connect-api-cli 1.1.10 → 1.1.11
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/README.md +7 -5
- package/dist/cli.js +1347 -219
- package/dist/index.d.mts +20 -1
- package/dist/index.d.ts +20 -1
- package/dist/index.js +863 -124
- package/dist/index.mjs +836 -100
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -42,6 +42,8 @@ interface OAuthRefreshResponse {
|
|
|
42
42
|
ret: ConnectRet;
|
|
43
43
|
accessToken: string;
|
|
44
44
|
expireTime: number;
|
|
45
|
+
/** 刷新接口通常不返回新值;若返回则覆盖旧的 refreshToken */
|
|
46
|
+
refreshToken?: string;
|
|
45
47
|
}
|
|
46
48
|
/** HarmonyOS 开发者中心下载的 Service Account 凭据(*_private.json) */
|
|
47
49
|
interface ServiceAccountCredentials {
|
|
@@ -55,6 +57,23 @@ interface ServiceAccountCredentials {
|
|
|
55
57
|
client_cert_uri?: string;
|
|
56
58
|
}
|
|
57
59
|
|
|
60
|
+
/** 刷新被服务端拒绝(refreshToken 失效),调用方应提示重新登录,不要打开浏览器。 */
|
|
61
|
+
declare class OAuthRefreshRejectedError extends Error {
|
|
62
|
+
constructor(message: string);
|
|
63
|
+
}
|
|
64
|
+
interface NormalizedOAuthToken {
|
|
65
|
+
accessToken: string;
|
|
66
|
+
/** 秒。服务端没给、给了 0 或字段名对不上时为 0,表示没有过期时间。 */
|
|
67
|
+
expireTime: number;
|
|
68
|
+
refreshToken?: string;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* 换票 / 刷新响应的字段名并不稳定。
|
|
72
|
+
* 同时认 expireTime / expiresTime / expiresIn / expires_in 与 refreshToken / refresh_token。
|
|
73
|
+
*/
|
|
74
|
+
declare function normalizeOAuthToken(data: unknown, previousRefreshToken?: string): NormalizedOAuthToken;
|
|
75
|
+
/** HTTP 4xx 或业务码拒绝都算 refreshToken 失效;超时和断网不是。 */
|
|
76
|
+
declare function isDefinitiveOAuthRefreshFailure(err: unknown): boolean;
|
|
58
77
|
declare class AuthService {
|
|
59
78
|
/**
|
|
60
79
|
* 获取访问API的Token(service to service,client_credentials 模式)
|
|
@@ -750,4 +769,4 @@ interface AgcConfig {
|
|
|
750
769
|
}
|
|
751
770
|
declare function getConfig(authMode?: AuthMode): AgcConfig;
|
|
752
771
|
|
|
753
|
-
export { type AgcConfig, type AuthMode, AuthService, type DevecoConfig, type OAuthConfig, ProjectService, ProvisionService, PublishService, type ServiceAccountConfig, UploadService, connectApiClient, getConfig };
|
|
772
|
+
export { type AgcConfig, type AuthMode, AuthService, type DevecoConfig, type NormalizedOAuthToken, type OAuthConfig, OAuthRefreshRejectedError, ProjectService, ProvisionService, PublishService, type ServiceAccountConfig, UploadService, connectApiClient, getConfig, isDefinitiveOAuthRefreshFailure, normalizeOAuthToken };
|
package/dist/index.d.ts
CHANGED
|
@@ -42,6 +42,8 @@ interface OAuthRefreshResponse {
|
|
|
42
42
|
ret: ConnectRet;
|
|
43
43
|
accessToken: string;
|
|
44
44
|
expireTime: number;
|
|
45
|
+
/** 刷新接口通常不返回新值;若返回则覆盖旧的 refreshToken */
|
|
46
|
+
refreshToken?: string;
|
|
45
47
|
}
|
|
46
48
|
/** HarmonyOS 开发者中心下载的 Service Account 凭据(*_private.json) */
|
|
47
49
|
interface ServiceAccountCredentials {
|
|
@@ -55,6 +57,23 @@ interface ServiceAccountCredentials {
|
|
|
55
57
|
client_cert_uri?: string;
|
|
56
58
|
}
|
|
57
59
|
|
|
60
|
+
/** 刷新被服务端拒绝(refreshToken 失效),调用方应提示重新登录,不要打开浏览器。 */
|
|
61
|
+
declare class OAuthRefreshRejectedError extends Error {
|
|
62
|
+
constructor(message: string);
|
|
63
|
+
}
|
|
64
|
+
interface NormalizedOAuthToken {
|
|
65
|
+
accessToken: string;
|
|
66
|
+
/** 秒。服务端没给、给了 0 或字段名对不上时为 0,表示没有过期时间。 */
|
|
67
|
+
expireTime: number;
|
|
68
|
+
refreshToken?: string;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* 换票 / 刷新响应的字段名并不稳定。
|
|
72
|
+
* 同时认 expireTime / expiresTime / expiresIn / expires_in 与 refreshToken / refresh_token。
|
|
73
|
+
*/
|
|
74
|
+
declare function normalizeOAuthToken(data: unknown, previousRefreshToken?: string): NormalizedOAuthToken;
|
|
75
|
+
/** HTTP 4xx 或业务码拒绝都算 refreshToken 失效;超时和断网不是。 */
|
|
76
|
+
declare function isDefinitiveOAuthRefreshFailure(err: unknown): boolean;
|
|
58
77
|
declare class AuthService {
|
|
59
78
|
/**
|
|
60
79
|
* 获取访问API的Token(service to service,client_credentials 模式)
|
|
@@ -750,4 +769,4 @@ interface AgcConfig {
|
|
|
750
769
|
}
|
|
751
770
|
declare function getConfig(authMode?: AuthMode): AgcConfig;
|
|
752
771
|
|
|
753
|
-
export { type AgcConfig, type AuthMode, AuthService, type DevecoConfig, type OAuthConfig, ProjectService, ProvisionService, PublishService, type ServiceAccountConfig, UploadService, connectApiClient, getConfig };
|
|
772
|
+
export { type AgcConfig, type AuthMode, AuthService, type DevecoConfig, type NormalizedOAuthToken, type OAuthConfig, OAuthRefreshRejectedError, ProjectService, ProvisionService, PublishService, type ServiceAccountConfig, UploadService, connectApiClient, getConfig, isDefinitiveOAuthRefreshFailure, normalizeOAuthToken };
|