feat: harden orchestrator execution runtime

This commit is contained in:
john
2026-07-24 23:53:32 +08:00
parent 396bb78200
commit f6f2cd0933
55 changed files with 5122 additions and 194 deletions
+33
View File
@@ -62,6 +62,39 @@ export async function getPageDataPolicyIndex(pool, pageId) {
};
}
export async function getPageDataPolicyIndexByWorkspacePath(
pool,
ownerUserId,
workspaceRelativePath,
) {
if (!pool || !ownerUserId || !workspaceRelativePath) return null;
const [rows] = await pool.query(
`SELECT i.page_id, i.owner_user_id, i.access_mode, i.dataset_count,
i.scope_hash, i.updated_at, p.current_publish_id
FROM h5_page_data_policy_index i
JOIN h5_page_records p
ON p.id = i.page_id
AND p.user_id = i.owner_user_id
WHERE i.owner_user_id = ?
AND p.workspace_relative_path = ?
AND p.status <> 'deleted'
ORDER BY i.updated_at DESC
LIMIT 1`,
[ownerUserId, workspaceRelativePath],
);
const row = rows[0];
if (!row) return null;
return {
pageId: row.page_id,
ownerUserId: row.owner_user_id,
accessMode: row.access_mode,
datasetCount: Number(row.dataset_count ?? 0),
scopeHash: row.scope_hash,
updatedAt: Number(row.updated_at ?? 0),
publicationId: row.current_publish_id ?? null,
};
}
export async function listPageDataPolicyIndexByOwner(pool, ownerUserId, { limit = 50 } = {}) {
if (!pool) return [];
const safeLimit = Math.min(Math.max(1, Number(limit ?? 50)), 200);