scout-types 1.0.19 → 1.0.21
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/types/Message.js +1 -1
- package/dist/src/types/ScoutDocument.d.ts +1 -0
- package/dist/src/types/ScoutDocument.js +4 -1
- package/dist/src/types/Sources.d.ts +2 -2
- package/dist/src/types/Sources.js +16 -16
- package/package.json +1 -1
- package/src/types/Message.ts +1 -1
- package/src/types/ScoutDocument.ts +4 -1
- package/src/types/Sources.ts +16 -16
|
@@ -80,6 +80,6 @@ export class Message {
|
|
|
80
80
|
(message.fragments === undefined || Array.isArray(message.fragments) && message.fragments.every(Fragment.is)) &&
|
|
81
81
|
(message.sources === undefined || Sources.is(message.sources)) &&
|
|
82
82
|
typeof message.text === "string" &&
|
|
83
|
-
Attachment.is(message.attachment));
|
|
83
|
+
(message.attachment === undefined || Attachment.is(message.attachment)));
|
|
84
84
|
}
|
|
85
85
|
}
|
|
@@ -27,6 +27,7 @@ export declare class ScoutTweetDocument extends ScoutDocument {
|
|
|
27
27
|
static is(scout_document: any): scout_document is ScoutTweetDocument;
|
|
28
28
|
}
|
|
29
29
|
export declare class ScoutPressDocument extends ScoutDocument {
|
|
30
|
+
readonly url: string;
|
|
30
31
|
constructor(scout_document: any);
|
|
31
32
|
static is(scout_document: any): scout_document is ScoutPressDocument;
|
|
32
33
|
}
|
|
@@ -76,15 +76,18 @@ export class ScoutTweetDocument extends ScoutDocument {
|
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
78
|
export class ScoutPressDocument extends ScoutDocument {
|
|
79
|
+
url;
|
|
79
80
|
constructor(scout_document) {
|
|
80
81
|
if (!ScoutPressDocument.is(scout_document)) {
|
|
81
82
|
throw Error("Invalid input.");
|
|
82
83
|
}
|
|
83
84
|
super(scout_document);
|
|
85
|
+
this.url = scout_document.url;
|
|
84
86
|
}
|
|
85
87
|
static is(scout_document) {
|
|
86
88
|
return (ScoutDocument.is(scout_document) &&
|
|
87
|
-
scout_document.type === "PRESS"
|
|
89
|
+
scout_document.type === "PRESS" &&
|
|
90
|
+
typeof scout_document.url === "string");
|
|
88
91
|
}
|
|
89
92
|
}
|
|
90
93
|
export class ScoutFileDocument extends ScoutDocument {
|
|
@@ -28,8 +28,8 @@ export declare class BillSource {
|
|
|
28
28
|
readonly type: string;
|
|
29
29
|
readonly vector_key: string;
|
|
30
30
|
readonly bill: Bill;
|
|
31
|
-
constructor(
|
|
32
|
-
static is(
|
|
31
|
+
constructor(bill_source: any);
|
|
32
|
+
static is(bill_source: any): bill_source is BillSource;
|
|
33
33
|
}
|
|
34
34
|
export declare class GrokSource {
|
|
35
35
|
readonly title: string;
|
|
@@ -64,25 +64,25 @@ export class BillSource {
|
|
|
64
64
|
type;
|
|
65
65
|
vector_key;
|
|
66
66
|
bill;
|
|
67
|
-
constructor(
|
|
68
|
-
if (!BillSource.is(
|
|
67
|
+
constructor(bill_source) {
|
|
68
|
+
if (!BillSource.is(bill_source)) {
|
|
69
69
|
throw Error("Invalid input.");
|
|
70
70
|
}
|
|
71
|
-
this.chunk_text =
|
|
72
|
-
this.description =
|
|
73
|
-
this.label =
|
|
74
|
-
this.type =
|
|
75
|
-
this.vector_key =
|
|
76
|
-
this.bill =
|
|
71
|
+
this.chunk_text = bill_source.chunk_text;
|
|
72
|
+
this.description = bill_source.description;
|
|
73
|
+
this.label = bill_source.label;
|
|
74
|
+
this.type = bill_source.type;
|
|
75
|
+
this.vector_key = bill_source.vector_key;
|
|
76
|
+
this.bill = bill_source.bill;
|
|
77
77
|
}
|
|
78
|
-
static is(
|
|
79
|
-
return (
|
|
80
|
-
typeof
|
|
81
|
-
typeof
|
|
82
|
-
typeof
|
|
83
|
-
typeof
|
|
84
|
-
typeof
|
|
85
|
-
Bill.is(
|
|
78
|
+
static is(bill_source) {
|
|
79
|
+
return (bill_source !== undefined &&
|
|
80
|
+
typeof bill_source.chunk_text === "string" &&
|
|
81
|
+
typeof bill_source.description === "string" &&
|
|
82
|
+
typeof bill_source.label === "string" &&
|
|
83
|
+
typeof bill_source.type === "string" &&
|
|
84
|
+
typeof bill_source.vector_key === "string" &&
|
|
85
|
+
Bill.is(bill_source.bill));
|
|
86
86
|
}
|
|
87
87
|
}
|
|
88
88
|
export class GrokSource {
|
package/package.json
CHANGED
package/src/types/Message.ts
CHANGED
|
@@ -94,7 +94,7 @@ export class Message {
|
|
|
94
94
|
(message.fragments === undefined || Array.isArray(message.fragments) && message.fragments.every(Fragment.is)) &&
|
|
95
95
|
(message.sources === undefined || Sources.is(message.sources)) &&
|
|
96
96
|
typeof message.text === "string" &&
|
|
97
|
-
Attachment.is(message.attachment)
|
|
97
|
+
(message.attachment === undefined || Attachment.is(message.attachment))
|
|
98
98
|
)
|
|
99
99
|
}
|
|
100
100
|
}
|
|
@@ -101,19 +101,22 @@ export class ScoutTweetDocument extends ScoutDocument {
|
|
|
101
101
|
}
|
|
102
102
|
|
|
103
103
|
export class ScoutPressDocument extends ScoutDocument {
|
|
104
|
+
readonly url : string
|
|
104
105
|
|
|
105
106
|
constructor(scout_document : any) {
|
|
106
107
|
if (!ScoutPressDocument.is(scout_document)) {
|
|
107
108
|
throw Error("Invalid input.")
|
|
108
109
|
}
|
|
109
110
|
super(scout_document)
|
|
111
|
+
this.url = scout_document.url
|
|
110
112
|
|
|
111
113
|
}
|
|
112
114
|
|
|
113
115
|
static is(scout_document : any) : scout_document is ScoutPressDocument {
|
|
114
116
|
return (
|
|
115
117
|
ScoutDocument.is(scout_document) &&
|
|
116
|
-
scout_document.type === "PRESS"
|
|
118
|
+
scout_document.type === "PRESS" &&
|
|
119
|
+
typeof scout_document.url === "string"
|
|
117
120
|
)
|
|
118
121
|
}
|
|
119
122
|
}
|
package/src/types/Sources.ts
CHANGED
|
@@ -76,27 +76,27 @@ export class BillSource {
|
|
|
76
76
|
readonly vector_key : string
|
|
77
77
|
readonly bill : Bill
|
|
78
78
|
|
|
79
|
-
constructor(
|
|
80
|
-
if (!BillSource.is(
|
|
79
|
+
constructor(bill_source : any) {
|
|
80
|
+
if (!BillSource.is(bill_source)) {
|
|
81
81
|
throw Error("Invalid input.")
|
|
82
82
|
}
|
|
83
|
-
this.chunk_text =
|
|
84
|
-
this.description =
|
|
85
|
-
this.label =
|
|
86
|
-
this.type =
|
|
87
|
-
this.vector_key =
|
|
88
|
-
this.bill =
|
|
83
|
+
this.chunk_text = bill_source.chunk_text
|
|
84
|
+
this.description = bill_source.description
|
|
85
|
+
this.label = bill_source.label
|
|
86
|
+
this.type = bill_source.type
|
|
87
|
+
this.vector_key = bill_source.vector_key
|
|
88
|
+
this.bill = bill_source.bill
|
|
89
89
|
}
|
|
90
90
|
|
|
91
|
-
static is(
|
|
91
|
+
static is(bill_source : any) : bill_source is BillSource {
|
|
92
92
|
return (
|
|
93
|
-
|
|
94
|
-
typeof
|
|
95
|
-
typeof
|
|
96
|
-
typeof
|
|
97
|
-
typeof
|
|
98
|
-
typeof
|
|
99
|
-
Bill.is(
|
|
93
|
+
bill_source !== undefined &&
|
|
94
|
+
typeof bill_source.chunk_text === "string" &&
|
|
95
|
+
typeof bill_source.description === "string" &&
|
|
96
|
+
typeof bill_source.label === "string" &&
|
|
97
|
+
typeof bill_source.type === "string" &&
|
|
98
|
+
typeof bill_source.vector_key === "string" &&
|
|
99
|
+
Bill.is(bill_source.bill)
|
|
100
100
|
)
|
|
101
101
|
}
|
|
102
102
|
}
|