@sanity/blueprints 0.13.0 → 0.14.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.
Files changed (45) hide show
  1. package/dist/definers/functions.d.ts +14 -9
  2. package/dist/definers/functions.js +27 -20
  3. package/dist/definers/functions.js.map +1 -1
  4. package/dist/definers/projects.d.ts +20 -2
  5. package/dist/definers/projects.js +22 -2
  6. package/dist/definers/projects.js.map +1 -1
  7. package/dist/definers/resources.d.ts +9 -1
  8. package/dist/definers/resources.js +22 -0
  9. package/dist/definers/resources.js.map +1 -1
  10. package/dist/definers/robotTokens.d.ts +19 -1
  11. package/dist/definers/robotTokens.js +21 -1
  12. package/dist/definers/robotTokens.js.map +1 -1
  13. package/dist/definers/roles.d.ts +19 -1
  14. package/dist/definers/roles.js +21 -1
  15. package/dist/definers/roles.js.map +1 -1
  16. package/dist/index.d.ts +4 -0
  17. package/dist/index.js +4 -0
  18. package/dist/index.js.map +1 -1
  19. package/dist/types/datasets.d.ts +2 -0
  20. package/dist/types/functions.d.ts +12 -12
  21. package/dist/types/resources.d.ts +35 -2
  22. package/dist/utils/schedule-parser.d.ts +7 -7
  23. package/dist/utils/schedule-parser.js +9 -9
  24. package/dist/utils/schedule-parser.js.map +1 -1
  25. package/dist/validation/datasets.js +6 -0
  26. package/dist/validation/datasets.js.map +1 -1
  27. package/dist/validation/functions.d.ts +2 -2
  28. package/dist/validation/functions.js +11 -11
  29. package/dist/validation/functions.js.map +1 -1
  30. package/dist/validation/resources.js +15 -1
  31. package/dist/validation/resources.js.map +1 -1
  32. package/package.json +1 -1
  33. package/src/definers/functions.ts +39 -31
  34. package/src/definers/projects.ts +30 -2
  35. package/src/definers/resources.ts +26 -1
  36. package/src/definers/robotTokens.ts +29 -1
  37. package/src/definers/roles.ts +24 -0
  38. package/src/index.ts +4 -0
  39. package/src/types/datasets.ts +2 -0
  40. package/src/types/functions.ts +14 -14
  41. package/src/types/resources.ts +40 -2
  42. package/src/utils/schedule-parser.ts +9 -9
  43. package/src/validation/datasets.ts +7 -0
  44. package/src/validation/functions.ts +11 -11
  45. package/src/validation/resources.ts +13 -1
@@ -1,4 +1,4 @@
1
- import { type BlueprintBaseFunctionConfig, type BlueprintBaseFunctionResource, type BlueprintDocumentFunctionConfig, type BlueprintDocumentFunctionResource, type BlueprintDocumentFunctionResourceEvent, type BlueprintMediaLibraryAssetFunctionConfig, type BlueprintMediaLibraryAssetFunctionResource, type BlueprintScheduleFunctionConfig, type BlueprintScheduleFunctionResource } from '../index.js';
1
+ import { type BlueprintBaseFunctionConfig, type BlueprintBaseFunctionResource, type BlueprintDocumentFunctionConfig, type BlueprintDocumentFunctionResource, type BlueprintDocumentFunctionResourceEvent, type BlueprintMediaLibraryAssetFunctionConfig, type BlueprintMediaLibraryAssetFunctionResource, type BlueprintScheduledFunctionConfig, type BlueprintScheduledFunctionResource } from '../index.js';
2
2
  /**
3
3
  * Defines a function that is triggered by document events in Sanity datasets.
4
4
  *
@@ -53,7 +53,7 @@ export declare function defineMediaLibraryAssetFunction(functionConfig: Blueprin
53
53
  * @remarks
54
54
  * Using a cron expression:
55
55
  * ```ts
56
- * defineScheduleFunction({
56
+ * defineScheduledFunction({
57
57
  * name: 'daily-cleanup',
58
58
  * event: {expression: '0 9 * * *'},
59
59
  * })
@@ -61,7 +61,7 @@ export declare function defineMediaLibraryAssetFunction(functionConfig: Blueprin
61
61
  *
62
62
  * Using explicit cron fields:
63
63
  * ```ts
64
- * defineScheduleFunction({
64
+ * defineScheduledFunction({
65
65
  * name: 'daily-cleanup',
66
66
  * event: {minute: '0', hour: '9', dayOfMonth: '*', month: '*', dayOfWeek: '*'},
67
67
  * })
@@ -72,20 +72,25 @@ export declare function defineMediaLibraryAssetFunction(functionConfig: Blueprin
72
72
  * `'mon, wed, fri at 9am'`, `'first of the month at noon'`
73
73
  *
74
74
  * ```ts
75
- * defineScheduleFunction({
75
+ * defineScheduledFunction({
76
76
  * name: 'daily-cleanup',
77
77
  * event: {expression: 'every day at 9am'},
78
78
  * })
79
79
  * ```
80
80
  * @public
81
- * @alpha Deploying Schedule Functions via Blueprints is experimental. This feature is not available publicly yet.
81
+ * @alpha Deploying Scheduled Functions via Blueprints is experimental. This feature is not available publicly yet.
82
82
  * @hidden
83
83
  * @category Definers
84
- * @expandType BlueprintScheduleFunctionConfig
85
- * @param functionConfig The configuration for the schedule function
86
- * @returns The validated schedule function resource
84
+ * @expandType BlueprintScheduledFunctionConfig
85
+ * @param functionConfig The configuration for the scheduled function
86
+ * @returns The validated scheduled function resource
87
87
  */
88
- export declare function defineScheduleFunction(functionConfig: BlueprintScheduleFunctionConfig): BlueprintScheduleFunctionResource;
88
+ export declare function defineScheduledFunction(functionConfig: BlueprintScheduledFunctionConfig): BlueprintScheduledFunctionResource;
89
+ /**
90
+ * @deprecated Define scheduled functions using `defineScheduledFunction` instead
91
+ * @hidden
92
+ */
93
+ export declare function defineScheduleFunction(functionConfig: BlueprintScheduledFunctionConfig): BlueprintScheduledFunctionResource;
89
94
  /**
90
95
  * Defines a base function resource with common properties.
91
96
  *
@@ -1,10 +1,10 @@
1
- import { validateDocumentFunction, validateFunction, validateMediaLibraryAssetFunction, validateScheduleFunction, } from '../index.js';
2
- import { parseScheduleExpression } from '../utils/schedule-parser.js';
1
+ import { validateDocumentFunction, validateFunction, validateMediaLibraryAssetFunction, validateScheduledFunction, } from '../index.js';
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
- const SCHEDULE_EVENT_KEYS = new Set(['minute', 'hour', 'dayOfWeek', 'month', 'dayOfMonth', 'expression']);
7
+ const SCHEDULED_EVENT_KEYS = new Set(['minute', 'hour', 'dayOfWeek', 'month', 'dayOfMonth', 'expression']);
8
8
  export function defineDocumentFunction(functionConfig) {
9
9
  let { name, src, event, timeout, memory, env, robotToken, project, runtime, ...maybeEvent } = functionConfig;
10
10
  // event validation and normalization
@@ -99,7 +99,7 @@ export function defineMediaLibraryAssetFunction(functionConfig) {
99
99
  * @remarks
100
100
  * Using a cron expression:
101
101
  * ```ts
102
- * defineScheduleFunction({
102
+ * defineScheduledFunction({
103
103
  * name: 'daily-cleanup',
104
104
  * event: {expression: '0 9 * * *'},
105
105
  * })
@@ -107,7 +107,7 @@ export function defineMediaLibraryAssetFunction(functionConfig) {
107
107
  *
108
108
  * Using explicit cron fields:
109
109
  * ```ts
110
- * defineScheduleFunction({
110
+ * defineScheduledFunction({
111
111
  * name: 'daily-cleanup',
112
112
  * event: {minute: '0', hour: '9', dayOfMonth: '*', month: '*', dayOfWeek: '*'},
113
113
  * })
@@ -118,36 +118,43 @@ export function defineMediaLibraryAssetFunction(functionConfig) {
118
118
  * `'mon, wed, fri at 9am'`, `'first of the month at noon'`
119
119
  *
120
120
  * ```ts
121
- * defineScheduleFunction({
121
+ * defineScheduledFunction({
122
122
  * name: 'daily-cleanup',
123
123
  * event: {expression: 'every day at 9am'},
124
124
  * })
125
125
  * ```
126
126
  * @public
127
- * @alpha Deploying Schedule Functions via Blueprints is experimental. This feature is not available publicly yet.
127
+ * @alpha Deploying Scheduled Functions via Blueprints is experimental. This feature is not available publicly yet.
128
128
  * @hidden
129
129
  * @category Definers
130
- * @expandType BlueprintScheduleFunctionConfig
131
- * @param functionConfig The configuration for the schedule function
132
- * @returns The validated schedule function resource
130
+ * @expandType BlueprintScheduledFunctionConfig
131
+ * @param functionConfig The configuration for the scheduled function
132
+ * @returns The validated scheduled function resource
133
133
  */
134
- export function defineScheduleFunction(functionConfig) {
134
+ export function defineScheduledFunction(functionConfig) {
135
135
  const { event, timezone } = functionConfig;
136
136
  const functionResource = {
137
137
  ...defineFunction(functionConfig, { skipValidation: true }),
138
138
  type: 'sanity.function.cron',
139
- event: buildScheduleFunctionEvent(event),
139
+ event: buildScheduledFunctionEvent(event),
140
140
  };
141
141
  if (timezone)
142
142
  functionResource.timezone = timezone;
143
- runValidation(() => validateScheduleFunction(functionResource));
143
+ runValidation(() => validateScheduledFunction(functionResource));
144
144
  // Always normalize to explicit fields (minute, hour, dayOfWeek, month, dayOfMonth)
145
145
  if ('expression' in functionResource.event && functionResource.event.expression) {
146
- const cron = parseScheduleExpression(functionResource.event.expression);
146
+ const cron = parseScheduledExpression(functionResource.event.expression);
147
147
  functionResource.event = cronStringToExplicitEvent(cron);
148
148
  }
149
149
  return functionResource;
150
150
  }
151
+ /**
152
+ * @deprecated Define scheduled functions using `defineScheduledFunction` instead
153
+ * @hidden
154
+ */
155
+ export function defineScheduleFunction(functionConfig) {
156
+ return defineScheduledFunction(functionConfig);
157
+ }
151
158
  /**
152
159
  * Defines a base function resource with common properties.
153
160
  *
@@ -206,18 +213,18 @@ function buildMediaLibraryFunctionEvent(event) {
206
213
  return fullEvent;
207
214
  }
208
215
  /**
209
- * Builds a schedule function event configuration.
216
+ * Builds a scheduled function event configuration.
210
217
  * Filters out non-event properties. Does not parse expressions.
211
- * @param event Schedule function event configuration
212
- * @returns Cleaned schedule function event configuration
218
+ * @param event Scheduled function event configuration
219
+ * @returns Cleaned scheduled function event configuration
213
220
  */
214
- function buildScheduleFunctionEvent(event) {
215
- return Object.fromEntries(Object.entries(event).filter(([key]) => SCHEDULE_EVENT_KEYS.has(key)));
221
+ function buildScheduledFunctionEvent(event) {
222
+ return Object.fromEntries(Object.entries(event).filter(([key]) => SCHEDULED_EVENT_KEYS.has(key)));
216
223
  }
217
224
  /**
218
225
  * Converts a cron expression string (minute hour dayOfMonth month dayOfWeek) to explicit event fields.
219
226
  * @param cron Cron string with five space-separated fields
220
- * @returns Explicit schedule event with minute, hour, dayOfMonth, month, dayOfWeek
227
+ * @returns Explicit scheduled event with minute, hour, dayOfMonth, month, dayOfWeek
221
228
  */
222
229
  function cronStringToExplicitEvent(cron) {
223
230
  const parts = cron.trim().split(/\s+/);
@@ -1 +1 @@
1
- {"version":3,"file":"functions.js","sourceRoot":"","sources":["../../src/definers/functions.ts"],"names":[],"mappings":"AAAA,OAAO,EAeL,wBAAwB,EACxB,gBAAgB,EAChB,iCAAiC,EACjC,wBAAwB,GACzB,MAAM,aAAa,CAAA;AACpB,OAAO,EAAC,uBAAuB,EAAC,MAAM,6BAA6B,CAAA;AACnE,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,mBAAmB,GAAG,IAAI,GAAG,CAA2B,CAAC,QAAQ,EAAE,MAAM,EAAE,WAAW,EAAE,OAAO,EAAE,YAAY,EAAE,YAAY,CAAC,CAAC,CAAA;AAmEnI,MAAM,UAAU,sBAAsB,CACpC,cAAiG;IAEjG,IAAI,EAAC,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,UAAU,EAAC,GAAG,cAAc,CAAA;IAE1G,qCAAqC;IACrC,IAAI,KAAK,EAAE,CAAC;QACV,2IAA2I;QAC3I,MAAM,aAAa,GAAG,KAAK,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAA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IAE/C,MAAM,SAAS,GAAG;QAChB,EAAE,EAAE,UAAU,CAAC,EAAE,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 robot token resource
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 robot token resource
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,EAA6D,eAAe,EAAC,MAAM,aAAa,CAAA;AACvG,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"}
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,EAAyB,MAAM,aAAa,CAAA;AAElE;;;;;;;;;;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"}
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,EAAmE,kBAAkB,EAAC,MAAM,aAAa,CAAA;AAChH,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"}
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"}
@@ -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;
@@ -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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B,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';
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';
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;;;G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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"}
@@ -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
  /**
@@ -40,11 +40,11 @@ export interface BlueprintMediaLibraryFunctionResourceEvent extends BlueprintFun
40
40
  */
41
41
  export type BlueprintFunctionResourceEvent = BlueprintDocumentFunctionResourceEvent | BlueprintMediaLibraryFunctionResourceEvent;
42
42
  /**
43
- * Explicit resource event for schedule functions to specific minutes, hours, days of month, months, and days of week
43
+ * Explicit resource event for scheduled functions to specific minutes, hours, days of month, months, and days of week
44
44
  * @example { minute: '0', hour: '9', dayOfMonth: '1', month: '1', dayOfWeek: '1' }
45
45
  * @category Functions Types
46
46
  */
47
- export interface BlueprintScheduleFunctionExplicitResourceEvent {
47
+ export interface BlueprintScheduledFunctionExplicitResourceEvent {
48
48
  minute: string;
49
49
  hour: string;
50
50
  dayOfMonth: string;
@@ -52,18 +52,18 @@ export interface BlueprintScheduleFunctionExplicitResourceEvent {
52
52
  dayOfWeek: string;
53
53
  }
54
54
  /**
55
- * Expression resource for schedule functions to specific expressions
55
+ * Expression resource for scheduled functions to specific expressions
56
56
  * @example { expression: '0 9 * * *' }
57
57
  * @category Functions Types
58
58
  */
59
- export interface BlueprintScheduleFunctionExpressionResourceEvent {
59
+ export interface BlueprintScheduledFunctionExpressionResourceEvent {
60
60
  expression: string;
61
61
  }
62
62
  /**
63
- * Union type of all schedule function resource event configurations
63
+ * Union type of all scheduled function resource event configurations
64
64
  * @category Functions Types
65
65
  */
66
- export type BlueprintScheduleFunctionResourceEvent = BlueprintScheduleFunctionExplicitResourceEvent | BlueprintScheduleFunctionExpressionResourceEvent;
66
+ export type BlueprintScheduledFunctionResourceEvent = BlueprintScheduledFunctionExplicitResourceEvent | BlueprintScheduledFunctionExpressionResourceEvent;
67
67
  /**
68
68
  * Dataset resource for scoping document functions to specific datasets
69
69
  * @example { type: 'dataset', id: 'my-project.production' }
@@ -144,12 +144,12 @@ export interface BlueprintMediaLibraryAssetFunctionResource extends BlueprintBas
144
144
  event: BlueprintMediaLibraryFunctionResourceEvent;
145
145
  }
146
146
  /**
147
- * A function resource triggered by schedule events
147
+ * A function resource triggered by scheduled events
148
148
  * @category Functions Types
149
149
  */
150
- export interface BlueprintScheduleFunctionResource extends BlueprintBaseFunctionResource {
150
+ export interface BlueprintScheduledFunctionResource extends BlueprintBaseFunctionResource {
151
151
  type: 'sanity.function.cron';
152
- event: BlueprintScheduleFunctionResourceEvent;
152
+ event: BlueprintScheduledFunctionResourceEvent;
153
153
  timezone?: string;
154
154
  }
155
155
  /**
@@ -197,14 +197,14 @@ export type BlueprintMediaLibraryAssetFunctionConfig = Omit<BlueprintMediaLibrar
197
197
  src?: string;
198
198
  };
199
199
  /**
200
- * Configuration for defining a schedule function.
200
+ * Configuration for defining a scheduled function.
201
201
  * @public
202
- * @alpha Deploying Schedule Functions via Blueprints is experimental. This feature is not available publicly yet.
202
+ * @alpha Deploying Scheduled Functions via Blueprints is experimental. This feature is not available publicly yet.
203
203
  * @hidden
204
204
  * @category Functions Types
205
205
  * @interface
206
206
  */
207
- export type BlueprintScheduleFunctionConfig = Omit<BlueprintScheduleFunctionResource, 'type' | 'src'> & {
207
+ export type BlueprintScheduledFunctionConfig = Omit<BlueprintScheduledFunctionResource, 'type' | 'src'> & {
208
208
  /**
209
209
  * Path to the function source code
210
210
  * @defaultValue `functions/${name}`
@@ -24,12 +24,25 @@ export interface BlueprintOwnershipAttachAction {
24
24
  export interface BlueprintOwnershipDetachAction {
25
25
  type: 'detach';
26
26
  }
27
+ /**
28
+ * An ownership action that will cause the resource to be read during deployment so it can be referenced
29
+ * by other resources. Note that referenced resources must be in the same project or organization as the
30
+ * current stack.
31
+ * @category Blueprint Internals
32
+ */
33
+ export interface BlueprintOwnershipReferenceAction {
34
+ type: 'reference';
35
+ /** The name or id of the stack where the resource is attached */
36
+ stack: string;
37
+ /** The name of the resource to be referenced */
38
+ name: string;
39
+ }
27
40
  /**
28
41
  * A union of all possible ownership actions.
29
42
  * @category Blueprint Internals
30
43
  * @expand
31
44
  */
32
- export type BlueprintOwnershipAction = BlueprintOwnershipAttachAction | BlueprintOwnershipDetachAction;
45
+ export type BlueprintOwnershipAction = BlueprintOwnershipAttachAction | BlueprintOwnershipDetachAction | BlueprintOwnershipReferenceAction;
33
46
  /**
34
47
  * An ownership action that will cause the referenced project-contained resource to be attached to the current stack.
35
48
  * @category Blueprint Internals
@@ -43,7 +56,7 @@ export interface BlueprintProjectOwnershipAttachAction extends BlueprintOwnershi
43
56
  * @category Blueprint Internals
44
57
  * @expand
45
58
  */
46
- export type BlueprintProjectOwnershipAction = BlueprintProjectOwnershipAttachAction | BlueprintOwnershipDetachAction;
59
+ export type BlueprintProjectOwnershipAction = BlueprintProjectOwnershipAttachAction | BlueprintOwnershipDetachAction | BlueprintOwnershipReferenceAction;
47
60
  /**
48
61
  * Defines the lifcycle policy for this resource.
49
62
  * @category Blueprint Internals
@@ -91,3 +104,23 @@ export interface BlueprintResource<Lifecycle extends BlueprintResourceLifecycle
91
104
  */
92
105
  lifecycle?: Lifecycle;
93
106
  }
107
+ /**
108
+ * The configuration for referencing a resource in another stack.
109
+ * @category Blueprint Internals
110
+ */
111
+ export interface BlueprintCrossStackReferenceConfig {
112
+ /** The name of the resource in the other stack */
113
+ name: string;
114
+ /** The name or id of the stack being referenced */
115
+ stack: string;
116
+ /** The local name of the resource, defaults to the name of the other resource */
117
+ localName?: string;
118
+ }
119
+ /**
120
+ * The configuration for referencing a resource in another stack including the type of resource.
121
+ * @category Blueprint Internals
122
+ */
123
+ export interface BlueprintCrossStackReferenceResourceConfig extends BlueprintCrossStackReferenceConfig {
124
+ /** The type of resource being referenced (e.g. `sanity.project`) */
125
+ type: string;
126
+ }