@bscotch/blork-shared
Advanced tools
Comparing version 0.28.0 to 0.29.0
@@ -108,9 +108,9 @@ import { BlorkError } 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; | ||
}>; | ||
@@ -117,0 +117,0 @@ deleteTemplate(templateId: string): Promise<void>; |
@@ -14,3 +14,3 @@ export declare const taskUrlAreas: readonly ["card", "tree", "pins", "doables", "done", "search"]; | ||
} | ||
export declare class TaskUrl { | ||
export declare class TaskLocation { | ||
/** | ||
@@ -22,7 +22,15 @@ * Most tasks fail silently. If there was an error, its message will be here. | ||
protected constructor(context: TaskUrlPartialContext); | ||
get isRoot(): boolean; | ||
get taskId(): string; | ||
get isSubtreeRoot(): boolean; | ||
get isCardRoot(): boolean; | ||
get pointer(): string[]; | ||
set pointer(pointer: string[]); | ||
get parentId(): string | undefined; | ||
get parentPointer(): string[]; | ||
get grandParentId(): string | undefined; | ||
get grandParentPointer(): string[]; | ||
get area(): TaskUrlArea; | ||
set area(area: TaskUrlArea); | ||
get isTreeLikeArea(): boolean; | ||
get subtree(): string[]; | ||
@@ -36,4 +44,10 @@ set subtree(subtree: string[]); | ||
get id(): string; | ||
equals(other: TaskUrl): boolean; | ||
equals(other: TaskLocation): boolean; | ||
clone(): TaskLocation; | ||
/** | ||
* Get a new TaskLocation that is the parent of this one. | ||
* If the parent can't be shown in the same location, returns the parent's tree location. | ||
*/ | ||
toParentLocation(): TaskLocation; | ||
/** | ||
* Get a deep copy of this URL's context object | ||
@@ -50,9 +64,9 @@ */ | ||
toURL(baseUrl: string): URL; | ||
static from(ctx: TaskUrlPartialContext): TaskUrl; | ||
static from(url: URL | string): TaskUrl; | ||
static from(ctx: TaskUrlPartialContext): TaskLocation; | ||
static from(url: URL | string): TaskLocation; | ||
/** | ||
* Given a TaskUrl id, parse it into a TaskUrlContext object. | ||
* Given a TaskLocation id, parse it into a TaskUrlContext object. | ||
*/ | ||
static fromId(id: string): TaskUrl; | ||
static fromId(id: string): TaskLocation; | ||
} | ||
//# sourceMappingURL=tasks.urls.d.ts.map |
import { assert } from './errors.js'; | ||
import { rootTaskId } from './types.tasks.js'; | ||
import { stringArraysAreSame } from './util.arrays.js'; | ||
import { pointerIsChild } from './util.pointers.js'; | ||
import { pointerIsChild, pointerIsPrefix } from './util.pointers.js'; | ||
export const taskUrlAreas = [ | ||
@@ -13,3 +13,3 @@ 'card', | ||
]; | ||
export class TaskUrl { | ||
export class TaskLocation { | ||
/** | ||
@@ -25,3 +25,4 @@ * Most tasks fail silently. If there was an error, its message will be here. | ||
this.context.area ||= 'tree'; | ||
if (context.area === 'card') { | ||
if (['pins', 'done', 'card'].includes(context.area)) { | ||
// Then we need a subtree! | ||
if (context.pointer && !context.subtree) { | ||
@@ -34,3 +35,3 @@ context.subtree = [...context.pointer]; | ||
else if (!context.pointer && !context.subtree) { | ||
this.error = 'Card view requires either pointer or subtree'; | ||
this.error = 'Requires either pointer or subtree'; | ||
context.area = 'tree'; | ||
@@ -52,5 +53,19 @@ } | ||
} | ||
get isRoot() { | ||
if (this.pointer.length === 1) { | ||
assert(this.pointer[0] === rootTaskId, 'Root task must be root'); | ||
return true; | ||
} | ||
return false; | ||
} | ||
get taskId() { | ||
assert(this.pointer.length > 0, 'Task ID must be present'); | ||
return this.pointer.at(-1); | ||
} | ||
get isSubtreeRoot() { | ||
return this.pointer.length === this.subtree.length; | ||
} | ||
get isCardRoot() { | ||
return this.area === 'card' && this.isSubtreeRoot; | ||
} | ||
get pointer() { | ||
@@ -62,3 +77,18 @@ return this.context.pointer || this.subtree; | ||
this.context.pointer = pointer; | ||
if (!pointerIsPrefix(this.context.subtree, pointer)) { | ||
this.context.subtree = [...pointer]; | ||
} | ||
} | ||
get parentId() { | ||
return this.pointer.at(-2); | ||
} | ||
get parentPointer() { | ||
return this.pointer.slice(0, -1) || []; | ||
} | ||
get grandParentId() { | ||
return this.pointer.at(-3); | ||
} | ||
get grandParentPointer() { | ||
return this.pointer.slice(0, -2) || []; | ||
} | ||
get area() { | ||
@@ -76,2 +106,5 @@ return this.context.area; | ||
} | ||
get isTreeLikeArea() { | ||
return ['tree', 'pins', 'card', 'done'].includes(this.area); | ||
} | ||
get subtree() { | ||
@@ -112,3 +145,26 @@ return this.context.subtree || [rootTaskId]; | ||
} | ||
clone() { | ||
return new TaskLocation(this.toContext()); | ||
} | ||
/** | ||
* Get a new TaskLocation that is the parent of this one. | ||
* If the parent can't be shown in the same location, returns the parent's tree location. | ||
*/ | ||
toParentLocation() { | ||
const newParent = new TaskLocation(this.toContext()); | ||
newParent.pointer = this.parentPointer; | ||
if (!newParent.isTreeLikeArea) { | ||
newParent.area = 'tree'; | ||
} | ||
else if (!stringArraysAreSame(newParent.subtree, this.subtree) && | ||
newParent.area !== 'card') { | ||
// Then we had to go up a level. | ||
newParent.area = 'tree'; | ||
} | ||
if (newParent.isRoot) { | ||
newParent.area = 'tree'; | ||
} | ||
return newParent; | ||
} | ||
/** | ||
* Get a deep copy of this URL's context object | ||
@@ -203,19 +259,22 @@ */ | ||
} | ||
return new TaskUrl(ctx); | ||
return new TaskLocation(ctx); | ||
} | ||
else { | ||
return new TaskUrl(urlOrCtx); | ||
return new TaskLocation(urlOrCtx); | ||
} | ||
} | ||
/** | ||
* Given a TaskUrl id, parse it into a TaskUrlContext object. | ||
* Given a TaskLocation id, parse it into a TaskUrlContext object. | ||
*/ | ||
static fromId(id) { | ||
let [area, pointerStr, subtreeStr] = id.split(':'); | ||
const subtree = subtreeStr?.split('/') || []; | ||
const pointer = subtree.concat(pointerStr?.split('/') || []); | ||
return TaskUrl.from({ | ||
const subtree = subtreeStr?.split('/'); | ||
let pointer; | ||
if (pointerStr) { | ||
pointer = (subtree || []).concat(pointerStr.split('/')); | ||
} | ||
return TaskLocation.from({ | ||
area: area, | ||
pointer: [rootTaskId, ...pointer], | ||
subtree: [rootTaskId, ...subtree], | ||
pointer: pointer && [rootTaskId, ...pointer], | ||
subtree: subtree && [rootTaskId, ...subtree], | ||
}); | ||
@@ -222,0 +281,0 @@ } |
@@ -45,11 +45,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; | ||
@@ -69,30 +69,31 @@ bytes: number; | ||
}, "strip", z.ZodTypeAny, { | ||
commentId: string; | ||
taskId: string; | ||
creator: string; | ||
comment: string; | ||
createdAt: Date; | ||
updatedAt: Date; | ||
taskId: string; | ||
commentId: string; | ||
comment: string; | ||
assigned?: Record<string, boolean> | null | undefined; | ||
snoozed?: Date | null | undefined; | ||
assigned?: Record<string, boolean> | null | undefined; | ||
blocking?: boolean | undefined; | ||
}, { | ||
commentId: string; | ||
taskId: string; | ||
creator: string; | ||
taskId: string; | ||
commentId: string; | ||
comment: string; | ||
assigned?: Record<string, boolean> | null | undefined; | ||
snoozed?: unknown; | ||
blocking?: boolean | undefined; | ||
createdAt?: unknown; | ||
updatedAt?: unknown; | ||
snoozed?: unknown; | ||
assigned?: Record<string, boolean> | null | undefined; | ||
blocking?: boolean | undefined; | ||
}>, "many">>; | ||
}, "strip", z.ZodTypeAny, { | ||
taskId: string; | ||
creator: string; | ||
assigned: Record<string, boolean>; | ||
createdAt: Date; | ||
updatedAt: Date; | ||
taskId: string; | ||
assigned: Record<string, boolean>; | ||
parents: string[]; | ||
children: string[]; | ||
snoozed?: Date | null | undefined; | ||
description?: string | null | undefined; | ||
@@ -106,3 +107,2 @@ deletedAt?: Date | null | undefined; | ||
tagged?: boolean | null | undefined; | ||
snoozed?: Date | null | undefined; | ||
nonowners?: string[] | null | undefined; | ||
@@ -112,5 +112,5 @@ blockers?: string[] | undefined; | ||
files?: { | ||
name: string; | ||
taskId: string; | ||
fileId: string; | ||
name: string; | ||
mimeType: string; | ||
@@ -120,20 +120,21 @@ bytes: number; | ||
comments?: { | ||
commentId: string; | ||
taskId: string; | ||
creator: string; | ||
comment: string; | ||
createdAt: Date; | ||
updatedAt: Date; | ||
taskId: string; | ||
commentId: string; | ||
comment: string; | ||
assigned?: Record<string, boolean> | null | undefined; | ||
snoozed?: Date | null | undefined; | ||
assigned?: Record<string, boolean> | null | undefined; | ||
blocking?: boolean | undefined; | ||
}[] | undefined; | ||
}, { | ||
taskId: string; | ||
creator: string; | ||
taskId: string; | ||
assigned: Record<string, boolean>; | ||
parents: string[]; | ||
description?: string | null | undefined; | ||
snoozed?: unknown; | ||
createdAt?: unknown; | ||
updatedAt?: unknown; | ||
description?: string | null | undefined; | ||
deletedAt?: unknown; | ||
@@ -146,3 +147,2 @@ locked?: boolean | null | undefined; | ||
tagged?: boolean | null | undefined; | ||
snoozed?: unknown; | ||
nonowners?: string[] | null | undefined; | ||
@@ -153,5 +153,5 @@ children?: string[] | undefined; | ||
files?: { | ||
name: string; | ||
taskId: string; | ||
fileId: string; | ||
name: string; | ||
mimeType: string; | ||
@@ -161,20 +161,21 @@ bytes: number; | ||
comments?: { | ||
commentId: string; | ||
taskId: string; | ||
creator: string; | ||
taskId: string; | ||
commentId: string; | ||
comment: string; | ||
assigned?: Record<string, boolean> | null | undefined; | ||
snoozed?: unknown; | ||
blocking?: boolean | undefined; | ||
createdAt?: unknown; | ||
updatedAt?: unknown; | ||
snoozed?: unknown; | ||
assigned?: Record<string, boolean> | null | undefined; | ||
blocking?: boolean | undefined; | ||
}[] | undefined; | ||
}>, { | ||
taskId: string; | ||
creator: string; | ||
assigned: Record<string, boolean>; | ||
createdAt: Date; | ||
updatedAt: Date; | ||
taskId: string; | ||
assigned: Record<string, boolean>; | ||
parents: string[]; | ||
children: string[]; | ||
snoozed?: Date | null | undefined; | ||
description?: string | null | undefined; | ||
@@ -188,3 +189,2 @@ deletedAt?: Date | null | undefined; | ||
tagged?: boolean | null | undefined; | ||
snoozed?: Date | null | undefined; | ||
nonowners?: string[] | null | undefined; | ||
@@ -194,5 +194,5 @@ blockers?: string[] | undefined; | ||
files?: { | ||
name: string; | ||
taskId: string; | ||
fileId: string; | ||
name: string; | ||
mimeType: string; | ||
@@ -202,10 +202,10 @@ bytes: number; | ||
comments?: { | ||
commentId: string; | ||
taskId: string; | ||
creator: string; | ||
comment: string; | ||
createdAt: Date; | ||
updatedAt: Date; | ||
taskId: string; | ||
commentId: string; | ||
comment: string; | ||
assigned?: Record<string, boolean> | null | undefined; | ||
snoozed?: Date | null | undefined; | ||
assigned?: Record<string, boolean> | null | undefined; | ||
blocking?: boolean | undefined; | ||
@@ -243,11 +243,11 @@ }[] | 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; | ||
@@ -650,8 +650,8 @@ position?: number | undefined; | ||
at: Date; | ||
taskId: string; | ||
event: string; | ||
taskId: string; | ||
clientId?: string | undefined; | ||
}, { | ||
taskId: string; | ||
event: string; | ||
taskId: string; | ||
at?: unknown; | ||
@@ -670,8 +670,8 @@ clientId?: string | undefined; | ||
at: Date; | ||
taskId: string; | ||
event: "taskDeleted"; | ||
taskId: string; | ||
clientId?: string | undefined; | ||
}, { | ||
taskId: string; | ||
event: "taskDeleted"; | ||
taskId: string; | ||
at?: unknown; | ||
@@ -715,11 +715,11 @@ clientId?: string | undefined; | ||
}, "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; | ||
@@ -739,30 +739,31 @@ bytes: number; | ||
}, "strip", z.ZodTypeAny, { | ||
commentId: string; | ||
taskId: string; | ||
creator: string; | ||
comment: string; | ||
createdAt: Date; | ||
updatedAt: Date; | ||
taskId: string; | ||
commentId: string; | ||
comment: string; | ||
assigned?: Record<string, boolean> | null | undefined; | ||
snoozed?: Date | null | undefined; | ||
assigned?: Record<string, boolean> | null | undefined; | ||
blocking?: boolean | undefined; | ||
}, { | ||
commentId: string; | ||
taskId: string; | ||
creator: string; | ||
taskId: string; | ||
commentId: string; | ||
comment: string; | ||
assigned?: Record<string, boolean> | null | undefined; | ||
snoozed?: unknown; | ||
blocking?: boolean | undefined; | ||
createdAt?: unknown; | ||
updatedAt?: unknown; | ||
snoozed?: unknown; | ||
assigned?: Record<string, boolean> | null | undefined; | ||
blocking?: boolean | undefined; | ||
}>, "many">>; | ||
}, "strip", z.ZodTypeAny, { | ||
taskId: string; | ||
creator: string; | ||
assigned: Record<string, boolean>; | ||
createdAt: Date; | ||
updatedAt: Date; | ||
taskId: string; | ||
assigned: Record<string, boolean>; | ||
parents: string[]; | ||
children: string[]; | ||
snoozed?: Date | null | undefined; | ||
description?: string | null | undefined; | ||
@@ -776,3 +777,2 @@ deletedAt?: Date | null | undefined; | ||
tagged?: boolean | null | undefined; | ||
snoozed?: Date | null | undefined; | ||
nonowners?: string[] | null | undefined; | ||
@@ -782,5 +782,5 @@ blockers?: string[] | undefined; | ||
files?: { | ||
name: string; | ||
taskId: string; | ||
fileId: string; | ||
name: string; | ||
mimeType: string; | ||
@@ -790,20 +790,21 @@ bytes: number; | ||
comments?: { | ||
commentId: string; | ||
taskId: string; | ||
creator: string; | ||
comment: string; | ||
createdAt: Date; | ||
updatedAt: Date; | ||
taskId: string; | ||
commentId: string; | ||
comment: string; | ||
assigned?: Record<string, boolean> | null | undefined; | ||
snoozed?: Date | null | undefined; | ||
assigned?: Record<string, boolean> | null | undefined; | ||
blocking?: boolean | undefined; | ||
}[] | undefined; | ||
}, { | ||
taskId: string; | ||
creator: string; | ||
taskId: string; | ||
assigned: Record<string, boolean>; | ||
parents: string[]; | ||
description?: string | null | undefined; | ||
snoozed?: unknown; | ||
createdAt?: unknown; | ||
updatedAt?: unknown; | ||
description?: string | null | undefined; | ||
deletedAt?: unknown; | ||
@@ -816,3 +817,2 @@ locked?: boolean | null | undefined; | ||
tagged?: boolean | null | undefined; | ||
snoozed?: unknown; | ||
nonowners?: string[] | null | undefined; | ||
@@ -823,5 +823,5 @@ children?: string[] | undefined; | ||
files?: { | ||
name: string; | ||
taskId: string; | ||
fileId: string; | ||
name: string; | ||
mimeType: string; | ||
@@ -831,20 +831,21 @@ bytes: number; | ||
comments?: { | ||
commentId: string; | ||
taskId: string; | ||
creator: string; | ||
taskId: string; | ||
commentId: string; | ||
comment: string; | ||
assigned?: Record<string, boolean> | null | undefined; | ||
snoozed?: unknown; | ||
blocking?: boolean | undefined; | ||
createdAt?: unknown; | ||
updatedAt?: unknown; | ||
snoozed?: unknown; | ||
assigned?: Record<string, boolean> | null | undefined; | ||
blocking?: boolean | undefined; | ||
}[] | undefined; | ||
}>, { | ||
taskId: string; | ||
creator: string; | ||
assigned: Record<string, boolean>; | ||
createdAt: Date; | ||
updatedAt: Date; | ||
taskId: string; | ||
assigned: Record<string, boolean>; | ||
parents: string[]; | ||
children: string[]; | ||
snoozed?: Date | null | undefined; | ||
description?: string | null | undefined; | ||
@@ -858,3 +859,2 @@ deletedAt?: Date | null | undefined; | ||
tagged?: boolean | null | undefined; | ||
snoozed?: Date | null | undefined; | ||
nonowners?: string[] | null | undefined; | ||
@@ -864,5 +864,5 @@ blockers?: string[] | undefined; | ||
files?: { | ||
name: string; | ||
taskId: string; | ||
fileId: string; | ||
name: string; | ||
mimeType: string; | ||
@@ -872,10 +872,10 @@ bytes: number; | ||
comments?: { | ||
commentId: string; | ||
taskId: string; | ||
creator: string; | ||
comment: string; | ||
createdAt: Date; | ||
updatedAt: Date; | ||
taskId: string; | ||
commentId: string; | ||
comment: string; | ||
assigned?: Record<string, boolean> | null | undefined; | ||
snoozed?: Date | null | undefined; | ||
assigned?: Record<string, boolean> | null | undefined; | ||
blocking?: boolean | undefined; | ||
@@ -886,12 +886,13 @@ }[] | undefined; | ||
at: Date; | ||
taskId: string; | ||
event: "taskCreated"; | ||
taskId: string; | ||
task: { | ||
taskId: string; | ||
creator: string; | ||
assigned: Record<string, boolean>; | ||
createdAt: Date; | ||
updatedAt: Date; | ||
taskId: string; | ||
assigned: Record<string, boolean>; | ||
parents: string[]; | ||
children: string[]; | ||
snoozed?: Date | null | undefined; | ||
description?: string | null | undefined; | ||
@@ -905,3 +906,2 @@ deletedAt?: Date | null | undefined; | ||
tagged?: boolean | null | undefined; | ||
snoozed?: Date | null | undefined; | ||
nonowners?: string[] | null | undefined; | ||
@@ -911,5 +911,5 @@ blockers?: string[] | undefined; | ||
files?: { | ||
name: string; | ||
taskId: string; | ||
fileId: string; | ||
name: string; | ||
mimeType: string; | ||
@@ -919,10 +919,10 @@ bytes: number; | ||
comments?: { | ||
commentId: string; | ||
taskId: string; | ||
creator: string; | ||
comment: string; | ||
createdAt: Date; | ||
updatedAt: Date; | ||
taskId: string; | ||
commentId: string; | ||
comment: string; | ||
assigned?: Record<string, boolean> | null | undefined; | ||
snoozed?: Date | null | undefined; | ||
assigned?: Record<string, boolean> | null | undefined; | ||
blocking?: boolean | undefined; | ||
@@ -933,7 +933,7 @@ }[] | undefined; | ||
}, { | ||
taskId: string; | ||
event: "taskCreated"; | ||
taskId: string; | ||
at?: unknown; | ||
clientId?: string | undefined; | ||
task?: unknown; | ||
clientId?: string | undefined; | ||
}>; | ||
@@ -975,11 +975,11 @@ export type TaskUpdatedEvent = z.infer<typeof taskUpdatedEventSchema>; | ||
}, "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; | ||
@@ -999,30 +999,31 @@ bytes: number; | ||
}, "strip", z.ZodTypeAny, { | ||
commentId: string; | ||
taskId: string; | ||
creator: string; | ||
comment: string; | ||
createdAt: Date; | ||
updatedAt: Date; | ||
taskId: string; | ||
commentId: string; | ||
comment: string; | ||
assigned?: Record<string, boolean> | null | undefined; | ||
snoozed?: Date | null | undefined; | ||
assigned?: Record<string, boolean> | null | undefined; | ||
blocking?: boolean | undefined; | ||
}, { | ||
commentId: string; | ||
taskId: string; | ||
creator: string; | ||
taskId: string; | ||
commentId: string; | ||
comment: string; | ||
assigned?: Record<string, boolean> | null | undefined; | ||
snoozed?: unknown; | ||
blocking?: boolean | undefined; | ||
createdAt?: unknown; | ||
updatedAt?: unknown; | ||
snoozed?: unknown; | ||
assigned?: Record<string, boolean> | null | undefined; | ||
blocking?: boolean | undefined; | ||
}>, "many">>; | ||
}, "strip", z.ZodTypeAny, { | ||
taskId: string; | ||
creator: string; | ||
assigned: Record<string, boolean>; | ||
createdAt: Date; | ||
updatedAt: Date; | ||
taskId: string; | ||
assigned: Record<string, boolean>; | ||
parents: string[]; | ||
children: string[]; | ||
snoozed?: Date | null | undefined; | ||
description?: string | null | undefined; | ||
@@ -1036,3 +1037,2 @@ deletedAt?: Date | null | undefined; | ||
tagged?: boolean | null | undefined; | ||
snoozed?: Date | null | undefined; | ||
nonowners?: string[] | null | undefined; | ||
@@ -1042,5 +1042,5 @@ blockers?: string[] | undefined; | ||
files?: { | ||
name: string; | ||
taskId: string; | ||
fileId: string; | ||
name: string; | ||
mimeType: string; | ||
@@ -1050,20 +1050,21 @@ bytes: number; | ||
comments?: { | ||
commentId: string; | ||
taskId: string; | ||
creator: string; | ||
comment: string; | ||
createdAt: Date; | ||
updatedAt: Date; | ||
taskId: string; | ||
commentId: string; | ||
comment: string; | ||
assigned?: Record<string, boolean> | null | undefined; | ||
snoozed?: Date | null | undefined; | ||
assigned?: Record<string, boolean> | null | undefined; | ||
blocking?: boolean | undefined; | ||
}[] | undefined; | ||
}, { | ||
taskId: string; | ||
creator: string; | ||
taskId: string; | ||
assigned: Record<string, boolean>; | ||
parents: string[]; | ||
description?: string | null | undefined; | ||
snoozed?: unknown; | ||
createdAt?: unknown; | ||
updatedAt?: unknown; | ||
description?: string | null | undefined; | ||
deletedAt?: unknown; | ||
@@ -1076,3 +1077,2 @@ locked?: boolean | null | undefined; | ||
tagged?: boolean | null | undefined; | ||
snoozed?: unknown; | ||
nonowners?: string[] | null | undefined; | ||
@@ -1083,5 +1083,5 @@ children?: string[] | undefined; | ||
files?: { | ||
name: string; | ||
taskId: string; | ||
fileId: string; | ||
name: string; | ||
mimeType: string; | ||
@@ -1091,20 +1091,21 @@ bytes: number; | ||
comments?: { | ||
commentId: string; | ||
taskId: string; | ||
creator: string; | ||
taskId: string; | ||
commentId: string; | ||
comment: string; | ||
assigned?: Record<string, boolean> | null | undefined; | ||
snoozed?: unknown; | ||
blocking?: boolean | undefined; | ||
createdAt?: unknown; | ||
updatedAt?: unknown; | ||
snoozed?: unknown; | ||
assigned?: Record<string, boolean> | null | undefined; | ||
blocking?: boolean | undefined; | ||
}[] | undefined; | ||
}>, { | ||
taskId: string; | ||
creator: string; | ||
assigned: Record<string, boolean>; | ||
createdAt: Date; | ||
updatedAt: Date; | ||
taskId: string; | ||
assigned: Record<string, boolean>; | ||
parents: string[]; | ||
children: string[]; | ||
snoozed?: Date | null | undefined; | ||
description?: string | null | undefined; | ||
@@ -1118,3 +1119,2 @@ deletedAt?: Date | null | undefined; | ||
tagged?: boolean | null | undefined; | ||
snoozed?: Date | null | undefined; | ||
nonowners?: string[] | null | undefined; | ||
@@ -1124,5 +1124,5 @@ blockers?: string[] | undefined; | ||
files?: { | ||
name: string; | ||
taskId: string; | ||
fileId: string; | ||
name: string; | ||
mimeType: string; | ||
@@ -1132,10 +1132,10 @@ bytes: number; | ||
comments?: { | ||
commentId: string; | ||
taskId: string; | ||
creator: string; | ||
comment: string; | ||
createdAt: Date; | ||
updatedAt: Date; | ||
taskId: string; | ||
commentId: string; | ||
comment: string; | ||
assigned?: Record<string, boolean> | null | undefined; | ||
snoozed?: Date | null | undefined; | ||
assigned?: Record<string, boolean> | null | undefined; | ||
blocking?: boolean | undefined; | ||
@@ -1146,12 +1146,13 @@ }[] | undefined; | ||
at: Date; | ||
taskId: string; | ||
event: "taskUpdated"; | ||
taskId: string; | ||
task: { | ||
taskId: string; | ||
creator: string; | ||
assigned: Record<string, boolean>; | ||
createdAt: Date; | ||
updatedAt: Date; | ||
taskId: string; | ||
assigned: Record<string, boolean>; | ||
parents: string[]; | ||
children: string[]; | ||
snoozed?: Date | null | undefined; | ||
description?: string | null | undefined; | ||
@@ -1165,3 +1166,2 @@ deletedAt?: Date | null | undefined; | ||
tagged?: boolean | null | undefined; | ||
snoozed?: Date | null | undefined; | ||
nonowners?: string[] | null | undefined; | ||
@@ -1171,5 +1171,5 @@ blockers?: string[] | undefined; | ||
files?: { | ||
name: string; | ||
taskId: string; | ||
fileId: string; | ||
name: string; | ||
mimeType: string; | ||
@@ -1179,10 +1179,10 @@ bytes: number; | ||
comments?: { | ||
commentId: string; | ||
taskId: string; | ||
creator: string; | ||
comment: string; | ||
createdAt: Date; | ||
updatedAt: Date; | ||
taskId: string; | ||
commentId: string; | ||
comment: string; | ||
assigned?: Record<string, boolean> | null | undefined; | ||
snoozed?: Date | null | undefined; | ||
assigned?: Record<string, boolean> | null | undefined; | ||
blocking?: boolean | undefined; | ||
@@ -1193,8 +1193,8 @@ }[] | undefined; | ||
}, { | ||
taskId: string; | ||
event: "taskUpdated"; | ||
taskId: string; | ||
at?: unknown; | ||
clientId?: string | undefined; | ||
task?: unknown; | ||
clientId?: string | undefined; | ||
}>; | ||
//# sourceMappingURL=types.tasks.d.ts.map |
@@ -57,9 +57,9 @@ import { z } from 'zod'; | ||
kind: "group"; | ||
name: string; | ||
userId: string; | ||
name: string; | ||
userIds: string[]; | ||
}, { | ||
kind: "group"; | ||
name: string; | ||
userId: string; | ||
name: string; | ||
userIds: string[]; | ||
@@ -128,4 +128,4 @@ }>; | ||
kind: "user"; | ||
name: string; | ||
userId: string; | ||
name: string; | ||
email: string; | ||
@@ -142,4 +142,4 @@ pins?: string[] | undefined; | ||
kind: "user"; | ||
name: string; | ||
userId: string; | ||
name: string; | ||
email: string; | ||
@@ -180,4 +180,4 @@ pins?: string[] | undefined; | ||
kind: "user"; | ||
name: string; | ||
userId: string; | ||
name: string; | ||
email: string; | ||
@@ -193,4 +193,4 @@ pins?: string[] | undefined; | ||
kind: "user"; | ||
name: string; | ||
userId: string; | ||
name: string; | ||
email: string; | ||
@@ -229,4 +229,4 @@ pins?: string[] | undefined; | ||
kind: "user"; | ||
name: string; | ||
userId: string; | ||
name: string; | ||
email: string; | ||
@@ -243,4 +243,4 @@ pins?: string[] | undefined; | ||
kind: "user"; | ||
name: string; | ||
userId: string; | ||
name: string; | ||
email: string; | ||
@@ -265,9 +265,9 @@ pins?: string[] | undefined; | ||
kind: "group"; | ||
name: string; | ||
userId: string; | ||
name: string; | ||
userIds: string[]; | ||
}, { | ||
kind: "group"; | ||
name: string; | ||
userId: string; | ||
name: string; | ||
userIds: string[]; | ||
@@ -300,4 +300,4 @@ }>]>; | ||
kind: "user"; | ||
name: string; | ||
userId: string; | ||
name: string; | ||
email: string; | ||
@@ -313,4 +313,4 @@ pins?: string[] | undefined; | ||
kind: "user"; | ||
name: string; | ||
userId: string; | ||
name: string; | ||
email: string; | ||
@@ -334,9 +334,9 @@ pins?: string[] | undefined; | ||
kind: "group"; | ||
name: string; | ||
userId: string; | ||
name: string; | ||
userIds: string[]; | ||
}, { | ||
kind: "group"; | ||
name: string; | ||
userId: string; | ||
name: string; | ||
userIds: string[]; | ||
@@ -484,4 +484,4 @@ }>]>; | ||
kind: "user"; | ||
name: string; | ||
userId: string; | ||
name: string; | ||
email: string; | ||
@@ -497,4 +497,4 @@ pins?: string[] | undefined; | ||
kind: "user"; | ||
name: string; | ||
userId: string; | ||
name: string; | ||
email: string; | ||
@@ -518,9 +518,9 @@ pins?: string[] | undefined; | ||
kind: "group"; | ||
name: string; | ||
userId: string; | ||
name: string; | ||
userIds: string[]; | ||
}, { | ||
kind: "group"; | ||
name: string; | ||
userId: string; | ||
name: string; | ||
userIds: string[]; | ||
@@ -533,9 +533,9 @@ }>]>; | ||
kind: "group"; | ||
name: string; | ||
userId: string; | ||
name: string; | ||
userIds: string[]; | ||
} | { | ||
kind: "user"; | ||
name: string; | ||
userId: string; | ||
name: string; | ||
email: string; | ||
@@ -556,9 +556,9 @@ pins?: string[] | undefined; | ||
kind: "group"; | ||
name: string; | ||
userId: string; | ||
name: string; | ||
userIds: string[]; | ||
} | { | ||
kind: "user"; | ||
name: string; | ||
userId: string; | ||
name: string; | ||
email: string; | ||
@@ -619,9 +619,9 @@ pins?: string[] | undefined; | ||
kind: "group"; | ||
name: string; | ||
userId: string; | ||
name: string; | ||
userIds: string[]; | ||
}, { | ||
kind: "group"; | ||
name: string; | ||
userId: string; | ||
name: string; | ||
userIds: string[]; | ||
@@ -634,4 +634,4 @@ }>; | ||
kind: "group"; | ||
name: string; | ||
userId: string; | ||
name: string; | ||
userIds: string[]; | ||
@@ -645,4 +645,4 @@ }; | ||
kind: "group"; | ||
name: string; | ||
userId: string; | ||
name: string; | ||
userIds: string[]; | ||
@@ -649,0 +649,0 @@ }; |
export declare function pointerIsChild(pointer: string[], parent: string[]): boolean; | ||
export declare function pointerIsPrefix(prefixPointer: string[], pointer: string[], ignoreSelf?: boolean): boolean; | ||
/** | ||
@@ -3,0 +4,0 @@ * Any two pointers will definitely have the root |
@@ -11,2 +11,9 @@ import { assert } from './errors.js'; | ||
} | ||
export function pointerIsPrefix(prefixPointer, pointer, ignoreSelf = false) { | ||
const isPrefix = prefixPointer.every((p, i) => pointer[i] === p); | ||
if (isPrefix && ignoreSelf) { | ||
return prefixPointer.length < pointer.length; | ||
} | ||
return isPrefix; | ||
} | ||
/** | ||
@@ -13,0 +20,0 @@ * Any two pointers will definitely have the root |
@@ -58,4 +58,4 @@ import { UserData, UserGroupData, UserOrGroupData, type UserDataSafe } from './types.users.js'; | ||
kind: "user"; | ||
name: string; | ||
userId: string; | ||
name: string; | ||
email: string; | ||
@@ -62,0 +62,0 @@ pins?: string[] | undefined; |
{ | ||
"name": "@bscotch/blork-shared", | ||
"version": "0.28.0", | ||
"version": "0.29.0", | ||
"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
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
531391
8445