@prismicio/client 7.11.1 → 7.12.0-alpha.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/dist/helpers/asLink.cjs +9 -7
- package/dist/helpers/asLink.cjs.map +1 -1
- package/dist/helpers/asLink.js +9 -7
- package/dist/helpers/asLink.js.map +1 -1
- package/dist/helpers/isFilled.cjs +3 -0
- package/dist/helpers/isFilled.cjs.map +1 -1
- package/dist/helpers/isFilled.d.ts +2 -1
- package/dist/helpers/isFilled.js +3 -0
- package/dist/helpers/isFilled.js.map +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js.map +1 -1
- package/dist/lib/resolveMigrationDocumentData.cjs +6 -1
- package/dist/lib/resolveMigrationDocumentData.cjs.map +1 -1
- package/dist/lib/resolveMigrationDocumentData.js +6 -1
- package/dist/lib/resolveMigrationDocumentData.js.map +1 -1
- package/dist/lib/serializerHelpers.cjs +0 -3
- package/dist/lib/serializerHelpers.cjs.map +1 -1
- package/dist/lib/serializerHelpers.js +0 -3
- package/dist/lib/serializerHelpers.js.map +1 -1
- package/dist/package.json.cjs +1 -1
- package/dist/package.json.js +1 -1
- package/dist/types/migration/Asset.cjs.map +1 -1
- package/dist/types/migration/Asset.d.ts +3 -3
- package/dist/types/migration/Asset.js.map +1 -1
- package/dist/types/model/contentRelationship.d.ts +1 -0
- package/dist/types/model/link.cjs.map +1 -1
- package/dist/types/model/link.d.ts +1 -0
- package/dist/types/model/link.js.map +1 -1
- package/dist/types/model/linkToMedia.d.ts +1 -0
- package/dist/types/value/contentRelationship.d.ts +24 -1
- package/dist/types/value/link.cjs.map +1 -1
- package/dist/types/value/link.d.ts +26 -3
- package/dist/types/value/link.js.map +1 -1
- package/dist/types/value/linkToMedia.d.ts +13 -1
- package/package.json +9 -9
- package/src/helpers/asLink.ts +11 -8
- package/src/helpers/isFilled.ts +6 -1
- package/src/index.ts +1 -0
- package/src/lib/resolveMigrationDocumentData.ts +10 -3
- package/src/lib/serializerHelpers.ts +0 -5
- package/src/types/migration/Asset.ts +7 -4
- package/src/types/model/contentRelationship.ts +1 -0
- package/src/types/model/link.ts +1 -0
- package/src/types/model/linkToMedia.ts +1 -0
- package/src/types/value/contentRelationship.ts +45 -2
- package/src/types/value/link.ts +49 -6
- package/src/types/value/linkToMedia.ts +21 -2
|
@@ -5,7 +5,7 @@ import type { EmptyLinkField, LinkType } from "./link"
|
|
|
5
5
|
import type { SliceZone } from "./sliceZone"
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
8
|
+
* Single field value for related documents
|
|
9
9
|
*
|
|
10
10
|
* @typeParam TypeEnum - Type API ID of the document.
|
|
11
11
|
* @typeParam LangEnum - Language API ID of the document.
|
|
@@ -13,7 +13,7 @@ import type { SliceZone } from "./sliceZone"
|
|
|
13
13
|
* GraphQuery of `fetchLinks`).
|
|
14
14
|
* @typeParam State - State of the field which determines its shape.
|
|
15
15
|
*/
|
|
16
|
-
export type
|
|
16
|
+
export type SingleContentRelationshipField<
|
|
17
17
|
TypeEnum = string,
|
|
18
18
|
LangEnum = string,
|
|
19
19
|
DataInterface extends
|
|
@@ -24,6 +24,49 @@ export type ContentRelationshipField<
|
|
|
24
24
|
? EmptyLinkField<typeof LinkType.Document>
|
|
25
25
|
: FilledContentRelationshipField<TypeEnum, LangEnum, DataInterface>
|
|
26
26
|
|
|
27
|
+
/**
|
|
28
|
+
* Repeatable field value for related documents
|
|
29
|
+
*
|
|
30
|
+
* @typeParam TypeEnum - Type API ID of the document.
|
|
31
|
+
* @typeParam LangEnum - Language API ID of the document.
|
|
32
|
+
* @typeParam DataInterface - Data fields for the document (filled in via
|
|
33
|
+
* GraphQuery of `fetchLinks`).
|
|
34
|
+
* @typeParam State - State of the field which determines its shape.
|
|
35
|
+
*/
|
|
36
|
+
export type RepeatableContentRelationshipField<
|
|
37
|
+
TypeEnum = string,
|
|
38
|
+
LangEnum = string,
|
|
39
|
+
DataInterface extends
|
|
40
|
+
| Record<string, AnyRegularField | GroupField | SliceZone>
|
|
41
|
+
| unknown = unknown,
|
|
42
|
+
State extends FieldState = FieldState,
|
|
43
|
+
> = State extends "empty"
|
|
44
|
+
? []
|
|
45
|
+
: [
|
|
46
|
+
SingleContentRelationshipField<TypeEnum, LangEnum, DataInterface>,
|
|
47
|
+
...SingleContentRelationshipField<TypeEnum, LangEnum, DataInterface>[],
|
|
48
|
+
]
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Field for related documents
|
|
52
|
+
*
|
|
53
|
+
* @typeParam TypeEnum - Type API ID of the document.
|
|
54
|
+
* @typeParam LangEnum - Language API ID of the document.
|
|
55
|
+
* @typeParam DataInterface - Data fields for the document (filled in via
|
|
56
|
+
* GraphQuery of `fetchLinks`).
|
|
57
|
+
* @typeParam State - State of the field which determines its shape.
|
|
58
|
+
*/
|
|
59
|
+
export type ContentRelationshipField<
|
|
60
|
+
TypeEnum = string,
|
|
61
|
+
LangEnum = string,
|
|
62
|
+
DataInterface extends
|
|
63
|
+
| Record<string, AnyRegularField | GroupField | SliceZone>
|
|
64
|
+
| unknown = unknown,
|
|
65
|
+
State extends FieldState = FieldState,
|
|
66
|
+
> =
|
|
67
|
+
| SingleContentRelationshipField<TypeEnum, LangEnum, DataInterface, State>
|
|
68
|
+
| RepeatableContentRelationshipField<TypeEnum, LangEnum, DataInterface, State>
|
|
69
|
+
|
|
27
70
|
/**
|
|
28
71
|
* Links that refer to documents
|
|
29
72
|
*/
|
package/src/types/value/link.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { AnyRegularField, FieldState } from "./types"
|
|
2
2
|
|
|
3
|
-
import type {
|
|
3
|
+
import type { SingleContentRelationshipField } from "./contentRelationship"
|
|
4
4
|
import type { GroupField } from "./group"
|
|
5
|
-
import type {
|
|
5
|
+
import type { SingleLinkToMediaField } from "./linkToMedia"
|
|
6
6
|
import type { SliceZone } from "./sliceZone"
|
|
7
7
|
|
|
8
8
|
/**
|
|
@@ -38,7 +38,7 @@ export interface FilledLinkToWebField {
|
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
/**
|
|
41
|
-
* A link field.
|
|
41
|
+
* A single link field value.
|
|
42
42
|
*
|
|
43
43
|
* @typeParam TypeEnum - Type API ID of the document.
|
|
44
44
|
* @typeParam LangEnum - Language API ID of the document.
|
|
@@ -46,7 +46,7 @@ export interface FilledLinkToWebField {
|
|
|
46
46
|
* GraphQuery of `fetchLinks`).
|
|
47
47
|
* @typeParam State - State of the field which determines its shape.
|
|
48
48
|
*/
|
|
49
|
-
export type
|
|
49
|
+
export type SingleLinkField<
|
|
50
50
|
TypeEnum = string,
|
|
51
51
|
LangEnum = string,
|
|
52
52
|
DataInterface extends
|
|
@@ -56,6 +56,49 @@ export type LinkField<
|
|
|
56
56
|
> = State extends "empty"
|
|
57
57
|
? EmptyLinkField<typeof LinkType.Any>
|
|
58
58
|
:
|
|
59
|
-
|
|
|
59
|
+
| SingleContentRelationshipField<TypeEnum, LangEnum, DataInterface, State>
|
|
60
60
|
| FilledLinkToWebField
|
|
61
|
-
|
|
|
61
|
+
| SingleLinkToMediaField<State>
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* A repeatable link field value.
|
|
65
|
+
*
|
|
66
|
+
* @typeParam TypeEnum - Type API ID of the document.
|
|
67
|
+
* @typeParam LangEnum - Language API ID of the document.
|
|
68
|
+
* @typeParam DataInterface - Data fields for the document (filled in via
|
|
69
|
+
* GraphQuery of `fetchLinks`).
|
|
70
|
+
* @typeParam State - State of the field which determines its shape.
|
|
71
|
+
*/
|
|
72
|
+
export type RepeatableLinkFieldValue<
|
|
73
|
+
TypeEnum = string,
|
|
74
|
+
LangEnum = string,
|
|
75
|
+
DataInterface extends
|
|
76
|
+
| Record<string, AnyRegularField | GroupField | SliceZone>
|
|
77
|
+
| unknown = unknown,
|
|
78
|
+
State extends FieldState = FieldState,
|
|
79
|
+
> = State extends "empty"
|
|
80
|
+
? []
|
|
81
|
+
: [
|
|
82
|
+
SingleLinkField<TypeEnum, LangEnum, DataInterface>,
|
|
83
|
+
...SingleLinkField<TypeEnum, LangEnum, DataInterface>[],
|
|
84
|
+
]
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* A link field.
|
|
88
|
+
*
|
|
89
|
+
* @typeParam TypeEnum - Type API ID of the document.
|
|
90
|
+
* @typeParam LangEnum - Language API ID of the document.
|
|
91
|
+
* @typeParam DataInterface - Data fields for the document (filled in via
|
|
92
|
+
* GraphQuery of `fetchLinks`).
|
|
93
|
+
* @typeParam State - State of the field which determines its shape.
|
|
94
|
+
*/
|
|
95
|
+
export type LinkField<
|
|
96
|
+
TypeEnum = string,
|
|
97
|
+
LangEnum = string,
|
|
98
|
+
DataInterface extends
|
|
99
|
+
| Record<string, AnyRegularField | GroupField | SliceZone>
|
|
100
|
+
| unknown = unknown,
|
|
101
|
+
State extends FieldState = FieldState,
|
|
102
|
+
> =
|
|
103
|
+
| SingleLinkField<TypeEnum, LangEnum, DataInterface, State>
|
|
104
|
+
| RepeatableLinkFieldValue<TypeEnum, LangEnum, DataInterface, State>
|
|
@@ -3,15 +3,34 @@ import type { FieldState } from "./types"
|
|
|
3
3
|
import type { EmptyLinkField, LinkType } from "./link"
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
* A link field that points to media.
|
|
6
|
+
* A single link field value that points to media.
|
|
7
7
|
*
|
|
8
8
|
* @typeParam State - State of the field which determines its shape.
|
|
9
9
|
*/
|
|
10
|
-
export type
|
|
10
|
+
export type SingleLinkToMediaField<State extends FieldState = FieldState> =
|
|
11
11
|
State extends "empty"
|
|
12
12
|
? EmptyLinkField<typeof LinkType.Media>
|
|
13
13
|
: FilledLinkToMediaField
|
|
14
14
|
|
|
15
|
+
/**
|
|
16
|
+
* Repeatable link field values that point to media.
|
|
17
|
+
*
|
|
18
|
+
* @typeParam State - State of the field which determines its shape.
|
|
19
|
+
*/
|
|
20
|
+
export type RepeatableLinkToMediaField<State extends FieldState = FieldState> =
|
|
21
|
+
State extends "empty"
|
|
22
|
+
? []
|
|
23
|
+
: [SingleLinkToMediaField, ...SingleLinkToMediaField[]]
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* A link field that points to media.
|
|
27
|
+
*
|
|
28
|
+
* @typeParam State - State of the field which determines its shape.
|
|
29
|
+
*/
|
|
30
|
+
export type LinkToMediaField<State extends FieldState = FieldState> =
|
|
31
|
+
| SingleLinkToMediaField<State>
|
|
32
|
+
| RepeatableLinkToMediaField<State>
|
|
33
|
+
|
|
15
34
|
/**
|
|
16
35
|
* A link that points to media.
|
|
17
36
|
*/
|