triangle-types 1.0.208 → 1.0.210
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/dist/src/index.d.ts +1 -0
- package/dist/src/index.js +1 -0
- package/dist/src/types/fragments/Fragment.d.ts +8 -8
- package/dist/src/types/fragments/Fragment.js +16 -16
- package/dist/src/types/twitter/TwitterUser.d.ts +1 -1
- package/dist/src/types/web/WebArticleFragment.d.ts +15 -0
- package/dist/src/types/web/WebArticleFragment.js +38 -0
- package/dist/src/types/web/WebArticleTag.d.ts +0 -2
- package/dist/src/types/web/WebArticleTag.js +0 -6
- package/package.json +1 -1
- package/src/index.ts +1 -0
- package/src/types/fragments/Fragment.ts +19 -19
- package/src/types/twitter/TwitterUser.ts +1 -1
- package/src/types/web/WebArticleFragment.ts +44 -0
- package/src/types/web/WebArticleTag.ts +0 -6
- package/src/types/press/PressArticle.ts +0 -38
- package/src/types/press/PressArticleTag.ts +0 -54
package/dist/src/index.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ export * from "./types/twitter/TwitterTweet.js";
|
|
|
4
4
|
export * from "./types/twitter/TwitterUser.js";
|
|
5
5
|
export * from "./types/twitter/TwitterUserTag.js";
|
|
6
6
|
export * from "./types/web/WebArticle.js";
|
|
7
|
+
export * from "./types/web/WebArticleFragment.js";
|
|
7
8
|
export * from "./types/web/WebArticleTag.js";
|
|
8
9
|
export * from "./types/youtube/YoutubeChannel.js";
|
|
9
10
|
export * from "./types/youtube/YoutubeVideo.js";
|
package/dist/src/index.js
CHANGED
|
@@ -4,6 +4,7 @@ export * from "./types/twitter/TwitterTweet.js";
|
|
|
4
4
|
export * from "./types/twitter/TwitterUser.js";
|
|
5
5
|
export * from "./types/twitter/TwitterUserTag.js";
|
|
6
6
|
export * from "./types/web/WebArticle.js";
|
|
7
|
+
export * from "./types/web/WebArticleFragment.js";
|
|
7
8
|
export * from "./types/web/WebArticleTag.js";
|
|
8
9
|
export * from "./types/youtube/YoutubeChannel.js";
|
|
9
10
|
export * from "./types/youtube/YoutubeVideo.js";
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { FederalCongressBillDocument } from "../federal_congress/FederalCongressBillDocument.js";
|
|
2
2
|
import { LegistarDocument } from "../legistar/LegistarDocument.js";
|
|
3
|
-
import {
|
|
3
|
+
import { WebArticleTag } from "../web/WebArticleTag.js";
|
|
4
4
|
import { ScoutDocument } from "../scout/ScoutDocument.js";
|
|
5
5
|
import { TwitterTweet } from "../twitter/TwitterTweet.js";
|
|
6
6
|
declare const fragment_type_ids: readonly ["LINE", "CHAR"];
|
|
7
7
|
export type FragmentTypeID = typeof fragment_type_ids[number];
|
|
8
8
|
export declare function is_fragment_type_id(fragment_type_id: any): fragment_type_id is FragmentTypeID;
|
|
9
|
-
declare const document_type_ids: readonly ["federal_congress_bill_document", "legistar_document", "
|
|
9
|
+
declare const document_type_ids: readonly ["federal_congress_bill_document", "legistar_document", "web_article_tag", "scout_document", "twitter_tweet"];
|
|
10
10
|
export type DocumentTypeID = typeof document_type_ids[number];
|
|
11
11
|
export declare function is_document_type_id(document_type_id: any): document_type_id is DocumentTypeID;
|
|
12
12
|
export declare class Fragment {
|
|
@@ -25,7 +25,7 @@ export declare class Fragment {
|
|
|
25
25
|
export declare class FragmentAux extends Fragment {
|
|
26
26
|
readonly federal_congress_bill_document?: FederalCongressBillDocument;
|
|
27
27
|
readonly legistar_document?: LegistarDocument;
|
|
28
|
-
readonly
|
|
28
|
+
readonly web_article_tag?: WebArticleTag;
|
|
29
29
|
readonly scout_document?: ScoutDocument;
|
|
30
30
|
readonly twitter_tweet?: TwitterTweet;
|
|
31
31
|
constructor(fragment: FragmentAux);
|
|
@@ -43,12 +43,12 @@ export declare class LegistarDocumentFragment extends Fragment {
|
|
|
43
43
|
constructor(fragment: LegistarDocumentFragment);
|
|
44
44
|
static is(fragment: any): fragment is LegistarDocumentFragment;
|
|
45
45
|
}
|
|
46
|
-
export declare class
|
|
47
|
-
readonly document_type_id: "
|
|
48
|
-
readonly
|
|
46
|
+
export declare class WebArticleTagFragment extends Fragment {
|
|
47
|
+
readonly document_type_id: "web_article_tag";
|
|
48
|
+
readonly web_article_id: string;
|
|
49
49
|
readonly tag_id: string;
|
|
50
|
-
constructor(fragment:
|
|
51
|
-
static is(fragment: any): fragment is
|
|
50
|
+
constructor(fragment: WebArticleTagFragment);
|
|
51
|
+
static is(fragment: any): fragment is WebArticleTagFragment;
|
|
52
52
|
}
|
|
53
53
|
export declare class ScoutDocumentFragment extends Fragment {
|
|
54
54
|
readonly document_type_id: "scout_document";
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { FederalCongressBillDocument } from "../federal_congress/FederalCongressBillDocument.js";
|
|
2
2
|
import { LegistarDocument } from "../legistar/LegistarDocument.js";
|
|
3
|
-
import {
|
|
3
|
+
import { WebArticleTag } from "../web/WebArticleTag.js";
|
|
4
4
|
import { ScoutDocument } from "../scout/ScoutDocument.js";
|
|
5
5
|
import { TwitterTweet } from "../twitter/TwitterTweet.js";
|
|
6
6
|
const fragment_type_ids = ["LINE", "CHAR"];
|
|
7
7
|
export function is_fragment_type_id(fragment_type_id) {
|
|
8
8
|
return fragment_type_ids.includes(fragment_type_id);
|
|
9
9
|
}
|
|
10
|
-
const document_type_ids = ["federal_congress_bill_document", "legistar_document", "
|
|
10
|
+
const document_type_ids = ["federal_congress_bill_document", "legistar_document", "web_article_tag", "scout_document", "twitter_tweet"];
|
|
11
11
|
export function is_document_type_id(document_type_id) {
|
|
12
12
|
return document_type_ids.includes(document_type_id);
|
|
13
13
|
}
|
|
@@ -48,7 +48,7 @@ export class Fragment {
|
|
|
48
48
|
export class FragmentAux extends Fragment {
|
|
49
49
|
federal_congress_bill_document;
|
|
50
50
|
legistar_document;
|
|
51
|
-
|
|
51
|
+
web_article_tag;
|
|
52
52
|
scout_document;
|
|
53
53
|
twitter_tweet;
|
|
54
54
|
constructor(fragment) {
|
|
@@ -58,7 +58,7 @@ export class FragmentAux extends Fragment {
|
|
|
58
58
|
super(fragment);
|
|
59
59
|
this.federal_congress_bill_document = fragment.federal_congress_bill_document;
|
|
60
60
|
this.legistar_document = fragment.legistar_document;
|
|
61
|
-
this.
|
|
61
|
+
this.web_article_tag = fragment.web_article_tag;
|
|
62
62
|
this.scout_document = fragment.scout_document;
|
|
63
63
|
this.twitter_tweet = fragment.twitter_tweet;
|
|
64
64
|
}
|
|
@@ -66,7 +66,7 @@ export class FragmentAux extends Fragment {
|
|
|
66
66
|
return (Fragment.is(fragment) &&
|
|
67
67
|
(fragment.federal_congress_bill_document === undefined || FederalCongressBillDocument.is(fragment.federal_congress_bill_document)) &&
|
|
68
68
|
(fragment.legistar_document === undefined || LegistarDocument.is(fragment.legistar_document)) &&
|
|
69
|
-
(fragment.
|
|
69
|
+
(fragment.web_article_tag === undefined || WebArticleTag.is(fragment.web_article_tag)) &&
|
|
70
70
|
(fragment.scout_document === undefined || ScoutDocument.is(fragment.scout_document)) &&
|
|
71
71
|
(fragment.twitter_tweet === undefined || TwitterTweet.is(fragment.twitter_tweet)));
|
|
72
72
|
}
|
|
@@ -105,36 +105,36 @@ export class LegistarDocumentFragment extends Fragment {
|
|
|
105
105
|
typeof fragment.legistar_document_id === "string");
|
|
106
106
|
}
|
|
107
107
|
}
|
|
108
|
-
export class
|
|
108
|
+
export class WebArticleTagFragment extends Fragment {
|
|
109
109
|
document_type_id;
|
|
110
|
-
|
|
110
|
+
web_article_id;
|
|
111
111
|
tag_id;
|
|
112
112
|
constructor(fragment) {
|
|
113
|
-
if (!
|
|
113
|
+
if (!WebArticleTagFragment.is(fragment)) {
|
|
114
114
|
throw Error("Invalid input.");
|
|
115
115
|
}
|
|
116
116
|
super(fragment);
|
|
117
117
|
this.document_type_id = fragment.document_type_id;
|
|
118
|
-
this.
|
|
118
|
+
this.web_article_id = fragment.web_article_id;
|
|
119
119
|
this.tag_id = fragment.tag_id;
|
|
120
120
|
}
|
|
121
121
|
static is(fragment) {
|
|
122
122
|
return (Fragment.is(fragment) &&
|
|
123
|
-
fragment.document_type_id === "
|
|
124
|
-
typeof fragment.
|
|
123
|
+
fragment.document_type_id === "web_article_tag" &&
|
|
124
|
+
typeof fragment.web_article_id === "string" &&
|
|
125
125
|
typeof fragment.tag_id === "string");
|
|
126
126
|
}
|
|
127
127
|
}
|
|
128
|
-
// export class
|
|
129
|
-
// readonly
|
|
130
|
-
// constructor(fragment :
|
|
131
|
-
// if (!
|
|
128
|
+
// export class WebArticleTagFragmentAux extends WebArticleTagFragment {
|
|
129
|
+
// readonly web_article_ : WebArticleTagAux
|
|
130
|
+
// constructor(fragment : WebArticleTagFragmentAux) {
|
|
131
|
+
// if (!WebArticleTagFragmentAux.is(fragment)) {
|
|
132
132
|
// throw Error("Invalid input.")
|
|
133
133
|
// }
|
|
134
134
|
// super(fragment)
|
|
135
135
|
// this.scout_document = fragment.scout_document
|
|
136
136
|
// }
|
|
137
|
-
// static is(fragment : any) : fragment is
|
|
137
|
+
// static is(fragment : any) : fragment is WebArticleTagFragmentAux {
|
|
138
138
|
// return (
|
|
139
139
|
// Fragment.is(fragment) &&
|
|
140
140
|
// ScoutDocument.is(fragment.scout_document)
|
|
@@ -4,7 +4,7 @@ export declare class TwitterUser {
|
|
|
4
4
|
readonly name: string;
|
|
5
5
|
readonly url: string;
|
|
6
6
|
readonly description: string;
|
|
7
|
-
readonly location
|
|
7
|
+
readonly location?: string;
|
|
8
8
|
readonly create_time: string;
|
|
9
9
|
readonly affiliated_twitter_user_id?: string;
|
|
10
10
|
readonly is_protected: boolean;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { FragmentTypeID } from "../fragments/Fragment.js";
|
|
2
|
+
export declare class WebArticleFragment {
|
|
3
|
+
readonly web_article_id: string;
|
|
4
|
+
readonly fragment_id: string;
|
|
5
|
+
readonly fragment_type_id: FragmentTypeID;
|
|
6
|
+
readonly max_size: number;
|
|
7
|
+
readonly min_index: number;
|
|
8
|
+
readonly max_index: number;
|
|
9
|
+
readonly title: string;
|
|
10
|
+
readonly text: string;
|
|
11
|
+
readonly vector: number[];
|
|
12
|
+
readonly [x: string]: any;
|
|
13
|
+
constructor(web_article_fragment: WebArticleFragment);
|
|
14
|
+
static is(web_article_fragment: any): web_article_fragment is WebArticleFragment;
|
|
15
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { is_fragment_type_id } from "../fragments/Fragment.js";
|
|
2
|
+
export class WebArticleFragment {
|
|
3
|
+
web_article_id;
|
|
4
|
+
fragment_id;
|
|
5
|
+
fragment_type_id;
|
|
6
|
+
max_size;
|
|
7
|
+
min_index;
|
|
8
|
+
max_index;
|
|
9
|
+
title;
|
|
10
|
+
text;
|
|
11
|
+
vector;
|
|
12
|
+
constructor(web_article_fragment) {
|
|
13
|
+
if (!WebArticleFragment.is(web_article_fragment)) {
|
|
14
|
+
throw Error("Invalid input.");
|
|
15
|
+
}
|
|
16
|
+
this.web_article_id = web_article_fragment.web_article_id;
|
|
17
|
+
this.fragment_id = web_article_fragment.fragment_id;
|
|
18
|
+
this.fragment_type_id = web_article_fragment.fragment_type_id;
|
|
19
|
+
this.max_size = web_article_fragment.max_size;
|
|
20
|
+
this.min_index = web_article_fragment.min_index;
|
|
21
|
+
this.max_index = web_article_fragment.max_index;
|
|
22
|
+
this.title = web_article_fragment.title;
|
|
23
|
+
this.text = web_article_fragment.text;
|
|
24
|
+
this.vector = web_article_fragment.vector;
|
|
25
|
+
}
|
|
26
|
+
static is(web_article_fragment) {
|
|
27
|
+
return (web_article_fragment !== undefined &&
|
|
28
|
+
typeof web_article_fragment.web_article_id === "string" &&
|
|
29
|
+
typeof web_article_fragment.fragment_id === "string" &&
|
|
30
|
+
is_fragment_type_id(web_article_fragment.fragment_type_id) &&
|
|
31
|
+
typeof web_article_fragment.max_size === "number" &&
|
|
32
|
+
typeof web_article_fragment.min_index === "number" &&
|
|
33
|
+
typeof web_article_fragment.max_index === "number" &&
|
|
34
|
+
typeof web_article_fragment.title === "string" &&
|
|
35
|
+
typeof web_article_fragment.text === "string" &&
|
|
36
|
+
Array.isArray(web_article_fragment.vector) && web_article_fragment.vector.every((coordinate) => typeof coordinate === "number"));
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -2,8 +2,6 @@ import { WebArticle } from "./WebArticle.js";
|
|
|
2
2
|
export declare class WebArticleTag {
|
|
3
3
|
readonly web_article_id: string;
|
|
4
4
|
readonly tag_id: string;
|
|
5
|
-
readonly url: string;
|
|
6
|
-
readonly domain: string;
|
|
7
5
|
readonly date: string;
|
|
8
6
|
readonly is_relevant?: boolean;
|
|
9
7
|
readonly sentiment_id?: string;
|
|
@@ -2,8 +2,6 @@ import { WebArticle } from "./WebArticle.js";
|
|
|
2
2
|
export class WebArticleTag {
|
|
3
3
|
web_article_id;
|
|
4
4
|
tag_id;
|
|
5
|
-
url;
|
|
6
|
-
domain;
|
|
7
5
|
date;
|
|
8
6
|
is_relevant;
|
|
9
7
|
sentiment_id;
|
|
@@ -13,8 +11,6 @@ export class WebArticleTag {
|
|
|
13
11
|
}
|
|
14
12
|
this.web_article_id = web_article_tag.web_article_id;
|
|
15
13
|
this.tag_id = web_article_tag.tag_id;
|
|
16
|
-
this.url = web_article_tag.url;
|
|
17
|
-
this.domain = web_article_tag.domain;
|
|
18
14
|
this.date = web_article_tag.date;
|
|
19
15
|
this.is_relevant = web_article_tag.is_relevant;
|
|
20
16
|
this.sentiment_id = web_article_tag.sentiment_id;
|
|
@@ -23,8 +19,6 @@ export class WebArticleTag {
|
|
|
23
19
|
return (web_article_tag !== undefined &&
|
|
24
20
|
typeof web_article_tag.web_article_id === "string" &&
|
|
25
21
|
typeof web_article_tag.tag_id === "string" &&
|
|
26
|
-
typeof web_article_tag.url === "string" &&
|
|
27
|
-
typeof web_article_tag.domain === "string" &&
|
|
28
22
|
typeof web_article_tag.date === "string" &&
|
|
29
23
|
(web_article_tag.is_relevant === undefined || typeof web_article_tag.is_relevant === "boolean") &&
|
|
30
24
|
(web_article_tag.sentiment_id === undefined || typeof web_article_tag.sentiment_id === "string"));
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -6,6 +6,7 @@ export * from "./types/twitter/TwitterTweet"
|
|
|
6
6
|
export * from "./types/twitter/TwitterUser"
|
|
7
7
|
export * from "./types/twitter/TwitterUserTag"
|
|
8
8
|
export * from "./types/web/WebArticle"
|
|
9
|
+
export * from "./types/web/WebArticleFragment"
|
|
9
10
|
export * from "./types/web/WebArticleTag"
|
|
10
11
|
export * from "./types/youtube/YoutubeChannel"
|
|
11
12
|
export * from "./types/youtube/YoutubeVideo"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { FederalCongressBillDocument } from "../federal_congress/FederalCongressBillDocument"
|
|
2
2
|
import { LegistarDocument } from "../legistar/LegistarDocument"
|
|
3
|
-
import {
|
|
3
|
+
import { WebArticleTag, WebArticleTagAux } from "../web/WebArticleTag"
|
|
4
4
|
import { ScoutDocument } from "../scout/ScoutDocument"
|
|
5
5
|
import { TwitterTweet } from "../twitter/TwitterTweet"
|
|
6
6
|
|
|
@@ -12,7 +12,7 @@ export function is_fragment_type_id(fragment_type_id : any) : fragment_type_id i
|
|
|
12
12
|
return fragment_type_ids.includes(fragment_type_id)
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
const document_type_ids = ["federal_congress_bill_document", "legistar_document", "
|
|
15
|
+
const document_type_ids = ["federal_congress_bill_document", "legistar_document", "web_article_tag", "scout_document", "twitter_tweet"] as const
|
|
16
16
|
|
|
17
17
|
export type DocumentTypeID = typeof document_type_ids[number]
|
|
18
18
|
|
|
@@ -63,7 +63,7 @@ export class Fragment {
|
|
|
63
63
|
export class FragmentAux extends Fragment {
|
|
64
64
|
readonly federal_congress_bill_document? : FederalCongressBillDocument
|
|
65
65
|
readonly legistar_document? : LegistarDocument
|
|
66
|
-
readonly
|
|
66
|
+
readonly web_article_tag? : WebArticleTag
|
|
67
67
|
readonly scout_document? : ScoutDocument
|
|
68
68
|
readonly twitter_tweet? : TwitterTweet
|
|
69
69
|
|
|
@@ -74,7 +74,7 @@ export class FragmentAux extends Fragment {
|
|
|
74
74
|
super(fragment)
|
|
75
75
|
this.federal_congress_bill_document = fragment.federal_congress_bill_document
|
|
76
76
|
this.legistar_document = fragment.legistar_document
|
|
77
|
-
this.
|
|
77
|
+
this.web_article_tag = fragment.web_article_tag
|
|
78
78
|
this.scout_document = fragment.scout_document
|
|
79
79
|
this.twitter_tweet = fragment.twitter_tweet
|
|
80
80
|
}
|
|
@@ -84,7 +84,7 @@ export class FragmentAux extends Fragment {
|
|
|
84
84
|
Fragment.is(fragment) &&
|
|
85
85
|
(fragment.federal_congress_bill_document === undefined || FederalCongressBillDocument.is(fragment.federal_congress_bill_document)) &&
|
|
86
86
|
(fragment.legistar_document === undefined || LegistarDocument.is(fragment.legistar_document)) &&
|
|
87
|
-
(fragment.
|
|
87
|
+
(fragment.web_article_tag === undefined || WebArticleTag.is(fragment.web_article_tag)) &&
|
|
88
88
|
(fragment.scout_document === undefined || ScoutDocument.is(fragment.scout_document)) &&
|
|
89
89
|
(fragment.twitter_tweet === undefined || TwitterTweet.is(fragment.twitter_tweet))
|
|
90
90
|
)
|
|
@@ -135,43 +135,43 @@ export class LegistarDocumentFragment extends Fragment {
|
|
|
135
135
|
}
|
|
136
136
|
}
|
|
137
137
|
|
|
138
|
-
export class
|
|
139
|
-
readonly document_type_id : "
|
|
140
|
-
readonly
|
|
138
|
+
export class WebArticleTagFragment extends Fragment {
|
|
139
|
+
readonly document_type_id : "web_article_tag"
|
|
140
|
+
readonly web_article_id : string
|
|
141
141
|
readonly tag_id : string
|
|
142
142
|
|
|
143
|
-
constructor(fragment :
|
|
144
|
-
if (!
|
|
143
|
+
constructor(fragment : WebArticleTagFragment) {
|
|
144
|
+
if (!WebArticleTagFragment.is(fragment)) {
|
|
145
145
|
throw Error("Invalid input.")
|
|
146
146
|
}
|
|
147
147
|
super(fragment)
|
|
148
148
|
this.document_type_id = fragment.document_type_id
|
|
149
|
-
this.
|
|
149
|
+
this.web_article_id = fragment.web_article_id
|
|
150
150
|
this.tag_id = fragment.tag_id
|
|
151
151
|
}
|
|
152
152
|
|
|
153
|
-
static is(fragment : any) : fragment is
|
|
153
|
+
static is(fragment : any) : fragment is WebArticleTagFragment {
|
|
154
154
|
return (
|
|
155
155
|
Fragment.is(fragment) &&
|
|
156
|
-
fragment.document_type_id === "
|
|
157
|
-
typeof fragment.
|
|
156
|
+
fragment.document_type_id === "web_article_tag" &&
|
|
157
|
+
typeof fragment.web_article_id === "string" &&
|
|
158
158
|
typeof fragment.tag_id === "string"
|
|
159
159
|
)
|
|
160
160
|
}
|
|
161
161
|
}
|
|
162
162
|
|
|
163
|
-
// export class
|
|
164
|
-
// readonly
|
|
163
|
+
// export class WebArticleTagFragmentAux extends WebArticleTagFragment {
|
|
164
|
+
// readonly web_article_ : WebArticleTagAux
|
|
165
165
|
|
|
166
|
-
// constructor(fragment :
|
|
167
|
-
// if (!
|
|
166
|
+
// constructor(fragment : WebArticleTagFragmentAux) {
|
|
167
|
+
// if (!WebArticleTagFragmentAux.is(fragment)) {
|
|
168
168
|
// throw Error("Invalid input.")
|
|
169
169
|
// }
|
|
170
170
|
// super(fragment)
|
|
171
171
|
// this.scout_document = fragment.scout_document
|
|
172
172
|
// }
|
|
173
173
|
|
|
174
|
-
// static is(fragment : any) : fragment is
|
|
174
|
+
// static is(fragment : any) : fragment is WebArticleTagFragmentAux {
|
|
175
175
|
// return (
|
|
176
176
|
// Fragment.is(fragment) &&
|
|
177
177
|
// ScoutDocument.is(fragment.scout_document)
|
|
@@ -4,7 +4,7 @@ export class TwitterUser {
|
|
|
4
4
|
readonly name : string
|
|
5
5
|
readonly url : string
|
|
6
6
|
readonly description : string
|
|
7
|
-
readonly location : string
|
|
7
|
+
readonly location? : string
|
|
8
8
|
readonly create_time : string
|
|
9
9
|
readonly affiliated_twitter_user_id? : string
|
|
10
10
|
readonly is_protected : boolean
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { FragmentTypeID, is_fragment_type_id } from "../fragments/Fragment"
|
|
2
|
+
|
|
3
|
+
export class WebArticleFragment {
|
|
4
|
+
readonly web_article_id : string
|
|
5
|
+
readonly fragment_id : string
|
|
6
|
+
readonly fragment_type_id : FragmentTypeID
|
|
7
|
+
readonly max_size : number
|
|
8
|
+
readonly min_index : number
|
|
9
|
+
readonly max_index : number
|
|
10
|
+
readonly title : string
|
|
11
|
+
readonly text : string
|
|
12
|
+
readonly vector : number[]
|
|
13
|
+
readonly [x : string] : any
|
|
14
|
+
|
|
15
|
+
constructor(web_article_fragment : WebArticleFragment) {
|
|
16
|
+
if (!WebArticleFragment.is(web_article_fragment)) {
|
|
17
|
+
throw Error("Invalid input.")
|
|
18
|
+
}
|
|
19
|
+
this.web_article_id = web_article_fragment.web_article_id
|
|
20
|
+
this.fragment_id = web_article_fragment.fragment_id
|
|
21
|
+
this.fragment_type_id = web_article_fragment.fragment_type_id
|
|
22
|
+
this.max_size = web_article_fragment.max_size
|
|
23
|
+
this.min_index = web_article_fragment.min_index
|
|
24
|
+
this.max_index = web_article_fragment.max_index
|
|
25
|
+
this.title = web_article_fragment.title
|
|
26
|
+
this.text = web_article_fragment.text
|
|
27
|
+
this.vector = web_article_fragment.vector
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
static is(web_article_fragment : any) : web_article_fragment is WebArticleFragment {
|
|
31
|
+
return (
|
|
32
|
+
web_article_fragment !== undefined &&
|
|
33
|
+
typeof web_article_fragment.web_article_id === "string" &&
|
|
34
|
+
typeof web_article_fragment.fragment_id === "string" &&
|
|
35
|
+
is_fragment_type_id(web_article_fragment.fragment_type_id) &&
|
|
36
|
+
typeof web_article_fragment.max_size === "number" &&
|
|
37
|
+
typeof web_article_fragment.min_index === "number" &&
|
|
38
|
+
typeof web_article_fragment.max_index === "number" &&
|
|
39
|
+
typeof web_article_fragment.title === "string" &&
|
|
40
|
+
typeof web_article_fragment.text === "string" &&
|
|
41
|
+
Array.isArray(web_article_fragment.vector) && web_article_fragment.vector.every((coordinate : any) => typeof coordinate === "number")
|
|
42
|
+
)
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -3,8 +3,6 @@ import { WebArticle } from "./WebArticle"
|
|
|
3
3
|
export class WebArticleTag {
|
|
4
4
|
readonly web_article_id : string
|
|
5
5
|
readonly tag_id : string
|
|
6
|
-
readonly url : string
|
|
7
|
-
readonly domain : string
|
|
8
6
|
readonly date : string
|
|
9
7
|
readonly is_relevant? : boolean
|
|
10
8
|
readonly sentiment_id? : string
|
|
@@ -16,8 +14,6 @@ export class WebArticleTag {
|
|
|
16
14
|
}
|
|
17
15
|
this.web_article_id = web_article_tag.web_article_id
|
|
18
16
|
this.tag_id = web_article_tag.tag_id
|
|
19
|
-
this.url = web_article_tag.url
|
|
20
|
-
this.domain = web_article_tag.domain
|
|
21
17
|
this.date = web_article_tag.date
|
|
22
18
|
this.is_relevant = web_article_tag.is_relevant
|
|
23
19
|
this.sentiment_id = web_article_tag.sentiment_id
|
|
@@ -28,8 +24,6 @@ export class WebArticleTag {
|
|
|
28
24
|
web_article_tag !== undefined &&
|
|
29
25
|
typeof web_article_tag.web_article_id === "string" &&
|
|
30
26
|
typeof web_article_tag.tag_id === "string" &&
|
|
31
|
-
typeof web_article_tag.url === "string" &&
|
|
32
|
-
typeof web_article_tag.domain === "string" &&
|
|
33
27
|
typeof web_article_tag.date === "string" &&
|
|
34
28
|
(web_article_tag.is_relevant === undefined || typeof web_article_tag.is_relevant === "boolean") &&
|
|
35
29
|
(web_article_tag.sentiment_id === undefined || typeof web_article_tag.sentiment_id === "string")
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
export class PressArticle {
|
|
2
|
-
readonly press_article_id : string
|
|
3
|
-
readonly publish_date : string
|
|
4
|
-
readonly title : string
|
|
5
|
-
readonly publisher? : string
|
|
6
|
-
readonly domain : string
|
|
7
|
-
readonly url : string
|
|
8
|
-
readonly relevance? : string
|
|
9
|
-
readonly s3_id? : string
|
|
10
|
-
|
|
11
|
-
constructor(press_article : PressArticle) {
|
|
12
|
-
if (!PressArticle.is(press_article)) {
|
|
13
|
-
throw Error("Invalid input.")
|
|
14
|
-
}
|
|
15
|
-
this.press_article_id = press_article.press_article_id
|
|
16
|
-
this.publish_date = press_article.publish_date
|
|
17
|
-
this.title = press_article.title
|
|
18
|
-
this.publisher = press_article.publisher
|
|
19
|
-
this.domain = press_article.domain
|
|
20
|
-
this.url = press_article.url
|
|
21
|
-
this.relevance = press_article.relevance
|
|
22
|
-
this.s3_id = press_article.s3_id
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
static is(press_article : any) : press_article is PressArticle {
|
|
26
|
-
return (
|
|
27
|
-
press_article !== undefined &&
|
|
28
|
-
typeof press_article.press_article_id === "string" &&
|
|
29
|
-
typeof press_article.publish_date === "string" &&
|
|
30
|
-
typeof press_article.title === "string" &&
|
|
31
|
-
(press_article.publisher === undefined || typeof press_article.publisher === "string") &&
|
|
32
|
-
typeof press_article.domain === "string" &&
|
|
33
|
-
typeof press_article.url === "string" &&
|
|
34
|
-
(press_article.relevance === undefined || typeof press_article.relevance === "string") &&
|
|
35
|
-
(press_article.s3_id === undefined || typeof press_article.s3_id === "string")
|
|
36
|
-
)
|
|
37
|
-
}
|
|
38
|
-
}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { PressArticle } from "./PressArticle"
|
|
2
|
-
|
|
3
|
-
export class PressArticleTag {
|
|
4
|
-
readonly press_article_id : string
|
|
5
|
-
readonly tag_id : string
|
|
6
|
-
readonly publish_date : string
|
|
7
|
-
readonly url : string
|
|
8
|
-
readonly relevance? : string
|
|
9
|
-
readonly sentiment? : string
|
|
10
|
-
readonly [x : string] : any
|
|
11
|
-
|
|
12
|
-
constructor(press_article_tag : PressArticleTag) {
|
|
13
|
-
if (!PressArticleTag.is(press_article_tag)) {
|
|
14
|
-
throw Error("Invalid input.")
|
|
15
|
-
}
|
|
16
|
-
this.press_article_id = press_article_tag.press_article_id
|
|
17
|
-
this.tag_id = press_article_tag.tag_id
|
|
18
|
-
this.publish_date = press_article_tag.publish_date
|
|
19
|
-
this.url = press_article_tag.url
|
|
20
|
-
this.relevance = press_article_tag.relevance
|
|
21
|
-
this.sentiment = press_article_tag.sentiment
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
static is(press_article_tag : any) : press_article_tag is PressArticleTag {
|
|
25
|
-
return (
|
|
26
|
-
press_article_tag !== undefined &&
|
|
27
|
-
typeof press_article_tag.press_article_id === "string" &&
|
|
28
|
-
typeof press_article_tag.tag_id === "string" &&
|
|
29
|
-
typeof press_article_tag.publish_date === "string" &&
|
|
30
|
-
typeof press_article_tag.url === "string" &&
|
|
31
|
-
(press_article_tag.relevance === undefined || typeof press_article_tag.relevance === "string") &&
|
|
32
|
-
(press_article_tag.sentiment === undefined || typeof press_article_tag.sentiment === "string")
|
|
33
|
-
)
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
export class PressArticleTagAux extends PressArticleTag {
|
|
38
|
-
readonly press_article : PressArticle
|
|
39
|
-
|
|
40
|
-
constructor(press_article_tag : any) {
|
|
41
|
-
if (!PressArticleTagAux.is(press_article_tag)) {
|
|
42
|
-
throw Error("Invalid input.")
|
|
43
|
-
}
|
|
44
|
-
super(press_article_tag)
|
|
45
|
-
this.press_article = press_article_tag.press_article
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
static is(press_article_tag : any) : press_article_tag is PressArticleTagAux {
|
|
49
|
-
return (
|
|
50
|
-
PressArticleTag.is(press_article_tag) &&
|
|
51
|
-
PressArticle.is(press_article_tag.press_article)
|
|
52
|
-
)
|
|
53
|
-
}
|
|
54
|
-
}
|