@dreamor/atlas-cli 0.7.19 → 0.7.21
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.
|
@@ -45,11 +45,15 @@ export async function refreshSession(opts = {}) {
|
|
|
45
45
|
}
|
|
46
46
|
try {
|
|
47
47
|
const ctx = await browser.newContext();
|
|
48
|
-
// 灌入已有 cookie,但剥离失效的 access_token
|
|
49
|
-
//
|
|
48
|
+
// 灌入已有 cookie,但剥离失效的 access_token 及相关签名 cookies
|
|
49
|
+
// (access_token.sig / refresh_token / refresh_token.sig)—— 强制
|
|
50
|
+
// SSO 用 SSO_REFRESH_TOKEN 换发全套新 token,防止 still_valid 假阳性。
|
|
51
|
+
// 注:实际工时 API 会校验 token + signature 匹配,只换 access_token
|
|
52
|
+
// 不换 sig 同样会被拒绝。
|
|
50
53
|
// playwright 严格校验 cookie 字段,需要补齐 path/secure 等。
|
|
54
|
+
const tokenNames = new Set(['access_token', 'access_token.sig', 'refresh_token', 'refresh_token.sig']);
|
|
51
55
|
const cookiesForContext = existing
|
|
52
|
-
.filter((c) => c.name
|
|
56
|
+
.filter((c) => !tokenNames.has(c.name))
|
|
53
57
|
.map((c) => ({
|
|
54
58
|
name: c.name,
|
|
55
59
|
value: c.value,
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { createClient } from '../../http/client.js';
|
|
2
2
|
import { isJsonMode, jsonOk, log } from '../../util/output.js';
|
|
3
3
|
import { enforceOutputLimit } from '../../util/output-limit.js';
|
|
4
|
-
import { SessionExpiredError } from '../../util/errors.js';
|
|
5
4
|
import { expandMonths, expandMonthsDefault } from '../../util/months.js';
|
|
6
5
|
import { resolveSecureExportPath, secureWriteFile } from '../../util/secure-fs.js';
|
|
7
6
|
import { annotateWithMonth, aggregateByAxis, filterByStaff, flattenTree, } from './_logic.js';
|
|
@@ -53,10 +52,10 @@ export async function monthCmd(opts) {
|
|
|
53
52
|
all.push(...annotateWithMonth(data, m));
|
|
54
53
|
}
|
|
55
54
|
catch (e) {
|
|
56
|
-
|
|
57
|
-
|
|
55
|
+
// 实际工时 API 对无数据月份也返回 501("当前token已失效"),
|
|
56
|
+
// 不是真正的 token 过期。不 rethrow,只记录到 failedMonths。
|
|
58
57
|
failedMonths.push({ month: m, error: e instanceof Error ? e.message : String(e) });
|
|
59
|
-
log(`月 ${m}
|
|
58
|
+
log(`月 ${m} 无实际工时数据`);
|
|
60
59
|
}
|
|
61
60
|
}
|
|
62
61
|
// Apply --department / --role filter
|
|
@@ -84,10 +83,10 @@ export async function summaryCmd(opts) {
|
|
|
84
83
|
all.push(...annotateWithMonth(await fetchActual(pid, m), m));
|
|
85
84
|
}
|
|
86
85
|
catch (e) {
|
|
87
|
-
|
|
88
|
-
|
|
86
|
+
// 实际工时 API 对无数据月份也返回 501("当前token已失效"),
|
|
87
|
+
// 不是真正的 token 过期。不 rethrow,只记录到 failedMonths。
|
|
89
88
|
failedMonths.push({ month: m, error: e instanceof Error ? e.message : String(e) });
|
|
90
|
-
log(`月 ${m}
|
|
89
|
+
log(`月 ${m} 无实际工时数据`);
|
|
91
90
|
}
|
|
92
91
|
}
|
|
93
92
|
// Apply --department / --role filter
|
|
@@ -114,10 +113,10 @@ export async function exportCmd(opts) {
|
|
|
114
113
|
rows.push(...annotateWithMonth(data, m));
|
|
115
114
|
}
|
|
116
115
|
catch (e) {
|
|
117
|
-
|
|
118
|
-
|
|
116
|
+
// 实际工时 API 对无数据月份也返回 501("当前token已失效"),
|
|
117
|
+
// 不是真正的 token 过期。不 rethrow,只记录到 failedMonths。
|
|
119
118
|
failedMonths.push({ month: m, error: e instanceof Error ? e.message : String(e) });
|
|
120
|
-
log(`月 ${m}
|
|
119
|
+
log(`月 ${m} 无实际工时数据`);
|
|
121
120
|
}
|
|
122
121
|
}
|
|
123
122
|
// Apply --department / --role filter
|
|
@@ -58,8 +58,10 @@ export async function compareCmd(opts) {
|
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
60
|
catch (e) {
|
|
61
|
-
|
|
62
|
-
|
|
61
|
+
// 实际工时 API 对无数据月份也返回 501(错误信息"当前token已失效"),
|
|
62
|
+
// 这不是真正的 token 过期——基线 API 正常就说明 token 有效。
|
|
63
|
+
// 所以不 rethrow SessionExpiredError,只记录到 failedMonths。
|
|
64
|
+
// 真正的 token 过期会由基线 API 的 catch 块捕获并抛出。
|
|
63
65
|
failedMonths.push({ month: m, error: `实际工时拉取失败: ${e instanceof Error ? e.message : String(e)}` });
|
|
64
66
|
}
|
|
65
67
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const ATLAS_VERSION = '0.7.
|
|
1
|
+
export const ATLAS_VERSION = '0.7.21';
|