@sanity/blueprints 0.7.0 → 0.8.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/README.md +1 -0
- package/dist/definers/blueprints.d.ts +12 -0
- package/dist/definers/blueprints.js +12 -0
- package/dist/definers/blueprints.js.map +1 -1
- package/dist/definers/cors.d.ts +10 -0
- package/dist/definers/cors.js +10 -0
- package/dist/definers/cors.js.map +1 -1
- package/dist/definers/datasets.d.ts +9 -0
- package/dist/definers/datasets.js +9 -0
- package/dist/definers/datasets.js.map +1 -1
- package/dist/definers/functions.d.ts +62 -0
- package/dist/definers/functions.js +58 -3
- package/dist/definers/functions.js.map +1 -1
- package/dist/definers/resources.d.ts +5 -0
- package/dist/definers/resources.js +5 -0
- package/dist/definers/resources.js.map +1 -1
- package/dist/definers/robots.d.ts +18 -0
- package/dist/definers/robots.js +30 -0
- package/dist/definers/robots.js.map +1 -0
- package/dist/definers/roles.d.ts +36 -0
- package/dist/definers/roles.js +39 -0
- package/dist/definers/roles.js.map +1 -1
- package/dist/definers/webhooks.d.ts +13 -0
- package/dist/definers/webhooks.js +13 -0
- package/dist/definers/webhooks.js.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/types/blueprints.d.ts +5 -5
- package/dist/types/cors.d.ts +30 -4
- package/dist/types/datasets.d.ts +16 -4
- package/dist/types/functions.d.ts +29 -0
- package/dist/types/resources.d.ts +47 -1
- package/dist/types/robots.d.ts +30 -0
- package/dist/types/robots.js +2 -0
- package/dist/types/robots.js.map +1 -0
- package/dist/types/roles.d.ts +16 -2
- package/dist/types/webhooks.d.ts +4 -1
- package/dist/utils/validation.d.ts +4 -0
- package/dist/utils/validation.js +4 -0
- package/dist/utils/validation.js.map +1 -1
- package/dist/validation/blueprints.d.ts +5 -0
- package/dist/validation/blueprints.js +5 -0
- package/dist/validation/blueprints.js.map +1 -1
- package/dist/validation/cors.d.ts +6 -1
- package/dist/validation/cors.js +7 -1
- package/dist/validation/cors.js.map +1 -1
- package/dist/validation/datasets.d.ts +6 -1
- package/dist/validation/datasets.js +7 -1
- package/dist/validation/datasets.js.map +1 -1
- package/dist/validation/functions.d.ts +19 -1
- package/dist/validation/functions.js +39 -5
- package/dist/validation/functions.js.map +1 -1
- package/dist/validation/resources.d.ts +9 -1
- package/dist/validation/resources.js +55 -1
- package/dist/validation/resources.js.map +1 -1
- package/dist/validation/robots.d.ts +8 -0
- package/dist/validation/robots.js +97 -0
- package/dist/validation/robots.js.map +1 -0
- package/dist/validation/roles.d.ts +11 -6
- package/dist/validation/roles.js +30 -23
- package/dist/validation/roles.js.map +1 -1
- package/dist/validation/webhooks.d.ts +7 -2
- package/dist/validation/webhooks.js +35 -29
- package/dist/validation/webhooks.js.map +1 -1
- package/package.json +1 -1
- package/src/definers/blueprints.ts +12 -0
- package/src/definers/cors.ts +10 -0
- package/src/definers/datasets.ts +9 -0
- package/src/definers/functions.ts +80 -3
- package/src/definers/resources.ts +5 -0
- package/src/definers/robots.ts +33 -0
- package/src/definers/roles.ts +40 -0
- package/src/definers/webhooks.ts +13 -0
- package/src/index.ts +3 -0
- package/src/types/blueprints.ts +5 -5
- package/src/types/cors.ts +30 -4
- package/src/types/datasets.ts +16 -4
- package/src/types/functions.ts +29 -0
- package/src/types/resources.ts +54 -1
- package/src/types/robots.ts +35 -0
- package/src/types/roles.ts +19 -5
- package/src/types/webhooks.ts +6 -1
- package/src/utils/validation.ts +4 -0
- package/src/validation/blueprints.ts +5 -0
- package/src/validation/cors.ts +7 -2
- package/src/validation/datasets.ts +7 -2
- package/src/validation/functions.ts +45 -12
- package/src/validation/resources.ts +50 -1
- package/src/validation/robots.ts +96 -0
- package/src/validation/roles.ts +30 -24
- package/src/validation/webhooks.ts +35 -30
package/dist/types/cors.d.ts
CHANGED
|
@@ -1,15 +1,41 @@
|
|
|
1
|
-
import type { BlueprintResource } from '../index.js';
|
|
1
|
+
import type { BlueprintProjectResourceLifecycle, BlueprintResource } from '../index.js';
|
|
2
2
|
/**
|
|
3
3
|
* Represents a CORS Origin resource.
|
|
4
|
+
* @see https://www.sanity.io/docs/content-lake/cors
|
|
4
5
|
*/
|
|
5
|
-
export interface BlueprintCorsOriginResource extends BlueprintResource {
|
|
6
|
+
export interface BlueprintCorsOriginResource extends BlueprintResource<BlueprintProjectResourceLifecycle> {
|
|
6
7
|
type: 'sanity.project.cors';
|
|
8
|
+
/**
|
|
9
|
+
* A CORS origin will be defined using the following format: `protocol://hostname[:port]`
|
|
10
|
+
*
|
|
11
|
+
* The protocol and host name are required while the port is optional. Wildcards (*) are allowed.
|
|
12
|
+
*/
|
|
7
13
|
origin: string;
|
|
14
|
+
/**
|
|
15
|
+
* When adding a CORS origin, you will also need to decide whether or not to allow credentials. If you allow credentials, the origin will be allowed to send authenticated requests using the token or session of a logged in user.
|
|
16
|
+
*
|
|
17
|
+
* If this origin hosts a studio, you will need to allow credentials. Otherwise, you should probably select not to allow credentials.
|
|
18
|
+
*
|
|
19
|
+
* Allowing credentials from wildcard origins is dangerous. Any domain that matches the given pattern will be able to send requests on the user's behalf if they are logged in to your studio.
|
|
20
|
+
*/
|
|
8
21
|
allowCredentials?: boolean;
|
|
9
|
-
/**
|
|
22
|
+
/**
|
|
23
|
+
* The project ID of the project that contains your CORS Origin.
|
|
24
|
+
*
|
|
25
|
+
* The `project` attribute must be defined if your blueprint is scoped to an organization. */
|
|
10
26
|
project?: string;
|
|
11
27
|
}
|
|
12
|
-
/**
|
|
28
|
+
/**
|
|
29
|
+
* Configuration for a CORS Origin resource.
|
|
30
|
+
* @see https://www.sanity.io/docs/content-lake/cors
|
|
31
|
+
*/
|
|
13
32
|
export type BlueprintCorsOriginConfig = Omit<BlueprintCorsOriginResource, 'type' | 'allowCredentials'> & {
|
|
33
|
+
/**
|
|
34
|
+
* When adding a CORS origin, you will also need to decide whether or not to allow credentials. If you allow credentials, the origin will be allowed to send authenticated requests using the token or session of a logged in user.
|
|
35
|
+
*
|
|
36
|
+
* If this origin hosts a studio, you will need to allow credentials. Otherwise, you should probably select not to allow credentials.
|
|
37
|
+
*
|
|
38
|
+
* Allowing credentials from wildcard origins is dangerous. Any domain that matches the given pattern will be able to send requests on the user's behalf if they are logged in to your studio.
|
|
39
|
+
*/
|
|
14
40
|
allowCredentials?: boolean;
|
|
15
41
|
};
|
package/dist/types/datasets.d.ts
CHANGED
|
@@ -1,15 +1,27 @@
|
|
|
1
1
|
import type { BlueprintResource } from '../index.js';
|
|
2
2
|
export type AclMode = 'public' | 'private' | 'custom';
|
|
3
|
-
/**
|
|
3
|
+
/**
|
|
4
|
+
* Represents a Dataset resource.
|
|
5
|
+
* @see https://www.sanity.io/docs/content-lake/datasets
|
|
6
|
+
*/
|
|
4
7
|
export interface BlueprintDatasetResource extends BlueprintResource {
|
|
5
8
|
type: 'sanity.project.dataset';
|
|
9
|
+
/** The name of the dataset. Must be unique within a project. */
|
|
6
10
|
datasetName: string;
|
|
11
|
+
/** The ACL mode to set for the new dataset. Defaults to public. */
|
|
7
12
|
aclMode?: AclMode;
|
|
8
|
-
/**
|
|
13
|
+
/**
|
|
14
|
+
* The project ID of the project that contains your Dataset.
|
|
15
|
+
*
|
|
16
|
+
* The `project` attribute must be defined if your blueprint is scoped to an organization.
|
|
17
|
+
*/
|
|
9
18
|
project?: string;
|
|
10
19
|
}
|
|
11
|
-
/**
|
|
20
|
+
/**
|
|
21
|
+
* Configuration for a Dataset resource.
|
|
22
|
+
* @see https://www.sanity.io/docs/content-lake/datasets
|
|
23
|
+
*/
|
|
12
24
|
export type BlueprintDatasetConfig = Omit<BlueprintDatasetResource, 'type' | 'datasetName'> & {
|
|
13
|
-
/** The name of the dataset
|
|
25
|
+
/** The name of the dataset. Must be unique within a project. Defaults to the name of the resource. */
|
|
14
26
|
datasetName?: string;
|
|
15
27
|
};
|
|
@@ -1,41 +1,70 @@
|
|
|
1
1
|
import type { BlueprintResource } from '../index.js';
|
|
2
|
+
/** Base event configuration shared by document and media library function types */
|
|
2
3
|
export interface BlueprintFunctionBaseResourceEvent {
|
|
4
|
+
/** Event types that trigger the function. Defaults to ['publish'] */
|
|
3
5
|
on?: [BlueprintFunctionResourceEventName, ...BlueprintFunctionResourceEventName[]];
|
|
6
|
+
/** GROQ filter expression to match specific documents (e.g., "_type == 'post'") */
|
|
4
7
|
filter?: string;
|
|
8
|
+
/** GROQ projection to specify which fields to include (e.g., "{_id, title, slug}") */
|
|
5
9
|
projection?: `{${string}}`;
|
|
10
|
+
/** Include draft documents in addition to published documents */
|
|
6
11
|
includeDrafts?: boolean;
|
|
7
12
|
}
|
|
13
|
+
/** Event configuration for document functions */
|
|
8
14
|
export interface BlueprintDocumentFunctionResourceEvent extends BlueprintFunctionBaseResourceEvent {
|
|
15
|
+
/** Include all versions of documents, not just the current version */
|
|
9
16
|
includeAllVersions?: boolean;
|
|
17
|
+
/** Optional dataset resource scoping for the function */
|
|
10
18
|
resource?: BlueprintFunctionResourceEventResourceDataset;
|
|
11
19
|
}
|
|
20
|
+
/** Event configuration for media library asset functions */
|
|
12
21
|
export interface BlueprintMediaLibraryFunctionResourceEvent extends BlueprintFunctionBaseResourceEvent {
|
|
22
|
+
/** Media library resource scoping (required for media library functions) */
|
|
13
23
|
resource: BlueprintFunctionResourceEventResourceMediaLibrary;
|
|
14
24
|
}
|
|
25
|
+
/** Union type of all function resource event configurations */
|
|
15
26
|
export type BlueprintFunctionResourceEvent = BlueprintDocumentFunctionResourceEvent | BlueprintMediaLibraryFunctionResourceEvent;
|
|
27
|
+
/**
|
|
28
|
+
* Dataset resource for scoping document functions to specific datasets
|
|
29
|
+
* @example { type: 'dataset', id: 'my-project.production' }
|
|
30
|
+
*/
|
|
16
31
|
interface BlueprintFunctionResourceEventResourceDataset {
|
|
17
32
|
type: 'dataset';
|
|
18
33
|
/** @description A dataset ID in the format <projectId>.<datasetName>. <datasetName> can be `*` to signify "all datasets in project with ID <projectId>." */
|
|
19
34
|
id: string;
|
|
20
35
|
}
|
|
36
|
+
/** Media library resource for scoping media library functions */
|
|
21
37
|
interface BlueprintFunctionResourceEventResourceMediaLibrary {
|
|
22
38
|
type: 'media-library';
|
|
23
39
|
id: string;
|
|
24
40
|
}
|
|
41
|
+
/** Events that can trigger a function */
|
|
25
42
|
type BlueprintFunctionResourceEventName = 'publish' | 'create' | 'delete' | 'update';
|
|
43
|
+
/** Base function resource with common properties for all function types */
|
|
26
44
|
export interface BlueprintBaseFunctionResource extends BlueprintResource {
|
|
45
|
+
/** Human-readable display name for the function */
|
|
27
46
|
displayName?: string;
|
|
47
|
+
/** Path to the function source code */
|
|
28
48
|
src: string;
|
|
49
|
+
/** Execution timeout in seconds */
|
|
29
50
|
timeout?: number;
|
|
51
|
+
/** Memory allocation in gigabytes */
|
|
30
52
|
memory?: number;
|
|
53
|
+
/** Environment variables provided to the function */
|
|
31
54
|
env?: Record<string, string>;
|
|
55
|
+
/** Token provided during function invocation */
|
|
56
|
+
robotToken?: string;
|
|
32
57
|
}
|
|
58
|
+
/** A function resource triggered by document events in Sanity datasets */
|
|
33
59
|
export interface BlueprintDocumentFunctionResource extends BlueprintBaseFunctionResource {
|
|
34
60
|
type: 'sanity.function.document';
|
|
61
|
+
/** Event configuration specifying when and how the function is triggered */
|
|
35
62
|
event: BlueprintDocumentFunctionResourceEvent;
|
|
36
63
|
}
|
|
64
|
+
/** A function resource triggered by media library asset events */
|
|
37
65
|
export interface BlueprintMediaLibraryAssetFunctionResource extends BlueprintBaseFunctionResource {
|
|
38
66
|
type: 'sanity.function.media-library.asset';
|
|
67
|
+
/** Event configuration specifying when and how the function is triggered */
|
|
39
68
|
event: BlueprintMediaLibraryFunctionResourceEvent;
|
|
40
69
|
}
|
|
41
70
|
export {};
|
|
@@ -1,7 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Define deployment behaviour once the policy has been deployed. The following behaviours are allowed:
|
|
3
|
+
*
|
|
4
|
+
* - **retain** If a stack is destroyed, the resource is detached from the stack and will not be destroyed. If the resource is removed from the blueprint, deployment will fail.
|
|
5
|
+
* - **replace** if a stack is deployed, the resource will be destroyed and created instead of performing an update. If the resource is removed from the blueprint, it will be destroyed. If the stack is destroyed, the resource will be destroyed.
|
|
6
|
+
* - **allow** if a stack is destroyed, the resource will be destroyed along with it. If the resource is removed it will be destroyed
|
|
7
|
+
* - **protect** if a stack is deployed the resource will not be updated. If the resource is removed from the blueprint or the stack is destroyed, deployment will fail.
|
|
8
|
+
*/
|
|
9
|
+
export type BlueprintResourceDeletionPolicy = 'allow' | 'retain' | 'replace' | 'protect';
|
|
10
|
+
/**
|
|
11
|
+
* An ownership action that will cause the referenced resource to be attached to the current stack.
|
|
12
|
+
*/
|
|
13
|
+
export interface BlueprintOwnershipAttachAction {
|
|
14
|
+
type: 'attach';
|
|
15
|
+
/** The identifier of the resource to be attached to the current stack */
|
|
16
|
+
id: string;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* A union of all possible ownership actions.
|
|
20
|
+
*/
|
|
21
|
+
export type BlueprintOwnershipAction = BlueprintOwnershipAttachAction;
|
|
22
|
+
/**
|
|
23
|
+
* An ownership action that will cause the referenced project-contained resource to be attached to the current stack.
|
|
24
|
+
*/
|
|
25
|
+
export interface BlueprintProjectOwnershipAttachAction extends BlueprintOwnershipAttachAction {
|
|
26
|
+
/** The identifier of the project for resources contained in a project */
|
|
27
|
+
projectId: string;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* A union of all possible ownership actions for resources belonging to projects.
|
|
31
|
+
*/
|
|
32
|
+
export type BlueprintProjectOwnershipAction = BlueprintProjectOwnershipAttachAction;
|
|
33
|
+
/**
|
|
34
|
+
* Defines the lifcycle policy for this resource.
|
|
35
|
+
*/
|
|
36
|
+
export interface BlueprintResourceLifecycle {
|
|
37
|
+
deletionPolicy?: BlueprintResourceDeletionPolicy;
|
|
38
|
+
ownershipAction?: BlueprintOwnershipAction;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Defines the lifcycle policy for this resource.
|
|
42
|
+
*/
|
|
43
|
+
export interface BlueprintProjectResourceLifecycle extends BlueprintResourceLifecycle {
|
|
44
|
+
ownershipAction?: BlueprintProjectOwnershipAction;
|
|
45
|
+
}
|
|
1
46
|
/**
|
|
2
47
|
* The base type for all resources.
|
|
3
48
|
*/
|
|
4
|
-
export interface BlueprintResource {
|
|
49
|
+
export interface BlueprintResource<Lifecycle extends BlueprintResourceLifecycle = BlueprintResourceLifecycle> {
|
|
5
50
|
type: string;
|
|
6
51
|
name: string;
|
|
52
|
+
lifecycle?: Lifecycle;
|
|
7
53
|
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { BlueprintResource } from './resources';
|
|
2
|
+
/** Resource types that robots can be attached to. */
|
|
3
|
+
export type RobotResourceType = 'organization' | 'project';
|
|
4
|
+
/**
|
|
5
|
+
* Defines the robot's roles within a given resource.
|
|
6
|
+
*/
|
|
7
|
+
export interface RobotMembership {
|
|
8
|
+
resourceType: RobotResourceType;
|
|
9
|
+
resourceId: string;
|
|
10
|
+
roleNames: string[];
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* A robot that provides a token for automated access.
|
|
14
|
+
* @see https://www.sanity.io/docs/content-lake/http-auth#k4c21d7b829fe
|
|
15
|
+
*/
|
|
16
|
+
export interface BlueprintRobotResource extends BlueprintResource {
|
|
17
|
+
type: 'sanity.access.robot';
|
|
18
|
+
/** A descriptive label for the robot and its use case */
|
|
19
|
+
label: string;
|
|
20
|
+
memberships: RobotMembership[];
|
|
21
|
+
resourceType?: RobotResourceType;
|
|
22
|
+
resourceId?: string;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Configuration for a robot that provides a token for automated access.
|
|
26
|
+
* @see https://www.sanity.io/docs/content-lake/http-auth#k4c21d7b829fe
|
|
27
|
+
*/
|
|
28
|
+
export type BlueprintRobotConfig = Omit<BlueprintRobotResource, 'type' | 'label' | 'token'> & {
|
|
29
|
+
label?: string;
|
|
30
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"robots.js","sourceRoot":"","sources":["../../src/types/robots.ts"],"names":[],"mappings":""}
|
package/dist/types/roles.d.ts
CHANGED
|
@@ -1,20 +1,34 @@
|
|
|
1
1
|
import type { BlueprintResource } from '../index.js';
|
|
2
|
+
/**
|
|
3
|
+
* A permission definition for a role.
|
|
4
|
+
*/
|
|
2
5
|
export interface RolePermission {
|
|
6
|
+
/** Predefined permission name (e.g., 'sanity-all-documents') */
|
|
3
7
|
name: string;
|
|
8
|
+
/** Permission action (e.g., 'read', 'mode') */
|
|
4
9
|
action: string;
|
|
10
|
+
/** Additional parameters for the permission */
|
|
5
11
|
params?: Record<string, unknown>;
|
|
6
12
|
}
|
|
7
|
-
|
|
8
|
-
|
|
13
|
+
/**
|
|
14
|
+
* Configuration for a custom role.
|
|
15
|
+
*/
|
|
16
|
+
export interface BlueprintRoleConfig extends Omit<BlueprintResource, 'type'> {
|
|
9
17
|
title: string;
|
|
10
18
|
description?: string;
|
|
11
19
|
appliesToUsers: boolean;
|
|
12
20
|
appliesToRobots: boolean;
|
|
13
21
|
permissions: RolePermission[];
|
|
14
22
|
}
|
|
23
|
+
/**
|
|
24
|
+
* A custom role resource
|
|
25
|
+
*/
|
|
15
26
|
export interface BlueprintRoleResource extends BlueprintRoleConfig, BlueprintResource {
|
|
16
27
|
type: 'sanity.access.role';
|
|
17
28
|
}
|
|
29
|
+
/**
|
|
30
|
+
* A custom role resource that is tied to a specific project
|
|
31
|
+
*/
|
|
18
32
|
export interface BlueprintProjectRoleResource extends BlueprintRoleResource {
|
|
19
33
|
resourceType: 'project';
|
|
20
34
|
resourceId: string;
|
package/dist/types/webhooks.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { BlueprintResource } from '../index.js';
|
|
2
|
+
/** Types of events that can trigger a webhook */
|
|
2
3
|
export type WebhookTrigger = 'create' | 'update' | 'delete';
|
|
4
|
+
/** A webhook resource definition */
|
|
3
5
|
export interface BlueprintDocumentWebhookResource extends BlueprintResource {
|
|
4
6
|
type: 'sanity.project.webhook';
|
|
5
7
|
project?: string;
|
|
@@ -16,6 +18,7 @@ export interface BlueprintDocumentWebhookResource extends BlueprintResource {
|
|
|
16
18
|
includeAllVersions?: boolean;
|
|
17
19
|
secret?: string;
|
|
18
20
|
dataset?: string;
|
|
19
|
-
apiVersion
|
|
21
|
+
apiVersion: string;
|
|
20
22
|
}
|
|
23
|
+
/** Configuration for a webhook */
|
|
21
24
|
export type BlueprintDocumentWebhookConfig = Omit<BlueprintDocumentWebhookResource, 'type'>;
|
|
@@ -1,2 +1,6 @@
|
|
|
1
1
|
import type { BlueprintError } from '../types/errors';
|
|
2
|
+
/**
|
|
3
|
+
* Executes the given validator function and throws a formatted error if any are returned.
|
|
4
|
+
* @param validator A function that returns a list of validation errors.
|
|
5
|
+
*/
|
|
2
6
|
export declare function runValidation(validator: () => BlueprintError[]): void;
|
package/dist/utils/validation.js
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Executes the given validator function and throws a formatted error if any are returned.
|
|
3
|
+
* @param validator A function that returns a list of validation errors.
|
|
4
|
+
*/
|
|
1
5
|
export function runValidation(validator) {
|
|
2
6
|
const errors = validator();
|
|
3
7
|
if (errors.length > 0) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validation.js","sourceRoot":"","sources":["../../src/utils/validation.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,aAAa,CAAC,SAAiC;IAC7D,MAAM,MAAM,GAAG,SAAS,EAAE,CAAA;IAC1B,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACtB,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;AACH,CAAC"}
|
|
1
|
+
{"version":3,"file":"validation.js","sourceRoot":"","sources":["../../src/utils/validation.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,MAAM,UAAU,aAAa,CAAC,SAAiC;IAC7D,MAAM,MAAM,GAAG,SAAS,EAAE,CAAA;IAC1B,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACtB,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;AACH,CAAC"}
|
|
@@ -1,2 +1,7 @@
|
|
|
1
1
|
import type { BlueprintError } from '../index.js';
|
|
2
|
+
/**
|
|
3
|
+
* Validates that the given input is a valid Blueprint
|
|
4
|
+
* @param blueprintConfig The blueprint configuration to be validated
|
|
5
|
+
* @returns A list of validation errors
|
|
6
|
+
*/
|
|
2
7
|
export declare function validateBlueprint(blueprintConfig: unknown): BlueprintError[];
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Validates that the given input is a valid Blueprint
|
|
3
|
+
* @param blueprintConfig The blueprint configuration to be validated
|
|
4
|
+
* @returns A list of validation errors
|
|
5
|
+
*/
|
|
1
6
|
export function validateBlueprint(blueprintConfig) {
|
|
2
7
|
if (!blueprintConfig)
|
|
3
8
|
return [{ type: 'invalid_value', message: 'blueprint config must be provided' }];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"blueprints.js","sourceRoot":"","sources":["../../src/validation/blueprints.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,iBAAiB,CAAC,eAAwB;IACxD,IAAI,CAAC,eAAe;QAAE,OAAO,CAAC,EAAC,IAAI,EAAE,eAAe,EAAE,OAAO,EAAE,mCAAmC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|
|
|
1
|
-
import type
|
|
1
|
+
import { type BlueprintError } from '../index.js';
|
|
2
|
+
/**
|
|
3
|
+
* Validates that the given resource is a valid CORS origin.
|
|
4
|
+
* @param resource The CORS origin resource
|
|
5
|
+
* @returns A list of validation errors
|
|
6
|
+
*/
|
|
2
7
|
export declare function validateCorsOrigin(resource: unknown): BlueprintError[];
|
package/dist/validation/cors.js
CHANGED
|
@@ -1,9 +1,15 @@
|
|
|
1
|
+
import { validateResource } from '../index.js';
|
|
2
|
+
/**
|
|
3
|
+
* Validates that the given resource is a valid CORS origin.
|
|
4
|
+
* @param resource The CORS origin resource
|
|
5
|
+
* @returns A list of validation errors
|
|
6
|
+
*/
|
|
1
7
|
export function validateCorsOrigin(resource) {
|
|
2
8
|
if (!resource)
|
|
3
9
|
return [{ type: 'invalid_value', message: 'CORS Origin config must be provided' }];
|
|
4
10
|
if (typeof resource !== 'object')
|
|
5
11
|
return [{ type: 'invalid_type', message: 'CORS Origin config must be an object' }];
|
|
6
|
-
const errors =
|
|
12
|
+
const errors = validateResource(resource, { projectContained: true });
|
|
7
13
|
if (!('name' in resource) || !resource.name) {
|
|
8
14
|
errors.push({ type: 'missing_parameter', message: 'CORS Origin name is required' });
|
|
9
15
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cors.js","sourceRoot":"","sources":["../../src/validation/cors.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"cors.js","sourceRoot":"","sources":["../../src/validation/cors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,gBAAgB,EAAC,MAAM,aAAa,CAAA;AAEjE;;;;GAIG;AACH,MAAM,UAAU,kBAAkB,CAAC,QAAiB;IAClD,IAAI,CAAC,QAAQ;QAAE,OAAO,CAAC,EAAC,IAAI,EAAE,eAAe,EAAE,OAAO,EAAE,qCAAqC,EAAC,CAAC,CAAA;IAC/F,IAAI,OAAO,QAAQ,KAAK,QAAQ;QAAE,OAAO,CAAC,EAAC,IAAI,EA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CAAC,CAAA;IAClF,CAAC;IAED,IAAI,SAAS,IAAI,QAAQ,EAAE,CAAC;QAC1B,IAAI,OAAO,QAAQ,CAAC,OAAO,KAAK,QAAQ,EAAE,CAAC;YACzC,MAAM,CAAC,IAAI,CAAC,EAAC,IAAI,EAAE,cAAc,EAAE,OAAO,EAAE,sCAAsC,EAAC,CAAC,CAAA;QACtF,CAAC;IACH,CAAC;IAED,OAAO,MAAM,CAAA;AACf,CAAC"}
|
|
@@ -1,2 +1,7 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type BlueprintError } from '../index.js';
|
|
2
|
+
/**
|
|
3
|
+
* Validates that the given resource is a valid Dataset.
|
|
4
|
+
* @param resource The Dataset resource
|
|
5
|
+
* @returns A list of validation errors
|
|
6
|
+
*/
|
|
2
7
|
export declare function validateDataset(resource: unknown): BlueprintError[];
|
|
@@ -1,9 +1,15 @@
|
|
|
1
|
+
import { validateResource } from '../index.js';
|
|
2
|
+
/**
|
|
3
|
+
* Validates that the given resource is a valid Dataset.
|
|
4
|
+
* @param resource The Dataset resource
|
|
5
|
+
* @returns A list of validation errors
|
|
6
|
+
*/
|
|
1
7
|
export function validateDataset(resource) {
|
|
2
8
|
if (!resource)
|
|
3
9
|
return [{ type: 'invalid_value', message: 'Dataset config must be provided' }];
|
|
4
10
|
if (typeof resource !== 'object')
|
|
5
11
|
return [{ type: 'invalid_type', message: 'Dataset config must be an object' }];
|
|
6
|
-
const errors =
|
|
12
|
+
const errors = validateResource(resource, { projectContained: true });
|
|
7
13
|
if (!('name' in resource) || !resource.name) {
|
|
8
14
|
errors.push({ type: 'missing_parameter', message: 'Dataset name is required' });
|
|
9
15
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"datasets.js","sourceRoot":"","sources":["../../src/validation/datasets.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"datasets.js","sourceRoot":"","sources":["../../src/validation/datasets.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,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,CAAC,OAAO,KAAK,QAAQ,EAAE,CAAC;YACzC,MAAM,CAAC,IAAI,CAAC,EAAC,IAAI,EAAE,cAAc,EAAE,OAAO,EAAE,iEAAiE,EAAC,CAAC,CAAA;QACjH,CAAC;aAAM,CAAC;YACN,MAAM,OAAO,GAAW,QAAQ,CAAC,OAAO,CAAA;YACxC,IAAI,OAAO,KAAK,QAAQ,IAAI,OAAO,KAAK,QAAQ,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;gBAC1E,MAAM,CAAC,IAAI,CAAC,EAAC,IAAI,EAAE,eAAe,EAAE,OAAO,EAAE,iEAAiE,EAAC,CAAC,CAAA;YAClH,CAAC;QACH,CAAC;IACH,CAAC;IAED,+BAA+B;IAC/B,IAAI,SAAS,IAAI,QAAQ,EAAE,CAAC;QAC1B,IAAI,OAAO,QAAQ,CAAC,OAAO,KAAK,QAAQ,EAAE,CAAC;YACzC,MAAM,CAAC,IAAI,CAAC,EAAC,IAAI,EAAE,cAAc,EAAE,OAAO,EAAE,kCAAkC,EAAC,CAAC,CAAA;QAClF,CAAC;IACH,CAAC;IAED,OAAO,MAAM,CAAA;AACf,CAAC"}
|
|
@@ -1,4 +1,22 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type BlueprintError } from '../index.js';
|
|
2
|
+
/**
|
|
3
|
+
* Validates a document function resource configuration.
|
|
4
|
+
* Checks that the function has a valid event configuration, correct type, and all required base properties.
|
|
5
|
+
* @param functionResource The function resource to validate
|
|
6
|
+
* @returns Array of validation errors, empty if valid
|
|
7
|
+
*/
|
|
2
8
|
export declare function validateDocumentFunction(functionResource: unknown): BlueprintError[];
|
|
9
|
+
/**
|
|
10
|
+
* Validates a media library asset function resource configuration.
|
|
11
|
+
* Checks that the function has a valid event configuration with required resource, correct type, and all required base properties.
|
|
12
|
+
* @param functionResource The function resource to validate
|
|
13
|
+
* @returns Array of validation errors, empty if valid
|
|
14
|
+
*/
|
|
3
15
|
export declare function validateMediaLibraryAssetFunction(functionResource: unknown): BlueprintError[];
|
|
16
|
+
/**
|
|
17
|
+
* Validates base function resource properties.
|
|
18
|
+
* Checks that required fields (name, type) are present and that optional fields have correct types.
|
|
19
|
+
* @param functionResource The function resource to validate
|
|
20
|
+
* @returns Array of validation errors, empty if valid
|
|
21
|
+
*/
|
|
4
22
|
export declare function validateFunction(functionResource: unknown): BlueprintError[];
|
|
@@ -1,12 +1,19 @@
|
|
|
1
|
+
import { validateResource, } from '../index.js';
|
|
1
2
|
const BASE_EVENT_KEYS = new Set(['on', 'filter', 'projection', 'includeDrafts']);
|
|
2
3
|
const DOCUMENT_EVENT_KEYS = new Set(['includeAllVersions', 'resource', ...BASE_EVENT_KEYS.values()]);
|
|
3
4
|
const MEDIA_LIBRARY_EVENT_KEYS = new Set(['resource', ...BASE_EVENT_KEYS.values()]);
|
|
5
|
+
/**
|
|
6
|
+
* Validates a document function resource configuration.
|
|
7
|
+
* Checks that the function has a valid event configuration, correct type, and all required base properties.
|
|
8
|
+
* @param functionResource The function resource to validate
|
|
9
|
+
* @returns Array of validation errors, empty if valid
|
|
10
|
+
*/
|
|
4
11
|
export function validateDocumentFunction(functionResource) {
|
|
5
12
|
if (!functionResource)
|
|
6
13
|
return [{ type: 'invalid_value', message: 'Function config must be provided' }];
|
|
7
14
|
if (typeof functionResource !== 'object')
|
|
8
15
|
return [{ type: 'invalid_type', message: 'Function config must be an object' }];
|
|
9
|
-
const errors =
|
|
16
|
+
const errors = validateFunction(functionResource);
|
|
10
17
|
// event validation
|
|
11
18
|
if ('event' in functionResource) {
|
|
12
19
|
// `event` was specified, but event keys (aggregated in `maybeEvent`) were also specified at the top level. ambiguous and deprecated usage.
|
|
@@ -27,15 +34,20 @@ export function validateDocumentFunction(functionResource) {
|
|
|
27
34
|
if ('type' in functionResource && functionResource.type !== 'sanity.function.document') {
|
|
28
35
|
errors.push({ type: 'invalid_value', message: '`type` must be `sanity.function.document`' });
|
|
29
36
|
}
|
|
30
|
-
errors.push(...validateFunction(functionResource));
|
|
31
37
|
return errors;
|
|
32
38
|
}
|
|
39
|
+
/**
|
|
40
|
+
* Validates a media library asset function resource configuration.
|
|
41
|
+
* Checks that the function has a valid event configuration with required resource, correct type, and all required base properties.
|
|
42
|
+
* @param functionResource The function resource to validate
|
|
43
|
+
* @returns Array of validation errors, empty if valid
|
|
44
|
+
*/
|
|
33
45
|
export function validateMediaLibraryAssetFunction(functionResource) {
|
|
34
46
|
if (!functionResource)
|
|
35
47
|
return [{ type: 'invalid_value', message: 'Function config must be provided' }];
|
|
36
48
|
if (typeof functionResource !== 'object')
|
|
37
49
|
return [{ type: 'invalid_type', message: 'Function config must be an object' }];
|
|
38
|
-
const errors =
|
|
50
|
+
const errors = validateFunction(functionResource);
|
|
39
51
|
if ('event' in functionResource) {
|
|
40
52
|
errors.push(...validateMediaLibraryFunctionEvent(functionResource.event));
|
|
41
53
|
}
|
|
@@ -45,15 +57,20 @@ export function validateMediaLibraryAssetFunction(functionResource) {
|
|
|
45
57
|
if ('type' in functionResource && functionResource.type !== 'sanity.function.media-library.asset') {
|
|
46
58
|
errors.push({ type: 'invalid_value', message: '`type` must be `sanity.function.media-library.asset`' });
|
|
47
59
|
}
|
|
48
|
-
errors.push(...validateFunction(functionResource));
|
|
49
60
|
return errors;
|
|
50
61
|
}
|
|
62
|
+
/**
|
|
63
|
+
* Validates base function resource properties.
|
|
64
|
+
* Checks that required fields (name, type) are present and that optional fields have correct types.
|
|
65
|
+
* @param functionResource The function resource to validate
|
|
66
|
+
* @returns Array of validation errors, empty if valid
|
|
67
|
+
*/
|
|
51
68
|
export function validateFunction(functionResource) {
|
|
52
69
|
if (!functionResource)
|
|
53
70
|
return [{ type: 'invalid_value', message: 'Function config must be provided' }];
|
|
54
71
|
if (typeof functionResource !== 'object')
|
|
55
72
|
return [{ type: 'invalid_type', message: 'Function config must be an object' }];
|
|
56
|
-
const errors =
|
|
73
|
+
const errors = validateResource(functionResource);
|
|
57
74
|
if (!('name' in functionResource)) {
|
|
58
75
|
errors.push({ type: 'missing_parameter', message: '`name` is required' });
|
|
59
76
|
}
|
|
@@ -77,8 +94,19 @@ export function validateFunction(functionResource) {
|
|
|
77
94
|
errors.push({ type: 'invalid_type', message: '`timeout` must be a number' });
|
|
78
95
|
}
|
|
79
96
|
}
|
|
97
|
+
if ('robotToken' in functionResource) {
|
|
98
|
+
if (typeof functionResource.robotToken !== 'string' && typeof functionResource.robotToken !== 'undefined') {
|
|
99
|
+
errors.push({ type: 'invalid_type', message: '`robotToken` must be a string' });
|
|
100
|
+
}
|
|
101
|
+
}
|
|
80
102
|
return errors;
|
|
81
103
|
}
|
|
104
|
+
/**
|
|
105
|
+
* Validates a document function event configuration.
|
|
106
|
+
* Checks event trigger types, optional filter/projection, and optional dataset resource scoping.
|
|
107
|
+
* @param event The event configuration to validate
|
|
108
|
+
* @returns Array of validation errors, empty if valid
|
|
109
|
+
*/
|
|
82
110
|
function validateDocumentFunctionEvent(event) {
|
|
83
111
|
if (!event)
|
|
84
112
|
return [{ type: 'invalid_value', message: 'Function event must be provided' }];
|
|
@@ -100,6 +128,12 @@ function validateDocumentFunctionEvent(event) {
|
|
|
100
128
|
}
|
|
101
129
|
return errors;
|
|
102
130
|
}
|
|
131
|
+
/**
|
|
132
|
+
* Validates a media library function event configuration.
|
|
133
|
+
* Checks event trigger types and ensures required media library resource is present.
|
|
134
|
+
* @param event The event configuration to validate
|
|
135
|
+
* @returns Array of validation errors, empty if valid
|
|
136
|
+
*/
|
|
103
137
|
function validateMediaLibraryFunctionEvent(event) {
|
|
104
138
|
if (!event)
|
|
105
139
|
return [{ type: 'invalid_value', message: 'Function event must be provided' }];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"functions.js","sourceRoot":"","sources":["../../src/validation/functions.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"functions.js","sourceRoot":"","sources":["../../src/validation/functions.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,gBAAgB,GACjB,MAAM,aAAa,CAAA;AA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M,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,wBAAwB,CAAC,GAAG,CAAC,GAAmC,CAAC,CAAC,CAC7D,CAAA;IAC/C,MAAM,MAAM,GAAqB,EAAE,CAAA;IAEnC,MAAM,SAAS,GAAG;QAChB,EAAE,EAAE,UAAU,CAAC,EAAE,IAAI,CAAC,SAAS,CAAC;QAChC,GAAG,UAAU;KACd,CAAA;IACD,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,CAAC;QAAE,MAAM,CAAC,IAAI,CAAC,EAAC,IAAI,EAAE,cAAc,EAAE,OAAO,EAAE,6BAA6B,EAAC,CAAC,CAAA;IAC7G,IAAI,SAAS,CAAC,QAAQ,EAAE,CAAC;QACvB,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,IAAI,SAAS,CAAC,QAAQ,CAAC,IAAI,KAAK,eAAe;YACzE,MAAM,CAAC,IAAI,CAAC,EAAC,IAAI,EAAE,eAAe,EAAE,OAAO,EAAE,+CAA+C,EAAC,CAAC,CAAA;IAClG,CAAC;SAAM,CAAC;QACN,MAAM,CAAC,IAAI,CAAC,EAAC,IAAI,EAAE,mBAAmB,EAAE,OAAO,EAAE,qDAAqD,EAAC,CAAC,CAAA;IAC1G,CAAC;IACD,OAAO,MAAM,CAAA;AACf,CAAC"}
|
|
@@ -1,3 +1,11 @@
|
|
|
1
1
|
import type { BlueprintError, BlueprintResource } from '../index.js';
|
|
2
|
-
|
|
2
|
+
/**
|
|
3
|
+
* Validates that the given resource is a valid resource.
|
|
4
|
+
* @param resource The resource
|
|
5
|
+
* @param options Validation options
|
|
6
|
+
* @returns A list of validation errors
|
|
7
|
+
*/
|
|
8
|
+
export declare function validateResource(resourceConfig: unknown, options?: {
|
|
9
|
+
projectContained?: boolean;
|
|
10
|
+
}): BlueprintError[];
|
|
3
11
|
export declare function assertResource(resource: unknown): asserts resource is BlueprintResource;
|