@prismicio/client 7.21.0-alpha.1 → 7.21.0-pr.414.2f27ec1
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 +1212 -1268
- package/dist/Client.cjs.map +1 -1
- package/dist/Client.d.cts +976 -0
- package/dist/Client.d.cts.map +1 -0
- package/dist/Client.d.ts +921 -926
- package/dist/Client.d.ts.map +1 -0
- package/dist/Client.js +1188 -1244
- package/dist/Client.js.map +1 -1
- package/dist/Migration.cjs +281 -312
- package/dist/Migration.cjs.map +1 -1
- package/dist/Migration.d.cts +216 -0
- package/dist/Migration.d.cts.map +1 -0
- package/dist/Migration.d.ts +197 -194
- package/dist/Migration.d.ts.map +1 -0
- package/dist/Migration.js +280 -311
- package/dist/Migration.js.map +1 -1
- package/dist/WriteClient.cjs +486 -558
- package/dist/WriteClient.cjs.map +1 -1
- package/dist/WriteClient.d.cts +262 -0
- package/dist/WriteClient.d.cts.map +1 -0
- package/dist/WriteClient.d.ts +226 -245
- package/dist/WriteClient.d.ts.map +1 -0
- package/dist/WriteClient.js +480 -552
- package/dist/WriteClient.js.map +1 -1
- package/dist/_virtual/rolldown_runtime.cjs +14 -0
- package/dist/_virtual/rolldown_runtime.js +13 -0
- package/dist/buildQueryURL.cjs +89 -59
- package/dist/buildQueryURL.cjs.map +1 -1
- package/dist/buildQueryURL.d.cts +220 -0
- package/dist/buildQueryURL.d.cts.map +1 -0
- package/dist/buildQueryURL.d.ts +169 -158
- package/dist/buildQueryURL.d.ts.map +1 -0
- package/dist/buildQueryURL.js +88 -58
- package/dist/buildQueryURL.js.map +1 -1
- package/dist/cookie.cjs +17 -3
- package/dist/cookie.cjs.map +1 -1
- package/dist/cookie.d.cts +11 -0
- package/dist/cookie.d.cts.map +1 -0
- package/dist/cookie.d.ts +7 -1
- package/dist/cookie.d.ts.map +1 -0
- package/dist/cookie.js +12 -4
- package/dist/cookie.js.map +1 -1
- package/dist/createClient.cjs +32 -5
- package/dist/createClient.cjs.map +1 -1
- package/dist/createClient.d.cts +41 -0
- package/dist/createClient.d.cts.map +1 -0
- package/dist/createClient.d.ts +22 -13
- package/dist/createClient.d.ts.map +1 -0
- package/dist/createClient.js +31 -4
- package/dist/createClient.js.map +1 -1
- package/dist/createMigration.cjs +21 -5
- package/dist/createMigration.cjs.map +1 -1
- package/dist/createMigration.d.cts +30 -0
- package/dist/createMigration.d.cts.map +1 -0
- package/dist/createMigration.d.ts +11 -5
- package/dist/createMigration.d.ts.map +1 -0
- package/dist/createMigration.js +20 -4
- package/dist/createMigration.js.map +1 -1
- package/dist/createWriteClient.cjs +29 -5
- package/dist/createWriteClient.cjs.map +1 -1
- package/dist/createWriteClient.d.cts +38 -0
- package/dist/createWriteClient.d.cts.map +1 -0
- package/dist/createWriteClient.d.ts +11 -5
- package/dist/createWriteClient.d.ts.map +1 -0
- package/dist/createWriteClient.js +28 -4
- package/dist/createWriteClient.js.map +1 -1
- package/dist/errors/ForbiddenError.cjs +7 -6
- package/dist/errors/ForbiddenError.cjs.map +1 -1
- package/dist/errors/ForbiddenError.d.cts +14 -0
- package/dist/errors/ForbiddenError.d.cts.map +1 -0
- package/dist/errors/ForbiddenError.d.ts +10 -7
- package/dist/errors/ForbiddenError.d.ts.map +1 -0
- package/dist/errors/ForbiddenError.js +7 -6
- package/dist/errors/ForbiddenError.js.map +1 -1
- package/dist/errors/InvalidDataError.cjs +7 -6
- package/dist/errors/InvalidDataError.cjs.map +1 -1
- package/dist/errors/InvalidDataError.d.cts +7 -0
- package/dist/errors/InvalidDataError.d.cts.map +1 -0
- package/dist/errors/InvalidDataError.d.ts +7 -3
- package/dist/errors/InvalidDataError.d.ts.map +1 -0
- package/dist/errors/InvalidDataError.js +7 -6
- package/dist/errors/InvalidDataError.js.map +1 -1
- package/dist/errors/NotFoundError.cjs +7 -6
- package/dist/errors/NotFoundError.cjs.map +1 -1
- package/dist/errors/NotFoundError.d.cts +7 -0
- package/dist/errors/NotFoundError.d.cts.map +1 -0
- package/dist/errors/NotFoundError.d.ts +7 -3
- package/dist/errors/NotFoundError.d.ts.map +1 -0
- package/dist/errors/NotFoundError.js +7 -6
- package/dist/errors/NotFoundError.js.map +1 -1
- package/dist/errors/ParsingError.cjs +7 -6
- package/dist/errors/ParsingError.cjs.map +1 -1
- package/dist/errors/ParsingError.d.cts +17 -0
- package/dist/errors/ParsingError.d.cts.map +1 -0
- package/dist/errors/ParsingError.d.ts +15 -12
- package/dist/errors/ParsingError.d.ts.map +1 -0
- package/dist/errors/ParsingError.js +7 -6
- package/dist/errors/ParsingError.js.map +1 -1
- package/dist/errors/PreviewTokenExpired.cjs +7 -6
- package/dist/errors/PreviewTokenExpired.cjs.map +1 -1
- package/dist/errors/PreviewTokenExpired.d.cts +11 -0
- package/dist/errors/PreviewTokenExpired.d.cts.map +1 -0
- package/dist/errors/PreviewTokenExpired.d.ts +9 -6
- package/dist/errors/PreviewTokenExpired.d.ts.map +1 -0
- package/dist/errors/PreviewTokenExpired.js +7 -6
- package/dist/errors/PreviewTokenExpired.js.map +1 -1
- package/dist/errors/PrismicError.cjs +14 -15
- package/dist/errors/PrismicError.cjs.map +1 -1
- package/dist/errors/PrismicError.d.cts +9 -0
- package/dist/errors/PrismicError.d.cts.map +1 -0
- package/dist/errors/PrismicError.d.ts +8 -4
- package/dist/errors/PrismicError.d.ts.map +1 -0
- package/dist/errors/PrismicError.js +13 -15
- package/dist/errors/PrismicError.js.map +1 -1
- package/dist/errors/RefExpiredError.cjs +7 -6
- package/dist/errors/RefExpiredError.cjs.map +1 -1
- package/dist/errors/RefExpiredError.d.cts +11 -0
- package/dist/errors/RefExpiredError.d.cts.map +1 -0
- package/dist/errors/RefExpiredError.d.ts +9 -6
- package/dist/errors/RefExpiredError.d.ts.map +1 -0
- package/dist/errors/RefExpiredError.js +7 -6
- package/dist/errors/RefExpiredError.js.map +1 -1
- package/dist/errors/RefNotFoundError.cjs +7 -6
- package/dist/errors/RefNotFoundError.cjs.map +1 -1
- package/dist/errors/RefNotFoundError.d.cts +11 -0
- package/dist/errors/RefNotFoundError.d.cts.map +1 -0
- package/dist/errors/RefNotFoundError.d.ts +9 -6
- package/dist/errors/RefNotFoundError.d.ts.map +1 -0
- package/dist/errors/RefNotFoundError.js +7 -6
- package/dist/errors/RefNotFoundError.js.map +1 -1
- package/dist/errors/RepositoryNotFoundError.cjs +7 -6
- package/dist/errors/RepositoryNotFoundError.cjs.map +1 -1
- package/dist/errors/RepositoryNotFoundError.d.cts +7 -0
- package/dist/errors/RepositoryNotFoundError.d.cts.map +1 -0
- package/dist/errors/RepositoryNotFoundError.d.ts +7 -3
- package/dist/errors/RepositoryNotFoundError.d.ts.map +1 -0
- package/dist/errors/RepositoryNotFoundError.js +7 -6
- package/dist/errors/RepositoryNotFoundError.js.map +1 -1
- package/dist/filter.cjs +93 -236
- package/dist/filter.cjs.map +1 -1
- package/dist/filter.d.cts +213 -0
- package/dist/filter.d.cts.map +1 -0
- package/dist/filter.d.ts +212 -208
- package/dist/filter.d.ts.map +1 -0
- package/dist/filter.js +93 -237
- package/dist/filter.js.map +1 -1
- package/dist/getGraphQLEndpoint.cjs +18 -10
- package/dist/getGraphQLEndpoint.cjs.map +1 -1
- package/dist/getGraphQLEndpoint.d.cts +14 -0
- package/dist/getGraphQLEndpoint.d.cts.map +1 -0
- package/dist/getGraphQLEndpoint.d.ts +5 -1
- package/dist/getGraphQLEndpoint.d.ts.map +1 -0
- package/dist/getGraphQLEndpoint.js +17 -9
- package/dist/getGraphQLEndpoint.js.map +1 -1
- package/dist/getRepositoryEndpoint.cjs +27 -10
- package/dist/getRepositoryEndpoint.cjs.map +1 -1
- package/dist/getRepositoryEndpoint.d.cts +23 -0
- package/dist/getRepositoryEndpoint.d.cts.map +1 -0
- package/dist/getRepositoryEndpoint.d.ts +14 -3
- package/dist/getRepositoryEndpoint.d.ts.map +1 -0
- package/dist/getRepositoryEndpoint.js +26 -9
- package/dist/getRepositoryEndpoint.js.map +1 -1
- package/dist/getRepositoryName.cjs +22 -14
- package/dist/getRepositoryName.cjs.map +1 -1
- package/dist/getRepositoryName.d.cts +16 -0
- package/dist/getRepositoryName.d.cts.map +1 -0
- package/dist/getRepositoryName.d.ts +5 -1
- package/dist/getRepositoryName.d.ts.map +1 -0
- package/dist/getRepositoryName.js +22 -14
- package/dist/getRepositoryName.js.map +1 -1
- package/dist/getToolbarSrc.cjs +42 -10
- package/dist/getToolbarSrc.cjs.map +1 -1
- package/dist/getToolbarSrc.d.cts +38 -0
- package/dist/getToolbarSrc.d.cts.map +1 -0
- package/dist/getToolbarSrc.d.ts +5 -1
- package/dist/getToolbarSrc.d.ts.map +1 -0
- package/dist/getToolbarSrc.js +41 -9
- package/dist/getToolbarSrc.js.map +1 -1
- package/dist/helpers/asDate.cjs +36 -11
- package/dist/helpers/asDate.cjs.map +1 -1
- package/dist/helpers/asDate.d.cts +29 -0
- package/dist/helpers/asDate.d.cts.map +1 -0
- package/dist/helpers/asDate.d.ts +20 -8
- package/dist/helpers/asDate.d.ts.map +1 -0
- package/dist/helpers/asDate.js +36 -12
- package/dist/helpers/asDate.js.map +1 -1
- package/dist/helpers/asHTML.cjs +76 -79
- package/dist/helpers/asHTML.cjs.map +1 -1
- package/dist/helpers/asHTML.d.cts +147 -0
- package/dist/helpers/asHTML.d.cts.map +1 -0
- package/dist/helpers/asHTML.d.ts +84 -78
- package/dist/helpers/asHTML.d.ts.map +1 -0
- package/dist/helpers/asHTML.js +74 -77
- package/dist/helpers/asHTML.js.map +1 -1
- package/dist/helpers/asImagePixelDensitySrcSet.cjs +57 -18
- package/dist/helpers/asImagePixelDensitySrcSet.cjs.map +1 -1
- package/dist/helpers/asImagePixelDensitySrcSet.d.cts +59 -0
- package/dist/helpers/asImagePixelDensitySrcSet.d.cts.map +1 -0
- package/dist/helpers/asImagePixelDensitySrcSet.d.ts +31 -25
- package/dist/helpers/asImagePixelDensitySrcSet.d.ts.map +1 -0
- package/dist/helpers/asImagePixelDensitySrcSet.js +57 -18
- package/dist/helpers/asImagePixelDensitySrcSet.js.map +1 -1
- package/dist/helpers/asImageSrc.cjs +30 -10
- package/dist/helpers/asImageSrc.cjs.map +1 -1
- package/dist/helpers/asImageSrc.d.cts +34 -0
- package/dist/helpers/asImageSrc.d.cts.map +1 -0
- package/dist/helpers/asImageSrc.d.ts +20 -14
- package/dist/helpers/asImageSrc.d.ts.map +1 -0
- package/dist/helpers/asImageSrc.js +30 -10
- package/dist/helpers/asImageSrc.js.map +1 -1
- package/dist/helpers/asImageWidthSrcSet.cjs +76 -42
- package/dist/helpers/asImageWidthSrcSet.cjs.map +1 -1
- package/dist/helpers/asImageWidthSrcSet.d.cts +67 -0
- package/dist/helpers/asImageWidthSrcSet.d.cts.map +1 -0
- package/dist/helpers/asImageWidthSrcSet.d.ts +34 -28
- package/dist/helpers/asImageWidthSrcSet.d.ts.map +1 -0
- package/dist/helpers/asImageWidthSrcSet.js +76 -42
- package/dist/helpers/asImageWidthSrcSet.js.map +1 -1
- package/dist/helpers/asLink.cjs +26 -44
- package/dist/helpers/asLink.cjs.map +1 -1
- package/dist/helpers/asLink.d.cts +83 -0
- package/dist/helpers/asLink.d.cts.map +1 -0
- package/dist/helpers/asLink.d.ts +64 -58
- package/dist/helpers/asLink.d.ts.map +1 -0
- package/dist/helpers/asLink.js +25 -43
- package/dist/helpers/asLink.js.map +1 -1
- package/dist/helpers/asLinkAttrs.cjs +44 -25
- package/dist/helpers/asLinkAttrs.cjs.map +1 -1
- package/dist/helpers/asLinkAttrs.d.cts +51 -0
- package/dist/helpers/asLinkAttrs.d.cts.map +1 -0
- package/dist/helpers/asLinkAttrs.d.ts +29 -28
- package/dist/helpers/asLinkAttrs.d.ts.map +1 -0
- package/dist/helpers/asLinkAttrs.js +43 -24
- package/dist/helpers/asLinkAttrs.js.map +1 -1
- package/dist/helpers/asText.cjs +15 -20
- package/dist/helpers/asText.cjs.map +1 -1
- package/dist/helpers/asText.d.cts +62 -0
- package/dist/helpers/asText.d.cts.map +1 -0
- package/dist/helpers/asText.d.ts +48 -33
- package/dist/helpers/asText.d.ts.map +1 -0
- package/dist/helpers/asText.js +15 -20
- package/dist/helpers/asText.js.map +1 -1
- package/dist/helpers/documentToLinkField.cjs +30 -24
- package/dist/helpers/documentToLinkField.cjs.map +1 -1
- package/dist/helpers/documentToLinkField.d.cts +21 -0
- package/dist/helpers/documentToLinkField.d.cts.map +1 -0
- package/dist/helpers/documentToLinkField.d.ts +8 -4
- package/dist/helpers/documentToLinkField.d.ts.map +1 -0
- package/dist/helpers/documentToLinkField.js +30 -24
- package/dist/helpers/documentToLinkField.js.map +1 -1
- package/dist/helpers/isFilled.cjs +215 -42
- package/dist/helpers/isFilled.cjs.map +1 -1
- package/dist/helpers/isFilled.d.cts +199 -0
- package/dist/helpers/isFilled.d.cts.map +1 -0
- package/dist/helpers/isFilled.d.ts +65 -56
- package/dist/helpers/isFilled.d.ts.map +1 -0
- package/dist/helpers/isFilled.js +210 -44
- package/dist/helpers/isFilled.js.map +1 -1
- package/dist/helpers/mapSliceZone.cjs +50 -39
- package/dist/helpers/mapSliceZone.cjs.map +1 -1
- package/dist/helpers/mapSliceZone.d.cts +139 -0
- package/dist/helpers/mapSliceZone.d.cts.map +1 -0
- package/dist/helpers/mapSliceZone.d.ts +47 -44
- package/dist/helpers/mapSliceZone.d.ts.map +1 -0
- package/dist/helpers/mapSliceZone.js +50 -40
- package/dist/helpers/mapSliceZone.js.map +1 -1
- package/dist/index.cjs +117 -94
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +181 -0
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.ts +151 -173
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +39 -73
- package/dist/index.js.map +1 -1
- package/dist/isRepositoryEndpoint.cjs +20 -9
- package/dist/isRepositoryEndpoint.cjs.map +1 -1
- package/dist/isRepositoryEndpoint.d.cts +14 -0
- package/dist/isRepositoryEndpoint.d.cts.map +1 -0
- package/dist/isRepositoryEndpoint.d.ts +7 -3
- package/dist/isRepositoryEndpoint.d.ts.map +1 -0
- package/dist/isRepositoryEndpoint.js +20 -10
- package/dist/isRepositoryEndpoint.js.map +1 -1
- package/dist/isRepositoryName.cjs +14 -4
- package/dist/isRepositoryName.cjs.map +1 -1
- package/dist/isRepositoryName.d.cts +13 -0
- package/dist/isRepositoryName.d.cts.map +1 -0
- package/dist/isRepositoryName.d.ts +5 -1
- package/dist/isRepositoryName.d.ts.map +1 -0
- package/dist/isRepositoryName.js +14 -5
- package/dist/isRepositoryName.js.map +1 -1
- package/dist/lib/appendFilters.cjs +21 -8
- package/dist/lib/appendFilters.cjs.map +1 -1
- package/dist/lib/appendFilters.js +21 -8
- package/dist/lib/appendFilters.js.map +1 -1
- package/dist/lib/castArray.cjs +17 -4
- package/dist/lib/castArray.cjs.map +1 -1
- package/dist/lib/castArray.js +17 -5
- package/dist/lib/castArray.js.map +1 -1
- package/dist/lib/castThunk.cjs +16 -4
- package/dist/lib/castThunk.cjs.map +1 -1
- package/dist/lib/castThunk.js +16 -5
- package/dist/lib/castThunk.js.map +1 -1
- package/dist/lib/devMsg.cjs +22 -5
- package/dist/lib/devMsg.cjs.map +1 -1
- package/dist/lib/devMsg.js +23 -6
- package/dist/lib/devMsg.js.map +1 -1
- package/dist/lib/escapeHTML.cjs +36 -39
- package/dist/lib/escapeHTML.cjs.map +1 -1
- package/dist/lib/escapeHTML.js +36 -40
- package/dist/lib/escapeHTML.js.map +1 -1
- package/dist/lib/everyTagFilter.cjs +16 -6
- package/dist/lib/everyTagFilter.cjs.map +1 -1
- package/dist/lib/everyTagFilter.js +15 -5
- package/dist/lib/everyTagFilter.js.map +1 -1
- package/dist/lib/findMasterRef.cjs +16 -5
- package/dist/lib/findMasterRef.cjs.map +1 -1
- package/dist/lib/findMasterRef.js +16 -5
- package/dist/lib/findMasterRef.js.map +1 -1
- package/dist/lib/findRef.cjs +21 -9
- package/dist/lib/findRef.cjs.map +1 -1
- package/dist/lib/findRef.js +21 -9
- package/dist/lib/findRef.js.map +1 -1
- package/dist/lib/findRefByID.cjs +17 -5
- package/dist/lib/findRefByID.cjs.map +1 -1
- package/dist/lib/findRefByID.js +17 -5
- package/dist/lib/findRefByID.js.map +1 -1
- package/dist/lib/findRefByLabel.cjs +17 -5
- package/dist/lib/findRefByLabel.cjs.map +1 -1
- package/dist/lib/findRefByLabel.js +17 -5
- package/dist/lib/findRefByLabel.js.map +1 -1
- package/dist/lib/getOptionalLinkProperties.cjs +19 -11
- package/dist/lib/getOptionalLinkProperties.cjs.map +1 -1
- package/dist/lib/getOptionalLinkProperties.js +19 -12
- package/dist/lib/getOptionalLinkProperties.js.map +1 -1
- package/dist/lib/getPreviewCookie.cjs +25 -16
- package/dist/lib/getPreviewCookie.cjs.map +1 -1
- package/dist/lib/getPreviewCookie.js +25 -16
- package/dist/lib/getPreviewCookie.js.map +1 -1
- package/dist/lib/isInternalURL.cjs +15 -6
- package/dist/lib/isInternalURL.cjs.map +1 -1
- package/dist/lib/isInternalURL.js +15 -7
- package/dist/lib/isInternalURL.js.map +1 -1
- package/dist/lib/isMigrationValue.cjs +65 -12
- package/dist/lib/isMigrationValue.cjs.map +1 -1
- package/dist/lib/isMigrationValue.js +63 -13
- package/dist/lib/isMigrationValue.js.map +1 -1
- package/dist/lib/isValue.cjs +93 -36
- package/dist/lib/isValue.cjs.map +1 -1
- package/dist/lib/isValue.js +93 -40
- package/dist/lib/isValue.js.map +1 -1
- package/dist/lib/minifyGraphQLQuery.cjs +13 -4
- package/dist/lib/minifyGraphQLQuery.cjs.map +1 -1
- package/dist/lib/minifyGraphQLQuery.js +13 -5
- package/dist/lib/minifyGraphQLQuery.js.map +1 -1
- package/dist/lib/pLimit.cjs +51 -45
- package/dist/lib/pLimit.cjs.map +1 -1
- package/dist/lib/pLimit.js +51 -46
- package/dist/lib/pLimit.js.map +1 -1
- package/dist/lib/request.cjs +54 -37
- package/dist/lib/request.cjs.map +1 -1
- package/dist/lib/request.d.cts +61 -0
- package/dist/lib/request.d.cts.map +1 -0
- package/dist/lib/request.d.ts +38 -50
- package/dist/lib/request.d.ts.map +1 -0
- package/dist/lib/request.js +54 -37
- package/dist/lib/request.js.map +1 -1
- package/dist/lib/resolveMigrationDocumentData.cjs +147 -125
- package/dist/lib/resolveMigrationDocumentData.cjs.map +1 -1
- package/dist/lib/resolveMigrationDocumentData.js +143 -122
- package/dist/lib/resolveMigrationDocumentData.js.map +1 -1
- package/dist/lib/serializerHelpers.cjs +73 -91
- package/dist/lib/serializerHelpers.cjs.map +1 -1
- package/dist/lib/serializerHelpers.js +71 -94
- package/dist/lib/serializerHelpers.js.map +1 -1
- package/dist/lib/someTagsFilter.cjs +16 -6
- package/dist/lib/someTagsFilter.cjs.map +1 -1
- package/dist/lib/someTagsFilter.js +15 -5
- package/dist/lib/someTagsFilter.js.map +1 -1
- package/dist/lib/throttledLog.cjs +22 -11
- package/dist/lib/throttledLog.cjs.map +1 -1
- package/dist/lib/throttledLog.js +22 -12
- package/dist/lib/throttledLog.js.map +1 -1
- package/dist/lib/typeFilter.cjs +14 -5
- package/dist/lib/typeFilter.cjs.map +1 -1
- package/dist/lib/typeFilter.js +14 -5
- package/dist/lib/typeFilter.js.map +1 -1
- package/dist/lib/validateAssetMetadata.cjs +40 -20
- package/dist/lib/validateAssetMetadata.cjs.map +1 -1
- package/dist/lib/validateAssetMetadata.js +40 -20
- package/dist/lib/validateAssetMetadata.js.map +1 -1
- package/dist/package.cjs +19 -0
- package/dist/package.cjs.map +1 -0
- package/dist/package.js +7 -0
- package/dist/package.js.map +1 -0
- package/dist/richtext/asText.cjs +18 -10
- package/dist/richtext/asText.cjs.map +1 -1
- package/dist/richtext/asText.d.cts +18 -0
- package/dist/richtext/asText.d.cts.map +1 -0
- package/dist/richtext/asText.d.ts +13 -7
- package/dist/richtext/asText.d.ts.map +1 -0
- package/dist/richtext/asText.js +18 -11
- package/dist/richtext/asText.js.map +1 -1
- package/dist/richtext/asTree.cjs +106 -107
- package/dist/richtext/asTree.cjs.map +1 -1
- package/dist/richtext/asTree.d.cts +20 -0
- package/dist/richtext/asTree.d.cts.map +1 -0
- package/dist/richtext/asTree.d.ts +9 -3
- package/dist/richtext/asTree.d.ts.map +1 -0
- package/dist/richtext/asTree.js +106 -107
- package/dist/richtext/asTree.js.map +1 -1
- package/dist/richtext/composeSerializers.cjs +28 -14
- package/dist/richtext/composeSerializers.cjs.map +1 -1
- package/dist/richtext/composeSerializers.d.cts +22 -0
- package/dist/richtext/composeSerializers.d.cts.map +1 -0
- package/dist/richtext/composeSerializers.d.ts +8 -2
- package/dist/richtext/composeSerializers.d.ts.map +1 -0
- package/dist/richtext/composeSerializers.js +28 -15
- package/dist/richtext/composeSerializers.js.map +1 -1
- package/dist/richtext/serialize.cjs +30 -14
- package/dist/richtext/serialize.cjs.map +1 -1
- package/dist/richtext/serialize.d.cts +25 -0
- package/dist/richtext/serialize.d.cts.map +1 -0
- package/dist/richtext/serialize.d.ts +17 -11
- package/dist/richtext/serialize.d.ts.map +1 -0
- package/dist/richtext/serialize.js +30 -14
- package/dist/richtext/serialize.js.map +1 -1
- package/dist/richtext/types.cjs +10 -8
- package/dist/richtext/types.cjs.map +1 -1
- package/dist/richtext/types.d.cts +71 -0
- package/dist/richtext/types.d.cts.map +1 -0
- package/dist/richtext/types.d.ts +49 -49
- package/dist/richtext/types.d.ts.map +1 -0
- package/dist/richtext/types.js +10 -8
- package/dist/richtext/types.js.map +1 -1
- package/dist/richtext/wrapMapSerializer.cjs +29 -21
- package/dist/richtext/wrapMapSerializer.cjs.map +1 -1
- package/dist/richtext/wrapMapSerializer.d.cts +21 -0
- package/dist/richtext/wrapMapSerializer.d.cts.map +1 -0
- package/dist/richtext/wrapMapSerializer.d.ts +8 -2
- package/dist/richtext/wrapMapSerializer.d.ts.map +1 -0
- package/dist/richtext/wrapMapSerializer.js +29 -21
- package/dist/richtext/wrapMapSerializer.js.map +1 -1
- package/dist/richtext.cjs +13 -15
- package/dist/richtext.d.cts +8 -0
- package/dist/richtext.d.ts +8 -0
- package/dist/richtext.js +4 -11
- package/dist/types/api/asset/asset.d.cts +97 -0
- package/dist/types/api/asset/asset.d.cts.map +1 -0
- package/dist/types/api/asset/asset.d.ts +87 -167
- package/dist/types/api/asset/asset.d.ts.map +1 -0
- package/dist/types/api/asset/tag.d.cts +35 -0
- package/dist/types/api/asset/tag.d.cts.map +1 -0
- package/dist/types/api/asset/tag.d.ts +29 -47
- package/dist/types/api/asset/tag.d.ts.map +1 -0
- package/dist/types/api/integration.d.cts +34 -0
- package/dist/types/api/integration.d.cts.map +1 -0
- package/dist/types/api/integration.d.ts +17 -11
- package/dist/types/api/integration.d.ts.map +1 -0
- package/dist/types/api/query.d.cts +49 -0
- package/dist/types/api/query.d.cts.map +1 -0
- package/dist/types/api/query.d.ts +40 -34
- package/dist/types/api/query.d.ts.map +1 -0
- package/dist/types/api/ref.d.cts +36 -0
- package/dist/types/api/ref.d.cts.map +1 -0
- package/dist/types/api/ref.d.ts +30 -26
- package/dist/types/api/ref.d.ts.map +1 -0
- package/dist/types/api/release.d.cts +17 -0
- package/dist/types/api/release.d.cts.map +1 -0
- package/dist/types/api/release.d.ts +8 -2
- package/dist/types/api/release.d.ts.map +1 -0
- package/dist/types/api/repository.d.cts +115 -0
- package/dist/types/api/repository.d.cts.map +1 -0
- package/dist/types/api/repository.d.ts +90 -84
- package/dist/types/api/repository.d.ts.map +1 -0
- package/dist/types/api/tags.d.cts +13 -0
- package/dist/types/api/tags.d.cts.map +1 -0
- package/dist/types/api/tags.d.ts +5 -1
- package/dist/types/api/tags.d.ts.map +1 -0
- package/dist/types/migration/Asset.cjs +34 -32
- package/dist/types/migration/Asset.cjs.map +1 -1
- package/dist/types/migration/Asset.d.cts +109 -0
- package/dist/types/migration/Asset.d.cts.map +1 -0
- package/dist/types/migration/Asset.d.ts +89 -88
- package/dist/types/migration/Asset.d.ts.map +1 -0
- package/dist/types/migration/Asset.js +33 -32
- package/dist/types/migration/Asset.js.map +1 -1
- package/dist/types/migration/ContentRelationship.d.cts +15 -0
- package/dist/types/migration/ContentRelationship.d.cts.map +1 -0
- package/dist/types/migration/ContentRelationship.d.ts +10 -11
- package/dist/types/migration/ContentRelationship.d.ts.map +1 -0
- package/dist/types/migration/Document.cjs +50 -46
- package/dist/types/migration/Document.cjs.map +1 -1
- package/dist/types/migration/Document.d.cts +97 -0
- package/dist/types/migration/Document.d.cts.map +1 -0
- package/dist/types/migration/Document.d.ts +62 -59
- package/dist/types/migration/Document.d.ts.map +1 -0
- package/dist/types/migration/Document.js +49 -46
- package/dist/types/migration/Document.js.map +1 -1
- package/dist/types/model/boolean.d.cts +21 -0
- package/dist/types/model/boolean.d.cts.map +1 -0
- package/dist/types/model/boolean.d.ts +15 -9
- package/dist/types/model/boolean.d.ts.map +1 -0
- package/dist/types/model/color.d.cts +19 -0
- package/dist/types/model/color.d.cts.map +1 -0
- package/dist/types/model/color.d.ts +13 -7
- package/dist/types/model/color.d.ts.map +1 -0
- package/dist/types/model/contentRelationship.d.cts +59 -0
- package/dist/types/model/contentRelationship.d.cts.map +1 -0
- package/dist/types/model/contentRelationship.d.ts +33 -26
- package/dist/types/model/contentRelationship.d.ts.map +1 -0
- package/dist/types/model/customType.d.cts +54 -0
- package/dist/types/model/customType.d.cts.map +1 -0
- package/dist/types/model/customType.d.ts +36 -30
- package/dist/types/model/customType.d.ts.map +1 -0
- package/dist/types/model/date.d.cts +20 -0
- package/dist/types/model/date.d.cts.map +1 -0
- package/dist/types/model/date.d.ts +14 -8
- package/dist/types/model/date.d.ts.map +1 -0
- package/dist/types/model/embed.d.cts +19 -0
- package/dist/types/model/embed.d.cts.map +1 -0
- package/dist/types/model/embed.d.ts +13 -7
- package/dist/types/model/embed.d.ts.map +1 -0
- package/dist/types/model/geoPoint.d.cts +18 -0
- package/dist/types/model/geoPoint.d.cts.map +1 -0
- package/dist/types/model/geoPoint.d.ts +12 -6
- package/dist/types/model/geoPoint.d.ts.map +1 -0
- package/dist/types/model/group.d.cts +29 -0
- package/dist/types/model/group.d.cts.map +1 -0
- package/dist/types/model/group.d.ts +14 -8
- package/dist/types/model/group.d.ts.map +1 -0
- package/dist/types/model/image.d.cts +37 -0
- package/dist/types/model/image.d.cts.map +1 -0
- package/dist/types/model/image.d.ts +19 -13
- package/dist/types/model/image.d.ts.map +1 -0
- package/dist/types/model/integration.d.cts +20 -0
- package/dist/types/model/integration.d.cts.map +1 -0
- package/dist/types/model/integration.d.ts +14 -8
- package/dist/types/model/integration.d.ts.map +1 -0
- package/dist/types/model/keyText.d.cts +19 -0
- package/dist/types/model/keyText.d.cts.map +1 -0
- package/dist/types/model/keyText.d.ts +13 -7
- package/dist/types/model/keyText.d.ts.map +1 -0
- package/dist/types/model/link.cjs +13 -6
- package/dist/types/model/link.cjs.map +1 -1
- package/dist/types/model/link.d.cts +34 -0
- package/dist/types/model/link.d.cts.map +1 -0
- package/dist/types/model/link.d.ts +22 -16
- package/dist/types/model/link.d.ts.map +1 -0
- package/dist/types/model/link.js +13 -7
- package/dist/types/model/link.js.map +1 -1
- package/dist/types/model/linkToMedia.d.cts +23 -0
- package/dist/types/model/linkToMedia.d.cts.map +1 -0
- package/dist/types/model/linkToMedia.d.ts +17 -11
- package/dist/types/model/linkToMedia.d.ts.map +1 -0
- package/dist/types/model/number.d.cts +21 -0
- package/dist/types/model/number.d.cts.map +1 -0
- package/dist/types/model/number.d.ts +15 -9
- package/dist/types/model/number.d.ts.map +1 -0
- package/dist/types/model/range.d.cts +20 -0
- package/dist/types/model/range.d.cts.map +1 -0
- package/dist/types/model/range.d.ts +16 -10
- package/dist/types/model/range.d.ts.map +1 -0
- package/dist/types/model/richText.d.cts +43 -0
- package/dist/types/model/richText.d.cts.map +1 -0
- package/dist/types/model/richText.d.ts +26 -20
- package/dist/types/model/richText.d.ts.map +1 -0
- package/dist/types/model/select.d.cts +24 -0
- package/dist/types/model/select.d.cts.map +1 -0
- package/dist/types/model/select.d.ts +15 -9
- package/dist/types/model/select.d.ts.map +1 -0
- package/dist/types/model/separator.d.cts +16 -0
- package/dist/types/model/separator.d.cts.map +1 -0
- package/dist/types/model/separator.d.ts +12 -6
- package/dist/types/model/separator.d.ts.map +1 -0
- package/dist/types/model/sharedSlice.d.cts +22 -0
- package/dist/types/model/sharedSlice.d.cts.map +1 -0
- package/dist/types/model/sharedSlice.d.ts +14 -8
- package/dist/types/model/sharedSlice.d.ts.map +1 -0
- package/dist/types/model/sharedSliceVariation.d.cts +25 -0
- package/dist/types/model/sharedSliceVariation.d.cts.map +1 -0
- package/dist/types/model/sharedSliceVariation.d.ts +16 -10
- package/dist/types/model/sharedSliceVariation.d.ts.map +1 -0
- package/dist/types/model/slice.cjs +12 -5
- package/dist/types/model/slice.cjs.map +1 -1
- package/dist/types/model/slice.d.cts +39 -0
- package/dist/types/model/slice.d.cts.map +1 -0
- package/dist/types/model/slice.d.ts +21 -15
- package/dist/types/model/slice.d.ts.map +1 -0
- package/dist/types/model/slice.js +12 -6
- package/dist/types/model/slice.js.map +1 -1
- package/dist/types/model/sliceZone.cjs +12 -5
- package/dist/types/model/sliceZone.cjs.map +1 -1
- package/dist/types/model/sliceZone.d.cts +47 -0
- package/dist/types/model/sliceZone.d.cts.map +1 -0
- package/dist/types/model/sliceZone.d.ts +23 -17
- package/dist/types/model/sliceZone.d.ts.map +1 -0
- package/dist/types/model/sliceZone.js +12 -6
- package/dist/types/model/sliceZone.js.map +1 -1
- package/dist/types/model/table.d.cts +18 -0
- package/dist/types/model/table.d.cts.map +1 -0
- package/dist/types/model/table.d.ts +12 -6
- package/dist/types/model/table.d.ts.map +1 -0
- package/dist/types/model/timestamp.d.cts +20 -0
- package/dist/types/model/timestamp.d.cts.map +1 -0
- package/dist/types/model/timestamp.d.ts +14 -8
- package/dist/types/model/timestamp.d.ts.map +1 -0
- package/dist/types/model/title.d.cts +13 -0
- package/dist/types/model/title.d.cts.map +1 -0
- package/dist/types/model/title.d.ts +8 -2
- package/dist/types/model/title.d.ts.map +1 -0
- package/dist/types/model/types.cjs +29 -36
- package/dist/types/model/types.cjs.map +1 -1
- package/dist/types/model/types.d.cts +82 -0
- package/dist/types/model/types.d.cts.map +1 -0
- package/dist/types/model/types.d.ts +66 -61
- package/dist/types/model/types.d.ts.map +1 -0
- package/dist/types/model/types.js +29 -37
- package/dist/types/model/types.js.map +1 -1
- package/dist/types/model/uid.d.cts +19 -0
- package/dist/types/model/uid.d.cts.map +1 -0
- package/dist/types/model/uid.d.ts +13 -7
- package/dist/types/model/uid.d.ts.map +1 -0
- package/dist/types/value/boolean.d.cts +10 -0
- package/dist/types/value/boolean.d.cts.map +1 -0
- package/dist/types/value/boolean.d.ts +5 -1
- package/dist/types/value/boolean.d.ts.map +1 -0
- package/dist/types/value/color.d.cts +15 -0
- package/dist/types/value/color.d.cts.map +1 -0
- package/dist/types/value/color.d.ts +8 -2
- package/dist/types/value/color.d.ts.map +1 -0
- package/dist/types/value/contentRelationship.d.cts +37 -0
- package/dist/types/value/contentRelationship.d.cts.map +1 -0
- package/dist/types/value/contentRelationship.d.ts +23 -17
- package/dist/types/value/contentRelationship.d.ts.map +1 -0
- package/dist/types/value/date.d.cts +15 -0
- package/dist/types/value/date.d.cts.map +1 -0
- package/dist/types/value/date.d.ts +8 -2
- package/dist/types/value/date.d.ts.map +1 -0
- package/dist/types/value/document.d.cts +120 -0
- package/dist/types/value/document.d.cts.map +1 -0
- package/dist/types/value/document.d.ts +90 -84
- package/dist/types/value/document.d.ts.map +1 -0
- package/dist/types/value/embed.cjs +14 -7
- package/dist/types/value/embed.cjs.map +1 -1
- package/dist/types/value/embed.d.cts +173 -0
- package/dist/types/value/embed.d.cts.map +1 -0
- package/dist/types/value/embed.d.ts +110 -105
- package/dist/types/value/embed.d.ts.map +1 -0
- package/dist/types/value/embed.js +14 -8
- package/dist/types/value/embed.js.map +1 -1
- package/dist/types/value/geoPoint.d.cts +18 -0
- package/dist/types/value/geoPoint.d.cts.map +1 -0
- package/dist/types/value/geoPoint.d.ts +10 -4
- package/dist/types/value/geoPoint.d.ts.map +1 -0
- package/dist/types/value/group.d.cts +19 -0
- package/dist/types/value/group.d.cts.map +1 -0
- package/dist/types/value/group.d.ts +9 -3
- package/dist/types/value/group.d.ts.map +1 -0
- package/dist/types/value/image.d.cts +53 -0
- package/dist/types/value/image.d.cts.map +1 -0
- package/dist/types/value/image.d.ts +31 -25
- package/dist/types/value/image.d.ts.map +1 -0
- package/dist/types/value/integration.d.cts +22 -0
- package/dist/types/value/integration.d.cts.map +1 -0
- package/dist/types/value/integration.d.ts +9 -3
- package/dist/types/value/integration.d.ts.map +1 -0
- package/dist/types/value/keyText.d.cts +15 -0
- package/dist/types/value/keyText.d.cts.map +1 -0
- package/dist/types/value/keyText.d.ts +8 -2
- package/dist/types/value/keyText.d.ts.map +1 -0
- package/dist/types/value/link.cjs +12 -7
- package/dist/types/value/link.cjs.map +1 -1
- package/dist/types/value/link.d.cts +74 -0
- package/dist/types/value/link.d.cts.map +1 -0
- package/dist/types/value/link.d.ts +27 -21
- package/dist/types/value/link.d.ts.map +1 -0
- package/dist/types/value/link.js +12 -8
- package/dist/types/value/link.js.map +1 -1
- package/dist/types/value/linkToMedia.d.cts +33 -0
- package/dist/types/value/linkToMedia.d.cts.map +1 -0
- package/dist/types/value/linkToMedia.d.ts +19 -14
- package/dist/types/value/linkToMedia.d.ts.map +1 -0
- package/dist/types/value/number.d.cts +15 -0
- package/dist/types/value/number.d.cts.map +1 -0
- package/dist/types/value/number.d.ts +8 -2
- package/dist/types/value/number.d.ts.map +1 -0
- package/dist/types/value/richText.cjs +29 -22
- package/dist/types/value/richText.cjs.map +1 -1
- package/dist/types/value/richText.d.cts +221 -0
- package/dist/types/value/richText.d.cts.map +1 -0
- package/dist/types/value/richText.d.ts +103 -97
- package/dist/types/value/richText.d.ts.map +1 -0
- package/dist/types/value/richText.js +29 -23
- package/dist/types/value/richText.js.map +1 -1
- package/dist/types/value/select.d.cts +16 -0
- package/dist/types/value/select.d.cts.map +1 -0
- package/dist/types/value/select.d.ts +8 -2
- package/dist/types/value/select.d.ts.map +1 -0
- package/dist/types/value/sharedSlice.d.cts +17 -0
- package/dist/types/value/sharedSlice.d.cts.map +1 -0
- package/dist/types/value/sharedSlice.d.ts +11 -5
- package/dist/types/value/sharedSlice.d.ts.map +1 -0
- package/dist/types/value/sharedSliceVariation.d.cts +16 -0
- package/dist/types/value/sharedSliceVariation.d.cts.map +1 -0
- package/dist/types/value/sharedSliceVariation.d.ts +12 -6
- package/dist/types/value/sharedSliceVariation.d.ts.map +1 -0
- package/dist/types/value/slice.d.cts +19 -0
- package/dist/types/value/slice.d.cts.map +1 -0
- package/dist/types/value/slice.d.ts +13 -7
- package/dist/types/value/slice.d.ts.map +1 -0
- package/dist/types/value/sliceZone.d.cts +18 -0
- package/dist/types/value/sliceZone.d.cts.map +1 -0
- package/dist/types/value/sliceZone.d.ts +10 -4
- package/dist/types/value/sliceZone.d.ts.map +1 -0
- package/dist/types/value/table.d.cts +97 -0
- package/dist/types/value/table.d.cts.map +1 -0
- package/dist/types/value/table.d.ts +65 -59
- package/dist/types/value/table.d.ts.map +1 -0
- package/dist/types/value/timestamp.d.cts +13 -0
- package/dist/types/value/timestamp.d.cts.map +1 -0
- package/dist/types/value/timestamp.d.ts +8 -3
- package/dist/types/value/timestamp.d.ts.map +1 -0
- package/dist/types/value/title.d.cts +16 -0
- package/dist/types/value/title.d.cts.map +1 -0
- package/dist/types/value/title.d.ts +11 -7
- package/dist/types/value/title.d.ts.map +1 -0
- package/dist/types/value/types.d.cts +61 -0
- package/dist/types/value/types.d.cts.map +1 -0
- package/dist/types/value/types.d.ts +31 -28
- package/dist/types/value/types.d.ts.map +1 -0
- package/dist/types/webhook/apiUpdate.d.cts +57 -0
- package/dist/types/webhook/apiUpdate.d.cts.map +1 -0
- package/dist/types/webhook/apiUpdate.d.ts +28 -23
- package/dist/types/webhook/apiUpdate.d.ts.map +1 -0
- package/dist/types/webhook/testTrigger.d.cts +15 -0
- package/dist/types/webhook/testTrigger.d.cts.map +1 -0
- package/dist/types/webhook/testTrigger.d.ts +9 -3
- package/dist/types/webhook/testTrigger.d.ts.map +1 -0
- package/dist/types/webhook/types.cjs +12 -5
- package/dist/types/webhook/types.cjs.map +1 -1
- package/dist/types/webhook/types.d.cts +23 -0
- package/dist/types/webhook/types.d.cts.map +1 -0
- package/dist/types/webhook/types.d.ts +16 -11
- package/dist/types/webhook/types.d.ts.map +1 -0
- package/dist/types/webhook/types.js +12 -6
- package/dist/types/webhook/types.js.map +1 -1
- package/package.json +20 -49
- package/src/Client.ts +26 -9
- package/src/WriteClient.ts +28 -36
- package/src/buildQueryURL.ts +33 -22
- package/src/createClient.ts +11 -8
- package/src/getRepositoryEndpoint.ts +9 -2
- package/src/helpers/asDate.ts +11 -4
- package/src/helpers/asHTML.ts +38 -30
- package/src/helpers/asImagePixelDensitySrcSet.ts +16 -15
- package/src/helpers/asImageSrc.ts +11 -10
- package/src/helpers/asImageWidthSrcSet.ts +19 -22
- package/src/helpers/asLink.ts +33 -35
- package/src/helpers/asLinkAttrs.ts +6 -13
- package/src/helpers/asText.ts +20 -10
- package/src/helpers/isFilled.ts +15 -14
- package/src/helpers/mapSliceZone.ts +15 -15
- package/src/index.ts +3 -2
- package/src/isRepositoryEndpoint.ts +2 -2
- package/src/lib/isValue.ts +0 -6
- package/src/lib/pLimit.ts +1 -1
- package/src/lib/request.ts +3 -3
- package/src/lib/throttledLog.ts +0 -1
- 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/migration/Document.ts +1 -1
- package/src/types/model/contentRelationship.ts +1 -0
- package/src/types/model/types.ts +0 -2
- package/src/types/value/date.ts +1 -1
- package/src/types/value/document.ts +3 -3
- package/src/types/value/timestamp.ts +1 -5
- package/dist/lib/appendFilters.d.ts +0 -18
- package/dist/lib/castArray.d.ts +0 -12
- package/dist/lib/castThunk.d.ts +0 -11
- package/dist/lib/devMsg.d.ts +0 -16
- package/dist/lib/escapeHTML.d.ts +0 -1
- package/dist/lib/everyTagFilter.d.ts +0 -9
- package/dist/lib/findMasterRef.d.ts +0 -11
- package/dist/lib/findRef.d.ts +0 -14
- package/dist/lib/findRefByID.d.ts +0 -12
- package/dist/lib/findRefByLabel.d.ts +0 -12
- package/dist/lib/getOptionalLinkProperties.d.ts +0 -12
- package/dist/lib/getPreviewCookie.d.ts +0 -9
- package/dist/lib/isInternalURL.d.ts +0 -8
- package/dist/lib/isMigrationValue.d.ts +0 -71
- package/dist/lib/isValue.d.ts +0 -78
- package/dist/lib/minifyGraphQLQuery.d.ts +0 -8
- package/dist/lib/pLimit.d.ts +0 -22
- package/dist/lib/resolveMigrationDocumentData.d.ts +0 -54
- package/dist/lib/serializerHelpers.d.ts +0 -9
- package/dist/lib/someTagsFilter.d.ts +0 -9
- package/dist/lib/throttledLog.d.ts +0 -15
- package/dist/lib/typeFilter.d.ts +0 -8
- package/dist/lib/validateAssetMetadata.d.ts +0 -10
- 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/index.d.ts +0 -7
- package/dist/richtext.cjs.map +0 -1
- package/dist/richtext.js.map +0 -1
- package/dist/types/api/migration/document.d.ts +0 -60
- package/dist/types/migration/Link.d.ts +0 -19
|
@@ -1,21 +1,30 @@
|
|
|
1
1
|
import { preview } from "../cookie.js";
|
|
2
|
+
|
|
3
|
+
//#region src/lib/getPreviewCookie.ts
|
|
2
4
|
const readValue = (value) => {
|
|
3
|
-
|
|
5
|
+
return value.replace(/%3B/g, ";");
|
|
4
6
|
};
|
|
7
|
+
/**
|
|
8
|
+
* Returns the value of a cookie from a given cookie store.
|
|
9
|
+
*
|
|
10
|
+
* @param cookieJar - The stringified cookie store from which to read the
|
|
11
|
+
* cookie.
|
|
12
|
+
*
|
|
13
|
+
* @returns The value of the cookie, if it exists.
|
|
14
|
+
*/
|
|
5
15
|
const getPreviewCookie = (cookieJar) => {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
return value;
|
|
16
|
+
const cookies = cookieJar.split("; ");
|
|
17
|
+
let value;
|
|
18
|
+
for (const cookie of cookies) {
|
|
19
|
+
const parts = cookie.split("=");
|
|
20
|
+
if (readValue(parts[0]).replace(/%3D/g, "=") === preview) {
|
|
21
|
+
value = readValue(parts.slice(1).join("="));
|
|
22
|
+
break;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
return value;
|
|
17
26
|
};
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
};
|
|
21
|
-
//# sourceMappingURL=getPreviewCookie.js.map
|
|
27
|
+
|
|
28
|
+
//#endregion
|
|
29
|
+
export { getPreviewCookie };
|
|
30
|
+
//# sourceMappingURL=getPreviewCookie.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getPreviewCookie.js","sources":["
|
|
1
|
+
{"version":3,"file":"getPreviewCookie.js","names":["value: string | undefined","previewCookieName"],"sources":["../../src/lib/getPreviewCookie.ts"],"sourcesContent":["import { preview as previewCookieName } from \"../cookie\"\n\nconst readValue = (value: string): string => {\n\treturn value.replace(/%3B/g, \";\")\n}\n\n/**\n * Returns the value of a cookie from a given cookie store.\n *\n * @param cookieJar - The stringified cookie store from which to read the\n * cookie.\n *\n * @returns The value of the cookie, if it exists.\n */\nexport const getPreviewCookie = (cookieJar: string): string | undefined => {\n\tconst cookies = cookieJar.split(\"; \")\n\n\tlet value: string | undefined\n\n\tfor (const cookie of cookies) {\n\t\tconst parts = cookie.split(\"=\")\n\t\tconst name = readValue(parts[0]).replace(/%3D/g, \"=\")\n\n\t\tif (name === previewCookieName) {\n\t\t\tvalue = readValue(parts.slice(1).join(\"=\"))\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn value\n}\n"],"mappings":";;;AAEA,MAAM,aAAa,UAA0B;AAC5C,QAAO,MAAM,QAAQ,QAAQ,IAAI;;;;;;;;;;AAWlC,MAAa,oBAAoB,cAA0C;CAC1E,MAAM,UAAU,UAAU,MAAM,KAAK;CAErC,IAAIA;AAEJ,MAAK,MAAM,UAAU,SAAS;EAC7B,MAAM,QAAQ,OAAO,MAAM,IAAI;AAG/B,MAFa,UAAU,MAAM,GAAG,CAAC,QAAQ,QAAQ,IAAI,KAExCC,SAAmB;AAC/B,WAAQ,UAAU,MAAM,MAAM,EAAE,CAAC,KAAK,IAAI,CAAC;AAC3C;;;AAIF,QAAO"}
|
|
@@ -1,9 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
|
|
2
|
+
//#region src/lib/isInternalURL.ts
|
|
3
|
+
/**
|
|
4
|
+
* Determines if a URL is internal or external.
|
|
5
|
+
*
|
|
6
|
+
* @param url - The URL to check if internal or external.
|
|
7
|
+
*
|
|
8
|
+
* @returns `true` if `url` is internal, `false` otherwise.
|
|
9
|
+
*/
|
|
3
10
|
const isInternalURL = (url) => {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
11
|
+
const isInternal = /^(\/(?!\/)|#)/.test(url);
|
|
12
|
+
const isSpecialLink = !isInternal && !/^https?:\/\//.test(url);
|
|
13
|
+
return isInternal && !isSpecialLink;
|
|
7
14
|
};
|
|
15
|
+
|
|
16
|
+
//#endregion
|
|
8
17
|
exports.isInternalURL = isInternalURL;
|
|
9
|
-
//# sourceMappingURL=isInternalURL.cjs.map
|
|
18
|
+
//# sourceMappingURL=isInternalURL.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isInternalURL.cjs","sources":["
|
|
1
|
+
{"version":3,"file":"isInternalURL.cjs","names":[],"sources":["../../src/lib/isInternalURL.ts"],"sourcesContent":["/**\n * Determines if a URL is internal or external.\n *\n * @param url - The URL to check if internal or external.\n *\n * @returns `true` if `url` is internal, `false` otherwise.\n */\n// TODO: This does not detect all relative URLs as internal such as `about` or `./about`. This function assumes relative URLs start with a \"/\" or \"#\"`.\nexport const isInternalURL = (url: string): boolean => {\n\tconst isInternal = /^(\\/(?!\\/)|#)/.test(url)\n\tconst isSpecialLink = !isInternal && !/^https?:\\/\\//.test(url)\n\n\treturn isInternal && !isSpecialLink\n}\n"],"mappings":";;;;;;;;;AAQA,MAAa,iBAAiB,QAAyB;CACtD,MAAM,aAAa,gBAAgB,KAAK,IAAI;CAC5C,MAAM,gBAAgB,CAAC,cAAc,CAAC,eAAe,KAAK,IAAI;AAE9D,QAAO,cAAc,CAAC"}
|
|
@@ -1,9 +1,17 @@
|
|
|
1
|
+
//#region src/lib/isInternalURL.ts
|
|
2
|
+
/**
|
|
3
|
+
* Determines if a URL is internal or external.
|
|
4
|
+
*
|
|
5
|
+
* @param url - The URL to check if internal or external.
|
|
6
|
+
*
|
|
7
|
+
* @returns `true` if `url` is internal, `false` otherwise.
|
|
8
|
+
*/
|
|
1
9
|
const isInternalURL = (url) => {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
10
|
+
const isInternal = /^(\/(?!\/)|#)/.test(url);
|
|
11
|
+
const isSpecialLink = !isInternal && !/^https?:\/\//.test(url);
|
|
12
|
+
return isInternal && !isSpecialLink;
|
|
5
13
|
};
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
};
|
|
9
|
-
//# sourceMappingURL=isInternalURL.js.map
|
|
14
|
+
|
|
15
|
+
//#endregion
|
|
16
|
+
export { isInternalURL };
|
|
17
|
+
//# sourceMappingURL=isInternalURL.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isInternalURL.js","sources":["
|
|
1
|
+
{"version":3,"file":"isInternalURL.js","names":[],"sources":["../../src/lib/isInternalURL.ts"],"sourcesContent":["/**\n * Determines if a URL is internal or external.\n *\n * @param url - The URL to check if internal or external.\n *\n * @returns `true` if `url` is internal, `false` otherwise.\n */\n// TODO: This does not detect all relative URLs as internal such as `about` or `./about`. This function assumes relative URLs start with a \"/\" or \"#\"`.\nexport const isInternalURL = (url: string): boolean => {\n\tconst isInternal = /^(\\/(?!\\/)|#)/.test(url)\n\tconst isSpecialLink = !isInternal && !/^https?:\\/\\//.test(url)\n\n\treturn isInternal && !isSpecialLink\n}\n"],"mappings":";;;;;;;;AAQA,MAAa,iBAAiB,QAAyB;CACtD,MAAM,aAAa,gBAAgB,KAAK,IAAI;CAC5C,MAAM,gBAAgB,CAAC,cAAc,CAAC,eAAe,KAAK,IAAI;AAE9D,QAAO,cAAc,CAAC"}
|
|
@@ -1,24 +1,77 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
const require_richText = require('../types/value/richText.cjs');
|
|
2
|
+
const require_link = require('../types/value/link.cjs');
|
|
3
|
+
const require_Asset = require('../types/migration/Asset.cjs');
|
|
4
|
+
const require_Document = require('../types/migration/Document.cjs');
|
|
5
|
+
const require_isValue = require('./isValue.cjs');
|
|
6
|
+
|
|
7
|
+
//#region src/lib/isMigrationValue.ts
|
|
8
|
+
/**
|
|
9
|
+
* Checks if a value is a migration content relationship field.
|
|
10
|
+
*
|
|
11
|
+
* @remarks
|
|
12
|
+
* `OptionalLinkProperties` is included because `MigrationContentRelationship`
|
|
13
|
+
* may be a link field, not strictly a content relationship field.
|
|
14
|
+
*
|
|
15
|
+
* @param value - Value to check.
|
|
16
|
+
*
|
|
17
|
+
* @returns `true` if `value` is a migration content relationship field, `false`
|
|
18
|
+
* otherwise.
|
|
19
|
+
*
|
|
20
|
+
* @internal
|
|
21
|
+
* This is not an official helper function and it's only designed to work with internal processes.
|
|
22
|
+
*/
|
|
8
23
|
const contentRelationship = (value) => {
|
|
9
|
-
|
|
24
|
+
return value instanceof require_Document.PrismicMigrationDocument || require_isValue.prismicDocument(value) || typeof value === "object" && value !== null && "link_type" in value && value.link_type === require_link.LinkType.Document && "id" in value && (contentRelationship(value.id) || typeof value.id === "function");
|
|
10
25
|
};
|
|
26
|
+
/**
|
|
27
|
+
* Checks if a value is a migration image field.
|
|
28
|
+
*
|
|
29
|
+
* @param value - Value to check.
|
|
30
|
+
*
|
|
31
|
+
* @returns `true` if `value` is a migration image field, `false` otherwise.
|
|
32
|
+
*
|
|
33
|
+
* @internal
|
|
34
|
+
* This is not an official helper function and it's only designed to work with internal processes.
|
|
35
|
+
*/
|
|
11
36
|
const image = (value) => {
|
|
12
|
-
|
|
37
|
+
return value instanceof require_Asset.PrismicMigrationAsset || typeof value === "object" && value !== null && "id" in value && Object.values(value).every((maybeThumbnail) => maybeThumbnail instanceof require_Asset.PrismicMigrationAsset);
|
|
13
38
|
};
|
|
39
|
+
/**
|
|
40
|
+
* Checks if a value is a migration link to media field.
|
|
41
|
+
*
|
|
42
|
+
* - @remarks `OptionalLinkProperties` is included because
|
|
43
|
+
* `MigrationContentRelationship` may be a link field, not strictly a content
|
|
44
|
+
* relationship field.
|
|
45
|
+
*
|
|
46
|
+
* @param value - Value to check.
|
|
47
|
+
*
|
|
48
|
+
* @returns `true` if `value` is a migration link to media field, `false`
|
|
49
|
+
* otherwise.
|
|
50
|
+
*
|
|
51
|
+
* @internal
|
|
52
|
+
* This is not an official helper function and it's only designed to work with internal processes.
|
|
53
|
+
*/
|
|
14
54
|
const linkToMedia = (value) => {
|
|
15
|
-
|
|
55
|
+
return typeof value === "object" && value !== null && "id" in value && value.id instanceof require_Asset.PrismicMigrationAsset && "link_type" in value && value.link_type === require_link.LinkType.Media;
|
|
16
56
|
};
|
|
57
|
+
/**
|
|
58
|
+
* Checks if a value is a migration rich text image node.
|
|
59
|
+
*
|
|
60
|
+
* @param value - Value to check.
|
|
61
|
+
*
|
|
62
|
+
* @returns `true` if `value` is a migration rich text image node, `false`
|
|
63
|
+
* otherwise.
|
|
64
|
+
*
|
|
65
|
+
* @internal
|
|
66
|
+
* This is not an official helper function and it's only designed to work with internal processes.
|
|
67
|
+
*/
|
|
17
68
|
const rtImageNode = (value) => {
|
|
18
|
-
|
|
69
|
+
return typeof value === "object" && value !== null && "id" in value && value.id instanceof require_Asset.PrismicMigrationAsset && "type" in value && value.type === require_richText.RichTextNodeType.image;
|
|
19
70
|
};
|
|
71
|
+
|
|
72
|
+
//#endregion
|
|
20
73
|
exports.contentRelationship = contentRelationship;
|
|
21
74
|
exports.image = image;
|
|
22
75
|
exports.linkToMedia = linkToMedia;
|
|
23
76
|
exports.rtImageNode = rtImageNode;
|
|
24
|
-
//# sourceMappingURL=isMigrationValue.cjs.map
|
|
77
|
+
//# sourceMappingURL=isMigrationValue.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isMigrationValue.cjs","sources":["
|
|
1
|
+
{"version":3,"file":"isMigrationValue.cjs","names":["PrismicMigrationDocument","LinkType","PrismicMigrationAsset","RichTextNodeType"],"sources":["../../src/lib/isMigrationValue.ts"],"sourcesContent":["import type {\n\tMigrationImage,\n\tMigrationLinkToMedia,\n\tMigrationRTImageNode,\n} from \"../types/migration/Asset\"\nimport { PrismicMigrationAsset } from \"../types/migration/Asset\"\nimport type { MigrationContentRelationship } from \"../types/migration/ContentRelationship\"\nimport {\n\ttype InjectMigrationSpecificTypes,\n\tPrismicMigrationDocument,\n} from \"../types/migration/Document\"\nimport type { PrismicDocument } from \"../types/value/document\"\nimport type { GroupField } from \"../types/value/group\"\nimport { LinkType } from \"../types/value/link\"\nimport type { OptionalLinkProperties } from \"../types/value/link\"\nimport { RichTextNodeType } from \"../types/value/richText\"\nimport type { SliceZone } from \"../types/value/sliceZone\"\nimport type { AnyRegularField } from \"../types/value/types\"\n\nimport * as is from \"./isValue\"\n\n/**\n * Unknown value to check if it's a specific field type.\n *\n * @remarks\n * Explicit types are added to help ensure narrowing is done effectively.\n */\ntype UnknownValue =\n\t| PrismicDocument\n\t| InjectMigrationSpecificTypes<AnyRegularField | GroupField | SliceZone>\n\t| unknown\n\n/**\n * Checks if a value is a migration content relationship field.\n *\n * @remarks\n * `OptionalLinkProperties` is included because `MigrationContentRelationship`\n * may be a link field, not strictly a content relationship field.\n *\n * @param value - Value to check.\n *\n * @returns `true` if `value` is a migration content relationship field, `false`\n * otherwise.\n *\n * @internal\n * This is not an official helper function and it's only designed to work with internal processes.\n */\nexport const contentRelationship = (\n\tvalue: UnknownValue,\n): value is MigrationContentRelationship & OptionalLinkProperties => {\n\treturn (\n\t\tvalue instanceof PrismicMigrationDocument ||\n\t\tis.prismicDocument(value) ||\n\t\t(typeof value === \"object\" &&\n\t\t\tvalue !== null &&\n\t\t\t\"link_type\" in value &&\n\t\t\tvalue.link_type === LinkType.Document &&\n\t\t\t\"id\" in value &&\n\t\t\t(contentRelationship(value.id) || typeof value.id === \"function\"))\n\t)\n}\n\n/**\n * Checks if a value is a migration image field.\n *\n * @param value - Value to check.\n *\n * @returns `true` if `value` is a migration image field, `false` otherwise.\n *\n * @internal\n * This is not an official helper function and it's only designed to work with internal processes.\n */\nexport const image = (value: UnknownValue): value is MigrationImage => {\n\treturn (\n\t\tvalue instanceof PrismicMigrationAsset ||\n\t\t(typeof value === \"object\" &&\n\t\t\tvalue !== null &&\n\t\t\t\"id\" in value &&\n\t\t\tObject.values(value).every(\n\t\t\t\t(maybeThumbnail) => maybeThumbnail instanceof PrismicMigrationAsset,\n\t\t\t))\n\t)\n}\n\n/**\n * Checks if a value is a migration link to media field.\n *\n * - @remarks `OptionalLinkProperties` is included because\n * `MigrationContentRelationship` may be a link field, not strictly a content\n * relationship field.\n *\n * @param value - Value to check.\n *\n * @returns `true` if `value` is a migration link to media field, `false`\n * otherwise.\n *\n * @internal\n * This is not an official helper function and it's only designed to work with internal processes.\n */\nexport const linkToMedia = (\n\tvalue: UnknownValue,\n): value is MigrationLinkToMedia & OptionalLinkProperties => {\n\treturn (\n\t\ttypeof value === \"object\" &&\n\t\tvalue !== null &&\n\t\t\"id\" in value &&\n\t\tvalue.id instanceof PrismicMigrationAsset &&\n\t\t\"link_type\" in value &&\n\t\tvalue.link_type === LinkType.Media\n\t)\n}\n\n/**\n * Checks if a value is a migration rich text image node.\n *\n * @param value - Value to check.\n *\n * @returns `true` if `value` is a migration rich text image node, `false`\n * otherwise.\n *\n * @internal\n * This is not an official helper function and it's only designed to work with internal processes.\n */\nexport const rtImageNode = (\n\tvalue: UnknownValue,\n): value is MigrationRTImageNode => {\n\treturn (\n\t\ttypeof value === \"object\" &&\n\t\tvalue !== null &&\n\t\t\"id\" in value &&\n\t\tvalue.id instanceof PrismicMigrationAsset &&\n\t\t\"type\" in value &&\n\t\tvalue.type === RichTextNodeType.image\n\t)\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AA+CA,MAAa,uBACZ,UACoE;AACpE,QACC,iBAAiBA,6EACE,MAAM,IACxB,OAAO,UAAU,YACjB,UAAU,QACV,eAAe,SACf,MAAM,cAAcC,sBAAS,YAC7B,QAAQ,UACP,oBAAoB,MAAM,GAAG,IAAI,OAAO,MAAM,OAAO;;;;;;;;;;;;AAczD,MAAa,SAAS,UAAiD;AACtE,QACC,iBAAiBC,uCAChB,OAAO,UAAU,YACjB,UAAU,QACV,QAAQ,SACR,OAAO,OAAO,MAAM,CAAC,OACnB,mBAAmB,0BAA0BA,oCAC9C;;;;;;;;;;;;;;;;;AAmBJ,MAAa,eACZ,UAC4D;AAC5D,QACC,OAAO,UAAU,YACjB,UAAU,QACV,QAAQ,SACR,MAAM,cAAcA,uCACpB,eAAe,SACf,MAAM,cAAcD,sBAAS;;;;;;;;;;;;;AAe/B,MAAa,eACZ,UACmC;AACnC,QACC,OAAO,UAAU,YACjB,UAAU,QACV,QAAQ,SACR,MAAM,cAAcC,uCACpB,UAAU,SACV,MAAM,SAASC,kCAAiB"}
|
|
@@ -1,24 +1,74 @@
|
|
|
1
|
+
import { RichTextNodeType } from "../types/value/richText.js";
|
|
2
|
+
import { LinkType } from "../types/value/link.js";
|
|
1
3
|
import { PrismicMigrationAsset } from "../types/migration/Asset.js";
|
|
2
4
|
import { PrismicMigrationDocument } from "../types/migration/Document.js";
|
|
3
|
-
import { LinkType } from "../types/value/link.js";
|
|
4
|
-
import { RichTextNodeType } from "../types/value/richText.js";
|
|
5
5
|
import { prismicDocument } from "./isValue.js";
|
|
6
|
+
|
|
7
|
+
//#region src/lib/isMigrationValue.ts
|
|
8
|
+
/**
|
|
9
|
+
* Checks if a value is a migration content relationship field.
|
|
10
|
+
*
|
|
11
|
+
* @remarks
|
|
12
|
+
* `OptionalLinkProperties` is included because `MigrationContentRelationship`
|
|
13
|
+
* may be a link field, not strictly a content relationship field.
|
|
14
|
+
*
|
|
15
|
+
* @param value - Value to check.
|
|
16
|
+
*
|
|
17
|
+
* @returns `true` if `value` is a migration content relationship field, `false`
|
|
18
|
+
* otherwise.
|
|
19
|
+
*
|
|
20
|
+
* @internal
|
|
21
|
+
* This is not an official helper function and it's only designed to work with internal processes.
|
|
22
|
+
*/
|
|
6
23
|
const contentRelationship = (value) => {
|
|
7
|
-
|
|
24
|
+
return value instanceof PrismicMigrationDocument || prismicDocument(value) || typeof value === "object" && value !== null && "link_type" in value && value.link_type === LinkType.Document && "id" in value && (contentRelationship(value.id) || typeof value.id === "function");
|
|
8
25
|
};
|
|
26
|
+
/**
|
|
27
|
+
* Checks if a value is a migration image field.
|
|
28
|
+
*
|
|
29
|
+
* @param value - Value to check.
|
|
30
|
+
*
|
|
31
|
+
* @returns `true` if `value` is a migration image field, `false` otherwise.
|
|
32
|
+
*
|
|
33
|
+
* @internal
|
|
34
|
+
* This is not an official helper function and it's only designed to work with internal processes.
|
|
35
|
+
*/
|
|
9
36
|
const image = (value) => {
|
|
10
|
-
|
|
37
|
+
return value instanceof PrismicMigrationAsset || typeof value === "object" && value !== null && "id" in value && Object.values(value).every((maybeThumbnail) => maybeThumbnail instanceof PrismicMigrationAsset);
|
|
11
38
|
};
|
|
39
|
+
/**
|
|
40
|
+
* Checks if a value is a migration link to media field.
|
|
41
|
+
*
|
|
42
|
+
* - @remarks `OptionalLinkProperties` is included because
|
|
43
|
+
* `MigrationContentRelationship` may be a link field, not strictly a content
|
|
44
|
+
* relationship field.
|
|
45
|
+
*
|
|
46
|
+
* @param value - Value to check.
|
|
47
|
+
*
|
|
48
|
+
* @returns `true` if `value` is a migration link to media field, `false`
|
|
49
|
+
* otherwise.
|
|
50
|
+
*
|
|
51
|
+
* @internal
|
|
52
|
+
* This is not an official helper function and it's only designed to work with internal processes.
|
|
53
|
+
*/
|
|
12
54
|
const linkToMedia = (value) => {
|
|
13
|
-
|
|
55
|
+
return typeof value === "object" && value !== null && "id" in value && value.id instanceof PrismicMigrationAsset && "link_type" in value && value.link_type === LinkType.Media;
|
|
14
56
|
};
|
|
57
|
+
/**
|
|
58
|
+
* Checks if a value is a migration rich text image node.
|
|
59
|
+
*
|
|
60
|
+
* @param value - Value to check.
|
|
61
|
+
*
|
|
62
|
+
* @returns `true` if `value` is a migration rich text image node, `false`
|
|
63
|
+
* otherwise.
|
|
64
|
+
*
|
|
65
|
+
* @internal
|
|
66
|
+
* This is not an official helper function and it's only designed to work with internal processes.
|
|
67
|
+
*/
|
|
15
68
|
const rtImageNode = (value) => {
|
|
16
|
-
|
|
17
|
-
};
|
|
18
|
-
export {
|
|
19
|
-
contentRelationship,
|
|
20
|
-
image,
|
|
21
|
-
linkToMedia,
|
|
22
|
-
rtImageNode
|
|
69
|
+
return typeof value === "object" && value !== null && "id" in value && value.id instanceof PrismicMigrationAsset && "type" in value && value.type === RichTextNodeType.image;
|
|
23
70
|
};
|
|
24
|
-
|
|
71
|
+
|
|
72
|
+
//#endregion
|
|
73
|
+
export { contentRelationship, image, linkToMedia, rtImageNode };
|
|
74
|
+
//# sourceMappingURL=isMigrationValue.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isMigrationValue.js","sources":["
|
|
1
|
+
{"version":3,"file":"isMigrationValue.js","names":["is.prismicDocument"],"sources":["../../src/lib/isMigrationValue.ts"],"sourcesContent":["import type {\n\tMigrationImage,\n\tMigrationLinkToMedia,\n\tMigrationRTImageNode,\n} from \"../types/migration/Asset\"\nimport { PrismicMigrationAsset } from \"../types/migration/Asset\"\nimport type { MigrationContentRelationship } from \"../types/migration/ContentRelationship\"\nimport {\n\ttype InjectMigrationSpecificTypes,\n\tPrismicMigrationDocument,\n} from \"../types/migration/Document\"\nimport type { PrismicDocument } from \"../types/value/document\"\nimport type { GroupField } from \"../types/value/group\"\nimport { LinkType } from \"../types/value/link\"\nimport type { OptionalLinkProperties } from \"../types/value/link\"\nimport { RichTextNodeType } from \"../types/value/richText\"\nimport type { SliceZone } from \"../types/value/sliceZone\"\nimport type { AnyRegularField } from \"../types/value/types\"\n\nimport * as is from \"./isValue\"\n\n/**\n * Unknown value to check if it's a specific field type.\n *\n * @remarks\n * Explicit types are added to help ensure narrowing is done effectively.\n */\ntype UnknownValue =\n\t| PrismicDocument\n\t| InjectMigrationSpecificTypes<AnyRegularField | GroupField | SliceZone>\n\t| unknown\n\n/**\n * Checks if a value is a migration content relationship field.\n *\n * @remarks\n * `OptionalLinkProperties` is included because `MigrationContentRelationship`\n * may be a link field, not strictly a content relationship field.\n *\n * @param value - Value to check.\n *\n * @returns `true` if `value` is a migration content relationship field, `false`\n * otherwise.\n *\n * @internal\n * This is not an official helper function and it's only designed to work with internal processes.\n */\nexport const contentRelationship = (\n\tvalue: UnknownValue,\n): value is MigrationContentRelationship & OptionalLinkProperties => {\n\treturn (\n\t\tvalue instanceof PrismicMigrationDocument ||\n\t\tis.prismicDocument(value) ||\n\t\t(typeof value === \"object\" &&\n\t\t\tvalue !== null &&\n\t\t\t\"link_type\" in value &&\n\t\t\tvalue.link_type === LinkType.Document &&\n\t\t\t\"id\" in value &&\n\t\t\t(contentRelationship(value.id) || typeof value.id === \"function\"))\n\t)\n}\n\n/**\n * Checks if a value is a migration image field.\n *\n * @param value - Value to check.\n *\n * @returns `true` if `value` is a migration image field, `false` otherwise.\n *\n * @internal\n * This is not an official helper function and it's only designed to work with internal processes.\n */\nexport const image = (value: UnknownValue): value is MigrationImage => {\n\treturn (\n\t\tvalue instanceof PrismicMigrationAsset ||\n\t\t(typeof value === \"object\" &&\n\t\t\tvalue !== null &&\n\t\t\t\"id\" in value &&\n\t\t\tObject.values(value).every(\n\t\t\t\t(maybeThumbnail) => maybeThumbnail instanceof PrismicMigrationAsset,\n\t\t\t))\n\t)\n}\n\n/**\n * Checks if a value is a migration link to media field.\n *\n * - @remarks `OptionalLinkProperties` is included because\n * `MigrationContentRelationship` may be a link field, not strictly a content\n * relationship field.\n *\n * @param value - Value to check.\n *\n * @returns `true` if `value` is a migration link to media field, `false`\n * otherwise.\n *\n * @internal\n * This is not an official helper function and it's only designed to work with internal processes.\n */\nexport const linkToMedia = (\n\tvalue: UnknownValue,\n): value is MigrationLinkToMedia & OptionalLinkProperties => {\n\treturn (\n\t\ttypeof value === \"object\" &&\n\t\tvalue !== null &&\n\t\t\"id\" in value &&\n\t\tvalue.id instanceof PrismicMigrationAsset &&\n\t\t\"link_type\" in value &&\n\t\tvalue.link_type === LinkType.Media\n\t)\n}\n\n/**\n * Checks if a value is a migration rich text image node.\n *\n * @param value - Value to check.\n *\n * @returns `true` if `value` is a migration rich text image node, `false`\n * otherwise.\n *\n * @internal\n * This is not an official helper function and it's only designed to work with internal processes.\n */\nexport const rtImageNode = (\n\tvalue: UnknownValue,\n): value is MigrationRTImageNode => {\n\treturn (\n\t\ttypeof value === \"object\" &&\n\t\tvalue !== null &&\n\t\t\"id\" in value &&\n\t\tvalue.id instanceof PrismicMigrationAsset &&\n\t\t\"type\" in value &&\n\t\tvalue.type === RichTextNodeType.image\n\t)\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AA+CA,MAAa,uBACZ,UACoE;AACpE,QACC,iBAAiB,4BACjBA,gBAAmB,MAAM,IACxB,OAAO,UAAU,YACjB,UAAU,QACV,eAAe,SACf,MAAM,cAAc,SAAS,YAC7B,QAAQ,UACP,oBAAoB,MAAM,GAAG,IAAI,OAAO,MAAM,OAAO;;;;;;;;;;;;AAczD,MAAa,SAAS,UAAiD;AACtE,QACC,iBAAiB,yBAChB,OAAO,UAAU,YACjB,UAAU,QACV,QAAQ,SACR,OAAO,OAAO,MAAM,CAAC,OACnB,mBAAmB,0BAA0B,sBAC9C;;;;;;;;;;;;;;;;;AAmBJ,MAAa,eACZ,UAC4D;AAC5D,QACC,OAAO,UAAU,YACjB,UAAU,QACV,QAAQ,SACR,MAAM,cAAc,yBACpB,eAAe,SACf,MAAM,cAAc,SAAS;;;;;;;;;;;;;AAe/B,MAAa,eACZ,UACmC;AACnC,QACC,OAAO,UAAU,YACjB,UAAU,QACV,QAAQ,SACR,MAAM,cAAc,yBACpB,UAAU,SACV,MAAM,SAAS,iBAAiB"}
|
package/dist/lib/isValue.cjs
CHANGED
|
@@ -1,53 +1,110 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
const require_richText = require('../types/value/richText.cjs');
|
|
2
|
+
const require_link = require('../types/value/link.cjs');
|
|
3
|
+
|
|
4
|
+
//#region src/lib/isValue.ts
|
|
5
|
+
/**
|
|
6
|
+
* Checks if a value is a link to media field.
|
|
7
|
+
*
|
|
8
|
+
* @param value - Value to check.
|
|
9
|
+
*
|
|
10
|
+
* @returns `true` if `value` is a link to media field, `false` otherwise.
|
|
11
|
+
*
|
|
12
|
+
* @internal
|
|
13
|
+
* This is not an official helper function and it's only designed to work with internal processes.
|
|
14
|
+
*/
|
|
5
15
|
const filledLinkToMedia = (value) => {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
11
|
-
return false;
|
|
16
|
+
if (value && typeof value === "object" && !("version" in value)) {
|
|
17
|
+
if ("link_type" in value && value.link_type === require_link.LinkType.Media && "id" in value && "name" in value && "kind" in value && "url" in value && "size" in value) return true;
|
|
18
|
+
}
|
|
19
|
+
return false;
|
|
12
20
|
};
|
|
21
|
+
/**
|
|
22
|
+
* Checks if a value is like an image field.
|
|
23
|
+
*
|
|
24
|
+
* @param value - Value to check.
|
|
25
|
+
*
|
|
26
|
+
* @returns `true` if `value` is like an image field, `false` otherwise.
|
|
27
|
+
*
|
|
28
|
+
* @internal
|
|
29
|
+
* This is not an official helper function and it's only designed to work with internal processes.
|
|
30
|
+
*/
|
|
13
31
|
const imageLike = (value) => {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
19
|
-
return false;
|
|
32
|
+
if (value && typeof value === "object" && (!("version" in value) || typeof value.version === "object")) {
|
|
33
|
+
if ("id" in value && "url" in value && typeof value.url === "string" && "dimensions" in value && "edit" in value && "alt" in value && "copyright" in value) return true;
|
|
34
|
+
}
|
|
35
|
+
return false;
|
|
20
36
|
};
|
|
37
|
+
/**
|
|
38
|
+
* Checks if a value is an image field.
|
|
39
|
+
*
|
|
40
|
+
* @param value - Value to check.
|
|
41
|
+
*
|
|
42
|
+
* @returns `true` if `value` is an image field, `false` otherwise.
|
|
43
|
+
*
|
|
44
|
+
* @internal
|
|
45
|
+
* This is not an official helper function and it's only designed to work with internal processes.
|
|
46
|
+
*/
|
|
21
47
|
const filledImage = (value) => {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}
|
|
25
|
-
return false;
|
|
48
|
+
if (imageLike(value) && (!("type" in value) || value.type !== require_richText.RichTextNodeType.image)) return true;
|
|
49
|
+
return false;
|
|
26
50
|
};
|
|
51
|
+
/**
|
|
52
|
+
* Checks if a value is a rich text image node.
|
|
53
|
+
*
|
|
54
|
+
* @param value - Value to check.
|
|
55
|
+
*
|
|
56
|
+
* @returns `true` if `value` is a rich text image node, `false` otherwise.
|
|
57
|
+
*
|
|
58
|
+
* @internal
|
|
59
|
+
* This is not an official helper function and it's only designed to work with internal processes.
|
|
60
|
+
*/
|
|
27
61
|
const rtImageNode = (value) => {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
}
|
|
31
|
-
return false;
|
|
62
|
+
if (imageLike(value) && "type" in value && value.type === require_richText.RichTextNodeType.image) return true;
|
|
63
|
+
return false;
|
|
32
64
|
};
|
|
65
|
+
/**
|
|
66
|
+
* Checks if a value is a content relationship field.
|
|
67
|
+
*
|
|
68
|
+
* @remarks
|
|
69
|
+
* The return value includes `OptionalLinkProperties` because
|
|
70
|
+
* `FilledContentRelationshipField` may be a link field, not strictly a content
|
|
71
|
+
* relationship field.
|
|
72
|
+
*
|
|
73
|
+
* @param value - Value to check.
|
|
74
|
+
*
|
|
75
|
+
* @returns `true` if `value` is a content relationship, `false` otherwise.
|
|
76
|
+
*
|
|
77
|
+
* @internal
|
|
78
|
+
* This is not an official helper function and it's only designed to work with internal processes.
|
|
79
|
+
*/
|
|
33
80
|
const filledContentRelationship = (value) => {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}
|
|
39
|
-
return false;
|
|
81
|
+
if (value && typeof value === "object" && !("version" in value)) {
|
|
82
|
+
if ("link_type" in value && value.link_type === require_link.LinkType.Document && "id" in value && "type" in value && "tags" in value && "lang" in value) return true;
|
|
83
|
+
}
|
|
84
|
+
return false;
|
|
40
85
|
};
|
|
86
|
+
/**
|
|
87
|
+
* Checks if a value is a Prismic document.
|
|
88
|
+
*
|
|
89
|
+
* @param value - Value to check.
|
|
90
|
+
*
|
|
91
|
+
* @returns `true` if `value` is a Prismic document, `false` otherwise.
|
|
92
|
+
*
|
|
93
|
+
* @internal
|
|
94
|
+
* This is not an official helper function and it's only designed to work with internal processes.
|
|
95
|
+
*/
|
|
41
96
|
const prismicDocument = (value) => {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
97
|
+
try {
|
|
98
|
+
return typeof value === "object" && value !== null && "id" in value && "href" in value && typeof value.href === "string" && new URL(value.href) && "type" in value && "lang" in value && "tags" in value && Array.isArray(value.tags);
|
|
99
|
+
} catch {
|
|
100
|
+
return false;
|
|
101
|
+
}
|
|
47
102
|
};
|
|
103
|
+
|
|
104
|
+
//#endregion
|
|
48
105
|
exports.filledContentRelationship = filledContentRelationship;
|
|
49
106
|
exports.filledImage = filledImage;
|
|
50
107
|
exports.filledLinkToMedia = filledLinkToMedia;
|
|
51
108
|
exports.prismicDocument = prismicDocument;
|
|
52
109
|
exports.rtImageNode = rtImageNode;
|
|
53
|
-
//# sourceMappingURL=isValue.cjs.map
|
|
110
|
+
//# sourceMappingURL=isValue.cjs.map
|
package/dist/lib/isValue.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isValue.cjs","sources":["
|
|
1
|
+
{"version":3,"file":"isValue.cjs","names":["LinkType","RichTextNodeType"],"sources":["../../src/lib/isValue.ts"],"sourcesContent":["import type { InjectMigrationSpecificTypes } from \"../types/migration/Document\"\nimport type { FilledContentRelationshipField } from \"../types/value/contentRelationship\"\nimport type { PrismicDocument } from \"../types/value/document\"\nimport type { GroupField } from \"../types/value/group\"\nimport type { ImageField } from \"../types/value/image\"\nimport { LinkType } from \"../types/value/link\"\nimport type { OptionalLinkProperties } from \"../types/value/link\"\nimport type { FilledLinkToMediaField } from \"../types/value/linkToMedia\"\nimport { type RTImageNode, RichTextNodeType } from \"../types/value/richText\"\nimport type { SliceZone } from \"../types/value/sliceZone\"\nimport type { AnyRegularField } from \"../types/value/types\"\n\n/**\n * Unknown value to check if it's a specific field type.\n *\n * @remarks\n * Explicit types are added to help ensure narrowing is done effectively.\n */\ntype UnknownValue =\n\t| PrismicDocument\n\t| InjectMigrationSpecificTypes<AnyRegularField | GroupField | SliceZone>\n\t| unknown\n\n/**\n * Checks if a value is a link to media field.\n *\n * @param value - Value to check.\n *\n * @returns `true` if `value` is a link to media field, `false` otherwise.\n *\n * @internal\n * This is not an official helper function and it's only designed to work with internal processes.\n */\nexport const filledLinkToMedia = (\n\tvalue: UnknownValue,\n): value is FilledLinkToMediaField => {\n\tif (value && typeof value === \"object\" && !(\"version\" in value)) {\n\t\tif (\n\t\t\t\"link_type\" in value &&\n\t\t\tvalue.link_type === LinkType.Media &&\n\t\t\t\"id\" in value &&\n\t\t\t\"name\" in value &&\n\t\t\t\"kind\" in value &&\n\t\t\t\"url\" in value &&\n\t\t\t\"size\" in value\n\t\t) {\n\t\t\treturn true\n\t\t}\n\t}\n\n\treturn false\n}\n\n/**\n * Checks if a value is like an image field.\n *\n * @param value - Value to check.\n *\n * @returns `true` if `value` is like an image field, `false` otherwise.\n *\n * @internal\n * This is not an official helper function and it's only designed to work with internal processes.\n */\nconst imageLike = (\n\tvalue: UnknownValue,\n): value is ImageField<string, \"filled\"> | RTImageNode => {\n\tif (\n\t\tvalue &&\n\t\ttypeof value === \"object\" &&\n\t\t(!(\"version\" in value) || typeof value.version === \"object\")\n\t) {\n\t\tif (\n\t\t\t\"id\" in value &&\n\t\t\t\"url\" in value &&\n\t\t\ttypeof value.url === \"string\" &&\n\t\t\t\"dimensions\" in value &&\n\t\t\t\"edit\" in value &&\n\t\t\t\"alt\" in value &&\n\t\t\t\"copyright\" in value\n\t\t) {\n\t\t\treturn true\n\t\t}\n\t}\n\n\treturn false\n}\n\n/**\n * Checks if a value is an image field.\n *\n * @param value - Value to check.\n *\n * @returns `true` if `value` is an image field, `false` otherwise.\n *\n * @internal\n * This is not an official helper function and it's only designed to work with internal processes.\n */\nexport const filledImage = (\n\tvalue: UnknownValue,\n): value is ImageField<string, \"filled\"> => {\n\tif (\n\t\timageLike(value) &&\n\t\t(!(\"type\" in value) || value.type !== RichTextNodeType.image)\n\t) {\n\t\treturn true\n\t}\n\n\treturn false\n}\n\n/**\n * Checks if a value is a rich text image node.\n *\n * @param value - Value to check.\n *\n * @returns `true` if `value` is a rich text image node, `false` otherwise.\n *\n * @internal\n * This is not an official helper function and it's only designed to work with internal processes.\n */\nexport const rtImageNode = (value: UnknownValue): value is RTImageNode => {\n\tif (\n\t\timageLike(value) &&\n\t\t\"type\" in value &&\n\t\tvalue.type === RichTextNodeType.image\n\t) {\n\t\treturn true\n\t}\n\n\treturn false\n}\n\n/**\n * Checks if a value is a content relationship field.\n *\n * @remarks\n * The return value includes `OptionalLinkProperties` because\n * `FilledContentRelationshipField` may be a link field, not strictly a content\n * relationship field.\n *\n * @param value - Value to check.\n *\n * @returns `true` if `value` is a content relationship, `false` otherwise.\n *\n * @internal\n * This is not an official helper function and it's only designed to work with internal processes.\n */\nexport const filledContentRelationship = (\n\tvalue: UnknownValue,\n): value is FilledContentRelationshipField & OptionalLinkProperties => {\n\tif (value && typeof value === \"object\" && !(\"version\" in value)) {\n\t\tif (\n\t\t\t\"link_type\" in value &&\n\t\t\tvalue.link_type === LinkType.Document &&\n\t\t\t\"id\" in value &&\n\t\t\t\"type\" in value &&\n\t\t\t\"tags\" in value &&\n\t\t\t\"lang\" in value\n\t\t) {\n\t\t\treturn true\n\t\t}\n\t}\n\n\treturn false\n}\n\n/**\n * Checks if a value is a Prismic document.\n *\n * @param value - Value to check.\n *\n * @returns `true` if `value` is a Prismic document, `false` otherwise.\n *\n * @internal\n * This is not an official helper function and it's only designed to work with internal processes.\n */\nexport const prismicDocument = (\n\tvalue: UnknownValue,\n): value is PrismicDocument => {\n\ttry {\n\t\treturn (\n\t\t\ttypeof value === \"object\" &&\n\t\t\tvalue !== null &&\n\t\t\t\"id\" in value &&\n\t\t\t\"href\" in value &&\n\t\t\ttypeof value.href === \"string\" &&\n\t\t\tnew URL(value.href) &&\n\t\t\t\"type\" in value &&\n\t\t\t\"lang\" in value &&\n\t\t\t\"tags\" in value &&\n\t\t\tArray.isArray(value.tags)\n\t\t)\n\t} catch {\n\t\treturn false\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;AAiCA,MAAa,qBACZ,UACqC;AACrC,KAAI,SAAS,OAAO,UAAU,YAAY,EAAE,aAAa,QACxD;MACC,eAAe,SACf,MAAM,cAAcA,sBAAS,SAC7B,QAAQ,SACR,UAAU,SACV,UAAU,SACV,SAAS,SACT,UAAU,MAEV,QAAO;;AAIT,QAAO;;;;;;;;;;;;AAaR,MAAM,aACL,UACyD;AACzD,KACC,SACA,OAAO,UAAU,aAChB,EAAE,aAAa,UAAU,OAAO,MAAM,YAAY,WAEnD;MACC,QAAQ,SACR,SAAS,SACT,OAAO,MAAM,QAAQ,YACrB,gBAAgB,SAChB,UAAU,SACV,SAAS,SACT,eAAe,MAEf,QAAO;;AAIT,QAAO;;;;;;;;;;;;AAaR,MAAa,eACZ,UAC2C;AAC3C,KACC,UAAU,MAAM,KACf,EAAE,UAAU,UAAU,MAAM,SAASC,kCAAiB,OAEvD,QAAO;AAGR,QAAO;;;;;;;;;;;;AAaR,MAAa,eAAe,UAA8C;AACzE,KACC,UAAU,MAAM,IAChB,UAAU,SACV,MAAM,SAASA,kCAAiB,MAEhC,QAAO;AAGR,QAAO;;;;;;;;;;;;;;;;;AAkBR,MAAa,6BACZ,UACsE;AACtE,KAAI,SAAS,OAAO,UAAU,YAAY,EAAE,aAAa,QACxD;MACC,eAAe,SACf,MAAM,cAAcD,sBAAS,YAC7B,QAAQ,SACR,UAAU,SACV,UAAU,SACV,UAAU,MAEV,QAAO;;AAIT,QAAO;;;;;;;;;;;;AAaR,MAAa,mBACZ,UAC8B;AAC9B,KAAI;AACH,SACC,OAAO,UAAU,YACjB,UAAU,QACV,QAAQ,SACR,UAAU,SACV,OAAO,MAAM,SAAS,YACtB,IAAI,IAAI,MAAM,KAAK,IACnB,UAAU,SACV,UAAU,SACV,UAAU,SACV,MAAM,QAAQ,MAAM,KAAK;SAEnB;AACP,SAAO"}
|