Refresh HiveGrid Cloud reference snapshot
This commit is contained in:
1 parent
5e99e14772
commit
7f88026f79
5955 files changed
+1177325
-188362
No files matched your search
+10
-8
@@ -10,8 +10,8 @@
|
||||
// own timeline (`task` is itself a valid Activity subject).
|
||||
|
||||
import type { JsonValue } from "@hivegrid/foundation";
|
||||
import { createAuditEvent } from "@hivegrid/db/audit-events.server";
|
||||
import { logActivity, type ActivitySubjectType, type ActivityType } from "@hivegrid/activity";
|
||||
import { createAuditEvent, type AuditEventWriterClient } from "@hivegrid/db/audit-events.server";
|
||||
import { logActivity, type ActivitySubjectType, type ActivityType, type ActivityWriteClient } from "@hivegrid/activity";
|
||||
import type { TasksRouteContext } from "./taskAccess.server";
|
||||
import type { TaskEntityType } from "./taskService.server";
|
||||
|
||||
@@ -31,7 +31,7 @@ export async function auditTaskEvent(input: {
|
||||
action: TaskAuditAction;
|
||||
taskId: string;
|
||||
metadata?: Record<string, JsonValue>;
|
||||
}): Promise<void> {
|
||||
}, options: { readonly client?: AuditEventWriterClient; readonly strict?: boolean } = {}): Promise<void> {
|
||||
try {
|
||||
await createAuditEvent({
|
||||
tenantId: input.ctx.tenantId,
|
||||
@@ -41,8 +41,9 @@ export async function auditTaskEvent(input: {
|
||||
targetType: "task",
|
||||
targetId: input.taskId,
|
||||
metadata: input.metadata ?? null,
|
||||
});
|
||||
} catch {
|
||||
}, options.client);
|
||||
} catch (error) {
|
||||
if (options.strict) throw error;
|
||||
// Audit must never break the user action; the failure is logged upstream.
|
||||
}
|
||||
}
|
||||
@@ -67,7 +68,7 @@ export async function logTaskActivity(input: {
|
||||
summaryText: string;
|
||||
linkedEntityType?: TaskEntityType | null;
|
||||
linkedEntityId?: string | null;
|
||||
}): Promise<void> {
|
||||
}, options: { readonly client?: ActivityWriteClient; readonly strict?: boolean } = {}): Promise<void> {
|
||||
const linkedSubject = input.linkedEntityType ? ENTITY_TO_ACTIVITY_SUBJECT[input.linkedEntityType] : undefined;
|
||||
const useLinked = Boolean(linkedSubject && input.linkedEntityId);
|
||||
try {
|
||||
@@ -80,8 +81,9 @@ export async function logTaskActivity(input: {
|
||||
subjectId: useLinked ? (input.linkedEntityId as string) : input.taskId,
|
||||
summaryText: input.summaryText,
|
||||
relatedEntityRefs: useLinked ? [{ type: "task", id: input.taskId }] : undefined,
|
||||
});
|
||||
} catch {
|
||||
}, { client: options.client });
|
||||
} catch (error) {
|
||||
if (options.strict) throw error;
|
||||
// Activity logging is best-effort; never break the user action.
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user