@prismicio/client 7.0.1 → 7.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/buildQueryURL.cjs.map +1 -1
- package/dist/buildQueryURL.d.ts +1 -0
- package/dist/buildQueryURL.js.map +1 -1
- package/dist/createClient.cjs +8 -1
- package/dist/createClient.cjs.map +1 -1
- package/dist/createClient.d.ts +8 -0
- package/dist/createClient.js +8 -1
- package/dist/createClient.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.d.ts +1 -0
- package/dist/getRepositoryName.js.map +1 -1
- package/dist/getToolbarSrc.cjs.map +1 -1
- package/dist/getToolbarSrc.js.map +1 -1
- package/dist/helpers/asHTML.cjs.map +1 -1
- package/dist/helpers/asHTML.d.ts +0 -6
- package/dist/helpers/asHTML.js.map +1 -1
- package/dist/helpers/asImagePixelDensitySrcSet.cjs.map +1 -1
- package/dist/helpers/asImagePixelDensitySrcSet.d.ts +2 -1
- package/dist/helpers/asImagePixelDensitySrcSet.js.map +1 -1
- package/dist/helpers/asImageSrc.cjs.map +1 -1
- package/dist/helpers/asImageSrc.d.ts +2 -1
- package/dist/helpers/asImageSrc.js.map +1 -1
- package/dist/helpers/asImageWidthSrcSet.cjs.map +1 -1
- package/dist/helpers/asImageWidthSrcSet.d.ts +2 -1
- package/dist/helpers/asImageWidthSrcSet.js.map +1 -1
- package/dist/helpers/asLink.cjs.map +1 -1
- package/dist/helpers/asLink.d.ts +3 -4
- package/dist/helpers/asLink.js.map +1 -1
- package/dist/helpers/asLinkAttrs.cjs.map +1 -1
- package/dist/helpers/asLinkAttrs.d.ts +3 -1
- package/dist/helpers/asLinkAttrs.js.map +1 -1
- package/dist/helpers/asText.cjs.map +1 -1
- package/dist/helpers/asText.d.ts +0 -4
- package/dist/helpers/asText.js.map +1 -1
- package/dist/helpers/isFilled.d.ts +13 -10
- package/dist/helpers/unstable_mapSliceZone.cjs +39 -0
- package/dist/helpers/unstable_mapSliceZone.cjs.map +1 -0
- package/dist/helpers/unstable_mapSliceZone.d.ts +142 -0
- package/dist/helpers/unstable_mapSliceZone.js +39 -0
- package/dist/helpers/unstable_mapSliceZone.js.map +1 -0
- package/dist/index.cjs +2 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/isRepositoryEndpoint.cjs.map +1 -1
- package/dist/isRepositoryEndpoint.js.map +1 -1
- package/dist/lib/devMsg.cjs.map +1 -1
- package/dist/lib/devMsg.js.map +1 -1
- package/dist/lib/serializerHelpers.cjs.map +1 -1
- package/dist/lib/serializerHelpers.js.map +1 -1
- package/dist/package.json.cjs +1 -1
- package/dist/package.json.js +1 -1
- package/dist/types/api/repository.d.ts +6 -1
- package/dist/types/model/customType.d.ts +6 -0
- package/dist/types/value/document.d.ts +3 -2
- package/package.json +20 -20
- package/src/buildQueryURL.ts +1 -0
- package/src/createClient.ts +9 -1
- package/src/getRepositoryName.ts +1 -0
- package/src/helpers/asHTML.ts +0 -6
- package/src/helpers/asImagePixelDensitySrcSet.ts +1 -0
- package/src/helpers/asImageSrc.ts +1 -0
- package/src/helpers/asImageWidthSrcSet.ts +1 -0
- package/src/helpers/asLink.ts +3 -4
- package/src/helpers/asLinkAttrs.ts +2 -0
- package/src/helpers/asText.ts +0 -4
- package/src/helpers/unstable_mapSliceZone.ts +280 -0
- package/src/index.ts +1 -0
- package/src/types/api/repository.ts +6 -2
- package/src/types/model/customType.ts +7 -0
- package/src/types/value/document.ts +3 -2
package/dist/index.d.ts
CHANGED
|
@@ -55,6 +55,7 @@ export { asHTML } from "./helpers/asHTML";
|
|
|
55
55
|
export { asImageSrc } from "./helpers/asImageSrc";
|
|
56
56
|
export { asImageWidthSrcSet } from "./helpers/asImageWidthSrcSet";
|
|
57
57
|
export { asImagePixelDensitySrcSet } from "./helpers/asImagePixelDensitySrcSet";
|
|
58
|
+
export { unstable_mapSliceZone } from "./helpers/unstable_mapSliceZone";
|
|
58
59
|
export * as isFilled from "./helpers/isFilled";
|
|
59
60
|
export { documentToLinkField } from "./helpers/documentToLinkField";
|
|
60
61
|
export { Element } from "@prismicio/richtext";
|
package/dist/index.js
CHANGED
|
@@ -16,6 +16,7 @@ import { asHTML } from "./helpers/asHTML.js";
|
|
|
16
16
|
import { asImageSrc } from "./helpers/asImageSrc.js";
|
|
17
17
|
import { asImageWidthSrcSet } from "./helpers/asImageWidthSrcSet.js";
|
|
18
18
|
import { asImagePixelDensitySrcSet } from "./helpers/asImagePixelDensitySrcSet.js";
|
|
19
|
+
import { unstable_mapSliceZone } from "./helpers/unstable_mapSliceZone.js";
|
|
19
20
|
import * as isFilled from "./helpers/isFilled.js";
|
|
20
21
|
import { documentToLinkField } from "./helpers/documentToLinkField.js";
|
|
21
22
|
import { Element } from "@prismicio/richtext";
|
|
@@ -67,6 +68,7 @@ export {
|
|
|
67
68
|
isFilled,
|
|
68
69
|
isRepositoryEndpoint,
|
|
69
70
|
isRepositoryName,
|
|
70
|
-
predicate
|
|
71
|
+
predicate,
|
|
72
|
+
unstable_mapSliceZone
|
|
71
73
|
};
|
|
72
74
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../src/index.ts"],"sourcesContent":["// Imports are used for deprecations.\nimport type { CustomTypeModelIntegrationField } from \"./types/model/integration\";\nimport type { IntegrationField } from \"./types/value/integration\";\n\nimport type {\n\tHTMLRichTextFunctionSerializer,\n\tHTMLRichTextMapSerializer,\n} from \"./helpers/asHTML\";\n\nimport { filter } from \"./filter\";\n\n//=============================================================================\n// Client - Query content from Prismic.\n//=============================================================================\n\n// Primary Client API.\nexport { createClient, Client } from \"./createClient\";\n\n// API endpoint helpers.\nexport { getRepositoryEndpoint } from \"./getRepositoryEndpoint\";\nexport { getRepositoryName } from \"./getRepositoryName\";\nexport { getGraphQLEndpoint } from \"./getGraphQLEndpoint\";\nexport { isRepositoryName } from \"./isRepositoryName\";\nexport { isRepositoryEndpoint } from \"./isRepositoryEndpoint\";\nexport { buildQueryURL } from \"./buildQueryURL\";\n\n// Toolbar helpers.\nexport { getToolbarSrc } from \"./getToolbarSrc\";\n\n// Query filters API.\n/**\n * @deprecated Renamed to `filter`\n */\n// TODO: Remove when we remove support for deprecated `predicate` export.\nconst predicate = filter;\nexport { filter, predicate };\n\n// A collection of well-known cookie names shared between Prismic libraries and systems.\nexport * as cookie from \"./cookie\";\n\n// General types used to query content from Prismic. These are made public to allow users to better type their projects.\nexport type {\n\tAbortSignalLike,\n\tClientConfig,\n\tCreateClient,\n\tFetchLike,\n\tHttpRequestLike,\n\tRequestInitLike,\n\tResponseLike,\n} from \"./createClient\";\nexport type {\n\tBuildQueryURLArgs,\n\tOrdering,\n\tQueryParams,\n\tRoute,\n} from \"./buildQueryURL\";\n\n//=============================================================================\n// Helpers - Manipulate content from Prismic.\n//=============================================================================\n\n// Primary Helpers API.\nexport { asDate } from \"./helpers/asDate\";\nexport { asLink } from \"./helpers/asLink\";\nexport { asLinkAttrs } from \"./helpers/asLinkAttrs\";\nexport { asText } from \"./helpers/asText\";\nexport { asHTML } from \"./helpers/asHTML\";\nexport { asImageSrc } from \"./helpers/asImageSrc\";\nexport { asImageWidthSrcSet } from \"./helpers/asImageWidthSrcSet\";\nexport { asImagePixelDensitySrcSet } from \"./helpers/asImagePixelDensitySrcSet\";\nexport * as isFilled from \"./helpers/isFilled\";\n\n// Conversion helper.\nexport { documentToLinkField } from \"./helpers/documentToLinkField\";\n\n// RichText element types.\nexport { Element } from \"@prismicio/richtext\";\n\nexport type { LinkResolverFunction } from \"./helpers/asLink\";\nexport type { AsLinkAttrsConfig } from \"./helpers/asLinkAttrs\";\n\n/**\n * @deprecated Renamed to `HTMLRichTextMapSerializer`\n */\ntype HTMLMapSerializer = HTMLRichTextMapSerializer;\n/**\n * @deprecated Renamed to `HTMLRichTextFunctionSerializer`\n */\ntype HTMLFunctionSerializer = HTMLRichTextFunctionSerializer;\nexport type {\n\tHTMLRichTextMapSerializer,\n\tHTMLRichTextFunctionSerializer,\n\tHTMLMapSerializer,\n\tHTMLFunctionSerializer,\n};\nexport type { HTMLRichTextSerializer } from \"./helpers/asHTML\";\n\n//=============================================================================\n// Errors - Custom errors for Prismic APIs.\n//=============================================================================\n\nexport { PrismicError } from \"./errors/PrismicError\";\nexport { ForbiddenError } from \"./errors/ForbiddenError\";\nexport { NotFoundError } from \"./errors/NotFoundError\";\nexport { ParsingError } from \"./errors/ParsingError\";\n\n//=============================================================================\n// Types - Types representing Prismic content, models, and API payloads.\n//=============================================================================\n\n// Values - Types representing Prismic content.\nexport { RichTextNodeType } from \"./types/value/richText\";\nexport { LinkType } from \"./types/value/link\";\nexport { OEmbedType } from \"./types/value/embed\";\n\nexport type {\n\tPrismicDocument,\n\tPrismicDocumentWithUID,\n\tPrismicDocumentWithoutUID,\n\tPrismicDocumentHeader,\n\tAlternateLanguage,\n} from \"./types/value/document\";\n\nexport type {\n\t// RichText & Title\n\tRichTextField,\n\t// RichText & Title (block nodes)\n\tRTTextNodeBase,\n\tRTHeading1Node,\n\tRTHeading2Node,\n\tRTHeading3Node,\n\tRTHeading4Node,\n\tRTHeading5Node,\n\tRTHeading6Node,\n\tRTParagraphNode,\n\tRTPreformattedNode,\n\tRTListItemNode,\n\tRTOListItemNode,\n\t// RichText & Title (span nodes)\n\tRTSpanNodeBase,\n\tRTStrongNode,\n\tRTEmNode,\n\tRTLabelNode,\n\t// RichText & Title (media nodes)\n\tRTImageNode,\n\tRTEmbedNode,\n\t// RichText & Title (link nodes)\n\tRTLinkNode,\n\t// RichText & Title (serialization related nodes)\n\tRTListNode,\n\tRTOListNode,\n\tRTSpanNode,\n\t// RichText & Title (helpers)\n\tRTNode,\n\tRTTextNode,\n\tRTBlockNode,\n\tRTInlineNode,\n\tRTAnyNode,\n} from \"./types/value/richText\";\nexport type { TitleField } from \"./types/value/title\";\n\nexport type {\n\tImageField,\n\tImageFieldImage,\n\tFilledImageFieldImage,\n\tEmptyImageFieldImage,\n} from \"./types/value/image\";\n\nexport type {\n\tEmptyLinkField,\n\tLinkField,\n\tFilledLinkToWebField,\n} from \"./types/value/link\";\nexport type {\n\tContentRelationshipField,\n\tFilledContentRelationshipField,\n} from \"./types/value/contentRelationship\";\nexport type {\n\tLinkToMediaField,\n\tFilledLinkToMediaField,\n} from \"./types/value/linkToMedia\";\n\nexport type {\n\tOEmbedExtra,\n\tPhotoOEmbed,\n\tVideoOEmbed,\n\tLinkOEmbed,\n\tRichOEmbed,\n\tAnyOEmbed,\n\tEmbedField,\n} from \"./types/value/embed\";\n\nexport type { BooleanField } from \"./types/value/boolean\";\nexport type { ColorField } from \"./types/value/color\";\nexport type { DateField } from \"./types/value/date\";\nexport type { KeyTextField } from \"./types/value/keyText\";\nexport type { NumberField } from \"./types/value/number\";\nexport type { SelectField } from \"./types/value/select\";\nexport type { TimestampField } from \"./types/value/timestamp\";\nexport type { GeoPointField } from \"./types/value/geoPoint\";\n\n/**\n * @deprecated Renamed to `IntegrationField`\n */\n// TODO: Remove when we remove support for deprecated `IntegrationFields` export.\ntype IntegrationFields = IntegrationField;\nexport { IntegrationField, IntegrationFields };\n\nexport type { GroupField } from \"./types/value/group\";\n\nexport type { SliceZone } from \"./types/value/sliceZone\";\nexport type { Slice } from \"./types/value/slice\";\nexport type { SharedSlice } from \"./types/value/sharedSlice\";\nexport type { SharedSliceVariation } from \"./types/value/sharedSliceVariation\";\n\nexport type { FieldState, AnyRegularField } from \"./types/value/types\";\n\n// Models - Types representing Prismic content models.\nexport { CustomTypeModelFieldType } from \"./types/model/types\";\nexport { CustomTypeModelLinkSelectType } from \"./types/model/link\";\nexport { CustomTypeModelSliceType } from \"./types/model/sliceZone\";\nexport { CustomTypeModelSliceDisplay } from \"./types/model/slice\";\n\nexport type {\n\tCustomTypeModel,\n\tCustomTypeModelDefinition,\n\tCustomTypeModelTab,\n} from \"./types/model/customType\";\n\nexport type {\n\tCustomTypeModelRichTextField,\n\tCustomTypeModelRichTextMultiField,\n\tCustomTypeModelRichTextSingleField,\n} from \"./types/model/richText\";\nexport type { CustomTypeModelTitleField } from \"./types/model/title\";\n\nexport type {\n\tCustomTypeModelImageField,\n\tCustomTypeModelImageConstraint,\n\tCustomTypeModelImageThumbnail,\n} from \"./types/model/image\";\n\nexport type { CustomTypeModelContentRelationshipField } from \"./types/model/contentRelationship\";\nexport type { CustomTypeModelLinkField } from \"./types/model/link\";\nexport type { CustomTypeModelLinkToMediaField } from \"./types/model/linkToMedia\";\n\nexport type { CustomTypeModelEmbedField } from \"./types/model/embed\";\n\nexport type { CustomTypeModelBooleanField } from \"./types/model/boolean\";\nexport type { CustomTypeModelColorField } from \"./types/model/color\";\nexport type { CustomTypeModelDateField } from \"./types/model/date\";\nexport type { CustomTypeModelKeyTextField } from \"./types/model/keyText\";\nexport type { CustomTypeModelNumberField } from \"./types/model/number\";\nexport type { CustomTypeModelSelectField } from \"./types/model/select\";\nexport type { CustomTypeModelTimestampField } from \"./types/model/timestamp\";\nexport type { CustomTypeModelGeoPointField } from \"./types/model/geoPoint\";\n\n/**\n * @deprecated Renamed to `CustomTypeModelIntegrationField`.\n */\n// TODO: Remove when we remove support for deprecated `CustomTypeModelIntegrationField` export.\ntype CustomTypeModelIntegrationFieldsField = CustomTypeModelIntegrationField;\nexport {\n\tCustomTypeModelIntegrationField,\n\tCustomTypeModelIntegrationFieldsField,\n};\nexport type { CustomTypeModelGroupField } from \"./types/model/group\";\nexport type {\n\tCustomTypeModelSliceZoneField,\n\tCustomTypeModelSliceLabel,\n\tCustomTypeModelSharedSlice,\n} from \"./types/model/sliceZone\";\nexport type {\n\tCustomTypeModelSlice,\n\tCustomTypeModelLegacySlice,\n} from \"./types/model/slice\";\nexport type { SharedSliceModel } from \"./types/model/sharedSlice\";\nexport type { SharedSliceModelVariation } from \"./types/model/sharedSliceVariation\";\n\nexport type { CustomTypeModelUIDField } from \"./types/model/uid\";\n\nexport type { CustomTypeModelRangeField } from \"./types/model/range\";\nexport type { CustomTypeModelSeparatorField } from \"./types/model/separator\";\n\nexport type {\n\tCustomTypeModelField,\n\tCustomTypeModelFieldForGroup,\n} from \"./types/model/types\";\n\n// API - Types representing Prismic Rest API V2 responses.\nexport type { Query } from \"./types/api/query\";\n\nexport type { Ref } from \"./types/api/ref\";\n\nexport type { Release } from \"./types/api/release\";\n\nexport type {\n\tRepository,\n\tLanguage,\n\tForm,\n\tFormField,\n} from \"./types/api/repository\";\n\nexport type { Tags } from \"./types/api/tags\";\n\n// Webhook - Types representing Prismic webhooks.\nexport { WebhookType } from \"./types/webhook/types\";\n\nexport type { WebhookBody } from \"./types/webhook/types\";\n\nexport type { WebhookBodyAPIUpdate } from \"./types/webhook/apiUpdate\";\n\nexport type { WebhookBodyTestTrigger } from \"./types/webhook/testTrigger\";\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkCA,MAAM,YAAY;"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/index.ts"],"sourcesContent":["// Imports are used for deprecations.\nimport type { CustomTypeModelIntegrationField } from \"./types/model/integration\";\nimport type { IntegrationField } from \"./types/value/integration\";\n\nimport type {\n\tHTMLRichTextFunctionSerializer,\n\tHTMLRichTextMapSerializer,\n} from \"./helpers/asHTML\";\n\nimport { filter } from \"./filter\";\n\n//=============================================================================\n// Client - Query content from Prismic.\n//=============================================================================\n\n// Primary Client API.\nexport { createClient, Client } from \"./createClient\";\n\n// API endpoint helpers.\nexport { getRepositoryEndpoint } from \"./getRepositoryEndpoint\";\nexport { getRepositoryName } from \"./getRepositoryName\";\nexport { getGraphQLEndpoint } from \"./getGraphQLEndpoint\";\nexport { isRepositoryName } from \"./isRepositoryName\";\nexport { isRepositoryEndpoint } from \"./isRepositoryEndpoint\";\nexport { buildQueryURL } from \"./buildQueryURL\";\n\n// Toolbar helpers.\nexport { getToolbarSrc } from \"./getToolbarSrc\";\n\n// Query filters API.\n/**\n * @deprecated Renamed to `filter`\n */\n// TODO: Remove when we remove support for deprecated `predicate` export.\nconst predicate = filter;\nexport { filter, predicate };\n\n// A collection of well-known cookie names shared between Prismic libraries and systems.\nexport * as cookie from \"./cookie\";\n\n// General types used to query content from Prismic. These are made public to allow users to better type their projects.\nexport type {\n\tAbortSignalLike,\n\tClientConfig,\n\tCreateClient,\n\tFetchLike,\n\tHttpRequestLike,\n\tRequestInitLike,\n\tResponseLike,\n} from \"./createClient\";\nexport type {\n\tBuildQueryURLArgs,\n\tOrdering,\n\tQueryParams,\n\tRoute,\n} from \"./buildQueryURL\";\n\n//=============================================================================\n// Helpers - Manipulate content from Prismic.\n//=============================================================================\n\n// Primary Helpers API.\nexport { asDate } from \"./helpers/asDate\";\nexport { asLink } from \"./helpers/asLink\";\nexport { asLinkAttrs } from \"./helpers/asLinkAttrs\";\nexport { asText } from \"./helpers/asText\";\nexport { asHTML } from \"./helpers/asHTML\";\nexport { asImageSrc } from \"./helpers/asImageSrc\";\nexport { asImageWidthSrcSet } from \"./helpers/asImageWidthSrcSet\";\nexport { asImagePixelDensitySrcSet } from \"./helpers/asImagePixelDensitySrcSet\";\nexport { unstable_mapSliceZone } from \"./helpers/unstable_mapSliceZone\";\nexport * as isFilled from \"./helpers/isFilled\";\n\n// Conversion helper.\nexport { documentToLinkField } from \"./helpers/documentToLinkField\";\n\n// RichText element types.\nexport { Element } from \"@prismicio/richtext\";\n\nexport type { LinkResolverFunction } from \"./helpers/asLink\";\nexport type { AsLinkAttrsConfig } from \"./helpers/asLinkAttrs\";\n\n/**\n * @deprecated Renamed to `HTMLRichTextMapSerializer`\n */\ntype HTMLMapSerializer = HTMLRichTextMapSerializer;\n/**\n * @deprecated Renamed to `HTMLRichTextFunctionSerializer`\n */\ntype HTMLFunctionSerializer = HTMLRichTextFunctionSerializer;\nexport type {\n\tHTMLRichTextMapSerializer,\n\tHTMLRichTextFunctionSerializer,\n\tHTMLMapSerializer,\n\tHTMLFunctionSerializer,\n};\nexport type { HTMLRichTextSerializer } from \"./helpers/asHTML\";\n\n//=============================================================================\n// Errors - Custom errors for Prismic APIs.\n//=============================================================================\n\nexport { PrismicError } from \"./errors/PrismicError\";\nexport { ForbiddenError } from \"./errors/ForbiddenError\";\nexport { NotFoundError } from \"./errors/NotFoundError\";\nexport { ParsingError } from \"./errors/ParsingError\";\n\n//=============================================================================\n// Types - Types representing Prismic content, models, and API payloads.\n//=============================================================================\n\n// Values - Types representing Prismic content.\nexport { RichTextNodeType } from \"./types/value/richText\";\nexport { LinkType } from \"./types/value/link\";\nexport { OEmbedType } from \"./types/value/embed\";\n\nexport type {\n\tPrismicDocument,\n\tPrismicDocumentWithUID,\n\tPrismicDocumentWithoutUID,\n\tPrismicDocumentHeader,\n\tAlternateLanguage,\n} from \"./types/value/document\";\n\nexport type {\n\t// RichText & Title\n\tRichTextField,\n\t// RichText & Title (block nodes)\n\tRTTextNodeBase,\n\tRTHeading1Node,\n\tRTHeading2Node,\n\tRTHeading3Node,\n\tRTHeading4Node,\n\tRTHeading5Node,\n\tRTHeading6Node,\n\tRTParagraphNode,\n\tRTPreformattedNode,\n\tRTListItemNode,\n\tRTOListItemNode,\n\t// RichText & Title (span nodes)\n\tRTSpanNodeBase,\n\tRTStrongNode,\n\tRTEmNode,\n\tRTLabelNode,\n\t// RichText & Title (media nodes)\n\tRTImageNode,\n\tRTEmbedNode,\n\t// RichText & Title (link nodes)\n\tRTLinkNode,\n\t// RichText & Title (serialization related nodes)\n\tRTListNode,\n\tRTOListNode,\n\tRTSpanNode,\n\t// RichText & Title (helpers)\n\tRTNode,\n\tRTTextNode,\n\tRTBlockNode,\n\tRTInlineNode,\n\tRTAnyNode,\n} from \"./types/value/richText\";\nexport type { TitleField } from \"./types/value/title\";\n\nexport type {\n\tImageField,\n\tImageFieldImage,\n\tFilledImageFieldImage,\n\tEmptyImageFieldImage,\n} from \"./types/value/image\";\n\nexport type {\n\tEmptyLinkField,\n\tLinkField,\n\tFilledLinkToWebField,\n} from \"./types/value/link\";\nexport type {\n\tContentRelationshipField,\n\tFilledContentRelationshipField,\n} from \"./types/value/contentRelationship\";\nexport type {\n\tLinkToMediaField,\n\tFilledLinkToMediaField,\n} from \"./types/value/linkToMedia\";\n\nexport type {\n\tOEmbedExtra,\n\tPhotoOEmbed,\n\tVideoOEmbed,\n\tLinkOEmbed,\n\tRichOEmbed,\n\tAnyOEmbed,\n\tEmbedField,\n} from \"./types/value/embed\";\n\nexport type { BooleanField } from \"./types/value/boolean\";\nexport type { ColorField } from \"./types/value/color\";\nexport type { DateField } from \"./types/value/date\";\nexport type { KeyTextField } from \"./types/value/keyText\";\nexport type { NumberField } from \"./types/value/number\";\nexport type { SelectField } from \"./types/value/select\";\nexport type { TimestampField } from \"./types/value/timestamp\";\nexport type { GeoPointField } from \"./types/value/geoPoint\";\n\n/**\n * @deprecated Renamed to `IntegrationField`\n */\n// TODO: Remove when we remove support for deprecated `IntegrationFields` export.\ntype IntegrationFields = IntegrationField;\nexport { IntegrationField, IntegrationFields };\n\nexport type { GroupField } from \"./types/value/group\";\n\nexport type { SliceZone } from \"./types/value/sliceZone\";\nexport type { Slice } from \"./types/value/slice\";\nexport type { SharedSlice } from \"./types/value/sharedSlice\";\nexport type { SharedSliceVariation } from \"./types/value/sharedSliceVariation\";\n\nexport type { FieldState, AnyRegularField } from \"./types/value/types\";\n\n// Models - Types representing Prismic content models.\nexport { CustomTypeModelFieldType } from \"./types/model/types\";\nexport { CustomTypeModelLinkSelectType } from \"./types/model/link\";\nexport { CustomTypeModelSliceType } from \"./types/model/sliceZone\";\nexport { CustomTypeModelSliceDisplay } from \"./types/model/slice\";\n\nexport type {\n\tCustomTypeModel,\n\tCustomTypeModelDefinition,\n\tCustomTypeModelTab,\n} from \"./types/model/customType\";\n\nexport type {\n\tCustomTypeModelRichTextField,\n\tCustomTypeModelRichTextMultiField,\n\tCustomTypeModelRichTextSingleField,\n} from \"./types/model/richText\";\nexport type { CustomTypeModelTitleField } from \"./types/model/title\";\n\nexport type {\n\tCustomTypeModelImageField,\n\tCustomTypeModelImageConstraint,\n\tCustomTypeModelImageThumbnail,\n} from \"./types/model/image\";\n\nexport type { CustomTypeModelContentRelationshipField } from \"./types/model/contentRelationship\";\nexport type { CustomTypeModelLinkField } from \"./types/model/link\";\nexport type { CustomTypeModelLinkToMediaField } from \"./types/model/linkToMedia\";\n\nexport type { CustomTypeModelEmbedField } from \"./types/model/embed\";\n\nexport type { CustomTypeModelBooleanField } from \"./types/model/boolean\";\nexport type { CustomTypeModelColorField } from \"./types/model/color\";\nexport type { CustomTypeModelDateField } from \"./types/model/date\";\nexport type { CustomTypeModelKeyTextField } from \"./types/model/keyText\";\nexport type { CustomTypeModelNumberField } from \"./types/model/number\";\nexport type { CustomTypeModelSelectField } from \"./types/model/select\";\nexport type { CustomTypeModelTimestampField } from \"./types/model/timestamp\";\nexport type { CustomTypeModelGeoPointField } from \"./types/model/geoPoint\";\n\n/**\n * @deprecated Renamed to `CustomTypeModelIntegrationField`.\n */\n// TODO: Remove when we remove support for deprecated `CustomTypeModelIntegrationField` export.\ntype CustomTypeModelIntegrationFieldsField = CustomTypeModelIntegrationField;\nexport {\n\tCustomTypeModelIntegrationField,\n\tCustomTypeModelIntegrationFieldsField,\n};\nexport type { CustomTypeModelGroupField } from \"./types/model/group\";\nexport type {\n\tCustomTypeModelSliceZoneField,\n\tCustomTypeModelSliceLabel,\n\tCustomTypeModelSharedSlice,\n} from \"./types/model/sliceZone\";\nexport type {\n\tCustomTypeModelSlice,\n\tCustomTypeModelLegacySlice,\n} from \"./types/model/slice\";\nexport type { SharedSliceModel } from \"./types/model/sharedSlice\";\nexport type { SharedSliceModelVariation } from \"./types/model/sharedSliceVariation\";\n\nexport type { CustomTypeModelUIDField } from \"./types/model/uid\";\n\nexport type { CustomTypeModelRangeField } from \"./types/model/range\";\nexport type { CustomTypeModelSeparatorField } from \"./types/model/separator\";\n\nexport type {\n\tCustomTypeModelField,\n\tCustomTypeModelFieldForGroup,\n} from \"./types/model/types\";\n\n// API - Types representing Prismic Rest API V2 responses.\nexport type { Query } from \"./types/api/query\";\n\nexport type { Ref } from \"./types/api/ref\";\n\nexport type { Release } from \"./types/api/release\";\n\nexport type {\n\tRepository,\n\tLanguage,\n\tForm,\n\tFormField,\n} from \"./types/api/repository\";\n\nexport type { Tags } from \"./types/api/tags\";\n\n// Webhook - Types representing Prismic webhooks.\nexport { WebhookType } from \"./types/webhook/types\";\n\nexport type { WebhookBody } from \"./types/webhook/types\";\n\nexport type { WebhookBodyAPIUpdate } from \"./types/webhook/apiUpdate\";\n\nexport type { WebhookBodyTestTrigger } from \"./types/webhook/testTrigger\";\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkCA,MAAM,YAAY;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isRepositoryEndpoint.cjs","sources":["../../src/isRepositoryEndpoint.ts"],"sourcesContent":["/**\n * Determines if a string if a Prismic Rest API V2 endpoint. Note that any valid\n * URL is a valid endpoint to support network proxies.\n *\n * @param input - Input to test.\n *\n * @returns `true` if `input` is a valid Prismic Rest API V2 endpoint, `false`\n * otherwise.\n */\nexport const isRepositoryEndpoint = (input: string): boolean => {\n\ttry {\n\t\tnew URL(input);\n\n\t\treturn true;\n\t} catch {\n\t\treturn false;\n\t}\n};\n"],"names":[],"mappings":";;AASa,MAAA,uBAAuB,CAAC,UAA0B;AAC1D,MAAA;AACH,QAAI,IAAI,KAAK;AAEN,WAAA;AAAA,EAAA,
|
|
1
|
+
{"version":3,"file":"isRepositoryEndpoint.cjs","sources":["../../src/isRepositoryEndpoint.ts"],"sourcesContent":["/**\n * Determines if a string if a Prismic Rest API V2 endpoint. Note that any valid\n * URL is a valid endpoint to support network proxies.\n *\n * @param input - Input to test.\n *\n * @returns `true` if `input` is a valid Prismic Rest API V2 endpoint, `false`\n * otherwise.\n */\nexport const isRepositoryEndpoint = (input: string): boolean => {\n\ttry {\n\t\tnew URL(input);\n\n\t\treturn true;\n\t} catch {\n\t\treturn false;\n\t}\n};\n"],"names":[],"mappings":";;AASa,MAAA,uBAAuB,CAAC,UAA0B;AAC1D,MAAA;AACH,QAAI,IAAI,KAAK;AAEN,WAAA;AAAA,EAAA,QACA;AACA,WAAA;AAAA,EACP;AACF;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isRepositoryEndpoint.js","sources":["../../src/isRepositoryEndpoint.ts"],"sourcesContent":["/**\n * Determines if a string if a Prismic Rest API V2 endpoint. Note that any valid\n * URL is a valid endpoint to support network proxies.\n *\n * @param input - Input to test.\n *\n * @returns `true` if `input` is a valid Prismic Rest API V2 endpoint, `false`\n * otherwise.\n */\nexport const isRepositoryEndpoint = (input: string): boolean => {\n\ttry {\n\t\tnew URL(input);\n\n\t\treturn true;\n\t} catch {\n\t\treturn false;\n\t}\n};\n"],"names":[],"mappings":"AASa,MAAA,uBAAuB,CAAC,UAA0B;AAC1D,MAAA;AACH,QAAI,IAAI,KAAK;AAEN,WAAA;AAAA,EAAA,
|
|
1
|
+
{"version":3,"file":"isRepositoryEndpoint.js","sources":["../../src/isRepositoryEndpoint.ts"],"sourcesContent":["/**\n * Determines if a string if a Prismic Rest API V2 endpoint. Note that any valid\n * URL is a valid endpoint to support network proxies.\n *\n * @param input - Input to test.\n *\n * @returns `true` if `input` is a valid Prismic Rest API V2 endpoint, `false`\n * otherwise.\n */\nexport const isRepositoryEndpoint = (input: string): boolean => {\n\ttry {\n\t\tnew URL(input);\n\n\t\treturn true;\n\t} catch {\n\t\treturn false;\n\t}\n};\n"],"names":[],"mappings":"AASa,MAAA,uBAAuB,CAAC,UAA0B;AAC1D,MAAA;AACH,QAAI,IAAI,KAAK;AAEN,WAAA;AAAA,EAAA,QACA;AACA,WAAA;AAAA,EACP;AACF;"}
|
package/dist/lib/devMsg.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"devMsg.cjs","sources":["../../../src/lib/devMsg.ts"],"sourcesContent":["import { version } from \"../../package.json\";\n\n/**\n * Returns a `prismic.dev/msg` URL for a given message slug.\n *\n * @example\n *\n * ```ts\n * devMsg(\"missing-param\");\n * // => \"https://prismic.dev/msg/client/v1.2.3/missing-param.md\"\n * ```\n *\n * @param slug - Slug for the message. This corresponds to a Markdown file in\n * the Git repository's `/messages` directory.\n *\n * @returns The `prismic.dev/msg` URL for the given slug.\n */\nexport const devMsg = (slug: string): string => {\n\treturn `https://prismic.dev/msg/client/v${version}/${slug}`;\n};\n"],"names":["version"],"mappings":";;;AAiBa,MAAA,SAAS,CAAC,SAAwB;
|
|
1
|
+
{"version":3,"file":"devMsg.cjs","sources":["../../../src/lib/devMsg.ts"],"sourcesContent":["import { version } from \"../../package.json\";\n\n/**\n * Returns a `prismic.dev/msg` URL for a given message slug.\n *\n * @example\n *\n * ```ts\n * devMsg(\"missing-param\");\n * // => \"https://prismic.dev/msg/client/v1.2.3/missing-param.md\"\n * ```\n *\n * @param slug - Slug for the message. This corresponds to a Markdown file in\n * the Git repository's `/messages` directory.\n *\n * @returns The `prismic.dev/msg` URL for the given slug.\n */\nexport const devMsg = (slug: string): string => {\n\treturn `https://prismic.dev/msg/client/v${version}/${slug}`;\n};\n"],"names":["version"],"mappings":";;;AAiBa,MAAA,SAAS,CAAC,SAAwB;AACvC,SAAA,mCAAmCA,SAAAA,OAAO,IAAI,IAAI;AAC1D;;"}
|
package/dist/lib/devMsg.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"devMsg.js","sources":["../../../src/lib/devMsg.ts"],"sourcesContent":["import { version } from \"../../package.json\";\n\n/**\n * Returns a `prismic.dev/msg` URL for a given message slug.\n *\n * @example\n *\n * ```ts\n * devMsg(\"missing-param\");\n * // => \"https://prismic.dev/msg/client/v1.2.3/missing-param.md\"\n * ```\n *\n * @param slug - Slug for the message. This corresponds to a Markdown file in\n * the Git repository's `/messages` directory.\n *\n * @returns The `prismic.dev/msg` URL for the given slug.\n */\nexport const devMsg = (slug: string): string => {\n\treturn `https://prismic.dev/msg/client/v${version}/${slug}`;\n};\n"],"names":[],"mappings":";AAiBa,MAAA,SAAS,CAAC,SAAwB;
|
|
1
|
+
{"version":3,"file":"devMsg.js","sources":["../../../src/lib/devMsg.ts"],"sourcesContent":["import { version } from \"../../package.json\";\n\n/**\n * Returns a `prismic.dev/msg` URL for a given message slug.\n *\n * @example\n *\n * ```ts\n * devMsg(\"missing-param\");\n * // => \"https://prismic.dev/msg/client/v1.2.3/missing-param.md\"\n * ```\n *\n * @param slug - Slug for the message. This corresponds to a Markdown file in\n * the Git repository's `/messages` directory.\n *\n * @returns The `prismic.dev/msg` URL for the given slug.\n */\nexport const devMsg = (slug: string): string => {\n\treturn `https://prismic.dev/msg/client/v${version}/${slug}`;\n};\n"],"names":[],"mappings":";AAiBa,MAAA,SAAS,CAAC,SAAwB;AACvC,SAAA,mCAAmC,OAAO,IAAI,IAAI;AAC1D;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serializerHelpers.cjs","sources":["../../../src/lib/serializerHelpers.ts"],"sourcesContent":["import { LinkType } from \"../types/value/link\";\nimport {\n\tRTBlockNode,\n\tRTEmbedNode,\n\tRTImageNode,\n\tRTInlineNode,\n\tRTLinkNode,\n\tRTPreformattedNode,\n\tRichTextNodeType,\n} from \"../types/value/richText\";\n\nimport { LinkResolverFunction, asLink } from \"../helpers/asLink\";\n\nimport { escapeHTML } from \"./escapeHTML\";\n\nexport const getLabel = (node: RTBlockNode | RTInlineNode): string => {\n\treturn \"data\" in node && \"label\" in node.data\n\t\t? ` class=\"${node.data.label}\"`\n\t\t: \"\";\n};\n\nexport const serializeStandardTag = (\n\ttag: string,\n\tnode: RTBlockNode | RTInlineNode,\n\tchildren: string[],\n): string => {\n\treturn `<${tag}${getLabel(node)}>${children.join(\"\")}</${tag}>`;\n};\n\nexport const serializePreFormatted = (node: RTPreformattedNode): string => {\n\treturn `<pre${getLabel(node)}>${escapeHTML(node.text)}</pre>`;\n};\n\nexport const serializeImage = (\n\tlinkResolver:\n\t\t| LinkResolverFunction<string | null | undefined>\n\t\t| undefined\n\t\t| null,\n\tnode: RTImageNode,\n): string => {\n\tlet imageTag = `<img src=\"${node.url}\" alt=\"${escapeHTML(node.alt)}\"${\n\t\tnode.copyright ? ` copyright=\"${escapeHTML(node.copyright)}\"` : \"\"\n\t} />`;\n\n\t// If the image has a link, we wrap it with an anchor tag\n\tif (node.linkTo) {\n\t\timageTag = serializeHyperlink(\n\t\t\tlinkResolver,\n\t\t\t{\n\t\t\t\ttype: RichTextNodeType.hyperlink,\n\t\t\t\tdata: node.linkTo,\n\t\t\t\tstart: 0,\n\t\t\t\tend: 0,\n\t\t\t},\n\t\t\t[imageTag],\n\t\t);\n\t}\n\n\treturn `<p class=\"block-img\">${imageTag}</p>`;\n};\n\nexport const serializeEmbed = (node: RTEmbedNode): string => {\n\treturn `<div data-oembed=\"${node.oembed.embed_url}\" data-oembed-type=\"${\n\t\tnode.oembed.type\n\t}\" data-oembed-provider=\"${node.oembed.provider_name}\"${getLabel(node)}>${\n\t\tnode.oembed.html\n\t}</div>`;\n};\n\nexport const serializeHyperlink = (\n\tlinkResolver:\n\t\t| LinkResolverFunction<string | null | undefined>\n\t\t| undefined\n\t\t| null,\n\tnode: RTLinkNode,\n\tchildren: string[],\n): string => {\n\tswitch (node.data.link_type) {\n\t\tcase LinkType.Web: {\n\t\t\treturn `<a href=\"${escapeHTML(node.data.url)}\" ${\n\t\t\t\tnode.data.target ? `target=\"${node.data.target}\" ` : \"\"\n\t\t\t}rel=\"noopener noreferrer\"${getLabel(node)}>${children.join(\"\")}</a>`;\n\t\t}\n\n\t\tcase LinkType.Document: {\n\t\t\treturn `<a href=\"${asLink(node.data, linkResolver)}\"${getLabel(\n\t\t\t\tnode,\n\t\t\t)}>${children.join(\"\")}</a>`;\n\t\t}\n\n\t\tcase LinkType.Media: {\n\t\t\treturn `<a href=\"${node.data.url}\"${getLabel(node)}>${children.join(\n\t\t\t\t\"\",\n\t\t\t)}</a>`;\n\t\t}\n\t}\n};\n\nexport const serializeSpan = (content?: string): string => {\n\treturn content ? escapeHTML(content).replace(/\\n/g, \"<br />\") : \"\";\n};\n"],"names":["escapeHTML","RichTextNodeType","LinkType","asLink"],"mappings":";;;;;;AAea,MAAA,WAAW,CAAC,SAA4C;AAC7D,SAAA,UAAU,QAAQ,WAAW,KAAK,OACtC,WAAW,KAAK,KAAK,
|
|
1
|
+
{"version":3,"file":"serializerHelpers.cjs","sources":["../../../src/lib/serializerHelpers.ts"],"sourcesContent":["import { LinkType } from \"../types/value/link\";\nimport {\n\tRTBlockNode,\n\tRTEmbedNode,\n\tRTImageNode,\n\tRTInlineNode,\n\tRTLinkNode,\n\tRTPreformattedNode,\n\tRichTextNodeType,\n} from \"../types/value/richText\";\n\nimport { LinkResolverFunction, asLink } from \"../helpers/asLink\";\n\nimport { escapeHTML } from \"./escapeHTML\";\n\nexport const getLabel = (node: RTBlockNode | RTInlineNode): string => {\n\treturn \"data\" in node && \"label\" in node.data\n\t\t? ` class=\"${node.data.label}\"`\n\t\t: \"\";\n};\n\nexport const serializeStandardTag = (\n\ttag: string,\n\tnode: RTBlockNode | RTInlineNode,\n\tchildren: string[],\n): string => {\n\treturn `<${tag}${getLabel(node)}>${children.join(\"\")}</${tag}>`;\n};\n\nexport const serializePreFormatted = (node: RTPreformattedNode): string => {\n\treturn `<pre${getLabel(node)}>${escapeHTML(node.text)}</pre>`;\n};\n\nexport const serializeImage = (\n\tlinkResolver:\n\t\t| LinkResolverFunction<string | null | undefined>\n\t\t| undefined\n\t\t| null,\n\tnode: RTImageNode,\n): string => {\n\tlet imageTag = `<img src=\"${node.url}\" alt=\"${escapeHTML(node.alt)}\"${\n\t\tnode.copyright ? ` copyright=\"${escapeHTML(node.copyright)}\"` : \"\"\n\t} />`;\n\n\t// If the image has a link, we wrap it with an anchor tag\n\tif (node.linkTo) {\n\t\timageTag = serializeHyperlink(\n\t\t\tlinkResolver,\n\t\t\t{\n\t\t\t\ttype: RichTextNodeType.hyperlink,\n\t\t\t\tdata: node.linkTo,\n\t\t\t\tstart: 0,\n\t\t\t\tend: 0,\n\t\t\t},\n\t\t\t[imageTag],\n\t\t);\n\t}\n\n\treturn `<p class=\"block-img\">${imageTag}</p>`;\n};\n\nexport const serializeEmbed = (node: RTEmbedNode): string => {\n\treturn `<div data-oembed=\"${node.oembed.embed_url}\" data-oembed-type=\"${\n\t\tnode.oembed.type\n\t}\" data-oembed-provider=\"${node.oembed.provider_name}\"${getLabel(node)}>${\n\t\tnode.oembed.html\n\t}</div>`;\n};\n\nexport const serializeHyperlink = (\n\tlinkResolver:\n\t\t| LinkResolverFunction<string | null | undefined>\n\t\t| undefined\n\t\t| null,\n\tnode: RTLinkNode,\n\tchildren: string[],\n): string => {\n\tswitch (node.data.link_type) {\n\t\tcase LinkType.Web: {\n\t\t\treturn `<a href=\"${escapeHTML(node.data.url)}\" ${\n\t\t\t\tnode.data.target ? `target=\"${node.data.target}\" ` : \"\"\n\t\t\t}rel=\"noopener noreferrer\"${getLabel(node)}>${children.join(\"\")}</a>`;\n\t\t}\n\n\t\tcase LinkType.Document: {\n\t\t\treturn `<a href=\"${asLink(node.data, linkResolver)}\"${getLabel(\n\t\t\t\tnode,\n\t\t\t)}>${children.join(\"\")}</a>`;\n\t\t}\n\n\t\tcase LinkType.Media: {\n\t\t\treturn `<a href=\"${node.data.url}\"${getLabel(node)}>${children.join(\n\t\t\t\t\"\",\n\t\t\t)}</a>`;\n\t\t}\n\t}\n};\n\nexport const serializeSpan = (content?: string): string => {\n\treturn content ? escapeHTML(content).replace(/\\n/g, \"<br />\") : \"\";\n};\n"],"names":["escapeHTML","RichTextNodeType","LinkType","asLink"],"mappings":";;;;;;AAea,MAAA,WAAW,CAAC,SAA4C;AAC7D,SAAA,UAAU,QAAQ,WAAW,KAAK,OACtC,WAAW,KAAK,KAAK,KAAK,MAC1B;AACJ;AAEO,MAAM,uBAAuB,CACnC,KACA,MACA,aACW;AACX,SAAO,IAAI,GAAG,GAAG,SAAS,IAAI,CAAC,IAAI,SAAS,KAAK,EAAE,CAAC,KAAK,GAAG;AAC7D;AAEa,MAAA,wBAAwB,CAAC,SAAoC;AAClE,SAAA,OAAO,SAAS,IAAI,CAAC,IAAIA,WAAW,WAAA,KAAK,IAAI,CAAC;AACtD;AAEa,MAAA,iBAAiB,CAC7B,cAIA,SACW;AACX,MAAI,WAAW,aAAa,KAAK,GAAG,UAAUA,sBAAW,KAAK,GAAG,CAAC,IACjE,KAAK,YAAY,eAAeA,WAAAA,WAAW,KAAK,SAAS,CAAC,MAAM,EACjE;AAGA,MAAI,KAAK,QAAQ;AAChB,eAAW,mBACV,cACA;AAAA,MACC,MAAMC,SAAiB,iBAAA;AAAA,MACvB,MAAM,KAAK;AAAA,MACX,OAAO;AAAA,MACP,KAAK;AAAA,IAAA,GAEN,CAAC,QAAQ,CAAC;AAAA,EAEX;AAED,SAAO,wBAAwB,QAAQ;AACxC;AAEa,MAAA,iBAAiB,CAAC,SAA6B;AAC3D,SAAO,qBAAqB,KAAK,OAAO,SAAS,uBAChD,KAAK,OAAO,IACb,2BAA2B,KAAK,OAAO,aAAa,IAAI,SAAS,IAAI,CAAC,IACrE,KAAK,OAAO,IACb;AACD;AAEO,MAAM,qBAAqB,CACjC,cAIA,MACA,aACW;AACH,UAAA,KAAK,KAAK,WAAW;AAAA,IAC5B,KAAKC,KAAAA,SAAS,KAAK;AACX,aAAA,YAAYF,WAAAA,WAAW,KAAK,KAAK,GAAG,CAAC,KAC3C,KAAK,KAAK,SAAS,WAAW,KAAK,KAAK,MAAM,OAAO,EACtD,4BAA4B,SAAS,IAAI,CAAC,IAAI,SAAS,KAAK,EAAE,CAAC;AAAA,IAC/D;AAAA,IAED,KAAKE,KAAAA,SAAS,UAAU;AACvB,aAAO,YAAYC,OAAA,OAAO,KAAK,MAAM,YAAY,CAAC,IAAI,SACrD,IAAI,CACJ,IAAI,SAAS,KAAK,EAAE,CAAC;AAAA,IACtB;AAAA,IAED,KAAKD,KAAAA,SAAS,OAAO;AACpB,aAAO,YAAY,KAAK,KAAK,GAAG,IAAI,SAAS,IAAI,CAAC,IAAI,SAAS,KAC9D,EAAE,CACF;AAAA,IACD;AAAA,EACD;AACF;AAEa,MAAA,gBAAgB,CAAC,YAA4B;AACzD,SAAO,UAAUF,WAAW,WAAA,OAAO,EAAE,QAAQ,OAAO,QAAQ,IAAI;AACjE;;;;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serializerHelpers.js","sources":["../../../src/lib/serializerHelpers.ts"],"sourcesContent":["import { LinkType } from \"../types/value/link\";\nimport {\n\tRTBlockNode,\n\tRTEmbedNode,\n\tRTImageNode,\n\tRTInlineNode,\n\tRTLinkNode,\n\tRTPreformattedNode,\n\tRichTextNodeType,\n} from \"../types/value/richText\";\n\nimport { LinkResolverFunction, asLink } from \"../helpers/asLink\";\n\nimport { escapeHTML } from \"./escapeHTML\";\n\nexport const getLabel = (node: RTBlockNode | RTInlineNode): string => {\n\treturn \"data\" in node && \"label\" in node.data\n\t\t? ` class=\"${node.data.label}\"`\n\t\t: \"\";\n};\n\nexport const serializeStandardTag = (\n\ttag: string,\n\tnode: RTBlockNode | RTInlineNode,\n\tchildren: string[],\n): string => {\n\treturn `<${tag}${getLabel(node)}>${children.join(\"\")}</${tag}>`;\n};\n\nexport const serializePreFormatted = (node: RTPreformattedNode): string => {\n\treturn `<pre${getLabel(node)}>${escapeHTML(node.text)}</pre>`;\n};\n\nexport const serializeImage = (\n\tlinkResolver:\n\t\t| LinkResolverFunction<string | null | undefined>\n\t\t| undefined\n\t\t| null,\n\tnode: RTImageNode,\n): string => {\n\tlet imageTag = `<img src=\"${node.url}\" alt=\"${escapeHTML(node.alt)}\"${\n\t\tnode.copyright ? ` copyright=\"${escapeHTML(node.copyright)}\"` : \"\"\n\t} />`;\n\n\t// If the image has a link, we wrap it with an anchor tag\n\tif (node.linkTo) {\n\t\timageTag = serializeHyperlink(\n\t\t\tlinkResolver,\n\t\t\t{\n\t\t\t\ttype: RichTextNodeType.hyperlink,\n\t\t\t\tdata: node.linkTo,\n\t\t\t\tstart: 0,\n\t\t\t\tend: 0,\n\t\t\t},\n\t\t\t[imageTag],\n\t\t);\n\t}\n\n\treturn `<p class=\"block-img\">${imageTag}</p>`;\n};\n\nexport const serializeEmbed = (node: RTEmbedNode): string => {\n\treturn `<div data-oembed=\"${node.oembed.embed_url}\" data-oembed-type=\"${\n\t\tnode.oembed.type\n\t}\" data-oembed-provider=\"${node.oembed.provider_name}\"${getLabel(node)}>${\n\t\tnode.oembed.html\n\t}</div>`;\n};\n\nexport const serializeHyperlink = (\n\tlinkResolver:\n\t\t| LinkResolverFunction<string | null | undefined>\n\t\t| undefined\n\t\t| null,\n\tnode: RTLinkNode,\n\tchildren: string[],\n): string => {\n\tswitch (node.data.link_type) {\n\t\tcase LinkType.Web: {\n\t\t\treturn `<a href=\"${escapeHTML(node.data.url)}\" ${\n\t\t\t\tnode.data.target ? `target=\"${node.data.target}\" ` : \"\"\n\t\t\t}rel=\"noopener noreferrer\"${getLabel(node)}>${children.join(\"\")}</a>`;\n\t\t}\n\n\t\tcase LinkType.Document: {\n\t\t\treturn `<a href=\"${asLink(node.data, linkResolver)}\"${getLabel(\n\t\t\t\tnode,\n\t\t\t)}>${children.join(\"\")}</a>`;\n\t\t}\n\n\t\tcase LinkType.Media: {\n\t\t\treturn `<a href=\"${node.data.url}\"${getLabel(node)}>${children.join(\n\t\t\t\t\"\",\n\t\t\t)}</a>`;\n\t\t}\n\t}\n};\n\nexport const serializeSpan = (content?: string): string => {\n\treturn content ? escapeHTML(content).replace(/\\n/g, \"<br />\") : \"\";\n};\n"],"names":[],"mappings":";;;;AAea,MAAA,WAAW,CAAC,SAA4C;AAC7D,SAAA,UAAU,QAAQ,WAAW,KAAK,OACtC,WAAW,KAAK,KAAK,
|
|
1
|
+
{"version":3,"file":"serializerHelpers.js","sources":["../../../src/lib/serializerHelpers.ts"],"sourcesContent":["import { LinkType } from \"../types/value/link\";\nimport {\n\tRTBlockNode,\n\tRTEmbedNode,\n\tRTImageNode,\n\tRTInlineNode,\n\tRTLinkNode,\n\tRTPreformattedNode,\n\tRichTextNodeType,\n} from \"../types/value/richText\";\n\nimport { LinkResolverFunction, asLink } from \"../helpers/asLink\";\n\nimport { escapeHTML } from \"./escapeHTML\";\n\nexport const getLabel = (node: RTBlockNode | RTInlineNode): string => {\n\treturn \"data\" in node && \"label\" in node.data\n\t\t? ` class=\"${node.data.label}\"`\n\t\t: \"\";\n};\n\nexport const serializeStandardTag = (\n\ttag: string,\n\tnode: RTBlockNode | RTInlineNode,\n\tchildren: string[],\n): string => {\n\treturn `<${tag}${getLabel(node)}>${children.join(\"\")}</${tag}>`;\n};\n\nexport const serializePreFormatted = (node: RTPreformattedNode): string => {\n\treturn `<pre${getLabel(node)}>${escapeHTML(node.text)}</pre>`;\n};\n\nexport const serializeImage = (\n\tlinkResolver:\n\t\t| LinkResolverFunction<string | null | undefined>\n\t\t| undefined\n\t\t| null,\n\tnode: RTImageNode,\n): string => {\n\tlet imageTag = `<img src=\"${node.url}\" alt=\"${escapeHTML(node.alt)}\"${\n\t\tnode.copyright ? ` copyright=\"${escapeHTML(node.copyright)}\"` : \"\"\n\t} />`;\n\n\t// If the image has a link, we wrap it with an anchor tag\n\tif (node.linkTo) {\n\t\timageTag = serializeHyperlink(\n\t\t\tlinkResolver,\n\t\t\t{\n\t\t\t\ttype: RichTextNodeType.hyperlink,\n\t\t\t\tdata: node.linkTo,\n\t\t\t\tstart: 0,\n\t\t\t\tend: 0,\n\t\t\t},\n\t\t\t[imageTag],\n\t\t);\n\t}\n\n\treturn `<p class=\"block-img\">${imageTag}</p>`;\n};\n\nexport const serializeEmbed = (node: RTEmbedNode): string => {\n\treturn `<div data-oembed=\"${node.oembed.embed_url}\" data-oembed-type=\"${\n\t\tnode.oembed.type\n\t}\" data-oembed-provider=\"${node.oembed.provider_name}\"${getLabel(node)}>${\n\t\tnode.oembed.html\n\t}</div>`;\n};\n\nexport const serializeHyperlink = (\n\tlinkResolver:\n\t\t| LinkResolverFunction<string | null | undefined>\n\t\t| undefined\n\t\t| null,\n\tnode: RTLinkNode,\n\tchildren: string[],\n): string => {\n\tswitch (node.data.link_type) {\n\t\tcase LinkType.Web: {\n\t\t\treturn `<a href=\"${escapeHTML(node.data.url)}\" ${\n\t\t\t\tnode.data.target ? `target=\"${node.data.target}\" ` : \"\"\n\t\t\t}rel=\"noopener noreferrer\"${getLabel(node)}>${children.join(\"\")}</a>`;\n\t\t}\n\n\t\tcase LinkType.Document: {\n\t\t\treturn `<a href=\"${asLink(node.data, linkResolver)}\"${getLabel(\n\t\t\t\tnode,\n\t\t\t)}>${children.join(\"\")}</a>`;\n\t\t}\n\n\t\tcase LinkType.Media: {\n\t\t\treturn `<a href=\"${node.data.url}\"${getLabel(node)}>${children.join(\n\t\t\t\t\"\",\n\t\t\t)}</a>`;\n\t\t}\n\t}\n};\n\nexport const serializeSpan = (content?: string): string => {\n\treturn content ? escapeHTML(content).replace(/\\n/g, \"<br />\") : \"\";\n};\n"],"names":[],"mappings":";;;;AAea,MAAA,WAAW,CAAC,SAA4C;AAC7D,SAAA,UAAU,QAAQ,WAAW,KAAK,OACtC,WAAW,KAAK,KAAK,KAAK,MAC1B;AACJ;AAEO,MAAM,uBAAuB,CACnC,KACA,MACA,aACW;AACX,SAAO,IAAI,GAAG,GAAG,SAAS,IAAI,CAAC,IAAI,SAAS,KAAK,EAAE,CAAC,KAAK,GAAG;AAC7D;AAEa,MAAA,wBAAwB,CAAC,SAAoC;AAClE,SAAA,OAAO,SAAS,IAAI,CAAC,IAAI,WAAW,KAAK,IAAI,CAAC;AACtD;AAEa,MAAA,iBAAiB,CAC7B,cAIA,SACW;AACX,MAAI,WAAW,aAAa,KAAK,GAAG,UAAU,WAAW,KAAK,GAAG,CAAC,IACjE,KAAK,YAAY,eAAe,WAAW,KAAK,SAAS,CAAC,MAAM,EACjE;AAGA,MAAI,KAAK,QAAQ;AAChB,eAAW,mBACV,cACA;AAAA,MACC,MAAM,iBAAiB;AAAA,MACvB,MAAM,KAAK;AAAA,MACX,OAAO;AAAA,MACP,KAAK;AAAA,IAAA,GAEN,CAAC,QAAQ,CAAC;AAAA,EAEX;AAED,SAAO,wBAAwB,QAAQ;AACxC;AAEa,MAAA,iBAAiB,CAAC,SAA6B;AAC3D,SAAO,qBAAqB,KAAK,OAAO,SAAS,uBAChD,KAAK,OAAO,IACb,2BAA2B,KAAK,OAAO,aAAa,IAAI,SAAS,IAAI,CAAC,IACrE,KAAK,OAAO,IACb;AACD;AAEO,MAAM,qBAAqB,CACjC,cAIA,MACA,aACW;AACH,UAAA,KAAK,KAAK,WAAW;AAAA,IAC5B,KAAK,SAAS,KAAK;AACX,aAAA,YAAY,WAAW,KAAK,KAAK,GAAG,CAAC,KAC3C,KAAK,KAAK,SAAS,WAAW,KAAK,KAAK,MAAM,OAAO,EACtD,4BAA4B,SAAS,IAAI,CAAC,IAAI,SAAS,KAAK,EAAE,CAAC;AAAA,IAC/D;AAAA,IAED,KAAK,SAAS,UAAU;AACvB,aAAO,YAAY,OAAO,KAAK,MAAM,YAAY,CAAC,IAAI,SACrD,IAAI,CACJ,IAAI,SAAS,KAAK,EAAE,CAAC;AAAA,IACtB;AAAA,IAED,KAAK,SAAS,OAAO;AACpB,aAAO,YAAY,KAAK,KAAK,GAAG,IAAI,SAAS,IAAI,CAAC,IAAI,SAAS,KAC9D,EAAE,CACF;AAAA,IACD;AAAA,EACD;AACF;AAEa,MAAA,gBAAgB,CAAC,YAA4B;AACzD,SAAO,UAAU,WAAW,OAAO,EAAE,QAAQ,OAAO,QAAQ,IAAI;AACjE;"}
|
package/dist/package.json.cjs
CHANGED
package/dist/package.json.js
CHANGED
|
@@ -29,7 +29,9 @@ export interface Repository {
|
|
|
29
29
|
*/
|
|
30
30
|
types: Record<string, string>;
|
|
31
31
|
/**
|
|
32
|
-
*
|
|
32
|
+
* @deprecated Tags are only available in the forms object.
|
|
33
|
+
*
|
|
34
|
+
* @see More details in the blog post "A change to how the Prismic API handles tags": {@link https://prismic.io/blog/a-change-to-how-the-prismic-api-handles-tags}
|
|
33
35
|
*/
|
|
34
36
|
tags: string[];
|
|
35
37
|
/**
|
|
@@ -42,6 +44,9 @@ export interface Repository {
|
|
|
42
44
|
* The URL used to begin the OAuth process for the repository.
|
|
43
45
|
*/
|
|
44
46
|
oauth_initiate: string;
|
|
47
|
+
/**
|
|
48
|
+
* The token used for the OAuth process for the repository.
|
|
49
|
+
*/
|
|
45
50
|
oauth_token: string;
|
|
46
51
|
/**
|
|
47
52
|
* The version of the API.
|
|
@@ -14,6 +14,12 @@ export interface CustomTypeModel<ID extends string = string, Definition extends
|
|
|
14
14
|
* The human readable name of the custom type model.
|
|
15
15
|
*/
|
|
16
16
|
label: string | null | undefined;
|
|
17
|
+
/**
|
|
18
|
+
* The format of the custom type model.
|
|
19
|
+
*
|
|
20
|
+
* Fallback to "custom" if undefined.
|
|
21
|
+
*/
|
|
22
|
+
format?: "page" | "custom";
|
|
17
23
|
/**
|
|
18
24
|
* Determines if more than one document for the custom type can be created.
|
|
19
25
|
*/
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { AnyRegularField } from "./types";
|
|
2
2
|
import { GroupField } from "./group";
|
|
3
3
|
import { SliceZone } from "./sliceZone";
|
|
4
|
+
import { TimestampField } from "./timestamp";
|
|
4
5
|
/**
|
|
5
6
|
* Document metadata for a translation of a Prismic document.
|
|
6
7
|
*/
|
|
@@ -43,11 +44,11 @@ export interface PrismicDocumentHeader<TypeEnum = string, LangEnum = string> {
|
|
|
43
44
|
/**
|
|
44
45
|
* The timestamp at which the document was first published.
|
|
45
46
|
*/
|
|
46
|
-
first_publication_date:
|
|
47
|
+
first_publication_date: TimestampField<"filled">;
|
|
47
48
|
/**
|
|
48
49
|
* The timestamp at which the document was last published.
|
|
49
50
|
*/
|
|
50
|
-
last_publication_date:
|
|
51
|
+
last_publication_date: TimestampField<"filled">;
|
|
51
52
|
/**
|
|
52
53
|
* Slugs associated with document.
|
|
53
54
|
*
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prismicio/client",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.1.1",
|
|
4
4
|
"description": "The official JavaScript + TypeScript client library for Prismic",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"typescript",
|
|
@@ -60,32 +60,32 @@
|
|
|
60
60
|
},
|
|
61
61
|
"dependencies": {
|
|
62
62
|
"@prismicio/richtext": "^2.1.5",
|
|
63
|
-
"imgix-url-builder": "^0.0.
|
|
63
|
+
"imgix-url-builder": "^0.0.4"
|
|
64
64
|
},
|
|
65
65
|
"devDependencies": {
|
|
66
|
-
"@prismicio/mock": "^0.
|
|
67
|
-
"@prismicio/types-internal": "2.0.0
|
|
68
|
-
"@size-limit/preset-small-lib": "^8.2.
|
|
69
|
-
"@trivago/prettier-plugin-sort-imports": "^4.
|
|
70
|
-
"@typescript-eslint/eslint-plugin": "^
|
|
71
|
-
"@typescript-eslint/parser": "^
|
|
72
|
-
"@vitest/coverage-
|
|
66
|
+
"@prismicio/mock": "^0.3.1",
|
|
67
|
+
"@prismicio/types-internal": "2.0.0",
|
|
68
|
+
"@size-limit/preset-small-lib": "^8.2.6",
|
|
69
|
+
"@trivago/prettier-plugin-sort-imports": "^4.2.0",
|
|
70
|
+
"@typescript-eslint/eslint-plugin": "^6.3.0",
|
|
71
|
+
"@typescript-eslint/parser": "^6.3.0",
|
|
72
|
+
"@vitest/coverage-v8": "^0.34.1",
|
|
73
73
|
"abort-controller": "^3.0.0",
|
|
74
|
-
"eslint": "^8.
|
|
75
|
-
"eslint-config-prettier": "^
|
|
76
|
-
"eslint-plugin-prettier": "^
|
|
74
|
+
"eslint": "^8.47.0",
|
|
75
|
+
"eslint-config-prettier": "^9.0.0",
|
|
76
|
+
"eslint-plugin-prettier": "^5.0.0",
|
|
77
77
|
"eslint-plugin-tsdoc": "^0.2.17",
|
|
78
|
-
"msw": "^1.2.
|
|
79
|
-
"node-fetch": "^3.3.
|
|
80
|
-
"prettier": "^
|
|
81
|
-
"prettier-plugin-jsdoc": "^0.
|
|
82
|
-
"size-limit": "^8.2.
|
|
78
|
+
"msw": "^1.2.3",
|
|
79
|
+
"node-fetch": "^3.3.2",
|
|
80
|
+
"prettier": "^3.0.1",
|
|
81
|
+
"prettier-plugin-jsdoc": "^1.0.1",
|
|
82
|
+
"size-limit": "^8.2.6",
|
|
83
83
|
"standard-version": "^9.5.0",
|
|
84
84
|
"ts-expect": "^1.3.0",
|
|
85
|
-
"typescript": "^
|
|
86
|
-
"vite": "^4.
|
|
85
|
+
"typescript": "^4.9.5",
|
|
86
|
+
"vite": "^4.4.9",
|
|
87
87
|
"vite-plugin-sdk": "^0.1.1",
|
|
88
|
-
"vitest": "^0.
|
|
88
|
+
"vitest": "^0.34.1"
|
|
89
89
|
},
|
|
90
90
|
"engines": {
|
|
91
91
|
"node": ">=14.15.0"
|
package/src/buildQueryURL.ts
CHANGED
package/src/createClient.ts
CHANGED
|
@@ -370,6 +370,7 @@ export interface CreateClient {
|
|
|
370
370
|
*
|
|
371
371
|
* @typeParam TDocuments - A map of Prismic document type IDs mapped to their
|
|
372
372
|
* TypeScript type.
|
|
373
|
+
*
|
|
373
374
|
* @param repositoryNameOrEndpoint - The Prismic repository name or full Rest
|
|
374
375
|
* API V2 endpoint for the repository.
|
|
375
376
|
* @param options - Configuration that determines how content will be queried
|
|
@@ -664,7 +665,7 @@ export class Client<TDocuments extends PrismicDocument = PrismicDocument> {
|
|
|
664
665
|
return firstResult;
|
|
665
666
|
}
|
|
666
667
|
|
|
667
|
-
throw new
|
|
668
|
+
throw new NotFoundError("No documents were returned", url, undefined);
|
|
668
669
|
}
|
|
669
670
|
|
|
670
671
|
/**
|
|
@@ -732,6 +733,7 @@ export class Client<TDocuments extends PrismicDocument = PrismicDocument> {
|
|
|
732
733
|
* for all documents and is made available on its `id` property. A UID is
|
|
733
734
|
* provided in the Prismic editor and is unique among all documents of its
|
|
734
735
|
* custom type.
|
|
736
|
+
*
|
|
735
737
|
* @example
|
|
736
738
|
*
|
|
737
739
|
* ```ts
|
|
@@ -763,6 +765,7 @@ export class Client<TDocuments extends PrismicDocument = PrismicDocument> {
|
|
|
763
765
|
* for all documents and is made available on its `id` property. A UID is
|
|
764
766
|
* provided in the Prismic editor and is unique among all documents of its
|
|
765
767
|
* custom type.
|
|
768
|
+
*
|
|
766
769
|
* @example
|
|
767
770
|
*
|
|
768
771
|
* ```ts
|
|
@@ -800,6 +803,7 @@ export class Client<TDocuments extends PrismicDocument = PrismicDocument> {
|
|
|
800
803
|
* for all documents and is made available on its `id` property. A UID is
|
|
801
804
|
* provided in the Prismic editor and is unique among all documents of its
|
|
802
805
|
* custom type.
|
|
806
|
+
*
|
|
803
807
|
* @example
|
|
804
808
|
*
|
|
805
809
|
* ```ts
|
|
@@ -834,6 +838,7 @@ export class Client<TDocuments extends PrismicDocument = PrismicDocument> {
|
|
|
834
838
|
* for all documents and is made available on its `id` property. A UID is
|
|
835
839
|
* provided in the Prismic editor and is unique among all documents of its
|
|
836
840
|
* custom type.
|
|
841
|
+
*
|
|
837
842
|
* @example
|
|
838
843
|
*
|
|
839
844
|
* ```ts
|
|
@@ -874,6 +879,7 @@ export class Client<TDocuments extends PrismicDocument = PrismicDocument> {
|
|
|
874
879
|
* for all documents and is made available on its `id` property. A UID is
|
|
875
880
|
* provided in the Prismic editor and is unique among all documents of its
|
|
876
881
|
* custom type.
|
|
882
|
+
*
|
|
877
883
|
* @example
|
|
878
884
|
*
|
|
879
885
|
* ```ts
|
|
@@ -920,6 +926,7 @@ export class Client<TDocuments extends PrismicDocument = PrismicDocument> {
|
|
|
920
926
|
* for all documents and is made available on its `id` property. A UID is
|
|
921
927
|
* provided in the Prismic editor and is unique among all documents of its
|
|
922
928
|
* custom type.
|
|
929
|
+
*
|
|
923
930
|
* @example
|
|
924
931
|
*
|
|
925
932
|
* ```ts
|
|
@@ -964,6 +971,7 @@ export class Client<TDocuments extends PrismicDocument = PrismicDocument> {
|
|
|
964
971
|
* instance. For example, a repository may be configured to contain just one
|
|
965
972
|
* Settings document. This is in contrast to a repeatable custom type which
|
|
966
973
|
* allows multiple instances of itself.
|
|
974
|
+
*
|
|
967
975
|
* @example
|
|
968
976
|
*
|
|
969
977
|
* ```ts
|
package/src/getRepositoryName.ts
CHANGED
|
@@ -6,6 +6,7 @@ import { PrismicError } from "./errors/PrismicError";
|
|
|
6
6
|
*
|
|
7
7
|
* @typeParam RepositoryEndpoint - Prismic Rest API V2 endpoint for the
|
|
8
8
|
* repository.
|
|
9
|
+
*
|
|
9
10
|
* @param repositoryEndpoint - Prismic Rest API V2 endpoint for the repository.
|
|
10
11
|
*
|
|
11
12
|
* @returns The Prismic repository's name.
|
package/src/helpers/asHTML.ts
CHANGED
|
@@ -255,12 +255,6 @@ export const asHTML: {
|
|
|
255
255
|
*
|
|
256
256
|
* @deprecated Use object-style configuration instead.
|
|
257
257
|
*
|
|
258
|
-
* ```ts
|
|
259
|
-
* asHTML(field);
|
|
260
|
-
* asHTML(field, { linkResolver });
|
|
261
|
-
* asHTML(field, { serializer });
|
|
262
|
-
* asHTML(field, { linkResolver, serializer });
|
|
263
|
-
* ```
|
|
264
258
|
* @param richTextField - A rich text or title field from Prismic
|
|
265
259
|
* @param linkResolver - An optional link resolver function to resolve links,
|
|
266
260
|
* without it you're expected to use the `routes` options from the API
|
|
@@ -70,6 +70,7 @@ type AsImagePixelDensitySrcSetReturnType<
|
|
|
70
70
|
*
|
|
71
71
|
* @returns A `srcset` attribute value for the image field with Imgix URL
|
|
72
72
|
* parameters (if given). If the image field is empty, `null` is returned.
|
|
73
|
+
*
|
|
73
74
|
* @see Imgix URL parameters reference: https://docs.imgix.com/apis/rendering
|
|
74
75
|
*/
|
|
75
76
|
export const asImagePixelDensitySrcSet = <
|
|
@@ -27,6 +27,7 @@ type AsImageSrcReturnType<Field extends ImageFieldImage | null | undefined> =
|
|
|
27
27
|
*
|
|
28
28
|
* @returns The image field's image URL with transformations applied (if given).
|
|
29
29
|
* If the image field is empty, `null` is returned.
|
|
30
|
+
*
|
|
30
31
|
* @see Imgix URL parameters reference: https://docs.imgix.com/apis/rendering
|
|
31
32
|
*/
|
|
32
33
|
export const asImageSrc = <Field extends ImageFieldImage | null | undefined>(
|
|
@@ -74,6 +74,7 @@ type AsImageWidthSrcSetConfig = Omit<BuildWidthSrcSetParams, "widths"> & {
|
|
|
74
74
|
*
|
|
75
75
|
* @returns A `srcset` attribute value for the image field with Imgix URL
|
|
76
76
|
* parameters (if given). If the image field is empty, `null` is returned.
|
|
77
|
+
*
|
|
77
78
|
* @see Imgix URL parameters reference: https://docs.imgix.com/apis/rendering
|
|
78
79
|
*/
|
|
79
80
|
export const asImageWidthSrcSet = <
|
package/src/helpers/asLink.ts
CHANGED
|
@@ -10,6 +10,7 @@ import { documentToLinkField } from "./documentToLinkField";
|
|
|
10
10
|
*
|
|
11
11
|
* @typeParam ReturnType - Return type of your link resolver function, useful if
|
|
12
12
|
* you prefer to return a complex object
|
|
13
|
+
*
|
|
13
14
|
* @param linkToDocumentField - A document link field to resolve
|
|
14
15
|
*
|
|
15
16
|
* @returns Resolved URL
|
|
@@ -75,6 +76,7 @@ export const asLink: {
|
|
|
75
76
|
*
|
|
76
77
|
* @returns Resolved URL or, if the provided link field or document is empty,
|
|
77
78
|
* `null`
|
|
79
|
+
*
|
|
78
80
|
* @see Prismic link resolver documentation: {@link https://prismic.io/docs/route-resolver#link-resolver}
|
|
79
81
|
* @see Prismic API `routes` options documentation: {@link https://prismic.io/docs/route-resolver}
|
|
80
82
|
*/
|
|
@@ -95,10 +97,6 @@ export const asLink: {
|
|
|
95
97
|
*
|
|
96
98
|
* @deprecated Use object-style configuration instead.
|
|
97
99
|
*
|
|
98
|
-
* ```ts
|
|
99
|
-
* asLink(field);
|
|
100
|
-
* asLink(field, { linkResolver });
|
|
101
|
-
* ```
|
|
102
100
|
* @typeParam LinkResolverFunctionReturnType - link resolver function return
|
|
103
101
|
* type
|
|
104
102
|
* @typeParam Field - Link field or Prismic document to resolve to a URL
|
|
@@ -110,6 +108,7 @@ export const asLink: {
|
|
|
110
108
|
*
|
|
111
109
|
* @returns Resolved URL or, if the provided link field or document is empty,
|
|
112
110
|
* `null`
|
|
111
|
+
*
|
|
113
112
|
* @see Prismic link resolver documentation: {@link https://prismic.io/docs/route-resolver#link-resolver}
|
|
114
113
|
* @see Prismic API `routes` options documentation: {@link https://prismic.io/docs/route-resolver}
|
|
115
114
|
*/
|
|
@@ -77,11 +77,13 @@ type AsLinkAttrsReturnType<
|
|
|
77
77
|
* type
|
|
78
78
|
* @typeParam Field - Link field or Prismic document to resolve to link
|
|
79
79
|
* attributes
|
|
80
|
+
*
|
|
80
81
|
* @param linkFieldOrDocument - Any kind of link field or a document to resolve
|
|
81
82
|
* @param config - Configuration that determines the output of `asLinkAttrs()`
|
|
82
83
|
*
|
|
83
84
|
* @returns Resolved set of link attributes or, if the provided link field or
|
|
84
85
|
* document is empty, and empty object
|
|
86
|
+
*
|
|
85
87
|
* @see Prismic link resolver documentation: {@link https://prismic.io/docs/route-resolver#link-resolver}
|
|
86
88
|
* @see Prismic API `routes` options documentation: {@link https://prismic.io/docs/route-resolver}
|
|
87
89
|
*/
|
package/src/helpers/asText.ts
CHANGED
|
@@ -47,10 +47,6 @@ export const asText: {
|
|
|
47
47
|
*
|
|
48
48
|
* @deprecated Use object-style configuration instead.
|
|
49
49
|
*
|
|
50
|
-
* ```ts
|
|
51
|
-
* asText(field);
|
|
52
|
-
* asText(field, { separator });
|
|
53
|
-
* ```
|
|
54
50
|
* @param richTextField - A rich text or title field from Prismic
|
|
55
51
|
* @param separator - Separator used to join each element, defaults to a space
|
|
56
52
|
*
|