@prismicio/client 7.7.2 → 7.7.4
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/README.md +3 -3
- package/dist/buildQueryURL.cjs.map +1 -1
- package/dist/buildQueryURL.d.ts +1 -1
- package/dist/buildQueryURL.js.map +1 -1
- package/dist/cookie.cjs.map +1 -1
- package/dist/cookie.js.map +1 -1
- package/dist/createClient.cjs +31 -31
- package/dist/createClient.cjs.map +1 -1
- package/dist/createClient.d.ts +35 -35
- package/dist/createClient.js +31 -31
- package/dist/createClient.js.map +1 -1
- package/dist/errors/ForbiddenError.cjs.map +1 -1
- package/dist/errors/ForbiddenError.js.map +1 -1
- package/dist/errors/NotFoundError.cjs.map +1 -1
- package/dist/errors/NotFoundError.js.map +1 -1
- package/dist/errors/ParsingError.cjs.map +1 -1
- package/dist/errors/ParsingError.js.map +1 -1
- package/dist/errors/PreviewTokenExpired.cjs.map +1 -1
- package/dist/errors/PreviewTokenExpired.js.map +1 -1
- package/dist/errors/PrismicError.cjs.map +1 -1
- package/dist/errors/PrismicError.js.map +1 -1
- package/dist/errors/PrismicRichTextSerializerError.cjs.map +1 -1
- package/dist/errors/PrismicRichTextSerializerError.js.map +1 -1
- package/dist/errors/RefExpiredError.cjs.map +1 -1
- package/dist/errors/RefExpiredError.js.map +1 -1
- package/dist/errors/RefNotFoundError.cjs.map +1 -1
- package/dist/errors/RefNotFoundError.js.map +1 -1
- package/dist/errors/RepositoryNotFoundError.cjs.map +1 -1
- package/dist/errors/RepositoryNotFoundError.js.map +1 -1
- package/dist/filter.cjs.map +1 -1
- package/dist/filter.js.map +1 -1
- package/dist/getGraphQLEndpoint.cjs.map +1 -1
- package/dist/getGraphQLEndpoint.js.map +1 -1
- package/dist/getRepositoryEndpoint.cjs.map +1 -1
- package/dist/getRepositoryEndpoint.js.map +1 -1
- package/dist/getRepositoryName.cjs.map +1 -1
- package/dist/getRepositoryName.js.map +1 -1
- package/dist/getToolbarSrc.cjs.map +1 -1
- package/dist/getToolbarSrc.js.map +1 -1
- package/dist/helpers/asDate.cjs.map +1 -1
- package/dist/helpers/asDate.js.map +1 -1
- package/dist/helpers/asHTML.cjs.map +1 -1
- package/dist/helpers/asHTML.d.ts +2 -2
- package/dist/helpers/asHTML.js.map +1 -1
- package/dist/helpers/asImagePixelDensitySrcSet.cjs.map +1 -1
- package/dist/helpers/asImagePixelDensitySrcSet.d.ts +2 -2
- package/dist/helpers/asImagePixelDensitySrcSet.js.map +1 -1
- package/dist/helpers/asImageSrc.cjs.map +1 -1
- package/dist/helpers/asImageSrc.d.ts +2 -2
- package/dist/helpers/asImageSrc.js.map +1 -1
- package/dist/helpers/asImageWidthSrcSet.cjs.map +1 -1
- package/dist/helpers/asImageWidthSrcSet.d.ts +2 -2
- package/dist/helpers/asImageWidthSrcSet.js.map +1 -1
- package/dist/helpers/asLink.cjs.map +1 -1
- package/dist/helpers/asLink.d.ts +2 -4
- package/dist/helpers/asLink.js.map +1 -1
- package/dist/helpers/asLinkAttrs.cjs.map +1 -1
- package/dist/helpers/asLinkAttrs.d.ts +2 -2
- package/dist/helpers/asLinkAttrs.js.map +1 -1
- package/dist/helpers/asText.cjs.map +1 -1
- package/dist/helpers/asText.d.ts +1 -1
- 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.map +1 -1
- package/dist/helpers/isFilled.js.map +1 -1
- package/dist/helpers/mapSliceZone.cjs.map +1 -1
- package/dist/helpers/mapSliceZone.d.ts +1 -1
- package/dist/helpers/mapSliceZone.js.map +1 -1
- package/dist/helpers/unstable_htmlAsRichText.cjs.map +1 -1
- package/dist/helpers/unstable_htmlAsRichText.d.ts +4 -4
- package/dist/helpers/unstable_htmlAsRichText.js.map +1 -1
- package/dist/helpers/unstable_markdownAsRichText.cjs.map +1 -1
- package/dist/helpers/unstable_markdownAsRichText.d.ts +2 -2
- package/dist/helpers/unstable_markdownAsRichText.js.map +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/isRepositoryEndpoint.cjs.map +1 -1
- package/dist/isRepositoryEndpoint.js.map +1 -1
- package/dist/isRepositoryName.cjs.map +1 -1
- package/dist/isRepositoryName.js.map +1 -1
- package/dist/lib/RichTextFieldBuilder.cjs.map +1 -1
- package/dist/lib/RichTextFieldBuilder.d.ts +1 -1
- package/dist/lib/RichTextFieldBuilder.js.map +1 -1
- package/dist/lib/appendFilters.cjs.map +1 -1
- package/dist/lib/appendFilters.js.map +1 -1
- package/dist/lib/castArray.cjs.map +1 -1
- package/dist/lib/castArray.js.map +1 -1
- package/dist/lib/castThunk.cjs.map +1 -1
- package/dist/lib/castThunk.js.map +1 -1
- package/dist/lib/devMsg.cjs.map +1 -1
- package/dist/lib/devMsg.d.ts +1 -1
- package/dist/lib/devMsg.js.map +1 -1
- package/dist/lib/escapeHTML.cjs.map +1 -1
- package/dist/lib/escapeHTML.js.map +1 -1
- package/dist/lib/everyTagFilter.cjs.map +1 -1
- package/dist/lib/everyTagFilter.js.map +1 -1
- package/dist/lib/filterRichTextField.cjs.map +1 -1
- package/dist/lib/filterRichTextField.d.ts +3 -3
- package/dist/lib/filterRichTextField.js.map +1 -1
- package/dist/lib/findMasterRef.cjs.map +1 -1
- package/dist/lib/findMasterRef.d.ts +1 -1
- package/dist/lib/findMasterRef.js.map +1 -1
- package/dist/lib/findRef.cjs.map +1 -1
- package/dist/lib/findRef.d.ts +1 -1
- package/dist/lib/findRef.js.map +1 -1
- package/dist/lib/findRefByID.cjs.map +1 -1
- package/dist/lib/findRefByID.d.ts +1 -1
- package/dist/lib/findRefByID.js.map +1 -1
- package/dist/lib/findRefByLabel.cjs.map +1 -1
- package/dist/lib/findRefByLabel.d.ts +1 -1
- package/dist/lib/findRefByLabel.js.map +1 -1
- package/dist/lib/getPreviewCookie.cjs.map +1 -1
- package/dist/lib/getPreviewCookie.js.map +1 -1
- package/dist/lib/hastSerializerHelpers.cjs.map +1 -1
- package/dist/lib/hastSerializerHelpers.d.ts +3 -3
- package/dist/lib/hastSerializerHelpers.js.map +1 -1
- package/dist/lib/hastToRichText.cjs +3 -4
- package/dist/lib/hastToRichText.cjs.map +1 -1
- package/dist/lib/hastToRichText.d.ts +4 -4
- package/dist/lib/hastToRichText.js +3 -4
- package/dist/lib/hastToRichText.js.map +1 -1
- package/dist/lib/isInternalURL.cjs.map +1 -1
- package/dist/lib/isInternalURL.js.map +1 -1
- package/dist/lib/minifyGraphQLQuery.cjs.map +1 -1
- package/dist/lib/minifyGraphQLQuery.js.map +1 -1
- package/dist/lib/rehypeRichText.cjs.map +1 -1
- package/dist/lib/rehypeRichText.d.ts +5 -5
- package/dist/lib/rehypeRichText.js.map +1 -1
- package/dist/lib/serializerHelpers.cjs.map +1 -1
- package/dist/lib/serializerHelpers.d.ts +2 -2
- package/dist/lib/serializerHelpers.js.map +1 -1
- package/dist/lib/someTagsFilter.cjs.map +1 -1
- package/dist/lib/someTagsFilter.js.map +1 -1
- package/dist/lib/typeFilter.cjs.map +1 -1
- package/dist/lib/typeFilter.js.map +1 -1
- package/dist/package.json.cjs +1 -1
- package/dist/package.json.js +1 -1
- package/dist/richtext/asText.cjs.map +1 -1
- package/dist/richtext/asText.d.ts +1 -1
- package/dist/richtext/asText.js.map +1 -1
- package/dist/richtext/asTree.cjs.map +1 -1
- package/dist/richtext/asTree.d.ts +2 -2
- package/dist/richtext/asTree.js.map +1 -1
- package/dist/richtext/composeSerializers.cjs.map +1 -1
- package/dist/richtext/composeSerializers.d.ts +1 -1
- package/dist/richtext/composeSerializers.js.map +1 -1
- package/dist/richtext/serialize.cjs.map +1 -1
- package/dist/richtext/serialize.d.ts +1 -1
- package/dist/richtext/serialize.js.map +1 -1
- package/dist/richtext/types.cjs.map +1 -1
- package/dist/richtext/types.d.ts +1 -1
- package/dist/richtext/types.js.map +1 -1
- package/dist/richtext/wrapMapSerializer.cjs.map +1 -1
- package/dist/richtext/wrapMapSerializer.d.ts +1 -1
- package/dist/richtext/wrapMapSerializer.js.map +1 -1
- package/dist/types/api/query.d.ts +1 -1
- package/dist/types/api/release.d.ts +1 -1
- package/dist/types/api/repository.d.ts +1 -1
- package/dist/types/model/customType.d.ts +1 -1
- package/dist/types/model/link.cjs.map +1 -1
- package/dist/types/model/link.js.map +1 -1
- package/dist/types/model/slice.cjs.map +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.js.map +1 -1
- package/dist/types/model/title.d.ts +1 -1
- package/dist/types/model/types.cjs.map +1 -1
- package/dist/types/model/types.js.map +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.js.map +1 -1
- package/dist/types/value/link.cjs.map +1 -1
- package/dist/types/value/link.js.map +1 -1
- package/dist/types/value/richText.cjs.map +1 -1
- package/dist/types/value/richText.js.map +1 -1
- package/dist/types/webhook/apiUpdate.d.ts +1 -1
- package/dist/types/webhook/testTrigger.d.ts +1 -1
- package/dist/types/webhook/types.cjs.map +1 -1
- package/dist/types/webhook/types.d.ts +2 -2
- package/dist/types/webhook/types.js.map +1 -1
- package/package.json +1 -1
- package/src/buildQueryURL.ts +51 -51
- package/src/cookie.ts +1 -1
- package/src/createClient.ts +293 -293
- package/src/errors/ForbiddenError.ts +6 -6
- package/src/errors/NotFoundError.ts +1 -1
- package/src/errors/ParsingError.ts +8 -8
- package/src/errors/PreviewTokenExpired.ts +4 -4
- package/src/errors/PrismicError.ts +5 -5
- package/src/errors/PrismicRichTextSerializerError.ts +1 -1
- package/src/errors/RefExpiredError.ts +4 -4
- package/src/errors/RefNotFoundError.ts +4 -4
- package/src/errors/RepositoryNotFoundError.ts +1 -1
- package/src/filter.ts +22 -22
- package/src/getGraphQLEndpoint.ts +5 -5
- package/src/getRepositoryEndpoint.ts +5 -5
- package/src/getRepositoryName.ts +4 -4
- package/src/getToolbarSrc.ts +5 -5
- package/src/helpers/asDate.ts +7 -7
- package/src/helpers/asHTML.ts +54 -56
- package/src/helpers/asImagePixelDensitySrcSet.ts +14 -17
- package/src/helpers/asImageSrc.ts +9 -8
- package/src/helpers/asImageWidthSrcSet.ts +19 -22
- package/src/helpers/asLink.ts +26 -27
- package/src/helpers/asLinkAttrs.ts +30 -29
- package/src/helpers/asText.ts +15 -15
- package/src/helpers/documentToLinkField.ts +6 -6
- package/src/helpers/isFilled.ts +53 -53
- package/src/helpers/mapSliceZone.ts +34 -34
- package/src/helpers/unstable_htmlAsRichText.ts +23 -22
- package/src/helpers/unstable_markdownAsRichText.ts +14 -13
- package/src/index.ts +119 -119
- package/src/isRepositoryEndpoint.ts +4 -4
- package/src/isRepositoryName.ts +2 -2
- package/src/lib/RichTextFieldBuilder.ts +36 -41
- package/src/lib/appendFilters.ts +4 -4
- package/src/lib/castArray.ts +2 -2
- package/src/lib/castThunk.ts +2 -2
- package/src/lib/devMsg.ts +4 -4
- package/src/lib/escapeHTML.ts +24 -24
- package/src/lib/everyTagFilter.ts +4 -4
- package/src/lib/filterRichTextField.ts +31 -31
- package/src/lib/findMasterRef.ts +4 -4
- package/src/lib/findRef.ts +6 -6
- package/src/lib/findRefByID.ts +4 -4
- package/src/lib/findRefByLabel.ts +4 -4
- package/src/lib/getPreviewCookie.ts +11 -11
- package/src/lib/hastSerializerHelpers.ts +41 -37
- package/src/lib/hastToRichText.ts +74 -73
- package/src/lib/isInternalURL.ts +4 -4
- package/src/lib/minifyGraphQLQuery.ts +2 -2
- package/src/lib/rehypeRichText.ts +42 -41
- package/src/lib/serializerHelpers.ts +53 -54
- package/src/lib/someTagsFilter.ts +4 -4
- package/src/lib/typeFilter.ts +3 -3
- package/src/richtext/asText.ts +5 -5
- package/src/richtext/asTree.ts +53 -53
- package/src/richtext/composeSerializers.ts +6 -6
- package/src/richtext/index.ts +7 -7
- package/src/richtext/serialize.ts +11 -11
- package/src/richtext/types.ts +38 -38
- package/src/richtext/wrapMapSerializer.ts +6 -9
- package/src/types/api/query.ts +9 -9
- package/src/types/api/ref.ts +5 -5
- package/src/types/api/release.ts +2 -2
- package/src/types/api/repository.ts +24 -24
- package/src/types/api/tags.ts +1 -1
- package/src/types/model/boolean.ts +7 -7
- package/src/types/model/color.ts +5 -5
- package/src/types/model/contentRelationship.ts +9 -9
- package/src/types/model/customType.ts +9 -9
- package/src/types/model/date.ts +6 -6
- package/src/types/model/embed.ts +5 -5
- package/src/types/model/geoPoint.ts +4 -4
- package/src/types/model/group.ts +6 -6
- package/src/types/model/image.ts +9 -9
- package/src/types/model/integration.ts +6 -6
- package/src/types/model/keyText.ts +5 -5
- package/src/types/model/link.ts +8 -8
- package/src/types/model/linkToMedia.ts +7 -7
- package/src/types/model/number.ts +7 -7
- package/src/types/model/range.ts +8 -8
- package/src/types/model/richText.ts +16 -16
- package/src/types/model/select.ts +7 -7
- package/src/types/model/separator.ts +4 -4
- package/src/types/model/sharedSlice.ts +7 -7
- package/src/types/model/sharedSliceVariation.ts +9 -9
- package/src/types/model/slice.ts +12 -12
- package/src/types/model/sliceZone.ts +11 -11
- package/src/types/model/timestamp.ts +6 -6
- package/src/types/model/title.ts +2 -2
- package/src/types/model/types.ts +26 -26
- package/src/types/model/uid.ts +5 -5
- package/src/types/value/boolean.ts +1 -1
- package/src/types/value/color.ts +2 -2
- package/src/types/value/contentRelationship.ts +15 -15
- package/src/types/value/date.ts +2 -2
- package/src/types/value/document.ts +23 -23
- package/src/types/value/embed.ts +33 -33
- package/src/types/value/geoPoint.ts +4 -4
- package/src/types/value/group.ts +3 -3
- package/src/types/value/image.ts +21 -21
- package/src/types/value/integration.ts +2 -2
- package/src/types/value/keyText.ts +2 -2
- package/src/types/value/link.ts +12 -12
- package/src/types/value/linkToMedia.ts +11 -11
- package/src/types/value/number.ts +2 -2
- package/src/types/value/richText.ts +58 -58
- package/src/types/value/select.ts +2 -2
- package/src/types/value/sharedSlice.ts +5 -5
- package/src/types/value/sharedSliceVariation.ts +5 -5
- package/src/types/value/slice.ts +6 -6
- package/src/types/value/sliceZone.ts +4 -4
- package/src/types/value/timestamp.ts +3 -3
- package/src/types/value/title.ts +4 -4
- package/src/types/value/types.ts +22 -22
- package/src/types/webhook/apiUpdate.ts +18 -18
- package/src/types/webhook/testTrigger.ts +2 -2
- package/src/types/webhook/types.ts +8 -8
- package/dist/_node_modules/hast-util-whitespace/lib/index.cjs +0 -11
- package/dist/_node_modules/hast-util-whitespace/lib/index.cjs.map +0 -1
- package/dist/_node_modules/hast-util-whitespace/lib/index.js +0 -11
- package/dist/_node_modules/hast-util-whitespace/lib/index.js.map +0 -1
package/src/types/value/date.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { FieldState } from "./types"
|
|
1
|
+
import type { FieldState } from "./types"
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* A date field.
|
|
@@ -8,4 +8,4 @@ import type { FieldState } from "./types";
|
|
|
8
8
|
* @see More details: {@link https://prismic.io/docs/date}
|
|
9
9
|
*/
|
|
10
10
|
export type DateField<State extends FieldState = FieldState> =
|
|
11
|
-
State extends "empty" ? null : `${number}-${number}-${number}
|
|
11
|
+
State extends "empty" ? null : `${number}-${number}-${number}`
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { AnyRegularField } from "./types"
|
|
1
|
+
import type { AnyRegularField } from "./types"
|
|
2
2
|
|
|
3
|
-
import { GroupField } from "./group"
|
|
4
|
-
import { SliceZone } from "./sliceZone"
|
|
5
|
-
import { TimestampField } from "./timestamp"
|
|
3
|
+
import type { GroupField } from "./group"
|
|
4
|
+
import type { SliceZone } from "./sliceZone"
|
|
5
|
+
import type { TimestampField } from "./timestamp"
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Document metadata for a translation of a Prismic document.
|
|
9
9
|
*/
|
|
10
10
|
export interface AlternateLanguage<TypeEnum = string, LangEnum = string> {
|
|
11
|
-
id: string
|
|
12
|
-
uid?: string
|
|
13
|
-
type: TypeEnum
|
|
14
|
-
lang: LangEnum
|
|
11
|
+
id: string
|
|
12
|
+
uid?: string
|
|
13
|
+
type: TypeEnum
|
|
14
|
+
lang: LangEnum
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
/**
|
|
@@ -22,36 +22,36 @@ export interface PrismicDocumentHeader<TypeEnum = string, LangEnum = string> {
|
|
|
22
22
|
* The unique identifier for the document. Guaranteed to be unique among all
|
|
23
23
|
* documents in the Prismic repository.
|
|
24
24
|
*/
|
|
25
|
-
id: string
|
|
25
|
+
id: string
|
|
26
26
|
/**
|
|
27
27
|
* The unique identifier for the document. Guaranteed to be unique among all
|
|
28
28
|
* Prismic documents of the same type.
|
|
29
29
|
*/
|
|
30
|
-
uid: string | null
|
|
30
|
+
uid: string | null
|
|
31
31
|
/**
|
|
32
32
|
* Url that refers to document.
|
|
33
33
|
*/
|
|
34
|
-
url: string | null
|
|
34
|
+
url: string | null
|
|
35
35
|
/**
|
|
36
36
|
* Type of the document.
|
|
37
37
|
*/
|
|
38
|
-
type: TypeEnum
|
|
38
|
+
type: TypeEnum
|
|
39
39
|
/**
|
|
40
40
|
* Href for document.
|
|
41
41
|
*/
|
|
42
|
-
href: string
|
|
42
|
+
href: string
|
|
43
43
|
/**
|
|
44
44
|
* Tags associated with document.
|
|
45
45
|
*/
|
|
46
|
-
tags: string[]
|
|
46
|
+
tags: string[]
|
|
47
47
|
/**
|
|
48
48
|
* The timestamp at which the document was first published.
|
|
49
49
|
*/
|
|
50
|
-
first_publication_date: TimestampField<"filled"
|
|
50
|
+
first_publication_date: TimestampField<"filled">
|
|
51
51
|
/**
|
|
52
52
|
* The timestamp at which the document was last published.
|
|
53
53
|
*/
|
|
54
|
-
last_publication_date: TimestampField<"filled"
|
|
54
|
+
last_publication_date: TimestampField<"filled">
|
|
55
55
|
/**
|
|
56
56
|
* Slugs associated with document.
|
|
57
57
|
*
|
|
@@ -59,19 +59,19 @@ export interface PrismicDocumentHeader<TypeEnum = string, LangEnum = string> {
|
|
|
59
59
|
* introduced. Migrate to the UID field. For more details, see
|
|
60
60
|
* https://community.prismic.io/t/what-are-slugs/6493
|
|
61
61
|
*/
|
|
62
|
-
slugs: string[]
|
|
62
|
+
slugs: string[]
|
|
63
63
|
/**
|
|
64
64
|
* Documents that are related to this document.
|
|
65
65
|
*/
|
|
66
|
-
linked_documents: unknown[]
|
|
66
|
+
linked_documents: unknown[] // TODO: Not sure of the type for this one
|
|
67
67
|
/**
|
|
68
68
|
* Language of document.
|
|
69
69
|
*/
|
|
70
|
-
lang: LangEnum
|
|
70
|
+
lang: LangEnum
|
|
71
71
|
/**
|
|
72
72
|
* Array to access alternate language versions for document.
|
|
73
73
|
*/
|
|
74
|
-
alternate_languages: AlternateLanguage<TypeEnum, LangEnum>[]
|
|
74
|
+
alternate_languages: AlternateLanguage<TypeEnum, LangEnum>[]
|
|
75
75
|
}
|
|
76
76
|
|
|
77
77
|
/**
|
|
@@ -91,7 +91,7 @@ export interface PrismicDocument<
|
|
|
91
91
|
/**
|
|
92
92
|
* Data contained in the document.
|
|
93
93
|
*/
|
|
94
|
-
data: DataInterface
|
|
94
|
+
data: DataInterface
|
|
95
95
|
}
|
|
96
96
|
|
|
97
97
|
/**
|
|
@@ -117,7 +117,7 @@ export interface PrismicDocumentWithoutUID<
|
|
|
117
117
|
* The unique identifier for the document. Guaranteed to be unique among all
|
|
118
118
|
* Prismic documents of the same type.
|
|
119
119
|
*/
|
|
120
|
-
uid: null
|
|
120
|
+
uid: null
|
|
121
121
|
}
|
|
122
122
|
|
|
123
123
|
/**
|
|
@@ -140,5 +140,5 @@ export interface PrismicDocumentWithUID<
|
|
|
140
140
|
* The unique identifier for the document. Guaranteed to be unique among all
|
|
141
141
|
* Prismic documents of the same type.
|
|
142
142
|
*/
|
|
143
|
-
uid: string
|
|
143
|
+
uid: string
|
|
144
144
|
}
|
package/src/types/value/embed.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { EmptyObjectField, FieldState } from "./types"
|
|
1
|
+
import type { EmptyObjectField, FieldState } from "./types"
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* oEmbed 1.0 possible types.
|
|
@@ -10,7 +10,7 @@ export const OEmbedType = {
|
|
|
10
10
|
Video: "video",
|
|
11
11
|
Link: "link",
|
|
12
12
|
Rich: "rich",
|
|
13
|
-
} as const
|
|
13
|
+
} as const
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
16
|
* oEmbed response base fields. Those are every mandatory fields an oEmbed
|
|
@@ -22,13 +22,13 @@ type OEmbedBase<TType extends (typeof OEmbedType)[keyof typeof OEmbedType]> = {
|
|
|
22
22
|
/**
|
|
23
23
|
* oEmbed resource type.
|
|
24
24
|
*/
|
|
25
|
-
type: TType
|
|
25
|
+
type: TType
|
|
26
26
|
|
|
27
27
|
/**
|
|
28
28
|
* oEmbed version number, this must be "1.0".
|
|
29
29
|
*/
|
|
30
|
-
version: string
|
|
31
|
-
}
|
|
30
|
+
version: string
|
|
31
|
+
}
|
|
32
32
|
|
|
33
33
|
/**
|
|
34
34
|
* oEmbed response extra fields. Those are every non-mandatory and unknown
|
|
@@ -40,47 +40,47 @@ export type OEmbedExtra = {
|
|
|
40
40
|
/**
|
|
41
41
|
* oEmbed text title, describing the resource.
|
|
42
42
|
*/
|
|
43
|
-
title?: string | null
|
|
43
|
+
title?: string | null
|
|
44
44
|
|
|
45
45
|
/**
|
|
46
46
|
* oEmbed resource author/owner name.
|
|
47
47
|
*/
|
|
48
|
-
author_name?: string | null
|
|
48
|
+
author_name?: string | null
|
|
49
49
|
|
|
50
50
|
/**
|
|
51
51
|
* oEmbed resource author/owner URL.
|
|
52
52
|
*/
|
|
53
|
-
author_url?: string | null
|
|
53
|
+
author_url?: string | null
|
|
54
54
|
|
|
55
55
|
/**
|
|
56
56
|
* oEmbed resource provider name.
|
|
57
57
|
*/
|
|
58
|
-
provider_name?: string | null
|
|
58
|
+
provider_name?: string | null
|
|
59
59
|
|
|
60
60
|
/**
|
|
61
61
|
* oEmbed resource provider URL.
|
|
62
62
|
*/
|
|
63
|
-
provider_url?: string | null
|
|
63
|
+
provider_url?: string | null
|
|
64
64
|
|
|
65
65
|
/**
|
|
66
66
|
* oEmbed suggested cache lifetime for the resource, in seconds.
|
|
67
67
|
*/
|
|
68
|
-
cache_age?: number | null
|
|
68
|
+
cache_age?: number | null
|
|
69
69
|
|
|
70
70
|
/**
|
|
71
71
|
* oEmbed resource thumbnail URL.
|
|
72
72
|
*/
|
|
73
|
-
thumbnail_url?: string | null
|
|
73
|
+
thumbnail_url?: string | null
|
|
74
74
|
|
|
75
75
|
/**
|
|
76
76
|
* oEmbed resource thumbnail width.
|
|
77
77
|
*/
|
|
78
|
-
thumbnail_width?: number | null
|
|
78
|
+
thumbnail_width?: number | null
|
|
79
79
|
|
|
80
80
|
/**
|
|
81
81
|
* oEmbed resource thumbnail height.
|
|
82
82
|
*/
|
|
83
|
-
thumbnail_height?: number | null
|
|
83
|
+
thumbnail_height?: number | null
|
|
84
84
|
|
|
85
85
|
/**
|
|
86
86
|
* Providers may optionally include any parameters not specified in this
|
|
@@ -90,8 +90,8 @@ export type OEmbedExtra = {
|
|
|
90
90
|
*
|
|
91
91
|
* @see oEmbed specification: {@link https://oembed.com}
|
|
92
92
|
*/
|
|
93
|
-
[key: string]: unknown | null
|
|
94
|
-
}
|
|
93
|
+
[key: string]: unknown | null
|
|
94
|
+
}
|
|
95
95
|
|
|
96
96
|
/**
|
|
97
97
|
* oEmbed photo type. Those are every mandatory fields an oEmbed photo response
|
|
@@ -103,18 +103,18 @@ export type PhotoOEmbed = OEmbedBase<typeof OEmbedType.Photo> & {
|
|
|
103
103
|
/**
|
|
104
104
|
* oEmbed source URL of the image.
|
|
105
105
|
*/
|
|
106
|
-
url: string
|
|
106
|
+
url: string
|
|
107
107
|
|
|
108
108
|
/**
|
|
109
109
|
* oEmbed width in pixels of the image.
|
|
110
110
|
*/
|
|
111
|
-
width: number
|
|
111
|
+
width: number
|
|
112
112
|
|
|
113
113
|
/**
|
|
114
114
|
* oEmbed height in pixels of the image.
|
|
115
115
|
*/
|
|
116
|
-
height: number
|
|
117
|
-
}
|
|
116
|
+
height: number
|
|
117
|
+
}
|
|
118
118
|
|
|
119
119
|
/**
|
|
120
120
|
* oEmbed video type. Those are every mandatory fields an oEmbed video response
|
|
@@ -126,18 +126,18 @@ export type VideoOEmbed = OEmbedBase<typeof OEmbedType.Video> & {
|
|
|
126
126
|
/**
|
|
127
127
|
* oEmbed HTML required to embed a video player.
|
|
128
128
|
*/
|
|
129
|
-
html: string
|
|
129
|
+
html: string
|
|
130
130
|
|
|
131
131
|
/**
|
|
132
132
|
* oEmbed width in pixels required to display the HTML.
|
|
133
133
|
*/
|
|
134
|
-
width: number
|
|
134
|
+
width: number
|
|
135
135
|
|
|
136
136
|
/**
|
|
137
137
|
* oEmbed height in pixels required to display the HTML.
|
|
138
138
|
*/
|
|
139
|
-
height: number
|
|
140
|
-
}
|
|
139
|
+
height: number
|
|
140
|
+
}
|
|
141
141
|
|
|
142
142
|
/**
|
|
143
143
|
* oEmbed link type. Those are every mandatory fields an oEmbed link response
|
|
@@ -145,7 +145,7 @@ export type VideoOEmbed = OEmbedBase<typeof OEmbedType.Video> & {
|
|
|
145
145
|
*
|
|
146
146
|
* @see oEmbed specification: {@link https://oembed.com}
|
|
147
147
|
*/
|
|
148
|
-
export type LinkOEmbed = OEmbedBase<typeof OEmbedType.Link
|
|
148
|
+
export type LinkOEmbed = OEmbedBase<typeof OEmbedType.Link>
|
|
149
149
|
|
|
150
150
|
/**
|
|
151
151
|
* oEmbed rich type. Those are every mandatory fields an oEmbed rich response
|
|
@@ -157,18 +157,18 @@ export type RichOEmbed = OEmbedBase<typeof OEmbedType.Rich> & {
|
|
|
157
157
|
/**
|
|
158
158
|
* oEmbed HTML required to display the resource.
|
|
159
159
|
*/
|
|
160
|
-
html: string
|
|
160
|
+
html: string
|
|
161
161
|
|
|
162
162
|
/**
|
|
163
163
|
* oEmbed width in pixels required to display the HTML.
|
|
164
164
|
*/
|
|
165
|
-
width: number
|
|
165
|
+
width: number
|
|
166
166
|
|
|
167
167
|
/**
|
|
168
168
|
* oEmbed height in pixels required to display the HTML.
|
|
169
169
|
*/
|
|
170
|
-
height: number
|
|
171
|
-
}
|
|
170
|
+
height: number
|
|
171
|
+
}
|
|
172
172
|
|
|
173
173
|
/**
|
|
174
174
|
* Any of the possible types of oEmbed response. Those contains only mandatory
|
|
@@ -176,7 +176,7 @@ export type RichOEmbed = OEmbedBase<typeof OEmbedType.Rich> & {
|
|
|
176
176
|
*
|
|
177
177
|
* @see oEmbed specification: {@link https://oembed.com}
|
|
178
178
|
*/
|
|
179
|
-
export type AnyOEmbed = PhotoOEmbed | VideoOEmbed | LinkOEmbed | RichOEmbed
|
|
179
|
+
export type AnyOEmbed = PhotoOEmbed | VideoOEmbed | LinkOEmbed | RichOEmbed
|
|
180
180
|
|
|
181
181
|
/**
|
|
182
182
|
* An embed field.
|
|
@@ -192,6 +192,6 @@ export type EmbedField<
|
|
|
192
192
|
> = State extends "empty"
|
|
193
193
|
? EmptyObjectField
|
|
194
194
|
: Data & {
|
|
195
|
-
embed_url: string
|
|
196
|
-
html: string | null
|
|
197
|
-
}
|
|
195
|
+
embed_url: string
|
|
196
|
+
html: string | null
|
|
197
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { EmptyObjectField, FieldState } from "./types"
|
|
1
|
+
import type { EmptyObjectField, FieldState } from "./types"
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* A geopoint field.
|
|
@@ -11,6 +11,6 @@ export type GeoPointField<State extends FieldState = FieldState> =
|
|
|
11
11
|
State extends "empty"
|
|
12
12
|
? EmptyObjectField
|
|
13
13
|
: {
|
|
14
|
-
latitude: number
|
|
15
|
-
longitude: number
|
|
16
|
-
}
|
|
14
|
+
latitude: number
|
|
15
|
+
longitude: number
|
|
16
|
+
}
|
package/src/types/value/group.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AnyRegularField, FieldState } from "./types"
|
|
1
|
+
import type { AnyRegularField, FieldState } from "./types"
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* A group field.
|
|
@@ -11,7 +11,7 @@ export type GroupField<
|
|
|
11
11
|
AnyRegularField | NestedGroupField
|
|
12
12
|
>,
|
|
13
13
|
State extends FieldState = FieldState,
|
|
14
|
-
> = State extends "empty" ? [] : [Fields, ...Fields[]]
|
|
14
|
+
> = State extends "empty" ? [] : [Fields, ...Fields[]]
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
17
|
* A nested group field.
|
|
@@ -24,4 +24,4 @@ export type NestedGroupField<
|
|
|
24
24
|
AnyRegularField
|
|
25
25
|
>,
|
|
26
26
|
State extends FieldState = FieldState,
|
|
27
|
-
> = GroupField<Fields, State
|
|
27
|
+
> = GroupField<Fields, State>
|
package/src/types/value/image.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { FieldState, Simplify } from "./types"
|
|
1
|
+
import type { FieldState, Simplify } from "./types"
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* An individual image within an image field. The base image and each thumbnail
|
|
@@ -9,32 +9,32 @@ import type { FieldState, Simplify } from "./types";
|
|
|
9
9
|
* @see {@link ImageField} for a full image field type.
|
|
10
10
|
*/
|
|
11
11
|
export type ImageFieldImage<State extends FieldState = FieldState> =
|
|
12
|
-
State extends "empty" ? EmptyImageFieldImage : FilledImageFieldImage
|
|
12
|
+
State extends "empty" ? EmptyImageFieldImage : FilledImageFieldImage
|
|
13
13
|
|
|
14
14
|
export interface FilledImageFieldImage {
|
|
15
|
-
id: string
|
|
16
|
-
url: string
|
|
15
|
+
id: string
|
|
16
|
+
url: string
|
|
17
17
|
dimensions: {
|
|
18
|
-
width: number
|
|
19
|
-
height: number
|
|
20
|
-
}
|
|
18
|
+
width: number
|
|
19
|
+
height: number
|
|
20
|
+
}
|
|
21
21
|
edit: {
|
|
22
|
-
x: number
|
|
23
|
-
y: number
|
|
24
|
-
zoom: number
|
|
25
|
-
background: string
|
|
26
|
-
}
|
|
27
|
-
alt: string | null
|
|
28
|
-
copyright: string | null
|
|
22
|
+
x: number
|
|
23
|
+
y: number
|
|
24
|
+
zoom: number
|
|
25
|
+
background: string
|
|
26
|
+
}
|
|
27
|
+
alt: string | null
|
|
28
|
+
copyright: string | null
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
export interface EmptyImageFieldImage {
|
|
32
|
-
id?: null
|
|
33
|
-
url?: null
|
|
34
|
-
dimensions?: null
|
|
35
|
-
edit?: null
|
|
36
|
-
alt?: null
|
|
37
|
-
copyright?: null
|
|
32
|
+
id?: null
|
|
33
|
+
url?: null
|
|
34
|
+
dimensions?: null
|
|
35
|
+
edit?: null
|
|
36
|
+
alt?: null
|
|
37
|
+
copyright?: null
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
/**
|
|
@@ -75,4 +75,4 @@ export type ImageField<
|
|
|
75
75
|
Record<Extract<ThumbnailNames, string>, ImageFieldImage<State>>
|
|
76
76
|
: ImageFieldImage<State> &
|
|
77
77
|
Record<Extract<ThumbnailNames, string>, ImageFieldImage<State>>
|
|
78
|
-
|
|
78
|
+
>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { FieldState } from "./types"
|
|
1
|
+
import type { FieldState } from "./types"
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* An integration field.
|
|
@@ -11,4 +11,4 @@ import type { FieldState } from "./types";
|
|
|
11
11
|
export type IntegrationField<
|
|
12
12
|
Data extends Record<string, unknown> = Record<string, unknown>,
|
|
13
13
|
State extends FieldState = FieldState,
|
|
14
|
-
> = State extends "empty" ? null : Data
|
|
14
|
+
> = State extends "empty" ? null : Data
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { FieldState } from "./types"
|
|
1
|
+
import type { FieldState } from "./types"
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* A key text field
|
|
@@ -8,4 +8,4 @@ import type { FieldState } from "./types";
|
|
|
8
8
|
* @see More details: {@link https://prismic.io/docs/key-text}
|
|
9
9
|
*/
|
|
10
10
|
export type KeyTextField<State extends FieldState = FieldState> =
|
|
11
|
-
State extends "empty" ? null | "" : string
|
|
11
|
+
State extends "empty" ? null | "" : string
|
package/src/types/value/link.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type { AnyRegularField, FieldState } from "./types"
|
|
1
|
+
import type { AnyRegularField, FieldState } from "./types"
|
|
2
2
|
|
|
3
|
-
import type { ContentRelationshipField } from "./contentRelationship"
|
|
4
|
-
import type { GroupField } from "./group"
|
|
5
|
-
import type { LinkToMediaField } from "./linkToMedia"
|
|
6
|
-
import type { SliceZone } from "./sliceZone"
|
|
3
|
+
import type { ContentRelationshipField } from "./contentRelationship"
|
|
4
|
+
import type { GroupField } from "./group"
|
|
5
|
+
import type { LinkToMediaField } from "./linkToMedia"
|
|
6
|
+
import type { SliceZone } from "./sliceZone"
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* Link types
|
|
@@ -13,7 +13,7 @@ export const LinkType = {
|
|
|
13
13
|
Document: "Document",
|
|
14
14
|
Media: "Media",
|
|
15
15
|
Web: "Web",
|
|
16
|
-
} as const
|
|
16
|
+
} as const
|
|
17
17
|
|
|
18
18
|
/**
|
|
19
19
|
* For link fields that haven't been filled
|
|
@@ -23,16 +23,16 @@ export const LinkType = {
|
|
|
23
23
|
export type EmptyLinkField<
|
|
24
24
|
Type extends (typeof LinkType)[keyof typeof LinkType] = typeof LinkType.Any,
|
|
25
25
|
> = {
|
|
26
|
-
link_type: Type | string
|
|
27
|
-
}
|
|
26
|
+
link_type: Type | string
|
|
27
|
+
}
|
|
28
28
|
|
|
29
29
|
/**
|
|
30
30
|
* Link that points to external website
|
|
31
31
|
*/
|
|
32
32
|
export interface FilledLinkToWebField {
|
|
33
|
-
link_type: typeof LinkType.Web
|
|
34
|
-
url: string
|
|
35
|
-
target?: string
|
|
33
|
+
link_type: typeof LinkType.Web
|
|
34
|
+
url: string
|
|
35
|
+
target?: string
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
/**
|
|
@@ -56,4 +56,4 @@ export type LinkField<
|
|
|
56
56
|
:
|
|
57
57
|
| ContentRelationshipField<TypeEnum, LangEnum, DataInterface, State>
|
|
58
58
|
| FilledLinkToWebField
|
|
59
|
-
| LinkToMediaField<State
|
|
59
|
+
| LinkToMediaField<State>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { FieldState } from "./types"
|
|
1
|
+
import type { FieldState } from "./types"
|
|
2
2
|
|
|
3
|
-
import type { EmptyLinkField, LinkType } from "./link"
|
|
3
|
+
import type { EmptyLinkField, LinkType } from "./link"
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* A link field that points to media.
|
|
@@ -10,18 +10,18 @@ import type { EmptyLinkField, LinkType } from "./link";
|
|
|
10
10
|
export type LinkToMediaField<State extends FieldState = FieldState> =
|
|
11
11
|
State extends "empty"
|
|
12
12
|
? EmptyLinkField<typeof LinkType.Media>
|
|
13
|
-
: FilledLinkToMediaField
|
|
13
|
+
: FilledLinkToMediaField
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
16
|
* A link that points to media.
|
|
17
17
|
*/
|
|
18
18
|
export interface FilledLinkToMediaField {
|
|
19
|
-
id: string
|
|
20
|
-
link_type: typeof LinkType.Media
|
|
21
|
-
name: string
|
|
22
|
-
kind: string
|
|
23
|
-
url: string
|
|
24
|
-
size: string
|
|
25
|
-
height?: string | null
|
|
26
|
-
width?: string | null
|
|
19
|
+
id: string
|
|
20
|
+
link_type: typeof LinkType.Media
|
|
21
|
+
name: string
|
|
22
|
+
kind: string
|
|
23
|
+
url: string
|
|
24
|
+
size: string
|
|
25
|
+
height?: string | null
|
|
26
|
+
width?: string | null
|
|
27
27
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { FieldState } from "./types"
|
|
1
|
+
import type { FieldState } from "./types"
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* A number field.
|
|
@@ -8,4 +8,4 @@ import type { FieldState } from "./types";
|
|
|
8
8
|
* @see More details: {@link https://prismic.io/docs/number}
|
|
9
9
|
*/
|
|
10
10
|
export type NumberField<State extends FieldState = FieldState> =
|
|
11
|
-
State extends "empty" ? null : number
|
|
11
|
+
State extends "empty" ? null : number
|