@sanity/blueprints 0.11.0 → 0.12.1
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 +40 -317
- package/dist/definers/blueprints.d.ts +15 -3
- package/dist/definers/blueprints.js +40 -3
- package/dist/definers/blueprints.js.map +1 -1
- package/dist/definers/cors.d.ts +5 -2
- package/dist/definers/cors.js +17 -2
- package/dist/definers/cors.js.map +1 -1
- package/dist/definers/datasets.d.ts +5 -2
- package/dist/definers/datasets.js +18 -2
- package/dist/definers/datasets.js.map +1 -1
- package/dist/definers/functions.d.ts +37 -61
- package/dist/definers/functions.js +69 -95
- package/dist/definers/functions.js.map +1 -1
- package/dist/definers/resources.d.ts +10 -0
- package/dist/definers/resources.js +21 -0
- package/dist/definers/resources.js.map +1 -1
- package/dist/definers/robotTokens.d.ts +22 -0
- package/dist/definers/robotTokens.js +53 -0
- package/dist/definers/robotTokens.js.map +1 -0
- package/dist/definers/robots.d.ts +2 -22
- package/dist/definers/robots.js +2 -33
- package/dist/definers/robots.js.map +1 -1
- package/dist/definers/roles.d.ts +16 -25
- package/dist/definers/roles.js +64 -23
- package/dist/definers/roles.js.map +1 -1
- package/dist/definers/webhooks.d.ts +5 -2
- package/dist/definers/webhooks.js +25 -2
- 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/cors.d.ts +2 -0
- package/dist/types/datasets.d.ts +5 -1
- package/dist/types/functions.d.ts +65 -3
- package/dist/types/functions.js.map +1 -1
- package/dist/types/resources.d.ts +25 -0
- package/dist/types/robotTokens.d.ts +45 -0
- package/dist/types/robotTokens.js +2 -0
- package/dist/types/robotTokens.js.map +1 -0
- package/dist/types/robots.d.ts +8 -39
- package/dist/types/robots.js +1 -0
- package/dist/types/robots.js.map +1 -1
- package/dist/types/roles.d.ts +1 -0
- package/dist/types/webhooks.d.ts +6 -0
- package/dist/utils/validation.d.ts +9 -0
- package/dist/utils/validation.js +12 -0
- package/dist/utils/validation.js.map +1 -1
- package/dist/validation/cors.js +7 -0
- package/dist/validation/cors.js.map +1 -1
- package/dist/validation/resources.js +8 -0
- package/dist/validation/resources.js.map +1 -1
- package/dist/validation/robotTokens.d.ts +15 -0
- package/dist/validation/robotTokens.js +104 -0
- package/dist/validation/robotTokens.js.map +1 -0
- package/dist/validation/robots.d.ts +4 -15
- package/dist/validation/robots.js +5 -103
- package/dist/validation/robots.js.map +1 -1
- package/dist/validation/webhooks.js +6 -3
- package/dist/validation/webhooks.js.map +1 -1
- package/package.json +6 -6
- package/src/definers/blueprints.ts +40 -3
- package/src/definers/cors.ts +17 -2
- package/src/definers/datasets.ts +18 -2
- package/src/definers/functions.ts +124 -132
- package/src/definers/resources.ts +21 -0
- package/src/definers/robotTokens.ts +56 -0
- package/src/definers/robots.ts +2 -37
- package/src/definers/roles.ts +64 -23
- package/src/definers/webhooks.ts +25 -2
- package/src/index.ts +3 -0
- package/src/types/cors.ts +2 -0
- package/src/types/datasets.ts +5 -1
- package/src/types/functions.ts +71 -3
- package/src/types/resources.ts +26 -1
- package/src/types/robotTokens.ts +50 -0
- package/src/types/robots.ts +10 -44
- package/src/types/roles.ts +1 -0
- package/src/types/webhooks.ts +6 -0
- package/src/utils/validation.ts +14 -0
- package/src/validation/cors.ts +6 -0
- package/src/validation/resources.ts +8 -0
- package/src/validation/robotTokens.ts +103 -0
- package/src/validation/robots.ts +5 -102
- package/src/validation/webhooks.ts +5 -3
package/dist/definers/roles.d.ts
CHANGED
|
@@ -1,28 +1,23 @@
|
|
|
1
1
|
import { type BlueprintProjectRoleResource, type BlueprintRoleConfig, type BlueprintRoleResource } from '../index.js';
|
|
2
2
|
/**
|
|
3
3
|
* Defines a role that is scoped to the same resource as the blueprint.
|
|
4
|
-
*
|
|
4
|
+
*
|
|
5
|
+
* ```ts
|
|
5
6
|
* defineRole({
|
|
6
7
|
* name: 'custom-robot-role',
|
|
7
8
|
* title: 'Custom Robot Role',
|
|
8
9
|
* appliesToRobots: true,
|
|
9
|
-
* appliesToUsers: false,
|
|
10
10
|
* permissions: [{
|
|
11
11
|
* name: 'sanity-project-cors',
|
|
12
|
-
* action: 'create'
|
|
13
|
-
* },
|
|
14
|
-
*
|
|
15
|
-
* action: 'read'
|
|
16
|
-
* }, {
|
|
17
|
-
* name: 'sanity-project-cors',
|
|
18
|
-
* action: 'delete'
|
|
19
|
-
* }]
|
|
20
|
-
* }),
|
|
12
|
+
* action: 'create',
|
|
13
|
+
* }],
|
|
14
|
+
* })
|
|
21
15
|
* ```
|
|
22
16
|
* @param parameters The configuration of the role
|
|
23
17
|
* @public
|
|
24
18
|
* @beta Deploying Roles via Blueprints is experimental. This feature is stabilizing but may still be subject to breaking changes.
|
|
25
19
|
* @category Definers
|
|
20
|
+
* @expandType BlueprintRoleConfig
|
|
26
21
|
* @returns The role resource
|
|
27
22
|
*/
|
|
28
23
|
export declare function defineRole(parameters: BlueprintRoleConfig, options?: {
|
|
@@ -30,27 +25,23 @@ export declare function defineRole(parameters: BlueprintRoleConfig, options?: {
|
|
|
30
25
|
}): BlueprintRoleResource;
|
|
31
26
|
/**
|
|
32
27
|
* Defines a role that is scoped to the specified project.
|
|
33
|
-
*
|
|
28
|
+
*
|
|
29
|
+
* ```ts
|
|
34
30
|
* defineProjectRole(projectId, {
|
|
35
|
-
* name: '
|
|
36
|
-
* title: '
|
|
37
|
-
*
|
|
38
|
-
* appliesToUsers: false,
|
|
31
|
+
* name: 'viewer-role',
|
|
32
|
+
* title: 'Viewer',
|
|
33
|
+
* appliesToUsers: true,
|
|
39
34
|
* permissions: [{
|
|
40
35
|
* name: 'sanity-project-cors',
|
|
41
|
-
* action: '
|
|
42
|
-
* },
|
|
43
|
-
*
|
|
44
|
-
* action: 'read'
|
|
45
|
-
* }, {
|
|
46
|
-
* name: 'sanity-project-cors',
|
|
47
|
-
* action: 'delete'
|
|
48
|
-
* }]
|
|
49
|
-
* }),
|
|
36
|
+
* action: 'read',
|
|
37
|
+
* }],
|
|
38
|
+
* })
|
|
50
39
|
* ```
|
|
51
40
|
* @public
|
|
52
41
|
* @beta Deploying Roles via Blueprints is experimental. This feature is stabilizing but may still be subject to breaking changes.
|
|
42
|
+
* @hidden
|
|
53
43
|
* @category Definers
|
|
44
|
+
* @expandType BlueprintRoleConfig
|
|
54
45
|
* @param projectId The ID of the project to which the role will be scoped
|
|
55
46
|
* @param parameters The configuration of the role
|
|
56
47
|
* @returns The role resource
|
package/dist/definers/roles.js
CHANGED
|
@@ -1,29 +1,47 @@
|
|
|
1
1
|
import { validateProjectRole, validateRole, } from '../index.js';
|
|
2
2
|
import { runValidation } from '../utils/validation.js';
|
|
3
|
-
|
|
4
|
-
*
|
|
5
|
-
*
|
|
3
|
+
/*
|
|
4
|
+
* FUTURE example (move below @example when ready)
|
|
5
|
+
* @example All options
|
|
6
|
+
* ```ts
|
|
6
7
|
* defineRole({
|
|
7
|
-
* name: '
|
|
8
|
-
* title: '
|
|
8
|
+
* name: 'ci-deploy-role',
|
|
9
|
+
* title: 'CI Deploy Role',
|
|
10
|
+
* description: 'Permissions for CI/CD pipelines to manage CORS and datasets',
|
|
9
11
|
* appliesToRobots: true,
|
|
10
12
|
* appliesToUsers: false,
|
|
11
13
|
* permissions: [{
|
|
12
14
|
* name: 'sanity-project-cors',
|
|
13
|
-
* action: 'create'
|
|
15
|
+
* action: 'create',
|
|
14
16
|
* }, {
|
|
15
17
|
* name: 'sanity-project-cors',
|
|
16
|
-
* action: 'read'
|
|
18
|
+
* action: 'read',
|
|
17
19
|
* }, {
|
|
18
20
|
* name: 'sanity-project-cors',
|
|
19
|
-
* action: 'delete'
|
|
20
|
-
* }]
|
|
21
|
-
* })
|
|
21
|
+
* action: 'delete',
|
|
22
|
+
* }],
|
|
23
|
+
* })
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
/**
|
|
27
|
+
* Defines a role that is scoped to the same resource as the blueprint.
|
|
28
|
+
*
|
|
29
|
+
* ```ts
|
|
30
|
+
* defineRole({
|
|
31
|
+
* name: 'custom-robot-role',
|
|
32
|
+
* title: 'Custom Robot Role',
|
|
33
|
+
* appliesToRobots: true,
|
|
34
|
+
* permissions: [{
|
|
35
|
+
* name: 'sanity-project-cors',
|
|
36
|
+
* action: 'create',
|
|
37
|
+
* }],
|
|
38
|
+
* })
|
|
22
39
|
* ```
|
|
23
40
|
* @param parameters The configuration of the role
|
|
24
41
|
* @public
|
|
25
42
|
* @beta Deploying Roles via Blueprints is experimental. This feature is stabilizing but may still be subject to breaking changes.
|
|
26
43
|
* @category Definers
|
|
44
|
+
* @expandType BlueprintRoleConfig
|
|
27
45
|
* @returns The role resource
|
|
28
46
|
*/
|
|
29
47
|
export function defineRole(parameters, options) {
|
|
@@ -43,29 +61,52 @@ export function defineRole(parameters, options) {
|
|
|
43
61
|
runValidation(() => validateRole(roleResource));
|
|
44
62
|
return roleResource;
|
|
45
63
|
}
|
|
46
|
-
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
*
|
|
64
|
+
/*
|
|
65
|
+
* FUTURE example (move below @example when ready)
|
|
66
|
+
* @example Cross-resource references
|
|
67
|
+
* ```ts
|
|
68
|
+
* const role = defineProjectRole(projectId, {
|
|
69
|
+
* name: 'ci-deploy-role',
|
|
70
|
+
* title: 'CI Deploy Role',
|
|
52
71
|
* appliesToRobots: true,
|
|
53
|
-
* appliesToUsers: false,
|
|
54
72
|
* permissions: [{
|
|
55
73
|
* name: 'sanity-project-cors',
|
|
56
|
-
* action: 'create'
|
|
74
|
+
* action: 'create',
|
|
57
75
|
* }, {
|
|
58
76
|
* name: 'sanity-project-cors',
|
|
59
|
-
* action: '
|
|
60
|
-
* },
|
|
77
|
+
* action: 'delete',
|
|
78
|
+
* }],
|
|
79
|
+
* })
|
|
80
|
+
*
|
|
81
|
+
* defineRobotToken({
|
|
82
|
+
* name: 'ci-robot',
|
|
83
|
+
* memberships: [{
|
|
84
|
+
* resourceType: 'project',
|
|
85
|
+
* resourceId: projectId,
|
|
86
|
+
* roleNames: ['$.resources.ci-deploy-role'],
|
|
87
|
+
* }],
|
|
88
|
+
* })
|
|
89
|
+
* ```
|
|
90
|
+
*/
|
|
91
|
+
/**
|
|
92
|
+
* Defines a role that is scoped to the specified project.
|
|
93
|
+
*
|
|
94
|
+
* ```ts
|
|
95
|
+
* defineProjectRole(projectId, {
|
|
96
|
+
* name: 'viewer-role',
|
|
97
|
+
* title: 'Viewer',
|
|
98
|
+
* appliesToUsers: true,
|
|
99
|
+
* permissions: [{
|
|
61
100
|
* name: 'sanity-project-cors',
|
|
62
|
-
* action: '
|
|
63
|
-
* }]
|
|
64
|
-
* })
|
|
101
|
+
* action: 'read',
|
|
102
|
+
* }],
|
|
103
|
+
* })
|
|
65
104
|
* ```
|
|
66
105
|
* @public
|
|
67
106
|
* @beta Deploying Roles via Blueprints is experimental. This feature is stabilizing but may still be subject to breaking changes.
|
|
107
|
+
* @hidden
|
|
68
108
|
* @category Definers
|
|
109
|
+
* @expandType BlueprintRoleConfig
|
|
69
110
|
* @param projectId The ID of the project to which the role will be scoped
|
|
70
111
|
* @param parameters The configuration of the role
|
|
71
112
|
* @returns The role resource
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"roles.js","sourceRoot":"","sources":["../../src/definers/roles.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,mBAAmB,EACnB,YAAY,GACb,MAAM,aAAa,CAAA;AACpB,OAAO,EAAC,aAAa,EAAC,MAAM,wBAAwB,CAAA;AAEpD
|
|
1
|
+
{"version":3,"file":"roles.js","sourceRoot":"","sources":["../../src/definers/roles.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,mBAAmB,EACnB,YAAY,GACb,MAAM,aAAa,CAAA;AACpB,OAAO,EAAC,aAAa,EAAC,MAAM,wBAAwB,CAAA;AAEpD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,UAAU,UAAU,CAAC,UAA+B,EAAE,OAAoC;IAC9F,MAAM,YAAY,GAA0B;QAC1C,IAAI,EAAE,UAAU,CAAC,IAAI;QACrB,IAAI,EAAE,oBAAoB;QAC1B,KAAK,EAAE,UAAU,CAAC,KAAK;QACvB,WAAW,EAAE,UAAU,CAAC,WAAW;QACnC,cAAc,EAAE,UAAU,CAAC,cAAc;QACzC,eAAe,EAAE,UAAU,CAAC,eAAe;QAC3C,WAAW,EAAE,UAAU,CAAC,WAAW;KACpC,CAAA;IAED,IAAI,UAAU,CAAC,SAAS,EAAE,CAAC;QACzB,YAAY,CAAC,SAAS,GAAG,UAAU,CAAC,SAAS,CAAA;IAC/C,CAAC;IAED,IAAI,OAAO,EAAE,cAAc,KAAK,IAAI;QAAE,aAAa,CAAC,GAAG,EAAE,CAAC,YAAY,CAAC,YAAY,CAAC,CAAC,CAAA;IAErF,OAAO,YAAY,CAAA;AACrB,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,UAAU,iBAAiB,CAAC,SAAiB,EAAE,UAA+B;IAClF,MAAM,YAAY,GAAG,UAAU,CAAC,UAAU,EAAE,EAAC,cAAc,EAAE,IAAI,EAAC,CAAC,CAAA;IAEnE,MAAM,mBAAmB,GAAiC;QACxD,GAAG,YAAY;QACf,YAAY,EAAE,SAAS;QACvB,UAAU,EAAE,SAAS;KACtB,CAAA;IAED,aAAa,CAAC,GAAG,EAAE,CAAC,mBAAmB,CAAC,mBAAmB,CAAC,CAAC,CAAA;IAE7D,OAAO,mBAAmB,CAAA;AAC5B,CAAC"}
|
|
@@ -1,19 +1,22 @@
|
|
|
1
1
|
import { type BlueprintDocumentWebhookConfig, type BlueprintDocumentWebhookResource } from '../index.js';
|
|
2
2
|
/**
|
|
3
3
|
* Defines a webhook that is called when document changes occur.
|
|
4
|
-
*
|
|
4
|
+
*
|
|
5
|
+
* ```ts
|
|
5
6
|
* defineDocumentWebhook({
|
|
6
7
|
* name: 'my-webhook',
|
|
7
8
|
* on: ['create'],
|
|
8
9
|
* url: 'https://example.com/webhook',
|
|
9
10
|
* projection: '{_id}',
|
|
10
|
-
* dataset: '
|
|
11
|
+
* dataset: 'production',
|
|
12
|
+
* apiVersion: 'v2026-01-01',
|
|
11
13
|
* })
|
|
12
14
|
* ```
|
|
13
15
|
* @param parameters The webhook configuration
|
|
14
16
|
* @public
|
|
15
17
|
* @beta Deploying Webhooks via Blueprints is experimental. This feature is stabilizing but may still be subject to breaking changes.
|
|
16
18
|
* @category Definers
|
|
19
|
+
* @expandType BlueprintDocumentWebhookConfig
|
|
17
20
|
* @returns The webhook resource
|
|
18
21
|
*/
|
|
19
22
|
export declare function defineDocumentWebhook(parameters: BlueprintDocumentWebhookConfig): BlueprintDocumentWebhookResource;
|
|
@@ -1,20 +1,43 @@
|
|
|
1
1
|
import { validateDocumentWebhook } from '../index.js';
|
|
2
2
|
import { runValidation } from '../utils/validation.js';
|
|
3
|
+
/*
|
|
4
|
+
* FUTURE example (move below @example when ready)
|
|
5
|
+
* @example All options
|
|
6
|
+
* ```ts
|
|
7
|
+
* defineDocumentWebhook({
|
|
8
|
+
* name: 'sync-webhook',
|
|
9
|
+
* url: 'https://example.com/sync',
|
|
10
|
+
* on: ['create', 'update', 'delete'],
|
|
11
|
+
* dataset: 'production',
|
|
12
|
+
* apiVersion: 'v2026-01-01',
|
|
13
|
+
* filter: "_type == 'product'",
|
|
14
|
+
* projection: '{_id, title, slug}',
|
|
15
|
+
* httpMethod: 'POST',
|
|
16
|
+
* headers: {'X-Custom-Header': 'value'},
|
|
17
|
+
* secret: 'my-webhook-secret',
|
|
18
|
+
* includeDrafts: false,
|
|
19
|
+
* status: 'enabled',
|
|
20
|
+
* })
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
3
23
|
/**
|
|
4
24
|
* Defines a webhook that is called when document changes occur.
|
|
5
|
-
*
|
|
25
|
+
*
|
|
26
|
+
* ```ts
|
|
6
27
|
* defineDocumentWebhook({
|
|
7
28
|
* name: 'my-webhook',
|
|
8
29
|
* on: ['create'],
|
|
9
30
|
* url: 'https://example.com/webhook',
|
|
10
31
|
* projection: '{_id}',
|
|
11
|
-
* dataset: '
|
|
32
|
+
* dataset: 'production',
|
|
33
|
+
* apiVersion: 'v2026-01-01',
|
|
12
34
|
* })
|
|
13
35
|
* ```
|
|
14
36
|
* @param parameters The webhook configuration
|
|
15
37
|
* @public
|
|
16
38
|
* @beta Deploying Webhooks via Blueprints is experimental. This feature is stabilizing but may still be subject to breaking changes.
|
|
17
39
|
* @category Definers
|
|
40
|
+
* @expandType BlueprintDocumentWebhookConfig
|
|
18
41
|
* @returns The webhook resource
|
|
19
42
|
*/
|
|
20
43
|
export function defineDocumentWebhook(parameters) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webhooks.js","sourceRoot":"","sources":["../../src/definers/webhooks.ts"],"names":[],"mappings":"AAAA,OAAO,EAA6E,uBAAuB,EAAC,MAAM,aAAa,CAAA;AAC/H,OAAO,EAAC,aAAa,EAAC,MAAM,wBAAwB,CAAA;AAEpD
|
|
1
|
+
{"version":3,"file":"webhooks.js","sourceRoot":"","sources":["../../src/definers/webhooks.ts"],"names":[],"mappings":"AAAA,OAAO,EAA6E,uBAAuB,EAAC,MAAM,aAAa,CAAA;AAC/H,OAAO,EAAC,aAAa,EAAC,MAAM,wBAAwB,CAAA;AAEpD;;;;;;;;;;;;;;;;;;;GAmBG;AACH;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,UAAU,qBAAqB,CAAC,UAA0C;IAC9E,2BAA2B;IAC3B,IAAI,CAAC,UAAU,CAAC,WAAW,EAAE,CAAC;QAC5B,UAAU,CAAC,WAAW,GAAG,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,EAAE,GAAG,CAAC,CAAA;IAC5D,CAAC;IAED,MAAM,eAAe,GAAqC;QACxD,GAAG,UAAU;QACb,IAAI,EAAE,wBAAwB;KAC/B,CAAA;IAED,aAAa,CAAC,GAAG,EAAE,CAAC,uBAAuB,CAAC,eAAe,CAAC,CAAC,CAAA;IAE7D,OAAO,eAAe,CAAA;AACxB,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ export * from './definers/datasets.js';
|
|
|
8
8
|
export * from './definers/functions.js';
|
|
9
9
|
export * from './definers/resources.js';
|
|
10
10
|
export * from './definers/robots.js';
|
|
11
|
+
export * from './definers/robotTokens.js';
|
|
11
12
|
export * from './definers/roles.js';
|
|
12
13
|
export * from './definers/webhooks.js';
|
|
13
14
|
/**
|
|
@@ -25,6 +26,7 @@ export * from './types/errors.js';
|
|
|
25
26
|
export * from './types/functions.js';
|
|
26
27
|
export * from './types/resources.js';
|
|
27
28
|
export * from './types/robots.js';
|
|
29
|
+
export * from './types/robotTokens.js';
|
|
28
30
|
export * from './types/roles.js';
|
|
29
31
|
export * from './types/webhooks.js';
|
|
30
32
|
/**
|
|
@@ -37,6 +39,7 @@ export * from './validation/datasets.js';
|
|
|
37
39
|
export * from './validation/functions.js';
|
|
38
40
|
export * from './validation/resources.js';
|
|
39
41
|
export * from './validation/robots.js';
|
|
42
|
+
export * from './validation/robotTokens.js';
|
|
40
43
|
export * from './validation/roles.js';
|
|
41
44
|
export * from './validation/webhooks.js';
|
|
42
45
|
/**
|
package/dist/index.js
CHANGED
|
@@ -9,6 +9,7 @@ export * from './definers/datasets.js';
|
|
|
9
9
|
export * from './definers/functions.js';
|
|
10
10
|
export * from './definers/resources.js';
|
|
11
11
|
export * from './definers/robots.js';
|
|
12
|
+
export * from './definers/robotTokens.js';
|
|
12
13
|
export * from './definers/roles.js';
|
|
13
14
|
export * from './definers/webhooks.js';
|
|
14
15
|
// TYPES - base types for all resources
|
|
@@ -27,6 +28,7 @@ export * from './types/errors.js';
|
|
|
27
28
|
export * from './types/functions.js';
|
|
28
29
|
export * from './types/resources.js';
|
|
29
30
|
export * from './types/robots.js';
|
|
31
|
+
export * from './types/robotTokens.js';
|
|
30
32
|
export * from './types/roles.js';
|
|
31
33
|
export * from './types/webhooks.js';
|
|
32
34
|
// VALIDATION - validation for all resources
|
|
@@ -40,6 +42,7 @@ export * from './validation/datasets.js';
|
|
|
40
42
|
export * from './validation/functions.js';
|
|
41
43
|
export * from './validation/resources.js';
|
|
42
44
|
export * from './validation/robots.js';
|
|
45
|
+
export * from './validation/robotTokens.js';
|
|
43
46
|
export * from './validation/roles.js';
|
|
44
47
|
export * from './validation/webhooks.js';
|
|
45
48
|
// Public BLUEPRINTS INTERNALS - published bucket of misc Blueprint types
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,kDAAkD;AAClD;;;GAGG;AACH,cAAc,0BAA0B,CAAA;AACxC,cAAc,oBAAoB,CAAA;AAClC,cAAc,wBAAwB,CAAA;AACtC,cAAc,yBAAyB,CAAA;AACvC,cAAc,yBAAyB,CAAA;AACvC,cAAc,sBAAsB,CAAA;AACpC,cAAc,qBAAqB,CAAA;AACnC,cAAc,wBAAwB,CAAA;AAEtC,uCAAuC;AACvC;;;GAGG;AACH;;;GAGG;AACH,cAAc,uBAAuB,CAAA;AACrC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,qBAAqB,CAAA;AACnC,cAAc,mBAAmB,CAAA;AACjC,cAAc,sBAAsB,CAAA;AACpC,cAAc,sBAAsB,CAAA;AACpC,cAAc,mBAAmB,CAAA;AACjC,cAAc,kBAAkB,CAAA;AAChC,cAAc,qBAAqB,CAAA;AAEnC,4CAA4C;AAC5C;;;GAGG;AACH,cAAc,4BAA4B,CAAA;AAC1C,cAAc,sBAAsB,CAAA;AACpC,cAAc,0BAA0B,CAAA;AACxC,cAAc,2BAA2B,CAAA;AACzC,cAAc,2BAA2B,CAAA;AACzC,cAAc,wBAAwB,CAAA;AACtC,cAAc,uBAAuB,CAAA;AACrC,cAAc,0BAA0B,CAAA;AAExC,yEAAyE;AACzE;;;GAGG"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,kDAAkD;AAClD;;;GAGG;AACH,cAAc,0BAA0B,CAAA;AACxC,cAAc,oBAAoB,CAAA;AAClC,cAAc,wBAAwB,CAAA;AACtC,cAAc,yBAAyB,CAAA;AACvC,cAAc,yBAAyB,CAAA;AACvC,cAAc,sBAAsB,CAAA;AACpC,cAAc,2BAA2B,CAAA;AACzC,cAAc,qBAAqB,CAAA;AACnC,cAAc,wBAAwB,CAAA;AAEtC,uCAAuC;AACvC;;;GAGG;AACH;;;GAGG;AACH,cAAc,uBAAuB,CAAA;AACrC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,qBAAqB,CAAA;AACnC,cAAc,mBAAmB,CAAA;AACjC,cAAc,sBAAsB,CAAA;AACpC,cAAc,sBAAsB,CAAA;AACpC,cAAc,mBAAmB,CAAA;AACjC,cAAc,wBAAwB,CAAA;AACtC,cAAc,kBAAkB,CAAA;AAChC,cAAc,qBAAqB,CAAA;AAEnC,4CAA4C;AAC5C;;;GAGG;AACH,cAAc,4BAA4B,CAAA;AAC1C,cAAc,sBAAsB,CAAA;AACpC,cAAc,0BAA0B,CAAA;AACxC,cAAc,2BAA2B,CAAA;AACzC,cAAc,2BAA2B,CAAA;AACzC,cAAc,wBAAwB,CAAA;AACtC,cAAc,6BAA6B,CAAA;AAC3C,cAAc,uBAAuB,CAAA;AACrC,cAAc,0BAA0B,CAAA;AAExC,yEAAyE;AACzE;;;GAGG"}
|
package/dist/types/cors.d.ts
CHANGED
|
@@ -32,6 +32,7 @@ export interface BlueprintCorsOriginResource extends BlueprintResource<Blueprint
|
|
|
32
32
|
* @see https://www.sanity.io/docs/content-lake/cors
|
|
33
33
|
* @beta This feature is subject to breaking changes.
|
|
34
34
|
* @category Resource Types
|
|
35
|
+
* @interface
|
|
35
36
|
*/
|
|
36
37
|
export type BlueprintCorsOriginConfig = Omit<BlueprintCorsOriginResource, 'type' | 'allowCredentials'> & {
|
|
37
38
|
/**
|
|
@@ -40,6 +41,7 @@ export type BlueprintCorsOriginConfig = Omit<BlueprintCorsOriginResource, 'type'
|
|
|
40
41
|
* If this origin hosts a studio, you will need to allow credentials. Otherwise, you should probably select not to allow credentials.
|
|
41
42
|
*
|
|
42
43
|
* 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.
|
|
44
|
+
* @defaultValue false
|
|
43
45
|
*/
|
|
44
46
|
allowCredentials?: boolean;
|
|
45
47
|
};
|
package/dist/types/datasets.d.ts
CHANGED
|
@@ -32,8 +32,12 @@ export interface BlueprintDatasetResource extends BlueprintResource<BlueprintPro
|
|
|
32
32
|
* @alpha This feature is subject to breaking changes.
|
|
33
33
|
* @hidden
|
|
34
34
|
* @category Resource Types
|
|
35
|
+
* @interface
|
|
35
36
|
*/
|
|
36
37
|
export type BlueprintDatasetConfig = Omit<BlueprintDatasetResource, 'type' | 'datasetName'> & {
|
|
37
|
-
/**
|
|
38
|
+
/**
|
|
39
|
+
* The name of the dataset. Must be unique within a project.
|
|
40
|
+
* @defaultValue The `name` of the resource
|
|
41
|
+
*/
|
|
38
42
|
datasetName?: string;
|
|
39
43
|
};
|
|
@@ -4,7 +4,10 @@ import type { BlueprintResource } from '../index.js';
|
|
|
4
4
|
* @category Functions Types
|
|
5
5
|
*/
|
|
6
6
|
export interface BlueprintFunctionBaseResourceEvent {
|
|
7
|
-
/**
|
|
7
|
+
/**
|
|
8
|
+
* Event types that trigger the function
|
|
9
|
+
* @defaultValue ['publish']
|
|
10
|
+
*/
|
|
8
11
|
on?: [BlueprintFunctionResourceEventName, ...BlueprintFunctionResourceEventName[]];
|
|
9
12
|
/** GROQ filter expression to match specific documents (e.g., "_type == 'post'") */
|
|
10
13
|
filter?: string;
|
|
@@ -64,7 +67,7 @@ export type BlueprintScheduleFunctionResourceEvent = BlueprintScheduleFunctionEx
|
|
|
64
67
|
/**
|
|
65
68
|
* Dataset resource for scoping document functions to specific datasets
|
|
66
69
|
* @example { type: 'dataset', id: 'my-project.production' }
|
|
67
|
-
* @category
|
|
70
|
+
* @category Functions Types
|
|
68
71
|
*/
|
|
69
72
|
export interface BlueprintFunctionResourceEventResourceDataset {
|
|
70
73
|
type: 'dataset';
|
|
@@ -118,7 +121,7 @@ export interface BlueprintBaseFunctionResource extends BlueprintResource {
|
|
|
118
121
|
project?: string;
|
|
119
122
|
/**
|
|
120
123
|
* The runtime environment for the function (currently only Node.js is supported)
|
|
121
|
-
* @
|
|
124
|
+
* @defaultValue 'nodejs24.x'
|
|
122
125
|
*/
|
|
123
126
|
runtime?: FunctionRuntimes;
|
|
124
127
|
}
|
|
@@ -149,3 +152,62 @@ export interface BlueprintScheduleFunctionResource extends BlueprintBaseFunction
|
|
|
149
152
|
event: BlueprintScheduleFunctionResourceEvent;
|
|
150
153
|
timezone?: string;
|
|
151
154
|
}
|
|
155
|
+
/**
|
|
156
|
+
* Configuration for defining a base function.
|
|
157
|
+
* @internal
|
|
158
|
+
* @category Functions Types
|
|
159
|
+
* @interface
|
|
160
|
+
*/
|
|
161
|
+
export type BlueprintBaseFunctionConfig = Omit<BlueprintBaseFunctionResource, 'type' | 'src'> & {
|
|
162
|
+
/**
|
|
163
|
+
* Path to the function source code
|
|
164
|
+
* @defaultValue `functions/${name}`
|
|
165
|
+
*/
|
|
166
|
+
src?: string;
|
|
167
|
+
};
|
|
168
|
+
/**
|
|
169
|
+
* Configuration for defining a document function.
|
|
170
|
+
* @public
|
|
171
|
+
* @category Functions Types
|
|
172
|
+
* @interface
|
|
173
|
+
*/
|
|
174
|
+
export type BlueprintDocumentFunctionConfig = Omit<BlueprintDocumentFunctionResource, 'type' | 'src' | 'event'> & {
|
|
175
|
+
/**
|
|
176
|
+
* Path to the function source code
|
|
177
|
+
* @defaultValue `functions/${name}`
|
|
178
|
+
*/
|
|
179
|
+
src?: string;
|
|
180
|
+
/**
|
|
181
|
+
* Event configuration specifying when and how the function is triggered
|
|
182
|
+
* @defaultValue `{on: ['publish']}`
|
|
183
|
+
*/
|
|
184
|
+
event?: BlueprintDocumentFunctionResourceEvent;
|
|
185
|
+
};
|
|
186
|
+
/**
|
|
187
|
+
* Configuration for defining a media library asset function.
|
|
188
|
+
* @public
|
|
189
|
+
* @category Functions Types
|
|
190
|
+
* @interface
|
|
191
|
+
*/
|
|
192
|
+
export type BlueprintMediaLibraryAssetFunctionConfig = Omit<BlueprintMediaLibraryAssetFunctionResource, 'type' | 'src'> & {
|
|
193
|
+
/**
|
|
194
|
+
* Path to the function source code
|
|
195
|
+
* @defaultValue `functions/${name}`
|
|
196
|
+
*/
|
|
197
|
+
src?: string;
|
|
198
|
+
};
|
|
199
|
+
/**
|
|
200
|
+
* Configuration for defining a schedule function.
|
|
201
|
+
* @public
|
|
202
|
+
* @alpha Deploying Schedule Functions via Blueprints is experimental. This feature is not available publicly yet.
|
|
203
|
+
* @hidden
|
|
204
|
+
* @category Functions Types
|
|
205
|
+
* @interface
|
|
206
|
+
*/
|
|
207
|
+
export type BlueprintScheduleFunctionConfig = Omit<BlueprintScheduleFunctionResource, 'type' | 'src'> & {
|
|
208
|
+
/**
|
|
209
|
+
* Path to the function source code
|
|
210
|
+
* @defaultValue `functions/${name}`
|
|
211
|
+
*/
|
|
212
|
+
src?: string;
|
|
213
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"functions.js","sourceRoot":"","sources":["../../src/types/functions.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"functions.js","sourceRoot":"","sources":["../../src/types/functions.ts"],"names":[],"mappings":"AAwGA;;;GAGG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,MAAM,EAAE,YAAY,EAAE,YAAY,CAAU,CAAA"}
|
|
@@ -27,6 +27,7 @@ export interface BlueprintOwnershipDetachAction {
|
|
|
27
27
|
/**
|
|
28
28
|
* A union of all possible ownership actions.
|
|
29
29
|
* @category Blueprint Internals
|
|
30
|
+
* @expand
|
|
30
31
|
*/
|
|
31
32
|
export type BlueprintOwnershipAction = BlueprintOwnershipAttachAction | BlueprintOwnershipDetachAction;
|
|
32
33
|
/**
|
|
@@ -40,6 +41,7 @@ export interface BlueprintProjectOwnershipAttachAction extends BlueprintOwnershi
|
|
|
40
41
|
/**
|
|
41
42
|
* A union of all possible ownership actions for resources belonging to projects.
|
|
42
43
|
* @category Blueprint Internals
|
|
44
|
+
* @expand
|
|
43
45
|
*/
|
|
44
46
|
export type BlueprintProjectOwnershipAction = BlueprintProjectOwnershipAttachAction;
|
|
45
47
|
/**
|
|
@@ -49,10 +51,26 @@ export type BlueprintProjectOwnershipAction = BlueprintProjectOwnershipAttachAct
|
|
|
49
51
|
export interface BlueprintResourceLifecycle {
|
|
50
52
|
deletionPolicy?: BlueprintResourceDeletionPolicy;
|
|
51
53
|
ownershipAction?: BlueprintOwnershipAction;
|
|
54
|
+
/**
|
|
55
|
+
* Declares a dependency on another resource in the blueprint.
|
|
56
|
+
* The referenced resource will be deployed before this one.
|
|
57
|
+
*
|
|
58
|
+
* The value must be a resource reference starting with `$.resources.` followed by the name of
|
|
59
|
+
* the resource this resource depends on.
|
|
60
|
+
*
|
|
61
|
+
* @example
|
|
62
|
+
* ```ts
|
|
63
|
+
* lifecycle: {
|
|
64
|
+
* dependsOn: '$.resources.my-dataset',
|
|
65
|
+
* }
|
|
66
|
+
* ```
|
|
67
|
+
*/
|
|
68
|
+
dependsOn?: string;
|
|
52
69
|
}
|
|
53
70
|
/**
|
|
54
71
|
* Defines the lifcycle policy for this resource.
|
|
55
72
|
* @category Blueprint Internals
|
|
73
|
+
* @experimental
|
|
56
74
|
*/
|
|
57
75
|
export interface BlueprintProjectResourceLifecycle extends BlueprintResourceLifecycle {
|
|
58
76
|
ownershipAction?: BlueprintProjectOwnershipAction;
|
|
@@ -62,7 +80,14 @@ export interface BlueprintProjectResourceLifecycle extends BlueprintResourceLife
|
|
|
62
80
|
* @category Blueprint Internals
|
|
63
81
|
*/
|
|
64
82
|
export interface BlueprintResource<Lifecycle extends BlueprintResourceLifecycle = BlueprintResourceLifecycle> {
|
|
83
|
+
/** The type of the resource. e.g. 'sanity.project.webhook' */
|
|
65
84
|
type: string;
|
|
85
|
+
/** The name of the resource. Unique within the blueprint. e.g. 'sync-webhook' */
|
|
66
86
|
name: string;
|
|
87
|
+
/**
|
|
88
|
+
* Defines the lifcycle policy for this resource.
|
|
89
|
+
* @experimental
|
|
90
|
+
* @hidden
|
|
91
|
+
*/
|
|
67
92
|
lifecycle?: Lifecycle;
|
|
68
93
|
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { BlueprintProjectResourceLifecycle, BlueprintResource } from './resources';
|
|
2
|
+
/**
|
|
3
|
+
* Resource types that robot tokens can be attached to.
|
|
4
|
+
* @internal
|
|
5
|
+
*/
|
|
6
|
+
export type RobotTokenResourceType = 'organization' | 'project';
|
|
7
|
+
/**
|
|
8
|
+
* Defines the robot token's roles within a given resource.
|
|
9
|
+
* @beta This feature is subject to breaking changes.
|
|
10
|
+
* @category Resource Types
|
|
11
|
+
* @expand
|
|
12
|
+
*/
|
|
13
|
+
export interface RobotTokenMembership {
|
|
14
|
+
resourceType: RobotTokenResourceType;
|
|
15
|
+
resourceId: string;
|
|
16
|
+
roleNames: string[];
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* A robot token that provides automated access.
|
|
20
|
+
* @see https://www.sanity.io/docs/content-lake/http-auth#k4c21d7b829fe
|
|
21
|
+
* @beta This feature is subject to breaking changes.
|
|
22
|
+
* @category Resource Types
|
|
23
|
+
*/
|
|
24
|
+
export interface BlueprintRobotTokenResource extends BlueprintResource<BlueprintProjectResourceLifecycle> {
|
|
25
|
+
type: 'sanity.access.robot';
|
|
26
|
+
/** A descriptive label for the robot token and its use case */
|
|
27
|
+
label: string;
|
|
28
|
+
memberships: RobotTokenMembership[];
|
|
29
|
+
resourceType?: RobotTokenResourceType;
|
|
30
|
+
resourceId?: string;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Configuration for a robot token that provides automated access.
|
|
34
|
+
* @see https://www.sanity.io/docs/content-lake/http-auth#k4c21d7b829fe
|
|
35
|
+
* @beta This feature is subject to breaking changes.
|
|
36
|
+
* @category Resource Types
|
|
37
|
+
* @interface
|
|
38
|
+
*/
|
|
39
|
+
export type BlueprintRobotTokenConfig = Omit<BlueprintRobotTokenResource, 'type' | 'label' | 'token'> & {
|
|
40
|
+
/**
|
|
41
|
+
* A descriptive label for the robot token and its use case
|
|
42
|
+
* @defaultValue The `name` of the resource
|
|
43
|
+
*/
|
|
44
|
+
label?: string;
|
|
45
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"robotTokens.js","sourceRoot":"","sources":["../../src/types/robotTokens.ts"],"names":[],"mappings":""}
|
package/dist/types/robots.d.ts
CHANGED
|
@@ -1,39 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
*/
|
|
6
|
-
export type
|
|
7
|
-
/**
|
|
8
|
-
|
|
9
|
-
* @beta This feature is subject to breaking changes.
|
|
10
|
-
* @category Resource Types
|
|
11
|
-
*/
|
|
12
|
-
export interface RobotMembership {
|
|
13
|
-
resourceType: RobotResourceType;
|
|
14
|
-
resourceId: string;
|
|
15
|
-
roleNames: string[];
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* A robot that provides a token for automated access.
|
|
19
|
-
* @see https://www.sanity.io/docs/content-lake/http-auth#k4c21d7b829fe
|
|
20
|
-
* @beta This feature is subject to breaking changes.
|
|
21
|
-
* @category Resource Types
|
|
22
|
-
*/
|
|
23
|
-
export interface BlueprintRobotResource extends BlueprintResource<BlueprintProjectResourceLifecycle> {
|
|
24
|
-
type: 'sanity.access.robot';
|
|
25
|
-
/** A descriptive label for the robot and its use case */
|
|
26
|
-
label: string;
|
|
27
|
-
memberships: RobotMembership[];
|
|
28
|
-
resourceType?: RobotResourceType;
|
|
29
|
-
resourceId?: string;
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Configuration for a robot that provides a token for automated access.
|
|
33
|
-
* @see https://www.sanity.io/docs/content-lake/http-auth#k4c21d7b829fe
|
|
34
|
-
* @beta This feature is subject to breaking changes.
|
|
35
|
-
* @category Resource Types
|
|
36
|
-
*/
|
|
37
|
-
export type BlueprintRobotConfig = Omit<BlueprintRobotResource, 'type' | 'label' | 'token'> & {
|
|
38
|
-
label?: string;
|
|
39
|
-
};
|
|
1
|
+
/** @deprecated Use {@link BlueprintRobotTokenConfig} instead @hidden */
|
|
2
|
+
export type { BlueprintRobotTokenConfig as BlueprintRobotConfig } from './robotTokens.js';
|
|
3
|
+
/** @deprecated Use {@link BlueprintRobotTokenResource} instead @hidden */
|
|
4
|
+
export type { BlueprintRobotTokenResource as BlueprintRobotResource } from './robotTokens.js';
|
|
5
|
+
/** @deprecated Use {@link RobotTokenMembership} instead @hidden */
|
|
6
|
+
export type { RobotTokenMembership as RobotMembership } from './robotTokens.js';
|
|
7
|
+
/** @deprecated Use {@link RobotTokenResourceType} instead @hidden */
|
|
8
|
+
export type { RobotTokenResourceType as RobotResourceType } from './robotTokens.js';
|
package/dist/types/robots.js
CHANGED
package/dist/types/robots.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"robots.js","sourceRoot":"","sources":["../../src/types/robots.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"robots.js","sourceRoot":"","sources":["../../src/types/robots.ts"],"names":[],"mappings":"AAAA,iFAAiF"}
|
package/dist/types/roles.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import type { BlueprintProjectResourceLifecycle, BlueprintResource } from '../in
|
|
|
3
3
|
* A permission definition for a role.
|
|
4
4
|
* @beta This feature is subject to breaking changes.
|
|
5
5
|
* @category Resource Types
|
|
6
|
+
* @expand
|
|
6
7
|
*/
|
|
7
8
|
export interface RolePermission {
|
|
8
9
|
/** Predefined permission name (e.g., 'sanity-all-documents') */
|