@newskit-render/feed 0.5.2 → 0.7.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/queryArticleList.d.ts +3 -3
- package/dist/cjs/helpers/queryArticleList.js.map +1 -1
- package/dist/cjs/helpers/queryPage.d.ts +4 -4
- package/dist/cjs/helpers/queryPage.js.map +1 -1
- package/dist/cjs/helpers/types.d.ts +3 -3
- package/dist/cjs/helpers/types.js.map +1 -1
- 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/cjs/sitemap/__tests__/mocks.js +3 -2
- package/dist/cjs/sitemap/__tests__/mocks.js.map +1 -1
- package/dist/cjs/sitemap/index.d.ts +2 -2
- package/dist/cjs/sitemap/index.js.map +1 -1
- package/dist/esm/helpers/queryArticleList.d.ts +3 -3
- package/dist/esm/helpers/queryArticleList.js.map +1 -1
- package/dist/esm/helpers/queryPage.d.ts +4 -4
- package/dist/esm/helpers/queryPage.js.map +1 -1
- package/dist/esm/helpers/types.d.ts +3 -3
- package/dist/esm/helpers/types.js.map +1 -1
- 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/dist/esm/sitemap/__tests__/mocks.js +3 -2
- package/dist/esm/sitemap/__tests__/mocks.js.map +1 -1
- package/dist/esm/sitemap/index.d.ts +2 -2
- package/dist/esm/sitemap/index.js +1 -1
- package/dist/esm/sitemap/index.js.map +1 -1
- 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,7 +1,7 @@
|
|
|
1
|
-
import { ApolloHttpClient } from '@newskit-render/api';
|
|
1
|
+
import { ApolloHttpClient, Publisher } from '@newskit-render/api';
|
|
2
2
|
import { DocumentNode } from 'graphql';
|
|
3
|
-
import { ArticleList
|
|
4
|
-
export declare const queryArticleList: (publisher:
|
|
3
|
+
import { ArticleList } from './types';
|
|
4
|
+
export declare const queryArticleList: (publisher: Publisher, dates: {
|
|
5
5
|
from: string;
|
|
6
6
|
to?: string | undefined;
|
|
7
7
|
}, apolloClient: ApolloHttpClient, articleQuery: DocumentNode) => Promise<ArticleList>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"queryArticleList.js","sourceRoot":"","sources":["../../../src/helpers/queryArticleList.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGO,IAAM,gBAAgB,GAAG,UAC9B,
|
|
1
|
+
{"version":3,"file":"queryArticleList.js","sourceRoot":"","sources":["../../../src/helpers/queryArticleList.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGO,IAAM,gBAAgB,GAAG,UAC9B,SAAoB,EACpB,KAAoC,EACpC,YAA8B,EAC9B,YAA0B;;;;;gBAEtB,MAAM,GAAG,EAAE,CAAA;gBAEX,eAAe,GAAgB,EAAE,CAAA;gBAC7B,IAAI,GAAS,KAAK,KAAd,EAAE,EAAE,GAAK,KAAK,GAAV,CAAU;gBAGT,qBAAM,YAAY,CAAC,KAAK,CAAC;wBACxC,KAAK,EAAE,YAAY;wBACnB,SAAS,EAAE;4BACT,MAAM,EAAE,MAAM;4BACd,SAAS,EAAE,SAAS;4BACpB,IAAI,MAAA;4BACJ,EAAE,IAAA;yBACH;qBACF,CAAC;oBAEF,mDAAmD;kBAFjD;;gBARM,IAAI,GAAK,CAAA,SAQf,CAAA,KARU;gBAUZ,mDAAmD;gBACnD,MAAM,GAAG,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC,IAAI,CAAA;gBAC1C,mFAAmF;gBACnF,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,UAAU,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,UAAU,CAAC,CAAA;gBACzE,kDAAkD;gBAClD,eAAe,GAAG,eAAe,CAAC,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAA;;;qBAGxD,CAAA,eAAe,CAAC,MAAM,GAAG,UAAU,CAAA;gBACvB,qBAAM,YAAY,CAAC,KAAK,CAAC;wBACxC,KAAK,EAAE,YAAY;wBACnB,SAAS,EAAE;4BACT,MAAM,EAAE,MAAM;4BACd,SAAS,EAAE,SAAS;4BACpB,IAAI,MAAA;4BACJ,EAAE,IAAA;yBACH;qBACF,CAAC,EAAA;;gBARM,SAAS,CAAA,SAQf,CAAA,KARU;gBAUZ,MAAM,GAAG,MAAI,CAAC,WAAW,CAAC,WAAW,CAAC,IAAI,CAAA;gBAC1C,eAAe,GAAG,eAAe,CAAC,MAAM,CAAC,MAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAA;;oBAGjE,sBAAO,eAAe,EAAA;;;KACvB,CAAA;AA9CY,QAAA,gBAAgB,oBA8C5B"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Channel,
|
|
2
|
-
import { ApolloHttpClient } from '@newskit-render/api';
|
|
3
|
-
export declare const queryPage: (publisher:
|
|
4
|
-
export declare const queryChannelsList: (publisher:
|
|
1
|
+
import { Channel, StaticPage } from './types';
|
|
2
|
+
import { ApolloHttpClient, Publisher } from '@newskit-render/api';
|
|
3
|
+
export declare const queryPage: (publisher: Publisher, channel: string, apolloClient: ApolloHttpClient) => Promise<Omit<StaticPage, 'url'>>;
|
|
4
|
+
export declare const queryChannelsList: (publisher: Publisher, apolloClient: ApolloHttpClient) => Promise<Channel[]>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"queryPage.js","sourceRoot":"","sources":["../../../src/helpers/queryPage.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,sEAAsE;AACtE,sDAAqD;
|
|
1
|
+
{"version":3,"file":"queryPage.js","sourceRoot":"","sources":["../../../src/helpers/queryPage.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,sEAAsE;AACtE,sDAAqD;AAI9C,IAAM,SAAS,GAAG,UACvB,SAAoB,EACpB,OAAe,EACf,YAA8B;;;;oBAEY,qBAAM,YAAY,CAAC,KAAK,CAAC;oBACjE,KAAK,EAAE,kBAAQ;oBACf,SAAS,EAAE;wBACT,SAAS,EAAE,SAAS;wBACpB,OAAO,SAAA;qBACR;oBACD,WAAW,EAAE,KAAK;iBACnB,CAAC,EAAA;;gBAPM,IAAI,GAA8B,CAAA,SAOxC,CAAA,KAPU;gBAQZ,sBAAO,IAAI,CAAC,IAAI,EAAA;;;KACjB,CAAA;AAdY,QAAA,SAAS,aAcrB;AAEM,IAAM,iBAAiB,GAAG,UAC/B,SAAoB,EACpB,YAA8B;;;;;gBAE1B,QAAQ,GAAG,EAAE,CAAA;gBACb,MAAM,GAAG,EAAE,CAAA;;oBAEI,qBAAM,YAAY,CAAC,KAAK,CAAC;oBACxC,KAAK,EAAE,mCAAiB;oBACxB,SAAS,EAAE;wBACT,MAAM,QAAA;wBACN,SAAS,WAAA;qBACV;iBACF,CAAC,EAAA;;gBANM,IAAI,GAAK,CAAA,SAMf,CAAA,KANU;gBAOZ,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,IAAI,CAAA;gBAEpC,QAAQ,GAAG,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;;;oBACpC,MAAM,KAAK,EAAE;;oBACtB,sBAAO,QAAQ,EAAA;;;KAChB,CAAA;AAnBY,QAAA,iBAAiB,qBAmB7B"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import { NextApiResponse } from 'next';
|
|
3
3
|
import { ParsedUrlQuery } from 'querystring';
|
|
4
|
-
|
|
4
|
+
import { Publisher } from '@newskit-render/api';
|
|
5
5
|
export declare type ImageBlock = {
|
|
6
6
|
url: string;
|
|
7
7
|
caption?: string;
|
|
@@ -24,7 +24,7 @@ export declare type Article = {
|
|
|
24
24
|
id: number;
|
|
25
25
|
headline: string;
|
|
26
26
|
publishedDateTime: string;
|
|
27
|
-
publisher:
|
|
27
|
+
publisher: Publisher;
|
|
28
28
|
body: ArticleBody[];
|
|
29
29
|
categories: Category[];
|
|
30
30
|
};
|
|
@@ -50,7 +50,7 @@ export interface StaticPageQueryResponse {
|
|
|
50
50
|
}
|
|
51
51
|
export declare type SitemapConfig = {
|
|
52
52
|
res: NextApiResponse;
|
|
53
|
-
publisher:
|
|
53
|
+
publisher: Publisher;
|
|
54
54
|
domain: string;
|
|
55
55
|
publicationName: string;
|
|
56
56
|
customStaticPageCollection?: CustomStaticPage[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/helpers/types.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/helpers/types.ts"],"names":[],"mappings":";;;AAcA,IAAY,UAGX;AAHD,WAAY,UAAU;IACpB,uCAAyB,CAAA;IACzB,2DAA6C,CAAA;AAC/C,CAAC,EAHW,UAAU,GAAV,kBAAU,KAAV,kBAAU,QAGrB"}
|
|
@@ -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"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,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,11 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.customStaticPageResponseMockWithUrl = exports.customStaticPageResponseMock = exports.pageSitemapResponseMock = exports.newsSitemapXmlMock = exports.generalSitemapXmlMock = exports.apolloClientPageResponseMock = exports.apolloClientResponseMock = exports.sitemapXmlMock = void 0;
|
|
4
|
+
var api_1 = require("@newskit-render/api");
|
|
4
5
|
exports.sitemapXmlMock = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<sitemapindex \n xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\" \n>\n <sitemap>\n <loc>https://virginradio.co.uk/sitemap.xml?channel=page-slug</loc>\n </sitemap>\n <sitemap>\n <loc>https://virginradio.co.uk/sitemap.xml?yyyy=2016&mm=04&dd=02</loc>\n </sitemap>\n <sitemap>\n <loc>https://virginradio.co.uk/sitemap.xml?yyyy=2016&mm=04&dd=01</loc>\n </sitemap>\n <sitemap>\n <loc>https://virginradio.co.uk/sitemap.xml?yyyy=2016&mm=03&dd=31</loc>\n </sitemap>\n</sitemapindex>\n";
|
|
5
6
|
exports.apolloClientResponseMock = [
|
|
6
7
|
{
|
|
7
8
|
id: 1,
|
|
8
|
-
publisher:
|
|
9
|
+
publisher: api_1.Publisher.VIRGIN,
|
|
9
10
|
headline: 'News Title 1',
|
|
10
11
|
publishedDateTime: '2021-05-30T08:18:39.000Z',
|
|
11
12
|
body: [
|
|
@@ -31,7 +32,7 @@ exports.apolloClientResponseMock = [
|
|
|
31
32
|
},
|
|
32
33
|
{
|
|
33
34
|
id: 2,
|
|
34
|
-
publisher:
|
|
35
|
+
publisher: api_1.Publisher.VIRGIN,
|
|
35
36
|
headline: 'News Title 2',
|
|
36
37
|
publishedDateTime: '2021-05-31T08:18:39.000Z',
|
|
37
38
|
body: [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mocks.js","sourceRoot":"","sources":["../../../../src/sitemap/__tests__/mocks.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"mocks.js","sourceRoot":"","sources":["../../../../src/sitemap/__tests__/mocks.ts"],"names":[],"mappings":";;;AAAA,2CAA+C;AAGlC,QAAA,cAAc,GAAG,4jBAiB7B,CAAA;AAEY,QAAA,wBAAwB,GAAc;IACjD;QACE,EAAE,EAAE,CAAC;QACL,SAAS,EAAE,eAAS,CAAC,MAAM;QAC3B,QAAQ,EAAE,cAAc;QACxB,iBAAiB,EAAE,0BAA0B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/utils';
|
|
2
2
|
import genericSitemap from './generic-sitemap-resolver';
|
|
3
3
|
import newsSitemap from './news-sitemap-resolver';
|
|
4
|
-
import {
|
|
5
|
-
export { sitemapXml, genericSitemap, newsSitemap,
|
|
4
|
+
import { CustomStaticPage } from '../helpers/types';
|
|
5
|
+
export { sitemapXml, genericSitemap, newsSitemap, CustomStaticPage };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/sitemap/index.ts"],"names":[],"mappings":";;;;;;AAAA,0CAA6C;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/sitemap/index.ts"],"names":[],"mappings":";;;;;;AAAA,0CAA6C;AAKpC,2FALA,kBAAU,OAKA;AAJnB,wFAAuD;AAIlC,yBAJd,kCAAc,CAIc;AAHnC,kFAAiD;AAGZ,sBAH9B,+BAAW,CAG8B"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { ApolloHttpClient } from '@newskit-render/api';
|
|
1
|
+
import { ApolloHttpClient, Publisher } from '@newskit-render/api';
|
|
2
2
|
import { DocumentNode } from 'graphql';
|
|
3
|
-
import { ArticleList
|
|
4
|
-
export declare const queryArticleList: (publisher:
|
|
3
|
+
import { ArticleList } from './types';
|
|
4
|
+
export declare const queryArticleList: (publisher: Publisher, dates: {
|
|
5
5
|
from: string;
|
|
6
6
|
to?: string | undefined;
|
|
7
7
|
}, apolloClient: ApolloHttpClient, articleQuery: DocumentNode) => Promise<ArticleList>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"queryArticleList.js","sourceRoot":"","sources":["../../../src/helpers/queryArticleList.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,MAAM,CAAC,IAAM,gBAAgB,GAAG,UAC9B,
|
|
1
|
+
{"version":3,"file":"queryArticleList.js","sourceRoot":"","sources":["../../../src/helpers/queryArticleList.tsx"],"names":[],"mappings":";;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e,CAAC,MAAM,CAAC,MAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAA;;oBAGjE,sBAAO,eAAe,EAAA;;;KACvB,CAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Channel,
|
|
2
|
-
import { ApolloHttpClient } from '@newskit-render/api';
|
|
3
|
-
export declare const queryPage: (publisher:
|
|
4
|
-
export declare const queryChannelsList: (publisher:
|
|
1
|
+
import { Channel, StaticPage } from './types';
|
|
2
|
+
import { ApolloHttpClient, Publisher } from '@newskit-render/api';
|
|
3
|
+
export declare const queryPage: (publisher: Publisher, channel: string, apolloClient: ApolloHttpClient) => Promise<Omit<StaticPage, 'url'>>;
|
|
4
|
+
export declare const queryChannelsList: (publisher: Publisher, apolloClient: ApolloHttpClient) => Promise<Channel[]>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"queryPage.js","sourceRoot":"","sources":["../../../src/helpers/queryPage.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAA;AACtE,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAA;
|
|
1
|
+
{"version":3,"file":"queryPage.js","sourceRoot":"","sources":["../../../src/helpers/queryPage.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAA;AACtE,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAA;AAIrD,MAAM,CAAC,IAAM,SAAS,GAAG,UACvB,SAAoB,EACpB,OAAe,EACf,YAA8B;;;;oBAEY,qBAAM,YAAY,CAAC,KAAK,CAAC;oBACjE,KAAK,EAAE,QAAQ;oBACf,SAAS,EAAE;wBACT,SAAS,EAAE,SAAS;wBACpB,OAAO,SAAA;qBACR;oBACD,WAAW,EAAE,KAAK;iBACnB,CAAC,EAAA;;gBAPM,IAAI,GAA8B,CAAA,SAOxC,CAAA,KAPU;gBAQZ,sBAAO,IAAI,CAAC,IAAI,EAAA;;;KACjB,CAAA;AAED,MAAM,CAAC,IAAM,iBAAiB,GAAG,UAC/B,SAAoB,EACpB,YAA8B;;;;;gBAE1B,QAAQ,GAAG,EAAE,CAAA;gBACb,MAAM,GAAG,EAAE,CAAA;;oBAEI,qBAAM,YAAY,CAAC,KAAK,CAAC;oBACxC,KAAK,EAAE,iBAAiB;oBACxB,SAAS,EAAE;wBACT,MAAM,QAAA;wBACN,SAAS,WAAA;qBACV;iBACF,CAAC,EAAA;;gBANM,IAAI,GAAK,CAAA,SAMf,CAAA,KANU;gBAOZ,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,IAAI,CAAA;gBAEpC,QAAQ,GAAG,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;;;oBACpC,MAAM,KAAK,EAAE;;oBACtB,sBAAO,QAAQ,EAAA;;;KAChB,CAAA"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import { NextApiResponse } from 'next';
|
|
3
3
|
import { ParsedUrlQuery } from 'querystring';
|
|
4
|
-
|
|
4
|
+
import { Publisher } from '@newskit-render/api';
|
|
5
5
|
export declare type ImageBlock = {
|
|
6
6
|
url: string;
|
|
7
7
|
caption?: string;
|
|
@@ -24,7 +24,7 @@ export declare type Article = {
|
|
|
24
24
|
id: number;
|
|
25
25
|
headline: string;
|
|
26
26
|
publishedDateTime: string;
|
|
27
|
-
publisher:
|
|
27
|
+
publisher: Publisher;
|
|
28
28
|
body: ArticleBody[];
|
|
29
29
|
categories: Category[];
|
|
30
30
|
};
|
|
@@ -50,7 +50,7 @@ export interface StaticPageQueryResponse {
|
|
|
50
50
|
}
|
|
51
51
|
export declare type SitemapConfig = {
|
|
52
52
|
res: NextApiResponse;
|
|
53
|
-
publisher:
|
|
53
|
+
publisher: Publisher;
|
|
54
54
|
domain: string;
|
|
55
55
|
publicationName: string;
|
|
56
56
|
customStaticPageCollection?: CustomStaticPage[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/helpers/types.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/helpers/types.ts"],"names":[],"mappings":"AAcA,MAAM,CAAN,IAAY,UAGX;AAHD,WAAY,UAAU;IACpB,uCAAyB,CAAA;IACzB,2DAA6C,CAAA;AAC/C,CAAC,EAHW,UAAU,KAAV,UAAU,QAGrB"}
|
|
@@ -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","sour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,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":""}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import { Publisher } from '@newskit-render/api';
|
|
1
2
|
export var sitemapXmlMock = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<sitemapindex \n xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\" \n>\n <sitemap>\n <loc>https://virginradio.co.uk/sitemap.xml?channel=page-slug</loc>\n </sitemap>\n <sitemap>\n <loc>https://virginradio.co.uk/sitemap.xml?yyyy=2016&mm=04&dd=02</loc>\n </sitemap>\n <sitemap>\n <loc>https://virginradio.co.uk/sitemap.xml?yyyy=2016&mm=04&dd=01</loc>\n </sitemap>\n <sitemap>\n <loc>https://virginradio.co.uk/sitemap.xml?yyyy=2016&mm=03&dd=31</loc>\n </sitemap>\n</sitemapindex>\n";
|
|
2
3
|
export var apolloClientResponseMock = [
|
|
3
4
|
{
|
|
4
5
|
id: 1,
|
|
5
|
-
publisher:
|
|
6
|
+
publisher: Publisher.VIRGIN,
|
|
6
7
|
headline: 'News Title 1',
|
|
7
8
|
publishedDateTime: '2021-05-30T08:18:39.000Z',
|
|
8
9
|
body: [
|
|
@@ -28,7 +29,7 @@ export var apolloClientResponseMock = [
|
|
|
28
29
|
},
|
|
29
30
|
{
|
|
30
31
|
id: 2,
|
|
31
|
-
publisher:
|
|
32
|
+
publisher: Publisher.VIRGIN,
|
|
32
33
|
headline: 'News Title 2',
|
|
33
34
|
publishedDateTime: '2021-05-31T08:18:39.000Z',
|
|
34
35
|
body: [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mocks.js","sourceRoot":"","sources":["../../../../src/sitemap/__tests__/mocks.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"mocks.js","sourceRoot":"","sources":["../../../../src/sitemap/__tests__/mocks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AAG/C,MAAM,CAAC,IAAM,cAAc,GAAG,4jBAiB7B,CAAA;AAED,MAAM,CAAC,IAAM,wBAAwB,GAAc;IACjD;QACE,EAAE,EAAE,CAAC;QACL,SAAS,EAAE,SAAS,CAAC,MAAM;QAC3B,QAAQ,EAAE,cAAc;QACxB,iBAAiB,EAAE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AAG,6UASlD,CAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { sitemapXml } from '../helpers/utils';
|
|
2
2
|
import genericSitemap from './generic-sitemap-resolver';
|
|
3
3
|
import newsSitemap from './news-sitemap-resolver';
|
|
4
|
-
import {
|
|
5
|
-
export { sitemapXml, genericSitemap, newsSitemap,
|
|
4
|
+
import { CustomStaticPage } from '../helpers/types';
|
|
5
|
+
export { sitemapXml, genericSitemap, newsSitemap, CustomStaticPage };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { sitemapXml } from '../helpers/utils';
|
|
2
2
|
import genericSitemap from './generic-sitemap-resolver';
|
|
3
3
|
import newsSitemap from './news-sitemap-resolver';
|
|
4
|
-
export { sitemapXml, genericSitemap, newsSitemap
|
|
4
|
+
export { sitemapXml, genericSitemap, newsSitemap };
|
|
5
5
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/sitemap/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAC7C,OAAO,cAAc,MAAM,4BAA4B,CAAA;AACvD,OAAO,WAAW,MAAM,yBAAyB,CAAA;AAGjD,OAAO,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/sitemap/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAC7C,OAAO,cAAc,MAAM,4BAA4B,CAAA;AACvD,OAAO,WAAW,MAAM,yBAAyB,CAAA;AAGjD,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,WAAW,EAAoB,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@newskit-render/feed",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.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.19.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",
|