feedsmith 2.2.1 → 2.4.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/README.md +18 -8
- package/dist/common/config.cjs +111 -11
- package/dist/common/config.js +111 -12
- package/dist/common/types.d.cts +5 -5
- package/dist/common/types.d.ts +5 -5
- package/dist/common/utils.cjs +39 -21
- package/dist/common/utils.js +36 -22
- package/dist/feeds/atom/common/types.d.cts +32 -6
- package/dist/feeds/atom/common/types.d.ts +32 -6
- package/dist/feeds/atom/generate/utils.cjs +61 -35
- package/dist/feeds/atom/generate/utils.js +59 -33
- package/dist/feeds/atom/parse/index.cjs +1 -1
- package/dist/feeds/atom/parse/index.js +2 -2
- package/dist/feeds/atom/parse/utils.cjs +59 -32
- package/dist/feeds/atom/parse/utils.js +58 -31
- package/dist/feeds/rdf/common/types.d.cts +8 -6
- package/dist/feeds/rdf/common/types.d.ts +8 -6
- package/dist/feeds/rdf/parse/index.cjs +1 -1
- package/dist/feeds/rdf/parse/index.js +2 -2
- package/dist/feeds/rdf/parse/utils.cjs +27 -25
- package/dist/feeds/rdf/parse/utils.js +9 -7
- package/dist/feeds/rss/common/types.d.cts +44 -17
- package/dist/feeds/rss/common/types.d.ts +44 -17
- package/dist/feeds/rss/generate/index.d.cts +1 -1
- package/dist/feeds/rss/generate/index.d.ts +1 -1
- package/dist/feeds/rss/generate/utils.cjs +78 -48
- package/dist/feeds/rss/generate/utils.js +75 -45
- package/dist/feeds/rss/parse/index.cjs +1 -1
- package/dist/feeds/rss/parse/index.js +2 -2
- package/dist/feeds/rss/parse/utils.cjs +67 -45
- package/dist/feeds/rss/parse/utils.js +64 -42
- package/dist/namespaces/admin/common/types.d.cts +9 -0
- package/dist/namespaces/admin/common/types.d.ts +9 -0
- package/dist/namespaces/admin/generate/utils.cjs +13 -0
- package/dist/namespaces/admin/generate/utils.js +13 -0
- package/dist/namespaces/admin/parse/utils.cjs +13 -0
- package/dist/namespaces/admin/parse/utils.js +13 -0
- package/dist/namespaces/app/common/types.d.cts +14 -0
- package/dist/namespaces/app/common/types.d.ts +14 -0
- package/dist/namespaces/app/generate/utils.cjs +17 -0
- package/dist/namespaces/app/generate/utils.js +17 -0
- package/dist/namespaces/app/parse/utils.cjs +17 -0
- package/dist/namespaces/app/parse/utils.js +17 -0
- package/dist/namespaces/arxiv/common/types.d.cts +19 -0
- package/dist/namespaces/arxiv/common/types.d.ts +19 -0
- package/dist/namespaces/arxiv/generate/utils.cjs +28 -0
- package/dist/namespaces/arxiv/generate/utils.js +27 -0
- package/dist/namespaces/arxiv/parse/utils.cjs +28 -0
- package/dist/namespaces/arxiv/parse/utils.js +27 -0
- package/dist/namespaces/cc/common/types.d.cts +18 -0
- package/dist/namespaces/cc/common/types.d.ts +18 -0
- package/dist/namespaces/cc/generate/utils.cjs +22 -0
- package/dist/namespaces/cc/generate/utils.js +22 -0
- package/dist/namespaces/cc/parse/utils.cjs +22 -0
- package/dist/namespaces/cc/parse/utils.js +22 -0
- package/dist/namespaces/creativecommons/common/types.d.cts +8 -0
- package/dist/namespaces/creativecommons/common/types.d.ts +8 -0
- package/dist/namespaces/creativecommons/generate/utils.cjs +10 -0
- package/dist/namespaces/creativecommons/generate/utils.js +10 -0
- package/dist/namespaces/creativecommons/parse/utils.cjs +10 -0
- package/dist/namespaces/creativecommons/parse/utils.js +10 -0
- package/dist/namespaces/dcterms/common/types.d.cts +2 -2
- package/dist/namespaces/dcterms/common/types.d.ts +2 -2
- package/dist/namespaces/feedpress/common/types.d.cts +2 -2
- package/dist/namespaces/feedpress/common/types.d.ts +2 -2
- package/dist/namespaces/geo/common/types.d.cts +10 -0
- package/dist/namespaces/geo/common/types.d.ts +10 -0
- package/dist/namespaces/geo/generate/utils.cjs +14 -0
- package/dist/namespaces/geo/generate/utils.js +14 -0
- package/dist/namespaces/geo/parse/utils.cjs +14 -0
- package/dist/namespaces/geo/parse/utils.js +14 -0
- package/dist/namespaces/georss/common/types.d.cts +2 -2
- package/dist/namespaces/georss/common/types.d.ts +2 -2
- package/dist/namespaces/googleplay/common/types.d.cts +25 -0
- package/dist/namespaces/googleplay/common/types.d.ts +25 -0
- package/dist/namespaces/googleplay/generate/utils.cjs +41 -0
- package/dist/namespaces/googleplay/generate/utils.js +40 -0
- package/dist/namespaces/googleplay/parse/utils.cjs +44 -0
- package/dist/namespaces/googleplay/parse/utils.js +43 -0
- package/dist/namespaces/itunes/common/types.d.cts +2 -1
- package/dist/namespaces/itunes/common/types.d.ts +2 -1
- package/dist/namespaces/itunes/generate/utils.cjs +1 -0
- package/dist/namespaces/itunes/generate/utils.js +1 -0
- package/dist/namespaces/itunes/parse/utils.cjs +1 -0
- package/dist/namespaces/itunes/parse/utils.js +1 -0
- package/dist/namespaces/media/common/types.d.cts +5 -3
- package/dist/namespaces/media/common/types.d.ts +5 -3
- package/dist/namespaces/media/generate/utils.cjs +4 -4
- package/dist/namespaces/media/generate/utils.js +5 -5
- package/dist/namespaces/media/parse/utils.cjs +3 -2
- package/dist/namespaces/media/parse/utils.js +3 -2
- package/dist/namespaces/opensearch/common/types.d.cts +21 -0
- package/dist/namespaces/opensearch/common/types.d.ts +21 -0
- package/dist/namespaces/opensearch/generate/utils.cjs +28 -0
- package/dist/namespaces/opensearch/generate/utils.js +28 -0
- package/dist/namespaces/opensearch/parse/utils.cjs +28 -0
- package/dist/namespaces/opensearch/parse/utils.js +28 -0
- package/dist/namespaces/pingback/common/types.d.cts +12 -0
- package/dist/namespaces/pingback/common/types.d.ts +12 -0
- package/dist/namespaces/pingback/generate/utils.cjs +18 -0
- package/dist/namespaces/pingback/generate/utils.js +17 -0
- package/dist/namespaces/pingback/parse/utils.cjs +18 -0
- package/dist/namespaces/pingback/parse/utils.js +17 -0
- package/dist/namespaces/podcast/common/types.d.cts +17 -5
- package/dist/namespaces/podcast/common/types.d.ts +17 -5
- package/dist/namespaces/podcast/generate/utils.cjs +6 -6
- package/dist/namespaces/podcast/generate/utils.js +7 -7
- package/dist/namespaces/podcast/parse/utils.cjs +12 -6
- package/dist/namespaces/podcast/parse/utils.js +12 -6
- package/dist/namespaces/psc/common/types.d.cts +1 -1
- package/dist/namespaces/psc/common/types.d.ts +1 -1
- package/dist/namespaces/rawvoice/common/types.d.cts +10 -5
- package/dist/namespaces/rawvoice/common/types.d.ts +10 -5
- package/dist/namespaces/rawvoice/generate/utils.cjs +12 -4
- package/dist/namespaces/rawvoice/generate/utils.js +13 -5
- package/dist/namespaces/rawvoice/parse/utils.cjs +12 -4
- package/dist/namespaces/rawvoice/parse/utils.js +13 -5
- package/dist/namespaces/source/generate/utils.cjs +7 -7
- package/dist/namespaces/source/generate/utils.js +8 -8
- package/dist/namespaces/spotify/common/types.d.cts +20 -0
- package/dist/namespaces/spotify/common/types.d.ts +20 -0
- package/dist/namespaces/spotify/generate/utils.cjs +31 -2
- package/dist/namespaces/spotify/generate/utils.js +31 -3
- package/dist/namespaces/spotify/parse/utils.cjs +34 -2
- package/dist/namespaces/spotify/parse/utils.js +34 -3
- package/dist/namespaces/trackback/common/types.d.cts +9 -0
- package/dist/namespaces/trackback/common/types.d.ts +9 -0
- package/dist/namespaces/trackback/generate/utils.cjs +13 -0
- package/dist/namespaces/trackback/generate/utils.js +13 -0
- package/dist/namespaces/trackback/parse/utils.cjs +13 -0
- package/dist/namespaces/trackback/parse/utils.js +13 -0
- package/dist/opml/common/types.d.cts +2 -2
- package/dist/opml/common/types.d.ts +2 -2
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -60,7 +60,7 @@ Feedsmith aims to fully support all major feed formats and namespaces in complet
|
|
|
60
60
|
|--------|----------|---------|------------|
|
|
61
61
|
| [RSS](http://cyber.law.harvard.edu/rss/rss.html) | 0.9x, 2.0 | ✅ | ✅ |
|
|
62
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 | ✅ |
|
|
63
|
+
| [RDF](https://web.resource.org/rss/1.0/spec) | 0.9, 1.0 | ✅ | 📋 |
|
|
64
64
|
| [JSON Feed](https://jsonfeed.org) | 1.0, 1.1 | ✅ | ✅ |
|
|
65
65
|
|
|
66
66
|
### Namespaces
|
|
@@ -69,22 +69,32 @@ Feedsmith aims to fully support all major feed formats and namespaces in complet
|
|
|
69
69
|
|------|---------|--------------|---------|------------|
|
|
70
70
|
| [Atom](http://www.w3.org/2005/Atom) | `<atom:*>` | RSS, RDF | ✅ | ✅ |
|
|
71
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 | ✅ | ✅ |
|
|
72
73
|
| [Syndication](http://purl.org/rss/1.0/modules/syndication/) | `<sy:*>` | RSS, Atom, RDF | ✅ | ✅ |
|
|
73
74
|
| [Content](http://purl.org/rss/1.0/modules/content/) | `<content:*>` | RSS, RDF | ✅ | ✅ |
|
|
74
75
|
| [Slash](http://purl.org/rss/1.0/modules/slash/) | `<slash:*>` | RSS, Atom, RDF | ✅ | ✅ |
|
|
75
76
|
| [iTunes](http://www.itunes.com/dtds/podcast-1.0.dtd) | `<itunes:*>` | RSS, Atom | ✅ | ✅ |
|
|
76
|
-
| [Podcast](https://podcastindex.org/namespace/1.0) | `<podcast:*>` | RSS | ✅ | ✅ |
|
|
77
|
-
| [RawVoice](https://blubrry.com/developer/rawvoice-rss/) | `<rawvoice:*>` | RSS | ✅ | ✅ |
|
|
77
|
+
| [Podcast Index](https://podcastindex.org/namespace/1.0) | `<podcast:*>` | RSS | ✅ | ✅ |
|
|
78
78
|
| [Podlove Simple Chapters](http://podlove.org/simple-chapters) | `<psc:*>` | RSS, Atom | ✅ | ✅ |
|
|
79
|
-
| [Spotify](http://www.spotify.com/ns/rss) | `<spotify:*>` | RSS | ✅ | ✅ |
|
|
80
79
|
| [Media RSS](http://search.yahoo.com/mrss/) | `<media:*>` | RSS, Atom, RDF | ✅ | ✅ |
|
|
81
|
-
| [
|
|
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 | ✅ | ✅ |
|
|
82
88
|
| [Atom Threading](https://www.ietf.org/rfc/rfc4685.txt) | `<thr:*>` | RSS, Atom | ✅ | ✅ |
|
|
83
|
-
| [
|
|
84
|
-
| [
|
|
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 | ✅ | ✅ |
|
|
85
94
|
| [Source](http://source.scripting.com/) | `<source:*>` | RSS | ✅ | ✅ |
|
|
86
|
-
| [FeedPress](https://feedpress.com/xmlns) | `<feedpress:*>` | RSS | ✅ | ✅ |
|
|
87
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 | ✅ | ✅ |
|
|
88
98
|
|
|
89
99
|
### Other
|
|
90
100
|
|
package/dist/common/config.cjs
CHANGED
|
@@ -32,17 +32,39 @@ const locales = {
|
|
|
32
32
|
invalidInputRss: "Invalid input RSS"
|
|
33
33
|
};
|
|
34
34
|
const namespaceUris = {
|
|
35
|
+
admin: [
|
|
36
|
+
"http://webns.net/mvcb/",
|
|
37
|
+
"https://webns.net/mvcb/",
|
|
38
|
+
"http://webns.net/mvcb",
|
|
39
|
+
"https://webns.net/mvcb"
|
|
40
|
+
],
|
|
35
41
|
atom: [
|
|
36
42
|
"http://www.w3.org/2005/Atom",
|
|
37
43
|
"https://www.w3.org/2005/Atom",
|
|
38
44
|
"http://www.w3.org/2005/Atom/",
|
|
39
|
-
"https://www.w3.org/2005/Atom/"
|
|
45
|
+
"https://www.w3.org/2005/Atom/",
|
|
46
|
+
"http://purl.org/atom/ns#",
|
|
47
|
+
"https://purl.org/atom/ns#"
|
|
48
|
+
],
|
|
49
|
+
app: [
|
|
50
|
+
"http://www.w3.org/2007/app",
|
|
51
|
+
"https://www.w3.org/2007/app",
|
|
52
|
+
"http://www.w3.org/2007/app/",
|
|
53
|
+
"https://www.w3.org/2007/app/"
|
|
40
54
|
],
|
|
41
55
|
dc: [
|
|
42
56
|
"http://purl.org/dc/elements/1.1/",
|
|
43
57
|
"https://purl.org/dc/elements/1.1/",
|
|
44
58
|
"http://purl.org/dc/elements/1.1",
|
|
45
|
-
"https://purl.org/dc/elements/1.1"
|
|
59
|
+
"https://purl.org/dc/elements/1.1",
|
|
60
|
+
"http://dublincore.org/documents/dcmi-namespace/",
|
|
61
|
+
"https://dublincore.org/documents/dcmi-namespace/",
|
|
62
|
+
"http://dublincore.org/documents/dcmi-namespace",
|
|
63
|
+
"https://dublincore.org/documents/dcmi-namespace",
|
|
64
|
+
"http://purl.org/dc/elements/1.0/",
|
|
65
|
+
"https://purl.org/dc/elements/1.0/",
|
|
66
|
+
"http://purl.org/dc/elements/1.0",
|
|
67
|
+
"https://purl.org/dc/elements/1.0"
|
|
46
68
|
],
|
|
47
69
|
sy: [
|
|
48
70
|
"http://purl.org/rss/1.0/modules/syndication/",
|
|
@@ -56,6 +78,16 @@ const namespaceUris = {
|
|
|
56
78
|
"http://purl.org/rss/1.0/modules/content",
|
|
57
79
|
"https://purl.org/rss/1.0/modules/content"
|
|
58
80
|
],
|
|
81
|
+
creativeCommons: [
|
|
82
|
+
"http://backend.userland.com/creativeCommonsRssModule",
|
|
83
|
+
"https://backend.userland.com/creativeCommonsRssModule",
|
|
84
|
+
"http://backend.userland.com/creativeCommonsRssModule/",
|
|
85
|
+
"https://backend.userland.com/creativeCommonsRssModule/",
|
|
86
|
+
"http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html",
|
|
87
|
+
"https://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html",
|
|
88
|
+
"http://cyber.law.harvard.edu/rss/creativeCommonsRssModule",
|
|
89
|
+
"https://cyber.law.harvard.edu/rss/creativeCommonsRssModule"
|
|
90
|
+
],
|
|
59
91
|
slash: [
|
|
60
92
|
"http://purl.org/rss/1.0/modules/slash/",
|
|
61
93
|
"https://purl.org/rss/1.0/modules/slash/",
|
|
@@ -67,7 +99,8 @@ const namespaceUris = {
|
|
|
67
99
|
"https://podcastindex.org/namespace/1.0",
|
|
68
100
|
"http://podcastindex.org/namespace/1.0",
|
|
69
101
|
"https://podcastindex.org/namespace/1.0/",
|
|
70
|
-
"http://podcastindex.org/namespace/1.0/"
|
|
102
|
+
"http://podcastindex.org/namespace/1.0/",
|
|
103
|
+
"https://github.com/Podcastindex-org/podcast-namespace/blob/main/docs/1.0.md"
|
|
71
104
|
],
|
|
72
105
|
psc: [
|
|
73
106
|
"http://podlove.org/simple-chapters",
|
|
@@ -87,7 +120,15 @@ const namespaceUris = {
|
|
|
87
120
|
"http://www.rssboard.org/media-rss",
|
|
88
121
|
"http://www.rssboard.org/media-rss/",
|
|
89
122
|
"https://www.rssboard.org/media-rss",
|
|
90
|
-
"https://www.rssboard.org/media-rss/"
|
|
123
|
+
"https://www.rssboard.org/media-rss/",
|
|
124
|
+
"http://search.yahoo.com/searchmonkey/media/",
|
|
125
|
+
"https://search.yahoo.com/searchmonkey/media/",
|
|
126
|
+
"http://search.yahoo.com/searchmonkey/media",
|
|
127
|
+
"https://search.yahoo.com/searchmonkey/media",
|
|
128
|
+
"http://tools.search.yahoo.com/mrss/",
|
|
129
|
+
"https://tools.search.yahoo.com/mrss/",
|
|
130
|
+
"http://tools.search.yahoo.com/mrss",
|
|
131
|
+
"https://tools.search.yahoo.com/mrss"
|
|
91
132
|
],
|
|
92
133
|
georss: [
|
|
93
134
|
"http://www.georss.org/georss",
|
|
@@ -95,11 +136,16 @@ const namespaceUris = {
|
|
|
95
136
|
"https://www.georss.org/georss",
|
|
96
137
|
"https://www.georss.org/georss/"
|
|
97
138
|
],
|
|
139
|
+
geo: ["http://www.w3.org/2003/01/geo/wgs84_pos#", "https://www.w3.org/2003/01/geo/wgs84_pos#"],
|
|
98
140
|
thr: [
|
|
99
141
|
"http://purl.org/syndication/thread/1.0",
|
|
100
142
|
"https://purl.org/syndication/thread/1.0",
|
|
101
143
|
"http://purl.org/syndication/thread/1.0/",
|
|
102
|
-
"https://purl.org/syndication/thread/1.0/"
|
|
144
|
+
"https://purl.org/syndication/thread/1.0/",
|
|
145
|
+
"http://purl.org/rss/1.0/modules/threading/",
|
|
146
|
+
"https://purl.org/rss/1.0/modules/threading/",
|
|
147
|
+
"http://purl.org/rss/1.0/modules/threading",
|
|
148
|
+
"https://purl.org/rss/1.0/modules/threading"
|
|
103
149
|
],
|
|
104
150
|
dcterms: [
|
|
105
151
|
"http://purl.org/dc/terms/",
|
|
@@ -135,7 +181,11 @@ const namespaceUris = {
|
|
|
135
181
|
"https://feedpress.com/xmlns",
|
|
136
182
|
"http://feedpress.com/xmlns",
|
|
137
183
|
"https://feedpress.com/xmlns/",
|
|
138
|
-
"http://feedpress.com/xmlns/"
|
|
184
|
+
"http://feedpress.com/xmlns/",
|
|
185
|
+
"http://feedpress.it/xmlns",
|
|
186
|
+
"https://feedpress.it/xmlns",
|
|
187
|
+
"http://feedpress.it/xmlns/",
|
|
188
|
+
"https://feedpress.it/xmlns/"
|
|
139
189
|
],
|
|
140
190
|
yt: [
|
|
141
191
|
"http://www.youtube.com/xml/schemas/2015",
|
|
@@ -143,6 +193,14 @@ const namespaceUris = {
|
|
|
143
193
|
"http://www.youtube.com/xml/schemas/2015/",
|
|
144
194
|
"https://www.youtube.com/xml/schemas/2015/"
|
|
145
195
|
],
|
|
196
|
+
googleplay: [
|
|
197
|
+
"https://www.google.com/schemas/play-podcasts/1.0/",
|
|
198
|
+
"http://www.google.com/schemas/play-podcasts/1.0/",
|
|
199
|
+
"https://www.google.com/schemas/play-podcasts/1.0",
|
|
200
|
+
"http://www.google.com/schemas/play-podcasts/1.0",
|
|
201
|
+
"https://www.google.com/schemas/play-podcasts/1.0/play-podcasts.xsd",
|
|
202
|
+
"http://www.google.com/schemas/play-podcasts/1.0/play-podcasts.xsd"
|
|
203
|
+
],
|
|
146
204
|
spotify: [
|
|
147
205
|
"http://www.spotify.com/ns/rss",
|
|
148
206
|
"https://www.spotify.com/ns/rss",
|
|
@@ -151,19 +209,61 @@ const namespaceUris = {
|
|
|
151
209
|
],
|
|
152
210
|
rdf: ["http://www.w3.org/1999/02/22-rdf-syntax-ns#", "https://www.w3.org/1999/02/22-rdf-syntax-ns#"],
|
|
153
211
|
rawvoice: [
|
|
212
|
+
"http://www.rawvoice.com/rawvoiceRssModule/",
|
|
213
|
+
"https://www.rawvoice.com/rawvoiceRssModule/",
|
|
214
|
+
"http://www.rawvoice.com/rawvoiceRssModule",
|
|
215
|
+
"https://www.rawvoice.com/rawvoiceRssModule",
|
|
154
216
|
"https://blubrry.com/developer/rawvoice-rss",
|
|
155
217
|
"http://blubrry.com/developer/rawvoice-rss",
|
|
156
218
|
"https://blubrry.com/developer/rawvoice-rss/",
|
|
157
|
-
"http://blubrry.com/developer/rawvoice-rss/"
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
"http://
|
|
161
|
-
"https://
|
|
219
|
+
"http://blubrry.com/developer/rawvoice-rss/"
|
|
220
|
+
],
|
|
221
|
+
cc: [
|
|
222
|
+
"http://creativecommons.org/ns#",
|
|
223
|
+
"https://creativecommons.org/ns#",
|
|
224
|
+
"http://web.resource.org/cc/",
|
|
225
|
+
"https://web.resource.org/cc/",
|
|
226
|
+
"http://web.resource.org/cc",
|
|
227
|
+
"https://web.resource.org/cc"
|
|
228
|
+
],
|
|
229
|
+
opensearch: [
|
|
230
|
+
"http://a9.com/-/spec/opensearch/1.1/",
|
|
231
|
+
"https://a9.com/-/spec/opensearch/1.1/",
|
|
232
|
+
"http://a9.com/-/spec/opensearch/1.0/",
|
|
233
|
+
"https://a9.com/-/spec/opensearch/1.0/",
|
|
234
|
+
"http://a9.com/-/spec/opensearchrss/1.0/",
|
|
235
|
+
"https://a9.com/-/spec/opensearchrss/1.0/"
|
|
236
|
+
],
|
|
237
|
+
arxiv: [
|
|
238
|
+
"http://arxiv.org/schemas/atom",
|
|
239
|
+
"https://arxiv.org/schemas/atom",
|
|
240
|
+
"http://arxiv.org/schemas/atom/",
|
|
241
|
+
"https://arxiv.org/schemas/atom/"
|
|
242
|
+
],
|
|
243
|
+
pingback: [
|
|
244
|
+
"http://madskills.com/public/xml/rss/module/pingback/",
|
|
245
|
+
"https://madskills.com/public/xml/rss/module/pingback/",
|
|
246
|
+
"http://madskills.com/public/xml/rss/module/pingback",
|
|
247
|
+
"https://madskills.com/public/xml/rss/module/pingback"
|
|
248
|
+
],
|
|
249
|
+
trackback: [
|
|
250
|
+
"http://madskills.com/public/xml/rss/module/trackback/",
|
|
251
|
+
"https://madskills.com/public/xml/rss/module/trackback/",
|
|
252
|
+
"http://madskills.com/public/xml/rss/module/trackback",
|
|
253
|
+
"https://madskills.com/public/xml/rss/module/trackback"
|
|
162
254
|
]
|
|
163
255
|
};
|
|
256
|
+
const namespacePrefixes = Object.entries(namespaceUris).reduce((prefixes, [prefix, uris]) => {
|
|
257
|
+
for (const uri of uris) {
|
|
258
|
+
const normalizedUri = uri.toLowerCase();
|
|
259
|
+
prefixes[normalizedUri] = prefix.toLowerCase();
|
|
260
|
+
}
|
|
261
|
+
return prefixes;
|
|
262
|
+
}, {});
|
|
164
263
|
|
|
165
264
|
//#endregion
|
|
166
265
|
exports.builderConfig = builderConfig;
|
|
167
266
|
exports.locales = locales;
|
|
267
|
+
exports.namespacePrefixes = namespacePrefixes;
|
|
168
268
|
exports.namespaceUris = namespaceUris;
|
|
169
269
|
exports.parserConfig = parserConfig;
|
package/dist/common/config.js
CHANGED
|
@@ -31,17 +31,39 @@ const locales = {
|
|
|
31
31
|
invalidInputRss: "Invalid input RSS"
|
|
32
32
|
};
|
|
33
33
|
const namespaceUris = {
|
|
34
|
+
admin: [
|
|
35
|
+
"http://webns.net/mvcb/",
|
|
36
|
+
"https://webns.net/mvcb/",
|
|
37
|
+
"http://webns.net/mvcb",
|
|
38
|
+
"https://webns.net/mvcb"
|
|
39
|
+
],
|
|
34
40
|
atom: [
|
|
35
41
|
"http://www.w3.org/2005/Atom",
|
|
36
42
|
"https://www.w3.org/2005/Atom",
|
|
37
43
|
"http://www.w3.org/2005/Atom/",
|
|
38
|
-
"https://www.w3.org/2005/Atom/"
|
|
44
|
+
"https://www.w3.org/2005/Atom/",
|
|
45
|
+
"http://purl.org/atom/ns#",
|
|
46
|
+
"https://purl.org/atom/ns#"
|
|
47
|
+
],
|
|
48
|
+
app: [
|
|
49
|
+
"http://www.w3.org/2007/app",
|
|
50
|
+
"https://www.w3.org/2007/app",
|
|
51
|
+
"http://www.w3.org/2007/app/",
|
|
52
|
+
"https://www.w3.org/2007/app/"
|
|
39
53
|
],
|
|
40
54
|
dc: [
|
|
41
55
|
"http://purl.org/dc/elements/1.1/",
|
|
42
56
|
"https://purl.org/dc/elements/1.1/",
|
|
43
57
|
"http://purl.org/dc/elements/1.1",
|
|
44
|
-
"https://purl.org/dc/elements/1.1"
|
|
58
|
+
"https://purl.org/dc/elements/1.1",
|
|
59
|
+
"http://dublincore.org/documents/dcmi-namespace/",
|
|
60
|
+
"https://dublincore.org/documents/dcmi-namespace/",
|
|
61
|
+
"http://dublincore.org/documents/dcmi-namespace",
|
|
62
|
+
"https://dublincore.org/documents/dcmi-namespace",
|
|
63
|
+
"http://purl.org/dc/elements/1.0/",
|
|
64
|
+
"https://purl.org/dc/elements/1.0/",
|
|
65
|
+
"http://purl.org/dc/elements/1.0",
|
|
66
|
+
"https://purl.org/dc/elements/1.0"
|
|
45
67
|
],
|
|
46
68
|
sy: [
|
|
47
69
|
"http://purl.org/rss/1.0/modules/syndication/",
|
|
@@ -55,6 +77,16 @@ const namespaceUris = {
|
|
|
55
77
|
"http://purl.org/rss/1.0/modules/content",
|
|
56
78
|
"https://purl.org/rss/1.0/modules/content"
|
|
57
79
|
],
|
|
80
|
+
creativeCommons: [
|
|
81
|
+
"http://backend.userland.com/creativeCommonsRssModule",
|
|
82
|
+
"https://backend.userland.com/creativeCommonsRssModule",
|
|
83
|
+
"http://backend.userland.com/creativeCommonsRssModule/",
|
|
84
|
+
"https://backend.userland.com/creativeCommonsRssModule/",
|
|
85
|
+
"http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html",
|
|
86
|
+
"https://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html",
|
|
87
|
+
"http://cyber.law.harvard.edu/rss/creativeCommonsRssModule",
|
|
88
|
+
"https://cyber.law.harvard.edu/rss/creativeCommonsRssModule"
|
|
89
|
+
],
|
|
58
90
|
slash: [
|
|
59
91
|
"http://purl.org/rss/1.0/modules/slash/",
|
|
60
92
|
"https://purl.org/rss/1.0/modules/slash/",
|
|
@@ -66,7 +98,8 @@ const namespaceUris = {
|
|
|
66
98
|
"https://podcastindex.org/namespace/1.0",
|
|
67
99
|
"http://podcastindex.org/namespace/1.0",
|
|
68
100
|
"https://podcastindex.org/namespace/1.0/",
|
|
69
|
-
"http://podcastindex.org/namespace/1.0/"
|
|
101
|
+
"http://podcastindex.org/namespace/1.0/",
|
|
102
|
+
"https://github.com/Podcastindex-org/podcast-namespace/blob/main/docs/1.0.md"
|
|
70
103
|
],
|
|
71
104
|
psc: [
|
|
72
105
|
"http://podlove.org/simple-chapters",
|
|
@@ -86,7 +119,15 @@ const namespaceUris = {
|
|
|
86
119
|
"http://www.rssboard.org/media-rss",
|
|
87
120
|
"http://www.rssboard.org/media-rss/",
|
|
88
121
|
"https://www.rssboard.org/media-rss",
|
|
89
|
-
"https://www.rssboard.org/media-rss/"
|
|
122
|
+
"https://www.rssboard.org/media-rss/",
|
|
123
|
+
"http://search.yahoo.com/searchmonkey/media/",
|
|
124
|
+
"https://search.yahoo.com/searchmonkey/media/",
|
|
125
|
+
"http://search.yahoo.com/searchmonkey/media",
|
|
126
|
+
"https://search.yahoo.com/searchmonkey/media",
|
|
127
|
+
"http://tools.search.yahoo.com/mrss/",
|
|
128
|
+
"https://tools.search.yahoo.com/mrss/",
|
|
129
|
+
"http://tools.search.yahoo.com/mrss",
|
|
130
|
+
"https://tools.search.yahoo.com/mrss"
|
|
90
131
|
],
|
|
91
132
|
georss: [
|
|
92
133
|
"http://www.georss.org/georss",
|
|
@@ -94,11 +135,16 @@ const namespaceUris = {
|
|
|
94
135
|
"https://www.georss.org/georss",
|
|
95
136
|
"https://www.georss.org/georss/"
|
|
96
137
|
],
|
|
138
|
+
geo: ["http://www.w3.org/2003/01/geo/wgs84_pos#", "https://www.w3.org/2003/01/geo/wgs84_pos#"],
|
|
97
139
|
thr: [
|
|
98
140
|
"http://purl.org/syndication/thread/1.0",
|
|
99
141
|
"https://purl.org/syndication/thread/1.0",
|
|
100
142
|
"http://purl.org/syndication/thread/1.0/",
|
|
101
|
-
"https://purl.org/syndication/thread/1.0/"
|
|
143
|
+
"https://purl.org/syndication/thread/1.0/",
|
|
144
|
+
"http://purl.org/rss/1.0/modules/threading/",
|
|
145
|
+
"https://purl.org/rss/1.0/modules/threading/",
|
|
146
|
+
"http://purl.org/rss/1.0/modules/threading",
|
|
147
|
+
"https://purl.org/rss/1.0/modules/threading"
|
|
102
148
|
],
|
|
103
149
|
dcterms: [
|
|
104
150
|
"http://purl.org/dc/terms/",
|
|
@@ -134,7 +180,11 @@ const namespaceUris = {
|
|
|
134
180
|
"https://feedpress.com/xmlns",
|
|
135
181
|
"http://feedpress.com/xmlns",
|
|
136
182
|
"https://feedpress.com/xmlns/",
|
|
137
|
-
"http://feedpress.com/xmlns/"
|
|
183
|
+
"http://feedpress.com/xmlns/",
|
|
184
|
+
"http://feedpress.it/xmlns",
|
|
185
|
+
"https://feedpress.it/xmlns",
|
|
186
|
+
"http://feedpress.it/xmlns/",
|
|
187
|
+
"https://feedpress.it/xmlns/"
|
|
138
188
|
],
|
|
139
189
|
yt: [
|
|
140
190
|
"http://www.youtube.com/xml/schemas/2015",
|
|
@@ -142,6 +192,14 @@ const namespaceUris = {
|
|
|
142
192
|
"http://www.youtube.com/xml/schemas/2015/",
|
|
143
193
|
"https://www.youtube.com/xml/schemas/2015/"
|
|
144
194
|
],
|
|
195
|
+
googleplay: [
|
|
196
|
+
"https://www.google.com/schemas/play-podcasts/1.0/",
|
|
197
|
+
"http://www.google.com/schemas/play-podcasts/1.0/",
|
|
198
|
+
"https://www.google.com/schemas/play-podcasts/1.0",
|
|
199
|
+
"http://www.google.com/schemas/play-podcasts/1.0",
|
|
200
|
+
"https://www.google.com/schemas/play-podcasts/1.0/play-podcasts.xsd",
|
|
201
|
+
"http://www.google.com/schemas/play-podcasts/1.0/play-podcasts.xsd"
|
|
202
|
+
],
|
|
145
203
|
spotify: [
|
|
146
204
|
"http://www.spotify.com/ns/rss",
|
|
147
205
|
"https://www.spotify.com/ns/rss",
|
|
@@ -150,16 +208,57 @@ const namespaceUris = {
|
|
|
150
208
|
],
|
|
151
209
|
rdf: ["http://www.w3.org/1999/02/22-rdf-syntax-ns#", "https://www.w3.org/1999/02/22-rdf-syntax-ns#"],
|
|
152
210
|
rawvoice: [
|
|
211
|
+
"http://www.rawvoice.com/rawvoiceRssModule/",
|
|
212
|
+
"https://www.rawvoice.com/rawvoiceRssModule/",
|
|
213
|
+
"http://www.rawvoice.com/rawvoiceRssModule",
|
|
214
|
+
"https://www.rawvoice.com/rawvoiceRssModule",
|
|
153
215
|
"https://blubrry.com/developer/rawvoice-rss",
|
|
154
216
|
"http://blubrry.com/developer/rawvoice-rss",
|
|
155
217
|
"https://blubrry.com/developer/rawvoice-rss/",
|
|
156
|
-
"http://blubrry.com/developer/rawvoice-rss/"
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
"http://
|
|
160
|
-
"https://
|
|
218
|
+
"http://blubrry.com/developer/rawvoice-rss/"
|
|
219
|
+
],
|
|
220
|
+
cc: [
|
|
221
|
+
"http://creativecommons.org/ns#",
|
|
222
|
+
"https://creativecommons.org/ns#",
|
|
223
|
+
"http://web.resource.org/cc/",
|
|
224
|
+
"https://web.resource.org/cc/",
|
|
225
|
+
"http://web.resource.org/cc",
|
|
226
|
+
"https://web.resource.org/cc"
|
|
227
|
+
],
|
|
228
|
+
opensearch: [
|
|
229
|
+
"http://a9.com/-/spec/opensearch/1.1/",
|
|
230
|
+
"https://a9.com/-/spec/opensearch/1.1/",
|
|
231
|
+
"http://a9.com/-/spec/opensearch/1.0/",
|
|
232
|
+
"https://a9.com/-/spec/opensearch/1.0/",
|
|
233
|
+
"http://a9.com/-/spec/opensearchrss/1.0/",
|
|
234
|
+
"https://a9.com/-/spec/opensearchrss/1.0/"
|
|
235
|
+
],
|
|
236
|
+
arxiv: [
|
|
237
|
+
"http://arxiv.org/schemas/atom",
|
|
238
|
+
"https://arxiv.org/schemas/atom",
|
|
239
|
+
"http://arxiv.org/schemas/atom/",
|
|
240
|
+
"https://arxiv.org/schemas/atom/"
|
|
241
|
+
],
|
|
242
|
+
pingback: [
|
|
243
|
+
"http://madskills.com/public/xml/rss/module/pingback/",
|
|
244
|
+
"https://madskills.com/public/xml/rss/module/pingback/",
|
|
245
|
+
"http://madskills.com/public/xml/rss/module/pingback",
|
|
246
|
+
"https://madskills.com/public/xml/rss/module/pingback"
|
|
247
|
+
],
|
|
248
|
+
trackback: [
|
|
249
|
+
"http://madskills.com/public/xml/rss/module/trackback/",
|
|
250
|
+
"https://madskills.com/public/xml/rss/module/trackback/",
|
|
251
|
+
"http://madskills.com/public/xml/rss/module/trackback",
|
|
252
|
+
"https://madskills.com/public/xml/rss/module/trackback"
|
|
161
253
|
]
|
|
162
254
|
};
|
|
255
|
+
const namespacePrefixes = Object.entries(namespaceUris).reduce((prefixes, [prefix, uris]) => {
|
|
256
|
+
for (const uri of uris) {
|
|
257
|
+
const normalizedUri = uri.toLowerCase();
|
|
258
|
+
prefixes[normalizedUri] = prefix.toLowerCase();
|
|
259
|
+
}
|
|
260
|
+
return prefixes;
|
|
261
|
+
}, {});
|
|
163
262
|
|
|
164
263
|
//#endregion
|
|
165
|
-
export { builderConfig, locales, namespaceUris, parserConfig };
|
|
264
|
+
export { builderConfig, locales, namespacePrefixes, namespaceUris, parserConfig };
|
package/dist/common/types.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
//#region src/common/types.d.ts
|
|
2
2
|
type DateLike = Date | string;
|
|
3
|
-
type ExtraFields<F
|
|
3
|
+
type ExtraFields<F extends ReadonlyArray<string>, V = unknown> = { [K in F[number]]?: V };
|
|
4
4
|
type IsPlainObject<T> = T extends Array<unknown> ? false : T extends ((...args: Array<unknown>) => unknown) ? false : T extends Date ? false : T extends object ? T extends null ? false : true : false;
|
|
5
5
|
type RemoveUndefined<T> = T extends undefined ? never : T;
|
|
6
6
|
type DeepPartial<T> = IsPlainObject<T> extends true ? { [P in keyof T]?: DeepPartial<RemoveUndefined<T[P]>> } : T extends Array<infer U> ? Array<DeepPartial<U>> : T;
|
|
@@ -12,12 +12,12 @@ type XmlStylesheet = {
|
|
|
12
12
|
charset?: string;
|
|
13
13
|
alternate?: boolean;
|
|
14
14
|
};
|
|
15
|
-
type XmlGenerateOptions<O, F
|
|
16
|
-
lenient?: F
|
|
15
|
+
type XmlGenerateOptions<O, F extends boolean = false> = O & {
|
|
16
|
+
lenient?: F;
|
|
17
17
|
stylesheets?: Array<XmlStylesheet>;
|
|
18
18
|
};
|
|
19
|
-
type JsonGenerateOptions<O, F
|
|
20
|
-
lenient?: F
|
|
19
|
+
type JsonGenerateOptions<O, F extends boolean = false> = O & {
|
|
20
|
+
lenient?: F;
|
|
21
21
|
};
|
|
22
22
|
type XmlGenerateMain<S, L, O = Record<string, unknown>> = <F extends boolean = false>(value: F extends true ? L : S, options?: XmlGenerateOptions<O, F>) => string;
|
|
23
23
|
type JsonGenerateMain<S, L, O = Record<string, unknown>> = <F extends boolean = false>(value: F extends true ? L : S, options?: JsonGenerateOptions<O, F>) => unknown;
|
package/dist/common/types.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
//#region src/common/types.d.ts
|
|
2
2
|
type DateLike = Date | string;
|
|
3
|
-
type ExtraFields<F
|
|
3
|
+
type ExtraFields<F extends ReadonlyArray<string>, V = unknown> = { [K in F[number]]?: V };
|
|
4
4
|
type IsPlainObject<T> = T extends Array<unknown> ? false : T extends ((...args: Array<unknown>) => unknown) ? false : T extends Date ? false : T extends object ? T extends null ? false : true : false;
|
|
5
5
|
type RemoveUndefined<T> = T extends undefined ? never : T;
|
|
6
6
|
type DeepPartial<T> = IsPlainObject<T> extends true ? { [P in keyof T]?: DeepPartial<RemoveUndefined<T[P]>> } : T extends Array<infer U> ? Array<DeepPartial<U>> : T;
|
|
@@ -12,12 +12,12 @@ type XmlStylesheet = {
|
|
|
12
12
|
charset?: string;
|
|
13
13
|
alternate?: boolean;
|
|
14
14
|
};
|
|
15
|
-
type XmlGenerateOptions<O, F
|
|
16
|
-
lenient?: F
|
|
15
|
+
type XmlGenerateOptions<O, F extends boolean = false> = O & {
|
|
16
|
+
lenient?: F;
|
|
17
17
|
stylesheets?: Array<XmlStylesheet>;
|
|
18
18
|
};
|
|
19
|
-
type JsonGenerateOptions<O, F
|
|
20
|
-
lenient?: F
|
|
19
|
+
type JsonGenerateOptions<O, F extends boolean = false> = O & {
|
|
20
|
+
lenient?: F;
|
|
21
21
|
};
|
|
22
22
|
type XmlGenerateMain<S, L, O = Record<string, unknown>> = <F extends boolean = false>(value: F extends true ? L : S, options?: XmlGenerateOptions<O, F>) => string;
|
|
23
23
|
type JsonGenerateMain<S, L, O = Record<string, unknown>> = <F extends boolean = false>(value: F extends true ? L : S, options?: JsonGenerateOptions<O, F>) => unknown;
|
package/dist/common/utils.cjs
CHANGED
|
@@ -19,6 +19,15 @@ const isNonEmptyStringOrNumber = (value) => {
|
|
|
19
19
|
const retrieveText = (value) => {
|
|
20
20
|
return value?.["#text"] ?? value;
|
|
21
21
|
};
|
|
22
|
+
const retrieveRdfResourceOrText = (value, parse) => {
|
|
23
|
+
if (isObject(value)) {
|
|
24
|
+
const rdfResource = parse(value["@rdf:resource"]);
|
|
25
|
+
if (isPresent(rdfResource)) return rdfResource;
|
|
26
|
+
const resource = parse(value["@resource"]);
|
|
27
|
+
if (isPresent(resource)) return resource;
|
|
28
|
+
}
|
|
29
|
+
return parse(retrieveText(value));
|
|
30
|
+
};
|
|
22
31
|
const trimObject = (object) => {
|
|
23
32
|
let result;
|
|
24
33
|
for (const key in object) {
|
|
@@ -47,6 +56,14 @@ const trimArray = (value, parse) => {
|
|
|
47
56
|
}
|
|
48
57
|
return result.length > 0 ? result : void 0;
|
|
49
58
|
};
|
|
59
|
+
const generateArrayOrSingular = (pluralValues, singularValue, generator) => {
|
|
60
|
+
if (isPresent(pluralValues)) return trimArray(pluralValues.map(generator));
|
|
61
|
+
if (isPresent(singularValue)) return generator(singularValue);
|
|
62
|
+
};
|
|
63
|
+
const generateSingularOrArray = (singularValue, pluralValues, generator) => {
|
|
64
|
+
if (isPresent(singularValue)) return generator(singularValue);
|
|
65
|
+
if (isPresent(pluralValues)) return trimArray(pluralValues.map(generator));
|
|
66
|
+
};
|
|
50
67
|
const cdataStartTag = "<![CDATA[";
|
|
51
68
|
const cdataEndTag = "]]>";
|
|
52
69
|
const stripCdata = (text) => {
|
|
@@ -231,43 +248,41 @@ const generatePlainString = (value) => {
|
|
|
231
248
|
const generateNumber = (value) => {
|
|
232
249
|
if (typeof value === "number" && Number.isFinite(value)) return value;
|
|
233
250
|
};
|
|
251
|
+
const generateRdfResource = (value, generate) => {
|
|
252
|
+
const rdfResource = generate(value);
|
|
253
|
+
if (!isPresent(rdfResource)) return;
|
|
254
|
+
return { "@rdf:resource": rdfResource };
|
|
255
|
+
};
|
|
234
256
|
const generateNamespaceAttrs = (value, namespaceUris) => {
|
|
235
257
|
if (!isObject(value)) return;
|
|
236
258
|
let namespaceAttrs;
|
|
237
259
|
const valueNamespaces = detectNamespaces(value, true);
|
|
238
|
-
for (const
|
|
239
|
-
if (!valueNamespaces.has(
|
|
260
|
+
for (const prefix in namespaceUris) {
|
|
261
|
+
if (!valueNamespaces.has(prefix)) continue;
|
|
240
262
|
if (!namespaceAttrs) namespaceAttrs = {};
|
|
241
|
-
namespaceAttrs[`@xmlns:${
|
|
263
|
+
namespaceAttrs[`@xmlns:${prefix}`] = namespaceUris[prefix][0];
|
|
242
264
|
}
|
|
243
265
|
return namespaceAttrs;
|
|
244
266
|
};
|
|
245
|
-
const createNamespaceNormalizator = (namespaceUris, primaryNamespace) => {
|
|
246
|
-
const
|
|
267
|
+
const createNamespaceNormalizator = (namespaceUris, namespacePrefixes, primaryNamespace) => {
|
|
268
|
+
const normalizeNamespaceUri = (uri) => {
|
|
247
269
|
return typeof uri === "string" ? uri.trim().toLowerCase() : uri;
|
|
248
270
|
};
|
|
249
|
-
const
|
|
250
|
-
for (const prefix in namespaceUris) {
|
|
251
|
-
const uris = namespaceUris[prefix];
|
|
252
|
-
for (const uri of uris) {
|
|
253
|
-
const normalizedUri = normalizeUri(uri);
|
|
254
|
-
namespacesMap[normalizedUri] = prefix;
|
|
255
|
-
}
|
|
256
|
-
}
|
|
271
|
+
const primaryNamespaceUris = primaryNamespace && namespaceUris[primaryNamespace] ? namespaceUris[primaryNamespace].map(normalizeNamespaceUri) : void 0;
|
|
257
272
|
const resolveNamespacePrefix = (uri, localName, fallback) => {
|
|
258
|
-
const normalizedUri =
|
|
259
|
-
if (
|
|
260
|
-
const standardPrefix =
|
|
273
|
+
const normalizedUri = normalizeNamespaceUri(uri);
|
|
274
|
+
if (primaryNamespaceUris?.includes(normalizedUri)) return localName;
|
|
275
|
+
const standardPrefix = namespacePrefixes[normalizedUri];
|
|
261
276
|
if (standardPrefix) return `${standardPrefix}:${localName}`;
|
|
262
277
|
return fallback;
|
|
263
278
|
};
|
|
264
279
|
const extractNamespaceDeclarations = (element) => {
|
|
265
280
|
const declarations = {};
|
|
266
281
|
if (isObject(element)) {
|
|
267
|
-
for (const key in element) if (key === "@xmlns") declarations[""] =
|
|
282
|
+
for (const key in element) if (key === "@xmlns") declarations[""] = normalizeNamespaceUri(element[key]);
|
|
268
283
|
else if (key.indexOf("@xmlns:") === 0) {
|
|
269
284
|
const prefix = key.substring(7);
|
|
270
|
-
declarations[prefix] =
|
|
285
|
+
declarations[prefix] = normalizeNamespaceUri(element[key]);
|
|
271
286
|
}
|
|
272
287
|
}
|
|
273
288
|
return declarations;
|
|
@@ -286,7 +301,7 @@ const createNamespaceNormalizator = (namespaceUris, primaryNamespace) => {
|
|
|
286
301
|
};
|
|
287
302
|
const normalizeKey = (key, context) => {
|
|
288
303
|
if (key.indexOf("@") === 0) return `@${normalizeWithContext(key.substring(1), context, false)}`;
|
|
289
|
-
|
|
304
|
+
return normalizeWithContext(key, context, true);
|
|
290
305
|
};
|
|
291
306
|
const traverseAndNormalize = (object, parentContext = {}) => {
|
|
292
307
|
if (!isObject(object)) return object;
|
|
@@ -310,8 +325,7 @@ const createNamespaceNormalizator = (namespaceUris, primaryNamespace) => {
|
|
|
310
325
|
const group = keyGroups.get(normalizedKey);
|
|
311
326
|
if (group) group.push(normalizedValue);
|
|
312
327
|
}
|
|
313
|
-
for (const [normalizedKey, values] of keyGroups)
|
|
314
|
-
else normalizedObject[normalizedKey] = values;
|
|
328
|
+
for (const [normalizedKey, values] of keyGroups) normalizedObject[normalizedKey] = values.length === 1 ? values[0] : values;
|
|
315
329
|
return normalizedObject;
|
|
316
330
|
};
|
|
317
331
|
const normalizeRoot = (object) => {
|
|
@@ -332,14 +346,17 @@ const createNamespaceNormalizator = (namespaceUris, primaryNamespace) => {
|
|
|
332
346
|
//#endregion
|
|
333
347
|
exports.createNamespaceNormalizator = createNamespaceNormalizator;
|
|
334
348
|
exports.detectNamespaces = detectNamespaces;
|
|
349
|
+
exports.generateArrayOrSingular = generateArrayOrSingular;
|
|
335
350
|
exports.generateBoolean = generateBoolean;
|
|
336
351
|
exports.generateCdataString = generateCdataString;
|
|
337
352
|
exports.generateCsvOf = generateCsvOf;
|
|
338
353
|
exports.generateNamespaceAttrs = generateNamespaceAttrs;
|
|
339
354
|
exports.generateNumber = generateNumber;
|
|
340
355
|
exports.generatePlainString = generatePlainString;
|
|
356
|
+
exports.generateRdfResource = generateRdfResource;
|
|
341
357
|
exports.generateRfc3339Date = generateRfc3339Date;
|
|
342
358
|
exports.generateRfc822Date = generateRfc822Date;
|
|
359
|
+
exports.generateSingularOrArray = generateSingularOrArray;
|
|
343
360
|
exports.generateTextOrCdataString = generateTextOrCdataString;
|
|
344
361
|
exports.generateXml = generateXml;
|
|
345
362
|
exports.generateYesNoBoolean = generateYesNoBoolean;
|
|
@@ -356,6 +373,7 @@ exports.parseSingular = parseSingular;
|
|
|
356
373
|
exports.parseSingularOf = parseSingularOf;
|
|
357
374
|
exports.parseString = parseString;
|
|
358
375
|
exports.parseYesNoBoolean = parseYesNoBoolean;
|
|
376
|
+
exports.retrieveRdfResourceOrText = retrieveRdfResourceOrText;
|
|
359
377
|
exports.retrieveText = retrieveText;
|
|
360
378
|
exports.trimArray = trimArray;
|
|
361
379
|
exports.trimObject = trimObject;
|