统一 Node 22 与后端安全运行基线(07-15-production-trust-closeout-cleanup)

这个提交包含在:
2026-07-16 05:17:18 +08:00
父节点 dcf34d7ac6
当前提交 abb6a22f5c
共修改 28 个文件,包含 2250 行新增和 3012 行删除
+11 -5
查看文件
@@ -21,6 +21,11 @@ const INACTIVE_EMPLOYEE_ID = "00000000-0000-4000-8000-000000000004";
const POLICY_ID = "10000000-0000-4000-8000-000000000001";
const GENERAL_ID = "10000000-0000-4000-8000-000000000002";
const HIDDEN_ID = "10000000-0000-4000-8000-000000000003";
const TEST_FUTURE_OFFSET_MS = 24 * 60 * 60 * 1000;
function buildFutureDate() {
return new Date(Date.now() + TEST_FUTURE_OFFSET_MS);
}
function buildEmployee(overrides = {}) {
return {
@@ -47,7 +52,7 @@ function buildAnnouncement(overrides = {}) {
category: "policy",
requires_acknowledgement: true,
acknowledgement_statement: "我已阅读并理解该制度。",
acknowledgement_due_at: new Date("2026-06-01T15:59:59.000Z"),
acknowledgement_due_at: buildFutureDate(),
created_at: now,
created_by: ADMIN_ID,
updated_at: now,
@@ -76,11 +81,12 @@ function matchAnnouncementWhere(item, where = {}) {
if (where.enabled !== undefined && item.enabled !== where.enabled) {
return false;
}
const now = new Date("2026-05-28T02:00:00.000Z");
if (where.OR && item.starts_at && item.starts_at > now) {
const startsAtUpperBound = where.OR?.find((clause) => clause.starts_at?.lte)?.starts_at.lte ?? new Date();
const endsAtLowerBound = where.AND?.[0]?.OR?.find((clause) => clause.ends_at?.gte)?.ends_at.gte ?? new Date();
if (where.OR && item.starts_at && item.starts_at > startsAtUpperBound) {
return false;
}
if (where.AND && item.ends_at && item.ends_at < now) {
if (where.AND && item.ends_at && item.ends_at < endsAtLowerBound) {
return false;
}
return true;
@@ -107,7 +113,7 @@ function createPrismaState(options = {}) {
buildAnnouncement({
id: HIDDEN_ID,
title: "未来公告",
starts_at: new Date("2026-06-01T00:00:00.000Z"),
starts_at: buildFutureDate(),
}),
];
const acknowledgements = options.acknowledgements ?? [];