@polyester/sdk 0.35.0-devnet-20261111025029 → 0.35.0-devnet-20261111140253
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 +43 -1
- package/dist/catalogs/index.d.ts +2 -2
- package/dist/catalogs/snapshot-validation.js +7 -3
- package/dist/catalogs/snapshot-validation.js.map +1 -1
- package/dist/gen/ai/v1/assistant_pb.d.ts +4164 -0
- package/dist/gen/ai/v1/assistant_pb.d.ts.map +1 -0
- package/dist/gen/ai/v1/assistant_pb.js +1174 -0
- package/dist/gen/ai/v1/assistant_pb.js.map +1 -0
- package/dist/gen/alerts/v1/price_alerts_pb.d.ts +776 -0
- package/dist/gen/alerts/v1/price_alerts_pb.d.ts.map +1 -0
- package/dist/gen/alerts/v1/price_alerts_pb.js +378 -0
- package/dist/gen/alerts/v1/price_alerts_pb.js.map +1 -0
- package/dist/gen/auth/v1/address_book_pb.d.ts +6 -0
- package/dist/gen/auth/v1/address_book_pb.d.ts.map +1 -1
- package/dist/gen/auth/v1/address_book_pb.js +6 -0
- package/dist/gen/auth/v1/address_book_pb.js.map +1 -1
- package/dist/gen/auth/v1/api_keys_pb.d.ts +247 -3
- package/dist/gen/auth/v1/api_keys_pb.d.ts.map +1 -1
- package/dist/gen/auth/v1/api_keys_pb.js +81 -2
- package/dist/gen/auth/v1/api_keys_pb.js.map +1 -1
- package/dist/gen/auth/v1/auth_pb.d.ts +55 -6
- package/dist/gen/auth/v1/auth_pb.d.ts.map +1 -1
- package/dist/gen/auth/v1/auth_pb.js +55 -6
- package/dist/gen/auth/v1/auth_pb.js.map +1 -1
- package/dist/gen/auth/v1/policies_pb.d.ts +186 -14
- package/dist/gen/auth/v1/policies_pb.d.ts.map +1 -1
- package/dist/gen/auth/v1/policies_pb.js +163 -6
- package/dist/gen/auth/v1/policies_pb.js.map +1 -1
- package/dist/gen/auth/v1/profile_pb.d.ts +4 -2
- package/dist/gen/auth/v1/profile_pb.d.ts.map +1 -1
- package/dist/gen/auth/v1/profile_pb.js.map +1 -1
- package/dist/gen/auth/v1/resolve_pb.d.ts +1 -0
- package/dist/gen/auth/v1/resolve_pb.d.ts.map +1 -1
- package/dist/gen/auth/v1/resolve_pb.js.map +1 -1
- package/dist/gen/auth/v1/social_verification_pb.d.ts +170 -11
- package/dist/gen/auth/v1/social_verification_pb.d.ts.map +1 -1
- package/dist/gen/auth/v1/social_verification_pb.js +41 -3
- package/dist/gen/auth/v1/social_verification_pb.js.map +1 -1
- package/dist/gen/auth/v1/subaccounts_pb.d.ts +25 -9
- package/dist/gen/auth/v1/subaccounts_pb.d.ts.map +1 -1
- package/dist/gen/auth/v1/subaccounts_pb.js.map +1 -1
- package/dist/gen/chain/deposit/v1/deposit_pb.d.ts +4 -2
- package/dist/gen/chain/deposit/v1/deposit_pb.d.ts.map +1 -1
- package/dist/gen/chain/deposit/v1/deposit_pb.js.map +1 -1
- package/dist/gen/chain/guard/v1/guard_signer_pb.d.ts +5 -0
- package/dist/gen/chain/guard/v1/guard_signer_pb.d.ts.map +1 -1
- package/dist/gen/chain/guard/v1/guard_signer_pb.js.map +1 -1
- package/dist/gen/chain/lifecycle/v1/lifecycle_read_pb.d.ts +10 -0
- package/dist/gen/chain/lifecycle/v1/lifecycle_read_pb.d.ts.map +1 -1
- package/dist/gen/chain/lifecycle/v1/lifecycle_read_pb.js +1 -1
- package/dist/gen/chain/lifecycle/v1/lifecycle_read_pb.js.map +1 -1
- package/dist/gen/chain/lifecycle/v1/types_pb.d.ts +32 -4
- package/dist/gen/chain/lifecycle/v1/types_pb.d.ts.map +1 -1
- package/dist/gen/chain/lifecycle/v1/types_pb.js +32 -4
- package/dist/gen/chain/lifecycle/v1/types_pb.js.map +1 -1
- package/dist/gen/chain/withdraw/v1/auto_withdraw_pb.d.ts +391 -42
- package/dist/gen/chain/withdraw/v1/auto_withdraw_pb.d.ts.map +1 -1
- package/dist/gen/chain/withdraw/v1/auto_withdraw_pb.js +103 -17
- package/dist/gen/chain/withdraw/v1/auto_withdraw_pb.js.map +1 -1
- package/dist/gen/chain/withdraw/v1/withdraw_pb.d.ts +172 -4
- package/dist/gen/chain/withdraw/v1/withdraw_pb.d.ts.map +1 -1
- package/dist/gen/chain/withdraw/v1/withdraw_pb.js +63 -2
- package/dist/gen/chain/withdraw/v1/withdraw_pb.js.map +1 -1
- package/dist/gen/chain/zipper/v1/zipper_pb.d.ts +57 -3
- package/dist/gen/chain/zipper/v1/zipper_pb.d.ts.map +1 -1
- package/dist/gen/chain/zipper/v1/zipper_pb.js +41 -3
- package/dist/gen/chain/zipper/v1/zipper_pb.js.map +1 -1
- package/dist/gen/checkpoints/v1/checkpoints_pb.d.ts +2 -1
- package/dist/gen/checkpoints/v1/checkpoints_pb.d.ts.map +1 -1
- package/dist/gen/checkpoints/v1/checkpoints_pb.js.map +1 -1
- package/dist/gen/claims/v1/claims_pb.d.ts +20 -3
- package/dist/gen/claims/v1/claims_pb.d.ts.map +1 -1
- package/dist/gen/claims/v1/claims_pb.js +12 -3
- package/dist/gen/claims/v1/claims_pb.js.map +1 -1
- package/dist/gen/index.d.ts +9 -5
- package/dist/gen/index.js +5 -1
- package/dist/gen/ledger/v1/catalog_pb.d.ts +52 -1
- package/dist/gen/ledger/v1/catalog_pb.d.ts.map +1 -1
- package/dist/gen/ledger/v1/catalog_pb.js +52 -1
- package/dist/gen/ledger/v1/catalog_pb.js.map +1 -1
- package/dist/gen/marketdata/v1/heatmap_pb.d.ts +6 -0
- package/dist/gen/marketdata/v1/heatmap_pb.d.ts.map +1 -1
- package/dist/gen/marketdata/v1/heatmap_pb.js.map +1 -1
- package/dist/gen/marketdata/v1/marketdata_pb.d.ts +8 -0
- package/dist/gen/marketdata/v1/marketdata_pb.d.ts.map +1 -1
- package/dist/gen/marketdata/v1/marketdata_pb.js +1 -1
- package/dist/gen/marketdata/v1/marketdata_pb.js.map +1 -1
- package/dist/gen/orders/v1/orders_pb.d.ts +29 -8
- package/dist/gen/orders/v1/orders_pb.d.ts.map +1 -1
- package/dist/gen/orders/v1/orders_pb.js +18 -5
- package/dist/gen/orders/v1/orders_pb.js.map +1 -1
- package/dist/gen/polyester/ratelimit/v1/types_pb.d.ts +20 -1
- package/dist/gen/polyester/ratelimit/v1/types_pb.d.ts.map +1 -1
- package/dist/gen/polyester/ratelimit/v1/types_pb.js +20 -1
- package/dist/gen/polyester/ratelimit/v1/types_pb.js.map +1 -1
- package/dist/gen/rewards/v1/rewards_pb.d.ts +74 -3
- package/dist/gen/rewards/v1/rewards_pb.d.ts.map +1 -1
- package/dist/gen/rewards/v1/rewards_pb.js +16 -4
- package/dist/gen/rewards/v1/rewards_pb.js.map +1 -1
- package/dist/gen/swap/quickswap/v1/quickswap_broker_pb.d.ts +1268 -67
- package/dist/gen/swap/quickswap/v1/quickswap_broker_pb.d.ts.map +1 -1
- package/dist/gen/swap/quickswap/v1/quickswap_broker_pb.js +306 -5
- package/dist/gen/swap/quickswap/v1/quickswap_broker_pb.js.map +1 -1
- package/dist/gen/swap/quickswap/v1/quickswap_pb.d.ts +298 -54
- package/dist/gen/swap/quickswap/v1/quickswap_pb.d.ts.map +1 -1
- package/dist/gen/swap/quickswap/v1/quickswap_pb.js +183 -37
- package/dist/gen/swap/quickswap/v1/quickswap_pb.js.map +1 -1
- package/dist/gen/swap/quickswap/v1/quickswap_referral_pb.d.ts +933 -0
- package/dist/gen/swap/quickswap/v1/quickswap_referral_pb.d.ts.map +1 -0
- package/dist/gen/swap/quickswap/v1/quickswap_referral_pb.js +292 -0
- package/dist/gen/swap/quickswap/v1/quickswap_referral_pb.js.map +1 -0
- package/dist/gen/system/v1/system_pb.d.ts +77 -0
- package/dist/gen/system/v1/system_pb.d.ts.map +1 -0
- package/dist/gen/system/v1/system_pb.js +34 -0
- package/dist/gen/system/v1/system_pb.js.map +1 -0
- package/dist/gen/tradews/v1/trade_ws_pb.d.ts +2 -2
- package/dist/gen/tradews/v1/trade_ws_pb.js.map +1 -1
- package/dist/gen/transfer/v1/internal_transfer_pb.d.ts +101 -2
- package/dist/gen/transfer/v1/internal_transfer_pb.d.ts.map +1 -1
- package/dist/gen/transfer/v1/internal_transfer_pb.js +14 -2
- package/dist/gen/transfer/v1/internal_transfer_pb.js.map +1 -1
- package/dist/gen/vip/v1/vip_pb.d.ts +1 -0
- package/dist/gen/vip/v1/vip_pb.d.ts.map +1 -1
- package/dist/gen/vip/v1/vip_pb.js.map +1 -1
- package/dist/index.d.ts +9 -9
- package/dist/index.js +2 -2
- package/dist/services/address-book/address-book.schemas.d.ts +2 -2
- package/dist/services/api-keys/api-keys.codecs.js +10 -1
- package/dist/services/api-keys/api-keys.codecs.js.map +1 -1
- package/dist/services/api-keys/api-keys.schemas.d.ts +4 -0
- package/dist/services/api-keys/api-keys.schemas.d.ts.map +1 -1
- package/dist/services/api-keys/api-keys.schemas.js +3 -1
- package/dist/services/api-keys/api-keys.schemas.js.map +1 -1
- package/dist/services/auto-withdraw/auto-withdraw.codecs.d.ts +9 -2
- package/dist/services/auto-withdraw/auto-withdraw.codecs.d.ts.map +1 -1
- package/dist/services/auto-withdraw/auto-withdraw.codecs.js +9 -1
- package/dist/services/auto-withdraw/auto-withdraw.codecs.js.map +1 -1
- package/dist/services/auto-withdraw/auto-withdraw.d.ts +15 -4
- package/dist/services/auto-withdraw/auto-withdraw.d.ts.map +1 -1
- package/dist/services/auto-withdraw/auto-withdraw.js +24 -8
- package/dist/services/auto-withdraw/auto-withdraw.js.map +1 -1
- package/dist/services/auto-withdraw/auto-withdraw.schemas.d.ts +375 -7
- package/dist/services/auto-withdraw/auto-withdraw.schemas.d.ts.map +1 -1
- package/dist/services/auto-withdraw/auto-withdraw.schemas.js +66 -11
- package/dist/services/auto-withdraw/auto-withdraw.schemas.js.map +1 -1
- package/dist/services/auto-withdraw/auto-withdraw.types.d.ts +3 -3
- package/dist/services/changelog/changelog.schemas.d.ts +17 -17
- package/dist/services/checkpoints/checkpoints.schemas.d.ts +2 -2
- package/dist/services/claims/claims.d.ts +5 -2
- package/dist/services/claims/claims.d.ts.map +1 -1
- package/dist/services/claims/claims.js +5 -2
- package/dist/services/claims/claims.js.map +1 -1
- package/dist/services/heatmap/heatmap.schemas.d.ts +4 -4
- package/dist/services/internal-transfers/internal-transfers.d.ts +13 -4
- package/dist/services/internal-transfers/internal-transfers.d.ts.map +1 -1
- package/dist/services/internal-transfers/internal-transfers.js +17 -3
- package/dist/services/internal-transfers/internal-transfers.js.map +1 -1
- package/dist/services/internal-transfers/internal-transfers.schemas.d.ts +59 -4
- package/dist/services/internal-transfers/internal-transfers.schemas.d.ts.map +1 -1
- package/dist/services/internal-transfers/internal-transfers.schemas.js +32 -2
- 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.codecs.d.ts +2 -2
- package/dist/services/lifecycle/lifecycle.codecs.d.ts.map +1 -1
- package/dist/services/lifecycle/lifecycle.codecs.js +3 -1
- package/dist/services/lifecycle/lifecycle.codecs.js.map +1 -1
- package/dist/services/lifecycle/lifecycle.schemas.d.ts +114 -90
- package/dist/services/lifecycle/lifecycle.schemas.d.ts.map +1 -1
- package/dist/services/lifecycle/lifecycle.schemas.js +7 -1
- package/dist/services/lifecycle/lifecycle.schemas.js.map +1 -1
- package/dist/services/market-data/market-data.schemas.js +7 -2
- package/dist/services/market-data/market-data.schemas.js.map +1 -1
- package/dist/services/orderbook/orderbook.schemas.d.ts +1 -1
- package/dist/services/orders/order-errors.schemas.d.ts +2 -2
- package/dist/services/orders/orders-batch.schemas.d.ts +54 -54
- package/dist/services/orders/orders-input.schemas.d.ts +7 -7
- package/dist/services/orders/orders-output.schemas.d.ts +19 -19
- package/dist/services/orders/orders.d.ts +2 -0
- package/dist/services/orders/orders.d.ts.map +1 -1
- package/dist/services/orders/orders.js +2 -0
- 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 +85 -3
- package/dist/services/policies/shared.codecs.js.map +1 -1
- package/dist/services/policies/shared.d.ts +1 -1
- package/dist/services/policies/shared.d.ts.map +1 -1
- package/dist/services/policies/shared.js +5 -14
- package/dist/services/policies/shared.js.map +1 -1
- package/dist/services/policies/subaccount-policies/subaccount-policies.schemas.d.ts +3 -3
- package/dist/services/policies/subaccount-policies/subaccount-policies.schemas.js +3 -3
- package/dist/services/policies/subaccount-policies/subaccount-policies.schemas.js.map +1 -1
- package/dist/services/rewards/rewards.d.ts +13 -3
- package/dist/services/rewards/rewards.d.ts.map +1 -1
- package/dist/services/rewards/rewards.js +17 -3
- package/dist/services/rewards/rewards.js.map +1 -1
- package/dist/services/rewards/rewards.schemas.d.ts +101 -4
- package/dist/services/rewards/rewards.schemas.d.ts.map +1 -1
- package/dist/services/rewards/rewards.schemas.js +12 -2
- package/dist/services/rewards/rewards.schemas.js.map +1 -1
- package/dist/services/rewards/rewards.types.d.ts +2 -2
- package/dist/services/social-verification/social-verification.codecs.js +13 -5
- package/dist/services/social-verification/social-verification.codecs.js.map +1 -1
- package/dist/services/social-verification/social-verification.d.ts +18 -3
- package/dist/services/social-verification/social-verification.d.ts.map +1 -1
- package/dist/services/social-verification/social-verification.js +26 -3
- package/dist/services/social-verification/social-verification.js.map +1 -1
- package/dist/services/social-verification/social-verification.schemas.d.ts +33 -7
- package/dist/services/social-verification/social-verification.schemas.d.ts.map +1 -1
- package/dist/services/social-verification/social-verification.schemas.js +35 -10
- package/dist/services/social-verification/social-verification.schemas.js.map +1 -1
- package/dist/services/social-verification/social-verification.types.d.ts +2 -2
- package/dist/services/subaccounts/subaccounts.schemas.d.ts +17 -17
- package/dist/services/trades/trades.schemas.d.ts +2 -2
- package/dist/services/trading-withdraws/trading-withdraws.d.ts +7 -1
- package/dist/services/trading-withdraws/trading-withdraws.d.ts.map +1 -1
- package/dist/services/trading-withdraws/trading-withdraws.js +11 -1
- package/dist/services/trading-withdraws/trading-withdraws.js.map +1 -1
- package/dist/services/trading-withdraws/trading-withdraws.schemas.d.ts +42 -1
- package/dist/services/trading-withdraws/trading-withdraws.schemas.d.ts.map +1 -1
- package/dist/services/trading-withdraws/trading-withdraws.schemas.js +19 -3
- package/dist/services/trading-withdraws/trading-withdraws.schemas.js.map +1 -1
- package/dist/services/trading-withdraws/trading-withdraws.types.d.ts +2 -2
- 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 +30 -30
- package/dist/services/zipper/zipper.schemas.d.ts +2 -2
- package/dist/services/zipper/zipper.schemas.d.ts.map +1 -1
- package/dist/services/zipper/zipper.schemas.js +13 -2
- 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 +18 -1
- package/dist/shared/catalog-config.d.ts.map +1 -1
- package/dist/shared/catalog-config.js +7 -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 +5 -1
- package/dist/shared/connect-error-mapping.js.map +1 -1
- package/dist/shared/error-detail.d.ts +8 -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/claims.js +7 -2
- package/dist/shared/error-details/claims.js.map +1 -1
- package/dist/shared/error-details/withdraw.js +11 -2
- package/dist/shared/error-details/withdraw.js.map +1 -1
- package/dist/shared/errors.d.ts +20 -3
- package/dist/shared/errors.d.ts.map +1 -1
- package/dist/shared/errors.js +17 -1
- package/dist/shared/errors.js.map +1 -1
- package/dist/shared/ledger-codes.d.ts +7 -1
- package/dist/shared/ledger-codes.d.ts.map +1 -1
- package/dist/shared/ledger-codes.js +27 -3
- package/dist/shared/ledger-codes.js.map +1 -1
- package/dist/shared/rate-limit.schemas.d.ts +2 -2
- package/dist/shared/rate-limit.schemas.d.ts.map +1 -1
- package/dist/shared/rate-limit.schemas.js +4 -1
- package/dist/shared/rate-limit.schemas.js.map +1 -1
- package/dist/shared/transports.d.ts +2 -1
- package/dist/shared/transports.d.ts.map +1 -1
- package/dist/shared/transports.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { parse } from "../../shared/validation.js";
|
|
2
2
|
import { toConnectCallOptions } from "../../shared/request-options.js";
|
|
3
3
|
import { RewardCampaignService } from "../../gen/rewards/v1/rewards_pb.js";
|
|
4
|
-
import { ListRewardAwardsInputSchema, ListRewardAwardsResultSchema, SetRewardDestinationInputSchema, SetRewardDestinationResultSchema } from "./rewards.schemas.js";
|
|
4
|
+
import { AcknowledgeRewardAwardInputSchema, AcknowledgeRewardAwardResultSchema, ListRewardAwardsInputSchema, ListRewardAwardsResultSchema, SetRewardDestinationInputSchema, SetRewardDestinationResultSchema } from "./rewards.schemas.js";
|
|
5
5
|
import { createClient } from "@connectrpc/connect";
|
|
6
6
|
//#region src/services/rewards/rewards.ts
|
|
7
7
|
/**
|
|
8
|
-
* Reads published reward campaign awards for the authenticated root account
|
|
9
|
-
*
|
|
8
|
+
* Reads published reward campaign awards for the authenticated root account, records payout
|
|
9
|
+
* destinations, and acknowledges seen awards. Every call accepts a session JWT. `listAwards` also
|
|
10
|
+
* accepts an API key scoped to the main account whose policy grants `read-rewards`.
|
|
10
11
|
*/
|
|
11
12
|
var RewardsService = class {
|
|
12
13
|
#client;
|
|
@@ -29,6 +30,19 @@ var RewardsService = class {
|
|
|
29
30
|
const response = await this.#client.setMyRewardDestination(request, toConnectCallOptions(options));
|
|
30
31
|
return parse(SetRewardDestinationResultSchema, response);
|
|
31
32
|
}
|
|
33
|
+
/**
|
|
34
|
+
* Records that the recipient revealed an award (`revealed: true`) or saw a paid award's
|
|
35
|
+
* delivery (`deliverySeen: true`), so other sessions and devices do not show the dialog again.
|
|
36
|
+
* Set at least one. Marks are independent, permanent and idempotent: the first timestamp is
|
|
37
|
+
* kept, `false` leaves a mark unchanged, and a failed call can be retried as is. `deliverySeen`
|
|
38
|
+
* on an award that is not paid fails the whole call with `PreconditionFailedError`. Returns the
|
|
39
|
+
* current award with its marks; fulfillment state and revision are unchanged. Session JWT only.
|
|
40
|
+
*/
|
|
41
|
+
async acknowledgeAward(input, options) {
|
|
42
|
+
const request = parse(AcknowledgeRewardAwardInputSchema, input);
|
|
43
|
+
const response = await this.#client.acknowledgeMyRewardAward(request, toConnectCallOptions(options));
|
|
44
|
+
return parse(AcknowledgeRewardAwardResultSchema, response);
|
|
45
|
+
}
|
|
32
46
|
};
|
|
33
47
|
//#endregion
|
|
34
48
|
export { RewardsService };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rewards.js","names":["#client","Proto.RewardCampaignService"],"sources":["../../../src/services/rewards/rewards.ts"],"sourcesContent":["import { createClient, type Client } from \"@connectrpc/connect\";\nimport * as Proto from \"../../gen/rewards/v1/rewards_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 ListRewardAwardsInputSchema,\n ListRewardAwardsResultSchema,\n type ListRewardAwardsInput,\n type ListRewardAwardsResult,\n SetRewardDestinationInputSchema,\n SetRewardDestinationResultSchema,\n type SetRewardDestinationInput,\n type SetRewardDestinationResult,\n} from \"./rewards.schemas.js\";\n\n/**\n * Reads published reward campaign awards for the authenticated root account
|
|
1
|
+
{"version":3,"file":"rewards.js","names":["#client","Proto.RewardCampaignService"],"sources":["../../../src/services/rewards/rewards.ts"],"sourcesContent":["import { createClient, type Client } from \"@connectrpc/connect\";\nimport * as Proto from \"../../gen/rewards/v1/rewards_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 AcknowledgeRewardAwardInputSchema,\n AcknowledgeRewardAwardResultSchema,\n type AcknowledgeRewardAwardInput,\n type AcknowledgeRewardAwardResult,\n ListRewardAwardsInputSchema,\n ListRewardAwardsResultSchema,\n type ListRewardAwardsInput,\n type ListRewardAwardsResult,\n SetRewardDestinationInputSchema,\n SetRewardDestinationResultSchema,\n type SetRewardDestinationInput,\n type SetRewardDestinationResult,\n} from \"./rewards.schemas.js\";\n\n/**\n * Reads published reward campaign awards for the authenticated root account, records payout\n * destinations, and acknowledges seen awards. Every call accepts a session JWT. `listAwards` also\n * accepts an API key scoped to the main account whose policy grants `read-rewards`.\n */\nexport class RewardsService {\n #client: Client<typeof Proto.RewardCampaignService>;\n\n constructor(transports: AuthApiTransports) {\n this.#client = createClient(Proto.RewardCampaignService, transports.authApi);\n }\n\n /**\n * Returns published awards newest first. `limit` is 0 through 100 (0 or omitted uses 50); pass the previous `nextPageToken` as `pageToken` to continue. An empty `nextPageToken` means no more awards. When `awardsMayChange` is false, polling cannot surface new awards or changes until a new campaign is created.\n */\n async listAwards(\n input: ListRewardAwardsInput = {},\n options?: PolyesterRequestOptions,\n ): Promise<ListRewardAwardsResult> {\n const request = parse(ListRewardAwardsInputSchema, input);\n const response = await this.#client.listMyRewardAwards(\n request,\n toConnectCallOptions(options),\n );\n return parse(ListRewardAwardsResultSchema, response);\n }\n\n /**\n * Records a write-once payout destination for an award, interpreted in the award's `network`. Pass the award's `fulfillmentRevision` as `expectedRevision` and reuse the same `requestId` when retrying. Requires a fresh step-up proof via `options.stepUpToken`. This does not execute a transfer or mark the award delivered.\n */\n async setDestination(\n input: SetRewardDestinationInput,\n options?: PolyesterMutationOptions,\n ): Promise<SetRewardDestinationResult> {\n const request = parse(SetRewardDestinationInputSchema, input);\n const response = await this.#client.setMyRewardDestination(\n request,\n toConnectCallOptions(options),\n );\n return parse(SetRewardDestinationResultSchema, response);\n }\n\n /**\n * Records that the recipient revealed an award (`revealed: true`) or saw a paid award's\n * delivery (`deliverySeen: true`), so other sessions and devices do not show the dialog again.\n * Set at least one. Marks are independent, permanent and idempotent: the first timestamp is\n * kept, `false` leaves a mark unchanged, and a failed call can be retried as is. `deliverySeen`\n * on an award that is not paid fails the whole call with `PreconditionFailedError`. Returns the\n * current award with its marks; fulfillment state and revision are unchanged. Session JWT only.\n */\n async acknowledgeAward(\n input: AcknowledgeRewardAwardInput,\n options?: PolyesterRequestOptions,\n ): Promise<AcknowledgeRewardAwardResult> {\n const request = parse(AcknowledgeRewardAwardInputSchema, input);\n const response = await this.#client.acknowledgeMyRewardAward(\n request,\n toConnectCallOptions(options),\n );\n return parse(AcknowledgeRewardAwardResultSchema, response);\n }\n}\n"],"mappings":";;;;;;;;;;;AA6BA,IAAa,iBAAb,MAA4B;CACxB;CAEA,YAAY,YAA+B;EACvC,KAAKA,UAAU,aAAaC,uBAA6B,WAAW,OAAO;CAC/E;;;;CAKA,MAAM,WACF,QAA+B,CAAC,GAChC,SAC+B;EAC/B,MAAM,UAAU,MAAM,6BAA6B,KAAK;EACxD,MAAM,WAAW,MAAM,KAAKD,QAAQ,mBAChC,SACA,qBAAqB,OAAO,CAChC;EACA,OAAO,MAAM,8BAA8B,QAAQ;CACvD;;;;CAKA,MAAM,eACF,OACA,SACmC;EACnC,MAAM,UAAU,MAAM,iCAAiC,KAAK;EAC5D,MAAM,WAAW,MAAM,KAAKA,QAAQ,uBAChC,SACA,qBAAqB,OAAO,CAChC;EACA,OAAO,MAAM,kCAAkC,QAAQ;CAC3D;;;;;;;;;CAUA,MAAM,iBACF,OACA,SACqC;EACrC,MAAM,UAAU,MAAM,mCAAmC,KAAK;EAC9D,MAAM,WAAW,MAAM,KAAKA,QAAQ,yBAChC,SACA,qBAAqB,OAAO,CAChC;EACA,OAAO,MAAM,oCAAoC,QAAQ;CAC7D;AACJ"}
|
|
@@ -12,6 +12,16 @@ declare const SetRewardDestinationInputSchema: v.StrictObjectSchema<{
|
|
|
12
12
|
readonly requestId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 128, undefined>]>;
|
|
13
13
|
}, undefined>;
|
|
14
14
|
type SetRewardDestinationInput = v.InferInput<typeof SetRewardDestinationInputSchema>;
|
|
15
|
+
declare const AcknowledgeRewardAwardInputSchema: v.SchemaWithPipe<readonly [v.StrictObjectSchema<{
|
|
16
|
+
readonly awardId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.UuidAction<string, undefined>]>;
|
|
17
|
+
readonly revealed: v.OptionalSchema<v.BooleanSchema<undefined>, false>;
|
|
18
|
+
readonly deliverySeen: v.OptionalSchema<v.BooleanSchema<undefined>, false>;
|
|
19
|
+
}, undefined>, v.CheckAction<{
|
|
20
|
+
awardId: string;
|
|
21
|
+
revealed: boolean;
|
|
22
|
+
deliverySeen: boolean;
|
|
23
|
+
}, "Set revealed or deliverySeen to true.">]>;
|
|
24
|
+
type AcknowledgeRewardAwardInput = v.InferInput<typeof AcknowledgeRewardAwardInputSchema>;
|
|
15
25
|
declare const RewardAwardSchema: v.ObjectSchema<{
|
|
16
26
|
readonly awardId: v.StringSchema<undefined>;
|
|
17
27
|
readonly campaignId: v.StringSchema<undefined>;
|
|
@@ -19,7 +29,7 @@ declare const RewardAwardSchema: v.ObjectSchema<{
|
|
|
19
29
|
readonly assetId: v.NumberSchema<undefined>;
|
|
20
30
|
readonly amountBaseUnits: v.StringSchema<undefined>;
|
|
21
31
|
readonly fulfillmentMethod: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "external_testnet" | "internal_trading">]>;
|
|
22
|
-
readonly fulfillmentState: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "
|
|
32
|
+
readonly fulfillmentState: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "failed" | "awaiting_destination" | "ready_for_payout" | "paid" | "canceled">]>;
|
|
23
33
|
readonly publishedAt: v.SchemaWithPipe<readonly [v.OptionalSchema<v.ObjectSchema<{
|
|
24
34
|
readonly seconds: v.BigintSchema<undefined>;
|
|
25
35
|
readonly nanos: v.OptionalSchema<v.NumberSchema<undefined>, 0>;
|
|
@@ -31,6 +41,22 @@ declare const RewardAwardSchema: v.ObjectSchema<{
|
|
|
31
41
|
readonly fulfillmentRevision: v.SchemaWithPipe<readonly [v.BigintSchema<undefined>, v.TransformAction<bigint, string>]>;
|
|
32
42
|
readonly destinationAddress: v.StringSchema<undefined>;
|
|
33
43
|
readonly transactionId: v.StringSchema<undefined>;
|
|
44
|
+
/** When the recipient first acknowledged revealing the award, in any session; absent until then. */
|
|
45
|
+
readonly revealedAt: v.SchemaWithPipe<readonly [v.OptionalSchema<v.ObjectSchema<{
|
|
46
|
+
readonly seconds: v.BigintSchema<undefined>;
|
|
47
|
+
readonly nanos: v.OptionalSchema<v.NumberSchema<undefined>, 0>;
|
|
48
|
+
}, undefined>, undefined>, v.TransformAction<{
|
|
49
|
+
seconds: bigint;
|
|
50
|
+
nanos: number;
|
|
51
|
+
} | undefined, number | undefined>]>;
|
|
52
|
+
/** When the recipient first acknowledged seeing the paid award's delivery; absent until then. */
|
|
53
|
+
readonly deliverySeenAt: v.SchemaWithPipe<readonly [v.OptionalSchema<v.ObjectSchema<{
|
|
54
|
+
readonly seconds: v.BigintSchema<undefined>;
|
|
55
|
+
readonly nanos: v.OptionalSchema<v.NumberSchema<undefined>, 0>;
|
|
56
|
+
}, undefined>, undefined>, v.TransformAction<{
|
|
57
|
+
seconds: bigint;
|
|
58
|
+
nanos: number;
|
|
59
|
+
} | undefined, number | undefined>]>;
|
|
34
60
|
}, undefined>;
|
|
35
61
|
type RewardAward = v.InferOutput<typeof RewardAwardSchema>;
|
|
36
62
|
declare const ListRewardAwardsResultSchema: v.ObjectSchema<{
|
|
@@ -41,7 +67,7 @@ declare const ListRewardAwardsResultSchema: v.ObjectSchema<{
|
|
|
41
67
|
readonly assetId: v.NumberSchema<undefined>;
|
|
42
68
|
readonly amountBaseUnits: v.StringSchema<undefined>;
|
|
43
69
|
readonly fulfillmentMethod: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "external_testnet" | "internal_trading">]>;
|
|
44
|
-
readonly fulfillmentState: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "
|
|
70
|
+
readonly fulfillmentState: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "failed" | "awaiting_destination" | "ready_for_payout" | "paid" | "canceled">]>;
|
|
45
71
|
readonly publishedAt: v.SchemaWithPipe<readonly [v.OptionalSchema<v.ObjectSchema<{
|
|
46
72
|
readonly seconds: v.BigintSchema<undefined>;
|
|
47
73
|
readonly nanos: v.OptionalSchema<v.NumberSchema<undefined>, 0>;
|
|
@@ -53,6 +79,22 @@ declare const ListRewardAwardsResultSchema: v.ObjectSchema<{
|
|
|
53
79
|
readonly fulfillmentRevision: v.SchemaWithPipe<readonly [v.BigintSchema<undefined>, v.TransformAction<bigint, string>]>;
|
|
54
80
|
readonly destinationAddress: v.StringSchema<undefined>;
|
|
55
81
|
readonly transactionId: v.StringSchema<undefined>;
|
|
82
|
+
/** When the recipient first acknowledged revealing the award, in any session; absent until then. */
|
|
83
|
+
readonly revealedAt: v.SchemaWithPipe<readonly [v.OptionalSchema<v.ObjectSchema<{
|
|
84
|
+
readonly seconds: v.BigintSchema<undefined>;
|
|
85
|
+
readonly nanos: v.OptionalSchema<v.NumberSchema<undefined>, 0>;
|
|
86
|
+
}, undefined>, undefined>, v.TransformAction<{
|
|
87
|
+
seconds: bigint;
|
|
88
|
+
nanos: number;
|
|
89
|
+
} | undefined, number | undefined>]>;
|
|
90
|
+
/** When the recipient first acknowledged seeing the paid award's delivery; absent until then. */
|
|
91
|
+
readonly deliverySeenAt: v.SchemaWithPipe<readonly [v.OptionalSchema<v.ObjectSchema<{
|
|
92
|
+
readonly seconds: v.BigintSchema<undefined>;
|
|
93
|
+
readonly nanos: v.OptionalSchema<v.NumberSchema<undefined>, 0>;
|
|
94
|
+
}, undefined>, undefined>, v.TransformAction<{
|
|
95
|
+
seconds: bigint;
|
|
96
|
+
nanos: number;
|
|
97
|
+
} | undefined, number | undefined>]>;
|
|
56
98
|
}, undefined>, undefined>, readonly []>;
|
|
57
99
|
readonly nextPageToken: v.StringSchema<undefined>;
|
|
58
100
|
/**
|
|
@@ -72,7 +114,7 @@ declare const SetRewardDestinationResultSchema: v.ObjectSchema<{
|
|
|
72
114
|
readonly assetId: v.NumberSchema<undefined>;
|
|
73
115
|
readonly amountBaseUnits: v.StringSchema<undefined>;
|
|
74
116
|
readonly fulfillmentMethod: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "external_testnet" | "internal_trading">]>;
|
|
75
|
-
readonly fulfillmentState: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "
|
|
117
|
+
readonly fulfillmentState: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "failed" | "awaiting_destination" | "ready_for_payout" | "paid" | "canceled">]>;
|
|
76
118
|
readonly publishedAt: v.SchemaWithPipe<readonly [v.OptionalSchema<v.ObjectSchema<{
|
|
77
119
|
readonly seconds: v.BigintSchema<undefined>;
|
|
78
120
|
readonly nanos: v.OptionalSchema<v.NumberSchema<undefined>, 0>;
|
|
@@ -84,9 +126,64 @@ declare const SetRewardDestinationResultSchema: v.ObjectSchema<{
|
|
|
84
126
|
readonly fulfillmentRevision: v.SchemaWithPipe<readonly [v.BigintSchema<undefined>, v.TransformAction<bigint, string>]>;
|
|
85
127
|
readonly destinationAddress: v.StringSchema<undefined>;
|
|
86
128
|
readonly transactionId: v.StringSchema<undefined>;
|
|
129
|
+
/** When the recipient first acknowledged revealing the award, in any session; absent until then. */
|
|
130
|
+
readonly revealedAt: v.SchemaWithPipe<readonly [v.OptionalSchema<v.ObjectSchema<{
|
|
131
|
+
readonly seconds: v.BigintSchema<undefined>;
|
|
132
|
+
readonly nanos: v.OptionalSchema<v.NumberSchema<undefined>, 0>;
|
|
133
|
+
}, undefined>, undefined>, v.TransformAction<{
|
|
134
|
+
seconds: bigint;
|
|
135
|
+
nanos: number;
|
|
136
|
+
} | undefined, number | undefined>]>;
|
|
137
|
+
/** When the recipient first acknowledged seeing the paid award's delivery; absent until then. */
|
|
138
|
+
readonly deliverySeenAt: v.SchemaWithPipe<readonly [v.OptionalSchema<v.ObjectSchema<{
|
|
139
|
+
readonly seconds: v.BigintSchema<undefined>;
|
|
140
|
+
readonly nanos: v.OptionalSchema<v.NumberSchema<undefined>, 0>;
|
|
141
|
+
}, undefined>, undefined>, v.TransformAction<{
|
|
142
|
+
seconds: bigint;
|
|
143
|
+
nanos: number;
|
|
144
|
+
} | undefined, number | undefined>]>;
|
|
87
145
|
}, undefined>;
|
|
88
146
|
}, undefined>;
|
|
89
147
|
type SetRewardDestinationResult = v.InferOutput<typeof SetRewardDestinationResultSchema>;
|
|
148
|
+
declare const AcknowledgeRewardAwardResultSchema: v.ObjectSchema<{
|
|
149
|
+
readonly award: v.ObjectSchema<{
|
|
150
|
+
readonly awardId: v.StringSchema<undefined>;
|
|
151
|
+
readonly campaignId: v.StringSchema<undefined>;
|
|
152
|
+
readonly campaignName: v.StringSchema<undefined>;
|
|
153
|
+
readonly assetId: v.NumberSchema<undefined>;
|
|
154
|
+
readonly amountBaseUnits: v.StringSchema<undefined>;
|
|
155
|
+
readonly fulfillmentMethod: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "external_testnet" | "internal_trading">]>;
|
|
156
|
+
readonly fulfillmentState: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "failed" | "awaiting_destination" | "ready_for_payout" | "paid" | "canceled">]>;
|
|
157
|
+
readonly publishedAt: v.SchemaWithPipe<readonly [v.OptionalSchema<v.ObjectSchema<{
|
|
158
|
+
readonly seconds: v.BigintSchema<undefined>;
|
|
159
|
+
readonly nanos: v.OptionalSchema<v.NumberSchema<undefined>, 0>;
|
|
160
|
+
}, undefined>, undefined>, v.TransformAction<{
|
|
161
|
+
seconds: bigint;
|
|
162
|
+
nanos: number;
|
|
163
|
+
} | undefined, number | undefined>]>;
|
|
164
|
+
readonly network: v.StringSchema<undefined>;
|
|
165
|
+
readonly fulfillmentRevision: v.SchemaWithPipe<readonly [v.BigintSchema<undefined>, v.TransformAction<bigint, string>]>;
|
|
166
|
+
readonly destinationAddress: v.StringSchema<undefined>;
|
|
167
|
+
readonly transactionId: v.StringSchema<undefined>;
|
|
168
|
+
/** When the recipient first acknowledged revealing the award, in any session; absent until then. */
|
|
169
|
+
readonly revealedAt: v.SchemaWithPipe<readonly [v.OptionalSchema<v.ObjectSchema<{
|
|
170
|
+
readonly seconds: v.BigintSchema<undefined>;
|
|
171
|
+
readonly nanos: v.OptionalSchema<v.NumberSchema<undefined>, 0>;
|
|
172
|
+
}, undefined>, undefined>, v.TransformAction<{
|
|
173
|
+
seconds: bigint;
|
|
174
|
+
nanos: number;
|
|
175
|
+
} | undefined, number | undefined>]>;
|
|
176
|
+
/** When the recipient first acknowledged seeing the paid award's delivery; absent until then. */
|
|
177
|
+
readonly deliverySeenAt: v.SchemaWithPipe<readonly [v.OptionalSchema<v.ObjectSchema<{
|
|
178
|
+
readonly seconds: v.BigintSchema<undefined>;
|
|
179
|
+
readonly nanos: v.OptionalSchema<v.NumberSchema<undefined>, 0>;
|
|
180
|
+
}, undefined>, undefined>, v.TransformAction<{
|
|
181
|
+
seconds: bigint;
|
|
182
|
+
nanos: number;
|
|
183
|
+
} | undefined, number | undefined>]>;
|
|
184
|
+
}, undefined>;
|
|
185
|
+
}, undefined>;
|
|
186
|
+
type AcknowledgeRewardAwardResult = v.InferOutput<typeof AcknowledgeRewardAwardResultSchema>;
|
|
90
187
|
//#endregion
|
|
91
|
-
export { ListRewardAwardsInput, ListRewardAwardsInputSchema, ListRewardAwardsResult, ListRewardAwardsResultSchema, RewardAward, RewardAwardSchema, SetRewardDestinationInput, SetRewardDestinationInputSchema, SetRewardDestinationResult, SetRewardDestinationResultSchema };
|
|
188
|
+
export { AcknowledgeRewardAwardInput, AcknowledgeRewardAwardInputSchema, AcknowledgeRewardAwardResult, AcknowledgeRewardAwardResultSchema, ListRewardAwardsInput, ListRewardAwardsInputSchema, ListRewardAwardsResult, ListRewardAwardsResultSchema, RewardAward, RewardAwardSchema, SetRewardDestinationInput, SetRewardDestinationInputSchema, SetRewardDestinationResult, SetRewardDestinationResultSchema };
|
|
92
189
|
//# sourceMappingURL=rewards.schemas.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rewards.schemas.d.ts","names":[],"sources":["../../../src/services/rewards/rewards.schemas.ts"],"mappings":";;cASa,6BAA2B,EAAA;;;;KAK5B,wBAAwB,EAAE,kBAAkB;cAE3C,iCAA+B,EAAA;;;;;;KAOhC,4BAA4B,EAAE,kBAAkB;cAE/C,mBAAiB,EAAA
|
|
1
|
+
{"version":3,"file":"rewards.schemas.d.ts","names":[],"sources":["../../../src/services/rewards/rewards.schemas.ts"],"mappings":";;cASa,6BAA2B,EAAA;;;;KAK5B,wBAAwB,EAAE,kBAAkB;cAE3C,iCAA+B,EAAA;;;;;;KAOhC,4BAA4B,EAAE,kBAAkB;cAE/C,mCAAiC,EAAA,yBAAA,EAAA;;;;;;;;;KAYlC,8BAA8B,EAAE,kBAAkB;cAEjD,mBAAiB,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAmBlB,cAAc,EAAE,mBAAmB;cAElC,8BAA4B,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAY7B,yBAAyB,EAAE,mBAAmB;cAE7C,kCAAgC,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAIjC,6BAA6B,EAAE,mBAAmB;cAEjD,oCAAkC,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAInC,+BAA+B,EAAE,mBAAmB"}
|
|
@@ -13,6 +13,11 @@ const SetRewardDestinationInputSchema = v.strictObject({
|
|
|
13
13
|
expectedRevision: positiveBigintStringInputSchema("expectedRevision"),
|
|
14
14
|
requestId: v.pipe(v.string(), v.trim(), v.minLength(1), v.maxLength(128))
|
|
15
15
|
});
|
|
16
|
+
const AcknowledgeRewardAwardInputSchema = v.pipe(v.strictObject({
|
|
17
|
+
awardId: v.pipe(v.string(), v.trim(), v.uuid()),
|
|
18
|
+
revealed: v.optional(v.boolean(), false),
|
|
19
|
+
deliverySeen: v.optional(v.boolean(), false)
|
|
20
|
+
}), v.check(({ revealed, deliverySeen }) => revealed || deliverySeen, "Set revealed or deliverySeen to true."));
|
|
16
21
|
const RewardAwardSchema = v.object({
|
|
17
22
|
awardId: v.string(),
|
|
18
23
|
campaignId: v.string(),
|
|
@@ -25,7 +30,11 @@ const RewardAwardSchema = v.object({
|
|
|
25
30
|
network: v.string(),
|
|
26
31
|
fulfillmentRevision: BigIntStringSchema,
|
|
27
32
|
destinationAddress: v.string(),
|
|
28
|
-
transactionId: v.string()
|
|
33
|
+
transactionId: v.string(),
|
|
34
|
+
/** When the recipient first acknowledged revealing the award, in any session; absent until then. */
|
|
35
|
+
revealedAt: OptionalTimestampMsSchema,
|
|
36
|
+
/** When the recipient first acknowledged seeing the paid award's delivery; absent until then. */
|
|
37
|
+
deliverySeenAt: OptionalTimestampMsSchema
|
|
29
38
|
});
|
|
30
39
|
const ListRewardAwardsResultSchema = v.object({
|
|
31
40
|
awards: v.optional(v.array(RewardAwardSchema), []),
|
|
@@ -39,7 +48,8 @@ const ListRewardAwardsResultSchema = v.object({
|
|
|
39
48
|
awardsMayChange: v.boolean()
|
|
40
49
|
});
|
|
41
50
|
const SetRewardDestinationResultSchema = v.object({ award: RewardAwardSchema });
|
|
51
|
+
const AcknowledgeRewardAwardResultSchema = v.object({ award: RewardAwardSchema });
|
|
42
52
|
//#endregion
|
|
43
|
-
export { ListRewardAwardsInputSchema, ListRewardAwardsResultSchema, RewardAwardSchema, SetRewardDestinationInputSchema, SetRewardDestinationResultSchema };
|
|
53
|
+
export { AcknowledgeRewardAwardInputSchema, AcknowledgeRewardAwardResultSchema, ListRewardAwardsInputSchema, ListRewardAwardsResultSchema, RewardAwardSchema, SetRewardDestinationInputSchema, SetRewardDestinationResultSchema };
|
|
44
54
|
|
|
45
55
|
//# sourceMappingURL=rewards.schemas.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rewards.schemas.js","names":[],"sources":["../../../src/services/rewards/rewards.schemas.ts"],"sourcesContent":["import * as v from \"valibot\";\nimport { enumLabelSchema } from \"../../shared/proto-enum-codec.js\";\nimport {\n BigIntStringSchema,\n OptionalTimestampMsSchema,\n positiveBigintStringInputSchema,\n} from \"../../shared/schemas.js\";\nimport { RewardFulfillmentMethodCodec, RewardFulfillmentStateCodec } from \"./rewards.codecs.js\";\n\nexport const ListRewardAwardsInputSchema = v.strictObject({\n limit: v.optional(v.pipe(v.number(), v.integer(), v.minValue(0), v.maxValue(100))),\n pageToken: v.optional(v.pipe(v.string(), v.trim(), v.maxLength(256)), \"\"),\n});\n\nexport type ListRewardAwardsInput = v.InferInput<typeof ListRewardAwardsInputSchema>;\n\nexport const SetRewardDestinationInputSchema = v.strictObject({\n awardId: v.pipe(v.string(), v.trim(), v.minLength(1), v.maxLength(128)),\n destinationAddress: v.pipe(v.string(), v.trim(), v.minLength(1), v.maxLength(512)),\n expectedRevision: positiveBigintStringInputSchema(\"expectedRevision\"),\n requestId: v.pipe(v.string(), v.trim(), v.minLength(1), v.maxLength(128)),\n});\n\nexport type SetRewardDestinationInput = v.InferInput<typeof SetRewardDestinationInputSchema>;\n\nexport const RewardAwardSchema = v.object({\n awardId: v.string(),\n campaignId: v.string(),\n campaignName: v.string(),\n assetId: v.number(),\n amountBaseUnits: v.string(),\n fulfillmentMethod: enumLabelSchema(RewardFulfillmentMethodCodec.protoToOutput),\n fulfillmentState: enumLabelSchema(RewardFulfillmentStateCodec.protoToOutput),\n publishedAt: OptionalTimestampMsSchema,\n network: v.string(),\n fulfillmentRevision: BigIntStringSchema,\n destinationAddress: v.string(),\n transactionId: v.string(),\n});\n\nexport type RewardAward = v.InferOutput<typeof RewardAwardSchema>;\n\nexport const ListRewardAwardsResultSchema = v.object({\n awards: v.optional(v.array(RewardAwardSchema), []),\n nextPageToken: v.string(),\n /**\n * True while a campaign can still publish awards or one of this account's awards is awaiting\n * a destination, ready for payout, or failed and retryable. When false, polling cannot return\n * new awards or award changes until a new campaign is created, so check again on the next\n * page load or focus instead.\n */\n awardsMayChange: v.boolean(),\n});\n\nexport type ListRewardAwardsResult = v.InferOutput<typeof ListRewardAwardsResultSchema>;\n\nexport const SetRewardDestinationResultSchema = v.object({\n award: RewardAwardSchema,\n});\n\nexport type SetRewardDestinationResult = v.InferOutput<typeof SetRewardDestinationResultSchema>;\n"],"mappings":";;;;;AASA,MAAa,8BAA8B,EAAE,aAAa;CACtD,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,GAAG,EAAE,QAAQ,GAAG,EAAE,SAAS,CAAC,GAAG,EAAE,SAAS,GAAG,CAAC,CAAC;CACjF,WAAW,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,GAAG,EAAE,KAAK,GAAG,EAAE,UAAU,GAAG,CAAC,GAAG,EAAE;AAC5E,CAAC;AAID,MAAa,kCAAkC,EAAE,aAAa;CAC1D,SAAS,EAAE,KAAK,EAAE,OAAO,GAAG,EAAE,KAAK,GAAG,EAAE,UAAU,CAAC,GAAG,EAAE,UAAU,GAAG,CAAC;CACtE,oBAAoB,EAAE,KAAK,EAAE,OAAO,GAAG,EAAE,KAAK,GAAG,EAAE,UAAU,CAAC,GAAG,EAAE,UAAU,GAAG,CAAC;CACjF,kBAAkB,gCAAgC,kBAAkB;CACpE,WAAW,EAAE,KAAK,EAAE,OAAO,GAAG,EAAE,KAAK,GAAG,EAAE,UAAU,CAAC,GAAG,EAAE,UAAU,GAAG,CAAC;AAC5E,CAAC;AAID,MAAa,oBAAoB,EAAE,OAAO;CACtC,SAAS,EAAE,OAAO;CAClB,YAAY,EAAE,OAAO;CACrB,cAAc,EAAE,OAAO;CACvB,SAAS,EAAE,OAAO;CAClB,iBAAiB,EAAE,OAAO;CAC1B,mBAAmB,gBAAgB,6BAA6B,aAAa;CAC7E,kBAAkB,gBAAgB,4BAA4B,aAAa;CAC3E,aAAa;CACb,SAAS,EAAE,OAAO;CAClB,qBAAqB;CACrB,oBAAoB,EAAE,OAAO;CAC7B,eAAe,EAAE,OAAO;
|
|
1
|
+
{"version":3,"file":"rewards.schemas.js","names":[],"sources":["../../../src/services/rewards/rewards.schemas.ts"],"sourcesContent":["import * as v from \"valibot\";\nimport { enumLabelSchema } from \"../../shared/proto-enum-codec.js\";\nimport {\n BigIntStringSchema,\n OptionalTimestampMsSchema,\n positiveBigintStringInputSchema,\n} from \"../../shared/schemas.js\";\nimport { RewardFulfillmentMethodCodec, RewardFulfillmentStateCodec } from \"./rewards.codecs.js\";\n\nexport const ListRewardAwardsInputSchema = v.strictObject({\n limit: v.optional(v.pipe(v.number(), v.integer(), v.minValue(0), v.maxValue(100))),\n pageToken: v.optional(v.pipe(v.string(), v.trim(), v.maxLength(256)), \"\"),\n});\n\nexport type ListRewardAwardsInput = v.InferInput<typeof ListRewardAwardsInputSchema>;\n\nexport const SetRewardDestinationInputSchema = v.strictObject({\n awardId: v.pipe(v.string(), v.trim(), v.minLength(1), v.maxLength(128)),\n destinationAddress: v.pipe(v.string(), v.trim(), v.minLength(1), v.maxLength(512)),\n expectedRevision: positiveBigintStringInputSchema(\"expectedRevision\"),\n requestId: v.pipe(v.string(), v.trim(), v.minLength(1), v.maxLength(128)),\n});\n\nexport type SetRewardDestinationInput = v.InferInput<typeof SetRewardDestinationInputSchema>;\n\nexport const AcknowledgeRewardAwardInputSchema = v.pipe(\n v.strictObject({\n awardId: v.pipe(v.string(), v.trim(), v.uuid()),\n revealed: v.optional(v.boolean(), false),\n deliverySeen: v.optional(v.boolean(), false),\n }),\n v.check(\n ({ revealed, deliverySeen }) => revealed || deliverySeen,\n \"Set revealed or deliverySeen to true.\",\n ),\n);\n\nexport type AcknowledgeRewardAwardInput = v.InferInput<typeof AcknowledgeRewardAwardInputSchema>;\n\nexport const RewardAwardSchema = v.object({\n awardId: v.string(),\n campaignId: v.string(),\n campaignName: v.string(),\n assetId: v.number(),\n amountBaseUnits: v.string(),\n fulfillmentMethod: enumLabelSchema(RewardFulfillmentMethodCodec.protoToOutput),\n fulfillmentState: enumLabelSchema(RewardFulfillmentStateCodec.protoToOutput),\n publishedAt: OptionalTimestampMsSchema,\n network: v.string(),\n fulfillmentRevision: BigIntStringSchema,\n destinationAddress: v.string(),\n transactionId: v.string(),\n /** When the recipient first acknowledged revealing the award, in any session; absent until then. */\n revealedAt: OptionalTimestampMsSchema,\n /** When the recipient first acknowledged seeing the paid award's delivery; absent until then. */\n deliverySeenAt: OptionalTimestampMsSchema,\n});\n\nexport type RewardAward = v.InferOutput<typeof RewardAwardSchema>;\n\nexport const ListRewardAwardsResultSchema = v.object({\n awards: v.optional(v.array(RewardAwardSchema), []),\n nextPageToken: v.string(),\n /**\n * True while a campaign can still publish awards or one of this account's awards is awaiting\n * a destination, ready for payout, or failed and retryable. When false, polling cannot return\n * new awards or award changes until a new campaign is created, so check again on the next\n * page load or focus instead.\n */\n awardsMayChange: v.boolean(),\n});\n\nexport type ListRewardAwardsResult = v.InferOutput<typeof ListRewardAwardsResultSchema>;\n\nexport const SetRewardDestinationResultSchema = v.object({\n award: RewardAwardSchema,\n});\n\nexport type SetRewardDestinationResult = v.InferOutput<typeof SetRewardDestinationResultSchema>;\n\nexport const AcknowledgeRewardAwardResultSchema = v.object({\n award: RewardAwardSchema,\n});\n\nexport type AcknowledgeRewardAwardResult = v.InferOutput<typeof AcknowledgeRewardAwardResultSchema>;\n"],"mappings":";;;;;AASA,MAAa,8BAA8B,EAAE,aAAa;CACtD,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,GAAG,EAAE,QAAQ,GAAG,EAAE,SAAS,CAAC,GAAG,EAAE,SAAS,GAAG,CAAC,CAAC;CACjF,WAAW,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,GAAG,EAAE,KAAK,GAAG,EAAE,UAAU,GAAG,CAAC,GAAG,EAAE;AAC5E,CAAC;AAID,MAAa,kCAAkC,EAAE,aAAa;CAC1D,SAAS,EAAE,KAAK,EAAE,OAAO,GAAG,EAAE,KAAK,GAAG,EAAE,UAAU,CAAC,GAAG,EAAE,UAAU,GAAG,CAAC;CACtE,oBAAoB,EAAE,KAAK,EAAE,OAAO,GAAG,EAAE,KAAK,GAAG,EAAE,UAAU,CAAC,GAAG,EAAE,UAAU,GAAG,CAAC;CACjF,kBAAkB,gCAAgC,kBAAkB;CACpE,WAAW,EAAE,KAAK,EAAE,OAAO,GAAG,EAAE,KAAK,GAAG,EAAE,UAAU,CAAC,GAAG,EAAE,UAAU,GAAG,CAAC;AAC5E,CAAC;AAID,MAAa,oCAAoC,EAAE,KAC/C,EAAE,aAAa;CACX,SAAS,EAAE,KAAK,EAAE,OAAO,GAAG,EAAE,KAAK,GAAG,EAAE,KAAK,CAAC;CAC9C,UAAU,EAAE,SAAS,EAAE,QAAQ,GAAG,KAAK;CACvC,cAAc,EAAE,SAAS,EAAE,QAAQ,GAAG,KAAK;AAC/C,CAAC,GACD,EAAE,OACG,EAAE,UAAU,mBAAmB,YAAY,cAC5C,uCACJ,CACJ;AAIA,MAAa,oBAAoB,EAAE,OAAO;CACtC,SAAS,EAAE,OAAO;CAClB,YAAY,EAAE,OAAO;CACrB,cAAc,EAAE,OAAO;CACvB,SAAS,EAAE,OAAO;CAClB,iBAAiB,EAAE,OAAO;CAC1B,mBAAmB,gBAAgB,6BAA6B,aAAa;CAC7E,kBAAkB,gBAAgB,4BAA4B,aAAa;CAC3E,aAAa;CACb,SAAS,EAAE,OAAO;CAClB,qBAAqB;CACrB,oBAAoB,EAAE,OAAO;CAC7B,eAAe,EAAE,OAAO;;CAExB,YAAY;;CAEZ,gBAAgB;AACpB,CAAC;AAID,MAAa,+BAA+B,EAAE,OAAO;CACjD,QAAQ,EAAE,SAAS,EAAE,MAAM,iBAAiB,GAAG,CAAC,CAAC;CACjD,eAAe,EAAE,OAAO;;;;;;;CAOxB,iBAAiB,EAAE,QAAQ;AAC/B,CAAC;AAID,MAAa,mCAAmC,EAAE,OAAO,EACrD,OAAO,kBACX,CAAC;AAID,MAAa,qCAAqC,EAAE,OAAO,EACvD,OAAO,kBACX,CAAC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { ListRewardAwardsInput, ListRewardAwardsResult, RewardAward, SetRewardDestinationInput, SetRewardDestinationResult } from "./rewards.schemas.js";
|
|
1
|
+
import { AcknowledgeRewardAwardInput, AcknowledgeRewardAwardResult, ListRewardAwardsInput, ListRewardAwardsResult, RewardAward, SetRewardDestinationInput, SetRewardDestinationResult } from "./rewards.schemas.js";
|
|
2
2
|
import { RewardFulfillmentMethod, RewardFulfillmentState } from "./rewards.codecs.js";
|
|
3
|
-
export type { ListRewardAwardsInput, ListRewardAwardsResult, RewardAward, RewardFulfillmentMethod, RewardFulfillmentState, SetRewardDestinationInput, SetRewardDestinationResult };
|
|
3
|
+
export type { AcknowledgeRewardAwardInput, AcknowledgeRewardAwardResult, ListRewardAwardsInput, ListRewardAwardsResult, RewardAward, RewardFulfillmentMethod, RewardFulfillmentState, SetRewardDestinationInput, SetRewardDestinationResult };
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import "../../gen/auth/v1/auth_pb.js";
|
|
2
2
|
import "../../gen/auth/v1/social_verification_pb.js";
|
|
3
3
|
//#region src/services/social-verification/social-verification.codecs.ts
|
|
4
|
-
const SOCIAL_PROVIDER_VALUES = [
|
|
4
|
+
const SOCIAL_PROVIDER_VALUES = [
|
|
5
|
+
"twitter",
|
|
6
|
+
"discord",
|
|
7
|
+
"telegram"
|
|
8
|
+
];
|
|
5
9
|
const SOCIAL_VERIFICATION_METHOD_VALUES = [
|
|
6
10
|
"profile",
|
|
7
11
|
"channel",
|
|
@@ -14,17 +18,20 @@ const SOCIAL_VERIFICATION_STATUS_VALUES = [
|
|
|
14
18
|
"verified",
|
|
15
19
|
"failed",
|
|
16
20
|
"expired",
|
|
17
|
-
"canceled"
|
|
21
|
+
"canceled",
|
|
22
|
+
"awaiting_confirmation"
|
|
18
23
|
];
|
|
19
24
|
const SocialProviderCodec = {
|
|
20
25
|
inputToProto: {
|
|
21
26
|
twitter: 1,
|
|
22
|
-
discord: 2
|
|
27
|
+
discord: 2,
|
|
28
|
+
telegram: 3
|
|
23
29
|
},
|
|
24
30
|
protoToOutput: {
|
|
25
31
|
[0]: "unspecified",
|
|
26
32
|
[1]: "twitter",
|
|
27
|
-
[2]: "discord"
|
|
33
|
+
[2]: "discord",
|
|
34
|
+
[3]: "telegram"
|
|
28
35
|
}
|
|
29
36
|
};
|
|
30
37
|
const SocialVerificationMethodCodec = {
|
|
@@ -48,7 +55,8 @@ const SocialVerificationStatusCodec = { protoToOutput: {
|
|
|
48
55
|
[4]: "verified",
|
|
49
56
|
[5]: "failed",
|
|
50
57
|
[6]: "expired",
|
|
51
|
-
[7]: "canceled"
|
|
58
|
+
[7]: "canceled",
|
|
59
|
+
[8]: "awaiting_confirmation"
|
|
52
60
|
} };
|
|
53
61
|
const SOCIAL_VERIFICATION_ERROR_CODE_VALUES = [
|
|
54
62
|
"username_invalid",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"social-verification.codecs.js","names":[],"sources":["../../../src/services/social-verification/social-verification.codecs.ts"],"sourcesContent":["import { AuthErrorCode } from \"../../gen/auth/v1/auth_pb.js\";\nimport * as Proto from \"../../gen/auth/v1/social_verification_pb.js\";\nimport type { InputToProto, ProtoToOutput } from \"../../utils/types.js\";\n\nexport const SOCIAL_PROVIDER_VALUES = [\"twitter\", \"discord\"] as const;\nexport type SocialProviderValue = (typeof SOCIAL_PROVIDER_VALUES)[number];\n\nexport const SOCIAL_VERIFICATION_METHOD_VALUES = [\"profile\", \"channel\", \"dm\"] as const;\nexport type SocialVerificationMethodValue = (typeof SOCIAL_VERIFICATION_METHOD_VALUES)[number];\n\nexport const SOCIAL_VERIFICATION_STATUS_VALUES = [\n \"pending_user_action\",\n \"queued\",\n \"in_progress\",\n \"verified\",\n \"failed\",\n \"expired\",\n \"canceled\",\n] as const;\nexport type SocialVerificationStatusValue = (typeof SOCIAL_VERIFICATION_STATUS_VALUES)[number];\n\nexport const SocialProviderCodec = {\n inputToProto: {\n twitter: Proto.SocialProvider.TWITTER,\n discord: Proto.SocialProvider.DISCORD,\n } satisfies InputToProto<SocialProviderValue, Proto.SocialProvider>,\n protoToOutput: {\n [Proto.SocialProvider.PROVIDER_UNSPECIFIED]: \"unspecified\",\n [Proto.SocialProvider.TWITTER]: \"twitter\",\n [Proto.SocialProvider.DISCORD]: \"discord\",\n } satisfies ProtoToOutput<Proto.SocialProvider, SocialProviderValue>,\n} as const;\n\nexport const SocialVerificationMethodCodec = {\n inputToProto: {\n profile: Proto.SocialVerificationMethod.METHOD_PROFILE,\n channel: Proto.SocialVerificationMethod.METHOD_CHANNEL,\n dm: Proto.SocialVerificationMethod.METHOD_DM,\n } satisfies InputToProto<SocialVerificationMethodValue, Proto.SocialVerificationMethod>,\n protoToOutput: {\n [Proto.SocialVerificationMethod.METHOD_UNSPECIFIED]: \"unspecified\",\n [Proto.SocialVerificationMethod.METHOD_PROFILE]: \"profile\",\n [Proto.SocialVerificationMethod.METHOD_CHANNEL]: \"channel\",\n [Proto.SocialVerificationMethod.METHOD_DM]: \"dm\",\n } satisfies ProtoToOutput<Proto.SocialVerificationMethod, SocialVerificationMethodValue>,\n} as const;\n\nexport const SocialVerificationStatusCodec = {\n protoToOutput: {\n [Proto.SocialVerificationStatus.STATUS_UNSPECIFIED]: \"unspecified\",\n [Proto.SocialVerificationStatus.STATUS_PENDING_USER_ACTION]: \"pending_user_action\",\n [Proto.SocialVerificationStatus.STATUS_QUEUED]: \"queued\",\n [Proto.SocialVerificationStatus.STATUS_IN_PROGRESS]: \"in_progress\",\n [Proto.SocialVerificationStatus.STATUS_VERIFIED]: \"verified\",\n [Proto.SocialVerificationStatus.STATUS_FAILED]: \"failed\",\n [Proto.SocialVerificationStatus.STATUS_EXPIRED]: \"expired\",\n [Proto.SocialVerificationStatus.STATUS_CANCELLED]: \"canceled\",\n } satisfies ProtoToOutput<Proto.SocialVerificationStatus, SocialVerificationStatusValue>,\n} as const;\n\nexport const SOCIAL_VERIFICATION_ERROR_CODE_VALUES = [\n \"username_invalid\",\n \"username_taken\",\n \"username_cooldown\",\n \"username_feature_locked\",\n \"username_reserved\",\n \"invalid_request\",\n \"authentication_required\",\n \"session_kind_not_allowed\",\n \"wallet_login_failed\",\n \"resource_not_found\",\n \"subaccount_access_denied\",\n \"api_key_access_denied\",\n \"api_key_invalid_status_transition\",\n \"policy_invalid\",\n \"smart_account_already_linked\",\n \"invite_access_denied\",\n \"invite_invalid_state\",\n \"mfa_disabled\",\n \"mfa_not_enrolled\",\n \"mfa_session_invalid\",\n \"mfa_challenge_not_found\",\n \"mfa_challenge_invalid\",\n \"mfa_challenge_locked\",\n \"mfa_otp_invalid\",\n \"mfa_recovery_invalid\",\n \"mfa_passkey_not_available\",\n \"mfa_passkey_credential_invalid\",\n \"mfa_passkey_verify_failed\",\n \"mfa_enrollment_binding_invalid\",\n \"step_up_required\",\n \"step_up_proof_unavailable\",\n \"step_up_already_claimed\",\n \"policy_in_use\",\n \"policy_locked\",\n \"policy_scope_mismatch\",\n \"revision_conflict\",\n \"mfa_elevation_required\",\n \"mfa_last_factor_required\",\n \"internal_error\",\n \"terms_not_accepted\",\n \"social_verification_expired\",\n \"social_verification_invalid_state\",\n \"subaccount_challenge_invalid\",\n \"social_account_already_linked\",\n] as const;\nexport type SocialVerificationErrorCodeValue =\n (typeof SOCIAL_VERIFICATION_ERROR_CODE_VALUES)[number];\n\n// Partial: auth codes added upstream decode to \"unspecified\" until mapped here.\nexport const SocialVerificationErrorCodeCodec = {\n protoToOutput: {\n [AuthErrorCode.AUTH_UNSPECIFIED]: \"unspecified\",\n [AuthErrorCode.AUTH_USERNAME_INVALID]: \"username_invalid\",\n [AuthErrorCode.AUTH_USERNAME_TAKEN]: \"username_taken\",\n [AuthErrorCode.AUTH_USERNAME_COOLDOWN]: \"username_cooldown\",\n [AuthErrorCode.AUTH_USERNAME_FEATURE_LOCKED]: \"username_feature_locked\",\n [AuthErrorCode.AUTH_USERNAME_RESERVED]: \"username_reserved\",\n [AuthErrorCode.AUTH_INVALID_REQUEST]: \"invalid_request\",\n [AuthErrorCode.AUTH_AUTHENTICATION_REQUIRED]: \"authentication_required\",\n [AuthErrorCode.AUTH_SESSION_KIND_NOT_ALLOWED]: \"session_kind_not_allowed\",\n [AuthErrorCode.AUTH_WALLET_LOGIN_FAILED]: \"wallet_login_failed\",\n [AuthErrorCode.AUTH_RESOURCE_NOT_FOUND]: \"resource_not_found\",\n [AuthErrorCode.AUTH_SUBACCOUNT_ACCESS_DENIED]: \"subaccount_access_denied\",\n [AuthErrorCode.AUTH_API_KEY_ACCESS_DENIED]: \"api_key_access_denied\",\n [AuthErrorCode.AUTH_API_KEY_INVALID_STATUS_TRANSITION]: \"api_key_invalid_status_transition\",\n [AuthErrorCode.AUTH_POLICY_INVALID]: \"policy_invalid\",\n [AuthErrorCode.AUTH_SMART_ACCOUNT_ALREADY_LINKED]: \"smart_account_already_linked\",\n [AuthErrorCode.AUTH_INVITE_ACCESS_DENIED]: \"invite_access_denied\",\n [AuthErrorCode.AUTH_INVITE_INVALID_STATE]: \"invite_invalid_state\",\n [AuthErrorCode.AUTH_MFA_DISABLED]: \"mfa_disabled\",\n [AuthErrorCode.AUTH_MFA_NOT_ENROLLED]: \"mfa_not_enrolled\",\n [AuthErrorCode.AUTH_MFA_SESSION_INVALID]: \"mfa_session_invalid\",\n [AuthErrorCode.AUTH_MFA_CHALLENGE_NOT_FOUND]: \"mfa_challenge_not_found\",\n [AuthErrorCode.AUTH_MFA_CHALLENGE_INVALID]: \"mfa_challenge_invalid\",\n [AuthErrorCode.AUTH_MFA_CHALLENGE_LOCKED]: \"mfa_challenge_locked\",\n [AuthErrorCode.AUTH_MFA_OTP_INVALID]: \"mfa_otp_invalid\",\n [AuthErrorCode.AUTH_MFA_RECOVERY_INVALID]: \"mfa_recovery_invalid\",\n [AuthErrorCode.AUTH_MFA_PASSKEY_NOT_AVAILABLE]: \"mfa_passkey_not_available\",\n [AuthErrorCode.AUTH_MFA_PASSKEY_CREDENTIAL_INVALID]: \"mfa_passkey_credential_invalid\",\n [AuthErrorCode.AUTH_MFA_PASSKEY_VERIFY_FAILED]: \"mfa_passkey_verify_failed\",\n [AuthErrorCode.AUTH_MFA_ENROLLMENT_BINDING_INVALID]: \"mfa_enrollment_binding_invalid\",\n [AuthErrorCode.AUTH_STEP_UP_REQUIRED]: \"step_up_required\",\n [AuthErrorCode.AUTH_STEP_UP_PROOF_UNAVAILABLE]: \"step_up_proof_unavailable\",\n [AuthErrorCode.AUTH_STEP_UP_ALREADY_CLAIMED]: \"step_up_already_claimed\",\n [AuthErrorCode.AUTH_POLICY_IN_USE]: \"policy_in_use\",\n [AuthErrorCode.AUTH_POLICY_LOCKED]: \"policy_locked\",\n [AuthErrorCode.AUTH_POLICY_SCOPE_MISMATCH]: \"policy_scope_mismatch\",\n [AuthErrorCode.AUTH_REVISION_CONFLICT]: \"revision_conflict\",\n [AuthErrorCode.AUTH_MFA_ELEVATION_REQUIRED]: \"mfa_elevation_required\",\n [AuthErrorCode.AUTH_MFA_LAST_FACTOR_REQUIRED]: \"mfa_last_factor_required\",\n [AuthErrorCode.AUTH_INTERNAL_ERROR]: \"internal_error\",\n [AuthErrorCode.AUTH_TERMS_NOT_ACCEPTED]: \"terms_not_accepted\",\n [AuthErrorCode.AUTH_SOCIAL_VERIFICATION_EXPIRED]: \"social_verification_expired\",\n [AuthErrorCode.AUTH_SOCIAL_VERIFICATION_INVALID_STATE]: \"social_verification_invalid_state\",\n [AuthErrorCode.AUTH_SUBACCOUNT_CHALLENGE_INVALID]: \"subaccount_challenge_invalid\",\n [AuthErrorCode.AUTH_SOCIAL_ACCOUNT_ALREADY_LINKED]: \"social_account_already_linked\",\n } satisfies Partial<ProtoToOutput<AuthErrorCode, SocialVerificationErrorCodeValue>>,\n} as const;\n"],"mappings":";;;AAIA,MAAa,yBAAyB,CAAC,WAAW,SAAS;AAG3D,MAAa,oCAAoC;CAAC;CAAW;CAAW;AAAI;AAG5E,MAAa,oCAAoC;CAC7C;CACA;CACA;CACA;CACA;CACA;CACA;AACJ;AAGA,MAAa,sBAAsB;CAC/B,cAAc;EACV,SAAA;EACA,SAAA;CACJ;CACA,eAAe;GACkC,IAAA;GACb,IAAA;GACA,IAAA;CACpC;AACJ;AAEA,MAAa,gCAAgC;CACzC,cAAc;EACV,SAAA;EACA,SAAA;EACA,IAAA;CACJ;CACA,eAAe;GAC0C,IAAA;GACJ,IAAA;GACA,IAAA;GACL,IAAA;CAChD;AACJ;AAEA,MAAa,gCAAgC,EACzC,eAAe;EAC0C,IAAA;EACQ,IAAA;EACb,IAAA;EACK,IAAA;EACH,IAAA;EACF,IAAA;EACC,IAAA;EACE,IAAA;AACvD,EACJ;AAEA,MAAa,wCAAwC;CACjD;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACJ;AAKA,MAAa,mCAAmC,EAC5C,eAAe;EACuB,IAAA;EACK,IAAA;EACF,IAAA;EACG,IAAA;EACM,IAAA;EACN,IAAA;EACF,IAAA;EACQ,IAAA;EACC,IAAA;EACL,IAAA;EACD,KAAA;EACM,KAAA;EACH,KAAA;EACY,KAAA;EACnB,KAAA;EACc,KAAA;EACR,KAAA;EACA,KAAA;EACR,KAAA;EACI,KAAA;EACG,KAAA;EACI,KAAA;EACF,KAAA;EACD,KAAA;EACL,KAAA;EACK,KAAA;EACK,KAAA;EACK,KAAA;EACL,KAAA;EACK,KAAA;EACd,KAAA;EACS,KAAA;EACF,KAAA;EACV,KAAA;EACA,KAAA;EACQ,KAAA;EACJ,KAAA;EACK,KAAA;EACE,KAAA;EACV,KAAA;EACI,KAAA;EACS,KAAA;EACM,KAAA;EACL,KAAA;EACC,KAAA;AACxD,EACJ"}
|
|
1
|
+
{"version":3,"file":"social-verification.codecs.js","names":[],"sources":["../../../src/services/social-verification/social-verification.codecs.ts"],"sourcesContent":["import { AuthErrorCode } from \"../../gen/auth/v1/auth_pb.js\";\nimport * as Proto from \"../../gen/auth/v1/social_verification_pb.js\";\nimport type { InputToProto, ProtoToOutput } from \"../../utils/types.js\";\n\nexport const SOCIAL_PROVIDER_VALUES = [\"twitter\", \"discord\", \"telegram\"] as const;\nexport type SocialProviderValue = (typeof SOCIAL_PROVIDER_VALUES)[number];\n\nexport const SOCIAL_VERIFICATION_METHOD_VALUES = [\"profile\", \"channel\", \"dm\"] as const;\nexport type SocialVerificationMethodValue = (typeof SOCIAL_VERIFICATION_METHOD_VALUES)[number];\n\nexport const SOCIAL_VERIFICATION_STATUS_VALUES = [\n \"pending_user_action\",\n \"queued\",\n \"in_progress\",\n \"verified\",\n \"failed\",\n \"expired\",\n \"canceled\",\n \"awaiting_confirmation\",\n] as const;\nexport type SocialVerificationStatusValue = (typeof SOCIAL_VERIFICATION_STATUS_VALUES)[number];\n\nexport const SocialProviderCodec = {\n inputToProto: {\n twitter: Proto.SocialProvider.TWITTER,\n discord: Proto.SocialProvider.DISCORD,\n telegram: Proto.SocialProvider.TELEGRAM,\n } satisfies InputToProto<SocialProviderValue, Proto.SocialProvider>,\n protoToOutput: {\n [Proto.SocialProvider.PROVIDER_UNSPECIFIED]: \"unspecified\",\n [Proto.SocialProvider.TWITTER]: \"twitter\",\n [Proto.SocialProvider.DISCORD]: \"discord\",\n [Proto.SocialProvider.TELEGRAM]: \"telegram\",\n } satisfies ProtoToOutput<Proto.SocialProvider, SocialProviderValue>,\n} as const;\n\nexport const SocialVerificationMethodCodec = {\n inputToProto: {\n profile: Proto.SocialVerificationMethod.METHOD_PROFILE,\n channel: Proto.SocialVerificationMethod.METHOD_CHANNEL,\n dm: Proto.SocialVerificationMethod.METHOD_DM,\n } satisfies InputToProto<SocialVerificationMethodValue, Proto.SocialVerificationMethod>,\n protoToOutput: {\n [Proto.SocialVerificationMethod.METHOD_UNSPECIFIED]: \"unspecified\",\n [Proto.SocialVerificationMethod.METHOD_PROFILE]: \"profile\",\n [Proto.SocialVerificationMethod.METHOD_CHANNEL]: \"channel\",\n [Proto.SocialVerificationMethod.METHOD_DM]: \"dm\",\n } satisfies ProtoToOutput<Proto.SocialVerificationMethod, SocialVerificationMethodValue>,\n} as const;\n\nexport const SocialVerificationStatusCodec = {\n protoToOutput: {\n [Proto.SocialVerificationStatus.STATUS_UNSPECIFIED]: \"unspecified\",\n [Proto.SocialVerificationStatus.STATUS_PENDING_USER_ACTION]: \"pending_user_action\",\n [Proto.SocialVerificationStatus.STATUS_QUEUED]: \"queued\",\n [Proto.SocialVerificationStatus.STATUS_IN_PROGRESS]: \"in_progress\",\n [Proto.SocialVerificationStatus.STATUS_VERIFIED]: \"verified\",\n [Proto.SocialVerificationStatus.STATUS_FAILED]: \"failed\",\n [Proto.SocialVerificationStatus.STATUS_EXPIRED]: \"expired\",\n [Proto.SocialVerificationStatus.STATUS_CANCELLED]: \"canceled\",\n [Proto.SocialVerificationStatus.STATUS_AWAITING_CONFIRMATION]: \"awaiting_confirmation\",\n } satisfies ProtoToOutput<Proto.SocialVerificationStatus, SocialVerificationStatusValue>,\n} as const;\n\nexport const SOCIAL_VERIFICATION_ERROR_CODE_VALUES = [\n \"username_invalid\",\n \"username_taken\",\n \"username_cooldown\",\n \"username_feature_locked\",\n \"username_reserved\",\n \"invalid_request\",\n \"authentication_required\",\n \"session_kind_not_allowed\",\n \"wallet_login_failed\",\n \"resource_not_found\",\n \"subaccount_access_denied\",\n \"api_key_access_denied\",\n \"api_key_invalid_status_transition\",\n \"policy_invalid\",\n \"smart_account_already_linked\",\n \"invite_access_denied\",\n \"invite_invalid_state\",\n \"mfa_disabled\",\n \"mfa_not_enrolled\",\n \"mfa_session_invalid\",\n \"mfa_challenge_not_found\",\n \"mfa_challenge_invalid\",\n \"mfa_challenge_locked\",\n \"mfa_otp_invalid\",\n \"mfa_recovery_invalid\",\n \"mfa_passkey_not_available\",\n \"mfa_passkey_credential_invalid\",\n \"mfa_passkey_verify_failed\",\n \"mfa_enrollment_binding_invalid\",\n \"step_up_required\",\n \"step_up_proof_unavailable\",\n \"step_up_already_claimed\",\n \"policy_in_use\",\n \"policy_locked\",\n \"policy_scope_mismatch\",\n \"revision_conflict\",\n \"mfa_elevation_required\",\n \"mfa_last_factor_required\",\n \"internal_error\",\n \"terms_not_accepted\",\n \"social_verification_expired\",\n \"social_verification_invalid_state\",\n \"subaccount_challenge_invalid\",\n \"social_account_already_linked\",\n] as const;\nexport type SocialVerificationErrorCodeValue =\n (typeof SOCIAL_VERIFICATION_ERROR_CODE_VALUES)[number];\n\n// Partial: auth codes added upstream decode to \"unspecified\" until mapped here.\nexport const SocialVerificationErrorCodeCodec = {\n protoToOutput: {\n [AuthErrorCode.AUTH_UNSPECIFIED]: \"unspecified\",\n [AuthErrorCode.AUTH_USERNAME_INVALID]: \"username_invalid\",\n [AuthErrorCode.AUTH_USERNAME_TAKEN]: \"username_taken\",\n [AuthErrorCode.AUTH_USERNAME_COOLDOWN]: \"username_cooldown\",\n [AuthErrorCode.AUTH_USERNAME_FEATURE_LOCKED]: \"username_feature_locked\",\n [AuthErrorCode.AUTH_USERNAME_RESERVED]: \"username_reserved\",\n [AuthErrorCode.AUTH_INVALID_REQUEST]: \"invalid_request\",\n [AuthErrorCode.AUTH_AUTHENTICATION_REQUIRED]: \"authentication_required\",\n [AuthErrorCode.AUTH_SESSION_KIND_NOT_ALLOWED]: \"session_kind_not_allowed\",\n [AuthErrorCode.AUTH_WALLET_LOGIN_FAILED]: \"wallet_login_failed\",\n [AuthErrorCode.AUTH_RESOURCE_NOT_FOUND]: \"resource_not_found\",\n [AuthErrorCode.AUTH_SUBACCOUNT_ACCESS_DENIED]: \"subaccount_access_denied\",\n [AuthErrorCode.AUTH_API_KEY_ACCESS_DENIED]: \"api_key_access_denied\",\n [AuthErrorCode.AUTH_API_KEY_INVALID_STATUS_TRANSITION]: \"api_key_invalid_status_transition\",\n [AuthErrorCode.AUTH_POLICY_INVALID]: \"policy_invalid\",\n [AuthErrorCode.AUTH_SMART_ACCOUNT_ALREADY_LINKED]: \"smart_account_already_linked\",\n [AuthErrorCode.AUTH_INVITE_ACCESS_DENIED]: \"invite_access_denied\",\n [AuthErrorCode.AUTH_INVITE_INVALID_STATE]: \"invite_invalid_state\",\n [AuthErrorCode.AUTH_MFA_DISABLED]: \"mfa_disabled\",\n [AuthErrorCode.AUTH_MFA_NOT_ENROLLED]: \"mfa_not_enrolled\",\n [AuthErrorCode.AUTH_MFA_SESSION_INVALID]: \"mfa_session_invalid\",\n [AuthErrorCode.AUTH_MFA_CHALLENGE_NOT_FOUND]: \"mfa_challenge_not_found\",\n [AuthErrorCode.AUTH_MFA_CHALLENGE_INVALID]: \"mfa_challenge_invalid\",\n [AuthErrorCode.AUTH_MFA_CHALLENGE_LOCKED]: \"mfa_challenge_locked\",\n [AuthErrorCode.AUTH_MFA_OTP_INVALID]: \"mfa_otp_invalid\",\n [AuthErrorCode.AUTH_MFA_RECOVERY_INVALID]: \"mfa_recovery_invalid\",\n [AuthErrorCode.AUTH_MFA_PASSKEY_NOT_AVAILABLE]: \"mfa_passkey_not_available\",\n [AuthErrorCode.AUTH_MFA_PASSKEY_CREDENTIAL_INVALID]: \"mfa_passkey_credential_invalid\",\n [AuthErrorCode.AUTH_MFA_PASSKEY_VERIFY_FAILED]: \"mfa_passkey_verify_failed\",\n [AuthErrorCode.AUTH_MFA_ENROLLMENT_BINDING_INVALID]: \"mfa_enrollment_binding_invalid\",\n [AuthErrorCode.AUTH_STEP_UP_REQUIRED]: \"step_up_required\",\n [AuthErrorCode.AUTH_STEP_UP_PROOF_UNAVAILABLE]: \"step_up_proof_unavailable\",\n [AuthErrorCode.AUTH_STEP_UP_ALREADY_CLAIMED]: \"step_up_already_claimed\",\n [AuthErrorCode.AUTH_POLICY_IN_USE]: \"policy_in_use\",\n [AuthErrorCode.AUTH_POLICY_LOCKED]: \"policy_locked\",\n [AuthErrorCode.AUTH_POLICY_SCOPE_MISMATCH]: \"policy_scope_mismatch\",\n [AuthErrorCode.AUTH_REVISION_CONFLICT]: \"revision_conflict\",\n [AuthErrorCode.AUTH_MFA_ELEVATION_REQUIRED]: \"mfa_elevation_required\",\n [AuthErrorCode.AUTH_MFA_LAST_FACTOR_REQUIRED]: \"mfa_last_factor_required\",\n [AuthErrorCode.AUTH_INTERNAL_ERROR]: \"internal_error\",\n [AuthErrorCode.AUTH_TERMS_NOT_ACCEPTED]: \"terms_not_accepted\",\n [AuthErrorCode.AUTH_SOCIAL_VERIFICATION_EXPIRED]: \"social_verification_expired\",\n [AuthErrorCode.AUTH_SOCIAL_VERIFICATION_INVALID_STATE]: \"social_verification_invalid_state\",\n [AuthErrorCode.AUTH_SUBACCOUNT_CHALLENGE_INVALID]: \"subaccount_challenge_invalid\",\n [AuthErrorCode.AUTH_SOCIAL_ACCOUNT_ALREADY_LINKED]: \"social_account_already_linked\",\n } satisfies Partial<ProtoToOutput<AuthErrorCode, SocialVerificationErrorCodeValue>>,\n} as const;\n"],"mappings":";;;AAIA,MAAa,yBAAyB;CAAC;CAAW;CAAW;AAAU;AAGvE,MAAa,oCAAoC;CAAC;CAAW;CAAW;AAAI;AAG5E,MAAa,oCAAoC;CAC7C;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACJ;AAGA,MAAa,sBAAsB;CAC/B,cAAc;EACV,SAAA;EACA,SAAA;EACA,UAAA;CACJ;CACA,eAAe;GACkC,IAAA;GACb,IAAA;GACA,IAAA;GACC,IAAA;CACrC;AACJ;AAEA,MAAa,gCAAgC;CACzC,cAAc;EACV,SAAA;EACA,SAAA;EACA,IAAA;CACJ;CACA,eAAe;GAC0C,IAAA;GACJ,IAAA;GACA,IAAA;GACL,IAAA;CAChD;AACJ;AAEA,MAAa,gCAAgC,EACzC,eAAe;EAC0C,IAAA;EACQ,IAAA;EACb,IAAA;EACK,IAAA;EACH,IAAA;EACF,IAAA;EACC,IAAA;EACE,IAAA;EACY,IAAA;AACnE,EACJ;AAEA,MAAa,wCAAwC;CACjD;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACJ;AAKA,MAAa,mCAAmC,EAC5C,eAAe;EACuB,IAAA;EACK,IAAA;EACF,IAAA;EACG,IAAA;EACM,IAAA;EACN,IAAA;EACF,IAAA;EACQ,IAAA;EACC,IAAA;EACL,IAAA;EACD,KAAA;EACM,KAAA;EACH,KAAA;EACY,KAAA;EACnB,KAAA;EACc,KAAA;EACR,KAAA;EACA,KAAA;EACR,KAAA;EACI,KAAA;EACG,KAAA;EACI,KAAA;EACF,KAAA;EACD,KAAA;EACL,KAAA;EACK,KAAA;EACK,KAAA;EACK,KAAA;EACL,KAAA;EACK,KAAA;EACd,KAAA;EACS,KAAA;EACF,KAAA;EACV,KAAA;EACA,KAAA;EACQ,KAAA;EACJ,KAAA;EACK,KAAA;EACE,KAAA;EACV,KAAA;EACI,KAAA;EACS,KAAA;EACM,KAAA;EACL,KAAA;EACC,KAAA;AACxD,EACJ"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AuthApiTransports } from "../../shared/transports.js";
|
|
2
2
|
import { PolyesterMutationOptions, PolyesterRequestOptions } from "../../shared/request-options.js";
|
|
3
|
-
import { GetVerificationResponse, SocialProviderInputSchema, StartVerificationInput, StartVerificationResponse, VerificationReadyResponse } from "./social-verification.schemas.js";
|
|
3
|
+
import { ConfirmVerificationInput, GetVerificationResponse, SocialProviderInputSchema, StartVerificationInput, StartVerificationResponse, UnlinkSocialAccountInput, VerificationReadyResponse } from "./social-verification.schemas.js";
|
|
4
4
|
import * as v from "valibot";
|
|
5
5
|
//#region src/services/social-verification/social-verification.d.ts
|
|
6
6
|
/**
|
|
@@ -10,17 +10,32 @@ declare class SocialVerificationService {
|
|
|
10
10
|
#private;
|
|
11
11
|
constructor(transports: AuthApiTransports);
|
|
12
12
|
/**
|
|
13
|
-
* Starts or restarts provider verification. Twitter requires a handle and strips a leading @; Discord
|
|
13
|
+
* Starts or restarts provider verification. Twitter requires a handle and strips a leading @; Discord and Telegram get their identity from the provider bot. An omitted method uses the provider default (Twitter profile, Discord channel, Telegram dm). Discord and Telegram return an empty challengeCode when no new challenge is issued. For Telegram, open `actionUrl` to send the code to the Polyester bot, poll `get` until `awaiting_confirmation`, then `confirm`; while a Telegram account is linked, starting again throws until it is unlinked.
|
|
14
14
|
*/
|
|
15
15
|
start(input: StartVerificationInput, options?: PolyesterMutationOptions): Promise<StartVerificationResponse>;
|
|
16
16
|
/**
|
|
17
|
-
* Queues a provider check after the caller has placed the challenge code according to the selected verification method.
|
|
17
|
+
* Queues a provider check after the caller has placed the challenge code according to the selected verification method. Not used for Telegram, which links through `confirm`.
|
|
18
18
|
*/
|
|
19
19
|
markReady(input: v.InferInput<typeof SocialProviderInputSchema>, options?: PolyesterMutationOptions): Promise<VerificationReadyResponse>;
|
|
20
20
|
/**
|
|
21
21
|
* Returns the caller's current verification state for a provider, including status, challenge metadata, attempts, last error, and verified timestamp.
|
|
22
22
|
*/
|
|
23
23
|
get(input: v.InferInput<typeof SocialProviderInputSchema>, options?: PolyesterRequestOptions): Promise<GetVerificationResponse>;
|
|
24
|
+
/**
|
|
25
|
+
* Links the Telegram account that sent the challenge code. Pass the `providerUserId` shown
|
|
26
|
+
* while the verification is `awaiting_confirmation`, so the user links exactly the account
|
|
27
|
+
* they were shown. Requires enrolled MFA and a fresh `stepUpToken`; a retried confirmation of
|
|
28
|
+
* an existing link needs no new token. A mismatched ID or no account awaiting confirmation
|
|
29
|
+
* fails with `social_verification_invalid_state`; a Telegram account linked elsewhere fails
|
|
30
|
+
* the verification with `social_account_already_linked`.
|
|
31
|
+
*/
|
|
32
|
+
confirm(input: ConfirmVerificationInput, options?: PolyesterMutationOptions): Promise<GetVerificationResponse>;
|
|
33
|
+
/**
|
|
34
|
+
* Unlinks the Telegram account, or cancels a link in progress, and returns the `canceled`
|
|
35
|
+
* verification (absent if none was ever started). Repeating it changes nothing; start a new
|
|
36
|
+
* verification to link again.
|
|
37
|
+
*/
|
|
38
|
+
unlink(input: UnlinkSocialAccountInput, options?: PolyesterMutationOptions): Promise<GetVerificationResponse>;
|
|
24
39
|
}
|
|
25
40
|
//#endregion
|
|
26
41
|
export { SocialVerificationService };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"social-verification.d.ts","names":[],"sources":["../../../src/services/social-verification/social-verification.ts"],"mappings":";;;;;;;;
|
|
1
|
+
{"version":3,"file":"social-verification.d.ts","names":[],"sources":["../../../src/services/social-verification/social-verification.ts"],"mappings":";;;;;;;;cA6Ba;;EAGG,YAAA,YAAY;;;;EAOlB,MACF,OAAO,wBACP,UAAU,2BACX,QAAQ;;;;EAYL,UACF,OAAO,EAAE,kBAAkB,4BAC3B,UAAU,2BACX,QAAQ;;;;EAYL,IACF,OAAO,EAAE,kBAAkB,4BAC3B,UAAU,0BACX,QAAQ;;;;;;;;;EAiBL,QACF,OAAO,0BACP,UAAU,2BACX,QAAQ;;;;;;EAcL,OACF,OAAO,0BACP,UAAU,2BACX,QAAQ"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { parse } from "../../shared/validation.js";
|
|
2
2
|
import { toConnectCallOptions } from "../../shared/request-options.js";
|
|
3
3
|
import { SocialVerificationService as SocialVerificationService$1 } from "../../gen/auth/v1/social_verification_pb.js";
|
|
4
|
-
import { GetVerificationResponseSchema, SocialProviderInputSchema, StartVerificationInputSchema, StartVerificationResponseSchema, VerificationReadyResponseSchema } from "./social-verification.schemas.js";
|
|
4
|
+
import { ConfirmVerificationInputSchema, GetVerificationResponseSchema, SocialProviderInputSchema, StartVerificationInputSchema, StartVerificationResponseSchema, UnlinkSocialAccountInputSchema, VerificationReadyResponseSchema } from "./social-verification.schemas.js";
|
|
5
5
|
import { createClient } from "@connectrpc/connect";
|
|
6
6
|
//#region src/services/social-verification/social-verification.ts
|
|
7
7
|
/**
|
|
@@ -13,7 +13,7 @@ var SocialVerificationService = class {
|
|
|
13
13
|
this.#client = createClient(SocialVerificationService$1, transports.authApi);
|
|
14
14
|
}
|
|
15
15
|
/**
|
|
16
|
-
* Starts or restarts provider verification. Twitter requires a handle and strips a leading @; Discord
|
|
16
|
+
* Starts or restarts provider verification. Twitter requires a handle and strips a leading @; Discord and Telegram get their identity from the provider bot. An omitted method uses the provider default (Twitter profile, Discord channel, Telegram dm). Discord and Telegram return an empty challengeCode when no new challenge is issued. For Telegram, open `actionUrl` to send the code to the Polyester bot, poll `get` until `awaiting_confirmation`, then `confirm`; while a Telegram account is linked, starting again throws until it is unlinked.
|
|
17
17
|
*/
|
|
18
18
|
async start(input, options) {
|
|
19
19
|
const validated = parse(StartVerificationInputSchema, input);
|
|
@@ -21,7 +21,7 @@ var SocialVerificationService = class {
|
|
|
21
21
|
return parse(StartVerificationResponseSchema, res);
|
|
22
22
|
}
|
|
23
23
|
/**
|
|
24
|
-
* Queues a provider check after the caller has placed the challenge code according to the selected verification method.
|
|
24
|
+
* Queues a provider check after the caller has placed the challenge code according to the selected verification method. Not used for Telegram, which links through `confirm`.
|
|
25
25
|
*/
|
|
26
26
|
async markReady(input, options) {
|
|
27
27
|
const validated = parse(SocialProviderInputSchema, input);
|
|
@@ -36,6 +36,29 @@ var SocialVerificationService = class {
|
|
|
36
36
|
const res = await this.#client.getSocialVerification(validated, toConnectCallOptions(options));
|
|
37
37
|
return parse(GetVerificationResponseSchema, res);
|
|
38
38
|
}
|
|
39
|
+
/**
|
|
40
|
+
* Links the Telegram account that sent the challenge code. Pass the `providerUserId` shown
|
|
41
|
+
* while the verification is `awaiting_confirmation`, so the user links exactly the account
|
|
42
|
+
* they were shown. Requires enrolled MFA and a fresh `stepUpToken`; a retried confirmation of
|
|
43
|
+
* an existing link needs no new token. A mismatched ID or no account awaiting confirmation
|
|
44
|
+
* fails with `social_verification_invalid_state`; a Telegram account linked elsewhere fails
|
|
45
|
+
* the verification with `social_account_already_linked`.
|
|
46
|
+
*/
|
|
47
|
+
async confirm(input, options) {
|
|
48
|
+
const validated = parse(ConfirmVerificationInputSchema, input);
|
|
49
|
+
const res = await this.#client.confirmSocialVerification(validated, toConnectCallOptions(options));
|
|
50
|
+
return parse(GetVerificationResponseSchema, res);
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Unlinks the Telegram account, or cancels a link in progress, and returns the `canceled`
|
|
54
|
+
* verification (absent if none was ever started). Repeating it changes nothing; start a new
|
|
55
|
+
* verification to link again.
|
|
56
|
+
*/
|
|
57
|
+
async unlink(input, options) {
|
|
58
|
+
const validated = parse(UnlinkSocialAccountInputSchema, input);
|
|
59
|
+
const res = await this.#client.unlinkSocialAccount(validated, toConnectCallOptions(options));
|
|
60
|
+
return parse(GetVerificationResponseSchema, res);
|
|
61
|
+
}
|
|
39
62
|
};
|
|
40
63
|
//#endregion
|
|
41
64
|
export { SocialVerificationService };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"social-verification.js","names":["#client","Proto.SocialVerificationService"],"sources":["../../../src/services/social-verification/social-verification.ts"],"sourcesContent":["import { createClient, type Client } from \"@connectrpc/connect\";\nimport * as Proto from \"../../gen/auth/v1/social_verification_pb.js\";\nimport type * as v from \"valibot\";\nimport { parse } from \"../../shared/validation.js\";\nimport type { AuthApiTransports } from \"../../shared/transports.js\";\nimport {\n toConnectCallOptions,\n type PolyesterMutationOptions,\n type PolyesterRequestOptions,\n} from \"../../shared/request-options.js\";\nimport {\n StartVerificationInputSchema,\n StartVerificationResponseSchema,\n VerificationReadyResponseSchema,\n GetVerificationResponseSchema,\n SocialProviderInputSchema,\n type StartVerificationInput,\n type StartVerificationResponse,\n type VerificationReadyResponse,\n type GetVerificationResponse,\n} from \"./social-verification.schemas.js\";\n\n/**\n * Verifies ownership of external social accounts for the authenticated caller.\n */\nexport class SocialVerificationService {\n #client: Client<typeof Proto.SocialVerificationService>;\n\n constructor(transports: AuthApiTransports) {\n this.#client = createClient(Proto.SocialVerificationService, transports.authApi);\n }\n\n /**\n * Starts or restarts provider verification. Twitter requires a handle and strips a leading @; Discord
|
|
1
|
+
{"version":3,"file":"social-verification.js","names":["#client","Proto.SocialVerificationService"],"sources":["../../../src/services/social-verification/social-verification.ts"],"sourcesContent":["import { createClient, type Client } from \"@connectrpc/connect\";\nimport * as Proto from \"../../gen/auth/v1/social_verification_pb.js\";\nimport type * as v from \"valibot\";\nimport { parse } from \"../../shared/validation.js\";\nimport type { AuthApiTransports } from \"../../shared/transports.js\";\nimport {\n toConnectCallOptions,\n type PolyesterMutationOptions,\n type PolyesterRequestOptions,\n} from \"../../shared/request-options.js\";\nimport {\n ConfirmVerificationInputSchema,\n UnlinkSocialAccountInputSchema,\n StartVerificationInputSchema,\n StartVerificationResponseSchema,\n VerificationReadyResponseSchema,\n GetVerificationResponseSchema,\n SocialProviderInputSchema,\n type ConfirmVerificationInput,\n type UnlinkSocialAccountInput,\n type StartVerificationInput,\n type StartVerificationResponse,\n type VerificationReadyResponse,\n type GetVerificationResponse,\n} from \"./social-verification.schemas.js\";\n\n/**\n * Verifies ownership of external social accounts for the authenticated caller.\n */\nexport class SocialVerificationService {\n #client: Client<typeof Proto.SocialVerificationService>;\n\n constructor(transports: AuthApiTransports) {\n this.#client = createClient(Proto.SocialVerificationService, transports.authApi);\n }\n\n /**\n * Starts or restarts provider verification. Twitter requires a handle and strips a leading @; Discord and Telegram get their identity from the provider bot. An omitted method uses the provider default (Twitter profile, Discord channel, Telegram dm). Discord and Telegram return an empty challengeCode when no new challenge is issued. For Telegram, open `actionUrl` to send the code to the Polyester bot, poll `get` until `awaiting_confirmation`, then `confirm`; while a Telegram account is linked, starting again throws until it is unlinked.\n */\n async start(\n input: StartVerificationInput,\n options?: PolyesterMutationOptions,\n ): Promise<StartVerificationResponse> {\n const validated = parse(StartVerificationInputSchema, input);\n const res = await this.#client.startSocialVerification(\n validated,\n toConnectCallOptions(options),\n );\n return parse(StartVerificationResponseSchema, res);\n }\n\n /**\n * Queues a provider check after the caller has placed the challenge code according to the selected verification method. Not used for Telegram, which links through `confirm`.\n */\n async markReady(\n input: v.InferInput<typeof SocialProviderInputSchema>,\n options?: PolyesterMutationOptions,\n ): Promise<VerificationReadyResponse> {\n const validated = parse(SocialProviderInputSchema, input);\n const res = await this.#client.socialVerificationReady(\n validated,\n toConnectCallOptions(options),\n );\n return parse(VerificationReadyResponseSchema, res);\n }\n\n /**\n * Returns the caller's current verification state for a provider, including status, challenge metadata, attempts, last error, and verified timestamp.\n */\n async get(\n input: v.InferInput<typeof SocialProviderInputSchema>,\n options?: PolyesterRequestOptions,\n ): Promise<GetVerificationResponse> {\n const validated = parse(SocialProviderInputSchema, input);\n const res = await this.#client.getSocialVerification(\n validated,\n toConnectCallOptions(options),\n );\n return parse(GetVerificationResponseSchema, res);\n }\n\n /**\n * Links the Telegram account that sent the challenge code. Pass the `providerUserId` shown\n * while the verification is `awaiting_confirmation`, so the user links exactly the account\n * they were shown. Requires enrolled MFA and a fresh `stepUpToken`; a retried confirmation of\n * an existing link needs no new token. A mismatched ID or no account awaiting confirmation\n * fails with `social_verification_invalid_state`; a Telegram account linked elsewhere fails\n * the verification with `social_account_already_linked`.\n */\n async confirm(\n input: ConfirmVerificationInput,\n options?: PolyesterMutationOptions,\n ): Promise<GetVerificationResponse> {\n const validated = parse(ConfirmVerificationInputSchema, input);\n const res = await this.#client.confirmSocialVerification(\n validated,\n toConnectCallOptions(options),\n );\n return parse(GetVerificationResponseSchema, res);\n }\n\n /**\n * Unlinks the Telegram account, or cancels a link in progress, and returns the `canceled`\n * verification (absent if none was ever started). Repeating it changes nothing; start a new\n * verification to link again.\n */\n async unlink(\n input: UnlinkSocialAccountInput,\n options?: PolyesterMutationOptions,\n ): Promise<GetVerificationResponse> {\n const validated = parse(UnlinkSocialAccountInputSchema, input);\n const res = await this.#client.unlinkSocialAccount(\n validated,\n toConnectCallOptions(options),\n );\n return parse(GetVerificationResponseSchema, res);\n }\n}\n"],"mappings":";;;;;;;;;AA6BA,IAAa,4BAAb,MAAuC;CACnC;CAEA,YAAY,YAA+B;EACvC,KAAKA,UAAU,aAAaC,6BAAiC,WAAW,OAAO;CACnF;;;;CAKA,MAAM,MACF,OACA,SACkC;EAClC,MAAM,YAAY,MAAM,8BAA8B,KAAK;EAC3D,MAAM,MAAM,MAAM,KAAKD,QAAQ,wBAC3B,WACA,qBAAqB,OAAO,CAChC;EACA,OAAO,MAAM,iCAAiC,GAAG;CACrD;;;;CAKA,MAAM,UACF,OACA,SACkC;EAClC,MAAM,YAAY,MAAM,2BAA2B,KAAK;EACxD,MAAM,MAAM,MAAM,KAAKA,QAAQ,wBAC3B,WACA,qBAAqB,OAAO,CAChC;EACA,OAAO,MAAM,iCAAiC,GAAG;CACrD;;;;CAKA,MAAM,IACF,OACA,SACgC;EAChC,MAAM,YAAY,MAAM,2BAA2B,KAAK;EACxD,MAAM,MAAM,MAAM,KAAKA,QAAQ,sBAC3B,WACA,qBAAqB,OAAO,CAChC;EACA,OAAO,MAAM,+BAA+B,GAAG;CACnD;;;;;;;;;CAUA,MAAM,QACF,OACA,SACgC;EAChC,MAAM,YAAY,MAAM,gCAAgC,KAAK;EAC7D,MAAM,MAAM,MAAM,KAAKA,QAAQ,0BAC3B,WACA,qBAAqB,OAAO,CAChC;EACA,OAAO,MAAM,+BAA+B,GAAG;CACnD;;;;;;CAOA,MAAM,OACF,OACA,SACgC;EAChC,MAAM,YAAY,MAAM,gCAAgC,KAAK;EAC7D,MAAM,MAAM,MAAM,KAAKA,QAAQ,oBAC3B,WACA,qBAAqB,OAAO,CAChC;EACA,OAAO,MAAM,+BAA+B,GAAG;CACnD;AACJ"}
|