@tbox.cn/app-contracts 0.12.4 → 0.13.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.
- package/dist/identity.d.ts +6 -2
- package/dist/runtime.js +8 -2
- package/package.json +1 -1
package/dist/identity.d.ts
CHANGED
|
@@ -78,7 +78,7 @@ export interface ExchangeRequest {
|
|
|
78
78
|
}
|
|
79
79
|
/**
|
|
80
80
|
* 换码器接口:ExchangeRequest → ExchangeResult(identity + 可选外部凭据)。
|
|
81
|
-
*
|
|
81
|
+
* 内置实现(支付宝/微信)与 provider 包换码器均实现本接口。
|
|
82
82
|
*/
|
|
83
83
|
export interface IdentityExchange {
|
|
84
84
|
readonly provider: string;
|
|
@@ -98,8 +98,12 @@ export declare const AUTH_ERROR_CODES: {
|
|
|
98
98
|
readonly BROWSER_LOGIN_DISABLED: "AUTH_BROWSER_LOGIN_DISABLED";
|
|
99
99
|
/** 502:外部 provider 错误 */
|
|
100
100
|
readonly EXTERNAL_ERROR: "AUTH_EXTERNAL_ERROR";
|
|
101
|
-
/** 503:密钥链缺失(prod fail-fast
|
|
101
|
+
/** 503:密钥链缺失(prod fail-fast 启动拒绝——启动期语义;登录路由不再产出本码) */
|
|
102
102
|
readonly MISSING_SECRET: "AUTH_MISSING_SECRET";
|
|
103
|
+
/** 503:登录链配置缺失(换码 env/实例/物料)——修复动作 = 补配置 */
|
|
104
|
+
readonly NOT_CONFIGURED: "AUTH_NOT_CONFIGURED";
|
|
105
|
+
/** 503:登录域选择缺失(未选择商场且无默认商圈)——修复动作 = 入口带 mallId / 配 defaultInstanceId */
|
|
106
|
+
readonly SCOPE_REQUIRED: "AUTH_SCOPE_REQUIRED";
|
|
103
107
|
};
|
|
104
108
|
export type AuthErrorCode = (typeof AUTH_ERROR_CODES)[keyof typeof AUTH_ERROR_CODES];
|
|
105
109
|
/** 错误码 → HTTP 状态(客户端行为映射:401 重登录 / 403 提示 / 502 重试 / 503 配置) */
|
package/dist/runtime.js
CHANGED
|
@@ -20,8 +20,12 @@ var AUTH_ERROR_CODES = {
|
|
|
20
20
|
BROWSER_LOGIN_DISABLED: "AUTH_BROWSER_LOGIN_DISABLED",
|
|
21
21
|
/** 502:外部 provider 错误 */
|
|
22
22
|
EXTERNAL_ERROR: "AUTH_EXTERNAL_ERROR",
|
|
23
|
-
/** 503:密钥链缺失(prod fail-fast
|
|
24
|
-
MISSING_SECRET: "AUTH_MISSING_SECRET"
|
|
23
|
+
/** 503:密钥链缺失(prod fail-fast 启动拒绝——启动期语义;登录路由不再产出本码) */
|
|
24
|
+
MISSING_SECRET: "AUTH_MISSING_SECRET",
|
|
25
|
+
/** 503:登录链配置缺失(换码 env/实例/物料)——修复动作 = 补配置 */
|
|
26
|
+
NOT_CONFIGURED: "AUTH_NOT_CONFIGURED",
|
|
27
|
+
/** 503:登录域选择缺失(未选择商场且无默认商圈)——修复动作 = 入口带 mallId / 配 defaultInstanceId */
|
|
28
|
+
SCOPE_REQUIRED: "AUTH_SCOPE_REQUIRED"
|
|
25
29
|
};
|
|
26
30
|
function authCodeToStatus(code) {
|
|
27
31
|
switch (code) {
|
|
@@ -36,6 +40,8 @@ function authCodeToStatus(code) {
|
|
|
36
40
|
case AUTH_ERROR_CODES.EXTERNAL_ERROR:
|
|
37
41
|
return 502;
|
|
38
42
|
case AUTH_ERROR_CODES.MISSING_SECRET:
|
|
43
|
+
case AUTH_ERROR_CODES.NOT_CONFIGURED:
|
|
44
|
+
case AUTH_ERROR_CODES.SCOPE_REQUIRED:
|
|
39
45
|
return 503;
|
|
40
46
|
default:
|
|
41
47
|
return 401;
|