@sanity/blueprints 0.13.1 → 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/definers/projects.d.ts +20 -2
- package/dist/definers/projects.js +22 -2
- package/dist/definers/projects.js.map +1 -1
- package/dist/definers/resources.d.ts +9 -1
- package/dist/definers/resources.js +22 -0
- package/dist/definers/resources.js.map +1 -1
- package/dist/definers/robotTokens.d.ts +19 -1
- package/dist/definers/robotTokens.js +21 -1
- package/dist/definers/robotTokens.js.map +1 -1
- package/dist/definers/roles.d.ts +19 -1
- package/dist/definers/roles.js +21 -1
- package/dist/definers/roles.js.map +1 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.js +5 -1
- package/dist/index.js.map +1 -1
- package/dist/types/datasets.d.ts +2 -0
- 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/types/resources.d.ts +35 -2
- package/dist/validation/datasets.js +6 -0
- package/dist/validation/datasets.js.map +1 -1
- package/dist/validation/functions.d.ts +9 -0
- package/dist/validation/functions.js +39 -4
- package/dist/validation/functions.js.map +1 -1
- package/dist/validation/resources.js +15 -1
- package/dist/validation/resources.js.map +1 -1
- package/package.json +1 -1
- package/src/definers/functions.ts +50 -0
- package/src/definers/projects.ts +30 -2
- package/src/definers/resources.ts +26 -1
- package/src/definers/robotTokens.ts +29 -1
- package/src/definers/roles.ts +24 -0
- package/src/index.ts +5 -1
- package/src/types/datasets.ts +2 -0
- package/src/types/functions/event.ts +114 -0
- package/src/types/{functions.ts → functions/index.ts} +34 -103
- package/src/types/resources.ts +40 -2
- package/src/validation/datasets.ts +7 -0
- package/src/validation/functions.ts +40 -4
- package/src/validation/resources.ts +13 -1
- 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,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E,IAAI,CAAC,SAAS,CAAC;QAChC,GAAG,UAAU;KACd,CAAA;IACD,OAAO,SAAS,CAAA;AAClB,CAAC;AAED;;;;;GAKG;AACH,SAAS,2BAA2B,CAAC,KAA8C;IACjF,OAAO,MAAM,CAAC,WAAW,CACvB,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,oBAAoB,CAAC,GAAG,CAAC,GAAgC,CAAC,CAAC,CACzD,CAAA;AAC9C,CAAC;AAED;;;;GAIG;AACH,SAAS,yBAAyB,CAAC,IAAY;IAC7C,MAAM,KAAK,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAAA;IACtC,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACvB,MAAM,IAAI,KAAK,CAAC,+CAA+C,KAAK,CAAC,MAAM,EAAE,CAAC,CAAA;IAChF,CAAC;IACD,MAAM,CAAC,MAAM,EAAE,IAAI,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"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type BlueprintProjectConfig, type BlueprintProjectResource } from '../index.js';
|
|
1
|
+
import { type BlueprintCrossStackReferenceConfig, type BlueprintProjectConfig, type BlueprintProjectResource, type BlueprintResource } from '../index.js';
|
|
2
2
|
/**
|
|
3
3
|
* Defines a project.
|
|
4
4
|
*
|
|
@@ -13,7 +13,25 @@ import { type BlueprintProjectConfig, type BlueprintProjectResource } from '../i
|
|
|
13
13
|
* @beta Deploying Projects via Blueprints is experimental. This feature is stabilizing but may still be subject to breaking changes.
|
|
14
14
|
* @category Definers
|
|
15
15
|
* @expandType BlueprintProjectConfig
|
|
16
|
-
* @returns The
|
|
16
|
+
* @returns The project resource
|
|
17
17
|
* @hidden
|
|
18
18
|
*/
|
|
19
19
|
export declare function defineProject(parameters: BlueprintProjectConfig): BlueprintProjectResource;
|
|
20
|
+
/**
|
|
21
|
+
* Creates a reference to a project in another stack.
|
|
22
|
+
*
|
|
23
|
+
* ```ts
|
|
24
|
+
* referenceProject({
|
|
25
|
+
* name: 'editorial-project',
|
|
26
|
+
* stack: 'editorial',
|
|
27
|
+
* })
|
|
28
|
+
* ```
|
|
29
|
+
*
|
|
30
|
+
* @param params The parameters for referencing the project
|
|
31
|
+
* @public
|
|
32
|
+
* @beta Referencing Projects via Blueprints is experimental. This feature is stabilizing but may still be subject to breaking changes.
|
|
33
|
+
* @category Referencers
|
|
34
|
+
* @returns The project reference
|
|
35
|
+
* @hidden
|
|
36
|
+
*/
|
|
37
|
+
export declare function referenceProject({ name, stack, localName }: BlueprintCrossStackReferenceConfig): BlueprintResource;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { validateProject } from '../index.js';
|
|
1
|
+
import { referenceResource, validateProject, } from '../index.js';
|
|
2
2
|
import { runValidation } from '../utils/validation.js';
|
|
3
3
|
/**
|
|
4
4
|
* Defines a project.
|
|
@@ -14,7 +14,7 @@ import { runValidation } from '../utils/validation.js';
|
|
|
14
14
|
* @beta Deploying Projects via Blueprints is experimental. This feature is stabilizing but may still be subject to breaking changes.
|
|
15
15
|
* @category Definers
|
|
16
16
|
* @expandType BlueprintProjectConfig
|
|
17
|
-
* @returns The
|
|
17
|
+
* @returns The project resource
|
|
18
18
|
* @hidden
|
|
19
19
|
*/
|
|
20
20
|
export function defineProject(parameters) {
|
|
@@ -28,4 +28,24 @@ export function defineProject(parameters) {
|
|
|
28
28
|
runValidation(() => validateProject(projectResource));
|
|
29
29
|
return projectResource;
|
|
30
30
|
}
|
|
31
|
+
/**
|
|
32
|
+
* Creates a reference to a project in another stack.
|
|
33
|
+
*
|
|
34
|
+
* ```ts
|
|
35
|
+
* referenceProject({
|
|
36
|
+
* name: 'editorial-project',
|
|
37
|
+
* stack: 'editorial',
|
|
38
|
+
* })
|
|
39
|
+
* ```
|
|
40
|
+
*
|
|
41
|
+
* @param params The parameters for referencing the project
|
|
42
|
+
* @public
|
|
43
|
+
* @beta Referencing Projects via Blueprints is experimental. This feature is stabilizing but may still be subject to breaking changes.
|
|
44
|
+
* @category Referencers
|
|
45
|
+
* @returns The project reference
|
|
46
|
+
* @hidden
|
|
47
|
+
*/
|
|
48
|
+
export function referenceProject({ name, stack, localName }) {
|
|
49
|
+
return referenceResource({ name, stack, localName, type: 'sanity.project' });
|
|
50
|
+
}
|
|
31
51
|
//# sourceMappingURL=projects.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"projects.js","sourceRoot":"","sources":["../../src/definers/projects.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"projects.js","sourceRoot":"","sources":["../../src/definers/projects.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,iBAAiB,EACjB,eAAe,GAChB,MAAM,aAAa,CAAA;AACpB,OAAO,EAAC,aAAa,EAAC,MAAM,wBAAwB,CAAA;AAEpD;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,aAAa,CAAC,UAAkC;IAC9D,uBAAuB;IACvB,MAAM,WAAW,GAAG,UAAU,CAAC,WAAW,IAAI,UAAU,CAAC,IAAI,CAAA;IAE7D,MAAM,eAAe,GAA6B;QAChD,GAAG,UAAU;QACb,WAAW;QACX,IAAI,EAAE,gBAAgB;KACvB,CAAA;IAED,aAAa,CAAC,GAAG,EAAE,CAAC,eAAe,CAAC,eAAe,CAAC,CAAC,CAAA;IAErD,OAAO,eAAe,CAAA;AACxB,CAAC;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,gBAAgB,CAAC,EAAC,IAAI,EAAE,KAAK,EAAE,SAAS,EAAqC;IAC3F,OAAO,iBAAiB,CAAC,EAAC,IAAI,EAAE,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,gBAAgB,EAAC,CAAC,CAAA;AAC5E,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type BlueprintResource } from '../index.js';
|
|
1
|
+
import { type BlueprintCrossStackReferenceResourceConfig, type BlueprintResource } from '../index.js';
|
|
2
2
|
/**
|
|
3
3
|
* Defines a generic resource to be managed in Blueprints.
|
|
4
4
|
*
|
|
@@ -17,3 +17,11 @@ import { type BlueprintResource } from '../index.js';
|
|
|
17
17
|
* @internal
|
|
18
18
|
*/
|
|
19
19
|
export declare function defineResource(resourceConfig: Partial<BlueprintResource>): BlueprintResource;
|
|
20
|
+
/**
|
|
21
|
+
* Creates a reference to a resource in another stack
|
|
22
|
+
* @param params The parameters for referencing the resource
|
|
23
|
+
* @category Definers
|
|
24
|
+
* @expandType BlueprintCrossStackReferenceResourceConfig
|
|
25
|
+
* @internal
|
|
26
|
+
*/
|
|
27
|
+
export declare function referenceResource({ name, type, stack, localName }: BlueprintCrossStackReferenceResourceConfig): BlueprintResource;
|
|
@@ -34,4 +34,26 @@ export function defineResource(resourceConfig) {
|
|
|
34
34
|
assertResource(resource);
|
|
35
35
|
return resource;
|
|
36
36
|
}
|
|
37
|
+
/**
|
|
38
|
+
* Creates a reference to a resource in another stack
|
|
39
|
+
* @param params The parameters for referencing the resource
|
|
40
|
+
* @category Definers
|
|
41
|
+
* @expandType BlueprintCrossStackReferenceResourceConfig
|
|
42
|
+
* @internal
|
|
43
|
+
*/
|
|
44
|
+
export function referenceResource({ name, type, stack, localName }) {
|
|
45
|
+
const resource = {
|
|
46
|
+
type,
|
|
47
|
+
name: localName || name,
|
|
48
|
+
lifecycle: {
|
|
49
|
+
ownershipAction: {
|
|
50
|
+
type: 'reference',
|
|
51
|
+
stack,
|
|
52
|
+
name,
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
};
|
|
56
|
+
assertResource(resource);
|
|
57
|
+
return resource;
|
|
58
|
+
}
|
|
37
59
|
//# sourceMappingURL=resources.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resources.js","sourceRoot":"","sources":["../../src/definers/resources.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,cAAc,
|
|
1
|
+
{"version":3,"file":"resources.js","sourceRoot":"","sources":["../../src/definers/resources.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,cAAc,EAA0E,MAAM,aAAa,CAAA;AAEnH;;;;;;;;;;GAUG;AACH;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,cAAc,CAAC,cAA0C;IACvE,MAAM,QAAQ,GAAG;QACf,GAAG,cAAc;KAClB,CAAA;IAED,cAAc,CAAC,QAAQ,CAAC,CAAA;IAExB,OAAO,QAAQ,CAAA;AACjB,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,iBAAiB,CAAC,EAAC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,SAAS,EAA6C;IAC1G,MAAM,QAAQ,GAAG;QACf,IAAI;QACJ,IAAI,EAAE,SAAS,IAAI,IAAI;QACvB,SAAS,EAAE;YACT,eAAe,EAAE;gBACf,IAAI,EAAE,WAAoB;gBAC1B,KAAK;gBACL,IAAI;aACL;SACF;KACF,CAAA;IAED,cAAc,CAAC,QAAQ,CAAC,CAAA;IAExB,OAAO,QAAQ,CAAA;AACjB,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type BlueprintRobotTokenConfig, type BlueprintRobotTokenResource } from '../index.js';
|
|
1
|
+
import { type BlueprintCrossStackReferenceConfig, type BlueprintResource, type BlueprintRobotTokenConfig, type BlueprintRobotTokenResource } from '../index.js';
|
|
2
2
|
/**
|
|
3
3
|
* Defines a Robot Token for automated access. Has a token property provided during deployment that can be referenced by other resources.
|
|
4
4
|
*
|
|
@@ -20,3 +20,21 @@ import { type BlueprintRobotTokenConfig, type BlueprintRobotTokenResource } from
|
|
|
20
20
|
* @returns The robot token resource
|
|
21
21
|
*/
|
|
22
22
|
export declare function defineRobotToken(parameters: BlueprintRobotTokenConfig): BlueprintRobotTokenResource;
|
|
23
|
+
/**
|
|
24
|
+
* Creates a reference to a robot token in another stack.
|
|
25
|
+
*
|
|
26
|
+
* ```ts
|
|
27
|
+
* referenceRobotToken({
|
|
28
|
+
* name: 'editor-token',
|
|
29
|
+
* stack: 'editorial',
|
|
30
|
+
* })
|
|
31
|
+
* ```
|
|
32
|
+
*
|
|
33
|
+
* @public
|
|
34
|
+
* @beta Referencing Robot Tokens via Blueprints is experimental. This feature is stabilizing but may still be subject to breaking changes.
|
|
35
|
+
* @category Referencers
|
|
36
|
+
* @expandType BlueprintCrossStackReferenceConfig
|
|
37
|
+
* @param params The parameters for referencing the robot token
|
|
38
|
+
* @returns The robot token reference
|
|
39
|
+
*/
|
|
40
|
+
export declare function referenceRobotToken({ name, stack, localName }: BlueprintCrossStackReferenceConfig): BlueprintResource;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { validateRobotToken } from '../index.js';
|
|
1
|
+
import { referenceResource, validateRobotToken, } from '../index.js';
|
|
2
2
|
import { runValidation } from '../utils/validation.js';
|
|
3
3
|
/*
|
|
4
4
|
* FUTURE example (move below @example when ready)
|
|
@@ -50,4 +50,24 @@ export function defineRobotToken(parameters) {
|
|
|
50
50
|
runValidation(() => validateRobotToken(robotResource));
|
|
51
51
|
return robotResource;
|
|
52
52
|
}
|
|
53
|
+
/**
|
|
54
|
+
* Creates a reference to a robot token in another stack.
|
|
55
|
+
*
|
|
56
|
+
* ```ts
|
|
57
|
+
* referenceRobotToken({
|
|
58
|
+
* name: 'editor-token',
|
|
59
|
+
* stack: 'editorial',
|
|
60
|
+
* })
|
|
61
|
+
* ```
|
|
62
|
+
*
|
|
63
|
+
* @public
|
|
64
|
+
* @beta Referencing Robot Tokens via Blueprints is experimental. This feature is stabilizing but may still be subject to breaking changes.
|
|
65
|
+
* @category Referencers
|
|
66
|
+
* @expandType BlueprintCrossStackReferenceConfig
|
|
67
|
+
* @param params The parameters for referencing the robot token
|
|
68
|
+
* @returns The robot token reference
|
|
69
|
+
*/
|
|
70
|
+
export function referenceRobotToken({ name, stack, localName }) {
|
|
71
|
+
return referenceResource({ name, stack, localName, type: 'sanity.access.robot' });
|
|
72
|
+
}
|
|
53
73
|
//# sourceMappingURL=robotTokens.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"robotTokens.js","sourceRoot":"","sources":["../../src/definers/robotTokens.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"robotTokens.js","sourceRoot":"","sources":["../../src/definers/robotTokens.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,iBAAiB,EACjB,kBAAkB,GACnB,MAAM,aAAa,CAAA;AACpB,OAAO,EAAC,aAAa,EAAC,MAAM,wBAAwB,CAAA;AAEpD;;;;;;;;;;;;;;;;;;;GAmBG;AACH;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,UAAU,gBAAgB,CAAC,UAAqC;IACpE,MAAM,KAAK,GAAG,UAAU,CAAC,KAAK,IAAI,UAAU,CAAC,IAAI,CAAA;IAEjD,MAAM,aAAa,GAAgC;QACjD,GAAG,UAAU;QACb,KAAK;QACL,IAAI,EAAE,qBAAqB;KAC5B,CAAA;IAED,aAAa,CAAC,GAAG,EAAE,CAAC,kBAAkB,CAAC,aAAa,CAAC,CAAC,CAAA;IAEtD,OAAO,aAAa,CAAA;AACtB,CAAC;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,mBAAmB,CAAC,EAAC,IAAI,EAAE,KAAK,EAAE,SAAS,EAAqC;IAC9F,OAAO,iBAAiB,CAAC,EAAC,IAAI,EAAE,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,qBAAqB,EAAC,CAAC,CAAA;AACjF,CAAC"}
|
package/dist/definers/roles.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type BlueprintProjectRoleResource, type BlueprintRoleConfig, type BlueprintRoleResource } from '../index.js';
|
|
1
|
+
import { type BlueprintCrossStackReferenceConfig, type BlueprintProjectRoleResource, type BlueprintResource, type BlueprintRoleConfig, type BlueprintRoleResource } from '../index.js';
|
|
2
2
|
/**
|
|
3
3
|
* Defines a role that is scoped to the same resource as the blueprint.
|
|
4
4
|
*
|
|
@@ -47,3 +47,21 @@ export declare function defineRole(parameters: BlueprintRoleConfig, options?: {
|
|
|
47
47
|
* @returns The role resource
|
|
48
48
|
*/
|
|
49
49
|
export declare function defineProjectRole(projectId: string, parameters: BlueprintRoleConfig): BlueprintProjectRoleResource;
|
|
50
|
+
/**
|
|
51
|
+
* Creates a reference to a role in another stack.
|
|
52
|
+
*
|
|
53
|
+
* ```ts
|
|
54
|
+
* referenceRole({
|
|
55
|
+
* name: 'editor-role',
|
|
56
|
+
* stack: 'editorial',
|
|
57
|
+
* })
|
|
58
|
+
* ```
|
|
59
|
+
*
|
|
60
|
+
* @public
|
|
61
|
+
* @beta Referencing Roles via Blueprints is experimental. This feature is stabilizing but may still be subject to breaking changes.
|
|
62
|
+
* @category Referencers
|
|
63
|
+
* @expandType BlueprintCrossStackReferenceConfig
|
|
64
|
+
* @param params The parameters for referencing the role
|
|
65
|
+
* @returns The role reference
|
|
66
|
+
*/
|
|
67
|
+
export declare function referenceRole({ name, stack, localName }: BlueprintCrossStackReferenceConfig): BlueprintResource;
|
package/dist/definers/roles.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { validateProjectRole, validateRole, } from '../index.js';
|
|
1
|
+
import { referenceResource, validateProjectRole, validateRole, } from '../index.js';
|
|
2
2
|
import { runValidation } from '../utils/validation.js';
|
|
3
3
|
/*
|
|
4
4
|
* FUTURE example (move below @example when ready)
|
|
@@ -121,4 +121,24 @@ export function defineProjectRole(projectId, parameters) {
|
|
|
121
121
|
runValidation(() => validateProjectRole(projectRoleResource));
|
|
122
122
|
return projectRoleResource;
|
|
123
123
|
}
|
|
124
|
+
/**
|
|
125
|
+
* Creates a reference to a role in another stack.
|
|
126
|
+
*
|
|
127
|
+
* ```ts
|
|
128
|
+
* referenceRole({
|
|
129
|
+
* name: 'editor-role',
|
|
130
|
+
* stack: 'editorial',
|
|
131
|
+
* })
|
|
132
|
+
* ```
|
|
133
|
+
*
|
|
134
|
+
* @public
|
|
135
|
+
* @beta Referencing Roles via Blueprints is experimental. This feature is stabilizing but may still be subject to breaking changes.
|
|
136
|
+
* @category Referencers
|
|
137
|
+
* @expandType BlueprintCrossStackReferenceConfig
|
|
138
|
+
* @param params The parameters for referencing the role
|
|
139
|
+
* @returns The role reference
|
|
140
|
+
*/
|
|
141
|
+
export function referenceRole({ name, stack, localName }) {
|
|
142
|
+
return referenceResource({ name, stack, localName, type: 'sanity.access.role' });
|
|
143
|
+
}
|
|
124
144
|
//# sourceMappingURL=roles.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"roles.js","sourceRoot":"","sources":["../../src/definers/roles.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"roles.js","sourceRoot":"","sources":["../../src/definers/roles.ts"],"names":[],"mappings":"AAAA,OAAO,EAML,iBAAiB,EACjB,mBAAmB,EACnB,YAAY,GACb,MAAM,aAAa,CAAA;AACpB,OAAO,EAAC,aAAa,EAAC,MAAM,wBAAwB,CAAA;AAEpD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,UAAU,UAAU,CAAC,UAA+B,EAAE,OAAoC;IAC9F,MAAM,YAAY,GAA0B;QAC1C,IAAI,EAAE,UAAU,CAAC,IAAI;QACrB,IAAI,EAAE,oBAAoB;QAC1B,KAAK,EAAE,UAAU,CAAC,KAAK;QACvB,WAAW,EAAE,UAAU,CAAC,WAAW;QACnC,cAAc,EAAE,UAAU,CAAC,cAAc;QACzC,eAAe,EAAE,UAAU,CAAC,eAAe;QAC3C,WAAW,EAAE,UAAU,CAAC,WAAW;KACpC,CAAA;IAED,IAAI,UAAU,CAAC,SAAS,EAAE,CAAC;QACzB,YAAY,CAAC,SAAS,GAAG,UAAU,CAAC,SAAS,CAAA;IAC/C,CAAC;IAED,IAAI,OAAO,EAAE,cAAc,KAAK,IAAI;QAAE,aAAa,CAAC,GAAG,EAAE,CAAC,YAAY,CAAC,YAAY,CAAC,CAAC,CAAA;IAErF,OAAO,YAAY,CAAA;AACrB,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,UAAU,iBAAiB,CAAC,SAAiB,EAAE,UAA+B;IAClF,MAAM,YAAY,GAAG,UAAU,CAAC,UAAU,EAAE,EAAC,cAAc,EAAE,IAAI,EAAC,CAAC,CAAA;IAEnE,MAAM,mBAAmB,GAAiC;QACxD,GAAG,YAAY;QACf,YAAY,EAAE,SAAS;QACvB,UAAU,EAAE,SAAS;KACtB,CAAA;IAED,aAAa,CAAC,GAAG,EAAE,CAAC,mBAAmB,CAAC,mBAAmB,CAAC,CAAC,CAAA;IAE7D,OAAO,mBAAmB,CAAA;AAC5B,CAAC;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,aAAa,CAAC,EAAC,IAAI,EAAE,KAAK,EAAE,SAAS,EAAqC;IACxF,OAAO,iBAAiB,CAAC,EAAC,IAAI,EAAE,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,oBAAoB,EAAC,CAAC,CAAA;AAChF,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
* @categoryDescription Definers
|
|
3
3
|
* These functions are used to define resources in a Blueprint.
|
|
4
4
|
*/
|
|
5
|
+
/**
|
|
6
|
+
* @categoryDescription Referencers
|
|
7
|
+
* These functions are used to reference resources in another Blueprint.
|
|
8
|
+
*/
|
|
5
9
|
export * from './definers/blueprints.js';
|
|
6
10
|
export * from './definers/cors.js';
|
|
7
11
|
export * from './definers/datasets.js';
|
|
@@ -24,7 +28,7 @@ export * from './types/blueprints.js';
|
|
|
24
28
|
export * from './types/cors.js';
|
|
25
29
|
export * from './types/datasets.js';
|
|
26
30
|
export * from './types/errors.js';
|
|
27
|
-
export * from './types/functions.js';
|
|
31
|
+
export * from './types/functions/index.js';
|
|
28
32
|
export * from './types/projects.js';
|
|
29
33
|
export * from './types/resources.js';
|
|
30
34
|
export * from './types/robots.js';
|
package/dist/index.js
CHANGED
|
@@ -3,6 +3,10 @@
|
|
|
3
3
|
* @categoryDescription Definers
|
|
4
4
|
* These functions are used to define resources in a Blueprint.
|
|
5
5
|
*/
|
|
6
|
+
/**
|
|
7
|
+
* @categoryDescription Referencers
|
|
8
|
+
* These functions are used to reference resources in another Blueprint.
|
|
9
|
+
*/
|
|
6
10
|
export * from './definers/blueprints.js';
|
|
7
11
|
export * from './definers/cors.js';
|
|
8
12
|
export * from './definers/datasets.js';
|
|
@@ -26,7 +30,7 @@ export * from './types/blueprints.js';
|
|
|
26
30
|
export * from './types/cors.js';
|
|
27
31
|
export * from './types/datasets.js';
|
|
28
32
|
export * from './types/errors.js';
|
|
29
|
-
export * from './types/functions.js';
|
|
33
|
+
export * from './types/functions/index.js';
|
|
30
34
|
export * from './types/projects.js';
|
|
31
35
|
export * from './types/resources.js';
|
|
32
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,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"}
|
package/dist/types/datasets.d.ts
CHANGED
|
@@ -17,6 +17,8 @@ export interface BlueprintDatasetResource extends BlueprintResource<BlueprintPro
|
|
|
17
17
|
type: 'sanity.project.dataset';
|
|
18
18
|
/** The name of the dataset. Must be unique within a project. */
|
|
19
19
|
datasetName: string;
|
|
20
|
+
/** The dataset description */
|
|
21
|
+
description?: string;
|
|
20
22
|
/** The ACL mode to set for the new dataset. Defaults to public. */
|
|
21
23
|
aclMode?: AclMode;
|
|
22
24
|
/**
|
|
@@ -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"}
|