@sanity/functions 1.11.0 → 1.11.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- import type { InvokeCallback } from './invocation.js';
1
+ import type { InvokeCallback, InvokedBy } from './invocation.js';
2
2
  import type { ResourcesApi } from './resources.js';
3
3
  /**
4
4
  * The context object passed to the function handler.
@@ -12,6 +12,8 @@ export interface FunctionContext {
12
12
  functionResourceType: string;
13
13
  /** The resource ID of the function container; resource ID that houses the function. */
14
14
  functionResourceId: string;
15
+ /** Optional info on the invoker of the function */
16
+ invokedBy?: InvokedBy;
15
17
  /** Sanity lineage token */
16
18
  lineage?: string | undefined;
17
19
  /**
@@ -11,3 +11,9 @@ export type InvokeCallback = <T = unknown>(name: string, payload?: Record<string
11
11
  export type InvokeOptions = {
12
12
  sync?: boolean;
13
13
  };
14
+ /**
15
+ * Optional information on the invoker
16
+ */
17
+ export type InvokedBy = {
18
+ userId: string;
19
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sanity/functions",
3
- "version": "1.11.0",
3
+ "version": "1.11.1",
4
4
  "description": "Helper methods and type definitions for Sanity Functions",
5
5
  "keywords": [
6
6
  "sanity",
@@ -1,4 +1,4 @@
1
- import type {InvokeCallback} from './invocation.js'
1
+ import type {InvokeCallback, InvokedBy} from './invocation.js'
2
2
  import type {ResourcesApi} from './resources.js'
3
3
 
4
4
  /**
@@ -13,6 +13,8 @@ export interface FunctionContext {
13
13
  functionResourceType: string
14
14
  /** The resource ID of the function container; resource ID that houses the function. */
15
15
  functionResourceId: string
16
+ /** Optional info on the invoker of the function */
17
+ invokedBy?: InvokedBy
16
18
  /** Sanity lineage token */
17
19
  lineage?: string | undefined
18
20
  /**
@@ -13,3 +13,10 @@ export type InvokeOptions = {
13
13
  // Whether the function should be invoked synchronously
14
14
  sync?: boolean
15
15
  }
16
+
17
+ /**
18
+ * Optional information on the invoker
19
+ */
20
+ export type InvokedBy = {
21
+ userId: string
22
+ }