elections-types 1.0.9 → 1.0.12

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.
@@ -1,6 +1,10 @@
1
1
  export * from "./types/APIError.js";
2
- export * from "./types/Tweet.js";
3
- export * from "./types/User.js";
4
- export * from "./types/ElectionsConfig.js";
2
+ export * from "./types/Candidate.js";
3
+ export * from "./types/Committee.js";
5
4
  export * from "./types/Donation.js";
5
+ export * from "./types/Election.js";
6
+ export * from "./types/ElectionsConfig.js";
7
+ export * from "./types/FormTypeID.js";
6
8
  export * from "./types/State.js";
9
+ export * from "./types/Tweet.js";
10
+ export * from "./types/User.js";
package/dist/src/index.js CHANGED
@@ -1,6 +1,10 @@
1
1
  export * from "./types/APIError.js";
2
- export * from "./types/Tweet.js";
3
- export * from "./types/User.js";
4
- export * from "./types/ElectionsConfig.js";
2
+ export * from "./types/Candidate.js";
3
+ export * from "./types/Committee.js";
5
4
  export * from "./types/Donation.js";
5
+ export * from "./types/Election.js";
6
+ export * from "./types/ElectionsConfig.js";
7
+ export * from "./types/FormTypeID.js";
6
8
  export * from "./types/State.js";
9
+ export * from "./types/Tweet.js";
10
+ export * from "./types/User.js";
@@ -9,7 +9,7 @@ export declare class Election {
9
9
  readonly name: string;
10
10
  readonly office_id: OfficeID;
11
11
  readonly state_id: StateID;
12
- readonly district?: string;
12
+ readonly district?: number;
13
13
  readonly candidate_ids?: string[];
14
14
  readonly committee_ids?: string[];
15
15
  constructor(election: any);
@@ -13,7 +13,7 @@ export function is_election_id(election_id) {
13
13
  Number.isInteger(year) && year > 1700 && year < 3000 &&
14
14
  is_office_id(office_id) &&
15
15
  is_state_id(state_id) &&
16
- (office_id === "S" || Number.isInteger(district) && district < 100));
16
+ (office_id === "S" || parts[3].length === 2 && Number.isInteger(district) && district < 100));
17
17
  }
18
18
  export class Election {
19
19
  election_id;
@@ -41,7 +41,7 @@ export class Election {
41
41
  typeof election.name === "string" &&
42
42
  is_office_id(election.office_id) &&
43
43
  is_state_id(election.state_id) &&
44
- (election.district === undefined && typeof election.district === "string") &&
44
+ (election.district === undefined || typeof election.district === "number") &&
45
45
  (election.candidate_ids === undefined || Array.isArray(election.candidate_ids) && election.candidate_ids.every((candidate_id) => typeof candidate_id === "string")) &&
46
46
  (election.committee_ids === undefined || Array.isArray(election.committee_ids) && election.committee_ids.every((committee_id) => typeof committee_id === "string")));
47
47
  }
@@ -16,7 +16,17 @@ export interface ElectionsConfig extends ElectionsUtilsConfig {
16
16
  cognito_client_secret: string;
17
17
  secret_key: string;
18
18
  super_gov_api_keys: string[];
19
+ dynamodb_elections: string;
20
+ dynamodb_candidates: string;
19
21
  dynamodb_committees: string;
22
+ dynamodb_users: string;
23
+ dynamodb_user_subscriptions: string;
24
+ dynamodb_articles: string;
25
+ dynamodb_candidate_articles: string;
26
+ dynamodb_tweets: string;
27
+ dynamodb_candidate_tweets: string;
28
+ dynamodb_videos: string;
29
+ dynamodb_candidate_videos: string;
20
30
  dynamodb_donations: string;
21
31
  s3_bucket: string;
22
32
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "elections-types",
3
- "version": "1.0.9",
3
+ "version": "1.0.12",
4
4
  "main": "dist/src/index.js",
5
5
  "types": "dist/src/index.d.ts",
6
6
  "directories": {
package/src/index.ts CHANGED
@@ -1,6 +1,10 @@
1
1
  export * from "./types/APIError"
2
- export * from "./types/Tweet"
3
- export * from "./types/User"
4
- export * from "./types/ElectionsConfig"
2
+ export * from "./types/Candidate"
3
+ export * from "./types/Committee"
5
4
  export * from "./types/Donation"
6
- export * from "./types/State"
5
+ export * from "./types/Election"
6
+ export * from "./types/ElectionsConfig"
7
+ export * from "./types/FormTypeID"
8
+ export * from "./types/State"
9
+ export * from "./types/Tweet"
10
+ export * from "./types/User"
@@ -21,7 +21,7 @@ export function is_election_id(election_id : any) : election_id is ElectionID {
21
21
  Number.isInteger(year) && year > 1700 && year < 3000 &&
22
22
  is_office_id(office_id) &&
23
23
  is_state_id(state_id) &&
24
- (office_id === "S" || Number.isInteger(district) && district < 100)
24
+ (office_id === "S" || parts[3].length === 2 && Number.isInteger(district) && district < 100)
25
25
  )
26
26
  }
27
27
 
@@ -30,7 +30,7 @@ export class Election {
30
30
  readonly name : string
31
31
  readonly office_id : OfficeID
32
32
  readonly state_id : StateID
33
- readonly district? : string
33
+ readonly district? : number
34
34
  readonly candidate_ids? : string[]
35
35
  readonly committee_ids? : string[]
36
36
 
@@ -54,7 +54,7 @@ export class Election {
54
54
  typeof election.name === "string" &&
55
55
  is_office_id(election.office_id) &&
56
56
  is_state_id(election.state_id) &&
57
- (election.district === undefined && typeof election.district === "string") &&
57
+ (election.district === undefined || typeof election.district === "number") &&
58
58
  (election.candidate_ids === undefined || Array.isArray(election.candidate_ids) && election.candidate_ids.every((candidate_id : any) => typeof candidate_id === "string")) &&
59
59
  (election.committee_ids === undefined || Array.isArray(election.committee_ids) && election.committee_ids.every((committee_id : any) => typeof committee_id === "string"))
60
60
  )
@@ -18,7 +18,17 @@ export interface ElectionsConfig extends ElectionsUtilsConfig {
18
18
  secret_key : string,
19
19
  // admin_key : string,
20
20
  super_gov_api_keys : string[],
21
+ dynamodb_elections : string,
22
+ dynamodb_candidates : string,
21
23
  dynamodb_committees : string,
24
+ dynamodb_users : string,
25
+ dynamodb_user_subscriptions : string,
26
+ dynamodb_articles : string,
27
+ dynamodb_candidate_articles : string,
28
+ dynamodb_tweets : string,
29
+ dynamodb_candidate_tweets : string,
30
+ dynamodb_videos : string,
31
+ dynamodb_candidate_videos : string,
22
32
  dynamodb_donations : string,
23
33
  s3_bucket : string
24
34
  }