@sanity/media-library-types 1.4.0 → 1.6.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/lib/index.d.cts CHANGED
@@ -67,10 +67,7 @@ declare interface ArrayOptions<V = unknown>
67
67
  /** @deprecated This option does not have any effect anymore */
68
68
  direction?: "horizontal" | "vertical";
69
69
  sortable?: boolean;
70
- modal?: {
71
- type?: "dialog" | "popover";
72
- width?: number | "auto";
73
- };
70
+ modal?: ModalOptions;
74
71
  /** @alpha This API may change */
75
72
  insertMenu?: InsertMenuOptions;
76
73
  /**
@@ -589,9 +586,10 @@ declare interface BlockDefinition extends BaseSchemaDefinition {
589
586
  lists?: BlockListDefinition[];
590
587
  marks?: BlockMarksDefinition;
591
588
  of?: ArrayOfType<"object" | "reference">[];
592
- initialValue?: InitialValueProperty<any, any[]>;
589
+ /** Block types do not support initialValue - the runtime schema validation rejects it. */
590
+ initialValue?: never;
593
591
  options?: BlockOptions;
594
- validation?: ValidationBuilder<BlockRule, any[]>;
592
+ validation?: ValidationBuilder<BlockRule, PortableTextBlock>;
595
593
  }
596
594
 
597
595
  /**
@@ -654,7 +652,7 @@ declare interface BlockOptions extends BaseSchemaTypeOptions {
654
652
  }
655
653
 
656
654
  /** @public */
657
- declare interface BlockRule extends RuleDef<BlockRule, any[]> {}
655
+ declare interface BlockRule extends RuleDef<BlockRule, PortableTextBlock> {}
658
656
 
659
657
  /**
660
658
  * Schema definition for a text block style.
@@ -1526,6 +1524,13 @@ declare interface MediaValidator<T extends MediaAssetTypes = MediaAssetTypes> {
1526
1524
  ): CustomValidatorResult | Promise<CustomValidatorResult>;
1527
1525
  }
1528
1526
 
1527
+ /** @public */
1528
+ /** @public */
1529
+ declare interface ModalOptions {
1530
+ type?: "dialog" | "popover";
1531
+ width?: 1 | 2 | 3 | 4 | 5 | "auto" | (1 | 2 | 3 | 4 | 5 | "auto")[];
1532
+ }
1533
+
1529
1534
  /** @public */
1530
1535
  declare interface MultiFieldSet {
1531
1536
  name: string;
@@ -1607,10 +1612,7 @@ declare interface ObjectOptions extends BaseSchemaTypeOptions {
1607
1612
  collapsible?: boolean;
1608
1613
  collapsed?: boolean;
1609
1614
  columns?: number;
1610
- modal?: {
1611
- type?: "dialog" | "popover";
1612
- width?: number | number[] | "auto";
1613
- };
1615
+ modal?: ModalOptions;
1614
1616
  }
1615
1617
 
1616
1618
  /** @public */
@@ -1781,6 +1783,37 @@ export declare type PluginPostMessageUploadFilesResponse = {
1781
1783
  */
1782
1784
  export declare type PluginSelectAssetType = "file" | "image" | "video";
1783
1785
 
1786
+ /** @public */
1787
+ declare type PortableTextBlock = PortableTextTextBlock | PortableTextObject;
1788
+
1789
+ /** @public */
1790
+ declare interface PortableTextObject {
1791
+ _type: string;
1792
+ _key: string;
1793
+ [other: string]: unknown;
1794
+ }
1795
+
1796
+ /** @public */
1797
+ declare interface PortableTextSpan {
1798
+ _key: string;
1799
+ _type: "span";
1800
+ text: string;
1801
+ marks?: string[];
1802
+ }
1803
+
1804
+ /** @public */
1805
+ declare interface PortableTextTextBlock<
1806
+ TChild = PortableTextSpan | PortableTextObject,
1807
+ > {
1808
+ _type: string;
1809
+ _key: string;
1810
+ children: TChild[];
1811
+ markDefs?: PortableTextObject[];
1812
+ listItem?: string;
1813
+ style?: string;
1814
+ level?: number;
1815
+ }
1816
+
1784
1817
  /** @public */
1785
1818
  declare interface PrepareViewOptions {
1786
1819
  /** @beta */
@@ -2287,6 +2320,7 @@ declare type SanityAssetCollection = {
2287
2320
  _key: string;
2288
2321
  } & SanityAssetReference
2289
2322
  >;
2323
+ _system?: SanitySystem;
2290
2324
  };
2291
2325
 
2292
2326
  declare type SanityAssetInstanceState = string;
@@ -2542,6 +2576,7 @@ export declare type SanityVideoAsset = {
2542
2576
  _key: string;
2543
2577
  }>;
2544
2578
  state: SanityAssetInstanceState;
2579
+ error?: string;
2545
2580
  sha1hash?: string;
2546
2581
  mimeType?: string;
2547
2582
  originalFilename?: string;
package/lib/index.d.ts CHANGED
@@ -67,10 +67,7 @@ declare interface ArrayOptions<V = unknown>
67
67
  /** @deprecated This option does not have any effect anymore */
68
68
  direction?: "horizontal" | "vertical";
69
69
  sortable?: boolean;
70
- modal?: {
71
- type?: "dialog" | "popover";
72
- width?: number | "auto";
73
- };
70
+ modal?: ModalOptions;
74
71
  /** @alpha This API may change */
75
72
  insertMenu?: InsertMenuOptions;
76
73
  /**
@@ -589,9 +586,10 @@ declare interface BlockDefinition extends BaseSchemaDefinition {
589
586
  lists?: BlockListDefinition[];
590
587
  marks?: BlockMarksDefinition;
591
588
  of?: ArrayOfType<"object" | "reference">[];
592
- initialValue?: InitialValueProperty<any, any[]>;
589
+ /** Block types do not support initialValue - the runtime schema validation rejects it. */
590
+ initialValue?: never;
593
591
  options?: BlockOptions;
594
- validation?: ValidationBuilder<BlockRule, any[]>;
592
+ validation?: ValidationBuilder<BlockRule, PortableTextBlock>;
595
593
  }
596
594
 
597
595
  /**
@@ -654,7 +652,7 @@ declare interface BlockOptions extends BaseSchemaTypeOptions {
654
652
  }
655
653
 
656
654
  /** @public */
657
- declare interface BlockRule extends RuleDef<BlockRule, any[]> {}
655
+ declare interface BlockRule extends RuleDef<BlockRule, PortableTextBlock> {}
658
656
 
659
657
  /**
660
658
  * Schema definition for a text block style.
@@ -1526,6 +1524,13 @@ declare interface MediaValidator<T extends MediaAssetTypes = MediaAssetTypes> {
1526
1524
  ): CustomValidatorResult | Promise<CustomValidatorResult>;
1527
1525
  }
1528
1526
 
1527
+ /** @public */
1528
+ /** @public */
1529
+ declare interface ModalOptions {
1530
+ type?: "dialog" | "popover";
1531
+ width?: 1 | 2 | 3 | 4 | 5 | "auto" | (1 | 2 | 3 | 4 | 5 | "auto")[];
1532
+ }
1533
+
1529
1534
  /** @public */
1530
1535
  declare interface MultiFieldSet {
1531
1536
  name: string;
@@ -1607,10 +1612,7 @@ declare interface ObjectOptions extends BaseSchemaTypeOptions {
1607
1612
  collapsible?: boolean;
1608
1613
  collapsed?: boolean;
1609
1614
  columns?: number;
1610
- modal?: {
1611
- type?: "dialog" | "popover";
1612
- width?: number | number[] | "auto";
1613
- };
1615
+ modal?: ModalOptions;
1614
1616
  }
1615
1617
 
1616
1618
  /** @public */
@@ -1781,6 +1783,37 @@ export declare type PluginPostMessageUploadFilesResponse = {
1781
1783
  */
1782
1784
  export declare type PluginSelectAssetType = "file" | "image" | "video";
1783
1785
 
1786
+ /** @public */
1787
+ declare type PortableTextBlock = PortableTextTextBlock | PortableTextObject;
1788
+
1789
+ /** @public */
1790
+ declare interface PortableTextObject {
1791
+ _type: string;
1792
+ _key: string;
1793
+ [other: string]: unknown;
1794
+ }
1795
+
1796
+ /** @public */
1797
+ declare interface PortableTextSpan {
1798
+ _key: string;
1799
+ _type: "span";
1800
+ text: string;
1801
+ marks?: string[];
1802
+ }
1803
+
1804
+ /** @public */
1805
+ declare interface PortableTextTextBlock<
1806
+ TChild = PortableTextSpan | PortableTextObject,
1807
+ > {
1808
+ _type: string;
1809
+ _key: string;
1810
+ children: TChild[];
1811
+ markDefs?: PortableTextObject[];
1812
+ listItem?: string;
1813
+ style?: string;
1814
+ level?: number;
1815
+ }
1816
+
1784
1817
  /** @public */
1785
1818
  declare interface PrepareViewOptions {
1786
1819
  /** @beta */
@@ -2287,6 +2320,7 @@ declare type SanityAssetCollection = {
2287
2320
  _key: string;
2288
2321
  } & SanityAssetReference
2289
2322
  >;
2323
+ _system?: SanitySystem;
2290
2324
  };
2291
2325
 
2292
2326
  declare type SanityAssetInstanceState = string;
@@ -2542,6 +2576,7 @@ export declare type SanityVideoAsset = {
2542
2576
  _key: string;
2543
2577
  }>;
2544
2578
  state: SanityAssetInstanceState;
2579
+ error?: string;
2545
2580
  sha1hash?: string;
2546
2581
  mimeType?: string;
2547
2582
  originalFilename?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sanity/media-library-types",
3
- "version": "1.4.0",
3
+ "version": "1.6.0",
4
4
  "description": "Type definitions for common Sanity Media Library data structures",
5
5
  "keywords": [
6
6
  "content",
@@ -29,7 +29,6 @@
29
29
  "types": "./lib/index.d.ts",
30
30
  "exports": {
31
31
  ".": {
32
- "source": "./src/index.ts",
33
32
  "import": "./lib/index.js",
34
33
  "require": "./lib/index.cjs",
35
34
  "default": "./lib/index.js"
@@ -37,15 +36,14 @@
37
36
  "./package.json": "./package.json"
38
37
  },
39
38
  "devDependencies": {
40
- "@sanity/pkg-utils": "10.4.15",
41
- "@sanity/types": "5.21.0",
39
+ "@sanity/pkg-utils": "10.5.6",
40
+ "@sanity/types": "5.31.1",
42
41
  "rimraf": "5.0.10"
43
42
  },
44
43
  "scripts": {
45
- "build": "cp ../../../apps/huey/src/lib/schema.types.ts ./src/ && pkg-utils build --strict --check --clean",
44
+ "build": "pkg-utils build --strict --check --clean",
46
45
  "check:types": "tsc --project tsconfig.json",
47
46
  "clean": "rimraf lib",
48
- "schema-types": "cp ../../../apps/huey/src/lib/schema.types.ts ./src/",
49
47
  "watch": "pkg-utils watch"
50
48
  }
51
49
  }
@@ -41,6 +41,7 @@ export type SanitySymlink = {
41
41
  parent?: SanityDirectoryReference
42
42
  rootDirectory?: SanityDirectoryReference
43
43
  target?: SanityAssetReference
44
+ _system?: SanitySystem
44
45
  }
45
46
 
46
47
  export type SanityTreeReference = {
@@ -65,6 +66,7 @@ export type SanityAssetCollection = {
65
66
  _key: string
66
67
  } & SanityAssetReference
67
68
  >
69
+ _system?: SanitySystem
68
70
  }
69
71
 
70
72
  export type SanityVideoMetadataRendition = {
@@ -272,6 +274,7 @@ export type SanityVideoAsset = {
272
274
  _key: string
273
275
  }>
274
276
  state: SanityAssetInstanceState
277
+ error?: string
275
278
  sha1hash?: string
276
279
  mimeType?: string
277
280
  originalFilename?: string
@@ -393,6 +396,7 @@ export type SanityDirectory = {
393
396
  name?: string
394
397
  parent?: SanityDirectoryReference | SanityTreeReference
395
398
  rootDirectory?: SanityDirectoryReference
399
+ _system?: SanitySystem
396
400
  }
397
401
 
398
402
  export type SanityTree = {
@@ -402,6 +406,7 @@ export type SanityTree = {
402
406
  _updatedAt: string
403
407
  _rev: string
404
408
  name?: string
409
+ _system?: SanitySystem
405
410
  }
406
411
 
407
412
  export type AllSanitySchemaTypes =