@prismicio/client 7.0.0-alpha.5 → 7.0.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/buildQueryURL.cjs.map +1 -1
- package/dist/buildQueryURL.d.ts +4 -4
- package/dist/buildQueryURL.js.map +1 -1
- package/dist/createClient.cjs +24 -24
- package/dist/createClient.cjs.map +1 -1
- package/dist/createClient.d.ts +28 -28
- package/dist/createClient.js +24 -24
- package/dist/createClient.js.map +1 -1
- package/dist/filter.cjs +1 -1
- package/dist/filter.cjs.map +1 -1
- package/dist/filter.d.ts +1 -1
- package/dist/filter.js +1 -1
- package/dist/filter.js.map +1 -1
- package/dist/helpers/asDate.cjs.map +1 -1
- package/dist/helpers/asDate.d.ts +2 -2
- package/dist/helpers/asDate.js.map +1 -1
- package/dist/helpers/asHTML.cjs.map +1 -1
- package/dist/helpers/asHTML.d.ts +17 -17
- package/dist/helpers/asHTML.js.map +1 -1
- package/dist/helpers/asImagePixelDensitySrcSet.cjs.map +1 -1
- package/dist/helpers/asImagePixelDensitySrcSet.d.ts +5 -5
- package/dist/helpers/asImagePixelDensitySrcSet.js.map +1 -1
- package/dist/helpers/asImageSrc.cjs.map +1 -1
- package/dist/helpers/asImageSrc.d.ts +3 -3
- package/dist/helpers/asImageSrc.js.map +1 -1
- package/dist/helpers/asImageWidthSrcSet.cjs.map +1 -1
- package/dist/helpers/asImageWidthSrcSet.d.ts +6 -6
- package/dist/helpers/asImageWidthSrcSet.js.map +1 -1
- package/dist/helpers/asLink.cjs.map +1 -1
- package/dist/helpers/asLink.d.ts +14 -14
- package/dist/helpers/asLink.js.map +1 -1
- package/dist/helpers/asLinkAttrs.cjs.map +1 -1
- package/dist/helpers/asLinkAttrs.d.ts +5 -5
- package/dist/helpers/asLinkAttrs.js.map +1 -1
- package/dist/helpers/asText.cjs.map +1 -1
- package/dist/helpers/asText.d.ts +8 -8
- package/dist/helpers/asText.js.map +1 -1
- package/dist/helpers/documentToLinkField.cjs.map +1 -1
- package/dist/helpers/documentToLinkField.js.map +1 -1
- package/dist/helpers/isFilled.cjs +3 -1
- package/dist/helpers/isFilled.cjs.map +1 -1
- package/dist/helpers/isFilled.d.ts +24 -20
- package/dist/helpers/isFilled.js +3 -1
- package/dist/helpers/isFilled.js.map +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +12 -2
- package/dist/index.js.map +1 -1
- package/dist/package.json.cjs +1 -1
- package/dist/package.json.js +1 -1
- package/dist/types/api/repository.d.ts +2 -2
- package/dist/types/model/boolean.d.ts +1 -1
- package/dist/types/model/color.d.ts +1 -1
- package/dist/types/model/contentRelationship.d.ts +1 -1
- package/dist/types/model/customType.d.ts +11 -11
- package/dist/types/model/date.d.ts +1 -1
- package/dist/types/model/embed.d.ts +1 -1
- package/dist/types/model/geoPoint.d.ts +1 -1
- package/dist/types/model/group.d.ts +1 -1
- package/dist/types/model/image.d.ts +3 -3
- package/dist/types/model/{integrationFields.d.ts → integration.d.ts} +3 -3
- package/dist/types/model/keyText.d.ts +1 -1
- package/dist/types/model/link.cjs.map +1 -1
- package/dist/types/model/link.d.ts +2 -2
- package/dist/types/model/link.js.map +1 -1
- package/dist/types/model/linkToMedia.d.ts +1 -1
- package/dist/types/model/number.d.ts +1 -1
- package/dist/types/model/richText.d.ts +3 -3
- package/dist/types/model/select.d.ts +1 -1
- package/dist/types/model/sharedSlice.d.ts +2 -2
- package/dist/types/model/sharedSliceVariation.d.ts +1 -1
- package/dist/types/model/slice.cjs.map +1 -1
- package/dist/types/model/slice.d.ts +1 -1
- package/dist/types/model/slice.js.map +1 -1
- package/dist/types/model/sliceZone.cjs.map +1 -1
- package/dist/types/model/sliceZone.d.ts +2 -2
- package/dist/types/model/sliceZone.js.map +1 -1
- package/dist/types/model/timestamp.d.ts +1 -1
- package/dist/types/model/title.d.ts +1 -1
- package/dist/types/model/types.cjs +5 -1
- package/dist/types/model/types.cjs.map +1 -1
- package/dist/types/model/types.d.ts +10 -6
- package/dist/types/model/types.js +5 -1
- package/dist/types/model/types.js.map +1 -1
- package/dist/types/model/uid.d.ts +1 -1
- package/dist/types/value/boolean.d.ts +1 -1
- package/dist/types/value/color.d.ts +1 -1
- package/dist/types/value/contentRelationship.d.ts +1 -1
- package/dist/types/value/date.d.ts +1 -1
- package/dist/types/value/document.d.ts +4 -4
- package/dist/types/value/embed.cjs.map +1 -1
- package/dist/types/value/embed.d.ts +1 -1
- package/dist/types/value/embed.js.map +1 -1
- package/dist/types/value/geoPoint.d.ts +1 -1
- package/dist/types/value/group.d.ts +1 -1
- package/dist/types/value/image.d.ts +3 -3
- package/dist/types/value/{integrationFields.d.ts → integration.d.ts} +2 -2
- package/dist/types/value/keyText.d.ts +1 -1
- package/dist/types/value/link.cjs.map +1 -1
- package/dist/types/value/link.d.ts +2 -2
- package/dist/types/value/link.js.map +1 -1
- package/dist/types/value/linkToMedia.d.ts +2 -2
- package/dist/types/value/number.d.ts +1 -1
- package/dist/types/value/richText.cjs.map +1 -1
- package/dist/types/value/richText.d.ts +26 -26
- package/dist/types/value/richText.js.map +1 -1
- package/dist/types/value/select.d.ts +1 -1
- package/dist/types/value/sharedSlice.d.ts +1 -1
- package/dist/types/value/sharedSliceVariation.d.ts +3 -0
- package/dist/types/value/slice.d.ts +1 -1
- package/dist/types/value/timestamp.d.ts +1 -1
- package/dist/types/value/title.d.ts +1 -1
- package/dist/types/value/types.d.ts +2 -2
- package/dist/types/webhook/apiUpdate.d.ts +1 -1
- package/package.json +2 -2
- package/src/buildQueryURL.ts +4 -4
- package/src/createClient.ts +28 -28
- package/src/filter.ts +1 -1
- package/src/helpers/asDate.ts +2 -2
- package/src/helpers/asHTML.ts +18 -18
- package/src/helpers/asImagePixelDensitySrcSet.ts +5 -5
- package/src/helpers/asImageSrc.ts +3 -3
- package/src/helpers/asImageWidthSrcSet.ts +6 -6
- package/src/helpers/asLink.ts +18 -18
- package/src/helpers/asLinkAttrs.ts +5 -5
- package/src/helpers/asText.ts +8 -8
- package/src/helpers/documentToLinkField.ts +1 -1
- package/src/helpers/isFilled.ts +27 -22
- package/src/index.ts +19 -3
- package/src/types/api/repository.ts +2 -2
- package/src/types/model/boolean.ts +1 -1
- package/src/types/model/color.ts +1 -1
- package/src/types/model/contentRelationship.ts +1 -1
- package/src/types/model/customType.ts +11 -11
- package/src/types/model/date.ts +1 -1
- package/src/types/model/embed.ts +1 -1
- package/src/types/model/geoPoint.ts +1 -1
- package/src/types/model/group.ts +1 -1
- package/src/types/model/image.ts +3 -3
- package/src/types/model/{integrationFields.ts → integration.ts} +3 -3
- package/src/types/model/keyText.ts +1 -1
- package/src/types/model/link.ts +2 -2
- package/src/types/model/linkToMedia.ts +1 -1
- package/src/types/model/number.ts +1 -1
- package/src/types/model/richText.ts +3 -3
- package/src/types/model/select.ts +1 -1
- package/src/types/model/sharedSlice.ts +2 -2
- package/src/types/model/sharedSliceVariation.ts +1 -1
- package/src/types/model/slice.ts +1 -1
- package/src/types/model/sliceZone.ts +2 -2
- package/src/types/model/timestamp.ts +1 -1
- package/src/types/model/title.ts +1 -1
- package/src/types/model/types.ts +10 -6
- package/src/types/model/uid.ts +1 -1
- package/src/types/value/boolean.ts +1 -1
- package/src/types/value/color.ts +1 -1
- package/src/types/value/contentRelationship.ts +1 -1
- package/src/types/value/date.ts +1 -1
- package/src/types/value/document.ts +4 -4
- package/src/types/value/embed.ts +1 -1
- package/src/types/value/geoPoint.ts +1 -1
- package/src/types/value/group.ts +1 -1
- package/src/types/value/image.ts +4 -4
- package/src/types/value/{integrationFields.ts → integration.ts} +2 -2
- package/src/types/value/keyText.ts +1 -1
- package/src/types/value/link.ts +2 -2
- package/src/types/value/linkToMedia.ts +2 -2
- package/src/types/value/number.ts +1 -1
- package/src/types/value/richText.ts +26 -26
- package/src/types/value/select.ts +1 -1
- package/src/types/value/sharedSlice.ts +1 -1
- package/src/types/value/sharedSliceVariation.ts +3 -0
- package/src/types/value/slice.ts +1 -1
- package/src/types/value/timestamp.ts +1 -1
- package/src/types/value/title.ts +1 -1
- package/src/types/value/types.ts +2 -2
- package/src/types/webhook/apiUpdate.ts +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"richText.cjs","sources":["../../../../src/types/value/richText.ts"],"sourcesContent":["import type { FieldState } from \"./types\";\n\nimport type { FilledContentRelationshipField } from \"./contentRelationship\";\nimport type { EmbedField } from \"./embed\";\nimport type { FilledLinkToWebField } from \"./link\";\nimport type { FilledLinkToMediaField } from \"./linkToMedia\";\n\n/**\n * Types for RichTextNodes\n *\n * @see More details: {@link https://prismic.io/docs/rich-text-title}\n */\nexport const RichTextNodeType = {\n\theading1: \"heading1\",\n\theading2: \"heading2\",\n\theading3: \"heading3\",\n\theading4: \"heading4\",\n\theading5: \"heading5\",\n\theading6: \"heading6\",\n\tparagraph: \"paragraph\",\n\tpreformatted: \"preformatted\",\n\tstrong: \"strong\",\n\tem: \"em\",\n\tlistItem: \"list-item\",\n\toListItem: \"o-list-item\",\n\tlist: \"group-list-item\",\n\toList: \"group-o-list-item\",\n\timage: \"image\",\n\tembed: \"embed\",\n\thyperlink: \"hyperlink\",\n\tlabel: \"label\",\n\tspan: \"span\",\n} as const;\n\n// Text nodes\n\n/**\n * Base to be extended by other
|
|
1
|
+
{"version":3,"file":"richText.cjs","sources":["../../../../src/types/value/richText.ts"],"sourcesContent":["import type { FieldState } from \"./types\";\n\nimport type { FilledContentRelationshipField } from \"./contentRelationship\";\nimport type { EmbedField } from \"./embed\";\nimport type { FilledLinkToWebField } from \"./link\";\nimport type { FilledLinkToMediaField } from \"./linkToMedia\";\n\n/**\n * Types for RichTextNodes\n *\n * @see More details: {@link https://prismic.io/docs/rich-text-title}\n */\nexport const RichTextNodeType = {\n\theading1: \"heading1\",\n\theading2: \"heading2\",\n\theading3: \"heading3\",\n\theading4: \"heading4\",\n\theading5: \"heading5\",\n\theading6: \"heading6\",\n\tparagraph: \"paragraph\",\n\tpreformatted: \"preformatted\",\n\tstrong: \"strong\",\n\tem: \"em\",\n\tlistItem: \"list-item\",\n\toListItem: \"o-list-item\",\n\tlist: \"group-list-item\",\n\toList: \"group-o-list-item\",\n\timage: \"image\",\n\tembed: \"embed\",\n\thyperlink: \"hyperlink\",\n\tlabel: \"label\",\n\tspan: \"span\",\n} as const;\n\n// Text nodes\n\n/**\n * Base to be extended by other rich text nodes.\n */\nexport interface RTTextNodeBase {\n\ttext: string;\n\tspans: RTInlineNode[];\n}\n\n/**\n * Rich text `heading1` node\n */\nexport interface RTHeading1Node extends RTTextNodeBase {\n\ttype: typeof RichTextNodeType.heading1;\n}\n\n/**\n * Rich text `heading2` node\n */\nexport interface RTHeading2Node extends RTTextNodeBase {\n\ttype: typeof RichTextNodeType.heading2;\n}\n\n/**\n * Rich text `heading3` node\n */\nexport interface RTHeading3Node extends RTTextNodeBase {\n\ttype: typeof RichTextNodeType.heading3;\n}\n\n/**\n * Rich text `heading4` node\n */\nexport interface RTHeading4Node extends RTTextNodeBase {\n\ttype: typeof RichTextNodeType.heading4;\n}\n\n/**\n * Rich text `heading5` node\n */\nexport interface RTHeading5Node extends RTTextNodeBase {\n\ttype: typeof RichTextNodeType.heading5;\n}\n\n/**\n * Rich text `heading6` node\n */\nexport interface RTHeading6Node extends RTTextNodeBase {\n\ttype: typeof RichTextNodeType.heading6;\n}\n\n/**\n * Rich text `paragraph` node\n */\nexport interface RTParagraphNode extends RTTextNodeBase {\n\ttype: typeof RichTextNodeType.paragraph;\n}\n\n/**\n * Rich text `preformatted` node\n */\nexport interface RTPreformattedNode extends RTTextNodeBase {\n\ttype: typeof RichTextNodeType.preformatted;\n}\n\n/**\n * Rich text `list-item` node\n */\nexport interface RTListItemNode extends RTTextNodeBase {\n\ttype: typeof RichTextNodeType.listItem;\n}\n\n/**\n * Rich text `o-list-item` node for ordered lists\n */\nexport interface RTOListItemNode extends RTTextNodeBase {\n\ttype: typeof RichTextNodeType.oListItem;\n}\n\n// Span nodes\n\n/**\n * @internal Span Node base to be extended for other Span nodes\n */\nexport interface RTSpanNodeBase {\n\tstart: number;\n\tend: number;\n}\n/**\n * Rich text `strong` node\n */\nexport interface RTStrongNode extends RTSpanNodeBase {\n\ttype: typeof RichTextNodeType.strong;\n}\n\n/**\n * Rich text `embed` node\n */\nexport interface RTEmNode extends RTSpanNodeBase {\n\ttype: typeof RichTextNodeType.em;\n}\n\n/**\n * Rich text `label` node\n */\nexport interface RTLabelNode extends RTSpanNodeBase {\n\ttype: typeof RichTextNodeType.label;\n\tdata: {\n\t\tlabel: string;\n\t};\n}\n\n// Media nodes\n\n/**\n * Rich text `image` nodes. They could link to other documents, external web\n * links and media fields\n */\nexport type RTImageNode = {\n\ttype: typeof RichTextNodeType.image;\n\turl: string;\n\talt: string | null;\n\tcopyright: string | null;\n\tdimensions: {\n\t\twidth: number;\n\t\theight: number;\n\t};\n\tlinkTo?:\n\t\t| FilledContentRelationshipField\n\t\t| FilledLinkToWebField\n\t\t| FilledLinkToMediaField;\n};\n\n/**\n * Rich text `embed` node\n */\nexport type RTEmbedNode = {\n\ttype: typeof RichTextNodeType.embed;\n\toembed: EmbedField;\n};\n\n// Link nodes\n\n/**\n * Rich text `a` node\n *\n * @see More details: {@link https://prismic.io/docs/rich-text-title#elements-and-styles}\n */\nexport interface RTLinkNode extends RTSpanNodeBase {\n\ttype: typeof RichTextNodeType.hyperlink;\n\tdata:\n\t\t| FilledContentRelationshipField\n\t\t| FilledLinkToWebField\n\t\t| FilledLinkToMediaField;\n}\n\n// Serialization related nodes\n\n/**\n * Rich text `list` node\n */\nexport interface RTListNode {\n\ttype: typeof RichTextNodeType.list;\n\titems: RTListItemNode[];\n}\n\n/**\n * Rich text o-lost node\n */\nexport interface RTOListNode {\n\ttype: typeof RichTextNodeType.oList;\n\titems: RTOListItemNode[];\n}\n\n// This one is confusing but it's actually the inner content of a block\n/**\n * Rich text `span` node\n */\nexport interface RTSpanNode extends RTTextNodeBase {\n\ttype: typeof RichTextNodeType.span;\n}\n\n// Helpers\n\n/**\n * Nodes from a rich text field\n */\nexport type RTNode =\n\t| RTHeading1Node\n\t| RTHeading2Node\n\t| RTHeading3Node\n\t| RTHeading4Node\n\t| RTHeading5Node\n\t| RTHeading6Node\n\t| RTParagraphNode\n\t| RTPreformattedNode\n\t| RTListItemNode\n\t| RTOListItemNode\n\t| RTImageNode\n\t| RTEmbedNode;\n\n/**\n * Rich text nodes with text\n */\nexport type RTTextNode =\n\t| RTHeading1Node\n\t| RTHeading2Node\n\t| RTHeading3Node\n\t| RTHeading4Node\n\t| RTHeading5Node\n\t| RTHeading6Node\n\t| RTParagraphNode\n\t| RTPreformattedNode\n\t| RTListItemNode\n\t| RTOListItemNode;\n\n/**\n * Rich text block nodes\n */\nexport type RTBlockNode =\n\t| RTHeading1Node\n\t| RTHeading2Node\n\t| RTHeading3Node\n\t| RTHeading4Node\n\t| RTHeading5Node\n\t| RTHeading6Node\n\t| RTParagraphNode\n\t| RTPreformattedNode\n\t| RTListItemNode\n\t| RTOListItemNode\n\t| RTListNode\n\t| RTOListNode\n\t| RTImageNode\n\t| RTEmbedNode;\n\n/**\n * Inline rich text nodes\n */\nexport type RTInlineNode = RTStrongNode | RTEmNode | RTLabelNode | RTLinkNode;\n\n/**\n * All rich text nodes\n */\nexport type RTAnyNode = RTBlockNode | RTInlineNode | RTSpanNode;\n\n/**\n * A rich text field.\n *\n * @see Rich text field documentation: {@link https://prismic.io/docs/rich-text-title}\n */\nexport type RichTextField<State extends FieldState = FieldState> =\n\tState extends \"empty\" ? [] : [RTNode, ...RTNode[]];\n"],"names":[],"mappings":";;AAYO,MAAM,mBAAmB;AAAA,EAC/B,UAAU;AAAA,EACV,UAAU;AAAA,EACV,UAAU;AAAA,EACV,UAAU;AAAA,EACV,UAAU;AAAA,EACV,UAAU;AAAA,EACV,WAAW;AAAA,EACX,cAAc;AAAA,EACd,QAAQ;AAAA,EACR,IAAI;AAAA,EACJ,UAAU;AAAA,EACV,WAAW;AAAA,EACX,MAAM;AAAA,EACN,OAAO;AAAA,EACP,OAAO;AAAA,EACP,OAAO;AAAA,EACP,WAAW;AAAA,EACX,OAAO;AAAA,EACP,MAAM;;;"}
|
|
@@ -30,68 +30,68 @@ export declare const RichTextNodeType: {
|
|
|
30
30
|
readonly span: "span";
|
|
31
31
|
};
|
|
32
32
|
/**
|
|
33
|
-
* Base to be extended by other
|
|
33
|
+
* Base to be extended by other rich text nodes.
|
|
34
34
|
*/
|
|
35
35
|
export interface RTTextNodeBase {
|
|
36
36
|
text: string;
|
|
37
37
|
spans: RTInlineNode[];
|
|
38
38
|
}
|
|
39
39
|
/**
|
|
40
|
-
* Rich
|
|
40
|
+
* Rich text `heading1` node
|
|
41
41
|
*/
|
|
42
42
|
export interface RTHeading1Node extends RTTextNodeBase {
|
|
43
43
|
type: typeof RichTextNodeType.heading1;
|
|
44
44
|
}
|
|
45
45
|
/**
|
|
46
|
-
* Rich
|
|
46
|
+
* Rich text `heading2` node
|
|
47
47
|
*/
|
|
48
48
|
export interface RTHeading2Node extends RTTextNodeBase {
|
|
49
49
|
type: typeof RichTextNodeType.heading2;
|
|
50
50
|
}
|
|
51
51
|
/**
|
|
52
|
-
* Rich
|
|
52
|
+
* Rich text `heading3` node
|
|
53
53
|
*/
|
|
54
54
|
export interface RTHeading3Node extends RTTextNodeBase {
|
|
55
55
|
type: typeof RichTextNodeType.heading3;
|
|
56
56
|
}
|
|
57
57
|
/**
|
|
58
|
-
* Rich
|
|
58
|
+
* Rich text `heading4` node
|
|
59
59
|
*/
|
|
60
60
|
export interface RTHeading4Node extends RTTextNodeBase {
|
|
61
61
|
type: typeof RichTextNodeType.heading4;
|
|
62
62
|
}
|
|
63
63
|
/**
|
|
64
|
-
* Rich
|
|
64
|
+
* Rich text `heading5` node
|
|
65
65
|
*/
|
|
66
66
|
export interface RTHeading5Node extends RTTextNodeBase {
|
|
67
67
|
type: typeof RichTextNodeType.heading5;
|
|
68
68
|
}
|
|
69
69
|
/**
|
|
70
|
-
* Rich
|
|
70
|
+
* Rich text `heading6` node
|
|
71
71
|
*/
|
|
72
72
|
export interface RTHeading6Node extends RTTextNodeBase {
|
|
73
73
|
type: typeof RichTextNodeType.heading6;
|
|
74
74
|
}
|
|
75
75
|
/**
|
|
76
|
-
* Rich
|
|
76
|
+
* Rich text `paragraph` node
|
|
77
77
|
*/
|
|
78
78
|
export interface RTParagraphNode extends RTTextNodeBase {
|
|
79
79
|
type: typeof RichTextNodeType.paragraph;
|
|
80
80
|
}
|
|
81
81
|
/**
|
|
82
|
-
* Rich
|
|
82
|
+
* Rich text `preformatted` node
|
|
83
83
|
*/
|
|
84
84
|
export interface RTPreformattedNode extends RTTextNodeBase {
|
|
85
85
|
type: typeof RichTextNodeType.preformatted;
|
|
86
86
|
}
|
|
87
87
|
/**
|
|
88
|
-
* Rich
|
|
88
|
+
* Rich text `list-item` node
|
|
89
89
|
*/
|
|
90
90
|
export interface RTListItemNode extends RTTextNodeBase {
|
|
91
91
|
type: typeof RichTextNodeType.listItem;
|
|
92
92
|
}
|
|
93
93
|
/**
|
|
94
|
-
* Rich
|
|
94
|
+
* Rich text `o-list-item` node for ordered lists
|
|
95
95
|
*/
|
|
96
96
|
export interface RTOListItemNode extends RTTextNodeBase {
|
|
97
97
|
type: typeof RichTextNodeType.oListItem;
|
|
@@ -104,19 +104,19 @@ export interface RTSpanNodeBase {
|
|
|
104
104
|
end: number;
|
|
105
105
|
}
|
|
106
106
|
/**
|
|
107
|
-
* Rich
|
|
107
|
+
* Rich text `strong` node
|
|
108
108
|
*/
|
|
109
109
|
export interface RTStrongNode extends RTSpanNodeBase {
|
|
110
110
|
type: typeof RichTextNodeType.strong;
|
|
111
111
|
}
|
|
112
112
|
/**
|
|
113
|
-
* Rich
|
|
113
|
+
* Rich text `embed` node
|
|
114
114
|
*/
|
|
115
115
|
export interface RTEmNode extends RTSpanNodeBase {
|
|
116
116
|
type: typeof RichTextNodeType.em;
|
|
117
117
|
}
|
|
118
118
|
/**
|
|
119
|
-
* Rich
|
|
119
|
+
* Rich text `label` node
|
|
120
120
|
*/
|
|
121
121
|
export interface RTLabelNode extends RTSpanNodeBase {
|
|
122
122
|
type: typeof RichTextNodeType.label;
|
|
@@ -125,7 +125,7 @@ export interface RTLabelNode extends RTSpanNodeBase {
|
|
|
125
125
|
};
|
|
126
126
|
}
|
|
127
127
|
/**
|
|
128
|
-
* Rich
|
|
128
|
+
* Rich text `image` nodes. They could link to other documents, external web
|
|
129
129
|
* links and media fields
|
|
130
130
|
*/
|
|
131
131
|
export type RTImageNode = {
|
|
@@ -140,14 +140,14 @@ export type RTImageNode = {
|
|
|
140
140
|
linkTo?: FilledContentRelationshipField | FilledLinkToWebField | FilledLinkToMediaField;
|
|
141
141
|
};
|
|
142
142
|
/**
|
|
143
|
-
* Rich
|
|
143
|
+
* Rich text `embed` node
|
|
144
144
|
*/
|
|
145
145
|
export type RTEmbedNode = {
|
|
146
146
|
type: typeof RichTextNodeType.embed;
|
|
147
147
|
oembed: EmbedField;
|
|
148
148
|
};
|
|
149
149
|
/**
|
|
150
|
-
* Rich
|
|
150
|
+
* Rich text `a` node
|
|
151
151
|
*
|
|
152
152
|
* @see More details: {@link https://prismic.io/docs/rich-text-title#elements-and-styles}
|
|
153
153
|
*/
|
|
@@ -156,27 +156,27 @@ export interface RTLinkNode extends RTSpanNodeBase {
|
|
|
156
156
|
data: FilledContentRelationshipField | FilledLinkToWebField | FilledLinkToMediaField;
|
|
157
157
|
}
|
|
158
158
|
/**
|
|
159
|
-
* Rich
|
|
159
|
+
* Rich text `list` node
|
|
160
160
|
*/
|
|
161
161
|
export interface RTListNode {
|
|
162
162
|
type: typeof RichTextNodeType.list;
|
|
163
163
|
items: RTListItemNode[];
|
|
164
164
|
}
|
|
165
165
|
/**
|
|
166
|
-
* Rich
|
|
166
|
+
* Rich text o-lost node
|
|
167
167
|
*/
|
|
168
168
|
export interface RTOListNode {
|
|
169
169
|
type: typeof RichTextNodeType.oList;
|
|
170
170
|
items: RTOListItemNode[];
|
|
171
171
|
}
|
|
172
172
|
/**
|
|
173
|
-
* Rich
|
|
173
|
+
* Rich text `span` node
|
|
174
174
|
*/
|
|
175
175
|
export interface RTSpanNode extends RTTextNodeBase {
|
|
176
176
|
type: typeof RichTextNodeType.span;
|
|
177
177
|
}
|
|
178
178
|
/**
|
|
179
|
-
* Nodes from a
|
|
179
|
+
* Nodes from a rich text field
|
|
180
180
|
*/
|
|
181
181
|
export type RTNode = RTHeading1Node | RTHeading2Node | RTHeading3Node | RTHeading4Node | RTHeading5Node | RTHeading6Node | RTParagraphNode | RTPreformattedNode | RTListItemNode | RTOListItemNode | RTImageNode | RTEmbedNode;
|
|
182
182
|
/**
|
|
@@ -184,20 +184,20 @@ export type RTNode = RTHeading1Node | RTHeading2Node | RTHeading3Node | RTHeadin
|
|
|
184
184
|
*/
|
|
185
185
|
export type RTTextNode = RTHeading1Node | RTHeading2Node | RTHeading3Node | RTHeading4Node | RTHeading5Node | RTHeading6Node | RTParagraphNode | RTPreformattedNode | RTListItemNode | RTOListItemNode;
|
|
186
186
|
/**
|
|
187
|
-
* Rich
|
|
187
|
+
* Rich text block nodes
|
|
188
188
|
*/
|
|
189
189
|
export type RTBlockNode = RTHeading1Node | RTHeading2Node | RTHeading3Node | RTHeading4Node | RTHeading5Node | RTHeading6Node | RTParagraphNode | RTPreformattedNode | RTListItemNode | RTOListItemNode | RTListNode | RTOListNode | RTImageNode | RTEmbedNode;
|
|
190
190
|
/**
|
|
191
|
-
* Inline
|
|
191
|
+
* Inline rich text nodes
|
|
192
192
|
*/
|
|
193
193
|
export type RTInlineNode = RTStrongNode | RTEmNode | RTLabelNode | RTLinkNode;
|
|
194
194
|
/**
|
|
195
|
-
* All
|
|
195
|
+
* All rich text nodes
|
|
196
196
|
*/
|
|
197
197
|
export type RTAnyNode = RTBlockNode | RTInlineNode | RTSpanNode;
|
|
198
198
|
/**
|
|
199
|
-
*
|
|
199
|
+
* A rich text field.
|
|
200
200
|
*
|
|
201
|
-
* @see Rich
|
|
201
|
+
* @see Rich text field documentation: {@link https://prismic.io/docs/rich-text-title}
|
|
202
202
|
*/
|
|
203
203
|
export type RichTextField<State extends FieldState = FieldState> = State extends "empty" ? [] : [RTNode, ...RTNode[]];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"richText.js","sources":["../../../../src/types/value/richText.ts"],"sourcesContent":["import type { FieldState } from \"./types\";\n\nimport type { FilledContentRelationshipField } from \"./contentRelationship\";\nimport type { EmbedField } from \"./embed\";\nimport type { FilledLinkToWebField } from \"./link\";\nimport type { FilledLinkToMediaField } from \"./linkToMedia\";\n\n/**\n * Types for RichTextNodes\n *\n * @see More details: {@link https://prismic.io/docs/rich-text-title}\n */\nexport const RichTextNodeType = {\n\theading1: \"heading1\",\n\theading2: \"heading2\",\n\theading3: \"heading3\",\n\theading4: \"heading4\",\n\theading5: \"heading5\",\n\theading6: \"heading6\",\n\tparagraph: \"paragraph\",\n\tpreformatted: \"preformatted\",\n\tstrong: \"strong\",\n\tem: \"em\",\n\tlistItem: \"list-item\",\n\toListItem: \"o-list-item\",\n\tlist: \"group-list-item\",\n\toList: \"group-o-list-item\",\n\timage: \"image\",\n\tembed: \"embed\",\n\thyperlink: \"hyperlink\",\n\tlabel: \"label\",\n\tspan: \"span\",\n} as const;\n\n// Text nodes\n\n/**\n * Base to be extended by other
|
|
1
|
+
{"version":3,"file":"richText.js","sources":["../../../../src/types/value/richText.ts"],"sourcesContent":["import type { FieldState } from \"./types\";\n\nimport type { FilledContentRelationshipField } from \"./contentRelationship\";\nimport type { EmbedField } from \"./embed\";\nimport type { FilledLinkToWebField } from \"./link\";\nimport type { FilledLinkToMediaField } from \"./linkToMedia\";\n\n/**\n * Types for RichTextNodes\n *\n * @see More details: {@link https://prismic.io/docs/rich-text-title}\n */\nexport const RichTextNodeType = {\n\theading1: \"heading1\",\n\theading2: \"heading2\",\n\theading3: \"heading3\",\n\theading4: \"heading4\",\n\theading5: \"heading5\",\n\theading6: \"heading6\",\n\tparagraph: \"paragraph\",\n\tpreformatted: \"preformatted\",\n\tstrong: \"strong\",\n\tem: \"em\",\n\tlistItem: \"list-item\",\n\toListItem: \"o-list-item\",\n\tlist: \"group-list-item\",\n\toList: \"group-o-list-item\",\n\timage: \"image\",\n\tembed: \"embed\",\n\thyperlink: \"hyperlink\",\n\tlabel: \"label\",\n\tspan: \"span\",\n} as const;\n\n// Text nodes\n\n/**\n * Base to be extended by other rich text nodes.\n */\nexport interface RTTextNodeBase {\n\ttext: string;\n\tspans: RTInlineNode[];\n}\n\n/**\n * Rich text `heading1` node\n */\nexport interface RTHeading1Node extends RTTextNodeBase {\n\ttype: typeof RichTextNodeType.heading1;\n}\n\n/**\n * Rich text `heading2` node\n */\nexport interface RTHeading2Node extends RTTextNodeBase {\n\ttype: typeof RichTextNodeType.heading2;\n}\n\n/**\n * Rich text `heading3` node\n */\nexport interface RTHeading3Node extends RTTextNodeBase {\n\ttype: typeof RichTextNodeType.heading3;\n}\n\n/**\n * Rich text `heading4` node\n */\nexport interface RTHeading4Node extends RTTextNodeBase {\n\ttype: typeof RichTextNodeType.heading4;\n}\n\n/**\n * Rich text `heading5` node\n */\nexport interface RTHeading5Node extends RTTextNodeBase {\n\ttype: typeof RichTextNodeType.heading5;\n}\n\n/**\n * Rich text `heading6` node\n */\nexport interface RTHeading6Node extends RTTextNodeBase {\n\ttype: typeof RichTextNodeType.heading6;\n}\n\n/**\n * Rich text `paragraph` node\n */\nexport interface RTParagraphNode extends RTTextNodeBase {\n\ttype: typeof RichTextNodeType.paragraph;\n}\n\n/**\n * Rich text `preformatted` node\n */\nexport interface RTPreformattedNode extends RTTextNodeBase {\n\ttype: typeof RichTextNodeType.preformatted;\n}\n\n/**\n * Rich text `list-item` node\n */\nexport interface RTListItemNode extends RTTextNodeBase {\n\ttype: typeof RichTextNodeType.listItem;\n}\n\n/**\n * Rich text `o-list-item` node for ordered lists\n */\nexport interface RTOListItemNode extends RTTextNodeBase {\n\ttype: typeof RichTextNodeType.oListItem;\n}\n\n// Span nodes\n\n/**\n * @internal Span Node base to be extended for other Span nodes\n */\nexport interface RTSpanNodeBase {\n\tstart: number;\n\tend: number;\n}\n/**\n * Rich text `strong` node\n */\nexport interface RTStrongNode extends RTSpanNodeBase {\n\ttype: typeof RichTextNodeType.strong;\n}\n\n/**\n * Rich text `embed` node\n */\nexport interface RTEmNode extends RTSpanNodeBase {\n\ttype: typeof RichTextNodeType.em;\n}\n\n/**\n * Rich text `label` node\n */\nexport interface RTLabelNode extends RTSpanNodeBase {\n\ttype: typeof RichTextNodeType.label;\n\tdata: {\n\t\tlabel: string;\n\t};\n}\n\n// Media nodes\n\n/**\n * Rich text `image` nodes. They could link to other documents, external web\n * links and media fields\n */\nexport type RTImageNode = {\n\ttype: typeof RichTextNodeType.image;\n\turl: string;\n\talt: string | null;\n\tcopyright: string | null;\n\tdimensions: {\n\t\twidth: number;\n\t\theight: number;\n\t};\n\tlinkTo?:\n\t\t| FilledContentRelationshipField\n\t\t| FilledLinkToWebField\n\t\t| FilledLinkToMediaField;\n};\n\n/**\n * Rich text `embed` node\n */\nexport type RTEmbedNode = {\n\ttype: typeof RichTextNodeType.embed;\n\toembed: EmbedField;\n};\n\n// Link nodes\n\n/**\n * Rich text `a` node\n *\n * @see More details: {@link https://prismic.io/docs/rich-text-title#elements-and-styles}\n */\nexport interface RTLinkNode extends RTSpanNodeBase {\n\ttype: typeof RichTextNodeType.hyperlink;\n\tdata:\n\t\t| FilledContentRelationshipField\n\t\t| FilledLinkToWebField\n\t\t| FilledLinkToMediaField;\n}\n\n// Serialization related nodes\n\n/**\n * Rich text `list` node\n */\nexport interface RTListNode {\n\ttype: typeof RichTextNodeType.list;\n\titems: RTListItemNode[];\n}\n\n/**\n * Rich text o-lost node\n */\nexport interface RTOListNode {\n\ttype: typeof RichTextNodeType.oList;\n\titems: RTOListItemNode[];\n}\n\n// This one is confusing but it's actually the inner content of a block\n/**\n * Rich text `span` node\n */\nexport interface RTSpanNode extends RTTextNodeBase {\n\ttype: typeof RichTextNodeType.span;\n}\n\n// Helpers\n\n/**\n * Nodes from a rich text field\n */\nexport type RTNode =\n\t| RTHeading1Node\n\t| RTHeading2Node\n\t| RTHeading3Node\n\t| RTHeading4Node\n\t| RTHeading5Node\n\t| RTHeading6Node\n\t| RTParagraphNode\n\t| RTPreformattedNode\n\t| RTListItemNode\n\t| RTOListItemNode\n\t| RTImageNode\n\t| RTEmbedNode;\n\n/**\n * Rich text nodes with text\n */\nexport type RTTextNode =\n\t| RTHeading1Node\n\t| RTHeading2Node\n\t| RTHeading3Node\n\t| RTHeading4Node\n\t| RTHeading5Node\n\t| RTHeading6Node\n\t| RTParagraphNode\n\t| RTPreformattedNode\n\t| RTListItemNode\n\t| RTOListItemNode;\n\n/**\n * Rich text block nodes\n */\nexport type RTBlockNode =\n\t| RTHeading1Node\n\t| RTHeading2Node\n\t| RTHeading3Node\n\t| RTHeading4Node\n\t| RTHeading5Node\n\t| RTHeading6Node\n\t| RTParagraphNode\n\t| RTPreformattedNode\n\t| RTListItemNode\n\t| RTOListItemNode\n\t| RTListNode\n\t| RTOListNode\n\t| RTImageNode\n\t| RTEmbedNode;\n\n/**\n * Inline rich text nodes\n */\nexport type RTInlineNode = RTStrongNode | RTEmNode | RTLabelNode | RTLinkNode;\n\n/**\n * All rich text nodes\n */\nexport type RTAnyNode = RTBlockNode | RTInlineNode | RTSpanNode;\n\n/**\n * A rich text field.\n *\n * @see Rich text field documentation: {@link https://prismic.io/docs/rich-text-title}\n */\nexport type RichTextField<State extends FieldState = FieldState> =\n\tState extends \"empty\" ? [] : [RTNode, ...RTNode[]];\n"],"names":[],"mappings":"AAYO,MAAM,mBAAmB;AAAA,EAC/B,UAAU;AAAA,EACV,UAAU;AAAA,EACV,UAAU;AAAA,EACV,UAAU;AAAA,EACV,UAAU;AAAA,EACV,UAAU;AAAA,EACV,WAAW;AAAA,EACX,cAAc;AAAA,EACd,QAAQ;AAAA,EACR,IAAI;AAAA,EACJ,UAAU;AAAA,EACV,WAAW;AAAA,EACX,MAAM;AAAA,EACN,OAAO;AAAA,EACP,OAAO;AAAA,EACP,OAAO;AAAA,EACP,WAAW;AAAA,EACX,OAAO;AAAA,EACP,MAAM;;"}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import type { AnyRegularField } from "./types";
|
|
2
|
+
/**
|
|
3
|
+
* A shared Slice variation.
|
|
4
|
+
*/
|
|
2
5
|
export interface SharedSliceVariation<Variation = string, PrimaryFields extends Record<string, AnyRegularField> = Record<string, AnyRegularField>, ItemsFields extends Record<string, AnyRegularField> = Record<string, AnyRegularField>> {
|
|
3
6
|
variation: Variation;
|
|
4
7
|
version: string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { FieldState } from "./types";
|
|
2
2
|
import type { RTHeading1Node, RTHeading2Node, RTHeading3Node, RTHeading4Node, RTHeading5Node, RTHeading6Node } from "./richText";
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* A title field.
|
|
5
5
|
*
|
|
6
6
|
* @see Title field documentation: {@link https://prismic.io/docs/rich-text-title}
|
|
7
7
|
*/
|
|
@@ -5,7 +5,7 @@ import type { DateField } from "./date";
|
|
|
5
5
|
import type { EmbedField } from "./embed";
|
|
6
6
|
import type { GeoPointField } from "./geoPoint";
|
|
7
7
|
import type { ImageField } from "./image";
|
|
8
|
-
import type {
|
|
8
|
+
import type { IntegrationField } from "./integration";
|
|
9
9
|
import type { KeyTextField } from "./keyText";
|
|
10
10
|
import type { LinkField } from "./link";
|
|
11
11
|
import type { LinkToMediaField } from "./linkToMedia";
|
|
@@ -25,7 +25,7 @@ export type FieldState = "empty" | "filled";
|
|
|
25
25
|
/**
|
|
26
26
|
* Any regular field that can be nested in a group-like field.
|
|
27
27
|
*/
|
|
28
|
-
export type AnyRegularField = TitleField | RichTextField | ImageField | ContentRelationshipField | LinkField | LinkToMediaField | EmbedField | DateField | TimestampField | ColorField | NumberField | KeyTextField | SelectField | BooleanField | GeoPointField |
|
|
28
|
+
export type AnyRegularField = TitleField | RichTextField | ImageField | ContentRelationshipField | LinkField | LinkToMediaField | EmbedField | DateField | TimestampField | ColorField | NumberField | KeyTextField | SelectField | BooleanField | GeoPointField | IntegrationField;
|
|
29
29
|
/**
|
|
30
30
|
* Useful to flatten the type output to improve type hints shown in editors. And
|
|
31
31
|
* also to transform an interface into a type to aide with assignability.
|
|
@@ -22,7 +22,7 @@ interface WebhookBodyAPIUpdateOperations<T> {
|
|
|
22
22
|
deletion?: T[];
|
|
23
23
|
}
|
|
24
24
|
/**
|
|
25
|
-
* Metadata representing a mask (also called a
|
|
25
|
+
* Metadata representing a mask (also called a custom type).
|
|
26
26
|
*
|
|
27
27
|
* @see More details: {@link https://prismic.io/docs/custom-types}
|
|
28
28
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prismicio/client",
|
|
3
|
-
"version": "7.0.0
|
|
3
|
+
"version": "7.0.0",
|
|
4
4
|
"description": "The official JavaScript + TypeScript client library for Prismic",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"typescript",
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
},
|
|
59
59
|
"devDependencies": {
|
|
60
60
|
"@prismicio/mock": "^0.2.0",
|
|
61
|
-
"@prismicio/types-internal": "
|
|
61
|
+
"@prismicio/types-internal": "2.0.0-alpha.11",
|
|
62
62
|
"@size-limit/preset-small-lib": "^8.2.4",
|
|
63
63
|
"@trivago/prettier-plugin-sort-imports": "^4.1.1",
|
|
64
64
|
"@typescript-eslint/eslint-plugin": "^5.59.0",
|
package/src/buildQueryURL.ts
CHANGED
|
@@ -53,7 +53,7 @@ export interface Ordering {
|
|
|
53
53
|
*/
|
|
54
54
|
export interface Route {
|
|
55
55
|
/**
|
|
56
|
-
* The
|
|
56
|
+
* The custom type of the document.
|
|
57
57
|
*/
|
|
58
58
|
type: string;
|
|
59
59
|
|
|
@@ -184,8 +184,8 @@ export interface QueryParams {
|
|
|
184
184
|
|
|
185
185
|
/**
|
|
186
186
|
* The `brokenRoute` option allows you to define the route populated in the
|
|
187
|
-
* `url` property for broken
|
|
188
|
-
* link is a
|
|
187
|
+
* `url` property for broken link or content relationship fields. A broken
|
|
188
|
+
* link is a link or content relationship field whose linked document has been
|
|
189
189
|
* unpublished or deleted.
|
|
190
190
|
*
|
|
191
191
|
* {@link https://prismic.io/docs/route-resolver}
|
|
@@ -205,7 +205,7 @@ type BuildQueryURLParams = {
|
|
|
205
205
|
ref: string;
|
|
206
206
|
|
|
207
207
|
/**
|
|
208
|
-
* Ref used to populate
|
|
208
|
+
* Ref used to populate integration fields with the latest content.
|
|
209
209
|
*
|
|
210
210
|
* {@link https://prismic.io/docs/integration-fields}
|
|
211
211
|
*/
|
package/src/createClient.ts
CHANGED
|
@@ -234,7 +234,7 @@ export type ClientConfig = {
|
|
|
234
234
|
ref?: RefStringOrThunk;
|
|
235
235
|
|
|
236
236
|
/**
|
|
237
|
-
* A list of
|
|
237
|
+
* A list of route resolver objects that define how a document's `url` property
|
|
238
238
|
* is resolved.
|
|
239
239
|
*
|
|
240
240
|
* {@link https://prismic.io/docs/route-resolver}
|
|
@@ -243,8 +243,8 @@ export type ClientConfig = {
|
|
|
243
243
|
|
|
244
244
|
/**
|
|
245
245
|
* The `brokenRoute` option allows you to define the route populated in the
|
|
246
|
-
* `url` property for broken
|
|
247
|
-
* link is a
|
|
246
|
+
* `url` property for broken link or content relationship fields. A broken
|
|
247
|
+
* link is a link or content relationship field whose linked document has been
|
|
248
248
|
* unpublished or deleted.
|
|
249
249
|
*
|
|
250
250
|
* {@link https://prismic.io/docs/route-resolver}
|
|
@@ -327,7 +327,7 @@ type ResolvePreviewArgs<LinkResolverReturnType> = {
|
|
|
327
327
|
linkResolver?: LinkResolverFunction<LinkResolverReturnType>;
|
|
328
328
|
|
|
329
329
|
/**
|
|
330
|
-
* A fallback URL if the
|
|
330
|
+
* A fallback URL if the link resolver does not return a value.
|
|
331
331
|
*/
|
|
332
332
|
defaultURL: string;
|
|
333
333
|
|
|
@@ -415,7 +415,7 @@ export class Client<TDocuments extends PrismicDocument = PrismicDocument> {
|
|
|
415
415
|
accessToken?: string;
|
|
416
416
|
|
|
417
417
|
/**
|
|
418
|
-
* A list of
|
|
418
|
+
* A list of route resolver objects that define how a document's `url` field
|
|
419
419
|
* is resolved.
|
|
420
420
|
*
|
|
421
421
|
* {@link https://prismic.io/docs/route-resolver}
|
|
@@ -424,8 +424,8 @@ export class Client<TDocuments extends PrismicDocument = PrismicDocument> {
|
|
|
424
424
|
|
|
425
425
|
/**
|
|
426
426
|
* The `brokenRoute` option allows you to define the route populated in the
|
|
427
|
-
* `url` property for broken
|
|
428
|
-
* link is a
|
|
427
|
+
* `url` property for broken link or content relationship fields. A broken
|
|
428
|
+
* link is a link or content relationship field whose linked document has been
|
|
429
429
|
* unpublished or deleted.
|
|
430
430
|
*
|
|
431
431
|
* {@link https://prismic.io/docs/route-resolver}
|
|
@@ -735,7 +735,7 @@ export class Client<TDocuments extends PrismicDocument = PrismicDocument> {
|
|
|
735
735
|
* A document's UID is different from its ID. An ID is automatically generated
|
|
736
736
|
* for all documents and is made available on its `id` property. A UID is
|
|
737
737
|
* provided in the Prismic editor and is unique among all documents of its
|
|
738
|
-
*
|
|
738
|
+
* custom type.
|
|
739
739
|
* @example
|
|
740
740
|
*
|
|
741
741
|
* ```ts
|
|
@@ -765,7 +765,7 @@ export class Client<TDocuments extends PrismicDocument = PrismicDocument> {
|
|
|
765
765
|
* A document's UID is different from its ID. An ID is automatically generated
|
|
766
766
|
* for all documents and is made available on its `id` property. A UID is
|
|
767
767
|
* provided in the Prismic editor and is unique among all documents of its
|
|
768
|
-
*
|
|
768
|
+
* custom type.
|
|
769
769
|
* @example
|
|
770
770
|
*
|
|
771
771
|
* ```ts
|
|
@@ -801,7 +801,7 @@ export class Client<TDocuments extends PrismicDocument = PrismicDocument> {
|
|
|
801
801
|
* A document's UID is different from its ID. An ID is automatically generated
|
|
802
802
|
* for all documents and is made available on its `id` property. A UID is
|
|
803
803
|
* provided in the Prismic editor and is unique among all documents of its
|
|
804
|
-
*
|
|
804
|
+
* custom type.
|
|
805
805
|
* @example
|
|
806
806
|
*
|
|
807
807
|
* ```ts
|
|
@@ -828,13 +828,13 @@ export class Client<TDocuments extends PrismicDocument = PrismicDocument> {
|
|
|
828
828
|
|
|
829
829
|
/**
|
|
830
830
|
* Queries a document from the Prismic repository with a specific UID and
|
|
831
|
-
*
|
|
831
|
+
* custom type.
|
|
832
832
|
*
|
|
833
833
|
* @remarks
|
|
834
834
|
* A document's UID is different from its ID. An ID is automatically generated
|
|
835
835
|
* for all documents and is made available on its `id` property. A UID is
|
|
836
836
|
* provided in the Prismic editor and is unique among all documents of its
|
|
837
|
-
*
|
|
837
|
+
* custom type.
|
|
838
838
|
* @example
|
|
839
839
|
*
|
|
840
840
|
* ```ts
|
|
@@ -842,7 +842,7 @@ export class Client<TDocuments extends PrismicDocument = PrismicDocument> {
|
|
|
842
842
|
* ```
|
|
843
843
|
*
|
|
844
844
|
* @typeParam TDocument - Type of the Prismic document returned.
|
|
845
|
-
* @param documentType - The API ID of the document's
|
|
845
|
+
* @param documentType - The API ID of the document's custom type.
|
|
846
846
|
* @param uid - UID of the document.
|
|
847
847
|
* @param params - Parameters to filter, sort, and paginate the results.
|
|
848
848
|
*
|
|
@@ -873,7 +873,7 @@ export class Client<TDocuments extends PrismicDocument = PrismicDocument> {
|
|
|
873
873
|
* A document's UID is different from its ID. An ID is automatically generated
|
|
874
874
|
* for all documents and is made available on its `id` property. A UID is
|
|
875
875
|
* provided in the Prismic editor and is unique among all documents of its
|
|
876
|
-
*
|
|
876
|
+
* custom type.
|
|
877
877
|
* @example
|
|
878
878
|
*
|
|
879
879
|
* ```ts
|
|
@@ -884,7 +884,7 @@ export class Client<TDocuments extends PrismicDocument = PrismicDocument> {
|
|
|
884
884
|
* ```
|
|
885
885
|
*
|
|
886
886
|
* @typeParam TDocument - Type of the Prismic document returned.
|
|
887
|
-
* @param documentType - The API ID of the document's
|
|
887
|
+
* @param documentType - The API ID of the document's custom type.
|
|
888
888
|
* @param uids - A list of document UIDs.
|
|
889
889
|
* @param params - Parameters to filter, sort, and paginate the results.
|
|
890
890
|
*
|
|
@@ -909,7 +909,7 @@ export class Client<TDocuments extends PrismicDocument = PrismicDocument> {
|
|
|
909
909
|
|
|
910
910
|
/**
|
|
911
911
|
* Queries all documents from the Prismic repository with specific UIDs and
|
|
912
|
-
*
|
|
912
|
+
* custom type.
|
|
913
913
|
*
|
|
914
914
|
* This method may make multiple network requests to query all matching
|
|
915
915
|
* content.
|
|
@@ -918,7 +918,7 @@ export class Client<TDocuments extends PrismicDocument = PrismicDocument> {
|
|
|
918
918
|
* A document's UID is different from its ID. An ID is automatically generated
|
|
919
919
|
* for all documents and is made available on its `id` property. A UID is
|
|
920
920
|
* provided in the Prismic editor and is unique among all documents of its
|
|
921
|
-
*
|
|
921
|
+
* custom type.
|
|
922
922
|
* @example
|
|
923
923
|
*
|
|
924
924
|
* ```ts
|
|
@@ -929,7 +929,7 @@ export class Client<TDocuments extends PrismicDocument = PrismicDocument> {
|
|
|
929
929
|
* ```
|
|
930
930
|
*
|
|
931
931
|
* @typeParam TDocument - Type of Prismic documents returned.
|
|
932
|
-
* @param documentType - The API ID of the document's
|
|
932
|
+
* @param documentType - The API ID of the document's custom type.
|
|
933
933
|
* @param uids - A list of document UIDs.
|
|
934
934
|
* @param params - Parameters to filter, sort, and paginate the results.
|
|
935
935
|
*
|
|
@@ -955,12 +955,12 @@ export class Client<TDocuments extends PrismicDocument = PrismicDocument> {
|
|
|
955
955
|
|
|
956
956
|
/**
|
|
957
957
|
* Queries a singleton document from the Prismic repository for a specific
|
|
958
|
-
*
|
|
958
|
+
* custom type.
|
|
959
959
|
*
|
|
960
960
|
* @remarks
|
|
961
961
|
* A singleton document is one that is configured in Prismic to only allow one
|
|
962
962
|
* instance. For example, a repository may be configured to contain just one
|
|
963
|
-
* Settings document. This is in contrast to a repeatable
|
|
963
|
+
* Settings document. This is in contrast to a repeatable custom type which
|
|
964
964
|
* allows multiple instances of itself.
|
|
965
965
|
* @example
|
|
966
966
|
*
|
|
@@ -969,10 +969,10 @@ export class Client<TDocuments extends PrismicDocument = PrismicDocument> {
|
|
|
969
969
|
* ```
|
|
970
970
|
*
|
|
971
971
|
* @typeParam TDocument - Type of the Prismic document returned.
|
|
972
|
-
* @param documentType - The API ID of the singleton
|
|
972
|
+
* @param documentType - The API ID of the singleton custom type.
|
|
973
973
|
* @param params - Parameters to filter, sort, and paginate the results.
|
|
974
974
|
*
|
|
975
|
-
* @returns The singleton document for the
|
|
975
|
+
* @returns The singleton document for the custom type, if a matching document
|
|
976
976
|
* exists.
|
|
977
977
|
*/
|
|
978
978
|
async getSingle<
|
|
@@ -988,10 +988,10 @@ export class Client<TDocuments extends PrismicDocument = PrismicDocument> {
|
|
|
988
988
|
}
|
|
989
989
|
|
|
990
990
|
/**
|
|
991
|
-
* Queries documents from the Prismic repository for a specific
|
|
991
|
+
* Queries documents from the Prismic repository for a specific custom type.
|
|
992
992
|
*
|
|
993
993
|
* Use `getAllByType` instead if you need to query all documents for a
|
|
994
|
-
* specific
|
|
994
|
+
* specific custom type.
|
|
995
995
|
*
|
|
996
996
|
* @example
|
|
997
997
|
*
|
|
@@ -1000,10 +1000,10 @@ export class Client<TDocuments extends PrismicDocument = PrismicDocument> {
|
|
|
1000
1000
|
* ```
|
|
1001
1001
|
*
|
|
1002
1002
|
* @typeParam TDocument - Type of Prismic documents returned.
|
|
1003
|
-
* @param documentType - The API ID of the
|
|
1003
|
+
* @param documentType - The API ID of the custom type.
|
|
1004
1004
|
* @param params - Parameters to filter, sort, and paginate the results.
|
|
1005
1005
|
*
|
|
1006
|
-
* @returns A paginated response containing documents of the
|
|
1006
|
+
* @returns A paginated response containing documents of the custom type.
|
|
1007
1007
|
*/
|
|
1008
1008
|
async getByType<
|
|
1009
1009
|
TDocument extends TDocuments,
|
|
@@ -1031,10 +1031,10 @@ export class Client<TDocuments extends PrismicDocument = PrismicDocument> {
|
|
|
1031
1031
|
* ```
|
|
1032
1032
|
*
|
|
1033
1033
|
* @typeParam TDocument - Type of Prismic documents returned.
|
|
1034
|
-
* @param documentType - The API ID of the
|
|
1034
|
+
* @param documentType - The API ID of the custom type.
|
|
1035
1035
|
* @param params - Parameters to filter, sort, and paginate the results.
|
|
1036
1036
|
*
|
|
1037
|
-
* @returns A list of all documents of the
|
|
1037
|
+
* @returns A list of all documents of the custom type.
|
|
1038
1038
|
*/
|
|
1039
1039
|
async getAllByType<
|
|
1040
1040
|
TDocument extends TDocuments,
|
package/src/filter.ts
CHANGED
|
@@ -177,7 +177,7 @@ export const filter = {
|
|
|
177
177
|
* The `geopoint.near` filter checks that the value in the path is within
|
|
178
178
|
* the radius of the given coordinates.
|
|
179
179
|
*
|
|
180
|
-
* This filter will only work for a
|
|
180
|
+
* This filter will only work for a geopoint field.
|
|
181
181
|
*
|
|
182
182
|
* {@link https://prismic.io/docs/rest-api-technical-reference#geopointnear}
|
|
183
183
|
*/
|
package/src/helpers/asDate.ts
CHANGED
|
@@ -9,9 +9,9 @@ type AsDateReturnType<
|
|
|
9
9
|
> = Field extends DateField<"filled"> | TimestampField<"filled"> ? Date : null;
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
|
-
* Transforms a
|
|
12
|
+
* Transforms a date or timestamp field into a JavaScript Date object
|
|
13
13
|
*
|
|
14
|
-
* @param dateOrTimestampField - A
|
|
14
|
+
* @param dateOrTimestampField - A date or timestamp field from Prismic
|
|
15
15
|
*
|
|
16
16
|
* @returns A Date object, null if provided date is falsy
|
|
17
17
|
* @see Templating date field from Prismic {@link https://prismic.io/docs/template-content-vanilla-javascript#date-and-timestamp}
|