feedsmith 2.9.2 → 3.0.0-beta.2
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 +3 -9
- package/dist/common/config.cjs +2 -1
- package/dist/common/config.js +2 -1
- package/dist/common/errors.cjs +30 -0
- package/dist/common/errors.d.cts +15 -0
- package/dist/common/errors.d.ts +15 -0
- package/dist/common/errors.js +27 -0
- package/dist/common/parse.cjs +2 -1
- package/dist/common/parse.d.cts +10 -11
- package/dist/common/parse.d.ts +10 -11
- package/dist/common/parse.js +2 -1
- package/dist/common/types.d.cts +24 -12
- package/dist/common/types.d.ts +24 -12
- package/dist/common/utils.cjs +6 -14
- package/dist/common/utils.js +7 -13
- package/dist/feeds/atom/common/types.d.cts +65 -52
- package/dist/feeds/atom/common/types.d.ts +65 -52
- package/dist/feeds/atom/generate/index.cjs +2 -1
- package/dist/feeds/atom/generate/index.d.cts +2 -2
- package/dist/feeds/atom/generate/index.d.ts +2 -2
- package/dist/feeds/atom/generate/index.js +2 -1
- package/dist/feeds/atom/generate/utils.cjs +23 -6
- package/dist/feeds/atom/generate/utils.js +20 -3
- package/dist/feeds/atom/parse/index.cjs +10 -3
- package/dist/feeds/atom/parse/index.d.cts +2 -2
- package/dist/feeds/atom/parse/index.d.ts +2 -2
- package/dist/feeds/atom/parse/index.js +10 -3
- package/dist/feeds/atom/parse/utils.cjs +61 -31
- package/dist/feeds/atom/parse/utils.js +59 -29
- package/dist/feeds/json/common/types.d.cts +19 -19
- package/dist/feeds/json/common/types.d.ts +19 -19
- package/dist/feeds/json/generate/index.cjs +5 -1
- package/dist/feeds/json/generate/index.d.cts +2 -2
- package/dist/feeds/json/generate/index.d.ts +2 -2
- package/dist/feeds/json/generate/index.js +5 -1
- package/dist/feeds/json/generate/utils.cjs +7 -2
- package/dist/feeds/json/generate/utils.js +8 -3
- package/dist/feeds/json/parse/index.cjs +3 -2
- package/dist/feeds/json/parse/index.d.cts +2 -2
- package/dist/feeds/json/parse/index.d.ts +2 -2
- package/dist/feeds/json/parse/index.js +3 -2
- package/dist/feeds/json/parse/utils.cjs +4 -4
- package/dist/feeds/json/parse/utils.js +4 -4
- package/dist/feeds/rdf/common/types.d.cts +31 -28
- package/dist/feeds/rdf/common/types.d.ts +31 -28
- package/dist/feeds/rdf/parse/index.cjs +10 -3
- package/dist/feeds/rdf/parse/index.d.cts +2 -2
- package/dist/feeds/rdf/parse/index.d.ts +2 -2
- package/dist/feeds/rdf/parse/index.js +10 -3
- package/dist/feeds/rdf/parse/utils.cjs +23 -20
- package/dist/feeds/rdf/parse/utils.js +15 -12
- package/dist/feeds/rss/common/types.d.cts +76 -74
- package/dist/feeds/rss/common/types.d.ts +76 -74
- package/dist/feeds/rss/generate/index.cjs +2 -1
- package/dist/feeds/rss/generate/index.d.cts +2 -2
- package/dist/feeds/rss/generate/index.d.ts +2 -2
- package/dist/feeds/rss/generate/index.js +2 -1
- package/dist/feeds/rss/generate/utils.cjs +36 -36
- package/dist/feeds/rss/generate/utils.js +10 -10
- package/dist/feeds/rss/parse/index.cjs +10 -3
- package/dist/feeds/rss/parse/index.d.cts +2 -2
- package/dist/feeds/rss/parse/index.d.ts +2 -2
- package/dist/feeds/rss/parse/index.js +10 -3
- package/dist/feeds/rss/parse/utils.cjs +138 -38
- package/dist/feeds/rss/parse/utils.js +119 -19
- package/dist/index.cjs +5 -0
- package/dist/index.d.cts +37 -16
- package/dist/index.d.ts +37 -16
- package/dist/index.js +2 -1
- package/dist/namespaces/app/common/types.d.cts +1 -3
- package/dist/namespaces/app/common/types.d.ts +1 -3
- package/dist/namespaces/app/parse/utils.cjs +2 -2
- package/dist/namespaces/app/parse/utils.js +2 -2
- package/dist/namespaces/atom/common/types.d.cts +3 -3
- package/dist/namespaces/atom/common/types.d.ts +3 -3
- package/dist/namespaces/atom/parse/utils.cjs +4 -2
- package/dist/namespaces/atom/parse/utils.js +4 -2
- package/dist/namespaces/dc/common/types.d.cts +4 -19
- package/dist/namespaces/dc/common/types.d.ts +4 -19
- package/dist/namespaces/dc/generate/utils.cjs +15 -15
- package/dist/namespaces/dc/generate/utils.js +16 -16
- package/dist/namespaces/dc/parse/utils.cjs +4 -17
- package/dist/namespaces/dc/parse/utils.js +5 -18
- package/dist/namespaces/dcterms/common/types.d.cts +23 -59
- package/dist/namespaces/dcterms/common/types.d.ts +23 -59
- package/dist/namespaces/dcterms/generate/utils.cjs +55 -55
- package/dist/namespaces/dcterms/generate/utils.js +56 -56
- package/dist/namespaces/dcterms/parse/utils.cjs +23 -57
- package/dist/namespaces/dcterms/parse/utils.js +24 -58
- package/dist/namespaces/georss/common/types.d.cts +21 -19
- package/dist/namespaces/georss/common/types.d.ts +21 -19
- package/dist/namespaces/georss/generate/utils.cjs +2 -2
- package/dist/namespaces/georss/generate/utils.js +2 -2
- package/dist/namespaces/googleplay/common/types.d.cts +9 -7
- package/dist/namespaces/googleplay/common/types.d.ts +9 -7
- package/dist/namespaces/itunes/common/types.d.cts +9 -5
- package/dist/namespaces/itunes/common/types.d.ts +9 -5
- package/dist/namespaces/media/common/types.d.cts +85 -84
- package/dist/namespaces/media/common/types.d.ts +85 -84
- package/dist/namespaces/media/generate/utils.cjs +1 -1
- package/dist/namespaces/media/generate/utils.js +2 -2
- package/dist/namespaces/media/parse/utils.cjs +1 -2
- package/dist/namespaces/media/parse/utils.js +1 -2
- package/dist/namespaces/opensearch/common/types.d.cts +7 -5
- package/dist/namespaces/opensearch/common/types.d.ts +7 -5
- package/dist/namespaces/podcast/common/types.d.cts +136 -142
- package/dist/namespaces/podcast/common/types.d.ts +136 -142
- package/dist/namespaces/podcast/generate/utils.cjs +6 -6
- package/dist/namespaces/podcast/generate/utils.js +7 -7
- package/dist/namespaces/podcast/parse/utils.cjs +13 -19
- package/dist/namespaces/podcast/parse/utils.js +13 -19
- package/dist/namespaces/prism/common/types.d.cts +2 -4
- package/dist/namespaces/prism/common/types.d.ts +2 -4
- package/dist/namespaces/prism/parse/utils.cjs +19 -19
- package/dist/namespaces/prism/parse/utils.js +19 -19
- package/dist/namespaces/psc/common/types.d.cts +8 -6
- package/dist/namespaces/psc/common/types.d.ts +8 -6
- package/dist/namespaces/rawvoice/common/types.d.cts +24 -24
- package/dist/namespaces/rawvoice/common/types.d.ts +24 -24
- package/dist/namespaces/rawvoice/parse/utils.cjs +7 -7
- package/dist/namespaces/rawvoice/parse/utils.js +7 -7
- package/dist/namespaces/source/common/types.d.cts +20 -18
- package/dist/namespaces/source/common/types.d.ts +20 -18
- package/dist/namespaces/spotify/common/types.d.cts +22 -20
- package/dist/namespaces/spotify/common/types.d.ts +22 -20
- package/dist/namespaces/sy/common/types.d.cts +1 -3
- package/dist/namespaces/sy/common/types.d.ts +1 -3
- package/dist/namespaces/sy/parse/utils.cjs +2 -2
- package/dist/namespaces/sy/parse/utils.js +2 -2
- package/dist/namespaces/thr/common/types.d.cts +7 -7
- package/dist/namespaces/thr/common/types.d.ts +7 -7
- package/dist/namespaces/thr/parse/utils.cjs +2 -2
- package/dist/namespaces/thr/parse/utils.js +2 -2
- package/dist/namespaces/xml/common/types.d.cts +11 -0
- package/dist/namespaces/xml/common/types.d.ts +11 -0
- package/dist/namespaces/xml/generate/utils.cjs +13 -0
- package/dist/namespaces/xml/generate/utils.js +13 -0
- package/dist/namespaces/xml/parse/utils.cjs +13 -0
- package/dist/namespaces/xml/parse/utils.js +13 -0
- package/dist/opml/common/types.d.cts +18 -13
- package/dist/opml/common/types.d.ts +18 -13
- package/dist/opml/generate/index.cjs +2 -1
- package/dist/opml/generate/index.d.cts +3 -3
- package/dist/opml/generate/index.d.ts +3 -3
- package/dist/opml/generate/index.js +2 -1
- package/dist/opml/parse/index.cjs +9 -2
- package/dist/opml/parse/index.d.cts +2 -3
- package/dist/opml/parse/index.d.ts +2 -3
- package/dist/opml/parse/index.js +9 -2
- package/dist/opml/parse/utils.cjs +5 -5
- package/dist/opml/parse/utils.js +5 -5
- package/package.json +2 -19
- package/dist/types.cjs +0 -0
- package/dist/types.d.cts +0 -7
- package/dist/types.d.ts +0 -7
- package/dist/types.js +0 -1
|
@@ -16,11 +16,11 @@ const generatePoint = (point) => {
|
|
|
16
16
|
});
|
|
17
17
|
};
|
|
18
18
|
const generateLine = (line) => {
|
|
19
|
-
if (!require_utils.isObject(line)) return;
|
|
19
|
+
if (!require_utils.isObject(line) || !line.points) return;
|
|
20
20
|
return generateLatLngPairs(line.points, { min: 2 });
|
|
21
21
|
};
|
|
22
22
|
const generatePolygon = (polygon) => {
|
|
23
|
-
if (!require_utils.isObject(polygon)) return;
|
|
23
|
+
if (!require_utils.isObject(polygon) || !polygon.points) return;
|
|
24
24
|
return generateLatLngPairs(polygon.points, { min: 4 });
|
|
25
25
|
};
|
|
26
26
|
const generateBox = (box) => {
|
|
@@ -16,11 +16,11 @@ const generatePoint = (point) => {
|
|
|
16
16
|
});
|
|
17
17
|
};
|
|
18
18
|
const generateLine = (line) => {
|
|
19
|
-
if (!isObject(line)) return;
|
|
19
|
+
if (!isObject(line) || !line.points) return;
|
|
20
20
|
return generateLatLngPairs(line.points, { min: 2 });
|
|
21
21
|
};
|
|
22
22
|
const generatePolygon = (polygon) => {
|
|
23
|
-
if (!isObject(polygon)) return;
|
|
23
|
+
if (!isObject(polygon) || !polygon.points) return;
|
|
24
24
|
return generateLatLngPairs(polygon.points, { min: 4 });
|
|
25
25
|
};
|
|
26
26
|
const generateBox = (box) => {
|
|
@@ -1,21 +1,23 @@
|
|
|
1
|
+
import { Requirable, Strict } from "../../../common/types.cjs";
|
|
2
|
+
|
|
1
3
|
//#region src/namespaces/googleplay/common/types.d.ts
|
|
2
4
|
declare namespace GooglePlayNs {
|
|
3
|
-
type Image = {
|
|
4
|
-
href: string
|
|
5
|
-
}
|
|
6
|
-
type Item = {
|
|
5
|
+
type Image<TStrict extends boolean = false> = Strict<{
|
|
6
|
+
href: Requirable<string>;
|
|
7
|
+
}, TStrict>;
|
|
8
|
+
type Item<TStrict extends boolean = false> = {
|
|
7
9
|
author?: string;
|
|
8
10
|
description?: string;
|
|
9
11
|
explicit?: boolean | 'clean';
|
|
10
12
|
block?: boolean;
|
|
11
|
-
image?: Image
|
|
13
|
+
image?: Image<TStrict>;
|
|
12
14
|
};
|
|
13
|
-
type Feed = {
|
|
15
|
+
type Feed<TStrict extends boolean = false> = {
|
|
14
16
|
author?: string;
|
|
15
17
|
description?: string;
|
|
16
18
|
explicit?: boolean | 'clean';
|
|
17
19
|
block?: boolean;
|
|
18
|
-
image?: Image
|
|
20
|
+
image?: Image<TStrict>;
|
|
19
21
|
newFeedUrl?: string;
|
|
20
22
|
email?: string;
|
|
21
23
|
categories?: Array<string>;
|
|
@@ -1,21 +1,23 @@
|
|
|
1
|
+
import { Requirable, Strict } from "../../../common/types.js";
|
|
2
|
+
|
|
1
3
|
//#region src/namespaces/googleplay/common/types.d.ts
|
|
2
4
|
declare namespace GooglePlayNs {
|
|
3
|
-
type Image = {
|
|
4
|
-
href: string
|
|
5
|
-
}
|
|
6
|
-
type Item = {
|
|
5
|
+
type Image<TStrict extends boolean = false> = Strict<{
|
|
6
|
+
href: Requirable<string>;
|
|
7
|
+
}, TStrict>;
|
|
8
|
+
type Item<TStrict extends boolean = false> = {
|
|
7
9
|
author?: string;
|
|
8
10
|
description?: string;
|
|
9
11
|
explicit?: boolean | 'clean';
|
|
10
12
|
block?: boolean;
|
|
11
|
-
image?: Image
|
|
13
|
+
image?: Image<TStrict>;
|
|
12
14
|
};
|
|
13
|
-
type Feed = {
|
|
15
|
+
type Feed<TStrict extends boolean = false> = {
|
|
14
16
|
author?: string;
|
|
15
17
|
description?: string;
|
|
16
18
|
explicit?: boolean | 'clean';
|
|
17
19
|
block?: boolean;
|
|
18
|
-
image?: Image
|
|
20
|
+
image?: Image<TStrict>;
|
|
19
21
|
newFeedUrl?: string;
|
|
20
22
|
email?: string;
|
|
21
23
|
categories?: Array<string>;
|
|
@@ -1,8 +1,12 @@
|
|
|
1
|
+
import { Requirable, Strict } from "../../../common/types.cjs";
|
|
2
|
+
|
|
1
3
|
//#region src/namespaces/itunes/common/types.d.ts
|
|
2
4
|
declare namespace ItunesNs {
|
|
3
|
-
type
|
|
4
|
-
text: string
|
|
5
|
-
|
|
5
|
+
type BaseCategory<TStrict extends boolean = false> = Strict<{
|
|
6
|
+
text: Requirable<string>;
|
|
7
|
+
}, TStrict>;
|
|
8
|
+
type Category<TStrict extends boolean = false> = BaseCategory<TStrict> & {
|
|
9
|
+
categories?: Array<Category<TStrict>>;
|
|
6
10
|
};
|
|
7
11
|
type Owner = {
|
|
8
12
|
name?: string;
|
|
@@ -22,9 +26,9 @@ declare namespace ItunesNs {
|
|
|
22
26
|
subtitle?: string; /** @deprecated No longer used for search in Apple Podcasts. */
|
|
23
27
|
keywords?: Array<string>;
|
|
24
28
|
};
|
|
25
|
-
type Feed = {
|
|
29
|
+
type Feed<TStrict extends boolean = false> = {
|
|
26
30
|
image?: string;
|
|
27
|
-
categories?: Array<Category
|
|
31
|
+
categories?: Array<Category<TStrict>>;
|
|
28
32
|
explicit?: boolean;
|
|
29
33
|
author?: string;
|
|
30
34
|
title?: string;
|
|
@@ -1,8 +1,12 @@
|
|
|
1
|
+
import { Requirable, Strict } from "../../../common/types.js";
|
|
2
|
+
|
|
1
3
|
//#region src/namespaces/itunes/common/types.d.ts
|
|
2
4
|
declare namespace ItunesNs {
|
|
3
|
-
type
|
|
4
|
-
text: string
|
|
5
|
-
|
|
5
|
+
type BaseCategory<TStrict extends boolean = false> = Strict<{
|
|
6
|
+
text: Requirable<string>;
|
|
7
|
+
}, TStrict>;
|
|
8
|
+
type Category<TStrict extends boolean = false> = BaseCategory<TStrict> & {
|
|
9
|
+
categories?: Array<Category<TStrict>>;
|
|
6
10
|
};
|
|
7
11
|
type Owner = {
|
|
8
12
|
name?: string;
|
|
@@ -22,9 +26,9 @@ declare namespace ItunesNs {
|
|
|
22
26
|
subtitle?: string; /** @deprecated No longer used for search in Apple Podcasts. */
|
|
23
27
|
keywords?: Array<string>;
|
|
24
28
|
};
|
|
25
|
-
type Feed = {
|
|
29
|
+
type Feed<TStrict extends boolean = false> = {
|
|
26
30
|
image?: string;
|
|
27
|
-
categories?: Array<Category
|
|
31
|
+
categories?: Array<Category<TStrict>>;
|
|
28
32
|
explicit?: boolean;
|
|
29
33
|
author?: string;
|
|
30
34
|
title?: string;
|
|
@@ -1,58 +1,60 @@
|
|
|
1
|
+
import { Requirable, Strict } from "../../../common/types.cjs";
|
|
2
|
+
|
|
1
3
|
//#region src/namespaces/media/common/types.d.ts
|
|
2
4
|
declare namespace MediaNs {
|
|
3
|
-
type Rating = {
|
|
4
|
-
value: string
|
|
5
|
+
type Rating<TStrict extends boolean = false> = Strict<{
|
|
6
|
+
value: Requirable<string>;
|
|
5
7
|
scheme?: string;
|
|
6
|
-
}
|
|
7
|
-
type TitleOrDescription = {
|
|
8
|
-
value: string
|
|
8
|
+
}, TStrict>;
|
|
9
|
+
type TitleOrDescription<TStrict extends boolean = false> = Strict<{
|
|
10
|
+
value: Requirable<string>;
|
|
9
11
|
type?: string;
|
|
10
|
-
}
|
|
11
|
-
type Thumbnail = {
|
|
12
|
-
url: string
|
|
12
|
+
}, TStrict>;
|
|
13
|
+
type Thumbnail<TStrict extends boolean = false> = Strict<{
|
|
14
|
+
url: Requirable<string>;
|
|
13
15
|
height?: number;
|
|
14
16
|
width?: number;
|
|
15
17
|
time?: string;
|
|
16
|
-
}
|
|
17
|
-
type Category = {
|
|
18
|
-
name: string
|
|
18
|
+
}, TStrict>;
|
|
19
|
+
type Category<TStrict extends boolean = false> = Strict<{
|
|
20
|
+
name: Requirable<string>;
|
|
19
21
|
scheme?: string;
|
|
20
22
|
label?: string;
|
|
21
|
-
}
|
|
22
|
-
type Hash = {
|
|
23
|
-
value: string
|
|
23
|
+
}, TStrict>;
|
|
24
|
+
type Hash<TStrict extends boolean = false> = Strict<{
|
|
25
|
+
value: Requirable<string>;
|
|
24
26
|
algo?: string;
|
|
25
|
-
}
|
|
26
|
-
type Player = {
|
|
27
|
-
url: string
|
|
27
|
+
}, TStrict>;
|
|
28
|
+
type Player<TStrict extends boolean = false> = Strict<{
|
|
29
|
+
url: Requirable<string>;
|
|
28
30
|
height?: number;
|
|
29
31
|
width?: number;
|
|
30
|
-
}
|
|
31
|
-
type Credit = {
|
|
32
|
-
value: string
|
|
32
|
+
}, TStrict>;
|
|
33
|
+
type Credit<TStrict extends boolean = false> = Strict<{
|
|
34
|
+
value: Requirable<string>;
|
|
33
35
|
role?: string;
|
|
34
36
|
scheme?: string;
|
|
35
|
-
}
|
|
36
|
-
type Copyright = {
|
|
37
|
-
value: string
|
|
37
|
+
}, TStrict>;
|
|
38
|
+
type Copyright<TStrict extends boolean = false> = Strict<{
|
|
39
|
+
value: Requirable<string>;
|
|
38
40
|
url?: string;
|
|
39
|
-
}
|
|
40
|
-
type Text = {
|
|
41
|
-
value: string
|
|
41
|
+
}, TStrict>;
|
|
42
|
+
type Text<TStrict extends boolean = false> = Strict<{
|
|
43
|
+
value: Requirable<string>;
|
|
42
44
|
type?: string;
|
|
43
45
|
lang?: string;
|
|
44
46
|
start?: string;
|
|
45
47
|
end?: string;
|
|
46
|
-
}
|
|
47
|
-
type Restriction = {
|
|
48
|
-
value: string
|
|
49
|
-
relationship: string
|
|
48
|
+
}, TStrict>;
|
|
49
|
+
type Restriction<TStrict extends boolean = false> = Strict<{
|
|
50
|
+
value: Requirable<string>;
|
|
51
|
+
relationship: Requirable<string>;
|
|
50
52
|
type?: string;
|
|
51
|
-
}
|
|
52
|
-
type Community = {
|
|
53
|
+
}, TStrict>;
|
|
54
|
+
type Community<TStrict extends boolean = false> = {
|
|
53
55
|
starRating?: StarRating;
|
|
54
56
|
statistics?: Statistics;
|
|
55
|
-
tags?: Array<Tag
|
|
57
|
+
tags?: Array<Tag<TStrict>>;
|
|
56
58
|
};
|
|
57
59
|
type StarRating = {
|
|
58
60
|
average?: number;
|
|
@@ -64,48 +66,48 @@ declare namespace MediaNs {
|
|
|
64
66
|
views?: number;
|
|
65
67
|
favorites?: number;
|
|
66
68
|
};
|
|
67
|
-
type Tag = {
|
|
68
|
-
name: string
|
|
69
|
+
type Tag<TStrict extends boolean = false> = Strict<{
|
|
70
|
+
name: Requirable<string>;
|
|
69
71
|
weight?: number;
|
|
70
|
-
}
|
|
71
|
-
type Embed = {
|
|
72
|
-
url: string
|
|
72
|
+
}, TStrict>;
|
|
73
|
+
type Embed<TStrict extends boolean = false> = Strict<{
|
|
74
|
+
url: Requirable<string>;
|
|
73
75
|
width?: number;
|
|
74
76
|
height?: number;
|
|
75
|
-
params?: Array<Param
|
|
76
|
-
}
|
|
77
|
-
type Param = {
|
|
78
|
-
name: string
|
|
79
|
-
value: string
|
|
80
|
-
}
|
|
81
|
-
type Status = {
|
|
82
|
-
state: string
|
|
77
|
+
params?: Array<Param<TStrict>>;
|
|
78
|
+
}, TStrict>;
|
|
79
|
+
type Param<TStrict extends boolean = false> = Strict<{
|
|
80
|
+
name: Requirable<string>;
|
|
81
|
+
value: Requirable<string>;
|
|
82
|
+
}, TStrict>;
|
|
83
|
+
type Status<TStrict extends boolean = false> = Strict<{
|
|
84
|
+
state: Requirable<string>;
|
|
83
85
|
reason?: string;
|
|
84
|
-
}
|
|
86
|
+
}, TStrict>;
|
|
85
87
|
type Price = {
|
|
86
88
|
type?: string;
|
|
87
89
|
info?: string;
|
|
88
90
|
price?: number;
|
|
89
91
|
currency?: string;
|
|
90
92
|
};
|
|
91
|
-
type License = {
|
|
93
|
+
type License<TStrict extends boolean = false> = {
|
|
92
94
|
name?: string;
|
|
93
95
|
type?: string;
|
|
94
96
|
href?: string;
|
|
95
|
-
} & ({
|
|
97
|
+
} & (TStrict extends true ? {
|
|
96
98
|
name: string;
|
|
97
99
|
} | {
|
|
98
100
|
href: string;
|
|
99
|
-
});
|
|
100
|
-
type SubTitle = {
|
|
101
|
+
} : unknown);
|
|
102
|
+
type SubTitle<TStrict extends boolean = false> = Strict<{
|
|
101
103
|
type?: string;
|
|
102
104
|
lang?: string;
|
|
103
|
-
href: string
|
|
104
|
-
}
|
|
105
|
-
type PeerLink = {
|
|
105
|
+
href: Requirable<string>;
|
|
106
|
+
}, TStrict>;
|
|
107
|
+
type PeerLink<TStrict extends boolean = false> = Strict<{
|
|
106
108
|
type?: string;
|
|
107
|
-
href: string
|
|
108
|
-
}
|
|
109
|
+
href: Requirable<string>;
|
|
110
|
+
}, TStrict>;
|
|
109
111
|
type Rights = {
|
|
110
112
|
status?: string;
|
|
111
113
|
};
|
|
@@ -123,34 +125,34 @@ declare namespace MediaNs {
|
|
|
123
125
|
lng?: number;
|
|
124
126
|
};
|
|
125
127
|
/** @internal Shared elements available across Content, Group, ItemOrFeed types. */
|
|
126
|
-
type CommonElements = {
|
|
127
|
-
ratings?: Array<Rating
|
|
128
|
-
title?: TitleOrDescription
|
|
129
|
-
description?: TitleOrDescription
|
|
128
|
+
type CommonElements<TStrict extends boolean = false> = {
|
|
129
|
+
ratings?: Array<Rating<TStrict>>;
|
|
130
|
+
title?: TitleOrDescription<TStrict>;
|
|
131
|
+
description?: TitleOrDescription<TStrict>;
|
|
130
132
|
keywords?: Array<string>;
|
|
131
|
-
thumbnails?: Array<Thumbnail
|
|
132
|
-
categories?: Array<Category
|
|
133
|
-
hashes?: Array<Hash
|
|
134
|
-
player?: Player
|
|
135
|
-
credits?: Array<Credit
|
|
136
|
-
copyright?: Copyright
|
|
137
|
-
texts?: Array<Text
|
|
138
|
-
restrictions?: Array<Restriction
|
|
139
|
-
community?: Community
|
|
133
|
+
thumbnails?: Array<Thumbnail<TStrict>>;
|
|
134
|
+
categories?: Array<Category<TStrict>>;
|
|
135
|
+
hashes?: Array<Hash<TStrict>>;
|
|
136
|
+
player?: Player<TStrict>;
|
|
137
|
+
credits?: Array<Credit<TStrict>>;
|
|
138
|
+
copyright?: Copyright<TStrict>;
|
|
139
|
+
texts?: Array<Text<TStrict>>;
|
|
140
|
+
restrictions?: Array<Restriction<TStrict>>;
|
|
141
|
+
community?: Community<TStrict>;
|
|
140
142
|
comments?: Array<string>;
|
|
141
|
-
embed?: Embed
|
|
143
|
+
embed?: Embed<TStrict>;
|
|
142
144
|
responses?: Array<string>;
|
|
143
145
|
backLinks?: Array<string>;
|
|
144
|
-
status?: Status
|
|
146
|
+
status?: Status<TStrict>;
|
|
145
147
|
prices?: Array<Price>;
|
|
146
|
-
licenses?: Array<License
|
|
147
|
-
subTitles?: Array<SubTitle
|
|
148
|
-
peerLinks?: Array<PeerLink
|
|
148
|
+
licenses?: Array<License<TStrict>>;
|
|
149
|
+
subTitles?: Array<SubTitle<TStrict>>;
|
|
150
|
+
peerLinks?: Array<PeerLink<TStrict>>;
|
|
149
151
|
locations?: Array<Location>;
|
|
150
152
|
rights?: Rights;
|
|
151
153
|
scenes?: Array<Scene>;
|
|
152
154
|
};
|
|
153
|
-
type Content = {
|
|
155
|
+
type Content<TStrict extends boolean = false> = {
|
|
154
156
|
url?: string;
|
|
155
157
|
fileSize?: number;
|
|
156
158
|
type?: string;
|
|
@@ -165,15 +167,14 @@ declare namespace MediaNs {
|
|
|
165
167
|
height?: number;
|
|
166
168
|
width?: number;
|
|
167
169
|
lang?: string;
|
|
168
|
-
} & CommonElements
|
|
169
|
-
type Group = {
|
|
170
|
-
contents?: Array<Content
|
|
171
|
-
} & CommonElements
|
|
172
|
-
type ItemOrFeed = {
|
|
173
|
-
groups?: Array<Group
|
|
174
|
-
contents?: Array<Content
|
|
175
|
-
|
|
176
|
-
} & CommonElements;
|
|
170
|
+
} & CommonElements<TStrict>;
|
|
171
|
+
type Group<TStrict extends boolean = false> = {
|
|
172
|
+
contents?: Array<Content<TStrict>>;
|
|
173
|
+
} & CommonElements<TStrict>;
|
|
174
|
+
type ItemOrFeed<TStrict extends boolean = false> = {
|
|
175
|
+
groups?: Array<Group<TStrict>>;
|
|
176
|
+
contents?: Array<Content<TStrict>>;
|
|
177
|
+
} & CommonElements<TStrict>;
|
|
177
178
|
}
|
|
178
179
|
//#endregion
|
|
179
180
|
export { MediaNs };
|
|
@@ -1,58 +1,60 @@
|
|
|
1
|
+
import { Requirable, Strict } from "../../../common/types.js";
|
|
2
|
+
|
|
1
3
|
//#region src/namespaces/media/common/types.d.ts
|
|
2
4
|
declare namespace MediaNs {
|
|
3
|
-
type Rating = {
|
|
4
|
-
value: string
|
|
5
|
+
type Rating<TStrict extends boolean = false> = Strict<{
|
|
6
|
+
value: Requirable<string>;
|
|
5
7
|
scheme?: string;
|
|
6
|
-
}
|
|
7
|
-
type TitleOrDescription = {
|
|
8
|
-
value: string
|
|
8
|
+
}, TStrict>;
|
|
9
|
+
type TitleOrDescription<TStrict extends boolean = false> = Strict<{
|
|
10
|
+
value: Requirable<string>;
|
|
9
11
|
type?: string;
|
|
10
|
-
}
|
|
11
|
-
type Thumbnail = {
|
|
12
|
-
url: string
|
|
12
|
+
}, TStrict>;
|
|
13
|
+
type Thumbnail<TStrict extends boolean = false> = Strict<{
|
|
14
|
+
url: Requirable<string>;
|
|
13
15
|
height?: number;
|
|
14
16
|
width?: number;
|
|
15
17
|
time?: string;
|
|
16
|
-
}
|
|
17
|
-
type Category = {
|
|
18
|
-
name: string
|
|
18
|
+
}, TStrict>;
|
|
19
|
+
type Category<TStrict extends boolean = false> = Strict<{
|
|
20
|
+
name: Requirable<string>;
|
|
19
21
|
scheme?: string;
|
|
20
22
|
label?: string;
|
|
21
|
-
}
|
|
22
|
-
type Hash = {
|
|
23
|
-
value: string
|
|
23
|
+
}, TStrict>;
|
|
24
|
+
type Hash<TStrict extends boolean = false> = Strict<{
|
|
25
|
+
value: Requirable<string>;
|
|
24
26
|
algo?: string;
|
|
25
|
-
}
|
|
26
|
-
type Player = {
|
|
27
|
-
url: string
|
|
27
|
+
}, TStrict>;
|
|
28
|
+
type Player<TStrict extends boolean = false> = Strict<{
|
|
29
|
+
url: Requirable<string>;
|
|
28
30
|
height?: number;
|
|
29
31
|
width?: number;
|
|
30
|
-
}
|
|
31
|
-
type Credit = {
|
|
32
|
-
value: string
|
|
32
|
+
}, TStrict>;
|
|
33
|
+
type Credit<TStrict extends boolean = false> = Strict<{
|
|
34
|
+
value: Requirable<string>;
|
|
33
35
|
role?: string;
|
|
34
36
|
scheme?: string;
|
|
35
|
-
}
|
|
36
|
-
type Copyright = {
|
|
37
|
-
value: string
|
|
37
|
+
}, TStrict>;
|
|
38
|
+
type Copyright<TStrict extends boolean = false> = Strict<{
|
|
39
|
+
value: Requirable<string>;
|
|
38
40
|
url?: string;
|
|
39
|
-
}
|
|
40
|
-
type Text = {
|
|
41
|
-
value: string
|
|
41
|
+
}, TStrict>;
|
|
42
|
+
type Text<TStrict extends boolean = false> = Strict<{
|
|
43
|
+
value: Requirable<string>;
|
|
42
44
|
type?: string;
|
|
43
45
|
lang?: string;
|
|
44
46
|
start?: string;
|
|
45
47
|
end?: string;
|
|
46
|
-
}
|
|
47
|
-
type Restriction = {
|
|
48
|
-
value: string
|
|
49
|
-
relationship: string
|
|
48
|
+
}, TStrict>;
|
|
49
|
+
type Restriction<TStrict extends boolean = false> = Strict<{
|
|
50
|
+
value: Requirable<string>;
|
|
51
|
+
relationship: Requirable<string>;
|
|
50
52
|
type?: string;
|
|
51
|
-
}
|
|
52
|
-
type Community = {
|
|
53
|
+
}, TStrict>;
|
|
54
|
+
type Community<TStrict extends boolean = false> = {
|
|
53
55
|
starRating?: StarRating;
|
|
54
56
|
statistics?: Statistics;
|
|
55
|
-
tags?: Array<Tag
|
|
57
|
+
tags?: Array<Tag<TStrict>>;
|
|
56
58
|
};
|
|
57
59
|
type StarRating = {
|
|
58
60
|
average?: number;
|
|
@@ -64,48 +66,48 @@ declare namespace MediaNs {
|
|
|
64
66
|
views?: number;
|
|
65
67
|
favorites?: number;
|
|
66
68
|
};
|
|
67
|
-
type Tag = {
|
|
68
|
-
name: string
|
|
69
|
+
type Tag<TStrict extends boolean = false> = Strict<{
|
|
70
|
+
name: Requirable<string>;
|
|
69
71
|
weight?: number;
|
|
70
|
-
}
|
|
71
|
-
type Embed = {
|
|
72
|
-
url: string
|
|
72
|
+
}, TStrict>;
|
|
73
|
+
type Embed<TStrict extends boolean = false> = Strict<{
|
|
74
|
+
url: Requirable<string>;
|
|
73
75
|
width?: number;
|
|
74
76
|
height?: number;
|
|
75
|
-
params?: Array<Param
|
|
76
|
-
}
|
|
77
|
-
type Param = {
|
|
78
|
-
name: string
|
|
79
|
-
value: string
|
|
80
|
-
}
|
|
81
|
-
type Status = {
|
|
82
|
-
state: string
|
|
77
|
+
params?: Array<Param<TStrict>>;
|
|
78
|
+
}, TStrict>;
|
|
79
|
+
type Param<TStrict extends boolean = false> = Strict<{
|
|
80
|
+
name: Requirable<string>;
|
|
81
|
+
value: Requirable<string>;
|
|
82
|
+
}, TStrict>;
|
|
83
|
+
type Status<TStrict extends boolean = false> = Strict<{
|
|
84
|
+
state: Requirable<string>;
|
|
83
85
|
reason?: string;
|
|
84
|
-
}
|
|
86
|
+
}, TStrict>;
|
|
85
87
|
type Price = {
|
|
86
88
|
type?: string;
|
|
87
89
|
info?: string;
|
|
88
90
|
price?: number;
|
|
89
91
|
currency?: string;
|
|
90
92
|
};
|
|
91
|
-
type License = {
|
|
93
|
+
type License<TStrict extends boolean = false> = {
|
|
92
94
|
name?: string;
|
|
93
95
|
type?: string;
|
|
94
96
|
href?: string;
|
|
95
|
-
} & ({
|
|
97
|
+
} & (TStrict extends true ? {
|
|
96
98
|
name: string;
|
|
97
99
|
} | {
|
|
98
100
|
href: string;
|
|
99
|
-
});
|
|
100
|
-
type SubTitle = {
|
|
101
|
+
} : unknown);
|
|
102
|
+
type SubTitle<TStrict extends boolean = false> = Strict<{
|
|
101
103
|
type?: string;
|
|
102
104
|
lang?: string;
|
|
103
|
-
href: string
|
|
104
|
-
}
|
|
105
|
-
type PeerLink = {
|
|
105
|
+
href: Requirable<string>;
|
|
106
|
+
}, TStrict>;
|
|
107
|
+
type PeerLink<TStrict extends boolean = false> = Strict<{
|
|
106
108
|
type?: string;
|
|
107
|
-
href: string
|
|
108
|
-
}
|
|
109
|
+
href: Requirable<string>;
|
|
110
|
+
}, TStrict>;
|
|
109
111
|
type Rights = {
|
|
110
112
|
status?: string;
|
|
111
113
|
};
|
|
@@ -123,34 +125,34 @@ declare namespace MediaNs {
|
|
|
123
125
|
lng?: number;
|
|
124
126
|
};
|
|
125
127
|
/** @internal Shared elements available across Content, Group, ItemOrFeed types. */
|
|
126
|
-
type CommonElements = {
|
|
127
|
-
ratings?: Array<Rating
|
|
128
|
-
title?: TitleOrDescription
|
|
129
|
-
description?: TitleOrDescription
|
|
128
|
+
type CommonElements<TStrict extends boolean = false> = {
|
|
129
|
+
ratings?: Array<Rating<TStrict>>;
|
|
130
|
+
title?: TitleOrDescription<TStrict>;
|
|
131
|
+
description?: TitleOrDescription<TStrict>;
|
|
130
132
|
keywords?: Array<string>;
|
|
131
|
-
thumbnails?: Array<Thumbnail
|
|
132
|
-
categories?: Array<Category
|
|
133
|
-
hashes?: Array<Hash
|
|
134
|
-
player?: Player
|
|
135
|
-
credits?: Array<Credit
|
|
136
|
-
copyright?: Copyright
|
|
137
|
-
texts?: Array<Text
|
|
138
|
-
restrictions?: Array<Restriction
|
|
139
|
-
community?: Community
|
|
133
|
+
thumbnails?: Array<Thumbnail<TStrict>>;
|
|
134
|
+
categories?: Array<Category<TStrict>>;
|
|
135
|
+
hashes?: Array<Hash<TStrict>>;
|
|
136
|
+
player?: Player<TStrict>;
|
|
137
|
+
credits?: Array<Credit<TStrict>>;
|
|
138
|
+
copyright?: Copyright<TStrict>;
|
|
139
|
+
texts?: Array<Text<TStrict>>;
|
|
140
|
+
restrictions?: Array<Restriction<TStrict>>;
|
|
141
|
+
community?: Community<TStrict>;
|
|
140
142
|
comments?: Array<string>;
|
|
141
|
-
embed?: Embed
|
|
143
|
+
embed?: Embed<TStrict>;
|
|
142
144
|
responses?: Array<string>;
|
|
143
145
|
backLinks?: Array<string>;
|
|
144
|
-
status?: Status
|
|
146
|
+
status?: Status<TStrict>;
|
|
145
147
|
prices?: Array<Price>;
|
|
146
|
-
licenses?: Array<License
|
|
147
|
-
subTitles?: Array<SubTitle
|
|
148
|
-
peerLinks?: Array<PeerLink
|
|
148
|
+
licenses?: Array<License<TStrict>>;
|
|
149
|
+
subTitles?: Array<SubTitle<TStrict>>;
|
|
150
|
+
peerLinks?: Array<PeerLink<TStrict>>;
|
|
149
151
|
locations?: Array<Location>;
|
|
150
152
|
rights?: Rights;
|
|
151
153
|
scenes?: Array<Scene>;
|
|
152
154
|
};
|
|
153
|
-
type Content = {
|
|
155
|
+
type Content<TStrict extends boolean = false> = {
|
|
154
156
|
url?: string;
|
|
155
157
|
fileSize?: number;
|
|
156
158
|
type?: string;
|
|
@@ -165,15 +167,14 @@ declare namespace MediaNs {
|
|
|
165
167
|
height?: number;
|
|
166
168
|
width?: number;
|
|
167
169
|
lang?: string;
|
|
168
|
-
} & CommonElements
|
|
169
|
-
type Group = {
|
|
170
|
-
contents?: Array<Content
|
|
171
|
-
} & CommonElements
|
|
172
|
-
type ItemOrFeed = {
|
|
173
|
-
groups?: Array<Group
|
|
174
|
-
contents?: Array<Content
|
|
175
|
-
|
|
176
|
-
} & CommonElements;
|
|
170
|
+
} & CommonElements<TStrict>;
|
|
171
|
+
type Group<TStrict extends boolean = false> = {
|
|
172
|
+
contents?: Array<Content<TStrict>>;
|
|
173
|
+
} & CommonElements<TStrict>;
|
|
174
|
+
type ItemOrFeed<TStrict extends boolean = false> = {
|
|
175
|
+
groups?: Array<Group<TStrict>>;
|
|
176
|
+
contents?: Array<Content<TStrict>>;
|
|
177
|
+
} & CommonElements<TStrict>;
|
|
177
178
|
}
|
|
178
179
|
//#endregion
|
|
179
180
|
export { MediaNs };
|
|
@@ -259,7 +259,7 @@ const generateGroup = (group) => {
|
|
|
259
259
|
const generateItemOrFeed = (itemOrFeed) => {
|
|
260
260
|
if (!require_utils.isObject(itemOrFeed)) return;
|
|
261
261
|
return require_utils.trimObject({
|
|
262
|
-
"media:group": require_utils.
|
|
262
|
+
"media:group": require_utils.trimArray(itemOrFeed.groups, generateGroup),
|
|
263
263
|
"media:content": require_utils.trimArray(itemOrFeed.contents, generateContent),
|
|
264
264
|
...generateCommonElements(itemOrFeed)
|
|
265
265
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { generateCdataString, generateCsvOf, generateNumber, generatePlainString, generateTextOrCdataString, generateYesNoBoolean, isObject, trimArray, trimObject } from "../../../common/utils.js";
|
|
2
2
|
//#region src/namespaces/media/generate/utils.ts
|
|
3
3
|
const generateRating = (rating) => {
|
|
4
4
|
if (!isObject(rating)) return;
|
|
@@ -259,7 +259,7 @@ const generateGroup = (group) => {
|
|
|
259
259
|
const generateItemOrFeed = (itemOrFeed) => {
|
|
260
260
|
if (!isObject(itemOrFeed)) return;
|
|
261
261
|
return trimObject({
|
|
262
|
-
"media:group":
|
|
262
|
+
"media:group": trimArray(itemOrFeed.groups, generateGroup),
|
|
263
263
|
"media:content": trimArray(itemOrFeed.contents, generateContent),
|
|
264
264
|
...generateCommonElements(itemOrFeed)
|
|
265
265
|
});
|