triangle-types 1.0.209 → 1.0.211

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.
@@ -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";
@@ -16,6 +16,7 @@ export declare class TwitterTweet {
16
16
  readonly attachments_json?: string;
17
17
  readonly entities_json?: string;
18
18
  readonly reply_settings_type_id: string;
19
+ readonly vector?: number[];
19
20
  constructor(twitter_tweet: TwitterTweet);
20
21
  static is(twitter_tweet: any): twitter_tweet is TwitterTweet;
21
22
  }
@@ -16,6 +16,7 @@ export class TwitterTweet {
16
16
  attachments_json;
17
17
  entities_json;
18
18
  reply_settings_type_id;
19
+ vector;
19
20
  constructor(twitter_tweet) {
20
21
  if (!TwitterTweet.is(twitter_tweet)) {
21
22
  throw Error("Invalid input.");
@@ -37,6 +38,7 @@ export class TwitterTweet {
37
38
  this.attachments_json = twitter_tweet.attachments_json;
38
39
  this.entities_json = twitter_tweet.entities_json;
39
40
  this.reply_settings_type_id = twitter_tweet.reply_settings_type_id;
41
+ this.vector = twitter_tweet.vector;
40
42
  }
41
43
  static is(twitter_tweet) {
42
44
  return (twitter_tweet !== undefined &&
@@ -56,6 +58,7 @@ export class TwitterTweet {
56
58
  (twitter_tweet.media_json === undefined || typeof twitter_tweet.media_json === "string") &&
57
59
  (twitter_tweet.attachments_json === undefined || typeof twitter_tweet.attachments_json === "string") &&
58
60
  (twitter_tweet.entities_json === undefined || typeof twitter_tweet.entities_json === "string") &&
59
- typeof twitter_tweet.reply_settings_type_id === "string");
61
+ typeof twitter_tweet.reply_settings_type_id === "string" &&
62
+ (twitter_tweet.vector === undefined || Array.isArray(twitter_tweet.vector) && twitter_tweet.vector.every((coordinate) => typeof coordinate === "number")));
60
63
  }
61
64
  }
@@ -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: 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,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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "triangle-types",
3
- "version": "1.0.209",
3
+ "version": "1.0.211",
4
4
  "main": "dist/src/index.js",
5
5
  "types": "dist/src/index.d.ts",
6
6
  "scripts": {
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"
@@ -16,6 +16,7 @@ export class TwitterTweet {
16
16
  readonly attachments_json? : string
17
17
  readonly entities_json? : string
18
18
  readonly reply_settings_type_id : string
19
+ readonly vector? : number[]
19
20
 
20
21
  constructor(twitter_tweet : TwitterTweet) {
21
22
  if (!TwitterTweet.is(twitter_tweet)) {
@@ -38,6 +39,7 @@ export class TwitterTweet {
38
39
  this.attachments_json = twitter_tweet.attachments_json
39
40
  this.entities_json = twitter_tweet.entities_json
40
41
  this.reply_settings_type_id = twitter_tweet.reply_settings_type_id
42
+ this.vector = twitter_tweet.vector
41
43
  }
42
44
 
43
45
  static is(twitter_tweet : any) : twitter_tweet is TwitterTweet {
@@ -59,7 +61,8 @@ export class TwitterTweet {
59
61
  (twitter_tweet.media_json === undefined || typeof twitter_tweet.media_json === "string") &&
60
62
  (twitter_tweet.attachments_json === undefined || typeof twitter_tweet.attachments_json === "string") &&
61
63
  (twitter_tweet.entities_json === undefined || typeof twitter_tweet.entities_json === "string") &&
62
- typeof twitter_tweet.reply_settings_type_id === "string"
64
+ typeof twitter_tweet.reply_settings_type_id === "string" &&
65
+ (twitter_tweet.vector === undefined || Array.isArray(twitter_tweet.vector) && twitter_tweet.vector.every((coordinate : any) => typeof coordinate === "number"))
63
66
 
64
67
  )
65
68
  }
@@ -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")