@sanity/blueprints 0.14.0 → 0.15.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/dist/definers/functions.d.ts +33 -1
- package/dist/definers/functions.js +42 -1
- package/dist/definers/functions.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/types/functions/event.d.ts +96 -0
- package/dist/types/functions/event.js +3 -0
- package/dist/types/functions/event.js.map +1 -0
- package/dist/types/{functions.d.ts → functions/index.d.ts} +27 -90
- package/dist/types/{functions.js → functions/index.js} +3 -2
- package/dist/types/functions/index.js.map +1 -0
- package/dist/validation/functions.d.ts +9 -0
- package/dist/validation/functions.js +39 -4
- package/dist/validation/functions.js.map +1 -1
- package/package.json +1 -1
- package/src/definers/functions.ts +50 -0
- package/src/index.ts +1 -1
- package/src/types/functions/event.ts +114 -0
- package/src/types/{functions.ts → functions/index.ts} +34 -103
- package/src/validation/functions.ts +40 -4
- package/dist/types/functions.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type BlueprintBaseFunctionConfig, type BlueprintBaseFunctionResource, type BlueprintDocumentFunctionConfig, type BlueprintDocumentFunctionResource, type BlueprintDocumentFunctionResourceEvent, type BlueprintMediaLibraryAssetFunctionConfig, type BlueprintMediaLibraryAssetFunctionResource, type BlueprintScheduledFunctionConfig, type BlueprintScheduledFunctionResource } from '../index.js';
|
|
1
|
+
import { type BlueprintBaseFunctionConfig, type BlueprintBaseFunctionResource, type BlueprintDocumentFunctionConfig, type BlueprintDocumentFunctionResource, type BlueprintDocumentFunctionResourceEvent, type BlueprintMediaLibraryAssetFunctionConfig, type BlueprintMediaLibraryAssetFunctionResource, 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
|
*
|
|
@@ -91,6 +91,38 @@ export declare function defineScheduledFunction(functionConfig: BlueprintSchedul
|
|
|
91
91
|
* @hidden
|
|
92
92
|
*/
|
|
93
93
|
export declare function defineScheduleFunction(functionConfig: BlueprintScheduledFunctionConfig): BlueprintScheduledFunctionResource;
|
|
94
|
+
/**
|
|
95
|
+
* Defines a function that is triggered on a sync tag invalidate event.
|
|
96
|
+
*
|
|
97
|
+
* @remarks
|
|
98
|
+
* Using implicit event scoping to all datasets in the function project:
|
|
99
|
+
* ```ts
|
|
100
|
+
* defineSyncTagInvalidateFunction({
|
|
101
|
+
* name: 'bustin-caches',
|
|
102
|
+
* })
|
|
103
|
+
* ```
|
|
104
|
+
*
|
|
105
|
+
* Using explicit event scoping to a particular dataset in the function project:
|
|
106
|
+
* ```ts
|
|
107
|
+
* defineSyncTagInvalidateFunction({
|
|
108
|
+
* name: 'bustin-caches',
|
|
109
|
+
* event: {
|
|
110
|
+
* resource: {
|
|
111
|
+
* type: 'dataset',
|
|
112
|
+
* id: 'myProj.myDataset',
|
|
113
|
+
* },
|
|
114
|
+
* },
|
|
115
|
+
* })
|
|
116
|
+
* ```
|
|
117
|
+
* @public
|
|
118
|
+
* @alpha Deploying Sync Tag Invalidate Functions via Blueprints is experimental. This feature is not available publicly yet.
|
|
119
|
+
* @hidden
|
|
120
|
+
* @category Definers
|
|
121
|
+
* @expandType BlueprintSyncTagInvalidateFunctionConfig
|
|
122
|
+
* @param functionConfig The configuration for the sync tag invalidate function
|
|
123
|
+
* @returns The validated sync tag invalidate function resource
|
|
124
|
+
*/
|
|
125
|
+
export declare function defineSyncTagInvalidateFunction(functionConfig: BlueprintSyncTagInvalidateFunctionConfig): BlueprintSyncTagInvalidateFunctionResource;
|
|
94
126
|
/**
|
|
95
127
|
* Defines a base function resource with common properties.
|
|
96
128
|
*
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { validateDocumentFunction, validateFunction, validateMediaLibraryAssetFunction, validateScheduledFunction, } from '../index.js';
|
|
1
|
+
import { validateDocumentFunction, validateFunction, validateMediaLibraryAssetFunction, 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']);
|
|
@@ -155,6 +155,47 @@ export function defineScheduledFunction(functionConfig) {
|
|
|
155
155
|
export function defineScheduleFunction(functionConfig) {
|
|
156
156
|
return defineScheduledFunction(functionConfig);
|
|
157
157
|
}
|
|
158
|
+
/**
|
|
159
|
+
* Defines a function that is triggered on a sync tag invalidate event.
|
|
160
|
+
*
|
|
161
|
+
* @remarks
|
|
162
|
+
* Using implicit event scoping to all datasets in the function project:
|
|
163
|
+
* ```ts
|
|
164
|
+
* defineSyncTagInvalidateFunction({
|
|
165
|
+
* name: 'bustin-caches',
|
|
166
|
+
* })
|
|
167
|
+
* ```
|
|
168
|
+
*
|
|
169
|
+
* Using explicit event scoping to a particular dataset in the function project:
|
|
170
|
+
* ```ts
|
|
171
|
+
* defineSyncTagInvalidateFunction({
|
|
172
|
+
* name: 'bustin-caches',
|
|
173
|
+
* event: {
|
|
174
|
+
* resource: {
|
|
175
|
+
* type: 'dataset',
|
|
176
|
+
* id: 'myProj.myDataset',
|
|
177
|
+
* },
|
|
178
|
+
* },
|
|
179
|
+
* })
|
|
180
|
+
* ```
|
|
181
|
+
* @public
|
|
182
|
+
* @alpha Deploying Sync Tag Invalidate Functions via Blueprints is experimental. This feature is not available publicly yet.
|
|
183
|
+
* @hidden
|
|
184
|
+
* @category Definers
|
|
185
|
+
* @expandType BlueprintSyncTagInvalidateFunctionConfig
|
|
186
|
+
* @param functionConfig The configuration for the sync tag invalidate function
|
|
187
|
+
* @returns The validated sync tag invalidate function resource
|
|
188
|
+
*/
|
|
189
|
+
export function defineSyncTagInvalidateFunction(functionConfig) {
|
|
190
|
+
const { event } = functionConfig;
|
|
191
|
+
const functionResource = {
|
|
192
|
+
...defineFunction(functionConfig, { skipValidation: true }),
|
|
193
|
+
type: 'sanity.function.sync-tag-invalidate',
|
|
194
|
+
...(event?.resource ? { event } : {}),
|
|
195
|
+
};
|
|
196
|
+
runValidation(() => validateSyncTagInvalidateFunction(functionResource));
|
|
197
|
+
return functionResource;
|
|
198
|
+
}
|
|
158
199
|
/**
|
|
159
200
|
* Defines a base function resource with common properties.
|
|
160
201
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"functions.js","sourceRoot":"","sources":["../../src/definers/functions.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"functions.js","sourceRoot":"","sources":["../../src/definers/functions.ts"],"names":[],"mappings":"AAAA,OAAO,EAiBL,wBAAwB,EACxB,gBAAgB,EAChB,iCAAiC,EACjC,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;AAmErI,MAAM,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I,EAAE,UAAU,EAAE,KAAK,EAAE,SAAS,CAAC,GAAG,KAAK,CAAA;IAC1D,OAAO,EAAC,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,SAAS,EAAC,CAAA;AACrD,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -28,7 +28,7 @@ export * from './types/blueprints.js';
|
|
|
28
28
|
export * from './types/cors.js';
|
|
29
29
|
export * from './types/datasets.js';
|
|
30
30
|
export * from './types/errors.js';
|
|
31
|
-
export * from './types/functions.js';
|
|
31
|
+
export * from './types/functions/index.js';
|
|
32
32
|
export * from './types/projects.js';
|
|
33
33
|
export * from './types/resources.js';
|
|
34
34
|
export * from './types/robots.js';
|
package/dist/index.js
CHANGED
|
@@ -30,7 +30,7 @@ export * from './types/blueprints.js';
|
|
|
30
30
|
export * from './types/cors.js';
|
|
31
31
|
export * from './types/datasets.js';
|
|
32
32
|
export * from './types/errors.js';
|
|
33
|
-
export * from './types/functions.js';
|
|
33
|
+
export * from './types/functions/index.js';
|
|
34
34
|
export * from './types/projects.js';
|
|
35
35
|
export * from './types/resources.js';
|
|
36
36
|
export * from './types/robots.js';
|
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;AACxC,cAAc,oBAAoB,CAAA;AAClC,cAAc,wBAAwB,CAAA;AACtC,cAAc,yBAAyB,CAAA;AACvC,cAAc,wBAAwB,CAAA;AACtC,cAAc,yBAAyB,CAAA;AACvC,cAAc,sBAAsB,CAAA;AACpC,cAAc,2BAA2B,CAAA;AACzC,cAAc,qBAAqB,CAAA;AACnC,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,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,kDAAkD;AAClD;;;GAGG;AACH;;;GAGG;AACH,cAAc,0BAA0B,CAAA;AACxC,cAAc,oBAAoB,CAAA;AAClC,cAAc,wBAAwB,CAAA;AACtC,cAAc,yBAAyB,CAAA;AACvC,cAAc,wBAAwB,CAAA;AACtC,cAAc,yBAAyB,CAAA;AACvC,cAAc,sBAAsB,CAAA;AACpC,cAAc,2BAA2B,CAAA;AACzC,cAAc,qBAAqB,CAAA;AACnC,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,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,0BAA0B,CAAA;AAExC,yEAAyE;AACzE;;;GAGG"}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Base event configuration shared by document and media library function types
|
|
3
|
+
* @category Functions Types
|
|
4
|
+
*/
|
|
5
|
+
export interface BlueprintFunctionBaseResourceEvent {
|
|
6
|
+
/**
|
|
7
|
+
* Event types that trigger the function
|
|
8
|
+
* @defaultValue ['publish']
|
|
9
|
+
*/
|
|
10
|
+
on?: [BlueprintFunctionResourceEventName, ...BlueprintFunctionResourceEventName[]];
|
|
11
|
+
/** GROQ filter expression to match specific documents (e.g., "_type == 'post'") */
|
|
12
|
+
filter?: string;
|
|
13
|
+
/** GROQ projection to specify which fields to include (e.g., "{_id, title, slug}") */
|
|
14
|
+
projection?: `{${string}}`;
|
|
15
|
+
/** Include draft documents in addition to published documents */
|
|
16
|
+
includeDrafts?: boolean;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Event configuration for document functions
|
|
20
|
+
* @category Functions Types
|
|
21
|
+
*/
|
|
22
|
+
export interface BlueprintDocumentFunctionResourceEvent extends BlueprintFunctionBaseResourceEvent {
|
|
23
|
+
/** Include all versions of documents, not just the current version */
|
|
24
|
+
includeAllVersions?: boolean;
|
|
25
|
+
/** Optional dataset resource scoping for the function */
|
|
26
|
+
resource?: BlueprintFunctionResourceEventResourceDataset;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Event configuration for media library asset functions
|
|
30
|
+
* @category Functions Types
|
|
31
|
+
*/
|
|
32
|
+
export interface BlueprintMediaLibraryFunctionResourceEvent extends BlueprintFunctionBaseResourceEvent {
|
|
33
|
+
/** Media library resource scoping (required for media library functions) */
|
|
34
|
+
resource: BlueprintFunctionResourceEventResourceMediaLibrary;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Event configuration for sync tag invalidate functions
|
|
38
|
+
* @category Functions Types
|
|
39
|
+
*/
|
|
40
|
+
export interface BlueprintSyncTagInvalidateFunctionResourceEvent {
|
|
41
|
+
/** Optional dataset resource scoping for the function */
|
|
42
|
+
resource?: BlueprintFunctionResourceEventResourceDataset;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Explicit resource event for scheduled functions to specific minutes, hours, days of month, months, and days of week
|
|
46
|
+
* @example { minute: '0', hour: '9', dayOfMonth: '1', month: '1', dayOfWeek: '1' }
|
|
47
|
+
* @category Functions Types
|
|
48
|
+
*/
|
|
49
|
+
export interface BlueprintScheduledFunctionExplicitResourceEvent {
|
|
50
|
+
minute: string;
|
|
51
|
+
hour: string;
|
|
52
|
+
dayOfMonth: string;
|
|
53
|
+
month: string;
|
|
54
|
+
dayOfWeek: string;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Expression resource for scheduled functions to specific expressions
|
|
58
|
+
* @example { expression: '0 9 * * *' }
|
|
59
|
+
* @category Functions Types
|
|
60
|
+
*/
|
|
61
|
+
export interface BlueprintScheduledFunctionExpressionResourceEvent {
|
|
62
|
+
expression: string;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Union type of all scheduled function resource event configurations
|
|
66
|
+
* @category Functions Types
|
|
67
|
+
*/
|
|
68
|
+
export type BlueprintScheduledFunctionResourceEvent = BlueprintScheduledFunctionExplicitResourceEvent | BlueprintScheduledFunctionExpressionResourceEvent;
|
|
69
|
+
/**
|
|
70
|
+
* Union type of all function resource event configurations
|
|
71
|
+
* @category Functions Types
|
|
72
|
+
*/
|
|
73
|
+
export type BlueprintFunctionResourceEvent = BlueprintDocumentFunctionResourceEvent | BlueprintMediaLibraryFunctionResourceEvent | BlueprintScheduledFunctionResourceEvent | BlueprintSyncTagInvalidateFunctionResourceEvent;
|
|
74
|
+
/**
|
|
75
|
+
* Dataset resource for scoping document functions to specific datasets
|
|
76
|
+
* @example { type: 'dataset', id: 'my-project.production' }
|
|
77
|
+
* @category Functions Types
|
|
78
|
+
*/
|
|
79
|
+
export interface BlueprintFunctionResourceEventResourceDataset {
|
|
80
|
+
type: 'dataset';
|
|
81
|
+
/** A dataset ID in the format <projectId>.<datasetName>. <datasetName> can be `*` to signify "all datasets in project with ID <projectId>." */
|
|
82
|
+
id: string;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Media library resource for scoping media library functions
|
|
86
|
+
* @category Functions Types
|
|
87
|
+
*/
|
|
88
|
+
export interface BlueprintFunctionResourceEventResourceMediaLibrary {
|
|
89
|
+
type: 'media-library';
|
|
90
|
+
id: string;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Events that can trigger a function
|
|
94
|
+
* @category Functions Types
|
|
95
|
+
*/
|
|
96
|
+
export type BlueprintFunctionResourceEventName = 'publish' | 'create' | 'delete' | 'update';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"event.js","sourceRoot":"","sources":["../../../src/types/functions/event.ts"],"names":[],"mappings":"AAAA,+BAA+B"}
|
|
@@ -1,94 +1,8 @@
|
|
|
1
|
-
import type { BlueprintResource } from '
|
|
1
|
+
import type { BlueprintResource } from '../../index.js';
|
|
2
|
+
import type { BlueprintDocumentFunctionResourceEvent, BlueprintMediaLibraryFunctionResourceEvent, BlueprintScheduledFunctionResourceEvent, BlueprintSyncTagInvalidateFunctionResourceEvent } from './event.js';
|
|
3
|
+
export * from './event.js';
|
|
2
4
|
/**
|
|
3
|
-
*
|
|
4
|
-
* @category Functions Types
|
|
5
|
-
*/
|
|
6
|
-
export interface BlueprintFunctionBaseResourceEvent {
|
|
7
|
-
/**
|
|
8
|
-
* Event types that trigger the function
|
|
9
|
-
* @defaultValue ['publish']
|
|
10
|
-
*/
|
|
11
|
-
on?: [BlueprintFunctionResourceEventName, ...BlueprintFunctionResourceEventName[]];
|
|
12
|
-
/** GROQ filter expression to match specific documents (e.g., "_type == 'post'") */
|
|
13
|
-
filter?: string;
|
|
14
|
-
/** GROQ projection to specify which fields to include (e.g., "{_id, title, slug}") */
|
|
15
|
-
projection?: `{${string}}`;
|
|
16
|
-
/** Include draft documents in addition to published documents */
|
|
17
|
-
includeDrafts?: boolean;
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* Event configuration for document functions
|
|
21
|
-
* @category Functions Types
|
|
22
|
-
*/
|
|
23
|
-
export interface BlueprintDocumentFunctionResourceEvent extends BlueprintFunctionBaseResourceEvent {
|
|
24
|
-
/** Include all versions of documents, not just the current version */
|
|
25
|
-
includeAllVersions?: boolean;
|
|
26
|
-
/** Optional dataset resource scoping for the function */
|
|
27
|
-
resource?: BlueprintFunctionResourceEventResourceDataset;
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* Event configuration for media library asset functions
|
|
31
|
-
* @category Functions Types
|
|
32
|
-
*/
|
|
33
|
-
export interface BlueprintMediaLibraryFunctionResourceEvent extends BlueprintFunctionBaseResourceEvent {
|
|
34
|
-
/** Media library resource scoping (required for media library functions) */
|
|
35
|
-
resource: BlueprintFunctionResourceEventResourceMediaLibrary;
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* Union type of all function resource event configurations
|
|
39
|
-
* @category Functions Types
|
|
40
|
-
*/
|
|
41
|
-
export type BlueprintFunctionResourceEvent = BlueprintDocumentFunctionResourceEvent | BlueprintMediaLibraryFunctionResourceEvent;
|
|
42
|
-
/**
|
|
43
|
-
* Explicit resource event for scheduled functions to specific minutes, hours, days of month, months, and days of week
|
|
44
|
-
* @example { minute: '0', hour: '9', dayOfMonth: '1', month: '1', dayOfWeek: '1' }
|
|
45
|
-
* @category Functions Types
|
|
46
|
-
*/
|
|
47
|
-
export interface BlueprintScheduledFunctionExplicitResourceEvent {
|
|
48
|
-
minute: string;
|
|
49
|
-
hour: string;
|
|
50
|
-
dayOfMonth: string;
|
|
51
|
-
month: string;
|
|
52
|
-
dayOfWeek: string;
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* Expression resource for scheduled functions to specific expressions
|
|
56
|
-
* @example { expression: '0 9 * * *' }
|
|
57
|
-
* @category Functions Types
|
|
58
|
-
*/
|
|
59
|
-
export interface BlueprintScheduledFunctionExpressionResourceEvent {
|
|
60
|
-
expression: string;
|
|
61
|
-
}
|
|
62
|
-
/**
|
|
63
|
-
* Union type of all scheduled function resource event configurations
|
|
64
|
-
* @category Functions Types
|
|
65
|
-
*/
|
|
66
|
-
export type BlueprintScheduledFunctionResourceEvent = BlueprintScheduledFunctionExplicitResourceEvent | BlueprintScheduledFunctionExpressionResourceEvent;
|
|
67
|
-
/**
|
|
68
|
-
* Dataset resource for scoping document functions to specific datasets
|
|
69
|
-
* @example { type: 'dataset', id: 'my-project.production' }
|
|
70
|
-
* @category Functions Types
|
|
71
|
-
*/
|
|
72
|
-
export interface BlueprintFunctionResourceEventResourceDataset {
|
|
73
|
-
type: 'dataset';
|
|
74
|
-
/** A dataset ID in the format <projectId>.<datasetName>. <datasetName> can be `*` to signify "all datasets in project with ID <projectId>." */
|
|
75
|
-
id: string;
|
|
76
|
-
}
|
|
77
|
-
/**
|
|
78
|
-
* Media library resource for scoping media library functions
|
|
79
|
-
* @category Functions Types
|
|
80
|
-
*/
|
|
81
|
-
export interface BlueprintFunctionResourceEventResourceMediaLibrary {
|
|
82
|
-
type: 'media-library';
|
|
83
|
-
id: string;
|
|
84
|
-
}
|
|
85
|
-
/**
|
|
86
|
-
* Events that can trigger a function
|
|
87
|
-
* @category Functions Types
|
|
88
|
-
*/
|
|
89
|
-
export type BlueprintFunctionResourceEventName = 'publish' | 'create' | 'delete' | 'update';
|
|
90
|
-
/**
|
|
91
|
-
* Current support Function runtimes
|
|
5
|
+
* Supported Function runtimes
|
|
92
6
|
* @category Functions Types
|
|
93
7
|
*/
|
|
94
8
|
export declare const VALID_RUNTIMES: readonly ["node", "nodejs22.x", "nodejs24.x"];
|
|
@@ -152,6 +66,14 @@ export interface BlueprintScheduledFunctionResource extends BlueprintBaseFunctio
|
|
|
152
66
|
event: BlueprintScheduledFunctionResourceEvent;
|
|
153
67
|
timezone?: string;
|
|
154
68
|
}
|
|
69
|
+
/**
|
|
70
|
+
* A function resource triggered by sync tag invalidate events
|
|
71
|
+
* @category Functions Types
|
|
72
|
+
*/
|
|
73
|
+
export interface BlueprintSyncTagInvalidateFunctionResource extends BlueprintBaseFunctionResource {
|
|
74
|
+
type: 'sanity.function.sync-tag-invalidate';
|
|
75
|
+
event?: BlueprintSyncTagInvalidateFunctionResourceEvent;
|
|
76
|
+
}
|
|
155
77
|
/**
|
|
156
78
|
* Configuration for defining a base function.
|
|
157
79
|
* @internal
|
|
@@ -211,3 +133,18 @@ export type BlueprintScheduledFunctionConfig = Omit<BlueprintScheduledFunctionRe
|
|
|
211
133
|
*/
|
|
212
134
|
src?: string;
|
|
213
135
|
};
|
|
136
|
+
/**
|
|
137
|
+
* Configuration for defining a sync tag invalidate function.
|
|
138
|
+
* @public
|
|
139
|
+
* @alpha Deploying Sync Tag Invalidate Functions via Blueprints is experimental. This feature is not available publicly yet.
|
|
140
|
+
* @hidden
|
|
141
|
+
* @category Functions Types
|
|
142
|
+
* @interface
|
|
143
|
+
*/
|
|
144
|
+
export type BlueprintSyncTagInvalidateFunctionConfig = Omit<BlueprintSyncTagInvalidateFunctionResource, 'type' | 'src'> & {
|
|
145
|
+
/**
|
|
146
|
+
* Path to the function source code
|
|
147
|
+
* @defaultValue `functions/${name}`
|
|
148
|
+
*/
|
|
149
|
+
src?: string;
|
|
150
|
+
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
export * from './event.js';
|
|
1
2
|
/**
|
|
2
|
-
*
|
|
3
|
+
* Supported Function runtimes
|
|
3
4
|
* @category Functions Types
|
|
4
5
|
*/
|
|
5
6
|
export const VALID_RUNTIMES = ['node', 'nodejs22.x', 'nodejs24.x'];
|
|
6
|
-
//# sourceMappingURL=
|
|
7
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/types/functions/index.ts"],"names":[],"mappings":"AAQA,cAAc,YAAY,CAAA;AAE1B;;;GAGG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,MAAM,EAAE,YAAY,EAAE,YAAY,CAAU,CAAA"}
|
|
@@ -32,3 +32,12 @@ export declare function validateFunction(functionResource: unknown): BlueprintEr
|
|
|
32
32
|
* @returns Array of validation errors, empty if valid
|
|
33
33
|
*/
|
|
34
34
|
export declare function validateScheduledFunction(functionResource: unknown): BlueprintError[];
|
|
35
|
+
/**
|
|
36
|
+
* Validates a sync tag invalidate function resource configuration.
|
|
37
|
+
* @param functionResource The function resource to validate
|
|
38
|
+
* @alpha
|
|
39
|
+
* @hidden
|
|
40
|
+
* @category Functions Types
|
|
41
|
+
* @returns Array of validation errors, empty if valid
|
|
42
|
+
*/
|
|
43
|
+
export declare function validateSyncTagInvalidateFunction(functionResource: unknown): BlueprintError[];
|
|
@@ -130,13 +130,25 @@ function validateDocumentFunctionEvent(event) {
|
|
|
130
130
|
if (!Array.isArray(fullEvent.on))
|
|
131
131
|
errors.push({ type: 'invalid_type', message: '`event.on` must be an array' });
|
|
132
132
|
if (fullEvent.resource) {
|
|
133
|
-
|
|
134
|
-
errors.push({ type: 'invalid_value', message: '`event.resource.type` must be "dataset"' });
|
|
135
|
-
if (!fullEvent.resource.id || fullEvent.resource.id.split('.').length !== 2)
|
|
136
|
-
errors.push({ type: 'invalid_format', message: '`event.resource.id` must be in the format <projectId>.<datasetName>' });
|
|
133
|
+
errors.push(...validateFunctionEventResourceDataset(fullEvent));
|
|
137
134
|
}
|
|
138
135
|
return errors;
|
|
139
136
|
}
|
|
137
|
+
function validateFunctionEventResourceDataset(event) {
|
|
138
|
+
const errors = [];
|
|
139
|
+
if (!event || typeof event !== 'object')
|
|
140
|
+
return [{ type: 'invalid_value', message: '`event` must be an object' }];
|
|
141
|
+
if (!('resource' in event))
|
|
142
|
+
return [{ type: 'invalid_value', message: '`event.resource` must exist' }];
|
|
143
|
+
const resource = event.resource;
|
|
144
|
+
if (!resource || typeof resource !== 'object')
|
|
145
|
+
return [{ type: 'invalid_value', message: '`event.resource` must be an object' }];
|
|
146
|
+
if (!('type' in resource) || !resource.type || resource.type !== 'dataset')
|
|
147
|
+
errors.push({ type: 'invalid_value', message: '`event.resource.type` must be "dataset"' });
|
|
148
|
+
if (!('id' in resource) || !resource.id || typeof resource.id !== 'string' || resource.id.split('.').length !== 2)
|
|
149
|
+
errors.push({ type: 'invalid_format', message: '`event.resource.id` must be in the format <projectId>.<datasetName>' });
|
|
150
|
+
return errors;
|
|
151
|
+
}
|
|
140
152
|
/**
|
|
141
153
|
* Validates a media library function event configuration.
|
|
142
154
|
* Checks event trigger types and ensures required media library resource is present.
|
|
@@ -297,4 +309,27 @@ function validateScheduledFunctionTimezone(timezone) {
|
|
|
297
309
|
}
|
|
298
310
|
return errors;
|
|
299
311
|
}
|
|
312
|
+
/**
|
|
313
|
+
* Validates a sync tag invalidate function resource configuration.
|
|
314
|
+
* @param functionResource The function resource to validate
|
|
315
|
+
* @alpha
|
|
316
|
+
* @hidden
|
|
317
|
+
* @category Functions Types
|
|
318
|
+
* @returns Array of validation errors, empty if valid
|
|
319
|
+
*/
|
|
320
|
+
export function validateSyncTagInvalidateFunction(functionResource) {
|
|
321
|
+
if (!functionResource)
|
|
322
|
+
return [{ type: 'invalid_value', message: 'Function config must be provided' }];
|
|
323
|
+
if (typeof functionResource !== 'object')
|
|
324
|
+
return [{ type: 'invalid_type', message: 'Function config must be an object' }];
|
|
325
|
+
const errors = [];
|
|
326
|
+
if ('type' in functionResource && functionResource.type !== 'sanity.function.sync-tag-invalidate') {
|
|
327
|
+
errors.push({ type: 'invalid_value', message: '`type` must be `sanity.function.sync-tag-invalidate`' });
|
|
328
|
+
}
|
|
329
|
+
if ('event' in functionResource) {
|
|
330
|
+
errors.push(...validateFunctionEventResourceDataset(functionResource.event));
|
|
331
|
+
}
|
|
332
|
+
errors.push(...validateFunction(functionResource));
|
|
333
|
+
return errors;
|
|
334
|
+
}
|
|
300
335
|
//# sourceMappingURL=functions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"functions.js","sourceRoot":"","sources":["../../src/validation/functions.ts"],"names":[],"mappings":"AAAA,OAAO,EAML,cAAc,EACd,gBAAgB,GACjB,MAAM,a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;IAAC,MAAM,CAAC;QACP,MAAM,CAAC,IAAI,CAAC;YACV,IAAI,EAAE,eAAe;YACrB,OAAO,EAAE,0CAA0C;SACpD,CAAC,CAAA;IACJ,CAAC;IAED,OAAO,MAAM,CAAA;AACf,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,iCAAiC,CAAC,gBAAyB;IACzE,IAAI,CAAC,gBAAgB;QAAE,OAAO,CAAC,EAAC,IAAI,EAAE,eAAe,EAAE,OAAO,EAAE,kCAAkC,EAAC,CAAC,CAAA;IACpG,IAAI,OAAO,gBAAgB,KAAK,QAAQ;QAAE,OAAO,CAAC,EAAC,IAAI,EAAE,cAAc,EAAE,OAAO,EAAE,mCAAmC,EAAC,CAAC,CAAA;IAEvH,MAAM,MAAM,GAAqB,EAAE,CAAA;IAEnC,IAAI,MAAM,IAAI,gBAAgB,IAAI,gBAAgB,CAAC,IAAI,KAAK,qCAAqC,EAAE,CAAC;QAClG,MAAM,CAAC,IAAI,CAAC,EAAC,IAAI,EAAE,eAAe,EAAE,OAAO,EAAE,sDAAsD,EAAC,CAAC,CAAA;IACvG,CAAC;IAED,IAAI,OAAO,IAAI,gBAAgB,EAAE,CAAC;QAChC,MAAM,CAAC,IAAI,CAAC,GAAG,oCAAoC,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAC,CAAA;IAC9E,CAAC;IAED,MAAM,CAAC,IAAI,CAAC,GAAG,gBAAgB,CAAC,gBAAgB,CAAC,CAAC,CAAA;IAElD,OAAO,MAAM,CAAA;AACf,CAAC"}
|
package/package.json
CHANGED
|
@@ -13,10 +13,13 @@ import {
|
|
|
13
13
|
type BlueprintScheduledFunctionExpressionResourceEvent,
|
|
14
14
|
type BlueprintScheduledFunctionResource,
|
|
15
15
|
type BlueprintScheduledFunctionResourceEvent,
|
|
16
|
+
type BlueprintSyncTagInvalidateFunctionConfig,
|
|
17
|
+
type BlueprintSyncTagInvalidateFunctionResource,
|
|
16
18
|
validateDocumentFunction,
|
|
17
19
|
validateFunction,
|
|
18
20
|
validateMediaLibraryAssetFunction,
|
|
19
21
|
validateScheduledFunction,
|
|
22
|
+
validateSyncTagInvalidateFunction,
|
|
20
23
|
} from '../index.js'
|
|
21
24
|
import {parseScheduledExpression} from '../utils/schedule-parser.js'
|
|
22
25
|
import {runValidation} from '../utils/validation.js'
|
|
@@ -270,6 +273,53 @@ export function defineScheduleFunction(functionConfig: BlueprintScheduledFunctio
|
|
|
270
273
|
return defineScheduledFunction(functionConfig)
|
|
271
274
|
}
|
|
272
275
|
|
|
276
|
+
/**
|
|
277
|
+
* Defines a function that is triggered on a sync tag invalidate event.
|
|
278
|
+
*
|
|
279
|
+
* @remarks
|
|
280
|
+
* Using implicit event scoping to all datasets in the function project:
|
|
281
|
+
* ```ts
|
|
282
|
+
* defineSyncTagInvalidateFunction({
|
|
283
|
+
* name: 'bustin-caches',
|
|
284
|
+
* })
|
|
285
|
+
* ```
|
|
286
|
+
*
|
|
287
|
+
* Using explicit event scoping to a particular dataset in the function project:
|
|
288
|
+
* ```ts
|
|
289
|
+
* defineSyncTagInvalidateFunction({
|
|
290
|
+
* name: 'bustin-caches',
|
|
291
|
+
* event: {
|
|
292
|
+
* resource: {
|
|
293
|
+
* type: 'dataset',
|
|
294
|
+
* id: 'myProj.myDataset',
|
|
295
|
+
* },
|
|
296
|
+
* },
|
|
297
|
+
* })
|
|
298
|
+
* ```
|
|
299
|
+
* @public
|
|
300
|
+
* @alpha Deploying Sync Tag Invalidate Functions via Blueprints is experimental. This feature is not available publicly yet.
|
|
301
|
+
* @hidden
|
|
302
|
+
* @category Definers
|
|
303
|
+
* @expandType BlueprintSyncTagInvalidateFunctionConfig
|
|
304
|
+
* @param functionConfig The configuration for the sync tag invalidate function
|
|
305
|
+
* @returns The validated sync tag invalidate function resource
|
|
306
|
+
*/
|
|
307
|
+
export function defineSyncTagInvalidateFunction(
|
|
308
|
+
functionConfig: BlueprintSyncTagInvalidateFunctionConfig,
|
|
309
|
+
): BlueprintSyncTagInvalidateFunctionResource {
|
|
310
|
+
const {event} = functionConfig
|
|
311
|
+
|
|
312
|
+
const functionResource: BlueprintSyncTagInvalidateFunctionResource = {
|
|
313
|
+
...defineFunction(functionConfig, {skipValidation: true}),
|
|
314
|
+
type: 'sanity.function.sync-tag-invalidate',
|
|
315
|
+
...(event?.resource ? {event} : {}),
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
runValidation(() => validateSyncTagInvalidateFunction(functionResource))
|
|
319
|
+
|
|
320
|
+
return functionResource
|
|
321
|
+
}
|
|
322
|
+
|
|
273
323
|
/**
|
|
274
324
|
* Defines a base function resource with common properties.
|
|
275
325
|
*
|
package/src/index.ts
CHANGED
|
@@ -31,7 +31,7 @@ export * from './types/blueprints.js'
|
|
|
31
31
|
export * from './types/cors.js'
|
|
32
32
|
export * from './types/datasets.js'
|
|
33
33
|
export * from './types/errors.js'
|
|
34
|
-
export * from './types/functions.js'
|
|
34
|
+
export * from './types/functions/index.js'
|
|
35
35
|
export * from './types/projects.js'
|
|
36
36
|
export * from './types/resources.js'
|
|
37
37
|
export * from './types/robots.js'
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
// --- Function Event Types ---
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Base event configuration shared by document and media library function types
|
|
5
|
+
* @category Functions Types
|
|
6
|
+
*/
|
|
7
|
+
export interface BlueprintFunctionBaseResourceEvent {
|
|
8
|
+
/**
|
|
9
|
+
* Event types that trigger the function
|
|
10
|
+
* @defaultValue ['publish']
|
|
11
|
+
*/
|
|
12
|
+
on?: [BlueprintFunctionResourceEventName, ...BlueprintFunctionResourceEventName[]]
|
|
13
|
+
/** GROQ filter expression to match specific documents (e.g., "_type == 'post'") */
|
|
14
|
+
filter?: string
|
|
15
|
+
/** GROQ projection to specify which fields to include (e.g., "{_id, title, slug}") */
|
|
16
|
+
projection?: `{${string}}`
|
|
17
|
+
/** Include draft documents in addition to published documents */
|
|
18
|
+
includeDrafts?: boolean
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Event configuration for document functions
|
|
23
|
+
* @category Functions Types
|
|
24
|
+
*/
|
|
25
|
+
export interface BlueprintDocumentFunctionResourceEvent extends BlueprintFunctionBaseResourceEvent {
|
|
26
|
+
/** Include all versions of documents, not just the current version */
|
|
27
|
+
includeAllVersions?: boolean
|
|
28
|
+
/** Optional dataset resource scoping for the function */
|
|
29
|
+
resource?: BlueprintFunctionResourceEventResourceDataset
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Event configuration for media library asset functions
|
|
34
|
+
* @category Functions Types
|
|
35
|
+
*/
|
|
36
|
+
export interface BlueprintMediaLibraryFunctionResourceEvent extends BlueprintFunctionBaseResourceEvent {
|
|
37
|
+
/** Media library resource scoping (required for media library functions) */
|
|
38
|
+
resource: BlueprintFunctionResourceEventResourceMediaLibrary
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Event configuration for sync tag invalidate functions
|
|
43
|
+
* @category Functions Types
|
|
44
|
+
*/
|
|
45
|
+
export interface BlueprintSyncTagInvalidateFunctionResourceEvent {
|
|
46
|
+
/** Optional dataset resource scoping for the function */
|
|
47
|
+
resource?: BlueprintFunctionResourceEventResourceDataset
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Explicit resource event for scheduled functions to specific minutes, hours, days of month, months, and days of week
|
|
52
|
+
* @example { minute: '0', hour: '9', dayOfMonth: '1', month: '1', dayOfWeek: '1' }
|
|
53
|
+
* @category Functions Types
|
|
54
|
+
*/
|
|
55
|
+
export interface BlueprintScheduledFunctionExplicitResourceEvent {
|
|
56
|
+
minute: string
|
|
57
|
+
hour: string
|
|
58
|
+
dayOfMonth: string
|
|
59
|
+
month: string
|
|
60
|
+
dayOfWeek: string
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Expression resource for scheduled functions to specific expressions
|
|
65
|
+
* @example { expression: '0 9 * * *' }
|
|
66
|
+
* @category Functions Types
|
|
67
|
+
*/
|
|
68
|
+
export interface BlueprintScheduledFunctionExpressionResourceEvent {
|
|
69
|
+
expression: string
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Union type of all scheduled function resource event configurations
|
|
74
|
+
* @category Functions Types
|
|
75
|
+
*/
|
|
76
|
+
export type BlueprintScheduledFunctionResourceEvent =
|
|
77
|
+
| BlueprintScheduledFunctionExplicitResourceEvent
|
|
78
|
+
| BlueprintScheduledFunctionExpressionResourceEvent
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Union type of all function resource event configurations
|
|
82
|
+
* @category Functions Types
|
|
83
|
+
*/
|
|
84
|
+
export type BlueprintFunctionResourceEvent =
|
|
85
|
+
| BlueprintDocumentFunctionResourceEvent
|
|
86
|
+
| BlueprintMediaLibraryFunctionResourceEvent
|
|
87
|
+
| BlueprintScheduledFunctionResourceEvent
|
|
88
|
+
| BlueprintSyncTagInvalidateFunctionResourceEvent
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Dataset resource for scoping document functions to specific datasets
|
|
92
|
+
* @example { type: 'dataset', id: 'my-project.production' }
|
|
93
|
+
* @category Functions Types
|
|
94
|
+
*/
|
|
95
|
+
export interface BlueprintFunctionResourceEventResourceDataset {
|
|
96
|
+
type: 'dataset'
|
|
97
|
+
/** A dataset ID in the format <projectId>.<datasetName>. <datasetName> can be `*` to signify "all datasets in project with ID <projectId>." */
|
|
98
|
+
id: string
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Media library resource for scoping media library functions
|
|
103
|
+
* @category Functions Types
|
|
104
|
+
*/
|
|
105
|
+
export interface BlueprintFunctionResourceEventResourceMediaLibrary {
|
|
106
|
+
type: 'media-library'
|
|
107
|
+
id: string
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Events that can trigger a function
|
|
112
|
+
* @category Functions Types
|
|
113
|
+
*/
|
|
114
|
+
export type BlueprintFunctionResourceEventName = 'publish' | 'create' | 'delete' | 'update'
|
|
@@ -1,109 +1,15 @@
|
|
|
1
|
-
import type {BlueprintResource} from '
|
|
1
|
+
import type {BlueprintResource} from '../../index.js'
|
|
2
|
+
import type {
|
|
3
|
+
BlueprintDocumentFunctionResourceEvent,
|
|
4
|
+
BlueprintMediaLibraryFunctionResourceEvent,
|
|
5
|
+
BlueprintScheduledFunctionResourceEvent,
|
|
6
|
+
BlueprintSyncTagInvalidateFunctionResourceEvent,
|
|
7
|
+
} from './event.js'
|
|
2
8
|
|
|
3
|
-
|
|
9
|
+
export * from './event.js'
|
|
4
10
|
|
|
5
11
|
/**
|
|
6
|
-
*
|
|
7
|
-
* @category Functions Types
|
|
8
|
-
*/
|
|
9
|
-
export interface BlueprintFunctionBaseResourceEvent {
|
|
10
|
-
/**
|
|
11
|
-
* Event types that trigger the function
|
|
12
|
-
* @defaultValue ['publish']
|
|
13
|
-
*/
|
|
14
|
-
on?: [BlueprintFunctionResourceEventName, ...BlueprintFunctionResourceEventName[]]
|
|
15
|
-
/** GROQ filter expression to match specific documents (e.g., "_type == 'post'") */
|
|
16
|
-
filter?: string
|
|
17
|
-
/** GROQ projection to specify which fields to include (e.g., "{_id, title, slug}") */
|
|
18
|
-
projection?: `{${string}}`
|
|
19
|
-
/** Include draft documents in addition to published documents */
|
|
20
|
-
includeDrafts?: boolean
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Event configuration for document functions
|
|
25
|
-
* @category Functions Types
|
|
26
|
-
*/
|
|
27
|
-
export interface BlueprintDocumentFunctionResourceEvent extends BlueprintFunctionBaseResourceEvent {
|
|
28
|
-
/** Include all versions of documents, not just the current version */
|
|
29
|
-
includeAllVersions?: boolean
|
|
30
|
-
/** Optional dataset resource scoping for the function */
|
|
31
|
-
resource?: BlueprintFunctionResourceEventResourceDataset
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* Event configuration for media library asset functions
|
|
36
|
-
* @category Functions Types
|
|
37
|
-
*/
|
|
38
|
-
export interface BlueprintMediaLibraryFunctionResourceEvent extends BlueprintFunctionBaseResourceEvent {
|
|
39
|
-
/** Media library resource scoping (required for media library functions) */
|
|
40
|
-
resource: BlueprintFunctionResourceEventResourceMediaLibrary
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* Union type of all function resource event configurations
|
|
45
|
-
* @category Functions Types
|
|
46
|
-
*/
|
|
47
|
-
export type BlueprintFunctionResourceEvent = BlueprintDocumentFunctionResourceEvent | BlueprintMediaLibraryFunctionResourceEvent
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* Explicit resource event for scheduled functions to specific minutes, hours, days of month, months, and days of week
|
|
51
|
-
* @example { minute: '0', hour: '9', dayOfMonth: '1', month: '1', dayOfWeek: '1' }
|
|
52
|
-
* @category Functions Types
|
|
53
|
-
*/
|
|
54
|
-
export interface BlueprintScheduledFunctionExplicitResourceEvent {
|
|
55
|
-
minute: string
|
|
56
|
-
hour: string
|
|
57
|
-
dayOfMonth: string
|
|
58
|
-
month: string
|
|
59
|
-
dayOfWeek: string
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* Expression resource for scheduled functions to specific expressions
|
|
64
|
-
* @example { expression: '0 9 * * *' }
|
|
65
|
-
* @category Functions Types
|
|
66
|
-
*/
|
|
67
|
-
export interface BlueprintScheduledFunctionExpressionResourceEvent {
|
|
68
|
-
expression: string
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* Union type of all scheduled function resource event configurations
|
|
73
|
-
* @category Functions Types
|
|
74
|
-
*/
|
|
75
|
-
export type BlueprintScheduledFunctionResourceEvent =
|
|
76
|
-
| BlueprintScheduledFunctionExplicitResourceEvent
|
|
77
|
-
| BlueprintScheduledFunctionExpressionResourceEvent
|
|
78
|
-
|
|
79
|
-
/**
|
|
80
|
-
* Dataset resource for scoping document functions to specific datasets
|
|
81
|
-
* @example { type: 'dataset', id: 'my-project.production' }
|
|
82
|
-
* @category Functions Types
|
|
83
|
-
*/
|
|
84
|
-
export interface BlueprintFunctionResourceEventResourceDataset {
|
|
85
|
-
type: 'dataset'
|
|
86
|
-
/** A dataset ID in the format <projectId>.<datasetName>. <datasetName> can be `*` to signify "all datasets in project with ID <projectId>." */
|
|
87
|
-
id: string
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
/**
|
|
91
|
-
* Media library resource for scoping media library functions
|
|
92
|
-
* @category Functions Types
|
|
93
|
-
*/
|
|
94
|
-
export interface BlueprintFunctionResourceEventResourceMediaLibrary {
|
|
95
|
-
type: 'media-library'
|
|
96
|
-
id: string
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
/**
|
|
100
|
-
* Events that can trigger a function
|
|
101
|
-
* @category Functions Types
|
|
102
|
-
*/
|
|
103
|
-
export type BlueprintFunctionResourceEventName = 'publish' | 'create' | 'delete' | 'update'
|
|
104
|
-
|
|
105
|
-
/**
|
|
106
|
-
* Current support Function runtimes
|
|
12
|
+
* Supported Function runtimes
|
|
107
13
|
* @category Functions Types
|
|
108
14
|
*/
|
|
109
15
|
export const VALID_RUNTIMES = ['node', 'nodejs22.x', 'nodejs24.x'] as const
|
|
@@ -176,6 +82,15 @@ export interface BlueprintScheduledFunctionResource extends BlueprintBaseFunctio
|
|
|
176
82
|
timezone?: string
|
|
177
83
|
}
|
|
178
84
|
|
|
85
|
+
/**
|
|
86
|
+
* A function resource triggered by sync tag invalidate events
|
|
87
|
+
* @category Functions Types
|
|
88
|
+
*/
|
|
89
|
+
export interface BlueprintSyncTagInvalidateFunctionResource extends BlueprintBaseFunctionResource {
|
|
90
|
+
type: 'sanity.function.sync-tag-invalidate'
|
|
91
|
+
event?: BlueprintSyncTagInvalidateFunctionResourceEvent
|
|
92
|
+
}
|
|
93
|
+
|
|
179
94
|
// --- Function Config Types ---
|
|
180
95
|
|
|
181
96
|
/**
|
|
@@ -240,3 +155,19 @@ export type BlueprintScheduledFunctionConfig = Omit<BlueprintScheduledFunctionRe
|
|
|
240
155
|
*/
|
|
241
156
|
src?: string
|
|
242
157
|
}
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* Configuration for defining a sync tag invalidate function.
|
|
161
|
+
* @public
|
|
162
|
+
* @alpha Deploying Sync Tag Invalidate Functions via Blueprints is experimental. This feature is not available publicly yet.
|
|
163
|
+
* @hidden
|
|
164
|
+
* @category Functions Types
|
|
165
|
+
* @interface
|
|
166
|
+
*/
|
|
167
|
+
export type BlueprintSyncTagInvalidateFunctionConfig = Omit<BlueprintSyncTagInvalidateFunctionResource, 'type' | 'src'> & {
|
|
168
|
+
/**
|
|
169
|
+
* Path to the function source code
|
|
170
|
+
* @defaultValue `functions/${name}`
|
|
171
|
+
*/
|
|
172
|
+
src?: string
|
|
173
|
+
}
|
|
@@ -151,14 +151,23 @@ function validateDocumentFunctionEvent(event: unknown): BlueprintError[] {
|
|
|
151
151
|
}
|
|
152
152
|
if (!Array.isArray(fullEvent.on)) errors.push({type: 'invalid_type', message: '`event.on` must be an array'})
|
|
153
153
|
if (fullEvent.resource) {
|
|
154
|
-
|
|
155
|
-
errors.push({type: 'invalid_value', message: '`event.resource.type` must be "dataset"'})
|
|
156
|
-
if (!fullEvent.resource.id || fullEvent.resource.id.split('.').length !== 2)
|
|
157
|
-
errors.push({type: 'invalid_format', message: '`event.resource.id` must be in the format <projectId>.<datasetName>'})
|
|
154
|
+
errors.push(...validateFunctionEventResourceDataset(fullEvent))
|
|
158
155
|
}
|
|
159
156
|
return errors
|
|
160
157
|
}
|
|
161
158
|
|
|
159
|
+
function validateFunctionEventResourceDataset(event: unknown): BlueprintError[] {
|
|
160
|
+
const errors: BlueprintError[] = []
|
|
161
|
+
if (!event || typeof event !== 'object') return [{type: 'invalid_value', message: '`event` must be an object'}]
|
|
162
|
+
if (!('resource' in event)) return [{type: 'invalid_value', message: '`event.resource` must exist'}]
|
|
163
|
+
const resource = event.resource
|
|
164
|
+
if (!resource || typeof resource !== 'object') return [{type: 'invalid_value', message: '`event.resource` must be an object'}]
|
|
165
|
+
if (!('type' in resource) || !resource.type || resource.type !== 'dataset')
|
|
166
|
+
errors.push({type: 'invalid_value', message: '`event.resource.type` must be "dataset"'})
|
|
167
|
+
if (!('id' in resource) || !resource.id || typeof resource.id !== 'string' || resource.id.split('.').length !== 2)
|
|
168
|
+
errors.push({type: 'invalid_format', message: '`event.resource.id` must be in the format <projectId>.<datasetName>'})
|
|
169
|
+
return errors
|
|
170
|
+
}
|
|
162
171
|
/**
|
|
163
172
|
* Validates a media library function event configuration.
|
|
164
173
|
* Checks event trigger types and ensures required media library resource is present.
|
|
@@ -319,3 +328,30 @@ function validateScheduledFunctionTimezone(timezone: unknown): BlueprintError[]
|
|
|
319
328
|
|
|
320
329
|
return errors
|
|
321
330
|
}
|
|
331
|
+
|
|
332
|
+
/**
|
|
333
|
+
* Validates a sync tag invalidate function resource configuration.
|
|
334
|
+
* @param functionResource The function resource to validate
|
|
335
|
+
* @alpha
|
|
336
|
+
* @hidden
|
|
337
|
+
* @category Functions Types
|
|
338
|
+
* @returns Array of validation errors, empty if valid
|
|
339
|
+
*/
|
|
340
|
+
export function validateSyncTagInvalidateFunction(functionResource: unknown): BlueprintError[] {
|
|
341
|
+
if (!functionResource) return [{type: 'invalid_value', message: 'Function config must be provided'}]
|
|
342
|
+
if (typeof functionResource !== 'object') return [{type: 'invalid_type', message: 'Function config must be an object'}]
|
|
343
|
+
|
|
344
|
+
const errors: BlueprintError[] = []
|
|
345
|
+
|
|
346
|
+
if ('type' in functionResource && functionResource.type !== 'sanity.function.sync-tag-invalidate') {
|
|
347
|
+
errors.push({type: 'invalid_value', message: '`type` must be `sanity.function.sync-tag-invalidate`'})
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
if ('event' in functionResource) {
|
|
351
|
+
errors.push(...validateFunctionEventResourceDataset(functionResource.event))
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
errors.push(...validateFunction(functionResource))
|
|
355
|
+
|
|
356
|
+
return errors
|
|
357
|
+
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"functions.js","sourceRoot":"","sources":["../../src/types/functions.ts"],"names":[],"mappings":"AAwGA;;;GAGG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,MAAM,EAAE,YAAY,EAAE,YAAY,CAAU,CAAA"}
|