@se-studio/contentful-rest-api 1.0.45 → 1.0.47
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/CHANGELOG.md +416 -0
- package/dist/api/article-type.d.ts +37 -0
- package/dist/api/article-type.d.ts.map +1 -0
- package/dist/api/article-type.js +134 -0
- package/dist/api/article-type.js.map +1 -0
- package/dist/api/article.d.ts +32 -0
- package/dist/api/article.d.ts.map +1 -0
- package/dist/api/article.js +43 -0
- package/dist/api/article.js.map +1 -0
- package/dist/api/asset.d.ts +28 -0
- package/dist/api/asset.d.ts.map +1 -0
- package/dist/api/asset.js +55 -0
- package/dist/api/asset.js.map +1 -0
- package/dist/api/context.d.ts +24 -0
- package/dist/api/context.d.ts.map +1 -0
- package/dist/api/context.js +62 -0
- package/dist/api/context.js.map +1 -0
- package/dist/api/custom-type.d.ts +37 -0
- package/dist/api/custom-type.d.ts.map +1 -0
- package/dist/api/custom-type.js +44 -0
- package/dist/api/custom-type.js.map +1 -0
- package/dist/api/helpers.d.ts +73 -0
- package/dist/api/helpers.d.ts.map +1 -0
- package/dist/api/helpers.js +296 -0
- package/dist/api/helpers.js.map +1 -0
- package/dist/api/index.d.ts +22 -0
- package/dist/api/index.d.ts.map +1 -0
- package/dist/api/index.js +28 -0
- package/dist/api/index.js.map +1 -0
- package/dist/api/links.d.ts +109 -0
- package/dist/api/links.d.ts.map +1 -0
- package/dist/api/links.js +199 -0
- package/dist/api/links.js.map +1 -0
- package/dist/api/page.d.ts +33 -0
- package/dist/api/page.d.ts.map +1 -0
- package/dist/api/page.js +40 -0
- package/dist/api/page.js.map +1 -0
- package/dist/api/person.d.ts +37 -0
- package/dist/api/person.d.ts.map +1 -0
- package/dist/api/person.js +134 -0
- package/dist/api/person.js.map +1 -0
- package/dist/api/preview.d.ts +55 -0
- package/dist/api/preview.d.ts.map +1 -0
- package/dist/api/preview.js +160 -0
- package/dist/api/preview.js.map +1 -0
- package/dist/api/related-articles.d.ts +22 -0
- package/dist/api/related-articles.d.ts.map +1 -0
- package/dist/api/related-articles.js +82 -0
- package/dist/api/related-articles.js.map +1 -0
- package/dist/api/server-asset.d.ts +40 -0
- package/dist/api/server-asset.d.ts.map +1 -0
- package/dist/api/server-asset.js +65 -0
- package/dist/api/server-asset.js.map +1 -0
- package/dist/api/sitemap.d.ts +131 -0
- package/dist/api/sitemap.d.ts.map +1 -0
- package/dist/api/sitemap.js +199 -0
- package/dist/api/sitemap.js.map +1 -0
- package/dist/api/tag.d.ts +37 -0
- package/dist/api/tag.d.ts.map +1 -0
- package/dist/api/tag.js +131 -0
- package/dist/api/tag.js.map +1 -0
- package/dist/api/template.d.ts +49 -0
- package/dist/api/template.d.ts.map +1 -0
- package/dist/api/template.js +88 -0
- package/dist/api/template.js.map +1 -0
- package/dist/api/types.d.ts +98 -0
- package/dist/api/types.d.ts.map +1 -0
- package/dist/api/types.js +2 -0
- package/dist/api/types.js.map +1 -0
- package/dist/baseTypes/baseAlternatePageContent.d.ts +24 -0
- package/dist/baseTypes/baseAlternatePageContent.d.ts.map +1 -0
- package/dist/baseTypes/baseAlternatePageContent.js +2 -0
- package/dist/baseTypes/baseAlternatePageContent.js.map +1 -0
- package/dist/baseTypes/baseArticle.d.ts +179 -0
- package/dist/baseTypes/baseArticle.d.ts.map +1 -0
- package/dist/baseTypes/baseArticle.js +2 -0
- package/dist/baseTypes/baseArticle.js.map +1 -0
- package/dist/baseTypes/baseArticleType.d.ts +156 -0
- package/dist/baseTypes/baseArticleType.d.ts.map +1 -0
- package/dist/baseTypes/baseArticleType.js +2 -0
- package/dist/baseTypes/baseArticleType.js.map +1 -0
- package/dist/baseTypes/baseBanner.d.ts +76 -0
- package/dist/baseTypes/baseBanner.d.ts.map +1 -0
- package/dist/baseTypes/baseBanner.js +2 -0
- package/dist/baseTypes/baseBanner.js.map +1 -0
- package/dist/baseTypes/baseCollection.d.ts +132 -0
- package/dist/baseTypes/baseCollection.d.ts.map +1 -0
- package/dist/baseTypes/baseCollection.js +2 -0
- package/dist/baseTypes/baseCollection.js.map +1 -0
- package/dist/baseTypes/baseComponent.d.ts +130 -0
- package/dist/baseTypes/baseComponent.d.ts.map +1 -0
- package/dist/baseTypes/baseComponent.js +2 -0
- package/dist/baseTypes/baseComponent.js.map +1 -0
- package/dist/baseTypes/baseCustomType.d.ts +126 -0
- package/dist/baseTypes/baseCustomType.d.ts.map +1 -0
- package/dist/baseTypes/baseCustomType.js +2 -0
- package/dist/baseTypes/baseCustomType.js.map +1 -0
- package/dist/baseTypes/baseExternalComponent.d.ts +66 -0
- package/dist/baseTypes/baseExternalComponent.d.ts.map +1 -0
- package/dist/baseTypes/baseExternalComponent.js +2 -0
- package/dist/baseTypes/baseExternalComponent.js.map +1 -0
- package/dist/baseTypes/baseExternalVideo.d.ts +85 -0
- package/dist/baseTypes/baseExternalVideo.d.ts.map +1 -0
- package/dist/baseTypes/baseExternalVideo.js +2 -0
- package/dist/baseTypes/baseExternalVideo.js.map +1 -0
- package/dist/baseTypes/baseLink.d.ts +90 -0
- package/dist/baseTypes/baseLink.d.ts.map +1 -0
- package/dist/baseTypes/baseLink.js +2 -0
- package/dist/baseTypes/baseLink.js.map +1 -0
- package/dist/baseTypes/baseMedia.d.ts +92 -0
- package/dist/baseTypes/baseMedia.d.ts.map +1 -0
- package/dist/baseTypes/baseMedia.js +2 -0
- package/dist/baseTypes/baseMedia.js.map +1 -0
- package/dist/baseTypes/baseNavigation.d.ts +36 -0
- package/dist/baseTypes/baseNavigation.d.ts.map +1 -0
- package/dist/baseTypes/baseNavigation.js +2 -0
- package/dist/baseTypes/baseNavigation.js.map +1 -0
- package/dist/baseTypes/baseNavigationItem.d.ts +96 -0
- package/dist/baseTypes/baseNavigationItem.d.ts.map +1 -0
- package/dist/baseTypes/baseNavigationItem.js +2 -0
- package/dist/baseTypes/baseNavigationItem.js.map +1 -0
- package/dist/baseTypes/basePage.d.ts +120 -0
- package/dist/baseTypes/basePage.d.ts.map +1 -0
- package/dist/baseTypes/basePage.js +2 -0
- package/dist/baseTypes/basePage.js.map +1 -0
- package/dist/baseTypes/basePageTest.d.ts +66 -0
- package/dist/baseTypes/basePageTest.d.ts.map +1 -0
- package/dist/baseTypes/basePageTest.js +2 -0
- package/dist/baseTypes/basePageTest.js.map +1 -0
- package/dist/baseTypes/basePageVariant.d.ts +123 -0
- package/dist/baseTypes/basePageVariant.d.ts.map +1 -0
- package/dist/baseTypes/basePageVariant.js +2 -0
- package/dist/baseTypes/basePageVariant.js.map +1 -0
- package/dist/baseTypes/basePerson.d.ts +111 -0
- package/dist/baseTypes/basePerson.d.ts.map +1 -0
- package/dist/baseTypes/basePerson.js +2 -0
- package/dist/baseTypes/basePerson.js.map +1 -0
- package/dist/baseTypes/baseSchema.d.ts +18 -0
- package/dist/baseTypes/baseSchema.d.ts.map +1 -0
- package/dist/baseTypes/baseSchema.js +2 -0
- package/dist/baseTypes/baseSchema.js.map +1 -0
- package/dist/baseTypes/baseShared.d.ts +30 -0
- package/dist/baseTypes/baseShared.d.ts.map +1 -0
- package/dist/baseTypes/baseShared.js +2 -0
- package/dist/baseTypes/baseShared.js.map +1 -0
- package/dist/baseTypes/baseTag.d.ts +108 -0
- package/dist/baseTypes/baseTag.d.ts.map +1 -0
- package/dist/baseTypes/baseTag.js +2 -0
- package/dist/baseTypes/baseTag.js.map +1 -0
- package/dist/baseTypes/baseTagType.d.ts +11 -0
- package/dist/baseTypes/baseTagType.d.ts.map +1 -0
- package/dist/baseTypes/baseTagType.js +2 -0
- package/dist/baseTypes/baseTagType.js.map +1 -0
- package/dist/baseTypes/baseTemplate.d.ts +55 -0
- package/dist/baseTypes/baseTemplate.d.ts.map +1 -0
- package/dist/baseTypes/baseTemplate.js +2 -0
- package/dist/baseTypes/baseTemplate.js.map +1 -0
- package/dist/client.d.ts +143 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +268 -0
- package/dist/client.js.map +1 -0
- package/dist/converters/article.d.ts +42 -0
- package/dist/converters/article.d.ts.map +1 -0
- package/dist/converters/article.js +220 -0
- package/dist/converters/article.js.map +1 -0
- package/dist/converters/asset.d.ts +22 -0
- package/dist/converters/asset.d.ts.map +1 -0
- package/dist/converters/asset.js +282 -0
- package/dist/converters/asset.js.map +1 -0
- package/dist/converters/collection.d.ts +26 -0
- package/dist/converters/collection.d.ts.map +1 -0
- package/dist/converters/collection.js +50 -0
- package/dist/converters/collection.js.map +1 -0
- package/dist/converters/component.d.ts +26 -0
- package/dist/converters/component.d.ts.map +1 -0
- package/dist/converters/component.js +54 -0
- package/dist/converters/component.js.map +1 -0
- package/dist/converters/customType.d.ts +24 -0
- package/dist/converters/customType.d.ts.map +1 -0
- package/dist/converters/customType.js +71 -0
- package/dist/converters/customType.js.map +1 -0
- package/dist/converters/externalComponent.d.ts +22 -0
- package/dist/converters/externalComponent.d.ts.map +1 -0
- package/dist/converters/externalComponent.js +34 -0
- package/dist/converters/externalComponent.js.map +1 -0
- package/dist/converters/helpers.d.ts +116 -0
- package/dist/converters/helpers.d.ts.map +1 -0
- package/dist/converters/helpers.js +128 -0
- package/dist/converters/helpers.js.map +1 -0
- package/dist/converters/iconCollector.d.ts +65 -0
- package/dist/converters/iconCollector.d.ts.map +1 -0
- package/dist/converters/iconCollector.js +282 -0
- package/dist/converters/iconCollector.js.map +1 -0
- package/dist/converters/index.d.ts +18 -0
- package/dist/converters/index.d.ts.map +1 -0
- package/dist/converters/index.js +18 -0
- package/dist/converters/index.js.map +1 -0
- package/dist/converters/link.d.ts +11 -0
- package/dist/converters/link.d.ts.map +1 -0
- package/dist/converters/link.js +96 -0
- package/dist/converters/link.js.map +1 -0
- package/dist/converters/navigationItem.d.ts +11 -0
- package/dist/converters/navigationItem.d.ts.map +1 -0
- package/dist/converters/navigationItem.js +73 -0
- package/dist/converters/navigationItem.js.map +1 -0
- package/dist/converters/page.d.ts +44 -0
- package/dist/converters/page.d.ts.map +1 -0
- package/dist/converters/page.js +121 -0
- package/dist/converters/page.js.map +1 -0
- package/dist/converters/person.d.ts +40 -0
- package/dist/converters/person.d.ts.map +1 -0
- package/dist/converters/person.js +109 -0
- package/dist/converters/person.js.map +1 -0
- package/dist/converters/resolver.d.ts +29 -0
- package/dist/converters/resolver.d.ts.map +1 -0
- package/dist/converters/resolver.js +317 -0
- package/dist/converters/resolver.js.map +1 -0
- package/dist/converters/schema.d.ts +14 -0
- package/dist/converters/schema.d.ts.map +1 -0
- package/dist/converters/schema.js +18 -0
- package/dist/converters/schema.js.map +1 -0
- package/dist/converters/svgProcessor.d.ts +23 -0
- package/dist/converters/svgProcessor.d.ts.map +1 -0
- package/dist/converters/svgProcessor.js +47 -0
- package/dist/converters/svgProcessor.js.map +1 -0
- package/dist/converters/tag.d.ts +25 -0
- package/dist/converters/tag.d.ts.map +1 -0
- package/dist/converters/tag.js +98 -0
- package/dist/converters/tag.js.map +1 -0
- package/dist/converters/template.d.ts +26 -0
- package/dist/converters/template.d.ts.map +1 -0
- package/dist/converters/template.js +44 -0
- package/dist/converters/template.js.map +1 -0
- package/dist/index.d.ts +28 -718
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +37 -3602
- package/dist/index.js.map +1 -1
- package/dist/revalidation/handlers.d.ts +52 -0
- package/dist/revalidation/handlers.d.ts.map +1 -0
- package/dist/revalidation/handlers.js +130 -0
- package/dist/revalidation/handlers.js.map +1 -0
- package/dist/revalidation/index.d.ts +3 -0
- package/dist/revalidation/index.d.ts.map +1 -0
- package/dist/revalidation/index.js +4 -0
- package/dist/revalidation/index.js.map +1 -0
- package/dist/revalidation/nextjs-route.d.ts +31 -0
- package/dist/revalidation/nextjs-route.d.ts.map +1 -0
- package/dist/revalidation/nextjs-route.js +34 -0
- package/dist/revalidation/nextjs-route.js.map +1 -0
- package/dist/revalidation/route.d.ts +3 -0
- package/dist/revalidation/route.d.ts.map +1 -0
- package/dist/revalidation/route.js +97 -0
- package/dist/revalidation/route.js.map +1 -0
- package/dist/revalidation/server-utils.d.ts +22 -0
- package/dist/revalidation/server-utils.d.ts.map +1 -0
- package/dist/revalidation/server-utils.js +41 -0
- package/dist/revalidation/server-utils.js.map +1 -0
- package/dist/revalidation/tags.d.ts +81 -0
- package/dist/revalidation/tags.d.ts.map +1 -0
- package/dist/revalidation/tags.js +117 -0
- package/dist/revalidation/tags.js.map +1 -0
- package/dist/revalidation/utils.d.ts +21 -0
- package/dist/revalidation/utils.d.ts.map +1 -0
- package/dist/revalidation/utils.js +51 -0
- package/dist/revalidation/utils.js.map +1 -0
- package/dist/server.d.ts +7 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +10 -0
- package/dist/server.js.map +1 -0
- package/dist/types.d.ts +67 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/dist/utils/arrayUtils.d.ts +3 -0
- package/dist/utils/arrayUtils.d.ts.map +1 -0
- package/dist/utils/arrayUtils.js +12 -0
- package/dist/utils/arrayUtils.js.map +1 -0
- package/dist/utils/dateUtils.d.ts +9 -0
- package/dist/utils/dateUtils.d.ts.map +1 -0
- package/dist/utils/dateUtils.js +26 -0
- package/dist/utils/dateUtils.js.map +1 -0
- package/dist/utils/errors.d.ts +56 -0
- package/dist/utils/errors.d.ts.map +1 -0
- package/dist/utils/errors.js +100 -0
- package/dist/utils/errors.js.map +1 -0
- package/dist/utils/index.d.ts +8 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +8 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/json-utils.d.ts +17 -0
- package/dist/utils/json-utils.d.ts.map +1 -0
- package/dist/utils/json-utils.js +43 -0
- package/dist/utils/json-utils.js.map +1 -0
- package/dist/utils/retry.d.ts +112 -0
- package/dist/utils/retry.d.ts.map +1 -0
- package/dist/utils/retry.js +221 -0
- package/dist/utils/retry.js.map +1 -0
- package/package.json +12 -6
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"person.js","sourceRoot":"","sources":["../../src/api/person.ts"],"names":[],"mappings":"A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,EAAE,CAAC;YACf,MAAM,OAAO,GAAG,WAAW,EAAE,GAAG,CAAC,EAAE,IAAI,SAAS,CAAC;YACjD,MAAM,SAAS,GAAG,WAAW,EAAE,GAAG,CAAC,WAAW,EAAE,GAAG,EAAE,EAAE,CAAC;YACxD,MAAM,YAAY,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,0BAA0B,CAAC;YAEzF,MAAM,QAAQ,GAAa;gBACzB,OAAO;gBACP,SAAS;gBACT,OAAO,EAAE,YAAY;gBACrB,KAAK;aACN,CAAC;YAEF,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC5C,CAAC;IACH,CAAC,CAAC;IAEF,kCAAkC;IAClC,IAAI,OAAO,EAAE,KAAK,EAAE,CAAC;QACnB,OAAO,MAAM,SAAS,CAAC,OAAO,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC;IACjD,CAAC;IAED,OAAO,MAAM,OAAO,EAAE,CAAC;AACzB,CAAC"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Preview page utilities for Contentful
|
|
3
|
+
*
|
|
4
|
+
* Provides functionality to look up an entry by ID and calculate the
|
|
5
|
+
* appropriate URL for preview redirects.
|
|
6
|
+
*/
|
|
7
|
+
import type { BaseConverterContext } from '../converters/helpers';
|
|
8
|
+
import type { ContentfulConfig, FetchOptions } from '../types';
|
|
9
|
+
/**
|
|
10
|
+
* Supported content types for preview lookup
|
|
11
|
+
*/
|
|
12
|
+
export type PreviewContentType = 'page' | 'pageVariant' | 'article' | 'articleType' | 'tag' | 'person' | 'customType';
|
|
13
|
+
/**
|
|
14
|
+
* Information about an entry for preview purposes
|
|
15
|
+
*/
|
|
16
|
+
export interface PreviewEntryInfo {
|
|
17
|
+
/** The content type of the entry */
|
|
18
|
+
contentType: PreviewContentType;
|
|
19
|
+
/** The Contentful entry ID */
|
|
20
|
+
entryId: string;
|
|
21
|
+
/** The slug of the entry */
|
|
22
|
+
slug: string;
|
|
23
|
+
/** For articles, the article type's slug (needed for URL calculation) */
|
|
24
|
+
articleTypeSlug?: string;
|
|
25
|
+
/** The calculated URL for this entry */
|
|
26
|
+
href: string;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Looks up a Contentful entry by ID and returns information needed for preview redirect.
|
|
30
|
+
*
|
|
31
|
+
* Makes a single API call to fetch the entry by ID, determines its content type,
|
|
32
|
+
* extracts the relevant slug fields, and calculates the URL using the context's
|
|
33
|
+
* URL calculators.
|
|
34
|
+
*
|
|
35
|
+
* @param context - Base converter context containing URL calculators
|
|
36
|
+
* @param config - Contentful configuration (spaceId, accessToken, etc.)
|
|
37
|
+
* @param entryId - The Contentful entry ID to look up
|
|
38
|
+
* @param options - Optional fetch options (preview mode is always enabled for this function)
|
|
39
|
+
* @returns PreviewEntryInfo with content type, slug, and calculated href, or null if not found
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
* ```ts
|
|
43
|
+
* const context = createBaseConverterContext();
|
|
44
|
+
* const info = await getPreviewEntryInfo(
|
|
45
|
+
* context,
|
|
46
|
+
* { spaceId: '...', accessToken: '...' },
|
|
47
|
+
* 'abc123'
|
|
48
|
+
* );
|
|
49
|
+
* if (info) {
|
|
50
|
+
* redirect(info.href);
|
|
51
|
+
* }
|
|
52
|
+
* ```
|
|
53
|
+
*/
|
|
54
|
+
export declare function getPreviewEntryInfo(context: BaseConverterContext, config: ContentfulConfig, entryId: string, options?: Omit<FetchOptions, 'preview'>): Promise<PreviewEntryInfo | null>;
|
|
55
|
+
//# sourceMappingURL=preview.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"preview.d.ts","sourceRoot":"","sources":["../../src/api/preview.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAClE,OAAO,KAAK,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAE/D;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAC1B,MAAM,GACN,aAAa,GACb,SAAS,GACT,aAAa,GACb,KAAK,GACL,QAAQ,GACR,YAAY,CAAC;AAEjB;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,oCAAoC;IACpC,WAAW,EAAE,kBAAkB,CAAC;IAChC,8BAA8B;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,4BAA4B;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,yEAAyE;IACzE,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,wCAAwC;IACxC,IAAI,EAAE,MAAM,CAAC;CACd;AA2BD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAsB,mBAAmB,CACvC,OAAO,EAAE,oBAAoB,EAC7B,MAAM,EAAE,gBAAgB,EACxB,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE,IAAI,CAAC,YAAY,EAAE,SAAS,CAAC,GACtC,OAAO,CAAC,gBAAgB,GAAG,IAAI,CAAC,CA8GlC"}
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Preview page utilities for Contentful
|
|
3
|
+
*
|
|
4
|
+
* Provides functionality to look up an entry by ID and calculate the
|
|
5
|
+
* appropriate URL for preview redirects.
|
|
6
|
+
*/
|
|
7
|
+
import { getContentfulClient } from '../client';
|
|
8
|
+
/**
|
|
9
|
+
* Looks up a Contentful entry by ID and returns information needed for preview redirect.
|
|
10
|
+
*
|
|
11
|
+
* Makes a single API call to fetch the entry by ID, determines its content type,
|
|
12
|
+
* extracts the relevant slug fields, and calculates the URL using the context's
|
|
13
|
+
* URL calculators.
|
|
14
|
+
*
|
|
15
|
+
* @param context - Base converter context containing URL calculators
|
|
16
|
+
* @param config - Contentful configuration (spaceId, accessToken, etc.)
|
|
17
|
+
* @param entryId - The Contentful entry ID to look up
|
|
18
|
+
* @param options - Optional fetch options (preview mode is always enabled for this function)
|
|
19
|
+
* @returns PreviewEntryInfo with content type, slug, and calculated href, or null if not found
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```ts
|
|
23
|
+
* const context = createBaseConverterContext();
|
|
24
|
+
* const info = await getPreviewEntryInfo(
|
|
25
|
+
* context,
|
|
26
|
+
* { spaceId: '...', accessToken: '...' },
|
|
27
|
+
* 'abc123'
|
|
28
|
+
* );
|
|
29
|
+
* if (info) {
|
|
30
|
+
* redirect(info.href);
|
|
31
|
+
* }
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
export async function getPreviewEntryInfo(context, config, entryId, options) {
|
|
35
|
+
// Always use preview API for preview lookups
|
|
36
|
+
const client = getContentfulClient(config, true);
|
|
37
|
+
const response = await client.getEntries({
|
|
38
|
+
'sys.id': entryId,
|
|
39
|
+
include: 1, // Need 1 level for Article → ArticleType slug
|
|
40
|
+
}, {
|
|
41
|
+
...options,
|
|
42
|
+
preview: true,
|
|
43
|
+
});
|
|
44
|
+
const entry = response.items[0];
|
|
45
|
+
if (!entry) {
|
|
46
|
+
return null;
|
|
47
|
+
}
|
|
48
|
+
const contentTypeId = entry.sys.contentType.sys.id;
|
|
49
|
+
const { fields } = entry;
|
|
50
|
+
// Map Contentful content type ID to our PreviewContentType
|
|
51
|
+
// and extract the relevant slug and calculate href
|
|
52
|
+
switch (contentTypeId) {
|
|
53
|
+
case 'page': {
|
|
54
|
+
const slug = fields.slug;
|
|
55
|
+
if (!slug)
|
|
56
|
+
return null;
|
|
57
|
+
return {
|
|
58
|
+
contentType: 'page',
|
|
59
|
+
entryId,
|
|
60
|
+
slug,
|
|
61
|
+
href: context.urlCalculators.page(slug),
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
case 'pageVariant': {
|
|
65
|
+
const slug = fields.slug;
|
|
66
|
+
if (!slug)
|
|
67
|
+
return null;
|
|
68
|
+
return {
|
|
69
|
+
contentType: 'pageVariant',
|
|
70
|
+
entryId,
|
|
71
|
+
slug,
|
|
72
|
+
href: context.urlCalculators.pageVariant(slug),
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
case 'article': {
|
|
76
|
+
const slug = fields.slug;
|
|
77
|
+
// For articles, we need the articleType's slug from the included entry
|
|
78
|
+
const articleTypeSlug = getArticleTypeSlug(entry, response.includes?.Entry);
|
|
79
|
+
if (!slug || !articleTypeSlug)
|
|
80
|
+
return null;
|
|
81
|
+
return {
|
|
82
|
+
contentType: 'article',
|
|
83
|
+
entryId,
|
|
84
|
+
slug,
|
|
85
|
+
articleTypeSlug,
|
|
86
|
+
href: context.urlCalculators.article(articleTypeSlug, slug),
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
case 'articleType': {
|
|
90
|
+
const slug = fields.slug;
|
|
91
|
+
if (!slug)
|
|
92
|
+
return null;
|
|
93
|
+
return {
|
|
94
|
+
contentType: 'articleType',
|
|
95
|
+
entryId,
|
|
96
|
+
slug,
|
|
97
|
+
href: context.urlCalculators.articleType(slug),
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
case 'tag': {
|
|
101
|
+
const slug = fields.slug;
|
|
102
|
+
if (!slug)
|
|
103
|
+
return null;
|
|
104
|
+
return {
|
|
105
|
+
contentType: 'tag',
|
|
106
|
+
entryId,
|
|
107
|
+
slug,
|
|
108
|
+
href: context.urlCalculators.tag(slug),
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
case 'person': {
|
|
112
|
+
const slug = fields.slug;
|
|
113
|
+
if (!slug)
|
|
114
|
+
return null;
|
|
115
|
+
return {
|
|
116
|
+
contentType: 'person',
|
|
117
|
+
entryId,
|
|
118
|
+
slug,
|
|
119
|
+
href: context.urlCalculators.person(slug),
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
case 'customType': {
|
|
123
|
+
const slug = fields.slug;
|
|
124
|
+
if (!slug)
|
|
125
|
+
return null;
|
|
126
|
+
return {
|
|
127
|
+
contentType: 'customType',
|
|
128
|
+
entryId,
|
|
129
|
+
slug,
|
|
130
|
+
href: context.urlCalculators.customType(slug),
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
default:
|
|
134
|
+
// Unknown content type - not supported for preview
|
|
135
|
+
return null;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Extracts the article type slug from an article entry.
|
|
140
|
+
* Looks in the entry's articleType field, falling back to includes if needed.
|
|
141
|
+
*/
|
|
142
|
+
function getArticleTypeSlug(entry, includes) {
|
|
143
|
+
// First, check if articleType is resolved in the entry
|
|
144
|
+
const articleTypeField = entry.fields.articleType;
|
|
145
|
+
if (!articleTypeField) {
|
|
146
|
+
return undefined;
|
|
147
|
+
}
|
|
148
|
+
// If the articleType has fields (resolved), get slug from there
|
|
149
|
+
if (articleTypeField.fields?.slug) {
|
|
150
|
+
return articleTypeField.fields.slug;
|
|
151
|
+
}
|
|
152
|
+
// Otherwise, look it up in includes
|
|
153
|
+
const articleTypeId = articleTypeField.sys?.id;
|
|
154
|
+
if (!articleTypeId || !includes) {
|
|
155
|
+
return undefined;
|
|
156
|
+
}
|
|
157
|
+
const articleTypeEntry = includes.find((inc) => inc.sys.id === articleTypeId);
|
|
158
|
+
return articleTypeEntry?.fields?.slug;
|
|
159
|
+
}
|
|
160
|
+
//# sourceMappingURL=preview.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"preview.js","sourceRoot":"","sources":["../../src/api/preview.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAyDhD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,CAAC,KAAK,UAAU,mBAAmB,CACvC,OAA6B,EAC7B,MAAwB,EACxB,OAAe,EACf,OAAuC;IAEvC,6CAA6C;IAC7C,MAAM,MAAM,GAAG,mBA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;YAClB,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC;YACzB,IAAI,CAAC,IAAI;gBAAE,OAAO,IAAI,CAAC;YACvB,OAAO;gBACL,WAAW,EAAE,YAAY;gBACzB,OAAO;gBACP,IAAI;gBACJ,IAAI,EAAE,OAAO,CAAC,cAAc,CAAC,UAAU,CAAC,IAAI,CAAC;aAC9C,CAAC;QACJ,CAAC;QAED;YACE,mDAAmD;YACnD,OAAO,IAAI,CAAC;IAChB,CAAC;AACH,CAAC;AAED;;;GAGG;AACH,SAAS,kBAAkB,CAAC,KAAe,EAAE,QAAgC;IAC3E,uDAAuD;IACvD,MAAM,gBAAgB,GAAG,KAAK,CAAC,MAAM,CAAC,WAAW,CAAC;IAClD,IAAI,CAAC,gBAAgB,EAAE,CAAC;QACtB,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,gEAAgE;IAChE,IAAI,gBAAgB,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC;QAClC,OAAO,gBAAgB,CAAC,MAAM,CAAC,IAAI,CAAC;IACtC,CAAC;IAED,oCAAoC;IACpC,MAAM,aAAa,GAAG,gBAAgB,CAAC,GAAG,EAAE,EAAE,CAAC;IAC/C,IAAI,CAAC,aAAa,IAAI,CAAC,QAAQ,EAAE,CAAC;QAChC,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,MAAM,gBAAgB,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,KAAK,aAAa,CAAC,CAAC;IAC9E,OAAO,gBAAgB,EAAE,MAAM,EAAE,IAA0B,CAAC;AAC9D,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { IArticleLink } from '@se-studio/core-data-types';
|
|
2
|
+
import type { RelatedArticlesOptions } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Filters and ranks articles based on related article criteria.
|
|
5
|
+
* Articles with more matching tags are ranked higher.
|
|
6
|
+
*
|
|
7
|
+
* @param articles - Array of article links with metadata
|
|
8
|
+
* @param options - Filtering options
|
|
9
|
+
* @returns Filtered and ranked array of article links
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```ts
|
|
13
|
+
* const relatedArticles = filterRelatedArticles(allArticles, {
|
|
14
|
+
* articleTypeIds: ['blog-type-id'],
|
|
15
|
+
* tagIds: ['tag-1', 'tag-2'],
|
|
16
|
+
* excludeArticleIds: [currentArticle.id],
|
|
17
|
+
* count: 3,
|
|
18
|
+
* });
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
export declare function filterRelatedArticles(articles: IArticleLink[], options: RelatedArticlesOptions): IArticleLink[];
|
|
22
|
+
//# sourceMappingURL=related-articles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"related-articles.d.ts","sourceRoot":"","sources":["../../src/api/related-articles.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAC;AAEtD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,qBAAqB,CACnC,QAAQ,EAAE,YAAY,EAAE,EACxB,OAAO,EAAE,sBAAsB,GAC9B,YAAY,EAAE,CAiFhB"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Filters and ranks articles based on related article criteria.
|
|
3
|
+
* Articles with more matching tags are ranked higher.
|
|
4
|
+
*
|
|
5
|
+
* @param articles - Array of article links with metadata
|
|
6
|
+
* @param options - Filtering options
|
|
7
|
+
* @returns Filtered and ranked array of article links
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* const relatedArticles = filterRelatedArticles(allArticles, {
|
|
12
|
+
* articleTypeIds: ['blog-type-id'],
|
|
13
|
+
* tagIds: ['tag-1', 'tag-2'],
|
|
14
|
+
* excludeArticleIds: [currentArticle.id],
|
|
15
|
+
* count: 3,
|
|
16
|
+
* });
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
export function filterRelatedArticles(articles, options) {
|
|
20
|
+
const { excludeArticleIds, articleTypeIds: rawArticleTypeIds, tagIds: rawTagIds, authorIds: rawAuthorIds, before, after, count, } = options;
|
|
21
|
+
// Extract and deduplicate IDs from link objects
|
|
22
|
+
const excludeIds = excludeArticleIds ? [...new Set(excludeArticleIds)] : [];
|
|
23
|
+
const articleTypeIds = rawArticleTypeIds ? [...new Set(rawArticleTypeIds)] : [];
|
|
24
|
+
const tagIds = rawTagIds ? [...new Set(rawTagIds)] : [];
|
|
25
|
+
const authorIds = rawAuthorIds ? [...new Set(rawAuthorIds)] : [];
|
|
26
|
+
// Score and filter articles
|
|
27
|
+
const scoredArticles = articles
|
|
28
|
+
.map((article) => {
|
|
29
|
+
let score = 0;
|
|
30
|
+
// Filter: Exclude specific articles
|
|
31
|
+
if (excludeIds.length > 0 && excludeIds.includes(article.id)) {
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
// Filter: Article type (match any of the provided types)
|
|
35
|
+
if (articleTypeIds.length > 0) {
|
|
36
|
+
if (!article.articleType?.id || !articleTypeIds.includes(article.articleType.id)) {
|
|
37
|
+
return null;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
// Filter: Date range
|
|
41
|
+
if (article.date) {
|
|
42
|
+
const articleDate = new Date(article.date);
|
|
43
|
+
if (before && articleDate > before) {
|
|
44
|
+
return null;
|
|
45
|
+
}
|
|
46
|
+
if (after && articleDate < after) {
|
|
47
|
+
return null;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
// Score: Tag matching (more matches = higher score)
|
|
51
|
+
if (tagIds.length > 0 && article.tags) {
|
|
52
|
+
const articleTagIds = article.tags.map((tag) => tag.id);
|
|
53
|
+
const matchingTags = tagIds.filter((tagId) => articleTagIds.includes(tagId));
|
|
54
|
+
score += matchingTags.length * 10; // Each matching tag adds 10 points
|
|
55
|
+
}
|
|
56
|
+
// Score: Author matching (match any of the provided authors)
|
|
57
|
+
if (authorIds.length > 0 && article.author?.id) {
|
|
58
|
+
if (authorIds.includes(article.author.id)) {
|
|
59
|
+
score += 5; // Matching author adds 5 points
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
return { article, score };
|
|
63
|
+
})
|
|
64
|
+
.filter((item) => item !== null);
|
|
65
|
+
// Sort by score (descending), then by date (descending)
|
|
66
|
+
scoredArticles.sort((a, b) => {
|
|
67
|
+
if (b.score !== a.score) {
|
|
68
|
+
return b.score - a.score;
|
|
69
|
+
}
|
|
70
|
+
// If scores are equal, sort by date (newest first)
|
|
71
|
+
if (a.article.date && b.article.date) {
|
|
72
|
+
const articleDateA = new Date(a.article.date);
|
|
73
|
+
const articleDateB = new Date(b.article.date);
|
|
74
|
+
return articleDateB.getTime() - articleDateA.getTime();
|
|
75
|
+
}
|
|
76
|
+
return 0;
|
|
77
|
+
});
|
|
78
|
+
// Take top N articles (or all if count is undefined)
|
|
79
|
+
const topArticles = count !== undefined ? scoredArticles.slice(0, count) : scoredArticles;
|
|
80
|
+
return topArticles.map(({ article }) => article);
|
|
81
|
+
}
|
|
82
|
+
//# sourceMappingURL=related-articles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"related-articles.js","sourceRoot":"","sources":["../../src/api/related-articles.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,qBAAqB,CACnC,QAAwB,EACxB,OAA+B;IAE/B,MAAM,EACJ,iBAAiB,EACjB,cAAc,EAAE,iBAAiB,EACjC,MAAM,EAAE,SAAS,EACjB,SAAS,EAAE,YAAY,EACvB,MAAM,EACN,KAAK,EACL,KAAK,GACN,GAAG,OAAO,CAAC;IAEZ,gDAAgD;IAChD,MAAM,UAAU,GAAG,iBAAiB,CAAC,CAAC,CAAC,CAAC,GAAG,IA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MAAM,YAAY,GAAG,IAAI,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;YAC9C,MAAM,YAAY,GAAG,IAAI,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;YAC9C,OAAO,YAAY,CAAC,OAAO,EAAE,GAAG,YAAY,CAAC,OAAO,EAAE,CAAC;QACzD,CAAC;QACD,OAAO,CAAC,CAAC;IACX,CAAC,CAAC,CAAC;IAEH,qDAAqD;IACrD,MAAM,WAAW,GAAG,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC;IAE1F,OAAO,WAAW,CAAC,GAAG,CAAC,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,OAAO,CAAC,CAAC;AACnD,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import 'server-only';
|
|
2
|
+
import type { NextRequest } from 'next/server';
|
|
3
|
+
import type { ContentfulConfig } from '../types';
|
|
4
|
+
/**
|
|
5
|
+
* Configuration for creating a download handler
|
|
6
|
+
*/
|
|
7
|
+
export interface DownloadHandlerConfig {
|
|
8
|
+
/**
|
|
9
|
+
* Function to get the Contentful configuration.
|
|
10
|
+
* Called on each request to allow for dynamic config.
|
|
11
|
+
*/
|
|
12
|
+
getConfig: (preview?: boolean) => ContentfulConfig;
|
|
13
|
+
/**
|
|
14
|
+
* Default cache revalidation time in seconds.
|
|
15
|
+
* Defaults to 86400 (24 hours).
|
|
16
|
+
*/
|
|
17
|
+
revalidate?: number;
|
|
18
|
+
/**
|
|
19
|
+
* Whether to use preview API.
|
|
20
|
+
* Defaults to false.
|
|
21
|
+
*/
|
|
22
|
+
preview?: boolean;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Route params structure for Next.js App Router
|
|
26
|
+
*/
|
|
27
|
+
export interface DownloadRouteParams {
|
|
28
|
+
params: Promise<{
|
|
29
|
+
assetId: string;
|
|
30
|
+
filename: string;
|
|
31
|
+
}>;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Creates a Next.js App Router GET handler for downloading/viewing Contentful assets.
|
|
35
|
+
*
|
|
36
|
+
* @param config - Download handler configuration
|
|
37
|
+
* @returns GET handler function for Next.js route
|
|
38
|
+
*/
|
|
39
|
+
export declare function createDownloadHandler(config: DownloadHandlerConfig): (_request: NextRequest, { params }: DownloadRouteParams) => Promise<Response>;
|
|
40
|
+
//# sourceMappingURL=server-asset.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server-asset.d.ts","sourceRoot":"","sources":["../../src/api/server-asset.ts"],"names":[],"mappings":"AAAA,OAAO,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAGjD;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC;;;OAGG;IACH,SAAS,EAAE,CAAC,OAAO,CAAC,EAAE,OAAO,KAAK,gBAAgB,CAAC;IAEnD;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,OAAO,CAAC;QACd,OAAO,EAAE,MAAM,CAAC;QAChB,QAAQ,EAAE,MAAM,CAAC;KAClB,CAAC,CAAC;CACJ;AAYD;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,qBAAqB,IAI/D,UAAU,WAAW,EACrB,YAAY,mBAAmB,KAC9B,OAAO,CAAC,QAAQ,CAAC,CAkErB"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import 'server-only';
|
|
2
|
+
import { getCacheTags } from '../revalidation/utils';
|
|
3
|
+
import { contentfulAssetRest, isBrowserViewable } from './asset';
|
|
4
|
+
/**
|
|
5
|
+
* Creates a Next.js App Router GET handler for downloading/viewing Contentful assets.
|
|
6
|
+
*
|
|
7
|
+
* @param config - Download handler configuration
|
|
8
|
+
* @returns GET handler function for Next.js route
|
|
9
|
+
*/
|
|
10
|
+
export function createDownloadHandler(config) {
|
|
11
|
+
const { getConfig, revalidate = 86400, preview = false } = config;
|
|
12
|
+
return async function GET(_request, { params }) {
|
|
13
|
+
const { assetId, filename } = await params;
|
|
14
|
+
// Decode the filename (in case it was URL-encoded)
|
|
15
|
+
const decodedFilename = decodeURIComponent(filename);
|
|
16
|
+
try {
|
|
17
|
+
// Get Contentful config
|
|
18
|
+
const contentfulConfig = getConfig(preview);
|
|
19
|
+
// Fetch asset metadata from Contentful (uses client with rate limiting)
|
|
20
|
+
const asset = await contentfulAssetRest(contentfulConfig, assetId, {
|
|
21
|
+
preview,
|
|
22
|
+
next: { revalidate },
|
|
23
|
+
});
|
|
24
|
+
if (!asset?.fields?.file) {
|
|
25
|
+
return Response.json({ error: 'Asset not found' }, { status: 404 });
|
|
26
|
+
}
|
|
27
|
+
const { file } = asset.fields;
|
|
28
|
+
const assetUrl = `https:${file.url}`;
|
|
29
|
+
// Fetch the actual file from Contentful CDN
|
|
30
|
+
const cacheTags = getCacheTags('asset', assetId, preview);
|
|
31
|
+
const fileFetchOptions = {
|
|
32
|
+
next: {
|
|
33
|
+
revalidate,
|
|
34
|
+
tags: cacheTags,
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
const fileResponse = await fetch(assetUrl, fileFetchOptions);
|
|
38
|
+
if (!fileResponse.ok) {
|
|
39
|
+
return Response.json({ error: 'Failed to fetch file' }, { status: 502 });
|
|
40
|
+
}
|
|
41
|
+
// Build response headers
|
|
42
|
+
const headers = new Headers();
|
|
43
|
+
// Content type from Contentful
|
|
44
|
+
headers.set('Content-Type', file.contentType);
|
|
45
|
+
// Content-Disposition: inline opens in browser, attachment forces download
|
|
46
|
+
const disposition = isBrowserViewable(file.contentType) ? 'inline' : 'attachment';
|
|
47
|
+
headers.set('Content-Disposition', `${disposition}; filename="${decodedFilename}"`);
|
|
48
|
+
// Set content length if available
|
|
49
|
+
if (file.details?.size) {
|
|
50
|
+
headers.set('Content-Length', String(file.details.size));
|
|
51
|
+
}
|
|
52
|
+
// Cache control
|
|
53
|
+
headers.set('Cache-Control', `public, max-age=${revalidate}, s-maxage=${revalidate}`);
|
|
54
|
+
return new Response(fileResponse.body, {
|
|
55
|
+
status: 200,
|
|
56
|
+
headers,
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
catch (error) {
|
|
60
|
+
console.error('[Download] Error proxying file:', error);
|
|
61
|
+
return Response.json({ error: 'Internal server error' }, { status: 500 });
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
//# sourceMappingURL=server-asset.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server-asset.js","sourceRoot":"","sources":["../../src/api/server-asset.ts"],"names":[],"mappings":"AAAA,OAAO,aAAa,CAAC;AAErB,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAErD,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AA6CjE;;;;;GAKG;AACH,MAAM,UAAU,qBAAqB,CAAC,MAA6B;IACjE,MAAM,EAAE,SAAS,EAAE,UAAU,GAAG,KAAK,EAAE,OAAO,GAAG,KAAK,EAAE,GAAG,MAAM,CAAC;IAElE,OAAO,KAAK,UAAU,GAAG,CACvB,QAAqB,EACrB,EAAE,MAAM,EAAuB;QAE/B,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,MAAM,MAAM,CAAC;QAE3C,mDAAmD;QACnD,MAAM,eAAe,GAAG,kBAAkB,CAAC,QAAQ,CAAC,CAAC;QAErD,IAAI,CAAC;YACH,wBAAwB;YACxB,MAAM,gBAAgB,GAAG,SAAS,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YAClF,OAAO,CAAC,GAAG,CAAC,qBAAqB,EAAE,GAAG,WAAW,eAAe,eAAe,GAAG,CAAC,CAAC;YAEpF,kCAAkC;YAClC,IAAI,IAAI,CAAC,OAAO,EAAE,IAAI,EAAE,CAAC;gBACvB,OAAO,CAAC,GAAG,CAAC,gBAAgB,EAAE,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;YAC3D,CAAC;YAED,gBAAgB;YAChB,OAAO,CAAC,GAAG,CAAC,eAAe,EAAE,mBAAmB,UAAU,cAAc,UAAU,EAAE,CAAC,CAAC;YAEtF,OAAO,IAAI,QAAQ,CAAC,YAAY,CAAC,IAAI,EAAE;gBACrC,MAAM,EAAE,GAAG;gBACX,OAAO;aACR,CAAC,CAAC;QACL,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,KAAK,CAAC,iCAAiC,EAAE,KAAK,CAAC,CAAC;YACxD,OAAO,QAAQ,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,uBAAuB,EAAE,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC;QAC5E,CAAC;IACH,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import type { BaseConverterContext } from '../converters/helpers';
|
|
2
|
+
import type { CmsResponse, ContentfulConfig, FetchOptions } from '../types';
|
|
3
|
+
import type { ISitemapEntry, SitemapConfig, SitemapContentTypeConfig, SitemapEntryProvider } from './types';
|
|
4
|
+
/**
|
|
5
|
+
* Fetches all page sitemap entries from Contentful.
|
|
6
|
+
* Only includes pages that are indexed and not hidden.
|
|
7
|
+
*
|
|
8
|
+
* @param context - Converter context
|
|
9
|
+
* @param config - Contentful configuration
|
|
10
|
+
* @param sitemapConfig - Optional sitemap configuration (priority, changeFrequency)
|
|
11
|
+
* @param options - Fetch options (locale, preview, caching, etc.)
|
|
12
|
+
* @returns Promise resolving to CmsResponse with array of sitemap entries
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```ts
|
|
16
|
+
* const { data: entries } = await contentfulPageSitemapEntries(
|
|
17
|
+
* context,
|
|
18
|
+
* config,
|
|
19
|
+
* { priority: 0.8, changeFrequency: 'weekly' },
|
|
20
|
+
* { next: { revalidate: 3600 } }
|
|
21
|
+
* );
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
export declare function contentfulPageSitemapEntries(context: BaseConverterContext, config: ContentfulConfig, sitemapConfig: SitemapContentTypeConfig, options: FetchOptions): Promise<CmsResponse<ISitemapEntry[]>>;
|
|
25
|
+
/**
|
|
26
|
+
* Fetches all article sitemap entries from Contentful.
|
|
27
|
+
* Only includes articles that are indexed and not hidden.
|
|
28
|
+
*
|
|
29
|
+
* @param context - Converter context
|
|
30
|
+
* @param config - Contentful configuration
|
|
31
|
+
* @param sitemapConfig - Optional sitemap configuration (priority, changeFrequency)
|
|
32
|
+
* @param options - Fetch options (locale, preview, caching, etc.)
|
|
33
|
+
* @returns Promise resolving to CmsResponse with array of sitemap entries
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```ts
|
|
37
|
+
* const { data: entries } = await contentfulArticleSitemapEntries(
|
|
38
|
+
* context,
|
|
39
|
+
* config,
|
|
40
|
+
* { priority: 0.6, changeFrequency: 'monthly' },
|
|
41
|
+
* { next: { revalidate: 3600 } }
|
|
42
|
+
* );
|
|
43
|
+
* ```
|
|
44
|
+
*/
|
|
45
|
+
export declare function contentfulArticleSitemapEntries(context: BaseConverterContext, config: ContentfulConfig, sitemapConfig: SitemapContentTypeConfig, options: FetchOptions): Promise<CmsResponse<ISitemapEntry[]>>;
|
|
46
|
+
/**
|
|
47
|
+
* Fetches all article type sitemap entries from Contentful.
|
|
48
|
+
* Only includes article types that are indexed and not hidden.
|
|
49
|
+
*
|
|
50
|
+
* @param context - Converter context
|
|
51
|
+
* @param config - Contentful configuration
|
|
52
|
+
* @param sitemapConfig - Optional sitemap configuration (priority, changeFrequency)
|
|
53
|
+
* @param options - Fetch options (locale, preview, caching, etc.)
|
|
54
|
+
* @returns Promise resolving to CmsResponse with array of sitemap entries
|
|
55
|
+
*/
|
|
56
|
+
export declare function contentfulArticleTypeSitemapEntries(context: BaseConverterContext, config: ContentfulConfig, sitemapConfig: SitemapContentTypeConfig, options: FetchOptions): Promise<CmsResponse<ISitemapEntry[]>>;
|
|
57
|
+
/**
|
|
58
|
+
* Fetches all tag sitemap entries from Contentful.
|
|
59
|
+
* Only includes tags that are indexed and not hidden.
|
|
60
|
+
*
|
|
61
|
+
* @param context - Converter context
|
|
62
|
+
* @param config - Contentful configuration
|
|
63
|
+
* @param sitemapConfig - Optional sitemap configuration (priority, changeFrequency)
|
|
64
|
+
* @param options - Fetch options (locale, preview, caching, etc.)
|
|
65
|
+
* @returns Promise resolving to CmsResponse with array of sitemap entries
|
|
66
|
+
*/
|
|
67
|
+
export declare function contentfulTagSitemapEntries(context: BaseConverterContext, config: ContentfulConfig, sitemapConfig: SitemapContentTypeConfig, options: FetchOptions): Promise<CmsResponse<ISitemapEntry[]>>;
|
|
68
|
+
/**
|
|
69
|
+
* Fetches all person sitemap entries from Contentful.
|
|
70
|
+
* Only includes people that are indexed and not hidden.
|
|
71
|
+
*
|
|
72
|
+
* @param context - Converter context
|
|
73
|
+
* @param config - Contentful configuration
|
|
74
|
+
* @param sitemapConfig - Optional sitemap configuration (priority, changeFrequency)
|
|
75
|
+
* @param options - Fetch options (locale, preview, caching, etc.)
|
|
76
|
+
* @returns Promise resolving to CmsResponse with array of sitemap entries
|
|
77
|
+
*/
|
|
78
|
+
export declare function contentfulPersonSitemapEntries(context: BaseConverterContext, config: ContentfulConfig, sitemapConfig: SitemapContentTypeConfig, options: FetchOptions): Promise<CmsResponse<ISitemapEntry[]>>;
|
|
79
|
+
/**
|
|
80
|
+
* Collects sitemap entries from multiple providers.
|
|
81
|
+
* This allows projects to register custom content types for sitemap generation.
|
|
82
|
+
*
|
|
83
|
+
* @param context - Converter context
|
|
84
|
+
* @param config - Contentful configuration
|
|
85
|
+
* @param sitemapConfig - Configuration with array of provider functions
|
|
86
|
+
* @param options - Fetch options (locale, preview, caching, etc.)
|
|
87
|
+
* @returns Promise resolving to CmsResponse with all sitemap entries combined
|
|
88
|
+
*
|
|
89
|
+
* @example
|
|
90
|
+
* ```ts
|
|
91
|
+
* const { data: entries, errors } = await getAllSitemapEntries(
|
|
92
|
+
* context,
|
|
93
|
+
* config,
|
|
94
|
+
* {
|
|
95
|
+
* providers: [
|
|
96
|
+
* (ctx, cfg, opts) => contentfulPageSitemapEntries(ctx, cfg, { priority: 0.8 }, opts),
|
|
97
|
+
* (ctx, cfg, opts) => contentfulArticleSitemapEntries(ctx, cfg, { priority: 0.6 }, opts),
|
|
98
|
+
* // Custom content type provider
|
|
99
|
+
* async (ctx, cfg, opts) => {
|
|
100
|
+
* const links = await fetchCustomContentLinks(ctx, cfg, opts);
|
|
101
|
+
* return { data: links.map(l => ({ url: l.href, lastModified: l.lastModified })), errors: [] };
|
|
102
|
+
* },
|
|
103
|
+
* ],
|
|
104
|
+
* },
|
|
105
|
+
* { next: { revalidate: 3600 } }
|
|
106
|
+
* );
|
|
107
|
+
* ```
|
|
108
|
+
*/
|
|
109
|
+
export declare function getAllSitemapEntries(context: BaseConverterContext, config: ContentfulConfig, sitemapConfig: SitemapConfig, options: FetchOptions): Promise<CmsResponse<ISitemapEntry[]>>;
|
|
110
|
+
/**
|
|
111
|
+
* Creates a sitemap entry provider with pre-configured options.
|
|
112
|
+
* Useful for creating providers with specific priority and changeFrequency settings.
|
|
113
|
+
*
|
|
114
|
+
* @param fetcher - The sitemap entry fetcher function to wrap
|
|
115
|
+
* @param sitemapConfig - Configuration for priority and change frequency
|
|
116
|
+
* @returns A sitemap entry provider function
|
|
117
|
+
*
|
|
118
|
+
* @example
|
|
119
|
+
* ```ts
|
|
120
|
+
* const pageProvider = createSitemapProvider(
|
|
121
|
+
* contentfulPageSitemapEntries,
|
|
122
|
+
* { priority: 0.8, changeFrequency: 'weekly' }
|
|
123
|
+
* );
|
|
124
|
+
*
|
|
125
|
+
* const { data: entries } = await getAllSitemapEntries(context, config, {
|
|
126
|
+
* providers: [pageProvider, articleProvider],
|
|
127
|
+
* });
|
|
128
|
+
* ```
|
|
129
|
+
*/
|
|
130
|
+
export declare function createSitemapProvider(fetcher: (context: BaseConverterContext, config: ContentfulConfig, sitemapConfig: SitemapContentTypeConfig, options: FetchOptions) => Promise<CmsResponse<ISitemapEntry[]>>, sitemapConfig: SitemapContentTypeConfig): SitemapEntryProvider;
|
|
131
|
+
//# sourceMappingURL=sitemap.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sitemap.d.ts","sourceRoot":"","sources":["../../src/api/sitemap.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAClE,OAAO,KAAK,EAAY,WAAW,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAQtF,OAAO,KAAK,EACV,aAAa,EACb,aAAa,EACb,wBAAwB,EACxB,oBAAoB,EACrB,MAAM,SAAS,CAAC;AAgCjB;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAsB,4BAA4B,CAChD,OAAO,EAAE,oBAAoB,EAC7B,MAAM,EAAE,gBAAgB,EACxB,aAAa,EAAE,wBAAwB,EACvC,OAAO,EAAE,YAAY,GACpB,OAAO,CAAC,WAAW,CAAC,aAAa,EAAE,CAAC,CAAC,CAMvC;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAsB,+BAA+B,CACnD,OAAO,EAAE,oBAAoB,EAC7B,MAAM,EAAE,gBAAgB,EACxB,aAAa,EAAE,wBAAwB,EACvC,OAAO,EAAE,YAAY,GACpB,OAAO,CAAC,WAAW,CAAC,aAAa,EAAE,CAAC,CAAC,CAMvC;AAED;;;;;;;;;GASG;AACH,wBAAsB,mCAAmC,CACvD,OAAO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