triangle-types 1.0.37 → 1.0.39
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/fragments/Fragment.d.ts +21 -0
- package/dist/src/types/fragments/Fragment.js +68 -0
- package/dist/src/types/fragments/FragmentVector.d.ts +2 -0
- package/dist/src/types/fragments/FragmentVector.js +3 -0
- package/package.json +1 -1
- package/src/types/fragments/Fragment.ts +87 -0
- package/src/types/fragments/FragmentVector.ts +5 -0
|
@@ -1,8 +1,14 @@
|
|
|
1
|
+
import { ScoutDocument } from "../scout/ScoutDocument.js";
|
|
2
|
+
import { TwitterTweet } from "../twitter/TwitterTweet.js";
|
|
1
3
|
declare const fragment_type_ids: readonly ["LINE", "CHAR"];
|
|
2
4
|
export type FragmentTypeID = typeof fragment_type_ids[number];
|
|
3
5
|
export declare function is_fragment_type_id(fragment_type_id: any): fragment_type_id is FragmentTypeID;
|
|
6
|
+
declare const document_type_ids: readonly ["federal_congress_bill_document", "legistar_document", "press_article_tag", "scout_document", "twitter_tweet"];
|
|
7
|
+
export type DocumentTypeID = typeof document_type_ids[number];
|
|
8
|
+
export declare function is_document_type_id(document_type_id: any): document_type_id is DocumentTypeID;
|
|
4
9
|
export declare class Fragment {
|
|
5
10
|
readonly fragment_id: string;
|
|
11
|
+
readonly document_type_id: DocumentTypeID;
|
|
6
12
|
readonly fragment_type_id: FragmentTypeID;
|
|
7
13
|
readonly max_size: number;
|
|
8
14
|
readonly min_index: number;
|
|
@@ -14,29 +20,44 @@ export declare class Fragment {
|
|
|
14
20
|
static is(fragment: any): fragment is Fragment;
|
|
15
21
|
}
|
|
16
22
|
export declare class FederalCongressBillDocumentFragment extends Fragment {
|
|
23
|
+
readonly document_type_id: "federal_congress_bill_document";
|
|
17
24
|
readonly federal_congress_bill_document_id: string;
|
|
18
25
|
constructor(fragment: FederalCongressBillDocumentFragment);
|
|
19
26
|
static is(fragment: any): fragment is FederalCongressBillDocumentFragment;
|
|
20
27
|
}
|
|
21
28
|
export declare class LegistarDocumentFragment extends Fragment {
|
|
29
|
+
readonly document_type_id: "legistar_document";
|
|
22
30
|
readonly legistar_document_id: string;
|
|
23
31
|
constructor(fragment: LegistarDocumentFragment);
|
|
24
32
|
static is(fragment: any): fragment is LegistarDocumentFragment;
|
|
25
33
|
}
|
|
26
34
|
export declare class PressArticleTagFragment extends Fragment {
|
|
35
|
+
readonly document_type_id: "press_article_tag";
|
|
27
36
|
readonly press_article_id: string;
|
|
28
37
|
readonly tag_id: string;
|
|
29
38
|
constructor(fragment: PressArticleTagFragment);
|
|
30
39
|
static is(fragment: any): fragment is PressArticleTagFragment;
|
|
31
40
|
}
|
|
32
41
|
export declare class ScoutDocumentFragment extends Fragment {
|
|
42
|
+
readonly document_type_id: "scout_document";
|
|
33
43
|
readonly scout_document_id: string;
|
|
34
44
|
constructor(fragment: ScoutDocumentFragment);
|
|
35
45
|
static is(fragment: any): fragment is ScoutDocumentFragment;
|
|
36
46
|
}
|
|
47
|
+
export declare class ScoutDocumentFragmentAux extends ScoutDocumentFragment {
|
|
48
|
+
readonly scout_document: ScoutDocument;
|
|
49
|
+
constructor(fragment: ScoutDocumentFragmentAux);
|
|
50
|
+
static is(fragment: any): fragment is ScoutDocumentFragmentAux;
|
|
51
|
+
}
|
|
37
52
|
export declare class TwitterTweetFragment extends Fragment {
|
|
53
|
+
readonly document_type_id: "twitter_tweet";
|
|
38
54
|
readonly twitter_tweet_id: string;
|
|
39
55
|
constructor(fragment: TwitterTweetFragment);
|
|
40
56
|
static is(fragment: any): fragment is TwitterTweetFragment;
|
|
41
57
|
}
|
|
58
|
+
export declare class TwitterTweetFragmentAux extends TwitterTweetFragment {
|
|
59
|
+
readonly twitter_tweet: TwitterTweet;
|
|
60
|
+
constructor(fragment: TwitterTweetFragmentAux);
|
|
61
|
+
static is(fragment: any): fragment is TwitterTweetFragmentAux;
|
|
62
|
+
}
|
|
42
63
|
export {};
|
|
@@ -1,9 +1,16 @@
|
|
|
1
|
+
import { ScoutDocument } from "../scout/ScoutDocument.js";
|
|
2
|
+
import { TwitterTweet } from "../twitter/TwitterTweet.js";
|
|
1
3
|
const fragment_type_ids = ["LINE", "CHAR"];
|
|
2
4
|
export function is_fragment_type_id(fragment_type_id) {
|
|
3
5
|
return fragment_type_ids.includes(fragment_type_id);
|
|
4
6
|
}
|
|
7
|
+
const document_type_ids = ["federal_congress_bill_document", "legistar_document", "press_article_tag", "scout_document", "twitter_tweet"];
|
|
8
|
+
export function is_document_type_id(document_type_id) {
|
|
9
|
+
return document_type_ids.includes(document_type_id);
|
|
10
|
+
}
|
|
5
11
|
export class Fragment {
|
|
6
12
|
fragment_id;
|
|
13
|
+
document_type_id;
|
|
7
14
|
fragment_type_id;
|
|
8
15
|
max_size;
|
|
9
16
|
min_index;
|
|
@@ -15,6 +22,7 @@ export class Fragment {
|
|
|
15
22
|
throw Error("Invalid input.");
|
|
16
23
|
}
|
|
17
24
|
this.fragment_id = fragment.fragment_id;
|
|
25
|
+
this.document_type_id = fragment.document_type_id;
|
|
18
26
|
this.fragment_type_id = fragment.fragment_type_id;
|
|
19
27
|
this.max_size = fragment.max_size;
|
|
20
28
|
this.min_index = fragment.min_index;
|
|
@@ -25,6 +33,7 @@ export class Fragment {
|
|
|
25
33
|
static is(fragment) {
|
|
26
34
|
return (fragment !== undefined &&
|
|
27
35
|
typeof fragment.fragment_id === "string" &&
|
|
36
|
+
is_document_type_id(fragment.document_type_id) &&
|
|
28
37
|
is_fragment_type_id(fragment.fragment_type_id) &&
|
|
29
38
|
typeof fragment.max_size === "number" &&
|
|
30
39
|
typeof fragment.min_index === "number" &&
|
|
@@ -34,34 +43,41 @@ export class Fragment {
|
|
|
34
43
|
}
|
|
35
44
|
}
|
|
36
45
|
export class FederalCongressBillDocumentFragment extends Fragment {
|
|
46
|
+
document_type_id;
|
|
37
47
|
federal_congress_bill_document_id;
|
|
38
48
|
constructor(fragment) {
|
|
39
49
|
if (!FederalCongressBillDocumentFragment.is(fragment)) {
|
|
40
50
|
throw Error("Invalid input.");
|
|
41
51
|
}
|
|
42
52
|
super(fragment);
|
|
53
|
+
this.document_type_id = fragment.document_type_id;
|
|
43
54
|
this.federal_congress_bill_document_id = fragment.federal_congress_bill_document_id;
|
|
44
55
|
}
|
|
45
56
|
static is(fragment) {
|
|
46
57
|
return (Fragment.is(fragment) &&
|
|
58
|
+
fragment.document_type_id === "federal_congress_bill_document" &&
|
|
47
59
|
typeof fragment.federal_congress_bill_document_id === "string");
|
|
48
60
|
}
|
|
49
61
|
}
|
|
50
62
|
export class LegistarDocumentFragment extends Fragment {
|
|
63
|
+
document_type_id;
|
|
51
64
|
legistar_document_id;
|
|
52
65
|
constructor(fragment) {
|
|
53
66
|
if (!LegistarDocumentFragment.is(fragment)) {
|
|
54
67
|
throw Error("Invalid input.");
|
|
55
68
|
}
|
|
56
69
|
super(fragment);
|
|
70
|
+
this.document_type_id = fragment.document_type_id;
|
|
57
71
|
this.legistar_document_id = fragment.legistar_document_id;
|
|
58
72
|
}
|
|
59
73
|
static is(fragment) {
|
|
60
74
|
return (Fragment.is(fragment) &&
|
|
75
|
+
fragment.document_type_id === "legistar_document" &&
|
|
61
76
|
typeof fragment.legistar_document_id === "string");
|
|
62
77
|
}
|
|
63
78
|
}
|
|
64
79
|
export class PressArticleTagFragment extends Fragment {
|
|
80
|
+
document_type_id;
|
|
65
81
|
press_article_id;
|
|
66
82
|
tag_id;
|
|
67
83
|
constructor(fragment) {
|
|
@@ -69,40 +85,92 @@ export class PressArticleTagFragment extends Fragment {
|
|
|
69
85
|
throw Error("Invalid input.");
|
|
70
86
|
}
|
|
71
87
|
super(fragment);
|
|
88
|
+
this.document_type_id = fragment.document_type_id;
|
|
72
89
|
this.press_article_id = fragment.press_article_id;
|
|
73
90
|
this.tag_id = fragment.tag_id;
|
|
74
91
|
}
|
|
75
92
|
static is(fragment) {
|
|
76
93
|
return (Fragment.is(fragment) &&
|
|
94
|
+
fragment.document_type_id === "press_article_tag" &&
|
|
77
95
|
typeof fragment.press_article_id === "string" &&
|
|
78
96
|
typeof fragment.tag_id === "string");
|
|
79
97
|
}
|
|
80
98
|
}
|
|
99
|
+
// export class PressArticleTagFragmentAux extends PressArticleTagFragment {
|
|
100
|
+
// readonly press_article_ : PressArticleTagAux
|
|
101
|
+
// constructor(fragment : PressArticleTagFragmentAux) {
|
|
102
|
+
// if (!PressArticleTagFragmentAux.is(fragment)) {
|
|
103
|
+
// throw Error("Invalid input.")
|
|
104
|
+
// }
|
|
105
|
+
// super(fragment)
|
|
106
|
+
// this.scout_document = fragment.scout_document
|
|
107
|
+
// }
|
|
108
|
+
// static is(fragment : any) : fragment is PressArticleTagFragmentAux {
|
|
109
|
+
// return (
|
|
110
|
+
// Fragment.is(fragment) &&
|
|
111
|
+
// ScoutDocument.is(fragment.scout_document)
|
|
112
|
+
// )
|
|
113
|
+
// }
|
|
114
|
+
// }
|
|
81
115
|
export class ScoutDocumentFragment extends Fragment {
|
|
116
|
+
document_type_id;
|
|
82
117
|
scout_document_id;
|
|
83
118
|
constructor(fragment) {
|
|
84
119
|
if (!ScoutDocumentFragment.is(fragment)) {
|
|
85
120
|
throw Error("Invalid input.");
|
|
86
121
|
}
|
|
87
122
|
super(fragment);
|
|
123
|
+
this.document_type_id = fragment.document_type_id;
|
|
88
124
|
this.scout_document_id = fragment.scout_document_id;
|
|
89
125
|
}
|
|
90
126
|
static is(fragment) {
|
|
91
127
|
return (Fragment.is(fragment) &&
|
|
128
|
+
fragment.document_type_id === "scout_document" &&
|
|
92
129
|
typeof fragment.scout_document_id === "string");
|
|
93
130
|
}
|
|
94
131
|
}
|
|
132
|
+
export class ScoutDocumentFragmentAux extends ScoutDocumentFragment {
|
|
133
|
+
scout_document;
|
|
134
|
+
constructor(fragment) {
|
|
135
|
+
if (!ScoutDocumentFragmentAux.is(fragment)) {
|
|
136
|
+
throw Error("Invalid input.");
|
|
137
|
+
}
|
|
138
|
+
super(fragment);
|
|
139
|
+
this.scout_document = fragment.scout_document;
|
|
140
|
+
}
|
|
141
|
+
static is(fragment) {
|
|
142
|
+
return (Fragment.is(fragment) &&
|
|
143
|
+
ScoutDocument.is(fragment.scout_document));
|
|
144
|
+
}
|
|
145
|
+
}
|
|
95
146
|
export class TwitterTweetFragment extends Fragment {
|
|
147
|
+
document_type_id;
|
|
96
148
|
twitter_tweet_id;
|
|
97
149
|
constructor(fragment) {
|
|
98
150
|
if (!TwitterTweetFragment.is(fragment)) {
|
|
99
151
|
throw Error("Invalid input.");
|
|
100
152
|
}
|
|
101
153
|
super(fragment);
|
|
154
|
+
this.document_type_id = fragment.document_type_id;
|
|
102
155
|
this.twitter_tweet_id = fragment.twitter_tweet_id;
|
|
103
156
|
}
|
|
104
157
|
static is(fragment) {
|
|
105
158
|
return (Fragment.is(fragment) &&
|
|
159
|
+
fragment.document_type_id === "twitter_tweet" &&
|
|
106
160
|
typeof fragment.twitter_tweet_id === "string");
|
|
107
161
|
}
|
|
108
162
|
}
|
|
163
|
+
export class TwitterTweetFragmentAux extends TwitterTweetFragment {
|
|
164
|
+
twitter_tweet;
|
|
165
|
+
constructor(fragment) {
|
|
166
|
+
if (!TwitterTweetFragmentAux.is(fragment)) {
|
|
167
|
+
throw Error("Invalid input.");
|
|
168
|
+
}
|
|
169
|
+
super(fragment);
|
|
170
|
+
this.twitter_tweet = fragment.twitter_tweet;
|
|
171
|
+
}
|
|
172
|
+
static is(fragment) {
|
|
173
|
+
return (Fragment.is(fragment) &&
|
|
174
|
+
TwitterTweet.is(fragment.twitter_tweet));
|
|
175
|
+
}
|
|
176
|
+
}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import { DocumentTypeID } from "./Fragment.js";
|
|
1
2
|
export declare class FragmentVector {
|
|
2
3
|
readonly fragment_vector_id: string;
|
|
3
4
|
readonly fragment_id: string;
|
|
4
5
|
readonly vector_id: string;
|
|
6
|
+
readonly document_type_id: DocumentTypeID;
|
|
5
7
|
readonly coordinates: number[];
|
|
6
8
|
readonly headers: Record<string, any>;
|
|
7
9
|
readonly s3_vector_id?: string;
|
|
@@ -2,6 +2,7 @@ export class FragmentVector {
|
|
|
2
2
|
fragment_vector_id;
|
|
3
3
|
fragment_id;
|
|
4
4
|
vector_id;
|
|
5
|
+
document_type_id;
|
|
5
6
|
// readonly s3_vector_bucket_id : string
|
|
6
7
|
// readonly s3_vector_index_id : string
|
|
7
8
|
coordinates;
|
|
@@ -14,6 +15,7 @@ export class FragmentVector {
|
|
|
14
15
|
this.fragment_vector_id = fragment_vector.fragment_vector_id;
|
|
15
16
|
this.fragment_id = fragment_vector.fragment_id;
|
|
16
17
|
this.vector_id = fragment_vector.vector_id;
|
|
18
|
+
this.document_type_id = fragment_vector.document_type_id;
|
|
17
19
|
// this.s3_vector_bucket_id = fragment_vector.s3_vector_bucket_id
|
|
18
20
|
// this.s3_vector_index_id = fragment_vector.s3_vector_index_id
|
|
19
21
|
this.coordinates = fragment_vector.coordinates;
|
|
@@ -25,6 +27,7 @@ export class FragmentVector {
|
|
|
25
27
|
typeof fragment_vector.fragment_vector_id === "string" &&
|
|
26
28
|
typeof fragment_vector.fragment_id === "string" &&
|
|
27
29
|
typeof fragment_vector.vector_id === "string" &&
|
|
30
|
+
typeof fragment_vector.document_type_id === "string" &&
|
|
28
31
|
// typeof fragment_vector.s3_vector_bucket_id === "string" &&
|
|
29
32
|
// typeof fragment_vector.s3_vector_index_id === "string" &&
|
|
30
33
|
Array.isArray(fragment_vector.coordinates) && fragment_vector.coordinates.every((coordinate) => typeof coordinate === "number") &&
|
package/package.json
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import { PressArticleTagAux } from "../press/PressArticleTag"
|
|
2
|
+
import { ScoutDocument } from "../scout/ScoutDocument"
|
|
3
|
+
import { TwitterTweet } from "../twitter/TwitterTweet"
|
|
4
|
+
|
|
1
5
|
const fragment_type_ids = ["LINE", "CHAR"] as const
|
|
2
6
|
|
|
3
7
|
export type FragmentTypeID = typeof fragment_type_ids[number]
|
|
@@ -6,8 +10,17 @@ export function is_fragment_type_id(fragment_type_id : any) : fragment_type_id i
|
|
|
6
10
|
return fragment_type_ids.includes(fragment_type_id)
|
|
7
11
|
}
|
|
8
12
|
|
|
13
|
+
const document_type_ids = ["federal_congress_bill_document", "legistar_document", "press_article_tag", "scout_document", "twitter_tweet"] as const
|
|
14
|
+
|
|
15
|
+
export type DocumentTypeID = typeof document_type_ids[number]
|
|
16
|
+
|
|
17
|
+
export function is_document_type_id(document_type_id : any) : document_type_id is DocumentTypeID {
|
|
18
|
+
return document_type_ids.includes(document_type_id)
|
|
19
|
+
}
|
|
20
|
+
|
|
9
21
|
export class Fragment {
|
|
10
22
|
readonly fragment_id : string
|
|
23
|
+
readonly document_type_id : DocumentTypeID
|
|
11
24
|
readonly fragment_type_id : FragmentTypeID
|
|
12
25
|
readonly max_size : number
|
|
13
26
|
readonly min_index : number
|
|
@@ -21,6 +34,7 @@ export class Fragment {
|
|
|
21
34
|
throw Error("Invalid input.")
|
|
22
35
|
}
|
|
23
36
|
this.fragment_id = fragment.fragment_id
|
|
37
|
+
this.document_type_id = fragment.document_type_id
|
|
24
38
|
this.fragment_type_id = fragment.fragment_type_id
|
|
25
39
|
this.max_size = fragment.max_size
|
|
26
40
|
this.min_index = fragment.min_index
|
|
@@ -33,6 +47,7 @@ export class Fragment {
|
|
|
33
47
|
return (
|
|
34
48
|
fragment !== undefined &&
|
|
35
49
|
typeof fragment.fragment_id === "string" &&
|
|
50
|
+
is_document_type_id(fragment.document_type_id) &&
|
|
36
51
|
is_fragment_type_id(fragment.fragment_type_id) &&
|
|
37
52
|
typeof fragment.max_size === "number" &&
|
|
38
53
|
typeof fragment.min_index === "number" &&
|
|
@@ -44,6 +59,7 @@ export class Fragment {
|
|
|
44
59
|
}
|
|
45
60
|
|
|
46
61
|
export class FederalCongressBillDocumentFragment extends Fragment {
|
|
62
|
+
readonly document_type_id : "federal_congress_bill_document"
|
|
47
63
|
readonly federal_congress_bill_document_id : string
|
|
48
64
|
|
|
49
65
|
constructor(fragment : FederalCongressBillDocumentFragment) {
|
|
@@ -51,18 +67,21 @@ export class FederalCongressBillDocumentFragment extends Fragment {
|
|
|
51
67
|
throw Error("Invalid input.")
|
|
52
68
|
}
|
|
53
69
|
super(fragment)
|
|
70
|
+
this.document_type_id = fragment.document_type_id
|
|
54
71
|
this.federal_congress_bill_document_id = fragment.federal_congress_bill_document_id
|
|
55
72
|
}
|
|
56
73
|
|
|
57
74
|
static is(fragment : any) : fragment is FederalCongressBillDocumentFragment {
|
|
58
75
|
return (
|
|
59
76
|
Fragment.is(fragment) &&
|
|
77
|
+
fragment.document_type_id === "federal_congress_bill_document" &&
|
|
60
78
|
typeof fragment.federal_congress_bill_document_id === "string"
|
|
61
79
|
)
|
|
62
80
|
}
|
|
63
81
|
}
|
|
64
82
|
|
|
65
83
|
export class LegistarDocumentFragment extends Fragment {
|
|
84
|
+
readonly document_type_id : "legistar_document"
|
|
66
85
|
readonly legistar_document_id : string
|
|
67
86
|
|
|
68
87
|
constructor(fragment : LegistarDocumentFragment) {
|
|
@@ -70,18 +89,21 @@ export class LegistarDocumentFragment extends Fragment {
|
|
|
70
89
|
throw Error("Invalid input.")
|
|
71
90
|
}
|
|
72
91
|
super(fragment)
|
|
92
|
+
this.document_type_id = fragment.document_type_id
|
|
73
93
|
this.legistar_document_id = fragment.legistar_document_id
|
|
74
94
|
}
|
|
75
95
|
|
|
76
96
|
static is(fragment : any) : fragment is LegistarDocumentFragment {
|
|
77
97
|
return (
|
|
78
98
|
Fragment.is(fragment) &&
|
|
99
|
+
fragment.document_type_id === "legistar_document" &&
|
|
79
100
|
typeof fragment.legistar_document_id === "string"
|
|
80
101
|
)
|
|
81
102
|
}
|
|
82
103
|
}
|
|
83
104
|
|
|
84
105
|
export class PressArticleTagFragment extends Fragment {
|
|
106
|
+
readonly document_type_id : "press_article_tag"
|
|
85
107
|
readonly press_article_id : string
|
|
86
108
|
readonly tag_id : string
|
|
87
109
|
|
|
@@ -90,6 +112,7 @@ export class PressArticleTagFragment extends Fragment {
|
|
|
90
112
|
throw Error("Invalid input.")
|
|
91
113
|
}
|
|
92
114
|
super(fragment)
|
|
115
|
+
this.document_type_id = fragment.document_type_id
|
|
93
116
|
this.press_article_id = fragment.press_article_id
|
|
94
117
|
this.tag_id = fragment.tag_id
|
|
95
118
|
}
|
|
@@ -97,13 +120,34 @@ export class PressArticleTagFragment extends Fragment {
|
|
|
97
120
|
static is(fragment : any) : fragment is PressArticleTagFragment {
|
|
98
121
|
return (
|
|
99
122
|
Fragment.is(fragment) &&
|
|
123
|
+
fragment.document_type_id === "press_article_tag" &&
|
|
100
124
|
typeof fragment.press_article_id === "string" &&
|
|
101
125
|
typeof fragment.tag_id === "string"
|
|
102
126
|
)
|
|
103
127
|
}
|
|
104
128
|
}
|
|
105
129
|
|
|
130
|
+
// export class PressArticleTagFragmentAux extends PressArticleTagFragment {
|
|
131
|
+
// readonly press_article_ : PressArticleTagAux
|
|
132
|
+
|
|
133
|
+
// constructor(fragment : PressArticleTagFragmentAux) {
|
|
134
|
+
// if (!PressArticleTagFragmentAux.is(fragment)) {
|
|
135
|
+
// throw Error("Invalid input.")
|
|
136
|
+
// }
|
|
137
|
+
// super(fragment)
|
|
138
|
+
// this.scout_document = fragment.scout_document
|
|
139
|
+
// }
|
|
140
|
+
|
|
141
|
+
// static is(fragment : any) : fragment is PressArticleTagFragmentAux {
|
|
142
|
+
// return (
|
|
143
|
+
// Fragment.is(fragment) &&
|
|
144
|
+
// ScoutDocument.is(fragment.scout_document)
|
|
145
|
+
// )
|
|
146
|
+
// }
|
|
147
|
+
// }
|
|
148
|
+
|
|
106
149
|
export class ScoutDocumentFragment extends Fragment {
|
|
150
|
+
readonly document_type_id : "scout_document"
|
|
107
151
|
readonly scout_document_id : string
|
|
108
152
|
|
|
109
153
|
constructor(fragment : ScoutDocumentFragment) {
|
|
@@ -111,18 +155,40 @@ export class ScoutDocumentFragment extends Fragment {
|
|
|
111
155
|
throw Error("Invalid input.")
|
|
112
156
|
}
|
|
113
157
|
super(fragment)
|
|
158
|
+
this.document_type_id = fragment.document_type_id
|
|
114
159
|
this.scout_document_id = fragment.scout_document_id
|
|
115
160
|
}
|
|
116
161
|
|
|
117
162
|
static is(fragment : any) : fragment is ScoutDocumentFragment {
|
|
118
163
|
return (
|
|
119
164
|
Fragment.is(fragment) &&
|
|
165
|
+
fragment.document_type_id === "scout_document" &&
|
|
120
166
|
typeof fragment.scout_document_id === "string"
|
|
121
167
|
)
|
|
122
168
|
}
|
|
123
169
|
}
|
|
124
170
|
|
|
171
|
+
export class ScoutDocumentFragmentAux extends ScoutDocumentFragment {
|
|
172
|
+
readonly scout_document : ScoutDocument
|
|
173
|
+
|
|
174
|
+
constructor(fragment : ScoutDocumentFragmentAux) {
|
|
175
|
+
if (!ScoutDocumentFragmentAux.is(fragment)) {
|
|
176
|
+
throw Error("Invalid input.")
|
|
177
|
+
}
|
|
178
|
+
super(fragment)
|
|
179
|
+
this.scout_document = fragment.scout_document
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
static is(fragment : any) : fragment is ScoutDocumentFragmentAux {
|
|
183
|
+
return (
|
|
184
|
+
Fragment.is(fragment) &&
|
|
185
|
+
ScoutDocument.is(fragment.scout_document)
|
|
186
|
+
)
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
|
|
125
190
|
export class TwitterTweetFragment extends Fragment {
|
|
191
|
+
readonly document_type_id : "twitter_tweet"
|
|
126
192
|
readonly twitter_tweet_id : string
|
|
127
193
|
|
|
128
194
|
constructor(fragment : TwitterTweetFragment) {
|
|
@@ -130,13 +196,34 @@ export class TwitterTweetFragment extends Fragment {
|
|
|
130
196
|
throw Error("Invalid input.")
|
|
131
197
|
}
|
|
132
198
|
super(fragment)
|
|
199
|
+
this.document_type_id = fragment.document_type_id
|
|
133
200
|
this.twitter_tweet_id = fragment.twitter_tweet_id
|
|
134
201
|
}
|
|
135
202
|
|
|
136
203
|
static is(fragment : any) : fragment is TwitterTweetFragment {
|
|
137
204
|
return (
|
|
138
205
|
Fragment.is(fragment) &&
|
|
206
|
+
fragment.document_type_id === "twitter_tweet" &&
|
|
139
207
|
typeof fragment.twitter_tweet_id === "string"
|
|
140
208
|
)
|
|
141
209
|
}
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
export class TwitterTweetFragmentAux extends TwitterTweetFragment {
|
|
213
|
+
readonly twitter_tweet : TwitterTweet
|
|
214
|
+
|
|
215
|
+
constructor(fragment : TwitterTweetFragmentAux) {
|
|
216
|
+
if (!TwitterTweetFragmentAux.is(fragment)) {
|
|
217
|
+
throw Error("Invalid input.")
|
|
218
|
+
}
|
|
219
|
+
super(fragment)
|
|
220
|
+
this.twitter_tweet = fragment.twitter_tweet
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
static is(fragment : any) : fragment is TwitterTweetFragmentAux {
|
|
224
|
+
return (
|
|
225
|
+
Fragment.is(fragment) &&
|
|
226
|
+
TwitterTweet.is(fragment.twitter_tweet)
|
|
227
|
+
)
|
|
228
|
+
}
|
|
142
229
|
}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
+
import { DocumentTypeID, FragmentTypeID } from "./Fragment"
|
|
2
|
+
|
|
1
3
|
export class FragmentVector {
|
|
2
4
|
readonly fragment_vector_id : string
|
|
3
5
|
readonly fragment_id : string
|
|
4
6
|
readonly vector_id : string
|
|
7
|
+
readonly document_type_id : DocumentTypeID
|
|
5
8
|
// readonly s3_vector_bucket_id : string
|
|
6
9
|
// readonly s3_vector_index_id : string
|
|
7
10
|
readonly coordinates : number[]
|
|
@@ -16,6 +19,7 @@ export class FragmentVector {
|
|
|
16
19
|
this.fragment_vector_id = fragment_vector.fragment_vector_id
|
|
17
20
|
this.fragment_id = fragment_vector.fragment_id
|
|
18
21
|
this.vector_id = fragment_vector.vector_id
|
|
22
|
+
this.document_type_id = fragment_vector.document_type_id
|
|
19
23
|
// this.s3_vector_bucket_id = fragment_vector.s3_vector_bucket_id
|
|
20
24
|
// this.s3_vector_index_id = fragment_vector.s3_vector_index_id
|
|
21
25
|
this.coordinates = fragment_vector.coordinates
|
|
@@ -29,6 +33,7 @@ export class FragmentVector {
|
|
|
29
33
|
typeof fragment_vector.fragment_vector_id === "string" &&
|
|
30
34
|
typeof fragment_vector.fragment_id === "string" &&
|
|
31
35
|
typeof fragment_vector.vector_id === "string" &&
|
|
36
|
+
typeof fragment_vector.document_type_id === "string" &&
|
|
32
37
|
// typeof fragment_vector.s3_vector_bucket_id === "string" &&
|
|
33
38
|
// typeof fragment_vector.s3_vector_index_id === "string" &&
|
|
34
39
|
Array.isArray(fragment_vector.coordinates) && fragment_vector.coordinates.every((coordinate : any) => typeof coordinate === "number") &&
|