@polyester/sdk 0.28.1 → 0.29.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/dist/gen/auth/v1/auth_pb.d.ts +7 -1
  3. package/dist/gen/auth/v1/auth_pb.d.ts.map +1 -1
  4. package/dist/gen/auth/v1/auth_pb.js +7 -1
  5. package/dist/gen/auth/v1/auth_pb.js.map +1 -1
  6. package/dist/gen/auth/v1/social_verification_pb.d.ts +9 -0
  7. package/dist/gen/auth/v1/social_verification_pb.d.ts.map +1 -1
  8. package/dist/gen/auth/v1/social_verification_pb.js +6 -1
  9. package/dist/gen/auth/v1/social_verification_pb.js.map +1 -1
  10. package/dist/gen/claims/v1/claims_pb.d.ts +7 -1
  11. package/dist/gen/claims/v1/claims_pb.d.ts.map +1 -1
  12. package/dist/gen/claims/v1/claims_pb.js +7 -1
  13. package/dist/gen/claims/v1/claims_pb.js.map +1 -1
  14. package/dist/gen/orders/v1/orders_read_pb.d.ts +3 -1
  15. package/dist/gen/orders/v1/orders_read_pb.d.ts.map +1 -1
  16. package/dist/gen/orders/v1/orders_read_pb.js.map +1 -1
  17. package/dist/index.d.ts +4 -4
  18. package/dist/index.js +2 -2
  19. package/dist/services/address-book/address-book.schemas.d.ts +209 -85
  20. package/dist/services/address-book/address-book.schemas.d.ts.map +1 -1
  21. package/dist/services/address-book/address-book.schemas.js +22 -3
  22. package/dist/services/address-book/address-book.schemas.js.map +1 -1
  23. package/dist/services/address-book/address-book.types.d.ts +2 -2
  24. package/dist/services/address-book/index.d.ts +1 -1
  25. package/dist/services/api-keys/api-keys.schemas.d.ts +3 -3
  26. package/dist/services/api-keys/api-keys.schemas.d.ts.map +1 -1
  27. package/dist/services/api-keys/api-keys.schemas.js +2 -2
  28. package/dist/services/api-keys/api-keys.schemas.js.map +1 -1
  29. package/dist/services/heatmap/heatmap.schemas.d.ts +4 -4
  30. package/dist/services/lifecycle/lifecycle.schemas.d.ts +42 -42
  31. package/dist/services/orderbook/orderbook.schemas.d.ts +1 -1
  32. package/dist/services/orders/orders-output.schemas.d.ts +6 -6
  33. package/dist/services/policies/api-key-policies/api-key-policies.schemas.d.ts +1 -1
  34. package/dist/services/policies/api-key-policies/api-key-policies.schemas.js +1 -1
  35. package/dist/services/policies/api-key-policies/api-key-policies.schemas.js.map +1 -1
  36. package/dist/services/social-verification/index.d.ts +2 -2
  37. package/dist/services/social-verification/social-verification.codecs.js +95 -1
  38. package/dist/services/social-verification/social-verification.codecs.js.map +1 -1
  39. package/dist/services/social-verification/social-verification.schemas.d.ts +10 -1
  40. package/dist/services/social-verification/social-verification.schemas.d.ts.map +1 -1
  41. package/dist/services/social-verification/social-verification.schemas.js +3 -1
  42. package/dist/services/social-verification/social-verification.schemas.js.map +1 -1
  43. package/dist/services/social-verification/social-verification.types.d.ts +2 -2
  44. package/dist/services/subaccounts/subaccounts.d.ts +2 -1
  45. package/dist/services/subaccounts/subaccounts.d.ts.map +1 -1
  46. package/dist/services/subaccounts/subaccounts.js +2 -1
  47. package/dist/services/subaccounts/subaccounts.js.map +1 -1
  48. package/dist/services/subaccounts/subaccounts.schemas.d.ts +2 -2
  49. package/dist/services/subaccounts/subaccounts.schemas.d.ts.map +1 -1
  50. package/dist/services/subaccounts/subaccounts.schemas.js +3 -3
  51. package/dist/services/subaccounts/subaccounts.schemas.js.map +1 -1
  52. package/dist/services/trades/trades.schemas.d.ts +15 -14
  53. package/dist/services/trades/trades.schemas.d.ts.map +1 -1
  54. package/dist/services/trades/trades.schemas.js +10 -3
  55. package/dist/services/trades/trades.schemas.js.map +1 -1
  56. package/dist/services/triggers/trigger-input.schemas.d.ts +1 -1
  57. package/dist/services/triggers/triggers-output.schemas.d.ts +19 -19
  58. package/dist/shared/connect-error-mapping.d.ts.map +1 -1
  59. package/dist/shared/connect-error-mapping.js +6 -2
  60. package/dist/shared/connect-error-mapping.js.map +1 -1
  61. package/dist/shared/errors.d.ts +13 -2
  62. package/dist/shared/errors.d.ts.map +1 -1
  63. package/dist/shared/errors.js +14 -1
  64. package/dist/shared/errors.js.map +1 -1
  65. package/dist/shared/schemas.js +3 -1
  66. package/dist/shared/schemas.js.map +1 -1
  67. package/dist/shared/transports.d.ts +5 -0
  68. package/dist/shared/transports.d.ts.map +1 -1
  69. package/dist/shared/transports.js +14 -2
  70. package/dist/shared/transports.js.map +1 -1
  71. package/package.json +1 -1
@@ -1,3 +1,4 @@
1
+ import "../../gen/auth/v1/auth_pb.js";
1
2
  import "../../gen/auth/v1/social_verification_pb.js";
2
3
  //#region src/services/social-verification/social-verification.codecs.ts
3
4
  const SOCIAL_PROVIDER_VALUES = ["twitter", "discord"];
@@ -49,7 +50,100 @@ const SocialVerificationStatusCodec = { protoToOutput: {
49
50
  [6]: "expired",
50
51
  [7]: "cancelled"
51
52
  } };
53
+ const SOCIAL_VERIFICATION_ERROR_CODE_VALUES = [
54
+ "username_invalid",
55
+ "username_taken",
56
+ "username_cooldown",
57
+ "username_feature_locked",
58
+ "username_reserved",
59
+ "invalid_request",
60
+ "authentication_required",
61
+ "session_kind_not_allowed",
62
+ "wallet_login_failed",
63
+ "resource_not_found",
64
+ "subaccount_access_denied",
65
+ "api_key_access_denied",
66
+ "api_key_invalid_status_transition",
67
+ "policy_invalid",
68
+ "smart_account_already_linked",
69
+ "invite_access_denied",
70
+ "invite_invalid_state",
71
+ "mfa_disabled",
72
+ "mfa_not_enrolled",
73
+ "mfa_session_invalid",
74
+ "mfa_challenge_not_found",
75
+ "mfa_challenge_invalid",
76
+ "mfa_challenge_locked",
77
+ "mfa_otp_invalid",
78
+ "mfa_recovery_invalid",
79
+ "mfa_passkey_not_available",
80
+ "mfa_passkey_credential_invalid",
81
+ "mfa_passkey_verify_failed",
82
+ "mfa_enrollment_binding_invalid",
83
+ "step_up_required",
84
+ "step_up_proof_unavailable",
85
+ "step_up_already_claimed",
86
+ "policy_in_use",
87
+ "policy_locked",
88
+ "policy_scope_mismatch",
89
+ "revision_conflict",
90
+ "mfa_elevation_required",
91
+ "mfa_last_factor_required",
92
+ "internal_error",
93
+ "terms_not_accepted",
94
+ "social_verification_expired",
95
+ "social_verification_invalid_state",
96
+ "subaccount_challenge_invalid",
97
+ "social_account_already_linked"
98
+ ];
99
+ const SocialVerificationErrorCodeCodec = { protoToOutput: {
100
+ [0]: "unspecified",
101
+ [1]: "username_invalid",
102
+ [2]: "username_taken",
103
+ [3]: "username_cooldown",
104
+ [4]: "username_feature_locked",
105
+ [5]: "username_reserved",
106
+ [6]: "invalid_request",
107
+ [7]: "authentication_required",
108
+ [8]: "session_kind_not_allowed",
109
+ [9]: "wallet_login_failed",
110
+ [10]: "resource_not_found",
111
+ [11]: "subaccount_access_denied",
112
+ [12]: "api_key_access_denied",
113
+ [14]: "api_key_invalid_status_transition",
114
+ [15]: "policy_invalid",
115
+ [16]: "smart_account_already_linked",
116
+ [17]: "invite_access_denied",
117
+ [18]: "invite_invalid_state",
118
+ [19]: "mfa_disabled",
119
+ [20]: "mfa_not_enrolled",
120
+ [21]: "mfa_session_invalid",
121
+ [22]: "mfa_challenge_not_found",
122
+ [23]: "mfa_challenge_invalid",
123
+ [24]: "mfa_challenge_locked",
124
+ [25]: "mfa_otp_invalid",
125
+ [26]: "mfa_recovery_invalid",
126
+ [27]: "mfa_passkey_not_available",
127
+ [28]: "mfa_passkey_credential_invalid",
128
+ [29]: "mfa_passkey_verify_failed",
129
+ [30]: "mfa_enrollment_binding_invalid",
130
+ [31]: "step_up_required",
131
+ [32]: "step_up_proof_unavailable",
132
+ [33]: "step_up_already_claimed",
133
+ [34]: "policy_in_use",
134
+ [35]: "policy_locked",
135
+ [36]: "policy_scope_mismatch",
136
+ [37]: "revision_conflict",
137
+ [38]: "mfa_elevation_required",
138
+ [39]: "mfa_last_factor_required",
139
+ [40]: "internal_error",
140
+ [41]: "terms_not_accepted",
141
+ [42]: "social_verification_expired",
142
+ [43]: "social_verification_invalid_state",
143
+ [44]: "subaccount_challenge_invalid",
144
+ [45]: "social_account_already_linked"
145
+ } };
52
146
  //#endregion
53
- export { SOCIAL_PROVIDER_VALUES, SOCIAL_VERIFICATION_METHOD_VALUES, SOCIAL_VERIFICATION_STATUS_VALUES, SocialProviderCodec, SocialVerificationMethodCodec, SocialVerificationStatusCodec };
147
+ export { SOCIAL_PROVIDER_VALUES, SOCIAL_VERIFICATION_ERROR_CODE_VALUES, SOCIAL_VERIFICATION_METHOD_VALUES, SOCIAL_VERIFICATION_STATUS_VALUES, SocialProviderCodec, SocialVerificationErrorCodeCodec, SocialVerificationMethodCodec, SocialVerificationStatusCodec };
54
148
 
55
149
  //# sourceMappingURL=social-verification.codecs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"social-verification.codecs.js","names":[],"sources":["../../../src/services/social-verification/social-verification.codecs.ts"],"sourcesContent":["import * 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 \"cancelled\",\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]: \"cancelled\",\n } satisfies ProtoToOutput<Proto.SocialVerificationStatus, SocialVerificationStatusValue>,\n} as const;\n"],"mappings":";;AAGA,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"}
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 \"cancelled\",\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]: \"cancelled\",\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"}
@@ -7,6 +7,8 @@ declare const SocialProviderSchema: v.PicklistSchema<readonly ["twitter", "disco
7
7
  type SocialProvider = v.InferInput<typeof SocialProviderSchema>;
8
8
  declare const SocialVerificationMethodSchema: v.PicklistSchema<readonly ["profile", "channel", "dm"], undefined>;
9
9
  type SocialVerificationMethod = v.InferInput<typeof SocialVerificationMethodSchema>;
10
+ declare const SocialVerificationErrorCodeSchema: v.PicklistSchema<readonly ["username_invalid", "username_taken", "username_cooldown", "username_feature_locked", "username_reserved", "invalid_request", "authentication_required", "session_kind_not_allowed", "wallet_login_failed", "resource_not_found", "subaccount_access_denied", "api_key_access_denied", "api_key_invalid_status_transition", "policy_invalid", "smart_account_already_linked", "invite_access_denied", "invite_invalid_state", "mfa_disabled", "mfa_not_enrolled", "mfa_session_invalid", "mfa_challenge_not_found", "mfa_challenge_invalid", "mfa_challenge_locked", "mfa_otp_invalid", "mfa_recovery_invalid", "mfa_passkey_not_available", "mfa_passkey_credential_invalid", "mfa_passkey_verify_failed", "mfa_enrollment_binding_invalid", "step_up_required", "step_up_proof_unavailable", "step_up_already_claimed", "policy_in_use", "policy_locked", "policy_scope_mismatch", "revision_conflict", "mfa_elevation_required", "mfa_last_factor_required", "internal_error", "terms_not_accepted", "social_verification_expired", "social_verification_invalid_state", "subaccount_challenge_invalid", "social_account_already_linked"], undefined>;
11
+ type SocialVerificationErrorCode = v.InferOutput<typeof SocialVerificationErrorCodeSchema>;
10
12
  declare const SocialVerificationStatusSchema: v.PicklistSchema<readonly ["pending_user_action", "queued", "in_progress", "verified", "failed", "expired", "cancelled"], undefined>;
11
13
  type SocialVerificationStatus = v.InferOutput<typeof SocialVerificationStatusSchema>;
12
14
  declare const SocialVerificationSchema: v.ObjectSchema<{
@@ -41,6 +43,13 @@ type SocialVerification = Omit<SocialVerificationBase, "provider" | "method" | "
41
43
  provider: DecodedEnum<SocialProvider>;
42
44
  method: DecodedEnum<SocialVerificationMethod>;
43
45
  status: DecodedEnum<SocialVerificationStatus>;
46
+ /**
47
+ * Machine-readable failure for the current state; branch on this, not `lastError`.
48
+ * `"unspecified"` when no typed failure applies or the code is newer than this SDK.
49
+ * `"social_account_already_linked"` is non-retryable for this account: send the
50
+ * user to the account already linked to that identity instead of restarting.
51
+ */
52
+ errorCode: DecodedEnum<SocialVerificationErrorCode>;
44
53
  };
45
54
  declare const StartVerificationInputSchema: v.SchemaWithPipe<readonly [v.VariantSchema<"provider", [v.StrictObjectSchema<{
46
55
  readonly provider: v.LiteralSchema<"twitter", undefined>;
@@ -106,5 +115,5 @@ declare const GetVerificationResponseSchema: v.SchemaWithPipe<readonly [v.Object
106
115
  }>]>;
107
116
  type GetVerificationResponse = v.InferOutput<typeof GetVerificationResponseSchema>;
108
117
  //#endregion
109
- export { GetVerificationResponse, GetVerificationResponseSchema, SocialProvider, SocialProviderInput, SocialProviderInputSchema, SocialProviderSchema, SocialVerification, SocialVerificationMethod, SocialVerificationMethodSchema, SocialVerificationSchema, SocialVerificationStatus, SocialVerificationStatusSchema, StartVerificationInput, StartVerificationInputSchema, StartVerificationResponse, StartVerificationResponseSchema, VerificationReadyResponse, VerificationReadyResponseSchema };
118
+ export { GetVerificationResponse, GetVerificationResponseSchema, SocialProvider, SocialProviderInput, SocialProviderInputSchema, SocialProviderSchema, SocialVerification, SocialVerificationErrorCode, SocialVerificationErrorCodeSchema, SocialVerificationMethod, SocialVerificationMethodSchema, SocialVerificationSchema, SocialVerificationStatus, SocialVerificationStatusSchema, StartVerificationInput, StartVerificationInputSchema, StartVerificationResponse, StartVerificationResponseSchema, VerificationReadyResponse, VerificationReadyResponseSchema };
110
119
  //# sourceMappingURL=social-verification.schemas.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"social-verification.schemas.d.ts","names":[],"sources":["../../../src/services/social-verification/social-verification.schemas.ts"],"mappings":";;;;;cAoBa,sBAAoB,EAAA;KACrB,iBAAiB,EAAE,kBAAkB;cAEpC,gCAA8B,EAAA;KAC/B,2BAA2B,EAAE,kBAAkB;cAE9C,gCAA8B,EAAA;KAC/B,2BAA2B,EAAE,mBAAmB;cAgC/C,0BAAwB,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;KAgBhC,yBAAyB,EAAE,mBAAmB;KACvC,qBAAqB,KAAK;EAClC,UAAU,YAAY;EACtB,QAAQ,YAAY;EACpB,QAAQ,YAAY;;cAGX,8BAA4B,EAAA,yBAAA,EAAA,2BAAA,EAAA;;;;;;;;;;;;;;;;;;;KA+B7B,yBAAyB,EAAE,kBAAkB;cAO5C,2BAAyB,EAAA;;;KAI1B,sBAAsB,EAAE,kBAAkB;cAEzC,iCAA+B,EAAA,yBAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;KAahC,4BAA4B,EAAE,mBAAmB;cAEhD,iCAA+B,EAAA,yBAAA,EAAA;;;;;;;KAShC,4BAA4B,EAAE,mBAAmB;cAEhD,+BAA6B,EAAA,yBAAA,EAAA;;;;;;;KAS9B,0BAA0B,EAAE,mBAAmB"}
1
+ {"version":3,"file":"social-verification.schemas.d.ts","names":[],"sources":["../../../src/services/social-verification/social-verification.schemas.ts"],"mappings":";;;;;cAuBa,sBAAoB,EAAA;KACrB,iBAAiB,EAAE,kBAAkB;cAEpC,gCAA8B,EAAA;KAC/B,2BAA2B,EAAE,kBAAkB;cAE9C,mCAAiC,EAAA;KAClC,8BAA8B,EAAE,mBAAmB;cAElD,gCAA8B,EAAA;KAC/B,2BAA2B,EAAE,mBAAmB;cAiC/C,0BAAwB,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;KAgBhC,yBAAyB,EAAE,mBAAmB;KACvC,qBAAqB,KAAK;EAClC,UAAU,YAAY;EACtB,QAAQ,YAAY;EACpB,QAAQ,YAAY;;;;;;;EAOpB,WAAW,YAAY;;cAGd,8BAA4B,EAAA,yBAAA,EAAA,2BAAA,EAAA;;;;;;;;;;;;;;;;;;;KA+B7B,yBAAyB,EAAE,kBAAkB;cAO5C,2BAAyB,EAAA;;;KAI1B,sBAAsB,EAAE,kBAAkB;cAEzC,iCAA+B,EAAA,yBAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;KAahC,4BAA4B,EAAE,mBAAmB;cAEhD,iCAA+B,EAAA,yBAAA,EAAA;;;;;;;KAShC,4BAA4B,EAAE,mBAAmB;cAEhD,+BAA6B,EAAA,yBAAA,EAAA;;;;;;;KAS9B,0BAA0B,EAAE,mBAAmB"}
@@ -1,11 +1,12 @@
1
1
  import { enumLabel } from "../../shared/proto-enum-codec.js";
2
2
  import { TimestampSchema } from "../../shared/schemas.js";
3
3
  import "../../gen/auth/v1/social_verification_pb.js";
4
- import { SOCIAL_PROVIDER_VALUES, SOCIAL_VERIFICATION_METHOD_VALUES, SOCIAL_VERIFICATION_STATUS_VALUES, SocialProviderCodec, SocialVerificationMethodCodec, SocialVerificationStatusCodec } from "./social-verification.codecs.js";
4
+ import { SOCIAL_PROVIDER_VALUES, SOCIAL_VERIFICATION_ERROR_CODE_VALUES, SOCIAL_VERIFICATION_METHOD_VALUES, SOCIAL_VERIFICATION_STATUS_VALUES, SocialProviderCodec, SocialVerificationErrorCodeCodec, SocialVerificationMethodCodec, SocialVerificationStatusCodec } from "./social-verification.codecs.js";
5
5
  import * as v from "valibot";
6
6
  //#region src/services/social-verification/social-verification.schemas.ts
7
7
  const SocialProviderSchema = v.picklist(SOCIAL_PROVIDER_VALUES);
8
8
  const SocialVerificationMethodSchema = v.picklist(SOCIAL_VERIFICATION_METHOD_VALUES);
9
+ v.picklist(SOCIAL_VERIFICATION_ERROR_CODE_VALUES);
9
10
  const SocialVerificationStatusSchema = v.picklist(SOCIAL_VERIFICATION_STATUS_VALUES);
10
11
  function normalizeHandle(input) {
11
12
  return (input ?? "").trim().replace(/^@+/, "");
@@ -29,6 +30,7 @@ function transformVerification(v) {
29
30
  verifiedAt: v.verifiedAt,
30
31
  attempts: v.attempts,
31
32
  lastError: v.lastError,
33
+ errorCode: enumLabel(SocialVerificationErrorCodeCodec.protoToOutput, v.errorCode),
32
34
  updatedAt: v.updatedAt
33
35
  };
34
36
  }
@@ -1 +1 @@
1
- {"version":3,"file":"social-verification.schemas.js","names":[],"sources":["../../../src/services/social-verification/social-verification.schemas.ts"],"sourcesContent":["import * as v from \"valibot\";\nimport { TimestampSchema } from \"../../shared/schemas.js\";\nimport { enumLabel } from \"../../shared/proto-enum-codec.js\";\nimport type { DecodedEnum } from \"../../utils/types.js\";\nimport * as Proto from \"../../gen/auth/v1/social_verification_pb.js\";\nimport {\n SOCIAL_PROVIDER_VALUES,\n SOCIAL_VERIFICATION_METHOD_VALUES,\n SOCIAL_VERIFICATION_STATUS_VALUES,\n SocialProviderCodec,\n SocialVerificationMethodCodec,\n SocialVerificationStatusCodec,\n} from \"./social-verification.codecs.js\";\n\nexport {\n SOCIAL_PROVIDER_VALUES,\n SOCIAL_VERIFICATION_METHOD_VALUES,\n SOCIAL_VERIFICATION_STATUS_VALUES,\n} from \"./social-verification.codecs.js\";\n\nexport const SocialProviderSchema = v.picklist(SOCIAL_PROVIDER_VALUES);\nexport type SocialProvider = v.InferInput<typeof SocialProviderSchema>;\n\nexport const SocialVerificationMethodSchema = v.picklist(SOCIAL_VERIFICATION_METHOD_VALUES);\nexport type SocialVerificationMethod = v.InferInput<typeof SocialVerificationMethodSchema>;\n\nexport const SocialVerificationStatusSchema = v.picklist(SOCIAL_VERIFICATION_STATUS_VALUES);\nexport type SocialVerificationStatus = v.InferOutput<typeof SocialVerificationStatusSchema>;\n\nfunction normalizeHandle(input: string): string {\n return (input ?? \"\").trim().replace(/^@+/, \"\");\n}\n\nconst TWITTER_HANDLE_PATTERN = /^[A-Za-z0-9_]{1,15}$/;\n\n/**\n * Normalizes a social verification response into the SDK verification shape.\n */\nexport function transformVerification(\n v: Proto.SocialVerification | undefined,\n): SocialVerification | undefined {\n if (!v) return undefined;\n return {\n id: v.id,\n provider: enumLabel(SocialProviderCodec.protoToOutput, v.provider),\n method: enumLabel(SocialVerificationMethodCodec.protoToOutput, v.method),\n handle: v.handle,\n providerUserId: v.providerUserId,\n challengeCode: v.challengeCode,\n status: enumLabel(SocialVerificationStatusCodec.protoToOutput, v.status),\n requestedAt: v.requestedAt,\n expiresAt: v.expiresAt,\n verifiedAt: v.verifiedAt,\n attempts: v.attempts,\n lastError: v.lastError,\n updatedAt: v.updatedAt,\n };\n}\n\nexport const SocialVerificationSchema = v.object({\n id: v.bigint(),\n provider: SocialProviderSchema,\n method: SocialVerificationMethodSchema,\n handle: v.string(),\n providerUserId: v.string(),\n challengeCode: v.string(),\n status: SocialVerificationStatusSchema,\n requestedAt: v.optional(TimestampSchema),\n expiresAt: v.optional(TimestampSchema),\n verifiedAt: v.optional(TimestampSchema),\n attempts: v.number(),\n lastError: v.string(),\n updatedAt: v.optional(TimestampSchema),\n});\n\ntype SocialVerificationBase = v.InferOutput<typeof SocialVerificationSchema>;\nexport type SocialVerification = Omit<SocialVerificationBase, \"provider\" | \"method\" | \"status\"> & {\n provider: DecodedEnum<SocialProvider>;\n method: DecodedEnum<SocialVerificationMethod>;\n status: DecodedEnum<SocialVerificationStatus>;\n};\n\nexport const StartVerificationInputSchema = v.pipe(\n v.variant(\"provider\", [\n v.strictObject({\n provider: v.literal(\"twitter\"),\n handle: v.pipe(\n v.string(),\n v.transform(normalizeHandle),\n v.minLength(1),\n v.regex(\n TWITTER_HANDLE_PATTERN,\n \"Twitter handle must be 1-15 letters, digits, or underscores\",\n ),\n ),\n method: v.optional(v.literal(\"profile\")),\n }),\n v.strictObject({\n provider: v.literal(\"discord\"),\n method: v.optional(v.picklist([\"channel\", \"dm\"])),\n }),\n ]),\n v.transform(({ provider, method, ...input }) => ({\n ...input,\n provider: SocialProviderCodec.inputToProto[provider],\n // METHOD_UNSPECIFIED lets the API choose Twitter's profile or Discord's channel default.\n method:\n method === undefined\n ? Proto.SocialVerificationMethod.METHOD_UNSPECIFIED\n : SocialVerificationMethodCodec.inputToProto[method],\n })),\n);\n\nexport type StartVerificationInput = v.InferInput<typeof StartVerificationInputSchema>;\n\nexport const ProviderInputSchema = v.pipe(\n SocialProviderSchema,\n v.transform((v) => SocialProviderCodec.inputToProto[v]),\n);\n\nexport const SocialProviderInputSchema = v.strictObject({\n provider: ProviderInputSchema,\n});\n\nexport type SocialProviderInput = v.InferInput<typeof SocialProviderInputSchema>;\n\nexport const StartVerificationResponseSchema = v.pipe(\n v.object({\n challengeCode: v.string(),\n expiresAt: v.optional(TimestampSchema),\n verification: v.optional(v.custom<Proto.SocialVerification>(() => true)),\n }),\n v.transform((res) => ({\n challengeCode: res.challengeCode,\n expiresAt: res.expiresAt,\n verification: transformVerification(res.verification),\n })),\n);\n\nexport type StartVerificationResponse = v.InferOutput<typeof StartVerificationResponseSchema>;\n\nexport const VerificationReadyResponseSchema = v.pipe(\n v.object({\n verification: v.optional(v.custom<Proto.SocialVerification>(() => true)),\n }),\n v.transform((res) => ({\n verification: transformVerification(res.verification),\n })),\n);\n\nexport type VerificationReadyResponse = v.InferOutput<typeof VerificationReadyResponseSchema>;\n\nexport const GetVerificationResponseSchema = v.pipe(\n v.object({\n verification: v.optional(v.custom<Proto.SocialVerification>(() => true)),\n }),\n v.transform((res) => ({\n verification: transformVerification(res.verification),\n })),\n);\n\nexport type GetVerificationResponse = v.InferOutput<typeof GetVerificationResponseSchema>;\n"],"mappings":";;;;;;AAoBA,MAAa,uBAAuB,EAAE,SAAS,sBAAsB;AAGrE,MAAa,iCAAiC,EAAE,SAAS,iCAAiC;AAG1F,MAAa,iCAAiC,EAAE,SAAS,iCAAiC;AAG1F,SAAS,gBAAgB,OAAuB;CAC5C,QAAQ,SAAS,GAAA,CAAI,KAAK,CAAC,CAAC,QAAQ,OAAO,EAAE;AACjD;AAEA,MAAM,yBAAyB;;;;AAK/B,SAAgB,sBACZ,GAC8B;CAC9B,IAAI,CAAC,GAAG,OAAO,KAAA;CACf,OAAO;EACH,IAAI,EAAE;EACN,UAAU,UAAU,oBAAoB,eAAe,EAAE,QAAQ;EACjE,QAAQ,UAAU,8BAA8B,eAAe,EAAE,MAAM;EACvE,QAAQ,EAAE;EACV,gBAAgB,EAAE;EAClB,eAAe,EAAE;EACjB,QAAQ,UAAU,8BAA8B,eAAe,EAAE,MAAM;EACvE,aAAa,EAAE;EACf,WAAW,EAAE;EACb,YAAY,EAAE;EACd,UAAU,EAAE;EACZ,WAAW,EAAE;EACb,WAAW,EAAE;CACjB;AACJ;AAEwC,EAAE,OAAO;CAC7C,IAAI,EAAE,OAAO;CACb,UAAU;CACV,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I,YAAY;AACxD,EAAE,CACN;AAIA,MAAa,kCAAkC,EAAE,KAC7C,EAAE,OAAO,EACL,cAAc,EAAE,SAAS,EAAE,aAAuC,IAAI,CAAC,EAC3E,CAAC,GACD,EAAE,WAAW,SAAS,EAClB,cAAc,sBAAsB,IAAI,YAAY,EACxD,EAAE,CACN;AAIA,MAAa,gCAAgC,EAAE,KAC3C,EAAE,OAAO,EACL,cAAc,EAAE,SAAS,EAAE,aAAuC,IAAI,CAAC,EAC3E,CAAC,GACD,EAAE,WAAW,SAAS,EAClB,cAAc,sBAAsB,IAAI,YAAY,EACxD,EAAE,CACN"}
1
+ {"version":3,"file":"social-verification.schemas.js","names":[],"sources":["../../../src/services/social-verification/social-verification.schemas.ts"],"sourcesContent":["import * as v from \"valibot\";\nimport { TimestampSchema } from \"../../shared/schemas.js\";\nimport { enumLabel } from \"../../shared/proto-enum-codec.js\";\nimport type { DecodedEnum } from \"../../utils/types.js\";\nimport * as Proto from \"../../gen/auth/v1/social_verification_pb.js\";\nimport {\n SOCIAL_PROVIDER_VALUES,\n SOCIAL_VERIFICATION_ERROR_CODE_VALUES,\n SOCIAL_VERIFICATION_METHOD_VALUES,\n SOCIAL_VERIFICATION_STATUS_VALUES,\n SocialProviderCodec,\n SocialVerificationErrorCodeCodec,\n SocialVerificationMethodCodec,\n SocialVerificationStatusCodec,\n} from \"./social-verification.codecs.js\";\n\nexport {\n SOCIAL_PROVIDER_VALUES,\n SOCIAL_VERIFICATION_ERROR_CODE_VALUES,\n SOCIAL_VERIFICATION_METHOD_VALUES,\n SOCIAL_VERIFICATION_STATUS_VALUES,\n} from \"./social-verification.codecs.js\";\n\nexport const SocialProviderSchema = v.picklist(SOCIAL_PROVIDER_VALUES);\nexport type SocialProvider = v.InferInput<typeof SocialProviderSchema>;\n\nexport const SocialVerificationMethodSchema = v.picklist(SOCIAL_VERIFICATION_METHOD_VALUES);\nexport type SocialVerificationMethod = v.InferInput<typeof SocialVerificationMethodSchema>;\n\nexport const SocialVerificationErrorCodeSchema = v.picklist(SOCIAL_VERIFICATION_ERROR_CODE_VALUES);\nexport type SocialVerificationErrorCode = v.InferOutput<typeof SocialVerificationErrorCodeSchema>;\n\nexport const SocialVerificationStatusSchema = v.picklist(SOCIAL_VERIFICATION_STATUS_VALUES);\nexport type SocialVerificationStatus = v.InferOutput<typeof SocialVerificationStatusSchema>;\n\nfunction normalizeHandle(input: string): string {\n return (input ?? \"\").trim().replace(/^@+/, \"\");\n}\n\nconst TWITTER_HANDLE_PATTERN = /^[A-Za-z0-9_]{1,15}$/;\n\n/**\n * Normalizes a social verification response into the SDK verification shape.\n */\nexport function transformVerification(\n v: Proto.SocialVerification | undefined,\n): SocialVerification | undefined {\n if (!v) return undefined;\n return {\n id: v.id,\n provider: enumLabel(SocialProviderCodec.protoToOutput, v.provider),\n method: enumLabel(SocialVerificationMethodCodec.protoToOutput, v.method),\n handle: v.handle,\n providerUserId: v.providerUserId,\n challengeCode: v.challengeCode,\n status: enumLabel(SocialVerificationStatusCodec.protoToOutput, v.status),\n requestedAt: v.requestedAt,\n expiresAt: v.expiresAt,\n verifiedAt: v.verifiedAt,\n attempts: v.attempts,\n lastError: v.lastError,\n errorCode: enumLabel(SocialVerificationErrorCodeCodec.protoToOutput, v.errorCode),\n updatedAt: v.updatedAt,\n };\n}\n\nexport const SocialVerificationSchema = v.object({\n id: v.bigint(),\n provider: SocialProviderSchema,\n method: SocialVerificationMethodSchema,\n handle: v.string(),\n providerUserId: v.string(),\n challengeCode: v.string(),\n status: SocialVerificationStatusSchema,\n requestedAt: v.optional(TimestampSchema),\n expiresAt: v.optional(TimestampSchema),\n verifiedAt: v.optional(TimestampSchema),\n attempts: v.number(),\n lastError: v.string(),\n updatedAt: v.optional(TimestampSchema),\n});\n\ntype SocialVerificationBase = v.InferOutput<typeof SocialVerificationSchema>;\nexport type SocialVerification = Omit<SocialVerificationBase, \"provider\" | \"method\" | \"status\"> & {\n provider: DecodedEnum<SocialProvider>;\n method: DecodedEnum<SocialVerificationMethod>;\n status: DecodedEnum<SocialVerificationStatus>;\n /**\n * Machine-readable failure for the current state; branch on this, not `lastError`.\n * `\"unspecified\"` when no typed failure applies or the code is newer than this SDK.\n * `\"social_account_already_linked\"` is non-retryable for this account: send the\n * user to the account already linked to that identity instead of restarting.\n */\n errorCode: DecodedEnum<SocialVerificationErrorCode>;\n};\n\nexport const StartVerificationInputSchema = v.pipe(\n v.variant(\"provider\", [\n v.strictObject({\n provider: v.literal(\"twitter\"),\n handle: v.pipe(\n v.string(),\n v.transform(normalizeHandle),\n v.minLength(1),\n v.regex(\n TWITTER_HANDLE_PATTERN,\n \"Twitter handle must be 1-15 letters, digits, or underscores\",\n ),\n ),\n method: v.optional(v.literal(\"profile\")),\n }),\n v.strictObject({\n provider: v.literal(\"discord\"),\n method: v.optional(v.picklist([\"channel\", \"dm\"])),\n }),\n ]),\n v.transform(({ provider, method, ...input }) => ({\n ...input,\n provider: SocialProviderCodec.inputToProto[provider],\n // METHOD_UNSPECIFIED lets the API choose Twitter's profile or Discord's channel default.\n method:\n method === undefined\n ? Proto.SocialVerificationMethod.METHOD_UNSPECIFIED\n : SocialVerificationMethodCodec.inputToProto[method],\n })),\n);\n\nexport type StartVerificationInput = v.InferInput<typeof StartVerificationInputSchema>;\n\nexport const ProviderInputSchema = v.pipe(\n SocialProviderSchema,\n v.transform((v) => SocialProviderCodec.inputToProto[v]),\n);\n\nexport const SocialProviderInputSchema = v.strictObject({\n provider: ProviderInputSchema,\n});\n\nexport type SocialProviderInput = v.InferInput<typeof SocialProviderInputSchema>;\n\nexport const StartVerificationResponseSchema = v.pipe(\n v.object({\n challengeCode: v.string(),\n expiresAt: v.optional(TimestampSchema),\n verification: v.optional(v.custom<Proto.SocialVerification>(() => true)),\n }),\n v.transform((res) => ({\n challengeCode: res.challengeCode,\n expiresAt: res.expiresAt,\n verification: transformVerification(res.verification),\n })),\n);\n\nexport type StartVerificationResponse = v.InferOutput<typeof StartVerificationResponseSchema>;\n\nexport const VerificationReadyResponseSchema = v.pipe(\n v.object({\n verification: v.optional(v.custom<Proto.SocialVerification>(() => true)),\n }),\n v.transform((res) => ({\n verification: transformVerification(res.verification),\n })),\n);\n\nexport type VerificationReadyResponse = v.InferOutput<typeof VerificationReadyResponseSchema>;\n\nexport const GetVerificationResponseSchema = v.pipe(\n v.object({\n verification: v.optional(v.custom<Proto.SocialVerification>(() => true)),\n }),\n v.transform((res) => ({\n verification: transformVerification(res.verification),\n })),\n);\n\nexport type GetVerificationResponse = v.InferOutput<typeof GetVerificationResponseSchema>;\n"],"mappings":";;;;;;AAuBA,MAAa,uBAAuB,EAAE,SAAS,sBAAsB;AAGrE,MAAa,iCAAiC,EAAE,SAAS,iCAAiC;AAGzC,EAAE,SAAS,qCAAqC;AAGjG,MAAa,iCAAiC,EAAE,SAAS,iCAAiC;AAG1F,SAAS,gBAAgB,OAAuB;CAC5C,QAAQ,SAAS,GAAA,CAAI,KAAK,CAAC,CAAC,QAAQ,OAAO,EAAE;AACjD;AAEA,MAAM,yBAAyB;;;;AAK/B,SAAgB,sBACZ,GAC8B;CAC9B,IAAI,CAAC,GAAG,OAAO,KAAA;CACf,OAAO;EACH,IAAI,EAAE;EACN,UAAU,UAAU,oBAAoB,eAAe,EAAE,QAAQ;EACjE,QAAQ,UAAU,8BAA8B,eAAe,EAAE,MAAM;EACvE,QAAQ,EAAE;EACV,gBAAgB,EAAE;EAClB,eAAe,EAAE;EACjB,QAAQ,UAAU,8BAA8B,eAAe,EAAE,MAAM;EACvE,aAAa,EAAE;EACf,WAAW,EAAE;EACb,YAAY,EAAE;EACd,UAAU,EAAE;EACZ,WAAW,EAAE;EACb,WAAW,UAAU,iCAAiC,eAAe,EAAE,SAAS;EAChF,WAAW,EAAE;CACjB;AACJ;AAEwC,EAAE,OAAO;CAC7C,IAAI,EAAE,OAAO;CACb,UAAU;CACV,QAAQ;CACR,QAAQ,EAAE,OAAO;CACjB,gBAAgB,EAAE,OAAO;CACzB,eAAe,EAAE,OAAO;CACx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AAE,SAAS,EAAE,aAAuC,IAAI,CAAC,EAC3E,CAAC,GACD,EAAE,WAAW,SAAS,EAClB,cAAc,sBAAsB,IAAI,YAAY,EACxD,EAAE,CACN;AAIA,MAAa,gCAAgC,EAAE,KAC3C,EAAE,OAAO,EACL,cAAc,EAAE,SAAS,EAAE,aAAuC,IAAI,CAAC,EAC3E,CAAC,GACD,EAAE,WAAW,SAAS,EAClB,cAAc,sBAAsB,IAAI,YAAY,EACxD,EAAE,CACN"}
@@ -1,2 +1,2 @@
1
- import { GetVerificationResponse, SocialProvider, SocialProviderInput, SocialVerification, SocialVerificationMethod, SocialVerificationStatus, StartVerificationInput, StartVerificationResponse, VerificationReadyResponse } from "./social-verification.schemas.js";
2
- export type { GetVerificationResponse, SocialProvider, SocialProviderInput, SocialVerification, SocialVerificationMethod, SocialVerificationStatus, StartVerificationInput, StartVerificationResponse, VerificationReadyResponse };
1
+ import { GetVerificationResponse, SocialProvider, SocialProviderInput, SocialVerification, SocialVerificationErrorCode, SocialVerificationMethod, SocialVerificationStatus, StartVerificationInput, StartVerificationResponse, VerificationReadyResponse } from "./social-verification.schemas.js";
2
+ export type { GetVerificationResponse, SocialProvider, SocialProviderInput, SocialVerification, SocialVerificationErrorCode, SocialVerificationMethod, SocialVerificationStatus, StartVerificationInput, StartVerificationResponse, VerificationReadyResponse };
@@ -72,7 +72,8 @@ declare class SubaccountsService {
72
72
  */
73
73
  setMemberMfaRequirement(input: v.InferInput<typeof SetSubaccountMemberMfaRequirementInputSchema>, options?: PolyesterMutationOptions): Promise<SubaccountMutationResult>;
74
74
  /**
75
- * Returns incoming, outgoing, or all subaccount invitations for the caller, newest first.
75
+ * Returns the caller's subaccount invitations, newest first. Omit `direction` to include both
76
+ * incoming and outgoing invitations, or pass `"incoming"` or `"outgoing"` to filter.
76
77
  */
77
78
  listInvites(input: v.InferInput<typeof ListSubaccountInvitesInputSchema>, options?: PolyesterRequestOptions): Promise<SubaccountInvite[]>;
78
79
  /**
@@ -1 +1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C,UAAU,OAAO;;;;EAmBjB,iBAAiB,OAAO"}
@@ -122,7 +122,8 @@ var SubaccountsService = class {
122
122
  return parse(SubaccountMutationResultSchema, res);
123
123
  }
124
124
  /**
125
- * Returns incoming, outgoing, or all subaccount invitations for the caller, newest first.
125
+ * Returns the caller's subaccount invitations, newest first. Omit `direction` to include both
126
+ * incoming and outgoing invitations, or pass `"incoming"` or `"outgoing"` to filter.
126
127
  */
127
128
  async listInvites(input, options) {
128
129
  const validatedInput = parse(ListSubaccountInvitesInputSchema, input);
@@ -1 +1 @@
1
- {"version":3,"file":"subaccounts.js","names":["#client","Proto.SubaccountService","#viewClient","Proto.SubaccountViewService","#publicRoleClient","Proto.SubaccountRoleService","#authRoleClient","#realtime","SubaccountSchema","ApiKeySchema","Proto.SubaccountSchema","ProtoApiKeys.ApiKeySchema"],"sources":["../../../src/services/subaccounts/subaccounts.ts"],"sourcesContent":["import * as Proto from \"../../gen/auth/v1/subaccounts_pb.js\";\nimport * as ProtoApiKeys from \"../../gen/auth/v1/api_keys_pb.js\";\nimport { createClient, type Client } from \"@connectrpc/connect\";\nimport * as v from \"valibot\";\nimport { parse } from \"../../shared/validation.js\";\nimport { type ApiKey, ApiKeySchema } from \"../api-keys/index.js\";\nimport { formatId } from \"../../utils/base58-id.js\";\nimport {\n toConnectCallOptions,\n type PolyesterMutationOptions,\n type PolyesterRequestOptions,\n} from \"../../shared/request-options.js\";\nimport type { PolyesterRealtime } from \"../../realtime/index.js\";\nimport {\n DEFAULT_SUBACCOUNT_POLICY,\n SubaccountPoliciesService,\n type SubaccountPolicy,\n SubaccountPolicySchema,\n} from \"../policies/subaccount-policies/index.js\";\nimport type { BaseSubscribeInput } from \"../../shared/types.js\";\nimport type { AuthAndPublicApiTransports } from \"../../shared/transports.js\";\nimport type { SubaccountResolver } from \"../subaccount-resolver.js\";\nimport {\n CreateSubaccountChallengeInputSchema,\n CreateSubaccountInputSchema,\n CreateSubaccountResultSchema,\n SubaccountChallengeSchema,\n UpdateSubaccountInputSchema,\n InviteSubaccountMemberInputSchema,\n RemoveSubaccountMemberInputSchema,\n UpdateSubaccountMemberRoleInputSchema,\n ListSubaccountInvitesInputSchema,\n RespondSubaccountInviteInputSchema,\n SubaccountActivityInputSchema,\n SubaccountSchema,\n SubaccountMemberSchema,\n SubaccountInviteSchema,\n SubaccountActivityEventSchema,\n SetSubaccountMemberMfaRequirementInputSchema,\n SubaccountIdInputSchema,\n SubaccountMutationResultSchema,\n SubaccountRoleCatalogSchema,\n EffectiveSubaccountPermissionsSchema,\n type CreateSubaccountResult,\n type SubaccountChallenge,\n type Subaccount,\n type SubaccountMember,\n type SubaccountInvite,\n type SubaccountEvent,\n type SubaccountMutationResult,\n type SubaccountRoleCatalog,\n type EffectiveSubaccountPermissions,\n} from \"./subaccounts.schemas.js\";\n\ninterface SubscribeSubaccountsInput extends BaseSubscribeInput<Subaccount> {\n accountId: string;\n}\n\ninterface SubscribeApiKeysInput extends BaseSubscribeInput<ApiKey> {\n accountId: string;\n}\n\n/**\n * Reads the public role catalog and creates, manages, shares, audits, and subscribes to subaccounts visible to the authenticated caller.\n */\nexport class SubaccountsService {\n readonly policies: SubaccountPoliciesService;\n\n #client: Client<typeof Proto.SubaccountService>;\n #viewClient: Client<typeof Proto.SubaccountViewService>;\n #publicRoleClient: Client<typeof Proto.SubaccountRoleService>;\n #authRoleClient: Client<typeof Proto.SubaccountRoleService>;\n #realtime: PolyesterRealtime;\n\n constructor(\n transports: AuthAndPublicApiTransports,\n realtime: PolyesterRealtime,\n resolver?: SubaccountResolver,\n ) {\n this.policies = new SubaccountPoliciesService(transports, realtime, resolver);\n this.#client = createClient(Proto.SubaccountService, transports.authApi);\n this.#viewClient = createClient(Proto.SubaccountViewService, transports.authApi);\n this.#publicRoleClient = createClient(Proto.SubaccountRoleService, transports.publicApi);\n this.#authRoleClient = createClient(Proto.SubaccountRoleService, transports.authApi);\n this.#realtime = realtime;\n }\n\n /**\n * Returns subaccounts owned by or shared with the caller plus totalCreated, including soft-deleted ones. Use `createChallenge` for the canonical next smart-account address and salt.\n */\n async list(options?: PolyesterRequestOptions): Promise<{\n totalCreated: number;\n subaccounts: v.InferOutput<typeof SubaccountSchema>[];\n }> {\n const res = await this.#client.listSubaccounts({}, toConnectCallOptions(options));\n return {\n totalCreated: res.totalCreated,\n subaccounts: parse(v.array(SubaccountSchema), res.subaccounts),\n };\n }\n\n /**\n * Fetches an aggregated subaccount dashboard view with subaccount details, policy, API keys, balances, members, and outgoing invites; throws if the subaccount is missing.\n */\n async get(\n input: v.InferInput<typeof SubaccountIdInputSchema>,\n options?: PolyesterRequestOptions,\n ): Promise<\n Subaccount & {\n apiKeys: ApiKey[];\n policy: SubaccountPolicy;\n members: SubaccountMember[];\n invites: SubaccountInvite[];\n }\n > {\n const validatedInput = parse(SubaccountIdInputSchema, input);\n const subaccountId = formatId(validatedInput.subaccountId);\n const res = await this.#viewClient.getSubaccount(\n {\n subaccountId: validatedInput.subaccountId,\n includeApiKeys: true,\n includeBalances: true,\n includeMembers: true,\n includeInvites: true,\n includePolicy: true,\n invitesDirection: Proto.SubaccountInviteDirection.OUTGOING,\n },\n toConnectCallOptions(options),\n );\n if (!res.subaccount) throw new Error(`Subaccount not found: ${subaccountId}`);\n\n return {\n ...parse(SubaccountSchema, res.subaccount),\n policy: res.policy\n ? parse(SubaccountPolicySchema, res.policy)\n : DEFAULT_SUBACCOUNT_POLICY,\n apiKeys: parse(v.optional(v.array(ApiKeySchema), []), res.apiKeys),\n members: parse(v.optional(v.array(SubaccountMemberSchema), []), res.members),\n invites: v\n .parse(v.optional(v.array(SubaccountInviteSchema), []), res.invites)\n .filter((invite) => invite.subaccountId === subaccountId),\n };\n }\n\n /**\n * Requests the canonical next smart account and a short-lived EIP-191 authorization message\n * bound to the authenticated root and the selected owner EOA. Sign the exact message through\n * the returned smart account, then pass it to `create`. A new challenge replaces the previous one.\n */\n async createChallenge(\n input: v.InferInput<typeof CreateSubaccountChallengeInputSchema>,\n options?: PolyesterRequestOptions,\n ): Promise<SubaccountChallenge> {\n const validatedInput = parse(CreateSubaccountChallengeInputSchema, input);\n const res = await this.#client.createSubaccountChallenge(\n validatedInput,\n toConnectCallOptions(options),\n );\n return parse(SubaccountChallengeSchema, res);\n }\n\n /**\n * Creates a new subaccount under the caller's root account using the smart-account address, message, and smart-account signature from `createChallenge`.\n */\n async create(\n input: v.InferInput<typeof CreateSubaccountInputSchema>,\n options?: PolyesterMutationOptions,\n ): Promise<CreateSubaccountResult> {\n const validatedInput = parse(CreateSubaccountInputSchema, input);\n const res = await this.#client.createSubaccount(\n validatedInput,\n toConnectCallOptions(options),\n );\n return parse(CreateSubaccountResultSchema, res);\n }\n\n /**\n * Updates mutable subaccount display/status fields such as label and active/disabled status.\n */\n async update(\n input: v.InferInput<typeof UpdateSubaccountInputSchema>,\n options?: PolyesterMutationOptions,\n ): Promise<Subaccount> {\n const validatedInput = parse(UpdateSubaccountInputSchema, input);\n const res = await this.#client.updateSubaccount(\n validatedInput,\n toConnectCallOptions(options),\n );\n if (!res.subaccount) throw new Error(\"Failed to update subaccount\");\n return parse(SubaccountSchema, res.subaccount);\n }\n\n /**\n * Creates or refreshes a pending invitation granting a role on a subaccount to another root account.\n */\n async inviteMember(\n input: v.InferInput<typeof InviteSubaccountMemberInputSchema>,\n options?: PolyesterMutationOptions,\n ): Promise<SubaccountInvite> {\n const validatedInput = parse(InviteSubaccountMemberInputSchema, input);\n const res = await this.#client.inviteSubaccountMember(\n validatedInput,\n toConnectCallOptions(options),\n );\n return parse(SubaccountInviteSchema, res.invite);\n }\n\n /**\n * Removes delegated access for a subaccount member by grantee account ID.\n */\n async removeMember(\n input: v.InferInput<typeof RemoveSubaccountMemberInputSchema>,\n options?: PolyesterMutationOptions,\n ): Promise<SubaccountMutationResult> {\n const validatedInput = parse(RemoveSubaccountMemberInputSchema, input);\n const res = await this.#client.removeSubaccountMember(\n validatedInput,\n toConnectCallOptions(options),\n );\n return parse(SubaccountMutationResultSchema, res);\n }\n\n /**\n * Changes an existing delegated member's role without sending a new invitation.\n */\n async updateMemberRole(\n input: v.InferInput<typeof UpdateSubaccountMemberRoleInputSchema>,\n options?: PolyesterMutationOptions,\n ): Promise<SubaccountMutationResult> {\n const validatedInput = parse(UpdateSubaccountMemberRoleInputSchema, input);\n const res = await this.#client.updateSubaccountMemberRole(\n validatedInput,\n toConnectCallOptions(options),\n );\n return parse(SubaccountMutationResultSchema, res);\n }\n\n /**\n * Enables or disables the owner-controlled MFA requirement for delegated interactive member actions on a subaccount.\n */\n async setMemberMfaRequirement(\n input: v.InferInput<typeof SetSubaccountMemberMfaRequirementInputSchema>,\n options?: PolyesterMutationOptions,\n ): Promise<SubaccountMutationResult> {\n const validatedInput = parse(SetSubaccountMemberMfaRequirementInputSchema, input);\n const res = await this.#client.setSubaccountMemberMFARequirement(\n validatedInput,\n toConnectCallOptions(options),\n );\n return parse(SubaccountMutationResultSchema, res);\n }\n\n /**\n * Returns incoming, outgoing, or all subaccount invitations for the caller, newest first.\n */\n async listInvites(\n input: v.InferInput<typeof ListSubaccountInvitesInputSchema>,\n options?: PolyesterRequestOptions,\n ): Promise<SubaccountInvite[]> {\n const validatedInput = parse(ListSubaccountInvitesInputSchema, input);\n const res = await this.#client.listSubaccountInvites(\n validatedInput,\n toConnectCallOptions(options),\n );\n return parse(v.array(SubaccountInviteSchema), res.invites);\n }\n\n /**\n * Returns the public built-in role and permission catalog with display metadata and per-role permission sets.\n */\n async listRoles(options?: PolyesterRequestOptions): Promise<SubaccountRoleCatalog> {\n const res = await this.#publicRoleClient.listSubaccountRoles(\n {},\n toConnectCallOptions(options),\n );\n return parse(SubaccountRoleCatalogSchema, res);\n }\n\n /**\n * Returns the caller's current role, effective role-granted permissions, and attached policy ID for a subaccount.\n */\n async getEffectivePermissions(\n input: v.InferInput<typeof SubaccountIdInputSchema>,\n options?: PolyesterRequestOptions,\n ): Promise<EffectiveSubaccountPermissions> {\n const validatedInput = parse(SubaccountIdInputSchema, input);\n const res = await this.#authRoleClient.getEffectiveSubaccountPermissions(\n validatedInput,\n toConnectCallOptions(options),\n );\n return parse(EffectiveSubaccountPermissionsSchema, res);\n }\n\n /**\n * Returns the owner and delegated members for a subaccount, including role and MFA enrollment status.\n */\n async listMembers(\n input: v.InferInput<typeof SubaccountIdInputSchema>,\n options?: PolyesterRequestOptions,\n ): Promise<SubaccountMember[]> {\n const validatedInput = parse(SubaccountIdInputSchema, input);\n const res = await this.#client.listSubaccountMembers(\n validatedInput,\n toConnectCallOptions(options),\n );\n return parse(v.array(SubaccountMemberSchema), res.members);\n }\n\n /**\n * Accepts or rejects an incoming invite, or cancels an outgoing invite, returning the updated invitation.\n */\n async respondInvite(\n input: v.InferInput<typeof RespondSubaccountInviteInputSchema>,\n options?: PolyesterMutationOptions,\n ): Promise<SubaccountInvite> {\n const validatedInput = parse(RespondSubaccountInviteInputSchema, input);\n const res = await this.#client.respondSubaccountInvite(\n validatedInput,\n toConnectCallOptions(options),\n );\n return parse(SubaccountInviteSchema, res.invite);\n }\n\n /**\n * Returns paginated audit/activity events for a subaccount, newest first, with a non-negative integer limit from 0 through 200 and opaque cursor pagination.\n */\n async listEvents(\n input: v.InferInput<typeof SubaccountActivityInputSchema>,\n options?: PolyesterRequestOptions,\n ): Promise<{ events: SubaccountEvent[]; nextPageToken: string }> {\n const validatedInput = parse(SubaccountActivityInputSchema, input);\n const res = await this.#viewClient.listSubaccountActivity(\n validatedInput,\n toConnectCallOptions(options),\n );\n return {\n events: parse(v.optional(v.array(SubaccountActivityEventSchema), []), res.events),\n nextPageToken: res.nextPageToken,\n };\n }\n\n /**\n * Subscribes to private subaccount updates for an account and emits normalized subaccount records.\n */\n subscribe(input: SubscribeSubaccountsInput) {\n const channel = `private:auth:subaccounts:${input.accountId}:proto`;\n\n return this.#realtime.connectProtoChannel({\n channel,\n schema: Proto.SubaccountSchema,\n onPublication: (data) => {\n const subaccount = parse(SubaccountSchema, data);\n input.onEvent(subaccount);\n },\n onConnected: () => input.onOpen?.(),\n onDisconnected: () => input.onClose?.(),\n onError: input.onError,\n });\n }\n\n /**\n * Subscribes to private API key updates for an account through the subaccount realtime channel helper.\n */\n subscribeApiKeys(input: SubscribeApiKeysInput) {\n const channel = `private:auth:api-keys:${input.accountId}:proto`;\n\n return this.#realtime.connectProtoChannel({\n channel,\n schema: ProtoApiKeys.ApiKeySchema,\n onPublication: (data) => {\n const apiKey = parse(ApiKeySchema, data);\n input.onEvent(apiKey);\n },\n onConnected: () => input.onOpen?.(),\n onDisconnected: () => input.onClose?.(),\n onError: input.onError,\n });\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;AAiEA,IAAa,qBAAb,MAAgC;CAC5B;CAEA;CACA;CACA;CACA;CACA;CAEA,YACI,YACA,UACA,UACF;EACE,KAAK,WAAW,IAAI,0BAA0B,YAAY,UAAU,QAAQ;EAC5E,KAAKA,UAAU,aAAaC,mBAAyB,WAAW,OAAO;EACvE,KAAKC,cAAc,aAAaC,uBAA6B,WAAW,OAAO;EAC/E,KAAKC,oBAAoB,aAAaC,uBAA6B,WAAW,SAAS;EACvF,KAAKC,kBAAkB,aAAaD,uBAA6B,WAAW,OAAO;EACnF,KAAKE,YAAY;CACrB;;;;CAKA,MAAM,KAAK,SAGR;EACC,MAAM,MAAM,MAAM,KAAKP,QAAQ,gBAAgB,CAAC,GAAG,qBAAqB,OAAO,CAAC;EAChF,OAAO;GACH,cAAc,IAAI;GAClB,aAAa,MAAM,EAAE,MAAMQ,kBAAgB,GAAG,IAAI,WAAW;EACjE;CACJ;;;;CAKA,MAAM,IACF,OACA,SAQF;EACE,MAAM,iBAAiB,MAAM,yBAAyB,KAAK;EAC3D,MAAM,eAAe,SAAS,eAAe,YAAY;EACzD,MAAM,MAAM,MAAM,KAAKN,YAAY,cAC/B;GACI,cAAc,eAAe;GAC7B,gBAAgB;GAChB,iBAAiB;GACjB,gBAAgB;GAChB,gBAAgB;GAChB,eAAe;GACf,kBAAA;EACJ,GACA,qBAAqB,OAAO,CAChC;EACA,IAAI,CAA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ubaccountService","#viewClient","Proto.SubaccountViewService","#publicRoleClient","Proto.SubaccountRoleService","#authRoleClient","#realtime","SubaccountSchema","ApiKeySchema","Proto.SubaccountSchema","ProtoApiKeys.ApiKeySchema"],"sources":["../../../src/services/subaccounts/subaccounts.ts"],"sourcesContent":["import * as Proto from \"../../gen/auth/v1/subaccounts_pb.js\";\nimport * as ProtoApiKeys from \"../../gen/auth/v1/api_keys_pb.js\";\nimport { createClient, type Client } from \"@connectrpc/connect\";\nimport * as v from \"valibot\";\nimport { parse } from \"../../shared/validation.js\";\nimport { type ApiKey, ApiKeySchema } from \"../api-keys/index.js\";\nimport { formatId } from \"../../utils/base58-id.js\";\nimport {\n toConnectCallOptions,\n type PolyesterMutationOptions,\n type PolyesterRequestOptions,\n} from \"../../shared/request-options.js\";\nimport type { PolyesterRealtime } from \"../../realtime/index.js\";\nimport {\n DEFAULT_SUBACCOUNT_POLICY,\n SubaccountPoliciesService,\n type SubaccountPolicy,\n SubaccountPolicySchema,\n} from \"../policies/subaccount-policies/index.js\";\nimport type { BaseSubscribeInput } from \"../../shared/types.js\";\nimport type { AuthAndPublicApiTransports } from \"../../shared/transports.js\";\nimport type { SubaccountResolver } from \"../subaccount-resolver.js\";\nimport {\n CreateSubaccountChallengeInputSchema,\n CreateSubaccountInputSchema,\n CreateSubaccountResultSchema,\n SubaccountChallengeSchema,\n UpdateSubaccountInputSchema,\n InviteSubaccountMemberInputSchema,\n RemoveSubaccountMemberInputSchema,\n UpdateSubaccountMemberRoleInputSchema,\n ListSubaccountInvitesInputSchema,\n RespondSubaccountInviteInputSchema,\n SubaccountActivityInputSchema,\n SubaccountSchema,\n SubaccountMemberSchema,\n SubaccountInviteSchema,\n SubaccountActivityEventSchema,\n SetSubaccountMemberMfaRequirementInputSchema,\n SubaccountIdInputSchema,\n SubaccountMutationResultSchema,\n SubaccountRoleCatalogSchema,\n EffectiveSubaccountPermissionsSchema,\n type CreateSubaccountResult,\n type SubaccountChallenge,\n type Subaccount,\n type SubaccountMember,\n type SubaccountInvite,\n type SubaccountEvent,\n type SubaccountMutationResult,\n type SubaccountRoleCatalog,\n type EffectiveSubaccountPermissions,\n} from \"./subaccounts.schemas.js\";\n\ninterface SubscribeSubaccountsInput extends BaseSubscribeInput<Subaccount> {\n accountId: string;\n}\n\ninterface SubscribeApiKeysInput extends BaseSubscribeInput<ApiKey> {\n accountId: string;\n}\n\n/**\n * Reads the public role catalog and creates, manages, shares, audits, and subscribes to subaccounts visible to the authenticated caller.\n */\nexport class SubaccountsService {\n readonly policies: SubaccountPoliciesService;\n\n #client: Client<typeof Proto.SubaccountService>;\n #viewClient: Client<typeof Proto.SubaccountViewService>;\n #publicRoleClient: Client<typeof Proto.SubaccountRoleService>;\n #authRoleClient: Client<typeof Proto.SubaccountRoleService>;\n #realtime: PolyesterRealtime;\n\n constructor(\n transports: AuthAndPublicApiTransports,\n realtime: PolyesterRealtime,\n resolver?: SubaccountResolver,\n ) {\n this.policies = new SubaccountPoliciesService(transports, realtime, resolver);\n this.#client = createClient(Proto.SubaccountService, transports.authApi);\n this.#viewClient = createClient(Proto.SubaccountViewService, transports.authApi);\n this.#publicRoleClient = createClient(Proto.SubaccountRoleService, transports.publicApi);\n this.#authRoleClient = createClient(Proto.SubaccountRoleService, transports.authApi);\n this.#realtime = realtime;\n }\n\n /**\n * Returns subaccounts owned by or shared with the caller plus totalCreated, including soft-deleted ones. Use `createChallenge` for the canonical next smart-account address and salt.\n */\n async list(options?: PolyesterRequestOptions): Promise<{\n totalCreated: number;\n subaccounts: v.InferOutput<typeof SubaccountSchema>[];\n }> {\n const res = await this.#client.listSubaccounts({}, toConnectCallOptions(options));\n return {\n totalCreated: res.totalCreated,\n subaccounts: parse(v.array(SubaccountSchema), res.subaccounts),\n };\n }\n\n /**\n * Fetches an aggregated subaccount dashboard view with subaccount details, policy, API keys, balances, members, and outgoing invites; throws if the subaccount is missing.\n */\n async get(\n input: v.InferInput<typeof SubaccountIdInputSchema>,\n options?: PolyesterRequestOptions,\n ): Promise<\n Subaccount & {\n apiKeys: ApiKey[];\n policy: SubaccountPolicy;\n members: SubaccountMember[];\n invites: SubaccountInvite[];\n }\n > {\n const validatedInput = parse(SubaccountIdInputSchema, input);\n const subaccountId = formatId(validatedInput.subaccountId);\n const res = await this.#viewClient.getSubaccount(\n {\n subaccountId: validatedInput.subaccountId,\n includeApiKeys: true,\n includeBalances: true,\n includeMembers: true,\n includeInvites: true,\n includePolicy: true,\n invitesDirection: Proto.SubaccountInviteDirection.OUTGOING,\n },\n toConnectCallOptions(options),\n );\n if (!res.subaccount) throw new Error(`Subaccount not found: ${subaccountId}`);\n\n return {\n ...parse(SubaccountSchema, res.subaccount),\n policy: res.policy\n ? parse(SubaccountPolicySchema, res.policy)\n : DEFAULT_SUBACCOUNT_POLICY,\n apiKeys: parse(v.optional(v.array(ApiKeySchema), []), res.apiKeys),\n members: parse(v.optional(v.array(SubaccountMemberSchema), []), res.members),\n invites: v\n .parse(v.optional(v.array(SubaccountInviteSchema), []), res.invites)\n .filter((invite) => invite.subaccountId === subaccountId),\n };\n }\n\n /**\n * Requests the canonical next smart account and a short-lived EIP-191 authorization message\n * bound to the authenticated root and the selected owner EOA. Sign the exact message through\n * the returned smart account, then pass it to `create`. A new challenge replaces the previous one.\n */\n async createChallenge(\n input: v.InferInput<typeof CreateSubaccountChallengeInputSchema>,\n options?: PolyesterRequestOptions,\n ): Promise<SubaccountChallenge> {\n const validatedInput = parse(CreateSubaccountChallengeInputSchema, input);\n const res = await this.#client.createSubaccountChallenge(\n validatedInput,\n toConnectCallOptions(options),\n );\n return parse(SubaccountChallengeSchema, res);\n }\n\n /**\n * Creates a new subaccount under the caller's root account using the smart-account address, message, and smart-account signature from `createChallenge`.\n */\n async create(\n input: v.InferInput<typeof CreateSubaccountInputSchema>,\n options?: PolyesterMutationOptions,\n ): Promise<CreateSubaccountResult> {\n const validatedInput = parse(CreateSubaccountInputSchema, input);\n const res = await this.#client.createSubaccount(\n validatedInput,\n toConnectCallOptions(options),\n );\n return parse(CreateSubaccountResultSchema, res);\n }\n\n /**\n * Updates mutable subaccount display/status fields such as label and active/disabled status.\n */\n async update(\n input: v.InferInput<typeof UpdateSubaccountInputSchema>,\n options?: PolyesterMutationOptions,\n ): Promise<Subaccount> {\n const validatedInput = parse(UpdateSubaccountInputSchema, input);\n const res = await this.#client.updateSubaccount(\n validatedInput,\n toConnectCallOptions(options),\n );\n if (!res.subaccount) throw new Error(\"Failed to update subaccount\");\n return parse(SubaccountSchema, res.subaccount);\n }\n\n /**\n * Creates or refreshes a pending invitation granting a role on a subaccount to another root account.\n */\n async inviteMember(\n input: v.InferInput<typeof InviteSubaccountMemberInputSchema>,\n options?: PolyesterMutationOptions,\n ): Promise<SubaccountInvite> {\n const validatedInput = parse(InviteSubaccountMemberInputSchema, input);\n const res = await this.#client.inviteSubaccountMember(\n validatedInput,\n toConnectCallOptions(options),\n );\n return parse(SubaccountInviteSchema, res.invite);\n }\n\n /**\n * Removes delegated access for a subaccount member by grantee account ID.\n */\n async removeMember(\n input: v.InferInput<typeof RemoveSubaccountMemberInputSchema>,\n options?: PolyesterMutationOptions,\n ): Promise<SubaccountMutationResult> {\n const validatedInput = parse(RemoveSubaccountMemberInputSchema, input);\n const res = await this.#client.removeSubaccountMember(\n validatedInput,\n toConnectCallOptions(options),\n );\n return parse(SubaccountMutationResultSchema, res);\n }\n\n /**\n * Changes an existing delegated member's role without sending a new invitation.\n */\n async updateMemberRole(\n input: v.InferInput<typeof UpdateSubaccountMemberRoleInputSchema>,\n options?: PolyesterMutationOptions,\n ): Promise<SubaccountMutationResult> {\n const validatedInput = parse(UpdateSubaccountMemberRoleInputSchema, input);\n const res = await this.#client.updateSubaccountMemberRole(\n validatedInput,\n toConnectCallOptions(options),\n );\n return parse(SubaccountMutationResultSchema, res);\n }\n\n /**\n * Enables or disables the owner-controlled MFA requirement for delegated interactive member actions on a subaccount.\n */\n async setMemberMfaRequirement(\n input: v.InferInput<typeof SetSubaccountMemberMfaRequirementInputSchema>,\n options?: PolyesterMutationOptions,\n ): Promise<SubaccountMutationResult> {\n const validatedInput = parse(SetSubaccountMemberMfaRequirementInputSchema, input);\n const res = await this.#client.setSubaccountMemberMFARequirement(\n validatedInput,\n toConnectCallOptions(options),\n );\n return parse(SubaccountMutationResultSchema, res);\n }\n\n /**\n * Returns the caller's subaccount invitations, newest first. Omit `direction` to include both\n * incoming and outgoing invitations, or pass `\"incoming\"` or `\"outgoing\"` to filter.\n */\n async listInvites(\n input: v.InferInput<typeof ListSubaccountInvitesInputSchema>,\n options?: PolyesterRequestOptions,\n ): Promise<SubaccountInvite[]> {\n const validatedInput = parse(ListSubaccountInvitesInputSchema, input);\n const res = await this.#client.listSubaccountInvites(\n validatedInput,\n toConnectCallOptions(options),\n );\n return parse(v.array(SubaccountInviteSchema), res.invites);\n }\n\n /**\n * Returns the public built-in role and permission catalog with display metadata and per-role permission sets.\n */\n async listRoles(options?: PolyesterRequestOptions): Promise<SubaccountRoleCatalog> {\n const res = await this.#publicRoleClient.listSubaccountRoles(\n {},\n toConnectCallOptions(options),\n );\n return parse(SubaccountRoleCatalogSchema, res);\n }\n\n /**\n * Returns the caller's current role, effective role-granted permissions, and attached policy ID for a subaccount.\n */\n async getEffectivePermissions(\n input: v.InferInput<typeof SubaccountIdInputSchema>,\n options?: PolyesterRequestOptions,\n ): Promise<EffectiveSubaccountPermissions> {\n const validatedInput = parse(SubaccountIdInputSchema, input);\n const res = await this.#authRoleClient.getEffectiveSubaccountPermissions(\n validatedInput,\n toConnectCallOptions(options),\n );\n return parse(EffectiveSubaccountPermissionsSchema, res);\n }\n\n /**\n * Returns the owner and delegated members for a subaccount, including role and MFA enrollment status.\n */\n async listMembers(\n input: v.InferInput<typeof SubaccountIdInputSchema>,\n options?: PolyesterRequestOptions,\n ): Promise<SubaccountMember[]> {\n const validatedInput = parse(SubaccountIdInputSchema, input);\n const res = await this.#client.listSubaccountMembers(\n validatedInput,\n toConnectCallOptions(options),\n );\n return parse(v.array(SubaccountMemberSchema), res.members);\n }\n\n /**\n * Accepts or rejects an incoming invite, or cancels an outgoing invite, returning the updated invitation.\n */\n async respondInvite(\n input: v.InferInput<typeof RespondSubaccountInviteInputSchema>,\n options?: PolyesterMutationOptions,\n ): Promise<SubaccountInvite> {\n const validatedInput = parse(RespondSubaccountInviteInputSchema, input);\n const res = await this.#client.respondSubaccountInvite(\n validatedInput,\n toConnectCallOptions(options),\n );\n return parse(SubaccountInviteSchema, res.invite);\n }\n\n /**\n * Returns paginated audit/activity events for a subaccount, newest first, with a non-negative integer limit from 0 through 200 and opaque cursor pagination.\n */\n async listEvents(\n input: v.InferInput<typeof SubaccountActivityInputSchema>,\n options?: PolyesterRequestOptions,\n ): Promise<{ events: SubaccountEvent[]; nextPageToken: string }> {\n const validatedInput = parse(SubaccountActivityInputSchema, input);\n const res = await this.#viewClient.listSubaccountActivity(\n validatedInput,\n toConnectCallOptions(options),\n );\n return {\n events: parse(v.optional(v.array(SubaccountActivityEventSchema), []), res.events),\n nextPageToken: res.nextPageToken,\n };\n }\n\n /**\n * Subscribes to private subaccount updates for an account and emits normalized subaccount records.\n */\n subscribe(input: SubscribeSubaccountsInput) {\n const channel = `private:auth:subaccounts:${input.accountId}:proto`;\n\n return this.#realtime.connectProtoChannel({\n channel,\n schema: Proto.SubaccountSchema,\n onPublication: (data) => {\n const subaccount = parse(SubaccountSchema, data);\n input.onEvent(subaccount);\n },\n onConnected: () => input.onOpen?.(),\n onDisconnected: () => input.onClose?.(),\n onError: input.onError,\n });\n }\n\n /**\n * Subscribes to private API key updates for an account through the subaccount realtime channel helper.\n */\n subscribeApiKeys(input: SubscribeApiKeysInput) {\n const channel = `private:auth:api-keys:${input.accountId}:proto`;\n\n return this.#realtime.connectProtoChannel({\n channel,\n schema: ProtoApiKeys.ApiKeySchema,\n onPublication: (data) => {\n const apiKey = parse(ApiKeySchema, data);\n input.onEvent(apiKey);\n },\n onConnected: () => input.onOpen?.(),\n onDisconnected: () => input.onClose?.(),\n onError: input.onError,\n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AAM,WACF,OACA,SAC6D;EAC7D,MAAM,iBAAiB,MAAM,+BAA+B,KAAK;EACjE,MAAM,MAAM,MAAM,KAAKE,YAAY,uBAC/B,gBACA,qBAAqB,OAAO,CAChC;EACA,OAAO;GACH,QAAQ,MAAM,EAAE,SAAS,EAAE,MAAM,6BAA6B,GAAG,CAAC,CAAC,GAAG,IAAI,MAAM;GAChF,eAAe,IAAI;EACvB;CACJ;;;;CAKA,UAAU,OAAkC;EACxC,MAAM,UAAU,4BAA4B,MAAM,UAAU;EAE5D,OAAO,KAAKK,UAAU,oBAAoB;GACtC;GACA,QAAQG;GACR,gBAAgB,SAAS;IACrB,MAAM,aAAa,MAAMF,oBAAkB,IAAI;IAC/C,MAAM,QAAQ,UAAU;GAC5B;GACA,mBAAmB,MAAM,SAAS;GAClC,sBAAsB,MAAM,UAAU;GACtC,SAAS,MAAM;EACnB,CAAC;CACL;;;;CAKA,iBAAiB,OAA8B;EAC3C,MAAM,UAAU,yBAAyB,MAAM,UAAU;EAEzD,OAAO,KAAKD,UAAU,oBAAoB;GACtC;GACA,QAAQI;GACR,gBAAgB,SAAS;IACrB,MAAM,SAAS,MAAMF,gBAAc,IAAI;IACvC,MAAM,QAAQ,MAAM;GACxB;GACA,mBAAmB,MAAM,SAAS;GAClC,sBAAsB,MAAM,UAAU;GACtC,SAAS,MAAM;EACnB,CAAC;CACL;AACJ"}
@@ -295,8 +295,8 @@ declare const SubaccountActivityEventSchema: v.ObjectSchema<{
295
295
  seconds: bigint;
296
296
  nanos: number;
297
297
  } | undefined, number | undefined>]>;
298
- readonly entityKind: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "api_key" | "account" | "subaccount" | "destination" | "session" | "member" | "policy" | "invite" | "security">]>;
299
- readonly eventAction: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "enabled" | "disabled" | "failed" | "created" | "updated" | "deleted" | "removed" | "role_set" | "received" | "replied" | "revoked" | "blocked" | "hold_placed" | "hold_released">]>;
298
+ readonly entityKind: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "api_key" | "account" | "subaccount" | "destination" | "session" | "policy" | "member" | "invite" | "security">]>;
299
+ readonly eventAction: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "enabled" | "disabled" | "revoked" | "failed" | "created" | "updated" | "deleted" | "removed" | "role_set" | "received" | "replied" | "blocked" | "hold_placed" | "hold_released">]>;
300
300
  readonly source: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "web" | "mobile" | "api">]>;
301
301
  readonly ip: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
302
302
  readonly userAgent: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
@@ -1 +1 @@
1
- {"version":3,"file":"subaccounts.schemas.d.ts","names":[],"sources":["../../../src/services/subaccounts/subaccounts.schemas.ts"],"mappings":";;;cA0Ca,sBAAoB,EAAA;KAErB,iBAAiB,EAAE,mBAAmB;cAI5C,iCAA+B,EAAA,yBAAA,EAAA,yBAAA,EAAA;KAEzB,uBAAuB,EAAE,mBAAmB;cAE3C,sCAAoC,EAAA;;;;;;KAOrC,iCAAiC,EAAE,mBACpC;cAGE,gCAA8B,EAAA;;;;;;;KAQ/B,2BAA2B,EAAE,mBAAmB;cAE/C,6BAA2B,EAAA;;;;;;;;;;;;;;;KAK5B,wBAAwB,EAAE,mBAAmB;cAE5C,sCAAoC,EAAA;;;;;KAMrC,iCAAiC,EAAE,mBACpC;cAGE,sCAAoC,EAAA;;;;KAKrC,iCAAiC,EAAE,kBACpC;cAGE,2BAAyB,EAAA;;;;;;;;;;;;;KAQ1B,sBAAsB,EAAE,mBAAmB;cAE1C,6BAA2B,EAAA;;;;;;;;KAS5B,wBAAwB,EAAE,kBAAkB;cAE3C,yBAAuB,EAAA;;;KAIxB,oBAAoB,EAAE,kBAAkB;cAEvC,8BA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mBAAmB,EAAE,mBAAmB;cAEvC,kBAAgB,EAAA,yBAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAyBjB,aAAa,EAAE,mBAAmB;cAEjC,wBAAsB,EAAA;;;;;;;;KASvB,mBAAmB,EAAE,mBAAmB;cAEvC,wBAAsB,EAAA,yBAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAqCvB,mBAAmB,EAAE,mBAAmB;cAEvC,+BAA6B,EAAA;;;;;KAM9B,0BAA0B,EAAE,kBAAkB;cAE7C,+BAA6B,EAAA;;;;;;;;;;;;;;;;KAc9B,kBAAkB,EAAE,mBAAmB"}
@@ -1,6 +1,6 @@
1
1
  import { enumLabel, enumLabelSchema } from "../../shared/proto-enum-codec.js";
2
2
  import { tsObjToMs, tsObjToNsString } from "../../utils/time.js";
3
- import { BigIntStringSchema, OptionalTimestampMsSchema, PublicIdSchema, TimestampSchema, idInputSchema, positiveBigintStringInputSchema } from "../../shared/schemas.js";
3
+ import { BigIntStringSchema, OptionalTimestampMsSchema, PublicIdOrEmptySchema, PublicIdSchema, TimestampSchema, idInputSchema, positiveBigintStringInputSchema } from "../../shared/schemas.js";
4
4
  import { PolicyActionCodec } from "../policies/shared.codecs.js";
5
5
  import { buildProtoPatch, defineProtoPatchFields } from "../../utils/proto-patch.js";
6
6
  import { WalletAddressSchema, WalletChallengeMessageSchema, WalletChallengeUriSchema, WalletSignatureSchema } from "../auth/wallet-challenge.schemas.js";
@@ -36,7 +36,7 @@ const SubaccountRoleCatalogSchema = v.object({
36
36
  const EffectiveSubaccountPermissionsSchema = v.object({
37
37
  role: ProtoSubaccountRoleSchema,
38
38
  permissions: v.optional(v.array(ProtoSubaccountPermissionSchema), []),
39
- subaccountPolicyId: PublicIdSchema
39
+ subaccountPolicyId: PublicIdOrEmptySchema
40
40
  });
41
41
  const CreateSubaccountChallengeInputSchema = v.strictObject({
42
42
  ownerAddress: WalletAddressSchema,
@@ -143,7 +143,7 @@ const SubaccountSchema = v.pipe(v.object({
143
143
  ownerUsername: v.optional(v.string(), ""),
144
144
  ownerAvatarUrl: v.optional(v.string(), ""),
145
145
  ownerRootSmartAccountAddress: v.string(),
146
- subaccountPolicyId: PublicIdSchema,
146
+ subaccountPolicyId: PublicIdOrEmptySchema,
147
147
  requireMemberMfa: v.optional(v.boolean(), false),
148
148
  updatedAt: v.optional(TimestampSchema),
149
149
  revision: BigIntStringSchema
@@ -1 +1 @@
1
- {"version":3,"file":"subaccounts.schemas.js","names":[],"sources":["../../../src/services/subaccounts/subaccounts.schemas.ts"],"sourcesContent":["import {\n WalletAddressSchema,\n WalletChallengeMessageSchema,\n WalletChallengeUriSchema,\n WalletSignatureSchema,\n} from \"../auth/wallet-challenge.schemas.js\";\nimport * as v from \"valibot\";\nimport {\n BigIntStringSchema,\n OptionalTimestampMsSchema,\n PublicIdSchema,\n TimestampSchema,\n idInputSchema,\n positiveBigintStringInputSchema,\n} from \"../../shared/schemas.js\";\nimport { tsObjToMs, tsObjToNsString } from \"../../utils/time.js\";\nimport { enumLabel, enumLabelSchema } from \"../../shared/proto-enum-codec.js\";\nimport {\n SubaccountRoleCodec,\n SubaccountPermissionCodec,\n InviteActionCodec,\n InviteStatusCodec,\n SubaccountInviteDirectionCodec,\n SUBACCOUNT_INVITE_DIRECTION_VALUES,\n SubaccountStatusCodec,\n SUBACCOUNT_STATUS_VALUES,\n ActivityEntityKindCodec,\n ActivityEventActionCodec,\n ActivityEventSourceCodec,\n} from \"./subaccounts.codecs.js\";\nimport { PolicyActionCodec } from \"../policies/shared.codecs.js\";\nimport { buildProtoPatch, defineProtoPatchFields } from \"../../utils/proto-patch.js\";\n\nconst SUBACCOUNT_ROLE_VALUES = [\n \"owner\",\n \"admin\",\n \"treasury\",\n \"leveraged_trader\",\n \"trader\",\n \"viewer\",\n] as const;\n\nexport const SubaccountRoleSchema = v.picklist(SUBACCOUNT_ROLE_VALUES);\n\nexport type SubaccountRole = v.InferOutput<typeof SubaccountRoleSchema>;\n\nconst ProtoSubaccountRoleSchema = enumLabelSchema(SubaccountRoleCodec.protoToOutput);\n\nconst ProtoSubaccountPermissionSchema = enumLabelSchema(SubaccountPermissionCodec.protoToOutput);\n\nexport type SubaccountPermission = v.InferOutput<typeof ProtoSubaccountPermissionSchema>;\n\nexport const SubaccountPermissionDefinitionSchema = v.object({\n permission: ProtoSubaccountPermissionSchema,\n displayName: v.optional(v.string(), \"\"),\n description: v.optional(v.string(), \"\"),\n policyAction: enumLabelSchema(PolicyActionCodec.protoToOutput),\n});\n\nexport type SubaccountPermissionDefinition = v.InferOutput<\n typeof SubaccountPermissionDefinitionSchema\n>;\n\nexport const SubaccountRoleDefinitionSchema = v.object({\n role: ProtoSubaccountRoleSchema,\n displayName: v.optional(v.string(), \"\"),\n description: v.optional(v.string(), \"\"),\n assignable: v.optional(v.boolean(), false),\n permissions: v.optional(v.array(ProtoSubaccountPermissionSchema), []),\n});\n\nexport type SubaccountRoleDefinition = v.InferOutput<typeof SubaccountRoleDefinitionSchema>;\n\nexport const SubaccountRoleCatalogSchema = v.object({\n permissions: v.optional(v.array(SubaccountPermissionDefinitionSchema), []),\n roles: v.optional(v.array(SubaccountRoleDefinitionSchema), []),\n});\n\nexport type SubaccountRoleCatalog = v.InferOutput<typeof SubaccountRoleCatalogSchema>;\n\nexport const EffectiveSubaccountPermissionsSchema = v.object({\n role: ProtoSubaccountRoleSchema,\n permissions: v.optional(v.array(ProtoSubaccountPermissionSchema), []),\n subaccountPolicyId: PublicIdSchema,\n});\n\nexport type EffectiveSubaccountPermissions = v.InferOutput<\n typeof EffectiveSubaccountPermissionsSchema\n>;\n\nexport const CreateSubaccountChallengeInputSchema = v.strictObject({\n ownerAddress: WalletAddressSchema,\n uri: WalletChallengeUriSchema,\n});\n\nexport type CreateSubaccountChallengeInput = v.InferInput<\n typeof CreateSubaccountChallengeInputSchema\n>;\n\nexport const SubaccountChallengeSchema = v.object({\n message: WalletChallengeMessageSchema,\n smartAccountAddress: WalletAddressSchema,\n smartAccountSaltNonce: v.number(),\n expiresAt: OptionalTimestampMsSchema,\n polyesterChainId: v.pipe(v.bigint(), v.transform(Number)),\n});\n\nexport type SubaccountChallenge = v.InferOutput<typeof SubaccountChallengeSchema>;\n\nexport const CreateSubaccountInputSchema = v.strictObject({\n label: v.optional(v.string(), \"\"),\n icon: v.optional(v.string(), \"\"),\n color: v.optional(v.string(), \"\"),\n smartAccountAddress: WalletAddressSchema,\n message: WalletChallengeMessageSchema,\n signature: WalletSignatureSchema,\n});\n\nexport type CreateSubaccountInput = v.InferInput<typeof CreateSubaccountInputSchema>;\n\nexport const SubaccountIdInputSchema = v.strictObject({\n subaccountId: idInputSchema(\"subaccountId\"),\n});\n\nexport type SubaccountIdInput = v.InferInput<typeof SubaccountIdInputSchema>;\n\nexport const CreateSubaccountResultSchema = v.object({\n subaccountId: PublicIdSchema,\n totalCreated: v.number(),\n smartAccountSaltNonce: v.number(),\n revision: BigIntStringSchema,\n});\n\nexport type CreateSubaccountResult = v.InferOutput<typeof CreateSubaccountResultSchema>;\n\nexport const SubaccountMutationResultSchema = v.object({});\n\nexport type SubaccountMutationResult = v.InferOutput<typeof SubaccountMutationResultSchema>;\n\ntype SubaccountPatch = {\n label?: string;\n icon?: string;\n color?: string;\n status?: (typeof SUBACCOUNT_STATUS_VALUES)[number];\n};\n\nconst SUBACCOUNT_PATCH_FIELDS = defineProtoPatchFields<SubaccountPatch>()({\n label: { path: \"label\", encode: (label) => ({ label }) },\n icon: { path: \"icon\", encode: (icon) => ({ icon }) },\n color: { path: \"color\", encode: (color) => ({ color }) },\n status: {\n path: \"status\",\n encode: (status) => ({ status: SubaccountStatusCodec.inputToProto[status] }),\n },\n});\n\nexport const UpdateSubaccountInputSchema = v.pipe(\n v.strictObject({\n subaccountId: idInputSchema(\"subaccountId\"),\n expectedRevision: positiveBigintStringInputSchema(\"expectedRevision\"),\n label: v.optional(v.string()),\n icon: v.optional(v.string()),\n color: v.optional(v.string()),\n status: v.optional(v.picklist(SUBACCOUNT_STATUS_VALUES)),\n }),\n v.check(\n ({ label, icon, color, status }) =>\n label !== undefined ||\n icon !== undefined ||\n color !== undefined ||\n status !== undefined,\n \"At least one subaccount field must be provided\",\n ),\n v.transform(({ subaccountId, expectedRevision, ...input }) => {\n const { patch: subaccount, updateMask } = buildProtoPatch(input, SUBACCOUNT_PATCH_FIELDS);\n return {\n subaccountId,\n subaccount,\n updateMask,\n expectedRevision,\n };\n }),\n);\n\nexport type UpdateSubaccountInput = v.InferInput<typeof UpdateSubaccountInputSchema>;\n\nexport const InviteSubaccountMemberInputSchema = v.strictObject({\n subaccountId: idInputSchema(\"subaccountId\"),\n granteeAccountId: idInputSchema(\"granteeAccountId\"),\n role: v.pipe(\n SubaccountRoleSchema,\n v.transform((role) => SubaccountRoleCodec.inputToProto[role]),\n ),\n});\n\nexport type InviteSubaccountMemberInput = v.InferInput<typeof InviteSubaccountMemberInputSchema>;\n\nexport const RemoveSubaccountMemberInputSchema = v.strictObject({\n subaccountId: idInputSchema(\"subaccountId\"),\n granteeAccountId: idInputSchema(\"granteeAccountId\"),\n});\n\nexport type RemoveSubaccountMemberInput = v.InferInput<typeof RemoveSubaccountMemberInputSchema>;\n\nexport const UpdateSubaccountMemberRoleInputSchema = InviteSubaccountMemberInputSchema;\n\nexport type UpdateSubaccountMemberRoleInput = v.InferInput<\n typeof UpdateSubaccountMemberRoleInputSchema\n>;\n\nexport const SetSubaccountMemberMfaRequirementInputSchema = v.strictObject({\n subaccountId: idInputSchema(\"subaccountId\"),\n requireMemberMfa: v.boolean(),\n});\n\nexport type SetSubaccountMemberMfaRequirementInput = v.InferInput<\n typeof SetSubaccountMemberMfaRequirementInputSchema\n>;\n\nexport const ListSubaccountInvitesInputSchema = v.strictObject({\n direction: v.pipe(\n v.optional(v.picklist(SUBACCOUNT_INVITE_DIRECTION_VALUES), \"\"),\n v.transform((direction) => SubaccountInviteDirectionCodec.inputToProto[direction]),\n ),\n});\n\nexport type ListSubaccountInvitesInput = v.InferInput<typeof ListSubaccountInvitesInputSchema>;\n\nconst InviteActionSchema = v.picklist([\"accept\", \"decline\", \"cancel\"]);\n\nconst InviteStatusSchema = v.picklist([\"pending\", \"accepted\", \"declined\", \"cancelled\"]);\n\nexport type SubaccountInviteStatus = v.InferOutput<typeof InviteStatusSchema>;\n\nconst ProtoInviteStatusSchema = v.number();\n\nexport const RespondSubaccountInviteInputSchema = v.strictObject({\n inviteId: idInputSchema(\"inviteId\"),\n action: v.pipe(\n InviteActionSchema,\n v.transform((v) => InviteActionCodec.inputToProto[v]),\n ),\n});\n\nexport type RespondSubaccountInviteInput = v.InferInput<typeof RespondSubaccountInviteInputSchema>;\n\nconst ProtoSubaccountStatusSchema = enumLabelSchema(SubaccountStatusCodec.protoToOutput);\n\nexport type SubaccountStatus = v.InferOutput<typeof ProtoSubaccountStatusSchema>;\n\nexport const SubaccountSchema = v.pipe(\n v.object({\n id: PublicIdSchema,\n role: ProtoSubaccountRoleSchema,\n label: v.optional(v.string(), \"\"),\n icon: v.optional(v.string(), \"\"),\n color: v.optional(v.string(), \"\"),\n status: ProtoSubaccountStatusSchema,\n smartAccountAddress: v.string(),\n smartAccountSaltNonce: v.optional(v.number()),\n ownerUsername: v.optional(v.string(), \"\"),\n ownerAvatarUrl: v.optional(v.string(), \"\"),\n ownerRootSmartAccountAddress: v.string(),\n subaccountPolicyId: PublicIdSchema,\n requireMemberMfa: v.optional(v.boolean(), false),\n updatedAt: v.optional(TimestampSchema),\n revision: BigIntStringSchema,\n }),\n v.transform(({ updatedAt, ...subaccount }) => ({\n ...subaccount,\n updatedAt: tsObjToMs(updatedAt),\n updatedAtNs: tsObjToNsString(updatedAt),\n })),\n);\n\nexport type Subaccount = v.InferOutput<typeof SubaccountSchema>;\n\nexport const SubaccountMemberSchema = v.object({\n accountId: PublicIdSchema,\n role: ProtoSubaccountRoleSchema,\n username: v.optional(v.string(), \"\"),\n smartAccountAddress: v.string(),\n avatarUrl: v.optional(v.string(), \"\"),\n mfaEnrolled: v.optional(v.boolean(), false),\n});\n\nexport type SubaccountMember = v.InferOutput<typeof SubaccountMemberSchema>;\n\nexport const SubaccountInviteSchema = v.pipe(\n v.object({\n id: PublicIdSchema,\n subaccountId: PublicIdSchema,\n granteeAccountId: PublicIdSchema,\n inviterAccountId: PublicIdSchema,\n role: ProtoSubaccountRoleSchema,\n status: v.pipe(\n ProtoInviteStatusSchema,\n v.transform((v) => enumLabel(InviteStatusCodec.protoToOutput, v)),\n ),\n createdAt: OptionalTimestampMsSchema,\n respondedAt: OptionalTimestampMsSchema,\n granteeUsername: v.optional(v.string(), \"\"),\n inviterUsername: v.optional(v.string(), \"\"),\n subaccountLabel: v.optional(v.string(), \"\"),\n inviterRootSmartAccountAddress: v.string(),\n granteeRootSmartAccountAddress: v.string(),\n requireMemberMfa: v.boolean(),\n }),\n v.transform(\n ({\n subaccountLabel,\n subaccountId,\n inviterRootSmartAccountAddress,\n granteeRootSmartAccountAddress,\n ...rest\n }) => ({\n ...rest,\n subaccountId,\n subaccountLabel,\n inviterSmartAccountAddress: inviterRootSmartAccountAddress,\n granteeSmartAccountAddress: granteeRootSmartAccountAddress,\n }),\n ),\n);\n\nexport type SubaccountInvite = v.InferOutput<typeof SubaccountInviteSchema>;\n\nexport const SubaccountActivityInputSchema = v.strictObject({\n subaccountId: idInputSchema(\"subaccountId\"),\n limit: v.optional(v.pipe(v.number(), v.integer(), v.minValue(0), v.maxValue(200)), 50),\n pageToken: v.optional(v.pipe(v.string(), v.trim()), \"\"),\n});\n\nexport type SubaccountActivityInput = v.InferInput<typeof SubaccountActivityInputSchema>;\n\nexport const SubaccountActivityEventSchema = v.object({\n createdAt: OptionalTimestampMsSchema,\n entityKind: enumLabelSchema(ActivityEntityKindCodec.protoToOutput),\n eventAction: enumLabelSchema(ActivityEventActionCodec.protoToOutput),\n source: enumLabelSchema(ActivityEventSourceCodec.protoToOutput),\n ip: v.optional(v.string()),\n userAgent: v.optional(v.string()),\n actorAccountId: PublicIdSchema,\n payloadJson: v.pipe(\n v.string(),\n v.transform((v) => JSON.parse(v)),\n ),\n});\n\nexport type SubaccountEvent = v.InferOutput<typeof SubaccountActivityEventSchema>;\n"],"mappings":";;;;;;;;AA0CA,MAAa,uBAAuB,EAAE,SAAS;CAR3C;CACA;CACA;CACA;CACA;CACA;AAG2C,CAAsB;AAIrE,MAAM,4BAA4B,gBAAgB,oBAAoB,aAAa;AAEnF,MAAM,kCAAkC,gBAAgB,0BAA0B,aAAa;AAI/F,MAAa,uCAAuC,EAAE,OAAO;CACzD,YAAY;CACZ,aAAa,EAAE,SAAS,EAAE,OAAO,GAAG,EAAE;CACtC,aAAa,EAAE,SAAS,EAAE,OAAO,GAAG,EAAE;CACtC,cAAc,gBAAgB,kBAAkB,aAAa;AACjE,CAAC;AAMD,MAAa,iCAAiC,EAAE,OAAO;CACnD,MAAM;CACN,aAAa,EAAE,SAAS,EAAE,OAAO,GAAG,EAAE;CACtC,aAAa,EAAE,SAAS,EAAE,OAAO,GAAG,EAAE;CACtC,YAAY,EAAE,SAAS,EAAE,QAAQ,GAAG,KAAK;CACzC,aAAa,EAAE,SAAS,EAAE,MAAM,+BAA+B,GAAG,CAAC,CAAC;AACxE,CAAC;AAID,MAAa,8BAA8B,EAAE,OAAO;CAChD,aAAa,EAAE,SAAS,EAAE,MAAM,oCAAoC,GAAG,CAAC,CAAC;CACzE,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,GAAG,CAAC,CAAC;AACjE,CAAC;AAID,MAAa,uCAAuC,EAAE,OAAO;CACzD,MAAM;CACN,aAAa,EAAE,SAAS,EAAE,MAAM,+BAA+B,GAAG,CAAC,CAAC;CACpE,oBAAoB;AACxB,CAAC;AAMD,MAAa,uCAAuC,EAAE,aAAa;CAC/D,cAAc;CACd,KAAK;AACT,CAAC;AAMD,MAAa,4BAA4B,EAAE,OAAO;CAC9C,SAAS;CACT,qBAAqB;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ACzC,kBAAkB,EAAE,QAAQ;AAChC,CAAC,GACD,EAAE,WACG,EACG,iBACA,cACA,gCACA,gCACA,GAAG,YACA;CACH,GAAG;CACH;CACA;CACA,4BAA4B;CAC5B,4BAA4B;AAChC,EACJ,CACJ;AAIA,MAAa,gCAAgC,EAAE,aAAa;CACxD,cAAc,cAAc,cAAc;CAC1C,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,GAAG,EAAE,QAAQ,GAAG,EAAE,SAAS,CAAC,GAAG,EAAE,SAAS,GAAG,CAAC,GAAG,EAAE;CACrF,WAAW,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,GAAG,EAAE,KAAK,CAAC,GAAG,EAAE;AAC1D,CAAC;AAID,MAAa,gCAAgC,EAAE,OAAO;CAClD,WAAW;CACX,YAAY,gBAAgB,wBAAwB,aAAa;CACjE,aAAa,gBAAgB,yBAAyB,aAAa;CACnE,QAAQ,gBAAgB,yBAAyB,aAAa;CAC9D,IAAI,EAAE,SAAS,EAAE,OAAO,CAAC;CACzB,WAAW,EAAE,SAAS,EAAE,OAAO,CAAC;CAChC,gBAAgB;CAChB,aAAa,EAAE,KACX,EAAE,OAAO,GACT,EAAE,WAAW,MAAM,KAAK,MAAM,CAAC,CAAC,CACpC;AACJ,CAAC"}
1
+ {"version":3,"file":"subaccounts.schemas.js","names":[],"sources":["../../../src/services/subaccounts/subaccounts.schemas.ts"],"sourcesContent":["import {\n WalletAddressSchema,\n WalletChallengeMessageSchema,\n WalletChallengeUriSchema,\n WalletSignatureSchema,\n} from \"../auth/wallet-challenge.schemas.js\";\nimport * as v from \"valibot\";\nimport {\n BigIntStringSchema,\n OptionalTimestampMsSchema,\n PublicIdOrEmptySchema,\n PublicIdSchema,\n TimestampSchema,\n idInputSchema,\n positiveBigintStringInputSchema,\n} from \"../../shared/schemas.js\";\nimport { tsObjToMs, tsObjToNsString } from \"../../utils/time.js\";\nimport { enumLabel, enumLabelSchema } from \"../../shared/proto-enum-codec.js\";\nimport {\n SubaccountRoleCodec,\n SubaccountPermissionCodec,\n InviteActionCodec,\n InviteStatusCodec,\n SubaccountInviteDirectionCodec,\n SUBACCOUNT_INVITE_DIRECTION_VALUES,\n SubaccountStatusCodec,\n SUBACCOUNT_STATUS_VALUES,\n ActivityEntityKindCodec,\n ActivityEventActionCodec,\n ActivityEventSourceCodec,\n} from \"./subaccounts.codecs.js\";\nimport { PolicyActionCodec } from \"../policies/shared.codecs.js\";\nimport { buildProtoPatch, defineProtoPatchFields } from \"../../utils/proto-patch.js\";\n\nconst SUBACCOUNT_ROLE_VALUES = [\n \"owner\",\n \"admin\",\n \"treasury\",\n \"leveraged_trader\",\n \"trader\",\n \"viewer\",\n] as const;\n\nexport const SubaccountRoleSchema = v.picklist(SUBACCOUNT_ROLE_VALUES);\n\nexport type SubaccountRole = v.InferOutput<typeof SubaccountRoleSchema>;\n\nconst ProtoSubaccountRoleSchema = enumLabelSchema(SubaccountRoleCodec.protoToOutput);\n\nconst ProtoSubaccountPermissionSchema = enumLabelSchema(SubaccountPermissionCodec.protoToOutput);\n\nexport type SubaccountPermission = v.InferOutput<typeof ProtoSubaccountPermissionSchema>;\n\nexport const SubaccountPermissionDefinitionSchema = v.object({\n permission: ProtoSubaccountPermissionSchema,\n displayName: v.optional(v.string(), \"\"),\n description: v.optional(v.string(), \"\"),\n policyAction: enumLabelSchema(PolicyActionCodec.protoToOutput),\n});\n\nexport type SubaccountPermissionDefinition = v.InferOutput<\n typeof SubaccountPermissionDefinitionSchema\n>;\n\nexport const SubaccountRoleDefinitionSchema = v.object({\n role: ProtoSubaccountRoleSchema,\n displayName: v.optional(v.string(), \"\"),\n description: v.optional(v.string(), \"\"),\n assignable: v.optional(v.boolean(), false),\n permissions: v.optional(v.array(ProtoSubaccountPermissionSchema), []),\n});\n\nexport type SubaccountRoleDefinition = v.InferOutput<typeof SubaccountRoleDefinitionSchema>;\n\nexport const SubaccountRoleCatalogSchema = v.object({\n permissions: v.optional(v.array(SubaccountPermissionDefinitionSchema), []),\n roles: v.optional(v.array(SubaccountRoleDefinitionSchema), []),\n});\n\nexport type SubaccountRoleCatalog = v.InferOutput<typeof SubaccountRoleCatalogSchema>;\n\nexport const EffectiveSubaccountPermissionsSchema = v.object({\n role: ProtoSubaccountRoleSchema,\n permissions: v.optional(v.array(ProtoSubaccountPermissionSchema), []),\n subaccountPolicyId: PublicIdOrEmptySchema,\n});\n\nexport type EffectiveSubaccountPermissions = v.InferOutput<\n typeof EffectiveSubaccountPermissionsSchema\n>;\n\nexport const CreateSubaccountChallengeInputSchema = v.strictObject({\n ownerAddress: WalletAddressSchema,\n uri: WalletChallengeUriSchema,\n});\n\nexport type CreateSubaccountChallengeInput = v.InferInput<\n typeof CreateSubaccountChallengeInputSchema\n>;\n\nexport const SubaccountChallengeSchema = v.object({\n message: WalletChallengeMessageSchema,\n smartAccountAddress: WalletAddressSchema,\n smartAccountSaltNonce: v.number(),\n expiresAt: OptionalTimestampMsSchema,\n polyesterChainId: v.pipe(v.bigint(), v.transform(Number)),\n});\n\nexport type SubaccountChallenge = v.InferOutput<typeof SubaccountChallengeSchema>;\n\nexport const CreateSubaccountInputSchema = v.strictObject({\n label: v.optional(v.string(), \"\"),\n icon: v.optional(v.string(), \"\"),\n color: v.optional(v.string(), \"\"),\n smartAccountAddress: WalletAddressSchema,\n message: WalletChallengeMessageSchema,\n signature: WalletSignatureSchema,\n});\n\nexport type CreateSubaccountInput = v.InferInput<typeof CreateSubaccountInputSchema>;\n\nexport const SubaccountIdInputSchema = v.strictObject({\n subaccountId: idInputSchema(\"subaccountId\"),\n});\n\nexport type SubaccountIdInput = v.InferInput<typeof SubaccountIdInputSchema>;\n\nexport const CreateSubaccountResultSchema = v.object({\n subaccountId: PublicIdSchema,\n totalCreated: v.number(),\n smartAccountSaltNonce: v.number(),\n revision: BigIntStringSchema,\n});\n\nexport type CreateSubaccountResult = v.InferOutput<typeof CreateSubaccountResultSchema>;\n\nexport const SubaccountMutationResultSchema = v.object({});\n\nexport type SubaccountMutationResult = v.InferOutput<typeof SubaccountMutationResultSchema>;\n\ntype SubaccountPatch = {\n label?: string;\n icon?: string;\n color?: string;\n status?: (typeof SUBACCOUNT_STATUS_VALUES)[number];\n};\n\nconst SUBACCOUNT_PATCH_FIELDS = defineProtoPatchFields<SubaccountPatch>()({\n label: { path: \"label\", encode: (label) => ({ label }) },\n icon: { path: \"icon\", encode: (icon) => ({ icon }) },\n color: { path: \"color\", encode: (color) => ({ color }) },\n status: {\n path: \"status\",\n encode: (status) => ({ status: SubaccountStatusCodec.inputToProto[status] }),\n },\n});\n\nexport const UpdateSubaccountInputSchema = v.pipe(\n v.strictObject({\n subaccountId: idInputSchema(\"subaccountId\"),\n expectedRevision: positiveBigintStringInputSchema(\"expectedRevision\"),\n label: v.optional(v.string()),\n icon: v.optional(v.string()),\n color: v.optional(v.string()),\n status: v.optional(v.picklist(SUBACCOUNT_STATUS_VALUES)),\n }),\n v.check(\n ({ label, icon, color, status }) =>\n label !== undefined ||\n icon !== undefined ||\n color !== undefined ||\n status !== undefined,\n \"At least one subaccount field must be provided\",\n ),\n v.transform(({ subaccountId, expectedRevision, ...input }) => {\n const { patch: subaccount, updateMask } = buildProtoPatch(input, SUBACCOUNT_PATCH_FIELDS);\n return {\n subaccountId,\n subaccount,\n updateMask,\n expectedRevision,\n };\n }),\n);\n\nexport type UpdateSubaccountInput = v.InferInput<typeof UpdateSubaccountInputSchema>;\n\nexport const InviteSubaccountMemberInputSchema = v.strictObject({\n subaccountId: idInputSchema(\"subaccountId\"),\n granteeAccountId: idInputSchema(\"granteeAccountId\"),\n role: v.pipe(\n SubaccountRoleSchema,\n v.transform((role) => SubaccountRoleCodec.inputToProto[role]),\n ),\n});\n\nexport type InviteSubaccountMemberInput = v.InferInput<typeof InviteSubaccountMemberInputSchema>;\n\nexport const RemoveSubaccountMemberInputSchema = v.strictObject({\n subaccountId: idInputSchema(\"subaccountId\"),\n granteeAccountId: idInputSchema(\"granteeAccountId\"),\n});\n\nexport type RemoveSubaccountMemberInput = v.InferInput<typeof RemoveSubaccountMemberInputSchema>;\n\nexport const UpdateSubaccountMemberRoleInputSchema = InviteSubaccountMemberInputSchema;\n\nexport type UpdateSubaccountMemberRoleInput = v.InferInput<\n typeof UpdateSubaccountMemberRoleInputSchema\n>;\n\nexport const SetSubaccountMemberMfaRequirementInputSchema = v.strictObject({\n subaccountId: idInputSchema(\"subaccountId\"),\n requireMemberMfa: v.boolean(),\n});\n\nexport type SetSubaccountMemberMfaRequirementInput = v.InferInput<\n typeof SetSubaccountMemberMfaRequirementInputSchema\n>;\n\nexport const ListSubaccountInvitesInputSchema = v.strictObject({\n direction: v.pipe(\n v.optional(v.picklist(SUBACCOUNT_INVITE_DIRECTION_VALUES), \"\"),\n v.transform((direction) => SubaccountInviteDirectionCodec.inputToProto[direction]),\n ),\n});\n\nexport type ListSubaccountInvitesInput = v.InferInput<typeof ListSubaccountInvitesInputSchema>;\n\nconst InviteActionSchema = v.picklist([\"accept\", \"decline\", \"cancel\"]);\n\nconst InviteStatusSchema = v.picklist([\"pending\", \"accepted\", \"declined\", \"cancelled\"]);\n\nexport type SubaccountInviteStatus = v.InferOutput<typeof InviteStatusSchema>;\n\nconst ProtoInviteStatusSchema = v.number();\n\nexport const RespondSubaccountInviteInputSchema = v.strictObject({\n inviteId: idInputSchema(\"inviteId\"),\n action: v.pipe(\n InviteActionSchema,\n v.transform((v) => InviteActionCodec.inputToProto[v]),\n ),\n});\n\nexport type RespondSubaccountInviteInput = v.InferInput<typeof RespondSubaccountInviteInputSchema>;\n\nconst ProtoSubaccountStatusSchema = enumLabelSchema(SubaccountStatusCodec.protoToOutput);\n\nexport type SubaccountStatus = v.InferOutput<typeof ProtoSubaccountStatusSchema>;\n\nexport const SubaccountSchema = v.pipe(\n v.object({\n id: PublicIdSchema,\n role: ProtoSubaccountRoleSchema,\n label: v.optional(v.string(), \"\"),\n icon: v.optional(v.string(), \"\"),\n color: v.optional(v.string(), \"\"),\n status: ProtoSubaccountStatusSchema,\n smartAccountAddress: v.string(),\n smartAccountSaltNonce: v.optional(v.number()),\n ownerUsername: v.optional(v.string(), \"\"),\n ownerAvatarUrl: v.optional(v.string(), \"\"),\n ownerRootSmartAccountAddress: v.string(),\n subaccountPolicyId: PublicIdOrEmptySchema,\n requireMemberMfa: v.optional(v.boolean(), false),\n updatedAt: v.optional(TimestampSchema),\n revision: BigIntStringSchema,\n }),\n v.transform(({ updatedAt, ...subaccount }) => ({\n ...subaccount,\n updatedAt: tsObjToMs(updatedAt),\n updatedAtNs: tsObjToNsString(updatedAt),\n })),\n);\n\nexport type Subaccount = v.InferOutput<typeof SubaccountSchema>;\n\nexport const SubaccountMemberSchema = v.object({\n accountId: PublicIdSchema,\n role: ProtoSubaccountRoleSchema,\n username: v.optional(v.string(), \"\"),\n smartAccountAddress: v.string(),\n avatarUrl: v.optional(v.string(), \"\"),\n mfaEnrolled: v.optional(v.boolean(), false),\n});\n\nexport type SubaccountMember = v.InferOutput<typeof SubaccountMemberSchema>;\n\nexport const SubaccountInviteSchema = v.pipe(\n v.object({\n id: PublicIdSchema,\n subaccountId: PublicIdSchema,\n granteeAccountId: PublicIdSchema,\n inviterAccountId: PublicIdSchema,\n role: ProtoSubaccountRoleSchema,\n status: v.pipe(\n ProtoInviteStatusSchema,\n v.transform((v) => enumLabel(InviteStatusCodec.protoToOutput, v)),\n ),\n createdAt: OptionalTimestampMsSchema,\n respondedAt: OptionalTimestampMsSchema,\n granteeUsername: v.optional(v.string(), \"\"),\n inviterUsername: v.optional(v.string(), \"\"),\n subaccountLabel: v.optional(v.string(), \"\"),\n inviterRootSmartAccountAddress: v.string(),\n granteeRootSmartAccountAddress: v.string(),\n requireMemberMfa: v.boolean(),\n }),\n v.transform(\n ({\n subaccountLabel,\n subaccountId,\n inviterRootSmartAccountAddress,\n granteeRootSmartAccountAddress,\n ...rest\n }) => ({\n ...rest,\n subaccountId,\n subaccountLabel,\n inviterSmartAccountAddress: inviterRootSmartAccountAddress,\n granteeSmartAccountAddress: granteeRootSmartAccountAddress,\n }),\n ),\n);\n\nexport type SubaccountInvite = v.InferOutput<typeof SubaccountInviteSchema>;\n\nexport const SubaccountActivityInputSchema = v.strictObject({\n subaccountId: idInputSchema(\"subaccountId\"),\n limit: v.optional(v.pipe(v.number(), v.integer(), v.minValue(0), v.maxValue(200)), 50),\n pageToken: v.optional(v.pipe(v.string(), v.trim()), \"\"),\n});\n\nexport type SubaccountActivityInput = v.InferInput<typeof SubaccountActivityInputSchema>;\n\nexport const SubaccountActivityEventSchema = v.object({\n createdAt: OptionalTimestampMsSchema,\n entityKind: enumLabelSchema(ActivityEntityKindCodec.protoToOutput),\n eventAction: enumLabelSchema(ActivityEventActionCodec.protoToOutput),\n source: enumLabelSchema(ActivityEventSourceCodec.protoToOutput),\n ip: v.optional(v.string()),\n userAgent: v.optional(v.string()),\n actorAccountId: PublicIdSchema,\n payloadJson: v.pipe(\n v.string(),\n v.transform((v) => JSON.parse(v)),\n ),\n});\n\nexport type SubaccountEvent = v.InferOutput<typeof SubaccountActivityEventSchema>;\n"],"mappings":";;;;;;;;AA2CA,MAAa,uBAAuB,EAAE,SAAS;CAR3C;CACA;CACA;CACA;CACA;CACA;AAG2C,CAAsB;AAIrE,MAAM,4BAA4B,gBAAgB,oBAAoB,aAAa;AAEnF,MAAM,kCAAkC,gBAAgB,0BAA0B,aAAa;AAI/F,MAAa,uCAAuC,EAAE,OAAO;CACzD,YAAY;CACZ,aAAa,EAAE,SAAS,EAAE,OAAO,GAAG,EAAE;CACtC,aAAa,EAAE,SAAS,EAAE,OAAO,GAAG,EAAE;CACtC,cAAc,gBAAgB,kBAAkB,aAAa;AACjE,CAAC;AAMD,MAAa,iCAAiC,EAAE,OAAO;CACnD,MAAM;CACN,aAAa,EAAE,SAAS,EAAE,OAAO,GAAG,EAAE;CACtC,aAAa,EAAE,SAAS,EAAE,OAAO,GAAG,EAAE;CACtC,YAAY,EAAE,SAAS,EAAE,QAAQ,GAAG,KAAK;CACzC,aAAa,EAAE,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