@sanity/blueprints 0.34.1 → 0.35.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/agents.d.ts +3 -1
- package/dist/definers/agents.js +3 -1
- package/dist/definers/agents.js.map +1 -1
- package/dist/definers/applications.d.ts +30 -18
- package/dist/definers/applications.js +30 -18
- package/dist/definers/applications.js.map +1 -1
- package/dist/definers/blueprints.d.ts +1 -0
- package/dist/definers/blueprints.js +1 -25
- package/dist/definers/blueprints.js.map +1 -1
- package/dist/definers/context.d.ts +6 -2
- package/dist/definers/context.js +6 -2
- package/dist/definers/context.js.map +1 -1
- package/dist/definers/cors.d.ts +11 -1
- package/dist/definers/cors.js +10 -12
- package/dist/definers/cors.js.map +1 -1
- package/dist/definers/datasets.d.ts +12 -2
- package/dist/definers/datasets.js +11 -14
- package/dist/definers/datasets.js.map +1 -1
- package/dist/definers/functions/document.d.ts +30 -0
- package/dist/definers/functions/document.js.map +1 -1
- package/dist/definers/functions/durable.d.ts +4 -3
- package/dist/definers/functions/durable.js +4 -3
- package/dist/definers/functions/durable.js.map +1 -1
- package/dist/definers/functions/media-library.d.ts +31 -0
- package/dist/definers/functions/media-library.js +18 -19
- package/dist/definers/functions/media-library.js.map +1 -1
- package/dist/definers/functions/pubsub.d.ts +2 -3
- package/dist/definers/functions/pubsub.js +2 -3
- package/dist/definers/functions/pubsub.js.map +1 -1
- package/dist/definers/functions/queue.d.ts +15 -4
- package/dist/definers/functions/queue.js +19 -6
- package/dist/definers/functions/queue.js.map +1 -1
- package/dist/definers/functions/scheduled.d.ts +7 -6
- package/dist/definers/functions/scheduled.js +7 -6
- package/dist/definers/functions/scheduled.js.map +1 -1
- package/dist/definers/functions/sync-tag-invalidate.d.ts +5 -2
- package/dist/definers/functions/sync-tag-invalidate.js +5 -2
- package/dist/definers/functions/sync-tag-invalidate.js.map +1 -1
- package/dist/definers/installation-config.d.ts +4 -2
- package/dist/definers/installation-config.js +4 -2
- package/dist/definers/installation-config.js.map +1 -1
- package/dist/definers/permissions.d.ts +8 -2
- package/dist/definers/permissions.js +8 -2
- package/dist/definers/permissions.js.map +1 -1
- package/dist/definers/projects.d.ts +3 -4
- package/dist/definers/projects.js +3 -4
- package/dist/definers/projects.js.map +1 -1
- package/dist/definers/resources.d.ts +1 -0
- package/dist/definers/resources.js +1 -11
- package/dist/definers/resources.js.map +1 -1
- package/dist/definers/robotTokens.d.ts +22 -3
- package/dist/definers/robotTokens.js +17 -18
- package/dist/definers/robotTokens.js.map +1 -1
- package/dist/definers/roles.d.ts +53 -5
- package/dist/definers/roles.js +38 -40
- package/dist/definers/roles.js.map +1 -1
- package/dist/definers/studios.d.ts +5 -3
- package/dist/definers/studios.js +5 -3
- package/dist/definers/studios.js.map +1 -1
- package/dist/definers/webhooks.d.ts +19 -1
- package/dist/definers/webhooks.js +15 -17
- package/dist/definers/webhooks.js.map +1 -1
- package/dist/index.d.ts +18 -18
- package/dist/index.js +19 -20
- package/dist/index.js.map +1 -1
- package/dist/resolve/index.d.ts +2 -3
- package/dist/resolve/index.js +2 -3
- package/dist/resolve/index.js.map +1 -1
- package/dist/types/agents.d.ts +7 -3
- package/dist/types/applications.d.ts +67 -49
- package/dist/types/applications.js +9 -6
- package/dist/types/applications.js.map +1 -1
- package/dist/types/context.d.ts +17 -7
- package/dist/types/cors.d.ts +0 -2
- package/dist/types/datasets.d.ts +0 -6
- package/dist/types/functions/index.d.ts +64 -14
- package/dist/types/functions/index.js +2 -1
- package/dist/types/functions/index.js.map +1 -1
- package/dist/types/installation-config.d.ts +13 -10
- package/dist/types/permissions.d.ts +8 -4
- package/dist/types/projects.d.ts +5 -4
- package/dist/types/robotTokens.d.ts +0 -3
- package/dist/types/roles.d.ts +0 -4
- package/dist/types/studios.d.ts +28 -13
- package/dist/types/studios.js +3 -2
- package/dist/types/studios.js.map +1 -1
- package/dist/types/webhooks.d.ts +0 -3
- package/dist/utils/debounce.d.ts +0 -11
- package/dist/utils/debounce.js +0 -22
- package/dist/utils/debounce.js.map +1 -1
- package/dist/utils/parse-duration.d.ts +13 -0
- package/dist/utils/parse-duration.js +24 -0
- package/dist/utils/parse-duration.js.map +1 -1
- package/dist/utils/throttle.d.ts +9 -0
- package/dist/utils/throttle.js +22 -0
- package/dist/utils/throttle.js.map +1 -0
- package/dist/validation/applications.js +7 -2
- package/dist/validation/applications.js.map +1 -1
- package/dist/validation/functions.d.ts +10 -0
- package/dist/validation/functions.js +112 -12
- package/dist/validation/functions.js.map +1 -1
- package/dist/validation/projects.js +3 -0
- package/dist/validation/projects.js.map +1 -1
- package/dist/validation/studios.js +4 -0
- package/dist/validation/studios.js.map +1 -1
- package/package.json +1 -1
- package/src/definers/agents.ts +3 -1
- package/src/definers/applications.ts +30 -18
- package/src/definers/blueprints.ts +1 -25
- package/src/definers/context.ts +6 -2
- package/src/definers/cors.ts +10 -12
- package/src/definers/datasets.ts +11 -14
- package/src/definers/functions/document.ts +17 -24
- package/src/definers/functions/durable.ts +4 -3
- package/src/definers/functions/media-library.ts +18 -19
- package/src/definers/functions/pubsub.ts +2 -3
- package/src/definers/functions/queue.ts +19 -6
- package/src/definers/functions/scheduled.ts +7 -6
- package/src/definers/functions/sync-tag-invalidate.ts +5 -2
- package/src/definers/installation-config.ts +4 -2
- package/src/definers/permissions.ts +8 -2
- package/src/definers/projects.ts +3 -4
- package/src/definers/resources.ts +1 -11
- package/src/definers/robotTokens.ts +17 -18
- package/src/definers/roles.ts +38 -40
- package/src/definers/studios.ts +5 -3
- package/src/definers/webhooks.ts +15 -17
- package/src/index.ts +20 -21
- package/src/resolve/index.ts +2 -4
- package/src/types/agents.ts +7 -3
- package/src/types/applications.ts +67 -49
- package/src/types/context.ts +17 -7
- package/src/types/cors.ts +0 -2
- package/src/types/datasets.ts +0 -6
- package/src/types/functions/index.ts +67 -14
- package/src/types/installation-config.ts +13 -10
- package/src/types/permissions.ts +8 -4
- package/src/types/projects.ts +6 -4
- package/src/types/robotTokens.ts +0 -3
- package/src/types/roles.ts +0 -4
- package/src/types/studios.ts +28 -13
- package/src/types/webhooks.ts +0 -3
- package/src/utils/debounce.ts +0 -25
- package/src/utils/parse-duration.ts +27 -0
- package/src/utils/throttle.ts +25 -0
- package/src/validation/applications.ts +6 -2
- package/src/validation/functions.ts +123 -12
- package/src/validation/projects.ts +4 -0
- package/src/validation/studios.ts +3 -0
package/src/types/context.ts
CHANGED
|
@@ -2,7 +2,9 @@ import type {BlueprintResource} from '../index.js'
|
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* A knowledge base that a Context MCP endpoint serves.
|
|
5
|
-
*
|
|
5
|
+
*
|
|
6
|
+
* This feature is subject to breaking changes.
|
|
7
|
+
* @beta
|
|
6
8
|
* @category Resource Types
|
|
7
9
|
*/
|
|
8
10
|
export interface ContextKnowledgeBaseSource {
|
|
@@ -13,7 +15,9 @@ export interface ContextKnowledgeBaseSource {
|
|
|
13
15
|
|
|
14
16
|
/**
|
|
15
17
|
* A Sanity dataset that a Context MCP endpoint serves.
|
|
16
|
-
*
|
|
18
|
+
*
|
|
19
|
+
* This feature is subject to breaking changes.
|
|
20
|
+
* @beta
|
|
17
21
|
* @category Resource Types
|
|
18
22
|
*/
|
|
19
23
|
export interface ContextDatasetSource {
|
|
@@ -33,14 +37,18 @@ export interface ContextDatasetSource {
|
|
|
33
37
|
|
|
34
38
|
/**
|
|
35
39
|
* Content that a Context MCP endpoint serves.
|
|
36
|
-
*
|
|
40
|
+
*
|
|
41
|
+
* This feature is subject to breaking changes.
|
|
42
|
+
* @beta
|
|
37
43
|
* @category Resource Types
|
|
38
44
|
*/
|
|
39
45
|
export type ContextMcpEndpointSource = ContextKnowledgeBaseSource | ContextDatasetSource
|
|
40
46
|
|
|
41
47
|
/**
|
|
42
48
|
* A Context knowledge base resource.
|
|
43
|
-
*
|
|
49
|
+
*
|
|
50
|
+
* This feature is subject to breaking changes.
|
|
51
|
+
* @beta
|
|
44
52
|
* @category Resource Types
|
|
45
53
|
*/
|
|
46
54
|
export interface BlueprintContextKnowledgeBaseResource extends BlueprintResource {
|
|
@@ -58,7 +66,7 @@ export interface BlueprintContextKnowledgeBaseResource extends BlueprintResource
|
|
|
58
66
|
|
|
59
67
|
/**
|
|
60
68
|
* Configuration for a Context knowledge base.
|
|
61
|
-
* @beta
|
|
69
|
+
* @beta
|
|
62
70
|
* @category Resource Types
|
|
63
71
|
* @interface
|
|
64
72
|
*/
|
|
@@ -66,7 +74,9 @@ export type BlueprintContextKnowledgeBaseConfig = Omit<BlueprintContextKnowledge
|
|
|
66
74
|
|
|
67
75
|
/**
|
|
68
76
|
* A Context MCP endpoint resource.
|
|
69
|
-
*
|
|
77
|
+
*
|
|
78
|
+
* This feature is subject to breaking changes.
|
|
79
|
+
* @beta
|
|
70
80
|
* @category Resource Types
|
|
71
81
|
*/
|
|
72
82
|
export interface BlueprintContextMcpEndpointResource extends BlueprintResource {
|
|
@@ -89,7 +99,7 @@ export interface BlueprintContextMcpEndpointResource extends BlueprintResource {
|
|
|
89
99
|
|
|
90
100
|
/**
|
|
91
101
|
* Configuration for a Context MCP endpoint.
|
|
92
|
-
* @beta
|
|
102
|
+
* @beta
|
|
93
103
|
* @category Resource Types
|
|
94
104
|
* @interface
|
|
95
105
|
*/
|
package/src/types/cors.ts
CHANGED
|
@@ -3,7 +3,6 @@ import type {BlueprintProjectResourceLifecycle, BlueprintResource} from '../inde
|
|
|
3
3
|
/**
|
|
4
4
|
* Represents a CORS Origin resource.
|
|
5
5
|
* @see https://www.sanity.io/docs/content-lake/cors
|
|
6
|
-
* @beta This feature is subject to breaking changes.
|
|
7
6
|
* @category Resource Types
|
|
8
7
|
*/
|
|
9
8
|
export interface BlueprintCorsOriginResource extends BlueprintResource<BlueprintProjectResourceLifecycle> {
|
|
@@ -33,7 +32,6 @@ export interface BlueprintCorsOriginResource extends BlueprintResource<Blueprint
|
|
|
33
32
|
/**
|
|
34
33
|
* Configuration for a CORS Origin resource.
|
|
35
34
|
* @see https://www.sanity.io/docs/content-lake/cors
|
|
36
|
-
* @beta This feature is subject to breaking changes.
|
|
37
35
|
* @category Resource Types
|
|
38
36
|
* @interface
|
|
39
37
|
*/
|
package/src/types/datasets.ts
CHANGED
|
@@ -2,8 +2,6 @@ import type {BlueprintProjectResourceLifecycle, BlueprintResource} from '../inde
|
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* The ACL mode for a dataset.
|
|
5
|
-
* @alpha
|
|
6
|
-
* @hidden
|
|
7
5
|
* @category Resource Types
|
|
8
6
|
*/
|
|
9
7
|
export type AclMode = 'public' | 'private' | 'custom'
|
|
@@ -11,8 +9,6 @@ export type AclMode = 'public' | 'private' | 'custom'
|
|
|
11
9
|
/**
|
|
12
10
|
* Represents a Dataset resource.
|
|
13
11
|
* @see https://www.sanity.io/docs/content-lake/datasets
|
|
14
|
-
* @alpha This feature is subject to breaking changes.
|
|
15
|
-
* @hidden
|
|
16
12
|
* @category Resource Types
|
|
17
13
|
*/
|
|
18
14
|
export interface BlueprintDatasetResource extends BlueprintResource<BlueprintProjectResourceLifecycle> {
|
|
@@ -37,8 +33,6 @@ export interface BlueprintDatasetResource extends BlueprintResource<BlueprintPro
|
|
|
37
33
|
/**
|
|
38
34
|
* Configuration for a Dataset resource.
|
|
39
35
|
* @see https://www.sanity.io/docs/content-lake/datasets
|
|
40
|
-
* @alpha This feature is subject to breaking changes.
|
|
41
|
-
* @hidden
|
|
42
36
|
* @category Resource Types
|
|
43
37
|
* @interface
|
|
44
38
|
*/
|
|
@@ -10,12 +10,13 @@ import type {
|
|
|
10
10
|
import type {IanaTimezone} from './timezone.js'
|
|
11
11
|
|
|
12
12
|
export * from './event.js'
|
|
13
|
+
export * from './timezone.js'
|
|
13
14
|
|
|
14
15
|
/**
|
|
15
16
|
* Supported Function runtimes
|
|
16
17
|
* @category Functions Types
|
|
17
18
|
*/
|
|
18
|
-
export const VALID_RUNTIMES = ['node', 'nodejs22.x', 'nodejs24.x'] as const
|
|
19
|
+
export const VALID_RUNTIMES = ['node', 'nodejs22.x', 'nodejs24.x', 'nodejs26.x'] as const
|
|
19
20
|
/**
|
|
20
21
|
* Supported function runtimes
|
|
21
22
|
* @category Functions Types
|
|
@@ -44,7 +45,7 @@ interface BlueprintCommonFunctionResource extends BlueprintResource {
|
|
|
44
45
|
|
|
45
46
|
/**
|
|
46
47
|
* The runtime environment for the function (currently only Node.js is supported)
|
|
47
|
-
* @defaultValue '
|
|
48
|
+
* @defaultValue 'nodejs26.x'
|
|
48
49
|
*/
|
|
49
50
|
runtime?: FunctionRuntimes
|
|
50
51
|
}
|
|
@@ -67,12 +68,6 @@ interface QueueConfig {
|
|
|
67
68
|
* Definers accept the wider {@link DebounceInput} and parse it into this shape.
|
|
68
69
|
*/
|
|
69
70
|
debounce?: DebounceConfig
|
|
70
|
-
/**
|
|
71
|
-
* Whether to place messages that failed processing into a Dead Letter Queue.
|
|
72
|
-
* @todo: not implemented
|
|
73
|
-
* @default `false`
|
|
74
|
-
*/
|
|
75
|
-
dlq?: boolean
|
|
76
71
|
/**
|
|
77
72
|
* By default, queues employ at-least once delivery. When set to `true`, employs first-in-first-out ordering and exactly-once delivery.
|
|
78
73
|
* FIFO queues have a lower transaction-per-second limit.
|
|
@@ -82,6 +77,48 @@ interface QueueConfig {
|
|
|
82
77
|
fifo?: boolean
|
|
83
78
|
}
|
|
84
79
|
|
|
80
|
+
/**
|
|
81
|
+
* Configuration used when throttling Queue function types.
|
|
82
|
+
* Starts at most `limit` messages per `period`; messages over the rate stay queued and are delivered late, not dropped.
|
|
83
|
+
* @category Functions Types
|
|
84
|
+
* @alpha
|
|
85
|
+
* @hidden
|
|
86
|
+
*/
|
|
87
|
+
export interface ThrottleConfig {
|
|
88
|
+
/**
|
|
89
|
+
* Maximum number of messages started per `period`
|
|
90
|
+
*/
|
|
91
|
+
limit: number
|
|
92
|
+
/**
|
|
93
|
+
* Length of the throttle period in seconds
|
|
94
|
+
*/
|
|
95
|
+
period: number
|
|
96
|
+
/**
|
|
97
|
+
* Number of messages an idle queue may release at once before pacing resumes.
|
|
98
|
+
* Must not be greater than `limit`.
|
|
99
|
+
*/
|
|
100
|
+
burst?: number
|
|
101
|
+
/**
|
|
102
|
+
* Dotted path into `{event, context}`, e.g. `event.data.tenantId`; each distinct value is throttled in its own bucket.
|
|
103
|
+
* When omitted, the whole function is throttled as one bucket.
|
|
104
|
+
*/
|
|
105
|
+
key?: string
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Throttle configuration as accepted by a function definer, before durations are parsed.
|
|
110
|
+
* @category Functions Types
|
|
111
|
+
* @alpha
|
|
112
|
+
* @hidden
|
|
113
|
+
*/
|
|
114
|
+
export interface ThrottleConfigInput extends Omit<ThrottleConfig, 'period'> {
|
|
115
|
+
/**
|
|
116
|
+
* Length of the throttle period.
|
|
117
|
+
* A number is read as seconds, a string is parsed as a duration, e.g. `'1 minute'`.
|
|
118
|
+
*/
|
|
119
|
+
period: string | number
|
|
120
|
+
}
|
|
121
|
+
|
|
85
122
|
/**
|
|
86
123
|
* Configuration used when debouncing Queue or Workflow function types.
|
|
87
124
|
* @category Functions Types
|
|
@@ -98,7 +135,7 @@ export interface DebounceConfig {
|
|
|
98
135
|
*/
|
|
99
136
|
maxWindow?: number
|
|
100
137
|
/**
|
|
101
|
-
* Dotted path into {event, context} used to
|
|
138
|
+
* Dotted path into `{event, context}` used to group debounced events, e.g. `event.data.documentId`
|
|
102
139
|
*/
|
|
103
140
|
key?: string
|
|
104
141
|
}
|
|
@@ -117,7 +154,7 @@ export interface DebounceConfigInput extends Omit<DebounceConfig, 'window' | 'ma
|
|
|
117
154
|
window: string | number
|
|
118
155
|
/**
|
|
119
156
|
* Maximum time to extend a debounce window from the first event.
|
|
120
|
-
* Must be greater than `window`.
|
|
157
|
+
* Must be greater than or equal to `window`.
|
|
121
158
|
* A number is read as seconds, a string is parsed as a duration, e.g. `'1 hour'`.
|
|
122
159
|
*/
|
|
123
160
|
maxWindow?: string | number
|
|
@@ -193,6 +230,17 @@ export interface BlueprintQueueFunctionResource extends BlueprintBaseFunctionRes
|
|
|
193
230
|
type: 'sanity.function.queue'
|
|
194
231
|
/** Optional Content Lake event source that triggers the function */
|
|
195
232
|
event?: BlueprintFunctionResourceContentLakeEvent
|
|
233
|
+
/**
|
|
234
|
+
* Total delivery attempts per message, at most 1000: `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
|
+
* When omitted, a message is redelivered until the queue's retention period expires.
|
|
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
|
|
196
244
|
}
|
|
197
245
|
|
|
198
246
|
/**
|
|
@@ -205,7 +253,9 @@ export interface BlueprintPubSubFunctionResource extends BlueprintBaseFunctionRe
|
|
|
205
253
|
|
|
206
254
|
/**
|
|
207
255
|
* A durable, step-based function.
|
|
208
|
-
*
|
|
256
|
+
*
|
|
257
|
+
* Deploying Durable Functions via Blueprints is experimental.
|
|
258
|
+
* @beta
|
|
209
259
|
* @category Functions Types
|
|
210
260
|
*/
|
|
211
261
|
export interface BlueprintDurableFunctionResource extends BlueprintBaseFunctionResource {
|
|
@@ -301,12 +351,12 @@ export type BlueprintSyncTagInvalidateFunctionConfig = Omit<BlueprintSyncTagInva
|
|
|
301
351
|
/**
|
|
302
352
|
* Configuration for defining a queue function.
|
|
303
353
|
* @public
|
|
304
|
-
* @alpha
|
|
354
|
+
* @alpha
|
|
305
355
|
* @hidden
|
|
306
356
|
* @category Functions Types
|
|
307
357
|
* @interface
|
|
308
358
|
*/
|
|
309
|
-
export type BlueprintQueueFunctionConfig = Omit<BlueprintQueueFunctionResource, 'type' | 'src' | 'event' | 'debounce'> & {
|
|
359
|
+
export type BlueprintQueueFunctionConfig = Omit<BlueprintQueueFunctionResource, 'type' | 'src' | 'event' | 'debounce' | 'throttle'> & {
|
|
310
360
|
/**
|
|
311
361
|
* Path to the function source code
|
|
312
362
|
* @defaultValue `functions/${name}`
|
|
@@ -318,6 +368,9 @@ export type BlueprintQueueFunctionConfig = Omit<BlueprintQueueFunctionResource,
|
|
|
318
368
|
|
|
319
369
|
/** Optional debounce configuration, as a duration or a full config */
|
|
320
370
|
debounce?: DebounceInput
|
|
371
|
+
|
|
372
|
+
/** Optional throttle configuration */
|
|
373
|
+
throttle?: ThrottleConfigInput
|
|
321
374
|
}
|
|
322
375
|
|
|
323
376
|
/**
|
|
@@ -337,7 +390,7 @@ export type BlueprintPubSubFunctionConfig = Omit<BlueprintPubSubFunctionResource
|
|
|
337
390
|
/**
|
|
338
391
|
* Configuration for defining a durable function.
|
|
339
392
|
* @public
|
|
340
|
-
* @beta
|
|
393
|
+
* @beta
|
|
341
394
|
* @category Functions Types
|
|
342
395
|
* @interface
|
|
343
396
|
*/
|
|
@@ -3,13 +3,14 @@ import type {BlueprintResource} from '../index.js'
|
|
|
3
3
|
/**
|
|
4
4
|
* Fields shared by every singleton installation config resource.
|
|
5
5
|
*
|
|
6
|
+
* This feature is subject to breaking changes.
|
|
7
|
+
*
|
|
6
8
|
* @remarks
|
|
7
9
|
* The backend selects a provider from the resource `type`
|
|
8
10
|
* (`sanity.installation.config`), so every installation config shares that one
|
|
9
11
|
* type and is discriminated by `appType`.
|
|
10
|
-
* @beta
|
|
12
|
+
* @beta
|
|
11
13
|
* @category Resource Types
|
|
12
|
-
* @hidden
|
|
13
14
|
*/
|
|
14
15
|
export interface BlueprintInstallationConfigResourceBase extends BlueprintResource {
|
|
15
16
|
type: 'sanity.installation.config'
|
|
@@ -26,9 +27,10 @@ export interface BlueprintInstallationConfigResourceBase extends BlueprintResour
|
|
|
26
27
|
|
|
27
28
|
/**
|
|
28
29
|
* One custom field a Media Library configuration exposes.
|
|
29
|
-
*
|
|
30
|
+
*
|
|
31
|
+
* This feature is subject to breaking changes.
|
|
32
|
+
* @beta
|
|
30
33
|
* @category Resource Types
|
|
31
|
-
* @hidden
|
|
32
34
|
*/
|
|
33
35
|
export interface BlueprintMediaLibraryField {
|
|
34
36
|
/** Unique within the Media Library config. */
|
|
@@ -47,14 +49,15 @@ export interface BlueprintMediaLibraryField {
|
|
|
47
49
|
/**
|
|
48
50
|
* Represents a singleton Media Library configuration resource.
|
|
49
51
|
*
|
|
52
|
+
* This feature is subject to breaking changes.
|
|
53
|
+
*
|
|
50
54
|
* @remarks
|
|
51
55
|
* The Media Library is a Sanity-owned singleton, so this resource carries no
|
|
52
56
|
* application identity of its own — it only names the target `appType`, the
|
|
53
57
|
* config `root`, and its `fields`. The provider resolves the organization's
|
|
54
58
|
* media library installation id at deploy time.
|
|
55
|
-
* @beta
|
|
59
|
+
* @beta
|
|
56
60
|
* @category Resource Types
|
|
57
|
-
* @hidden
|
|
58
61
|
*/
|
|
59
62
|
export interface BlueprintMediaLibraryConfigResource extends BlueprintInstallationConfigResourceBase {
|
|
60
63
|
/** The target installation this config applies to. Set by the definer. */
|
|
@@ -73,20 +76,20 @@ export interface BlueprintMediaLibraryConfigResource extends BlueprintInstallati
|
|
|
73
76
|
/**
|
|
74
77
|
* A union of every singleton installation config resource, discriminated by `appType`.
|
|
75
78
|
*
|
|
79
|
+
* This feature is subject to breaking changes.
|
|
80
|
+
*
|
|
76
81
|
* @remarks
|
|
77
82
|
* Media Library is the only member today; additional installation configs are
|
|
78
83
|
* added to this union.
|
|
79
|
-
* @beta
|
|
84
|
+
* @beta
|
|
80
85
|
* @category Resource Types
|
|
81
|
-
* @hidden
|
|
82
86
|
*/
|
|
83
87
|
export type BlueprintInstallationConfigResource = BlueprintMediaLibraryConfigResource
|
|
84
88
|
|
|
85
89
|
/**
|
|
86
90
|
* Configuration for a singleton Media Library configuration resource.
|
|
87
|
-
* @beta
|
|
91
|
+
* @beta
|
|
88
92
|
* @category Resource Types
|
|
89
93
|
* @interface
|
|
90
|
-
* @hidden
|
|
91
94
|
*/
|
|
92
95
|
export type BlueprintMediaLibraryConfigConfig = Omit<BlueprintMediaLibraryConfigResource, 'type' | 'appType'>
|
package/src/types/permissions.ts
CHANGED
|
@@ -3,16 +3,20 @@ import type {BlueprintProjectResourceLifecycle, BlueprintResource} from '../inde
|
|
|
3
3
|
/**
|
|
4
4
|
* The type of a custom permission.
|
|
5
5
|
*
|
|
6
|
+
* This feature is subject to breaking changes.
|
|
7
|
+
*
|
|
6
8
|
* - **sanity.document.filter** A role grants document actions, such as `read` and `update`, on the documents that match the filter.
|
|
7
9
|
* - **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.
|
|
8
|
-
* @beta
|
|
10
|
+
* @beta
|
|
9
11
|
* @category Resource Types
|
|
10
12
|
*/
|
|
11
13
|
export type BlueprintPermissionType = 'sanity.document.filter' | 'sanity.document.filter.mode'
|
|
12
14
|
|
|
13
15
|
/**
|
|
14
16
|
* A custom permission resource that roles can grant.
|
|
15
|
-
*
|
|
17
|
+
*
|
|
18
|
+
* This feature is subject to breaking changes.
|
|
19
|
+
* @beta
|
|
16
20
|
* @category Resource Types
|
|
17
21
|
*/
|
|
18
22
|
export interface BlueprintPermissionResource extends BlueprintResource<BlueprintProjectResourceLifecycle> {
|
|
@@ -48,7 +52,7 @@ export interface BlueprintPermissionResource extends BlueprintResource<Blueprint
|
|
|
48
52
|
|
|
49
53
|
/**
|
|
50
54
|
* Configuration for a custom permission resource.
|
|
51
|
-
* @beta
|
|
55
|
+
* @beta
|
|
52
56
|
* @category Resource Types
|
|
53
57
|
* @interface
|
|
54
58
|
*/
|
|
@@ -56,7 +60,7 @@ export type BlueprintPermissionConfig = Omit<BlueprintPermissionResource, 'type'
|
|
|
56
60
|
|
|
57
61
|
/**
|
|
58
62
|
* Configuration for a content resource: a custom permission of type `sanity.document.filter.mode`, as the Manage UI makes it.
|
|
59
|
-
* @beta
|
|
63
|
+
* @beta
|
|
60
64
|
* @category Resource Types
|
|
61
65
|
*/
|
|
62
66
|
export interface BlueprintContentResourceConfig extends Omit<BlueprintPermissionConfig, 'permissionType' | 'config'> {
|
package/src/types/projects.ts
CHANGED
|
@@ -3,23 +3,25 @@ import type {BlueprintResource, BlueprintResourceLifecycle} from './resources.js
|
|
|
3
3
|
/**
|
|
4
4
|
* Reporesents a Sanity Project.
|
|
5
5
|
* @see https://www.sanity.io/docs/http-reference/projects-api
|
|
6
|
-
* @beta This feature is subject to breaking changes.
|
|
7
6
|
* @category Resource Types
|
|
8
|
-
* @hidden
|
|
9
7
|
*/
|
|
10
8
|
export interface BlueprintProjectResource extends BlueprintResource<BlueprintResourceLifecycle> {
|
|
11
9
|
type: 'sanity.project'
|
|
12
10
|
|
|
13
11
|
/** The name of the project, defaults to the resource name if not provided */
|
|
14
12
|
displayName?: string
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Path to the logo image, relative to the blueprint file. Uploaded on every deploy; omitting it removes the logo.
|
|
16
|
+
* PNG, JPEG, BMP, GIF, TIFF, SVG, WebP, HEIF or AVIF, up to 5 MB.
|
|
17
|
+
*/
|
|
18
|
+
logo?: string
|
|
15
19
|
}
|
|
16
20
|
|
|
17
21
|
/**
|
|
18
22
|
* Configuration for a Sanity Project.
|
|
19
23
|
* @see https://www.sanity.io/docs/http-reference/projects-api
|
|
20
|
-
* @beta This feature is subject to breaking changes.
|
|
21
24
|
* @category Resource Types
|
|
22
25
|
* @interface
|
|
23
|
-
* @hidden
|
|
24
26
|
*/
|
|
25
27
|
export type BlueprintProjectConfig = Omit<BlueprintProjectResource, 'type'>
|
package/src/types/robotTokens.ts
CHANGED
|
@@ -8,7 +8,6 @@ export type RobotTokenResourceType = 'organization' | 'project'
|
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Defines the robot token's roles within a given resource. Membership scope defaults to the robot token's scope.
|
|
11
|
-
* @beta This feature is subject to breaking changes.
|
|
12
11
|
* @category Resource Types
|
|
13
12
|
* @expand
|
|
14
13
|
*/
|
|
@@ -21,7 +20,6 @@ export interface RobotTokenMembership {
|
|
|
21
20
|
/**
|
|
22
21
|
* A robot token that provides automated access.
|
|
23
22
|
* @see https://www.sanity.io/docs/content-lake/http-auth#k4c21d7b829fe
|
|
24
|
-
* @beta This feature is subject to breaking changes.
|
|
25
23
|
* @category Resource Types
|
|
26
24
|
*/
|
|
27
25
|
export interface BlueprintRobotTokenResource extends BlueprintResource<BlueprintProjectResourceLifecycle> {
|
|
@@ -37,7 +35,6 @@ export interface BlueprintRobotTokenResource extends BlueprintResource<Blueprint
|
|
|
37
35
|
/**
|
|
38
36
|
* Configuration for a robot token that provides automated access.
|
|
39
37
|
* @see https://www.sanity.io/docs/content-lake/http-auth#k4c21d7b829fe
|
|
40
|
-
* @beta This feature is subject to breaking changes.
|
|
41
38
|
* @category Resource Types
|
|
42
39
|
* @interface
|
|
43
40
|
*/
|
package/src/types/roles.ts
CHANGED
|
@@ -2,7 +2,6 @@ import type {BlueprintProjectResourceLifecycle, BlueprintResource} from '../inde
|
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* A permission definition for a role.
|
|
5
|
-
* @beta This feature is subject to breaking changes.
|
|
6
5
|
* @category Resource Types
|
|
7
6
|
* @expand
|
|
8
7
|
*/
|
|
@@ -17,7 +16,6 @@ export interface RolePermission {
|
|
|
17
16
|
|
|
18
17
|
/**
|
|
19
18
|
* Configuration for a custom role.
|
|
20
|
-
* @beta This feature is subject to breaking changes.
|
|
21
19
|
* @category Resource Types
|
|
22
20
|
*/
|
|
23
21
|
export interface BlueprintRoleConfig extends Omit<BlueprintResource<BlueprintProjectResourceLifecycle>, 'type'> {
|
|
@@ -30,7 +28,6 @@ export interface BlueprintRoleConfig extends Omit<BlueprintResource<BlueprintPro
|
|
|
30
28
|
|
|
31
29
|
/**
|
|
32
30
|
* A custom role resource
|
|
33
|
-
* @beta This feature is subject to breaking changes.
|
|
34
31
|
* @category Resource Types
|
|
35
32
|
*/
|
|
36
33
|
export interface BlueprintRoleResource extends BlueprintRoleConfig, BlueprintResource<BlueprintProjectResourceLifecycle> {
|
|
@@ -39,7 +36,6 @@ export interface BlueprintRoleResource extends BlueprintRoleConfig, BlueprintRes
|
|
|
39
36
|
|
|
40
37
|
/**
|
|
41
38
|
* A custom role resource that is tied to a specific project
|
|
42
|
-
* @beta This feature is subject to breaking changes.
|
|
43
39
|
* @category Resource Types
|
|
44
40
|
*/
|
|
45
41
|
export interface BlueprintProjectRoleResource extends BlueprintRoleResource {
|
package/src/types/studios.ts
CHANGED
|
@@ -5,51 +5,64 @@ import type {BlueprintProjectResourceLifecycle, BlueprintResource} from '../inde
|
|
|
5
5
|
/**
|
|
6
6
|
* Custom Vite configuration for the Studio so it can be changed and extended.
|
|
7
7
|
* This type matches the type in @sanity/cli-core and must continue to remain compatible.
|
|
8
|
-
*
|
|
8
|
+
*
|
|
9
|
+
* This feature is subject to breaking changes.
|
|
10
|
+
* @beta
|
|
9
11
|
* @category Resource Types
|
|
10
|
-
* @hidden
|
|
11
12
|
*/
|
|
12
13
|
export type UserViteConfig = ((config: InlineConfig, env: ConfigEnv) => InlineConfig | Promise<InlineConfig>) | InlineConfig
|
|
13
14
|
|
|
14
15
|
/**
|
|
15
16
|
* The set of valid application visibilities.
|
|
16
|
-
*
|
|
17
|
+
*
|
|
18
|
+
* This feature is subject to breaking changes.
|
|
19
|
+
* @beta
|
|
17
20
|
* @category Resource Types
|
|
18
|
-
* @hidden
|
|
19
21
|
*/
|
|
20
22
|
export const APPLICATION_VISIBILITIES = ['default', 'unlisted', 'disabled'] as const
|
|
21
23
|
|
|
22
24
|
/**
|
|
23
25
|
* The visibility of the studio in the dashboard.
|
|
24
|
-
*
|
|
26
|
+
*
|
|
27
|
+
* This feature is subject to breaking changes.
|
|
28
|
+
* @beta
|
|
25
29
|
* @category Resource Types
|
|
26
|
-
* @hidden
|
|
27
30
|
*/
|
|
28
31
|
export type ApplicationVisibility = (typeof APPLICATION_VISIBILITIES)[number]
|
|
29
32
|
|
|
30
33
|
/**
|
|
31
34
|
* A workspace definition extracted from a studio's configuration during the build.
|
|
32
|
-
*
|
|
35
|
+
*
|
|
36
|
+
* This feature is subject to breaking changes.
|
|
37
|
+
* @beta
|
|
33
38
|
* @category Resource Types
|
|
34
|
-
* @hidden
|
|
35
39
|
*/
|
|
36
40
|
export type StudioWorkspace = {
|
|
41
|
+
/** The project ID of the workspace */
|
|
37
42
|
projectId: string
|
|
43
|
+
/** The dataset of the workspace */
|
|
38
44
|
dataset: string
|
|
45
|
+
/** The ID of the deployed schema descriptor for the workspace */
|
|
39
46
|
schemaDescriptorId: string
|
|
47
|
+
/** The workspace name */
|
|
40
48
|
name: string
|
|
49
|
+
/** The workspace title */
|
|
41
50
|
title: string | undefined
|
|
51
|
+
/** The workspace subtitle */
|
|
42
52
|
subtitle: string | undefined
|
|
53
|
+
/** The workspace base path */
|
|
43
54
|
basePath: string | undefined
|
|
55
|
+
/** The workspace icon */
|
|
44
56
|
icon: string | undefined
|
|
45
57
|
}
|
|
46
58
|
|
|
47
59
|
/**
|
|
48
60
|
* Represents a Studio resource.
|
|
61
|
+
*
|
|
62
|
+
* This feature is subject to breaking changes.
|
|
49
63
|
* @see https://www.sanity.io/docs/studio
|
|
50
|
-
* @beta
|
|
64
|
+
* @beta
|
|
51
65
|
* @category Resource Types
|
|
52
|
-
* @hidden
|
|
53
66
|
*/
|
|
54
67
|
export interface BlueprintStudioResource extends BlueprintResource<BlueprintProjectResourceLifecycle> {
|
|
55
68
|
type: 'sanity.studio'
|
|
@@ -70,7 +83,10 @@ export interface BlueprintStudioResource extends BlueprintResource<BlueprintProj
|
|
|
70
83
|
/** Title for the studio. */
|
|
71
84
|
title: string
|
|
72
85
|
|
|
73
|
-
/**
|
|
86
|
+
/**
|
|
87
|
+
* Path to the icon image, relative to `root`. Uploaded on every deploy; omitting it removes the icon.
|
|
88
|
+
* PNG, JPEG, BMP, GIF, TIFF, SVG, WebP, HEIF or AVIF, up to 5 MB.
|
|
89
|
+
*/
|
|
74
90
|
icon?: string
|
|
75
91
|
|
|
76
92
|
/** Dashboard visibility */
|
|
@@ -118,10 +134,9 @@ export interface BlueprintStudioResource extends BlueprintResource<BlueprintProj
|
|
|
118
134
|
/**
|
|
119
135
|
* Configuration for a Studio resource.
|
|
120
136
|
* @see https://www.sanity.io/docs/studio
|
|
121
|
-
* @beta
|
|
137
|
+
* @beta
|
|
122
138
|
* @category Resource Types
|
|
123
139
|
* @interface
|
|
124
|
-
* @hidden
|
|
125
140
|
*/
|
|
126
141
|
export interface BlueprintStudioConfig extends Omit<BlueprintStudioResource, 'type' | 'slug' | 'title' | 'autoUpdates'> {
|
|
127
142
|
/**
|
package/src/types/webhooks.ts
CHANGED
|
@@ -2,14 +2,12 @@ import type {BlueprintProjectResourceLifecycle, BlueprintResource} from '../inde
|
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Types of events that can trigger a webhook
|
|
5
|
-
* @beta This feature is subject to breaking changes.
|
|
6
5
|
* @category Resource Types
|
|
7
6
|
*/
|
|
8
7
|
export type WebhookTrigger = 'create' | 'update' | 'delete'
|
|
9
8
|
|
|
10
9
|
/**
|
|
11
10
|
* A webhook resource definition
|
|
12
|
-
* @beta This feature is subject to breaking changes.
|
|
13
11
|
* @category Resource Types
|
|
14
12
|
*/
|
|
15
13
|
export interface BlueprintDocumentWebhookResource extends BlueprintResource<BlueprintProjectResourceLifecycle> {
|
|
@@ -38,7 +36,6 @@ export interface BlueprintDocumentWebhookResource extends BlueprintResource<Blue
|
|
|
38
36
|
|
|
39
37
|
/**
|
|
40
38
|
* Configuration for a webhook
|
|
41
|
-
* @beta This feature is subject to breaking changes.
|
|
42
39
|
* @category Resource Types
|
|
43
40
|
* @interface
|
|
44
41
|
*/
|
package/src/utils/debounce.ts
CHANGED
|
@@ -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
|
import {parseDuration} from './parse-duration.js'
|
|
4
3
|
|
|
@@ -27,27 +26,3 @@ export function createDebounceObject(debounce: DebounceInput): DebounceConfig {
|
|
|
27
26
|
...(key !== undefined && {key}),
|
|
28
27
|
}
|
|
29
28
|
}
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* Resolves a debounce duration, given either as a number of seconds or as a duration string, to seconds.
|
|
33
|
-
* @param field The name of the field being resolved, used in error messages
|
|
34
|
-
* @param value The value to resolve
|
|
35
|
-
* @returns The value in seconds, or the errors that prevented it from being resolved
|
|
36
|
-
*/
|
|
37
|
-
export function resolveDebounceDuration(field: string, value: unknown): {seconds?: number; errors: BlueprintError[]} {
|
|
38
|
-
if (typeof value === 'number') {
|
|
39
|
-
return Number.isFinite(value)
|
|
40
|
-
? {seconds: value, errors: []}
|
|
41
|
-
: {errors: [{type: 'invalid_value', message: `\`${field}\` must be a valid duration`}]}
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
if (typeof value === 'string') {
|
|
45
|
-
try {
|
|
46
|
-
return {seconds: parseDuration(value, 's'), errors: []}
|
|
47
|
-
} catch {
|
|
48
|
-
return {errors: [{type: 'invalid_value', message: `\`${field}\` must be a valid duration`}]}
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
return {errors: [{type: 'invalid_type', message: `\`${field}\` must be a number of seconds or a duration string`}]}
|
|
53
|
-
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import parse from 'parse-duration'
|
|
2
|
+
import type {BlueprintError} from '../types/errors.js'
|
|
2
3
|
|
|
3
4
|
type DurationUnit = 'ms' | 's' | 'm' | 'h' | 'd' | 'w' | 'mo' | 'y'
|
|
4
5
|
|
|
@@ -36,3 +37,29 @@ export function parseDuration(duration: string | number, unit: DurationUnit = 's
|
|
|
36
37
|
|
|
37
38
|
return parsed
|
|
38
39
|
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Resolves a duration field, given either as a number of seconds or as a duration string, to seconds.
|
|
43
|
+
* Unlike {@link parseDuration} this never throws, so validators can report the problem instead.
|
|
44
|
+
* @param field The name of the field being resolved, used in error messages
|
|
45
|
+
* @param value The value to resolve
|
|
46
|
+
* @internal
|
|
47
|
+
* @returns The value in seconds, or the errors that prevented it from being resolved
|
|
48
|
+
*/
|
|
49
|
+
export function resolveDuration(field: string, value: unknown): {seconds?: number; errors: BlueprintError[]} {
|
|
50
|
+
if (typeof value === 'number') {
|
|
51
|
+
return Number.isFinite(value)
|
|
52
|
+
? {seconds: value, errors: []}
|
|
53
|
+
: {errors: [{type: 'invalid_value', message: `\`${field}\` must be a valid duration`}]}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
if (typeof value === 'string') {
|
|
57
|
+
try {
|
|
58
|
+
return {seconds: parseDuration(value, 's'), errors: []}
|
|
59
|
+
} catch {
|
|
60
|
+
return {errors: [{type: 'invalid_value', message: `\`${field}\` must be a valid duration`}]}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
return {errors: [{type: 'invalid_type', message: `\`${field}\` must be a number of seconds or a duration string`}]}
|
|
65
|
+
}
|