@newskit-render/feed 0.5.3 → 0.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.
- package/README.md +70 -17
- package/dist/cjs/helpers/utils.d.ts +1 -1
- package/dist/cjs/helpers/utils.js +3 -2
- package/dist/cjs/helpers/utils.js.map +1 -1
- package/dist/cjs/index.d.ts +1 -0
- package/dist/cjs/index.js +1 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/rss/__tests__/mocks.d.ts +4 -0
- package/dist/cjs/rss/__tests__/mocks.js +22 -0
- package/dist/cjs/rss/__tests__/mocks.js.map +1 -0
- package/dist/cjs/rss/create-rss-feed.d.ts +2 -0
- package/dist/cjs/rss/create-rss-feed.js +9 -0
- package/dist/cjs/rss/create-rss-feed.js.map +1 -0
- package/dist/cjs/rss/index.d.ts +2 -0
- package/dist/cjs/rss/index.js +4 -0
- package/dist/cjs/rss/index.js.map +1 -1
- package/dist/cjs/rss/rss-feed-resolver.d.ts +4 -0
- package/dist/cjs/rss/rss-feed-resolver.js +53 -0
- package/dist/cjs/rss/rss-feed-resolver.js.map +1 -0
- package/dist/cjs/rss/types.d.ts +16 -0
- package/dist/cjs/rss/types.js +3 -0
- package/dist/cjs/rss/types.js.map +1 -0
- package/dist/esm/helpers/utils.d.ts +1 -1
- package/dist/esm/helpers/utils.js +3 -2
- package/dist/esm/helpers/utils.js.map +1 -1
- package/dist/esm/index.d.ts +1 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/rss/__tests__/mocks.d.ts +4 -0
- package/dist/esm/rss/__tests__/mocks.js +19 -0
- package/dist/esm/rss/__tests__/mocks.js.map +1 -0
- package/dist/esm/rss/create-rss-feed.d.ts +2 -0
- package/dist/esm/rss/create-rss-feed.js +5 -0
- package/dist/esm/rss/create-rss-feed.js.map +1 -0
- package/dist/esm/rss/index.d.ts +2 -0
- package/dist/esm/rss/index.js +1 -1
- package/dist/esm/rss/index.js.map +1 -1
- package/dist/esm/rss/rss-feed-resolver.d.ts +4 -0
- package/dist/esm/rss/rss-feed-resolver.js +49 -0
- package/dist/esm/rss/rss-feed-resolver.js.map +1 -0
- package/dist/esm/rss/types.d.ts +16 -0
- package/dist/esm/rss/types.js +2 -0
- package/dist/esm/rss/types.js.map +1 -0
- package/package.json +10 -2
package/README.md
CHANGED
|
@@ -20,10 +20,41 @@ yarn add @newskit-render/feed
|
|
|
20
20
|
|
|
21
21
|
Under your `/pages/api` folder create `sitemap.ts` and `news-sitemap.ts` files.
|
|
22
22
|
|
|
23
|
+
update the `next.config.js` file to add rewrites:
|
|
24
|
+
|
|
25
|
+
```
|
|
26
|
+
async rewrites() {
|
|
27
|
+
return [
|
|
28
|
+
{
|
|
29
|
+
source: '/sitemap.xml',
|
|
30
|
+
destination: '/api/sitemap',
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
source: '/news-sitemap.xml',
|
|
34
|
+
destination: '/api/news-sitemap',
|
|
35
|
+
},
|
|
36
|
+
]
|
|
37
|
+
},
|
|
38
|
+
```
|
|
39
|
+
|
|
23
40
|
### Create Rss page
|
|
24
41
|
|
|
25
|
-
|
|
42
|
+
Under your `/pages/api` folder create `feed.ts` file
|
|
43
|
+
|
|
44
|
+
update the `next.config.js` file to add rewrites:
|
|
26
45
|
|
|
46
|
+
```
|
|
47
|
+
async rewrites() {
|
|
48
|
+
return [
|
|
49
|
+
{
|
|
50
|
+
source: '/feed',
|
|
51
|
+
destination: '/api/feed',
|
|
52
|
+
},
|
|
53
|
+
]
|
|
54
|
+
},
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
see `rssFeed` funtion
|
|
27
58
|
### Implementation
|
|
28
59
|
|
|
29
60
|
#### genericSitemap
|
|
@@ -103,21 +134,43 @@ export default handler
|
|
|
103
134
|
|
|
104
135
|
```
|
|
105
136
|
|
|
106
|
-
|
|
137
|
+
### rssFeed
|
|
138
|
+
|
|
139
|
+
`rssFeed` - this funtion will handle the logic for `feed.ts` route. It will receive the following parameters:
|
|
140
|
+
|
|
141
|
+
`context` (required) - Next.js context object (only needs `res` from context but its easier to destructor as below)
|
|
142
|
+
|
|
143
|
+
`titeAttributes` object with the following attributes:
|
|
144
|
+
|
|
145
|
+
`title` - string - title of the rss feed
|
|
146
|
+
`link` - string - link of rss feed (example - https://talksport.com/feed/)
|
|
147
|
+
`description` - string - describe what the feed is for
|
|
148
|
+
`lastBuildDate` - string - date in RFC-822 date-time - denotes last time content of feed was updated
|
|
149
|
+
`language` - optional - string - language code of feed - default: `en-US`
|
|
150
|
+
`updatePeriod` - optional - string - indicates how often feed updates so feed users know how often they should pole it. Can be `'hourly' | 'daily' | 'weekly' | 'monthly' | 'yearly'` - default: `hourly`
|
|
151
|
+
`updateFrequency` - optional - number - representing the number of times the feed should be refreshed during the updatePeriod - default: 1.
|
|
152
|
+
`logoUrl` - string - url to site icon
|
|
153
|
+
|
|
154
|
+
example
|
|
107
155
|
|
|
108
156
|
```
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
157
|
+
import { NextApiRequest, NextApiResponse } from 'next'
|
|
158
|
+
import { rssFeed, UpdatePeriod } from '@newskit-render/feed'
|
|
159
|
+
|
|
160
|
+
const handler = async (req: NextApiRequest, res: NextApiResponse) =>
|
|
161
|
+
rssFeed({
|
|
162
|
+
res,
|
|
163
|
+
titeAttributes: {
|
|
164
|
+
title: 'Demo Site',
|
|
165
|
+
link: `${process.env.SITE_HOST}/feed`,
|
|
166
|
+
description: 'Newskit Render Demo site',
|
|
167
|
+
lastBuildDate: new Date().toUTCString(),
|
|
168
|
+
language: 'en-US',
|
|
169
|
+
updatePeriod: 'hourly' as UpdatePeriod,
|
|
170
|
+
updateFrequency: 1,
|
|
171
|
+
logoUrl: `${process.env.SITE_HOST}/favicon.ico`,
|
|
172
|
+
},
|
|
173
|
+
})
|
|
174
|
+
|
|
175
|
+
export default handler
|
|
176
|
+
```
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ServerResponse } from 'http';
|
|
2
2
|
export declare const sitemapXml: () => null;
|
|
3
|
-
export declare const setResponse: (res: ServerResponse, html: string) => {
|
|
3
|
+
export declare const setResponse: (res: ServerResponse, html: string, contentType?: string) => {
|
|
4
4
|
props: Record<string, never>;
|
|
5
5
|
};
|
|
6
6
|
export declare const getTodayDate: () => string;
|
|
@@ -5,8 +5,9 @@ var sitemapXml = function () {
|
|
|
5
5
|
return null;
|
|
6
6
|
};
|
|
7
7
|
exports.sitemapXml = sitemapXml;
|
|
8
|
-
var setResponse = function (res, html) {
|
|
9
|
-
|
|
8
|
+
var setResponse = function (res, html, contentType) {
|
|
9
|
+
if (contentType === void 0) { contentType = 'text/xml'; }
|
|
10
|
+
res.setHeader('Content-Type', contentType);
|
|
10
11
|
res.write(html);
|
|
11
12
|
res.end();
|
|
12
13
|
return { props: {} };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/helpers/utils.ts"],"names":[],"mappings":";;;AACO,IAAM,UAAU,GAAG;IACxB,OAAO,IAAI,CAAA;AACb,CAAC,CAAA;AAFY,QAAA,UAAU,cAEtB;AAEM,IAAM,WAAW,GAAG,UACzB,GAAmB,EACnB,IAAY;
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/helpers/utils.ts"],"names":[],"mappings":";;;AACO,IAAM,UAAU,GAAG;IACxB,OAAO,IAAI,CAAA;AACb,CAAC,CAAA;AAFY,QAAA,UAAU,cAEtB;AAEM,IAAM,WAAW,GAAG,UACzB,GAAmB,EACnB,IAAY,EACZ,WAAwB;IAAxB,4BAAA,EAAA,wBAAwB;IAExB,GAAG,CAAC,SAAS,CAAC,cAAc,EAAE,WAAW,CAAC,CAAA;IAC1C,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;IACf,GAAG,CAAC,GAAG,EAAE,CAAA;IAET,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE,CAAA;AACtB,CAAC,CAAA;AAVY,QAAA,WAAW,eAUvB;AAEM,IAAM,YAAY,GAAG;IAC1B,OAAO,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAA;AAC9C,CAAC,CAAA;AAFY,QAAA,YAAY,gBAExB;AAEM,IAAM,iBAAiB,GAAG;IAC/B,OAAO,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAA;AAC3E,CAAC,CAAA;AAFY,QAAA,iBAAiB,qBAE7B;AAEM,IAAM,WAAW,GAAG,UAAC,SAAe,EAAE,OAAa;IACxD,IAAM,OAAO,GAAG,CAAC,SAAS,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAA;IACtD,iDAAiD;IACjD,IAAM,SAAS,GAAG,IAAI,CAAC,IAAI,CACzB,CAAC,OAAO,CAAC,OAAO,EAAE,GAAG,SAAS,CAAC,OAAO,EAAE,CAAC,GAAG,CAAC,IAAI,GAAG,IAAI,GAAG,EAAE,CAAC,CAC/D,CAAA;IAED,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,SAAS,EAAE,CAAC,EAAE,EAAE;QAClC,IAAM,IAAI,GAAG,IAAI,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,SAAS,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC,CAAC;aAC9D,WAAW,EAAE;aACb,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAA;QACf,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;KACnB;IACD,OAAO,OAAO,CAAC,OAAO,EAAE,CAAA;AAC1B,CAAC,CAAA;AAdY,QAAA,WAAW,eAcvB;AAEM,IAAM,YAAY,GAAG,UAAC,IAAY;IACvC,OAAA,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC,IAAI,EAAE;AAAnC,CAAmC,CAAA;AADxB,QAAA,YAAY,gBACY"}
|
package/dist/cjs/index.d.ts
CHANGED
package/dist/cjs/index.js
CHANGED
|
@@ -11,4 +11,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
11
11
|
};
|
|
12
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
13
|
__exportStar(require("./sitemap"), exports);
|
|
14
|
+
__exportStar(require("./rss"), exports);
|
|
14
15
|
//# sourceMappingURL=index.js.map
|
package/dist/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,4CAAyB"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,4CAAyB;AACzB,wCAAqB"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.rssMock = exports.titeAttributesdefaultMock = exports.titeAttributesMock = void 0;
|
|
4
|
+
exports.titeAttributesMock = {
|
|
5
|
+
title: 'Demo',
|
|
6
|
+
link: 'https://demo.com/feed/',
|
|
7
|
+
description: 'demo test feed',
|
|
8
|
+
lastBuildDate: 'Fri, 01 Apr 2022 13:00:30 GMT',
|
|
9
|
+
language: 'en-US',
|
|
10
|
+
updatePeriod: 'hourly',
|
|
11
|
+
updateFrequency: 1,
|
|
12
|
+
logoUrl: 'https://talksport.com/demo-icon;w=32',
|
|
13
|
+
};
|
|
14
|
+
exports.titeAttributesdefaultMock = {
|
|
15
|
+
title: 'Demo',
|
|
16
|
+
link: 'https://demo.com/feed/',
|
|
17
|
+
description: 'demo test feed',
|
|
18
|
+
lastBuildDate: 'Fri, 01 Apr 2022 13:00:30 GMT',
|
|
19
|
+
logoUrl: 'https://talksport.com/demo-icon;w=32',
|
|
20
|
+
};
|
|
21
|
+
exports.rssMock = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<rss version=\"2.0\"\n xmlns:content=\"http://purl.org/rss/1.0/modules/content/\"\n xmlns:wfw=\"http://wellformedweb.org/CommentAPI/\"\n xmlns:dc=\"http://purl.org/dc/elements/1.1/\"\n xmlns:atom=\"http://www.w3.org/2005/Atom\"\n xmlns:sy=\"http://purl.org/rss/1.0/modules/syndication/\"\n xmlns:slash=\"http://purl.org/rss/1.0/modules/slash/\"\t\n xmlns:georss=\"http://www.georss.org/georss\"\n xmlns:geo=\"http://www.w3.org/2003/01/geo/wgs84_pos#\"\n>\n<channel>\n <title>" + exports.titeAttributesMock.title + "</title>\n <atom:link href=\"" + exports.titeAttributesMock.link + "\" rel=\"self\" type=\"application/rss+xml\" />\n <link>" + exports.titeAttributesMock.link + "</link>\n <description>" + exports.titeAttributesMock.description + "</description>\n <lastBuildDate>" + exports.titeAttributesMock.lastBuildDate + "</lastBuildDate>\n <language>" + exports.titeAttributesMock.language + "</language>\n <sy:updatePeriod>" + exports.titeAttributesMock.updatePeriod + "</sy:updatePeriod>\n <sy:updateFrequency>" + exports.titeAttributesMock.updateFrequency + "</sy:updateFrequency>\n <generator>Newskit Render</generator>\n <image>\n <url>" + exports.titeAttributesMock.logoUrl + "</url>\n <title>" + exports.titeAttributesMock.title + "</title>\n <link>" + exports.titeAttributesMock.link + "</link>\n <width>32</width>\n <height>32</height>\n </image>\n <item>\n <title>temp test item</title>\n <link>https://somewhere</link>\n <description>placeholder iterm to be replaced in PPDSR-736</description>\n <guid isPermaLink=\"false\">Post 1077148 at temp test</guid>\n </item>\n</channel>\n</rss>\n";
|
|
22
|
+
//# sourceMappingURL=mocks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mocks.js","sourceRoot":"","sources":["../../../../src/rss/__tests__/mocks.ts"],"names":[],"mappings":";;;AAEa,QAAA,kBAAkB,GAAmB;IAChD,KAAK,EAAE,MAAM;IACb,IAAI,EAAE,wBAAwB;IAC9B,WAAW,EAAE,gBAAgB;IAC7B,aAAa,EAAE,+BAA+B;IAC9C,QAAQ,EAAE,OAAO;IACjB,YAAY,EAAE,QAAQ;IACtB,eAAe,EAAE,CAAC;IAClB,OAAO,EAAE,sCAAsC;CAChD,CAAA;AAEY,QAAA,yBAAyB,GAAmB;IACvD,KAAK,EAAE,MAAM;IACb,IAAI,EAAE,wBAAwB;IAC9B,WAAW,EAAE,gBAAgB;IAC7B,aAAa,EAAE,+BAA+B;IAC9C,OAAO,EAAE,sCAAsC;CAChD,CAAA;AAEY,QAAA,OAAO,GAAG,uiBAYV,0BAAkB,CAAC,KAAK,wCACd,0BAAkB,CAAC,IAAI,mEAClC,0BAAkB,CAAC,IAAI,kCAChB,0BAAkB,CAAC,WAAW,2CAC5B,0BAAkB,CAAC,aAAa,wCACrC,0BAAkB,CAAC,QAAQ,0CACpB,0BAAkB,CAAC,YAAY,oDAC5B,0BAAkB,CAAC,eAAe,oGAG7C,0BAAkB,CAAC,OAAO,+BACxB,0BAAkB,CAAC,KAAK,gCACzB,0BAAkB,CAAC,IAAI,wWAYtC,CAAA"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createRSSFeed = void 0;
|
|
4
|
+
var createRSSFeed = function (_a) {
|
|
5
|
+
var title = _a.title, link = _a.link, description = _a.description, lastBuildDate = _a.lastBuildDate, _b = _a.language, language = _b === void 0 ? 'en-US' : _b, _c = _a.updatePeriod, updatePeriod = _c === void 0 ? 'hourly' : _c, _d = _a.updateFrequency, updateFrequency = _d === void 0 ? 1 : _d, logoUrl = _a.logoUrl;
|
|
6
|
+
return "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<rss version=\"2.0\"\n xmlns:content=\"http://purl.org/rss/1.0/modules/content/\"\n xmlns:wfw=\"http://wellformedweb.org/CommentAPI/\"\n xmlns:dc=\"http://purl.org/dc/elements/1.1/\"\n xmlns:atom=\"http://www.w3.org/2005/Atom\"\n xmlns:sy=\"http://purl.org/rss/1.0/modules/syndication/\"\n xmlns:slash=\"http://purl.org/rss/1.0/modules/slash/\"\t\n xmlns:georss=\"http://www.georss.org/georss\"\n xmlns:geo=\"http://www.w3.org/2003/01/geo/wgs84_pos#\"\n>\n<channel>\n <title>" + title + "</title>\n <atom:link href=\"" + link + "\" rel=\"self\" type=\"application/rss+xml\" />\n <link>" + link + "</link>\n <description>" + description + "</description>\n <lastBuildDate>" + lastBuildDate + "</lastBuildDate>\n <language>" + language + "</language>\n <sy:updatePeriod>" + updatePeriod + "</sy:updatePeriod>\n <sy:updateFrequency>" + updateFrequency + "</sy:updateFrequency>\n <generator>Newskit Render</generator>\n <image>\n <url>" + logoUrl + "</url>\n <title>" + title + "</title>\n <link>" + link + "</link>\n <width>32</width>\n <height>32</height>\n </image>\n <item>\n <title>temp test item</title>\n <link>https://somewhere</link>\n <description>placeholder iterm to be replaced in PPDSR-736</description>\n <guid isPermaLink=\"false\">Post 1077148 at temp test</guid>\n </item>\n</channel>\n</rss>\n";
|
|
7
|
+
};
|
|
8
|
+
exports.createRSSFeed = createRSSFeed;
|
|
9
|
+
//# sourceMappingURL=create-rss-feed.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-rss-feed.js","sourceRoot":"","sources":["../../../src/rss/create-rss-feed.ts"],"names":[],"mappings":";;;AAEO,IAAM,aAAa,GAAG,UAAC,EASb;QARf,KAAK,WAAA,EACL,IAAI,UAAA,EACJ,WAAW,iBAAA,EACX,aAAa,mBAAA,EACb,gBAAkB,EAAlB,QAAQ,mBAAG,OAAO,KAAA,EAClB,oBAAuB,EAAvB,YAAY,mBAAG,QAAQ,KAAA,EACvB,uBAAmB,EAAnB,eAAe,mBAAG,CAAC,KAAA,EACnB,OAAO,aAAA;IACqB,OAAA,uiBAYjB,KAAK,wCACK,IAAI,mEACf,IAAI,kCACG,WAAW,2CACT,aAAa,wCAClB,QAAQ,0CACD,YAAY,oDACT,eAAe,oGAG1B,OAAO,+BACL,KAAK,gCACN,IAAI,wWAYnB;AApC6B,CAoC7B,CAAA;AA7CY,QAAA,aAAa,iBA6CzB"}
|
package/dist/cjs/rss/index.d.ts
CHANGED
package/dist/cjs/rss/index.js
CHANGED
|
@@ -1,2 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.rssFeed = void 0;
|
|
4
|
+
var rss_feed_resolver_1 = require("./rss-feed-resolver");
|
|
5
|
+
Object.defineProperty(exports, "rssFeed", { enumerable: true, get: function () { return rss_feed_resolver_1.rssFeed; } });
|
|
2
6
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/rss/index.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/rss/index.ts"],"names":[],"mappings":";;;AAAA,yDAA6C;AAApC,4GAAA,OAAO,OAAA"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (_) try {
|
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.rssFeed = void 0;
|
|
40
|
+
var utils_1 = require("../helpers/utils");
|
|
41
|
+
var create_rss_feed_1 = require("./create-rss-feed");
|
|
42
|
+
var rssFeed = function (_a) {
|
|
43
|
+
var res = _a.res, titeAttributes = _a.titeAttributes;
|
|
44
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
45
|
+
var html;
|
|
46
|
+
return __generator(this, function (_b) {
|
|
47
|
+
html = (0, create_rss_feed_1.createRSSFeed)(titeAttributes);
|
|
48
|
+
return [2 /*return*/, (0, utils_1.setResponse)(res, html, 'application/rss+xml; charset=UTF-8')];
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
};
|
|
52
|
+
exports.rssFeed = rssFeed;
|
|
53
|
+
//# sourceMappingURL=rss-feed-resolver.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rss-feed-resolver.js","sourceRoot":"","sources":["../../../src/rss/rss-feed-resolver.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0CAA8C;AAE9C,qDAAiD;AAE1C,IAAM,OAAO,GAAG,UAAO,EAGf;QAFb,GAAG,SAAA,EACH,cAAc,oBAAA;;;;YAER,IAAI,GAAG,IAAA,+BAAa,EAAC,cAAc,CAAC,CAAA;YAC1C,sBAAO,IAAA,mBAAW,EAAC,GAAG,EAAE,IAAI,EAAE,oCAAoC,CAAC,EAAA;;;CACpE,CAAA;AANY,QAAA,OAAO,WAMnB"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { NextApiResponse } from 'next';
|
|
2
|
+
export declare type UpdatePeriod = 'hourly' | 'daily' | 'weekly' | 'monthly' | 'yearly';
|
|
3
|
+
export declare type TiteAttributes = {
|
|
4
|
+
title: string;
|
|
5
|
+
link: string;
|
|
6
|
+
description: string;
|
|
7
|
+
lastBuildDate: string;
|
|
8
|
+
language?: string;
|
|
9
|
+
updatePeriod?: UpdatePeriod;
|
|
10
|
+
updateFrequency?: number;
|
|
11
|
+
logoUrl: string;
|
|
12
|
+
};
|
|
13
|
+
export interface RssFeedProps {
|
|
14
|
+
res: NextApiResponse;
|
|
15
|
+
titeAttributes: TiteAttributes;
|
|
16
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/rss/types.ts"],"names":[],"mappings":""}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ServerResponse } from 'http';
|
|
2
2
|
export declare const sitemapXml: () => null;
|
|
3
|
-
export declare const setResponse: (res: ServerResponse, html: string) => {
|
|
3
|
+
export declare const setResponse: (res: ServerResponse, html: string, contentType?: string) => {
|
|
4
4
|
props: Record<string, never>;
|
|
5
5
|
};
|
|
6
6
|
export declare const getTodayDate: () => string;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
export var sitemapXml = function () {
|
|
2
2
|
return null;
|
|
3
3
|
};
|
|
4
|
-
export var setResponse = function (res, html) {
|
|
5
|
-
|
|
4
|
+
export var setResponse = function (res, html, contentType) {
|
|
5
|
+
if (contentType === void 0) { contentType = 'text/xml'; }
|
|
6
|
+
res.setHeader('Content-Type', contentType);
|
|
6
7
|
res.write(html);
|
|
7
8
|
res.end();
|
|
8
9
|
return { props: {} };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/helpers/utils.ts"],"names":[],"mappings":"AACA,MAAM,CAAC,IAAM,UAAU,GAAG;IACxB,OAAO,IAAI,CAAA;AACb,CAAC,CAAA;AAED,MAAM,CAAC,IAAM,WAAW,GAAG,UACzB,GAAmB,EACnB,IAAY;
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/helpers/utils.ts"],"names":[],"mappings":"AACA,MAAM,CAAC,IAAM,UAAU,GAAG;IACxB,OAAO,IAAI,CAAA;AACb,CAAC,CAAA;AAED,MAAM,CAAC,IAAM,WAAW,GAAG,UACzB,GAAmB,EACnB,IAAY,EACZ,WAAwB;IAAxB,4BAAA,EAAA,wBAAwB;IAExB,GAAG,CAAC,SAAS,CAAC,cAAc,EAAE,WAAW,CAAC,CAAA;IAC1C,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;IACf,GAAG,CAAC,GAAG,EAAE,CAAA;IAET,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE,CAAA;AACtB,CAAC,CAAA;AAED,MAAM,CAAC,IAAM,YAAY,GAAG;IAC1B,OAAO,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAA;AAC9C,CAAC,CAAA;AAED,MAAM,CAAC,IAAM,iBAAiB,GAAG;IAC/B,OAAO,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAA;AAC3E,CAAC,CAAA;AAED,MAAM,CAAC,IAAM,WAAW,GAAG,UAAC,SAAe,EAAE,OAAa;IACxD,IAAM,OAAO,GAAG,CAAC,SAAS,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAA;IACtD,iDAAiD;IACjD,IAAM,SAAS,GAAG,IAAI,CAAC,IAAI,CACzB,CAAC,OAAO,CAAC,OAAO,EAAE,GAAG,SAAS,CAAC,OAAO,EAAE,CAAC,GAAG,CAAC,IAAI,GAAG,IAAI,GAAG,EAAE,CAAC,CAC/D,CAAA;IAED,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,SAAS,EAAE,CAAC,EAAE,EAAE;QAClC,IAAM,IAAI,GAAG,IAAI,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,SAAS,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC,CAAC;aAC9D,WAAW,EAAE;aACb,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAA;QACf,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;KACnB;IACD,OAAO,OAAO,CAAC,OAAO,EAAE,CAAA;AAC1B,CAAC,CAAA;AAED,MAAM,CAAC,IAAM,YAAY,GAAG,UAAC,IAAY;IACvC,OAAA,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC,IAAI,EAAE;AAAnC,CAAmC,CAAA"}
|
package/dist/esm/index.d.ts
CHANGED
package/dist/esm/index.js
CHANGED
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAA;AACzB,cAAc,OAAO,CAAA"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export var titeAttributesMock = {
|
|
2
|
+
title: 'Demo',
|
|
3
|
+
link: 'https://demo.com/feed/',
|
|
4
|
+
description: 'demo test feed',
|
|
5
|
+
lastBuildDate: 'Fri, 01 Apr 2022 13:00:30 GMT',
|
|
6
|
+
language: 'en-US',
|
|
7
|
+
updatePeriod: 'hourly',
|
|
8
|
+
updateFrequency: 1,
|
|
9
|
+
logoUrl: 'https://talksport.com/demo-icon;w=32',
|
|
10
|
+
};
|
|
11
|
+
export var titeAttributesdefaultMock = {
|
|
12
|
+
title: 'Demo',
|
|
13
|
+
link: 'https://demo.com/feed/',
|
|
14
|
+
description: 'demo test feed',
|
|
15
|
+
lastBuildDate: 'Fri, 01 Apr 2022 13:00:30 GMT',
|
|
16
|
+
logoUrl: 'https://talksport.com/demo-icon;w=32',
|
|
17
|
+
};
|
|
18
|
+
export var rssMock = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<rss version=\"2.0\"\n xmlns:content=\"http://purl.org/rss/1.0/modules/content/\"\n xmlns:wfw=\"http://wellformedweb.org/CommentAPI/\"\n xmlns:dc=\"http://purl.org/dc/elements/1.1/\"\n xmlns:atom=\"http://www.w3.org/2005/Atom\"\n xmlns:sy=\"http://purl.org/rss/1.0/modules/syndication/\"\n xmlns:slash=\"http://purl.org/rss/1.0/modules/slash/\"\t\n xmlns:georss=\"http://www.georss.org/georss\"\n xmlns:geo=\"http://www.w3.org/2003/01/geo/wgs84_pos#\"\n>\n<channel>\n <title>" + titeAttributesMock.title + "</title>\n <atom:link href=\"" + titeAttributesMock.link + "\" rel=\"self\" type=\"application/rss+xml\" />\n <link>" + titeAttributesMock.link + "</link>\n <description>" + titeAttributesMock.description + "</description>\n <lastBuildDate>" + titeAttributesMock.lastBuildDate + "</lastBuildDate>\n <language>" + titeAttributesMock.language + "</language>\n <sy:updatePeriod>" + titeAttributesMock.updatePeriod + "</sy:updatePeriod>\n <sy:updateFrequency>" + titeAttributesMock.updateFrequency + "</sy:updateFrequency>\n <generator>Newskit Render</generator>\n <image>\n <url>" + titeAttributesMock.logoUrl + "</url>\n <title>" + titeAttributesMock.title + "</title>\n <link>" + titeAttributesMock.link + "</link>\n <width>32</width>\n <height>32</height>\n </image>\n <item>\n <title>temp test item</title>\n <link>https://somewhere</link>\n <description>placeholder iterm to be replaced in PPDSR-736</description>\n <guid isPermaLink=\"false\">Post 1077148 at temp test</guid>\n </item>\n</channel>\n</rss>\n";
|
|
19
|
+
//# sourceMappingURL=mocks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mocks.js","sourceRoot":"","sources":["../../../../src/rss/__tests__/mocks.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,IAAM,kBAAkB,GAAmB;IAChD,KAAK,EAAE,MAAM;IACb,IAAI,EAAE,wBAAwB;IAC9B,WAAW,EAAE,gBAAgB;IAC7B,aAAa,EAAE,+BAA+B;IAC9C,QAAQ,EAAE,OAAO;IACjB,YAAY,EAAE,QAAQ;IACtB,eAAe,EAAE,CAAC;IAClB,OAAO,EAAE,sCAAsC;CAChD,CAAA;AAED,MAAM,CAAC,IAAM,yBAAyB,GAAmB;IACvD,KAAK,EAAE,MAAM;IACb,IAAI,EAAE,wBAAwB;IAC9B,WAAW,EAAE,gBAAgB;IAC7B,aAAa,EAAE,+BAA+B;IAC9C,OAAO,EAAE,sCAAsC;CAChD,CAAA;AAED,MAAM,CAAC,IAAM,OAAO,GAAG,uiBAYV,kBAAkB,CAAC,KAAK,wCACd,kBAAkB,CAAC,IAAI,mEAClC,kBAAkB,CAAC,IAAI,kCAChB,kBAAkB,CAAC,WAAW,2CAC5B,kBAAkB,CAAC,aAAa,wCACrC,kBAAkB,CAAC,QAAQ,0CACpB,kBAAkB,CAAC,YAAY,oDAC5B,kBAAkB,CAAC,eAAe,oGAG7C,kBAAkB,CAAC,OAAO,+BACxB,kBAAkB,CAAC,KAAK,gCACzB,kBAAkB,CAAC,IAAI,wWAYtC,CAAA"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export var createRSSFeed = function (_a) {
|
|
2
|
+
var title = _a.title, link = _a.link, description = _a.description, lastBuildDate = _a.lastBuildDate, _b = _a.language, language = _b === void 0 ? 'en-US' : _b, _c = _a.updatePeriod, updatePeriod = _c === void 0 ? 'hourly' : _c, _d = _a.updateFrequency, updateFrequency = _d === void 0 ? 1 : _d, logoUrl = _a.logoUrl;
|
|
3
|
+
return "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<rss version=\"2.0\"\n xmlns:content=\"http://purl.org/rss/1.0/modules/content/\"\n xmlns:wfw=\"http://wellformedweb.org/CommentAPI/\"\n xmlns:dc=\"http://purl.org/dc/elements/1.1/\"\n xmlns:atom=\"http://www.w3.org/2005/Atom\"\n xmlns:sy=\"http://purl.org/rss/1.0/modules/syndication/\"\n xmlns:slash=\"http://purl.org/rss/1.0/modules/slash/\"\t\n xmlns:georss=\"http://www.georss.org/georss\"\n xmlns:geo=\"http://www.w3.org/2003/01/geo/wgs84_pos#\"\n>\n<channel>\n <title>" + title + "</title>\n <atom:link href=\"" + link + "\" rel=\"self\" type=\"application/rss+xml\" />\n <link>" + link + "</link>\n <description>" + description + "</description>\n <lastBuildDate>" + lastBuildDate + "</lastBuildDate>\n <language>" + language + "</language>\n <sy:updatePeriod>" + updatePeriod + "</sy:updatePeriod>\n <sy:updateFrequency>" + updateFrequency + "</sy:updateFrequency>\n <generator>Newskit Render</generator>\n <image>\n <url>" + logoUrl + "</url>\n <title>" + title + "</title>\n <link>" + link + "</link>\n <width>32</width>\n <height>32</height>\n </image>\n <item>\n <title>temp test item</title>\n <link>https://somewhere</link>\n <description>placeholder iterm to be replaced in PPDSR-736</description>\n <guid isPermaLink=\"false\">Post 1077148 at temp test</guid>\n </item>\n</channel>\n</rss>\n";
|
|
4
|
+
};
|
|
5
|
+
//# sourceMappingURL=create-rss-feed.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-rss-feed.js","sourceRoot":"","sources":["../../../src/rss/create-rss-feed.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,IAAM,aAAa,GAAG,UAAC,EASb;QARf,KAAK,WAAA,EACL,IAAI,UAAA,EACJ,WAAW,iBAAA,EACX,aAAa,mBAAA,EACb,gBAAkB,EAAlB,QAAQ,mBAAG,OAAO,KAAA,EAClB,oBAAuB,EAAvB,YAAY,mBAAG,QAAQ,KAAA,EACvB,uBAAmB,EAAnB,eAAe,mBAAG,CAAC,KAAA,EACnB,OAAO,aAAA;IACqB,OAAA,uiBAYjB,KAAK,wCACK,IAAI,mEACf,IAAI,kCACG,WAAW,2CACT,aAAa,wCAClB,QAAQ,0CACD,YAAY,oDACT,eAAe,oGAG1B,OAAO,+BACL,KAAK,gCACN,IAAI,wWAYnB;AApC6B,CAoC7B,CAAA"}
|
package/dist/esm/rss/index.d.ts
CHANGED
package/dist/esm/rss/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
export { rssFeed } from './rss-feed-resolver';
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/rss/index.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/rss/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
11
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
12
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
13
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
14
|
+
function step(op) {
|
|
15
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
16
|
+
while (_) try {
|
|
17
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
18
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
19
|
+
switch (op[0]) {
|
|
20
|
+
case 0: case 1: t = op; break;
|
|
21
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
22
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
23
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
24
|
+
default:
|
|
25
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
26
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
27
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
28
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
29
|
+
if (t[2]) _.ops.pop();
|
|
30
|
+
_.trys.pop(); continue;
|
|
31
|
+
}
|
|
32
|
+
op = body.call(thisArg, _);
|
|
33
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
34
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
import { setResponse } from '../helpers/utils';
|
|
38
|
+
import { createRSSFeed } from './create-rss-feed';
|
|
39
|
+
export var rssFeed = function (_a) {
|
|
40
|
+
var res = _a.res, titeAttributes = _a.titeAttributes;
|
|
41
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
42
|
+
var html;
|
|
43
|
+
return __generator(this, function (_b) {
|
|
44
|
+
html = createRSSFeed(titeAttributes);
|
|
45
|
+
return [2 /*return*/, setResponse(res, html, 'application/rss+xml; charset=UTF-8')];
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
};
|
|
49
|
+
//# sourceMappingURL=rss-feed-resolver.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rss-feed-resolver.js","sourceRoot":"","sources":["../../../src/rss/rss-feed-resolver.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAE9C,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAEjD,MAAM,CAAC,IAAM,OAAO,GAAG,UAAO,EAGf;QAFb,GAAG,SAAA,EACH,cAAc,oBAAA;;;;YAER,IAAI,GAAG,aAAa,CAAC,cAAc,CAAC,CAAA;YAC1C,sBAAO,WAAW,CAAC,GAAG,EAAE,IAAI,EAAE,oCAAoC,CAAC,EAAA;;;CACpE,CAAA"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { NextApiResponse } from 'next';
|
|
2
|
+
export declare type UpdatePeriod = 'hourly' | 'daily' | 'weekly' | 'monthly' | 'yearly';
|
|
3
|
+
export declare type TiteAttributes = {
|
|
4
|
+
title: string;
|
|
5
|
+
link: string;
|
|
6
|
+
description: string;
|
|
7
|
+
lastBuildDate: string;
|
|
8
|
+
language?: string;
|
|
9
|
+
updatePeriod?: UpdatePeriod;
|
|
10
|
+
updateFrequency?: number;
|
|
11
|
+
logoUrl: string;
|
|
12
|
+
};
|
|
13
|
+
export interface RssFeedProps {
|
|
14
|
+
res: NextApiResponse;
|
|
15
|
+
titeAttributes: TiteAttributes;
|
|
16
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/rss/types.ts"],"names":[],"mappings":""}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@newskit-render/feed",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"description": "Newskit Render - Feed package",
|
|
5
5
|
"author": "",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -24,12 +24,20 @@
|
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"@apollo/client": "3.3.7",
|
|
27
|
-
"@newskit-render/api": "^0.
|
|
27
|
+
"@newskit-render/api": "^0.21.0",
|
|
28
28
|
"cross-fetch": "3.1.4",
|
|
29
29
|
"graphql": "15.6.0",
|
|
30
30
|
"lodash.escape": "4.0.1",
|
|
31
31
|
"react": "17.0.2"
|
|
32
32
|
},
|
|
33
|
+
"resolutions": {
|
|
34
|
+
"@types/react": "^17.0.1",
|
|
35
|
+
"@types/react-dom": "^17.0.2"
|
|
36
|
+
},
|
|
37
|
+
"overrides": {
|
|
38
|
+
"@types/react": "^17.0.1",
|
|
39
|
+
"@types/react-dom": "^17.0.2"
|
|
40
|
+
},
|
|
33
41
|
"devDependencies": {
|
|
34
42
|
"@types/jest": "27.0.2",
|
|
35
43
|
"@typescript-eslint/eslint-plugin": "4.13.0",
|