@datocms/astro 0.6.0 → 0.6.2

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/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@datocms/astro",
3
3
  "description": "A set of components and utilities to work faster with DatoCMS in Astro projects.",
4
4
  "type": "module",
5
- "version": "0.6.0",
5
+ "version": "0.6.2",
6
6
  "sideEffects": false,
7
7
  "repository": {
8
8
  "type": "git",
@@ -4,12 +4,26 @@ import {
4
4
  type Document,
5
5
  type StructuredText,
6
6
  } from 'datocms-structured-text-utils';
7
- import type { BlockComponents, InlineRecordComponents, LinkToRecordComponents } from './types';
7
+ import type {
8
+ BlockComponents,
9
+ InlineBlockComponents,
10
+ InlineRecordComponents,
11
+ LinkToRecordComponents,
12
+ } from './types';
8
13
 
9
14
  type Props<B extends DatocmsRecord, L extends DatocmsRecord, I extends DatocmsRecord> =
10
15
  | {
11
16
  /** The actual [field value](https://www.datocms.com/docs/structured-text/dast) you get from a DatoCMS Structured Text field */
12
- data: Document | DastNode | null | undefined;
17
+ data:
18
+ | (Omit<StructuredText<B, L, I>, 'blocks' | 'links' | 'inlineBlocks'> & {
19
+ blocks?: never;
20
+ links?: never;
21
+ inlineBlocks?: never;
22
+ })
23
+ | Document
24
+ | DastNode
25
+ | null
26
+ | undefined;
13
27
  blockComponents?: never;
14
28
  inlineBlockComponents?: never;
15
29
  linkToRecordComponents?: never;
@@ -20,8 +34,8 @@ type Props<B extends DatocmsRecord, L extends DatocmsRecord, I extends DatocmsRe
20
34
  data:
21
35
  | (Omit<StructuredText<B, L, I>, 'blocks' | 'links' | 'inlineBlocks'> & {
22
36
  blocks: B[];
23
- links: never;
24
- inlineBlocks: never;
37
+ links?: never;
38
+ inlineBlocks?: never;
25
39
  })
26
40
  | null
27
41
  | undefined;
@@ -35,9 +49,9 @@ type Props<B extends DatocmsRecord, L extends DatocmsRecord, I extends DatocmsRe
35
49
  /** The actual [field value](https://www.datocms.com/docs/structured-text/dast) you get from a DatoCMS Structured Text field */
36
50
  data:
37
51
  | (Omit<StructuredText<B, L, I>, 'blocks' | 'links' | 'inlineBlocks'> & {
38
- blocks: never;
52
+ blocks?: never;
39
53
  links: L[];
40
- inlineBlocks: never;
54
+ inlineBlocks?: never;
41
55
  })
42
56
  | null
43
57
  | undefined;
@@ -52,15 +66,15 @@ type Props<B extends DatocmsRecord, L extends DatocmsRecord, I extends DatocmsRe
52
66
  /** The actual [field value](https://www.datocms.com/docs/structured-text/dast) you get from a DatoCMS Structured Text field */
53
67
  data:
54
68
  | (Omit<StructuredText<B, L, I>, 'blocks' | 'links' | 'inlineBlocks'> & {
55
- blocks: never;
56
- links: never;
69
+ blocks?: never;
70
+ links?: never;
57
71
  inlineBlocks: I[];
58
72
  })
59
73
  | null
60
74
  | undefined;
61
75
  blockComponents?: never;
62
76
  /** An object in which the keys are the `__typename` of the inline blocks to be rendered, and the values are the Astro components */
63
- inlineBlockComponents: BlockComponents<B, L, I>;
77
+ inlineBlockComponents: InlineBlockComponents<B, L, I>;
64
78
  linkToRecordComponents?: never;
65
79
  inlineRecordComponents?: never;
66
80
  }
@@ -68,7 +82,7 @@ type Props<B extends DatocmsRecord, L extends DatocmsRecord, I extends DatocmsRe
68
82
  /** The actual [field value](https://www.datocms.com/docs/structured-text/dast) you get from a DatoCMS Structured Text field */
69
83
  data:
70
84
  | (Omit<StructuredText<B, L, I>, 'blocks' | 'links' | 'inlineBlocks'> & {
71
- blocks: never;
85
+ blocks?: never;
72
86
  links: L[];
73
87
  inlineBlocks: I[];
74
88
  })
@@ -76,7 +90,7 @@ type Props<B extends DatocmsRecord, L extends DatocmsRecord, I extends DatocmsRe
76
90
  | undefined;
77
91
  blockComponents?: never;
78
92
  /** An object in which the keys are the `__typename` of the inline blocks to be rendered, and the values are the Astro components */
79
- inlineBlockComponents: BlockComponents<B, L, I>;
93
+ inlineBlockComponents: InlineBlockComponents<B, L, I>;
80
94
  /** An object in which the keys are the `__typename` of the records to be rendered, and the values are the Astro components */
81
95
  linkToRecordComponents: LinkToRecordComponents<B, L, I>;
82
96
  /** An object in which the keys are the `__typename` of the records to be rendered, and the values are the Astro components */
@@ -87,7 +101,7 @@ type Props<B extends DatocmsRecord, L extends DatocmsRecord, I extends DatocmsRe
87
101
  data:
88
102
  | (Omit<StructuredText<B, L, I>, 'blocks' | 'links' | 'inlineBlocks'> & {
89
103
  blocks: B[];
90
- links: never;
104
+ links?: never;
91
105
  inlineBlocks: I[];
92
106
  })
93
107
  | null
@@ -95,7 +109,7 @@ type Props<B extends DatocmsRecord, L extends DatocmsRecord, I extends DatocmsRe
95
109
  /** An object in which the keys are the `__typename` of the blocks to be rendered, and the values are the Astro components */
96
110
  blockComponents: BlockComponents<B, L, I>;
97
111
  /** An object in which the keys are the `__typename` of the inline blocks to be rendered, and the values are the Astro components */
98
- inlineBlockComponents: BlockComponents<B, L, I>;
112
+ inlineBlockComponents: InlineBlockComponents<B, L, I>;
99
113
  linkToRecordComponents?: never;
100
114
  inlineRecordComponents?: never;
101
115
  }
@@ -105,7 +119,7 @@ type Props<B extends DatocmsRecord, L extends DatocmsRecord, I extends DatocmsRe
105
119
  | (Omit<StructuredText<B, L, I>, 'blocks' | 'links' | 'inlineBlocks'> & {
106
120
  blocks: B[];
107
121
  links: L[];
108
- inlineBlocks: never;
122
+ inlineBlocks?: never;
109
123
  })
110
124
  | null
111
125
  | undefined;
@@ -130,7 +144,7 @@ type Props<B extends DatocmsRecord, L extends DatocmsRecord, I extends DatocmsRe
130
144
  /** An object in which the keys are the `__typename` of the blocks to be rendered, and the values are the Astro components */
131
145
  blockComponents: BlockComponents<B, L, I>;
132
146
  /** An object in which the keys are the `__typename` of the inline blocks to be rendered, and the values are the Astro components */
133
- inlineBlockComponents: BlockComponents<B, L, I>;
147
+ inlineBlockComponents: InlineBlockComponents<B, L, I>;
134
148
  /** An object in which the keys are the `__typename` of the records to be rendered, and the values are the Astro components */
135
149
  linkToRecordComponents: LinkToRecordComponents<B, L, I>;
136
150
  /** An object in which the keys are the `__typename` of the records to be rendered, and the values are the Astro components */
@@ -138,9 +152,9 @@ type Props<B extends DatocmsRecord, L extends DatocmsRecord, I extends DatocmsRe
138
152
  };
139
153
 
140
154
  export function ensureValidStructuredTextProps<
141
- B extends DatocmsRecord,
142
- L extends DatocmsRecord,
143
- I extends DatocmsRecord,
155
+ B extends DatocmsRecord = DatocmsRecord,
156
+ L extends DatocmsRecord = DatocmsRecord,
157
+ I extends DatocmsRecord = DatocmsRecord,
144
158
  >(props: Props<B, L, I>): Props<B, L, I> {
145
159
  return props;
146
160
  }