Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/add-context-get-invoker.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@tailor-platform/function-types": patch
---

Add `tailor.context` namespace with `getInvoker()` for retrieving information about the invoker of the current function execution
26 changes: 25 additions & 1 deletion packages/types/tailor.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -495,4 +495,28 @@ declare namespace tailor.workflow {
key: string,
callback: (waitPayload: any) => any
): Promise<void>;
}
}

declare namespace tailor.context {
/**
* Information about the invoker of the current function execution.
*/
interface Invoker {
/** The invoker's ID */
id: string;
/** The invoker's type */
type: "user" | "machine_user";
/** The workspace ID */
workspaceId: string;
/** The invoker's attribute IDs */
attributes: string[];
/** The invoker's attribute map */
attributeMap: Record<string, unknown>;
}

/**
* Returns information about the invoker of the current function execution,
* or `null` for anonymous invocations.
*/
function getInvoker(): Invoker | null;
}