feedsmith 2.6.1 β†’ 2.8.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.
Files changed (44) hide show
  1. package/README.md +58 -54
  2. package/dist/common/config.cjs +50 -0
  3. package/dist/common/config.js +50 -0
  4. package/dist/common/utils.cjs +16 -23
  5. package/dist/common/utils.js +17 -24
  6. package/dist/feeds/rdf/common/types.d.cts +5 -0
  7. package/dist/feeds/rdf/common/types.d.ts +5 -0
  8. package/dist/feeds/rdf/parse/utils.cjs +21 -4
  9. package/dist/feeds/rdf/parse/utils.js +22 -5
  10. package/dist/feeds/rss/common/types.d.cts +8 -0
  11. package/dist/feeds/rss/common/types.d.ts +8 -0
  12. package/dist/feeds/rss/generate/utils.cjs +32 -24
  13. package/dist/feeds/rss/generate/utils.js +55 -47
  14. package/dist/feeds/rss/parse/utils.cjs +26 -18
  15. package/dist/feeds/rss/parse/utils.js +53 -45
  16. package/dist/namespaces/acast/common/types.d.cts +29 -0
  17. package/dist/namespaces/acast/common/types.d.ts +29 -0
  18. package/dist/namespaces/acast/generate/utils.cjs +43 -0
  19. package/dist/namespaces/acast/generate/utils.js +42 -0
  20. package/dist/namespaces/acast/parse/utils.cjs +43 -0
  21. package/dist/namespaces/acast/parse/utils.js +42 -0
  22. package/dist/namespaces/blogchannel/common/types.d.cts +10 -0
  23. package/dist/namespaces/blogchannel/common/types.d.ts +10 -0
  24. package/dist/namespaces/blogchannel/generate/utils.cjs +14 -0
  25. package/dist/namespaces/blogchannel/generate/utils.js +14 -0
  26. package/dist/namespaces/blogchannel/parse/utils.cjs +14 -0
  27. package/dist/namespaces/blogchannel/parse/utils.js +14 -0
  28. package/dist/namespaces/podcast/common/types.d.cts +12 -2
  29. package/dist/namespaces/podcast/common/types.d.ts +12 -2
  30. package/dist/namespaces/podcast/generate/utils.cjs +13 -5
  31. package/dist/namespaces/podcast/generate/utils.js +13 -5
  32. package/dist/namespaces/podcast/parse/utils.cjs +30 -4
  33. package/dist/namespaces/podcast/parse/utils.js +31 -5
  34. package/dist/namespaces/prism/common/types.d.cts +156 -0
  35. package/dist/namespaces/prism/common/types.d.ts +156 -0
  36. package/dist/namespaces/prism/generate/utils.cjs +154 -0
  37. package/dist/namespaces/prism/generate/utils.js +153 -0
  38. package/dist/namespaces/prism/parse/utils.cjs +154 -0
  39. package/dist/namespaces/prism/parse/utils.js +153 -0
  40. package/dist/namespaces/rdf/common/types.d.cts +19 -0
  41. package/dist/namespaces/rdf/common/types.d.ts +19 -0
  42. package/dist/namespaces/rdf/parse/utils.cjs +10 -0
  43. package/dist/namespaces/rdf/parse/utils.js +10 -0
  44. package/package.json +6 -6
package/README.md CHANGED
@@ -22,22 +22,22 @@ Feedsmith offers universal and format‑specific parsers that maintain the origi
22
22
 
23
23
  ### Core
24
24
 
25
- * **Comprehensive support** 🎯 β€” Supports all major feed formats and namespaces.
26
- * **Preserves structure** πŸ“¦ β€” Parsed feed object maintains the original feed structure making it easy to access the data.
27
- * **Smart namespace handling** 🧠 β€” Normalizes custom namespace prefixes to standard ones (e.g., `<custom:creator>` becomes `dc.creator`).
28
- * **Parsing & generating** πŸ”© β€” Use one package for both parsing and generating feeds.
25
+ * **Comprehensive support** β€” Supports all major feed formats and namespaces.
26
+ * **Preserves structure** β€” Parsed feed object maintains the original feed structure making it easy to access the data.
27
+ * **Smart namespace handling** β€” Normalizes custom namespace prefixes to standard ones (e.g., `<custom:creator>` becomes `dc.creator`).
28
+ * **Parsing & generating** β€” Use one package for both parsing and generating feeds.
29
29
 
30
30
  ### Leniency
31
- * **Normalizes legacy elements** ✨ β€” Upgrades feed elements to their modern equivalents so that you never need to worry about reading feeds in older formats.
32
- * **CaSe INSENsiTive** 🐍 β€” Handles fields and attributes in any case (lowercase, uppercase, mixed).
33
- * **Namespace URI tolerance** πŸ”§ β€” Accepts non-official namespace URIs (HTTPS variants, case variations, trailing slashes, whitespace).
34
- * **Forgiving** 🀝 β€” Gracefully handles malformed or incomplete feeds and extracts valid data. This makes it suitable for use with real-world feeds that may not strictly follow specifications.
31
+ * **Normalizes legacy elements** β€” Upgrades feed elements to their modern equivalents so that you never need to worry about reading feeds in older formats.
32
+ * **CaSe INSENsiTive** β€” Handles fields and attributes in any case (lowercase, uppercase, mixed).
33
+ * **Namespace URI tolerance** β€” Accepts non-official namespace URIs (HTTPS variants, case variations, trailing slashes, whitespace).
34
+ * **Forgiving** β€” Gracefully handles malformed or incomplete feeds and extracts valid data. This makes it suitable for use with real-world feeds that may not strictly follow specifications.
35
35
 
36
36
  ### Performance and Type-Safety
37
- * **Ultrafast parsing** ⚑ β€” One of the fastest JavaScript feed parsers ([see benchmarks](/benchmarks)).
38
- * **Type-safe API** πŸ›Ÿ β€” Built with TypeScript from the ground up, it provides complete type definitions for every feed format and namespace.
39
- * **Tree-shakable** πŸƒ β€” Only include the parts of the library you need, reducing bundle size.
40
- * **Well-tested** πŸ”¬ β€” Comprehensive test suite with over 2000 tests and 99% code coverage.
37
+ * **Ultrafast parsing** β€” One of the fastest JavaScript feed parsers ([see benchmarks](/benchmarks)).
38
+ * **Type-safe API** β€” Built with TypeScript from the ground up, it provides complete type definitions for every feed format and namespace.
39
+ * **Tree-shakable** β€” Only include the parts of the library you need, reducing bundle size.
40
+ * **Well-tested** β€” Comprehensive test suite with over 2000 tests and 99% code coverage.
41
41
 
42
42
  ### Compatibility
43
43
  * Works in Node.js 14.0.0+ and modern browsers.
@@ -56,51 +56,55 @@ Feedsmith aims to fully support all major feed formats and namespaces in complet
56
56
 
57
57
  ### Feeds
58
58
 
59
- | Format | Versions | Parsing | Generating |
60
- |--------|----------|---------|------------|
61
- | [RSS](http://cyber.law.harvard.edu/rss/rss.html) | 0.9x, 2.0 | βœ… | βœ… |
62
- | [Atom](https://tools.ietf.org/html/rfc4287) | 0.3, 1.0 | βœ… | βœ… |
63
- | [RDF](https://web.resource.org/rss/1.0/spec) | 0.9, 1.0 | βœ… | πŸ“‹ |
64
- | [JSON Feed](https://jsonfeed.org) | 1.0, 1.1 | βœ… | βœ… |
65
-
66
- ### Namespaces
67
-
68
- | Name | Prefix | Supported in | Parsing | Generating |
69
- |------|---------|--------------|---------|------------|
70
- | [Atom](http://www.w3.org/2005/Atom) | `<atom:*>` | RSS, RDF | βœ… | βœ… |
71
- | [Dublin Core](http://purl.org/dc/elements/1.1/) | `<dc:*>` | RSS, Atom, RDF | βœ… | βœ… |
72
- | [Dublin Core Terms](http://purl.org/dc/terms/) | `<dcterms:*>` | RSS, Atom, RDF | βœ… | βœ… |
73
- | [Syndication](http://purl.org/rss/1.0/modules/syndication/) | `<sy:*>` | RSS, Atom, RDF | βœ… | βœ… |
74
- | [Content](http://purl.org/rss/1.0/modules/content/) | `<content:*>` | RSS, RDF | βœ… | βœ… |
75
- | [Slash](http://purl.org/rss/1.0/modules/slash/) | `<slash:*>` | RSS, Atom, RDF | βœ… | βœ… |
76
- | [iTunes](http://www.itunes.com/dtds/podcast-1.0.dtd) | `<itunes:*>` | RSS, Atom | βœ… | βœ… |
77
- | [Podcast Index](https://podcastindex.org/namespace/1.0) | `<podcast:*>` | RSS | βœ… | βœ… |
78
- | [Podlove Simple Chapters](http://podlove.org/simple-chapters) | `<psc:*>` | RSS, Atom | βœ… | βœ… |
79
- | [Media RSS](http://search.yahoo.com/mrss/) | `<media:*>` | RSS, Atom, RDF | βœ… | βœ… |
80
- | [Google Play Podcast](https://www.google.com/schemas/play-podcasts/1.0/) | `<googleplay:*>` | RSS, Atom | βœ… | βœ… |
81
- | [Spotify](http://www.spotify.com/ns/rss) | `<spotify:*>` | RSS | βœ… | βœ… |
82
- | [RawVoice](https://blubrry.com/developer/rawvoice-rss/) | `<rawvoice:*>` | RSS | βœ… | βœ… |
83
- | [FeedPress](https://feedpress.com/xmlns) | `<feedpress:*>` | RSS | βœ… | βœ… |
84
- | [arXiv](http://arxiv.org/schemas/atom) | `<arxiv:*>` | Atom | βœ… | βœ… |
85
- | [OpenSearch](http://a9.com/-/spec/opensearch/1.1/) | `<opensearch:*>` | RSS, Atom | βœ… | βœ… |
86
- | [ccREL](http://creativecommons.org/ns#) | `<cc:*>` | RSS, Atom | βœ… | βœ… |
87
- | [Creative Commons](http://backend.userland.com/creativeCommonsRssModule) | `<creativeCommons:*>` | RSS, Atom | βœ… | βœ… |
88
- | [Atom Threading](https://www.ietf.org/rfc/rfc4685.txt) | `<thr:*>` | RSS, Atom | βœ… | βœ… |
89
- | [Atom Publishing Protocol](http://www.w3.org/2007/app) | `<app:*>` | Atom | βœ… | βœ… |
90
- | [Comment API](http://wellformedweb.org/CommentAPI/) | `<wfw:*>` | RSS, Atom, RDF | βœ… | βœ… |
91
- | [Administrative](http://webns.net/mvcb/) | `<admin:*>` | RSS, Atom, RDF | βœ… | βœ… |
92
- | [Pingback](http://madskills.com/public/xml/rss/module/pingback/) | `<pingback:*>` | RSS, Atom | βœ… | βœ… |
93
- | [Trackback](http://madskills.com/public/xml/rss/module/trackback/) | `<trackback:*>` | RSS, Atom | βœ… | βœ… |
94
- | [Source](http://source.scripting.com/) | `<source:*>` | RSS | βœ… | βœ… |
95
- | [YouTube](https://www.youtube.com/feeds/videos.xml) | `<yt:*>` | Atom | βœ… | βœ… |
96
- | [W3C Basic Geo](http://www.w3.org/2003/01/geo/wgs84_pos#) | `<geo:*>` | RSS, Atom | βœ… | βœ… |
97
- | [GeoRSS Simple](http://www.georss.org/georss) | `<georss:*>` | RSS, Atom, RDF | βœ… | βœ… |
59
+ | Format | Versions | Parse | Generate |
60
+ |--------|----------|-------|----------|
61
+ | [RSS](https://feedsmith.dev/reference/feeds/rss) | 0.9x, 2.0 | βœ… | βœ… |
62
+ | [Atom](https://feedsmith.dev/reference/feeds/atom) | 0.3, 1.0 | βœ… | βœ… |
63
+ | [RDF](https://feedsmith.dev/reference/feeds/rdf) | 0.9, 1.0 | βœ… | πŸ“‹ |
64
+ | [JSON Feed](https://feedsmith.dev/reference/feeds/json) | 1.0, 1.1 | βœ… | βœ… |
98
65
 
99
66
  ### Other
100
67
 
101
- | Format | Versions | Parsing | Generating |
102
- |--------|----------|---------|------------|
103
- | [OPML](https://opml.org/) | 1.0, 2.0 | βœ… | βœ… |
68
+ | Format | Versions | Parse | Generate |
69
+ |--------|----------|-------|----------|
70
+ | [OPML](https://feedsmith.dev/reference/other/opml) | 1.0, 2.0 | βœ… | βœ… |
71
+
72
+ ### Feed Namespaces
73
+
74
+ | Name | Prefix | Supported in | Parse | Generate |
75
+ |------|---------|--------------|-------|----------|
76
+ | [Atom](https://feedsmith.dev/reference/namespaces/atom) | `<atom:*>` | RSS, RDF | βœ… | βœ… |
77
+ | [Dublin Core](https://feedsmith.dev/reference/namespaces/dc) | `<dc:*>` | RSS, Atom, RDF | βœ… | βœ… |
78
+ | [Dublin Core Terms](https://feedsmith.dev/reference/namespaces/dcterms) | `<dcterms:*>` | RSS, Atom, RDF | βœ… | βœ… |
79
+ | [Syndication](https://feedsmith.dev/reference/namespaces/sy) | `<sy:*>` | RSS, Atom, RDF | βœ… | βœ… |
80
+ | [Content](https://feedsmith.dev/reference/namespaces/content) | `<content:*>` | RSS, RDF | βœ… | βœ… |
81
+ | [Slash](https://feedsmith.dev/reference/namespaces/slash) | `<slash:*>` | RSS, Atom, RDF | βœ… | βœ… |
82
+ | [iTunes](https://feedsmith.dev/reference/namespaces/itunes) | `<itunes:*>` | RSS, Atom | βœ… | βœ… |
83
+ | [Podcast Index](https://feedsmith.dev/reference/namespaces/podcast) | `<podcast:*>` | RSS | βœ… | βœ… |
84
+ | [Podlove Simple Chapters](https://feedsmith.dev/reference/namespaces/psc) | `<psc:*>` | RSS, Atom | βœ… | βœ… |
85
+ | [Media RSS](https://feedsmith.dev/reference/namespaces/media) | `<media:*>` | RSS, Atom, RDF | βœ… | βœ… |
86
+ | [Google Play Podcast](https://feedsmith.dev/reference/namespaces/googleplay) | `<googleplay:*>` | RSS, Atom | βœ… | βœ… |
87
+ | [Spotify](https://feedsmith.dev/reference/namespaces/spotify) | `<spotify:*>` | RSS | βœ… | βœ… |
88
+ | [Acast](https://feedsmith.dev/reference/namespaces/acast) | `<acast:*>` | RSS | βœ… | βœ… |
89
+ | [RawVoice](https://feedsmith.dev/reference/namespaces/rawvoice) | `<rawvoice:*>` | RSS | βœ… | βœ… |
90
+ | [FeedPress](https://feedsmith.dev/reference/namespaces/feedpress) | `<feedpress:*>` | RSS | βœ… | βœ… |
91
+ | [arXiv](https://feedsmith.dev/reference/namespaces/arxiv) | `<arxiv:*>` | Atom | βœ… | βœ… |
92
+ | [OpenSearch](https://feedsmith.dev/reference/namespaces/opensearch) | `<opensearch:*>` | RSS, Atom | βœ… | βœ… |
93
+ | [PRISM](https://feedsmith.dev/reference/namespaces/prism) | `<prism:*>` | RSS | βœ… | βœ… |
94
+ | [ccREL](https://feedsmith.dev/reference/namespaces/cc) | `<cc:*>` | RSS, Atom | βœ… | βœ… |
95
+ | [Creative Commons](https://feedsmith.dev/reference/namespaces/creativecommons) | `<creativeCommons:*>` | RSS, Atom | βœ… | βœ… |
96
+ | [Atom Threading](https://feedsmith.dev/reference/namespaces/thr) | `<thr:*>` | RSS, Atom | βœ… | βœ… |
97
+ | [Atom Publishing Protocol](https://feedsmith.dev/reference/namespaces/app) | `<app:*>` | Atom | βœ… | βœ… |
98
+ | [Comment API](https://feedsmith.dev/reference/namespaces/wfw) | `<wfw:*>` | RSS, Atom, RDF | βœ… | βœ… |
99
+ | [Administrative](https://feedsmith.dev/reference/namespaces/admin) | `<admin:*>` | RSS, Atom, RDF | βœ… | βœ… |
100
+ | [Pingback](https://feedsmith.dev/reference/namespaces/pingback) | `<pingback:*>` | RSS, Atom | βœ… | βœ… |
101
+ | [Trackback](https://feedsmith.dev/reference/namespaces/trackback) | `<trackback:*>` | RSS, Atom | βœ… | βœ… |
102
+ | [Source](https://feedsmith.dev/reference/namespaces/source) | `<source:*>` | RSS | βœ… | βœ… |
103
+ | [blogChannel](https://feedsmith.dev/reference/namespaces/blogchannel) | `<blogChannel:*>` | RSS | βœ… | βœ… |
104
+ | [YouTube](https://feedsmith.dev/reference/namespaces/yt) | `<yt:*>` | Atom | βœ… | βœ… |
105
+ | [W3C Basic Geo](https://feedsmith.dev/reference/namespaces/geo) | `<geo:*>` | RSS, Atom | βœ… | βœ… |
106
+ | [GeoRSS Simple](https://feedsmith.dev/reference/namespaces/georss) | `<georss:*>` | RSS, Atom, RDF | βœ… | βœ… |
107
+ | [RDF](https://feedsmith.dev/reference/namespaces/rdf) | `<rdf:*>` | RDF | βœ… | βœ… |
104
108
 
105
109
  ## Quick Start
106
110
 
@@ -46,6 +46,12 @@ const namespaceUris = {
46
46
  "http://purl.org/atom/ns#",
47
47
  "https://purl.org/atom/ns#"
48
48
  ],
49
+ blogChannel: [
50
+ "http://backend.userland.com/blogChannelModule",
51
+ "https://backend.userland.com/blogChannelModule",
52
+ "http://backend.userland.com/blogChannelModule/",
53
+ "https://backend.userland.com/blogChannelModule/"
54
+ ],
49
55
  app: [
50
56
  "http://www.w3.org/2007/app",
51
57
  "https://www.w3.org/2007/app",
@@ -251,6 +257,50 @@ const namespaceUris = {
251
257
  "https://madskills.com/public/xml/rss/module/trackback/",
252
258
  "http://madskills.com/public/xml/rss/module/trackback",
253
259
  "https://madskills.com/public/xml/rss/module/trackback"
260
+ ],
261
+ prism: [
262
+ "http://prismstandard.org/namespaces/basic/3.0/",
263
+ "https://prismstandard.org/namespaces/basic/3.0/",
264
+ "http://prismstandard.org/namespaces/basic/3.0",
265
+ "https://prismstandard.org/namespaces/basic/3.0",
266
+ "http://prismstandard.org/namespaces/basic/2.2/",
267
+ "https://prismstandard.org/namespaces/basic/2.2/",
268
+ "http://prismstandard.org/namespaces/basic/2.2",
269
+ "https://prismstandard.org/namespaces/basic/2.2",
270
+ "http://prismstandard.org/namespaces/basic/2.1/",
271
+ "https://prismstandard.org/namespaces/basic/2.1/",
272
+ "http://prismstandard.org/namespaces/basic/2.1",
273
+ "https://prismstandard.org/namespaces/basic/2.1",
274
+ "http://prismstandard.org/namespaces/basic/2.0/",
275
+ "https://prismstandard.org/namespaces/basic/2.0/",
276
+ "http://prismstandard.org/namespaces/basic/2.0",
277
+ "https://prismstandard.org/namespaces/basic/2.0",
278
+ "http://prismstandard.org/namespaces/2.0/basic/",
279
+ "https://prismstandard.org/namespaces/2.0/basic/",
280
+ "http://prismstandard.org/namespaces/2.0/basic",
281
+ "https://prismstandard.org/namespaces/2.0/basic",
282
+ "http://prismstandard.org/namespaces/1.2/basic/",
283
+ "https://prismstandard.org/namespaces/1.2/basic/",
284
+ "http://prismstandard.org/namespaces/1.2/basic",
285
+ "https://prismstandard.org/namespaces/1.2/basic",
286
+ "http://prismstandard.org/namespaces/1.1/basic/",
287
+ "https://prismstandard.org/namespaces/1.1/basic/",
288
+ "http://prismstandard.org/namespaces/1.1/basic",
289
+ "https://prismstandard.org/namespaces/1.1/basic",
290
+ "http://prismstandard.org/namespaces/1.0/basic/",
291
+ "https://prismstandard.org/namespaces/1.0/basic/",
292
+ "http://prismstandard.org/namespaces/1.0/basic",
293
+ "https://prismstandard.org/namespaces/1.0/basic",
294
+ "http://purl.org/rss/1.0/modules/prism/",
295
+ "https://purl.org/rss/1.0/modules/prism/",
296
+ "http://purl.org/rss/1.0/modules/prism",
297
+ "https://purl.org/rss/1.0/modules/prism"
298
+ ],
299
+ acast: [
300
+ "https://schema.acast.com/1.0/",
301
+ "http://schema.acast.com/1.0/",
302
+ "https://schema.acast.com/1.0",
303
+ "http://schema.acast.com/1.0"
254
304
  ]
255
305
  };
256
306
  const namespacePrefixes = Object.entries(namespaceUris).reduce((prefixes, [prefix, uris]) => {
@@ -45,6 +45,12 @@ const namespaceUris = {
45
45
  "http://purl.org/atom/ns#",
46
46
  "https://purl.org/atom/ns#"
47
47
  ],
48
+ blogChannel: [
49
+ "http://backend.userland.com/blogChannelModule",
50
+ "https://backend.userland.com/blogChannelModule",
51
+ "http://backend.userland.com/blogChannelModule/",
52
+ "https://backend.userland.com/blogChannelModule/"
53
+ ],
48
54
  app: [
49
55
  "http://www.w3.org/2007/app",
50
56
  "https://www.w3.org/2007/app",
@@ -250,6 +256,50 @@ const namespaceUris = {
250
256
  "https://madskills.com/public/xml/rss/module/trackback/",
251
257
  "http://madskills.com/public/xml/rss/module/trackback",
252
258
  "https://madskills.com/public/xml/rss/module/trackback"
259
+ ],
260
+ prism: [
261
+ "http://prismstandard.org/namespaces/basic/3.0/",
262
+ "https://prismstandard.org/namespaces/basic/3.0/",
263
+ "http://prismstandard.org/namespaces/basic/3.0",
264
+ "https://prismstandard.org/namespaces/basic/3.0",
265
+ "http://prismstandard.org/namespaces/basic/2.2/",
266
+ "https://prismstandard.org/namespaces/basic/2.2/",
267
+ "http://prismstandard.org/namespaces/basic/2.2",
268
+ "https://prismstandard.org/namespaces/basic/2.2",
269
+ "http://prismstandard.org/namespaces/basic/2.1/",
270
+ "https://prismstandard.org/namespaces/basic/2.1/",
271
+ "http://prismstandard.org/namespaces/basic/2.1",
272
+ "https://prismstandard.org/namespaces/basic/2.1",
273
+ "http://prismstandard.org/namespaces/basic/2.0/",
274
+ "https://prismstandard.org/namespaces/basic/2.0/",
275
+ "http://prismstandard.org/namespaces/basic/2.0",
276
+ "https://prismstandard.org/namespaces/basic/2.0",
277
+ "http://prismstandard.org/namespaces/2.0/basic/",
278
+ "https://prismstandard.org/namespaces/2.0/basic/",
279
+ "http://prismstandard.org/namespaces/2.0/basic",
280
+ "https://prismstandard.org/namespaces/2.0/basic",
281
+ "http://prismstandard.org/namespaces/1.2/basic/",
282
+ "https://prismstandard.org/namespaces/1.2/basic/",
283
+ "http://prismstandard.org/namespaces/1.2/basic",
284
+ "https://prismstandard.org/namespaces/1.2/basic",
285
+ "http://prismstandard.org/namespaces/1.1/basic/",
286
+ "https://prismstandard.org/namespaces/1.1/basic/",
287
+ "http://prismstandard.org/namespaces/1.1/basic",
288
+ "https://prismstandard.org/namespaces/1.1/basic",
289
+ "http://prismstandard.org/namespaces/1.0/basic/",
290
+ "https://prismstandard.org/namespaces/1.0/basic/",
291
+ "http://prismstandard.org/namespaces/1.0/basic",
292
+ "https://prismstandard.org/namespaces/1.0/basic",
293
+ "http://purl.org/rss/1.0/modules/prism/",
294
+ "https://purl.org/rss/1.0/modules/prism/",
295
+ "http://purl.org/rss/1.0/modules/prism",
296
+ "https://purl.org/rss/1.0/modules/prism"
297
+ ],
298
+ acast: [
299
+ "https://schema.acast.com/1.0/",
300
+ "http://schema.acast.com/1.0/",
301
+ "https://schema.acast.com/1.0",
302
+ "http://schema.acast.com/1.0"
253
303
  ]
254
304
  };
255
305
  const namespacePrefixes = Object.entries(namespaceUris).reduce((prefixes, [prefix, uris]) => {
@@ -64,39 +64,32 @@ const generateSingularOrArray = (singularValue, pluralValues, generator) => {
64
64
  };
65
65
  const cdataStartTag = "<![CDATA[";
66
66
  const cdataEndTag = "]]>";
67
- const stripCdata = (text) => {
68
- if (typeof text !== "string") return text;
67
+ const hasEntities = (text) => {
68
+ const ampIndex = text.indexOf("&");
69
+ return ampIndex !== -1 && text.indexOf(";", ampIndex) !== -1;
70
+ };
71
+ const decodeWithCdata = (text) => {
69
72
  let currentIndex = text.indexOf(cdataStartTag);
70
- if (currentIndex === -1) return text;
73
+ if (currentIndex === -1) return hasEntities(text) ? (0, entities.decodeHTML)(text) : text;
71
74
  let result = "";
72
75
  let lastIndex = 0;
73
76
  while (currentIndex !== -1) {
74
- result += text.substring(lastIndex, currentIndex);
75
- lastIndex = text.indexOf(cdataEndTag, currentIndex + 9);
76
- if (lastIndex === -1) return text;
77
- result += text.substring(currentIndex + 9, lastIndex);
78
- lastIndex += 3;
77
+ const textBefore = text.substring(lastIndex, currentIndex);
78
+ result += hasEntities(textBefore) ? (0, entities.decodeHTML)(textBefore) : textBefore;
79
+ const endIndex = text.indexOf(cdataEndTag, currentIndex + 9);
80
+ if (endIndex === -1) return hasEntities(text) ? (0, entities.decodeHTML)(text) : text;
81
+ result += text.substring(currentIndex + 9, endIndex);
82
+ lastIndex = endIndex + 3;
79
83
  currentIndex = text.indexOf(cdataStartTag, lastIndex);
80
84
  }
81
- result += text.substring(lastIndex);
85
+ const textAfter = text.substring(lastIndex);
86
+ result += hasEntities(textAfter) ? (0, entities.decodeHTML)(textAfter) : textAfter;
82
87
  return result;
83
88
  };
84
- const hasEntities = (text) => {
85
- const ampIndex = text.indexOf("&");
86
- return ampIndex !== -1 && text.indexOf(";", ampIndex) !== -1;
87
- };
88
89
  const parseString = (value) => {
89
90
  if (typeof value === "string") {
90
91
  if (value === "") return;
91
- let string = value;
92
- if (value.indexOf(cdataStartTag) !== -1) string = stripCdata(value);
93
- string = string.trim();
94
- if (string === "") return;
95
- if (hasEntities(string)) {
96
- string = (0, entities.decodeXML)(string);
97
- if (hasEntities(string)) string = (0, entities.decodeHTML)(string);
98
- }
99
- return string || void 0;
92
+ return decodeWithCdata(value).trim() || void 0;
100
93
  }
101
94
  if (typeof value === "number") return value.toString();
102
95
  };
@@ -307,8 +300,8 @@ const createNamespaceNormalizator = (namespaceUris, namespacePrefixes, primaryNa
307
300
  return normalizeWithContext(key, context, true);
308
301
  };
309
302
  const traverseAndNormalize = (object, parentContext = {}) => {
310
- if (!isObject(object)) return object;
311
303
  if (Array.isArray(object)) return object.map((item) => traverseAndNormalize(item, parentContext));
304
+ if (!isObject(object)) return object;
312
305
  const normalizedObject = {};
313
306
  const keyGroups = /* @__PURE__ */ new Map();
314
307
  const declarations = extractNamespaceDeclarations(object);
@@ -1,4 +1,4 @@
1
- import { decodeHTML, decodeXML } from "entities";
1
+ import { decodeHTML } from "entities";
2
2
 
3
3
  //#region src/common/utils.ts
4
4
  const isPresent = (value) => {
@@ -64,39 +64,32 @@ const generateSingularOrArray = (singularValue, pluralValues, generator) => {
64
64
  };
65
65
  const cdataStartTag = "<![CDATA[";
66
66
  const cdataEndTag = "]]>";
67
- const stripCdata = (text) => {
68
- if (typeof text !== "string") return text;
67
+ const hasEntities = (text) => {
68
+ const ampIndex = text.indexOf("&");
69
+ return ampIndex !== -1 && text.indexOf(";", ampIndex) !== -1;
70
+ };
71
+ const decodeWithCdata = (text) => {
69
72
  let currentIndex = text.indexOf(cdataStartTag);
70
- if (currentIndex === -1) return text;
73
+ if (currentIndex === -1) return hasEntities(text) ? decodeHTML(text) : text;
71
74
  let result = "";
72
75
  let lastIndex = 0;
73
76
  while (currentIndex !== -1) {
74
- result += text.substring(lastIndex, currentIndex);
75
- lastIndex = text.indexOf(cdataEndTag, currentIndex + 9);
76
- if (lastIndex === -1) return text;
77
- result += text.substring(currentIndex + 9, lastIndex);
78
- lastIndex += 3;
77
+ const textBefore = text.substring(lastIndex, currentIndex);
78
+ result += hasEntities(textBefore) ? decodeHTML(textBefore) : textBefore;
79
+ const endIndex = text.indexOf(cdataEndTag, currentIndex + 9);
80
+ if (endIndex === -1) return hasEntities(text) ? decodeHTML(text) : text;
81
+ result += text.substring(currentIndex + 9, endIndex);
82
+ lastIndex = endIndex + 3;
79
83
  currentIndex = text.indexOf(cdataStartTag, lastIndex);
80
84
  }
81
- result += text.substring(lastIndex);
85
+ const textAfter = text.substring(lastIndex);
86
+ result += hasEntities(textAfter) ? decodeHTML(textAfter) : textAfter;
82
87
  return result;
83
88
  };
84
- const hasEntities = (text) => {
85
- const ampIndex = text.indexOf("&");
86
- return ampIndex !== -1 && text.indexOf(";", ampIndex) !== -1;
87
- };
88
89
  const parseString = (value) => {
89
90
  if (typeof value === "string") {
90
91
  if (value === "") return;
91
- let string = value;
92
- if (value.indexOf(cdataStartTag) !== -1) string = stripCdata(value);
93
- string = string.trim();
94
- if (string === "") return;
95
- if (hasEntities(string)) {
96
- string = decodeXML(string);
97
- if (hasEntities(string)) string = decodeHTML(string);
98
- }
99
- return string || void 0;
92
+ return decodeWithCdata(value).trim() || void 0;
100
93
  }
101
94
  if (typeof value === "number") return value.toString();
102
95
  };
@@ -307,8 +300,8 @@ const createNamespaceNormalizator = (namespaceUris, namespacePrefixes, primaryNa
307
300
  return normalizeWithContext(key, context, true);
308
301
  };
309
302
  const traverseAndNormalize = (object, parentContext = {}) => {
310
- if (!isObject(object)) return object;
311
303
  if (Array.isArray(object)) return object.map((item) => traverseAndNormalize(item, parentContext));
304
+ if (!isObject(object)) return object;
312
305
  const normalizedObject = {};
313
306
  const keyGroups = /* @__PURE__ */ new Map();
314
307
  const declarations = extractNamespaceDeclarations(object);
@@ -9,6 +9,7 @@ import { SyNs } from "../../../namespaces/sy/common/types.cjs";
9
9
  import { WfwNs } from "../../../namespaces/wfw/common/types.cjs";
10
10
  import { AtomNs } from "../../../namespaces/atom/common/types.cjs";
11
11
  import { ContentNs } from "../../../namespaces/content/common/types.cjs";
12
+ import { RdfNs } from "../../../namespaces/rdf/common/types.cjs";
12
13
 
13
14
  //#region src/feeds/rdf/common/types.d.ts
14
15
  declare namespace Rdf {
@@ -16,17 +17,20 @@ declare namespace Rdf {
16
17
  title: string;
17
18
  link: string;
18
19
  url?: string;
20
+ rdf?: RdfNs.About;
19
21
  };
20
22
  type TextInput = {
21
23
  title: string;
22
24
  description: string;
23
25
  name: string;
24
26
  link: string;
27
+ rdf?: RdfNs.About;
25
28
  };
26
29
  type Item<TDate extends DateLike> = {
27
30
  title: string;
28
31
  link: string;
29
32
  description?: string;
33
+ rdf?: RdfNs.About;
30
34
  atom?: AtomNs.Entry<TDate>;
31
35
  dc?: DcNs.ItemOrFeed<TDate>;
32
36
  content?: ContentNs.Item;
@@ -43,6 +47,7 @@ declare namespace Rdf {
43
47
  image?: Image;
44
48
  items?: Array<Item<TDate>>;
45
49
  textInput?: TextInput;
50
+ rdf?: RdfNs.About;
46
51
  atom?: AtomNs.Feed<TDate>;
47
52
  dc?: DcNs.ItemOrFeed<TDate>;
48
53
  sy?: SyNs.Feed<TDate>;
@@ -9,6 +9,7 @@ import { SyNs } from "../../../namespaces/sy/common/types.js";
9
9
  import { WfwNs } from "../../../namespaces/wfw/common/types.js";
10
10
  import { AtomNs } from "../../../namespaces/atom/common/types.js";
11
11
  import { ContentNs } from "../../../namespaces/content/common/types.js";
12
+ import { RdfNs } from "../../../namespaces/rdf/common/types.js";
12
13
 
13
14
  //#region src/feeds/rdf/common/types.d.ts
14
15
  declare namespace Rdf {
@@ -16,17 +17,20 @@ declare namespace Rdf {
16
17
  title: string;
17
18
  link: string;
18
19
  url?: string;
20
+ rdf?: RdfNs.About;
19
21
  };
20
22
  type TextInput = {
21
23
  title: string;
22
24
  description: string;
23
25
  name: string;
24
26
  link: string;
27
+ rdf?: RdfNs.About;
25
28
  };
26
29
  type Item<TDate extends DateLike> = {
27
30
  title: string;
28
31
  link: string;
29
32
  description?: string;
33
+ rdf?: RdfNs.About;
30
34
  atom?: AtomNs.Entry<TDate>;
31
35
  dc?: DcNs.ItemOrFeed<TDate>;
32
36
  content?: ContentNs.Item;
@@ -43,6 +47,7 @@ declare namespace Rdf {
43
47
  image?: Image;
44
48
  items?: Array<Item<TDate>>;
45
49
  textInput?: TextInput;
50
+ rdf?: RdfNs.About;
46
51
  atom?: AtomNs.Feed<TDate>;
47
52
  dc?: DcNs.ItemOrFeed<TDate>;
48
53
  sy?: SyNs.Feed<TDate>;
@@ -9,18 +9,29 @@ const require_utils$7 = require('../../../namespaces/sy/parse/utils.cjs');
9
9
  const require_utils$8 = require('../../../namespaces/wfw/parse/utils.cjs');
10
10
  const require_utils$9 = require('../../../namespaces/atom/parse/utils.cjs');
11
11
  const require_utils$10 = require('../../../namespaces/content/parse/utils.cjs');
12
+ const require_utils$11 = require('../../../namespaces/rdf/parse/utils.cjs');
12
13
 
13
14
  //#region src/feeds/rdf/parse/utils.ts
15
+ const retrieveByAbout = (elements, resourceUri) => {
16
+ if (!resourceUri) return;
17
+ return (Array.isArray(elements) ? elements : [elements]).find((el) => el?.["@about"] === resourceUri);
18
+ };
19
+ const findByTocReference = (value, property) => {
20
+ if (!require_utils.isObject(value)) return;
21
+ const resourceUri = require_utils.parseString(require_utils.parseSingular(require_utils.parseSingular(value.channel)?.[property])?.["@resource"]);
22
+ return retrieveByAbout(value[property], resourceUri);
23
+ };
14
24
  const parseImage = (value) => {
15
25
  if (!require_utils.isObject(value)) return;
16
26
  return require_utils.trimObject({
17
27
  title: require_utils.parseSingularOf(value.title, (value$1) => require_utils.parseString(require_utils.retrieveText(value$1))),
18
28
  link: require_utils.parseSingularOf(value.link, (value$1) => require_utils.parseString(require_utils.retrieveText(value$1))),
19
- url: require_utils.parseSingularOf(value.url, (value$1) => require_utils.parseString(require_utils.retrieveText(value$1)))
29
+ url: require_utils.parseSingularOf(value.url, (value$1) => require_utils.parseString(require_utils.retrieveText(value$1))),
30
+ rdf: require_utils$11.retrieveAbout(value)
20
31
  });
21
32
  };
22
33
  const retrieveImage = (value) => {
23
- return require_utils.parseSingularOf(value?.image, parseImage);
34
+ return parseImage(findByTocReference(value, "image")) ?? require_utils.parseSingularOf(value?.image, parseImage);
24
35
  };
25
36
  const parseTextInput = (value) => {
26
37
  if (!require_utils.isObject(value)) return;
@@ -28,11 +39,12 @@ const parseTextInput = (value) => {
28
39
  title: require_utils.parseSingularOf(value.title, (value$1) => require_utils.parseString(require_utils.retrieveText(value$1))),
29
40
  description: require_utils.parseSingularOf(value.description, (value$1) => require_utils.parseString(require_utils.retrieveText(value$1))),
30
41
  name: require_utils.parseSingularOf(value.name, (value$1) => require_utils.parseString(require_utils.retrieveText(value$1))),
31
- link: require_utils.parseSingularOf(value.link, (value$1) => require_utils.parseString(require_utils.retrieveText(value$1)))
42
+ link: require_utils.parseSingularOf(value.link, (value$1) => require_utils.parseString(require_utils.retrieveText(value$1))),
43
+ rdf: require_utils$11.retrieveAbout(value)
32
44
  });
33
45
  };
34
46
  const retrieveTextInput = (value) => {
35
- return require_utils.parseSingularOf(value?.textinput, parseTextInput);
47
+ return parseTextInput(findByTocReference(value, "textinput")) ?? require_utils.parseSingularOf(value?.textinput, parseTextInput);
36
48
  };
37
49
  const parseItem = (value) => {
38
50
  if (!require_utils.isObject(value)) return;
@@ -41,6 +53,7 @@ const parseItem = (value) => {
41
53
  title: require_utils.parseSingularOf(value.title, (value$1) => require_utils.parseString(require_utils.retrieveText(value$1))),
42
54
  link: require_utils.parseSingularOf(value.link, (value$1) => require_utils.parseString(require_utils.retrieveText(value$1))),
43
55
  description: require_utils.parseSingularOf(value.description, (value$1) => require_utils.parseString(require_utils.retrieveText(value$1))),
56
+ rdf: require_utils$11.retrieveAbout(value),
44
57
  atom: namespaces.has("atom") ? require_utils$9.retrieveEntry(value) : void 0,
45
58
  dc: namespaces.has("dc") ? require_utils$2.retrieveItemOrFeed(value) : void 0,
46
59
  content: namespaces.has("content") ? require_utils$10.retrieveItem(value) : void 0,
@@ -52,6 +65,9 @@ const parseItem = (value) => {
52
65
  });
53
66
  };
54
67
  const retrieveItems = (value, options) => {
68
+ if (!require_utils.isObject(value)) return;
69
+ const items = require_utils.trimArray(require_utils.parseArrayOf(require_utils.parseSingular(require_utils.parseSingular(require_utils.parseSingular(value.channel)?.items)?.seq)?.li, (li) => require_utils.parseString(li?.["@resource"]), options?.maxItems)?.map((uri) => retrieveByAbout(value.item, uri)), parseItem);
70
+ if (items?.length) return items;
55
71
  return require_utils.parseArrayOf(value?.item, parseItem, options?.maxItems);
56
72
  };
57
73
  const parseFeed = (value, options) => {
@@ -65,6 +81,7 @@ const parseFeed = (value, options) => {
65
81
  image: retrieveImage(value),
66
82
  items: retrieveItems(value, options),
67
83
  textInput: retrieveTextInput(value),
84
+ rdf: require_utils$11.retrieveAbout(channel),
68
85
  atom: namespaces.has("atom") ? require_utils$9.retrieveFeed(channel) : void 0,
69
86
  dc: namespaces.has("dc") ? require_utils$2.retrieveItemOrFeed(channel) : void 0,
70
87
  sy: namespaces.has("sy") ? require_utils$7.retrieveFeed(channel) : void 0,
@@ -1,4 +1,4 @@
1
- import { detectNamespaces, isObject, parseArrayOf, parseSingular, parseSingularOf, parseString, retrieveText, trimObject } from "../../../common/utils.js";
1
+ import { detectNamespaces, isObject, parseArrayOf, parseSingular, parseSingularOf, parseString, retrieveText, trimArray, trimObject } from "../../../common/utils.js";
2
2
  import { retrieveFeed } from "../../../namespaces/admin/parse/utils.js";
3
3
  import { retrieveItemOrFeed } from "../../../namespaces/dc/parse/utils.js";
4
4
  import { retrieveItemOrFeed as retrieveItemOrFeed$1 } from "../../../namespaces/dcterms/parse/utils.js";
@@ -9,18 +9,29 @@ import { retrieveFeed as retrieveFeed$2 } from "../../../namespaces/sy/parse/uti
9
9
  import { retrieveItem as retrieveItem$2 } from "../../../namespaces/wfw/parse/utils.js";
10
10
  import { retrieveEntry, retrieveFeed as retrieveFeed$1 } from "../../../namespaces/atom/parse/utils.js";
11
11
  import { retrieveItem } from "../../../namespaces/content/parse/utils.js";
12
+ import { retrieveAbout } from "../../../namespaces/rdf/parse/utils.js";
12
13
 
13
14
  //#region src/feeds/rdf/parse/utils.ts
15
+ const retrieveByAbout = (elements, resourceUri) => {
16
+ if (!resourceUri) return;
17
+ return (Array.isArray(elements) ? elements : [elements]).find((el) => el?.["@about"] === resourceUri);
18
+ };
19
+ const findByTocReference = (value, property) => {
20
+ if (!isObject(value)) return;
21
+ const resourceUri = parseString(parseSingular(parseSingular(value.channel)?.[property])?.["@resource"]);
22
+ return retrieveByAbout(value[property], resourceUri);
23
+ };
14
24
  const parseImage = (value) => {
15
25
  if (!isObject(value)) return;
16
26
  return trimObject({
17
27
  title: parseSingularOf(value.title, (value$1) => parseString(retrieveText(value$1))),
18
28
  link: parseSingularOf(value.link, (value$1) => parseString(retrieveText(value$1))),
19
- url: parseSingularOf(value.url, (value$1) => parseString(retrieveText(value$1)))
29
+ url: parseSingularOf(value.url, (value$1) => parseString(retrieveText(value$1))),
30
+ rdf: retrieveAbout(value)
20
31
  });
21
32
  };
22
33
  const retrieveImage = (value) => {
23
- return parseSingularOf(value?.image, parseImage);
34
+ return parseImage(findByTocReference(value, "image")) ?? parseSingularOf(value?.image, parseImage);
24
35
  };
25
36
  const parseTextInput = (value) => {
26
37
  if (!isObject(value)) return;
@@ -28,11 +39,12 @@ const parseTextInput = (value) => {
28
39
  title: parseSingularOf(value.title, (value$1) => parseString(retrieveText(value$1))),
29
40
  description: parseSingularOf(value.description, (value$1) => parseString(retrieveText(value$1))),
30
41
  name: parseSingularOf(value.name, (value$1) => parseString(retrieveText(value$1))),
31
- link: parseSingularOf(value.link, (value$1) => parseString(retrieveText(value$1)))
42
+ link: parseSingularOf(value.link, (value$1) => parseString(retrieveText(value$1))),
43
+ rdf: retrieveAbout(value)
32
44
  });
33
45
  };
34
46
  const retrieveTextInput = (value) => {
35
- return parseSingularOf(value?.textinput, parseTextInput);
47
+ return parseTextInput(findByTocReference(value, "textinput")) ?? parseSingularOf(value?.textinput, parseTextInput);
36
48
  };
37
49
  const parseItem = (value) => {
38
50
  if (!isObject(value)) return;
@@ -41,6 +53,7 @@ const parseItem = (value) => {
41
53
  title: parseSingularOf(value.title, (value$1) => parseString(retrieveText(value$1))),
42
54
  link: parseSingularOf(value.link, (value$1) => parseString(retrieveText(value$1))),
43
55
  description: parseSingularOf(value.description, (value$1) => parseString(retrieveText(value$1))),
56
+ rdf: retrieveAbout(value),
44
57
  atom: namespaces.has("atom") ? retrieveEntry(value) : void 0,
45
58
  dc: namespaces.has("dc") ? retrieveItemOrFeed(value) : void 0,
46
59
  content: namespaces.has("content") ? retrieveItem(value) : void 0,
@@ -52,6 +65,9 @@ const parseItem = (value) => {
52
65
  });
53
66
  };
54
67
  const retrieveItems = (value, options) => {
68
+ if (!isObject(value)) return;
69
+ const items = trimArray(parseArrayOf(parseSingular(parseSingular(parseSingular(value.channel)?.items)?.seq)?.li, (li) => parseString(li?.["@resource"]), options?.maxItems)?.map((uri) => retrieveByAbout(value.item, uri)), parseItem);
70
+ if (items?.length) return items;
55
71
  return parseArrayOf(value?.item, parseItem, options?.maxItems);
56
72
  };
57
73
  const parseFeed = (value, options) => {
@@ -65,6 +81,7 @@ const parseFeed = (value, options) => {
65
81
  image: retrieveImage(value),
66
82
  items: retrieveItems(value, options),
67
83
  textInput: retrieveTextInput(value),
84
+ rdf: retrieveAbout(channel),
68
85
  atom: namespaces.has("atom") ? retrieveFeed$1(channel) : void 0,
69
86
  dc: namespaces.has("dc") ? retrieveItemOrFeed(channel) : void 0,
70
87
  sy: namespaces.has("sy") ? retrieveFeed$2(channel) : void 0,