doersiq-types 2.0.0 → 2.0.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/dist/src/types/Bot.d.ts +0 -1
- package/dist/src/types/Bot.js +0 -4
- package/dist/src/types/Conversation.d.ts +0 -2
- package/dist/src/types/Conversation.js +1 -8
- package/dist/src/types/Message.d.ts +1 -9
- package/dist/src/types/Message.js +2 -24
- package/package.json +1 -1
- package/src/types/Bot.ts +0 -4
- package/src/types/Conversation.ts +1 -8
- package/src/types/Message.ts +3 -30
- package/dist/src/Bot.d.ts +0 -28
- package/dist/src/Bot.js +0 -73
- package/dist/src/BotDocument.d.ts +0 -14
- package/dist/src/BotDocument.js +0 -38
- package/dist/src/Conversation.d.ts +0 -16
- package/dist/src/Conversation.js +0 -42
- package/dist/src/DoersAPIError.d.ts +0 -4
- package/dist/src/DoersAPIError.js +0 -18
- package/dist/src/Jurisdiction.d.ts +0 -22
- package/dist/src/Jurisdiction.js +0 -53
- package/dist/src/JurisdictionDocument.d.ts +0 -15
- package/dist/src/JurisdictionDocument.js +0 -44
- package/dist/src/Message.d.ts +0 -29
- package/dist/src/Message.js +0 -79
- package/dist/src/OfficeClass.d.ts +0 -17
- package/dist/src/OfficeClass.js +0 -131
- package/dist/src/Party.d.ts +0 -10
- package/dist/src/Party.js +0 -26
- package/dist/src/Sources.d.ts +0 -38
- package/dist/src/Sources.js +0 -105
- package/dist/src/State.d.ts +0 -10
- package/dist/src/State.js +0 -256
- package/dist/src/Tweet.d.ts +0 -11
- package/dist/src/Tweet.js +0 -32
- package/dist/src/User.d.ts +0 -15
- package/dist/src/User.js +0 -39
package/dist/src/types/Bot.d.ts
CHANGED
|
@@ -12,7 +12,6 @@ export declare class Bot {
|
|
|
12
12
|
readonly district?: number;
|
|
13
13
|
readonly party_id: PartyID;
|
|
14
14
|
readonly tone_description_refresh: boolean;
|
|
15
|
-
readonly topics: string[];
|
|
16
15
|
readonly jurisdiction_ids: number[];
|
|
17
16
|
readonly office_class_id: OfficeClassID;
|
|
18
17
|
readonly office_name?: string;
|
package/dist/src/types/Bot.js
CHANGED
|
@@ -12,7 +12,6 @@ export class Bot {
|
|
|
12
12
|
district;
|
|
13
13
|
party_id;
|
|
14
14
|
tone_description_refresh;
|
|
15
|
-
topics;
|
|
16
15
|
jurisdiction_ids;
|
|
17
16
|
office_class_id;
|
|
18
17
|
office_name;
|
|
@@ -29,7 +28,6 @@ export class Bot {
|
|
|
29
28
|
this.district = bot.district;
|
|
30
29
|
this.party_id = bot.party_id;
|
|
31
30
|
this.tone_description_refresh = bot.tone_description_refresh;
|
|
32
|
-
this.topics = bot.topics;
|
|
33
31
|
this.jurisdiction_ids = bot.jurisdiction_ids;
|
|
34
32
|
this.office_class_id = bot.office_class_id;
|
|
35
33
|
this.office_name = bot.office_name;
|
|
@@ -45,8 +43,6 @@ export class Bot {
|
|
|
45
43
|
(bot.district === undefined || typeof bot.district === "number") &&
|
|
46
44
|
is_party_id(bot.party_id) &&
|
|
47
45
|
typeof bot.tone_description_refresh === "boolean" &&
|
|
48
|
-
Array.isArray(bot.topics) &&
|
|
49
|
-
bot.topics.every((topic) => typeof topic === "string") &&
|
|
50
46
|
Array.isArray(bot.jurisdiction_ids) &&
|
|
51
47
|
bot.jurisdiction_ids.every((jurisdiction_id) => typeof jurisdiction_id === "number") &&
|
|
52
48
|
is_office_class_id(bot.office_class_id) &&
|
|
@@ -4,8 +4,6 @@ export declare class Conversation {
|
|
|
4
4
|
readonly conversation_id: string;
|
|
5
5
|
readonly bot_id: string;
|
|
6
6
|
readonly time: string;
|
|
7
|
-
readonly mode: "email" | "general";
|
|
8
|
-
readonly topics?: string[];
|
|
9
7
|
readonly [x: string]: any;
|
|
10
8
|
constructor(conversation: any);
|
|
11
9
|
static is(conversation: any): conversation is Conversation;
|
|
@@ -4,8 +4,6 @@ export class Conversation {
|
|
|
4
4
|
conversation_id;
|
|
5
5
|
bot_id;
|
|
6
6
|
time;
|
|
7
|
-
mode;
|
|
8
|
-
topics;
|
|
9
7
|
constructor(conversation) {
|
|
10
8
|
if (!Conversation.is(conversation)) {
|
|
11
9
|
throw Error("Invalid input.");
|
|
@@ -14,18 +12,13 @@ export class Conversation {
|
|
|
14
12
|
this.conversation_id = conversation.conversation_id;
|
|
15
13
|
this.bot_id = conversation.bot_id;
|
|
16
14
|
this.time = conversation.time;
|
|
17
|
-
this.mode = conversation.mode;
|
|
18
|
-
this.topics = conversation.topics;
|
|
19
15
|
}
|
|
20
16
|
static is(conversation) {
|
|
21
17
|
return (conversation !== undefined &&
|
|
22
18
|
typeof conversation.user_id === "string" &&
|
|
23
19
|
typeof conversation.conversation_id === "string" &&
|
|
24
20
|
typeof conversation.bot_id === "string" &&
|
|
25
|
-
typeof conversation.time === "string"
|
|
26
|
-
["email", "general"].includes(conversation.mode) &&
|
|
27
|
-
(conversation.topics === undefined || Array.isArray(conversation.topics) &&
|
|
28
|
-
conversation.topics.every((topic) => typeof topic === "string")));
|
|
21
|
+
typeof conversation.time === "string");
|
|
29
22
|
}
|
|
30
23
|
}
|
|
31
24
|
export class ConversationAux extends Conversation {
|
|
@@ -5,27 +5,19 @@ export declare class Fragment {
|
|
|
5
5
|
constructor(fragment: any);
|
|
6
6
|
static is(fragment: any): fragment is Fragment;
|
|
7
7
|
}
|
|
8
|
-
export declare class Post {
|
|
9
|
-
text: string;
|
|
10
|
-
s3_image_filename?: string;
|
|
11
|
-
s3_image_url?: string;
|
|
12
|
-
constructor(post: any);
|
|
13
|
-
static is(post: any): post is Post;
|
|
14
|
-
}
|
|
15
8
|
export declare class Message {
|
|
16
9
|
readonly user_id: string;
|
|
17
10
|
readonly message_id: string;
|
|
18
11
|
readonly bot_id: string;
|
|
19
12
|
readonly conversation_id: string;
|
|
20
13
|
readonly time: string;
|
|
21
|
-
readonly mode: "
|
|
14
|
+
readonly mode: "chat" | "write";
|
|
22
15
|
readonly role: "user" | "bot";
|
|
23
16
|
readonly system_prompt?: string;
|
|
24
17
|
readonly grok_text?: string;
|
|
25
18
|
readonly fragments?: Fragment[];
|
|
26
19
|
readonly sources?: Sources;
|
|
27
20
|
readonly text: string;
|
|
28
|
-
readonly posts?: Post[];
|
|
29
21
|
constructor(message: any);
|
|
30
22
|
static is(message: any): message is Message;
|
|
31
23
|
}
|
|
@@ -15,25 +15,6 @@ export class Fragment {
|
|
|
15
15
|
Sources.is(fragment.sources));
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
|
-
export class Post {
|
|
19
|
-
text;
|
|
20
|
-
s3_image_filename;
|
|
21
|
-
s3_image_url;
|
|
22
|
-
constructor(post) {
|
|
23
|
-
if (!Post.is(post)) {
|
|
24
|
-
throw Error("Invalid input.");
|
|
25
|
-
}
|
|
26
|
-
this.text = post.text;
|
|
27
|
-
this.s3_image_filename = post.s3_image_filename;
|
|
28
|
-
this.s3_image_url = post.s3_image_url;
|
|
29
|
-
}
|
|
30
|
-
static is(post) {
|
|
31
|
-
return (post !== undefined &&
|
|
32
|
-
typeof post.text === "string" &&
|
|
33
|
-
(post.s3_image_filename === undefined || typeof post.s3_image_filename === "string") &&
|
|
34
|
-
(post.s3_image_url === undefined || typeof post.s3_image_url === "string"));
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
18
|
export class Message {
|
|
38
19
|
user_id;
|
|
39
20
|
message_id;
|
|
@@ -47,7 +28,6 @@ export class Message {
|
|
|
47
28
|
fragments;
|
|
48
29
|
sources;
|
|
49
30
|
text;
|
|
50
|
-
posts;
|
|
51
31
|
constructor(message) {
|
|
52
32
|
if (!Message.is(message)) {
|
|
53
33
|
throw Error("Invalid input.");
|
|
@@ -64,7 +44,6 @@ export class Message {
|
|
|
64
44
|
this.fragments = message.fragments;
|
|
65
45
|
this.sources = message.sources;
|
|
66
46
|
this.text = message.text;
|
|
67
|
-
this.posts = message.posts;
|
|
68
47
|
}
|
|
69
48
|
static is(message) {
|
|
70
49
|
return (message !== undefined &&
|
|
@@ -73,13 +52,12 @@ export class Message {
|
|
|
73
52
|
typeof message.bot_id === "string" &&
|
|
74
53
|
typeof message.conversation_id === "string" &&
|
|
75
54
|
typeof message.time === "string" &&
|
|
76
|
-
["
|
|
55
|
+
["chat", "write"].includes(message.mode) &&
|
|
77
56
|
["user", "bot"].includes(message.role) &&
|
|
78
57
|
(message.system_prompt === undefined || typeof message.system_prompt === "string") &&
|
|
79
58
|
(message.grok_text === undefined || typeof message.grok_text === "string") &&
|
|
80
59
|
(message.fragments === undefined || Array.isArray(message.fragments) && message.fragments.every(Fragment.is)) &&
|
|
81
60
|
(message.sources === undefined || Sources.is(message.sources)) &&
|
|
82
|
-
typeof message.text === "string"
|
|
83
|
-
(message.posts === undefined || Array.isArray(message.posts) && message.posts.every(Post.is)));
|
|
61
|
+
typeof message.text === "string");
|
|
84
62
|
}
|
|
85
63
|
}
|
package/package.json
CHANGED
package/src/types/Bot.ts
CHANGED
|
@@ -13,7 +13,6 @@ export class Bot {
|
|
|
13
13
|
readonly district? : number
|
|
14
14
|
readonly party_id : PartyID
|
|
15
15
|
readonly tone_description_refresh : boolean
|
|
16
|
-
readonly topics : string[]
|
|
17
16
|
readonly jurisdiction_ids : number[]
|
|
18
17
|
readonly office_class_id : OfficeClassID
|
|
19
18
|
readonly office_name? : string
|
|
@@ -32,7 +31,6 @@ export class Bot {
|
|
|
32
31
|
this.district = bot.district
|
|
33
32
|
this.party_id = bot.party_id
|
|
34
33
|
this.tone_description_refresh = bot.tone_description_refresh
|
|
35
|
-
this.topics = bot.topics
|
|
36
34
|
this.jurisdiction_ids = bot.jurisdiction_ids
|
|
37
35
|
this.office_class_id = bot.office_class_id
|
|
38
36
|
this.office_name = bot.office_name
|
|
@@ -50,8 +48,6 @@ export class Bot {
|
|
|
50
48
|
(bot.district === undefined || typeof bot.district === "number") &&
|
|
51
49
|
is_party_id(bot.party_id) &&
|
|
52
50
|
typeof bot.tone_description_refresh === "boolean" &&
|
|
53
|
-
Array.isArray(bot.topics) &&
|
|
54
|
-
bot.topics.every((topic : any) => typeof topic === "string") &&
|
|
55
51
|
Array.isArray(bot.jurisdiction_ids) &&
|
|
56
52
|
bot.jurisdiction_ids.every((jurisdiction_id : any) => typeof jurisdiction_id === "number") &&
|
|
57
53
|
is_office_class_id(bot.office_class_id) &&
|
|
@@ -5,8 +5,6 @@ export class Conversation {
|
|
|
5
5
|
readonly conversation_id : string
|
|
6
6
|
readonly bot_id : string
|
|
7
7
|
readonly time : string
|
|
8
|
-
readonly mode : "email" | "general"
|
|
9
|
-
readonly topics? : string[]
|
|
10
8
|
readonly [x : string] : any
|
|
11
9
|
|
|
12
10
|
constructor(conversation : any) {
|
|
@@ -17,8 +15,6 @@ export class Conversation {
|
|
|
17
15
|
this.conversation_id = conversation.conversation_id
|
|
18
16
|
this.bot_id = conversation.bot_id
|
|
19
17
|
this.time = conversation.time
|
|
20
|
-
this.mode = conversation.mode
|
|
21
|
-
this.topics = conversation.topics
|
|
22
18
|
}
|
|
23
19
|
|
|
24
20
|
static is(conversation : any) : conversation is Conversation {
|
|
@@ -27,10 +23,7 @@ export class Conversation {
|
|
|
27
23
|
typeof conversation.user_id === "string" &&
|
|
28
24
|
typeof conversation.conversation_id === "string" &&
|
|
29
25
|
typeof conversation.bot_id === "string" &&
|
|
30
|
-
typeof conversation.time === "string"
|
|
31
|
-
["email", "general"].includes(conversation.mode) &&
|
|
32
|
-
(conversation.topics === undefined || Array.isArray(conversation.topics) &&
|
|
33
|
-
conversation.topics.every((topic : any) => typeof topic === "string"))
|
|
26
|
+
typeof conversation.time === "string"
|
|
34
27
|
)
|
|
35
28
|
}
|
|
36
29
|
}
|
package/src/types/Message.ts
CHANGED
|
@@ -21,44 +21,19 @@ export class Fragment {
|
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
export class Post {
|
|
25
|
-
text : string
|
|
26
|
-
s3_image_filename? : string
|
|
27
|
-
s3_image_url? : string
|
|
28
|
-
|
|
29
|
-
constructor(post : any) {
|
|
30
|
-
if (!Post.is(post)) {
|
|
31
|
-
throw Error("Invalid input.")
|
|
32
|
-
}
|
|
33
|
-
this.text = post.text
|
|
34
|
-
this.s3_image_filename = post.s3_image_filename
|
|
35
|
-
this.s3_image_url = post.s3_image_url
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
static is(post : any) : post is Post {
|
|
39
|
-
return (
|
|
40
|
-
post !== undefined &&
|
|
41
|
-
typeof post.text === "string" &&
|
|
42
|
-
(post.s3_image_filename === undefined || typeof post.s3_image_filename === "string") &&
|
|
43
|
-
(post.s3_image_url === undefined || typeof post.s3_image_url === "string")
|
|
44
|
-
)
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
24
|
export class Message {
|
|
49
25
|
readonly user_id : string
|
|
50
26
|
readonly message_id : string
|
|
51
27
|
readonly bot_id : string
|
|
52
28
|
readonly conversation_id : string
|
|
53
29
|
readonly time : string
|
|
54
|
-
readonly mode : "
|
|
30
|
+
readonly mode : "chat" | "write"
|
|
55
31
|
readonly role : "user" | "bot"
|
|
56
32
|
readonly system_prompt? : string
|
|
57
33
|
readonly grok_text? : string
|
|
58
34
|
readonly fragments? : Fragment[]
|
|
59
35
|
readonly sources? : Sources
|
|
60
36
|
readonly text : string
|
|
61
|
-
readonly posts? : Post[]
|
|
62
37
|
|
|
63
38
|
constructor(message : any) {
|
|
64
39
|
if (!Message.is(message)) {
|
|
@@ -76,7 +51,6 @@ export class Message {
|
|
|
76
51
|
this.fragments = message.fragments
|
|
77
52
|
this.sources = message.sources
|
|
78
53
|
this.text = message.text
|
|
79
|
-
this.posts = message.posts
|
|
80
54
|
}
|
|
81
55
|
|
|
82
56
|
static is(message : any) : message is Message {
|
|
@@ -87,14 +61,13 @@ export class Message {
|
|
|
87
61
|
typeof message.bot_id === "string" &&
|
|
88
62
|
typeof message.conversation_id === "string" &&
|
|
89
63
|
typeof message.time === "string" &&
|
|
90
|
-
["
|
|
64
|
+
["chat", "write"].includes(message.mode) &&
|
|
91
65
|
["user", "bot"].includes(message.role) &&
|
|
92
66
|
(message.system_prompt === undefined || typeof message.system_prompt === "string") &&
|
|
93
67
|
(message.grok_text === undefined || typeof message.grok_text === "string") &&
|
|
94
68
|
(message.fragments === undefined || Array.isArray(message.fragments) && message.fragments.every(Fragment.is)) &&
|
|
95
69
|
(message.sources === undefined || Sources.is(message.sources)) &&
|
|
96
|
-
typeof message.text === "string"
|
|
97
|
-
(message.posts === undefined || Array.isArray(message.posts) && message.posts.every(Post.is))
|
|
70
|
+
typeof message.text === "string"
|
|
98
71
|
)
|
|
99
72
|
}
|
|
100
73
|
}
|
package/dist/src/Bot.d.ts
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { OfficeClassID } from "./OfficeClass.js";
|
|
2
|
-
import { Jurisdiction } from "./Jurisdiction.js";
|
|
3
|
-
import { StateID } from "./State.js";
|
|
4
|
-
import { PartyID } from "./Party.js";
|
|
5
|
-
export declare class Bot {
|
|
6
|
-
readonly office_id: string;
|
|
7
|
-
readonly number: string;
|
|
8
|
-
readonly bot_id: string;
|
|
9
|
-
readonly name: string;
|
|
10
|
-
readonly active: boolean;
|
|
11
|
-
readonly state_id: StateID;
|
|
12
|
-
readonly district?: number;
|
|
13
|
-
readonly party_id: PartyID;
|
|
14
|
-
readonly guidelines: string;
|
|
15
|
-
readonly topics: string[];
|
|
16
|
-
readonly jurisdiction_ids: number[];
|
|
17
|
-
readonly office_class_id: OfficeClassID;
|
|
18
|
-
readonly office_name?: string;
|
|
19
|
-
readonly [x: string]: any;
|
|
20
|
-
constructor(bot: any);
|
|
21
|
-
static is(bot: any): bot is Bot;
|
|
22
|
-
}
|
|
23
|
-
export declare class BotAux extends Bot {
|
|
24
|
-
readonly jurisdictions: Jurisdiction[];
|
|
25
|
-
readonly photo_download_url?: string;
|
|
26
|
-
constructor(bot: any);
|
|
27
|
-
static is(bot: any): bot is BotAux;
|
|
28
|
-
}
|
package/dist/src/Bot.js
DELETED
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import { is_office_class_id } from "./OfficeClass.js";
|
|
2
|
-
import { Jurisdiction } from "./Jurisdiction.js";
|
|
3
|
-
import { is_state_id } from "./State.js";
|
|
4
|
-
import { is_party_id } from "./Party.js";
|
|
5
|
-
export class Bot {
|
|
6
|
-
office_id;
|
|
7
|
-
number;
|
|
8
|
-
bot_id;
|
|
9
|
-
name;
|
|
10
|
-
active;
|
|
11
|
-
state_id;
|
|
12
|
-
district;
|
|
13
|
-
party_id;
|
|
14
|
-
guidelines;
|
|
15
|
-
topics;
|
|
16
|
-
jurisdiction_ids;
|
|
17
|
-
office_class_id;
|
|
18
|
-
office_name;
|
|
19
|
-
constructor(bot) {
|
|
20
|
-
if (!Bot.is(bot)) {
|
|
21
|
-
throw Error("Invalid input.");
|
|
22
|
-
}
|
|
23
|
-
this.office_id = bot.office_id;
|
|
24
|
-
this.number = bot.number;
|
|
25
|
-
this.bot_id = bot.bot_id;
|
|
26
|
-
this.name = bot.name;
|
|
27
|
-
this.active = bot.active;
|
|
28
|
-
this.state_id = bot.state_id;
|
|
29
|
-
this.district = bot.district;
|
|
30
|
-
this.party_id = bot.party_id;
|
|
31
|
-
this.guidelines = bot.guidelines;
|
|
32
|
-
this.topics = bot.topics;
|
|
33
|
-
this.jurisdiction_ids = bot.jurisdiction_ids;
|
|
34
|
-
this.office_class_id = bot.office_class_id;
|
|
35
|
-
this.office_name = bot.office_name;
|
|
36
|
-
}
|
|
37
|
-
static is(bot) {
|
|
38
|
-
return (bot !== undefined &&
|
|
39
|
-
typeof bot.office_id === "string" &&
|
|
40
|
-
typeof bot.number === "string" &&
|
|
41
|
-
typeof bot.bot_id === "string" &&
|
|
42
|
-
typeof bot.name === "string" &&
|
|
43
|
-
typeof bot.active === "boolean" &&
|
|
44
|
-
is_state_id(bot.state_id) &&
|
|
45
|
-
(bot.district === undefined || typeof bot.district === "number") &&
|
|
46
|
-
is_party_id(bot.party_id) &&
|
|
47
|
-
typeof bot.guidelines === "string" &&
|
|
48
|
-
Array.isArray(bot.topics) &&
|
|
49
|
-
bot.topics.every((topic) => typeof topic === "string") &&
|
|
50
|
-
Array.isArray(bot.jurisdiction_ids) &&
|
|
51
|
-
bot.jurisdiction_ids.every((jurisdiction_id) => typeof jurisdiction_id === "number") &&
|
|
52
|
-
is_office_class_id(bot.office_class_id) &&
|
|
53
|
-
(bot.office_name === undefined || typeof bot.office_name === "string"));
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
export class BotAux extends Bot {
|
|
57
|
-
jurisdictions;
|
|
58
|
-
photo_download_url;
|
|
59
|
-
constructor(bot) {
|
|
60
|
-
if (!BotAux.is(bot)) {
|
|
61
|
-
throw Error("Invalid input.");
|
|
62
|
-
}
|
|
63
|
-
super(bot);
|
|
64
|
-
this.jurisdictions = bot.jurisdictions;
|
|
65
|
-
this.photo_download_url = bot.photo_download_url;
|
|
66
|
-
}
|
|
67
|
-
static is(bot) {
|
|
68
|
-
return (Bot.is(bot) &&
|
|
69
|
-
Array.isArray(bot.jurisdictions) &&
|
|
70
|
-
bot.jurisdictions.every(Jurisdiction.is) &&
|
|
71
|
-
(bot.photo_download_url === undefined || typeof bot.photo_download_url === "string"));
|
|
72
|
-
}
|
|
73
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { Tweet } from "./Tweet.js";
|
|
2
|
-
export declare class BotDocument {
|
|
3
|
-
readonly bot_id: string;
|
|
4
|
-
readonly document_id: string;
|
|
5
|
-
readonly type: "URL" | "TWEET" | "TWITTER";
|
|
6
|
-
readonly s3_filename?: string;
|
|
7
|
-
readonly url?: string;
|
|
8
|
-
readonly username?: string;
|
|
9
|
-
readonly vector_keys?: string[];
|
|
10
|
-
readonly tweet?: Tweet;
|
|
11
|
-
readonly text?: string;
|
|
12
|
-
constructor(bot_document: any);
|
|
13
|
-
static is(bot_document: any): bot_document is BotDocument;
|
|
14
|
-
}
|
package/dist/src/BotDocument.js
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { Tweet } from "./Tweet.js";
|
|
2
|
-
export class BotDocument {
|
|
3
|
-
bot_id;
|
|
4
|
-
document_id;
|
|
5
|
-
type;
|
|
6
|
-
s3_filename;
|
|
7
|
-
url;
|
|
8
|
-
username;
|
|
9
|
-
vector_keys;
|
|
10
|
-
tweet;
|
|
11
|
-
text;
|
|
12
|
-
constructor(bot_document) {
|
|
13
|
-
if (!BotDocument.is(bot_document)) {
|
|
14
|
-
throw Error("Invalid input.");
|
|
15
|
-
}
|
|
16
|
-
this.bot_id = bot_document.bot_id;
|
|
17
|
-
this.document_id = bot_document.document_id;
|
|
18
|
-
this.type = bot_document.type;
|
|
19
|
-
this.s3_filename = bot_document.s3_filename;
|
|
20
|
-
this.url = bot_document.url;
|
|
21
|
-
this.username = bot_document.username;
|
|
22
|
-
this.vector_keys = bot_document.vector_keys;
|
|
23
|
-
this.tweet = bot_document.tweet;
|
|
24
|
-
this.text = bot_document.text;
|
|
25
|
-
}
|
|
26
|
-
static is(bot_document) {
|
|
27
|
-
return (bot_document !== undefined &&
|
|
28
|
-
typeof bot_document.bot_id === "string" &&
|
|
29
|
-
typeof bot_document.document_id === "string" &&
|
|
30
|
-
typeof bot_document.type === "string" &&
|
|
31
|
-
(bot_document.s3_filename === undefined || typeof bot_document.s3_filename === "string") &&
|
|
32
|
-
(bot_document.url === undefined || typeof bot_document.url === "string") &&
|
|
33
|
-
(bot_document.username === undefined || typeof bot_document.username === "string") &&
|
|
34
|
-
(bot_document.vector_keys === undefined || Array.isArray(bot_document.vector_keys) && bot_document.vector_keys.every((vector_key) => typeof vector_key === "string")) &&
|
|
35
|
-
(bot_document.tweet === undefined || Tweet.is(bot_document.tweet)) &&
|
|
36
|
-
(bot_document.text === undefined || typeof bot_document.text === "string"));
|
|
37
|
-
}
|
|
38
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { Message } from "./Message.js";
|
|
2
|
-
export declare class Conversation {
|
|
3
|
-
readonly user_id: string;
|
|
4
|
-
readonly conversation_id: string;
|
|
5
|
-
readonly bot_id: string;
|
|
6
|
-
readonly mode: "email" | "general";
|
|
7
|
-
readonly topics?: string[];
|
|
8
|
-
readonly [x: string]: any;
|
|
9
|
-
constructor(conversation: any);
|
|
10
|
-
static is(conversation: any): conversation is Conversation;
|
|
11
|
-
}
|
|
12
|
-
export declare class ConversationAux extends Conversation {
|
|
13
|
-
readonly messages: Message[];
|
|
14
|
-
constructor(conversation: any);
|
|
15
|
-
static is(conversation: any): conversation is ConversationAux;
|
|
16
|
-
}
|
package/dist/src/Conversation.js
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { Message } from "./Message.js";
|
|
2
|
-
export class Conversation {
|
|
3
|
-
user_id;
|
|
4
|
-
conversation_id;
|
|
5
|
-
bot_id;
|
|
6
|
-
mode;
|
|
7
|
-
topics;
|
|
8
|
-
constructor(conversation) {
|
|
9
|
-
if (!Conversation.is(conversation)) {
|
|
10
|
-
throw Error("Invalid input.");
|
|
11
|
-
}
|
|
12
|
-
this.user_id = conversation.user_id;
|
|
13
|
-
this.conversation_id = conversation.conversation_id;
|
|
14
|
-
this.bot_id = conversation.bot_id;
|
|
15
|
-
this.mode = conversation.mode;
|
|
16
|
-
this.topics = conversation.topics;
|
|
17
|
-
}
|
|
18
|
-
static is(conversation) {
|
|
19
|
-
return (conversation !== undefined &&
|
|
20
|
-
typeof conversation.user_id === "string" &&
|
|
21
|
-
typeof conversation.conversation_id === "string" &&
|
|
22
|
-
typeof conversation.bot_id === "string" &&
|
|
23
|
-
["email", "general"].includes(conversation.mode) &&
|
|
24
|
-
(conversation.topics === undefined || Array.isArray(conversation.topics) &&
|
|
25
|
-
conversation.topics.every((topic) => typeof topic === "string")));
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
export class ConversationAux extends Conversation {
|
|
29
|
-
messages;
|
|
30
|
-
constructor(conversation) {
|
|
31
|
-
if (!ConversationAux.is(conversation)) {
|
|
32
|
-
throw Error("Invalid input.");
|
|
33
|
-
}
|
|
34
|
-
super(conversation);
|
|
35
|
-
this.messages = conversation.messages;
|
|
36
|
-
}
|
|
37
|
-
static is(conversation) {
|
|
38
|
-
return (Conversation.is(conversation) &&
|
|
39
|
-
Array.isArray(conversation.messages) &&
|
|
40
|
-
conversation.messages.every(Message.is));
|
|
41
|
-
}
|
|
42
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
const default_messages_by_status = {
|
|
2
|
-
400: "Bad Request",
|
|
3
|
-
401: "Unauthorized",
|
|
4
|
-
403: "Forbidden",
|
|
5
|
-
404: "Not Found",
|
|
6
|
-
405: "Method Not Allowed",
|
|
7
|
-
500: "Internal Server Error",
|
|
8
|
-
600: "Failed to Parse Output"
|
|
9
|
-
};
|
|
10
|
-
export class DoersAPIError extends Error {
|
|
11
|
-
status;
|
|
12
|
-
constructor(status, message) {
|
|
13
|
-
const default_message = default_messages_by_status[status];
|
|
14
|
-
super(message !== undefined ? message : default_message !== undefined ? default_message : "Error");
|
|
15
|
-
this.name = "DoersAPIError";
|
|
16
|
-
this.status = status;
|
|
17
|
-
}
|
|
18
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
export declare enum JurisdictionLevel {
|
|
2
|
-
SCHOOL = 0,
|
|
3
|
-
NATION = 1,
|
|
4
|
-
STATE = 2,
|
|
5
|
-
COUNTY = 3,
|
|
6
|
-
CITY = 4
|
|
7
|
-
}
|
|
8
|
-
export declare function is_jurisdiction_level(jurisdiction_level: any): jurisdiction_level is JurisdictionLevel;
|
|
9
|
-
export declare class Jurisdiction {
|
|
10
|
-
readonly jurisdiction_id: number;
|
|
11
|
-
readonly name: string;
|
|
12
|
-
readonly path: number[];
|
|
13
|
-
readonly sub_jurisdiction_ids: number[];
|
|
14
|
-
readonly super_jurisdiction_id?: number;
|
|
15
|
-
readonly level: JurisdictionLevel;
|
|
16
|
-
readonly state_jurisdiction_id?: number;
|
|
17
|
-
readonly county_jurisdiction_id?: number;
|
|
18
|
-
readonly city_jurisdiction_id?: number;
|
|
19
|
-
readonly geographic: boolean;
|
|
20
|
-
constructor(jurisdiction: any);
|
|
21
|
-
static is(jurisdiction: any): jurisdiction is Jurisdiction;
|
|
22
|
-
}
|
package/dist/src/Jurisdiction.js
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
export var JurisdictionLevel;
|
|
2
|
-
(function (JurisdictionLevel) {
|
|
3
|
-
JurisdictionLevel[JurisdictionLevel["SCHOOL"] = 0] = "SCHOOL";
|
|
4
|
-
JurisdictionLevel[JurisdictionLevel["NATION"] = 1] = "NATION";
|
|
5
|
-
JurisdictionLevel[JurisdictionLevel["STATE"] = 2] = "STATE";
|
|
6
|
-
JurisdictionLevel[JurisdictionLevel["COUNTY"] = 3] = "COUNTY";
|
|
7
|
-
JurisdictionLevel[JurisdictionLevel["CITY"] = 4] = "CITY";
|
|
8
|
-
})(JurisdictionLevel || (JurisdictionLevel = {}));
|
|
9
|
-
export function is_jurisdiction_level(jurisdiction_level) {
|
|
10
|
-
return [0, 1, 2, 3, 4].includes(jurisdiction_level);
|
|
11
|
-
}
|
|
12
|
-
export class Jurisdiction {
|
|
13
|
-
jurisdiction_id;
|
|
14
|
-
name;
|
|
15
|
-
path;
|
|
16
|
-
sub_jurisdiction_ids;
|
|
17
|
-
super_jurisdiction_id;
|
|
18
|
-
level;
|
|
19
|
-
state_jurisdiction_id;
|
|
20
|
-
county_jurisdiction_id;
|
|
21
|
-
city_jurisdiction_id;
|
|
22
|
-
geographic;
|
|
23
|
-
constructor(jurisdiction) {
|
|
24
|
-
if (!Jurisdiction.is(jurisdiction)) {
|
|
25
|
-
throw Error("Invalid input.");
|
|
26
|
-
}
|
|
27
|
-
this.jurisdiction_id = jurisdiction.jurisdiction_id;
|
|
28
|
-
this.name = jurisdiction.name;
|
|
29
|
-
this.path = jurisdiction.path;
|
|
30
|
-
this.sub_jurisdiction_ids = jurisdiction.sub_jurisdiction_ids;
|
|
31
|
-
this.super_jurisdiction_id = jurisdiction.super_jurisdiction_id;
|
|
32
|
-
this.level = jurisdiction.level;
|
|
33
|
-
this.state_jurisdiction_id = jurisdiction.state_jurisdiction_id;
|
|
34
|
-
this.county_jurisdiction_id = jurisdiction.county_jurisdiction_id;
|
|
35
|
-
this.city_jurisdiction_id = jurisdiction.city_jurisdiction_id;
|
|
36
|
-
this.geographic = jurisdiction.geographic;
|
|
37
|
-
}
|
|
38
|
-
static is(jurisdiction) {
|
|
39
|
-
return (jurisdiction !== undefined &&
|
|
40
|
-
typeof jurisdiction.jurisdiction_id === "number" &&
|
|
41
|
-
typeof jurisdiction.name === "string" &&
|
|
42
|
-
Array.isArray(jurisdiction.path) &&
|
|
43
|
-
jurisdiction.path.every((jurisdiction_id) => typeof jurisdiction_id === "number") &&
|
|
44
|
-
Array.isArray(jurisdiction.sub_jurisdiction_ids) &&
|
|
45
|
-
jurisdiction.sub_jurisdiction_ids.every((jurisdiction_id) => typeof jurisdiction_id === "number") &&
|
|
46
|
-
is_jurisdiction_level(jurisdiction.level) &&
|
|
47
|
-
typeof jurisdiction.geographic === "boolean" &&
|
|
48
|
-
(jurisdiction.super_jurisdiction_id === undefined || typeof jurisdiction.super_jurisdiction_id === "number") &&
|
|
49
|
-
(jurisdiction.state_jurisdiction_id === undefined || typeof jurisdiction.state_jurisdiction_id === "number") &&
|
|
50
|
-
(jurisdiction.county_jurisdiction_id === undefined || typeof jurisdiction.county_jurisdiction_id === "number") &&
|
|
51
|
-
(jurisdiction.city_jurisdiction_id === undefined || typeof jurisdiction.city_jurisdiction_id === "number"));
|
|
52
|
-
}
|
|
53
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export declare class JurisdictionDocument {
|
|
2
|
-
readonly jurisdiction_id: number;
|
|
3
|
-
readonly document_id: string;
|
|
4
|
-
readonly media_id: string;
|
|
5
|
-
readonly origin: string;
|
|
6
|
-
readonly s3_filename?: string;
|
|
7
|
-
readonly time?: string;
|
|
8
|
-
readonly title: string;
|
|
9
|
-
readonly type: string;
|
|
10
|
-
readonly url: string;
|
|
11
|
-
readonly vector_keys?: string[];
|
|
12
|
-
readonly location?: string;
|
|
13
|
-
constructor(jurisdiction_document: any);
|
|
14
|
-
static is(jurisdiction_document: any): jurisdiction_document is JurisdictionDocument;
|
|
15
|
-
}
|