connect-api-cli 1.1.3 → 1.1.4

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/index.mjs CHANGED
@@ -1,12 +1,1206 @@
1
- import {
2
- AuthService,
3
- ProjectService,
4
- ProvisionService,
5
- PublishService,
6
- UploadService,
7
- agcClient,
8
- getConfig
9
- } from "./chunk-3WGV37EN.mjs";
1
+ // src/services/auth.ts
2
+ import axios from "axios";
3
+ import * as crypto from "crypto";
4
+
5
+ // src/config/index.ts
6
+ import * as dotenv from "dotenv";
7
+ import path from "path";
8
+ import fs from "fs";
9
+ var envPath = path.resolve(process.cwd(), ".env");
10
+ if (fs.existsSync(envPath)) {
11
+ dotenv.config({ path: envPath, quiet: true });
12
+ } else {
13
+ dotenv.config({ quiet: true });
14
+ }
15
+ var DEFAULT_OAUTH = {
16
+ clientId: "117427577",
17
+ authUrl: "https://oauth-login.cloud.huawei.com/oauth2/v3/authorize",
18
+ tokenUrl: "https://connect-api.cloud.huawei.com/api/cag/v1/access-token/generate",
19
+ refreshUrl: "https://connect-api.cloud.huawei.com/api/cag/v1/access-token/refresh",
20
+ redirectUri: "http://localhost:12306",
21
+ scope: "openid profile https://www.huawei.com/auth/agc/publish https://www.huawei.com/auth/agc/develop"
22
+ };
23
+ function loadServiceAccountCredentials(filePath) {
24
+ const abs = path.isAbsolute(filePath) ? filePath : path.resolve(process.cwd(), filePath);
25
+ if (!fs.existsSync(abs)) {
26
+ throw new Error(`Service Account credentials file not found: ${abs}`);
27
+ }
28
+ let raw;
29
+ try {
30
+ raw = JSON.parse(fs.readFileSync(abs, "utf8"));
31
+ } catch {
32
+ throw new Error(`Invalid Service Account credentials JSON: ${abs}`);
33
+ }
34
+ const creds = raw;
35
+ if (!creds.key_id || !creds.private_key || !creds.sub_account) {
36
+ throw new Error(
37
+ `Service Account credentials missing required fields (key_id, private_key, sub_account): ${abs}`
38
+ );
39
+ }
40
+ return {
41
+ key_id: creds.key_id,
42
+ private_key: creds.private_key,
43
+ sub_account: creds.sub_account,
44
+ project_id: creds.project_id,
45
+ auth_uri: creds.auth_uri,
46
+ token_uri: creds.token_uri,
47
+ auth_provider_cert_uri: creds.auth_provider_cert_uri,
48
+ client_cert_uri: creds.client_cert_uri
49
+ };
50
+ }
51
+ function getConfig() {
52
+ const clientId = process.env.AGC_CLIENT_ID;
53
+ const clientSecret = process.env.AGC_CLIENT_SECRET;
54
+ const authMode = process.env.AGC_AUTH_MODE ?? "client_credentials";
55
+ if (authMode === "client_credentials" && (!clientId || !clientSecret)) {
56
+ throw new Error("Missing AGC credentials. Please set AGC_CLIENT_ID and AGC_CLIENT_SECRET environment variables.");
57
+ }
58
+ if (authMode === "service_account" && !process.env.AGC_SA_CREDENTIALS) {
59
+ throw new Error(
60
+ "Missing Service Account credentials. Please set AGC_SA_CREDENTIALS to the path of your *_private.json file."
61
+ );
62
+ }
63
+ const oauth = {
64
+ clientId: process.env.AGC_OAUTH_CLIENT_ID || DEFAULT_OAUTH.clientId,
65
+ authUrl: process.env.AGC_OAUTH_AUTH_URL || DEFAULT_OAUTH.authUrl,
66
+ tokenUrl: process.env.AGC_OAUTH_TOKEN_URL || DEFAULT_OAUTH.tokenUrl,
67
+ refreshUrl: process.env.AGC_OAUTH_REFRESH_URL || DEFAULT_OAUTH.refreshUrl,
68
+ redirectUri: process.env.AGC_OAUTH_REDIRECT_URI || DEFAULT_OAUTH.redirectUri,
69
+ scope: process.env.AGC_OAUTH_SCOPE || DEFAULT_OAUTH.scope
70
+ };
71
+ let serviceAccount;
72
+ if (authMode === "service_account") {
73
+ const credentialsPath = path.isAbsolute(process.env.AGC_SA_CREDENTIALS) ? process.env.AGC_SA_CREDENTIALS : path.resolve(process.cwd(), process.env.AGC_SA_CREDENTIALS);
74
+ serviceAccount = {
75
+ credentialsPath,
76
+ credentials: loadServiceAccountCredentials(credentialsPath)
77
+ };
78
+ }
79
+ const resolvedClientId = authMode === "oauth" ? oauth.clientId : authMode === "service_account" ? serviceAccount.credentials.key_id : clientId || "";
80
+ return {
81
+ clientId: resolvedClientId,
82
+ clientSecret: clientSecret || "",
83
+ domain: process.env.AGC_DOMAIN || "connect-api.cloud.huawei.com",
84
+ authMode,
85
+ oauth,
86
+ teamId: process.env.AGC_TEAM_ID || void 0,
87
+ serviceAccount
88
+ };
89
+ }
90
+
91
+ // src/services/auth.ts
92
+ var SA_AUD = "https://oauth-login.cloud.huawei.com/oauth2/v3/token";
93
+ var SA_JWT_TTL_SEC = 3600;
94
+ var AuthService = class {
95
+ /**
96
+ * 获取访问API的Token(service to service,client_credentials 模式)
97
+ */
98
+ static async getToken() {
99
+ const config2 = getConfig();
100
+ const url = `https://${config2.domain}/api/oauth2/v1/token`;
101
+ const payload = {
102
+ grant_type: "client_credentials",
103
+ client_id: config2.clientId,
104
+ client_secret: config2.clientSecret
105
+ };
106
+ const response = await axios.post(url, payload, {
107
+ maxRedirects: 0,
108
+ headers: {
109
+ "Content-Type": "application/json"
110
+ }
111
+ });
112
+ return response.data;
113
+ }
114
+ /**
115
+ * 使用 Service Account 凭据本地签发 PS256 JWT(可直接作为 Authorization Bearer)。
116
+ * 参见:获取服务端授权 → Service Account 方式。
117
+ */
118
+ static createServiceAccountJwt(credentials, nowSec = Math.floor(Date.now() / 1e3)) {
119
+ const iat = nowSec;
120
+ const exp = iat + SA_JWT_TTL_SEC;
121
+ const aud = credentials.token_uri || SA_AUD;
122
+ const header = {
123
+ kid: credentials.key_id,
124
+ typ: "JWT",
125
+ alg: "PS256"
126
+ };
127
+ const payload = {
128
+ aud,
129
+ iss: credentials.sub_account,
130
+ exp,
131
+ iat
132
+ };
133
+ const encodedHeader = base64UrlEncode(Buffer.from(JSON.stringify(header), "utf8"));
134
+ const encodedPayload = base64UrlEncode(Buffer.from(JSON.stringify(payload), "utf8"));
135
+ const signingInput = `${encodedHeader}.${encodedPayload}`;
136
+ const privateKey = crypto.createPrivateKey(normalizePem(credentials.private_key));
137
+ const signature = crypto.sign("sha256", Buffer.from(signingInput, "utf8"), {
138
+ key: privateKey,
139
+ padding: crypto.constants.RSA_PKCS1_PSS_PADDING,
140
+ // PS256:saltLength = digest length(与 Java SHA256withRSA/PSS 常见默认一致)
141
+ saltLength: crypto.constants.RSA_PSS_SALTLEN_DIGEST
142
+ });
143
+ const jwt = `${signingInput}.${base64UrlEncode(signature)}`;
144
+ return {
145
+ jwt,
146
+ expiresIn: SA_JWT_TTL_SEC,
147
+ expiresAt: exp * 1e3
148
+ };
149
+ }
150
+ /**
151
+ * 拼装 OAuth 授权 URL(含随机 state 防 CSRF)
152
+ */
153
+ static buildAuthUrl(state) {
154
+ const cfg = getConfig();
155
+ const url = new URL(cfg.oauth.authUrl);
156
+ url.searchParams.set("client_id", cfg.oauth.clientId);
157
+ url.searchParams.set("redirect_uri", cfg.oauth.redirectUri);
158
+ url.searchParams.set("scope", cfg.oauth.scope);
159
+ url.searchParams.set("response_type", "code");
160
+ url.searchParams.set("state", state);
161
+ url.searchParams.set("access_type", "offline");
162
+ return url.toString();
163
+ }
164
+ /**
165
+ * 用授权码换取 OAuth token(与插件 /access-token/generate 对齐)
166
+ */
167
+ static async getOAuthToken(code, redirectUri) {
168
+ const cfg = getConfig();
169
+ const controller = new AbortController();
170
+ const timeoutId = setTimeout(() => controller.abort(), 3e4);
171
+ try {
172
+ const res = await axios.post(cfg.oauth.tokenUrl, { code, redirectUri }, {
173
+ maxRedirects: 0,
174
+ headers: { "Content-Type": "application/json" },
175
+ signal: controller.signal
176
+ });
177
+ if (!res.data.ret || res.data.ret.code !== 0) {
178
+ throw new Error(res.data.ret?.msg || "Authentication failed");
179
+ }
180
+ return res.data;
181
+ } catch (err) {
182
+ if (err instanceof Error && err.name === "AbortError") {
183
+ throw new Error("\u8BF7\u6C42\u8D85\u65F6\uFF0C\u8BF7\u68C0\u67E5\u7F51\u7EDC\u8FDE\u63A5");
184
+ }
185
+ throw err;
186
+ } finally {
187
+ clearTimeout(timeoutId);
188
+ }
189
+ }
190
+ /**
191
+ * 用 refreshToken 刷新 OAuth token(与插件 /access-token/refresh 对齐)。
192
+ * 刷新接口只返回新的 accessToken,refreshToken 沿用旧值。
193
+ */
194
+ static async refreshOAuthToken(refreshToken) {
195
+ const cfg = getConfig();
196
+ const controller = new AbortController();
197
+ const timeoutId = setTimeout(() => controller.abort(), 3e4);
198
+ try {
199
+ const res = await axios.post(cfg.oauth.refreshUrl, { refreshToken }, {
200
+ maxRedirects: 0,
201
+ headers: { "Content-Type": "application/json" },
202
+ signal: controller.signal
203
+ });
204
+ if (!res.data.ret || res.data.ret.code !== 0) {
205
+ throw new Error(res.data.ret?.msg || "Refresh failed");
206
+ }
207
+ return res.data;
208
+ } catch (err) {
209
+ if (err instanceof Error && err.name === "AbortError") {
210
+ throw new Error("\u8BF7\u6C42\u8D85\u65F6\uFF0C\u8BF7\u68C0\u67E5\u7F51\u7EDC\u8FDE\u63A5");
211
+ }
212
+ throw err;
213
+ } finally {
214
+ clearTimeout(timeoutId);
215
+ }
216
+ }
217
+ };
218
+ function base64UrlEncode(buf) {
219
+ return buf.toString("base64").replace(/=/g, "").replace(/\+/g, "-").replace(/\//g, "_");
220
+ }
221
+ function normalizePem(privateKey) {
222
+ const trimmed = privateKey.trim();
223
+ if (trimmed.includes("\\n")) {
224
+ return trimmed.replace(/\\n/g, "\n");
225
+ }
226
+ return trimmed;
227
+ }
228
+
229
+ // src/core/http.ts
230
+ import axios3 from "axios";
231
+
232
+ // src/core/private-file.ts
233
+ import fs2 from "fs";
234
+ function restrictPermissions(fd) {
235
+ if (process.platform !== "win32") fs2.fchmodSync(fd, 384);
236
+ }
237
+ function readPrivateFile(file) {
238
+ const fd = fs2.openSync(file, "r");
239
+ try {
240
+ restrictPermissions(fd);
241
+ return fs2.readFileSync(fd, "utf8");
242
+ } finally {
243
+ fs2.closeSync(fd);
244
+ }
245
+ }
246
+ function writePrivateFile(file, contents) {
247
+ const fd = fs2.openSync(file, fs2.constants.O_WRONLY | fs2.constants.O_CREAT, 384);
248
+ try {
249
+ restrictPermissions(fd);
250
+ fs2.ftruncateSync(fd, 0);
251
+ fs2.writeFileSync(fd, contents, "utf8");
252
+ } finally {
253
+ fs2.closeSync(fd);
254
+ }
255
+ }
256
+
257
+ // src/core/oauth-team.ts
258
+ import axios2 from "axios";
259
+ import fs3 from "fs";
260
+ import path2 from "path";
261
+ import os from "os";
262
+ var TOKEN_FILE = path2.join(os.homedir(), ".connect-api-cli-token.json");
263
+ var cachedTeamId;
264
+ function readPersistedTeamId() {
265
+ try {
266
+ if (!fs3.existsSync(TOKEN_FILE)) return void 0;
267
+ const data = JSON.parse(readPrivateFile(TOKEN_FILE));
268
+ return data.teamId || void 0;
269
+ } catch {
270
+ return void 0;
271
+ }
272
+ }
273
+ function writePersistedTeamId(teamId) {
274
+ try {
275
+ if (!fs3.existsSync(TOKEN_FILE)) return;
276
+ const data = JSON.parse(readPrivateFile(TOKEN_FILE));
277
+ data.teamId = teamId;
278
+ writePrivateFile(TOKEN_FILE, JSON.stringify(data, null, 2));
279
+ } catch {
280
+ }
281
+ }
282
+ async function resolveOAuthTeamId(cfg, accessToken) {
283
+ if (cfg.teamId) {
284
+ return cfg.teamId;
285
+ }
286
+ if (cachedTeamId !== void 0) {
287
+ return cachedTeamId || void 0;
288
+ }
289
+ const persisted = readPersistedTeamId();
290
+ if (persisted) {
291
+ cachedTeamId = persisted;
292
+ return persisted;
293
+ }
294
+ const res = await axios2.get(
295
+ `https://${cfg.domain}/api/ups/user-permission-service/v1/user-team-list`,
296
+ {
297
+ headers: {
298
+ oauth2Token: accessToken,
299
+ "Content-Type": "application/json"
300
+ },
301
+ timeout: 3e4,
302
+ maxRedirects: 0
303
+ }
304
+ );
305
+ const teams = res.data.teams || [];
306
+ if (res.data.ret && res.data.ret.code !== 0) {
307
+ throw new Error(
308
+ `Failed to list teams for OAuth teamId: ${res.data.ret.msg || JSON.stringify(res.data.ret)}`
309
+ );
310
+ }
311
+ if (teams.length === 0) {
312
+ cachedTeamId = null;
313
+ throw new Error("OAuth account has no teams. Cannot set teamId for API calls.");
314
+ }
315
+ if (teams.length === 1) {
316
+ cachedTeamId = teams[0].id;
317
+ writePersistedTeamId(cachedTeamId);
318
+ return cachedTeamId;
319
+ }
320
+ cachedTeamId = null;
321
+ const preview = teams.slice(0, 8).map((t) => `${t.id}${t.name ? `(${t.name})` : ""}`).join(", ");
322
+ throw new Error(
323
+ `Multiple teams found (${teams.length}). Set AGC_TEAM_ID to one of: ${preview}`
324
+ );
325
+ }
326
+ function clearOAuthTeamIdCache() {
327
+ cachedTeamId = void 0;
328
+ }
329
+
330
+ // src/core/auth-mgr.ts
331
+ import * as crypto2 from "crypto";
332
+ import * as http from "http";
333
+ import { exec } from "child_process";
334
+ import fs4 from "fs";
335
+ import path3 from "path";
336
+ import os2 from "os";
337
+ var AuthManager = class {
338
+ static cacheFile = path3.join(os2.homedir(), ".connect-api-cli-token.json");
339
+ /**
340
+ * 获取当前生效的 access token,并具备自动刷新能力:
341
+ * - OAuth 模式:token 过期时优先用 refreshToken 自动刷新,无需重新登录
342
+ * - client_credentials / service_account:过期后重新换取 / 重新签 JWT
343
+ */
344
+ static async getAccessToken() {
345
+ const cfg = getConfig();
346
+ const cache = this.readCache();
347
+ const sameCredential = cache && cache.clientId === cfg.clientId && cache.domain === cfg.domain && cache.authMode === cfg.authMode;
348
+ if (sameCredential && cache.expiresAt > Date.now() + 5 * 60 * 1e3) {
349
+ return cache.accessToken;
350
+ }
351
+ if (cfg.authMode === "oauth" && cache?.refreshToken) {
352
+ try {
353
+ const refreshed = await AuthService.refreshOAuthToken(cache.refreshToken);
354
+ const expiresAt = Date.now() + refreshed.expireTime * 1e3;
355
+ this.writeCache({
356
+ accessToken: refreshed.accessToken,
357
+ expiresAt,
358
+ clientId: cfg.clientId,
359
+ domain: cfg.domain,
360
+ authMode: cfg.authMode,
361
+ refreshToken: cache.refreshToken
362
+ // 刷新接口不返回新 refreshToken,沿用旧值
363
+ });
364
+ return refreshed.accessToken;
365
+ } catch (e) {
366
+ console.error("OAuth token refresh failed, need to re-login:", e instanceof Error ? e.message : String(e));
367
+ this.clearCache();
368
+ }
369
+ }
370
+ return this.acquire();
371
+ }
372
+ /** 登录入口:按当前认证模式获取并缓存 token */
373
+ static async login() {
374
+ clearOAuthTeamIdCache();
375
+ return this.acquire();
376
+ }
377
+ /** 按当前认证模式获取 token(client_credentials / service_account / oauth) */
378
+ static async acquire() {
379
+ const cfg = getConfig();
380
+ if (cfg.authMode === "oauth") {
381
+ return this.loginOAuth();
382
+ }
383
+ if (cfg.authMode === "service_account") {
384
+ if (!cfg.serviceAccount) {
385
+ throw new Error("Service Account credentials not loaded. Set AGC_SA_CREDENTIALS.");
386
+ }
387
+ const { jwt, expiresAt } = AuthService.createServiceAccountJwt(cfg.serviceAccount.credentials);
388
+ this.writeCache({
389
+ accessToken: jwt,
390
+ expiresAt,
391
+ clientId: cfg.clientId,
392
+ domain: cfg.domain,
393
+ authMode: cfg.authMode
394
+ });
395
+ return jwt;
396
+ }
397
+ const res = await AuthService.getToken();
398
+ if (res.access_token && res.expires_in) {
399
+ const expiresAt = Date.now() + res.expires_in * 1e3;
400
+ this.writeCache({
401
+ accessToken: res.access_token,
402
+ expiresAt,
403
+ clientId: cfg.clientId,
404
+ domain: cfg.domain,
405
+ authMode: cfg.authMode
406
+ });
407
+ return res.access_token;
408
+ }
409
+ throw new Error(`Failed to get token: ${JSON.stringify(res.ret)}`);
410
+ }
411
+ /** OAuth 授权码登录:启动本地回调服务器 + 打开浏览器 */
412
+ static loginOAuth() {
413
+ return new Promise((resolve, reject) => {
414
+ const cfg = getConfig();
415
+ const redirectUri = cfg.oauth.redirectUri;
416
+ const port = Number(new URL(redirectUri).port || 80);
417
+ const state = crypto2.randomBytes(32).toString("hex");
418
+ const server = http.createServer(async (req, res) => {
419
+ try {
420
+ const url = new URL(req.url, `http://${req.headers.host}`);
421
+ const code = url.searchParams.get("code");
422
+ const returnedState = url.searchParams.get("state");
423
+ if (!code || returnedState !== state) {
424
+ res.writeHead(400, { "Content-Type": "text/html; charset=utf-8" });
425
+ res.end("<h3>\u65E0\u6548\u7684\u56DE\u8C03\u53C2\u6570</h3>");
426
+ return;
427
+ }
428
+ const token = await AuthService.getOAuthToken(code, redirectUri);
429
+ const expiresAt = Date.now() + token.expireTime * 1e3;
430
+ this.writeCache({
431
+ accessToken: token.accessToken,
432
+ expiresAt,
433
+ clientId: cfg.clientId,
434
+ domain: cfg.domain,
435
+ authMode: cfg.authMode,
436
+ refreshToken: token.refreshToken
437
+ });
438
+ res.writeHead(200, { "Content-Type": "text/html; charset=utf-8" });
439
+ res.end('<!DOCTYPE html><html><body style="font-family:sans-serif;padding:40px;text-align:center"><h2>\u767B\u5F55\u6210\u529F\uFF0C\u53EF\u5173\u95ED\u6B64\u7A97\u53E3</h2></body></html>');
440
+ server.close();
441
+ resolve(token.accessToken);
442
+ } catch (err) {
443
+ server.close();
444
+ reject(err instanceof Error ? err : new Error(String(err)));
445
+ }
446
+ });
447
+ server.on("error", (err) => {
448
+ server.close();
449
+ reject(err);
450
+ });
451
+ server.listen(port, () => {
452
+ const authUrl = AuthService.buildAuthUrl(state);
453
+ console.log("\u8BF7\u5728\u6D4F\u89C8\u5668\u4E2D\u5B8C\u6210\u534E\u4E3A\u8D26\u53F7\u6388\u6743...");
454
+ console.log(`\u82E5\u6D4F\u89C8\u5668\u672A\u81EA\u52A8\u6253\u5F00\uFF0C\u8BF7\u8BBF\u95EE: ${authUrl}`);
455
+ openBrowser(authUrl);
456
+ });
457
+ });
458
+ }
459
+ /** 查询缓存状态(供 status 命令显示) */
460
+ static getStatus() {
461
+ return this.readCache();
462
+ }
463
+ static readCache() {
464
+ try {
465
+ if (fs4.existsSync(this.cacheFile)) {
466
+ const data = readPrivateFile(this.cacheFile);
467
+ return JSON.parse(data);
468
+ }
469
+ } catch (e) {
470
+ }
471
+ return null;
472
+ }
473
+ static writeCache(cache) {
474
+ try {
475
+ writePrivateFile(this.cacheFile, JSON.stringify(cache, null, 2));
476
+ } catch (e) {
477
+ }
478
+ }
479
+ /**
480
+ * 清除缓存的 Token(登出)
481
+ */
482
+ static clearCache() {
483
+ clearOAuthTeamIdCache();
484
+ try {
485
+ if (fs4.existsSync(this.cacheFile)) {
486
+ fs4.unlinkSync(this.cacheFile);
487
+ return true;
488
+ }
489
+ return false;
490
+ } catch (e) {
491
+ return false;
492
+ }
493
+ }
494
+ };
495
+ function openBrowser(url) {
496
+ const platform = process.platform;
497
+ const cmd = platform === "darwin" ? "open" : platform === "win32" ? 'start ""' : "xdg-open";
498
+ exec(`${cmd} "${url}"`, (err) => {
499
+ if (err) {
500
+ console.error("\u65E0\u6CD5\u81EA\u52A8\u6253\u5F00\u6D4F\u89C8\u5668\uFF0C\u8BF7\u624B\u52A8\u590D\u5236\u4E0A\u9762\u7684\u94FE\u63A5\u8BBF\u95EE\u3002");
501
+ }
502
+ });
503
+ }
504
+
505
+ // src/core/http.ts
506
+ var agcClient = axios3.create({ maxRedirects: 0 });
507
+ function setHeader(headers, name, value) {
508
+ if (typeof headers?.set === "function") {
509
+ headers.set(name, value);
510
+ } else {
511
+ headers[name] = value;
512
+ }
513
+ }
514
+ function deleteHeader(headers, name) {
515
+ if (typeof headers?.delete === "function") {
516
+ headers.delete(name);
517
+ } else {
518
+ delete headers[name];
519
+ }
520
+ }
521
+ function getHeader(headers, name) {
522
+ if (typeof headers?.get === "function") {
523
+ return headers.get(name);
524
+ }
525
+ return headers?.[name] ?? headers?.[name.toLowerCase()];
526
+ }
527
+ function applyAuthHeaders(headers, token, cfg, force = false) {
528
+ if (cfg.authMode === "oauth") {
529
+ deleteHeader(headers, "Authorization");
530
+ deleteHeader(headers, "client_id");
531
+ setHeader(headers, "oauth2Token", token);
532
+ return;
533
+ }
534
+ deleteHeader(headers, "oauth2Token");
535
+ if (force || !getHeader(headers, "Authorization")) {
536
+ setHeader(headers, "Authorization", `Bearer ${token}`);
537
+ }
538
+ if (cfg.authMode !== "service_account" && !getHeader(headers, "client_id")) {
539
+ setHeader(headers, "client_id", cfg.clientId);
540
+ }
541
+ }
542
+ agcClient.interceptors.request.use(async (config2) => {
543
+ const cfg = getConfig();
544
+ if (!config2.baseURL) {
545
+ config2.baseURL = `https://${cfg.domain}`;
546
+ }
547
+ const token = await AuthManager.getAccessToken();
548
+ if (!config2.headers) {
549
+ config2.headers = {};
550
+ }
551
+ applyAuthHeaders(config2.headers, token, cfg);
552
+ if (cfg.authMode === "oauth" && !getHeader(config2.headers, "teamId")) {
553
+ const teamId = await resolveOAuthTeamId(cfg, token);
554
+ if (teamId) {
555
+ setHeader(config2.headers, "teamId", teamId);
556
+ }
557
+ }
558
+ if (config2.data !== void 0 && !getHeader(config2.headers, "Content-Type")) {
559
+ setHeader(config2.headers, "Content-Type", "application/json");
560
+ }
561
+ return config2;
562
+ }, (error) => {
563
+ return Promise.reject(error);
564
+ });
565
+ agcClient.interceptors.response.use(
566
+ (res) => res,
567
+ async (err) => {
568
+ const original = err.config;
569
+ const status = err.response?.status;
570
+ if (status === 401 && original && !original._retry) {
571
+ original._retry = true;
572
+ try {
573
+ const cfg = getConfig();
574
+ const newToken = await AuthManager.getAccessToken();
575
+ if (!original.headers) {
576
+ original.headers = {};
577
+ }
578
+ applyAuthHeaders(original.headers, newToken, cfg, true);
579
+ return agcClient(original);
580
+ } catch (e) {
581
+ return Promise.reject(err);
582
+ }
583
+ }
584
+ if (status === 401 || status === 403) {
585
+ const body = err.response?.data;
586
+ const msg = typeof body === "object" ? JSON.stringify(body, null, 2) : body;
587
+ err.message = err.message + (msg ? `
588
+ API \u54CD\u5E94: ${msg}` : "");
589
+ }
590
+ return Promise.reject(err);
591
+ }
592
+ );
593
+
594
+ // src/services/publish.ts
595
+ function appIdHeaders(appId) {
596
+ return { appId };
597
+ }
598
+ function withOptionalParams(base) {
599
+ const out = {};
600
+ for (const [k, v] of Object.entries(base)) {
601
+ if (v !== void 0) out[k] = v;
602
+ }
603
+ return out;
604
+ }
605
+ var PublishService = class {
606
+ /** 查询应用包名对应的 appid */
607
+ static async getAppIdList(packageName, packageTypes) {
608
+ const response = await agcClient.get("/api/publish/v2/appid-list", {
609
+ params: withOptionalParams({ packageName, packageTypes })
610
+ });
611
+ return response.data;
612
+ }
613
+ /** 创建应用或元服务(projectId 为 query 参数) */
614
+ static async createApp(req) {
615
+ const { projectId, packageName, ...rest } = req;
616
+ const body = { ...rest };
617
+ if (req.installationFree === 0 && packageName) {
618
+ body.packageName = packageName;
619
+ }
620
+ const response = await agcClient.post(
621
+ `/api/publish/v3/app?projectId=${encodeURIComponent(projectId)}`,
622
+ body
623
+ );
624
+ return response.data;
625
+ }
626
+ /** 查询团队账号下的成员角色列表 */
627
+ static async getMembersRoleList(req) {
628
+ const response = await agcClient.get(
629
+ "/api/publish/v3/members-role-list",
630
+ {
631
+ params: {
632
+ fromPage: req.fromPage,
633
+ pageSize: req.pageSize,
634
+ languageCode: req.languageCode
635
+ }
636
+ }
637
+ );
638
+ return response.data;
639
+ }
640
+ /** 查询应用信息 */
641
+ static async getAppInfo(appIdOrReq, lang) {
642
+ const req = typeof appIdOrReq === "string" ? { appId: appIdOrReq, lang } : appIdOrReq;
643
+ const response = await agcClient.get("/api/publish/v3/app-info", {
644
+ params: withOptionalParams({
645
+ appId: req.appId,
646
+ lang: req.lang,
647
+ releaseType: req.releaseType,
648
+ versionId: req.versionId
649
+ })
650
+ });
651
+ return response.data;
652
+ }
653
+ /** 更新应用基本信息 */
654
+ static async updateAppInfo(req) {
655
+ const { appId, releaseType, releasePhase, ...body } = req;
656
+ const response = await agcClient.put(
657
+ "/api/publish/v3/app-info",
658
+ body,
659
+ {
660
+ params: withOptionalParams({ appId, releaseType, releasePhase })
661
+ }
662
+ );
663
+ return response.data;
664
+ }
665
+ /** 更新应用语言信息 */
666
+ static async updateLanguageInfo(req) {
667
+ const { appId, releaseType, releasePhase, ...body } = req;
668
+ const response = await agcClient.put(
669
+ "/api/publish/v3/app-language-info",
670
+ body,
671
+ {
672
+ params: withOptionalParams({ appId, releaseType, releasePhase })
673
+ }
674
+ );
675
+ return response.data;
676
+ }
677
+ /** 删除应用语言信息 */
678
+ static async deleteLanguageInfo(req) {
679
+ const response = await agcClient.delete(
680
+ "/api/publish/v2/app-language-info",
681
+ {
682
+ params: withOptionalParams({
683
+ appId: req.appId,
684
+ lang: req.lang,
685
+ releaseType: req.releaseType
686
+ })
687
+ }
688
+ );
689
+ return response.data;
690
+ }
691
+ /** 更新应用文件信息(图标/截图/视频等) */
692
+ static async updateAppFileInfo(req) {
693
+ const { appId, releaseType, releasePhase, ...body } = req;
694
+ const response = await agcClient.put(
695
+ "/api/publish/v3/app-file-info",
696
+ body,
697
+ {
698
+ params: withOptionalParams({ appId, releaseType, releasePhase })
699
+ }
700
+ );
701
+ return response.data;
702
+ }
703
+ /** 更新应用软件包信息(OBS 上传后上报,AGC 控制台才会出现记录) */
704
+ static async updateAppPackageInfo(req) {
705
+ const { appId, releaseType, releasePhase, fileName, objectId } = req;
706
+ const response = await agcClient.put(
707
+ "/api/publish/v3/app-package-info",
708
+ { fileName, objectId },
709
+ {
710
+ params: withOptionalParams({ appId, releaseType, releasePhase })
711
+ }
712
+ );
713
+ return response.data;
714
+ }
715
+ /** 更新版本上架时间 */
716
+ static async updateReleaseTime(req) {
717
+ const { appId, ...body } = req;
718
+ const response = await agcClient.put(
719
+ "/api/publish/v2/on-shelf-time",
720
+ body,
721
+ { params: { appId } }
722
+ );
723
+ return response.data;
724
+ }
725
+ /** 更新分阶段发布 */
726
+ static async updatePhasedRelease(req) {
727
+ const { appId, ...body } = req;
728
+ const response = await agcClient.put(
729
+ "/api/publish/v2/version/phased-release",
730
+ body,
731
+ { headers: appIdHeaders(appId) }
732
+ );
733
+ return response.data;
734
+ }
735
+ /** 查询应用软件包信息 */
736
+ static async getPackageInfo(req) {
737
+ const response = await agcClient.get(
738
+ "/api/publish/v2/app-package-info",
739
+ {
740
+ params: { packageId: req.packageId },
741
+ headers: appIdHeaders(req.appId)
742
+ }
743
+ );
744
+ return response.data;
745
+ }
746
+ /** 查询软件包编译状态 */
747
+ static async getCompileStatus(req) {
748
+ const response = await agcClient.get(
749
+ "/api/publish/v3/package/compile/status",
750
+ { params: { appId: req.appId, pkgIds: req.pkgIds } }
751
+ );
752
+ return response.data;
753
+ }
754
+ /** 查询应用所有版本类型的版本列表 */
755
+ static async queryBriefInfoList(req) {
756
+ const { appId, ...body } = req;
757
+ const response = await agcClient.post(
758
+ "/api/publish/v3/version/brief-info/list",
759
+ body,
760
+ { headers: appIdHeaders(appId) }
761
+ );
762
+ return response.data;
763
+ }
764
+ /** 查询应用未处理的问题工单 */
765
+ static async queryVersionVoc(req) {
766
+ const { appId, ...body } = req;
767
+ const response = await agcClient.post(
768
+ "/api/publish/v1/app-voc/version-voc",
769
+ body,
770
+ { headers: appIdHeaders(appId) }
771
+ );
772
+ return response.data;
773
+ }
774
+ /** 查询需要上传的资质文件信息 */
775
+ static async queryTagQualDependent() {
776
+ const response = await agcClient.get(
777
+ "/api/publish/v2/tag-qual-dependent"
778
+ );
779
+ return response.data;
780
+ }
781
+ /** 提交资质审核任务 */
782
+ static async submitQualificationReview(req) {
783
+ const { appId, ...body } = req;
784
+ const response = await agcClient.post(
785
+ "/api/publish/v2/qualification-review-task",
786
+ body,
787
+ { headers: appIdHeaders(appId) }
788
+ );
789
+ return response.data;
790
+ }
791
+ /** 查询资质审核任务详情 */
792
+ static async getQualificationReview(req) {
793
+ const response = await agcClient.get(
794
+ "/api/publish/v2/qualification-review-task",
795
+ {
796
+ params: { tagIds: req.tagIds },
797
+ headers: appIdHeaders(req.appId)
798
+ }
799
+ );
800
+ return response.data;
801
+ }
802
+ /** 修改资质审核任务 */
803
+ static async updateQualificationReview(req) {
804
+ const { appId, ...body } = req;
805
+ const response = await agcClient.put(
806
+ "/api/publish/v2/qualification-review-task",
807
+ body,
808
+ { headers: appIdHeaders(appId) }
809
+ );
810
+ return response.data;
811
+ }
812
+ /** 撤销资质审核任务 */
813
+ static async cancelQualificationReview(req) {
814
+ const response = await agcClient.put(
815
+ "/api/publish/v2/qualification-review-task/cancel",
816
+ { taskId: req.taskId },
817
+ { headers: appIdHeaders(req.appId) }
818
+ );
819
+ return response.data;
820
+ }
821
+ /** 删除资质审核任务 */
822
+ static async deleteQualificationReview(req) {
823
+ const response = await agcClient.delete(
824
+ "/api/publish/v2/qualification-review-task",
825
+ {
826
+ data: { tagIds: req.tagIds },
827
+ headers: appIdHeaders(req.appId)
828
+ }
829
+ );
830
+ return response.data;
831
+ }
832
+ /** 新建用户协议 / 隐私政策协议(body.type 区分) */
833
+ static async createAgreement(req) {
834
+ const { appId, ...body } = req;
835
+ const response = await agcClient.post(
836
+ "/api/publish/v2/agreement",
837
+ body,
838
+ { headers: appIdHeaders(appId) }
839
+ );
840
+ return response.data;
841
+ }
842
+ /** 查询用户协议 / 隐私政策协议列表(body.type 区分) */
843
+ static async listAgreements(req) {
844
+ const { appId, ...body } = req;
845
+ const response = await agcClient.post(
846
+ "/api/publish/v2/agreement/list",
847
+ body,
848
+ { headers: appIdHeaders(appId) }
849
+ );
850
+ return response.data;
851
+ }
852
+ /** 更新用户协议 / 隐私政策协议 */
853
+ static async updateAgreement(req) {
854
+ const { appId, ...body } = req;
855
+ const response = await agcClient.put(
856
+ "/api/publish/v2/agreement",
857
+ body,
858
+ { headers: appIdHeaders(appId) }
859
+ );
860
+ return response.data;
861
+ }
862
+ /** 提交隐私政策协议 */
863
+ static async submitPrivacyAgreement(req) {
864
+ const { appId, ...body } = req;
865
+ const response = await agcClient.put(
866
+ "/api/publish/v2/agreement/submit",
867
+ body,
868
+ { headers: appIdHeaders(appId) }
869
+ );
870
+ return response.data;
871
+ }
872
+ /** 申请年龄分级 */
873
+ static async applyAgeRating(req) {
874
+ const { appId, releaseType, releasePhase, ...body } = req;
875
+ const response = await agcClient.post(
876
+ "/api/publish/v2/app-age-rating",
877
+ body,
878
+ {
879
+ params: withOptionalParams({ releaseType, releasePhase }),
880
+ headers: appIdHeaders(appId)
881
+ }
882
+ );
883
+ return response.data;
884
+ }
885
+ /** 提交发布 */
886
+ static async submitApp(req) {
887
+ const { appId, ...body } = req;
888
+ const response = await agcClient.post(
889
+ "/api/publish/v3/app-submit",
890
+ body,
891
+ { headers: appIdHeaders(appId) }
892
+ );
893
+ return response.data;
894
+ }
895
+ /** 撤销审核 */
896
+ static async cancelReview(req) {
897
+ const response = await agcClient.put(
898
+ "/api/publish/v3/version/on-shelf/cancel",
899
+ { versionId: req.versionId },
900
+ { headers: appIdHeaders(req.appId) }
901
+ );
902
+ return response.data;
903
+ }
904
+ /** 下架应用 */
905
+ static async shelfOff(req) {
906
+ const response = await agcClient.post(
907
+ "/api/publish/v2/app-shelf-off",
908
+ null,
909
+ {
910
+ params: withOptionalParams({
911
+ appId: req.appId,
912
+ reason: req.reason,
913
+ releaseType: req.releaseType
914
+ })
915
+ }
916
+ );
917
+ return response.data;
918
+ }
919
+ };
920
+
921
+ // src/services/project.ts
922
+ var ProjectService = class {
923
+ /** 查询团队下的项目列表(Project Management API) */
924
+ static async listProjects() {
925
+ const response = await agcClient.get("/api/project-service/v1/projects");
926
+ return response.data;
927
+ }
928
+ };
929
+
930
+ // src/services/upload.ts
931
+ import axios4 from "axios";
932
+ import fs5 from "fs";
933
+ import path4 from "path";
934
+ function pickObjectId(res) {
935
+ return res.urlInfo?.objectId || res.objectId;
936
+ }
937
+ var UploadService = class {
938
+ // ================= Raw APIs =================
939
+ static async getUploadUrl(req) {
940
+ const response = await agcClient.get("/api/publish/v2/upload-url/for-obs", {
941
+ params: req
942
+ });
943
+ return response.data;
944
+ }
945
+ static async initMultipart(req) {
946
+ const response = await agcClient.post("/api/publish/v2/upload/multipart/init", null, {
947
+ params: req
948
+ });
949
+ return response.data;
950
+ }
951
+ static async getMultipartParts(req) {
952
+ const { objectId, nspUploadId, parts } = req;
953
+ const response = await agcClient.post("/api/publish/v2/upload/multipart/parts", parts, {
954
+ params: { objectId, nspUploadId }
955
+ });
956
+ return response.data;
957
+ }
958
+ static async composeMultipart(req) {
959
+ const { objectId, nspUploadId, parts } = req;
960
+ const response = await agcClient.post("/api/publish/v2/upload/multipart/compose", parts, {
961
+ params: { objectId, nspUploadId }
962
+ });
963
+ return response.data;
964
+ }
965
+ // ================= High-level Operations =================
966
+ /**
967
+ * 封装好的上传文件核心流程(支持根据文件大小自动单文件或分片上传)
968
+ * 文件大小 < 5MB 时使用单文件上传,否则使用分片上传。
969
+ * 仅完成 OBS 落盘;HarmonyOS `.app` 还须调用更新应用软件包信息,AGC 控制台才会有记录。
970
+ */
971
+ static async uploadFile(options) {
972
+ const stat = fs5.statSync(options.filePath);
973
+ const fileName = path4.basename(options.filePath) || "unknown";
974
+ if (stat.size < 5 * 1024 * 1024) {
975
+ return this.uploadSingleFile(options, fileName, stat.size);
976
+ }
977
+ return this.uploadMultipartFile(options, fileName, stat.size);
978
+ }
979
+ /**
980
+ * OBS 预签名 PUT 头:SignedHeaders 含 content-length / host。
981
+ * 必须显式带 Content-Length;Host 交给客户端按 URL 设置,勿原样回传。
982
+ */
983
+ static buildObsPutHeaders(headers, contentLength) {
984
+ const out = { ...headers };
985
+ delete out.Host;
986
+ delete out.host;
987
+ out["Content-Length"] = String(contentLength);
988
+ if (!out["Content-Type"] && !out["content-type"]) {
989
+ out["Content-Type"] = "application/octet-stream";
990
+ }
991
+ return out;
992
+ }
993
+ /**
994
+ * 单文件上传流程
995
+ */
996
+ static async uploadSingleFile(options, fileName, contentLength) {
997
+ const urlRes = await this.getUploadUrl({
998
+ appId: options.appId,
999
+ fileName,
1000
+ contentLength,
1001
+ releaseType: options.releaseType,
1002
+ chineseMainlandFlag: options.chineseMainlandFlag
1003
+ });
1004
+ if (!urlRes.urlInfo) {
1005
+ throw new Error(`Failed to get upload URL: ${JSON.stringify(urlRes.ret)}`);
1006
+ }
1007
+ const objectId = pickObjectId(urlRes);
1008
+ if (!objectId) {
1009
+ throw new Error(
1010
+ `Failed to get objectId from upload URL: ${JSON.stringify(urlRes.ret)}`
1011
+ );
1012
+ }
1013
+ const { url, headers } = urlRes.urlInfo;
1014
+ const fileStream = fs5.createReadStream(options.filePath);
1015
+ await axios4.put(url, fileStream, {
1016
+ headers: this.buildObsPutHeaders(headers, contentLength),
1017
+ maxBodyLength: Infinity,
1018
+ maxContentLength: Infinity
1019
+ });
1020
+ return { fileName, objectId };
1021
+ }
1022
+ /**
1023
+ * 分片上传流程
1024
+ */
1025
+ static async uploadMultipartFile(options, fileName, fileSize) {
1026
+ const initRes = await this.initMultipart({
1027
+ appId: options.appId,
1028
+ fileName,
1029
+ releaseType: options.releaseType,
1030
+ chineseMainlandFlag: options.chineseMainlandFlag
1031
+ });
1032
+ const { objectId, nspUploadId, nspPartMinSize = 5242880 } = initRes;
1033
+ if (!objectId || !nspUploadId) {
1034
+ throw new Error(`Failed to init multipart upload: ${JSON.stringify(initRes.ret)}`);
1035
+ }
1036
+ const partSize = Number(nspPartMinSize);
1037
+ const partsCount = Math.ceil(fileSize / partSize);
1038
+ const partsReqBody = {};
1039
+ for (let i = 1; i <= partsCount; i++) {
1040
+ const start = (i - 1) * partSize;
1041
+ const end = Math.min(start + partSize, fileSize);
1042
+ partsReqBody[`additionalProp${i}`] = {
1043
+ length: end - start
1044
+ };
1045
+ }
1046
+ const partsRes = await this.getMultipartParts({
1047
+ objectId,
1048
+ nspUploadId,
1049
+ parts: partsReqBody
1050
+ });
1051
+ const uploadInfoMap = partsRes.uploadInfoMap;
1052
+ if (!uploadInfoMap) {
1053
+ throw new Error(`Failed to get parts upload URL: ${JSON.stringify(partsRes.ret)}`);
1054
+ }
1055
+ const fd = fs5.openSync(options.filePath, "r");
1056
+ const composeReqBody = {};
1057
+ for (let i = 1; i <= partsCount; i++) {
1058
+ const propKey = `additionalProp${i}`;
1059
+ const uploadInfo = uploadInfoMap[propKey];
1060
+ const start = (i - 1) * partSize;
1061
+ const end = Math.min(start + partSize, fileSize);
1062
+ const length = end - start;
1063
+ const buffer = Buffer.alloc(length);
1064
+ fs5.readSync(fd, buffer, 0, length, start);
1065
+ const res = await axios4.put(uploadInfo.url, buffer, {
1066
+ headers: this.buildObsPutHeaders(uploadInfo.headers, length),
1067
+ maxBodyLength: Infinity,
1068
+ maxContentLength: Infinity
1069
+ });
1070
+ const etag = res.headers["etag"];
1071
+ composeReqBody[propKey] = {
1072
+ partObjectId: uploadInfo.partObjectId || "",
1073
+ etag
1074
+ };
1075
+ }
1076
+ fs5.closeSync(fd);
1077
+ await this.composeMultipart({
1078
+ objectId,
1079
+ nspUploadId,
1080
+ parts: composeReqBody
1081
+ });
1082
+ return { fileName, objectId };
1083
+ }
1084
+ };
1085
+
1086
+ // src/services/provision.ts
1087
+ var ProvisionService = class {
1088
+ // ================= Certificates =================
1089
+ static async createCert(req) {
1090
+ const response = await agcClient.post("/api/publish/v3/cert", req);
1091
+ return response.data;
1092
+ }
1093
+ static async getCertList(req) {
1094
+ const response = await agcClient.post("/api/publish/v3/cert/list", req);
1095
+ return response.data;
1096
+ }
1097
+ static async deleteCert(req) {
1098
+ const response = await agcClient.post("/api/publish/v2/cert/delete", req);
1099
+ return response.data;
1100
+ }
1101
+ // ================= Devices =================
1102
+ static async addDevice(req) {
1103
+ const response = await agcClient.post("/api/publish/v2/device", req);
1104
+ return response.data;
1105
+ }
1106
+ static async getDeviceList(req) {
1107
+ const params = {};
1108
+ if (req.deviceName) params.deviceName = req.deviceName;
1109
+ if (req.fromRecCount !== void 0) params.fromRecCount = req.fromRecCount;
1110
+ if (req.maxReqCount !== void 0) params.maxReqCount = req.maxReqCount;
1111
+ if (req.order !== void 0) params.order = req.order;
1112
+ const response = await agcClient.get("/api/publish/v2/device/list", { params });
1113
+ return response.data;
1114
+ }
1115
+ static async deleteDevice(req) {
1116
+ const response = await agcClient.post("/api/publish/v2/device/delete", req);
1117
+ return response.data;
1118
+ }
1119
+ // ================= Profile / Provision =================
1120
+ static async createProvision(req) {
1121
+ const response = await agcClient.post("/api/publish/v3/provision", req);
1122
+ return response.data;
1123
+ }
1124
+ static async getProvisionList(req) {
1125
+ const params = {};
1126
+ if (req.fromRecCount !== void 0) params.fromRecCount = req.fromRecCount;
1127
+ if (req.maxReqCount !== void 0) params.maxReqCount = req.maxReqCount;
1128
+ const headers = { appId: req.appId };
1129
+ if (req.provisionId) headers.provisionId = req.provisionId;
1130
+ const response = await agcClient.get("/api/publish/v3/provision/list", {
1131
+ params,
1132
+ headers
1133
+ });
1134
+ return response.data;
1135
+ }
1136
+ static async updateProvision(req) {
1137
+ const response = await agcClient.put("/api/publish/v3/provision", req);
1138
+ return response.data;
1139
+ }
1140
+ static async deleteProvision(req) {
1141
+ const response = await agcClient.delete("/api/publish/v2/provision", {
1142
+ params: { id: req.id }
1143
+ });
1144
+ return response.data;
1145
+ }
1146
+ // ================= Fingerprint =================
1147
+ static async addFingerprint(req) {
1148
+ const { appId, ...body } = req;
1149
+ const response = await agcClient.post(
1150
+ "/api/provision/v1/fingerprints",
1151
+ body,
1152
+ { headers: { appId } }
1153
+ );
1154
+ return response.data;
1155
+ }
1156
+ static async getFingerprintList(req) {
1157
+ const response = await agcClient.get("/api/provision/v1/fingerprints", {
1158
+ headers: { appId: req.appId }
1159
+ });
1160
+ return response.data;
1161
+ }
1162
+ static async deleteFingerprint(req) {
1163
+ const { appId, ...body } = req;
1164
+ const response = await agcClient.delete(
1165
+ "/api/provision/v1/fingerprints",
1166
+ { headers: { appId }, data: body }
1167
+ );
1168
+ return response.data;
1169
+ }
1170
+ // ================= ACL Permission =================
1171
+ /** 查询可申请的 ACL 权限列表 */
1172
+ static async getEligibleACL(req) {
1173
+ const { appId, ...body } = req;
1174
+ const response = await agcClient.post(
1175
+ "/api/provision/v1/user/permission/apply/list",
1176
+ body,
1177
+ { headers: { appId } }
1178
+ );
1179
+ return response.data;
1180
+ }
1181
+ static async applyACL(req) {
1182
+ const { appId, ...body } = req;
1183
+ const response = await agcClient.post(
1184
+ "/api/provision/v1/user/permission/apply",
1185
+ body,
1186
+ { headers: { appId } }
1187
+ );
1188
+ return response.data;
1189
+ }
1190
+ static async getACLStatus(req) {
1191
+ const response = await agcClient.get(
1192
+ "/api/provision/v1/user/permission/apply/status",
1193
+ { headers: { appId: req.appId } }
1194
+ );
1195
+ return response.data;
1196
+ }
1197
+ static async getACLQuery(req) {
1198
+ const response = await agcClient.get("/api/provision/v1/user/permission", {
1199
+ headers: { appId: req.appId }
1200
+ });
1201
+ return response.data;
1202
+ }
1203
+ };
10
1204
  export {
11
1205
  AuthService,
12
1206
  ProjectService,
@@ -16,4 +1210,3 @@ export {
16
1210
  agcClient,
17
1211
  getConfig
18
1212
  };
19
- //# sourceMappingURL=index.mjs.map