@sanity/blueprints 0.34.1 → 0.36.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 (164) hide show
  1. package/README.md +1 -2
  2. package/dist/definers/agents.d.ts +3 -1
  3. package/dist/definers/agents.js +4 -2
  4. package/dist/definers/agents.js.map +1 -1
  5. package/dist/definers/applications.d.ts +30 -18
  6. package/dist/definers/applications.js +36 -24
  7. package/dist/definers/applications.js.map +1 -1
  8. package/dist/definers/blueprints.d.ts +1 -0
  9. package/dist/definers/blueprints.js +5 -27
  10. package/dist/definers/blueprints.js.map +1 -1
  11. package/dist/definers/context.d.ts +6 -2
  12. package/dist/definers/context.js +8 -4
  13. package/dist/definers/context.js.map +1 -1
  14. package/dist/definers/cors.d.ts +11 -1
  15. package/dist/definers/cors.js +11 -13
  16. package/dist/definers/cors.js.map +1 -1
  17. package/dist/definers/datasets.d.ts +30 -3
  18. package/dist/definers/datasets.js +32 -16
  19. package/dist/definers/datasets.js.map +1 -1
  20. package/dist/definers/functions/document.d.ts +29 -0
  21. package/dist/definers/functions/document.js +1 -1
  22. package/dist/definers/functions/document.js.map +1 -1
  23. package/dist/definers/functions/durable.d.ts +4 -3
  24. package/dist/definers/functions/durable.js +5 -4
  25. package/dist/definers/functions/durable.js.map +1 -1
  26. package/dist/definers/functions/index.js +1 -1
  27. package/dist/definers/functions/index.js.map +1 -1
  28. package/dist/definers/functions/media-library.d.ts +30 -0
  29. package/dist/definers/functions/media-library.js +19 -21
  30. package/dist/definers/functions/media-library.js.map +1 -1
  31. package/dist/definers/functions/pubsub.d.ts +2 -3
  32. package/dist/definers/functions/pubsub.js +3 -4
  33. package/dist/definers/functions/pubsub.js.map +1 -1
  34. package/dist/definers/functions/queue.d.ts +26 -6
  35. package/dist/definers/functions/queue.js +31 -10
  36. package/dist/definers/functions/queue.js.map +1 -1
  37. package/dist/definers/functions/scheduled.d.ts +7 -6
  38. package/dist/definers/functions/scheduled.js +8 -7
  39. package/dist/definers/functions/scheduled.js.map +1 -1
  40. package/dist/definers/functions/sync-tag-invalidate.d.ts +5 -2
  41. package/dist/definers/functions/sync-tag-invalidate.js +6 -3
  42. package/dist/definers/functions/sync-tag-invalidate.js.map +1 -1
  43. package/dist/definers/installation-config.d.ts +4 -2
  44. package/dist/definers/installation-config.js +5 -3
  45. package/dist/definers/installation-config.js.map +1 -1
  46. package/dist/definers/permissions.d.ts +8 -2
  47. package/dist/definers/permissions.js +12 -5
  48. package/dist/definers/permissions.js.map +1 -1
  49. package/dist/definers/projects.d.ts +3 -4
  50. package/dist/definers/projects.js +4 -5
  51. package/dist/definers/projects.js.map +1 -1
  52. package/dist/definers/resources.d.ts +1 -0
  53. package/dist/definers/resources.js +1 -11
  54. package/dist/definers/resources.js.map +1 -1
  55. package/dist/definers/robotTokens.d.ts +22 -4
  56. package/dist/definers/robotTokens.js +53 -20
  57. package/dist/definers/robotTokens.js.map +1 -1
  58. package/dist/definers/roles.d.ts +49 -9
  59. package/dist/definers/roles.js +54 -55
  60. package/dist/definers/roles.js.map +1 -1
  61. package/dist/definers/studios.d.ts +5 -3
  62. package/dist/definers/studios.js +6 -4
  63. package/dist/definers/studios.js.map +1 -1
  64. package/dist/definers/webhooks.d.ts +19 -1
  65. package/dist/definers/webhooks.js +18 -22
  66. package/dist/definers/webhooks.js.map +1 -1
  67. package/dist/index.d.ts +18 -18
  68. package/dist/index.js +19 -20
  69. package/dist/index.js.map +1 -1
  70. package/dist/resolve/index.d.ts +2 -3
  71. package/dist/resolve/index.js +2 -3
  72. package/dist/resolve/index.js.map +1 -1
  73. package/dist/types/agents.d.ts +7 -3
  74. package/dist/types/applications.d.ts +68 -50
  75. package/dist/types/applications.js +9 -6
  76. package/dist/types/applications.js.map +1 -1
  77. package/dist/types/context.d.ts +17 -7
  78. package/dist/types/cors.d.ts +0 -2
  79. package/dist/types/datasets.d.ts +0 -6
  80. package/dist/types/functions/index.d.ts +96 -21
  81. package/dist/types/functions/index.js +2 -1
  82. package/dist/types/functions/index.js.map +1 -1
  83. package/dist/types/installation-config.d.ts +14 -11
  84. package/dist/types/permissions.d.ts +8 -4
  85. package/dist/types/projects.d.ts +5 -4
  86. package/dist/types/robotTokens.d.ts +14 -4
  87. package/dist/types/roles.d.ts +10 -9
  88. package/dist/types/studios.d.ts +29 -14
  89. package/dist/types/studios.js +3 -2
  90. package/dist/types/studios.js.map +1 -1
  91. package/dist/types/webhooks.d.ts +0 -3
  92. package/dist/utils/debounce.d.ts +0 -11
  93. package/dist/utils/debounce.js +0 -22
  94. package/dist/utils/debounce.js.map +1 -1
  95. package/dist/utils/parse-duration.d.ts +13 -0
  96. package/dist/utils/parse-duration.js +24 -0
  97. package/dist/utils/parse-duration.js.map +1 -1
  98. package/dist/utils/throttle.d.ts +9 -0
  99. package/dist/utils/throttle.js +22 -0
  100. package/dist/utils/throttle.js.map +1 -0
  101. package/dist/utils/validation.d.ts +14 -11
  102. package/dist/utils/validation.js +25 -17
  103. package/dist/utils/validation.js.map +1 -1
  104. package/dist/validation/applications.js +7 -2
  105. package/dist/validation/applications.js.map +1 -1
  106. package/dist/validation/blueprints.js +120 -4
  107. package/dist/validation/blueprints.js.map +1 -1
  108. package/dist/validation/functions.d.ts +19 -0
  109. package/dist/validation/functions.js +169 -36
  110. package/dist/validation/functions.js.map +1 -1
  111. package/dist/validation/projects.js +3 -0
  112. package/dist/validation/projects.js.map +1 -1
  113. package/dist/validation/resources.js +1 -1
  114. package/dist/validation/resources.js.map +1 -1
  115. package/dist/validation/studios.js +4 -0
  116. package/dist/validation/studios.js.map +1 -1
  117. package/package.json +1 -1
  118. package/src/definers/agents.ts +4 -2
  119. package/src/definers/applications.ts +36 -24
  120. package/src/definers/blueprints.ts +4 -27
  121. package/src/definers/context.ts +8 -4
  122. package/src/definers/cors.ts +11 -13
  123. package/src/definers/datasets.ts +40 -16
  124. package/src/definers/functions/document.ts +17 -25
  125. package/src/definers/functions/durable.ts +5 -4
  126. package/src/definers/functions/index.ts +1 -1
  127. package/src/definers/functions/media-library.ts +19 -21
  128. package/src/definers/functions/pubsub.ts +3 -4
  129. package/src/definers/functions/queue.ts +31 -10
  130. package/src/definers/functions/scheduled.ts +8 -7
  131. package/src/definers/functions/sync-tag-invalidate.ts +6 -3
  132. package/src/definers/installation-config.ts +5 -3
  133. package/src/definers/permissions.ts +14 -6
  134. package/src/definers/projects.ts +4 -5
  135. package/src/definers/resources.ts +1 -11
  136. package/src/definers/robotTokens.ts +55 -20
  137. package/src/definers/roles.ts +60 -58
  138. package/src/definers/studios.ts +6 -4
  139. package/src/definers/webhooks.ts +18 -23
  140. package/src/index.ts +20 -21
  141. package/src/resolve/index.ts +2 -4
  142. package/src/types/agents.ts +7 -3
  143. package/src/types/applications.ts +68 -50
  144. package/src/types/context.ts +17 -7
  145. package/src/types/cors.ts +0 -2
  146. package/src/types/datasets.ts +0 -6
  147. package/src/types/functions/index.ts +100 -21
  148. package/src/types/installation-config.ts +14 -11
  149. package/src/types/permissions.ts +8 -4
  150. package/src/types/projects.ts +6 -4
  151. package/src/types/robotTokens.ts +15 -4
  152. package/src/types/roles.ts +10 -9
  153. package/src/types/studios.ts +33 -14
  154. package/src/types/webhooks.ts +0 -3
  155. package/src/utils/debounce.ts +0 -25
  156. package/src/utils/parse-duration.ts +27 -0
  157. package/src/utils/throttle.ts +25 -0
  158. package/src/utils/validation.ts +24 -17
  159. package/src/validation/applications.ts +6 -2
  160. package/src/validation/blueprints.ts +132 -5
  161. package/src/validation/functions.ts +183 -37
  162. package/src/validation/projects.ts +4 -0
  163. package/src/validation/resources.ts +1 -1
  164. package/src/validation/studios.ts +3 -0
@@ -2,11 +2,12 @@ import type { BlueprintResource } from '../../index.js';
2
2
  import type { BlueprintDocumentFunctionResourceEvent, BlueprintFunctionResourceContentLakeEvent, BlueprintMediaLibraryFunctionResourceEvent, BlueprintScheduledFunctionConfigEvent, BlueprintScheduledFunctionResourceEvent, BlueprintSyncTagInvalidateFunctionResourceEvent } from './event.js';
3
3
  import type { IanaTimezone } from './timezone.js';
4
4
  export * from './event.js';
5
+ export * from './timezone.js';
5
6
  /**
6
7
  * Supported Function runtimes
7
8
  * @category Functions Types
8
9
  */
9
- export declare const VALID_RUNTIMES: readonly ['node', 'nodejs22.x', 'nodejs24.x'];
10
+ export declare const VALID_RUNTIMES: readonly ['node', 'nodejs22.x', 'nodejs24.x', 'nodejs26.x'];
10
11
  /**
11
12
  * Supported function runtimes
12
13
  * @category Functions Types
@@ -31,41 +32,100 @@ interface BlueprintCommonFunctionResource extends BlueprintResource {
31
32
  robotToken?: string;
32
33
  /**
33
34
  * The runtime environment for the function (currently only Node.js is supported)
34
- * @defaultValue 'nodejs24.x'
35
+ * @defaultValue 'nodejs26.x'
35
36
  */
36
37
  runtime?: FunctionRuntimes;
37
38
  }
38
39
  /**
39
- * Configuration used for Queue or Workflow function types.
40
- * @todo: not implemented
40
+ * Configuration used for Queue function types.
41
41
  * @category Functions Types
42
42
  * @alpha
43
43
  * @hidden
44
44
  */
45
45
  interface QueueConfig {
46
46
  /**
47
- * Maximum number of concurrent invocations in progress from queue to Function
48
- * @todo: not implemented, what is the default anyways?
47
+ * How many messages run at once, and whether they run in order.
48
+ * @defaultValue `{limit: 2, fifo: false}`
49
49
  */
50
- concurrency?: number;
50
+ concurrency?: ConcurrencyConfig;
51
51
  /**
52
52
  * Debounce configuration, with any durations already resolved to seconds.
53
53
  * Definers accept the wider {@link DebounceInput} and parse it into this shape.
54
54
  */
55
55
  debounce?: DebounceConfig;
56
+ }
57
+ /**
58
+ * How many messages a Queue function runs at once, and if they are processed in order.
59
+ *
60
+ * - `{limit: 1, fifo: true}` processes messages one at a time, in order.
61
+ * - `{limit: 5, fifo: true, key: 'event.data.documentId'}` keeps messages with the same key in order,
62
+ * while up to 5 keys run at once, so one busy key doesn't delay the others.
63
+ * - `{limit: 5}` processes up to 5 messages at once, with no order guarantees.
64
+ *
65
+ * A `limit` of 1 needs `fifo: true`, and `fifo` with a `limit` above 1 needs a `key`.
66
+ *
67
+ * Changing `fifo` on a deployed function replaces its queue, and messages still waiting in the old queue are lost.
68
+ * @category Functions Types
69
+ * @alpha
70
+ * @hidden
71
+ */
72
+ export interface ConcurrencyConfig {
56
73
  /**
57
- * Whether to place messages that failed processing into a Dead Letter Queue.
58
- * @todo: not implemented
59
- * @default `false`
74
+ * Maximum number of messages processed at once, from 1 to 1000.
75
+ * A limit of 1 needs `fifo: true`.
60
76
  */
61
- dlq?: boolean;
77
+ limit: number;
62
78
  /**
63
- * By default, queues employ at-least once delivery. When set to `true`, employs first-in-first-out ordering and exactly-once delivery.
64
- * FIFO queues have a lower transaction-per-second limit.
65
- * @todo: not implemented
66
- * @default `false`
79
+ * Process messages in order: one at a time with a `limit` of 1, or in order per `key` with a higher limit.
80
+ * Changing this on a deployed function replaces its queue, and messages still waiting in the old queue are lost.
81
+ * @defaultValue `false`
67
82
  */
68
83
  fifo?: boolean;
84
+ /**
85
+ * Dotted path into `{event, context}`, e.g. `event.data.documentId`; messages with the same value are processed in order.
86
+ * Required when `fifo` is `true` and `limit` is above 1.
87
+ */
88
+ key?: string;
89
+ }
90
+ /**
91
+ * Configuration used when throttling Queue function types.
92
+ * Starts at most `limit` messages per `period`; messages over the rate stay queued and are delivered late, not dropped.
93
+ * @category Functions Types
94
+ * @alpha
95
+ * @hidden
96
+ */
97
+ export interface ThrottleConfig {
98
+ /**
99
+ * Maximum number of messages started per `period`
100
+ */
101
+ limit: number;
102
+ /**
103
+ * Length of the throttle period in seconds
104
+ */
105
+ period: number;
106
+ /**
107
+ * Number of messages an idle queue may release at once before pacing resumes.
108
+ * Must not be greater than `limit`.
109
+ */
110
+ burst?: number;
111
+ /**
112
+ * Dotted path into `{event, context}`, e.g. `event.data.tenantId`; each distinct value is throttled in its own bucket.
113
+ * When omitted, the whole function is throttled as one bucket.
114
+ */
115
+ key?: string;
116
+ }
117
+ /**
118
+ * Throttle configuration as accepted by a function definer, before durations are parsed.
119
+ * @category Functions Types
120
+ * @alpha
121
+ * @hidden
122
+ */
123
+ export interface ThrottleConfigInput extends Omit<ThrottleConfig, 'period'> {
124
+ /**
125
+ * Length of the throttle period.
126
+ * A number is read as seconds, a string is parsed as a duration, e.g. `'1 minute'`.
127
+ */
128
+ period: string | number;
69
129
  }
70
130
  /**
71
131
  * Configuration used when debouncing Queue or Workflow function types.
@@ -83,7 +143,7 @@ export interface DebounceConfig {
83
143
  */
84
144
  maxWindow?: number;
85
145
  /**
86
- * Dotted path into {event, context} used to debounce events
146
+ * Dotted path into `{event, context}` used to group debounced events, e.g. `event.data.documentId`
87
147
  */
88
148
  key?: string;
89
149
  }
@@ -101,7 +161,7 @@ export interface DebounceConfigInput extends Omit<DebounceConfig, 'window' | 'ma
101
161
  window: string | number;
102
162
  /**
103
163
  * Maximum time to extend a debounce window from the first event.
104
- * Must be greater than `window`.
164
+ * Must be greater than or equal to `window`.
105
165
  * A number is read as seconds, a string is parsed as a duration, e.g. `'1 hour'`.
106
166
  */
107
167
  maxWindow?: string | number;
@@ -170,6 +230,17 @@ export interface BlueprintQueueFunctionResource extends BlueprintBaseFunctionRes
170
230
  type: 'sanity.function.queue';
171
231
  /** Optional Content Lake event source that triggers the function */
172
232
  event?: BlueprintFunctionResourceContentLakeEvent;
233
+ /**
234
+ * Total delivery attempts per message, at most 100: `1` delivers once and never retries, `3` delivers once and retries twice.
235
+ * Messages that use up their attempts are moved to a Dead Letter Queue.
236
+ * @defaultValue `3`, applied by the functions service when omitted
237
+ */
238
+ maxAttempts?: number;
239
+ /**
240
+ * Throttle configuration, with `period` already resolved to seconds.
241
+ * Definers accept the wider {@link ThrottleConfigInput} and parse it into this shape.
242
+ */
243
+ throttle?: ThrottleConfig;
173
244
  }
174
245
  /**
175
246
  * A function resource triggered by another function
@@ -180,7 +251,9 @@ export interface BlueprintPubSubFunctionResource extends BlueprintBaseFunctionRe
180
251
  }
181
252
  /**
182
253
  * A durable, step-based function.
183
- * @beta Deploying Durable Functions via Blueprints is experimental.
254
+ *
255
+ * Deploying Durable Functions via Blueprints is experimental.
256
+ * @beta
184
257
  * @category Functions Types
185
258
  */
186
259
  export interface BlueprintDurableFunctionResource extends BlueprintBaseFunctionResource {
@@ -268,12 +341,12 @@ export type BlueprintSyncTagInvalidateFunctionConfig = Omit<BlueprintSyncTagInva
268
341
  /**
269
342
  * Configuration for defining a queue function.
270
343
  * @public
271
- * @alpha Deploying Queue Functions via Blueprints is experimental. This feature is not available publicly yet.
344
+ * @alpha
272
345
  * @hidden
273
346
  * @category Functions Types
274
347
  * @interface
275
348
  */
276
- export type BlueprintQueueFunctionConfig = Omit<BlueprintQueueFunctionResource, 'type' | 'src' | 'event' | 'debounce'> & {
349
+ export type BlueprintQueueFunctionConfig = Omit<BlueprintQueueFunctionResource, 'type' | 'src' | 'event' | 'debounce' | 'throttle'> & {
277
350
  /**
278
351
  * Path to the function source code
279
352
  * @defaultValue `functions/${name}`
@@ -283,6 +356,8 @@ export type BlueprintQueueFunctionConfig = Omit<BlueprintQueueFunctionResource,
283
356
  event?: BlueprintFunctionResourceContentLakeEvent;
284
357
  /** Optional debounce configuration, as a duration or a full config */
285
358
  debounce?: DebounceInput;
359
+ /** Optional throttle configuration */
360
+ throttle?: ThrottleConfigInput;
286
361
  };
287
362
  /**
288
363
  * Configuration for defining an event function.
@@ -300,7 +375,7 @@ export type BlueprintPubSubFunctionConfig = Omit<BlueprintPubSubFunctionResource
300
375
  /**
301
376
  * Configuration for defining a durable function.
302
377
  * @public
303
- * @beta Deploying Durable Functions via Blueprints is experimental.
378
+ * @beta
304
379
  * @category Functions Types
305
380
  * @interface
306
381
  */
@@ -1,7 +1,8 @@
1
1
  export * from './event.js';
2
+ export * from './timezone.js';
2
3
  /**
3
4
  * Supported Function runtimes
4
5
  * @category Functions Types
5
6
  */
6
- export const VALID_RUNTIMES = ['node', 'nodejs22.x', 'nodejs24.x'];
7
+ export const VALID_RUNTIMES = ['node', 'nodejs22.x', 'nodejs24.x', 'nodejs26.x'];
7
8
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/types/functions/index.ts"],"names":[],"mappings":"AAWA,cAAc,YAAY,CAAA;AAE1B;;;GAGG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,MAAM,EAAE,YAAY,EAAE,YAAY,CAAU,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/types/functions/index.ts"],"names":[],"mappings":"AAWA,cAAc,YAAY,CAAA;AAC1B,cAAc,eAAe,CAAA;AAE7B;;;GAGG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,MAAM,EAAE,YAAY,EAAE,YAAY,EAAE,YAAY,CAAU,CAAA"}
@@ -2,13 +2,14 @@ import type { BlueprintResource } from '../index.js';
2
2
  /**
3
3
  * Fields shared by every singleton installation config resource.
4
4
  *
5
+ * This feature is subject to breaking changes.
6
+ *
5
7
  * @remarks
6
8
  * The backend selects a provider from the resource `type`
7
9
  * (`sanity.installation.config`), so every installation config shares that one
8
10
  * type and is discriminated by `appType`.
9
- * @beta This feature is subject to breaking changes.
11
+ * @beta
10
12
  * @category Resource Types
11
- * @hidden
12
13
  */
13
14
  export interface BlueprintInstallationConfigResourceBase extends BlueprintResource {
14
15
  type: 'sanity.installation.config';
@@ -22,9 +23,10 @@ export interface BlueprintInstallationConfigResourceBase extends BlueprintResour
22
23
  }
23
24
  /**
24
25
  * One custom field a Media Library configuration exposes.
25
- * @beta This feature is subject to breaking changes.
26
+ *
27
+ * This feature is subject to breaking changes.
28
+ * @beta
26
29
  * @category Resource Types
27
- * @hidden
28
30
  */
29
31
  export interface BlueprintMediaLibraryField {
30
32
  /** Unique within the Media Library config. */
@@ -39,14 +41,15 @@ export interface BlueprintMediaLibraryField {
39
41
  /**
40
42
  * Represents a singleton Media Library configuration resource.
41
43
  *
44
+ * This feature is subject to breaking changes.
45
+ *
42
46
  * @remarks
43
47
  * The Media Library is a Sanity-owned singleton, so this resource carries no
44
48
  * application identity of its own — it only names the target `appType`, the
45
49
  * config `root`, and its `fields`. The provider resolves the organization's
46
50
  * media library installation id at deploy time.
47
- * @beta This feature is subject to breaking changes.
51
+ * @beta
48
52
  * @category Resource Types
49
- * @hidden
50
53
  */
51
54
  export interface BlueprintMediaLibraryConfigResource extends BlueprintInstallationConfigResourceBase {
52
55
  /** The target installation this config applies to. Set by the definer. */
@@ -61,19 +64,19 @@ export interface BlueprintMediaLibraryConfigResource extends BlueprintInstallati
61
64
  /**
62
65
  * A union of every singleton installation config resource, discriminated by `appType`.
63
66
  *
67
+ * This feature is subject to breaking changes.
68
+ *
64
69
  * @remarks
65
70
  * Media Library is the only member today; additional installation configs are
66
71
  * added to this union.
67
- * @beta This feature is subject to breaking changes.
72
+ * @beta
68
73
  * @category Resource Types
69
- * @hidden
70
74
  */
71
75
  export type BlueprintInstallationConfigResource = BlueprintMediaLibraryConfigResource;
72
76
  /**
73
77
  * Configuration for a singleton Media Library configuration resource.
74
- * @beta This feature is subject to breaking changes.
78
+ * @beta
75
79
  * @category Resource Types
76
80
  * @interface
77
- * @hidden
78
81
  */
79
- export type BlueprintMediaLibraryConfigConfig = Omit<BlueprintMediaLibraryConfigResource, 'type' | 'appType'>;
82
+ export type BlueprintMediaLibraryConfigConfig = Omit<BlueprintMediaLibraryConfigResource, 'type' | 'appType' | 'version' | 'mfManifest'>;
@@ -2,15 +2,19 @@ import type { BlueprintProjectResourceLifecycle, BlueprintResource } from '../in
2
2
  /**
3
3
  * The type of a custom permission.
4
4
  *
5
+ * This feature is subject to breaking changes.
6
+ *
5
7
  * - **sanity.document.filter** A role grants document actions, such as `read` and `update`, on the documents that match the filter.
6
8
  * - **sanity.document.filter.mode** A role grants the `mode` action, with a `mode` param such as `read` or `publish`, on the documents that match the filter.
7
- * @beta This feature is subject to breaking changes.
9
+ * @beta
8
10
  * @category Resource Types
9
11
  */
10
12
  export type BlueprintPermissionType = 'sanity.document.filter' | 'sanity.document.filter.mode';
11
13
  /**
12
14
  * A custom permission resource that roles can grant.
13
- * @beta This feature is subject to breaking changes.
15
+ *
16
+ * This feature is subject to breaking changes.
17
+ * @beta
14
18
  * @category Resource Types
15
19
  */
16
20
  export interface BlueprintPermissionResource extends BlueprintResource<BlueprintProjectResourceLifecycle> {
@@ -45,14 +49,14 @@ export interface BlueprintPermissionResource extends BlueprintResource<Blueprint
45
49
  }
46
50
  /**
47
51
  * Configuration for a custom permission resource.
48
- * @beta This feature is subject to breaking changes.
52
+ * @beta
49
53
  * @category Resource Types
50
54
  * @interface
51
55
  */
52
56
  export type BlueprintPermissionConfig = Omit<BlueprintPermissionResource, 'type'>;
53
57
  /**
54
58
  * Configuration for a content resource: a custom permission of type `sanity.document.filter.mode`, as the Manage UI makes it.
55
- * @beta This feature is subject to breaking changes.
59
+ * @beta
56
60
  * @category Resource Types
57
61
  */
58
62
  export interface BlueprintContentResourceConfig extends Omit<BlueprintPermissionConfig, 'permissionType' | 'config'> {
@@ -2,21 +2,22 @@ import type { BlueprintResource, BlueprintResourceLifecycle } from './resources.
2
2
  /**
3
3
  * Reporesents a Sanity Project.
4
4
  * @see https://www.sanity.io/docs/http-reference/projects-api
5
- * @beta This feature is subject to breaking changes.
6
5
  * @category Resource Types
7
- * @hidden
8
6
  */
9
7
  export interface BlueprintProjectResource extends BlueprintResource<BlueprintResourceLifecycle> {
10
8
  type: 'sanity.project';
11
9
  /** The name of the project, defaults to the resource name if not provided */
12
10
  displayName?: string;
11
+ /**
12
+ * Path to the logo image, relative to the blueprint file. Uploaded on every deploy; omitting it removes the logo.
13
+ * PNG, JPEG, BMP, GIF, TIFF, SVG, WebP, HEIF or AVIF, up to 5 MB.
14
+ */
15
+ logo?: string;
13
16
  }
14
17
  /**
15
18
  * Configuration for a Sanity Project.
16
19
  * @see https://www.sanity.io/docs/http-reference/projects-api
17
- * @beta This feature is subject to breaking changes.
18
20
  * @category Resource Types
19
21
  * @interface
20
- * @hidden
21
22
  */
22
23
  export type BlueprintProjectConfig = Omit<BlueprintProjectResource, 'type'>;
@@ -6,7 +6,6 @@ import type { BlueprintProjectResourceLifecycle, BlueprintResource } from './res
6
6
  export type RobotTokenResourceType = 'organization' | 'project';
7
7
  /**
8
8
  * Defines the robot token's roles within a given resource. Membership scope defaults to the robot token's scope.
9
- * @beta This feature is subject to breaking changes.
10
9
  * @category Resource Types
11
10
  * @expand
12
11
  */
@@ -15,10 +14,19 @@ export interface RobotTokenMembership {
15
14
  resourceId?: string;
16
15
  roleNames: string[];
17
16
  }
17
+ /**
18
+ * A membership of a robot token, as passed to {@link defineRobotToken}.
19
+ * @category Resource Types
20
+ * @expand
21
+ * @interface
22
+ */
23
+ export type RobotTokenMembershipConfig = RobotTokenMembership & {
24
+ /** The ID of the project that the membership belongs to. Sets `resourceType` to `project` and `resourceId` to the project. */
25
+ project?: string;
26
+ };
18
27
  /**
19
28
  * A robot token that provides automated access.
20
29
  * @see https://www.sanity.io/docs/content-lake/http-auth#k4c21d7b829fe
21
- * @beta This feature is subject to breaking changes.
22
30
  * @category Resource Types
23
31
  */
24
32
  export interface BlueprintRobotTokenResource extends BlueprintResource<BlueprintProjectResourceLifecycle> {
@@ -32,14 +40,16 @@ export interface BlueprintRobotTokenResource extends BlueprintResource<Blueprint
32
40
  /**
33
41
  * Configuration for a robot token that provides automated access.
34
42
  * @see https://www.sanity.io/docs/content-lake/http-auth#k4c21d7b829fe
35
- * @beta This feature is subject to breaking changes.
36
43
  * @category Resource Types
37
44
  * @interface
38
45
  */
39
- export type BlueprintRobotTokenConfig = Omit<BlueprintRobotTokenResource, 'type' | 'label' | 'token'> & {
46
+ export type BlueprintRobotTokenConfig = Omit<BlueprintRobotTokenResource, 'type' | 'label' | 'memberships'> & {
40
47
  /**
41
48
  * A descriptive label for the robot token and its use case
42
49
  * @defaultValue The `name` of the resource
43
50
  */
44
51
  label?: string;
52
+ /** The ID of the project that the robot token belongs to. Sets `resourceType` to `project` and `resourceId` to the project. */
53
+ project?: string;
54
+ memberships: RobotTokenMembershipConfig[];
45
55
  };
@@ -1,7 +1,6 @@
1
1
  import type { BlueprintProjectResourceLifecycle, BlueprintResource } from '../index.js';
2
2
  /**
3
3
  * A permission definition for a role.
4
- * @beta This feature is subject to breaking changes.
5
4
  * @category Resource Types
6
5
  * @expand
7
6
  */
@@ -14,11 +13,11 @@ export interface RolePermission {
14
13
  params?: Record<string, unknown>;
15
14
  }
16
15
  /**
17
- * Configuration for a custom role.
18
- * @beta This feature is subject to breaking changes.
16
+ * A custom role resource
19
17
  * @category Resource Types
20
18
  */
21
- export interface BlueprintRoleConfig extends Omit<BlueprintResource<BlueprintProjectResourceLifecycle>, 'type'> {
19
+ export interface BlueprintRoleResource extends BlueprintResource<BlueprintProjectResourceLifecycle> {
20
+ type: 'sanity.access.role';
22
21
  title: string;
23
22
  description?: string;
24
23
  appliesToUsers: boolean;
@@ -26,16 +25,18 @@ export interface BlueprintRoleConfig extends Omit<BlueprintResource<BlueprintPro
26
25
  permissions: RolePermission[];
27
26
  }
28
27
  /**
29
- * A custom role resource
30
- * @beta This feature is subject to breaking changes.
28
+ * Configuration for a custom role.
31
29
  * @category Resource Types
32
30
  */
33
- export interface BlueprintRoleResource extends BlueprintRoleConfig, BlueprintResource<BlueprintProjectResourceLifecycle> {
34
- type: 'sanity.access.role';
31
+ export interface BlueprintRoleConfig extends Omit<BlueprintRoleResource, 'type'> {
32
+ /**
33
+ * The ID of the project that the role belongs to. Without it, the role is scoped to the stack.
34
+ * Sets `resourceType` to `project` and `resourceId` to the project.
35
+ */
36
+ project?: string;
35
37
  }
36
38
  /**
37
39
  * A custom role resource that is tied to a specific project
38
- * @beta This feature is subject to breaking changes.
39
40
  * @category Resource Types
40
41
  */
41
42
  export interface BlueprintProjectRoleResource extends BlueprintRoleResource {
@@ -4,47 +4,60 @@ import type { BlueprintProjectResourceLifecycle, BlueprintResource } from '../in
4
4
  /**
5
5
  * Custom Vite configuration for the Studio so it can be changed and extended.
6
6
  * This type matches the type in @sanity/cli-core and must continue to remain compatible.
7
- * @beta This feature is subject to breaking changes.
7
+ *
8
+ * This feature is subject to breaking changes.
9
+ * @beta
8
10
  * @category Resource Types
9
- * @hidden
10
11
  */
11
12
  export type UserViteConfig = ((config: InlineConfig, env: ConfigEnv) => InlineConfig | Promise<InlineConfig>) | InlineConfig;
12
13
  /**
13
14
  * The set of valid application visibilities.
14
- * @beta This feature is subject to breaking changes.
15
+ *
16
+ * This feature is subject to breaking changes.
17
+ * @beta
15
18
  * @category Resource Types
16
- * @hidden
17
19
  */
18
20
  export declare const APPLICATION_VISIBILITIES: readonly ['default', 'unlisted', 'disabled'];
19
21
  /**
20
22
  * The visibility of the studio in the dashboard.
21
- * @beta This feature is subject to breaking changes.
23
+ *
24
+ * This feature is subject to breaking changes.
25
+ * @beta
22
26
  * @category Resource Types
23
- * @hidden
24
27
  */
25
28
  export type ApplicationVisibility = (typeof APPLICATION_VISIBILITIES)[number];
26
29
  /**
27
30
  * A workspace definition extracted from a studio's configuration during the build.
28
- * @beta This feature is subject to breaking changes.
31
+ *
32
+ * This feature is subject to breaking changes.
33
+ * @beta
29
34
  * @category Resource Types
30
- * @hidden
31
35
  */
32
36
  export type StudioWorkspace = {
37
+ /** The project ID of the workspace */
33
38
  projectId: string;
39
+ /** The dataset of the workspace */
34
40
  dataset: string;
41
+ /** The ID of the deployed schema descriptor for the workspace */
35
42
  schemaDescriptorId: string;
43
+ /** The workspace name */
36
44
  name: string;
45
+ /** The workspace title */
37
46
  title: string | undefined;
47
+ /** The workspace subtitle */
38
48
  subtitle: string | undefined;
49
+ /** The workspace base path */
39
50
  basePath: string | undefined;
51
+ /** The workspace icon */
40
52
  icon: string | undefined;
41
53
  };
42
54
  /**
43
55
  * Represents a Studio resource.
56
+ *
57
+ * This feature is subject to breaking changes.
44
58
  * @see https://www.sanity.io/docs/studio
45
- * @beta This feature is subject to breaking changes.
59
+ * @beta
46
60
  * @category Resource Types
47
- * @hidden
48
61
  */
49
62
  export interface BlueprintStudioResource extends BlueprintResource<BlueprintProjectResourceLifecycle> {
50
63
  type: 'sanity.studio';
@@ -60,7 +73,10 @@ export interface BlueprintStudioResource extends BlueprintResource<BlueprintProj
60
73
  slug: string;
61
74
  /** Title for the studio. */
62
75
  title: string;
63
- /** Icon for the studio in the browser. */
76
+ /**
77
+ * Path to the icon image, relative to `root`. Uploaded on every deploy; omitting it removes the icon.
78
+ * PNG, JPEG, BMP, GIF, TIFF, SVG, WebP, HEIF or AVIF, up to 5 MB.
79
+ */
64
80
  icon?: string;
65
81
  /** Dashboard visibility */
66
82
  visibility?: ApplicationVisibility;
@@ -96,12 +112,11 @@ export interface BlueprintStudioResource extends BlueprintResource<BlueprintProj
96
112
  /**
97
113
  * Configuration for a Studio resource.
98
114
  * @see https://www.sanity.io/docs/studio
99
- * @beta This feature is subject to breaking changes.
115
+ * @beta
100
116
  * @category Resource Types
101
117
  * @interface
102
- * @hidden
103
118
  */
104
- export interface BlueprintStudioConfig extends Omit<BlueprintStudioResource, 'type' | 'slug' | 'title' | 'autoUpdates'> {
119
+ export interface BlueprintStudioConfig extends Omit<BlueprintStudioResource, 'type' | 'slug' | 'title' | 'autoUpdates' | 'schemaInputs' | 'workspaces' | 'mfManifest' | 'version'> {
105
120
  /**
106
121
  * The slug to be used in the studio hostname. Must match `^[a-z0-9]([a-z0-9-]*[a-z0-9])?$`.
107
122
  *
@@ -1,8 +1,9 @@
1
1
  /**
2
2
  * The set of valid application visibilities.
3
- * @beta This feature is subject to breaking changes.
3
+ *
4
+ * This feature is subject to breaking changes.
5
+ * @beta
4
6
  * @category Resource Types
5
- * @hidden
6
7
  */
7
8
  export const APPLICATION_VISIBILITIES = ['default', 'unlisted', 'disabled'];
8
9
  //# sourceMappingURL=studios.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"studios.js","sourceRoot":"","sources":["../../src/types/studios.ts"],"names":[],"mappings":"AAaA;;;;;GAKG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,SAAS,EAAE,UAAU,EAAE,UAAU,CAAU,CAAA"}
1
+ {"version":3,"file":"studios.js","sourceRoot":"","sources":["../../src/types/studios.ts"],"names":[],"mappings":"AAcA;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,SAAS,EAAE,UAAU,EAAE,UAAU,CAAU,CAAA"}
@@ -1,13 +1,11 @@
1
1
  import type { BlueprintProjectResourceLifecycle, BlueprintResource } from '../index.js';
2
2
  /**
3
3
  * Types of events that can trigger a webhook
4
- * @beta This feature is subject to breaking changes.
5
4
  * @category Resource Types
6
5
  */
7
6
  export type WebhookTrigger = 'create' | 'update' | 'delete';
8
7
  /**
9
8
  * A webhook resource definition
10
- * @beta This feature is subject to breaking changes.
11
9
  * @category Resource Types
12
10
  */
13
11
  export interface BlueprintDocumentWebhookResource extends BlueprintResource<BlueprintProjectResourceLifecycle> {
@@ -35,7 +33,6 @@ export interface BlueprintDocumentWebhookResource extends BlueprintResource<Blue
35
33
  }
36
34
  /**
37
35
  * Configuration for a webhook
38
- * @beta This feature is subject to breaking changes.
39
36
  * @category Resource Types
40
37
  * @interface
41
38
  */
@@ -1,4 +1,3 @@
1
- import type { BlueprintError } from '../types/errors.js';
2
1
  import type { DebounceConfig, DebounceInput } from '../types/functions/index.js';
3
2
  /**
4
3
  * Normalizes the debounce config accepted by a definer into the shape held by a resource,
@@ -8,13 +7,3 @@ import type { DebounceConfig, DebounceInput } from '../types/functions/index.js'
8
7
  * @returns The debounce config, with `window` and `maxWindow` in seconds
9
8
  */
10
9
  export declare function createDebounceObject(debounce: DebounceInput): DebounceConfig;
11
- /**
12
- * Resolves a debounce duration, given either as a number of seconds or as a duration string, to seconds.
13
- * @param field The name of the field being resolved, used in error messages
14
- * @param value The value to resolve
15
- * @returns The value in seconds, or the errors that prevented it from being resolved
16
- */
17
- export declare function resolveDebounceDuration(field: string, value: unknown): {
18
- seconds?: number;
19
- errors: BlueprintError[];
20
- };
@@ -21,26 +21,4 @@ export function createDebounceObject(debounce) {
21
21
  ...(key !== undefined && { key }),
22
22
  };
23
23
  }
24
- /**
25
- * Resolves a debounce duration, given either as a number of seconds or as a duration string, to seconds.
26
- * @param field The name of the field being resolved, used in error messages
27
- * @param value The value to resolve
28
- * @returns The value in seconds, or the errors that prevented it from being resolved
29
- */
30
- export function resolveDebounceDuration(field, value) {
31
- if (typeof value === 'number') {
32
- return Number.isFinite(value)
33
- ? { seconds: value, errors: [] }
34
- : { errors: [{ type: 'invalid_value', message: `\`${field}\` must be a valid duration` }] };
35
- }
36
- if (typeof value === 'string') {
37
- try {
38
- return { seconds: parseDuration(value, 's'), errors: [] };
39
- }
40
- catch {
41
- return { errors: [{ type: 'invalid_value', message: `\`${field}\` must be a valid duration` }] };
42
- }
43
- }
44
- return { errors: [{ type: 'invalid_type', message: `\`${field}\` must be a number of seconds or a duration string` }] };
45
- }
46
24
  //# sourceMappingURL=debounce.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"debounce.js","sourceRoot":"","sources":["../../src/utils/debounce.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,aAAa,EAAC,MAAM,qBAAqB,CAAA;AAEjD;;;;;;GAMG;AACH,MAAM,UAAU,oBAAoB,CAAC,QAAuB;IAC1D,IAAI,OAAO,QAAQ,KAAK,QAAQ,EAAE,CAAC;QACjC,OAAO,EAAC,MAAM,EAAE,aAAa,CAAC,QAAQ,EAAE,GAAG,CAAC,EAAC,CAAA;IAC/C,CAAC;IAED,MAAM,EAAC,MAAM,EAAE,SAAS,EAAE,GAAG,EAAC,GAAG,QAAQ,CAAA;IAEzC,yEAAyE;IACzE,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;QACzB,MAAM,IAAI,KAAK,CAAC,oDAAoD,CAAC,CAAA;IACvE,CAAC;IAED,OAAO;QACL,MAAM,EAAE,aAAa,CAAC,MAAM,EAAE,GAAG,CAAC;QAClC,GAAG,CAAC,SAAS,KAAK,SAAS,IAAI,EAAC,SAAS,EAAE,aAAa,CAAC,SAAS,EAAE,GAAG,CAAC,EAAC,CAAC;QAC1E,GAAG,CAAC,GAAG,KAAK,SAAS,IAAI,EAAC,GAAG,EAAC,CAAC;KAChC,CAAA;AACH,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,uBAAuB,CAAC,KAAa,EAAE,KAAc;IACnE,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,OAAO,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC;YAC3B,CAAC,CAAC,EAAC,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,EAAC;YAC9B,CAAC,CAAC,EAAC,MAAM,EAAE,CAAC,EAAC,IAAI,EAAE,eAAe,EAAE,OAAO,EAAE,KAAK,KAAK,6BAA6B,EAAC,CAAC,EAAC,CAAA;IAC3F,CAAC;IAED,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,IAAI,CAAC;YACH,OAAO,EAAC,OAAO,EAAE,aAAa,CAAC,KAAK,EAAE,GAAG,CAAC,EAAE,MAAM,EAAE,EAAE,EAAC,CAAA;QACzD,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,EAAC,MAAM,EAAE,CAAC,EAAC,IAAI,EAAE,eAAe,EAAE,OAAO,EAAE,KAAK,KAAK,6BAA6B,EAAC,CAAC,EAAC,CAAA;QAC9F,CAAC;IACH,CAAC;IAED,OAAO,EAAC,MAAM,EAAE,CAAC,EAAC,IAAI,EAAE,cAAc,EAAE,OAAO,EAAE,KAAK,KAAK,qDAAqD,EAAC,CAAC,EAAC,CAAA;AACrH,CAAC"}
1
+ {"version":3,"file":"debounce.js","sourceRoot":"","sources":["../../src/utils/debounce.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,aAAa,EAAC,MAAM,qBAAqB,CAAA;AAEjD;;;;;;GAMG;AACH,MAAM,UAAU,oBAAoB,CAAC,QAAuB;IAC1D,IAAI,OAAO,QAAQ,KAAK,QAAQ,EAAE,CAAC;QACjC,OAAO,EAAC,MAAM,EAAE,aAAa,CAAC,QAAQ,EAAE,GAAG,CAAC,EAAC,CAAA;IAC/C,CAAC;IAED,MAAM,EAAC,MAAM,EAAE,SAAS,EAAE,GAAG,EAAC,GAAG,QAAQ,CAAA;IAEzC,yEAAyE;IACzE,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;QACzB,MAAM,IAAI,KAAK,CAAC,oDAAoD,CAAC,CAAA;IACvE,CAAC;IAED,OAAO;QACL,MAAM,EAAE,aAAa,CAAC,MAAM,EAAE,GAAG,CAAC;QAClC,GAAG,CAAC,SAAS,KAAK,SAAS,IAAI,EAAC,SAAS,EAAE,aAAa,CAAC,SAAS,EAAE,GAAG,CAAC,EAAC,CAAC;QAC1E,GAAG,CAAC,GAAG,KAAK,SAAS,IAAI,EAAC,GAAG,EAAC,CAAC;KAChC,CAAA;AACH,CAAC"}