scout-types 1.0.13 → 1.0.15
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.
|
@@ -5,6 +5,13 @@ export declare class Fragment {
|
|
|
5
5
|
constructor(fragment: any);
|
|
6
6
|
static is(fragment: any): fragment is Fragment;
|
|
7
7
|
}
|
|
8
|
+
export declare class Attachment {
|
|
9
|
+
readonly type: string;
|
|
10
|
+
readonly filename: string;
|
|
11
|
+
readonly s3_filename: string;
|
|
12
|
+
constructor(attachment: any);
|
|
13
|
+
static is(attachment: any): attachment is Attachment;
|
|
14
|
+
}
|
|
8
15
|
export declare class Message {
|
|
9
16
|
readonly user_id: string;
|
|
10
17
|
readonly message_id: string;
|
|
@@ -18,6 +25,7 @@ export declare class Message {
|
|
|
18
25
|
readonly fragments?: Fragment[];
|
|
19
26
|
readonly sources?: Sources;
|
|
20
27
|
readonly text: string;
|
|
28
|
+
readonly attachment?: Attachment;
|
|
21
29
|
constructor(message: any);
|
|
22
30
|
static is(message: any): message is Message;
|
|
23
31
|
}
|
|
@@ -15,6 +15,25 @@ export class Fragment {
|
|
|
15
15
|
Sources.is(fragment.sources));
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
|
+
export class Attachment {
|
|
19
|
+
type;
|
|
20
|
+
filename;
|
|
21
|
+
s3_filename;
|
|
22
|
+
constructor(attachment) {
|
|
23
|
+
if (!Attachment.is(attachment)) {
|
|
24
|
+
throw Error("Invalid input.");
|
|
25
|
+
}
|
|
26
|
+
this.type = attachment.type;
|
|
27
|
+
this.filename = attachment.filename;
|
|
28
|
+
this.s3_filename = attachment.s3_filename;
|
|
29
|
+
}
|
|
30
|
+
static is(attachment) {
|
|
31
|
+
return (attachment !== undefined &&
|
|
32
|
+
typeof attachment.text === "string" &&
|
|
33
|
+
typeof attachment.filename === "string" &&
|
|
34
|
+
typeof attachment.s3_filename === "string");
|
|
35
|
+
}
|
|
36
|
+
}
|
|
18
37
|
export class Message {
|
|
19
38
|
user_id;
|
|
20
39
|
message_id;
|
|
@@ -28,6 +47,7 @@ export class Message {
|
|
|
28
47
|
fragments;
|
|
29
48
|
sources;
|
|
30
49
|
text;
|
|
50
|
+
attachment;
|
|
31
51
|
constructor(message) {
|
|
32
52
|
if (!Message.is(message)) {
|
|
33
53
|
throw Error("Invalid input.");
|
|
@@ -44,6 +64,7 @@ export class Message {
|
|
|
44
64
|
this.fragments = message.fragments;
|
|
45
65
|
this.sources = message.sources;
|
|
46
66
|
this.text = message.text;
|
|
67
|
+
this.attachment = message.attachment;
|
|
47
68
|
}
|
|
48
69
|
static is(message) {
|
|
49
70
|
return (message !== undefined &&
|
|
@@ -58,6 +79,7 @@ export class Message {
|
|
|
58
79
|
(message.grok_text === undefined || typeof message.grok_text === "string") &&
|
|
59
80
|
(message.fragments === undefined || Array.isArray(message.fragments) && message.fragments.every(Fragment.is)) &&
|
|
60
81
|
(message.sources === undefined || Sources.is(message.sources)) &&
|
|
61
|
-
typeof message.text === "string"
|
|
82
|
+
typeof message.text === "string" &&
|
|
83
|
+
Attachment.is(message.attachment));
|
|
62
84
|
}
|
|
63
85
|
}
|
|
@@ -13,7 +13,7 @@ export declare class Scout {
|
|
|
13
13
|
readonly party_id: PartyID;
|
|
14
14
|
readonly tone_description_refresh: boolean;
|
|
15
15
|
readonly jurisdiction_ids: number[];
|
|
16
|
-
readonly sub_scout_ids
|
|
16
|
+
readonly sub_scout_ids?: string[];
|
|
17
17
|
readonly office_class_id: OfficeClassID;
|
|
18
18
|
readonly office_name?: string;
|
|
19
19
|
readonly [x: string]: any;
|
|
@@ -22,7 +22,7 @@ export declare class Scout {
|
|
|
22
22
|
}
|
|
23
23
|
export declare class ScoutAux extends Scout {
|
|
24
24
|
readonly jurisdictions: Jurisdiction[];
|
|
25
|
-
readonly sub_scouts
|
|
25
|
+
readonly sub_scouts?: Scout[];
|
|
26
26
|
readonly photo_download_url?: string;
|
|
27
27
|
readonly tone_description?: string;
|
|
28
28
|
constructor(scout: any);
|
package/dist/src/types/Scout.js
CHANGED
|
@@ -47,8 +47,7 @@ export class Scout {
|
|
|
47
47
|
typeof scout.tone_description_refresh === "boolean" &&
|
|
48
48
|
Array.isArray(scout.jurisdiction_ids) &&
|
|
49
49
|
scout.jurisdiction_ids.every((jurisdiction_id) => typeof jurisdiction_id === "number") &&
|
|
50
|
-
Array.isArray(scout.sub_scout_ids) &&
|
|
51
|
-
scout.sub_scout_ids.every((sub_scout_id) => typeof sub_scout_id === "string") &&
|
|
50
|
+
(scout.sub_scout_ids || Array.isArray(scout.sub_scout_ids) && scout.sub_scout_ids.every((sub_scout_id) => typeof sub_scout_id === "string")) &&
|
|
52
51
|
is_office_class_id(scout.office_class_id) &&
|
|
53
52
|
(scout.office_name === undefined || typeof scout.office_name === "string"));
|
|
54
53
|
}
|
|
@@ -72,8 +71,7 @@ export class ScoutAux extends Scout {
|
|
|
72
71
|
return (Scout.is(scout) &&
|
|
73
72
|
Array.isArray(scout.jurisdictions) &&
|
|
74
73
|
scout.jurisdictions.every(Jurisdiction.is) &&
|
|
75
|
-
Array.isArray(scout.sub_scouts) &&
|
|
76
|
-
scout.sub_scouts.every(Scout.is) &&
|
|
74
|
+
(scout.sub_scouts === undefined || Array.isArray(scout.sub_scouts) && scout.sub_scouts.every(Scout.is)) &&
|
|
77
75
|
(scout.photo_download_url === undefined || typeof scout.photo_download_url === "string") &&
|
|
78
76
|
(scout.tone_description === undefined || typeof scout.tone_description === "string"));
|
|
79
77
|
}
|
package/package.json
CHANGED
package/src/types/Message.ts
CHANGED
|
@@ -21,6 +21,30 @@ export class Fragment {
|
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
+
export class Attachment {
|
|
25
|
+
readonly type : string
|
|
26
|
+
readonly filename : string
|
|
27
|
+
readonly s3_filename : string
|
|
28
|
+
|
|
29
|
+
constructor(attachment : any) {
|
|
30
|
+
if (!Attachment.is(attachment)) {
|
|
31
|
+
throw Error("Invalid input.")
|
|
32
|
+
}
|
|
33
|
+
this.type = attachment.type
|
|
34
|
+
this.filename = attachment.filename
|
|
35
|
+
this.s3_filename = attachment.s3_filename
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
static is(attachment : any) : attachment is Attachment {
|
|
39
|
+
return (
|
|
40
|
+
attachment !== undefined &&
|
|
41
|
+
typeof attachment.text === "string" &&
|
|
42
|
+
typeof attachment.filename === "string" &&
|
|
43
|
+
typeof attachment.s3_filename === "string"
|
|
44
|
+
)
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
24
48
|
export class Message {
|
|
25
49
|
readonly user_id : string
|
|
26
50
|
readonly message_id : string
|
|
@@ -34,6 +58,7 @@ export class Message {
|
|
|
34
58
|
readonly fragments? : Fragment[]
|
|
35
59
|
readonly sources? : Sources
|
|
36
60
|
readonly text : string
|
|
61
|
+
readonly attachment? : Attachment
|
|
37
62
|
|
|
38
63
|
constructor(message : any) {
|
|
39
64
|
if (!Message.is(message)) {
|
|
@@ -51,6 +76,7 @@ export class Message {
|
|
|
51
76
|
this.fragments = message.fragments
|
|
52
77
|
this.sources = message.sources
|
|
53
78
|
this.text = message.text
|
|
79
|
+
this.attachment = message.attachment
|
|
54
80
|
}
|
|
55
81
|
|
|
56
82
|
static is(message : any) : message is Message {
|
|
@@ -67,7 +93,8 @@ export class Message {
|
|
|
67
93
|
(message.grok_text === undefined || typeof message.grok_text === "string") &&
|
|
68
94
|
(message.fragments === undefined || Array.isArray(message.fragments) && message.fragments.every(Fragment.is)) &&
|
|
69
95
|
(message.sources === undefined || Sources.is(message.sources)) &&
|
|
70
|
-
typeof message.text === "string"
|
|
96
|
+
typeof message.text === "string" &&
|
|
97
|
+
Attachment.is(message.attachment)
|
|
71
98
|
)
|
|
72
99
|
}
|
|
73
100
|
}
|
package/src/types/Scout.ts
CHANGED
|
@@ -14,7 +14,7 @@ export class Scout {
|
|
|
14
14
|
readonly party_id : PartyID
|
|
15
15
|
readonly tone_description_refresh : boolean
|
|
16
16
|
readonly jurisdiction_ids : number[]
|
|
17
|
-
readonly sub_scout_ids : string[]
|
|
17
|
+
readonly sub_scout_ids? : string[]
|
|
18
18
|
readonly office_class_id : OfficeClassID
|
|
19
19
|
readonly office_name? : string
|
|
20
20
|
readonly [x : string] : any
|
|
@@ -52,8 +52,7 @@ export class Scout {
|
|
|
52
52
|
typeof scout.tone_description_refresh === "boolean" &&
|
|
53
53
|
Array.isArray(scout.jurisdiction_ids) &&
|
|
54
54
|
scout.jurisdiction_ids.every((jurisdiction_id : any) => typeof jurisdiction_id === "number") &&
|
|
55
|
-
Array.isArray(scout.sub_scout_ids) &&
|
|
56
|
-
scout.sub_scout_ids.every((sub_scout_id : any) => typeof sub_scout_id === "string") &&
|
|
55
|
+
(scout.sub_scout_ids || Array.isArray(scout.sub_scout_ids) && scout.sub_scout_ids.every((sub_scout_id : any) => typeof sub_scout_id === "string")) &&
|
|
57
56
|
is_office_class_id(scout.office_class_id) &&
|
|
58
57
|
(scout.office_name === undefined || typeof scout.office_name === "string")
|
|
59
58
|
)
|
|
@@ -62,7 +61,7 @@ export class Scout {
|
|
|
62
61
|
|
|
63
62
|
export class ScoutAux extends Scout {
|
|
64
63
|
readonly jurisdictions : Jurisdiction[]
|
|
65
|
-
readonly sub_scouts : Scout[]
|
|
64
|
+
readonly sub_scouts? : Scout[]
|
|
66
65
|
readonly photo_download_url? : string
|
|
67
66
|
readonly tone_description? : string
|
|
68
67
|
|
|
@@ -82,8 +81,7 @@ export class ScoutAux extends Scout {
|
|
|
82
81
|
Scout.is(scout) &&
|
|
83
82
|
Array.isArray(scout.jurisdictions) &&
|
|
84
83
|
scout.jurisdictions.every(Jurisdiction.is) &&
|
|
85
|
-
Array.isArray(scout.sub_scouts) &&
|
|
86
|
-
scout.sub_scouts.every(Scout.is) &&
|
|
84
|
+
(scout.sub_scouts === undefined || Array.isArray(scout.sub_scouts) && scout.sub_scouts.every(Scout.is)) &&
|
|
87
85
|
(scout.photo_download_url === undefined || typeof scout.photo_download_url === "string") &&
|
|
88
86
|
(scout.tone_description === undefined || typeof scout.tone_description === "string")
|
|
89
87
|
)
|