@prismicio/client 7.21.0-alpha.1 → 7.21.0-alpha.2
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/index.cjs +3880 -92
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4424 -0
- package/dist/index.d.mts +4424 -0
- package/dist/index.d.ts +4349 -128
- package/dist/index.mjs +3837 -0
- package/dist/index.mjs.map +1 -0
- package/dist/richtext/index.cjs +244 -0
- package/dist/richtext/index.cjs.map +1 -0
- package/dist/richtext/index.d.cts +78 -0
- package/dist/richtext/index.d.mts +78 -0
- package/dist/richtext/index.d.ts +78 -7
- package/dist/richtext/index.mjs +237 -0
- package/dist/richtext/index.mjs.map +1 -0
- package/dist/shared/client.TSGr56lO.d.cts +899 -0
- package/dist/shared/client.TSGr56lO.d.mts +899 -0
- package/dist/shared/client.TSGr56lO.d.ts +899 -0
- package/package.json +19 -42
- package/src/buildQueryURL.ts +29 -21
- package/src/createClient.ts +11 -8
- package/src/getRepositoryEndpoint.ts +9 -2
- package/src/helpers/asDate.ts +11 -4
- package/src/helpers/asHTML.ts +34 -26
- package/src/helpers/asImagePixelDensitySrcSet.ts +16 -15
- package/src/helpers/asImageSrc.ts +11 -10
- package/src/helpers/asImageWidthSrcSet.ts +18 -17
- package/src/helpers/asLink.ts +33 -32
- package/src/helpers/asLinkAttrs.ts +6 -9
- package/src/helpers/asText.ts +20 -10
- package/src/helpers/isFilled.ts +15 -14
- package/src/helpers/mapSliceZone.ts +10 -10
- package/src/index.ts +2 -2
- package/src/isRepositoryEndpoint.ts +2 -2
- package/src/richtext/asText.ts +5 -5
- package/src/richtext/serialize.ts +8 -8
- package/src/richtext/types.ts +6 -6
- package/src/types/migration/Asset.ts +10 -2
- package/src/types/model/types.ts +0 -2
- package/dist/Client.cjs +0 -1274
- package/dist/Client.cjs.map +0 -1
- package/dist/Client.d.ts +0 -981
- package/dist/Client.js +0 -1274
- package/dist/Client.js.map +0 -1
- package/dist/Migration.cjs +0 -315
- package/dist/Migration.cjs.map +0 -1
- package/dist/Migration.d.ts +0 -213
- package/dist/Migration.js +0 -315
- package/dist/Migration.js.map +0 -1
- package/dist/WriteClient.cjs +0 -560
- package/dist/WriteClient.cjs.map +0 -1
- package/dist/WriteClient.d.ts +0 -281
- package/dist/WriteClient.js +0 -560
- package/dist/WriteClient.js.map +0 -1
- package/dist/buildQueryURL.cjs +0 -66
- package/dist/buildQueryURL.cjs.map +0 -1
- package/dist/buildQueryURL.d.ts +0 -209
- package/dist/buildQueryURL.js +0 -66
- package/dist/buildQueryURL.js.map +0 -1
- package/dist/cookie.cjs +0 -5
- package/dist/cookie.cjs.map +0 -1
- package/dist/cookie.d.ts +0 -5
- package/dist/cookie.js +0 -5
- package/dist/cookie.js.map +0 -1
- package/dist/createClient.cjs +0 -6
- package/dist/createClient.cjs.map +0 -1
- package/dist/createClient.d.ts +0 -32
- package/dist/createClient.js +0 -6
- package/dist/createClient.js.map +0 -1
- package/dist/createMigration.cjs +0 -6
- package/dist/createMigration.cjs.map +0 -1
- package/dist/createMigration.d.ts +0 -24
- package/dist/createMigration.js +0 -6
- package/dist/createMigration.js.map +0 -1
- package/dist/createWriteClient.cjs +0 -6
- package/dist/createWriteClient.cjs.map +0 -1
- package/dist/createWriteClient.d.ts +0 -32
- package/dist/createWriteClient.js +0 -6
- package/dist/createWriteClient.js.map +0 -1
- package/dist/errors/ForbiddenError.cjs +0 -7
- package/dist/errors/ForbiddenError.cjs.map +0 -1
- package/dist/errors/ForbiddenError.d.ts +0 -11
- package/dist/errors/ForbiddenError.js +0 -7
- package/dist/errors/ForbiddenError.js.map +0 -1
- package/dist/errors/InvalidDataError.cjs +0 -7
- package/dist/errors/InvalidDataError.cjs.map +0 -1
- package/dist/errors/InvalidDataError.d.ts +0 -3
- package/dist/errors/InvalidDataError.js +0 -7
- package/dist/errors/InvalidDataError.js.map +0 -1
- package/dist/errors/NotFoundError.cjs +0 -7
- package/dist/errors/NotFoundError.cjs.map +0 -1
- package/dist/errors/NotFoundError.d.ts +0 -3
- package/dist/errors/NotFoundError.js +0 -7
- package/dist/errors/NotFoundError.js.map +0 -1
- package/dist/errors/ParsingError.cjs +0 -7
- package/dist/errors/ParsingError.cjs.map +0 -1
- package/dist/errors/ParsingError.d.ts +0 -14
- package/dist/errors/ParsingError.js +0 -7
- package/dist/errors/ParsingError.js.map +0 -1
- package/dist/errors/PreviewTokenExpired.cjs +0 -7
- package/dist/errors/PreviewTokenExpired.cjs.map +0 -1
- package/dist/errors/PreviewTokenExpired.d.ts +0 -8
- package/dist/errors/PreviewTokenExpired.js +0 -7
- package/dist/errors/PreviewTokenExpired.js.map +0 -1
- package/dist/errors/PrismicError.cjs +0 -16
- package/dist/errors/PrismicError.cjs.map +0 -1
- package/dist/errors/PrismicError.d.ts +0 -5
- package/dist/errors/PrismicError.js +0 -16
- package/dist/errors/PrismicError.js.map +0 -1
- package/dist/errors/RefExpiredError.cjs +0 -7
- package/dist/errors/RefExpiredError.cjs.map +0 -1
- package/dist/errors/RefExpiredError.d.ts +0 -8
- package/dist/errors/RefExpiredError.js +0 -7
- package/dist/errors/RefExpiredError.js.map +0 -1
- package/dist/errors/RefNotFoundError.cjs +0 -7
- package/dist/errors/RefNotFoundError.cjs.map +0 -1
- package/dist/errors/RefNotFoundError.d.ts +0 -8
- package/dist/errors/RefNotFoundError.js +0 -7
- package/dist/errors/RefNotFoundError.js.map +0 -1
- package/dist/errors/RepositoryNotFoundError.cjs +0 -7
- package/dist/errors/RepositoryNotFoundError.cjs.map +0 -1
- package/dist/errors/RepositoryNotFoundError.d.ts +0 -3
- package/dist/errors/RepositoryNotFoundError.js +0 -7
- package/dist/errors/RepositoryNotFoundError.js.map +0 -1
- package/dist/filter.cjs +0 -247
- package/dist/filter.cjs.map +0 -1
- package/dist/filter.d.ts +0 -209
- package/dist/filter.js +0 -247
- package/dist/filter.js.map +0 -1
- package/dist/getGraphQLEndpoint.cjs +0 -13
- package/dist/getGraphQLEndpoint.cjs.map +0 -1
- package/dist/getGraphQLEndpoint.d.ts +0 -10
- package/dist/getGraphQLEndpoint.js +0 -13
- package/dist/getGraphQLEndpoint.js.map +0 -1
- package/dist/getRepositoryEndpoint.cjs +0 -13
- package/dist/getRepositoryEndpoint.cjs.map +0 -1
- package/dist/getRepositoryEndpoint.d.ts +0 -12
- package/dist/getRepositoryEndpoint.js +0 -13
- package/dist/getRepositoryEndpoint.js.map +0 -1
- package/dist/getRepositoryName.cjs +0 -17
- package/dist/getRepositoryName.cjs.map +0 -1
- package/dist/getRepositoryName.d.ts +0 -12
- package/dist/getRepositoryName.js +0 -17
- package/dist/getRepositoryName.js.map +0 -1
- package/dist/getToolbarSrc.cjs +0 -13
- package/dist/getToolbarSrc.cjs.map +0 -1
- package/dist/getToolbarSrc.d.ts +0 -34
- package/dist/getToolbarSrc.js +0 -13
- package/dist/getToolbarSrc.js.map +0 -1
- package/dist/helpers/asDate.cjs +0 -14
- package/dist/helpers/asDate.cjs.map +0 -1
- package/dist/helpers/asDate.d.ts +0 -17
- package/dist/helpers/asDate.js +0 -14
- package/dist/helpers/asDate.js.map +0 -1
- package/dist/helpers/asHTML.cjs +0 -86
- package/dist/helpers/asHTML.cjs.map +0 -1
- package/dist/helpers/asHTML.d.ts +0 -141
- package/dist/helpers/asHTML.js +0 -86
- package/dist/helpers/asHTML.js.map +0 -1
- package/dist/helpers/asImagePixelDensitySrcSet.cjs +0 -21
- package/dist/helpers/asImagePixelDensitySrcSet.cjs.map +0 -1
- package/dist/helpers/asImagePixelDensitySrcSet.d.ts +0 -53
- package/dist/helpers/asImagePixelDensitySrcSet.js +0 -21
- package/dist/helpers/asImagePixelDensitySrcSet.js.map +0 -1
- package/dist/helpers/asImageSrc.cjs +0 -13
- package/dist/helpers/asImageSrc.cjs.map +0 -1
- package/dist/helpers/asImageSrc.d.ts +0 -28
- package/dist/helpers/asImageSrc.js +0 -13
- package/dist/helpers/asImageSrc.js.map +0 -1
- package/dist/helpers/asImageWidthSrcSet.cjs +0 -45
- package/dist/helpers/asImageWidthSrcSet.cjs.map +0 -1
- package/dist/helpers/asImageWidthSrcSet.d.ts +0 -61
- package/dist/helpers/asImageWidthSrcSet.js +0 -45
- package/dist/helpers/asImageWidthSrcSet.js.map +0 -1
- package/dist/helpers/asLink.cjs +0 -47
- package/dist/helpers/asLink.cjs.map +0 -1
- package/dist/helpers/asLink.d.ts +0 -77
- package/dist/helpers/asLink.js +0 -47
- package/dist/helpers/asLink.js.map +0 -1
- package/dist/helpers/asLinkAttrs.cjs +0 -28
- package/dist/helpers/asLinkAttrs.cjs.map +0 -1
- package/dist/helpers/asLinkAttrs.d.ts +0 -50
- package/dist/helpers/asLinkAttrs.js +0 -28
- package/dist/helpers/asLinkAttrs.js.map +0 -1
- package/dist/helpers/asText.cjs +0 -21
- package/dist/helpers/asText.cjs.map +0 -1
- package/dist/helpers/asText.d.ts +0 -47
- package/dist/helpers/asText.js +0 -21
- package/dist/helpers/asText.js.map +0 -1
- package/dist/helpers/documentToLinkField.cjs +0 -27
- package/dist/helpers/documentToLinkField.cjs.map +0 -1
- package/dist/helpers/documentToLinkField.d.ts +0 -17
- package/dist/helpers/documentToLinkField.js +0 -27
- package/dist/helpers/documentToLinkField.js.map +0 -1
- package/dist/helpers/isFilled.cjs +0 -77
- package/dist/helpers/isFilled.cjs.map +0 -1
- package/dist/helpers/isFilled.d.ts +0 -190
- package/dist/helpers/isFilled.js +0 -77
- package/dist/helpers/isFilled.js.map +0 -1
- package/dist/helpers/mapSliceZone.cjs +0 -42
- package/dist/helpers/mapSliceZone.cjs.map +0 -1
- package/dist/helpers/mapSliceZone.d.ts +0 -136
- package/dist/helpers/mapSliceZone.js +0 -42
- package/dist/helpers/mapSliceZone.js.map +0 -1
- package/dist/index.js +0 -97
- package/dist/index.js.map +0 -1
- package/dist/isRepositoryEndpoint.cjs +0 -12
- package/dist/isRepositoryEndpoint.cjs.map +0 -1
- package/dist/isRepositoryEndpoint.d.ts +0 -10
- package/dist/isRepositoryEndpoint.js +0 -12
- package/dist/isRepositoryEndpoint.js.map +0 -1
- package/dist/isRepositoryName.cjs +0 -7
- package/dist/isRepositoryName.cjs.map +0 -1
- package/dist/isRepositoryName.d.ts +0 -9
- package/dist/isRepositoryName.js +0 -7
- package/dist/isRepositoryName.js.map +0 -1
- package/dist/lib/appendFilters.cjs +0 -11
- package/dist/lib/appendFilters.cjs.map +0 -1
- package/dist/lib/appendFilters.d.ts +0 -18
- package/dist/lib/appendFilters.js +0 -11
- package/dist/lib/appendFilters.js.map +0 -1
- package/dist/lib/castArray.cjs +0 -7
- package/dist/lib/castArray.cjs.map +0 -1
- package/dist/lib/castArray.d.ts +0 -12
- package/dist/lib/castArray.js +0 -7
- package/dist/lib/castArray.js.map +0 -1
- package/dist/lib/castThunk.cjs +0 -7
- package/dist/lib/castThunk.cjs.map +0 -1
- package/dist/lib/castThunk.d.ts +0 -11
- package/dist/lib/castThunk.js +0 -7
- package/dist/lib/castThunk.js.map +0 -1
- package/dist/lib/devMsg.cjs +0 -8
- package/dist/lib/devMsg.cjs.map +0 -1
- package/dist/lib/devMsg.d.ts +0 -16
- package/dist/lib/devMsg.js +0 -8
- package/dist/lib/devMsg.js.map +0 -1
- package/dist/lib/escapeHTML.cjs +0 -43
- package/dist/lib/escapeHTML.cjs.map +0 -1
- package/dist/lib/escapeHTML.d.ts +0 -1
- package/dist/lib/escapeHTML.js +0 -43
- package/dist/lib/escapeHTML.js.map +0 -1
- package/dist/lib/everyTagFilter.cjs +0 -9
- package/dist/lib/everyTagFilter.cjs.map +0 -1
- package/dist/lib/everyTagFilter.d.ts +0 -9
- package/dist/lib/everyTagFilter.js +0 -9
- package/dist/lib/everyTagFilter.js.map +0 -1
- package/dist/lib/findMasterRef.cjs +0 -8
- package/dist/lib/findMasterRef.cjs.map +0 -1
- package/dist/lib/findMasterRef.d.ts +0 -11
- package/dist/lib/findMasterRef.js +0 -8
- package/dist/lib/findMasterRef.js.map +0 -1
- package/dist/lib/findRef.cjs +0 -12
- package/dist/lib/findRef.cjs.map +0 -1
- package/dist/lib/findRef.d.ts +0 -14
- package/dist/lib/findRef.js +0 -12
- package/dist/lib/findRef.js.map +0 -1
- package/dist/lib/findRefByID.cjs +0 -8
- package/dist/lib/findRefByID.cjs.map +0 -1
- package/dist/lib/findRefByID.d.ts +0 -12
- package/dist/lib/findRefByID.js +0 -8
- package/dist/lib/findRefByID.js.map +0 -1
- package/dist/lib/findRefByLabel.cjs +0 -8
- package/dist/lib/findRefByLabel.cjs.map +0 -1
- package/dist/lib/findRefByLabel.d.ts +0 -12
- package/dist/lib/findRefByLabel.js +0 -8
- package/dist/lib/findRefByLabel.js.map +0 -1
- package/dist/lib/getOptionalLinkProperties.cjs +0 -14
- package/dist/lib/getOptionalLinkProperties.cjs.map +0 -1
- package/dist/lib/getOptionalLinkProperties.d.ts +0 -12
- package/dist/lib/getOptionalLinkProperties.js +0 -14
- package/dist/lib/getOptionalLinkProperties.js.map +0 -1
- package/dist/lib/getPreviewCookie.cjs +0 -21
- package/dist/lib/getPreviewCookie.cjs.map +0 -1
- package/dist/lib/getPreviewCookie.d.ts +0 -9
- package/dist/lib/getPreviewCookie.js +0 -21
- package/dist/lib/getPreviewCookie.js.map +0 -1
- package/dist/lib/isInternalURL.cjs +0 -9
- package/dist/lib/isInternalURL.cjs.map +0 -1
- package/dist/lib/isInternalURL.d.ts +0 -8
- package/dist/lib/isInternalURL.js +0 -9
- package/dist/lib/isInternalURL.js.map +0 -1
- package/dist/lib/isMigrationValue.cjs +0 -24
- package/dist/lib/isMigrationValue.cjs.map +0 -1
- package/dist/lib/isMigrationValue.d.ts +0 -71
- package/dist/lib/isMigrationValue.js +0 -24
- package/dist/lib/isMigrationValue.js.map +0 -1
- package/dist/lib/isValue.cjs +0 -53
- package/dist/lib/isValue.cjs.map +0 -1
- package/dist/lib/isValue.d.ts +0 -78
- package/dist/lib/isValue.js +0 -53
- package/dist/lib/isValue.js.map +0 -1
- package/dist/lib/minifyGraphQLQuery.cjs +0 -7
- package/dist/lib/minifyGraphQLQuery.cjs.map +0 -1
- package/dist/lib/minifyGraphQLQuery.d.ts +0 -8
- package/dist/lib/minifyGraphQLQuery.js +0 -7
- package/dist/lib/minifyGraphQLQuery.js.map +0 -1
- package/dist/lib/pLimit.cjs +0 -49
- package/dist/lib/pLimit.cjs.map +0 -1
- package/dist/lib/pLimit.d.ts +0 -22
- package/dist/lib/pLimit.js +0 -49
- package/dist/lib/pLimit.js.map +0 -1
- package/dist/lib/request.cjs +0 -43
- package/dist/lib/request.cjs.map +0 -1
- package/dist/lib/request.d.ts +0 -73
- package/dist/lib/request.js +0 -43
- package/dist/lib/request.js.map +0 -1
- package/dist/lib/resolveMigrationDocumentData.cjs +0 -134
- package/dist/lib/resolveMigrationDocumentData.cjs.map +0 -1
- package/dist/lib/resolveMigrationDocumentData.d.ts +0 -54
- package/dist/lib/resolveMigrationDocumentData.js +0 -134
- package/dist/lib/resolveMigrationDocumentData.js.map +0 -1
- package/dist/lib/serializerHelpers.cjs +0 -113
- package/dist/lib/serializerHelpers.cjs.map +0 -1
- package/dist/lib/serializerHelpers.d.ts +0 -9
- package/dist/lib/serializerHelpers.js +0 -113
- package/dist/lib/serializerHelpers.js.map +0 -1
- package/dist/lib/someTagsFilter.cjs +0 -9
- package/dist/lib/someTagsFilter.cjs.map +0 -1
- package/dist/lib/someTagsFilter.d.ts +0 -9
- package/dist/lib/someTagsFilter.js +0 -9
- package/dist/lib/someTagsFilter.js.map +0 -1
- package/dist/lib/throttledLog.cjs +0 -17
- package/dist/lib/throttledLog.cjs.map +0 -1
- package/dist/lib/throttledLog.d.ts +0 -15
- package/dist/lib/throttledLog.js +0 -17
- package/dist/lib/throttledLog.js.map +0 -1
- package/dist/lib/typeFilter.cjs +0 -8
- package/dist/lib/typeFilter.cjs.map +0 -1
- package/dist/lib/typeFilter.d.ts +0 -8
- package/dist/lib/typeFilter.js +0 -8
- package/dist/lib/typeFilter.js.map +0 -1
- package/dist/lib/validateAssetMetadata.cjs +0 -28
- package/dist/lib/validateAssetMetadata.cjs.map +0 -1
- package/dist/lib/validateAssetMetadata.d.ts +0 -10
- package/dist/lib/validateAssetMetadata.js +0 -28
- package/dist/lib/validateAssetMetadata.js.map +0 -1
- package/dist/package.json.cjs +0 -7
- package/dist/package.json.cjs.map +0 -1
- package/dist/package.json.js +0 -7
- package/dist/package.json.js.map +0 -1
- package/dist/richtext/asText.cjs +0 -13
- package/dist/richtext/asText.cjs.map +0 -1
- package/dist/richtext/asText.d.ts +0 -12
- package/dist/richtext/asText.js +0 -13
- package/dist/richtext/asText.js.map +0 -1
- package/dist/richtext/asTree.cjs +0 -123
- package/dist/richtext/asTree.cjs.map +0 -1
- package/dist/richtext/asTree.d.ts +0 -14
- package/dist/richtext/asTree.js +0 -123
- package/dist/richtext/asTree.js.map +0 -1
- package/dist/richtext/composeSerializers.cjs +0 -17
- package/dist/richtext/composeSerializers.cjs.map +0 -1
- package/dist/richtext/composeSerializers.d.ts +0 -16
- package/dist/richtext/composeSerializers.js +0 -17
- package/dist/richtext/composeSerializers.js.map +0 -1
- package/dist/richtext/serialize.cjs +0 -19
- package/dist/richtext/serialize.cjs.map +0 -1
- package/dist/richtext/serialize.d.ts +0 -19
- package/dist/richtext/serialize.js +0 -19
- package/dist/richtext/serialize.js.map +0 -1
- package/dist/richtext/types.cjs +0 -11
- package/dist/richtext/types.cjs.map +0 -1
- package/dist/richtext/types.d.ts +0 -71
- package/dist/richtext/types.js +0 -11
- package/dist/richtext/types.js.map +0 -1
- package/dist/richtext/wrapMapSerializer.cjs +0 -24
- package/dist/richtext/wrapMapSerializer.cjs.map +0 -1
- package/dist/richtext/wrapMapSerializer.d.ts +0 -15
- package/dist/richtext/wrapMapSerializer.js +0 -24
- package/dist/richtext/wrapMapSerializer.js.map +0 -1
- package/dist/richtext.cjs +0 -15
- package/dist/richtext.cjs.map +0 -1
- package/dist/richtext.js +0 -15
- package/dist/richtext.js.map +0 -1
- package/dist/types/api/asset/asset.d.ts +0 -177
- package/dist/types/api/asset/tag.d.ts +0 -53
- package/dist/types/api/integration.d.ts +0 -28
- package/dist/types/api/migration/document.d.ts +0 -60
- package/dist/types/api/query.d.ts +0 -43
- package/dist/types/api/ref.d.ts +0 -32
- package/dist/types/api/release.d.ts +0 -11
- package/dist/types/api/repository.d.ts +0 -109
- package/dist/types/api/tags.d.ts +0 -9
- package/dist/types/migration/Asset.cjs +0 -33
- package/dist/types/migration/Asset.cjs.map +0 -1
- package/dist/types/migration/Asset.d.ts +0 -108
- package/dist/types/migration/Asset.js +0 -33
- package/dist/types/migration/Asset.js.map +0 -1
- package/dist/types/migration/ContentRelationship.d.ts +0 -16
- package/dist/types/migration/Document.cjs +0 -47
- package/dist/types/migration/Document.cjs.map +0 -1
- package/dist/types/migration/Document.d.ts +0 -94
- package/dist/types/migration/Document.js +0 -47
- package/dist/types/migration/Document.js.map +0 -1
- package/dist/types/migration/Link.d.ts +0 -19
- package/dist/types/model/boolean.d.ts +0 -15
- package/dist/types/model/color.d.ts +0 -13
- package/dist/types/model/contentRelationship.d.ts +0 -52
- package/dist/types/model/customType.d.ts +0 -48
- package/dist/types/model/date.d.ts +0 -14
- package/dist/types/model/embed.d.ts +0 -13
- package/dist/types/model/geoPoint.d.ts +0 -12
- package/dist/types/model/group.d.ts +0 -23
- package/dist/types/model/image.d.ts +0 -31
- package/dist/types/model/integration.d.ts +0 -14
- package/dist/types/model/keyText.d.ts +0 -13
- package/dist/types/model/link.cjs +0 -9
- package/dist/types/model/link.cjs.map +0 -1
- package/dist/types/model/link.d.ts +0 -28
- package/dist/types/model/link.js +0 -9
- package/dist/types/model/link.js.map +0 -1
- package/dist/types/model/linkToMedia.d.ts +0 -17
- package/dist/types/model/number.d.ts +0 -15
- package/dist/types/model/range.d.ts +0 -14
- package/dist/types/model/richText.d.ts +0 -37
- package/dist/types/model/select.d.ts +0 -18
- package/dist/types/model/separator.d.ts +0 -10
- package/dist/types/model/sharedSlice.d.ts +0 -16
- package/dist/types/model/sharedSliceVariation.d.ts +0 -19
- package/dist/types/model/slice.cjs +0 -8
- package/dist/types/model/slice.cjs.map +0 -1
- package/dist/types/model/slice.d.ts +0 -33
- package/dist/types/model/slice.js +0 -8
- package/dist/types/model/slice.js.map +0 -1
- package/dist/types/model/sliceZone.cjs +0 -8
- package/dist/types/model/sliceZone.cjs.map +0 -1
- package/dist/types/model/sliceZone.d.ts +0 -41
- package/dist/types/model/sliceZone.js +0 -8
- package/dist/types/model/sliceZone.js.map +0 -1
- package/dist/types/model/table.d.ts +0 -12
- package/dist/types/model/timestamp.d.ts +0 -14
- package/dist/types/model/title.d.ts +0 -7
- package/dist/types/model/types.cjs +0 -39
- package/dist/types/model/types.cjs.map +0 -1
- package/dist/types/model/types.d.ts +0 -77
- package/dist/types/model/types.js +0 -39
- package/dist/types/model/types.js.map +0 -1
- package/dist/types/model/uid.d.ts +0 -13
- package/dist/types/value/boolean.d.ts +0 -6
- package/dist/types/value/color.d.ts +0 -9
- package/dist/types/value/contentRelationship.d.ts +0 -31
- package/dist/types/value/date.d.ts +0 -9
- package/dist/types/value/document.d.ts +0 -114
- package/dist/types/value/embed.cjs +0 -10
- package/dist/types/value/embed.cjs.map +0 -1
- package/dist/types/value/embed.d.ts +0 -168
- package/dist/types/value/embed.js +0 -10
- package/dist/types/value/embed.js.map +0 -1
- package/dist/types/value/geoPoint.d.ts +0 -12
- package/dist/types/value/group.d.ts +0 -13
- package/dist/types/value/image.d.ts +0 -47
- package/dist/types/value/integration.d.ts +0 -16
- package/dist/types/value/keyText.d.ts +0 -9
- package/dist/types/value/link.cjs +0 -10
- package/dist/types/value/link.cjs.map +0 -1
- package/dist/types/value/link.d.ts +0 -68
- package/dist/types/value/link.js +0 -10
- package/dist/types/value/link.js.map +0 -1
- package/dist/types/value/linkToMedia.d.ts +0 -28
- package/dist/types/value/number.d.ts +0 -9
- package/dist/types/value/richText.cjs +0 -25
- package/dist/types/value/richText.cjs.map +0 -1
- package/dist/types/value/richText.d.ts +0 -215
- package/dist/types/value/richText.js +0 -25
- package/dist/types/value/richText.js.map +0 -1
- package/dist/types/value/select.d.ts +0 -10
- package/dist/types/value/sharedSlice.d.ts +0 -11
- package/dist/types/value/sharedSliceVariation.d.ts +0 -10
- package/dist/types/value/slice.d.ts +0 -13
- package/dist/types/value/sliceZone.d.ts +0 -12
- package/dist/types/value/table.d.ts +0 -91
- package/dist/types/value/timestamp.d.ts +0 -8
- package/dist/types/value/title.d.ts +0 -12
- package/dist/types/value/types.d.ts +0 -58
- package/dist/types/webhook/apiUpdate.d.ts +0 -52
- package/dist/types/webhook/testTrigger.d.ts +0 -9
- package/dist/types/webhook/types.cjs +0 -8
- package/dist/types/webhook/types.cjs.map +0 -1
- package/dist/types/webhook/types.d.ts +0 -18
- package/dist/types/webhook/types.js +0 -8
- package/dist/types/webhook/types.js.map +0 -1
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import type { FilledContentRelationshipField } from "../types/value/contentRelationship";
|
|
2
|
-
import type { PrismicDocument } from "../types/value/document";
|
|
3
|
-
import type { FilledLinkToWebField, LinkField } from "../types/value/link";
|
|
4
|
-
import type { FilledLinkToMediaField } from "../types/value/linkToMedia";
|
|
5
|
-
import type { AsLinkReturnType, LinkResolverFunction } from "./asLink";
|
|
6
|
-
type AsLinkAttrsConfigRelArgs<LinkResolverFunctionReturnType = ReturnType<LinkResolverFunction>, Field extends LinkField | PrismicDocument | null | undefined = LinkField | PrismicDocument | null | undefined> = {
|
|
7
|
-
href: NonNullable<AsLinkReturnType<LinkResolverFunctionReturnType, Field>> | undefined;
|
|
8
|
-
isExternal: boolean;
|
|
9
|
-
target?: string;
|
|
10
|
-
};
|
|
11
|
-
export type AsLinkAttrsConfig<LinkResolverFunctionReturnType = ReturnType<LinkResolverFunction>, Field extends LinkField | PrismicDocument | null | undefined = LinkField | PrismicDocument | null | undefined> = {
|
|
12
|
-
linkResolver?: LinkResolverFunction<LinkResolverFunctionReturnType>;
|
|
13
|
-
rel?: (args: AsLinkAttrsConfigRelArgs<LinkResolverFunctionReturnType, Field>) => string | undefined | void;
|
|
14
|
-
};
|
|
15
|
-
/**
|
|
16
|
-
* The return type of `asLinkAttrs()`.
|
|
17
|
-
*/
|
|
18
|
-
type AsLinkAttrsReturnType<LinkResolverFunctionReturnType = ReturnType<LinkResolverFunction>, Field extends LinkField | PrismicDocument | null | undefined = LinkField | PrismicDocument | null | undefined> = Field extends FilledLinkToWebField | FilledLinkToMediaField | FilledContentRelationshipField | PrismicDocument ? {
|
|
19
|
-
href: NonNullable<AsLinkReturnType<LinkResolverFunctionReturnType, Field>> | undefined;
|
|
20
|
-
target?: string;
|
|
21
|
-
rel?: string;
|
|
22
|
-
} : {
|
|
23
|
-
href?: undefined;
|
|
24
|
-
target?: undefined;
|
|
25
|
-
rel?: undefined;
|
|
26
|
-
};
|
|
27
|
-
/**
|
|
28
|
-
* Resolves any type of link field or Prismic document to a set of link
|
|
29
|
-
* attributes. The attributes are designed to be passed to link HTML elements,
|
|
30
|
-
* like `<a>`.
|
|
31
|
-
*
|
|
32
|
-
* If a resolved URL is external (i.e. starts with a protocol like `https://`),
|
|
33
|
-
* `rel` is returned as `"noreferrer"`.
|
|
34
|
-
*
|
|
35
|
-
* @typeParam LinkResolverFunctionReturnType - link resolver function return
|
|
36
|
-
* type
|
|
37
|
-
* @typeParam Field - Link field or Prismic document to resolve to link
|
|
38
|
-
* attributes
|
|
39
|
-
*
|
|
40
|
-
* @param linkFieldOrDocument - Any kind of link field or a document to resolve
|
|
41
|
-
* @param config - Configuration that determines the output of `asLinkAttrs()`
|
|
42
|
-
*
|
|
43
|
-
* @returns Resolved set of link attributes or, if the provided link field or
|
|
44
|
-
* document is empty, and empty object
|
|
45
|
-
*
|
|
46
|
-
* @see Prismic link resolver documentation: {@link https://prismic.io/docs/route-resolver#link-resolver}
|
|
47
|
-
* @see Prismic API `routes` options documentation: {@link https://prismic.io/docs/route-resolver}
|
|
48
|
-
*/
|
|
49
|
-
export declare const asLinkAttrs: <LinkResolverFunctionReturnType = ReturnType<LinkResolverFunction>, Field extends LinkField | PrismicDocument | null | undefined = LinkField | PrismicDocument | null | undefined>(linkFieldOrDocument: Field, config?: AsLinkAttrsConfig<LinkResolverFunctionReturnType>) => AsLinkAttrsReturnType<LinkResolverFunctionReturnType>;
|
|
50
|
-
export {};
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { isInternalURL } from "../lib/isInternalURL.js";
|
|
2
|
-
import { asLink } from "./asLink.js";
|
|
3
|
-
import { link } from "./isFilled.js";
|
|
4
|
-
const asLinkAttrs = (linkFieldOrDocument, config = {}) => {
|
|
5
|
-
if (linkFieldOrDocument && // eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
6
|
-
// @ts-ignore - Bug in TypeScript 4.9: https://github.com/microsoft/TypeScript/issues/51501
|
|
7
|
-
("link_type" in linkFieldOrDocument ? link(linkFieldOrDocument) : linkFieldOrDocument)) {
|
|
8
|
-
const target = (
|
|
9
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
10
|
-
// @ts-ignore - Bug in TypeScript 4.9: https://github.com/microsoft/TypeScript/issues/51501
|
|
11
|
-
"target" in linkFieldOrDocument ? linkFieldOrDocument.target : void 0
|
|
12
|
-
);
|
|
13
|
-
const rawHref = asLink(linkFieldOrDocument, config.linkResolver);
|
|
14
|
-
const href = rawHref == null ? void 0 : rawHref;
|
|
15
|
-
const isExternal = typeof href === "string" ? !isInternalURL(href) : false;
|
|
16
|
-
const rel = config.rel ? config.rel({ href, isExternal, target }) : isExternal ? "noreferrer" : void 0;
|
|
17
|
-
return {
|
|
18
|
-
href,
|
|
19
|
-
target,
|
|
20
|
-
rel: rel == null ? void 0 : rel
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
return {};
|
|
24
|
-
};
|
|
25
|
-
export {
|
|
26
|
-
asLinkAttrs
|
|
27
|
-
};
|
|
28
|
-
//# sourceMappingURL=asLinkAttrs.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"asLinkAttrs.js","sources":["../../../src/helpers/asLinkAttrs.ts"],"sourcesContent":["import { isInternalURL } from \"../lib/isInternalURL\"\n\nimport type { FilledContentRelationshipField } from \"../types/value/contentRelationship\"\nimport type { PrismicDocument } from \"../types/value/document\"\nimport type { FilledLinkToWebField, LinkField } from \"../types/value/link\"\nimport type { FilledLinkToMediaField } from \"../types/value/linkToMedia\"\n\nimport type { AsLinkReturnType, LinkResolverFunction } from \"./asLink\"\nimport { asLink } from \"./asLink\"\nimport { link as isFilledLink } from \"./isFilled\"\n\ntype AsLinkAttrsConfigRelArgs<\n\tLinkResolverFunctionReturnType = ReturnType<LinkResolverFunction>,\n\tField extends LinkField | PrismicDocument | null | undefined =\n\t\t| LinkField\n\t\t| PrismicDocument\n\t\t| null\n\t\t| undefined,\n> = {\n\thref:\n\t\t| NonNullable<AsLinkReturnType<LinkResolverFunctionReturnType, Field>>\n\t\t| undefined\n\tisExternal: boolean\n\ttarget?: string\n}\n\nexport type AsLinkAttrsConfig<\n\tLinkResolverFunctionReturnType = ReturnType<LinkResolverFunction>,\n\tField extends LinkField | PrismicDocument | null | undefined =\n\t\t| LinkField\n\t\t| PrismicDocument\n\t\t| null\n\t\t| undefined,\n> = {\n\tlinkResolver?: LinkResolverFunction<LinkResolverFunctionReturnType>\n\trel?: (\n\t\targs: AsLinkAttrsConfigRelArgs<LinkResolverFunctionReturnType, Field>,\n\t) => string | undefined | void\n}\n\n/**\n * The return type of `asLinkAttrs()`.\n */\ntype AsLinkAttrsReturnType<\n\tLinkResolverFunctionReturnType = ReturnType<LinkResolverFunction>,\n\tField extends LinkField | PrismicDocument | null | undefined =\n\t\t| LinkField\n\t\t| PrismicDocument\n\t\t| null\n\t\t| undefined,\n> = Field extends\n\t| FilledLinkToWebField\n\t| FilledLinkToMediaField\n\t| FilledContentRelationshipField\n\t| PrismicDocument\n\t? {\n\t\t\thref:\n\t\t\t\t| NonNullable<AsLinkReturnType<LinkResolverFunctionReturnType, Field>>\n\t\t\t\t| undefined\n\t\t\ttarget?: string\n\t\t\trel?: string\n\t\t}\n\t: {\n\t\t\thref?: undefined\n\t\t\ttarget?: undefined\n\t\t\trel?: undefined\n\t\t}\n\n/**\n * Resolves any type of link field or Prismic document to a set of link\n * attributes. The attributes are designed to be passed to link HTML elements,\n * like `<a>`.\n *\n * If a resolved URL is external (i.e. starts with a protocol like `https://`),\n * `rel` is returned as `\"noreferrer\"`.\n *\n * @typeParam LinkResolverFunctionReturnType - link resolver function return\n * type\n * @typeParam Field - Link field or Prismic document to resolve to link\n * attributes\n *\n * @param linkFieldOrDocument - Any kind of link field or a document to resolve\n * @param config - Configuration that determines the output of `asLinkAttrs()`\n *\n * @returns Resolved set of link attributes or, if the provided link field or\n * document is empty, and empty object\n *\n * @see Prismic link resolver documentation: {@link https://prismic.io/docs/route-resolver#link-resolver}\n * @see Prismic API `routes` options documentation: {@link https://prismic.io/docs/route-resolver}\n */\nexport const asLinkAttrs = <\n\tLinkResolverFunctionReturnType = ReturnType<LinkResolverFunction>,\n\tField extends LinkField | PrismicDocument | null | undefined =\n\t\t| LinkField\n\t\t| PrismicDocument\n\t\t| null\n\t\t| undefined,\n>(\n\tlinkFieldOrDocument: Field,\n\tconfig: AsLinkAttrsConfig<LinkResolverFunctionReturnType> = {},\n): AsLinkAttrsReturnType<LinkResolverFunctionReturnType> => {\n\tif (\n\t\tlinkFieldOrDocument &&\n\t\t// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n\t\t// @ts-ignore - Bug in TypeScript 4.9: https://github.com/microsoft/TypeScript/issues/51501\n\t\t(\"link_type\" in linkFieldOrDocument\n\t\t\t? isFilledLink(linkFieldOrDocument)\n\t\t\t: linkFieldOrDocument)\n\t) {\n\t\tconst target =\n\t\t\t// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n\t\t\t// @ts-ignore - Bug in TypeScript 4.9: https://github.com/microsoft/TypeScript/issues/51501\n\t\t\t\"target\" in linkFieldOrDocument ? linkFieldOrDocument.target : undefined\n\n\t\tconst rawHref = asLink(linkFieldOrDocument, config.linkResolver)\n\t\tconst href =\n\t\t\trawHref == null ? undefined : (rawHref as NonNullable<typeof rawHref>)\n\n\t\tconst isExternal = typeof href === \"string\" ? !isInternalURL(href) : false\n\n\t\tconst rel = config.rel\n\t\t\t? config.rel({ href, isExternal, target })\n\t\t\t: isExternal\n\t\t\t\t? \"noreferrer\"\n\t\t\t\t: undefined\n\n\t\treturn {\n\t\t\thref,\n\t\t\ttarget,\n\t\t\trel: rel == null ? undefined : rel,\n\t\t}\n\t}\n\n\treturn {}\n}\n"],"names":["isFilledLink"],"mappings":";;;AA0FO,MAAM,cAAc,CAQ1B,qBACA,SAA4D,OACF;AAEzD,MAAA;AAAA;AAAA,GAGC,eAAe,sBACbA,KAAa,mBAAmB,IAChC,sBACF;AACK,UAAA;AAAA;AAAA;AAAA,MAGL,YAAY,sBAAsB,oBAAoB,SAAS;AAAA;AAEhE,UAAM,UAAU,OAAO,qBAAqB,OAAO,YAAY;AACzD,UAAA,OACL,WAAW,OAAO,SAAa;AAEhC,UAAM,aAAa,OAAO,SAAS,WAAW,CAAC,cAAc,IAAI,IAAI;AAErE,UAAM,MAAM,OAAO,MAChB,OAAO,IAAI,EAAE,MAAM,YAAY,OAAQ,CAAA,IACvC,aACC,eACA;AAEG,WAAA;AAAA,MACN;AAAA,MACA;AAAA,MACA,KAAK,OAAO,OAAO,SAAY;AAAA;;AAIjC,SAAO;AACR;"}
|
package/dist/helpers/asText.cjs
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const asText$1 = require("../richtext/asText.cjs");
|
|
4
|
-
const asText = (richTextField, ...configObjectOrTuple) => {
|
|
5
|
-
if (richTextField) {
|
|
6
|
-
const [configObjectOrSeparator] = configObjectOrTuple;
|
|
7
|
-
let config;
|
|
8
|
-
if (typeof configObjectOrSeparator === "string") {
|
|
9
|
-
config = {
|
|
10
|
-
separator: configObjectOrSeparator
|
|
11
|
-
};
|
|
12
|
-
} else {
|
|
13
|
-
config = { ...configObjectOrSeparator };
|
|
14
|
-
}
|
|
15
|
-
return asText$1.asText(richTextField, config.separator);
|
|
16
|
-
} else {
|
|
17
|
-
return null;
|
|
18
|
-
}
|
|
19
|
-
};
|
|
20
|
-
exports.asText = asText;
|
|
21
|
-
//# sourceMappingURL=asText.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"asText.cjs","sources":["../../../src/helpers/asText.ts"],"sourcesContent":["import type { RichTextField } from \"../types/value/richText\"\n\nimport { asText as baseAsText } from \"../richtext/asText\"\n\n/**\n * Configuration that determines the output of `asText()`.\n */\ntype AsTextConfig = {\n\t/**\n\t * Separator used to join each element.\n\t *\n\t * @defaultValue ` ` (a space)\n\t */\n\tseparator?: string\n}\n\n// TODO: Remove when we remove support for deprecated tuple-style configuration.\n/**\n * @deprecated Use object-style configuration instead.\n */\ntype AsTextDeprecatedTupleConfig = [separator?: string]\n\n/**\n * The return type of `asText()`.\n */\ntype AsTextReturnType<Field extends RichTextField | null | undefined> =\n\tField extends RichTextField ? string : null\n\nexport const asText: {\n\t/**\n\t * Serializes a rich text or title field to a plain text string.\n\t *\n\t * @param richTextField - A rich text or title field from Prismic\n\t * @param config - Configuration that determines the output of `asText()`\n\t *\n\t * @returns Plain text equivalent of the provided rich text or title field\n\t *\n\t * @see Templating rich text and title fields from Prismic {@link https://prismic.io/docs/template-content-vanilla-javascript#rich-text-and-title}\n\t */\n\t<Field extends RichTextField | null | undefined>(\n\t\trichTextField: Field,\n\t\tconfig?: AsTextConfig,\n\t): AsTextReturnType<Field>\n\n\t/**\n\t * Serializes a rich text or title field to a plain text string.\n\t *\n\t * @deprecated Use object-style configuration instead.\n\t *\n\t * @param richTextField - A rich text or title field from Prismic\n\t * @param separator - Separator used to join each element, defaults to a space\n\t *\n\t * @returns Plain text equivalent of the provided rich text or title field\n\t *\n\t * @see Templating rich text and title fields from Prismic {@link https://prismic.io/docs/template-content-vanilla-javascript#rich-text-and-title}\n\t */\n\t<Field extends RichTextField | null | undefined>(\n\t\trichTextField: Field,\n\t\t...config: AsTextDeprecatedTupleConfig\n\t): AsTextReturnType<Field>\n} = <Field extends RichTextField | null | undefined>(\n\trichTextField: Field,\n\t// TODO: Rename to `config` when we remove support for deprecated tuple-style configuration.\n\t...configObjectOrTuple: [config?: AsTextConfig] | AsTextDeprecatedTupleConfig\n): AsTextReturnType<Field> => {\n\tif (richTextField) {\n\t\t// TODO: Remove when we remove support for deprecated tuple-style configuration.\n\t\tconst [configObjectOrSeparator] = configObjectOrTuple\n\t\tlet config: AsTextConfig\n\t\tif (typeof configObjectOrSeparator === \"string\") {\n\t\t\tconfig = {\n\t\t\t\tseparator: configObjectOrSeparator,\n\t\t\t}\n\t\t} else {\n\t\t\tconfig = { ...configObjectOrSeparator }\n\t\t}\n\n\t\treturn baseAsText(\n\t\t\trichTextField,\n\t\t\tconfig.separator,\n\t\t) as AsTextReturnType<Field>\n\t} else {\n\t\treturn null as AsTextReturnType<Field>\n\t}\n}\n"],"names":["baseAsText"],"mappings":";;;AA4Ba,MAAA,SAgCT,CACH,kBAEG,wBACyB;AAC5B,MAAI,eAAe;AAEZ,UAAA,CAAC,uBAAuB,IAAI;AAC9B,QAAA;AACA,QAAA,OAAO,4BAA4B,UAAU;AACvC,eAAA;AAAA,QACR,WAAW;AAAA;WAEN;AACG,eAAA,EAAE,GAAG;;AAGR,WAAAA,gBACN,eACA,OAAO,SAAS;AAAA,EAAA,OAEX;AACC,WAAA;AAAA,EAAA;AAET;;"}
|
package/dist/helpers/asText.d.ts
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import type { RichTextField } from "../types/value/richText";
|
|
2
|
-
/**
|
|
3
|
-
* Configuration that determines the output of `asText()`.
|
|
4
|
-
*/
|
|
5
|
-
type AsTextConfig = {
|
|
6
|
-
/**
|
|
7
|
-
* Separator used to join each element.
|
|
8
|
-
*
|
|
9
|
-
* @defaultValue ` ` (a space)
|
|
10
|
-
*/
|
|
11
|
-
separator?: string;
|
|
12
|
-
};
|
|
13
|
-
/**
|
|
14
|
-
* @deprecated Use object-style configuration instead.
|
|
15
|
-
*/
|
|
16
|
-
type AsTextDeprecatedTupleConfig = [separator?: string];
|
|
17
|
-
/**
|
|
18
|
-
* The return type of `asText()`.
|
|
19
|
-
*/
|
|
20
|
-
type AsTextReturnType<Field extends RichTextField | null | undefined> = Field extends RichTextField ? string : null;
|
|
21
|
-
export declare const asText: {
|
|
22
|
-
/**
|
|
23
|
-
* Serializes a rich text or title field to a plain text string.
|
|
24
|
-
*
|
|
25
|
-
* @param richTextField - A rich text or title field from Prismic
|
|
26
|
-
* @param config - Configuration that determines the output of `asText()`
|
|
27
|
-
*
|
|
28
|
-
* @returns Plain text equivalent of the provided rich text or title field
|
|
29
|
-
*
|
|
30
|
-
* @see Templating rich text and title fields from Prismic {@link https://prismic.io/docs/template-content-vanilla-javascript#rich-text-and-title}
|
|
31
|
-
*/
|
|
32
|
-
<Field extends RichTextField | null | undefined>(richTextField: Field, config?: AsTextConfig): AsTextReturnType<Field>;
|
|
33
|
-
/**
|
|
34
|
-
* Serializes a rich text or title field to a plain text string.
|
|
35
|
-
*
|
|
36
|
-
* @deprecated Use object-style configuration instead.
|
|
37
|
-
*
|
|
38
|
-
* @param richTextField - A rich text or title field from Prismic
|
|
39
|
-
* @param separator - Separator used to join each element, defaults to a space
|
|
40
|
-
*
|
|
41
|
-
* @returns Plain text equivalent of the provided rich text or title field
|
|
42
|
-
*
|
|
43
|
-
* @see Templating rich text and title fields from Prismic {@link https://prismic.io/docs/template-content-vanilla-javascript#rich-text-and-title}
|
|
44
|
-
*/
|
|
45
|
-
<Field extends RichTextField | null | undefined>(richTextField: Field, ...config: AsTextDeprecatedTupleConfig): AsTextReturnType<Field>;
|
|
46
|
-
};
|
|
47
|
-
export {};
|
package/dist/helpers/asText.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { asText as asText$1 } from "../richtext/asText.js";
|
|
2
|
-
const asText = (richTextField, ...configObjectOrTuple) => {
|
|
3
|
-
if (richTextField) {
|
|
4
|
-
const [configObjectOrSeparator] = configObjectOrTuple;
|
|
5
|
-
let config;
|
|
6
|
-
if (typeof configObjectOrSeparator === "string") {
|
|
7
|
-
config = {
|
|
8
|
-
separator: configObjectOrSeparator
|
|
9
|
-
};
|
|
10
|
-
} else {
|
|
11
|
-
config = { ...configObjectOrSeparator };
|
|
12
|
-
}
|
|
13
|
-
return asText$1(richTextField, config.separator);
|
|
14
|
-
} else {
|
|
15
|
-
return null;
|
|
16
|
-
}
|
|
17
|
-
};
|
|
18
|
-
export {
|
|
19
|
-
asText
|
|
20
|
-
};
|
|
21
|
-
//# sourceMappingURL=asText.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"asText.js","sources":["../../../src/helpers/asText.ts"],"sourcesContent":["import type { RichTextField } from \"../types/value/richText\"\n\nimport { asText as baseAsText } from \"../richtext/asText\"\n\n/**\n * Configuration that determines the output of `asText()`.\n */\ntype AsTextConfig = {\n\t/**\n\t * Separator used to join each element.\n\t *\n\t * @defaultValue ` ` (a space)\n\t */\n\tseparator?: string\n}\n\n// TODO: Remove when we remove support for deprecated tuple-style configuration.\n/**\n * @deprecated Use object-style configuration instead.\n */\ntype AsTextDeprecatedTupleConfig = [separator?: string]\n\n/**\n * The return type of `asText()`.\n */\ntype AsTextReturnType<Field extends RichTextField | null | undefined> =\n\tField extends RichTextField ? string : null\n\nexport const asText: {\n\t/**\n\t * Serializes a rich text or title field to a plain text string.\n\t *\n\t * @param richTextField - A rich text or title field from Prismic\n\t * @param config - Configuration that determines the output of `asText()`\n\t *\n\t * @returns Plain text equivalent of the provided rich text or title field\n\t *\n\t * @see Templating rich text and title fields from Prismic {@link https://prismic.io/docs/template-content-vanilla-javascript#rich-text-and-title}\n\t */\n\t<Field extends RichTextField | null | undefined>(\n\t\trichTextField: Field,\n\t\tconfig?: AsTextConfig,\n\t): AsTextReturnType<Field>\n\n\t/**\n\t * Serializes a rich text or title field to a plain text string.\n\t *\n\t * @deprecated Use object-style configuration instead.\n\t *\n\t * @param richTextField - A rich text or title field from Prismic\n\t * @param separator - Separator used to join each element, defaults to a space\n\t *\n\t * @returns Plain text equivalent of the provided rich text or title field\n\t *\n\t * @see Templating rich text and title fields from Prismic {@link https://prismic.io/docs/template-content-vanilla-javascript#rich-text-and-title}\n\t */\n\t<Field extends RichTextField | null | undefined>(\n\t\trichTextField: Field,\n\t\t...config: AsTextDeprecatedTupleConfig\n\t): AsTextReturnType<Field>\n} = <Field extends RichTextField | null | undefined>(\n\trichTextField: Field,\n\t// TODO: Rename to `config` when we remove support for deprecated tuple-style configuration.\n\t...configObjectOrTuple: [config?: AsTextConfig] | AsTextDeprecatedTupleConfig\n): AsTextReturnType<Field> => {\n\tif (richTextField) {\n\t\t// TODO: Remove when we remove support for deprecated tuple-style configuration.\n\t\tconst [configObjectOrSeparator] = configObjectOrTuple\n\t\tlet config: AsTextConfig\n\t\tif (typeof configObjectOrSeparator === \"string\") {\n\t\t\tconfig = {\n\t\t\t\tseparator: configObjectOrSeparator,\n\t\t\t}\n\t\t} else {\n\t\t\tconfig = { ...configObjectOrSeparator }\n\t\t}\n\n\t\treturn baseAsText(\n\t\t\trichTextField,\n\t\t\tconfig.separator,\n\t\t) as AsTextReturnType<Field>\n\t} else {\n\t\treturn null as AsTextReturnType<Field>\n\t}\n}\n"],"names":["baseAsText"],"mappings":";AA4Ba,MAAA,SAgCT,CACH,kBAEG,wBACyB;AAC5B,MAAI,eAAe;AAEZ,UAAA,CAAC,uBAAuB,IAAI;AAC9B,QAAA;AACA,QAAA,OAAO,4BAA4B,UAAU;AACvC,eAAA;AAAA,QACR,WAAW;AAAA;WAEN;AACG,eAAA,EAAE,GAAG;;AAGR,WAAAA,SACN,eACA,OAAO,SAAS;AAAA,EAAA,OAEX;AACC,WAAA;AAAA,EAAA;AAET;"}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const link = require("../types/value/link.cjs");
|
|
4
|
-
const documentToLinkField = (prismicDocument) => {
|
|
5
|
-
var _a;
|
|
6
|
-
return {
|
|
7
|
-
link_type: link.LinkType.Document,
|
|
8
|
-
id: prismicDocument.id,
|
|
9
|
-
uid: prismicDocument.uid || void 0,
|
|
10
|
-
type: prismicDocument.type,
|
|
11
|
-
tags: prismicDocument.tags,
|
|
12
|
-
lang: prismicDocument.lang,
|
|
13
|
-
url: prismicDocument.url == null ? void 0 : prismicDocument.url,
|
|
14
|
-
slug: (_a = prismicDocument.slugs) == null ? void 0 : _a[0],
|
|
15
|
-
// Slug field is not available with GraphQL
|
|
16
|
-
// The REST API does not include a `data` property if the data
|
|
17
|
-
// object is empty.
|
|
18
|
-
//
|
|
19
|
-
// A presence check for `prismicDocument.data` is done to
|
|
20
|
-
// support partial documents. While `documentToLinkField` is
|
|
21
|
-
// not typed to accept partial documents, passing a partial
|
|
22
|
-
// document can happen in untyped projects.
|
|
23
|
-
...prismicDocument.data && Object.keys(prismicDocument.data).length > 0 ? { data: prismicDocument.data } : {}
|
|
24
|
-
};
|
|
25
|
-
};
|
|
26
|
-
exports.documentToLinkField = documentToLinkField;
|
|
27
|
-
//# sourceMappingURL=documentToLinkField.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"documentToLinkField.cjs","sources":["../../../src/helpers/documentToLinkField.ts"],"sourcesContent":["import type { FilledContentRelationshipField } from \"../types/value/contentRelationship\"\nimport type { PrismicDocument } from \"../types/value/document\"\nimport { LinkType } from \"../types/value/link\"\n\ntype SetOptional<T, Keys extends keyof T> = Omit<T, Keys> &\n\tPartial<Pick<T, Keys>>\n\n/**\n * Converts a document into a link field, this is useful when crawling the API\n * for document links\n *\n * @typeParam TDocument - Specific interface of the provided document\n *\n * @param prismicDocument - A document coming from Prismic\n *\n * @returns The equivalent link field to use with `asLink()`\n *\n * @internal\n */\nexport const documentToLinkField = <\n\tTDocument extends SetOptional<PrismicDocument, \"slugs\">,\n>(\n\tprismicDocument: TDocument,\n): FilledContentRelationshipField<\n\tTDocument[\"type\"],\n\tTDocument[\"lang\"],\n\tTDocument[\"data\"]\n> => {\n\treturn {\n\t\tlink_type: LinkType.Document,\n\t\tid: prismicDocument.id,\n\t\tuid: prismicDocument.uid || undefined,\n\t\ttype: prismicDocument.type,\n\t\ttags: prismicDocument.tags,\n\t\tlang: prismicDocument.lang,\n\t\turl: prismicDocument.url == null ? undefined : prismicDocument.url,\n\t\tslug: prismicDocument.slugs?.[0], // Slug field is not available with GraphQL\n\t\t// The REST API does not include a `data` property if the data\n\t\t// object is empty.\n\t\t//\n\t\t// A presence check for `prismicDocument.data` is done to\n\t\t// support partial documents. While `documentToLinkField` is\n\t\t// not typed to accept partial documents, passing a partial\n\t\t// document can happen in untyped projects.\n\t\t...(prismicDocument.data && Object.keys(prismicDocument.data).length > 0\n\t\t\t? { data: prismicDocument.data }\n\t\t\t: {}),\n\t}\n}\n"],"names":["LinkType"],"mappings":";;;AAmBa,MAAA,sBAAsB,CAGlC,oBAKG;;AACI,SAAA;AAAA,IACN,WAAWA,KAAS,SAAA;AAAA,IACpB,IAAI,gBAAgB;AAAA,IACpB,KAAK,gBAAgB,OAAO;AAAA,IAC5B,MAAM,gBAAgB;AAAA,IACtB,MAAM,gBAAgB;AAAA,IACtB,MAAM,gBAAgB;AAAA,IACtB,KAAK,gBAAgB,OAAO,OAAO,SAAY,gBAAgB;AAAA,IAC/D,OAAM,qBAAgB,UAAhB,mBAAwB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAQ9B,GAAI,gBAAgB,QAAQ,OAAO,KAAK,gBAAgB,IAAI,EAAE,SAAS,IACpE,EAAE,MAAM,gBAAgB,KAAA,IACxB,CAAA;AAAA;AAEL;;"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type { FilledContentRelationshipField } from "../types/value/contentRelationship";
|
|
2
|
-
import type { PrismicDocument } from "../types/value/document";
|
|
3
|
-
type SetOptional<T, Keys extends keyof T> = Omit<T, Keys> & Partial<Pick<T, Keys>>;
|
|
4
|
-
/**
|
|
5
|
-
* Converts a document into a link field, this is useful when crawling the API
|
|
6
|
-
* for document links
|
|
7
|
-
*
|
|
8
|
-
* @typeParam TDocument - Specific interface of the provided document
|
|
9
|
-
*
|
|
10
|
-
* @param prismicDocument - A document coming from Prismic
|
|
11
|
-
*
|
|
12
|
-
* @returns The equivalent link field to use with `asLink()`
|
|
13
|
-
*
|
|
14
|
-
* @internal
|
|
15
|
-
*/
|
|
16
|
-
export declare const documentToLinkField: <TDocument extends SetOptional<PrismicDocument, "slugs">>(prismicDocument: TDocument) => FilledContentRelationshipField<TDocument["type"], TDocument["lang"], TDocument["data"]>;
|
|
17
|
-
export {};
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { LinkType } from "../types/value/link.js";
|
|
2
|
-
const documentToLinkField = (prismicDocument) => {
|
|
3
|
-
var _a;
|
|
4
|
-
return {
|
|
5
|
-
link_type: LinkType.Document,
|
|
6
|
-
id: prismicDocument.id,
|
|
7
|
-
uid: prismicDocument.uid || void 0,
|
|
8
|
-
type: prismicDocument.type,
|
|
9
|
-
tags: prismicDocument.tags,
|
|
10
|
-
lang: prismicDocument.lang,
|
|
11
|
-
url: prismicDocument.url == null ? void 0 : prismicDocument.url,
|
|
12
|
-
slug: (_a = prismicDocument.slugs) == null ? void 0 : _a[0],
|
|
13
|
-
// Slug field is not available with GraphQL
|
|
14
|
-
// The REST API does not include a `data` property if the data
|
|
15
|
-
// object is empty.
|
|
16
|
-
//
|
|
17
|
-
// A presence check for `prismicDocument.data` is done to
|
|
18
|
-
// support partial documents. While `documentToLinkField` is
|
|
19
|
-
// not typed to accept partial documents, passing a partial
|
|
20
|
-
// document can happen in untyped projects.
|
|
21
|
-
...prismicDocument.data && Object.keys(prismicDocument.data).length > 0 ? { data: prismicDocument.data } : {}
|
|
22
|
-
};
|
|
23
|
-
};
|
|
24
|
-
export {
|
|
25
|
-
documentToLinkField
|
|
26
|
-
};
|
|
27
|
-
//# sourceMappingURL=documentToLinkField.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"documentToLinkField.js","sources":["../../../src/helpers/documentToLinkField.ts"],"sourcesContent":["import type { FilledContentRelationshipField } from \"../types/value/contentRelationship\"\nimport type { PrismicDocument } from \"../types/value/document\"\nimport { LinkType } from \"../types/value/link\"\n\ntype SetOptional<T, Keys extends keyof T> = Omit<T, Keys> &\n\tPartial<Pick<T, Keys>>\n\n/**\n * Converts a document into a link field, this is useful when crawling the API\n * for document links\n *\n * @typeParam TDocument - Specific interface of the provided document\n *\n * @param prismicDocument - A document coming from Prismic\n *\n * @returns The equivalent link field to use with `asLink()`\n *\n * @internal\n */\nexport const documentToLinkField = <\n\tTDocument extends SetOptional<PrismicDocument, \"slugs\">,\n>(\n\tprismicDocument: TDocument,\n): FilledContentRelationshipField<\n\tTDocument[\"type\"],\n\tTDocument[\"lang\"],\n\tTDocument[\"data\"]\n> => {\n\treturn {\n\t\tlink_type: LinkType.Document,\n\t\tid: prismicDocument.id,\n\t\tuid: prismicDocument.uid || undefined,\n\t\ttype: prismicDocument.type,\n\t\ttags: prismicDocument.tags,\n\t\tlang: prismicDocument.lang,\n\t\turl: prismicDocument.url == null ? undefined : prismicDocument.url,\n\t\tslug: prismicDocument.slugs?.[0], // Slug field is not available with GraphQL\n\t\t// The REST API does not include a `data` property if the data\n\t\t// object is empty.\n\t\t//\n\t\t// A presence check for `prismicDocument.data` is done to\n\t\t// support partial documents. While `documentToLinkField` is\n\t\t// not typed to accept partial documents, passing a partial\n\t\t// document can happen in untyped projects.\n\t\t...(prismicDocument.data && Object.keys(prismicDocument.data).length > 0\n\t\t\t? { data: prismicDocument.data }\n\t\t\t: {}),\n\t}\n}\n"],"names":[],"mappings":";AAmBa,MAAA,sBAAsB,CAGlC,oBAKG;;AACI,SAAA;AAAA,IACN,WAAW,SAAS;AAAA,IACpB,IAAI,gBAAgB;AAAA,IACpB,KAAK,gBAAgB,OAAO;AAAA,IAC5B,MAAM,gBAAgB;AAAA,IACtB,MAAM,gBAAgB;AAAA,IACtB,MAAM,gBAAgB;AAAA,IACtB,KAAK,gBAAgB,OAAO,OAAO,SAAY,gBAAgB;AAAA,IAC/D,OAAM,qBAAgB,UAAhB,mBAAwB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAQ9B,GAAI,gBAAgB,QAAQ,OAAO,KAAK,gBAAgB,IAAI,EAAE,SAAS,IACpE,EAAE,MAAM,gBAAgB,KAAA,IACxB,CAAA;AAAA;AAEL;"}
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const isNonNullish = (input) => {
|
|
4
|
-
return input != null;
|
|
5
|
-
};
|
|
6
|
-
const isNonEmptyArray = (input) => {
|
|
7
|
-
return !!input.length;
|
|
8
|
-
};
|
|
9
|
-
const richText = (field) => {
|
|
10
|
-
if (!isNonNullish(field)) {
|
|
11
|
-
return false;
|
|
12
|
-
} else if (field.length === 1 && "text" in field[0]) {
|
|
13
|
-
return !!field[0].text;
|
|
14
|
-
} else {
|
|
15
|
-
return !!field.length;
|
|
16
|
-
}
|
|
17
|
-
};
|
|
18
|
-
const title = richText;
|
|
19
|
-
const imageThumbnail = (thumbnail) => {
|
|
20
|
-
return isNonNullish(thumbnail) && !!thumbnail.url;
|
|
21
|
-
};
|
|
22
|
-
const image = imageThumbnail;
|
|
23
|
-
const link = (field) => {
|
|
24
|
-
return isNonNullish(field) && ("id" in field || "url" in field);
|
|
25
|
-
};
|
|
26
|
-
const linkToMedia = link;
|
|
27
|
-
const contentRelationship = link;
|
|
28
|
-
const date = isNonNullish;
|
|
29
|
-
const timestamp = isNonNullish;
|
|
30
|
-
const color = isNonNullish;
|
|
31
|
-
const number = isNonNullish;
|
|
32
|
-
const keyText = (field) => {
|
|
33
|
-
return isNonNullish(keyText) && !!field;
|
|
34
|
-
};
|
|
35
|
-
const select = isNonNullish;
|
|
36
|
-
const embed = (field) => {
|
|
37
|
-
return isNonNullish(field) && !!field.embed_url;
|
|
38
|
-
};
|
|
39
|
-
const geoPoint = (field) => {
|
|
40
|
-
return isNonNullish(field) && "longitude" in field;
|
|
41
|
-
};
|
|
42
|
-
const table = isNonNullish;
|
|
43
|
-
const integration = isNonNullish;
|
|
44
|
-
const integrationField = integration;
|
|
45
|
-
const integrationFields = integration;
|
|
46
|
-
const repeatable = (repeatable2) => {
|
|
47
|
-
return isNonNullish(repeatable2) && isNonEmptyArray(repeatable2);
|
|
48
|
-
};
|
|
49
|
-
const group = (group2) => {
|
|
50
|
-
return isNonNullish(group2) && isNonEmptyArray(group2);
|
|
51
|
-
};
|
|
52
|
-
const sliceZone = (slices) => {
|
|
53
|
-
return isNonNullish(slices) && isNonEmptyArray(slices);
|
|
54
|
-
};
|
|
55
|
-
exports.color = color;
|
|
56
|
-
exports.contentRelationship = contentRelationship;
|
|
57
|
-
exports.date = date;
|
|
58
|
-
exports.embed = embed;
|
|
59
|
-
exports.geoPoint = geoPoint;
|
|
60
|
-
exports.group = group;
|
|
61
|
-
exports.image = image;
|
|
62
|
-
exports.imageThumbnail = imageThumbnail;
|
|
63
|
-
exports.integration = integration;
|
|
64
|
-
exports.integrationField = integrationField;
|
|
65
|
-
exports.integrationFields = integrationFields;
|
|
66
|
-
exports.keyText = keyText;
|
|
67
|
-
exports.link = link;
|
|
68
|
-
exports.linkToMedia = linkToMedia;
|
|
69
|
-
exports.number = number;
|
|
70
|
-
exports.repeatable = repeatable;
|
|
71
|
-
exports.richText = richText;
|
|
72
|
-
exports.select = select;
|
|
73
|
-
exports.sliceZone = sliceZone;
|
|
74
|
-
exports.table = table;
|
|
75
|
-
exports.timestamp = timestamp;
|
|
76
|
-
exports.title = title;
|
|
77
|
-
//# sourceMappingURL=isFilled.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"isFilled.cjs","sources":["../../../src/helpers/isFilled.ts"],"sourcesContent":["import type { ColorField } from \"../types/value/color\"\nimport type {\n\tContentRelationshipField,\n\tEmptyContentRelationshipField,\n} from \"../types/value/contentRelationship\"\nimport type { DateField } from \"../types/value/date\"\nimport type { AnyOEmbed, EmbedField } from \"../types/value/embed\"\nimport type { GeoPointField } from \"../types/value/geoPoint\"\nimport type { GroupField, NestedGroupField } from \"../types/value/group\"\nimport type { ImageField, ImageFieldImage } from \"../types/value/image\"\nimport type {\n\tIntegrationField,\n\tIntegrationFieldData,\n} from \"../types/value/integration\"\nimport type { KeyTextField } from \"../types/value/keyText\"\nimport type { LinkField } from \"../types/value/link\"\nimport type { LinkToMediaField } from \"../types/value/linkToMedia\"\nimport type { NumberField } from \"../types/value/number\"\nimport type { RichTextField } from \"../types/value/richText\"\nimport type { SelectField } from \"../types/value/select\"\nimport type { SharedSlice } from \"../types/value/sharedSlice\"\nimport type { Slice } from \"../types/value/slice\"\nimport type { SliceZone } from \"../types/value/sliceZone\"\nimport type { TableField } from \"../types/value/table\"\nimport type { TimestampField } from \"../types/value/timestamp\"\nimport type { TitleField } from \"../types/value/title\"\nimport type { AnyRegularField, Repeatable } from \"../types/value/types\"\n\n/**\n * Determines if a value is not nullish (i.e. not `null` or `undefined`). This\n * is used to check if nullable field values are filled.\n *\n * @param input - The value to check.\n *\n * @returns `true` if `input` is not nullish, `false` otherwise.\n */\nconst isNonNullish = <T>(input: T): input is NonNullable<T> => {\n\treturn input != null\n}\n\n/**\n * Determines if an array is not empty. This is used to check if array-based\n * fields are filled.\n *\n * @param input - The array to check.\n *\n * @returns `true` if `input` has at least one element, `false` otherwise.\n */\nconst isNonEmptyArray = <T>(input: T[]): input is [T, ...T[]] => {\n\treturn !!input.length\n}\n\n/**\n * Determines if a rich text field is filled.\n *\n * @param field - rich text field to check.\n *\n * @returns `true` if `field` is filled, `false` otherwise.\n */\nexport const richText = (\n\tfield: RichTextField | null | undefined,\n): field is RichTextField<\"filled\"> => {\n\tif (!isNonNullish(field)) {\n\t\treturn false\n\t} else if (field.length === 1 && \"text\" in field[0]) {\n\t\treturn !!field[0].text\n\t} else {\n\t\treturn !!field.length\n\t}\n}\n\n/**\n * Determines if a title field is filled.\n *\n * @param field - Title field to check.\n *\n * @returns `true` if `field` is filled, `false` otherwise.\n */\nexport const title = richText as (\n\tfield: TitleField | null | undefined,\n) => field is TitleField<\"filled\">\n\n/**\n * Determines if an Image thumbnail is filled.\n *\n * @param thumbnail - Image thumbnail to check.\n *\n * @returns `true` if `field` is filled, `false` otherwise.\n */\nexport const imageThumbnail = (\n\tthumbnail: ImageFieldImage | null | undefined,\n): thumbnail is ImageFieldImage<\"filled\"> => {\n\treturn isNonNullish(thumbnail) && !!thumbnail.url\n}\n\n/**\n * Determines if an image field is filled.\n *\n * @param field - Image field to check.\n *\n * @returns `true` if `field` is filled, `false` otherwise.\n */\nexport const image = imageThumbnail as <\n\tThumbnailNames extends string | null = never,\n>(\n\tfield: ImageField<ThumbnailNames> | null | undefined,\n) => field is ImageField<ThumbnailNames, \"filled\">\n\n/**\n * Determines if a link field is filled.\n *\n * @param field - Link field to check.\n *\n * @returns `true` if `field` is filled, `false` otherwise.\n */\nexport const link = <\n\tTypeEnum = string,\n\tLangEnum = string,\n\tDataInterface extends\n\t\t| Record<string, AnyRegularField | GroupField | SliceZone>\n\t\t| unknown = unknown,\n>(\n\tfield: LinkField<TypeEnum, LangEnum, DataInterface> | null | undefined,\n): field is LinkField<TypeEnum, LangEnum, DataInterface, \"filled\"> => {\n\treturn isNonNullish(field) && (\"id\" in field || \"url\" in field)\n}\n\n/**\n * Determines if a link to media field is filled.\n *\n * @param field - Link to media field to check.\n *\n * @returns `true` if `field` is filled, `false` otherwise.\n */\nexport const linkToMedia = link as (\n\tfield: LinkToMediaField | null | undefined,\n) => field is LinkToMediaField<\"filled\">\n\n/**\n * Determines if a content relationship field is filled.\n *\n * @param field - Content Relationship field to check.\n *\n * @returns `true` if `field` is filled, `false` otherwise.\n */\nexport const contentRelationship = link as <\n\tField extends ContentRelationshipField,\n>(\n\tfield: Field | null | undefined,\n) => field is Exclude<Field, EmptyContentRelationshipField>\n\n/**\n * Determines if a date field is filled.\n *\n * @param field - Date field to check.\n *\n * @returns `true` if `field` is filled, `false` otherwise.\n */\nexport const date = isNonNullish as (\n\tfield: DateField | null | undefined,\n) => field is DateField<\"filled\">\n\n/**\n * Determines if a timestamp field is filled.\n *\n * @param field - Timestamp field to check.\n *\n * @returns `true` if `field` is filled, `false` otherwise.\n */\nexport const timestamp = isNonNullish as (\n\tfield: TimestampField | null | undefined,\n) => field is TimestampField<\"filled\">\n\n/**\n * Determines if a color field is filled.\n *\n * @param field - Color field to check.\n *\n * @returns `true` if `field` is filled, `false` otherwise.\n */\nexport const color = isNonNullish as (\n\tfield: ColorField | null | undefined,\n) => field is ColorField<\"filled\">\n\n/**\n * Determines if a number field is filled.\n *\n * @param field - Number field to check.\n *\n * @returns `true` if `field` is filled, `false` otherwise.\n */\nexport const number = isNonNullish as (\n\tfield: NumberField | null | undefined,\n) => field is NumberField<\"filled\">\n\n/**\n * Determines if a key text field is filled.\n *\n * @param field - Key Text field to check.\n *\n * @returns `true` if `field` is filled, `false` otherwise.\n */\nexport const keyText = (\n\tfield: KeyTextField | null | undefined,\n): field is KeyTextField<\"filled\"> => {\n\treturn isNonNullish(keyText) && !!field\n}\n\n/**\n * Determines if a select field is filled.\n *\n * @param field - Select field to check.\n *\n * @returns `true` if `field` is filled, `false` otherwise.\n */\nexport const select = isNonNullish as <Enum extends string>(\n\tfield: SelectField<Enum> | null | undefined,\n) => field is SelectField<Enum, \"filled\">\n\n/**\n * Determines if an embed field is filled.\n *\n * @param field - Embed field to check.\n *\n * @returns `true` if `field` is filled, `false` otherwise.\n */\nexport const embed = <Field extends EmbedField<AnyOEmbed>>(\n\tfield: Field | null | undefined,\n): field is Extract<Field, EmbedField<AnyOEmbed, \"filled\">> => {\n\treturn isNonNullish(field) && !!field.embed_url\n}\n\n/**\n * Determines if a geopoint field is filled.\n *\n * @param field - GeoPoint field to check.\n *\n * @returns `true` if `field` is filled, `false` otherwise.\n */\nexport const geoPoint = (\n\tfield: GeoPointField | null | undefined,\n): field is GeoPointField<\"filled\"> => {\n\treturn isNonNullish(field) && \"longitude\" in field\n}\n\n/**\n * Determines if a table field is filled.\n *\n * @param field - Table field to check.\n *\n * @returns `true` if `field` is filled, `false` otherwise.\n */\nexport const table = isNonNullish as (\n\tfield: TableField | null | undefined,\n) => field is TableField<\"filled\">\n\n/**\n * Determines if an integration field is filled.\n *\n * @param field - Integration field to check.\n *\n * @returns `true` if `field` is filled, `false` otherwise.\n */\nexport const integration = isNonNullish as <Data extends IntegrationFieldData>(\n\tfield: IntegrationField<Data> | null | undefined,\n) => field is IntegrationField<Data, \"filled\">\n/**\n * @deprecated Renamed to `integration`.\n */\n// TODO: Remove when we remove support for deprecated `integrationField` export.\nexport const integrationField = integration\n/**\n * @deprecated Renamed to `integrationField`.\n */\n// TODO: Remove when we remove support for deprecated `integrationFields` export.\nexport const integrationFields = integration\n\n/**\n * Determines if a repeatable field has at least one item.\n *\n * @param repeatable - Repeatable to check.\n *\n * @returns `true` if `repeatable` contains at least one item, `false`\n * otherwise.\n */\nexport const repeatable = <T extends LinkField>(\n\trepeatable: Repeatable<T> | null | undefined,\n): repeatable is Repeatable<T, \"filled\"> => {\n\treturn isNonNullish(repeatable) && isNonEmptyArray(repeatable)\n}\n\n/**\n * Determines if a Group has at least one item.\n *\n * @param group - Group to check.\n *\n * @returns `true` if `group` contains at least one item, `false` otherwise.\n */\nexport const group = <\n\tFields extends Record<string, AnyRegularField | NestedGroupField>,\n>(\n\tgroup: GroupField<Fields> | null | undefined,\n): group is GroupField<Fields, \"filled\"> => {\n\treturn isNonNullish(group) && isNonEmptyArray(group)\n}\n\n/**\n * Determines if a Slice Zone has at least one Slice.\n *\n * @param slices - Slice Zone to check.\n *\n * @returns `true` if `slices` contains at least one Slice, `false` otherwise.\n */\nexport const sliceZone = <Slices extends Slice | SharedSlice>(\n\tslices: SliceZone<Slices> | null | undefined,\n): slices is SliceZone<Slices, \"filled\"> => {\n\treturn isNonNullish(slices) && isNonEmptyArray(slices)\n}\n"],"names":["repeatable","group"],"mappings":";;AAoCA,MAAM,eAAe,CAAI,UAAqC;AAC7D,SAAO,SAAS;AACjB;AAUA,MAAM,kBAAkB,CAAI,UAAoC;AACxD,SAAA,CAAC,CAAC,MAAM;AAChB;AASa,MAAA,WAAW,CACvB,UACqC;AACjC,MAAA,CAAC,aAAa,KAAK,GAAG;AAClB,WAAA;AAAA,EAAA,WACG,MAAM,WAAW,KAAK,UAAU,MAAM,CAAC,GAAG;AACpD,WAAO,CAAC,CAAC,MAAM,CAAC,EAAE;AAAA,EAAA,OACZ;AACC,WAAA,CAAC,CAAC,MAAM;AAAA,EAAA;AAEjB;AASO,MAAM,QAAQ;AAWR,MAAA,iBAAiB,CAC7B,cAC2C;AAC3C,SAAO,aAAa,SAAS,KAAK,CAAC,CAAC,UAAU;AAC/C;AASO,MAAM,QAAQ;AAaR,MAAA,OAAO,CAOnB,UACoE;AACpE,SAAO,aAAa,KAAK,MAAM,QAAQ,SAAS,SAAS;AAC1D;AASO,MAAM,cAAc;AAWpB,MAAM,sBAAsB;AAa5B,MAAM,OAAO;AAWb,MAAM,YAAY;AAWlB,MAAM,QAAQ;AAWd,MAAM,SAAS;AAWT,MAAA,UAAU,CACtB,UACoC;AACpC,SAAO,aAAa,OAAO,KAAK,CAAC,CAAC;AACnC;AASO,MAAM,SAAS;AAWT,MAAA,QAAQ,CACpB,UAC6D;AAC7D,SAAO,aAAa,KAAK,KAAK,CAAC,CAAC,MAAM;AACvC;AASa,MAAA,WAAW,CACvB,UACqC;AAC9B,SAAA,aAAa,KAAK,KAAK,eAAe;AAC9C;AASO,MAAM,QAAQ;AAWd,MAAM,cAAc;AAOpB,MAAM,mBAAmB;AAKzB,MAAM,oBAAoB;AAUpB,MAAA,aAAa,CACzBA,gBAC0C;AAC1C,SAAO,aAAaA,WAAU,KAAK,gBAAgBA,WAAU;AAC9D;AASa,MAAA,QAAQ,CAGpBC,WAC0C;AAC1C,SAAO,aAAaA,MAAK,KAAK,gBAAgBA,MAAK;AACpD;AASa,MAAA,YAAY,CACxB,WAC0C;AAC1C,SAAO,aAAa,MAAM,KAAK,gBAAgB,MAAM;AACtD;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,190 +0,0 @@
|
|
|
1
|
-
import type { ColorField } from "../types/value/color";
|
|
2
|
-
import type { ContentRelationshipField, EmptyContentRelationshipField } from "../types/value/contentRelationship";
|
|
3
|
-
import type { DateField } from "../types/value/date";
|
|
4
|
-
import type { AnyOEmbed, EmbedField } from "../types/value/embed";
|
|
5
|
-
import type { GeoPointField } from "../types/value/geoPoint";
|
|
6
|
-
import type { GroupField, NestedGroupField } from "../types/value/group";
|
|
7
|
-
import type { ImageField, ImageFieldImage } from "../types/value/image";
|
|
8
|
-
import type { IntegrationField, IntegrationFieldData } from "../types/value/integration";
|
|
9
|
-
import type { KeyTextField } from "../types/value/keyText";
|
|
10
|
-
import type { LinkField } from "../types/value/link";
|
|
11
|
-
import type { LinkToMediaField } from "../types/value/linkToMedia";
|
|
12
|
-
import type { NumberField } from "../types/value/number";
|
|
13
|
-
import type { RichTextField } from "../types/value/richText";
|
|
14
|
-
import type { SelectField } from "../types/value/select";
|
|
15
|
-
import type { SharedSlice } from "../types/value/sharedSlice";
|
|
16
|
-
import type { Slice } from "../types/value/slice";
|
|
17
|
-
import type { SliceZone } from "../types/value/sliceZone";
|
|
18
|
-
import type { TableField } from "../types/value/table";
|
|
19
|
-
import type { TimestampField } from "../types/value/timestamp";
|
|
20
|
-
import type { TitleField } from "../types/value/title";
|
|
21
|
-
import type { AnyRegularField, Repeatable } from "../types/value/types";
|
|
22
|
-
/**
|
|
23
|
-
* Determines if a rich text field is filled.
|
|
24
|
-
*
|
|
25
|
-
* @param field - rich text field to check.
|
|
26
|
-
*
|
|
27
|
-
* @returns `true` if `field` is filled, `false` otherwise.
|
|
28
|
-
*/
|
|
29
|
-
export declare const richText: (field: RichTextField | null | undefined) => field is RichTextField<"filled">;
|
|
30
|
-
/**
|
|
31
|
-
* Determines if a title field is filled.
|
|
32
|
-
*
|
|
33
|
-
* @param field - Title field to check.
|
|
34
|
-
*
|
|
35
|
-
* @returns `true` if `field` is filled, `false` otherwise.
|
|
36
|
-
*/
|
|
37
|
-
export declare const title: (field: TitleField | null | undefined) => field is TitleField<"filled">;
|
|
38
|
-
/**
|
|
39
|
-
* Determines if an Image thumbnail is filled.
|
|
40
|
-
*
|
|
41
|
-
* @param thumbnail - Image thumbnail to check.
|
|
42
|
-
*
|
|
43
|
-
* @returns `true` if `field` is filled, `false` otherwise.
|
|
44
|
-
*/
|
|
45
|
-
export declare const imageThumbnail: (thumbnail: ImageFieldImage | null | undefined) => thumbnail is ImageFieldImage<"filled">;
|
|
46
|
-
/**
|
|
47
|
-
* Determines if an image field is filled.
|
|
48
|
-
*
|
|
49
|
-
* @param field - Image field to check.
|
|
50
|
-
*
|
|
51
|
-
* @returns `true` if `field` is filled, `false` otherwise.
|
|
52
|
-
*/
|
|
53
|
-
export declare const image: <ThumbnailNames extends string | null = never>(field: ImageField<ThumbnailNames> | null | undefined) => field is ImageField<ThumbnailNames, "filled">;
|
|
54
|
-
/**
|
|
55
|
-
* Determines if a link field is filled.
|
|
56
|
-
*
|
|
57
|
-
* @param field - Link field to check.
|
|
58
|
-
*
|
|
59
|
-
* @returns `true` if `field` is filled, `false` otherwise.
|
|
60
|
-
*/
|
|
61
|
-
export declare const link: <TypeEnum = string, LangEnum = string, DataInterface extends Record<string, AnyRegularField | GroupField | SliceZone> | unknown = unknown>(field: LinkField<TypeEnum, LangEnum, DataInterface> | null | undefined) => field is LinkField<TypeEnum, LangEnum, DataInterface, "filled">;
|
|
62
|
-
/**
|
|
63
|
-
* Determines if a link to media field is filled.
|
|
64
|
-
*
|
|
65
|
-
* @param field - Link to media field to check.
|
|
66
|
-
*
|
|
67
|
-
* @returns `true` if `field` is filled, `false` otherwise.
|
|
68
|
-
*/
|
|
69
|
-
export declare const linkToMedia: (field: LinkToMediaField | null | undefined) => field is LinkToMediaField<"filled">;
|
|
70
|
-
/**
|
|
71
|
-
* Determines if a content relationship field is filled.
|
|
72
|
-
*
|
|
73
|
-
* @param field - Content Relationship field to check.
|
|
74
|
-
*
|
|
75
|
-
* @returns `true` if `field` is filled, `false` otherwise.
|
|
76
|
-
*/
|
|
77
|
-
export declare const contentRelationship: <Field extends ContentRelationshipField>(field: Field | null | undefined) => field is Exclude<Field, EmptyContentRelationshipField>;
|
|
78
|
-
/**
|
|
79
|
-
* Determines if a date field is filled.
|
|
80
|
-
*
|
|
81
|
-
* @param field - Date field to check.
|
|
82
|
-
*
|
|
83
|
-
* @returns `true` if `field` is filled, `false` otherwise.
|
|
84
|
-
*/
|
|
85
|
-
export declare const date: (field: DateField | null | undefined) => field is DateField<"filled">;
|
|
86
|
-
/**
|
|
87
|
-
* Determines if a timestamp field is filled.
|
|
88
|
-
*
|
|
89
|
-
* @param field - Timestamp field to check.
|
|
90
|
-
*
|
|
91
|
-
* @returns `true` if `field` is filled, `false` otherwise.
|
|
92
|
-
*/
|
|
93
|
-
export declare const timestamp: (field: TimestampField | null | undefined) => field is TimestampField<"filled">;
|
|
94
|
-
/**
|
|
95
|
-
* Determines if a color field is filled.
|
|
96
|
-
*
|
|
97
|
-
* @param field - Color field to check.
|
|
98
|
-
*
|
|
99
|
-
* @returns `true` if `field` is filled, `false` otherwise.
|
|
100
|
-
*/
|
|
101
|
-
export declare const color: (field: ColorField | null | undefined) => field is ColorField<"filled">;
|
|
102
|
-
/**
|
|
103
|
-
* Determines if a number field is filled.
|
|
104
|
-
*
|
|
105
|
-
* @param field - Number field to check.
|
|
106
|
-
*
|
|
107
|
-
* @returns `true` if `field` is filled, `false` otherwise.
|
|
108
|
-
*/
|
|
109
|
-
export declare const number: (field: NumberField | null | undefined) => field is NumberField<"filled">;
|
|
110
|
-
/**
|
|
111
|
-
* Determines if a key text field is filled.
|
|
112
|
-
*
|
|
113
|
-
* @param field - Key Text field to check.
|
|
114
|
-
*
|
|
115
|
-
* @returns `true` if `field` is filled, `false` otherwise.
|
|
116
|
-
*/
|
|
117
|
-
export declare const keyText: (field: KeyTextField | null | undefined) => field is KeyTextField<"filled">;
|
|
118
|
-
/**
|
|
119
|
-
* Determines if a select field is filled.
|
|
120
|
-
*
|
|
121
|
-
* @param field - Select field to check.
|
|
122
|
-
*
|
|
123
|
-
* @returns `true` if `field` is filled, `false` otherwise.
|
|
124
|
-
*/
|
|
125
|
-
export declare const select: <Enum extends string>(field: SelectField<Enum> | null | undefined) => field is SelectField<Enum, "filled">;
|
|
126
|
-
/**
|
|
127
|
-
* Determines if an embed field is filled.
|
|
128
|
-
*
|
|
129
|
-
* @param field - Embed field to check.
|
|
130
|
-
*
|
|
131
|
-
* @returns `true` if `field` is filled, `false` otherwise.
|
|
132
|
-
*/
|
|
133
|
-
export declare const embed: <Field extends EmbedField<AnyOEmbed>>(field: Field | null | undefined) => field is Extract<Field, EmbedField<AnyOEmbed, "filled">>;
|
|
134
|
-
/**
|
|
135
|
-
* Determines if a geopoint field is filled.
|
|
136
|
-
*
|
|
137
|
-
* @param field - GeoPoint field to check.
|
|
138
|
-
*
|
|
139
|
-
* @returns `true` if `field` is filled, `false` otherwise.
|
|
140
|
-
*/
|
|
141
|
-
export declare const geoPoint: (field: GeoPointField | null | undefined) => field is GeoPointField<"filled">;
|
|
142
|
-
/**
|
|
143
|
-
* Determines if a table field is filled.
|
|
144
|
-
*
|
|
145
|
-
* @param field - Table field to check.
|
|
146
|
-
*
|
|
147
|
-
* @returns `true` if `field` is filled, `false` otherwise.
|
|
148
|
-
*/
|
|
149
|
-
export declare const table: (field: TableField | null | undefined) => field is TableField<"filled">;
|
|
150
|
-
/**
|
|
151
|
-
* Determines if an integration field is filled.
|
|
152
|
-
*
|
|
153
|
-
* @param field - Integration field to check.
|
|
154
|
-
*
|
|
155
|
-
* @returns `true` if `field` is filled, `false` otherwise.
|
|
156
|
-
*/
|
|
157
|
-
export declare const integration: <Data extends IntegrationFieldData>(field: IntegrationField<Data> | null | undefined) => field is IntegrationField<Data, "filled">;
|
|
158
|
-
/**
|
|
159
|
-
* @deprecated Renamed to `integration`.
|
|
160
|
-
*/
|
|
161
|
-
export declare const integrationField: <Data extends IntegrationFieldData>(field: IntegrationField<Data> | null | undefined) => field is IntegrationField<Data, "filled">;
|
|
162
|
-
/**
|
|
163
|
-
* @deprecated Renamed to `integrationField`.
|
|
164
|
-
*/
|
|
165
|
-
export declare const integrationFields: <Data extends IntegrationFieldData>(field: IntegrationField<Data> | null | undefined) => field is IntegrationField<Data, "filled">;
|
|
166
|
-
/**
|
|
167
|
-
* Determines if a repeatable field has at least one item.
|
|
168
|
-
*
|
|
169
|
-
* @param repeatable - Repeatable to check.
|
|
170
|
-
*
|
|
171
|
-
* @returns `true` if `repeatable` contains at least one item, `false`
|
|
172
|
-
* otherwise.
|
|
173
|
-
*/
|
|
174
|
-
export declare const repeatable: <T extends LinkField>(repeatable: Repeatable<T> | null | undefined) => repeatable is Repeatable<T, "filled">;
|
|
175
|
-
/**
|
|
176
|
-
* Determines if a Group has at least one item.
|
|
177
|
-
*
|
|
178
|
-
* @param group - Group to check.
|
|
179
|
-
*
|
|
180
|
-
* @returns `true` if `group` contains at least one item, `false` otherwise.
|
|
181
|
-
*/
|
|
182
|
-
export declare const group: <Fields extends Record<string, AnyRegularField | NestedGroupField>>(group: GroupField<Fields> | null | undefined) => group is GroupField<Fields, "filled">;
|
|
183
|
-
/**
|
|
184
|
-
* Determines if a Slice Zone has at least one Slice.
|
|
185
|
-
*
|
|
186
|
-
* @param slices - Slice Zone to check.
|
|
187
|
-
*
|
|
188
|
-
* @returns `true` if `slices` contains at least one Slice, `false` otherwise.
|
|
189
|
-
*/
|
|
190
|
-
export declare const sliceZone: <Slices extends Slice | SharedSlice>(slices: SliceZone<Slices> | null | undefined) => slices is SliceZone<Slices, "filled">;
|