@prismicio/client 6.7.0 → 7.0.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/ForbiddenError.cjs +7 -0
- package/dist/ForbiddenError.cjs.map +1 -0
- package/dist/ForbiddenError.d.ts +11 -0
- package/dist/ForbiddenError.js +7 -0
- package/dist/ForbiddenError.js.map +1 -0
- package/dist/NotFoundError.cjs +7 -0
- package/dist/NotFoundError.cjs.map +1 -0
- package/dist/NotFoundError.d.ts +3 -0
- package/dist/NotFoundError.js +7 -0
- package/dist/NotFoundError.js.map +1 -0
- package/dist/ParsingError.cjs +7 -0
- package/dist/ParsingError.cjs.map +1 -0
- package/dist/ParsingError.d.ts +12 -0
- package/dist/ParsingError.js +7 -0
- package/dist/ParsingError.js.map +1 -0
- package/dist/PrismicError.cjs +19 -0
- package/dist/PrismicError.cjs.map +1 -0
- package/dist/PrismicError.d.ts +5 -0
- package/dist/PrismicError.js +19 -0
- package/dist/PrismicError.js.map +1 -0
- package/dist/buildQueryURL.cjs +41 -0
- package/dist/buildQueryURL.cjs.map +1 -0
- package/dist/buildQueryURL.d.ts +130 -0
- package/dist/buildQueryURL.js +41 -0
- package/dist/buildQueryURL.js.map +1 -0
- package/dist/client.cjs +414 -0
- package/dist/client.cjs.map +1 -0
- package/dist/client.d.ts +908 -0
- package/dist/client.js +414 -0
- package/dist/client.js.map +1 -0
- package/dist/cookie.cjs +5 -0
- package/dist/cookie.cjs.map +1 -0
- package/dist/cookie.d.ts +5 -0
- package/dist/cookie.js +5 -0
- package/dist/cookie.js.map +1 -0
- package/dist/getGraphQLEndpoint.cjs +13 -0
- package/dist/getGraphQLEndpoint.cjs.map +1 -0
- package/dist/getGraphQLEndpoint.d.ts +9 -0
- package/dist/getGraphQLEndpoint.js +13 -0
- package/dist/getGraphQLEndpoint.js.map +1 -0
- package/dist/getRepositoryEndpoint.cjs +13 -0
- package/dist/getRepositoryEndpoint.cjs.map +1 -0
- package/dist/getRepositoryEndpoint.d.ts +10 -0
- package/dist/getRepositoryEndpoint.js +13 -0
- package/dist/getRepositoryEndpoint.js.map +1 -0
- package/dist/getRepositoryName.cjs +12 -0
- package/dist/getRepositoryName.cjs.map +1 -0
- package/dist/getRepositoryName.d.ts +13 -0
- package/dist/getRepositoryName.js +12 -0
- package/dist/getRepositoryName.js.map +1 -0
- package/dist/helpers/asDate.cjs +14 -0
- package/dist/helpers/asDate.cjs.map +1 -0
- package/dist/helpers/asDate.d.ts +16 -0
- package/dist/helpers/asDate.js +14 -0
- package/dist/helpers/asDate.js.map +1 -0
- package/dist/helpers/asHTML.cjs +79 -0
- package/dist/helpers/asHTML.cjs.map +1 -0
- package/dist/helpers/asHTML.d.ts +20 -0
- package/dist/helpers/asHTML.js +79 -0
- package/dist/helpers/asHTML.js.map +1 -0
- package/dist/helpers/asImagePixelDensitySrcSet.cjs +21 -0
- package/dist/helpers/asImagePixelDensitySrcSet.cjs.map +1 -0
- package/dist/helpers/asImagePixelDensitySrcSet.d.ts +52 -0
- package/dist/helpers/asImagePixelDensitySrcSet.js +21 -0
- package/dist/helpers/asImagePixelDensitySrcSet.js.map +1 -0
- package/dist/helpers/asImageSrc.cjs +13 -0
- package/dist/helpers/asImageSrc.cjs.map +1 -0
- package/dist/helpers/asImageSrc.d.ts +27 -0
- package/dist/helpers/asImageSrc.js +13 -0
- package/dist/helpers/asImageSrc.js.map +1 -0
- package/dist/helpers/asImageWidthSrcSet.cjs +40 -0
- package/dist/helpers/asImageWidthSrcSet.cjs.map +1 -0
- package/dist/helpers/asImageWidthSrcSet.d.ts +60 -0
- package/dist/helpers/asImageWidthSrcSet.js +40 -0
- package/dist/helpers/asImageWidthSrcSet.js.map +1 -0
- package/dist/helpers/asLink.cjs +32 -0
- package/dist/helpers/asLink.cjs.map +1 -0
- package/dist/helpers/asLink.d.ts +24 -0
- package/dist/helpers/asLink.js +32 -0
- package/dist/helpers/asLink.js.map +1 -0
- package/dist/helpers/asText.cjs +12 -0
- package/dist/helpers/asText.cjs.map +1 -0
- package/dist/helpers/asText.d.ts +16 -0
- package/dist/helpers/asText.js +12 -0
- package/dist/helpers/asText.js.map +1 -0
- package/dist/helpers/documentToLinkField.cjs +19 -0
- package/dist/helpers/documentToLinkField.cjs.map +1 -0
- package/dist/helpers/documentToLinkField.d.ts +15 -0
- package/dist/helpers/documentToLinkField.js +19 -0
- package/dist/helpers/documentToLinkField.js.map +1 -0
- package/dist/helpers/isFilled.cjs +67 -0
- package/dist/helpers/isFilled.cjs.map +1 -0
- package/dist/helpers/isFilled.d.ts +175 -0
- package/dist/helpers/isFilled.js +67 -0
- package/dist/helpers/isFilled.js.map +1 -0
- package/dist/index.cjs +67 -721
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +92 -1526
- package/dist/index.js +64 -681
- package/dist/index.js.map +1 -1
- package/dist/isRepositoryEndpoint.cjs +12 -0
- package/dist/isRepositoryEndpoint.cjs.map +1 -0
- package/dist/isRepositoryEndpoint.d.ts +10 -0
- package/dist/isRepositoryEndpoint.js +12 -0
- package/dist/isRepositoryEndpoint.js.map +1 -0
- package/dist/isRepositoryName.cjs +7 -0
- package/dist/isRepositoryName.cjs.map +1 -0
- package/dist/isRepositoryName.d.ts +9 -0
- package/dist/isRepositoryName.js +7 -0
- package/dist/isRepositoryName.js.map +1 -0
- package/dist/lib/appendPredicates.cjs +14 -0
- package/dist/lib/appendPredicates.cjs.map +1 -0
- package/dist/lib/appendPredicates.d.ts +18 -0
- package/dist/lib/appendPredicates.js +14 -0
- package/dist/lib/appendPredicates.js.map +1 -0
- package/dist/lib/castArray.cjs +5 -0
- package/dist/lib/castArray.cjs.map +1 -0
- package/dist/lib/castArray.d.ts +11 -0
- package/dist/lib/castArray.js +5 -0
- package/dist/lib/castArray.js.map +1 -0
- package/dist/lib/castThunk.cjs +5 -0
- package/dist/lib/castThunk.cjs.map +1 -0
- package/dist/lib/castThunk.d.ts +10 -0
- package/dist/lib/castThunk.js +5 -0
- package/dist/lib/castThunk.js.map +1 -0
- package/dist/lib/findMasterRef.cjs +8 -0
- package/dist/lib/findMasterRef.cjs.map +1 -0
- package/dist/lib/findMasterRef.d.ts +10 -0
- package/dist/lib/findMasterRef.js +8 -0
- package/dist/lib/findMasterRef.js.map +1 -0
- package/dist/lib/findRef.cjs +12 -0
- package/dist/lib/findRef.cjs.map +1 -0
- package/dist/lib/findRef.d.ts +13 -0
- package/dist/lib/findRef.js +12 -0
- package/dist/lib/findRef.js.map +1 -0
- package/dist/lib/findRefByID.cjs +8 -0
- package/dist/lib/findRefByID.cjs.map +1 -0
- package/dist/lib/findRefByID.d.ts +11 -0
- package/dist/lib/findRefByID.js +8 -0
- package/dist/lib/findRefByID.js.map +1 -0
- package/dist/lib/findRefByLabel.cjs +8 -0
- package/dist/lib/findRefByLabel.cjs.map +1 -0
- package/dist/lib/findRefByLabel.d.ts +11 -0
- package/dist/lib/findRefByLabel.js +8 -0
- package/dist/lib/findRefByLabel.js.map +1 -0
- package/dist/lib/getPreviewCookie.cjs +21 -0
- package/dist/lib/getPreviewCookie.cjs.map +1 -0
- package/dist/lib/getPreviewCookie.d.ts +9 -0
- package/dist/lib/getPreviewCookie.js +21 -0
- package/dist/lib/getPreviewCookie.js.map +1 -0
- package/dist/lib/minifyGraphQLQuery.cjs +7 -0
- package/dist/lib/minifyGraphQLQuery.cjs.map +1 -0
- package/dist/lib/minifyGraphQLQuery.d.ts +8 -0
- package/dist/lib/minifyGraphQLQuery.js +7 -0
- package/dist/lib/minifyGraphQLQuery.js.map +1 -0
- package/dist/lib/serializerHelpers.cjs +56 -0
- package/dist/lib/serializerHelpers.cjs.map +1 -0
- package/dist/lib/serializerHelpers.d.ts +9 -0
- package/dist/lib/serializerHelpers.js +54 -0
- package/dist/lib/serializerHelpers.js.map +1 -0
- package/dist/predicate.cjs +68 -0
- package/dist/predicate.cjs.map +1 -0
- package/dist/predicate.d.ts +209 -0
- package/dist/predicate.js +68 -0
- package/dist/predicate.js.map +1 -0
- package/dist/types/api/query.d.ts +42 -0
- package/dist/types/api/ref.d.ts +32 -0
- package/dist/types/api/release.d.ts +10 -0
- package/dist/types/api/repository.d.ts +100 -0
- package/dist/types/api/tags.d.ts +8 -0
- package/dist/types/client.d.ts +128 -0
- package/dist/types/helpers.d.ts +63 -0
- package/dist/types/model/boolean.d.ts +15 -0
- package/dist/types/model/color.d.ts +13 -0
- package/dist/types/model/contentRelationship.d.ts +18 -0
- package/dist/types/model/customType.d.ts +42 -0
- package/dist/types/model/date.d.ts +14 -0
- package/dist/types/model/embed.d.ts +13 -0
- package/dist/types/model/geoPoint.d.ts +12 -0
- package/dist/types/model/group.d.ts +15 -0
- package/dist/types/model/image.d.ts +31 -0
- package/dist/types/model/integrationFields.d.ts +14 -0
- package/dist/types/model/keyText.d.ts +13 -0
- package/dist/types/model/link.cjs +9 -0
- package/dist/types/model/link.cjs.map +1 -0
- package/dist/types/model/link.d.ts +27 -0
- package/dist/types/model/link.js +9 -0
- package/dist/types/model/link.js.map +1 -0
- package/dist/types/model/linkToMedia.d.ts +16 -0
- package/dist/types/model/number.d.ts +15 -0
- package/dist/types/model/range.d.ts +14 -0
- package/dist/types/model/richText.d.ts +35 -0
- package/dist/types/model/select.d.ts +18 -0
- package/dist/types/model/separator.d.ts +10 -0
- package/dist/types/model/sharedSlice.d.ts +19 -0
- package/dist/types/model/sharedSliceVariation.d.ts +22 -0
- package/dist/types/model/slice.cjs +8 -0
- package/dist/types/model/slice.cjs.map +1 -0
- package/dist/types/model/slice.d.ts +33 -0
- package/dist/types/model/slice.js +8 -0
- package/dist/types/model/slice.js.map +1 -0
- package/dist/types/model/sliceZone.cjs +8 -0
- package/dist/types/model/sliceZone.cjs.map +1 -0
- package/dist/types/model/sliceZone.d.ts +44 -0
- package/dist/types/model/sliceZone.js +8 -0
- package/dist/types/model/sliceZone.js.map +1 -0
- package/dist/types/model/timestamp.d.ts +14 -0
- package/dist/types/model/title.d.ts +7 -0
- package/dist/types/model/types.cjs +25 -0
- package/dist/types/model/types.cjs.map +1 -0
- package/dist/types/model/types.d.ts +62 -0
- package/dist/types/model/types.js +25 -0
- package/dist/types/model/types.js.map +1 -0
- package/dist/types/model/uid.d.ts +13 -0
- package/dist/types/utils.d.ts +28 -0
- package/dist/types/value/boolean.d.ts +6 -0
- package/dist/types/value/color.d.ts +8 -0
- package/dist/types/value/contentRelationship.d.ts +29 -0
- package/dist/types/value/date.d.ts +8 -0
- package/dist/types/value/document.d.ts +113 -0
- package/dist/types/value/embed.cjs +10 -0
- package/dist/types/value/embed.cjs.map +1 -0
- package/dist/types/value/embed.d.ts +167 -0
- package/dist/types/value/embed.js +10 -0
- package/dist/types/value/embed.js.map +1 -0
- package/dist/types/value/geoPoint.d.ts +11 -0
- package/dist/types/value/group.d.ts +7 -0
- package/dist/types/value/image.d.ts +36 -0
- package/dist/types/value/integrationFields.d.ts +9 -0
- package/dist/types/value/keyText.d.ts +8 -0
- package/dist/types/value/link.cjs +10 -0
- package/dist/types/value/link.cjs.map +1 -0
- package/dist/types/value/link.d.ts +40 -0
- package/dist/types/value/link.js +10 -0
- package/dist/types/value/link.js.map +1 -0
- package/dist/types/value/linkToMedia.d.ts +20 -0
- package/dist/types/value/number.d.ts +8 -0
- package/dist/types/value/richText.cjs +25 -0
- package/dist/types/value/richText.cjs.map +1 -0
- package/dist/types/value/richText.d.ts +203 -0
- package/dist/types/value/richText.js +25 -0
- package/dist/types/value/richText.js.map +1 -0
- package/dist/types/value/select.d.ts +9 -0
- package/dist/types/value/sharedSlice.d.ts +11 -0
- package/dist/types/value/sharedSliceVariation.d.ts +7 -0
- package/dist/types/value/slice.d.ts +13 -0
- package/dist/types/value/sliceZone.d.ts +12 -0
- package/dist/types/value/timestamp.d.ts +8 -0
- package/dist/types/value/title.d.ts +12 -0
- package/dist/types/value/types.d.ts +40 -0
- package/dist/types/webhook/apiUpdate.d.ts +52 -0
- package/dist/types/webhook/testTrigger.d.ts +9 -0
- package/dist/types/webhook/types.cjs +8 -0
- package/dist/types/webhook/types.cjs.map +1 -0
- package/dist/types/webhook/types.d.ts +18 -0
- package/dist/types/webhook/types.js +8 -0
- package/dist/types/webhook/types.js.map +1 -0
- package/package.json +40 -33
- package/src/buildQueryURL.ts +8 -4
- package/src/client.ts +111 -118
- package/src/cookie.ts +2 -1
- package/src/getRepositoryName.ts +4 -2
- package/src/helpers/asDate.ts +48 -0
- package/src/helpers/asHTML.ts +154 -0
- package/src/helpers/asImagePixelDensitySrcSet.ts +96 -0
- package/src/helpers/asImageSrc.ts +41 -0
- package/src/helpers/asImageWidthSrcSet.ts +139 -0
- package/src/helpers/asLink.ts +99 -0
- package/src/helpers/asText.ts +29 -0
- package/src/helpers/documentToLinkField.ts +47 -0
- package/src/helpers/isFilled.ts +290 -0
- package/src/index.ts +237 -21
- package/src/isRepositoryEndpoint.ts +2 -1
- package/src/isRepositoryName.ts +2 -1
- package/src/lib/appendPredicates.ts +2 -1
- package/src/lib/findMasterRef.ts +2 -2
- package/src/lib/findRef.ts +2 -5
- package/src/lib/findRefByID.ts +2 -2
- package/src/lib/findRefByLabel.ts +2 -5
- package/src/lib/getPreviewCookie.ts +3 -2
- package/src/lib/serializerHelpers.ts +96 -0
- package/src/predicate.ts +4 -2
- package/src/types/api/query.ts +50 -0
- package/src/types/api/ref.ts +36 -0
- package/src/types/api/release.ts +11 -0
- package/src/types/api/repository.ts +117 -0
- package/src/types/api/tags.ts +8 -0
- package/src/{types.ts → types/client.ts} +16 -52
- package/src/types/helpers.ts +103 -0
- package/src/types/model/boolean.ts +16 -0
- package/src/types/model/color.ts +14 -0
- package/src/types/model/contentRelationship.ts +22 -0
- package/src/types/model/customType.ts +61 -0
- package/src/types/model/date.ts +15 -0
- package/src/types/model/embed.ts +14 -0
- package/src/types/model/geoPoint.ts +13 -0
- package/src/types/model/group.ts +24 -0
- package/src/types/model/image.ts +37 -0
- package/src/types/model/integrationFields.ts +15 -0
- package/src/types/model/keyText.ts +14 -0
- package/src/types/model/link.ts +31 -0
- package/src/types/model/linkToMedia.ts +17 -0
- package/src/types/model/number.ts +16 -0
- package/src/types/model/range.ts +15 -0
- package/src/types/model/richText.ts +40 -0
- package/src/types/model/select.ts +22 -0
- package/src/types/model/separator.ts +11 -0
- package/src/types/model/sharedSlice.ts +23 -0
- package/src/types/model/sharedSliceVariation.ts +33 -0
- package/src/types/model/slice.ts +49 -0
- package/src/types/model/sliceZone.ts +62 -0
- package/src/types/model/timestamp.ts +15 -0
- package/src/types/model/title.ts +8 -0
- package/src/types/model/types.ts +91 -0
- package/src/types/model/uid.ts +14 -0
- package/src/types/utils.ts +34 -0
- package/src/types/value/boolean.ts +6 -0
- package/src/types/value/color.ts +10 -0
- package/src/types/value/contentRelationship.ts +48 -0
- package/src/types/value/date.ts +10 -0
- package/src/types/value/document.ts +142 -0
- package/src/types/value/embed.ts +196 -0
- package/src/types/value/geoPoint.ts +15 -0
- package/src/types/value/group.ts +14 -0
- package/src/types/value/image.ts +67 -0
- package/src/types/value/integrationFields.ts +13 -0
- package/src/types/value/keyText.ts +10 -0
- package/src/types/value/link.ts +59 -0
- package/src/types/value/linkToMedia.ts +25 -0
- package/src/types/value/number.ts +10 -0
- package/src/types/value/richText.ts +286 -0
- package/src/types/value/select.ts +13 -0
- package/src/types/value/sharedSlice.ts +15 -0
- package/src/types/value/sharedSliceVariation.ts +18 -0
- package/src/types/value/slice.ts +24 -0
- package/src/types/value/sliceZone.ts +16 -0
- package/src/types/value/timestamp.ts +12 -0
- package/src/types/value/title.ts +31 -0
- package/src/types/value/types.ts +60 -0
- package/src/types/webhook/apiUpdate.ts +56 -0
- package/src/types/webhook/testTrigger.ts +10 -0
- package/src/types/webhook/types.ts +21 -0
- package/src/lib/orElseThrow.ts +0 -17
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
import type { EmbedField } from "./embed";
|
|
2
|
+
import type { FieldState } from "./types";
|
|
3
|
+
import type { FilledContentRelationshipField } from "./contentRelationship";
|
|
4
|
+
import type { FilledLinkToMediaField } from "./linkToMedia";
|
|
5
|
+
import type { FilledLinkToWebField } from "./link";
|
|
6
|
+
/**
|
|
7
|
+
* Types for RichTextNodes
|
|
8
|
+
*
|
|
9
|
+
* @see More details: {@link https://prismic.io/docs/core-concepts/rich-text-title}
|
|
10
|
+
*/
|
|
11
|
+
export declare const RichTextNodeType: {
|
|
12
|
+
readonly heading1: "heading1";
|
|
13
|
+
readonly heading2: "heading2";
|
|
14
|
+
readonly heading3: "heading3";
|
|
15
|
+
readonly heading4: "heading4";
|
|
16
|
+
readonly heading5: "heading5";
|
|
17
|
+
readonly heading6: "heading6";
|
|
18
|
+
readonly paragraph: "paragraph";
|
|
19
|
+
readonly preformatted: "preformatted";
|
|
20
|
+
readonly strong: "strong";
|
|
21
|
+
readonly em: "em";
|
|
22
|
+
readonly listItem: "list-item";
|
|
23
|
+
readonly oListItem: "o-list-item";
|
|
24
|
+
readonly list: "group-list-item";
|
|
25
|
+
readonly oList: "group-o-list-item";
|
|
26
|
+
readonly image: "image";
|
|
27
|
+
readonly embed: "embed";
|
|
28
|
+
readonly hyperlink: "hyperlink";
|
|
29
|
+
readonly label: "label";
|
|
30
|
+
readonly span: "span";
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* Base to be extended by other RT Nodes.
|
|
34
|
+
*/
|
|
35
|
+
export interface RTTextNodeBase {
|
|
36
|
+
text: string;
|
|
37
|
+
spans: RTInlineNode[];
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Rich Text `heading1` node
|
|
41
|
+
*/
|
|
42
|
+
export interface RTHeading1Node extends RTTextNodeBase {
|
|
43
|
+
type: typeof RichTextNodeType.heading1;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Rich Text `heading2` node
|
|
47
|
+
*/
|
|
48
|
+
export interface RTHeading2Node extends RTTextNodeBase {
|
|
49
|
+
type: typeof RichTextNodeType.heading2;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Rich Text `heading3` node
|
|
53
|
+
*/
|
|
54
|
+
export interface RTHeading3Node extends RTTextNodeBase {
|
|
55
|
+
type: typeof RichTextNodeType.heading3;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Rich Text `heading4` node
|
|
59
|
+
*/
|
|
60
|
+
export interface RTHeading4Node extends RTTextNodeBase {
|
|
61
|
+
type: typeof RichTextNodeType.heading4;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Rich Text `heading5` node
|
|
65
|
+
*/
|
|
66
|
+
export interface RTHeading5Node extends RTTextNodeBase {
|
|
67
|
+
type: typeof RichTextNodeType.heading5;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Rich Text `heading6` node
|
|
71
|
+
*/
|
|
72
|
+
export interface RTHeading6Node extends RTTextNodeBase {
|
|
73
|
+
type: typeof RichTextNodeType.heading6;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Rich Text `paragraph` node
|
|
77
|
+
*/
|
|
78
|
+
export interface RTParagraphNode extends RTTextNodeBase {
|
|
79
|
+
type: typeof RichTextNodeType.paragraph;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Rich Text `preformatted` node
|
|
83
|
+
*/
|
|
84
|
+
export interface RTPreformattedNode extends RTTextNodeBase {
|
|
85
|
+
type: typeof RichTextNodeType.preformatted;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Rich Text `list-item` node
|
|
89
|
+
*/
|
|
90
|
+
export interface RTListItemNode extends RTTextNodeBase {
|
|
91
|
+
type: typeof RichTextNodeType.listItem;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Rich Text `o-list-item` node for ordered lists
|
|
95
|
+
*/
|
|
96
|
+
export interface RTOListItemNode extends RTTextNodeBase {
|
|
97
|
+
type: typeof RichTextNodeType.oListItem;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* @internal Span Node base to be extended for other Span nodes
|
|
101
|
+
*/
|
|
102
|
+
export interface RTSpanNodeBase {
|
|
103
|
+
start: number;
|
|
104
|
+
end: number;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Rich Text `strong` node
|
|
108
|
+
*/
|
|
109
|
+
export interface RTStrongNode extends RTSpanNodeBase {
|
|
110
|
+
type: typeof RichTextNodeType.strong;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Rich Text `embed` node
|
|
114
|
+
*/
|
|
115
|
+
export interface RTEmNode extends RTSpanNodeBase {
|
|
116
|
+
type: typeof RichTextNodeType.em;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Rich Text `label` node
|
|
120
|
+
*/
|
|
121
|
+
export interface RTLabelNode extends RTSpanNodeBase {
|
|
122
|
+
type: typeof RichTextNodeType.label;
|
|
123
|
+
data: {
|
|
124
|
+
label: string;
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Rich Text `image` nodes. They could link to other documents, external web
|
|
129
|
+
* links and media fields
|
|
130
|
+
*/
|
|
131
|
+
export declare type RTImageNode = {
|
|
132
|
+
type: typeof RichTextNodeType.image;
|
|
133
|
+
url: string;
|
|
134
|
+
alt: string | null;
|
|
135
|
+
copyright: string | null;
|
|
136
|
+
dimensions: {
|
|
137
|
+
width: number;
|
|
138
|
+
height: number;
|
|
139
|
+
};
|
|
140
|
+
linkTo?: FilledContentRelationshipField | FilledLinkToWebField | FilledLinkToMediaField;
|
|
141
|
+
};
|
|
142
|
+
/**
|
|
143
|
+
* Rich Text `embed` node
|
|
144
|
+
*/
|
|
145
|
+
export declare type RTEmbedNode = {
|
|
146
|
+
type: typeof RichTextNodeType.embed;
|
|
147
|
+
oembed: EmbedField;
|
|
148
|
+
};
|
|
149
|
+
/**
|
|
150
|
+
* Rich Text `a` node
|
|
151
|
+
*
|
|
152
|
+
* @see More details: {@link https://prismic.io/docs/core-concepts/edit-rich-text#add-links}
|
|
153
|
+
*/
|
|
154
|
+
export interface RTLinkNode extends RTSpanNodeBase {
|
|
155
|
+
type: typeof RichTextNodeType.hyperlink;
|
|
156
|
+
data: FilledContentRelationshipField | FilledLinkToWebField | FilledLinkToMediaField;
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Rich Text `list` node
|
|
160
|
+
*/
|
|
161
|
+
export interface RTListNode {
|
|
162
|
+
type: typeof RichTextNodeType.list;
|
|
163
|
+
items: RTListItemNode[];
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Rich Text o-lost node
|
|
167
|
+
*/
|
|
168
|
+
export interface RTOListNode {
|
|
169
|
+
type: typeof RichTextNodeType.oList;
|
|
170
|
+
items: RTOListItemNode[];
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* Rich Text `span` node
|
|
174
|
+
*/
|
|
175
|
+
export interface RTSpanNode extends RTTextNodeBase {
|
|
176
|
+
type: typeof RichTextNodeType.span;
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Nodes from a Rich Text Field
|
|
180
|
+
*/
|
|
181
|
+
export declare type RTNode = RTHeading1Node | RTHeading2Node | RTHeading3Node | RTHeading4Node | RTHeading5Node | RTHeading6Node | RTParagraphNode | RTPreformattedNode | RTListItemNode | RTOListItemNode | RTImageNode | RTEmbedNode;
|
|
182
|
+
/**
|
|
183
|
+
* Rich text nodes with text
|
|
184
|
+
*/
|
|
185
|
+
export declare type RTTextNode = RTHeading1Node | RTHeading2Node | RTHeading3Node | RTHeading4Node | RTHeading5Node | RTHeading6Node | RTParagraphNode | RTPreformattedNode | RTListItemNode | RTOListItemNode;
|
|
186
|
+
/**
|
|
187
|
+
* Rich Text block nodes
|
|
188
|
+
*/
|
|
189
|
+
export declare type RTBlockNode = RTHeading1Node | RTHeading2Node | RTHeading3Node | RTHeading4Node | RTHeading5Node | RTHeading6Node | RTParagraphNode | RTPreformattedNode | RTListItemNode | RTOListItemNode | RTListNode | RTOListNode | RTImageNode | RTEmbedNode;
|
|
190
|
+
/**
|
|
191
|
+
* Inline Rich Text Nodes
|
|
192
|
+
*/
|
|
193
|
+
export declare type RTInlineNode = RTStrongNode | RTEmNode | RTLabelNode | RTLinkNode;
|
|
194
|
+
/**
|
|
195
|
+
* All Rich Text nodes
|
|
196
|
+
*/
|
|
197
|
+
export declare type RTAnyNode = RTBlockNode | RTInlineNode | RTSpanNode;
|
|
198
|
+
/**
|
|
199
|
+
* Rich Text Field
|
|
200
|
+
*
|
|
201
|
+
* @see Rich Text field documentation: {@link https://prismic.io/docs/core-concepts/rich-text-title}
|
|
202
|
+
*/
|
|
203
|
+
export declare type RichTextField<State extends FieldState = FieldState> = State extends "empty" ? [] : [RTNode, ...RTNode[]];
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
const RichTextNodeType = {
|
|
2
|
+
heading1: "heading1",
|
|
3
|
+
heading2: "heading2",
|
|
4
|
+
heading3: "heading3",
|
|
5
|
+
heading4: "heading4",
|
|
6
|
+
heading5: "heading5",
|
|
7
|
+
heading6: "heading6",
|
|
8
|
+
paragraph: "paragraph",
|
|
9
|
+
preformatted: "preformatted",
|
|
10
|
+
strong: "strong",
|
|
11
|
+
em: "em",
|
|
12
|
+
listItem: "list-item",
|
|
13
|
+
oListItem: "o-list-item",
|
|
14
|
+
list: "group-list-item",
|
|
15
|
+
oList: "group-o-list-item",
|
|
16
|
+
image: "image",
|
|
17
|
+
embed: "embed",
|
|
18
|
+
hyperlink: "hyperlink",
|
|
19
|
+
label: "label",
|
|
20
|
+
span: "span"
|
|
21
|
+
};
|
|
22
|
+
export {
|
|
23
|
+
RichTextNodeType
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=richText.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"richText.js","sources":["../../../src/types/value/richText.ts"],"sourcesContent":["import type { EmbedField } from \"./embed\";\nimport type { FieldState } from \"./types\";\nimport type { FilledContentRelationshipField } from \"./contentRelationship\";\nimport type { FilledLinkToMediaField } from \"./linkToMedia\";\nimport type { FilledLinkToWebField } from \"./link\";\n\n/**\n * Types for RichTextNodes\n *\n * @see More details: {@link https://prismic.io/docs/core-concepts/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 RT 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/core-concepts/edit-rich-text#add-links}\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 * Rich Text Field\n *\n * @see Rich Text field documentation: {@link https://prismic.io/docs/core-concepts/rich-text-title}\n */\nexport type RichTextField<State extends FieldState = FieldState> =\n\tState extends \"empty\" ? [] : [RTNode, ...RTNode[]];\n"],"names":[],"mappings":"AAWO,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;;"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { FieldState } from "./types";
|
|
2
|
+
/**
|
|
3
|
+
* A Select field
|
|
4
|
+
*
|
|
5
|
+
* @typeParam Enum - Selectable options for the field.
|
|
6
|
+
* @typeParam State - State of the field which determines its shape.
|
|
7
|
+
* @see More details: {@link https://prismic.io/docs/core-concepts/select}
|
|
8
|
+
*/
|
|
9
|
+
export declare type SelectField<Enum extends string = string, State extends FieldState = FieldState> = State extends "empty" ? null : Enum;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { SharedSliceVariation } from "./sharedSliceVariation";
|
|
2
|
+
/**
|
|
3
|
+
* Shared Slice
|
|
4
|
+
*
|
|
5
|
+
* @see More details: {@link https://prismic.io/docs/core-concepts/reusing-slices#shared-slices}
|
|
6
|
+
*/
|
|
7
|
+
export declare type SharedSlice<SliceType = string, Variations extends SharedSliceVariation = SharedSliceVariation> = {
|
|
8
|
+
slice_type: SliceType;
|
|
9
|
+
slice_label: null;
|
|
10
|
+
id?: string;
|
|
11
|
+
} & Variations;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { AnyRegularField } from "./types";
|
|
2
|
+
export interface SharedSliceVariation<Variation = string, PrimaryFields extends Record<string, AnyRegularField> = Record<string, AnyRegularField>, ItemsFields extends Record<string, AnyRegularField> = Record<string, AnyRegularField>> {
|
|
3
|
+
variation: Variation;
|
|
4
|
+
version: string;
|
|
5
|
+
primary: PrimaryFields;
|
|
6
|
+
items: ItemsFields[];
|
|
7
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { AnyRegularField } from "./types";
|
|
2
|
+
/**
|
|
3
|
+
* Slice - Sections of your website
|
|
4
|
+
*
|
|
5
|
+
* @see More details: {@link https://prismic.io/docs/core-concepts/slices}
|
|
6
|
+
*/
|
|
7
|
+
export interface Slice<SliceType = string, PrimaryFields extends Record<string, AnyRegularField> = Record<string, AnyRegularField>, ItemsFields extends Record<string, AnyRegularField> = Record<string, AnyRegularField>> {
|
|
8
|
+
slice_type: SliceType;
|
|
9
|
+
slice_label: string | null;
|
|
10
|
+
id?: string;
|
|
11
|
+
primary: PrimaryFields;
|
|
12
|
+
items: ItemsFields[];
|
|
13
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { FieldState } from "./types";
|
|
2
|
+
import type { SharedSlice } from "./sharedSlice";
|
|
3
|
+
import type { Slice } from "./slice";
|
|
4
|
+
/**
|
|
5
|
+
* Prismic Slices are sections of your website. Prismic documents contain a
|
|
6
|
+
* dynamic "Slice Zone" that allows content creators to add, edit, and rearrange
|
|
7
|
+
* Slices to compose dynamic layouts for any page design, such as blog posts,
|
|
8
|
+
* landing pages, case studies, and tutorials.
|
|
9
|
+
*
|
|
10
|
+
* @see More details: {@link https://prismic.io/docs/technologies/adding-the-slicezone-component-nextjs}
|
|
11
|
+
*/
|
|
12
|
+
export declare type SliceZone<Slices extends Slice | SharedSlice = Slice | SharedSlice, State extends FieldState = FieldState> = State extends "empty" ? [] : [Slices, ...Slices[]];
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { FieldState } from "./types";
|
|
2
|
+
import type { DateField } from "./date";
|
|
3
|
+
/**
|
|
4
|
+
* Simple Timestamp Field
|
|
5
|
+
*
|
|
6
|
+
* @typeParam State - State of the field which determines its shape.
|
|
7
|
+
*/
|
|
8
|
+
export declare type TimestampField<State extends FieldState = FieldState> = State extends "empty" ? null : `${DateField<"filled">}T${number}:${number}:${number}+${number}`;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { FieldState } from "./types";
|
|
2
|
+
import type { RTHeading1Node, RTHeading2Node, RTHeading3Node, RTHeading4Node, RTHeading5Node, RTHeading6Node } from "./richText";
|
|
3
|
+
/**
|
|
4
|
+
* Title Field
|
|
5
|
+
*
|
|
6
|
+
* @see Title field documentation: {@link https://prismic.io/docs/core-concepts/rich-text-title}
|
|
7
|
+
*/
|
|
8
|
+
export declare type TitleField<State extends FieldState = FieldState> = State extends "empty" ? [] : [
|
|
9
|
+
Omit<RTHeading1Node | RTHeading2Node | RTHeading3Node | RTHeading4Node | RTHeading5Node | RTHeading6Node, "spans"> & {
|
|
10
|
+
spans: [];
|
|
11
|
+
}
|
|
12
|
+
];
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { RichTextField } from "./richText";
|
|
2
|
+
import type { TitleField } from "./title";
|
|
3
|
+
import type { ImageField } from "./image";
|
|
4
|
+
import type { ContentRelationshipField } from "./contentRelationship";
|
|
5
|
+
import type { LinkField } from "./link";
|
|
6
|
+
import type { LinkToMediaField } from "./linkToMedia";
|
|
7
|
+
import type { EmbedField } from "./embed";
|
|
8
|
+
import type { BooleanField } from "./boolean";
|
|
9
|
+
import type { ColorField } from "./color";
|
|
10
|
+
import type { DateField } from "./date";
|
|
11
|
+
import type { KeyTextField } from "./keyText";
|
|
12
|
+
import type { NumberField } from "./number";
|
|
13
|
+
import type { SelectField } from "./select";
|
|
14
|
+
import type { TimestampField } from "./timestamp";
|
|
15
|
+
import type { GeoPointField } from "./geoPoint";
|
|
16
|
+
import type { IntegrationFields } from "./integrationFields";
|
|
17
|
+
/**
|
|
18
|
+
* Empty state for object-shaped fields.
|
|
19
|
+
*/
|
|
20
|
+
export declare type EmptyObjectField = Record<string, never>;
|
|
21
|
+
/**
|
|
22
|
+
* Valid states for fields. Not all fields use this type (e.g. BooleanField).
|
|
23
|
+
*/
|
|
24
|
+
export declare type FieldState = "empty" | "filled";
|
|
25
|
+
/**
|
|
26
|
+
* Any regular field that can be nested in a group-like field.
|
|
27
|
+
*/
|
|
28
|
+
export declare type AnyRegularField = TitleField | RichTextField | ImageField | ContentRelationshipField | LinkField | LinkToMediaField | EmbedField | DateField | TimestampField | ColorField | NumberField | KeyTextField | SelectField | BooleanField | GeoPointField | IntegrationFields;
|
|
29
|
+
/**
|
|
30
|
+
* Useful to flatten the type output to improve type hints shown in editors. And
|
|
31
|
+
* also to transform an interface into a type to aide with assignability.
|
|
32
|
+
*
|
|
33
|
+
* Taken from the `type-fest` package.
|
|
34
|
+
*
|
|
35
|
+
* @typeParam T - The type to simplify.
|
|
36
|
+
* @see https://github.com/sindresorhus/type-fest/blob/cbd7ec510bd136ac045bbc74e391ee686b8a9a2f/source/simplify.d.ts
|
|
37
|
+
*/
|
|
38
|
+
export declare type Simplify<T> = {
|
|
39
|
+
[P in keyof T]: T[P];
|
|
40
|
+
};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { WebhookBodyBase, WebhookType } from "./types";
|
|
2
|
+
/**
|
|
3
|
+
* Webhook payload sent when a Prismic repository content is updated.
|
|
4
|
+
*
|
|
5
|
+
* @see More details: {@link https://prismic.io/docs/core-concepts/webhooks}
|
|
6
|
+
*/
|
|
7
|
+
export interface WebhookBodyAPIUpdate extends WebhookBodyBase {
|
|
8
|
+
type: typeof WebhookType.APIUpdate;
|
|
9
|
+
masterRef?: string;
|
|
10
|
+
releases: WebhookBodyAPIUpdateOperations<WebhookBodyAPIUpdateRelease>;
|
|
11
|
+
masks: WebhookBodyAPIUpdateOperations<WebhookBodyAPIUpdateMask>;
|
|
12
|
+
tags: WebhookBodyAPIUpdateOperations<WebhookBodyAPIUpdateTag>;
|
|
13
|
+
documents: string[];
|
|
14
|
+
/**
|
|
15
|
+
* @deprecated Experiments are no longer supported by Prismic.
|
|
16
|
+
*/
|
|
17
|
+
experiments?: WebhookBodyAPIUpdateOperations<unknown>;
|
|
18
|
+
}
|
|
19
|
+
interface WebhookBodyAPIUpdateOperations<T> {
|
|
20
|
+
update?: T[];
|
|
21
|
+
addition?: T[];
|
|
22
|
+
deletion?: T[];
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Metadata representing a mask (also called a Custom Type).
|
|
26
|
+
*
|
|
27
|
+
* @see More details: {@link https://prismic.io/docs/core-concepts/custom-types}
|
|
28
|
+
*/
|
|
29
|
+
interface WebhookBodyAPIUpdateMask {
|
|
30
|
+
id: string;
|
|
31
|
+
label: string;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Metadata representing a tag.
|
|
35
|
+
*
|
|
36
|
+
* @see More details: {@link https://prismic.io/docs/core-concepts/document-tags}
|
|
37
|
+
*/
|
|
38
|
+
interface WebhookBodyAPIUpdateTag {
|
|
39
|
+
id: string;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Metadata representing a Release.
|
|
43
|
+
*
|
|
44
|
+
* @see More details: {@link https://prismic.io/docs/core-concepts/draft-plan-and-schedule-content#releases}
|
|
45
|
+
*/
|
|
46
|
+
interface WebhookBodyAPIUpdateRelease {
|
|
47
|
+
id: string;
|
|
48
|
+
ref: string;
|
|
49
|
+
label: string;
|
|
50
|
+
documents: string[];
|
|
51
|
+
}
|
|
52
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { WebhookBodyBase, WebhookType } from "./types";
|
|
2
|
+
/**
|
|
3
|
+
* Webhook payload sent when a test webhook action is triggered.
|
|
4
|
+
*
|
|
5
|
+
* @see More details: {@link https://prismic.io/docs/core-concepts/webhooks}
|
|
6
|
+
*/
|
|
7
|
+
export interface WebhookBodyTestTrigger extends WebhookBodyBase {
|
|
8
|
+
type: typeof WebhookType.TestTrigger;
|
|
9
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3
|
+
const WebhookType = {
|
|
4
|
+
APIUpdate: "api-update",
|
|
5
|
+
TestTrigger: "test-trigger"
|
|
6
|
+
};
|
|
7
|
+
exports.WebhookType = WebhookType;
|
|
8
|
+
//# sourceMappingURL=types.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.cjs","sources":["../../../src/types/webhook/types.ts"],"sourcesContent":["import { WebhookBodyAPIUpdate } from \"./apiUpdate\";\nimport { WebhookBodyTestTrigger } from \"./testTrigger\";\n\nexport type WebhookBody = WebhookBodyAPIUpdate | WebhookBodyTestTrigger;\n\n/**\n * Types of Prismic Webhooks.\n *\n * @see More details: {@link https://prismic.io/docs/core-concepts/webhooks}\n */\nexport const WebhookType = {\n\tAPIUpdate: \"api-update\",\n\tTestTrigger: \"test-trigger\",\n} as const;\n\nexport interface WebhookBodyBase {\n\ttype: typeof WebhookType[keyof typeof WebhookType];\n\tdomain: string;\n\tapiUrl: string;\n\tsecret: string | null;\n}\n"],"names":[],"mappings":";;AAUO,MAAM,cAAc;AAAA,EAC1B,WAAW;AAAA,EACX,aAAa;;;"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { WebhookBodyAPIUpdate } from "./apiUpdate";
|
|
2
|
+
import { WebhookBodyTestTrigger } from "./testTrigger";
|
|
3
|
+
export declare type WebhookBody = WebhookBodyAPIUpdate | WebhookBodyTestTrigger;
|
|
4
|
+
/**
|
|
5
|
+
* Types of Prismic Webhooks.
|
|
6
|
+
*
|
|
7
|
+
* @see More details: {@link https://prismic.io/docs/core-concepts/webhooks}
|
|
8
|
+
*/
|
|
9
|
+
export declare const WebhookType: {
|
|
10
|
+
readonly APIUpdate: "api-update";
|
|
11
|
+
readonly TestTrigger: "test-trigger";
|
|
12
|
+
};
|
|
13
|
+
export interface WebhookBodyBase {
|
|
14
|
+
type: typeof WebhookType[keyof typeof WebhookType];
|
|
15
|
+
domain: string;
|
|
16
|
+
apiUrl: string;
|
|
17
|
+
secret: string | null;
|
|
18
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sources":["../../../src/types/webhook/types.ts"],"sourcesContent":["import { WebhookBodyAPIUpdate } from \"./apiUpdate\";\nimport { WebhookBodyTestTrigger } from \"./testTrigger\";\n\nexport type WebhookBody = WebhookBodyAPIUpdate | WebhookBodyTestTrigger;\n\n/**\n * Types of Prismic Webhooks.\n *\n * @see More details: {@link https://prismic.io/docs/core-concepts/webhooks}\n */\nexport const WebhookType = {\n\tAPIUpdate: \"api-update\",\n\tTestTrigger: \"test-trigger\",\n} as const;\n\nexport interface WebhookBodyBase {\n\ttype: typeof WebhookType[keyof typeof WebhookType];\n\tdomain: string;\n\tapiUrl: string;\n\tsecret: string | null;\n}\n"],"names":[],"mappings":"AAUO,MAAM,cAAc;AAAA,EAC1B,WAAW;AAAA,EACX,aAAa;;"}
|
package/package.json
CHANGED
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prismicio/client",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "7.0.0-alpha.0",
|
|
4
4
|
"description": "The official JavaScript + TypeScript client library for Prismic",
|
|
5
5
|
"keywords": [
|
|
6
|
-
"
|
|
7
|
-
"
|
|
6
|
+
"typescript",
|
|
7
|
+
"client",
|
|
8
|
+
"helpers",
|
|
9
|
+
"types",
|
|
10
|
+
"utils",
|
|
11
|
+
"toolbox",
|
|
8
12
|
"cms",
|
|
9
|
-
"
|
|
10
|
-
"
|
|
11
|
-
"typescript"
|
|
13
|
+
"prismic",
|
|
14
|
+
"prismic.io"
|
|
12
15
|
],
|
|
13
16
|
"repository": {
|
|
14
17
|
"type": "git",
|
|
@@ -34,49 +37,53 @@
|
|
|
34
37
|
"src"
|
|
35
38
|
],
|
|
36
39
|
"scripts": {
|
|
37
|
-
"build": "
|
|
38
|
-
"dev": "
|
|
39
|
-
"format": "prettier --write
|
|
40
|
-
"lint": "eslint --ext .js,.ts .",
|
|
40
|
+
"build": "vite build",
|
|
41
|
+
"dev": "vite build --watch",
|
|
42
|
+
"format": "prettier --write .",
|
|
41
43
|
"prepare": "npm run build",
|
|
42
|
-
"release": "npm run
|
|
43
|
-
"release:beta": "npm run build && npm run test && standard-version --release-as major --prerelease beta && git push --follow-tags && npm run build && npm publish --tag beta",
|
|
44
|
-
"release:beta:dry": "standard-version --release-as major --prerelease beta --dry-run",
|
|
44
|
+
"release": "npm run test && standard-version && git push --follow-tags && npm run build && npm publish",
|
|
45
45
|
"release:dry": "standard-version --dry-run",
|
|
46
|
-
"
|
|
47
|
-
"
|
|
46
|
+
"release:alpha": "npm run test && standard-version --release-as major --prerelease alpha && git push --follow-tags && npm run build && npm publish --tag alpha",
|
|
47
|
+
"release:alpha:dry": "standard-version --release-as major --prerelease alpha --dry-run",
|
|
48
|
+
"lint": "eslint --ext .js,.ts .",
|
|
49
|
+
"types": "tsc --noEmit",
|
|
48
50
|
"unit": "vitest run --coverage",
|
|
49
|
-
"unit:watch": "vitest watch"
|
|
51
|
+
"unit:watch": "vitest watch",
|
|
52
|
+
"size": "size-limit",
|
|
53
|
+
"test": "npm run lint && npm run types && npm run unit && npm run build && npm run size"
|
|
50
54
|
},
|
|
51
55
|
"dependencies": {
|
|
52
|
-
"@prismicio/
|
|
53
|
-
"
|
|
56
|
+
"@prismicio/richtext": "^2.1.1",
|
|
57
|
+
"escape-html": "^1.0.3",
|
|
58
|
+
"imgix-url-builder": "^0.0.3"
|
|
54
59
|
},
|
|
55
60
|
"devDependencies": {
|
|
56
61
|
"@prismicio/mock": "^0.1.1",
|
|
57
|
-
"@
|
|
58
|
-
"@
|
|
59
|
-
"@
|
|
60
|
-
"@typescript-eslint/
|
|
61
|
-
"@
|
|
62
|
+
"@prismicio/types-internal": "^1.1.1",
|
|
63
|
+
"@size-limit/preset-small-lib": "^8.1.0",
|
|
64
|
+
"@types/escape-html": "^1.0.2",
|
|
65
|
+
"@typescript-eslint/eslint-plugin": "^5.39.0",
|
|
66
|
+
"@typescript-eslint/parser": "^5.39.0",
|
|
67
|
+
"@vitest/coverage-c8": "^0.23.4",
|
|
62
68
|
"abort-controller": "^3.0.0",
|
|
63
|
-
"eslint": "^8.
|
|
69
|
+
"eslint": "^8.24.0",
|
|
64
70
|
"eslint-config-prettier": "^8.5.0",
|
|
65
71
|
"eslint-plugin-prettier": "^4.2.1",
|
|
66
|
-
"eslint-plugin-tsdoc": "^0.2.
|
|
67
|
-
"msw": "^0.
|
|
72
|
+
"eslint-plugin-tsdoc": "^0.2.17",
|
|
73
|
+
"msw": "^0.47.4",
|
|
68
74
|
"node-fetch": "^3.2.10",
|
|
69
|
-
"nyc": "^15.1.0",
|
|
70
75
|
"prettier": "^2.7.1",
|
|
71
|
-
"prettier-plugin-jsdoc": "^0.
|
|
72
|
-
"
|
|
73
|
-
"size-limit": "^8.0.1",
|
|
76
|
+
"prettier-plugin-jsdoc": "^0.4.2",
|
|
77
|
+
"size-limit": "^8.1.0",
|
|
74
78
|
"standard-version": "^9.5.0",
|
|
75
|
-
"
|
|
76
|
-
"
|
|
79
|
+
"ts-expect": "^1.3.0",
|
|
80
|
+
"typescript": "^4.8.4",
|
|
81
|
+
"vite": "^3.1.4",
|
|
82
|
+
"vite-plugin-sdk": "^0.0.3",
|
|
83
|
+
"vitest": "^0.23.4"
|
|
77
84
|
},
|
|
78
85
|
"engines": {
|
|
79
|
-
"node": ">=
|
|
86
|
+
"node": ">=14.15.0"
|
|
80
87
|
},
|
|
81
88
|
"publishConfig": {
|
|
82
89
|
"access": "public"
|
package/src/buildQueryURL.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { castArray } from "./lib/castArray";
|
|
2
2
|
|
|
3
|
-
import { ValueOf
|
|
3
|
+
import type { ValueOf } from "./types/utils";
|
|
4
|
+
import type { Ordering, Route } from "./types/client";
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* Parameters for the Prismic REST API V2.
|
|
@@ -33,7 +34,8 @@ export interface QueryParams {
|
|
|
33
34
|
|
|
34
35
|
/**
|
|
35
36
|
* The `after` parameter can be used along with the orderings option. It will
|
|
36
|
-
* remove all the documents except for those after the specified document in
|
|
37
|
+
* remove all the documents except for those after the specified document in
|
|
38
|
+
* the list.
|
|
37
39
|
*
|
|
38
40
|
* {@link https://prismic.io/docs/technologies/search-parameters-reference-rest-api#after}
|
|
39
41
|
*/
|
|
@@ -57,7 +59,8 @@ export interface QueryParams {
|
|
|
57
59
|
|
|
58
60
|
/**
|
|
59
61
|
* The `graphQuery` parameter allows you to specify which fields to retrieve
|
|
60
|
-
* and what content to retrieve from Linked Documents / Content
|
|
62
|
+
* and what content to retrieve from Linked Documents / Content
|
|
63
|
+
* Relationships.
|
|
61
64
|
*
|
|
62
65
|
* {@link https://prismic.io/docs/technologies/graphquery-rest-api}
|
|
63
66
|
*/
|
|
@@ -79,7 +82,8 @@ export interface QueryParams {
|
|
|
79
82
|
orderings?: Ordering | string | (Ordering | string)[];
|
|
80
83
|
|
|
81
84
|
/**
|
|
82
|
-
* The `routes` option allows you to define how a document's `url` field is
|
|
85
|
+
* The `routes` option allows you to define how a document's `url` field is
|
|
86
|
+
* resolved.
|
|
83
87
|
*
|
|
84
88
|
* {@link https://prismic.io/docs/core-concepts/link-resolver-route-resolver#route-resolver}
|
|
85
89
|
*/
|