fix(core): update

This commit is contained in:
Philipp Kunz 2020-10-28 17:43:58 +00:00
parent 35680b135d
commit d03b37690f
6 changed files with 97 additions and 43 deletions

51
package-lock.json generated
View File

@ -1435,7 +1435,6 @@
"version": "4.0.16",
"resolved": "https://verdaccio.lossless.one/@pushrocks%2fsmartenv/-/smartenv-4.0.16.tgz",
"integrity": "sha512-NwYMONDc/NjY6BGvzZzLMteF83kPQTF9BCGfqWbktUUruEtdqL+nGw6ecoLFi2b5u7XPb8jK1TKIcSvpNJ7SyA==",
"dev": true,
"requires": {
"@pushrocks/smartpromise": "^3.0.6",
"@types/node": "^14.11.2"
@ -2022,7 +2021,6 @@
"version": "3.2.9",
"resolved": "https://verdaccio.lossless.one/@pushrocks%2ftapbundle/-/tapbundle-3.2.9.tgz",
"integrity": "sha512-vtmYL/l7BZvAzySh7cYnnTG6CFMp5zYtowJuMAmqUjhIaQaWW1Tvbrpjp7lVwRXj2JlL/i69KcJ6RVdLItK+rA==",
"dev": true,
"requires": {
"@pushrocks/smartdelay": "^2.0.9",
"@pushrocks/smartenv": "^4.0.10",
@ -2129,6 +2127,22 @@
"defer-to-connect": "^1.0.1"
}
},
"@tsclass/tsclass": {
"version": "3.0.25",
"resolved": "https://verdaccio.lossless.one/@tsclass%2ftsclass/-/tsclass-3.0.25.tgz",
"integrity": "sha512-CGfjdltByZYXyV+6WFOhBELjXDoes37Ww4w35D3MlCxT7MAKoxJn+PnIZ7Add4rJcJwziLuftYVKwKnY+FRRgA==",
"requires": {
"@pushrocks/tapbundle": "^3.2.9",
"type-fest": "^0.16.0"
},
"dependencies": {
"type-fest": {
"version": "0.16.0",
"resolved": "https://verdaccio.lossless.one/type-fest/-/type-fest-0.16.0.tgz",
"integrity": "sha512-eaBzG6MxNzEn9kiwvtre90cXaNLkmadMWa1zQMs3XORCXNbsH/OewwbxC5ia9dCxIxnTAsSxXJaa/p5y8DlvJg=="
}
}
},
"@types/body-parser": {
"version": "1.19.0",
"resolved": "https://verdaccio.lossless.one/@types%2fbody-parser/-/body-parser-1.19.0.tgz",
@ -2148,14 +2162,12 @@
"@types/chai": {
"version": "4.2.14",
"resolved": "https://verdaccio.lossless.one/@types%2fchai/-/chai-4.2.14.tgz",
"integrity": "sha512-G+ITQPXkwTrslfG5L/BksmbLUA0M1iybEsmCWPqzSxsRRhJZimBKJkoMi8fr/CPygPTj4zO5pJH7I2/cm9M7SQ==",
"dev": true
"integrity": "sha512-G+ITQPXkwTrslfG5L/BksmbLUA0M1iybEsmCWPqzSxsRRhJZimBKJkoMi8fr/CPygPTj4zO5pJH7I2/cm9M7SQ=="
},
"@types/chai-as-promised": {
"version": "7.1.3",
"resolved": "https://verdaccio.lossless.one/@types%2fchai-as-promised/-/chai-as-promised-7.1.3.tgz",
"integrity": "sha512-FQnh1ohPXJELpKhzjuDkPLR2BZCAqed+a6xV4MI/T3XzHfd2FlarfUGUdZYgqYe8oxkYn0fchHEeHfHqdZ96sg==",
"dev": true,
"requires": {
"@types/chai": "*"
}
@ -2164,7 +2176,6 @@
"version": "1.4.2",
"resolved": "https://verdaccio.lossless.one/@types%2fchai-string/-/chai-string-1.4.2.tgz",
"integrity": "sha512-ld/1hV5qcPRGuwlPdvRfvM3Ka/iofOk2pH4VkasK4b1JJP1LjNmWWn0LsISf6RRzyhVOvs93rb9tM09e+UuF8Q==",
"dev": true,
"requires": {
"@types/chai": "*"
}
@ -2316,9 +2327,9 @@
"integrity": "sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA=="
},
"@types/node": {
"version": "14.14.3",
"resolved": "https://verdaccio.lossless.one/@types%2fnode/-/node-14.14.3.tgz",
"integrity": "sha512-33/L34xS7HVUx23e0wOT2V1qPF1IrHgQccdJVm9uXGTB9vFBrrzBtkQymT8VskeKOxjz55MSqMv0xuLq+u98WQ=="
"version": "14.14.5",
"resolved": "https://verdaccio.lossless.one/@types%2fnode/-/node-14.14.5.tgz",
"integrity": "sha512-H5Wn24s/ZOukBmDn03nnGTp18A60ny9AmCwnEcgJiTgSGsCO7k+NWP7zjCCbhlcnVCoI+co52dUAt9GMhOSULw=="
},
"@types/parcel-bundler": {
"version": "1.12.1",
@ -2698,8 +2709,7 @@
"assertion-error": {
"version": "1.1.0",
"resolved": "https://verdaccio.lossless.one/assertion-error/-/assertion-error-1.1.0.tgz",
"integrity": "sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==",
"dev": true
"integrity": "sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw=="
},
"assign-symbols": {
"version": "1.0.0",
@ -3355,7 +3365,6 @@
"version": "4.2.0",
"resolved": "https://verdaccio.lossless.one/chai/-/chai-4.2.0.tgz",
"integrity": "sha512-XQU3bhBukrOsQCuwZndwGcCVQHyZi53fQ6Ys1Fym7E4olpIqqZZhhoFJoaKVvV17lWQoXYwgWN2nF5crA8J2jw==",
"dev": true,
"requires": {
"assertion-error": "^1.1.0",
"check-error": "^1.0.2",
@ -3369,7 +3378,6 @@
"version": "7.1.1",
"resolved": "https://verdaccio.lossless.one/chai-as-promised/-/chai-as-promised-7.1.1.tgz",
"integrity": "sha512-azL6xMoi+uxu6z4rhWQ1jbdUhOMhis2PvscD/xjLqNMkv3BPPp2JyyuTHOrf9BOosGpNQ11v6BKv/g57RXbiaA==",
"dev": true,
"requires": {
"check-error": "^1.0.2"
}
@ -3377,8 +3385,7 @@
"chai-string": {
"version": "1.5.0",
"resolved": "https://verdaccio.lossless.one/chai-string/-/chai-string-1.5.0.tgz",
"integrity": "sha512-sydDC3S3pNAQMYwJrs6dQX0oBQ6KfIPuOZ78n7rocW0eJJlsHPh2t3kwW7xfwYA/1Bf6/arGtSUo16rxR2JFlw==",
"dev": true
"integrity": "sha512-sydDC3S3pNAQMYwJrs6dQX0oBQ6KfIPuOZ78n7rocW0eJJlsHPh2t3kwW7xfwYA/1Bf6/arGtSUo16rxR2JFlw=="
},
"chalk": {
"version": "2.4.2",
@ -3426,8 +3433,7 @@
"check-error": {
"version": "1.0.2",
"resolved": "https://verdaccio.lossless.one/check-error/-/check-error-1.0.2.tgz",
"integrity": "sha1-V00xLt2Iu13YkS6Sht1sCu1KrII=",
"dev": true
"integrity": "sha1-V00xLt2Iu13YkS6Sht1sCu1KrII="
},
"chokidar": {
"version": "2.1.8",
@ -4272,7 +4278,6 @@
"version": "3.0.1",
"resolved": "https://verdaccio.lossless.one/deep-eql/-/deep-eql-3.0.1.tgz",
"integrity": "sha512-+QeIQyN5ZuO+3Uk5DYh6/1eKO0m0YmJFGNmFHGACpf1ClL1nmlV/p4gNgbl2pJGxgXb4faqo6UE+M5ACEMyVcw==",
"dev": true,
"requires": {
"type-detect": "^4.0.0"
}
@ -5950,8 +5955,7 @@
"get-func-name": {
"version": "2.0.0",
"resolved": "https://verdaccio.lossless.one/get-func-name/-/get-func-name-2.0.0.tgz",
"integrity": "sha1-6td0q+5y4gQJQzoGY2YCPdaIekE=",
"dev": true
"integrity": "sha1-6td0q+5y4gQJQzoGY2YCPdaIekE="
},
"get-port": {
"version": "3.2.0",
@ -8114,8 +8118,7 @@
"pathval": {
"version": "1.1.0",
"resolved": "https://verdaccio.lossless.one/pathval/-/pathval-1.1.0.tgz",
"integrity": "sha1-uULm1L3mUwBe9rcTYd74cn0GReA=",
"dev": true
"integrity": "sha1-uULm1L3mUwBe9rcTYd74cn0GReA="
},
"pbkdf2": {
"version": "3.1.1",
@ -9699,7 +9702,6 @@
"version": "2.0.1",
"resolved": "https://verdaccio.lossless.one/smartchai/-/smartchai-2.0.1.tgz",
"integrity": "sha512-9M+R56OhAHXScxgr2vzQqxGx0XMS0QXriNZuP7hjlbVbo2FUT+l60iEzbwPt9Ga+5u2cEEjSSoZEQVqlROaddA==",
"dev": true,
"requires": {
"@types/chai": "^4.1.2",
"@types/chai-as-promised": "^7.1.0",
@ -10514,8 +10516,7 @@
"type-detect": {
"version": "4.0.8",
"resolved": "https://verdaccio.lossless.one/type-detect/-/type-detect-4.0.8.tgz",
"integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==",
"dev": true
"integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g=="
},
"type-fest": {
"version": "0.8.1",

View File

@ -16,7 +16,7 @@
"@gitzone/tsbundle": "^1.0.78",
"@gitzone/tstest": "^1.0.44",
"@pushrocks/tapbundle": "^3.2.9",
"@types/node": "^14.11.2",
"@types/node": "^14.14.5",
"tslint": "^6.1.3",
"tslint-config-prettier": "^1.15.0"
},
@ -24,7 +24,8 @@
"@pushrocks/smartcache": "^1.0.13",
"@pushrocks/smartfeed": "^1.0.5",
"@pushrocks/smartxml": "^1.0.6",
"@pushrocks/smartyaml": "^2.0.5"
"@pushrocks/smartyaml": "^2.0.5",
"@tsclass/tsclass": "^3.0.25"
},
"browserslist": [
"last 1 chrome versions"

View File

@ -1,3 +1,17 @@
export interface ISitemapYaml {
daily: string[];
}
export interface IRssItem {
[key: string]: any;
link?: string;
guid?: string;
title?: string;
pubDate?: string;
creator?: string;
content?: string;
isoDate?: string;
categories?: string[];
contentSnippet?: string;
enclosure?: any;
}

View File

@ -1,20 +1,33 @@
import * as plugins from './smartsitemap.plugins';
import * as interfaces from './interfaces';
export class SitemapNews {
public items: any[] = [];
public rssItems: interfaces.IRssItem[] = [];
constructor(optionsArg: {}) {}
public async readAndAddFromRssFeedString(feedStringArg: string) {
const smartfeedInstance = new plugins.smartfeed.Smartfeed();
const parsedFeed = await smartfeedInstance.parseFeedFromString(feedStringArg);
this.items = this.items.concat(parsedFeed.items);
this.rssItems = this.rssItems.concat(parsedFeed.items);
}
public async readAndAddFromRssFeedUrl(urlArg: string) {
const smartfeedInstance = new plugins.smartfeed.Smartfeed();
const parsedFeed = await smartfeedInstance.parseFeedFromUrl(urlArg);
this.items = this.items.concat(parsedFeed.items);
this.rssItems = this.rssItems.concat(parsedFeed.items);
}
public async readAndParseArticles(articleArrayArg: plugins.tsclass.content.IArticle[]) {
const rssItemArray = articleArrayArg.map((articleArg): interfaces.IRssItem => {
return {
title: articleArg.title,
content: articleArg.content,
isoDate: new Date(/* TODO: put article timestamp here */).toISOString()
};
});
this.rssItems = this.rssItems.concat(rssItemArray);
}
public exportSitemapXml() {
@ -25,24 +38,24 @@ export class SitemapNews {
'news:name': string;
'news:language': string;
};
"news:publication_date" : string;
"news:keywords": string;
"news:title": string;
'news:publication_date': string;
'news:keywords': string;
'news:title': string;
};
}[] = [];
for (const itemArg of this.items) {
for (const itemArg of this.rssItems) {
urls.push({
loc: itemArg.link,
"news:news": {
"news:publication": {
"news:language": 'en',
"news:name": 'some name'
'news:news': {
'news:publication': {
'news:language': 'en',
'news:name': 'some name',
},
"news:keywords": '',
"news:publication_date": itemArg.isoDate,
"news:title": itemArg.title
}
})
'news:keywords': '',
'news:publication_date': itemArg.isoDate,
'news:title': itemArg.title,
},
});
}
const sitemapObject: any = {
urlset: {

View File

@ -15,6 +15,24 @@ export class SmartSitemap {
return sitemapNewsInstance.exportSitemapXml();
}
/**
* creates a sitemap for news from feedxmlstring
*/
public async createSitemapNewsFromAFeedStringArg(feedStringArg: string): Promise<string> {
const sitemapNewsInstance = new SitemapNews({});
await sitemapNewsInstance.readAndAddFromRssFeedString(feedStringArg);
return sitemapNewsInstance.exportSitemapXml();
}
/**
* creates a sitemap for news from an array of articles
*/
public async createSitemapNewsFromArticleArray(articleArrayArg: plugins.tsclass.content.IArticle[]): Promise<string> {
const sitemapNewsInstance = new SitemapNews({});
await sitemapNewsInstance.readAndParseArticles(articleArrayArg);
return sitemapNewsInstance.exportSitemapXml();
}
/**
* creates a normal sitemap from a list of urls
*/

View File

@ -10,3 +10,10 @@ export {
smartxml,
smartyaml
};
// tsclass
import * as tsclass from '@tsclass/tsclass';
export {
tsclass
};