@sanity/blueprints 0.30.0 → 0.32.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.
@@ -0,0 +1,88 @@
1
+ import { type BlueprintContextKnowledgeBaseConfig, type BlueprintContextKnowledgeBaseResource, type BlueprintContextMcpEndpointConfig, type BlueprintContextMcpEndpointResource } from '../index.js';
2
+ /**
3
+ * Defines a Context knowledge base.
4
+ *
5
+ * @remarks
6
+ * The blueprint must be scoped to an organization. A new knowledge base has no sources. Add sources in the Context API
7
+ * or the dashboard.
8
+ *
9
+ * The default deletion policy is `retain`. If the stack is destroyed, the knowledge base is detached and not deleted. If
10
+ * the resource is removed from the blueprint, the deploy fails. To remove the resource, first deploy it with one of these
11
+ * `lifecycle` values:
12
+ * - `{ownershipAction: {type: 'detach'}}` keeps the knowledge base.
13
+ * - `{deletionPolicy: 'allow'}` deletes the knowledge base.
14
+ *
15
+ * @example
16
+ * ```ts
17
+ * defineContextKnowledgeBase({
18
+ * name: 'product-docs',
19
+ * title: 'Product docs',
20
+ * description: 'Everything about the product',
21
+ * })
22
+ * ```
23
+ *
24
+ * @example Detach before removal
25
+ * ```ts
26
+ * defineContextKnowledgeBase({
27
+ * name: 'product-docs',
28
+ * title: 'Product docs',
29
+ * description: 'Everything about the product',
30
+ * lifecycle: {ownershipAction: {type: 'detach'}},
31
+ * })
32
+ * ```
33
+ * @param parameters The knowledge base configuration
34
+ * @public
35
+ * @beta Deploying Context via Blueprints is experimental. This feature is stabilizing but may still be subject to breaking changes.
36
+ * @category Definers
37
+ * @expandType BlueprintContextKnowledgeBaseConfig
38
+ * @returns The knowledge base resource
39
+ */
40
+ export declare function defineContextKnowledgeBase(parameters: BlueprintContextKnowledgeBaseConfig): BlueprintContextKnowledgeBaseResource;
41
+ /**
42
+ * Defines a Context MCP endpoint that agents connect to.
43
+ *
44
+ * @remarks
45
+ * The blueprint must be scoped to an organization.
46
+ *
47
+ * @example
48
+ * ```ts
49
+ * defineContextMcpEndpoint({
50
+ * name: 'support-agent',
51
+ * title: 'Support agent',
52
+ * sources: [{type: 'dataset', id: 'abc123.production'}],
53
+ * })
54
+ * ```
55
+ *
56
+ * @example Knowledge base and dataset sources
57
+ * ```ts
58
+ * const productDocs = defineContextKnowledgeBase({
59
+ * name: 'product-docs',
60
+ * title: 'Product docs',
61
+ * description: 'Everything about the product',
62
+ * })
63
+ *
64
+ * defineContextMcpEndpoint({
65
+ * name: 'support-agent',
66
+ * title: 'Support agent',
67
+ * sources: [productDocs, {type: 'dataset', id: 'abc123.production'}],
68
+ * instructions: 'Answer questions about the product.',
69
+ * groqFilter: '_type in ["article", "faq"]',
70
+ * })
71
+ * ```
72
+ *
73
+ * @example Dataset settings
74
+ * ```ts
75
+ * defineContextMcpEndpoint({
76
+ * name: 'editor-agent',
77
+ * title: 'Editor agent',
78
+ * sources: [{type: 'dataset', id: 'abc123.production', workspace: 'marketing', perspective: 'drafts', semanticSearch: false}],
79
+ * })
80
+ * ```
81
+ * @param parameters The MCP endpoint configuration
82
+ * @public
83
+ * @beta Deploying Context via Blueprints is experimental. This feature is stabilizing but may still be subject to breaking changes.
84
+ * @category Definers
85
+ * @expandType BlueprintContextMcpEndpointConfig
86
+ * @returns The MCP endpoint resource
87
+ */
88
+ export declare function defineContextMcpEndpoint(parameters: BlueprintContextMcpEndpointConfig): BlueprintContextMcpEndpointResource;
@@ -0,0 +1,108 @@
1
+ import { validateContextKnowledgeBase, validateContextMcpEndpoint, } from '../index.js';
2
+ import { runValidation } from '../utils/validation.js';
3
+ /**
4
+ * Defines a Context knowledge base.
5
+ *
6
+ * @remarks
7
+ * The blueprint must be scoped to an organization. A new knowledge base has no sources. Add sources in the Context API
8
+ * or the dashboard.
9
+ *
10
+ * The default deletion policy is `retain`. If the stack is destroyed, the knowledge base is detached and not deleted. If
11
+ * the resource is removed from the blueprint, the deploy fails. To remove the resource, first deploy it with one of these
12
+ * `lifecycle` values:
13
+ * - `{ownershipAction: {type: 'detach'}}` keeps the knowledge base.
14
+ * - `{deletionPolicy: 'allow'}` deletes the knowledge base.
15
+ *
16
+ * @example
17
+ * ```ts
18
+ * defineContextKnowledgeBase({
19
+ * name: 'product-docs',
20
+ * title: 'Product docs',
21
+ * description: 'Everything about the product',
22
+ * })
23
+ * ```
24
+ *
25
+ * @example Detach before removal
26
+ * ```ts
27
+ * defineContextKnowledgeBase({
28
+ * name: 'product-docs',
29
+ * title: 'Product docs',
30
+ * description: 'Everything about the product',
31
+ * lifecycle: {ownershipAction: {type: 'detach'}},
32
+ * })
33
+ * ```
34
+ * @param parameters The knowledge base configuration
35
+ * @public
36
+ * @beta Deploying Context via Blueprints is experimental. This feature is stabilizing but may still be subject to breaking changes.
37
+ * @category Definers
38
+ * @expandType BlueprintContextKnowledgeBaseConfig
39
+ * @returns The knowledge base resource
40
+ */
41
+ export function defineContextKnowledgeBase(parameters) {
42
+ const knowledgeBaseResource = {
43
+ ...parameters,
44
+ type: 'sanity.context.knowledge-base',
45
+ };
46
+ runValidation(() => validateContextKnowledgeBase(knowledgeBaseResource));
47
+ return knowledgeBaseResource;
48
+ }
49
+ /**
50
+ * Defines a Context MCP endpoint that agents connect to.
51
+ *
52
+ * @remarks
53
+ * The blueprint must be scoped to an organization.
54
+ *
55
+ * @example
56
+ * ```ts
57
+ * defineContextMcpEndpoint({
58
+ * name: 'support-agent',
59
+ * title: 'Support agent',
60
+ * sources: [{type: 'dataset', id: 'abc123.production'}],
61
+ * })
62
+ * ```
63
+ *
64
+ * @example Knowledge base and dataset sources
65
+ * ```ts
66
+ * const productDocs = defineContextKnowledgeBase({
67
+ * name: 'product-docs',
68
+ * title: 'Product docs',
69
+ * description: 'Everything about the product',
70
+ * })
71
+ *
72
+ * defineContextMcpEndpoint({
73
+ * name: 'support-agent',
74
+ * title: 'Support agent',
75
+ * sources: [productDocs, {type: 'dataset', id: 'abc123.production'}],
76
+ * instructions: 'Answer questions about the product.',
77
+ * groqFilter: '_type in ["article", "faq"]',
78
+ * })
79
+ * ```
80
+ *
81
+ * @example Dataset settings
82
+ * ```ts
83
+ * defineContextMcpEndpoint({
84
+ * name: 'editor-agent',
85
+ * title: 'Editor agent',
86
+ * sources: [{type: 'dataset', id: 'abc123.production', workspace: 'marketing', perspective: 'drafts', semanticSearch: false}],
87
+ * })
88
+ * ```
89
+ * @param parameters The MCP endpoint configuration
90
+ * @public
91
+ * @beta Deploying Context via Blueprints is experimental. This feature is stabilizing but may still be subject to breaking changes.
92
+ * @category Definers
93
+ * @expandType BlueprintContextMcpEndpointConfig
94
+ * @returns The MCP endpoint resource
95
+ */
96
+ export function defineContextMcpEndpoint(parameters) {
97
+ const mcpEndpointResource = {
98
+ ...parameters,
99
+ type: 'sanity.context.mcp',
100
+ // Malformed sources pass through untouched, so validation reports them instead of throwing here.
101
+ sources: Array.isArray(parameters.sources)
102
+ ? parameters.sources.map((source) => source?.type === 'sanity.context.knowledge-base' ? { type: 'knowledge-base', id: `$.resources.${source.name}` } : source)
103
+ : parameters.sources,
104
+ };
105
+ runValidation(() => validateContextMcpEndpoint(mcpEndpointResource));
106
+ return mcpEndpointResource;
107
+ }
108
+ //# sourceMappingURL=context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context.js","sourceRoot":"","sources":["../../src/definers/context.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,4BAA4B,EAC5B,0BAA0B,GAC3B,MAAM,aAAa,CAAA;AACpB,OAAO,EAAC,aAAa,EAAC,MAAM,wBAAwB,CAAA;AAEpD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,MAAM,UAAU,0BAA0B,CAAC,UAA+C;IACxF,MAAM,qBAAqB,GAA0C;QACnE,GAAG,UAAU;QACb,IAAI,EAAE,+BAA+B;KACtC,CAAA;IAED,aAAa,CAAC,GAAG,EAAE,CAAC,4BAA4B,CAAC,qBAAqB,CAAC,CAAC,CAAA;IAExE,OAAO,qBAAqB,CAAA;AAC9B,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AACH,MAAM,UAAU,wBAAwB,CAAC,UAA6C;IACpF,MAAM,mBAAmB,GAAwC;QAC/D,GAAG,UAAU;QACb,IAAI,EAAE,oBAAoB;QAC1B,iGAAiG;QACjG,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC;YACxC,CAAC,CAAC,UAAU,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAChC,MAAM,EAAE,IAAI,KAAK,+BAA+B,CAAC,CAAC,CAAC,EAAC,IAAI,EAAE,gBAAgB,EAAE,EAAE,EAAE,eAAe,MAAM,CAAC,IAAI,EAAE,EAAC,CAAC,CAAC,CAAC,MAAM,CACvH;YACH,CAAC,CAAC,UAAU,CAAC,OAAO;KACvB,CAAA;IAED,aAAa,CAAC,GAAG,EAAE,CAAC,0BAA0B,CAAC,mBAAmB,CAAC,CAAC,CAAA;IAEpE,OAAO,mBAAmB,CAAA;AAC5B,CAAC"}
@@ -8,17 +8,13 @@ import { type BlueprintDurableConfig, type BlueprintDurableFunctionResource } fr
8
8
  * defineDurableFunction({
9
9
  * name: 'daily-cleanup',
10
10
  * event: {type: 'document', on: ['create'], filter: "_type == 'post'"},
11
- * concurrency: 5,
12
- * debounce: 10,
13
11
  * })
14
12
  * ```
15
13
  *
16
- *
17
14
  * @param functionConfig The configuration for the function
18
15
  * @category Definers
19
- * @alpha Deploying Durable Functions via Blueprints is experimental. This feature is not available publicly yet.
16
+ * @beta Deploying Durable Functions via Blueprints is experimental.
20
17
  * @public
21
- * @hidden
22
18
  * @expandType BlueprintDurableConfig
23
19
  * @returns The validated durable function resource
24
20
  */
@@ -1,5 +1,4 @@
1
1
  import { validateDurableFunction } from '../../index.js';
2
- import { createDebounceObject } from '../../utils/debounce.js';
3
2
  import { parseDuration } from '../../utils/parse-duration.js';
4
3
  import { runValidation } from '../../utils/validation.js';
5
4
  import { defineFunction } from './index.js';
@@ -12,29 +11,26 @@ import { defineFunction } from './index.js';
12
11
  * defineDurableFunction({
13
12
  * name: 'daily-cleanup',
14
13
  * event: {type: 'document', on: ['create'], filter: "_type == 'post'"},
15
- * concurrency: 5,
16
- * debounce: 10,
17
14
  * })
18
15
  * ```
19
16
  *
20
- *
21
17
  * @param functionConfig The configuration for the function
22
18
  * @category Definers
23
- * @alpha Deploying Durable Functions via Blueprints is experimental. This feature is not available publicly yet.
19
+ * @beta Deploying Durable Functions via Blueprints is experimental.
24
20
  * @public
25
- * @hidden
26
21
  * @expandType BlueprintDurableConfig
27
22
  * @returns The validated durable function resource
28
23
  */
29
24
  export function defineDurableFunction(functionConfig) {
30
- const { name, event, concurrency, debounce, src, durableTimeout } = functionConfig;
25
+ const { name, event, src, durableTimeout } = functionConfig;
31
26
  const functionResource = {
32
27
  ...defineFunction({ ...functionConfig, src: src ?? `functions/${name}` }, { skipValidation: true }),
33
28
  type: 'sanity.function.durable',
34
29
  ...(event !== undefined && { event }),
35
30
  ...(durableTimeout !== undefined && { durableTimeout: parseDuration(durableTimeout, 's') }),
36
- ...(concurrency !== undefined && { concurrency }),
37
- ...(debounce !== undefined && { debounce: createDebounceObject(debounce) }),
31
+ // TODO: eventually support queue fields once backend supports it
32
+ // ...(concurrency !== undefined && {concurrency}),
33
+ // ...(debounce !== undefined && {debounce: createDebounceObject(debounce)}),
38
34
  };
39
35
  runValidation(() => validateDurableFunction(functionResource));
40
36
  return functionResource;
@@ -1 +1 @@
1
- {"version":3,"file":"durable.js","sourceRoot":"","sources":["../../../src/definers/functions/durable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqE,uBAAuB,EAAC,MAAM,gBAAgB,CAAA;AAC1H,OAAO,EAAC,oBAAoB,EAAC,MAAM,yBAAyB,CAAA;AAC5D,OAAO,EAAC,aAAa,EAAC,MAAM,+BAA+B,CAAA;AAC3D,OAAO,EAAC,aAAa,EAAC,MAAM,2BAA2B,CAAA;AACvD,OAAO,EAAC,cA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cAAsC;IAC1E,MAAM,EAAC,IAAI,EAAE,KAAK,EAAE,GAAG,EAAE,cAAc,EAAC,GAAG,cAAc,CAAA;IACzD,MAAM,gBAAgB,GAAqC;QACzD,GAAG,cAAc,CAAC,EAAC,GAAG,cAAc,EAAE,GAAG,EAAE,GAAG,IAAI,aAAa,IAAI,EAAE,EAAC,EAAE,EAAC,cAAc,EAAE,IAAI,EAAC,CAAC;QAC/F,IAAI,EAAE,yBAAyB;QAC/B,GAAG,CAAC,KAAK,KAAK,SAAS,IAAI,EAAC,KAAK,EAAC,CAAC;QACnC,GAAG,CAAC,cAAc,KAAK,SAAS,IAAI,EAAC,cAAc,EAAE,aAAa,CAAC,cAAc,EAAE,GAAG,CAAC,EAAC,CAAC;QACzF,iEAAiE;QACjE,mDAAmD;QACnD,6EAA6E;KAC9E,CAAA;IAED,aAAa,CAAC,GAAG,EAAE,CAAC,uBAAuB,CAAC,gBAAgB,CAAC,CAAC,CAAA;IAC9D,OAAO,gBAAgB,CAAA;AACzB,CAAC"}
package/dist/index.d.ts CHANGED
@@ -8,6 +8,7 @@
8
8
  */
9
9
  export * from './definers/applications.js';
10
10
  export * from './definers/blueprints.js';
11
+ export * from './definers/context.js';
11
12
  export * from './definers/cors.js';
12
13
  export * from './definers/datasets.js';
13
14
  export * from './definers/functions/document.js';
@@ -37,6 +38,7 @@ export * from './definers/webhooks.js';
37
38
  */
38
39
  export * from './types/applications.js';
39
40
  export * from './types/blueprints.js';
41
+ export * from './types/context.js';
40
42
  export * from './types/cors.js';
41
43
  export * from './types/datasets.js';
42
44
  export * from './types/errors.js';
@@ -56,6 +58,7 @@ export * from './types/webhooks.js';
56
58
  */
57
59
  export * from './validation/applications.js';
58
60
  export * from './validation/blueprints.js';
61
+ export * from './validation/context.js';
59
62
  export * from './validation/cors.js';
60
63
  export * from './validation/datasets.js';
61
64
  export * from './validation/functions.js';
package/dist/index.js CHANGED
@@ -9,6 +9,7 @@
9
9
  */
10
10
  export * from './definers/applications.js';
11
11
  export * from './definers/blueprints.js';
12
+ export * from './definers/context.js';
12
13
  export * from './definers/cors.js';
13
14
  export * from './definers/datasets.js';
14
15
  export * from './definers/functions/document.js';
@@ -39,6 +40,7 @@ export * from './definers/webhooks.js';
39
40
  */
40
41
  export * from './types/applications.js';
41
42
  export * from './types/blueprints.js';
43
+ export * from './types/context.js';
42
44
  export * from './types/cors.js';
43
45
  export * from './types/datasets.js';
44
46
  export * from './types/errors.js';
@@ -59,6 +61,7 @@ export * from './types/webhooks.js';
59
61
  */
60
62
  export * from './validation/applications.js';
61
63
  export * from './validation/blueprints.js';
64
+ export * from './validation/context.js';
62
65
  export * from './validation/cors.js';
63
66
  export * from './validation/datasets.js';
64
67
  export * from './validation/functions.js';
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,kDAAkD;AAClD;;;GAGG;AACH;;;GAGG;AACH,cAAc,4BAA4B,CAAA;AAC1C,cAAc,0BAA0B,CAAA;AACxC,cAAc,oBAAoB,CAAA;AAClC,cAAc,wBAAwB,CAAA;AACtC,cAAc,kCAAkC,CAAA;AAChD,cAAc,iCAAiC,CAAA;AAC/C,cAAc,+BAA+B,CAAA;AAC7C,cAAc,uCAAuC,CAAA;AACrD,cAAc,gCAAgC,CAAA;AAC9C,cAAc,+BAA+B,CAAA;AAC7C,cAAc,mCAAmC,CAAA;AACjD,cAAc,6CAA6C,CAAA;AAC3D,cAAc,mCAAmC,CAAA;AACjD,cAAc,2BAA2B,CAAA;AACzC,cAAc,wBAAwB,CAAA;AACtC,cAAc,yBAAyB,CAAA;AACvC,cAAc,sBAAsB,CAAA;AACpC,cAAc,2BAA2B,CAAA;AACzC,cAAc,qBAAqB,CAAA;AACnC,cAAc,uBAAuB,CAAA;AACrC,cAAc,wBAAwB,CAAA;AAEtC,uCAAuC;AACvC;;;GAGG;AACH;;;GAGG;AACH,cAAc,yBAAyB,CAAA;AACvC,cAAc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../index.js';
2
+ /**
3
+ * A knowledge base that a Context MCP endpoint serves.
4
+ * @beta This feature is subject to breaking changes.
5
+ * @category Resource Types
6
+ */
7
+ export interface ContextKnowledgeBaseSource {
8
+ type: 'knowledge-base';
9
+ /** A knowledge base in the blueprint as `$.resources.<name>`, or the ID (`kb…`) of a knowledge base. */
10
+ id: string;
11
+ }
12
+ /**
13
+ * A Sanity dataset that a Context MCP endpoint serves.
14
+ * @beta This feature is subject to breaking changes.
15
+ * @category Resource Types
16
+ */
17
+ export interface ContextDatasetSource {
18
+ type: 'dataset';
19
+ /** The dataset as `<projectId>.<datasetName>`, for example `abc123.production`. It can't be a `$.resources.<name>` reference. */
20
+ id: string;
21
+ /** The studio workspace whose schema agents use, by name. `null` uses the studio's first workspace. */
22
+ workspace?: string | null;
23
+ /** The perspective agents query the dataset with. `null` uses `published`. */
24
+ perspective?: 'published' | 'drafts' | 'raw' | null;
25
+ /**
26
+ * Whether agents can use semantic search on the dataset. `false` turns it off. `true` or `null` use it while the
27
+ * dataset has embeddings enabled.
28
+ */
29
+ semanticSearch?: boolean | null;
30
+ }
31
+ /**
32
+ * Content that a Context MCP endpoint serves.
33
+ * @beta This feature is subject to breaking changes.
34
+ * @category Resource Types
35
+ */
36
+ export type ContextMcpEndpointSource = ContextKnowledgeBaseSource | ContextDatasetSource;
37
+ /**
38
+ * A Context knowledge base resource.
39
+ * @beta This feature is subject to breaking changes.
40
+ * @category Resource Types
41
+ */
42
+ export interface BlueprintContextKnowledgeBaseResource extends BlueprintResource {
43
+ type: 'sanity.context.knowledge-base';
44
+ /**
45
+ * The resource name in the blueprint. The knowledge base has no name, only a `title`. With the default deletion
46
+ * policy (`retain`), a deploy fails if this name changes.
47
+ */
48
+ name: string;
49
+ /** The knowledge base title, up to 100 characters. */
50
+ title: string;
51
+ /** What the knowledge base covers, up to 2,000 characters. */
52
+ description: string;
53
+ }
54
+ /**
55
+ * Configuration for a Context knowledge base.
56
+ * @beta This feature is subject to breaking changes.
57
+ * @category Resource Types
58
+ * @interface
59
+ */
60
+ export type BlueprintContextKnowledgeBaseConfig = Omit<BlueprintContextKnowledgeBaseResource, 'type'>;
61
+ /**
62
+ * A Context MCP endpoint resource.
63
+ * @beta This feature is subject to breaking changes.
64
+ * @category Resource Types
65
+ */
66
+ export interface BlueprintContextMcpEndpointResource extends BlueprintResource {
67
+ type: 'sanity.context.mcp';
68
+ /**
69
+ * The endpoint name in the URL that agents connect to: lowercase letters, digits and single hyphens, up to 64
70
+ * characters. The names `by-name` and `mcp` followed by 8 letters or digits are reserved. With the default deletion
71
+ * policy (`allow`), a change deletes the endpoint and creates a new endpoint with a new URL.
72
+ */
73
+ name: string;
74
+ /** The endpoint title, up to 100 characters. */
75
+ title: string;
76
+ /** What the endpoint serves: any number of knowledge bases and at most one dataset. */
77
+ sources: ContextMcpEndpointSource[];
78
+ /** Instructions for agents that connect to the endpoint, up to 10,000 characters. */
79
+ instructions?: string;
80
+ /** A GROQ filter for the documents that the dataset source serves. It requires a dataset source. */
81
+ groqFilter?: string;
82
+ }
83
+ /**
84
+ * Configuration for a Context MCP endpoint.
85
+ * @beta This feature is subject to breaking changes.
86
+ * @category Resource Types
87
+ * @interface
88
+ */
89
+ export type BlueprintContextMcpEndpointConfig = Omit<BlueprintContextMcpEndpointResource, 'type' | 'sources'> & {
90
+ /**
91
+ * What the endpoint serves: any number of knowledge bases and at most one dataset. A knowledge base source can also
92
+ * be the resource that {@link defineContextKnowledgeBase} returns.
93
+ */
94
+ sources: Array<ContextMcpEndpointSource | BlueprintContextKnowledgeBaseResource>;
95
+ };
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context.js","sourceRoot":"","sources":["../../src/types/context.ts"],"names":[],"mappings":""}
@@ -180,11 +180,10 @@ export interface BlueprintPubSubFunctionResource extends BlueprintBaseFunctionRe
180
180
  }
181
181
  /**
182
182
  * A durable, step-based function.
183
- * @alpha Deploying Durable Functions via Blueprints is experimental. This feature is not available publicly yet.
184
- * @hidden
183
+ * @beta Deploying Durable Functions via Blueprints is experimental.
185
184
  * @category Functions Types
186
185
  */
187
- export interface BlueprintDurableFunctionResource extends BlueprintBaseFunctionResource, QueueConfig {
186
+ export interface BlueprintDurableFunctionResource extends BlueprintBaseFunctionResource {
188
187
  type: 'sanity.function.durable';
189
188
  event?: BlueprintFunctionResourceContentLakeEvent;
190
189
  /**
@@ -301,12 +300,11 @@ export type BlueprintPubSubFunctionConfig = Omit<BlueprintPubSubFunctionResource
301
300
  /**
302
301
  * Configuration for defining a durable function.
303
302
  * @public
304
- * @alpha Deploying Durable Functions via Blueprints is experimental. This feature is not available publicly yet.
305
- * @hidden
303
+ * @beta Deploying Durable Functions via Blueprints is experimental.
306
304
  * @category Functions Types
307
305
  * @interface
308
306
  */
309
- export type BlueprintDurableConfig = Omit<BlueprintDurableFunctionResource, 'type' | 'src' | 'event' | 'durableTimeout' | 'debounce'> & {
307
+ export type BlueprintDurableConfig = Omit<BlueprintDurableFunctionResource, 'type' | 'src' | 'event' | 'durableTimeout'> & {
310
308
  /**
311
309
  * Path to the function source code
312
310
  * @defaultValue `functions/${name}`
@@ -321,8 +319,4 @@ export type BlueprintDurableConfig = Omit<BlueprintDurableFunctionResource, 'typ
321
319
  * @defaultValue 86_400 (24 hours)
322
320
  */
323
321
  durableTimeout?: string | number;
324
- /**
325
- * Optional debounce configuration, as a duration or a full config
326
- */
327
- debounce?: DebounceInput;
328
322
  };
@@ -23,6 +23,22 @@ export declare const APPLICATION_VISIBILITIES: readonly ['default', 'unlisted',
23
23
  * @hidden
24
24
  */
25
25
  export type ApplicationVisibility = (typeof APPLICATION_VISIBILITIES)[number];
26
+ /**
27
+ * A workspace definition extracted from a studio's configuration during the build.
28
+ * @beta This feature is subject to breaking changes.
29
+ * @category Resource Types
30
+ * @hidden
31
+ */
32
+ export type StudioWorkspace = {
33
+ projectId: string;
34
+ dataset: string;
35
+ schemaDescriptorId: string;
36
+ name: string;
37
+ title: string | undefined;
38
+ subtitle: string | undefined;
39
+ basePath: string | undefined;
40
+ icon: string | undefined;
41
+ };
26
42
  /**
27
43
  * Represents a Studio resource.
28
44
  * @see https://www.sanity.io/docs/studio
@@ -72,6 +88,8 @@ export interface BlueprintStudioResource extends BlueprintResource<BlueprintProj
72
88
  vite?: UserViteConfig;
73
89
  /** Schema inputs extracted from the studio's schema definition. */
74
90
  schemaInputs?: WorkspaceSchemaInput[];
91
+ /** Workspaces extracted from the studio's configuration. */
92
+ workspaces?: StudioWorkspace[];
75
93
  /** Module federation manifest */
76
94
  mfManifest?: Record<string, unknown>;
77
95
  }
@@ -28,3 +28,15 @@ export declare function resetCollectedErrors(): void;
28
28
  * @internal
29
29
  */
30
30
  export declare function isReference(value: unknown): boolean;
31
+ /**
32
+ * Validates a string field on an object, optionally requiring it to be present and non-empty.
33
+ * @param obj The object containing the field
34
+ * @param field The field name
35
+ * @param label The label used as the prefix of error messages
36
+ * @param options Whether the field is required
37
+ * @returns A list of validation errors
38
+ * @internal
39
+ */
40
+ export declare function validateStringField(obj: object, field: string, label: string, options: {
41
+ required: boolean;
42
+ }): BlueprintError[];
@@ -40,4 +40,23 @@ const REFERENCE_PREFIXES = ['$.resources.', '$.values.', '$.parameters.', '$.par
40
40
  export function isReference(value) {
41
41
  return typeof value === 'string' && REFERENCE_PREFIXES.some((prefix) => value.startsWith(prefix));
42
42
  }
43
+ /**
44
+ * Validates a string field on an object, optionally requiring it to be present and non-empty.
45
+ * @param obj The object containing the field
46
+ * @param field The field name
47
+ * @param label The label used as the prefix of error messages
48
+ * @param options Whether the field is required
49
+ * @returns A list of validation errors
50
+ * @internal
51
+ */
52
+ export function validateStringField(obj, field, label, options) {
53
+ const value = Reflect.get(obj, field);
54
+ if (typeof value === 'undefined' || (options.required && !value)) {
55
+ return options.required ? [{ type: 'missing_parameter', message: `${label}.${field} is required` }] : [];
56
+ }
57
+ if (typeof value !== 'string') {
58
+ return [{ type: 'invalid_type', message: `${label}.${field} must be a string` }];
59
+ }
60
+ return [];
61
+ }
43
62
  //# sourceMappingURL=validation.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"validation.js","sourceRoot":"","sources":["../../src/utils/validation.ts"],"names":[],"mappings":"AAEA,MAAM,eAAe,GAAqB,EAAE,CAAA;AAE5C;;;;;GAKG;AACH,MAAM,UAAU,aAAa,CAAC,SAAiC,EAAE,OAAgC;IAC/F,MAAM,MAAM,GAAG,SAAS,EAAE,CAAA;IAC1B,IAAI,OAAO,EAAE,UAAU,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC7C,MAAM,OAAO,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;QAC3D,MAAM,IAAI,KAAK,CAAC,OAAO,CAAC,CAAA;IAC1B,CAAC;IACD,eAAe,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,CAAA;AACjC,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,kBAAkB;IAChC,OAAO,eAAe,CAAA;AACxB,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,oBAAoB;IAClC,eAAe,CAAC,MAAM,CAAC,CAAC,EAAE,eAAe,CAAC,MAAM,CAAC,CAAA;AACnD,CAAC;AAED,MAAM,kBAAkB,GAAG,CAAC,cAAc,EAAE,WAAW,EAAE,eAAe,EAAE,WAAW,CAAC,CAAA;AAEtF;;;;;;;GAOG;AACH,MAAM,UAAU,WAAW,CAAC,KAAc;IACxC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,kBAAkB,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,KAAK,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAA;AACnG,CAAC"}
1
+ {"version":3,"file":"validation.js","sourceRoot":"","sources":["../../src/utils/validation.ts"],"names":[],"mappings":"AAEA,MAAM,eAAe,G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,CAAC,EAAE,CAAC;QACjE,OAAO,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,EAAC,IAAI,EAAE,mBAAmB,EAAE,OAAO,EAAE,GAAG,KAAK,IAAI,KAAK,cAAc,EAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAA;IACxG,CAAC;IACD,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,OAAO,CAAC,EAAC,IAAI,EAAE,cAAc,EAAE,OAAO,EAAE,GAAG,KAAK,IAAI,KAAK,mBAAmB,EAAC,CAAC,CAAA;IAChF,CAAC;IACD,OAAO,EAAE,CAAA;AACX,CAAC"}
@@ -0,0 +1,15 @@
1
+ import { type BlueprintError } from '../index.js';
2
+ /**
3
+ * Validates that the given resource is a valid Context knowledge base.
4
+ * @param resource The Context knowledge base resource
5
+ * @category Validation
6
+ * @returns A list of validation errors
7
+ */
8
+ export declare function validateContextKnowledgeBase(resource: unknown): BlueprintError[];
9
+ /**
10
+ * Validates that the given resource is a valid Context MCP endpoint.
11
+ * @param resource The Context MCP endpoint resource
12
+ * @category Validation
13
+ * @returns A list of validation errors
14
+ */
15
+ export declare function validateContextMcpEndpoint(resource: unknown): BlueprintError[];