diff --git a/.changeset/add-context-get-invoker.md b/.changeset/add-context-get-invoker.md new file mode 100644 index 0000000..419320f --- /dev/null +++ b/.changeset/add-context-get-invoker.md @@ -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 diff --git a/packages/types/tailor.d.ts b/packages/types/tailor.d.ts index 3c74f18..70070c2 100644 --- a/packages/types/tailor.d.ts +++ b/packages/types/tailor.d.ts @@ -495,4 +495,28 @@ declare namespace tailor.workflow { key: string, callback: (waitPayload: any) => any ): Promise; -} \ No newline at end of file +} + +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; + } + + /** + * Returns information about the invoker of the current function execution, + * or `null` for anonymous invocations. + */ + function getInvoker(): Invoker | null; +}