@se-studio/contentful-rest-api 1.1.2 → 1.2.0
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 +22 -0
- package/dist/api/related-articles.d.ts +6 -1
- package/dist/api/related-articles.d.ts.map +1 -1
- package/dist/api/related-articles.js +66 -19
- package/dist/api/related-articles.js.map +1 -1
- package/dist/api/types.d.ts +15 -3
- package/dist/api/types.d.ts.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
# @se-studio/contentful-rest-api
|
|
2
2
|
|
|
3
|
+
## 1.2.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- feat: support slug-based and tag type filtering for related articles (plus strict author matching)
|
|
8
|
+
|
|
9
|
+
**@se-studio/contentful-rest-api**
|
|
10
|
+
|
|
11
|
+
- Extended `RelatedArticlesOptions` and `filterRelatedArticles` with `articleTypeSlugs`, `tagSlugs`, `tagTypeIds`/`tagTypeSlugs`, `authorSlugs`, and `strictAuthorMatch` (OR semantics with the existing ID-based filters).
|
|
12
|
+
- Tag scoring now correctly counts _distinct_ tags (prevents double-counting when the same tag matches via both an ID and a slug).
|
|
13
|
+
- Updated logging and the `@example` in the JSDoc.
|
|
14
|
+
|
|
15
|
+
**@se-studio/core-ui**
|
|
16
|
+
|
|
17
|
+
- Extended `LinkFetchOptions` (used by `getAll*Links` and `FetchHelpers` / `rendererConfig.fetchHelpers`) with the full set of related article filter fields. Added clear JSDoc noting that the article-specific filters only take effect for `getAllArticleLinks`.
|
|
18
|
+
- `createAppHelpers` now wraps `getAllArticleLinks` so that when any filter criteria (IDs or slugs for types/tags/authors/tagTypes, `strictAuthorMatch`, `excludeArticleIds`, `before`/`after`, `count`) are passed, it fetches the base list then runs it through `filterRelatedArticles` (preserving `errors` and correctly handling `allowUnindexed`).
|
|
19
|
+
- Re-exported `RelatedArticlesOptions` and `filterRelatedArticles` from `@se-studio/core-ui` for convenient use in apps.
|
|
20
|
+
- Added comprehensive tests covering the new filter combinations and the `getAllArticleLinks` wrapper integration.
|
|
21
|
+
- Minor hygiene improvements (import ordering per surgical changes guideline, one-line note that internal `getRelatedArticles`/`getRelatedPeople` now benefit from the richer filter).
|
|
22
|
+
|
|
23
|
+
This enables much more flexible "related content" collections and custom article lists directly from `fetchHelpers.getAllArticleLinks(...)` (or the app helpers) without duplicating filtering/ranking logic.
|
|
24
|
+
|
|
3
25
|
## 1.1.2
|
|
4
26
|
|
|
5
27
|
### Patch Changes
|
|
@@ -13,7 +13,12 @@ import type { RelatedArticlesOptions } from './types';
|
|
|
13
13
|
* ```ts
|
|
14
14
|
* const relatedArticles = filterRelatedArticles(allArticles, {
|
|
15
15
|
* articleTypeIds: ['blog-type-id'],
|
|
16
|
-
*
|
|
16
|
+
* articleTypeSlugs: ['resources/news'],
|
|
17
|
+
* tagIds: ['tag-1'],
|
|
18
|
+
* tagSlugs: ['tag-2'],
|
|
19
|
+
* tagTypeSlugs: ['condition'],
|
|
20
|
+
* authorSlugs: ['alice'],
|
|
21
|
+
* strictAuthorMatch: true,
|
|
17
22
|
* excludeArticleIds: [currentArticle.id],
|
|
18
23
|
* count: 3,
|
|
19
24
|
* });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"related-articles.d.ts","sourceRoot":"","sources":["../../src/api/related-articles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,KAAK,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAClF,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAC;AAEtD
|
|
1
|
+
{"version":3,"file":"related-articles.d.ts","sourceRoot":"","sources":["../../src/api/related-articles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,KAAK,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAClF,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAC;AAEtD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,qBAAqB,CACnC,QAAQ,EAAE,YAAY,EAAE,EACxB,OAAO,EAAE,sBAAsB,GAC9B,YAAY,EAAE,CA6JhB"}
|
|
@@ -12,21 +12,31 @@ import { getArticleAuthors } from '@se-studio/core-data-types';
|
|
|
12
12
|
* ```ts
|
|
13
13
|
* const relatedArticles = filterRelatedArticles(allArticles, {
|
|
14
14
|
* articleTypeIds: ['blog-type-id'],
|
|
15
|
-
*
|
|
15
|
+
* articleTypeSlugs: ['resources/news'],
|
|
16
|
+
* tagIds: ['tag-1'],
|
|
17
|
+
* tagSlugs: ['tag-2'],
|
|
18
|
+
* tagTypeSlugs: ['condition'],
|
|
19
|
+
* authorSlugs: ['alice'],
|
|
20
|
+
* strictAuthorMatch: true,
|
|
16
21
|
* excludeArticleIds: [currentArticle.id],
|
|
17
22
|
* count: 3,
|
|
18
23
|
* });
|
|
19
24
|
* ```
|
|
20
25
|
*/
|
|
21
26
|
export function filterRelatedArticles(articles, options) {
|
|
22
|
-
const { excludeArticleIds, articleTypeIds: rawArticleTypeIds, tagIds: rawTagIds, authorIds: rawAuthorIds, before, after, count, } = options;
|
|
23
|
-
// Extract and deduplicate IDs
|
|
27
|
+
const { excludeArticleIds, articleTypeIds: rawArticleTypeIds, articleTypeSlugs: rawArticleTypeSlugs, tagIds: rawTagIds, tagSlugs: rawTagSlugs, tagTypeIds: rawTagTypeIds, tagTypeSlugs: rawTagTypeSlugs, authorIds: rawAuthorIds, authorSlugs: rawAuthorSlugs, strictAuthorMatch, before, after, count, } = options;
|
|
28
|
+
// Extract and deduplicate IDs/slugs
|
|
24
29
|
const excludeIds = excludeArticleIds ? [...new Set(excludeArticleIds)] : [];
|
|
25
30
|
const articleTypeIds = rawArticleTypeIds ? [...new Set(rawArticleTypeIds)] : [];
|
|
31
|
+
const articleTypeSlugs = rawArticleTypeSlugs ? [...new Set(rawArticleTypeSlugs)] : [];
|
|
26
32
|
const tagIds = rawTagIds ? [...new Set(rawTagIds)] : [];
|
|
33
|
+
const tagSlugs = rawTagSlugs ? [...new Set(rawTagSlugs)] : [];
|
|
34
|
+
const tagTypeIds = rawTagTypeIds ? [...new Set(rawTagTypeIds)] : [];
|
|
35
|
+
const tagTypeSlugs = rawTagTypeSlugs ? [...new Set(rawTagTypeSlugs)] : [];
|
|
27
36
|
const authorIds = rawAuthorIds ? [...new Set(rawAuthorIds)] : [];
|
|
37
|
+
const authorSlugs = rawAuthorSlugs ? [...new Set(rawAuthorSlugs)] : [];
|
|
28
38
|
if (process.env.LOG_RELATED_ARTICLES) {
|
|
29
|
-
console.log(`[RelatedArticles:filter] input: ${articles.length} articles, options: articleTypes=${(rawArticleTypeIds ?? []).join(',') || 'none'} tags=${(rawTagIds ?? []).join(',') || 'none'} authors=${(rawAuthorIds ?? []).join(',') || 'none'} count=${count ?? 'all'}`);
|
|
39
|
+
console.log(`[RelatedArticles:filter] input: ${articles.length} articles, options: articleTypes=${[...(rawArticleTypeIds ?? []), ...(rawArticleTypeSlugs ?? [])].join(',') || 'none'} tags=${[...(rawTagIds ?? []), ...(rawTagSlugs ?? [])].join(',') || 'none'} tagTypes=${[...(rawTagTypeIds ?? []), ...(rawTagTypeSlugs ?? [])].join(',') || 'none'} authors=${[...(rawAuthorIds ?? []), ...(rawAuthorSlugs ?? [])].join(',') || 'none'} strictAuthorMatch=${strictAuthorMatch ?? false} count=${count ?? 'all'}`);
|
|
30
40
|
}
|
|
31
41
|
// Score and filter articles
|
|
32
42
|
const scoredArticles = articles
|
|
@@ -40,9 +50,15 @@ export function filterRelatedArticles(articles, options) {
|
|
|
40
50
|
if (excludeIds.length > 0 && excludeIds.includes(article.id)) {
|
|
41
51
|
return null;
|
|
42
52
|
}
|
|
43
|
-
// Filter: Article type (match any of the provided types)
|
|
44
|
-
if (articleTypeIds.length > 0) {
|
|
45
|
-
|
|
53
|
+
// Filter: Article type (match any of the provided types by ID or slug)
|
|
54
|
+
if (articleTypeIds.length > 0 || articleTypeSlugs.length > 0) {
|
|
55
|
+
const matchesById = articleTypeIds.length > 0 &&
|
|
56
|
+
!!article.articleType?.id &&
|
|
57
|
+
articleTypeIds.includes(article.articleType.id);
|
|
58
|
+
const matchesBySlug = articleTypeSlugs.length > 0 &&
|
|
59
|
+
!!article.articleType?.slug &&
|
|
60
|
+
articleTypeSlugs.includes(article.articleType.slug);
|
|
61
|
+
if (!matchesById && !matchesBySlug) {
|
|
46
62
|
return null;
|
|
47
63
|
}
|
|
48
64
|
}
|
|
@@ -56,21 +72,52 @@ export function filterRelatedArticles(articles, options) {
|
|
|
56
72
|
return null;
|
|
57
73
|
}
|
|
58
74
|
}
|
|
59
|
-
// Filter + score: Tag matching (must match at least one; more matches = higher score)
|
|
60
|
-
if (tagIds.length > 0) {
|
|
61
|
-
const
|
|
62
|
-
const
|
|
63
|
-
if (
|
|
75
|
+
// Filter + score: Tag matching by ID or slug (must match at least one; more matches = higher score)
|
|
76
|
+
if (tagIds.length > 0 || tagSlugs.length > 0) {
|
|
77
|
+
const articleTags = article.tags ?? [];
|
|
78
|
+
const matchingTagIds = new Set();
|
|
79
|
+
if (tagIds.length > 0) {
|
|
80
|
+
for (const id of tagIds) {
|
|
81
|
+
const tag = articleTags.find((t) => t.id === id);
|
|
82
|
+
if (tag?.id)
|
|
83
|
+
matchingTagIds.add(tag.id);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
if (tagSlugs.length > 0) {
|
|
87
|
+
for (const slug of tagSlugs) {
|
|
88
|
+
const tag = articleTags.find((t) => t.slug === slug);
|
|
89
|
+
if (tag?.id)
|
|
90
|
+
matchingTagIds.add(tag.id);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
const totalMatches = matchingTagIds.size;
|
|
94
|
+
if (totalMatches === 0) {
|
|
64
95
|
return null;
|
|
65
96
|
}
|
|
66
|
-
score +=
|
|
97
|
+
score += totalMatches * 10; // Each matching *distinct* tag adds 10 points
|
|
67
98
|
}
|
|
68
|
-
//
|
|
69
|
-
if (
|
|
70
|
-
const
|
|
71
|
-
|
|
72
|
-
.
|
|
73
|
-
|
|
99
|
+
// Filter: Tag type matching (hard filter — no scoring)
|
|
100
|
+
if (tagTypeIds.length > 0 || tagTypeSlugs.length > 0) {
|
|
101
|
+
const articleTags = article.tags ?? [];
|
|
102
|
+
const matchesById = tagTypeIds.length > 0 &&
|
|
103
|
+
articleTags.some((t) => t.tagType?.id && tagTypeIds.includes(t.tagType.id));
|
|
104
|
+
const matchesBySlug = tagTypeSlugs.length > 0 &&
|
|
105
|
+
articleTags.some((t) => t.tagType?.slug && tagTypeSlugs.includes(t.tagType.slug));
|
|
106
|
+
if (!matchesById && !matchesBySlug) {
|
|
107
|
+
return null;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
// Filter/score: Author matching by ID or slug
|
|
111
|
+
if (authorIds.length > 0 || authorSlugs.length > 0) {
|
|
112
|
+
const articleAuthors = getArticleAuthors(article);
|
|
113
|
+
const matchesById = authorIds.length > 0 && articleAuthors.some((p) => p.id && authorIds.includes(p.id));
|
|
114
|
+
const matchesBySlug = authorSlugs.length > 0 &&
|
|
115
|
+
articleAuthors.some((p) => p.slug && authorSlugs.includes(p.slug));
|
|
116
|
+
const hasMatch = matchesById || matchesBySlug;
|
|
117
|
+
if (strictAuthorMatch && !hasMatch) {
|
|
118
|
+
return null;
|
|
119
|
+
}
|
|
120
|
+
if (hasMatch) {
|
|
74
121
|
score += 5; // Matching author adds 5 points
|
|
75
122
|
}
|
|
76
123
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"related-articles.js","sourceRoot":"","sources":["../../src/api/related-articles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAqB,MAAM,4BAA4B,CAAC;AAGlF
|
|
1
|
+
{"version":3,"file":"related-articles.js","sourceRoot":"","sources":["../../src/api/related-articles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAqB,MAAM,4BAA4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S,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"}
|
package/dist/api/types.d.ts
CHANGED
|
@@ -56,12 +56,24 @@ export interface SitemapConfig {
|
|
|
56
56
|
export interface RelatedArticlesOptions {
|
|
57
57
|
/** Articles to exclude from results */
|
|
58
58
|
excludeArticleIds?: string[];
|
|
59
|
-
/** Filter to articles matching any of these article
|
|
59
|
+
/** Filter to articles matching any of these article type IDs (OR) */
|
|
60
60
|
articleTypeIds?: string[];
|
|
61
|
-
/** Filter to articles matching any of these
|
|
61
|
+
/** Filter to articles matching any of these article type slugs (OR) */
|
|
62
|
+
articleTypeSlugs?: string[];
|
|
63
|
+
/** Filter to articles matching any of these tag IDs (OR); articles with more matches rank higher */
|
|
62
64
|
tagIds?: string[];
|
|
63
|
-
/** Filter
|
|
65
|
+
/** Filter to articles matching any of these tag slugs (OR); articles with more matches rank higher */
|
|
66
|
+
tagSlugs?: string[];
|
|
67
|
+
/** Filter to articles that have at least one tag belonging to any of these tag type IDs */
|
|
68
|
+
tagTypeIds?: string[];
|
|
69
|
+
/** Filter to articles that have at least one tag belonging to any of these tag type slugs */
|
|
70
|
+
tagTypeSlugs?: string[];
|
|
71
|
+
/** Filter/rank by author IDs - articles with matching authors are ranked higher */
|
|
64
72
|
authorIds?: string[];
|
|
73
|
+
/** Filter/rank by author slugs - articles with matching authors are ranked higher */
|
|
74
|
+
authorSlugs?: string[];
|
|
75
|
+
/** When true, authorIds/authorSlugs become a hard filter (exclude non-matching) rather than just a ranking boost */
|
|
76
|
+
strictAuthorMatch?: boolean;
|
|
65
77
|
/** Only include articles published before this date */
|
|
66
78
|
before?: Date;
|
|
67
79
|
/** Only include articles published after this date */
|
package/dist/api/types.d.ts.map
CHAN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