triangle-types 1.0.40 → 1.0.42

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.
@@ -72,3 +72,4 @@ export * from "./types/state_permits/WI/WIStatePermitDocument.js";
72
72
  export * from "./types/voters/Voter.js";
73
73
  export * from "./types/voters/VoterScore.js";
74
74
  export * from "./types/voters/VoterTurnout.js";
75
+ export * from "./types/voters/UserStateScore.js";
package/dist/src/index.js CHANGED
@@ -72,3 +72,4 @@ export * from "./types/state_permits/WI/WIStatePermitDocument.js";
72
72
  export * from "./types/voters/Voter.js";
73
73
  export * from "./types/voters/VoterScore.js";
74
74
  export * from "./types/voters/VoterTurnout.js";
75
+ export * from "./types/voters/UserStateScore.js";
@@ -64,11 +64,11 @@ export class FragmentAux extends Fragment {
64
64
  }
65
65
  static is(fragment) {
66
66
  return (Fragment.is(fragment) &&
67
- FederalCongressBillDocument.is(fragment.federal_congress_bill_document) &&
68
- LegistarDocument.is(fragment.legistar_document) &&
69
- PressArticleTag.is(fragment.press_article_tag) &&
70
- ScoutDocument.is(fragment.scout_document) &&
71
- TwitterTweet.is(fragment.twitter_tweet));
67
+ (fragment.federal_congress_bill_document === undefined || FederalCongressBillDocument.is(fragment.federal_congress_bill_document)) &&
68
+ (fragment.legistar_document === undefined || LegistarDocument.is(fragment.legistar_document)) &&
69
+ (fragment.press_article_tag === undefined || PressArticleTag.is(fragment.press_article_tag)) &&
70
+ (fragment.scout_document === undefined || ScoutDocument.is(fragment.scout_document)) &&
71
+ (fragment.twitter_tweet === undefined || TwitterTweet.is(fragment.twitter_tweet)));
72
72
  }
73
73
  }
74
74
  export class FederalCongressBillDocumentFragment extends Fragment {
@@ -0,0 +1,9 @@
1
+ import { StateID } from "../State.js";
2
+ export declare class UserStateScore {
3
+ readonly user_state_score_id: string;
4
+ readonly user_id: string;
5
+ readonly state_id: StateID;
6
+ readonly score_id: string;
7
+ constructor(user_state_score: any);
8
+ static is(user_state_score: any): user_state_score is UserStateScore;
9
+ }
@@ -0,0 +1,22 @@
1
+ export class UserStateScore {
2
+ user_state_score_id;
3
+ user_id;
4
+ state_id;
5
+ score_id;
6
+ constructor(user_state_score) {
7
+ if (!UserStateScore.is(user_state_score)) {
8
+ throw Error("Invalid input.");
9
+ }
10
+ this.user_state_score_id = user_state_score.user_state_score_id;
11
+ this.user_id = user_state_score.user_id;
12
+ this.state_id = user_state_score.state_id;
13
+ this.score_id = user_state_score.score_id;
14
+ }
15
+ static is(user_state_score) {
16
+ return (user_state_score !== undefined &&
17
+ typeof user_state_score.user_state_score_id === "string" &&
18
+ typeof user_state_score.user_id === "string" &&
19
+ typeof user_state_score.state_id === "string" &&
20
+ typeof user_state_score.score_id === "string");
21
+ }
22
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "triangle-types",
3
- "version": "1.0.40",
3
+ "version": "1.0.42",
4
4
  "main": "dist/src/index.js",
5
5
  "types": "dist/src/index.d.ts",
6
6
  "scripts": {
package/src/index.ts CHANGED
@@ -88,4 +88,5 @@ export * from "./types/state_permits/WI/WIStatePermitDocument"
88
88
 
89
89
  export * from "./types/voters/Voter"
90
90
  export * from "./types/voters/VoterScore"
91
- export * from "./types/voters/VoterTurnout"
91
+ export * from "./types/voters/VoterTurnout"
92
+ export * from "./types/voters/UserStateScore"
@@ -82,11 +82,11 @@ export class FragmentAux extends Fragment {
82
82
  static is(fragment : any) : fragment is FragmentAux {
83
83
  return (
84
84
  Fragment.is(fragment) &&
85
- FederalCongressBillDocument.is(fragment.federal_congress_bill_document) &&
86
- LegistarDocument.is(fragment.legistar_document) &&
87
- PressArticleTag.is(fragment.press_article_tag) &&
88
- ScoutDocument.is(fragment.scout_document) &&
89
- TwitterTweet.is(fragment.twitter_tweet)
85
+ (fragment.federal_congress_bill_document === undefined || FederalCongressBillDocument.is(fragment.federal_congress_bill_document)) &&
86
+ (fragment.legistar_document === undefined || LegistarDocument.is(fragment.legistar_document)) &&
87
+ (fragment.press_article_tag === undefined || PressArticleTag.is(fragment.press_article_tag)) &&
88
+ (fragment.scout_document === undefined || ScoutDocument.is(fragment.scout_document)) &&
89
+ (fragment.twitter_tweet === undefined || TwitterTweet.is(fragment.twitter_tweet))
90
90
  )
91
91
  }
92
92
  }
@@ -0,0 +1,28 @@
1
+ import { StateID } from "../State"
2
+
3
+ export class UserStateScore {
4
+ readonly user_state_score_id : string
5
+ readonly user_id : string
6
+ readonly state_id : StateID
7
+ readonly score_id : string
8
+
9
+ constructor(user_state_score : any) {
10
+ if (!UserStateScore.is(user_state_score)) {
11
+ throw Error("Invalid input.")
12
+ }
13
+ this.user_state_score_id = user_state_score.user_state_score_id
14
+ this.user_id = user_state_score.user_id
15
+ this.state_id = user_state_score.state_id
16
+ this.score_id = user_state_score.score_id
17
+ }
18
+
19
+ static is(user_state_score : any) : user_state_score is UserStateScore {
20
+ return (
21
+ user_state_score !== undefined &&
22
+ typeof user_state_score.user_state_score_id === "string" &&
23
+ typeof user_state_score.user_id === "string" &&
24
+ typeof user_state_score.state_id === "string" &&
25
+ typeof user_state_score.score_id === "string"
26
+ )
27
+ }
28
+ }