triangle-types 1.0.121 → 1.0.123

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.
@@ -9,11 +9,12 @@ export declare class FederalCongressMember {
9
9
  readonly birth_year: number;
10
10
  readonly chamber_id: string;
11
11
  readonly state_id: StateID;
12
- readonly district?: number;
12
+ readonly district_id?: number;
13
13
  readonly is_incumbent: boolean;
14
14
  readonly url?: string;
15
15
  readonly url_image?: string;
16
16
  readonly federal_senate_member_id?: string;
17
+ readonly scout_id?: string;
17
18
  constructor(federal_congress_member: any);
18
19
  static is(federal_congress_member: any): federal_congress_member is FederalCongressMember;
19
20
  }
@@ -9,11 +9,12 @@ export class FederalCongressMember {
9
9
  birth_year;
10
10
  chamber_id;
11
11
  state_id;
12
- district;
12
+ district_id;
13
13
  is_incumbent;
14
14
  url;
15
15
  url_image;
16
16
  federal_senate_member_id;
17
+ scout_id;
17
18
  constructor(federal_congress_member) {
18
19
  if (!FederalCongressMember.is(federal_congress_member)) {
19
20
  throw Error("Invalid input.");
@@ -28,10 +29,11 @@ export class FederalCongressMember {
28
29
  this.chamber_id = federal_congress_member.chamber_id;
29
30
  this.state_id = federal_congress_member.state_id;
30
31
  this.is_incumbent = federal_congress_member.is_incumbent;
31
- this.district = federal_congress_member.district;
32
+ this.district_id = federal_congress_member.district_id;
32
33
  this.url = federal_congress_member.url;
33
34
  this.url_image = federal_congress_member.url_image;
34
35
  this.federal_senate_member_id = federal_congress_member.federal_senate_member_id;
36
+ this.scout_id = federal_congress_member.scout_id;
35
37
  }
36
38
  static is(federal_congress_member) {
37
39
  return (federal_congress_member !== undefined &&
@@ -44,10 +46,11 @@ export class FederalCongressMember {
44
46
  typeof federal_congress_member.birth_year === "number" && !isNaN(federal_congress_member.birth_year) &&
45
47
  is_state_id(federal_congress_member.state_id) &&
46
48
  typeof federal_congress_member.chamber_id === "string" &&
47
- (federal_congress_member.district === undefined || typeof federal_congress_member.district === "number") &&
49
+ (federal_congress_member.district_id === undefined || typeof federal_congress_member.district_id === "number") &&
48
50
  typeof federal_congress_member.is_incumbent === "boolean" &&
49
51
  (federal_congress_member.url === undefined || typeof federal_congress_member.url === "string") &&
50
52
  (federal_congress_member.url_image === undefined || typeof federal_congress_member.url_image === "string") &&
51
- (federal_congress_member.federal_senate_member_id === undefined || typeof federal_congress_member.federal_senate_member_id === "string"));
53
+ (federal_congress_member.federal_senate_member_id === undefined || typeof federal_congress_member.federal_senate_member_id === "string") &&
54
+ (federal_congress_member.scout_id === undefined || typeof federal_congress_member.scout_id === "string"));
52
55
  }
53
56
  }
@@ -12,7 +12,7 @@ export declare class FederalElection {
12
12
  readonly name: string;
13
13
  readonly federal_election_office_id: FederalElectionOfficeID;
14
14
  readonly state_id?: StateID;
15
- readonly district?: number;
15
+ readonly district_id?: number;
16
16
  readonly [x: string]: any;
17
17
  constructor(federal_election: FederalElection);
18
18
  static is(federal_election: any): federal_election is FederalElection;
@@ -12,7 +12,7 @@ export function is_federal_election_id(federal_election_id) {
12
12
  const year = Number(parts[0]);
13
13
  const federal_election_office_id = parts[1];
14
14
  const state_id = parts[2];
15
- const district = Number(parts[3]);
15
+ const district_id = Number(parts[3]);
16
16
  if (!(Number.isInteger(year) && year > 1700 && year < 3000 && is_federal_election_office_id(federal_election_office_id))) {
17
17
  return false;
18
18
  }
@@ -31,7 +31,7 @@ export function is_federal_election_id(federal_election_id) {
31
31
  if (!(state_ids_without_district.includes(state_id) && parts.length === 3 || parts.length === 4)) {
32
32
  return false;
33
33
  }
34
- if (!Number.isInteger(district) && district < 100) {
34
+ if (!Number.isInteger(district_id) && district_id < 100) {
35
35
  return false;
36
36
  }
37
37
  return true;
@@ -41,7 +41,7 @@ export class FederalElection {
41
41
  name;
42
42
  federal_election_office_id;
43
43
  state_id;
44
- district;
44
+ district_id;
45
45
  constructor(federal_election) {
46
46
  if (!FederalElection.is(federal_election)) {
47
47
  throw Error("Invalid input.");
@@ -50,7 +50,7 @@ export class FederalElection {
50
50
  this.name = federal_election.name;
51
51
  this.federal_election_office_id = federal_election.federal_election_office_id;
52
52
  this.state_id = federal_election.state_id;
53
- this.district = federal_election.district;
53
+ this.district_id = federal_election.district_id;
54
54
  }
55
55
  static is(federal_election) {
56
56
  return (federal_election !== undefined &&
@@ -58,7 +58,7 @@ export class FederalElection {
58
58
  typeof federal_election.name === "string" &&
59
59
  is_federal_election_office_id(federal_election.federal_election_office_id) &&
60
60
  (federal_election.state_id === undefined || is_state_id(federal_election.state_id)) &&
61
- (federal_election.district === undefined || typeof federal_election.district === "number"));
61
+ (federal_election.district_id === undefined || typeof federal_election.district_id === "number"));
62
62
  }
63
63
  }
64
64
  export class FederalElectionAux extends FederalElection {
@@ -3,30 +3,16 @@ import { FederalElectionID, FederalElectionOfficeID } from "./FederalElection.js
3
3
  import { FederalElectionFileExpenditureAux } from "./FederalElectionFileExpenditure.js";
4
4
  import { FederalElectionF3File } from "./FederalElectionF3File.js";
5
5
  import { StateID } from "../regions/State.js";
6
- export declare class ActivityIndex {
7
- readonly news_index: number;
8
- readonly twitter_index: number;
9
- readonly total_index: number;
10
- constructor(activity_index: any);
11
- static is(activity_index: any): activity_index is ActivityIndex;
12
- }
13
6
  export declare class FederalElectionCandidate {
14
7
  readonly federal_election_candidate_id: string;
15
8
  readonly name: string;
16
9
  readonly federal_election_office_id: FederalElectionOfficeID;
17
10
  readonly state_id: StateID;
18
- readonly district?: number;
11
+ readonly district_id?: number;
19
12
  readonly federal_election_id: FederalElectionID;
20
13
  readonly party_id?: string;
21
- readonly is_active?: boolean;
22
- readonly status?: string;
23
14
  readonly federal_election_file_id?: number;
24
- readonly ballotpedia_name?: string;
25
- readonly ballotpedia_url?: string;
26
- readonly ballotpedia_data?: Record<string, any>;
27
- readonly activity_index?: ActivityIndex;
28
- readonly is_veteran?: string;
29
- readonly url_veteran?: string;
15
+ readonly scout_id?: string;
30
16
  [x: string]: any;
31
17
  constructor(federal_election_candidate: FederalElectionCandidate);
32
18
  static is(federal_election_candidate: any): federal_election_candidate is FederalElectionCandidate;
@@ -3,42 +3,37 @@ import { is_federal_election_id, is_federal_election_office_id } from "./Federal
3
3
  import { FederalElectionFileExpenditureAux } from "./FederalElectionFileExpenditure.js";
4
4
  import { FederalElectionF3File } from "./FederalElectionF3File.js";
5
5
  import { is_state_id } from "../regions/State.js";
6
- export class ActivityIndex {
7
- news_index;
8
- twitter_index;
9
- total_index;
10
- constructor(activity_index) {
11
- if (!ActivityIndex.is(activity_index)) {
12
- throw Error("Invalid input.");
13
- }
14
- this.news_index = activity_index.news_index;
15
- this.twitter_index = activity_index.twitter_index;
16
- this.total_index = activity_index.total_index;
17
- }
18
- static is(activity_index) {
19
- return (activity_index !== undefined &&
20
- typeof activity_index.news_index === "number" &&
21
- typeof activity_index.twitter_index === "number" &&
22
- typeof activity_index.total_index === "number");
23
- }
24
- }
6
+ // export class ActivityIndex {
7
+ // readonly news_index : number
8
+ // readonly twitter_index : number
9
+ // readonly total_index : number
10
+ // constructor(activity_index : any) {
11
+ // if (!ActivityIndex.is(activity_index)) {
12
+ // throw Error("Invalid input.")
13
+ // }
14
+ // this.news_index = activity_index.news_index
15
+ // this.twitter_index = activity_index.twitter_index
16
+ // this.total_index = activity_index.total_index
17
+ // }
18
+ // static is(activity_index : any) : activity_index is ActivityIndex {
19
+ // return (
20
+ // activity_index !== undefined &&
21
+ // typeof activity_index.news_index === "number" &&
22
+ // typeof activity_index.twitter_index === "number" &&
23
+ // typeof activity_index.total_index === "number"
24
+ // )
25
+ // }
26
+ // }
25
27
  export class FederalElectionCandidate {
26
28
  federal_election_candidate_id;
27
29
  name;
28
30
  federal_election_office_id;
29
31
  state_id;
30
- district;
32
+ district_id;
31
33
  federal_election_id;
32
34
  party_id;
33
- is_active;
34
- status;
35
35
  federal_election_file_id;
36
- ballotpedia_name;
37
- ballotpedia_url;
38
- ballotpedia_data;
39
- activity_index;
40
- is_veteran;
41
- url_veteran;
36
+ scout_id;
42
37
  constructor(federal_election_candidate) {
43
38
  if (!FederalElectionCandidate.is(federal_election_candidate)) {
44
39
  throw Error("Invalid input.");
@@ -47,18 +42,11 @@ export class FederalElectionCandidate {
47
42
  this.name = federal_election_candidate.name;
48
43
  this.federal_election_office_id = federal_election_candidate.federal_election_office_id;
49
44
  this.state_id = federal_election_candidate.state_id;
50
- this.district = federal_election_candidate.district;
45
+ this.district_id = federal_election_candidate.district_id;
51
46
  this.federal_election_id = federal_election_candidate.federal_election_id;
52
47
  this.party_id = federal_election_candidate.party_id;
53
- this.is_active = federal_election_candidate.is_active;
54
- this.status = federal_election_candidate.status;
55
48
  this.federal_election_file_id = federal_election_candidate.federal_election_file_id;
56
- this.ballotpedia_name = federal_election_candidate.ballotpedia_name;
57
- this.ballotpedia_url = federal_election_candidate.ballotpedia_url;
58
- this.ballotpedia_data = federal_election_candidate.ballotpedia_data;
59
- this.activity_index = federal_election_candidate.activity_index;
60
- this.is_veteran = federal_election_candidate.is_veteran;
61
- this.url_veteran = federal_election_candidate.url_veteran;
49
+ this.scout_id = federal_election_candidate.scout_id;
62
50
  }
63
51
  static is(federal_election_candidate) {
64
52
  return (federal_election_candidate !== undefined &&
@@ -66,18 +54,11 @@ export class FederalElectionCandidate {
66
54
  typeof federal_election_candidate.name === "string" &&
67
55
  is_federal_election_office_id(federal_election_candidate.federal_election_office_id) &&
68
56
  is_state_id(federal_election_candidate.state_id) &&
69
- (federal_election_candidate.district === undefined || typeof federal_election_candidate.district === "number") &&
57
+ (federal_election_candidate.district_id === undefined || typeof federal_election_candidate.district_id === "number") &&
70
58
  is_federal_election_id(federal_election_candidate.federal_election_id) &&
71
59
  (federal_election_candidate.party_id === undefined || typeof federal_election_candidate.party_id === "string") &&
72
- (federal_election_candidate.is_active === undefined || typeof federal_election_candidate.is_active === "boolean") &&
73
- (federal_election_candidate.status === undefined || typeof federal_election_candidate.status === "string") &&
74
60
  (federal_election_candidate.federal_election_file_id === undefined || typeof federal_election_candidate.federal_election_file_id === "number" && !isNaN(federal_election_candidate.federal_election_file_id)) &&
75
- (federal_election_candidate.ballotpedia_name === undefined || typeof federal_election_candidate.ballotpedia_name === "string") &&
76
- (federal_election_candidate.ballotpedia_url === undefined || typeof federal_election_candidate.ballotpedia_url === "string") &&
77
- (federal_election_candidate.ballotpedia_data === undefined || typeof federal_election_candidate.ballotpedia_data === "object" && Object.keys(federal_election_candidate.ballotpedia_data).map((key) => typeof key === "string")) &&
78
- (federal_election_candidate.activity_index === undefined || ActivityIndex.is(federal_election_candidate.activity_index)) &&
79
- (federal_election_candidate.is_veteran === undefined || typeof federal_election_candidate.is_veteran === "string") &&
80
- (federal_election_candidate.url_veteran === undefined || typeof federal_election_candidate.url_veteran === "string"));
61
+ (federal_election_candidate.scout_id === undefined || typeof federal_election_candidate.scout_id === "string"));
81
62
  }
82
63
  }
83
64
  export class FederalElectionCandidateAux extends FederalElectionCandidate {
@@ -3,7 +3,7 @@ import { FederalElectionFile } from "./FederalElectionFile.js";
3
3
  export declare class FederalElectionF24File extends FederalElectionFile {
4
4
  readonly federal_election_committee_id: string;
5
5
  readonly first_federal_election_file_id: number;
6
- readonly report_type: string;
6
+ readonly f24_report_type_id: string;
7
7
  readonly first_report_date: string;
8
8
  readonly report_date: string;
9
9
  readonly expenditures: FederalElectionFileExpenditure[];
@@ -3,7 +3,7 @@ import { FederalElectionFile } from "./FederalElectionFile.js";
3
3
  export class FederalElectionF24File extends FederalElectionFile {
4
4
  federal_election_committee_id;
5
5
  first_federal_election_file_id;
6
- report_type;
6
+ f24_report_type_id;
7
7
  first_report_date;
8
8
  report_date;
9
9
  expenditures;
@@ -14,7 +14,7 @@ export class FederalElectionF24File extends FederalElectionFile {
14
14
  super(federal_election_file);
15
15
  this.federal_election_committee_id = federal_election_file.federal_election_committee_id;
16
16
  this.first_federal_election_file_id = federal_election_file.first_federal_election_file_id;
17
- this.report_type = federal_election_file.report_type;
17
+ this.f24_report_type_id = federal_election_file.f24_report_type_id;
18
18
  this.first_report_date = federal_election_file.first_report_date;
19
19
  this.report_date = federal_election_file.report_date;
20
20
  this.expenditures = federal_election_file.expenditures;
@@ -24,7 +24,7 @@ export class FederalElectionF24File extends FederalElectionFile {
24
24
  federal_election_file.form_type_id === "F24" &&
25
25
  typeof federal_election_file.federal_election_committee_id === "string" &&
26
26
  typeof federal_election_file.first_federal_election_file_id === "number" &&
27
- typeof federal_election_file.report_type === "string" &&
27
+ typeof federal_election_file.f24_report_type_id === "string" &&
28
28
  typeof federal_election_file.first_report_date === "string" &&
29
29
  typeof federal_election_file.report_date === "string" &&
30
30
  Array.isArray(federal_election_file.expenditures) && federal_election_file.expenditures.every(FederalElectionFileExpenditure.is));
@@ -6,7 +6,7 @@ export declare class FederalElectionF2File extends FederalElectionFile {
6
6
  readonly name: string;
7
7
  readonly federal_election_office_id: FederalElectionOfficeID;
8
8
  readonly state_id: StateID;
9
- readonly district?: number;
9
+ readonly district_id?: number;
10
10
  readonly federal_election_id: FederalElectionID;
11
11
  readonly party_id?: string;
12
12
  readonly report_date: string;
@@ -6,7 +6,7 @@ export class FederalElectionF2File extends FederalElectionFile {
6
6
  name;
7
7
  federal_election_office_id;
8
8
  state_id;
9
- district;
9
+ district_id;
10
10
  federal_election_id;
11
11
  party_id;
12
12
  report_date;
@@ -19,7 +19,7 @@ export class FederalElectionF2File extends FederalElectionFile {
19
19
  this.name = federal_election_file.name;
20
20
  this.federal_election_office_id = federal_election_file.federal_election_office_id;
21
21
  this.state_id = federal_election_file.state_id;
22
- this.district = federal_election_file.district;
22
+ this.district_id = federal_election_file.district_id;
23
23
  this.federal_election_id = federal_election_file.federal_election_id;
24
24
  this.party_id = federal_election_file.party_id;
25
25
  this.report_date = federal_election_file.report_date;
@@ -31,7 +31,7 @@ export class FederalElectionF2File extends FederalElectionFile {
31
31
  typeof federal_election_file.name === "string" &&
32
32
  is_federal_election_office_id(federal_election_file.federal_election_office_id) &&
33
33
  is_state_id(federal_election_file.state_id) &&
34
- (federal_election_file.district === undefined || typeof federal_election_file.district === "number") &&
34
+ (federal_election_file.district_id === undefined || typeof federal_election_file.district_id === "number") &&
35
35
  is_federal_election_id(federal_election_file.federal_election_id) &&
36
36
  (federal_election_file.party_id === undefined || typeof federal_election_file.party_id === "string") &&
37
37
  typeof federal_election_file.report_date === "string");
@@ -3,6 +3,7 @@ export declare class PressArticleTag {
3
3
  readonly press_article_id: string;
4
4
  readonly tag_id: string;
5
5
  readonly publish_date: string;
6
+ readonly url: string;
6
7
  readonly relevance?: string;
7
8
  readonly sentiment?: string;
8
9
  readonly [x: string]: any;
@@ -3,6 +3,7 @@ export class PressArticleTag {
3
3
  press_article_id;
4
4
  tag_id;
5
5
  publish_date;
6
+ url;
6
7
  relevance;
7
8
  sentiment;
8
9
  constructor(press_article_tag) {
@@ -12,6 +13,7 @@ export class PressArticleTag {
12
13
  this.press_article_id = press_article_tag.press_article_id;
13
14
  this.tag_id = press_article_tag.tag_id;
14
15
  this.publish_date = press_article_tag.publish_date;
16
+ this.url = press_article_tag.url;
15
17
  this.relevance = press_article_tag.relevance;
16
18
  this.sentiment = press_article_tag.sentiment;
17
19
  }
@@ -20,6 +22,7 @@ export class PressArticleTag {
20
22
  typeof press_article_tag.press_article_id === "string" &&
21
23
  typeof press_article_tag.tag_id === "string" &&
22
24
  typeof press_article_tag.publish_date === "string" &&
25
+ typeof press_article_tag.url === "string" &&
23
26
  (press_article_tag.relevance === undefined || typeof press_article_tag.relevance === "string") &&
24
27
  (press_article_tag.sentiment === undefined || typeof press_article_tag.sentiment === "string"));
25
28
  }
@@ -1,11 +1,6 @@
1
1
  import { DocumentTypeID } from "../fragments/Fragment.js";
2
- import { StateID } from "../regions/State.js";
3
- declare const scout_type_ids: readonly ["I", "O"];
4
- export type ScoutTypeID = typeof scout_type_ids[number];
5
- export declare function is_scout_type_id(scout_type_id: any): scout_type_id is ScoutTypeID;
6
2
  export declare class Scout {
7
3
  readonly scout_id: string;
8
- readonly scout_type_id: ScoutTypeID;
9
4
  readonly name: string;
10
5
  readonly s3_id_img?: string;
11
6
  readonly document_type_ids: DocumentTypeID[];
@@ -19,14 +14,3 @@ export declare class ScoutAux extends Scout {
19
14
  constructor(scout: any);
20
15
  static is(scout: any): scout is ScoutAux;
21
16
  }
22
- declare const scout_office_ids: readonly ["USP", "USH", "USS", "STG", "STH", "STS"];
23
- export type ScoutOfficeID = typeof scout_office_ids[number];
24
- export declare function is_scout_office_id(scout_office_id: any): scout_office_id is ScoutOfficeID;
25
- export declare class IndividualScout extends Scout {
26
- readonly office_id: ScoutOfficeID;
27
- readonly state_id?: StateID;
28
- readonly district?: number;
29
- constructor(scout: any);
30
- static is(scout: any): scout is IndividualScout;
31
- }
32
- export {};
@@ -1,11 +1,12 @@
1
1
  import { is_document_type_id } from "../fragments/Fragment.js";
2
- const scout_type_ids = ["I", "O"];
3
- export function is_scout_type_id(scout_type_id) {
4
- return scout_type_ids.includes(scout_type_id);
5
- }
2
+ // const scout_type_ids = ["I", "O"] as const
3
+ // export type ScoutTypeID = typeof scout_type_ids[number]
4
+ // export function is_scout_type_id(scout_type_id : any) : scout_type_id is ScoutTypeID {
5
+ // return scout_type_ids.includes(scout_type_id)
6
+ // }
6
7
  export class Scout {
7
8
  scout_id;
8
- scout_type_id;
9
+ // readonly scout_type_id : ScoutTypeID
9
10
  name;
10
11
  s3_id_img;
11
12
  document_type_ids;
@@ -14,7 +15,7 @@ export class Scout {
14
15
  throw Error("Invalid input.");
15
16
  }
16
17
  this.scout_id = scout.scout_id;
17
- this.scout_type_id = scout.scout_type_id;
18
+ // this.scout_type_id = scout.scout_type_id
18
19
  this.name = scout.name;
19
20
  this.s3_id_img = scout.s3_id_img;
20
21
  this.document_type_ids = scout.document_type_ids;
@@ -22,7 +23,7 @@ export class Scout {
22
23
  static is(scout) {
23
24
  return (scout !== undefined &&
24
25
  typeof scout.scout_id === "string" &&
25
- is_scout_type_id(scout.scout_type_id) &&
26
+ // is_scout_type_id(scout.scout_type_id) &&
26
27
  typeof scout.name === "string" &&
27
28
  (scout.s3_id_img === undefined || typeof scout.s3_id_img === "string") &&
28
29
  Array.isArray(scout.document_type_ids) && scout.document_type_ids.every(is_document_type_id));
@@ -45,27 +46,30 @@ export class ScoutAux extends Scout {
45
46
  (scout.s3_url_img === undefined || typeof scout.s3_url_img === "string"));
46
47
  }
47
48
  }
48
- const scout_office_ids = ["USP", "USH", "USS", "STG", "STH", "STS"];
49
- export function is_scout_office_id(scout_office_id) {
50
- return scout_office_ids.includes(scout_office_id);
51
- }
52
- export class IndividualScout extends Scout {
53
- office_id;
54
- state_id;
55
- district;
56
- constructor(scout) {
57
- if (!IndividualScout.is(scout)) {
58
- throw Error("Invalid input.");
59
- }
60
- super(scout);
61
- this.office_id = scout.office_id;
62
- this.state_id = scout.state_id;
63
- this.district = scout.district;
64
- }
65
- static is(scout) {
66
- return (Scout.is(scout) &&
67
- is_scout_office_id(scout.office_id) &&
68
- (scout.state_id === undefined || typeof scout.state_id === "string") &&
69
- (scout.district === undefined || typeof scout.district === "number"));
70
- }
71
- }
49
+ // const scout_office_ids = ["USP", "USH", "USS", "STG", "STH", "STS"] as const
50
+ // export type ScoutOfficeID = typeof scout_office_ids[number]
51
+ // export function is_scout_office_id(scout_office_id : any) : scout_office_id is ScoutOfficeID {
52
+ // return scout_office_ids.includes(scout_office_id)
53
+ // }
54
+ // export class IndividualScout extends Scout {
55
+ // readonly office_id : ScoutOfficeID
56
+ // readonly state_id? : StateID
57
+ // readonly district? : number
58
+ // constructor(scout : any) {
59
+ // if (!IndividualScout.is(scout)) {
60
+ // throw Error("Invalid input.")
61
+ // }
62
+ // super(scout)
63
+ // this.office_id = scout.office_id
64
+ // this.state_id = scout.state_id
65
+ // this.district = scout.district
66
+ // }
67
+ // static is(scout : any) : scout is IndividualScout {
68
+ // return (
69
+ // Scout.is(scout) &&
70
+ // is_scout_office_id(scout.office_id) &&
71
+ // (scout.state_id === undefined || typeof scout.state_id === "string") &&
72
+ // (scout.district === undefined || typeof scout.district === "number")
73
+ // )
74
+ // }
75
+ // }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "triangle-types",
3
- "version": "1.0.121",
3
+ "version": "1.0.123",
4
4
  "main": "dist/src/index.js",
5
5
  "types": "dist/src/index.d.ts",
6
6
  "scripts": {
@@ -10,11 +10,12 @@ export class FederalCongressMember {
10
10
  readonly birth_year : number
11
11
  readonly chamber_id : string
12
12
  readonly state_id : StateID
13
- readonly district? : number
13
+ readonly district_id? : number
14
14
  readonly is_incumbent : boolean
15
15
  readonly url? : string
16
16
  readonly url_image? : string
17
17
  readonly federal_senate_member_id? : string
18
+ readonly scout_id? : string
18
19
 
19
20
 
20
21
  constructor(federal_congress_member : any) {
@@ -31,10 +32,11 @@ export class FederalCongressMember {
31
32
  this.chamber_id = federal_congress_member.chamber_id
32
33
  this.state_id = federal_congress_member.state_id
33
34
  this.is_incumbent = federal_congress_member.is_incumbent
34
- this.district = federal_congress_member.district
35
+ this.district_id = federal_congress_member.district_id
35
36
  this.url = federal_congress_member.url
36
37
  this.url_image = federal_congress_member.url_image
37
38
  this.federal_senate_member_id = federal_congress_member.federal_senate_member_id
39
+ this.scout_id = federal_congress_member.scout_id
38
40
  }
39
41
 
40
42
  static is(federal_congress_member : any) : federal_congress_member is FederalCongressMember {
@@ -49,11 +51,12 @@ export class FederalCongressMember {
49
51
  typeof federal_congress_member.birth_year === "number" && !isNaN(federal_congress_member.birth_year) &&
50
52
  is_state_id(federal_congress_member.state_id) &&
51
53
  typeof federal_congress_member.chamber_id === "string" &&
52
- (federal_congress_member.district === undefined || typeof federal_congress_member.district === "number") &&
54
+ (federal_congress_member.district_id === undefined || typeof federal_congress_member.district_id === "number") &&
53
55
  typeof federal_congress_member.is_incumbent === "boolean" &&
54
56
  (federal_congress_member.url === undefined || typeof federal_congress_member.url === "string") &&
55
57
  (federal_congress_member.url_image === undefined || typeof federal_congress_member.url_image === "string") &&
56
- (federal_congress_member.federal_senate_member_id === undefined || typeof federal_congress_member.federal_senate_member_id === "string")
58
+ (federal_congress_member.federal_senate_member_id === undefined || typeof federal_congress_member.federal_senate_member_id === "string") &&
59
+ (federal_congress_member.scout_id === undefined || typeof federal_congress_member.scout_id === "string")
57
60
  )
58
61
  }
59
62
 
@@ -20,7 +20,7 @@ export function is_federal_election_id(federal_election_id : any) : federal_elec
20
20
  const year = Number(parts[0])
21
21
  const federal_election_office_id = parts[1]
22
22
  const state_id = parts[2]
23
- const district = Number(parts[3])
23
+ const district_id = Number(parts[3])
24
24
  if (!(Number.isInteger(year) && year > 1700 && year < 3000 && is_federal_election_office_id(federal_election_office_id))) {
25
25
  return false
26
26
  }
@@ -39,7 +39,7 @@ export function is_federal_election_id(federal_election_id : any) : federal_elec
39
39
  if (!(state_ids_without_district.includes(state_id) && parts.length === 3 || parts.length === 4)) {
40
40
  return false
41
41
  }
42
- if (!Number.isInteger(district) && district < 100) {
42
+ if (!Number.isInteger(district_id) && district_id < 100) {
43
43
  return false
44
44
  }
45
45
  return true
@@ -50,7 +50,7 @@ export class FederalElection {
50
50
  readonly name : string
51
51
  readonly federal_election_office_id : FederalElectionOfficeID
52
52
  readonly state_id? : StateID
53
- readonly district? : number
53
+ readonly district_id? : number
54
54
  readonly [x : string] : any
55
55
 
56
56
  constructor(federal_election : FederalElection) {
@@ -61,7 +61,7 @@ export class FederalElection {
61
61
  this.name = federal_election.name
62
62
  this.federal_election_office_id = federal_election.federal_election_office_id
63
63
  this.state_id = federal_election.state_id
64
- this.district = federal_election.district
64
+ this.district_id = federal_election.district_id
65
65
  }
66
66
 
67
67
  static is(federal_election : any) : federal_election is FederalElection {
@@ -71,7 +71,7 @@ export class FederalElection {
71
71
  typeof federal_election.name === "string" &&
72
72
  is_federal_election_office_id(federal_election.federal_election_office_id) &&
73
73
  (federal_election.state_id === undefined || is_state_id(federal_election.state_id)) &&
74
- (federal_election.district === undefined || typeof federal_election.district === "number")
74
+ (federal_election.district_id === undefined || typeof federal_election.district_id === "number")
75
75
  )
76
76
  }
77
77
  }
@@ -4,49 +4,40 @@ import { FederalElectionFileExpenditureAux } from "./FederalElectionFileExpendit
4
4
  import { FederalElectionF3File } from "./FederalElectionF3File"
5
5
  import { is_state_id, StateID } from "../regions/State"
6
6
 
7
- export class ActivityIndex {
8
- readonly news_index : number
9
- readonly twitter_index : number
10
- readonly total_index : number
7
+ // export class ActivityIndex {
8
+ // readonly news_index : number
9
+ // readonly twitter_index : number
10
+ // readonly total_index : number
11
11
 
12
- constructor(activity_index : any) {
13
- if (!ActivityIndex.is(activity_index)) {
14
- throw Error("Invalid input.")
15
- }
16
- this.news_index = activity_index.news_index
17
- this.twitter_index = activity_index.twitter_index
18
- this.total_index = activity_index.total_index
19
- }
12
+ // constructor(activity_index : any) {
13
+ // if (!ActivityIndex.is(activity_index)) {
14
+ // throw Error("Invalid input.")
15
+ // }
16
+ // this.news_index = activity_index.news_index
17
+ // this.twitter_index = activity_index.twitter_index
18
+ // this.total_index = activity_index.total_index
19
+ // }
20
20
 
21
- static is(activity_index : any) : activity_index is ActivityIndex {
22
- return (
23
- activity_index !== undefined &&
24
- typeof activity_index.news_index === "number" &&
25
- typeof activity_index.twitter_index === "number" &&
26
- typeof activity_index.total_index === "number"
27
- )
28
- }
29
- }
21
+ // static is(activity_index : any) : activity_index is ActivityIndex {
22
+ // return (
23
+ // activity_index !== undefined &&
24
+ // typeof activity_index.news_index === "number" &&
25
+ // typeof activity_index.twitter_index === "number" &&
26
+ // typeof activity_index.total_index === "number"
27
+ // )
28
+ // }
29
+ // }
30
30
 
31
31
  export class FederalElectionCandidate {
32
32
  readonly federal_election_candidate_id : string
33
33
  readonly name : string
34
34
  readonly federal_election_office_id : FederalElectionOfficeID
35
35
  readonly state_id : StateID
36
- readonly district? : number
36
+ readonly district_id? : number
37
37
  readonly federal_election_id : FederalElectionID
38
38
  readonly party_id? : string
39
- readonly is_active? : boolean
40
- readonly status? : string
41
39
  readonly federal_election_file_id? : number
42
- readonly ballotpedia_name? : string
43
- readonly ballotpedia_url? : string
44
- readonly ballotpedia_data? : Record<string, any>
45
- readonly activity_index? : ActivityIndex
46
- readonly is_veteran? : string
47
- readonly url_veteran? : string
48
- // readonly urls? : string[]
49
- // readonly previews? : string[]
40
+ readonly scout_id? : string
50
41
  [x : string] : any
51
42
 
52
43
 
@@ -58,18 +49,11 @@ export class FederalElectionCandidate {
58
49
  this.name = federal_election_candidate.name
59
50
  this.federal_election_office_id = federal_election_candidate.federal_election_office_id
60
51
  this.state_id = federal_election_candidate.state_id
61
- this.district = federal_election_candidate.district
52
+ this.district_id = federal_election_candidate.district_id
62
53
  this.federal_election_id = federal_election_candidate.federal_election_id
63
54
  this.party_id = federal_election_candidate.party_id
64
- this.is_active = federal_election_candidate.is_active
65
- this.status = federal_election_candidate.status
66
55
  this.federal_election_file_id = federal_election_candidate.federal_election_file_id
67
- this.ballotpedia_name = federal_election_candidate.ballotpedia_name
68
- this.ballotpedia_url = federal_election_candidate.ballotpedia_url
69
- this.ballotpedia_data = federal_election_candidate.ballotpedia_data
70
- this.activity_index = federal_election_candidate.activity_index
71
- this.is_veteran = federal_election_candidate.is_veteran
72
- this.url_veteran = federal_election_candidate.url_veteran
56
+ this.scout_id = federal_election_candidate.scout_id
73
57
  }
74
58
 
75
59
  static is(federal_election_candidate : any) : federal_election_candidate is FederalElectionCandidate {
@@ -79,18 +63,11 @@ export class FederalElectionCandidate {
79
63
  typeof federal_election_candidate.name === "string" &&
80
64
  is_federal_election_office_id(federal_election_candidate.federal_election_office_id) &&
81
65
  is_state_id(federal_election_candidate.state_id) &&
82
- (federal_election_candidate.district === undefined || typeof federal_election_candidate.district === "number") &&
66
+ (federal_election_candidate.district_id === undefined || typeof federal_election_candidate.district_id === "number") &&
83
67
  is_federal_election_id(federal_election_candidate.federal_election_id) &&
84
68
  (federal_election_candidate.party_id === undefined || typeof federal_election_candidate.party_id === "string") &&
85
- (federal_election_candidate.is_active === undefined || typeof federal_election_candidate.is_active === "boolean") &&
86
- (federal_election_candidate.status === undefined || typeof federal_election_candidate.status === "string") &&
87
69
  (federal_election_candidate.federal_election_file_id === undefined || typeof federal_election_candidate.federal_election_file_id === "number" && !isNaN(federal_election_candidate.federal_election_file_id)) &&
88
- (federal_election_candidate.ballotpedia_name === undefined || typeof federal_election_candidate.ballotpedia_name === "string") &&
89
- (federal_election_candidate.ballotpedia_url === undefined || typeof federal_election_candidate.ballotpedia_url === "string") &&
90
- (federal_election_candidate.ballotpedia_data === undefined || typeof federal_election_candidate.ballotpedia_data === "object" && Object.keys(federal_election_candidate.ballotpedia_data).map((key : any) => typeof key === "string")) &&
91
- (federal_election_candidate.activity_index === undefined || ActivityIndex.is(federal_election_candidate.activity_index)) &&
92
- (federal_election_candidate.is_veteran === undefined || typeof federal_election_candidate.is_veteran === "string") &&
93
- (federal_election_candidate.url_veteran === undefined || typeof federal_election_candidate.url_veteran === "string")
70
+ (federal_election_candidate.scout_id === undefined || typeof federal_election_candidate.scout_id === "string")
94
71
  )
95
72
  }
96
73
  }
@@ -4,7 +4,7 @@ import { FederalElectionFile } from "./FederalElectionFile"
4
4
  export class FederalElectionF24File extends FederalElectionFile {
5
5
  readonly federal_election_committee_id : string
6
6
  readonly first_federal_election_file_id : number
7
- readonly report_type : string
7
+ readonly f24_report_type_id : string
8
8
  readonly first_report_date : string
9
9
  readonly report_date : string
10
10
  readonly expenditures : FederalElectionFileExpenditure[]
@@ -16,7 +16,7 @@ export class FederalElectionF24File extends FederalElectionFile {
16
16
  super(federal_election_file)
17
17
  this.federal_election_committee_id = federal_election_file.federal_election_committee_id
18
18
  this.first_federal_election_file_id = federal_election_file.first_federal_election_file_id
19
- this.report_type = federal_election_file.report_type
19
+ this.f24_report_type_id = federal_election_file.f24_report_type_id
20
20
  this.first_report_date = federal_election_file.first_report_date
21
21
  this.report_date = federal_election_file.report_date
22
22
  this.expenditures = federal_election_file.expenditures
@@ -28,7 +28,7 @@ export class FederalElectionF24File extends FederalElectionFile {
28
28
  federal_election_file.form_type_id === "F24" &&
29
29
  typeof federal_election_file.federal_election_committee_id === "string" &&
30
30
  typeof federal_election_file.first_federal_election_file_id === "number" &&
31
- typeof federal_election_file.report_type === "string" &&
31
+ typeof federal_election_file.f24_report_type_id === "string" &&
32
32
  typeof federal_election_file.first_report_date === "string" &&
33
33
  typeof federal_election_file.report_date === "string" &&
34
34
  Array.isArray(federal_election_file.expenditures) && federal_election_file.expenditures.every(FederalElectionFileExpenditure.is)
@@ -7,7 +7,7 @@ export class FederalElectionF2File extends FederalElectionFile {
7
7
  readonly name : string
8
8
  readonly federal_election_office_id : FederalElectionOfficeID
9
9
  readonly state_id : StateID
10
- readonly district? : number
10
+ readonly district_id? : number
11
11
  readonly federal_election_id : FederalElectionID
12
12
  readonly party_id? : string
13
13
  readonly report_date : string
@@ -21,7 +21,7 @@ export class FederalElectionF2File extends FederalElectionFile {
21
21
  this.name = federal_election_file.name
22
22
  this.federal_election_office_id = federal_election_file.federal_election_office_id
23
23
  this.state_id = federal_election_file.state_id
24
- this.district = federal_election_file.district
24
+ this.district_id = federal_election_file.district_id
25
25
  this.federal_election_id = federal_election_file.federal_election_id
26
26
  this.party_id = federal_election_file.party_id
27
27
  this.report_date = federal_election_file.report_date
@@ -35,7 +35,7 @@ export class FederalElectionF2File extends FederalElectionFile {
35
35
  typeof federal_election_file.name === "string" &&
36
36
  is_federal_election_office_id(federal_election_file.federal_election_office_id) &&
37
37
  is_state_id(federal_election_file.state_id) &&
38
- (federal_election_file.district === undefined || typeof federal_election_file.district === "number") &&
38
+ (federal_election_file.district_id === undefined || typeof federal_election_file.district_id === "number") &&
39
39
  is_federal_election_id(federal_election_file.federal_election_id) &&
40
40
  (federal_election_file.party_id === undefined || typeof federal_election_file.party_id === "string") &&
41
41
  typeof federal_election_file.report_date === "string"
@@ -4,6 +4,7 @@ export class PressArticleTag {
4
4
  readonly press_article_id : string
5
5
  readonly tag_id : string
6
6
  readonly publish_date : string
7
+ readonly url : string
7
8
  readonly relevance? : string
8
9
  readonly sentiment? : string
9
10
  readonly [x : string] : any
@@ -15,6 +16,7 @@ export class PressArticleTag {
15
16
  this.press_article_id = press_article_tag.press_article_id
16
17
  this.tag_id = press_article_tag.tag_id
17
18
  this.publish_date = press_article_tag.publish_date
19
+ this.url = press_article_tag.url
18
20
  this.relevance = press_article_tag.relevance
19
21
  this.sentiment = press_article_tag.sentiment
20
22
  }
@@ -25,6 +27,7 @@ export class PressArticleTag {
25
27
  typeof press_article_tag.press_article_id === "string" &&
26
28
  typeof press_article_tag.tag_id === "string" &&
27
29
  typeof press_article_tag.publish_date === "string" &&
30
+ typeof press_article_tag.url === "string" &&
28
31
  (press_article_tag.relevance === undefined || typeof press_article_tag.relevance === "string") &&
29
32
  (press_article_tag.sentiment === undefined || typeof press_article_tag.sentiment === "string")
30
33
  )
@@ -1,17 +1,17 @@
1
1
  import { DocumentTypeID, is_document_type_id } from "../fragments/Fragment"
2
2
  import { StateID } from "../regions/State"
3
3
 
4
- const scout_type_ids = ["I", "O"] as const
4
+ // const scout_type_ids = ["I", "O"] as const
5
5
 
6
- export type ScoutTypeID = typeof scout_type_ids[number]
6
+ // export type ScoutTypeID = typeof scout_type_ids[number]
7
7
 
8
- export function is_scout_type_id(scout_type_id : any) : scout_type_id is ScoutTypeID {
9
- return scout_type_ids.includes(scout_type_id)
10
- }
8
+ // export function is_scout_type_id(scout_type_id : any) : scout_type_id is ScoutTypeID {
9
+ // return scout_type_ids.includes(scout_type_id)
10
+ // }
11
11
 
12
12
  export class Scout {
13
13
  readonly scout_id : string
14
- readonly scout_type_id : ScoutTypeID
14
+ // readonly scout_type_id : ScoutTypeID
15
15
  readonly name : string
16
16
  readonly s3_id_img? : string
17
17
  readonly document_type_ids : DocumentTypeID[]
@@ -22,7 +22,7 @@ export class Scout {
22
22
  throw Error("Invalid input.")
23
23
  }
24
24
  this.scout_id = scout.scout_id
25
- this.scout_type_id = scout.scout_type_id
25
+ // this.scout_type_id = scout.scout_type_id
26
26
  this.name = scout.name
27
27
  this.s3_id_img = scout.s3_id_img
28
28
  this.document_type_ids = scout.document_type_ids
@@ -32,7 +32,7 @@ export class Scout {
32
32
  return (
33
33
  scout !== undefined &&
34
34
  typeof scout.scout_id === "string" &&
35
- is_scout_type_id(scout.scout_type_id) &&
35
+ // is_scout_type_id(scout.scout_type_id) &&
36
36
  typeof scout.name === "string" &&
37
37
  (scout.s3_id_img === undefined || typeof scout.s3_id_img === "string") &&
38
38
  Array.isArray(scout.document_type_ids) && scout.document_type_ids.every(is_document_type_id)
@@ -62,35 +62,35 @@ export class ScoutAux extends Scout {
62
62
  }
63
63
  }
64
64
 
65
- const scout_office_ids = ["USP", "USH", "USS", "STG", "STH", "STS"] as const
65
+ // const scout_office_ids = ["USP", "USH", "USS", "STG", "STH", "STS"] as const
66
66
 
67
- export type ScoutOfficeID = typeof scout_office_ids[number]
67
+ // export type ScoutOfficeID = typeof scout_office_ids[number]
68
68
 
69
- export function is_scout_office_id(scout_office_id : any) : scout_office_id is ScoutOfficeID {
70
- return scout_office_ids.includes(scout_office_id)
71
- }
69
+ // export function is_scout_office_id(scout_office_id : any) : scout_office_id is ScoutOfficeID {
70
+ // return scout_office_ids.includes(scout_office_id)
71
+ // }
72
72
 
73
- export class IndividualScout extends Scout {
74
- readonly office_id : ScoutOfficeID
75
- readonly state_id? : StateID
76
- readonly district? : number
73
+ // export class IndividualScout extends Scout {
74
+ // readonly office_id : ScoutOfficeID
75
+ // readonly state_id? : StateID
76
+ // readonly district? : number
77
77
 
78
- constructor(scout : any) {
79
- if (!IndividualScout.is(scout)) {
80
- throw Error("Invalid input.")
81
- }
82
- super(scout)
83
- this.office_id = scout.office_id
84
- this.state_id = scout.state_id
85
- this.district = scout.district
86
- }
78
+ // constructor(scout : any) {
79
+ // if (!IndividualScout.is(scout)) {
80
+ // throw Error("Invalid input.")
81
+ // }
82
+ // super(scout)
83
+ // this.office_id = scout.office_id
84
+ // this.state_id = scout.state_id
85
+ // this.district = scout.district
86
+ // }
87
87
 
88
- static is(scout : any) : scout is IndividualScout {
89
- return (
90
- Scout.is(scout) &&
91
- is_scout_office_id(scout.office_id) &&
92
- (scout.state_id === undefined || typeof scout.state_id === "string") &&
93
- (scout.district === undefined || typeof scout.district === "number")
94
- )
95
- }
96
- }
88
+ // static is(scout : any) : scout is IndividualScout {
89
+ // return (
90
+ // Scout.is(scout) &&
91
+ // is_scout_office_id(scout.office_id) &&
92
+ // (scout.state_id === undefined || typeof scout.state_id === "string") &&
93
+ // (scout.district === undefined || typeof scout.district === "number")
94
+ // )
95
+ // }
96
+ // }