@sanity/blueprints 0.21.0 → 0.23.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.
- package/README.md +1 -0
- package/dist/definers/functions.d.ts +29 -14
- package/dist/definers/functions.js +42 -29
- package/dist/definers/functions.js.map +1 -1
- package/dist/definers/studios.d.ts +22 -0
- package/dist/definers/studios.js +31 -0
- package/dist/definers/studios.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/types/functions/event.d.ts +9 -17
- package/dist/types/functions/index.d.ts +55 -15
- package/dist/types/functions/index.js.map +1 -1
- package/dist/types/studios.d.ts +57 -0
- package/dist/types/studios.js +2 -0
- package/dist/types/studios.js.map +1 -0
- package/dist/validation/functions.d.ts +10 -1
- package/dist/validation/functions.js +91 -19
- package/dist/validation/functions.js.map +1 -1
- package/dist/validation/studios.d.ts +9 -0
- package/dist/validation/studios.js +70 -0
- package/dist/validation/studios.js.map +1 -0
- package/package.json +19 -9
- package/src/definers/functions.ts +45 -31
- package/src/definers/studios.ts +34 -0
- package/src/index.ts +3 -0
- package/src/types/functions/event.ts +4 -23
- package/src/types/functions/index.ts +58 -15
- package/src/types/studios.ts +68 -0
- package/src/validation/functions.ts +98 -21
- package/src/validation/studios.ts +76 -0
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type BlueprintBaseFunctionConfig, type BlueprintBaseFunctionResource, type BlueprintDocumentFunctionConfig, type BlueprintDocumentFunctionResource, type BlueprintDocumentFunctionResourceEvent, type BlueprintEventFunctionConfig, type BlueprintEventFunctionResource, type BlueprintMediaLibraryAssetFunctionConfig, type BlueprintMediaLibraryAssetFunctionResource, type BlueprintQueueFunctionConfig, type BlueprintQueueFunctionResource, type BlueprintScheduledFunctionConfig, type BlueprintScheduledFunctionResource, type BlueprintSyncTagInvalidateFunctionConfig, type BlueprintSyncTagInvalidateFunctionResource } from '../index.js';
|
|
1
|
+
import { type BlueprintBaseFunctionConfig, type BlueprintBaseFunctionResource, type BlueprintDocumentFunctionConfig, type BlueprintDocumentFunctionResource, type BlueprintDocumentFunctionResourceEvent, type BlueprintEventFunctionConfig, type BlueprintEventFunctionResource, type BlueprintMediaLibraryAssetFunctionConfig, type BlueprintMediaLibraryAssetFunctionResource, type BlueprintPipelineConfig, type BlueprintPipelineResource, type BlueprintQueueFunctionConfig, type BlueprintQueueFunctionResource, type BlueprintScheduledFunctionConfig, type BlueprintScheduledFunctionResource, type BlueprintSyncTagInvalidateFunctionConfig, type BlueprintSyncTagInvalidateFunctionResource } from '../index.js';
|
|
2
2
|
/**
|
|
3
3
|
* Defines a function that is triggered by document events in Sanity datasets.
|
|
4
4
|
*
|
|
@@ -132,23 +132,13 @@ export declare function defineSyncTagInvalidateFunction(functionConfig: Blueprin
|
|
|
132
132
|
* })
|
|
133
133
|
* ```
|
|
134
134
|
*
|
|
135
|
-
* Using the reasonable defaults of concurrency: 1, fifo: true, and dlq: true
|
|
136
|
-
* ```ts
|
|
137
|
-
* defineQueueFunction({
|
|
138
|
-
* name: 'bustin-caches',
|
|
139
|
-
* queue: true,
|
|
140
|
-
* })
|
|
141
|
-
* ```
|
|
142
|
-
*
|
|
143
135
|
* Specifying a concurrency of 5
|
|
144
136
|
* ```ts
|
|
145
137
|
* defineQueueFunction({
|
|
146
138
|
* name: 'bustin-caches',
|
|
147
|
-
*
|
|
148
|
-
*
|
|
149
|
-
*
|
|
150
|
-
* dlq: true,
|
|
151
|
-
* },
|
|
139
|
+
* concurrency: 5,
|
|
140
|
+
* fifo: true,
|
|
141
|
+
* dlq: true,
|
|
152
142
|
* })
|
|
153
143
|
* ```
|
|
154
144
|
* @public
|
|
@@ -193,3 +183,28 @@ export declare function defineFunction(functionConfig: BlueprintBaseFunctionConf
|
|
|
193
183
|
skipValidation?: boolean;
|
|
194
184
|
scopeType?: 'organization';
|
|
195
185
|
}): BlueprintBaseFunctionResource;
|
|
186
|
+
/**
|
|
187
|
+
* Defines a pipeline function resource.
|
|
188
|
+
*
|
|
189
|
+
* @remarks
|
|
190
|
+
*
|
|
191
|
+
* ```ts
|
|
192
|
+
* definePipeline({
|
|
193
|
+
* name: 'daily-cleanup',
|
|
194
|
+
* event: {type: 'document', on: ['create'], filter: "_type == 'post'"},
|
|
195
|
+
* concurrency: 5,
|
|
196
|
+
* debounce: 10,
|
|
197
|
+
* debounceKey: 'document._id',
|
|
198
|
+
* })
|
|
199
|
+
* ```
|
|
200
|
+
*
|
|
201
|
+
*
|
|
202
|
+
* @param functionConfig The configuration for the function
|
|
203
|
+
* @category Definers
|
|
204
|
+
* @alpha Deploying Pipeline Functions via Blueprints is experimental. This feature is not available publicly yet.
|
|
205
|
+
* @public
|
|
206
|
+
* @hidden
|
|
207
|
+
* @expandType BlueprintPipelineConfig
|
|
208
|
+
* @returns The validated pipeline function resource
|
|
209
|
+
*/
|
|
210
|
+
export declare function definePipeline(functionConfig: BlueprintPipelineConfig): BlueprintPipelineResource;
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import { validateDocumentFunction, validateEventFunction, validateFunction, validateMediaLibraryAssetFunction, validateQueueFunction, validateScheduledFunction, validateSyncTagInvalidateFunction, } from '../index.js';
|
|
1
|
+
import { validateDocumentFunction, validateEventFunction, validateFunction, validateMediaLibraryAssetFunction, validatePipelineFunction, validateQueueFunction, validateScheduledFunction, validateSyncTagInvalidateFunction, } from '../index.js';
|
|
2
2
|
import { parseScheduledExpression } from '../utils/schedule-parser.js';
|
|
3
3
|
import { runValidation } from '../utils/validation.js';
|
|
4
4
|
const BASE_EVENT_KEYS = new Set(['on', 'filter', 'projection', 'includeDrafts']);
|
|
5
5
|
const DOCUMENT_EVENT_KEYS = new Set(['includeAllVersions', 'resource', ...BASE_EVENT_KEYS.values()]);
|
|
6
6
|
const MEDIA_LIBRARY_EVENT_KEYS = new Set(['resource', ...BASE_EVENT_KEYS.values()]);
|
|
7
7
|
const SCHEDULED_EVENT_KEYS = new Set(['minute', 'hour', 'dayOfWeek', 'month', 'dayOfMonth', 'expression']);
|
|
8
|
-
const QUEUE_EVENT_KEYS = new Set(['concurrency', 'fifo', 'dlq']);
|
|
9
8
|
export function defineDocumentFunction(functionConfig) {
|
|
10
9
|
let { name, src, event, timeout, memory, env, robotToken, project, runtime, ...maybeEvent } = functionConfig;
|
|
11
10
|
// event validation and normalization
|
|
@@ -206,23 +205,13 @@ export function defineSyncTagInvalidateFunction(functionConfig) {
|
|
|
206
205
|
* })
|
|
207
206
|
* ```
|
|
208
207
|
*
|
|
209
|
-
* Using the reasonable defaults of concurrency: 1, fifo: true, and dlq: true
|
|
210
|
-
* ```ts
|
|
211
|
-
* defineQueueFunction({
|
|
212
|
-
* name: 'bustin-caches',
|
|
213
|
-
* queue: true,
|
|
214
|
-
* })
|
|
215
|
-
* ```
|
|
216
|
-
*
|
|
217
208
|
* Specifying a concurrency of 5
|
|
218
209
|
* ```ts
|
|
219
210
|
* defineQueueFunction({
|
|
220
211
|
* name: 'bustin-caches',
|
|
221
|
-
*
|
|
222
|
-
*
|
|
223
|
-
*
|
|
224
|
-
* dlq: true,
|
|
225
|
-
* },
|
|
212
|
+
* concurrency: 5,
|
|
213
|
+
* fifo: true,
|
|
214
|
+
* dlq: true,
|
|
226
215
|
* })
|
|
227
216
|
* ```
|
|
228
217
|
* @public
|
|
@@ -234,11 +223,14 @@ export function defineSyncTagInvalidateFunction(functionConfig) {
|
|
|
234
223
|
* @returns The validated queue function resource
|
|
235
224
|
*/
|
|
236
225
|
export function defineQueueFunction(functionConfig) {
|
|
237
|
-
const {
|
|
226
|
+
const { concurrency = 1, fifo = true, dlq = true, event } = functionConfig;
|
|
238
227
|
const functionResource = {
|
|
239
228
|
...defineFunction(functionConfig, { skipValidation: true }),
|
|
240
229
|
type: 'sanity.function.queue',
|
|
241
|
-
|
|
230
|
+
...(concurrency !== undefined && { concurrency }),
|
|
231
|
+
...(fifo !== undefined && { fifo }),
|
|
232
|
+
...(dlq !== undefined && { dlq }),
|
|
233
|
+
...(event !== undefined && { event }),
|
|
242
234
|
};
|
|
243
235
|
runValidation(() => validateQueueFunction(functionResource));
|
|
244
236
|
return functionResource;
|
|
@@ -350,19 +342,40 @@ function cronStringToExplicitEvent(cron) {
|
|
|
350
342
|
return { minute, hour, dayOfMonth, month, dayOfWeek };
|
|
351
343
|
}
|
|
352
344
|
/**
|
|
353
|
-
*
|
|
354
|
-
*
|
|
355
|
-
* @
|
|
345
|
+
* Defines a pipeline function resource.
|
|
346
|
+
*
|
|
347
|
+
* @remarks
|
|
348
|
+
*
|
|
349
|
+
* ```ts
|
|
350
|
+
* definePipeline({
|
|
351
|
+
* name: 'daily-cleanup',
|
|
352
|
+
* event: {type: 'document', on: ['create'], filter: "_type == 'post'"},
|
|
353
|
+
* concurrency: 5,
|
|
354
|
+
* debounce: 10,
|
|
355
|
+
* debounceKey: 'document._id',
|
|
356
|
+
* })
|
|
357
|
+
* ```
|
|
358
|
+
*
|
|
359
|
+
*
|
|
360
|
+
* @param functionConfig The configuration for the function
|
|
361
|
+
* @category Definers
|
|
362
|
+
* @alpha Deploying Pipeline Functions via Blueprints is experimental. This feature is not available publicly yet.
|
|
363
|
+
* @public
|
|
364
|
+
* @hidden
|
|
365
|
+
* @expandType BlueprintPipelineConfig
|
|
366
|
+
* @returns The validated pipeline function resource
|
|
356
367
|
*/
|
|
357
|
-
function
|
|
358
|
-
const
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
...
|
|
365
|
-
...
|
|
368
|
+
export function definePipeline(functionConfig) {
|
|
369
|
+
const { name, event, concurrency, debounce, debounceKey, src } = functionConfig;
|
|
370
|
+
const functionResource = {
|
|
371
|
+
...defineFunction({ ...functionConfig, src: src ?? `functions/${name}` }, { skipValidation: true }),
|
|
372
|
+
type: 'sanity.function.pipeline',
|
|
373
|
+
...(event !== undefined && { event }),
|
|
374
|
+
...(concurrency !== undefined && { concurrency }),
|
|
375
|
+
...(debounce !== undefined && { debounce }),
|
|
376
|
+
...(debounceKey !== undefined && { debounceKey }),
|
|
366
377
|
};
|
|
378
|
+
runValidation(() => validatePipelineFunction(functionResource));
|
|
379
|
+
return functionResource;
|
|
367
380
|
}
|
|
368
381
|
//# sourceMappingURL=functions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"functions.js","sourceRoot":"","sources":["../../src/definers/functions.ts"],"names":[],"mappings":"AAAA,OAAO,EAwBL,wBAAwB,EACxB,qBAAqB,EACrB,gBAAgB,EAChB,iCAAiC,EACjC,qBAAqB,EACrB,yBAAyB,EACzB,iCAAiC,GAClC,MAAM,aAAa,CAAA;AACpB,OAAO,EAAC,wBAAwB,EAAC,MAAM,6BAA6B,CAAA;AACpE,OAAO,EAAC,aAAa,EAAC,MAAM,wBAAwB,CAAA;AAGpD,MAAM,eAAe,GAAG,IAAI,GAAG,CAAuB,CAAC,IAAI,EAAE,QAAQ,EAAE,YAAY,EAAE,eAAe,CAAC,CAAC,CAAA;AAEtG,MAAM,mBAAmB,GAAG,IAAI,GAAG,CAA2B,CAAC,oBAAoB,EAAE,UAAU,EAAE,GAAG,eAAe,CAAC,MAAM,EAAE,CAAC,CAAC,CAAA;AAE9H,MAAM,wBAAwB,GAAG,IAAI,GAAG,CAA+B,CAAC,UAAU,EAAE,GAAG,eAAe,CAAC,MAAM,EAAE,CAAC,CAAC,CAAA;AAIjH,MAAM,oBAAoB,GAAG,IAAI,GAAG,CAA4B,CAAC,QAAQ,EAAE,MAAM,EAAE,WAAW,EAAE,OAAO,EAAE,YAAY,EAAE,YAAY,CAAC,CAAC,CAAA;
|
|
1
|
+
{"version":3,"file":"functions.js","sourceRoot":"","sources":["../../src/definers/functions.ts"],"names":[],"mappings":"AAAA,OAAO,EAwBL,wBAAwB,EACxB,qBAAqB,EACrB,gBAAgB,EAChB,iCAAiC,EACjC,wBAAwB,EACxB,qBAAqB,EACrB,yBAAyB,EACzB,iCAAiC,GAClC,M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,EAAC,CAAC;QAC/C,GAAG,CAAC,QAAQ,KAAK,SAAS,IAAI,EAAC,QAAQ,EAAC,CAAC;QACzC,GAAG,CAAC,WAAW,KAAK,SAAS,IAAI,EAAC,WAAW,EAAC,CAAC;KAChD,CAAA;IAED,aAAa,CAAC,GAAG,EAAE,CAAC,wBAAwB,CAAC,gBAAgB,CAAC,CAAC,CAAA;IAC/D,OAAO,gBAAgB,CAAA;AACzB,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { BlueprintStudioConfig, BlueprintStudioResource } from '../types/studios.js';
|
|
2
|
+
/**
|
|
3
|
+
* Defines a studio.
|
|
4
|
+
*
|
|
5
|
+
* ```ts
|
|
6
|
+
* defineStudio({
|
|
7
|
+
* name: 'my-studio',
|
|
8
|
+
* src: 'studios/my-studio',
|
|
9
|
+
* autoUpdates: {
|
|
10
|
+
* enabled: true
|
|
11
|
+
* }
|
|
12
|
+
* })
|
|
13
|
+
* ```
|
|
14
|
+
* @param parameters The studio configuration
|
|
15
|
+
* @public
|
|
16
|
+
* @beta Deploying Studios via Blueprints is experimental. This may be subject to breaking changes.
|
|
17
|
+
* @category Definers
|
|
18
|
+
* @expandType BlueprintStudioConfig
|
|
19
|
+
* @returns The studio resource
|
|
20
|
+
* @hidden
|
|
21
|
+
*/
|
|
22
|
+
export declare function defineStudio(config: BlueprintStudioConfig): BlueprintStudioResource;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { validateStudio } from '../index.js';
|
|
2
|
+
import { runValidation } from '../utils/validation.js';
|
|
3
|
+
/**
|
|
4
|
+
* Defines a studio.
|
|
5
|
+
*
|
|
6
|
+
* ```ts
|
|
7
|
+
* defineStudio({
|
|
8
|
+
* name: 'my-studio',
|
|
9
|
+
* src: 'studios/my-studio',
|
|
10
|
+
* autoUpdates: {
|
|
11
|
+
* enabled: true
|
|
12
|
+
* }
|
|
13
|
+
* })
|
|
14
|
+
* ```
|
|
15
|
+
* @param parameters The studio configuration
|
|
16
|
+
* @public
|
|
17
|
+
* @beta Deploying Studios via Blueprints is experimental. This may be subject to breaking changes.
|
|
18
|
+
* @category Definers
|
|
19
|
+
* @expandType BlueprintStudioConfig
|
|
20
|
+
* @returns The studio resource
|
|
21
|
+
* @hidden
|
|
22
|
+
*/
|
|
23
|
+
export function defineStudio(config) {
|
|
24
|
+
const studioResource = {
|
|
25
|
+
...config,
|
|
26
|
+
type: 'sanity.studio',
|
|
27
|
+
};
|
|
28
|
+
runValidation(() => validateStudio(studioResource));
|
|
29
|
+
return studioResource;
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=studios.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"studios.js","sourceRoot":"","sources":["../../src/definers/studios.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,cAAc,EAAC,MAAM,aAAa,CAAA;AAE1C,OAAO,EAAC,aAAa,EAAC,MAAM,wBAAwB,CAAA;AAEpD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,UAAU,YAAY,CAAC,MAA6B;IACxD,MAAM,cAAc,GAA4B;QAC9C,GAAG,MAAM;QACT,IAAI,EAAE,eAAe;KACtB,CAAA;IAED,aAAa,CAAC,GAAG,EAAE,CAAC,cAAc,CAAC,cAAc,CAAC,CAAC,CAAA;IAEnD,OAAO,cAAc,CAAA;AACvB,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -15,6 +15,7 @@ export * from './definers/resources.js';
|
|
|
15
15
|
export * from './definers/robots.js';
|
|
16
16
|
export * from './definers/robotTokens.js';
|
|
17
17
|
export * from './definers/roles.js';
|
|
18
|
+
export * from './definers/studios.js';
|
|
18
19
|
export * from './definers/webhooks.js';
|
|
19
20
|
/**
|
|
20
21
|
* @categoryDescription Resource Types
|
|
@@ -34,6 +35,7 @@ export * from './types/resources.js';
|
|
|
34
35
|
export * from './types/robots.js';
|
|
35
36
|
export * from './types/robotTokens.js';
|
|
36
37
|
export * from './types/roles.js';
|
|
38
|
+
export * from './types/studios.js';
|
|
37
39
|
export * from './types/webhooks.js';
|
|
38
40
|
/**
|
|
39
41
|
* @categoryDescription Validation
|
|
@@ -48,6 +50,7 @@ export * from './validation/resources.js';
|
|
|
48
50
|
export * from './validation/robots.js';
|
|
49
51
|
export * from './validation/robotTokens.js';
|
|
50
52
|
export * from './validation/roles.js';
|
|
53
|
+
export * from './validation/studios.js';
|
|
51
54
|
export * from './validation/webhooks.js';
|
|
52
55
|
/**
|
|
53
56
|
* @categoryDescription Blueprint Internals
|
package/dist/index.js
CHANGED
|
@@ -16,6 +16,7 @@ export * from './definers/resources.js';
|
|
|
16
16
|
export * from './definers/robots.js';
|
|
17
17
|
export * from './definers/robotTokens.js';
|
|
18
18
|
export * from './definers/roles.js';
|
|
19
|
+
export * from './definers/studios.js';
|
|
19
20
|
export * from './definers/webhooks.js';
|
|
20
21
|
// TYPES - base types for all resources
|
|
21
22
|
/**
|
|
@@ -36,6 +37,7 @@ export * from './types/resources.js';
|
|
|
36
37
|
export * from './types/robots.js';
|
|
37
38
|
export * from './types/robotTokens.js';
|
|
38
39
|
export * from './types/roles.js';
|
|
40
|
+
export * from './types/studios.js';
|
|
39
41
|
export * from './types/webhooks.js';
|
|
40
42
|
// VALIDATION - validation for all resources
|
|
41
43
|
/**
|
|
@@ -51,6 +53,7 @@ export * from './validation/resources.js';
|
|
|
51
53
|
export * from './validation/robots.js';
|
|
52
54
|
export * from './validation/robotTokens.js';
|
|
53
55
|
export * from './validation/roles.js';
|
|
56
|
+
export * from './validation/studios.js';
|
|
54
57
|
export * from './validation/webhooks.js';
|
|
55
58
|
// Public BLUEPRINTS INTERNALS - published bucket of misc Blueprint types
|
|
56
59
|
/**
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,kDAAkD;AAClD;;;GAGG;AACH;;;GAGG;AACH,cAAc,0BAA0B,CAAA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AAc,qBAAqB,CAAA;AACnC,cAAc,uBAAuB,CAAA;AACrC,cAAc,wBAAwB,CAAA;AAEtC,uCAAuC;AACvC;;;GAGG;AACH;;;GAGG;AACH,cAAc,uBAAuB,CAAA;AACrC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,qBAAqB,CAAA;AACnC,cAAc,mBAAmB,CAAA;AACjC,cAAc,4BAA4B,CAAA;AAC1C,cAAc,qBAAqB,CAAA;AACnC,cAAc,sBAAsB,CAAA;AACpC,cAAc,mBAAmB,CAAA;AACjC,cAAc,wBAAwB,CAAA;AACtC,cAAc,kBAAkB,CAAA;AAChC,cAAc,oBAAoB,CAAA;AAClC,cAAc,qBAAqB,CAAA;AAEnC,4CAA4C;AAC5C;;;GAGG;AACH,cAAc,4BAA4B,CAAA;AAC1C,cAAc,sBAAsB,CAAA;AACpC,cAAc,0BAA0B,CAAA;AACxC,cAAc,2BAA2B,CAAA;AACzC,cAAc,0BAA0B,CAAA;AACxC,cAAc,2BAA2B,CAAA;AACzC,cAAc,wBAAwB,CAAA;AACtC,cAAc,6BAA6B,CAAA;AAC3C,cAAc,uBAAuB,CAAA;AACrC,cAAc,yBAAyB,CAAA;AACvC,cAAc,0BAA0B,CAAA;AAExC,yEAAyE;AACzE;;;GAGG"}
|
|
@@ -71,27 +71,19 @@ export type BlueprintScheduledFunctionResourceEvent = BlueprintScheduledFunction
|
|
|
71
71
|
* @category Functions Types
|
|
72
72
|
*/
|
|
73
73
|
export type BlueprintScheduledFunctionConfigEvent = BlueprintScheduledFunctionExplicitResourceEvent | BlueprintScheduledFunctionExpressionResourceEvent;
|
|
74
|
-
/**
|
|
75
|
-
* Event configuration for queue functions
|
|
76
|
-
* @category Functions Types
|
|
77
|
-
* @alpha
|
|
78
|
-
* @hidden
|
|
79
|
-
*/
|
|
80
|
-
export interface BlueprintQueueFunctionResourceEvent {
|
|
81
|
-
concurrency?: number;
|
|
82
|
-
fifo?: boolean;
|
|
83
|
-
dlq?: boolean;
|
|
84
|
-
}
|
|
85
|
-
/**
|
|
86
|
-
* Union type of all queue function resource event configurations
|
|
87
|
-
* @category Functions Types
|
|
88
|
-
*/
|
|
89
|
-
export type BlueprintQueueFunctionConfigEvent = true | BlueprintQueueFunctionResourceEvent;
|
|
90
74
|
/**
|
|
91
75
|
* Union type of all function resource event configurations
|
|
92
76
|
* @category Functions Types
|
|
93
77
|
*/
|
|
94
|
-
export type BlueprintFunctionResourceEvent =
|
|
78
|
+
export type BlueprintFunctionResourceEvent = ({
|
|
79
|
+
type: 'document';
|
|
80
|
+
} & BlueprintDocumentFunctionResourceEvent) | ({
|
|
81
|
+
type: 'media-library';
|
|
82
|
+
} & BlueprintMediaLibraryFunctionResourceEvent) | ({
|
|
83
|
+
type: 'cron';
|
|
84
|
+
} & BlueprintScheduledFunctionResourceEvent) | ({
|
|
85
|
+
type: 'sync-tag-invalidate';
|
|
86
|
+
} & BlueprintSyncTagInvalidateFunctionResourceEvent);
|
|
95
87
|
/**
|
|
96
88
|
* Dataset resource for scoping document functions to specific datasets
|
|
97
89
|
* @example { type: 'dataset', id: 'my-project.production' }
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import type { BlueprintResource } from '../../index.js';
|
|
2
|
-
import type { BlueprintDocumentFunctionResourceEvent,
|
|
2
|
+
import type { BlueprintDocumentFunctionResourceEvent, BlueprintFunctionResourceEvent, BlueprintMediaLibraryFunctionResourceEvent, BlueprintScheduledFunctionConfigEvent, BlueprintScheduledFunctionResourceEvent, BlueprintSyncTagInvalidateFunctionResourceEvent } from './event.js';
|
|
3
3
|
import type { IanaTimezone } from './timezone.js';
|
|
4
4
|
export * from './event.js';
|
|
5
5
|
/**
|
|
6
6
|
* Supported Function runtimes
|
|
7
7
|
* @category Functions Types
|
|
8
8
|
*/
|
|
9
|
-
export declare const VALID_RUNTIMES: readonly [
|
|
9
|
+
export declare const VALID_RUNTIMES: readonly ['node', 'nodejs22.x', 'nodejs24.x'];
|
|
10
10
|
/**
|
|
11
11
|
* Supported function runtimes
|
|
12
12
|
* @category Functions Types
|
|
@@ -89,7 +89,8 @@ export interface BlueprintSyncTagInvalidateFunctionResource extends BlueprintBas
|
|
|
89
89
|
*/
|
|
90
90
|
export interface BlueprintQueueFunctionResource extends BlueprintBaseFunctionResource {
|
|
91
91
|
type: 'sanity.function.queue';
|
|
92
|
-
event
|
|
92
|
+
/** Optional event configuration that triggers the function */
|
|
93
|
+
event?: BlueprintFunctionResourceEvent;
|
|
93
94
|
}
|
|
94
95
|
/**
|
|
95
96
|
* A function resource triggered by another function
|
|
@@ -192,22 +193,16 @@ export type BlueprintQueueFunctionConfig = Omit<BlueprintQueueFunctionResource,
|
|
|
192
193
|
* @defaultValue `functions/${name}`
|
|
193
194
|
*/
|
|
194
195
|
src?: string;
|
|
195
|
-
/**
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
*
|
|
201
|
-
* Provide an object to override specific settings.
|
|
202
|
-
*
|
|
203
|
-
* @defaultValue true
|
|
204
|
-
*/
|
|
205
|
-
queue?: BlueprintQueueFunctionConfigEvent;
|
|
196
|
+
/** Optional event configuration that triggers the queue function */
|
|
197
|
+
event?: BlueprintFunctionResourceEvent;
|
|
198
|
+
concurrency?: number;
|
|
199
|
+
fifo?: boolean;
|
|
200
|
+
dlq?: boolean;
|
|
206
201
|
};
|
|
207
202
|
/**
|
|
208
203
|
* Configuration for defining an event function.
|
|
209
204
|
* @public
|
|
210
|
-
* @alpha Deploying
|
|
205
|
+
* @alpha Deploying Event Functions via Blueprints is experimental. This feature is not available publicly yet.
|
|
211
206
|
* @hidden
|
|
212
207
|
* @category Functions Types
|
|
213
208
|
* @interface
|
|
@@ -219,3 +214,48 @@ export type BlueprintEventFunctionConfig = Omit<BlueprintEventFunctionResource,
|
|
|
219
214
|
*/
|
|
220
215
|
src?: string;
|
|
221
216
|
};
|
|
217
|
+
/**
|
|
218
|
+
* A durable, step-based pipeline function.
|
|
219
|
+
* @public
|
|
220
|
+
* @alpha Deploying Pipeline Functions via Blueprints is experimental. This feature is not available publicly yet.
|
|
221
|
+
* @hidden
|
|
222
|
+
* @category Functions Types
|
|
223
|
+
* @interface
|
|
224
|
+
*/
|
|
225
|
+
export interface BlueprintPipelineResource extends BlueprintBaseFunctionResource {
|
|
226
|
+
type: 'sanity.function.pipeline';
|
|
227
|
+
event?: BlueprintFunctionResourceEvent;
|
|
228
|
+
/**
|
|
229
|
+
* Concurrent executions
|
|
230
|
+
* Min 1
|
|
231
|
+
* Max 500
|
|
232
|
+
*/
|
|
233
|
+
concurrency?: number;
|
|
234
|
+
/**
|
|
235
|
+
* Debounce window in seconds
|
|
236
|
+
*/
|
|
237
|
+
debounce?: number;
|
|
238
|
+
/**
|
|
239
|
+
* Path used to group debounced events, e.g. 'document._id'
|
|
240
|
+
*/
|
|
241
|
+
debounceKey?: string;
|
|
242
|
+
}
|
|
243
|
+
/**
|
|
244
|
+
* Configuration for defining a pipeline function.
|
|
245
|
+
* @public
|
|
246
|
+
* @alpha Deploying Pipeline Functions via Blueprints is experimental. This feature is not available publicly yet.
|
|
247
|
+
* @hidden
|
|
248
|
+
* @category Functions Types
|
|
249
|
+
* @interface
|
|
250
|
+
*/
|
|
251
|
+
export type BlueprintPipelineConfig = Omit<BlueprintPipelineResource, 'type' | 'src' | 'event'> & {
|
|
252
|
+
/**
|
|
253
|
+
* Path to the pipeline source code
|
|
254
|
+
* @defaultValue `functions/${name}`
|
|
255
|
+
*/
|
|
256
|
+
src?: string;
|
|
257
|
+
/**
|
|
258
|
+
* Trigger configuration
|
|
259
|
+
*/
|
|
260
|
+
event?: BlueprintFunctionResourceEvent;
|
|
261
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/types/functions/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/types/functions/index.ts"],"names":[],"mappings":"AAWA,cAAc,YAAY,CAAA;AAE1B;;;GAGG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,MAAM,EAAE,YAAY,EAAE,YAAY,CAAU,CAAA"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import type { ConfigEnv, InlineConfig } from 'vite';
|
|
2
|
+
import type { BlueprintProjectResourceLifecycle, BlueprintResource } from '../index.js';
|
|
3
|
+
/**
|
|
4
|
+
* Custom Vite configuration for the Studio so it can be changed and extended.
|
|
5
|
+
* This type matches the type in @sanity/cli-core and must continue to remain compatible.
|
|
6
|
+
* @beta This feature is subject to breaking changes.
|
|
7
|
+
* @category Resource Types
|
|
8
|
+
* @hidden
|
|
9
|
+
*/
|
|
10
|
+
export type UserViteConfig = ((config: InlineConfig, env: ConfigEnv) => InlineConfig | Promise<InlineConfig>) | InlineConfig;
|
|
11
|
+
/**
|
|
12
|
+
* Represents a Studio resource.
|
|
13
|
+
* @see https://www.sanity.io/docs/studio
|
|
14
|
+
* @beta This feature is subject to breaking changes.
|
|
15
|
+
* @category Resource Types
|
|
16
|
+
* @hidden
|
|
17
|
+
*/
|
|
18
|
+
export interface BlueprintStudioResource extends BlueprintResource<BlueprintProjectResourceLifecycle> {
|
|
19
|
+
type: 'sanity.studio';
|
|
20
|
+
/** The relative location of the studio source code. */
|
|
21
|
+
src: string;
|
|
22
|
+
/**
|
|
23
|
+
* Auto update settings for the studio.
|
|
24
|
+
*/
|
|
25
|
+
autoUpdates: {
|
|
26
|
+
/** Whether auto updates are enabled for the studio */
|
|
27
|
+
enabled: boolean;
|
|
28
|
+
/** What "version"/"channel" to use for auto updates */
|
|
29
|
+
version?: string;
|
|
30
|
+
};
|
|
31
|
+
/** The base path of the studio URL. Defaults to '/' */
|
|
32
|
+
basePath?: string;
|
|
33
|
+
/** Whether or not to minify the source code. Defaults to true. */
|
|
34
|
+
minify?: boolean;
|
|
35
|
+
/** Whether or not to configure the reactCompiler. Defaults to false. */
|
|
36
|
+
reactCompiler?: boolean;
|
|
37
|
+
/** Whether or not to generate source maps. Defaults to false. */
|
|
38
|
+
sourceMap?: boolean;
|
|
39
|
+
/** Custom Vite configuration for the Studio so it can be changed and extended. */
|
|
40
|
+
vite?: UserViteConfig;
|
|
41
|
+
/**
|
|
42
|
+
* The project ID of the project that contains your Studio.
|
|
43
|
+
*
|
|
44
|
+
* The `project` attribute must be defined if your blueprint is scoped to an organization.
|
|
45
|
+
*/
|
|
46
|
+
project?: string;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Configuration for a Studio resource.
|
|
50
|
+
* @see https://www.sanity.io/docs/studio
|
|
51
|
+
* @beta This feature is subject to breaking changes.
|
|
52
|
+
* @category Resource Types
|
|
53
|
+
* @interface
|
|
54
|
+
* @hidden
|
|
55
|
+
*/
|
|
56
|
+
export interface BlueprintStudioConfig extends Omit<BlueprintStudioResource, 'type'> {
|
|
57
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"studios.js","sourceRoot":"","sources":["../../src/types/studios.ts"],"names":[],"mappings":""}
|
|
@@ -51,7 +51,7 @@ export declare function validateSyncTagInvalidateFunction(functionResource: unkn
|
|
|
51
51
|
*/
|
|
52
52
|
export declare function validateQueueFunction(functionResource: unknown): BlueprintError[];
|
|
53
53
|
/**
|
|
54
|
-
* Validates
|
|
54
|
+
* Validates an event function resource configuration.
|
|
55
55
|
* @param functionResource The function resource to validate
|
|
56
56
|
* @alpha
|
|
57
57
|
* @hidden
|
|
@@ -59,3 +59,12 @@ export declare function validateQueueFunction(functionResource: unknown): Bluepr
|
|
|
59
59
|
* @returns Array of validation errors, empty if valid
|
|
60
60
|
*/
|
|
61
61
|
export declare function validateEventFunction(functionResource: unknown): BlueprintError[];
|
|
62
|
+
/**
|
|
63
|
+
* Validates a pipeline function resource configuration.
|
|
64
|
+
* @param functionResource The function resource to validate
|
|
65
|
+
* @alpha
|
|
66
|
+
* @hidden
|
|
67
|
+
* @category Functions Types
|
|
68
|
+
* @returns Array of validation errors, empty if valid
|
|
69
|
+
*/
|
|
70
|
+
export declare function validatePipelineFunction(functionResource: unknown): BlueprintError[];
|