AGC认证错误重新生成ts-rs绑定

- ClientAuthError 联合收敛为类别变体 + 类型化 reason,无字段变体仍是 { type }
- 新增 AuthNetworkFailure/AuthNetworkReason/AuthResponseInvalid/AuthResponseInvalidReason/ServerAddressRejected/ServerAddressReason
- 删除拍平变体后不再生成的 AuthResponseServerRejected 载荷文件
This commit is contained in:
2026-10-02 02:42:26 +08:00
parent 254f2767cc
commit d5516d43fa
8 changed files with 63 additions and 21 deletions
@@ -0,0 +1,7 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { AuthNetworkReason } from './AuthNetworkReason';
/**
* 连接登录服务的传输层失败原因。
*/
export type AuthNetworkFailure = { reason: AuthNetworkReason };
@@ -0,0 +1,6 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
/**
* 连接登录服务失败的具体原因。
*/
export type AuthNetworkReason = 'timeout' | 'unreachable';
@@ -0,0 +1,13 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { AuthResponseInvalidReason } from './AuthResponseInvalidReason';
/**
* 登录响应契约破损的原因与服务端原文。
*/
export type AuthResponseInvalid = {
reason: AuthResponseInvalidReason;
/**
* 只有 [`AuthResponseInvalidReason::ServerRejected`] 可能带服务端原文;其余是 `None`。
*/
serverMessage: string | null;
};
@@ -0,0 +1,11 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
/**
* 登录响应契约破损的具体原因。
*/
export type AuthResponseInvalidReason =
| 'notJson'
| 'invalidBody'
| 'missingRefreshCookie'
| 'missingUserIdentity'
| 'serverRejected';
@@ -1,6 +0,0 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
/**
* 登录服务在响应体里显式拒绝时给的原文。
*/
export type AuthResponseServerRejected = { serverMessage: string | null };
@@ -1,24 +1,20 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { AuthResponseServerRejected } from './AuthResponseServerRejected';
import type { AuthNetworkFailure } from './AuthNetworkFailure';
import type { AuthResponseInvalid } from './AuthResponseInvalid';
import type { AuthServiceUnavailable } from './AuthServiceUnavailable';
import type { ClientSessionPersistFailed } from './ClientSessionPersistFailed';
import type { PasswordLoginRejected } from './PasswordLoginRejected';
import type { PhoneCodeLoginRejected } from './PhoneCodeLoginRejected';
import type { RuntimeSessionInstallFailed } from './RuntimeSessionInstallFailed';
import type { SendCodeRejected } from './SendCodeRejected';
import type { ServerAddressRejected } from './ServerAddressRejected';
import type { UnexpectedRejection } from './UnexpectedRejection';
/**
* 变体名就是线上的分流键(`type`),带载荷的变体持有同名载荷类型。
*/
export type ClientAuthError =
| { type: 'serverAddressEmptyOrTooLong' }
| { type: 'serverAddressNotAUrl' }
| { type: 'serverAddressHasCredentials' }
| { type: 'serverAddressHasPathOrQueryOrFragment' }
| { type: 'serverAddressNotHttps' }
| { type: 'serverAddressUnsupportedScheme' }
| { type: 'serverAddressOutsideChannel' }
| ({ type: 'serverAddressRejected' } & ServerAddressRejected)
| { type: 'phoneNumberInvalid' }
| { type: 'passwordMissing' }
| { type: 'loginCodeMissing' }
@@ -30,15 +26,10 @@ export type ClientAuthError =
| { type: 'smsCodeRejected' }
| { type: 'sessionInvalidated' }
| { type: 'permissionDenied' }
| { type: 'authNetworkTimeout' }
| { type: 'authNetworkUnreachable' }
| ({ type: 'authNetworkFailure' } & AuthNetworkFailure)
| ({ type: 'authServiceUnavailable' } & AuthServiceUnavailable)
| ({ type: 'unexpectedRejection' } & UnexpectedRejection)
| { type: 'authResponseNotJson' }
| { type: 'authResponseInvalidBody' }
| { type: 'authResponseMissingRefreshCookie' }
| { type: 'authResponseMissingUserIdentity' }
| ({ type: 'authResponseServerRejected' } & AuthResponseServerRejected)
| ({ type: 'authResponseInvalid' } & AuthResponseInvalid)
| ({ type: 'clientSessionPersistFailed' } & ClientSessionPersistFailed)
| ({ type: 'runtimeSessionInstallFailed' } & RuntimeSessionInstallFailed)
| { type: 'authClientInitFailed' };
@@ -0,0 +1,13 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
/**
* 服务地址校验失败的具体原因。
*/
export type ServerAddressReason =
| 'emptyOrTooLong'
| 'notAUrl'
| 'hasCredentials'
| 'hasPathOrQueryOrFragment'
| 'notHttps'
| 'unsupportedScheme'
| 'outsideChannel';
@@ -0,0 +1,7 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { ServerAddressReason } from './ServerAddressReason';
/**
* 服务地址被拒的具体原因。
*/
export type ServerAddressRejected = { reason: ServerAddressReason };