@bscotch/blork-shared
Advanced tools
Comparing version 0.15.0 to 0.15.1
@@ -105,9 +105,9 @@ import { BaseError } from './errors.js'; | ||
updateTemplate(templateId: string, patch: TaskTemplatePatch): Promise<{ | ||
creator: string; | ||
createdAt: Date; | ||
updatedAt: Date; | ||
name: string; | ||
description: string; | ||
template: string; | ||
templateId: string; | ||
creator: string; | ||
template: string; | ||
createdAt: Date; | ||
updatedAt: Date; | ||
}>; | ||
@@ -114,0 +114,0 @@ deleteTemplate(templateId: string): Promise<void>; |
@@ -91,2 +91,6 @@ import { CommentData, TaskData, UserData, UserDataSafe } from './index.js'; | ||
/** | ||
* A task is completable if all if its children are either done, deleted, or non-existent, or if it is already complete. | ||
*/ | ||
export declare function taskIsCompletable(cache: TaskCache, taskId: string | TaskData): boolean; | ||
/** | ||
* If the task or any of its ancestors are starred, return true. | ||
@@ -152,3 +156,3 @@ */ | ||
} | ||
export declare function hoursRollup(task: string | TaskData, cache: TaskCache): TaskHoursRollup; | ||
export declare function taskHoursRollup(task: string | TaskData, cache: TaskCache): TaskHoursRollup; | ||
export interface ComputedUserTasks { | ||
@@ -167,3 +171,3 @@ /** Total completed tasks for this user */ | ||
*/ | ||
export declare function isEmptyTask(task: TaskData): boolean; | ||
export declare function isEmptyTask(task: TaskData | undefined): task is TaskData; | ||
//# sourceMappingURL=tasks.d.ts.map |
@@ -298,2 +298,18 @@ import { assert } from './errors.js'; | ||
/** | ||
* A task is completable if all if its children are either done, deleted, or non-existent, or if it is already complete. | ||
*/ | ||
export function taskIsCompletable(cache, taskId) { | ||
const task = typeof taskId === 'string' ? cache.get(taskId) : taskId; | ||
if (!task) | ||
return false; | ||
if (task.done) | ||
return true; | ||
for (const childId of task.children) { | ||
const child = cache.get(childId); | ||
if (child && (!child.done || !child.deletedAt)) | ||
return false; | ||
} | ||
return true; | ||
} | ||
/** | ||
* If the task or any of its ancestors are starred, return true. | ||
@@ -466,3 +482,3 @@ */ | ||
} | ||
export function hoursRollup(task, cache) { | ||
export function taskHoursRollup(task, cache) { | ||
const results = { hours: 0, perUser: [] }; | ||
@@ -616,2 +632,4 @@ const taskData = typeof task === 'string' ? cache.get(task) : task; | ||
export function isEmptyTask(task) { | ||
if (!task) | ||
return true; | ||
if (task.title || | ||
@@ -618,0 +636,0 @@ task.description || |
@@ -44,11 +44,11 @@ import { z } from 'zod'; | ||
}, "strip", z.ZodTypeAny, { | ||
name: string; | ||
taskId: string; | ||
fileId: string; | ||
name: string; | ||
mimeType: string; | ||
bytes: number; | ||
}, { | ||
name: string; | ||
taskId: string; | ||
fileId: string; | ||
name: string; | ||
mimeType: string; | ||
@@ -68,28 +68,28 @@ bytes: number; | ||
}, "strip", z.ZodTypeAny, { | ||
commentId: string; | ||
taskId: string; | ||
creator: string; | ||
comment: string; | ||
done: boolean; | ||
createdAt: Date; | ||
updatedAt: Date; | ||
done: boolean; | ||
taskId: string; | ||
commentId: string; | ||
comment: string; | ||
owner?: string | null | undefined; | ||
blocking?: boolean | undefined; | ||
}, { | ||
commentId: string; | ||
taskId: string; | ||
creator: string; | ||
taskId: string; | ||
commentId: string; | ||
comment: string; | ||
owner?: string | null | undefined; | ||
done?: boolean | undefined; | ||
blocking?: boolean | undefined; | ||
createdAt?: unknown; | ||
updatedAt?: unknown; | ||
done?: boolean | undefined; | ||
owner?: string | null | undefined; | ||
blocking?: boolean | undefined; | ||
}>, "many">>; | ||
}, "strip", z.ZodTypeAny, { | ||
taskId: string; | ||
creator: string; | ||
done: boolean | null; | ||
createdAt: Date; | ||
updatedAt: Date; | ||
done: boolean | null; | ||
taskId: string; | ||
owners: string[]; | ||
@@ -110,5 +110,5 @@ parents: string[]; | ||
files?: { | ||
name: string; | ||
taskId: string; | ||
fileId: string; | ||
name: string; | ||
mimeType: string; | ||
@@ -118,9 +118,9 @@ bytes: number; | ||
comments?: { | ||
commentId: string; | ||
taskId: string; | ||
creator: string; | ||
comment: string; | ||
done: boolean; | ||
createdAt: Date; | ||
updatedAt: Date; | ||
done: boolean; | ||
taskId: string; | ||
commentId: string; | ||
comment: string; | ||
owner?: string | null | undefined; | ||
@@ -130,13 +130,13 @@ blocking?: boolean | undefined; | ||
}, { | ||
taskId: string; | ||
creator: string; | ||
taskId: string; | ||
owners: string[]; | ||
parents: string[]; | ||
description?: string | null | undefined; | ||
done?: boolean | null | undefined; | ||
createdAt?: unknown; | ||
updatedAt?: unknown; | ||
description?: string | null | undefined; | ||
deletedAt?: unknown; | ||
locked?: boolean | null | undefined; | ||
backlogged?: boolean | null | undefined; | ||
done?: boolean | null | undefined; | ||
hours?: number | null | undefined; | ||
@@ -151,5 +151,5 @@ starred?: boolean | null | undefined; | ||
files?: { | ||
name: string; | ||
taskId: string; | ||
fileId: string; | ||
name: string; | ||
mimeType: string; | ||
@@ -159,18 +159,18 @@ bytes: number; | ||
comments?: { | ||
commentId: string; | ||
taskId: string; | ||
creator: string; | ||
taskId: string; | ||
commentId: string; | ||
comment: string; | ||
owner?: string | null | undefined; | ||
done?: boolean | undefined; | ||
blocking?: boolean | undefined; | ||
createdAt?: unknown; | ||
updatedAt?: unknown; | ||
done?: boolean | undefined; | ||
owner?: string | null | undefined; | ||
blocking?: boolean | undefined; | ||
}[] | undefined; | ||
}>, { | ||
taskId: string; | ||
creator: string; | ||
done: boolean | null; | ||
createdAt: Date; | ||
updatedAt: Date; | ||
done: boolean | null; | ||
taskId: string; | ||
owners: string[]; | ||
@@ -191,5 +191,5 @@ parents: string[]; | ||
files?: { | ||
name: string; | ||
taskId: string; | ||
fileId: string; | ||
name: string; | ||
mimeType: string; | ||
@@ -199,9 +199,9 @@ bytes: number; | ||
comments?: { | ||
commentId: string; | ||
taskId: string; | ||
creator: string; | ||
comment: string; | ||
done: boolean; | ||
createdAt: Date; | ||
updatedAt: Date; | ||
done: boolean; | ||
taskId: string; | ||
commentId: string; | ||
comment: string; | ||
owner?: string | null | undefined; | ||
@@ -232,11 +232,11 @@ blocking?: boolean | undefined; | ||
}, "strip", z.ZodTypeAny, { | ||
tasks?: TaskCreate[] | undefined; | ||
template?: string | undefined; | ||
templateId?: string | undefined; | ||
template?: string | undefined; | ||
tasks?: TaskCreate[] | undefined; | ||
substitutions?: Record<string, string> | undefined; | ||
position?: number | undefined; | ||
}, { | ||
tasks?: TaskCreate[] | undefined; | ||
template?: string | undefined; | ||
templateId?: string | undefined; | ||
template?: string | undefined; | ||
tasks?: TaskCreate[] | undefined; | ||
substitutions?: Record<string, string> | undefined; | ||
@@ -316,8 +316,8 @@ position?: number | undefined; | ||
}, "strip", z.ZodTypeAny, { | ||
taskId: string; | ||
kind: "recover"; | ||
taskId: string; | ||
recursive?: boolean | undefined; | ||
}, { | ||
taskId: string; | ||
kind: "recover"; | ||
taskId: string; | ||
recursive?: boolean | undefined; | ||
@@ -330,7 +330,7 @@ }>; | ||
}, "strip", z.ZodTypeAny, { | ||
done: boolean; | ||
kind: "set-done"; | ||
}, { | ||
done: boolean; | ||
}, { | ||
kind: "set-done"; | ||
done: boolean; | ||
}>; | ||
@@ -497,8 +497,8 @@ export type TaskPatchLocked = z.infer<typeof taskPatchLockedSchema>; | ||
}, "strip", z.ZodTypeAny, { | ||
taskId: string; | ||
kind: "recover"; | ||
taskId: string; | ||
recursive?: boolean | undefined; | ||
}, { | ||
taskId: string; | ||
kind: "recover"; | ||
taskId: string; | ||
recursive?: boolean | undefined; | ||
@@ -509,7 +509,7 @@ }>, z.ZodObject<{ | ||
}, "strip", z.ZodTypeAny, { | ||
done: boolean; | ||
kind: "set-done"; | ||
}, { | ||
done: boolean; | ||
}, { | ||
kind: "set-done"; | ||
done: boolean; | ||
}>, z.ZodObject<{ | ||
@@ -622,7 +622,7 @@ kind: z.ZodLiteral<"set-locked">; | ||
at: Date; | ||
taskId: string; | ||
event: string; | ||
}, { | ||
taskId: string; | ||
}, { | ||
event: string; | ||
taskId: string; | ||
at?: unknown; | ||
@@ -639,7 +639,7 @@ }>; | ||
at: Date; | ||
taskId: string; | ||
event: "taskDeleted"; | ||
}, { | ||
taskId: string; | ||
}, { | ||
event: "taskDeleted"; | ||
taskId: string; | ||
at?: unknown; | ||
@@ -681,11 +681,11 @@ }>; | ||
}, "strip", z.ZodTypeAny, { | ||
name: string; | ||
taskId: string; | ||
fileId: string; | ||
name: string; | ||
mimeType: string; | ||
bytes: number; | ||
}, { | ||
name: string; | ||
taskId: string; | ||
fileId: string; | ||
name: string; | ||
mimeType: string; | ||
@@ -705,28 +705,28 @@ bytes: number; | ||
}, "strip", z.ZodTypeAny, { | ||
commentId: string; | ||
taskId: string; | ||
creator: string; | ||
comment: string; | ||
done: boolean; | ||
createdAt: Date; | ||
updatedAt: Date; | ||
done: boolean; | ||
taskId: string; | ||
commentId: string; | ||
comment: string; | ||
owner?: string | null | undefined; | ||
blocking?: boolean | undefined; | ||
}, { | ||
commentId: string; | ||
taskId: string; | ||
creator: string; | ||
taskId: string; | ||
commentId: string; | ||
comment: string; | ||
owner?: string | null | undefined; | ||
done?: boolean | undefined; | ||
blocking?: boolean | undefined; | ||
createdAt?: unknown; | ||
updatedAt?: unknown; | ||
done?: boolean | undefined; | ||
owner?: string | null | undefined; | ||
blocking?: boolean | undefined; | ||
}>, "many">>; | ||
}, "strip", z.ZodTypeAny, { | ||
taskId: string; | ||
creator: string; | ||
done: boolean | null; | ||
createdAt: Date; | ||
updatedAt: Date; | ||
done: boolean | null; | ||
taskId: string; | ||
owners: string[]; | ||
@@ -747,5 +747,5 @@ parents: string[]; | ||
files?: { | ||
name: string; | ||
taskId: string; | ||
fileId: string; | ||
name: string; | ||
mimeType: string; | ||
@@ -755,9 +755,9 @@ bytes: number; | ||
comments?: { | ||
commentId: string; | ||
taskId: string; | ||
creator: string; | ||
comment: string; | ||
done: boolean; | ||
createdAt: Date; | ||
updatedAt: Date; | ||
done: boolean; | ||
taskId: string; | ||
commentId: string; | ||
comment: string; | ||
owner?: string | null | undefined; | ||
@@ -767,13 +767,13 @@ blocking?: boolean | undefined; | ||
}, { | ||
taskId: string; | ||
creator: string; | ||
taskId: string; | ||
owners: string[]; | ||
parents: string[]; | ||
description?: string | null | undefined; | ||
done?: boolean | null | undefined; | ||
createdAt?: unknown; | ||
updatedAt?: unknown; | ||
description?: string | null | undefined; | ||
deletedAt?: unknown; | ||
locked?: boolean | null | undefined; | ||
backlogged?: boolean | null | undefined; | ||
done?: boolean | null | undefined; | ||
hours?: number | null | undefined; | ||
@@ -788,5 +788,5 @@ starred?: boolean | null | undefined; | ||
files?: { | ||
name: string; | ||
taskId: string; | ||
fileId: string; | ||
name: string; | ||
mimeType: string; | ||
@@ -796,18 +796,18 @@ bytes: number; | ||
comments?: { | ||
commentId: string; | ||
taskId: string; | ||
creator: string; | ||
taskId: string; | ||
commentId: string; | ||
comment: string; | ||
owner?: string | null | undefined; | ||
done?: boolean | undefined; | ||
blocking?: boolean | undefined; | ||
createdAt?: unknown; | ||
updatedAt?: unknown; | ||
done?: boolean | undefined; | ||
owner?: string | null | undefined; | ||
blocking?: boolean | undefined; | ||
}[] | undefined; | ||
}>, { | ||
taskId: string; | ||
creator: string; | ||
done: boolean | null; | ||
createdAt: Date; | ||
updatedAt: Date; | ||
done: boolean | null; | ||
taskId: string; | ||
owners: string[]; | ||
@@ -828,5 +828,5 @@ parents: string[]; | ||
files?: { | ||
name: string; | ||
taskId: string; | ||
fileId: string; | ||
name: string; | ||
mimeType: string; | ||
@@ -836,9 +836,9 @@ bytes: number; | ||
comments?: { | ||
commentId: string; | ||
taskId: string; | ||
creator: string; | ||
comment: string; | ||
done: boolean; | ||
createdAt: Date; | ||
updatedAt: Date; | ||
done: boolean; | ||
taskId: string; | ||
commentId: string; | ||
comment: string; | ||
owner?: string | null | undefined; | ||
@@ -850,9 +850,10 @@ blocking?: boolean | undefined; | ||
at: Date; | ||
taskId: string; | ||
event: "taskCreated"; | ||
task: { | ||
taskId: string; | ||
creator: string; | ||
done: boolean | null; | ||
createdAt: Date; | ||
updatedAt: Date; | ||
done: boolean | null; | ||
taskId: string; | ||
owners: string[]; | ||
@@ -873,5 +874,5 @@ parents: string[]; | ||
files?: { | ||
name: string; | ||
taskId: string; | ||
fileId: string; | ||
name: string; | ||
mimeType: string; | ||
@@ -881,9 +882,9 @@ bytes: number; | ||
comments?: { | ||
commentId: string; | ||
taskId: string; | ||
creator: string; | ||
comment: string; | ||
done: boolean; | ||
createdAt: Date; | ||
updatedAt: Date; | ||
done: boolean; | ||
taskId: string; | ||
commentId: string; | ||
comment: string; | ||
owner?: string | null | undefined; | ||
@@ -893,6 +894,5 @@ blocking?: boolean | undefined; | ||
}; | ||
}, { | ||
taskId: string; | ||
}, { | ||
event: "taskCreated"; | ||
taskId: string; | ||
at?: unknown; | ||
@@ -935,11 +935,11 @@ task?: unknown; | ||
}, "strip", z.ZodTypeAny, { | ||
name: string; | ||
taskId: string; | ||
fileId: string; | ||
name: string; | ||
mimeType: string; | ||
bytes: number; | ||
}, { | ||
name: string; | ||
taskId: string; | ||
fileId: string; | ||
name: string; | ||
mimeType: string; | ||
@@ -959,28 +959,28 @@ bytes: number; | ||
}, "strip", z.ZodTypeAny, { | ||
commentId: string; | ||
taskId: string; | ||
creator: string; | ||
comment: string; | ||
done: boolean; | ||
createdAt: Date; | ||
updatedAt: Date; | ||
done: boolean; | ||
taskId: string; | ||
commentId: string; | ||
comment: string; | ||
owner?: string | null | undefined; | ||
blocking?: boolean | undefined; | ||
}, { | ||
commentId: string; | ||
taskId: string; | ||
creator: string; | ||
taskId: string; | ||
commentId: string; | ||
comment: string; | ||
owner?: string | null | undefined; | ||
done?: boolean | undefined; | ||
blocking?: boolean | undefined; | ||
createdAt?: unknown; | ||
updatedAt?: unknown; | ||
done?: boolean | undefined; | ||
owner?: string | null | undefined; | ||
blocking?: boolean | undefined; | ||
}>, "many">>; | ||
}, "strip", z.ZodTypeAny, { | ||
taskId: string; | ||
creator: string; | ||
done: boolean | null; | ||
createdAt: Date; | ||
updatedAt: Date; | ||
done: boolean | null; | ||
taskId: string; | ||
owners: string[]; | ||
@@ -1001,5 +1001,5 @@ parents: string[]; | ||
files?: { | ||
name: string; | ||
taskId: string; | ||
fileId: string; | ||
name: string; | ||
mimeType: string; | ||
@@ -1009,9 +1009,9 @@ bytes: number; | ||
comments?: { | ||
commentId: string; | ||
taskId: string; | ||
creator: string; | ||
comment: string; | ||
done: boolean; | ||
createdAt: Date; | ||
updatedAt: Date; | ||
done: boolean; | ||
taskId: string; | ||
commentId: string; | ||
comment: string; | ||
owner?: string | null | undefined; | ||
@@ -1021,13 +1021,13 @@ blocking?: boolean | undefined; | ||
}, { | ||
taskId: string; | ||
creator: string; | ||
taskId: string; | ||
owners: string[]; | ||
parents: string[]; | ||
description?: string | null | undefined; | ||
done?: boolean | null | undefined; | ||
createdAt?: unknown; | ||
updatedAt?: unknown; | ||
description?: string | null | undefined; | ||
deletedAt?: unknown; | ||
locked?: boolean | null | undefined; | ||
backlogged?: boolean | null | undefined; | ||
done?: boolean | null | undefined; | ||
hours?: number | null | undefined; | ||
@@ -1042,5 +1042,5 @@ starred?: boolean | null | undefined; | ||
files?: { | ||
name: string; | ||
taskId: string; | ||
fileId: string; | ||
name: string; | ||
mimeType: string; | ||
@@ -1050,18 +1050,18 @@ bytes: number; | ||
comments?: { | ||
commentId: string; | ||
taskId: string; | ||
creator: string; | ||
taskId: string; | ||
commentId: string; | ||
comment: string; | ||
owner?: string | null | undefined; | ||
done?: boolean | undefined; | ||
blocking?: boolean | undefined; | ||
createdAt?: unknown; | ||
updatedAt?: unknown; | ||
done?: boolean | undefined; | ||
owner?: string | null | undefined; | ||
blocking?: boolean | undefined; | ||
}[] | undefined; | ||
}>, { | ||
taskId: string; | ||
creator: string; | ||
done: boolean | null; | ||
createdAt: Date; | ||
updatedAt: Date; | ||
done: boolean | null; | ||
taskId: string; | ||
owners: string[]; | ||
@@ -1082,5 +1082,5 @@ parents: string[]; | ||
files?: { | ||
name: string; | ||
taskId: string; | ||
fileId: string; | ||
name: string; | ||
mimeType: string; | ||
@@ -1090,9 +1090,9 @@ bytes: number; | ||
comments?: { | ||
commentId: string; | ||
taskId: string; | ||
creator: string; | ||
comment: string; | ||
done: boolean; | ||
createdAt: Date; | ||
updatedAt: Date; | ||
done: boolean; | ||
taskId: string; | ||
commentId: string; | ||
comment: string; | ||
owner?: string | null | undefined; | ||
@@ -1104,9 +1104,10 @@ blocking?: boolean | undefined; | ||
at: Date; | ||
taskId: string; | ||
event: "taskUpdated"; | ||
task: { | ||
taskId: string; | ||
creator: string; | ||
done: boolean | null; | ||
createdAt: Date; | ||
updatedAt: Date; | ||
done: boolean | null; | ||
taskId: string; | ||
owners: string[]; | ||
@@ -1127,5 +1128,5 @@ parents: string[]; | ||
files?: { | ||
name: string; | ||
taskId: string; | ||
fileId: string; | ||
name: string; | ||
mimeType: string; | ||
@@ -1135,9 +1136,9 @@ bytes: number; | ||
comments?: { | ||
commentId: string; | ||
taskId: string; | ||
creator: string; | ||
comment: string; | ||
done: boolean; | ||
createdAt: Date; | ||
updatedAt: Date; | ||
done: boolean; | ||
taskId: string; | ||
commentId: string; | ||
comment: string; | ||
owner?: string | null | undefined; | ||
@@ -1147,6 +1148,5 @@ blocking?: boolean | undefined; | ||
}; | ||
}, { | ||
taskId: string; | ||
}, { | ||
event: "taskUpdated"; | ||
taskId: string; | ||
at?: unknown; | ||
@@ -1153,0 +1153,0 @@ task?: unknown; |
@@ -480,2 +480,3 @@ import { z } from 'zod'; | ||
at: Date; | ||
userId: string; | ||
user: { | ||
@@ -498,6 +499,6 @@ kind: "group"; | ||
}; | ||
userId: string; | ||
event: "userCreated"; | ||
for: "all"; | ||
}, { | ||
userId: string; | ||
user: { | ||
@@ -520,3 +521,2 @@ kind: "group"; | ||
}; | ||
userId: string; | ||
event: "userCreated"; | ||
@@ -579,2 +579,3 @@ for: "all"; | ||
at: Date; | ||
userId: string; | ||
user: { | ||
@@ -586,6 +587,6 @@ kind: "group"; | ||
}; | ||
userId: string; | ||
event: "userGroupUpdated"; | ||
for: "all"; | ||
}, { | ||
userId: string; | ||
user: { | ||
@@ -597,3 +598,2 @@ kind: "group"; | ||
}; | ||
userId: string; | ||
event: "userGroupUpdated"; | ||
@@ -600,0 +600,0 @@ for: "all"; |
{ | ||
"name": "@bscotch/blork-shared", | ||
"version": "0.15.0", | ||
"version": "0.15.1", | ||
"description": "Client and shared utilities for Blork projects.", | ||
@@ -5,0 +5,0 @@ "keywords": [], |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
459203
7407