@sanity/blueprints 0.21.0 → 0.22.0

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.
@@ -115,3 +115,12 @@ export interface BlueprintFunctionResourceEventResourceMediaLibrary {
115
115
  * @category Functions Types
116
116
  */
117
117
  export type BlueprintFunctionResourceEventName = 'publish' | 'create' | 'delete' | 'update';
118
+ /**
119
+ * Event configuration for workflows.
120
+ * @category Functions Types
121
+ */
122
+ export type BlueprintWorkflowFunctionResourceEvent = ({
123
+ type: 'document';
124
+ } & BlueprintDocumentFunctionResourceEvent) | ({
125
+ type: 'sync-tag-invalidate';
126
+ } & BlueprintSyncTagInvalidateFunctionResourceEvent);
@@ -1,5 +1,5 @@
1
1
  import type { BlueprintResource } from '../../index.js';
2
- import type { BlueprintDocumentFunctionResourceEvent, BlueprintMediaLibraryFunctionResourceEvent, BlueprintQueueFunctionConfigEvent, BlueprintQueueFunctionResourceEvent, BlueprintScheduledFunctionConfigEvent, BlueprintScheduledFunctionResourceEvent, BlueprintSyncTagInvalidateFunctionResourceEvent } from './event.js';
2
+ import type { BlueprintDocumentFunctionResourceEvent, BlueprintMediaLibraryFunctionResourceEvent, BlueprintQueueFunctionConfigEvent, BlueprintQueueFunctionResourceEvent, BlueprintScheduledFunctionConfigEvent, BlueprintScheduledFunctionResourceEvent, BlueprintSyncTagInvalidateFunctionResourceEvent, BlueprintWorkflowFunctionResourceEvent } from './event.js';
3
3
  import type { IanaTimezone } from './timezone.js';
4
4
  export * from './event.js';
5
5
  /**
@@ -219,3 +219,46 @@ export type BlueprintEventFunctionConfig = Omit<BlueprintEventFunctionResource,
219
219
  */
220
220
  src?: string;
221
221
  };
222
+ /**
223
+ * A durable, step-based workflow function.
224
+ * @public
225
+ * @alpha Deploying Workflows via Blueprints is experimental. This feature is not available publicly yet.
226
+ * @hidden
227
+ * @category Functions Types
228
+ * @interface
229
+ */
230
+ export interface BlueprintWorkflowFunctionResource extends BlueprintBaseFunctionResource {
231
+ type: 'sanity.function.workflow';
232
+ event: BlueprintWorkflowFunctionResourceEvent;
233
+ /**
234
+ * Max concurrent executions
235
+ */
236
+ concurrency?: number;
237
+ /**
238
+ * Debounce window in minutes
239
+ */
240
+ debounce?: number;
241
+ /**
242
+ * Path used to group debounced events, e.g. 'document._id'
243
+ */
244
+ debounceKey?: string;
245
+ }
246
+ /**
247
+ * Configuration for defining a workflow function.
248
+ * @public
249
+ * @alpha Deploying Workflows via Blueprints is experimental.
250
+ * @hidden
251
+ * @category Functions Types
252
+ * @interface
253
+ */
254
+ export type BlueprintWorkflowFunctionConfig = Omit<BlueprintWorkflowFunctionResource, 'type' | 'src' | 'event'> & {
255
+ /**
256
+ * Path to the workflow source code
257
+ * @defaultValue `workflows/${name}`
258
+ */
259
+ src?: string;
260
+ /**
261
+ * Trigger configuration
262
+ */
263
+ event: BlueprintWorkflowFunctionResourceEvent;
264
+ };
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/types/functions/index.ts"],"names":[],"mappings":"AAYA,cAAc,YAAY,CAAA;AAE1B;;;GAGG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,MAAM,EAAE,YAAY,EAAE,YAAY,CAAU,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/types/functions/index.ts"],"names":[],"mappings":"AAaA,cAAc,YAAY,CAAA;AAE1B;;;GAGG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,MAAM,EAAE,YAAY,EAAE,YAAY,CAAU,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sanity/blueprints",
3
- "version": "0.21.0",
3
+ "version": "0.22.0",
4
4
  "description": "Helper methods and type definitions for Sanity Blueprints",
5
5
  "keywords": [
6
6
  "sanity",
@@ -137,3 +137,11 @@ export interface BlueprintFunctionResourceEventResourceMediaLibrary {
137
137
  * @category Functions Types
138
138
  */
139
139
  export type BlueprintFunctionResourceEventName = 'publish' | 'create' | 'delete' | 'update'
140
+
141
+ /**
142
+ * Event configuration for workflows.
143
+ * @category Functions Types
144
+ */
145
+ export type BlueprintWorkflowFunctionResourceEvent =
146
+ | ({type: 'document'} & BlueprintDocumentFunctionResourceEvent)
147
+ | ({type: 'sync-tag-invalidate'} & BlueprintSyncTagInvalidateFunctionResourceEvent)
@@ -7,6 +7,7 @@ import type {
7
7
  BlueprintScheduledFunctionConfigEvent,
8
8
  BlueprintScheduledFunctionResourceEvent,
9
9
  BlueprintSyncTagInvalidateFunctionResourceEvent,
10
+ BlueprintWorkflowFunctionResourceEvent,
10
11
  } from './event.js'
11
12
  import type {IanaTimezone} from './timezone.js'
12
13
 
@@ -249,3 +250,48 @@ export type BlueprintEventFunctionConfig = Omit<BlueprintEventFunctionResource,
249
250
  */
250
251
  src?: string
251
252
  }
253
+
254
+ /**
255
+ * A durable, step-based workflow function.
256
+ * @public
257
+ * @alpha Deploying Workflows via Blueprints is experimental. This feature is not available publicly yet.
258
+ * @hidden
259
+ * @category Functions Types
260
+ * @interface
261
+ */
262
+ export interface BlueprintWorkflowFunctionResource extends BlueprintBaseFunctionResource {
263
+ type: 'sanity.function.workflow'
264
+ event: BlueprintWorkflowFunctionResourceEvent
265
+ /**
266
+ * Max concurrent executions
267
+ */
268
+ concurrency?: number
269
+ /**
270
+ * Debounce window in minutes
271
+ */
272
+ debounce?: number
273
+ /**
274
+ * Path used to group debounced events, e.g. 'document._id'
275
+ */
276
+ debounceKey?: string
277
+ }
278
+
279
+ /**
280
+ * Configuration for defining a workflow function.
281
+ * @public
282
+ * @alpha Deploying Workflows via Blueprints is experimental.
283
+ * @hidden
284
+ * @category Functions Types
285
+ * @interface
286
+ */
287
+ export type BlueprintWorkflowFunctionConfig = Omit<BlueprintWorkflowFunctionResource, 'type' | 'src' | 'event'> & {
288
+ /**
289
+ * Path to the workflow source code
290
+ * @defaultValue `workflows/${name}`
291
+ */
292
+ src?: string
293
+ /**
294
+ * Trigger configuration
295
+ */
296
+ event: BlueprintWorkflowFunctionResourceEvent
297
+ }