@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,109 @@
|
|
|
1
|
+
import type { Ref } from "./ref.js";
|
|
2
|
+
/**
|
|
3
|
+
* Repository metadata returned from the Prismic REST API V2. This data can be
|
|
4
|
+
* fetched by sending a `GET` a request to a repository's `/api/v2` endpoint.
|
|
5
|
+
*
|
|
6
|
+
* @see More details on the `/api/v2` endpoint: {@link https://prismic.io/docs/api#refs-and-the-entry-api}
|
|
7
|
+
*/
|
|
8
|
+
export interface Repository {
|
|
9
|
+
/**
|
|
10
|
+
* A list of refs for the repository.
|
|
11
|
+
*
|
|
12
|
+
* @see {@link Ref}
|
|
13
|
+
*/
|
|
14
|
+
refs: Ref[];
|
|
15
|
+
/**
|
|
16
|
+
* An identifier used to query content with the latest integration fields
|
|
17
|
+
* data.
|
|
18
|
+
*/
|
|
19
|
+
integrationFieldsRef: string | null;
|
|
20
|
+
/**
|
|
21
|
+
* A list of languages for the repository.
|
|
22
|
+
*
|
|
23
|
+
* @see {@link Language}
|
|
24
|
+
*/
|
|
25
|
+
languages: Language[];
|
|
26
|
+
/**
|
|
27
|
+
* A list of the repository's custom type API IDs mapped to their
|
|
28
|
+
* human-readable name.
|
|
29
|
+
*/
|
|
30
|
+
types: Record<string, string>;
|
|
31
|
+
/**
|
|
32
|
+
* @deprecated Tags are only available in the forms object.
|
|
33
|
+
*
|
|
34
|
+
* @see More details in the blog post "A change to how the Prismic API handles tags": {@link https://prismic.io/blog/a-change-to-how-the-prismic-api-handles-tags}
|
|
35
|
+
*/
|
|
36
|
+
tags: string[];
|
|
37
|
+
/**
|
|
38
|
+
* An internally-used list of REST API features for the repository.
|
|
39
|
+
*
|
|
40
|
+
* @internal
|
|
41
|
+
*/
|
|
42
|
+
forms: Record<string, Form>;
|
|
43
|
+
/**
|
|
44
|
+
* The URL used to begin the OAuth process for the repository.
|
|
45
|
+
*/
|
|
46
|
+
oauth_initiate: string;
|
|
47
|
+
/**
|
|
48
|
+
* The token used for the OAuth process for the repository.
|
|
49
|
+
*/
|
|
50
|
+
oauth_token: string;
|
|
51
|
+
/**
|
|
52
|
+
* The version of the API.
|
|
53
|
+
*/
|
|
54
|
+
version: string;
|
|
55
|
+
/**
|
|
56
|
+
* Licensing information for the repository content.
|
|
57
|
+
*/
|
|
58
|
+
license: string;
|
|
59
|
+
/**
|
|
60
|
+
* @deprecated Experiments are no longer part of Prismic.
|
|
61
|
+
*/
|
|
62
|
+
experiments: unknown;
|
|
63
|
+
/**
|
|
64
|
+
* @deprecated Bookmarks are not longer part of Prismic.
|
|
65
|
+
*/
|
|
66
|
+
bookmarks: Record<string, string>;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Metadata for a language that has been configured for a repository.
|
|
70
|
+
*/
|
|
71
|
+
export interface Language {
|
|
72
|
+
/**
|
|
73
|
+
* A unique identifier for the language.
|
|
74
|
+
*/
|
|
75
|
+
id: string;
|
|
76
|
+
/**
|
|
77
|
+
* The name of the language.
|
|
78
|
+
*/
|
|
79
|
+
name: string;
|
|
80
|
+
/**
|
|
81
|
+
* Whether or not the language is the default language of the repository.
|
|
82
|
+
*/
|
|
83
|
+
is_master: boolean;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* A Prismic REST API V2 feature supported by the repository. It contains
|
|
87
|
+
* metadata about the feature and how to interact with it via the API.
|
|
88
|
+
*
|
|
89
|
+
* @internal
|
|
90
|
+
*/
|
|
91
|
+
export interface Form {
|
|
92
|
+
method: "GET";
|
|
93
|
+
enctype: string;
|
|
94
|
+
action: string;
|
|
95
|
+
name?: string;
|
|
96
|
+
rel?: string;
|
|
97
|
+
fields: Record<string, FormField>;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* A field for a feature of the Prismic REST API V2. It contains metadata about
|
|
101
|
+
* the feature's field and how to interact with it via the API.
|
|
102
|
+
*
|
|
103
|
+
* @internal
|
|
104
|
+
*/
|
|
105
|
+
export interface FormField {
|
|
106
|
+
type: "String" | "Integer";
|
|
107
|
+
multiple: boolean;
|
|
108
|
+
default?: string;
|
|
109
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* List of tags returned from the Prismic Tags API. This data can be fetched by
|
|
3
|
+
* sending a `GET` request to a repository's `/api/tags` endpoint.
|
|
4
|
+
*
|
|
5
|
+
* @typeParam Tag - Tags that are returned by the Tags API.
|
|
6
|
+
*
|
|
7
|
+
* @see More details on the Tags API: {@link https://prismic.io/docs/tags-api-technical-reference}
|
|
8
|
+
*/
|
|
9
|
+
export type Tags<Tag extends string = string> = Tag[];
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
class PrismicMigrationAsset {
|
|
4
|
+
/**
|
|
5
|
+
* Asset object from Prismic, available once created.
|
|
6
|
+
*/
|
|
7
|
+
asset;
|
|
8
|
+
/**
|
|
9
|
+
* Configuration of the asset.
|
|
10
|
+
*/
|
|
11
|
+
config;
|
|
12
|
+
/**
|
|
13
|
+
* The initial field value this migration field was created with.
|
|
14
|
+
*/
|
|
15
|
+
originalField;
|
|
16
|
+
/**
|
|
17
|
+
* Creates a migration asset used with the Prismic Migration API.
|
|
18
|
+
*
|
|
19
|
+
* @param config - Configuration of the asset.
|
|
20
|
+
* @param initialField - The initial field value if any.
|
|
21
|
+
*
|
|
22
|
+
* @returns A migration asset instance.
|
|
23
|
+
*/
|
|
24
|
+
constructor(config, initialField) {
|
|
25
|
+
this.config = config;
|
|
26
|
+
this.originalField = initialField;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
exports.PrismicMigrationAsset = PrismicMigrationAsset;
|
|
30
|
+
//# sourceMappingURL=Asset.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Asset.cjs","sources":["../../../../src/types/migration/Asset.ts"],"sourcesContent":["import type { Asset } from \"../api/asset/asset\"\nimport type { FilledImageFieldImage } from \"../value/image\"\nimport type { LinkToMediaField } from \"../value/linkToMedia\"\nimport { type RTImageNode } from \"../value/richText\"\n\nimport type { InjectMigrationSpecificTypes } from \"./Document\"\n\n/**\n * An asset to be uploaded to Prismic media library.\n */\nexport type MigrationAssetConfig = {\n\t/**\n\t * ID the assets is indexed with on the migration instance.\n\t *\n\t * @remarks\n\t * This property's value is not necessarily the same as the as the one in the\n\t * `file` property. It is mainly used for deduplication within a `Migration`\n\t * instance.\n\t */\n\tid:\n\t\t| string\n\t\t| URL\n\t\t| File\n\t\t| NonNullable<ConstructorParameters<typeof File>[0]>[0]\n\n\t/**\n\t * File to be uploaded as an asset.\n\t */\n\tfile:\n\t\t| string\n\t\t| URL\n\t\t| File\n\t\t| NonNullable<ConstructorParameters<typeof File>[0]>[0]\n\n\t/**\n\t * Filename of the asset.\n\t */\n\tfilename: string\n\n\t/**\n\t * Notes about the asset. Notes are private and only visible in Prismic media\n\t * library.\n\t */\n\tnotes?: string\n\n\t/**\n\t * Credits and copyright for the asset if any.\n\t */\n\tcredits?: string\n\n\t/**\n\t * Alternate text for the asset.\n\t */\n\talt?: string\n\n\t/**\n\t * Tags associated with the asset.\n\t *\n\t * @remarks\n\t * Tags should be at least 3 characters long and 20 characters at most.\n\t */\n\ttags?: string[]\n}\n\n/**\n * An image field in a migration.\n */\nexport type MigrationImage =\n\t| PrismicMigrationAsset\n\t| ({\n\t\t\t/**\n\t\t\t * A reference to the migration asset used to resolve the image field's\n\t\t\t * value.\n\t\t\t */\n\t\t\tid: PrismicMigrationAsset\n\t } & Record<string, PrismicMigrationAsset>)\n\n/**\n * A link to media field in a migration.\n */\nexport type MigrationLinkToMedia = Pick<\n\tLinkToMediaField<\"filled\">,\n\t\"link_type\" | \"text\"\n> & {\n\t/**\n\t * A reference to the migration asset used to resolve the link to media\n\t * field's value.\n\t */\n\tid: PrismicMigrationAsset\n}\n\n/**\n * The minimum amount of information needed to represent a link to media field\n * with the migration API.\n */\nexport type MigrationLinkToMediaField =\n\t| Pick<LinkToMediaField<\"filled\">, \"link_type\" | \"id\" | \"text\">\n\t| LinkToMediaField<\"empty\">\n\n/**\n * A rich text image node in a migration.\n */\nexport type MigrationRTImageNode = InjectMigrationSpecificTypes<\n\tPick<RTImageNode, \"type\" | \"linkTo\">\n> & {\n\t/**\n\t * A reference to the migration asset used to resolve the rich text image\n\t * node's value.\n\t */\n\tid: PrismicMigrationAsset\n}\n\n/**\n * A migration asset used with the Prismic Migration API.\n */\nexport class PrismicMigrationAsset {\n\t/**\n\t * Asset object from Prismic, available once created.\n\t */\n\tasset?: Asset\n\n\t/**\n\t * Configuration of the asset.\n\t */\n\tconfig: MigrationAssetConfig\n\n\t/**\n\t * The initial field value this migration field was created with.\n\t */\n\toriginalField?:\n\t\t| FilledImageFieldImage\n\t\t| LinkToMediaField<\"filled\">\n\t\t| RTImageNode\n\n\t/**\n\t * Creates a migration asset used with the Prismic Migration API.\n\t *\n\t * @param config - Configuration of the asset.\n\t * @param initialField - The initial field value if any.\n\t *\n\t * @returns A migration asset instance.\n\t */\n\tconstructor(\n\t\tconfig: MigrationAssetConfig,\n\t\tinitialField?:\n\t\t\t| FilledImageFieldImage\n\t\t\t| LinkToMediaField<\"filled\">\n\t\t\t| RTImageNode,\n\t) {\n\t\tthis.config = config\n\t\tthis.originalField = initialField\n\t}\n}\n"],"names":[],"mappings":";;MAmHa,sBAAqB;AAAA;AAAA;AAAA;AAAA,EAIjC;AAAA;AAAA;AAAA;AAAA,EAKA;AAAA;AAAA;AAAA;AAAA,EAKA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAaA,YACC,QACA,cAGc;AAEd,SAAK,SAAS;AACd,SAAK,gBAAgB;AAAA,EACtB;AACA;;"}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import type { Asset } from "../api/asset/asset.js";
|
|
2
|
+
import type { FilledImageFieldImage } from "../value/image.js";
|
|
3
|
+
import type { LinkToMediaField } from "../value/linkToMedia.js";
|
|
4
|
+
import { type RTImageNode } from "../value/richText.js";
|
|
5
|
+
import type { InjectMigrationSpecificTypes } from "./Document.js";
|
|
6
|
+
/**
|
|
7
|
+
* An asset to be uploaded to Prismic media library.
|
|
8
|
+
*/
|
|
9
|
+
export type MigrationAssetConfig = {
|
|
10
|
+
/**
|
|
11
|
+
* ID the assets is indexed with on the migration instance.
|
|
12
|
+
*
|
|
13
|
+
* @remarks
|
|
14
|
+
* This property's value is not necessarily the same as the as the one in the
|
|
15
|
+
* `file` property. It is mainly used for deduplication within a `Migration`
|
|
16
|
+
* instance.
|
|
17
|
+
*/
|
|
18
|
+
id: string | URL | File | NonNullable<ConstructorParameters<typeof File>[0]>[0];
|
|
19
|
+
/**
|
|
20
|
+
* File to be uploaded as an asset.
|
|
21
|
+
*/
|
|
22
|
+
file: string | URL | File | NonNullable<ConstructorParameters<typeof File>[0]>[0];
|
|
23
|
+
/**
|
|
24
|
+
* Filename of the asset.
|
|
25
|
+
*/
|
|
26
|
+
filename: string;
|
|
27
|
+
/**
|
|
28
|
+
* Notes about the asset. Notes are private and only visible in Prismic media
|
|
29
|
+
* library.
|
|
30
|
+
*/
|
|
31
|
+
notes?: string;
|
|
32
|
+
/**
|
|
33
|
+
* Credits and copyright for the asset if any.
|
|
34
|
+
*/
|
|
35
|
+
credits?: string;
|
|
36
|
+
/**
|
|
37
|
+
* Alternate text for the asset.
|
|
38
|
+
*/
|
|
39
|
+
alt?: string;
|
|
40
|
+
/**
|
|
41
|
+
* Tags associated with the asset.
|
|
42
|
+
*
|
|
43
|
+
* @remarks
|
|
44
|
+
* Tags should be at least 3 characters long and 20 characters at most.
|
|
45
|
+
*/
|
|
46
|
+
tags?: string[];
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* An image field in a migration.
|
|
50
|
+
*/
|
|
51
|
+
export type MigrationImage = PrismicMigrationAsset | ({
|
|
52
|
+
/**
|
|
53
|
+
* A reference to the migration asset used to resolve the image field's
|
|
54
|
+
* value.
|
|
55
|
+
*/
|
|
56
|
+
id: PrismicMigrationAsset;
|
|
57
|
+
} & Record<string, PrismicMigrationAsset>);
|
|
58
|
+
/**
|
|
59
|
+
* A link to media field in a migration.
|
|
60
|
+
*/
|
|
61
|
+
export type MigrationLinkToMedia = Pick<LinkToMediaField<"filled">, "link_type" | "text"> & {
|
|
62
|
+
/**
|
|
63
|
+
* A reference to the migration asset used to resolve the link to media
|
|
64
|
+
* field's value.
|
|
65
|
+
*/
|
|
66
|
+
id: PrismicMigrationAsset;
|
|
67
|
+
};
|
|
68
|
+
/**
|
|
69
|
+
* The minimum amount of information needed to represent a link to media field
|
|
70
|
+
* with the migration API.
|
|
71
|
+
*/
|
|
72
|
+
export type MigrationLinkToMediaField = Pick<LinkToMediaField<"filled">, "link_type" | "id" | "text"> | LinkToMediaField<"empty">;
|
|
73
|
+
/**
|
|
74
|
+
* A rich text image node in a migration.
|
|
75
|
+
*/
|
|
76
|
+
export type MigrationRTImageNode = InjectMigrationSpecificTypes<Pick<RTImageNode, "type" | "linkTo">> & {
|
|
77
|
+
/**
|
|
78
|
+
* A reference to the migration asset used to resolve the rich text image
|
|
79
|
+
* node's value.
|
|
80
|
+
*/
|
|
81
|
+
id: PrismicMigrationAsset;
|
|
82
|
+
};
|
|
83
|
+
/**
|
|
84
|
+
* A migration asset used with the Prismic Migration API.
|
|
85
|
+
*/
|
|
86
|
+
export declare class PrismicMigrationAsset {
|
|
87
|
+
/**
|
|
88
|
+
* Asset object from Prismic, available once created.
|
|
89
|
+
*/
|
|
90
|
+
asset?: Asset;
|
|
91
|
+
/**
|
|
92
|
+
* Configuration of the asset.
|
|
93
|
+
*/
|
|
94
|
+
config: MigrationAssetConfig;
|
|
95
|
+
/**
|
|
96
|
+
* The initial field value this migration field was created with.
|
|
97
|
+
*/
|
|
98
|
+
originalField?: FilledImageFieldImage | LinkToMediaField<"filled"> | RTImageNode;
|
|
99
|
+
/**
|
|
100
|
+
* Creates a migration asset used with the Prismic Migration API.
|
|
101
|
+
*
|
|
102
|
+
* @param config - Configuration of the asset.
|
|
103
|
+
* @param initialField - The initial field value if any.
|
|
104
|
+
*
|
|
105
|
+
* @returns A migration asset instance.
|
|
106
|
+
*/
|
|
107
|
+
constructor(config: MigrationAssetConfig, initialField?: FilledImageFieldImage | LinkToMediaField<"filled"> | RTImageNode);
|
|
108
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
class PrismicMigrationAsset {
|
|
2
|
+
/**
|
|
3
|
+
* Asset object from Prismic, available once created.
|
|
4
|
+
*/
|
|
5
|
+
asset;
|
|
6
|
+
/**
|
|
7
|
+
* Configuration of the asset.
|
|
8
|
+
*/
|
|
9
|
+
config;
|
|
10
|
+
/**
|
|
11
|
+
* The initial field value this migration field was created with.
|
|
12
|
+
*/
|
|
13
|
+
originalField;
|
|
14
|
+
/**
|
|
15
|
+
* Creates a migration asset used with the Prismic Migration API.
|
|
16
|
+
*
|
|
17
|
+
* @param config - Configuration of the asset.
|
|
18
|
+
* @param initialField - The initial field value if any.
|
|
19
|
+
*
|
|
20
|
+
* @returns A migration asset instance.
|
|
21
|
+
*/
|
|
22
|
+
constructor(config, initialField) {
|
|
23
|
+
this.config = config;
|
|
24
|
+
this.originalField = initialField;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
export {
|
|
28
|
+
PrismicMigrationAsset
|
|
29
|
+
};
|
|
30
|
+
//# sourceMappingURL=Asset.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Asset.js","sources":["../../../../src/types/migration/Asset.ts"],"sourcesContent":["import type { Asset } from \"../api/asset/asset\"\nimport type { FilledImageFieldImage } from \"../value/image\"\nimport type { LinkToMediaField } from \"../value/linkToMedia\"\nimport { type RTImageNode } from \"../value/richText\"\n\nimport type { InjectMigrationSpecificTypes } from \"./Document\"\n\n/**\n * An asset to be uploaded to Prismic media library.\n */\nexport type MigrationAssetConfig = {\n\t/**\n\t * ID the assets is indexed with on the migration instance.\n\t *\n\t * @remarks\n\t * This property's value is not necessarily the same as the as the one in the\n\t * `file` property. It is mainly used for deduplication within a `Migration`\n\t * instance.\n\t */\n\tid:\n\t\t| string\n\t\t| URL\n\t\t| File\n\t\t| NonNullable<ConstructorParameters<typeof File>[0]>[0]\n\n\t/**\n\t * File to be uploaded as an asset.\n\t */\n\tfile:\n\t\t| string\n\t\t| URL\n\t\t| File\n\t\t| NonNullable<ConstructorParameters<typeof File>[0]>[0]\n\n\t/**\n\t * Filename of the asset.\n\t */\n\tfilename: string\n\n\t/**\n\t * Notes about the asset. Notes are private and only visible in Prismic media\n\t * library.\n\t */\n\tnotes?: string\n\n\t/**\n\t * Credits and copyright for the asset if any.\n\t */\n\tcredits?: string\n\n\t/**\n\t * Alternate text for the asset.\n\t */\n\talt?: string\n\n\t/**\n\t * Tags associated with the asset.\n\t *\n\t * @remarks\n\t * Tags should be at least 3 characters long and 20 characters at most.\n\t */\n\ttags?: string[]\n}\n\n/**\n * An image field in a migration.\n */\nexport type MigrationImage =\n\t| PrismicMigrationAsset\n\t| ({\n\t\t\t/**\n\t\t\t * A reference to the migration asset used to resolve the image field's\n\t\t\t * value.\n\t\t\t */\n\t\t\tid: PrismicMigrationAsset\n\t } & Record<string, PrismicMigrationAsset>)\n\n/**\n * A link to media field in a migration.\n */\nexport type MigrationLinkToMedia = Pick<\n\tLinkToMediaField<\"filled\">,\n\t\"link_type\" | \"text\"\n> & {\n\t/**\n\t * A reference to the migration asset used to resolve the link to media\n\t * field's value.\n\t */\n\tid: PrismicMigrationAsset\n}\n\n/**\n * The minimum amount of information needed to represent a link to media field\n * with the migration API.\n */\nexport type MigrationLinkToMediaField =\n\t| Pick<LinkToMediaField<\"filled\">, \"link_type\" | \"id\" | \"text\">\n\t| LinkToMediaField<\"empty\">\n\n/**\n * A rich text image node in a migration.\n */\nexport type MigrationRTImageNode = InjectMigrationSpecificTypes<\n\tPick<RTImageNode, \"type\" | \"linkTo\">\n> & {\n\t/**\n\t * A reference to the migration asset used to resolve the rich text image\n\t * node's value.\n\t */\n\tid: PrismicMigrationAsset\n}\n\n/**\n * A migration asset used with the Prismic Migration API.\n */\nexport class PrismicMigrationAsset {\n\t/**\n\t * Asset object from Prismic, available once created.\n\t */\n\tasset?: Asset\n\n\t/**\n\t * Configuration of the asset.\n\t */\n\tconfig: MigrationAssetConfig\n\n\t/**\n\t * The initial field value this migration field was created with.\n\t */\n\toriginalField?:\n\t\t| FilledImageFieldImage\n\t\t| LinkToMediaField<\"filled\">\n\t\t| RTImageNode\n\n\t/**\n\t * Creates a migration asset used with the Prismic Migration API.\n\t *\n\t * @param config - Configuration of the asset.\n\t * @param initialField - The initial field value if any.\n\t *\n\t * @returns A migration asset instance.\n\t */\n\tconstructor(\n\t\tconfig: MigrationAssetConfig,\n\t\tinitialField?:\n\t\t\t| FilledImageFieldImage\n\t\t\t| LinkToMediaField<\"filled\">\n\t\t\t| RTImageNode,\n\t) {\n\t\tthis.config = config\n\t\tthis.originalField = initialField\n\t}\n}\n"],"names":[],"mappings":"MAmHa,sBAAqB;AAAA;AAAA;AAAA;AAAA,EAIjC;AAAA;AAAA;AAAA;AAAA,EAKA;AAAA;AAAA;AAAA;AAAA,EAKA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAaA,YACC,QACA,cAGc;AAEd,SAAK,SAAS;AACd,SAAK,gBAAgB;AAAA,EACtB;AACA;"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ContentRelationshipField, EmptyContentRelationshipField, FilledContentRelationshipField } from "../value/contentRelationship.js";
|
|
2
|
+
import type { PrismicDocument } from "../value/document.js";
|
|
3
|
+
import type { PrismicMigrationDocument } from "./Document.js";
|
|
4
|
+
type ValueOrThunk<T> = T | (() => Promise<T> | T);
|
|
5
|
+
/**
|
|
6
|
+
* A content relationship field in a migration.
|
|
7
|
+
*/
|
|
8
|
+
export type MigrationContentRelationship<TDocuments extends PrismicDocument = PrismicDocument> = ValueOrThunk<TDocuments | PrismicMigrationDocument<TDocuments> | undefined> | (Pick<ContentRelationshipField, "link_type"> & {
|
|
9
|
+
id: ValueOrThunk<TDocuments | PrismicMigrationDocument<TDocuments> | undefined>;
|
|
10
|
+
});
|
|
11
|
+
/**
|
|
12
|
+
* The minimum amount of information needed to represent a content relationship
|
|
13
|
+
* field with the migration API.
|
|
14
|
+
*/
|
|
15
|
+
export type MigrationContentRelationshipField = Pick<FilledContentRelationshipField, "link_type" | "id"> | EmptyContentRelationshipField;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
class PrismicMigrationDocument {
|
|
4
|
+
/**
|
|
5
|
+
* The document to be sent to the Migration API.
|
|
6
|
+
*/
|
|
7
|
+
document;
|
|
8
|
+
/**
|
|
9
|
+
* The name of the document displayed in the editor.
|
|
10
|
+
*/
|
|
11
|
+
title;
|
|
12
|
+
/**
|
|
13
|
+
* The link to the master language document to relate the document to if any.
|
|
14
|
+
*/
|
|
15
|
+
masterLanguageDocument;
|
|
16
|
+
/**
|
|
17
|
+
* Original Prismic document when the migration document came from another
|
|
18
|
+
* Prismic repository.
|
|
19
|
+
*
|
|
20
|
+
* @remarks
|
|
21
|
+
* When migrating a document from another repository, one might want to alter
|
|
22
|
+
* it with migration specific types, hence accepting an
|
|
23
|
+
* `ExistingPrismicDocument` instead of a regular `PrismicDocument`.
|
|
24
|
+
*/
|
|
25
|
+
originalPrismicDocument;
|
|
26
|
+
/**
|
|
27
|
+
* Creates a Prismic migration document instance.
|
|
28
|
+
*
|
|
29
|
+
* @param document - The document to be sent to the Migration API.
|
|
30
|
+
* @param title - The name of the document displayed in the editor.
|
|
31
|
+
* @param params - Parameters to create/update the document with on the
|
|
32
|
+
* Migration API.
|
|
33
|
+
*
|
|
34
|
+
* @returns A Prismic migration document instance.
|
|
35
|
+
*/
|
|
36
|
+
constructor(document, title, params) {
|
|
37
|
+
this.document = document;
|
|
38
|
+
this.title = title;
|
|
39
|
+
this.masterLanguageDocument = params?.masterLanguageDocument;
|
|
40
|
+
this.originalPrismicDocument = params?.originalPrismicDocument;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
exports.PrismicMigrationDocument = PrismicMigrationDocument;
|
|
44
|
+
//# sourceMappingURL=Document.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Document.cjs","sources":["../../../../src/types/migration/Document.ts"],"sourcesContent":["import type { FilledContentRelationshipField } from \"../value/contentRelationship\"\nimport type { PrismicDocument, PrismicDocumentWithUID } from \"../value/document\"\nimport type { AnyOEmbed, EmbedField, OEmbedExtra } from \"../value/embed\"\nimport type { FilledImageFieldImage } from \"../value/image\"\nimport type { FilledLinkToMediaField } from \"../value/linkToMedia\"\nimport type { RTImageNode } from \"../value/richText\"\nimport type { SharedSlice } from \"../value/sharedSlice\"\n\nimport type {\n\tMigrationImage,\n\tMigrationLinkToMedia,\n\tMigrationRTImageNode,\n} from \"./Asset\"\nimport type { MigrationContentRelationship } from \"./ContentRelationship\"\n\n/**\n * A utility type that extends any fields in a record with their migration\n * fields equivalent.\n *\n * @typeParam T - Type of the record to extend.\n */\nexport type InjectMigrationSpecificTypes<T> = T extends RTImageNode\n\t?\n\t\t\t| T\n\t\t\t| (Omit<T, \"linkTo\"> & InjectMigrationSpecificTypes<Pick<T, \"linkTo\">>)\n\t\t\t| MigrationRTImageNode\n\t\t\t| undefined\n\t: T extends FilledImageFieldImage\n\t\t? T | MigrationImage | undefined\n\t\t: T extends FilledLinkToMediaField\n\t\t\t? T | MigrationLinkToMedia | undefined\n\t\t\t: T extends FilledContentRelationshipField\n\t\t\t\t? T | MigrationContentRelationship\n\t\t\t\t: T extends EmbedField<AnyOEmbed & OEmbedExtra, \"filled\">\n\t\t\t\t\t? T | Pick<T, \"embed_url\">\n\t\t\t\t\t: T extends SharedSlice\n\t\t\t\t\t\t?\n\t\t\t\t\t\t\t\t| T\n\t\t\t\t\t\t\t\t| InjectMigrationSpecificTypes<\n\t\t\t\t\t\t\t\t\t\tOmit<T, \"id\" | \"slice_label\" | \"version\">\n\t\t\t\t\t\t\t\t >\n\t\t\t\t\t\t: // eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\t\t\t\t\t\tT extends Record<any, any>\n\t\t\t\t\t\t\t? { [P in keyof T]: InjectMigrationSpecificTypes<T[P]> }\n\t\t\t\t\t\t\t: T extends Array<infer U>\n\t\t\t\t\t\t\t\t? Array<InjectMigrationSpecificTypes<U>>\n\t\t\t\t\t\t\t\t: T\n\n/**\n * A utility type that ties the type and data of a Prismic document, creating a\n * strict union.\n */\ntype TiedDocumentTypeAndData<TDocument extends PrismicDocument> =\n\tTDocument extends PrismicDocument<infer TData, infer TType>\n\t\t? {\n\t\t\t\t/**\n\t\t\t\t * Type of the document.\n\t\t\t\t */\n\t\t\t\ttype: TType\n\n\t\t\t\t/**\n\t\t\t\t * Data contained in the document.\n\t\t\t\t */\n\t\t\t\tdata: InjectMigrationSpecificTypes<TData>\n\t\t\t} & (TDocument extends PrismicDocumentWithUID\n\t\t\t\t? Pick<TDocument, \"uid\">\n\t\t\t\t: Partial<Pick<TDocument, \"uid\">>)\n\t\t: never\n\n/**\n * A pending Prismic document to be created with the Migration API.\n *\n * @typeParam TDocument - Type of the Prismic document.\n */\nexport type PendingPrismicDocument<\n\tTDocument extends PrismicDocument = PrismicDocument,\n> = Pick<TDocument, \"lang\"> &\n\tPartial<Pick<TDocument, \"tags\">> &\n\tTiedDocumentTypeAndData<TDocument>\n\n/**\n * An existing Prismic document to be updated with the Migration API.\n *\n * @typeParam TDocument - Type of the Prismic document.\n */\nexport type ExistingPrismicDocument<\n\tTDocument extends PrismicDocument = PrismicDocument,\n> = Omit<TDocument, \"uid\" | \"type\" | \"data\"> &\n\tTiedDocumentTypeAndData<TDocument>\n\n/**\n * A Prismic document to be sent to the Migration API.\n *\n * @typeParam TDocument - Type of the Prismic document.\n */\nexport type MigrationDocument<\n\tTDocument extends PrismicDocument = PrismicDocument,\n> = PendingPrismicDocument<TDocument> | ExistingPrismicDocument<TDocument>\n\n/**\n * A Prismic migration document instance.\n *\n * @typeParam TDocument - Type of the Prismic document.\n */\nexport class PrismicMigrationDocument<\n\tTDocument extends PrismicDocument = PrismicDocument,\n> {\n\t/**\n\t * The document to be sent to the Migration API.\n\t */\n\tdocument: MigrationDocument<TDocument> & Partial<Pick<TDocument, \"id\">>\n\n\t/**\n\t * The name of the document displayed in the editor.\n\t */\n\ttitle?: string\n\n\t/**\n\t * The link to the master language document to relate the document to if any.\n\t */\n\tmasterLanguageDocument?: MigrationContentRelationship\n\n\t/**\n\t * Original Prismic document when the migration document came from another\n\t * Prismic repository.\n\t *\n\t * @remarks\n\t * When migrating a document from another repository, one might want to alter\n\t * it with migration specific types, hence accepting an\n\t * `ExistingPrismicDocument` instead of a regular `PrismicDocument`.\n\t */\n\toriginalPrismicDocument?: ExistingPrismicDocument<PrismicDocument>\n\n\t/**\n\t * Creates a Prismic migration document instance.\n\t *\n\t * @param document - The document to be sent to the Migration API.\n\t * @param title - The name of the document displayed in the editor.\n\t * @param params - Parameters to create/update the document with on the\n\t * Migration API.\n\t *\n\t * @returns A Prismic migration document instance.\n\t */\n\tconstructor(\n\t\tdocument: MigrationDocument<TDocument>,\n\t\ttitle?: string,\n\t\tparams?: {\n\t\t\tmasterLanguageDocument?: MigrationContentRelationship\n\t\t\toriginalPrismicDocument?: ExistingPrismicDocument<PrismicDocument>\n\t\t},\n\t) {\n\t\tthis.document = document\n\t\tthis.title = title\n\t\tthis.masterLanguageDocument = params?.masterLanguageDocument\n\t\tthis.originalPrismicDocument = params?.originalPrismicDocument\n\t}\n}\n"],"names":[],"mappings":";;MAwGa,yBAAwB;AAAA;AAAA;AAAA;AAAA,EAMpC;AAAA;AAAA;AAAA;AAAA,EAKA;AAAA;AAAA;AAAA;AAAA,EAKA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAWA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAYA,YACC,UACA,OACA,QAGC;AAED,SAAK,WAAW;AAChB,SAAK,QAAQ;AACb,SAAK,yBAAyB,QAAQ;AACtC,SAAK,0BAA0B,QAAQ;AAAA,EACxC;AACA;;"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import type { FilledContentRelationshipField } from "../value/contentRelationship.js";
|
|
2
|
+
import type { PrismicDocument, PrismicDocumentWithUID } from "../value/document.js";
|
|
3
|
+
import type { AnyOEmbed, EmbedField, OEmbedExtra } from "../value/embed.js";
|
|
4
|
+
import type { FilledImageFieldImage } from "../value/image.js";
|
|
5
|
+
import type { FilledLinkToMediaField } from "../value/linkToMedia.js";
|
|
6
|
+
import type { RTImageNode } from "../value/richText.js";
|
|
7
|
+
import type { SharedSlice } from "../value/sharedSlice.js";
|
|
8
|
+
import type { MigrationImage, MigrationLinkToMedia, MigrationRTImageNode } from "./Asset.js";
|
|
9
|
+
import type { MigrationContentRelationship } from "./ContentRelationship.js";
|
|
10
|
+
/**
|
|
11
|
+
* A utility type that extends any fields in a record with their migration
|
|
12
|
+
* fields equivalent.
|
|
13
|
+
*
|
|
14
|
+
* @typeParam T - Type of the record to extend.
|
|
15
|
+
*/
|
|
16
|
+
export type InjectMigrationSpecificTypes<T> = T extends RTImageNode ? T | (Omit<T, "linkTo"> & InjectMigrationSpecificTypes<Pick<T, "linkTo">>) | MigrationRTImageNode | undefined : T extends FilledImageFieldImage ? T | MigrationImage | undefined : T extends FilledLinkToMediaField ? T | MigrationLinkToMedia | undefined : T extends FilledContentRelationshipField ? T | MigrationContentRelationship : T extends EmbedField<AnyOEmbed & OEmbedExtra, "filled"> ? T | Pick<T, "embed_url"> : T extends SharedSlice ? T | InjectMigrationSpecificTypes<Omit<T, "id" | "slice_label" | "version">> : T extends Record<any, any> ? {
|
|
17
|
+
[P in keyof T]: InjectMigrationSpecificTypes<T[P]>;
|
|
18
|
+
} : T extends Array<infer U> ? Array<InjectMigrationSpecificTypes<U>> : T;
|
|
19
|
+
/**
|
|
20
|
+
* A utility type that ties the type and data of a Prismic document, creating a
|
|
21
|
+
* strict union.
|
|
22
|
+
*/
|
|
23
|
+
type TiedDocumentTypeAndData<TDocument extends PrismicDocument> = TDocument extends PrismicDocument<infer TData, infer TType> ? {
|
|
24
|
+
/**
|
|
25
|
+
* Type of the document.
|
|
26
|
+
*/
|
|
27
|
+
type: TType;
|
|
28
|
+
/**
|
|
29
|
+
* Data contained in the document.
|
|
30
|
+
*/
|
|
31
|
+
data: InjectMigrationSpecificTypes<TData>;
|
|
32
|
+
} & (TDocument extends PrismicDocumentWithUID ? Pick<TDocument, "uid"> : Partial<Pick<TDocument, "uid">>) : never;
|
|
33
|
+
/**
|
|
34
|
+
* A pending Prismic document to be created with the Migration API.
|
|
35
|
+
*
|
|
36
|
+
* @typeParam TDocument - Type of the Prismic document.
|
|
37
|
+
*/
|
|
38
|
+
export type PendingPrismicDocument<TDocument extends PrismicDocument = PrismicDocument> = Pick<TDocument, "lang"> & Partial<Pick<TDocument, "tags">> & TiedDocumentTypeAndData<TDocument>;
|
|
39
|
+
/**
|
|
40
|
+
* An existing Prismic document to be updated with the Migration API.
|
|
41
|
+
*
|
|
42
|
+
* @typeParam TDocument - Type of the Prismic document.
|
|
43
|
+
*/
|
|
44
|
+
export type ExistingPrismicDocument<TDocument extends PrismicDocument = PrismicDocument> = Omit<TDocument, "uid" | "type" | "data"> & TiedDocumentTypeAndData<TDocument>;
|
|
45
|
+
/**
|
|
46
|
+
* A Prismic document to be sent to the Migration API.
|
|
47
|
+
*
|
|
48
|
+
* @typeParam TDocument - Type of the Prismic document.
|
|
49
|
+
*/
|
|
50
|
+
export type MigrationDocument<TDocument extends PrismicDocument = PrismicDocument> = PendingPrismicDocument<TDocument> | ExistingPrismicDocument<TDocument>;
|
|
51
|
+
/**
|
|
52
|
+
* A Prismic migration document instance.
|
|
53
|
+
*
|
|
54
|
+
* @typeParam TDocument - Type of the Prismic document.
|
|
55
|
+
*/
|
|
56
|
+
export declare class PrismicMigrationDocument<TDocument extends PrismicDocument = PrismicDocument> {
|
|
57
|
+
/**
|
|
58
|
+
* The document to be sent to the Migration API.
|
|
59
|
+
*/
|
|
60
|
+
document: MigrationDocument<TDocument> & Partial<Pick<TDocument, "id">>;
|
|
61
|
+
/**
|
|
62
|
+
* The name of the document displayed in the editor.
|
|
63
|
+
*/
|
|
64
|
+
title?: string;
|
|
65
|
+
/**
|
|
66
|
+
* The link to the master language document to relate the document to if any.
|
|
67
|
+
*/
|
|
68
|
+
masterLanguageDocument?: MigrationContentRelationship;
|
|
69
|
+
/**
|
|
70
|
+
* Original Prismic document when the migration document came from another
|
|
71
|
+
* Prismic repository.
|
|
72
|
+
*
|
|
73
|
+
* @remarks
|
|
74
|
+
* When migrating a document from another repository, one might want to alter
|
|
75
|
+
* it with migration specific types, hence accepting an
|
|
76
|
+
* `ExistingPrismicDocument` instead of a regular `PrismicDocument`.
|
|
77
|
+
*/
|
|
78
|
+
originalPrismicDocument?: ExistingPrismicDocument<PrismicDocument>;
|
|
79
|
+
/**
|
|
80
|
+
* Creates a Prismic migration document instance.
|
|
81
|
+
*
|
|
82
|
+
* @param document - The document to be sent to the Migration API.
|
|
83
|
+
* @param title - The name of the document displayed in the editor.
|
|
84
|
+
* @param params - Parameters to create/update the document with on the
|
|
85
|
+
* Migration API.
|
|
86
|
+
*
|
|
87
|
+
* @returns A Prismic migration document instance.
|
|
88
|
+
*/
|
|
89
|
+
constructor(document: MigrationDocument<TDocument>, title?: string, params?: {
|
|
90
|
+
masterLanguageDocument?: MigrationContentRelationship;
|
|
91
|
+
originalPrismicDocument?: ExistingPrismicDocument<PrismicDocument>;
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
export {};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
class PrismicMigrationDocument {
|
|
2
|
+
/**
|
|
3
|
+
* The document to be sent to the Migration API.
|
|
4
|
+
*/
|
|
5
|
+
document;
|
|
6
|
+
/**
|
|
7
|
+
* The name of the document displayed in the editor.
|
|
8
|
+
*/
|
|
9
|
+
title;
|
|
10
|
+
/**
|
|
11
|
+
* The link to the master language document to relate the document to if any.
|
|
12
|
+
*/
|
|
13
|
+
masterLanguageDocument;
|
|
14
|
+
/**
|
|
15
|
+
* Original Prismic document when the migration document came from another
|
|
16
|
+
* Prismic repository.
|
|
17
|
+
*
|
|
18
|
+
* @remarks
|
|
19
|
+
* When migrating a document from another repository, one might want to alter
|
|
20
|
+
* it with migration specific types, hence accepting an
|
|
21
|
+
* `ExistingPrismicDocument` instead of a regular `PrismicDocument`.
|
|
22
|
+
*/
|
|
23
|
+
originalPrismicDocument;
|
|
24
|
+
/**
|
|
25
|
+
* Creates a Prismic migration document instance.
|
|
26
|
+
*
|
|
27
|
+
* @param document - The document to be sent to the Migration API.
|
|
28
|
+
* @param title - The name of the document displayed in the editor.
|
|
29
|
+
* @param params - Parameters to create/update the document with on the
|
|
30
|
+
* Migration API.
|
|
31
|
+
*
|
|
32
|
+
* @returns A Prismic migration document instance.
|
|
33
|
+
*/
|
|
34
|
+
constructor(document, title, params) {
|
|
35
|
+
this.document = document;
|
|
36
|
+
this.title = title;
|
|
37
|
+
this.masterLanguageDocument = params?.masterLanguageDocument;
|
|
38
|
+
this.originalPrismicDocument = params?.originalPrismicDocument;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
export {
|
|
42
|
+
PrismicMigrationDocument
|
|
43
|
+
};
|
|
44
|
+
//# sourceMappingURL=Document.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Document.js","sources":["../../../../src/types/migration/Document.ts"],"sourcesContent":["import type { FilledContentRelationshipField } from \"../value/contentRelationship\"\nimport type { PrismicDocument, PrismicDocumentWithUID } from \"../value/document\"\nimport type { AnyOEmbed, EmbedField, OEmbedExtra } from \"../value/embed\"\nimport type { FilledImageFieldImage } from \"../value/image\"\nimport type { FilledLinkToMediaField } from \"../value/linkToMedia\"\nimport type { RTImageNode } from \"../value/richText\"\nimport type { SharedSlice } from \"../value/sharedSlice\"\n\nimport type {\n\tMigrationImage,\n\tMigrationLinkToMedia,\n\tMigrationRTImageNode,\n} from \"./Asset\"\nimport type { MigrationContentRelationship } from \"./ContentRelationship\"\n\n/**\n * A utility type that extends any fields in a record with their migration\n * fields equivalent.\n *\n * @typeParam T - Type of the record to extend.\n */\nexport type InjectMigrationSpecificTypes<T> = T extends RTImageNode\n\t?\n\t\t\t| T\n\t\t\t| (Omit<T, \"linkTo\"> & InjectMigrationSpecificTypes<Pick<T, \"linkTo\">>)\n\t\t\t| MigrationRTImageNode\n\t\t\t| undefined\n\t: T extends FilledImageFieldImage\n\t\t? T | MigrationImage | undefined\n\t\t: T extends FilledLinkToMediaField\n\t\t\t? T | MigrationLinkToMedia | undefined\n\t\t\t: T extends FilledContentRelationshipField\n\t\t\t\t? T | MigrationContentRelationship\n\t\t\t\t: T extends EmbedField<AnyOEmbed & OEmbedExtra, \"filled\">\n\t\t\t\t\t? T | Pick<T, \"embed_url\">\n\t\t\t\t\t: T extends SharedSlice\n\t\t\t\t\t\t?\n\t\t\t\t\t\t\t\t| T\n\t\t\t\t\t\t\t\t| InjectMigrationSpecificTypes<\n\t\t\t\t\t\t\t\t\t\tOmit<T, \"id\" | \"slice_label\" | \"version\">\n\t\t\t\t\t\t\t\t >\n\t\t\t\t\t\t: // eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\t\t\t\t\t\tT extends Record<any, any>\n\t\t\t\t\t\t\t? { [P in keyof T]: InjectMigrationSpecificTypes<T[P]> }\n\t\t\t\t\t\t\t: T extends Array<infer U>\n\t\t\t\t\t\t\t\t? Array<InjectMigrationSpecificTypes<U>>\n\t\t\t\t\t\t\t\t: T\n\n/**\n * A utility type that ties the type and data of a Prismic document, creating a\n * strict union.\n */\ntype TiedDocumentTypeAndData<TDocument extends PrismicDocument> =\n\tTDocument extends PrismicDocument<infer TData, infer TType>\n\t\t? {\n\t\t\t\t/**\n\t\t\t\t * Type of the document.\n\t\t\t\t */\n\t\t\t\ttype: TType\n\n\t\t\t\t/**\n\t\t\t\t * Data contained in the document.\n\t\t\t\t */\n\t\t\t\tdata: InjectMigrationSpecificTypes<TData>\n\t\t\t} & (TDocument extends PrismicDocumentWithUID\n\t\t\t\t? Pick<TDocument, \"uid\">\n\t\t\t\t: Partial<Pick<TDocument, \"uid\">>)\n\t\t: never\n\n/**\n * A pending Prismic document to be created with the Migration API.\n *\n * @typeParam TDocument - Type of the Prismic document.\n */\nexport type PendingPrismicDocument<\n\tTDocument extends PrismicDocument = PrismicDocument,\n> = Pick<TDocument, \"lang\"> &\n\tPartial<Pick<TDocument, \"tags\">> &\n\tTiedDocumentTypeAndData<TDocument>\n\n/**\n * An existing Prismic document to be updated with the Migration API.\n *\n * @typeParam TDocument - Type of the Prismic document.\n */\nexport type ExistingPrismicDocument<\n\tTDocument extends PrismicDocument = PrismicDocument,\n> = Omit<TDocument, \"uid\" | \"type\" | \"data\"> &\n\tTiedDocumentTypeAndData<TDocument>\n\n/**\n * A Prismic document to be sent to the Migration API.\n *\n * @typeParam TDocument - Type of the Prismic document.\n */\nexport type MigrationDocument<\n\tTDocument extends PrismicDocument = PrismicDocument,\n> = PendingPrismicDocument<TDocument> | ExistingPrismicDocument<TDocument>\n\n/**\n * A Prismic migration document instance.\n *\n * @typeParam TDocument - Type of the Prismic document.\n */\nexport class PrismicMigrationDocument<\n\tTDocument extends PrismicDocument = PrismicDocument,\n> {\n\t/**\n\t * The document to be sent to the Migration API.\n\t */\n\tdocument: MigrationDocument<TDocument> & Partial<Pick<TDocument, \"id\">>\n\n\t/**\n\t * The name of the document displayed in the editor.\n\t */\n\ttitle?: string\n\n\t/**\n\t * The link to the master language document to relate the document to if any.\n\t */\n\tmasterLanguageDocument?: MigrationContentRelationship\n\n\t/**\n\t * Original Prismic document when the migration document came from another\n\t * Prismic repository.\n\t *\n\t * @remarks\n\t * When migrating a document from another repository, one might want to alter\n\t * it with migration specific types, hence accepting an\n\t * `ExistingPrismicDocument` instead of a regular `PrismicDocument`.\n\t */\n\toriginalPrismicDocument?: ExistingPrismicDocument<PrismicDocument>\n\n\t/**\n\t * Creates a Prismic migration document instance.\n\t *\n\t * @param document - The document to be sent to the Migration API.\n\t * @param title - The name of the document displayed in the editor.\n\t * @param params - Parameters to create/update the document with on the\n\t * Migration API.\n\t *\n\t * @returns A Prismic migration document instance.\n\t */\n\tconstructor(\n\t\tdocument: MigrationDocument<TDocument>,\n\t\ttitle?: string,\n\t\tparams?: {\n\t\t\tmasterLanguageDocument?: MigrationContentRelationship\n\t\t\toriginalPrismicDocument?: ExistingPrismicDocument<PrismicDocument>\n\t\t},\n\t) {\n\t\tthis.document = document\n\t\tthis.title = title\n\t\tthis.masterLanguageDocument = params?.masterLanguageDocument\n\t\tthis.originalPrismicDocument = params?.originalPrismicDocument\n\t}\n}\n"],"names":[],"mappings":"MAwGa,yBAAwB;AAAA;AAAA;AAAA;AAAA,EAMpC;AAAA;AAAA;AAAA;AAAA,EAKA;AAAA;AAAA;AAAA;AAAA,EAKA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAWA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAYA,YACC,UACA,OACA,QAGC;AAED,SAAK,WAAW;AAChB,SAAK,QAAQ;AACb,SAAK,yBAAyB,QAAQ;AACtC,SAAK,0BAA0B,QAAQ;AAAA,EACxC;AACA;"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { LinkType, OptionalLinkProperties } from "../value/link.js";
|
|
2
|
+
/**
|
|
3
|
+
* Adds `OptionalLinkProperties` to any type that looks like a link object (one
|
|
4
|
+
* that includes a valid `link_type` property).
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
*
|
|
8
|
+
* ```ts
|
|
9
|
+
* type Example = MaybeLink<PrismicDocument | LinkField>
|
|
10
|
+
* // PrismicDocument | (LinkField & OptionalLinkProperties)
|
|
11
|
+
* ```
|
|
12
|
+
*
|
|
13
|
+
* @typeParam T - The type to augment.
|
|
14
|
+
*/
|
|
15
|
+
export type MaybeLink<T> = Exclude<T, {
|
|
16
|
+
link_type: (typeof LinkType)[keyof typeof LinkType];
|
|
17
|
+
}> | (Extract<T, {
|
|
18
|
+
link_type: (typeof LinkType)[keyof typeof LinkType];
|
|
19
|
+
}> & OptionalLinkProperties);
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { CustomTypeModelFieldType } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* A boolean custom type field.
|
|
4
|
+
*
|
|
5
|
+
* More details: {@link https://prismic.io/docs/boolean}
|
|
6
|
+
*/
|
|
7
|
+
export interface CustomTypeModelBooleanField {
|
|
8
|
+
type: typeof CustomTypeModelFieldType.Boolean;
|
|
9
|
+
config?: {
|
|
10
|
+
label?: string | null;
|
|
11
|
+
default_value?: boolean;
|
|
12
|
+
placeholder_true?: string;
|
|
13
|
+
placeholder_false?: string;
|
|
14
|
+
};
|
|
15
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { CustomTypeModelFieldType } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* A color custom type field.
|
|
4
|
+
*
|
|
5
|
+
* More details: {@link https://prismic.io/docs/color}
|
|
6
|
+
*/
|
|
7
|
+
export interface CustomTypeModelColorField {
|
|
8
|
+
type: typeof CustomTypeModelFieldType.Color;
|
|
9
|
+
config?: {
|
|
10
|
+
label?: string | null;
|
|
11
|
+
placeholder?: string;
|
|
12
|
+
};
|
|
13
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { CustomTypeModelFieldType } from "./types.js";
|
|
2
|
+
import type { CustomTypeModelLinkSelectType } from "./link.js";
|
|
3
|
+
/**
|
|
4
|
+
* @internal
|
|
5
|
+
*/
|
|
6
|
+
export type CustomTypeModelFetchGroupLevel2 = {
|
|
7
|
+
id: string;
|
|
8
|
+
fields: ReadonlyArray<string>;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* @internal
|
|
12
|
+
*/
|
|
13
|
+
export type CustomTypeModelFetchCustomTypeLevel2 = {
|
|
14
|
+
id: string;
|
|
15
|
+
fields: ReadonlyArray<string | CustomTypeModelFetchGroupLevel2>;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* @internal
|
|
19
|
+
*/
|
|
20
|
+
export type CustomTypeModelFetchGroupLevel1 = {
|
|
21
|
+
id: string;
|
|
22
|
+
fields: ReadonlyArray<string | CustomTypeModelFetchContentRelationshipLevel1>;
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* @internal
|
|
26
|
+
*/
|
|
27
|
+
export type CustomTypeModelFetchContentRelationshipLevel1 = {
|
|
28
|
+
id: string;
|
|
29
|
+
customtypes: ReadonlyArray<string | CustomTypeModelFetchCustomTypeLevel2>;
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* @internal
|
|
33
|
+
*/
|
|
34
|
+
export type CustomTypeModelFetchCustomTypeLevel1 = {
|
|
35
|
+
id: string;
|
|
36
|
+
fields: ReadonlyArray<string | CustomTypeModelFetchGroupLevel1 | CustomTypeModelFetchContentRelationshipLevel1>;
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* A content relationship custom type field.
|
|
40
|
+
*
|
|
41
|
+
* More details: {@link https://prismic.io/docs/content-relationship}
|
|
42
|
+
*/
|
|
43
|
+
export interface CustomTypeModelContentRelationshipField<CustomTypes extends string | CustomTypeModelFetchCustomTypeLevel1 = string | CustomTypeModelFetchCustomTypeLevel1, Tags extends string = string> {
|
|
44
|
+
type: typeof CustomTypeModelFieldType.Link;
|
|
45
|
+
fieldset?: string | null;
|
|
46
|
+
config?: {
|
|
47
|
+
label?: string | null;
|
|
48
|
+
placeholder?: string;
|
|
49
|
+
select: typeof CustomTypeModelLinkSelectType.Document;
|
|
50
|
+
customtypes?: readonly CustomTypes[];
|
|
51
|
+
tags?: readonly Tags[];
|
|
52
|
+
};
|
|
53
|
+
}
|