@prismicio/client 7.21.0-alpha.2 → 7.21.0-pr.414.8f3ed35
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/Client.cjs +1271 -0
- package/dist/Client.cjs.map +1 -0
- package/dist/Client.d.ts +981 -0
- package/dist/Client.js +1271 -0
- package/dist/Client.js.map +1 -0
- package/dist/Migration.cjs +297 -0
- package/dist/Migration.cjs.map +1 -0
- package/dist/Migration.d.ts +213 -0
- package/dist/Migration.js +297 -0
- package/dist/Migration.js.map +1 -0
- package/dist/WriteClient.cjs +575 -0
- package/dist/WriteClient.cjs.map +1 -0
- package/dist/WriteClient.d.ts +281 -0
- package/dist/WriteClient.js +575 -0
- package/dist/WriteClient.js.map +1 -0
- package/dist/buildQueryURL.cjs +69 -0
- package/dist/buildQueryURL.cjs.map +1 -0
- package/dist/buildQueryURL.d.ts +217 -0
- package/dist/buildQueryURL.js +69 -0
- package/dist/buildQueryURL.js.map +1 -0
- package/dist/cookie.cjs +5 -0
- package/dist/cookie.cjs.map +1 -0
- package/dist/cookie.d.ts +5 -0
- package/dist/cookie.js +5 -0
- package/dist/cookie.js.map +1 -0
- package/dist/createClient.cjs +6 -0
- package/dist/createClient.cjs.map +1 -0
- package/dist/createClient.d.ts +35 -0
- package/dist/createClient.js +6 -0
- package/dist/createClient.js.map +1 -0
- package/dist/createMigration.cjs +6 -0
- package/dist/createMigration.cjs.map +1 -0
- package/dist/createMigration.d.ts +24 -0
- package/dist/createMigration.js +6 -0
- package/dist/createMigration.js.map +1 -0
- package/dist/createWriteClient.cjs +6 -0
- package/dist/createWriteClient.cjs.map +1 -0
- package/dist/createWriteClient.d.ts +32 -0
- package/dist/createWriteClient.js +6 -0
- package/dist/createWriteClient.js.map +1 -0
- package/dist/errors/ForbiddenError.cjs +7 -0
- package/dist/errors/ForbiddenError.cjs.map +1 -0
- package/dist/errors/ForbiddenError.d.ts +11 -0
- package/dist/errors/ForbiddenError.js +7 -0
- package/dist/errors/ForbiddenError.js.map +1 -0
- package/dist/errors/InvalidDataError.cjs +7 -0
- package/dist/errors/InvalidDataError.cjs.map +1 -0
- package/dist/errors/InvalidDataError.d.ts +3 -0
- package/dist/errors/InvalidDataError.js +7 -0
- package/dist/errors/InvalidDataError.js.map +1 -0
- package/dist/errors/NotFoundError.cjs +7 -0
- package/dist/errors/NotFoundError.cjs.map +1 -0
- package/dist/errors/NotFoundError.d.ts +3 -0
- package/dist/errors/NotFoundError.js +7 -0
- package/dist/errors/NotFoundError.js.map +1 -0
- package/dist/errors/ParsingError.cjs +7 -0
- package/dist/errors/ParsingError.cjs.map +1 -0
- package/dist/errors/ParsingError.d.ts +14 -0
- package/dist/errors/ParsingError.js +7 -0
- package/dist/errors/ParsingError.js.map +1 -0
- package/dist/errors/PreviewTokenExpired.cjs +7 -0
- package/dist/errors/PreviewTokenExpired.cjs.map +1 -0
- package/dist/errors/PreviewTokenExpired.d.ts +8 -0
- package/dist/errors/PreviewTokenExpired.js +7 -0
- package/dist/errors/PreviewTokenExpired.js.map +1 -0
- package/dist/errors/PrismicError.cjs +13 -0
- package/dist/errors/PrismicError.cjs.map +1 -0
- package/dist/errors/PrismicError.d.ts +5 -0
- package/dist/errors/PrismicError.js +13 -0
- package/dist/errors/PrismicError.js.map +1 -0
- package/dist/errors/RefExpiredError.cjs +7 -0
- package/dist/errors/RefExpiredError.cjs.map +1 -0
- package/dist/errors/RefExpiredError.d.ts +8 -0
- package/dist/errors/RefExpiredError.js +7 -0
- package/dist/errors/RefExpiredError.js.map +1 -0
- package/dist/errors/RefNotFoundError.cjs +7 -0
- package/dist/errors/RefNotFoundError.cjs.map +1 -0
- package/dist/errors/RefNotFoundError.d.ts +8 -0
- package/dist/errors/RefNotFoundError.js +7 -0
- package/dist/errors/RefNotFoundError.js.map +1 -0
- package/dist/errors/RepositoryNotFoundError.cjs +7 -0
- package/dist/errors/RepositoryNotFoundError.cjs.map +1 -0
- package/dist/errors/RepositoryNotFoundError.d.ts +3 -0
- package/dist/errors/RepositoryNotFoundError.js +7 -0
- package/dist/errors/RepositoryNotFoundError.js.map +1 -0
- package/dist/filter.cjs +247 -0
- package/dist/filter.cjs.map +1 -0
- package/dist/filter.d.ts +209 -0
- package/dist/filter.js +247 -0
- package/dist/filter.js.map +1 -0
- package/dist/getGraphQLEndpoint.cjs +13 -0
- package/dist/getGraphQLEndpoint.cjs.map +1 -0
- package/dist/getGraphQLEndpoint.d.ts +10 -0
- package/dist/getGraphQLEndpoint.js +13 -0
- package/dist/getGraphQLEndpoint.js.map +1 -0
- package/dist/getRepositoryEndpoint.cjs +13 -0
- package/dist/getRepositoryEndpoint.cjs.map +1 -0
- package/dist/getRepositoryEndpoint.d.ts +19 -0
- package/dist/getRepositoryEndpoint.js +13 -0
- package/dist/getRepositoryEndpoint.js.map +1 -0
- package/dist/getRepositoryName.cjs +17 -0
- package/dist/getRepositoryName.cjs.map +1 -0
- package/dist/getRepositoryName.d.ts +12 -0
- package/dist/getRepositoryName.js +17 -0
- package/dist/getRepositoryName.js.map +1 -0
- package/dist/getToolbarSrc.cjs +13 -0
- package/dist/getToolbarSrc.cjs.map +1 -0
- package/dist/getToolbarSrc.d.ts +34 -0
- package/dist/getToolbarSrc.js +13 -0
- package/dist/getToolbarSrc.js.map +1 -0
- package/dist/helpers/asDate.cjs +14 -0
- package/dist/helpers/asDate.cjs.map +1 -0
- package/dist/helpers/asDate.d.ts +24 -0
- package/dist/helpers/asDate.js +14 -0
- package/dist/helpers/asDate.js.map +1 -0
- package/dist/helpers/asHTML.cjs +86 -0
- package/dist/helpers/asHTML.cjs.map +1 -0
- package/dist/helpers/asHTML.d.ts +149 -0
- package/dist/helpers/asHTML.js +86 -0
- package/dist/helpers/asHTML.js.map +1 -0
- package/dist/helpers/asImagePixelDensitySrcSet.cjs +21 -0
- package/dist/helpers/asImagePixelDensitySrcSet.cjs.map +1 -0
- package/dist/helpers/asImagePixelDensitySrcSet.d.ts +54 -0
- package/dist/helpers/asImagePixelDensitySrcSet.js +21 -0
- package/dist/helpers/asImagePixelDensitySrcSet.js.map +1 -0
- package/dist/helpers/asImageSrc.cjs +13 -0
- package/dist/helpers/asImageSrc.cjs.map +1 -0
- package/dist/helpers/asImageSrc.d.ts +29 -0
- package/dist/helpers/asImageSrc.js +13 -0
- package/dist/helpers/asImageSrc.js.map +1 -0
- package/dist/helpers/asImageWidthSrcSet.cjs +45 -0
- package/dist/helpers/asImageWidthSrcSet.cjs.map +1 -0
- package/dist/helpers/asImageWidthSrcSet.d.ts +62 -0
- package/dist/helpers/asImageWidthSrcSet.js +45 -0
- package/dist/helpers/asImageWidthSrcSet.js.map +1 -0
- package/dist/helpers/asLink.cjs +47 -0
- package/dist/helpers/asLink.cjs.map +1 -0
- package/dist/helpers/asLink.d.ts +78 -0
- package/dist/helpers/asLink.js +47 -0
- package/dist/helpers/asLink.js.map +1 -0
- package/dist/helpers/asLinkAttrs.cjs +28 -0
- package/dist/helpers/asLinkAttrs.cjs.map +1 -0
- package/dist/helpers/asLinkAttrs.d.ts +47 -0
- package/dist/helpers/asLinkAttrs.js +28 -0
- package/dist/helpers/asLinkAttrs.js.map +1 -0
- package/dist/helpers/asText.cjs +21 -0
- package/dist/helpers/asText.cjs.map +1 -0
- package/dist/helpers/asText.d.ts +57 -0
- package/dist/helpers/asText.js +21 -0
- package/dist/helpers/asText.js.map +1 -0
- package/dist/helpers/documentToLinkField.cjs +26 -0
- package/dist/helpers/documentToLinkField.cjs.map +1 -0
- package/dist/helpers/documentToLinkField.d.ts +17 -0
- package/dist/helpers/documentToLinkField.js +26 -0
- package/dist/helpers/documentToLinkField.js.map +1 -0
- package/dist/helpers/isFilled.cjs +77 -0
- package/dist/helpers/isFilled.cjs.map +1 -0
- package/dist/helpers/isFilled.d.ts +191 -0
- package/dist/helpers/isFilled.js +77 -0
- package/dist/helpers/isFilled.js.map +1 -0
- package/dist/helpers/mapSliceZone.cjs +42 -0
- package/dist/helpers/mapSliceZone.cjs.map +1 -0
- package/dist/helpers/mapSliceZone.d.ts +136 -0
- package/dist/helpers/mapSliceZone.js +42 -0
- package/dist/helpers/mapSliceZone.js.map +1 -0
- package/dist/index.cjs +94 -3880
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +129 -4349
- package/dist/index.js +99 -0
- package/dist/index.js.map +1 -0
- package/dist/isRepositoryEndpoint.cjs +12 -0
- package/dist/isRepositoryEndpoint.cjs.map +1 -0
- package/dist/isRepositoryEndpoint.d.ts +10 -0
- package/dist/isRepositoryEndpoint.js +12 -0
- package/dist/isRepositoryEndpoint.js.map +1 -0
- package/dist/isRepositoryName.cjs +7 -0
- package/dist/isRepositoryName.cjs.map +1 -0
- package/dist/isRepositoryName.d.ts +9 -0
- package/dist/isRepositoryName.js +7 -0
- package/dist/isRepositoryName.js.map +1 -0
- package/dist/lib/appendFilters.cjs +11 -0
- package/dist/lib/appendFilters.cjs.map +1 -0
- package/dist/lib/appendFilters.d.ts +18 -0
- package/dist/lib/appendFilters.js +11 -0
- package/dist/lib/appendFilters.js.map +1 -0
- package/dist/lib/castArray.cjs +7 -0
- package/dist/lib/castArray.cjs.map +1 -0
- package/dist/lib/castArray.d.ts +12 -0
- package/dist/lib/castArray.js +7 -0
- package/dist/lib/castArray.js.map +1 -0
- package/dist/lib/castThunk.cjs +7 -0
- package/dist/lib/castThunk.cjs.map +1 -0
- package/dist/lib/castThunk.d.ts +11 -0
- package/dist/lib/castThunk.js +7 -0
- package/dist/lib/castThunk.js.map +1 -0
- package/dist/lib/devMsg.cjs +8 -0
- package/dist/lib/devMsg.cjs.map +1 -0
- package/dist/lib/devMsg.d.ts +16 -0
- package/dist/lib/devMsg.js +8 -0
- package/dist/lib/devMsg.js.map +1 -0
- package/dist/lib/escapeHTML.cjs +43 -0
- package/dist/lib/escapeHTML.cjs.map +1 -0
- package/dist/lib/escapeHTML.d.ts +1 -0
- package/dist/lib/escapeHTML.js +43 -0
- package/dist/lib/escapeHTML.js.map +1 -0
- package/dist/lib/everyTagFilter.cjs +9 -0
- package/dist/lib/everyTagFilter.cjs.map +1 -0
- package/dist/lib/everyTagFilter.d.ts +9 -0
- package/dist/lib/everyTagFilter.js +9 -0
- package/dist/lib/everyTagFilter.js.map +1 -0
- package/dist/lib/findMasterRef.cjs +8 -0
- package/dist/lib/findMasterRef.cjs.map +1 -0
- package/dist/lib/findMasterRef.d.ts +11 -0
- package/dist/lib/findMasterRef.js +8 -0
- package/dist/lib/findMasterRef.js.map +1 -0
- package/dist/lib/findRef.cjs +12 -0
- package/dist/lib/findRef.cjs.map +1 -0
- package/dist/lib/findRef.d.ts +14 -0
- package/dist/lib/findRef.js +12 -0
- package/dist/lib/findRef.js.map +1 -0
- package/dist/lib/findRefByID.cjs +8 -0
- package/dist/lib/findRefByID.cjs.map +1 -0
- package/dist/lib/findRefByID.d.ts +12 -0
- package/dist/lib/findRefByID.js +8 -0
- package/dist/lib/findRefByID.js.map +1 -0
- package/dist/lib/findRefByLabel.cjs +8 -0
- package/dist/lib/findRefByLabel.cjs.map +1 -0
- package/dist/lib/findRefByLabel.d.ts +12 -0
- package/dist/lib/findRefByLabel.js +8 -0
- package/dist/lib/findRefByLabel.js.map +1 -0
- package/dist/lib/getOptionalLinkProperties.cjs +14 -0
- package/dist/lib/getOptionalLinkProperties.cjs.map +1 -0
- package/dist/lib/getOptionalLinkProperties.d.ts +12 -0
- package/dist/lib/getOptionalLinkProperties.js +14 -0
- package/dist/lib/getOptionalLinkProperties.js.map +1 -0
- package/dist/lib/getPreviewCookie.cjs +21 -0
- package/dist/lib/getPreviewCookie.cjs.map +1 -0
- package/dist/lib/getPreviewCookie.d.ts +9 -0
- package/dist/lib/getPreviewCookie.js +21 -0
- package/dist/lib/getPreviewCookie.js.map +1 -0
- package/dist/lib/isInternalURL.cjs +9 -0
- package/dist/lib/isInternalURL.cjs.map +1 -0
- package/dist/lib/isInternalURL.d.ts +8 -0
- package/dist/lib/isInternalURL.js +9 -0
- package/dist/lib/isInternalURL.js.map +1 -0
- package/dist/lib/isMigrationValue.cjs +24 -0
- package/dist/lib/isMigrationValue.cjs.map +1 -0
- package/dist/lib/isMigrationValue.d.ts +71 -0
- package/dist/lib/isMigrationValue.js +24 -0
- package/dist/lib/isMigrationValue.js.map +1 -0
- package/dist/lib/isValue.cjs +53 -0
- package/dist/lib/isValue.cjs.map +1 -0
- package/dist/lib/isValue.d.ts +78 -0
- package/dist/lib/isValue.js +53 -0
- package/dist/lib/isValue.js.map +1 -0
- package/dist/lib/minifyGraphQLQuery.cjs +7 -0
- package/dist/lib/minifyGraphQLQuery.cjs.map +1 -0
- package/dist/lib/minifyGraphQLQuery.d.ts +8 -0
- package/dist/lib/minifyGraphQLQuery.js +7 -0
- package/dist/lib/minifyGraphQLQuery.js.map +1 -0
- package/dist/lib/pLimit.cjs +48 -0
- package/dist/lib/pLimit.cjs.map +1 -0
- package/dist/lib/pLimit.d.ts +22 -0
- package/dist/lib/pLimit.js +48 -0
- package/dist/lib/pLimit.js.map +1 -0
- package/dist/lib/request.cjs +41 -0
- package/dist/lib/request.cjs.map +1 -0
- package/dist/lib/request.d.ts +73 -0
- package/dist/lib/request.js +41 -0
- package/dist/lib/request.js.map +1 -0
- package/dist/lib/resolveMigrationDocumentData.cjs +132 -0
- package/dist/lib/resolveMigrationDocumentData.cjs.map +1 -0
- package/dist/lib/resolveMigrationDocumentData.d.ts +54 -0
- package/dist/lib/resolveMigrationDocumentData.js +132 -0
- package/dist/lib/resolveMigrationDocumentData.js.map +1 -0
- package/dist/lib/serializerHelpers.cjs +113 -0
- package/dist/lib/serializerHelpers.cjs.map +1 -0
- package/dist/lib/serializerHelpers.d.ts +9 -0
- package/dist/lib/serializerHelpers.js +113 -0
- package/dist/lib/serializerHelpers.js.map +1 -0
- package/dist/lib/someTagsFilter.cjs +9 -0
- package/dist/lib/someTagsFilter.cjs.map +1 -0
- package/dist/lib/someTagsFilter.d.ts +9 -0
- package/dist/lib/someTagsFilter.js +9 -0
- package/dist/lib/someTagsFilter.js.map +1 -0
- package/dist/lib/throttledLog.cjs +17 -0
- package/dist/lib/throttledLog.cjs.map +1 -0
- package/dist/lib/throttledLog.d.ts +15 -0
- package/dist/lib/throttledLog.js +17 -0
- package/dist/lib/throttledLog.js.map +1 -0
- package/dist/lib/typeFilter.cjs +8 -0
- package/dist/lib/typeFilter.cjs.map +1 -0
- package/dist/lib/typeFilter.d.ts +8 -0
- package/dist/lib/typeFilter.js +8 -0
- package/dist/lib/typeFilter.js.map +1 -0
- package/dist/lib/validateAssetMetadata.cjs +28 -0
- package/dist/lib/validateAssetMetadata.cjs.map +1 -0
- package/dist/lib/validateAssetMetadata.d.ts +10 -0
- package/dist/lib/validateAssetMetadata.js +28 -0
- package/dist/lib/validateAssetMetadata.js.map +1 -0
- package/dist/package.json.cjs +7 -0
- package/dist/package.json.cjs.map +1 -0
- package/dist/package.json.js +7 -0
- package/dist/package.json.js.map +1 -0
- package/dist/richtext/asText.cjs +13 -0
- package/dist/richtext/asText.cjs.map +1 -0
- package/dist/richtext/asText.d.ts +12 -0
- package/dist/richtext/asText.js +13 -0
- package/dist/richtext/asText.js.map +1 -0
- package/dist/richtext/asTree.cjs +123 -0
- package/dist/richtext/asTree.cjs.map +1 -0
- package/dist/richtext/asTree.d.ts +14 -0
- package/dist/richtext/asTree.js +123 -0
- package/dist/richtext/asTree.js.map +1 -0
- package/dist/richtext/composeSerializers.cjs +17 -0
- package/dist/richtext/composeSerializers.cjs.map +1 -0
- package/dist/richtext/composeSerializers.d.ts +16 -0
- package/dist/richtext/composeSerializers.js +17 -0
- package/dist/richtext/composeSerializers.js.map +1 -0
- package/dist/richtext/index.d.ts +7 -78
- package/dist/richtext/serialize.cjs +19 -0
- package/dist/richtext/serialize.cjs.map +1 -0
- package/dist/richtext/serialize.d.ts +19 -0
- package/dist/richtext/serialize.js +19 -0
- package/dist/richtext/serialize.js.map +1 -0
- package/dist/richtext/types.cjs +11 -0
- package/dist/richtext/types.cjs.map +1 -0
- package/dist/richtext/types.d.ts +71 -0
- package/dist/richtext/types.js +11 -0
- package/dist/richtext/types.js.map +1 -0
- package/dist/richtext/wrapMapSerializer.cjs +24 -0
- package/dist/richtext/wrapMapSerializer.cjs.map +1 -0
- package/dist/richtext/wrapMapSerializer.d.ts +15 -0
- package/dist/richtext/wrapMapSerializer.js +24 -0
- package/dist/richtext/wrapMapSerializer.js.map +1 -0
- package/dist/richtext.cjs +15 -0
- package/dist/richtext.cjs.map +1 -0
- package/dist/richtext.js +15 -0
- package/dist/richtext.js.map +1 -0
- package/dist/types/api/asset/asset.d.ts +177 -0
- package/dist/types/api/asset/tag.d.ts +53 -0
- package/dist/types/api/integration.d.ts +28 -0
- package/dist/types/api/migration/document.d.ts +60 -0
- package/dist/types/api/query.d.ts +43 -0
- package/dist/types/api/ref.d.ts +32 -0
- package/dist/types/api/release.d.ts +11 -0
- package/dist/types/api/repository.d.ts +109 -0
- package/dist/types/api/tags.d.ts +9 -0
- package/dist/types/migration/Asset.cjs +30 -0
- package/dist/types/migration/Asset.cjs.map +1 -0
- package/dist/types/migration/Asset.d.ts +108 -0
- package/dist/types/migration/Asset.js +30 -0
- package/dist/types/migration/Asset.js.map +1 -0
- package/dist/types/migration/ContentRelationship.d.ts +16 -0
- package/dist/types/migration/Document.cjs +44 -0
- package/dist/types/migration/Document.cjs.map +1 -0
- package/dist/types/migration/Document.d.ts +94 -0
- package/dist/types/migration/Document.js +44 -0
- package/dist/types/migration/Document.js.map +1 -0
- package/dist/types/migration/Link.d.ts +19 -0
- package/dist/types/model/boolean.d.ts +15 -0
- package/dist/types/model/color.d.ts +13 -0
- package/dist/types/model/contentRelationship.d.ts +53 -0
- package/dist/types/model/customType.d.ts +48 -0
- package/dist/types/model/date.d.ts +14 -0
- package/dist/types/model/embed.d.ts +13 -0
- package/dist/types/model/geoPoint.d.ts +12 -0
- package/dist/types/model/group.d.ts +23 -0
- package/dist/types/model/image.d.ts +31 -0
- package/dist/types/model/integration.d.ts +14 -0
- package/dist/types/model/keyText.d.ts +13 -0
- package/dist/types/model/link.cjs +9 -0
- package/dist/types/model/link.cjs.map +1 -0
- package/dist/types/model/link.d.ts +28 -0
- package/dist/types/model/link.js +9 -0
- package/dist/types/model/link.js.map +1 -0
- package/dist/types/model/linkToMedia.d.ts +17 -0
- package/dist/types/model/number.d.ts +15 -0
- package/dist/types/model/range.d.ts +14 -0
- package/dist/types/model/richText.d.ts +37 -0
- package/dist/types/model/select.d.ts +18 -0
- package/dist/types/model/separator.d.ts +10 -0
- package/dist/types/model/sharedSlice.d.ts +16 -0
- package/dist/types/model/sharedSliceVariation.d.ts +19 -0
- package/dist/types/model/slice.cjs +8 -0
- package/dist/types/model/slice.cjs.map +1 -0
- package/dist/types/model/slice.d.ts +33 -0
- package/dist/types/model/slice.js +8 -0
- package/dist/types/model/slice.js.map +1 -0
- package/dist/types/model/sliceZone.cjs +8 -0
- package/dist/types/model/sliceZone.cjs.map +1 -0
- package/dist/types/model/sliceZone.d.ts +41 -0
- package/dist/types/model/sliceZone.js +8 -0
- package/dist/types/model/sliceZone.js.map +1 -0
- package/dist/types/model/table.d.ts +12 -0
- package/dist/types/model/timestamp.d.ts +14 -0
- package/dist/types/model/title.d.ts +7 -0
- package/dist/types/model/types.cjs +39 -0
- package/dist/types/model/types.cjs.map +1 -0
- package/dist/types/model/types.d.ts +76 -0
- package/dist/types/model/types.js +39 -0
- package/dist/types/model/types.js.map +1 -0
- package/dist/types/model/uid.d.ts +13 -0
- package/dist/types/value/boolean.d.ts +6 -0
- package/dist/types/value/color.d.ts +9 -0
- package/dist/types/value/contentRelationship.d.ts +31 -0
- package/dist/types/value/date.d.ts +9 -0
- package/dist/types/value/document.d.ts +114 -0
- package/dist/types/value/embed.cjs +10 -0
- package/dist/types/value/embed.cjs.map +1 -0
- package/dist/types/value/embed.d.ts +168 -0
- package/dist/types/value/embed.js +10 -0
- package/dist/types/value/embed.js.map +1 -0
- package/dist/types/value/geoPoint.d.ts +12 -0
- package/dist/types/value/group.d.ts +13 -0
- package/dist/types/value/image.d.ts +47 -0
- package/dist/types/value/integration.d.ts +16 -0
- package/dist/types/value/keyText.d.ts +9 -0
- package/dist/types/value/link.cjs +10 -0
- package/dist/types/value/link.cjs.map +1 -0
- package/dist/types/value/link.d.ts +68 -0
- package/dist/types/value/link.js +10 -0
- package/dist/types/value/link.js.map +1 -0
- package/dist/types/value/linkToMedia.d.ts +28 -0
- package/dist/types/value/number.d.ts +9 -0
- package/dist/types/value/richText.cjs +25 -0
- package/dist/types/value/richText.cjs.map +1 -0
- package/dist/types/value/richText.d.ts +215 -0
- package/dist/types/value/richText.js +25 -0
- package/dist/types/value/richText.js.map +1 -0
- package/dist/types/value/select.d.ts +10 -0
- package/dist/types/value/sharedSlice.d.ts +11 -0
- package/dist/types/value/sharedSliceVariation.d.ts +10 -0
- package/dist/types/value/slice.d.ts +13 -0
- package/dist/types/value/sliceZone.d.ts +12 -0
- package/dist/types/value/table.d.ts +91 -0
- package/dist/types/value/timestamp.d.ts +7 -0
- package/dist/types/value/title.d.ts +12 -0
- package/dist/types/value/types.d.ts +58 -0
- package/dist/types/webhook/apiUpdate.d.ts +52 -0
- package/dist/types/webhook/testTrigger.d.ts +9 -0
- package/dist/types/webhook/types.cjs +8 -0
- package/dist/types/webhook/types.cjs.map +1 -0
- package/dist/types/webhook/types.d.ts +18 -0
- package/dist/types/webhook/types.js +8 -0
- package/dist/types/webhook/types.js.map +1 -0
- package/package.json +39 -23
- package/src/Client.ts +25 -8
- package/src/WriteClient.ts +22 -33
- package/src/buildQueryURL.ts +4 -1
- package/src/createClient.ts +1 -1
- package/src/index.ts +1 -0
- package/src/types/model/contentRelationship.ts +1 -0
- package/src/types/value/date.ts +1 -1
- package/src/types/value/timestamp.ts +1 -5
- package/dist/index.d.cts +0 -4424
- package/dist/index.d.mts +0 -4424
- package/dist/index.mjs +0 -3837
- package/dist/index.mjs.map +0 -1
- package/dist/richtext/index.cjs +0 -244
- package/dist/richtext/index.cjs.map +0 -1
- package/dist/richtext/index.d.cts +0 -78
- package/dist/richtext/index.d.mts +0 -78
- package/dist/richtext/index.mjs +0 -237
- package/dist/richtext/index.mjs.map +0 -1
- package/dist/shared/client.TSGr56lO.d.cts +0 -899
- package/dist/shared/client.TSGr56lO.d.mts +0 -899
- package/dist/shared/client.TSGr56lO.d.ts +0 -899
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import type { AnyRegularField, FieldState } from "./types.js";
|
|
2
|
+
import type { FilledContentRelationshipField } from "./contentRelationship.js";
|
|
3
|
+
import type { GroupField } from "./group.js";
|
|
4
|
+
import type { FilledLinkToMediaField } from "./linkToMedia.js";
|
|
5
|
+
import type { SliceZone } from "./sliceZone.js";
|
|
6
|
+
/**
|
|
7
|
+
* Link types
|
|
8
|
+
*/
|
|
9
|
+
export declare const LinkType: {
|
|
10
|
+
readonly Any: "Any";
|
|
11
|
+
readonly Document: "Document";
|
|
12
|
+
readonly Media: "Media";
|
|
13
|
+
readonly Web: "Web";
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* A link field.
|
|
17
|
+
*
|
|
18
|
+
* @typeParam TypeEnum - Type API ID of the document.
|
|
19
|
+
* @typeParam LangEnum - Language API ID of the document.
|
|
20
|
+
* @typeParam DataInterface - Data fields for the document (filled via the
|
|
21
|
+
* `fetchLinks` or `graphQuery` query parameter).
|
|
22
|
+
* @typeParam State - State of the field which determines its shape.
|
|
23
|
+
* @typeParam Variant - Variants of the link.
|
|
24
|
+
*/
|
|
25
|
+
export type LinkField<TypeEnum = string, LangEnum = string, DataInterface extends Record<string, AnyRegularField | GroupField | SliceZone> | unknown = unknown, State extends FieldState = FieldState, Variant = string> = State extends "empty" ? EmptyLinkField<typeof LinkType.Any, Variant> : FilledLinkField<TypeEnum, LangEnum, DataInterface, Variant>;
|
|
26
|
+
/**
|
|
27
|
+
* A link field that is filled.
|
|
28
|
+
*
|
|
29
|
+
* @typeParam TypeEnum - Type API ID of the document.
|
|
30
|
+
* @typeParam LangEnum - Language API ID of the document.
|
|
31
|
+
* @typeParam DataInterface - Data fields for the document (filled via the
|
|
32
|
+
* `fetchLinks` or `graphQuery` query parameter).
|
|
33
|
+
* @typeParam Variant - Variants of the link.
|
|
34
|
+
*/
|
|
35
|
+
export type FilledLinkField<TypeEnum = string, LangEnum = string, DataInterface extends Record<string, AnyRegularField | GroupField | SliceZone> | unknown = unknown, Variant = string> = (FilledContentRelationshipField<TypeEnum, LangEnum, DataInterface> & OptionalLinkProperties<Variant>) | FilledLinkToMediaField<Variant> | FilledLinkToWebField<Variant>;
|
|
36
|
+
/**
|
|
37
|
+
* A link field that is not filled.
|
|
38
|
+
*
|
|
39
|
+
* @typeParam _Unused - THIS PARAMETER IS NOT USED. If you are passing a type,
|
|
40
|
+
* **please remove it**.
|
|
41
|
+
* @typeParam Variant - Variants of the link.
|
|
42
|
+
*/
|
|
43
|
+
export type EmptyLinkField<_Unused extends (typeof LinkType)[keyof typeof LinkType] = typeof LinkType.Any, Variant = string> = {
|
|
44
|
+
link_type: "Any";
|
|
45
|
+
} & OptionalLinkProperties<Variant>;
|
|
46
|
+
/**
|
|
47
|
+
* A link field pointing to a relative or absolute URL.
|
|
48
|
+
*
|
|
49
|
+
* @typeParam Variant - Variants of the link.
|
|
50
|
+
*/
|
|
51
|
+
export type FilledLinkToWebField<Variant = string> = {
|
|
52
|
+
link_type: "Web";
|
|
53
|
+
url: string;
|
|
54
|
+
target?: string;
|
|
55
|
+
} & OptionalLinkProperties<Variant>;
|
|
56
|
+
/**
|
|
57
|
+
* Optional properties available to link fields. It is used to augment existing
|
|
58
|
+
* link-like fields (like content relationship fields) with field-specific
|
|
59
|
+
* properties.
|
|
60
|
+
*
|
|
61
|
+
* @typeParam Variant - Variants of the link.
|
|
62
|
+
*
|
|
63
|
+
* @internal
|
|
64
|
+
*/
|
|
65
|
+
export type OptionalLinkProperties<Variant = string> = {
|
|
66
|
+
text?: string;
|
|
67
|
+
variant?: Variant;
|
|
68
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"link.js","sources":["../../../../src/types/value/link.ts"],"sourcesContent":["import type { AnyRegularField, FieldState } from \"./types\"\n\nimport type { FilledContentRelationshipField } from \"./contentRelationship\"\nimport type { GroupField } from \"./group\"\nimport type { FilledLinkToMediaField } from \"./linkToMedia\"\nimport type { SliceZone } from \"./sliceZone\"\n\n/**\n * Link types\n */\nexport const LinkType = {\n\tAny: \"Any\",\n\tDocument: \"Document\",\n\tMedia: \"Media\",\n\tWeb: \"Web\",\n} as const\n\n/**\n * A link field.\n *\n * @typeParam TypeEnum - Type API ID of the document.\n * @typeParam LangEnum - Language API ID of the document.\n * @typeParam DataInterface - Data fields for the document (filled via the\n * `fetchLinks` or `graphQuery` query parameter).\n * @typeParam State - State of the field which determines its shape.\n * @typeParam Variant - Variants of the link.\n */\nexport type LinkField<\n\tTypeEnum = string,\n\tLangEnum = string,\n\tDataInterface extends\n\t\t| Record<string, AnyRegularField | GroupField | SliceZone>\n\t\t| unknown = unknown,\n\tState extends FieldState = FieldState,\n\tVariant = string,\n> = State extends \"empty\"\n\t? EmptyLinkField<typeof LinkType.Any, Variant>\n\t: FilledLinkField<TypeEnum, LangEnum, DataInterface, Variant>\n\n/**\n * A link field that is filled.\n *\n * @typeParam TypeEnum - Type API ID of the document.\n * @typeParam LangEnum - Language API ID of the document.\n * @typeParam DataInterface - Data fields for the document (filled via the\n * `fetchLinks` or `graphQuery` query parameter).\n * @typeParam Variant - Variants of the link.\n */\nexport type FilledLinkField<\n\tTypeEnum = string,\n\tLangEnum = string,\n\tDataInterface extends\n\t\t| Record<string, AnyRegularField | GroupField | SliceZone>\n\t\t| unknown = unknown,\n\tVariant = string,\n> =\n\t| (FilledContentRelationshipField<TypeEnum, LangEnum, DataInterface> &\n\t\t\tOptionalLinkProperties<Variant>)\n\t| FilledLinkToMediaField<Variant>\n\t| FilledLinkToWebField<Variant>\n\n/**\n * A link field that is not filled.\n *\n * @typeParam _Unused - THIS PARAMETER IS NOT USED. If you are passing a type,\n * **please remove it**.\n * @typeParam Variant - Variants of the link.\n */\nexport type EmptyLinkField<\n\t_Unused extends\n\t\t(typeof LinkType)[keyof typeof LinkType] = typeof LinkType.Any,\n\tVariant = string,\n> = {\n\tlink_type: \"Any\"\n} & OptionalLinkProperties<Variant>\n\n/**\n * A link field pointing to a relative or absolute URL.\n *\n * @typeParam Variant - Variants of the link.\n */\nexport type FilledLinkToWebField<Variant = string> = {\n\tlink_type: \"Web\"\n\turl: string\n\ttarget?: string\n} & OptionalLinkProperties<Variant>\n\n/**\n * Optional properties available to link fields. It is used to augment existing\n * link-like fields (like content relationship fields) with field-specific\n * properties.\n *\n * @typeParam Variant - Variants of the link.\n *\n * @internal\n */\n// Remember to update the `getOptionalLinkProperties()` function when updating\n// this type. The function should check for every property.\nexport type OptionalLinkProperties<Variant = string> = {\n\ttext?: string\n\tvariant?: Variant\n}\n"],"names":[],"mappings":"AAUO,MAAM,WAAW;AAAA,EACvB,KAAK;AAAA,EACL,UAAU;AAAA,EACV,OAAO;AAAA,EACP,KAAK;;"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { FieldState } from "./types.js";
|
|
2
|
+
import type { OptionalLinkProperties } from "./link.js";
|
|
3
|
+
/**
|
|
4
|
+
* A link field that points to media.
|
|
5
|
+
*
|
|
6
|
+
* @typeParam State - State of the field which determines its shape.
|
|
7
|
+
* @typeParam Variant - Variants of the link.
|
|
8
|
+
*/
|
|
9
|
+
export type LinkToMediaField<State extends FieldState = FieldState, Variant = string> = State extends "empty" ? EmptyLinkToMediaField<Variant> : FilledLinkToMediaField<Variant>;
|
|
10
|
+
type EmptyLinkToMediaField<Variant = string> = {
|
|
11
|
+
link_type: "Any";
|
|
12
|
+
} & OptionalLinkProperties<Variant>;
|
|
13
|
+
/**
|
|
14
|
+
* A link that points to media.
|
|
15
|
+
*
|
|
16
|
+
* @typeParam Variant - Variants of the link.
|
|
17
|
+
*/
|
|
18
|
+
export type FilledLinkToMediaField<Variant = string> = {
|
|
19
|
+
id: string;
|
|
20
|
+
link_type: "Media";
|
|
21
|
+
name: string;
|
|
22
|
+
kind: string;
|
|
23
|
+
url: string;
|
|
24
|
+
size: string;
|
|
25
|
+
height?: string | null;
|
|
26
|
+
width?: string | null;
|
|
27
|
+
} & OptionalLinkProperties<Variant>;
|
|
28
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { FieldState } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* A number field.
|
|
4
|
+
*
|
|
5
|
+
* @typeParam State - State of the field which determines its shape.
|
|
6
|
+
*
|
|
7
|
+
* @see More details: {@link https://prismic.io/docs/number}
|
|
8
|
+
*/
|
|
9
|
+
export type NumberField<State extends FieldState = FieldState> = State extends "empty" ? null : number;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const RichTextNodeType = {
|
|
4
|
+
heading1: "heading1",
|
|
5
|
+
heading2: "heading2",
|
|
6
|
+
heading3: "heading3",
|
|
7
|
+
heading4: "heading4",
|
|
8
|
+
heading5: "heading5",
|
|
9
|
+
heading6: "heading6",
|
|
10
|
+
paragraph: "paragraph",
|
|
11
|
+
preformatted: "preformatted",
|
|
12
|
+
strong: "strong",
|
|
13
|
+
em: "em",
|
|
14
|
+
listItem: "list-item",
|
|
15
|
+
oListItem: "o-list-item",
|
|
16
|
+
list: "group-list-item",
|
|
17
|
+
oList: "group-o-list-item",
|
|
18
|
+
image: "image",
|
|
19
|
+
embed: "embed",
|
|
20
|
+
hyperlink: "hyperlink",
|
|
21
|
+
label: "label",
|
|
22
|
+
span: "span"
|
|
23
|
+
};
|
|
24
|
+
exports.RichTextNodeType = RichTextNodeType;
|
|
25
|
+
//# sourceMappingURL=richText.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"richText.cjs","sources":["../../../../src/types/value/richText.ts"],"sourcesContent":["import type { FieldState } from \"./types\"\n\nimport type { EmbedField } from \"./embed\"\nimport type { FilledLinkField } from \"./link\"\n\n/**\n * Types enum for RichTextNodes\n *\n * @see More details: {@link https://prismic.io/docs/rich-text-title}\n */\nexport const RichTextNodeType = {\n\theading1: \"heading1\",\n\theading2: \"heading2\",\n\theading3: \"heading3\",\n\theading4: \"heading4\",\n\theading5: \"heading5\",\n\theading6: \"heading6\",\n\tparagraph: \"paragraph\",\n\tpreformatted: \"preformatted\",\n\tstrong: \"strong\",\n\tem: \"em\",\n\tlistItem: \"list-item\",\n\toListItem: \"o-list-item\",\n\tlist: \"group-list-item\",\n\toList: \"group-o-list-item\",\n\timage: \"image\",\n\tembed: \"embed\",\n\thyperlink: \"hyperlink\",\n\tlabel: \"label\",\n\tspan: \"span\",\n} as const\n\n/**\n * Types for RichTextNodes\n *\n * @see More details: {@link https://prismic.io/docs/rich-text-title}\n */\nexport type RichTextNodeTypes =\n\t(typeof RichTextNodeType)[keyof typeof RichTextNodeType]\n\n// Text nodes\n\n/**\n * Base to be extended by other rich text nodes.\n */\nexport interface RTTextNodeBase {\n\ttext: string\n\tspans: RTInlineNode[]\n\tdirection?: \"ltr\" | \"rtl\"\n}\n\n/**\n * Rich text `heading1` node\n */\nexport interface RTHeading1Node extends RTTextNodeBase {\n\ttype: typeof RichTextNodeType.heading1\n}\n\n/**\n * Rich text `heading2` node\n */\nexport interface RTHeading2Node extends RTTextNodeBase {\n\ttype: typeof RichTextNodeType.heading2\n}\n\n/**\n * Rich text `heading3` node\n */\nexport interface RTHeading3Node extends RTTextNodeBase {\n\ttype: typeof RichTextNodeType.heading3\n}\n\n/**\n * Rich text `heading4` node\n */\nexport interface RTHeading4Node extends RTTextNodeBase {\n\ttype: typeof RichTextNodeType.heading4\n}\n\n/**\n * Rich text `heading5` node\n */\nexport interface RTHeading5Node extends RTTextNodeBase {\n\ttype: typeof RichTextNodeType.heading5\n}\n\n/**\n * Rich text `heading6` node\n */\nexport interface RTHeading6Node extends RTTextNodeBase {\n\ttype: typeof RichTextNodeType.heading6\n}\n\n/**\n * Rich text `paragraph` node\n */\nexport interface RTParagraphNode extends RTTextNodeBase {\n\ttype: typeof RichTextNodeType.paragraph\n}\n\n/**\n * Rich text `preformatted` node\n */\nexport interface RTPreformattedNode extends RTTextNodeBase {\n\ttype: typeof RichTextNodeType.preformatted\n}\n\n/**\n * Rich text `list-item` node\n */\nexport interface RTListItemNode extends RTTextNodeBase {\n\ttype: typeof RichTextNodeType.listItem\n}\n\n/**\n * Rich text `o-list-item` node for ordered lists\n */\nexport interface RTOListItemNode extends RTTextNodeBase {\n\ttype: typeof RichTextNodeType.oListItem\n}\n\n// Span nodes\n\n/**\n * @internal Span Node base to be extended for other Span nodes\n */\nexport interface RTSpanNodeBase {\n\tstart: number\n\tend: number\n}\n/**\n * Rich text `strong` node\n */\nexport interface RTStrongNode extends RTSpanNodeBase {\n\ttype: typeof RichTextNodeType.strong\n}\n\n/**\n * Rich text `embed` node\n */\nexport interface RTEmNode extends RTSpanNodeBase {\n\ttype: typeof RichTextNodeType.em\n}\n\n/**\n * Rich text `label` node\n */\nexport interface RTLabelNode extends RTSpanNodeBase {\n\ttype: typeof RichTextNodeType.label\n\tdata: {\n\t\tlabel: string\n\t}\n}\n\n// Media nodes\n\n/**\n * Rich text `image` nodes. They could link to other documents, external web\n * links and media fields\n */\nexport type RTImageNode = {\n\ttype: typeof RichTextNodeType.image\n\tid: string\n\turl: string\n\talt: string | null\n\tcopyright: string | null\n\tdimensions: {\n\t\twidth: number\n\t\theight: number\n\t}\n\tedit: {\n\t\tx: number\n\t\ty: number\n\t\tzoom: number\n\t\tbackground: string\n\t}\n\tlinkTo?: FilledLinkField\n}\n\n/**\n * Rich text `embed` node\n */\nexport type RTEmbedNode = {\n\ttype: typeof RichTextNodeType.embed\n\toembed: EmbedField\n}\n\n// Link nodes\n\n/**\n * Rich text `a` node\n *\n * @see More details: {@link https://prismic.io/docs/rich-text-title#elements-and-styles}\n */\nexport interface RTLinkNode extends RTSpanNodeBase {\n\ttype: typeof RichTextNodeType.hyperlink\n\tdata: FilledLinkField\n}\n\n// Serialization related nodes\n\n/**\n * Rich text `list` node\n */\nexport interface RTListNode {\n\ttype: typeof RichTextNodeType.list\n\titems: RTListItemNode[]\n}\n\n/**\n * Rich text o-lost node\n */\nexport interface RTOListNode {\n\ttype: typeof RichTextNodeType.oList\n\titems: RTOListItemNode[]\n}\n\n// This one is confusing but it's actually the inner content of a block\n/**\n * Rich text `span` node\n */\nexport interface RTSpanNode extends RTTextNodeBase {\n\ttype: typeof RichTextNodeType.span\n}\n\n// Helpers\n\n/**\n * Nodes from a rich text field\n */\nexport type RTNode =\n\t| RTHeading1Node\n\t| RTHeading2Node\n\t| RTHeading3Node\n\t| RTHeading4Node\n\t| RTHeading5Node\n\t| RTHeading6Node\n\t| RTParagraphNode\n\t| RTPreformattedNode\n\t| RTListItemNode\n\t| RTOListItemNode\n\t| RTImageNode\n\t| RTEmbedNode\n\n/**\n * Rich text nodes with text\n */\nexport type RTTextNode =\n\t| RTHeading1Node\n\t| RTHeading2Node\n\t| RTHeading3Node\n\t| RTHeading4Node\n\t| RTHeading5Node\n\t| RTHeading6Node\n\t| RTParagraphNode\n\t| RTPreformattedNode\n\t| RTListItemNode\n\t| RTOListItemNode\n\n/**\n * Rich text block nodes\n */\nexport type RTBlockNode =\n\t| RTHeading1Node\n\t| RTHeading2Node\n\t| RTHeading3Node\n\t| RTHeading4Node\n\t| RTHeading5Node\n\t| RTHeading6Node\n\t| RTParagraphNode\n\t| RTPreformattedNode\n\t| RTListItemNode\n\t| RTOListItemNode\n\t| RTListNode\n\t| RTOListNode\n\t| RTImageNode\n\t| RTEmbedNode\n\n/**\n * Inline rich text nodes\n */\nexport type RTInlineNode = RTStrongNode | RTEmNode | RTLabelNode | RTLinkNode\n\n/**\n * All rich text nodes\n */\nexport type RTAnyNode = RTBlockNode | RTInlineNode | RTSpanNode\n\n/**\n * A rich text field.\n *\n * @see Rich text field documentation: {@link https://prismic.io/docs/rich-text-title}\n */\nexport type RichTextField<State extends FieldState = FieldState> =\n\tState extends \"empty\" ? [] : [RTNode, ...RTNode[]]\n"],"names":[],"mappings":";;AAUO,MAAM,mBAAmB;AAAA,EAC/B,UAAU;AAAA,EACV,UAAU;AAAA,EACV,UAAU;AAAA,EACV,UAAU;AAAA,EACV,UAAU;AAAA,EACV,UAAU;AAAA,EACV,WAAW;AAAA,EACX,cAAc;AAAA,EACd,QAAQ;AAAA,EACR,IAAI;AAAA,EACJ,UAAU;AAAA,EACV,WAAW;AAAA,EACX,MAAM;AAAA,EACN,OAAO;AAAA,EACP,OAAO;AAAA,EACP,OAAO;AAAA,EACP,WAAW;AAAA,EACX,OAAO;AAAA,EACP,MAAM;;;"}
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
import type { FieldState } from "./types.js";
|
|
2
|
+
import type { EmbedField } from "./embed.js";
|
|
3
|
+
import type { FilledLinkField } from "./link.js";
|
|
4
|
+
/**
|
|
5
|
+
* Types enum for RichTextNodes
|
|
6
|
+
*
|
|
7
|
+
* @see More details: {@link https://prismic.io/docs/rich-text-title}
|
|
8
|
+
*/
|
|
9
|
+
export declare const RichTextNodeType: {
|
|
10
|
+
readonly heading1: "heading1";
|
|
11
|
+
readonly heading2: "heading2";
|
|
12
|
+
readonly heading3: "heading3";
|
|
13
|
+
readonly heading4: "heading4";
|
|
14
|
+
readonly heading5: "heading5";
|
|
15
|
+
readonly heading6: "heading6";
|
|
16
|
+
readonly paragraph: "paragraph";
|
|
17
|
+
readonly preformatted: "preformatted";
|
|
18
|
+
readonly strong: "strong";
|
|
19
|
+
readonly em: "em";
|
|
20
|
+
readonly listItem: "list-item";
|
|
21
|
+
readonly oListItem: "o-list-item";
|
|
22
|
+
readonly list: "group-list-item";
|
|
23
|
+
readonly oList: "group-o-list-item";
|
|
24
|
+
readonly image: "image";
|
|
25
|
+
readonly embed: "embed";
|
|
26
|
+
readonly hyperlink: "hyperlink";
|
|
27
|
+
readonly label: "label";
|
|
28
|
+
readonly span: "span";
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* Types for RichTextNodes
|
|
32
|
+
*
|
|
33
|
+
* @see More details: {@link https://prismic.io/docs/rich-text-title}
|
|
34
|
+
*/
|
|
35
|
+
export type RichTextNodeTypes = (typeof RichTextNodeType)[keyof typeof RichTextNodeType];
|
|
36
|
+
/**
|
|
37
|
+
* Base to be extended by other rich text nodes.
|
|
38
|
+
*/
|
|
39
|
+
export interface RTTextNodeBase {
|
|
40
|
+
text: string;
|
|
41
|
+
spans: RTInlineNode[];
|
|
42
|
+
direction?: "ltr" | "rtl";
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Rich text `heading1` node
|
|
46
|
+
*/
|
|
47
|
+
export interface RTHeading1Node extends RTTextNodeBase {
|
|
48
|
+
type: typeof RichTextNodeType.heading1;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Rich text `heading2` node
|
|
52
|
+
*/
|
|
53
|
+
export interface RTHeading2Node extends RTTextNodeBase {
|
|
54
|
+
type: typeof RichTextNodeType.heading2;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Rich text `heading3` node
|
|
58
|
+
*/
|
|
59
|
+
export interface RTHeading3Node extends RTTextNodeBase {
|
|
60
|
+
type: typeof RichTextNodeType.heading3;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Rich text `heading4` node
|
|
64
|
+
*/
|
|
65
|
+
export interface RTHeading4Node extends RTTextNodeBase {
|
|
66
|
+
type: typeof RichTextNodeType.heading4;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Rich text `heading5` node
|
|
70
|
+
*/
|
|
71
|
+
export interface RTHeading5Node extends RTTextNodeBase {
|
|
72
|
+
type: typeof RichTextNodeType.heading5;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Rich text `heading6` node
|
|
76
|
+
*/
|
|
77
|
+
export interface RTHeading6Node extends RTTextNodeBase {
|
|
78
|
+
type: typeof RichTextNodeType.heading6;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Rich text `paragraph` node
|
|
82
|
+
*/
|
|
83
|
+
export interface RTParagraphNode extends RTTextNodeBase {
|
|
84
|
+
type: typeof RichTextNodeType.paragraph;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Rich text `preformatted` node
|
|
88
|
+
*/
|
|
89
|
+
export interface RTPreformattedNode extends RTTextNodeBase {
|
|
90
|
+
type: typeof RichTextNodeType.preformatted;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Rich text `list-item` node
|
|
94
|
+
*/
|
|
95
|
+
export interface RTListItemNode extends RTTextNodeBase {
|
|
96
|
+
type: typeof RichTextNodeType.listItem;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Rich text `o-list-item` node for ordered lists
|
|
100
|
+
*/
|
|
101
|
+
export interface RTOListItemNode extends RTTextNodeBase {
|
|
102
|
+
type: typeof RichTextNodeType.oListItem;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* @internal Span Node base to be extended for other Span nodes
|
|
106
|
+
*/
|
|
107
|
+
export interface RTSpanNodeBase {
|
|
108
|
+
start: number;
|
|
109
|
+
end: number;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Rich text `strong` node
|
|
113
|
+
*/
|
|
114
|
+
export interface RTStrongNode extends RTSpanNodeBase {
|
|
115
|
+
type: typeof RichTextNodeType.strong;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Rich text `embed` node
|
|
119
|
+
*/
|
|
120
|
+
export interface RTEmNode extends RTSpanNodeBase {
|
|
121
|
+
type: typeof RichTextNodeType.em;
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Rich text `label` node
|
|
125
|
+
*/
|
|
126
|
+
export interface RTLabelNode extends RTSpanNodeBase {
|
|
127
|
+
type: typeof RichTextNodeType.label;
|
|
128
|
+
data: {
|
|
129
|
+
label: string;
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Rich text `image` nodes. They could link to other documents, external web
|
|
134
|
+
* links and media fields
|
|
135
|
+
*/
|
|
136
|
+
export type RTImageNode = {
|
|
137
|
+
type: typeof RichTextNodeType.image;
|
|
138
|
+
id: string;
|
|
139
|
+
url: string;
|
|
140
|
+
alt: string | null;
|
|
141
|
+
copyright: string | null;
|
|
142
|
+
dimensions: {
|
|
143
|
+
width: number;
|
|
144
|
+
height: number;
|
|
145
|
+
};
|
|
146
|
+
edit: {
|
|
147
|
+
x: number;
|
|
148
|
+
y: number;
|
|
149
|
+
zoom: number;
|
|
150
|
+
background: string;
|
|
151
|
+
};
|
|
152
|
+
linkTo?: FilledLinkField;
|
|
153
|
+
};
|
|
154
|
+
/**
|
|
155
|
+
* Rich text `embed` node
|
|
156
|
+
*/
|
|
157
|
+
export type RTEmbedNode = {
|
|
158
|
+
type: typeof RichTextNodeType.embed;
|
|
159
|
+
oembed: EmbedField;
|
|
160
|
+
};
|
|
161
|
+
/**
|
|
162
|
+
* Rich text `a` node
|
|
163
|
+
*
|
|
164
|
+
* @see More details: {@link https://prismic.io/docs/rich-text-title#elements-and-styles}
|
|
165
|
+
*/
|
|
166
|
+
export interface RTLinkNode extends RTSpanNodeBase {
|
|
167
|
+
type: typeof RichTextNodeType.hyperlink;
|
|
168
|
+
data: FilledLinkField;
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Rich text `list` node
|
|
172
|
+
*/
|
|
173
|
+
export interface RTListNode {
|
|
174
|
+
type: typeof RichTextNodeType.list;
|
|
175
|
+
items: RTListItemNode[];
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Rich text o-lost node
|
|
179
|
+
*/
|
|
180
|
+
export interface RTOListNode {
|
|
181
|
+
type: typeof RichTextNodeType.oList;
|
|
182
|
+
items: RTOListItemNode[];
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Rich text `span` node
|
|
186
|
+
*/
|
|
187
|
+
export interface RTSpanNode extends RTTextNodeBase {
|
|
188
|
+
type: typeof RichTextNodeType.span;
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* Nodes from a rich text field
|
|
192
|
+
*/
|
|
193
|
+
export type RTNode = RTHeading1Node | RTHeading2Node | RTHeading3Node | RTHeading4Node | RTHeading5Node | RTHeading6Node | RTParagraphNode | RTPreformattedNode | RTListItemNode | RTOListItemNode | RTImageNode | RTEmbedNode;
|
|
194
|
+
/**
|
|
195
|
+
* Rich text nodes with text
|
|
196
|
+
*/
|
|
197
|
+
export type RTTextNode = RTHeading1Node | RTHeading2Node | RTHeading3Node | RTHeading4Node | RTHeading5Node | RTHeading6Node | RTParagraphNode | RTPreformattedNode | RTListItemNode | RTOListItemNode;
|
|
198
|
+
/**
|
|
199
|
+
* Rich text block nodes
|
|
200
|
+
*/
|
|
201
|
+
export type RTBlockNode = RTHeading1Node | RTHeading2Node | RTHeading3Node | RTHeading4Node | RTHeading5Node | RTHeading6Node | RTParagraphNode | RTPreformattedNode | RTListItemNode | RTOListItemNode | RTListNode | RTOListNode | RTImageNode | RTEmbedNode;
|
|
202
|
+
/**
|
|
203
|
+
* Inline rich text nodes
|
|
204
|
+
*/
|
|
205
|
+
export type RTInlineNode = RTStrongNode | RTEmNode | RTLabelNode | RTLinkNode;
|
|
206
|
+
/**
|
|
207
|
+
* All rich text nodes
|
|
208
|
+
*/
|
|
209
|
+
export type RTAnyNode = RTBlockNode | RTInlineNode | RTSpanNode;
|
|
210
|
+
/**
|
|
211
|
+
* A rich text field.
|
|
212
|
+
*
|
|
213
|
+
* @see Rich text field documentation: {@link https://prismic.io/docs/rich-text-title}
|
|
214
|
+
*/
|
|
215
|
+
export type RichTextField<State extends FieldState = FieldState> = State extends "empty" ? [] : [RTNode, ...RTNode[]];
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
const RichTextNodeType = {
|
|
2
|
+
heading1: "heading1",
|
|
3
|
+
heading2: "heading2",
|
|
4
|
+
heading3: "heading3",
|
|
5
|
+
heading4: "heading4",
|
|
6
|
+
heading5: "heading5",
|
|
7
|
+
heading6: "heading6",
|
|
8
|
+
paragraph: "paragraph",
|
|
9
|
+
preformatted: "preformatted",
|
|
10
|
+
strong: "strong",
|
|
11
|
+
em: "em",
|
|
12
|
+
listItem: "list-item",
|
|
13
|
+
oListItem: "o-list-item",
|
|
14
|
+
list: "group-list-item",
|
|
15
|
+
oList: "group-o-list-item",
|
|
16
|
+
image: "image",
|
|
17
|
+
embed: "embed",
|
|
18
|
+
hyperlink: "hyperlink",
|
|
19
|
+
label: "label",
|
|
20
|
+
span: "span"
|
|
21
|
+
};
|
|
22
|
+
export {
|
|
23
|
+
RichTextNodeType
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=richText.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"richText.js","sources":["../../../../src/types/value/richText.ts"],"sourcesContent":["import type { FieldState } from \"./types\"\n\nimport type { EmbedField } from \"./embed\"\nimport type { FilledLinkField } from \"./link\"\n\n/**\n * Types enum for RichTextNodes\n *\n * @see More details: {@link https://prismic.io/docs/rich-text-title}\n */\nexport const RichTextNodeType = {\n\theading1: \"heading1\",\n\theading2: \"heading2\",\n\theading3: \"heading3\",\n\theading4: \"heading4\",\n\theading5: \"heading5\",\n\theading6: \"heading6\",\n\tparagraph: \"paragraph\",\n\tpreformatted: \"preformatted\",\n\tstrong: \"strong\",\n\tem: \"em\",\n\tlistItem: \"list-item\",\n\toListItem: \"o-list-item\",\n\tlist: \"group-list-item\",\n\toList: \"group-o-list-item\",\n\timage: \"image\",\n\tembed: \"embed\",\n\thyperlink: \"hyperlink\",\n\tlabel: \"label\",\n\tspan: \"span\",\n} as const\n\n/**\n * Types for RichTextNodes\n *\n * @see More details: {@link https://prismic.io/docs/rich-text-title}\n */\nexport type RichTextNodeTypes =\n\t(typeof RichTextNodeType)[keyof typeof RichTextNodeType]\n\n// Text nodes\n\n/**\n * Base to be extended by other rich text nodes.\n */\nexport interface RTTextNodeBase {\n\ttext: string\n\tspans: RTInlineNode[]\n\tdirection?: \"ltr\" | \"rtl\"\n}\n\n/**\n * Rich text `heading1` node\n */\nexport interface RTHeading1Node extends RTTextNodeBase {\n\ttype: typeof RichTextNodeType.heading1\n}\n\n/**\n * Rich text `heading2` node\n */\nexport interface RTHeading2Node extends RTTextNodeBase {\n\ttype: typeof RichTextNodeType.heading2\n}\n\n/**\n * Rich text `heading3` node\n */\nexport interface RTHeading3Node extends RTTextNodeBase {\n\ttype: typeof RichTextNodeType.heading3\n}\n\n/**\n * Rich text `heading4` node\n */\nexport interface RTHeading4Node extends RTTextNodeBase {\n\ttype: typeof RichTextNodeType.heading4\n}\n\n/**\n * Rich text `heading5` node\n */\nexport interface RTHeading5Node extends RTTextNodeBase {\n\ttype: typeof RichTextNodeType.heading5\n}\n\n/**\n * Rich text `heading6` node\n */\nexport interface RTHeading6Node extends RTTextNodeBase {\n\ttype: typeof RichTextNodeType.heading6\n}\n\n/**\n * Rich text `paragraph` node\n */\nexport interface RTParagraphNode extends RTTextNodeBase {\n\ttype: typeof RichTextNodeType.paragraph\n}\n\n/**\n * Rich text `preformatted` node\n */\nexport interface RTPreformattedNode extends RTTextNodeBase {\n\ttype: typeof RichTextNodeType.preformatted\n}\n\n/**\n * Rich text `list-item` node\n */\nexport interface RTListItemNode extends RTTextNodeBase {\n\ttype: typeof RichTextNodeType.listItem\n}\n\n/**\n * Rich text `o-list-item` node for ordered lists\n */\nexport interface RTOListItemNode extends RTTextNodeBase {\n\ttype: typeof RichTextNodeType.oListItem\n}\n\n// Span nodes\n\n/**\n * @internal Span Node base to be extended for other Span nodes\n */\nexport interface RTSpanNodeBase {\n\tstart: number\n\tend: number\n}\n/**\n * Rich text `strong` node\n */\nexport interface RTStrongNode extends RTSpanNodeBase {\n\ttype: typeof RichTextNodeType.strong\n}\n\n/**\n * Rich text `embed` node\n */\nexport interface RTEmNode extends RTSpanNodeBase {\n\ttype: typeof RichTextNodeType.em\n}\n\n/**\n * Rich text `label` node\n */\nexport interface RTLabelNode extends RTSpanNodeBase {\n\ttype: typeof RichTextNodeType.label\n\tdata: {\n\t\tlabel: string\n\t}\n}\n\n// Media nodes\n\n/**\n * Rich text `image` nodes. They could link to other documents, external web\n * links and media fields\n */\nexport type RTImageNode = {\n\ttype: typeof RichTextNodeType.image\n\tid: string\n\turl: string\n\talt: string | null\n\tcopyright: string | null\n\tdimensions: {\n\t\twidth: number\n\t\theight: number\n\t}\n\tedit: {\n\t\tx: number\n\t\ty: number\n\t\tzoom: number\n\t\tbackground: string\n\t}\n\tlinkTo?: FilledLinkField\n}\n\n/**\n * Rich text `embed` node\n */\nexport type RTEmbedNode = {\n\ttype: typeof RichTextNodeType.embed\n\toembed: EmbedField\n}\n\n// Link nodes\n\n/**\n * Rich text `a` node\n *\n * @see More details: {@link https://prismic.io/docs/rich-text-title#elements-and-styles}\n */\nexport interface RTLinkNode extends RTSpanNodeBase {\n\ttype: typeof RichTextNodeType.hyperlink\n\tdata: FilledLinkField\n}\n\n// Serialization related nodes\n\n/**\n * Rich text `list` node\n */\nexport interface RTListNode {\n\ttype: typeof RichTextNodeType.list\n\titems: RTListItemNode[]\n}\n\n/**\n * Rich text o-lost node\n */\nexport interface RTOListNode {\n\ttype: typeof RichTextNodeType.oList\n\titems: RTOListItemNode[]\n}\n\n// This one is confusing but it's actually the inner content of a block\n/**\n * Rich text `span` node\n */\nexport interface RTSpanNode extends RTTextNodeBase {\n\ttype: typeof RichTextNodeType.span\n}\n\n// Helpers\n\n/**\n * Nodes from a rich text field\n */\nexport type RTNode =\n\t| RTHeading1Node\n\t| RTHeading2Node\n\t| RTHeading3Node\n\t| RTHeading4Node\n\t| RTHeading5Node\n\t| RTHeading6Node\n\t| RTParagraphNode\n\t| RTPreformattedNode\n\t| RTListItemNode\n\t| RTOListItemNode\n\t| RTImageNode\n\t| RTEmbedNode\n\n/**\n * Rich text nodes with text\n */\nexport type RTTextNode =\n\t| RTHeading1Node\n\t| RTHeading2Node\n\t| RTHeading3Node\n\t| RTHeading4Node\n\t| RTHeading5Node\n\t| RTHeading6Node\n\t| RTParagraphNode\n\t| RTPreformattedNode\n\t| RTListItemNode\n\t| RTOListItemNode\n\n/**\n * Rich text block nodes\n */\nexport type RTBlockNode =\n\t| RTHeading1Node\n\t| RTHeading2Node\n\t| RTHeading3Node\n\t| RTHeading4Node\n\t| RTHeading5Node\n\t| RTHeading6Node\n\t| RTParagraphNode\n\t| RTPreformattedNode\n\t| RTListItemNode\n\t| RTOListItemNode\n\t| RTListNode\n\t| RTOListNode\n\t| RTImageNode\n\t| RTEmbedNode\n\n/**\n * Inline rich text nodes\n */\nexport type RTInlineNode = RTStrongNode | RTEmNode | RTLabelNode | RTLinkNode\n\n/**\n * All rich text nodes\n */\nexport type RTAnyNode = RTBlockNode | RTInlineNode | RTSpanNode\n\n/**\n * A rich text field.\n *\n * @see Rich text field documentation: {@link https://prismic.io/docs/rich-text-title}\n */\nexport type RichTextField<State extends FieldState = FieldState> =\n\tState extends \"empty\" ? [] : [RTNode, ...RTNode[]]\n"],"names":[],"mappings":"AAUO,MAAM,mBAAmB;AAAA,EAC/B,UAAU;AAAA,EACV,UAAU;AAAA,EACV,UAAU;AAAA,EACV,UAAU;AAAA,EACV,UAAU;AAAA,EACV,UAAU;AAAA,EACV,WAAW;AAAA,EACX,cAAc;AAAA,EACd,QAAQ;AAAA,EACR,IAAI;AAAA,EACJ,UAAU;AAAA,EACV,WAAW;AAAA,EACX,MAAM;AAAA,EACN,OAAO;AAAA,EACP,OAAO;AAAA,EACP,OAAO;AAAA,EACP,WAAW;AAAA,EACX,OAAO;AAAA,EACP,MAAM;;"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { FieldState } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* A select field.
|
|
4
|
+
*
|
|
5
|
+
* @typeParam Enum - Selectable options for the field.
|
|
6
|
+
* @typeParam State - State of the field which determines its shape.
|
|
7
|
+
*
|
|
8
|
+
* @see More details: {@link https://prismic.io/docs/select}
|
|
9
|
+
*/
|
|
10
|
+
export type SelectField<Enum extends string = string, State extends FieldState = FieldState> = State extends "empty" ? null : Enum;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { SharedSliceVariation } from "./sharedSliceVariation.js";
|
|
2
|
+
/**
|
|
3
|
+
* A shared Slice.
|
|
4
|
+
*
|
|
5
|
+
* @see More details: {@link https://prismic.io/docs/slice}
|
|
6
|
+
*/
|
|
7
|
+
export type SharedSlice<SliceType = string, Variations extends SharedSliceVariation = SharedSliceVariation> = {
|
|
8
|
+
slice_type: SliceType;
|
|
9
|
+
slice_label: null;
|
|
10
|
+
id: string;
|
|
11
|
+
} & Variations;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { AnyRegularField, AnySlicePrimaryField } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* A shared Slice variation.
|
|
4
|
+
*/
|
|
5
|
+
export interface SharedSliceVariation<Variation = string, PrimaryFields extends Record<string, AnySlicePrimaryField> = Record<string, AnySlicePrimaryField>, ItemsFields extends Record<string, AnyRegularField> = Record<string, AnyRegularField>> {
|
|
6
|
+
variation: Variation;
|
|
7
|
+
version: string;
|
|
8
|
+
primary: PrimaryFields;
|
|
9
|
+
items: ItemsFields[];
|
|
10
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { AnyRegularField } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* A Slice - sections of your webpages.
|
|
4
|
+
*
|
|
5
|
+
* @see More details: {@link https://prismic.io/docs/slice}
|
|
6
|
+
*/
|
|
7
|
+
export interface Slice<SliceType = string, PrimaryFields extends Record<string, AnyRegularField> = Record<string, AnyRegularField>, ItemsFields extends Record<string, AnyRegularField> = Record<string, AnyRegularField>> {
|
|
8
|
+
slice_type: SliceType;
|
|
9
|
+
slice_label: string | null;
|
|
10
|
+
id: string;
|
|
11
|
+
primary: PrimaryFields;
|
|
12
|
+
items: ItemsFields[];
|
|
13
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { FieldState } from "./types.js";
|
|
2
|
+
import type { SharedSlice } from "./sharedSlice.js";
|
|
3
|
+
import type { Slice } from "./slice.js";
|
|
4
|
+
/**
|
|
5
|
+
* Prismic Slices are sections of your website. Prismic documents contain a
|
|
6
|
+
* dynamic "Slice Zone" that allows content creators to add, edit, and rearrange
|
|
7
|
+
* Slices to compose dynamic layouts for any page design, such as blog posts,
|
|
8
|
+
* landing pages, case studies, and tutorials.
|
|
9
|
+
*
|
|
10
|
+
* @see More details: {@link https://prismic.io/docs/slice}
|
|
11
|
+
*/
|
|
12
|
+
export type SliceZone<Slices extends Slice | SharedSlice = Slice | SharedSlice, State extends FieldState = FieldState> = State extends "empty" ? [] : [Slices, ...Slices[]];
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import type { FieldState } from "./types.js";
|
|
2
|
+
import type { RichTextField } from "./richText.js";
|
|
3
|
+
/**
|
|
4
|
+
* A table field.
|
|
5
|
+
*
|
|
6
|
+
* @typeParam State - State of the field which determines its shape.
|
|
7
|
+
*
|
|
8
|
+
* @see More details: {@link https://prismic.io/docs/table}
|
|
9
|
+
*/
|
|
10
|
+
export type TableField<State extends FieldState = FieldState> = State extends "empty" ? null : {
|
|
11
|
+
/**
|
|
12
|
+
* The head of the table.
|
|
13
|
+
*/
|
|
14
|
+
head?: TableFieldHead;
|
|
15
|
+
/**
|
|
16
|
+
* The body of the table.
|
|
17
|
+
*/
|
|
18
|
+
body: TableFieldBody;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Represents a table head.
|
|
22
|
+
*/
|
|
23
|
+
export type TableFieldHead = {
|
|
24
|
+
rows: TableFieldHeadRow[];
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* Represents a table body.
|
|
28
|
+
*/
|
|
29
|
+
export type TableFieldBody = {
|
|
30
|
+
rows: TableFieldBodyRow[];
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* Represents a row in a table head.
|
|
34
|
+
*/
|
|
35
|
+
export type TableFieldHeadRow = {
|
|
36
|
+
/**
|
|
37
|
+
* Unique key of the row.
|
|
38
|
+
*/
|
|
39
|
+
key: string;
|
|
40
|
+
/**
|
|
41
|
+
* Cells in the row.
|
|
42
|
+
*/
|
|
43
|
+
cells: TableFieldHeaderCell[];
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* Represents a table header cell.
|
|
47
|
+
*/
|
|
48
|
+
export type TableFieldHeaderCell = {
|
|
49
|
+
/**
|
|
50
|
+
* Unique key of the cell.
|
|
51
|
+
*/
|
|
52
|
+
key: string;
|
|
53
|
+
/**
|
|
54
|
+
* The type of the cell.
|
|
55
|
+
*/
|
|
56
|
+
type: "header";
|
|
57
|
+
/**
|
|
58
|
+
* The content of the cell.
|
|
59
|
+
*/
|
|
60
|
+
content: RichTextField;
|
|
61
|
+
};
|
|
62
|
+
/**
|
|
63
|
+
* Represents a row in a table body.
|
|
64
|
+
*/
|
|
65
|
+
export type TableFieldBodyRow = {
|
|
66
|
+
/**
|
|
67
|
+
* Unique key of the row.
|
|
68
|
+
*/
|
|
69
|
+
key: string;
|
|
70
|
+
/**
|
|
71
|
+
* Cells in the row.
|
|
72
|
+
*/
|
|
73
|
+
cells: (TableFieldHeaderCell | TableFieldDataCell)[];
|
|
74
|
+
};
|
|
75
|
+
/**
|
|
76
|
+
* Represents a table data cell.
|
|
77
|
+
*/
|
|
78
|
+
export type TableFieldDataCell = {
|
|
79
|
+
/**
|
|
80
|
+
* Unique key of the cell.
|
|
81
|
+
*/
|
|
82
|
+
key: string;
|
|
83
|
+
/**
|
|
84
|
+
* The type of the cell.
|
|
85
|
+
*/
|
|
86
|
+
type: "data";
|
|
87
|
+
/**
|
|
88
|
+
* The content of the cell.
|
|
89
|
+
*/
|
|
90
|
+
content: RichTextField;
|
|
91
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { FieldState } from "./types.js";
|
|
2
|
+
import type { RTHeading1Node, RTHeading2Node, RTHeading3Node, RTHeading4Node, RTHeading5Node, RTHeading6Node } from "./richText.js";
|
|
3
|
+
/**
|
|
4
|
+
* A title field.
|
|
5
|
+
*
|
|
6
|
+
* @see Title field documentation: {@link https://prismic.io/docs/rich-text-title}
|
|
7
|
+
*/
|
|
8
|
+
export type TitleField<State extends FieldState = FieldState> = State extends "empty" ? [] : [
|
|
9
|
+
Omit<RTHeading1Node | RTHeading2Node | RTHeading3Node | RTHeading4Node | RTHeading5Node | RTHeading6Node, "spans"> & {
|
|
10
|
+
spans: [];
|
|
11
|
+
}
|
|
12
|
+
];
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import type { BooleanField } from "./boolean.js";
|
|
2
|
+
import type { ColorField } from "./color.js";
|
|
3
|
+
import type { ContentRelationshipField } from "./contentRelationship.js";
|
|
4
|
+
import type { DateField } from "./date.js";
|
|
5
|
+
import type { EmbedField } from "./embed.js";
|
|
6
|
+
import type { GeoPointField } from "./geoPoint.js";
|
|
7
|
+
import type { GroupField } from "./group.js";
|
|
8
|
+
import type { ImageField } from "./image.js";
|
|
9
|
+
import type { IntegrationField } from "./integration.js";
|
|
10
|
+
import type { KeyTextField } from "./keyText.js";
|
|
11
|
+
import type { LinkField } from "./link.js";
|
|
12
|
+
import type { LinkToMediaField } from "./linkToMedia.js";
|
|
13
|
+
import type { NumberField } from "./number.js";
|
|
14
|
+
import type { RichTextField } from "./richText.js";
|
|
15
|
+
import type { SelectField } from "./select.js";
|
|
16
|
+
import type { TableField } from "./table.js";
|
|
17
|
+
import type { TimestampField } from "./timestamp.js";
|
|
18
|
+
import type { TitleField } from "./title.js";
|
|
19
|
+
/**
|
|
20
|
+
* Empty state for object-shaped fields.
|
|
21
|
+
*/
|
|
22
|
+
export type EmptyObjectField = Record<string, never>;
|
|
23
|
+
/**
|
|
24
|
+
* Valid states for fields. Not all fields use this type (e.g. BooleanField).
|
|
25
|
+
*/
|
|
26
|
+
export type FieldState = "empty" | "filled";
|
|
27
|
+
/**
|
|
28
|
+
* Any regular field that can be nested in a group-like field.
|
|
29
|
+
*/
|
|
30
|
+
export type AnyRegularField = TitleField | RichTextField | ImageField | ContentRelationshipField | LinkField | Repeatable<LinkField> | LinkToMediaField | EmbedField | DateField | TimestampField | ColorField | NumberField | KeyTextField | SelectField | BooleanField | GeoPointField | IntegrationField | TableField;
|
|
31
|
+
/**
|
|
32
|
+
* Any field that can be used in a slice's primary section.
|
|
33
|
+
*/
|
|
34
|
+
export type AnySlicePrimaryField = GroupField | AnyRegularField;
|
|
35
|
+
/**
|
|
36
|
+
* A list of repeatable fields.
|
|
37
|
+
*/
|
|
38
|
+
export type Repeatable<Field extends LinkField, State extends FieldState = FieldState> = State extends "empty" ? [] : [WithKey<Field>, ...WithKey<Field>[]];
|
|
39
|
+
/**
|
|
40
|
+
* Wrapper to add a key to a field when inside a repeatable.
|
|
41
|
+
*/
|
|
42
|
+
type WithKey<Field extends LinkField> = Field & {
|
|
43
|
+
key: string;
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* Useful to flatten the type output to improve type hints shown in editors. And
|
|
47
|
+
* also to transform an interface into a type to aide with assignability.
|
|
48
|
+
*
|
|
49
|
+
* Taken from the `type-fest` package.
|
|
50
|
+
*
|
|
51
|
+
* @typeParam T - The type to simplify.
|
|
52
|
+
*
|
|
53
|
+
* @see https://github.com/sindresorhus/type-fest/blob/cbd7ec510bd136ac045bbc74e391ee686b8a9a2f/source/simplify.d.ts
|
|
54
|
+
*/
|
|
55
|
+
export type Simplify<T> = {
|
|
56
|
+
[P in keyof T]: T[P];
|
|
57
|
+
};
|
|
58
|
+
export {};
|