@prismicio/client 7.15.0 → 7.15.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/dist/package.json.cjs +1 -1
- package/dist/package.json.js +1 -1
- package/dist/types/value/link.cjs.map +1 -1
- package/dist/types/value/link.d.ts +15 -8
- package/dist/types/value/link.js.map +1 -1
- package/dist/types/value/linkToMedia.d.ts +8 -5
- package/package.json +1 -1
- package/src/types/value/link.ts +22 -13
- package/src/types/value/linkToMedia.ts +13 -6
package/dist/package.json.cjs
CHANGED
package/dist/package.json.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"link.cjs","sources":["../../../../src/types/value/link.ts"],"sourcesContent":["import type { AnyRegularField, FieldState } from \"./types\"\n\nimport type { FilledContentRelationshipField } from \"./contentRelationship\"\nimport type { GroupField } from \"./group\"\nimport type { FilledLinkToMediaField } from \"./linkToMedia\"\nimport type { SliceZone } from \"./sliceZone\"\n\n/**\n * Link types\n */\nexport const LinkType = {\n\tAny: \"Any\",\n\tDocument: \"Document\",\n\tMedia: \"Media\",\n\tWeb: \"Web\",\n} as const\n\n/**\n * A link field.\n *\n * @typeParam TypeEnum - Type API ID of the document.\n * @typeParam LangEnum - Language API ID of the document.\n * @typeParam DataInterface - Data fields for the document (filled via the\n * `fetchLinks` or `graphQuery` query parameter).\n * @typeParam State - State of the field which determines its shape.\n */\nexport type LinkField<\n\tTypeEnum = string,\n\tLangEnum = string,\n\tDataInterface extends\n\t\t| Record<string, AnyRegularField | GroupField | SliceZone>\n\t\t| unknown = unknown,\n\tState extends FieldState = FieldState,\n> = State extends \"empty\"\n\t? EmptyLinkField
|
|
1
|
+
{"version":3,"file":"link.cjs","sources":["../../../../src/types/value/link.ts"],"sourcesContent":["import type { AnyRegularField, FieldState } from \"./types\"\n\nimport type { FilledContentRelationshipField } from \"./contentRelationship\"\nimport type { GroupField } from \"./group\"\nimport type { FilledLinkToMediaField } from \"./linkToMedia\"\nimport type { SliceZone } from \"./sliceZone\"\n\n/**\n * Link types\n */\nexport const LinkType = {\n\tAny: \"Any\",\n\tDocument: \"Document\",\n\tMedia: \"Media\",\n\tWeb: \"Web\",\n} as const\n\n/**\n * A link field.\n *\n * @typeParam TypeEnum - Type API ID of the document.\n * @typeParam LangEnum - Language API ID of the document.\n * @typeParam DataInterface - Data fields for the document (filled via the\n * `fetchLinks` or `graphQuery` query parameter).\n * @typeParam State - State of the field which determines its shape.\n * @typeParam Variant - Variants of the link.\n */\nexport type LinkField<\n\tTypeEnum = string,\n\tLangEnum = string,\n\tDataInterface extends\n\t\t| Record<string, AnyRegularField | GroupField | SliceZone>\n\t\t| unknown = unknown,\n\tState extends FieldState = FieldState,\n\tVariant = string,\n> = State extends \"empty\"\n\t? EmptyLinkField<typeof LinkType.Any, Variant>\n\t: FilledLinkField<TypeEnum, LangEnum, DataInterface, Variant>\n\n/**\n * A link field that is filled.\n *\n * @typeParam TypeEnum - Type API ID of the document.\n * @typeParam LangEnum - Language API ID of the document.\n * @typeParam DataInterface - Data fields for the document (filled via the\n * `fetchLinks` or `graphQuery` query parameter).\n * @typeParam Variant - Variants of the link.\n */\nexport type FilledLinkField<\n\tTypeEnum = string,\n\tLangEnum = string,\n\tDataInterface extends\n\t\t| Record<string, AnyRegularField | GroupField | SliceZone>\n\t\t| unknown = unknown,\n\tVariant = string,\n> =\n\t| (FilledContentRelationshipField<TypeEnum, LangEnum, DataInterface> &\n\t\t\tOptionalLinkProperties<Variant>)\n\t| FilledLinkToMediaField<Variant>\n\t| FilledLinkToWebField<Variant>\n\n/**\n * A link field that is not filled.\n *\n * @typeParam _Unused - THIS PARAMETER IS NOT USED. If you are passing a type,\n * **please remove it**.\n * @typeParam Variant - Variants of the link.\n */\nexport type EmptyLinkField<\n\t_Unused extends\n\t\t(typeof LinkType)[keyof typeof LinkType] = typeof LinkType.Any,\n\tVariant = string,\n> = {\n\tlink_type: \"Any\"\n} & OptionalLinkProperties<Variant>\n\n/**\n * A link field pointing to a relative or absolute URL.\n *\n * @typeParam Variant - Variants of the link.\n */\nexport type FilledLinkToWebField<Variant = string> = {\n\tlink_type: \"Web\"\n\turl: string\n\ttarget?: string\n} & OptionalLinkProperties<Variant>\n\n/**\n * Optional properties available to link fields. It is used to augment existing\n * link-like fields (like content relationship fields) with field-specific\n * properties.\n *\n * @typeParam Variant - Variants of the link.\n *\n * @internal\n */\n// Remember to update the `getOptionalLinkProperties()` function when updating\n// this type. The function should check for every property.\nexport type OptionalLinkProperties<Variant = string> = {\n\ttext?: string\n\tvariant?: Variant\n}\n"],"names":[],"mappings":";;AAUO,MAAM,WAAW;AAAA,EACvB,KAAK;AAAA,EACL,UAAU;AAAA,EACV,OAAO;AAAA,EACP,KAAK;;;"}
|
|
@@ -20,8 +20,9 @@ export declare const LinkType: {
|
|
|
20
20
|
* @typeParam DataInterface - Data fields for the document (filled via the
|
|
21
21
|
* `fetchLinks` or `graphQuery` query parameter).
|
|
22
22
|
* @typeParam State - State of the field which determines its shape.
|
|
23
|
+
* @typeParam Variant - Variants of the link.
|
|
23
24
|
*/
|
|
24
|
-
export type LinkField<TypeEnum = string, LangEnum = string, DataInterface extends Record<string, AnyRegularField | GroupField | SliceZone> | unknown = unknown, State extends FieldState = FieldState> = State extends "empty" ? EmptyLinkField : FilledLinkField<TypeEnum, LangEnum, DataInterface>;
|
|
25
|
+
export type LinkField<TypeEnum = string, LangEnum = string, DataInterface extends Record<string, AnyRegularField | GroupField | SliceZone> | unknown = unknown, State extends FieldState = FieldState, Variant = string> = State extends "empty" ? EmptyLinkField<typeof LinkType.Any, Variant> : FilledLinkField<TypeEnum, LangEnum, DataInterface, Variant>;
|
|
25
26
|
/**
|
|
26
27
|
* A link field that is filled.
|
|
27
28
|
*
|
|
@@ -29,33 +30,39 @@ export type LinkField<TypeEnum = string, LangEnum = string, DataInterface extend
|
|
|
29
30
|
* @typeParam LangEnum - Language API ID of the document.
|
|
30
31
|
* @typeParam DataInterface - Data fields for the document (filled via the
|
|
31
32
|
* `fetchLinks` or `graphQuery` query parameter).
|
|
33
|
+
* @typeParam Variant - Variants of the link.
|
|
32
34
|
*/
|
|
33
|
-
export type FilledLinkField<TypeEnum = string, LangEnum = string, DataInterface extends Record<string, AnyRegularField | GroupField | SliceZone> | unknown = unknown> = (FilledContentRelationshipField<TypeEnum, LangEnum, DataInterface> | FilledLinkToMediaField | FilledLinkToWebField
|
|
35
|
+
export type FilledLinkField<TypeEnum = string, LangEnum = string, DataInterface extends Record<string, AnyRegularField | GroupField | SliceZone> | unknown = unknown, Variant = string> = (FilledContentRelationshipField<TypeEnum, LangEnum, DataInterface> & OptionalLinkProperties<Variant>) | FilledLinkToMediaField<Variant> | FilledLinkToWebField<Variant>;
|
|
34
36
|
/**
|
|
35
37
|
* A link field that is not filled.
|
|
36
38
|
*
|
|
37
39
|
* @typeParam _Unused - THIS PARAMETER IS NOT USED. If you are passing a type,
|
|
38
40
|
* **please remove it**.
|
|
41
|
+
* @typeParam Variant - Variants of the link.
|
|
39
42
|
*/
|
|
40
|
-
export type EmptyLinkField<_Unused extends (typeof LinkType)[keyof typeof LinkType] = typeof LinkType.Any> = {
|
|
43
|
+
export type EmptyLinkField<_Unused extends (typeof LinkType)[keyof typeof LinkType] = typeof LinkType.Any, Variant = string> = {
|
|
41
44
|
link_type: "Any";
|
|
42
|
-
} & OptionalLinkProperties
|
|
45
|
+
} & OptionalLinkProperties<Variant>;
|
|
43
46
|
/**
|
|
44
47
|
* A link field pointing to a relative or absolute URL.
|
|
48
|
+
*
|
|
49
|
+
* @typeParam Variant - Variants of the link.
|
|
45
50
|
*/
|
|
46
|
-
export type FilledLinkToWebField = {
|
|
51
|
+
export type FilledLinkToWebField<Variant = string> = {
|
|
47
52
|
link_type: "Web";
|
|
48
53
|
url: string;
|
|
49
54
|
target?: string;
|
|
50
|
-
} & OptionalLinkProperties
|
|
55
|
+
} & OptionalLinkProperties<Variant>;
|
|
51
56
|
/**
|
|
52
57
|
* Optional properties available to link fields. It is used to augment existing
|
|
53
58
|
* link-like fields (like content relationship fields) with field-specific
|
|
54
59
|
* properties.
|
|
55
60
|
*
|
|
61
|
+
* @typeParam Variant - Variants of the link.
|
|
62
|
+
*
|
|
56
63
|
* @internal
|
|
57
64
|
*/
|
|
58
|
-
export type OptionalLinkProperties = {
|
|
65
|
+
export type OptionalLinkProperties<Variant = string> = {
|
|
59
66
|
text?: string;
|
|
60
|
-
variant?:
|
|
67
|
+
variant?: Variant;
|
|
61
68
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"link.js","sources":["../../../../src/types/value/link.ts"],"sourcesContent":["import type { AnyRegularField, FieldState } from \"./types\"\n\nimport type { FilledContentRelationshipField } from \"./contentRelationship\"\nimport type { GroupField } from \"./group\"\nimport type { FilledLinkToMediaField } from \"./linkToMedia\"\nimport type { SliceZone } from \"./sliceZone\"\n\n/**\n * Link types\n */\nexport const LinkType = {\n\tAny: \"Any\",\n\tDocument: \"Document\",\n\tMedia: \"Media\",\n\tWeb: \"Web\",\n} as const\n\n/**\n * A link field.\n *\n * @typeParam TypeEnum - Type API ID of the document.\n * @typeParam LangEnum - Language API ID of the document.\n * @typeParam DataInterface - Data fields for the document (filled via the\n * `fetchLinks` or `graphQuery` query parameter).\n * @typeParam State - State of the field which determines its shape.\n */\nexport type LinkField<\n\tTypeEnum = string,\n\tLangEnum = string,\n\tDataInterface extends\n\t\t| Record<string, AnyRegularField | GroupField | SliceZone>\n\t\t| unknown = unknown,\n\tState extends FieldState = FieldState,\n> = State extends \"empty\"\n\t? EmptyLinkField
|
|
1
|
+
{"version":3,"file":"link.js","sources":["../../../../src/types/value/link.ts"],"sourcesContent":["import type { AnyRegularField, FieldState } from \"./types\"\n\nimport type { FilledContentRelationshipField } from \"./contentRelationship\"\nimport type { GroupField } from \"./group\"\nimport type { FilledLinkToMediaField } from \"./linkToMedia\"\nimport type { SliceZone } from \"./sliceZone\"\n\n/**\n * Link types\n */\nexport const LinkType = {\n\tAny: \"Any\",\n\tDocument: \"Document\",\n\tMedia: \"Media\",\n\tWeb: \"Web\",\n} as const\n\n/**\n * A link field.\n *\n * @typeParam TypeEnum - Type API ID of the document.\n * @typeParam LangEnum - Language API ID of the document.\n * @typeParam DataInterface - Data fields for the document (filled via the\n * `fetchLinks` or `graphQuery` query parameter).\n * @typeParam State - State of the field which determines its shape.\n * @typeParam Variant - Variants of the link.\n */\nexport type LinkField<\n\tTypeEnum = string,\n\tLangEnum = string,\n\tDataInterface extends\n\t\t| Record<string, AnyRegularField | GroupField | SliceZone>\n\t\t| unknown = unknown,\n\tState extends FieldState = FieldState,\n\tVariant = string,\n> = State extends \"empty\"\n\t? EmptyLinkField<typeof LinkType.Any, Variant>\n\t: FilledLinkField<TypeEnum, LangEnum, DataInterface, Variant>\n\n/**\n * A link field that is filled.\n *\n * @typeParam TypeEnum - Type API ID of the document.\n * @typeParam LangEnum - Language API ID of the document.\n * @typeParam DataInterface - Data fields for the document (filled via the\n * `fetchLinks` or `graphQuery` query parameter).\n * @typeParam Variant - Variants of the link.\n */\nexport type FilledLinkField<\n\tTypeEnum = string,\n\tLangEnum = string,\n\tDataInterface extends\n\t\t| Record<string, AnyRegularField | GroupField | SliceZone>\n\t\t| unknown = unknown,\n\tVariant = string,\n> =\n\t| (FilledContentRelationshipField<TypeEnum, LangEnum, DataInterface> &\n\t\t\tOptionalLinkProperties<Variant>)\n\t| FilledLinkToMediaField<Variant>\n\t| FilledLinkToWebField<Variant>\n\n/**\n * A link field that is not filled.\n *\n * @typeParam _Unused - THIS PARAMETER IS NOT USED. If you are passing a type,\n * **please remove it**.\n * @typeParam Variant - Variants of the link.\n */\nexport type EmptyLinkField<\n\t_Unused extends\n\t\t(typeof LinkType)[keyof typeof LinkType] = typeof LinkType.Any,\n\tVariant = string,\n> = {\n\tlink_type: \"Any\"\n} & OptionalLinkProperties<Variant>\n\n/**\n * A link field pointing to a relative or absolute URL.\n *\n * @typeParam Variant - Variants of the link.\n */\nexport type FilledLinkToWebField<Variant = string> = {\n\tlink_type: \"Web\"\n\turl: string\n\ttarget?: string\n} & OptionalLinkProperties<Variant>\n\n/**\n * Optional properties available to link fields. It is used to augment existing\n * link-like fields (like content relationship fields) with field-specific\n * properties.\n *\n * @typeParam Variant - Variants of the link.\n *\n * @internal\n */\n// Remember to update the `getOptionalLinkProperties()` function when updating\n// this type. The function should check for every property.\nexport type OptionalLinkProperties<Variant = string> = {\n\ttext?: string\n\tvariant?: Variant\n}\n"],"names":[],"mappings":"AAUO,MAAM,WAAW;AAAA,EACvB,KAAK;AAAA,EACL,UAAU;AAAA,EACV,OAAO;AAAA,EACP,KAAK;;"}
|
|
@@ -4,15 +4,18 @@ import type { OptionalLinkProperties } from "./link";
|
|
|
4
4
|
* A link field that points to media.
|
|
5
5
|
*
|
|
6
6
|
* @typeParam State - State of the field which determines its shape.
|
|
7
|
+
* @typeParam Variant - Variants of the link.
|
|
7
8
|
*/
|
|
8
|
-
export type LinkToMediaField<State extends FieldState = FieldState> = State extends "empty" ? EmptyLinkToMediaField : FilledLinkToMediaField
|
|
9
|
-
type EmptyLinkToMediaField = {
|
|
9
|
+
export type LinkToMediaField<State extends FieldState = FieldState, Variant = string> = State extends "empty" ? EmptyLinkToMediaField<Variant> : FilledLinkToMediaField<Variant>;
|
|
10
|
+
type EmptyLinkToMediaField<Variant = string> = {
|
|
10
11
|
link_type: "Any";
|
|
11
|
-
} & OptionalLinkProperties
|
|
12
|
+
} & OptionalLinkProperties<Variant>;
|
|
12
13
|
/**
|
|
13
14
|
* A link that points to media.
|
|
15
|
+
*
|
|
16
|
+
* @typeParam Variant - Variants of the link.
|
|
14
17
|
*/
|
|
15
|
-
export type FilledLinkToMediaField = {
|
|
18
|
+
export type FilledLinkToMediaField<Variant = string> = {
|
|
16
19
|
id: string;
|
|
17
20
|
link_type: "Media";
|
|
18
21
|
name: string;
|
|
@@ -21,5 +24,5 @@ export type FilledLinkToMediaField = {
|
|
|
21
24
|
size: string;
|
|
22
25
|
height?: string | null;
|
|
23
26
|
width?: string | null;
|
|
24
|
-
} & OptionalLinkProperties
|
|
27
|
+
} & OptionalLinkProperties<Variant>;
|
|
25
28
|
export {};
|
package/package.json
CHANGED
package/src/types/value/link.ts
CHANGED
|
@@ -23,6 +23,7 @@ export const LinkType = {
|
|
|
23
23
|
* @typeParam DataInterface - Data fields for the document (filled via the
|
|
24
24
|
* `fetchLinks` or `graphQuery` query parameter).
|
|
25
25
|
* @typeParam State - State of the field which determines its shape.
|
|
26
|
+
* @typeParam Variant - Variants of the link.
|
|
26
27
|
*/
|
|
27
28
|
export type LinkField<
|
|
28
29
|
TypeEnum = string,
|
|
@@ -31,9 +32,10 @@ export type LinkField<
|
|
|
31
32
|
| Record<string, AnyRegularField | GroupField | SliceZone>
|
|
32
33
|
| unknown = unknown,
|
|
33
34
|
State extends FieldState = FieldState,
|
|
35
|
+
Variant = string,
|
|
34
36
|
> = State extends "empty"
|
|
35
|
-
? EmptyLinkField
|
|
36
|
-
: FilledLinkField<TypeEnum, LangEnum, DataInterface>
|
|
37
|
+
? EmptyLinkField<typeof LinkType.Any, Variant>
|
|
38
|
+
: FilledLinkField<TypeEnum, LangEnum, DataInterface, Variant>
|
|
37
39
|
|
|
38
40
|
/**
|
|
39
41
|
* A link field that is filled.
|
|
@@ -42,6 +44,7 @@ export type LinkField<
|
|
|
42
44
|
* @typeParam LangEnum - Language API ID of the document.
|
|
43
45
|
* @typeParam DataInterface - Data fields for the document (filled via the
|
|
44
46
|
* `fetchLinks` or `graphQuery` query parameter).
|
|
47
|
+
* @typeParam Variant - Variants of the link.
|
|
45
48
|
*/
|
|
46
49
|
export type FilledLinkField<
|
|
47
50
|
TypeEnum = string,
|
|
@@ -49,45 +52,51 @@ export type FilledLinkField<
|
|
|
49
52
|
DataInterface extends
|
|
50
53
|
| Record<string, AnyRegularField | GroupField | SliceZone>
|
|
51
54
|
| unknown = unknown,
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
55
|
+
Variant = string,
|
|
56
|
+
> =
|
|
57
|
+
| (FilledContentRelationshipField<TypeEnum, LangEnum, DataInterface> &
|
|
58
|
+
OptionalLinkProperties<Variant>)
|
|
59
|
+
| FilledLinkToMediaField<Variant>
|
|
60
|
+
| FilledLinkToWebField<Variant>
|
|
58
61
|
|
|
59
62
|
/**
|
|
60
63
|
* A link field that is not filled.
|
|
61
64
|
*
|
|
62
65
|
* @typeParam _Unused - THIS PARAMETER IS NOT USED. If you are passing a type,
|
|
63
66
|
* **please remove it**.
|
|
67
|
+
* @typeParam Variant - Variants of the link.
|
|
64
68
|
*/
|
|
65
69
|
export type EmptyLinkField<
|
|
66
70
|
_Unused extends
|
|
67
71
|
(typeof LinkType)[keyof typeof LinkType] = typeof LinkType.Any,
|
|
72
|
+
Variant = string,
|
|
68
73
|
> = {
|
|
69
74
|
link_type: "Any"
|
|
70
|
-
} & OptionalLinkProperties
|
|
75
|
+
} & OptionalLinkProperties<Variant>
|
|
71
76
|
|
|
72
77
|
/**
|
|
73
78
|
* A link field pointing to a relative or absolute URL.
|
|
79
|
+
*
|
|
80
|
+
* @typeParam Variant - Variants of the link.
|
|
74
81
|
*/
|
|
75
|
-
export type FilledLinkToWebField = {
|
|
82
|
+
export type FilledLinkToWebField<Variant = string> = {
|
|
76
83
|
link_type: "Web"
|
|
77
84
|
url: string
|
|
78
85
|
target?: string
|
|
79
|
-
} & OptionalLinkProperties
|
|
86
|
+
} & OptionalLinkProperties<Variant>
|
|
80
87
|
|
|
81
88
|
/**
|
|
82
89
|
* Optional properties available to link fields. It is used to augment existing
|
|
83
90
|
* link-like fields (like content relationship fields) with field-specific
|
|
84
91
|
* properties.
|
|
85
92
|
*
|
|
93
|
+
* @typeParam Variant - Variants of the link.
|
|
94
|
+
*
|
|
86
95
|
* @internal
|
|
87
96
|
*/
|
|
88
97
|
// Remember to update the `getOptionalLinkProperties()` function when updating
|
|
89
98
|
// this type. The function should check for every property.
|
|
90
|
-
export type OptionalLinkProperties = {
|
|
99
|
+
export type OptionalLinkProperties<Variant = string> = {
|
|
91
100
|
text?: string
|
|
92
|
-
variant?:
|
|
101
|
+
variant?: Variant
|
|
93
102
|
}
|
|
@@ -6,18 +6,25 @@ import type { OptionalLinkProperties } from "./link"
|
|
|
6
6
|
* A link field that points to media.
|
|
7
7
|
*
|
|
8
8
|
* @typeParam State - State of the field which determines its shape.
|
|
9
|
+
* @typeParam Variant - Variants of the link.
|
|
9
10
|
*/
|
|
10
|
-
export type LinkToMediaField<
|
|
11
|
-
State extends
|
|
11
|
+
export type LinkToMediaField<
|
|
12
|
+
State extends FieldState = FieldState,
|
|
13
|
+
Variant = string,
|
|
14
|
+
> = State extends "empty"
|
|
15
|
+
? EmptyLinkToMediaField<Variant>
|
|
16
|
+
: FilledLinkToMediaField<Variant>
|
|
12
17
|
|
|
13
|
-
type EmptyLinkToMediaField = {
|
|
18
|
+
type EmptyLinkToMediaField<Variant = string> = {
|
|
14
19
|
link_type: "Any"
|
|
15
|
-
} & OptionalLinkProperties
|
|
20
|
+
} & OptionalLinkProperties<Variant>
|
|
16
21
|
|
|
17
22
|
/**
|
|
18
23
|
* A link that points to media.
|
|
24
|
+
*
|
|
25
|
+
* @typeParam Variant - Variants of the link.
|
|
19
26
|
*/
|
|
20
|
-
export type FilledLinkToMediaField = {
|
|
27
|
+
export type FilledLinkToMediaField<Variant = string> = {
|
|
21
28
|
id: string
|
|
22
29
|
link_type: "Media"
|
|
23
30
|
name: string
|
|
@@ -26,4 +33,4 @@ export type FilledLinkToMediaField = {
|
|
|
26
33
|
size: string
|
|
27
34
|
height?: string | null
|
|
28
35
|
width?: string | null
|
|
29
|
-
} & OptionalLinkProperties
|
|
36
|
+
} & OptionalLinkProperties<Variant>
|