mirror of
https://github.com/profullstack/logicsrc.git
synced 2026-10-03 21:27:07 +00:00
Reject unknown task assignees (#80)
This commit is contained in:
parent
e38688f16e
commit
41ab662afa
2 changed files with 33 additions and 17 deletions
|
|
@ -89,13 +89,16 @@ export class AgentStack {
|
|||
return this.agents.get(did);
|
||||
}
|
||||
|
||||
createTask(input: CreateTaskInput): DidTask {
|
||||
if (!parseDid(input.ownerDid)) {
|
||||
throw new Error(`Invalid owner DID: ${input.ownerDid}`);
|
||||
}
|
||||
const ts = this.now();
|
||||
const task: DidTask = {
|
||||
id: this.nextId("task"),
|
||||
createTask(input: CreateTaskInput): DidTask {
|
||||
if (!parseDid(input.ownerDid)) {
|
||||
throw new Error(`Invalid owner DID: ${input.ownerDid}`);
|
||||
}
|
||||
if (input.assigneeDid && !this.agents.has(input.assigneeDid)) {
|
||||
throw new Error(`Unknown agent: ${input.assigneeDid}`);
|
||||
}
|
||||
const ts = this.now();
|
||||
const task: DidTask = {
|
||||
id: this.nextId("task"),
|
||||
ownerDid: input.ownerDid,
|
||||
assigneeDid: input.assigneeDid,
|
||||
sourceApp: input.sourceApp,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue