@sanity/blueprints 0.23.4 → 0.23.6

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.
@@ -7,7 +7,7 @@ import { runValidation } from '../utils/validation.js';
7
7
  * defineDataset({
8
8
  * name: 'staging',
9
9
  * datasetName: 'staging-v2',
10
- * aclMode: 'private',
10
+ * visibility: 'private',
11
11
  * project: 'my-project-id',
12
12
  * lifecycle: {deletionPolicy: 'protect'},
13
13
  * })
@@ -31,11 +31,13 @@ import { runValidation } from '../utils/validation.js';
31
31
  * @returns The dataset resource
32
32
  */
33
33
  export function defineDataset(parameters) {
34
- // default dataset name
34
+ // default dataset name and acl mode
35
35
  const datasetName = parameters.datasetName || parameters.name;
36
+ const aclMode = parameters.aclMode || parameters.visibility || 'public';
36
37
  const datasetResource = {
37
38
  ...parameters,
38
39
  datasetName,
40
+ aclMode,
39
41
  type: 'sanity.project.dataset',
40
42
  };
41
43
  runValidation(() => validateDataset(datasetResource));
@@ -1 +1 @@
1
- {"version":3,"file":"datasets.js","sourceRoot":"","sources":["../../src/definers/datasets.ts"],"names":[],"mappings":"AAAA,OAAO,EAA6D,eAAe,EAAC,MAAM,aAAa,CAAA;AACvG,OAAO,EAAC,aAAa,EAAC,MAAM,wBAAwB,CAAA;AAEpD;;;;;;;;;;;;GAYG;AACH;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,aAAa,CAAC,UAAkC;IAC9D,uBAAuB;IACvB,MAAM,WAAW,GAAG,UAAU,CAAC,WAAW,IAAI,UAAU,CAAC,IAAI,CAAA;IAE7D,MAAM,eAAe,GAA6B;QAChD,GAAG,UAAU;QACb,WAAW;QACX,IAAI,EAAE,wBAAwB;KAC/B,CAAA;IAED,aAAa,CAAC,GAAG,EAAE,CAAC,eAAe,CAAC,eAAe,CAAC,CAAC,CAAA;IAErD,OAAO,eAAe,CAAA;AACxB,CAAC"}
1
+ {"version":3,"file":"datasets.js","sourceRoot":"","sources":["../../src/definers/datasets.ts"],"names":[],"mappings":"AAAA,OAAO,EAA6D,eAAe,EAAC,MAAM,aAAa,CAAA;AACvG,OAAO,EAAC,aAAa,EAAC,MAAM,wBAAwB,CAAA;AAEpD;;;;;;;;;;;;GAYG;AACH;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,aAAa,CAAC,UAAkC;IAC9D,oCAAoC;IACpC,MAAM,WAAW,GAAG,UAAU,CAAC,WAAW,IAAI,UAAU,CAAC,IAAI,CAAA;IAC7D,MAAM,OAAO,GAAG,UAAU,CAAC,OAAO,IAAI,UAAU,CAAC,UAAU,IAAI,QAAQ,CAAA;IAEvE,MAAM,eAAe,GAA6B;QAChD,GAAG,UAAU;QACb,WAAW;QACX,OAAO;QACP,IAAI,EAAE,wBAAwB;KAC/B,CAAA;IAED,aAAa,CAAC,GAAG,EAAE,CAAC,eAAe,CAAC,eAAe,CAAC,CAAC,CAAA;IAErD,OAAO,eAAe,CAAA;AACxB,CAAC"}
@@ -19,8 +19,10 @@ export interface BlueprintDatasetResource extends BlueprintResource<BlueprintPro
19
19
  datasetName: string;
20
20
  /** The dataset description */
21
21
  description?: string;
22
- /** The ACL mode to set for the new dataset. Defaults to public. */
23
- aclMode?: AclMode;
22
+ /**
23
+ * The ACL mode to set for the dataset. Defaults to public.
24
+ */
25
+ aclMode: AclMode;
24
26
  /**
25
27
  * The project ID of the project that contains your Dataset.
26
28
  *
@@ -36,10 +38,17 @@ export interface BlueprintDatasetResource extends BlueprintResource<BlueprintPro
36
38
  * @category Resource Types
37
39
  * @interface
38
40
  */
39
- export type BlueprintDatasetConfig = Omit<BlueprintDatasetResource, 'type' | 'datasetName'> & {
41
+ export type BlueprintDatasetConfig = Omit<BlueprintDatasetResource, 'type' | 'datasetName' | 'aclMode'> & {
40
42
  /**
41
43
  * The name of the dataset. Must be unique within a project.
42
44
  * @defaultValue The `name` of the resource
43
45
  */
44
46
  datasetName?: string;
47
+ /**
48
+ * The ACL mode to set for the dataset. Defaults to public.
49
+ * @hidden
50
+ */
51
+ aclMode?: AclMode;
52
+ /** The visibility to set for the dataset. Defaults to public. */
53
+ visibility?: AclMode;
45
54
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sanity/blueprints",
3
- "version": "0.23.4",
3
+ "version": "0.23.6",
4
4
  "description": "Helper methods and type definitions for Sanity Blueprints",
5
5
  "keywords": [
6
6
  "sanity",
@@ -8,7 +8,7 @@ import {runValidation} from '../utils/validation.js'
8
8
  * defineDataset({
9
9
  * name: 'staging',
10
10
  * datasetName: 'staging-v2',
11
- * aclMode: 'private',
11
+ * visibility: 'private',
12
12
  * project: 'my-project-id',
13
13
  * lifecycle: {deletionPolicy: 'protect'},
14
14
  * })
@@ -32,12 +32,14 @@ import {runValidation} from '../utils/validation.js'
32
32
  * @returns The dataset resource
33
33
  */
34
34
  export function defineDataset(parameters: BlueprintDatasetConfig): BlueprintDatasetResource {
35
- // default dataset name
35
+ // default dataset name and acl mode
36
36
  const datasetName = parameters.datasetName || parameters.name
37
+ const aclMode = parameters.aclMode || parameters.visibility || 'public'
37
38
 
38
39
  const datasetResource: BlueprintDatasetResource = {
39
40
  ...parameters,
40
41
  datasetName,
42
+ aclMode,
41
43
  type: 'sanity.project.dataset',
42
44
  }
43
45
 
@@ -21,8 +21,10 @@ export interface BlueprintDatasetResource extends BlueprintResource<BlueprintPro
21
21
  datasetName: string
22
22
  /** The dataset description */
23
23
  description?: string
24
- /** The ACL mode to set for the new dataset. Defaults to public. */
25
- aclMode?: AclMode
24
+ /**
25
+ * The ACL mode to set for the dataset. Defaults to public.
26
+ */
27
+ aclMode: AclMode
26
28
 
27
29
  /**
28
30
  * The project ID of the project that contains your Dataset.
@@ -40,10 +42,17 @@ export interface BlueprintDatasetResource extends BlueprintResource<BlueprintPro
40
42
  * @category Resource Types
41
43
  * @interface
42
44
  */
43
- export type BlueprintDatasetConfig = Omit<BlueprintDatasetResource, 'type' | 'datasetName'> & {
45
+ export type BlueprintDatasetConfig = Omit<BlueprintDatasetResource, 'type' | 'datasetName' | 'aclMode'> & {
44
46
  /**
45
47
  * The name of the dataset. Must be unique within a project.
46
48
  * @defaultValue The `name` of the resource
47
49
  */
48
50
  datasetName?: string
51
+ /**
52
+ * The ACL mode to set for the dataset. Defaults to public.
53
+ * @hidden
54
+ */
55
+ aclMode?: AclMode
56
+ /** The visibility to set for the dataset. Defaults to public. */
57
+ visibility?: AclMode
49
58
  }