triangle-types 1.0.113 → 1.0.115

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.
Files changed (77) hide show
  1. package/dist/src/index.d.ts +7 -5
  2. package/dist/src/index.js +7 -5
  3. package/dist/src/types/errors/APIError.d.ts +4 -0
  4. package/dist/src/types/errors/APIError.js +19 -0
  5. package/dist/src/types/federal_congress/FederalCongressDistrict.d.ts +1 -1
  6. package/dist/src/types/federal_congress/FederalCongressDistrict.js +1 -1
  7. package/dist/src/types/federal_congress/FederalCongressMember.d.ts +1 -1
  8. package/dist/src/types/federal_congress/FederalCongressMember.js +1 -1
  9. package/dist/src/types/federal_elections/FederalElection.d.ts +1 -1
  10. package/dist/src/types/federal_elections/FederalElection.js +1 -1
  11. package/dist/src/types/federal_elections/FederalElectionCandidate.d.ts +1 -1
  12. package/dist/src/types/federal_elections/FederalElectionCandidate.js +1 -1
  13. package/dist/src/types/federal_elections/FederalElectionDonation.d.ts +1 -1
  14. package/dist/src/types/federal_elections/FederalElectionF2File.d.ts +1 -1
  15. package/dist/src/types/federal_elections/FederalElectionF2File.js +1 -1
  16. package/dist/src/types/prism/Prism.d.ts +2 -2
  17. package/dist/src/types/prism/Prism.js +2 -2
  18. package/dist/src/types/prism/Voter.d.ts +1 -1
  19. package/dist/src/types/prism/Voter.js +1 -1
  20. package/dist/src/types/prism/VoterFeature.d.ts +1 -1
  21. package/dist/src/types/prism/VoterFeature.js +1 -1
  22. package/dist/src/types/prism/VoterTarget.d.ts +1 -1
  23. package/dist/src/types/prism/VoterTarget.js +1 -1
  24. package/dist/src/types/regions/County.d.ts +8 -0
  25. package/dist/src/types/regions/County.js +25 -0
  26. package/dist/src/types/regions/SchoolDistrict.d.ts +10 -0
  27. package/dist/src/types/regions/SchoolDistrict.js +26 -0
  28. package/dist/src/types/regions/State.d.ts +8 -0
  29. package/dist/src/types/regions/State.js +210 -0
  30. package/dist/src/types/scout/Scout.d.ts +1 -1
  31. package/dist/src/types/state_legislature/StateLegislatureDistrict.d.ts +1 -1
  32. package/dist/src/types/state_legislature/StateLegislatureDistrict.js +1 -1
  33. package/dist/src/types/state_permits/StateFacility.d.ts +1 -1
  34. package/dist/src/types/state_permits/StateFacility.js +1 -1
  35. package/dist/src/types/state_permits/StatePermit.d.ts +1 -1
  36. package/dist/src/types/state_permits/StatePermit.js +1 -1
  37. package/dist/src/types/state_permits/StatePermitDocument.d.ts +1 -1
  38. package/dist/src/types/state_permits/StatePermitDocument.js +1 -1
  39. package/dist/src/types/state_permits/StatePermitDocumentSource.d.ts +1 -1
  40. package/dist/src/types/state_permits/StatePermitDocumentSource.js +1 -1
  41. package/dist/src/types/state_permits/StatePermitDocumentSourcePollutant.d.ts +1 -1
  42. package/dist/src/types/state_permits/StatePermitDocumentSourcePollutant.js +1 -1
  43. package/dist/src/types/user/Tenant.d.ts +6 -0
  44. package/dist/src/types/user/Tenant.js +17 -0
  45. package/dist/src/types/user/TenantProvision.d.ts +6 -0
  46. package/dist/src/types/user/TenantProvision.js +17 -0
  47. package/dist/src/types/user/User.d.ts +7 -0
  48. package/dist/src/types/user/User.js +32 -0
  49. package/package.json +1 -1
  50. package/src/index.ts +10 -6
  51. package/src/types/federal_congress/FederalCongressDistrict.ts +1 -1
  52. package/src/types/federal_congress/FederalCongressMember.ts +1 -1
  53. package/src/types/federal_elections/FederalElection.ts +1 -1
  54. package/src/types/federal_elections/FederalElectionCandidate.ts +1 -1
  55. package/src/types/federal_elections/FederalElectionDonation.ts +1 -1
  56. package/src/types/federal_elections/FederalElectionF2File.ts +1 -1
  57. package/src/types/prism/Prism.ts +3 -3
  58. package/src/types/prism/Voter.ts +1 -1
  59. package/src/types/prism/VoterFeature.ts +1 -1
  60. package/src/types/prism/VoterTarget.ts +1 -1
  61. package/src/types/scout/Scout.ts +1 -1
  62. package/src/types/state_legislature/StateLegislatureDistrict.ts +1 -1
  63. package/src/types/state_permits/KY/KYStateFacility.ts +1 -1
  64. package/src/types/state_permits/StateFacility.ts +1 -1
  65. package/src/types/state_permits/StatePermit.ts +1 -1
  66. package/src/types/state_permits/StatePermitDocument.ts +1 -1
  67. package/src/types/state_permits/StatePermitDocumentSource.ts +1 -1
  68. package/src/types/state_permits/StatePermitDocumentSourcePollutant.ts +1 -1
  69. package/src/types/user/Tenant.ts +21 -0
  70. package/src/types/user/TenantProvision.ts +21 -0
  71. package/src/types/user/User.ts +36 -0
  72. package/src/types/User.ts +0 -33
  73. package/src/types/jurisdiction/Jurisdiction.ts +0 -25
  74. /package/src/types/{APIError.ts → errors/APIError.ts} +0 -0
  75. /package/src/types/{County.ts → regions/County.ts} +0 -0
  76. /package/src/types/{SchoolDistrict.ts → regions/SchoolDistrict.ts} +0 -0
  77. /package/src/types/{State.ts → regions/State.ts} +0 -0
@@ -1,8 +1,4 @@
1
- export * from "./types/APIError.js";
2
- export * from "./types/County.js";
3
- export * from "./types/SchoolDistrict.js";
4
- export * from "./types/State.js";
5
- export * from "./types/User.js";
1
+ export * from "./types/errors/APIError.js";
6
2
  export * from "./types/application/ApplicationStage.js";
7
3
  export * from "./types/press/PressArticle.js";
8
4
  export * from "./types/press/PressArticleTag.js";
@@ -61,6 +57,9 @@ export * from "./types/prism/UserPrismSegment.js";
61
57
  export * from "./types/prism/Voter.js";
62
58
  export * from "./types/prism/VoterFeature.js";
63
59
  export * from "./types/prism/VoterTarget.js";
60
+ export * from "./types/regions/County.js";
61
+ export * from "./types/regions/SchoolDistrict.js";
62
+ export * from "./types/regions/State.js";
64
63
  export * from "./types/scout/Scout.js";
65
64
  export * from "./types/scout/ScoutDocument.js";
66
65
  export * from "./types/scout/ScoutSubScout.js";
@@ -88,3 +87,6 @@ export * from "./types/state_permits/TN/TNStatePermit.js";
88
87
  export * from "./types/state_permits/TN/TNStatePermitDocument.js";
89
88
  export * from "./types/state_permits/WI/WIStatePermit.js";
90
89
  export * from "./types/state_permits/WI/WIStatePermitDocument.js";
90
+ export * from "./types/user/User.js";
91
+ export * from "./types/user/Tenant.js";
92
+ export * from "./types/user/TenantProvision.js";
package/dist/src/index.js CHANGED
@@ -1,8 +1,4 @@
1
- export * from "./types/APIError.js";
2
- export * from "./types/County.js";
3
- export * from "./types/SchoolDistrict.js";
4
- export * from "./types/State.js";
5
- export * from "./types/User.js";
1
+ export * from "./types/errors/APIError.js";
6
2
  export * from "./types/application/ApplicationStage.js";
7
3
  export * from "./types/press/PressArticle.js";
8
4
  export * from "./types/press/PressArticleTag.js";
@@ -61,6 +57,9 @@ export * from "./types/prism/UserPrismSegment.js";
61
57
  export * from "./types/prism/Voter.js";
62
58
  export * from "./types/prism/VoterFeature.js";
63
59
  export * from "./types/prism/VoterTarget.js";
60
+ export * from "./types/regions/County.js";
61
+ export * from "./types/regions/SchoolDistrict.js";
62
+ export * from "./types/regions/State.js";
64
63
  export * from "./types/scout/Scout.js";
65
64
  export * from "./types/scout/ScoutDocument.js";
66
65
  export * from "./types/scout/ScoutSubScout.js";
@@ -88,3 +87,6 @@ export * from "./types/state_permits/TN/TNStatePermit.js";
88
87
  export * from "./types/state_permits/TN/TNStatePermitDocument.js";
89
88
  export * from "./types/state_permits/WI/WIStatePermit.js";
90
89
  export * from "./types/state_permits/WI/WIStatePermitDocument.js";
90
+ export * from "./types/user/User.js";
91
+ export * from "./types/user/Tenant.js";
92
+ export * from "./types/user/TenantProvision.js";
@@ -0,0 +1,4 @@
1
+ export declare class APIError extends Error {
2
+ status: number;
3
+ constructor(status: number, message?: string);
4
+ }
@@ -0,0 +1,19 @@
1
+ const default_messages_by_status = {
2
+ 400: "Bad Request",
3
+ 401: "Unauthorized",
4
+ 403: "Forbidden",
5
+ 404: "Not Found",
6
+ 405: "Method Not Allowed",
7
+ 500: "Internal Server Error",
8
+ 504: "Gateway Timeout",
9
+ 600: "Failed to Parse Output"
10
+ };
11
+ export class APIError extends Error {
12
+ status;
13
+ constructor(status, message) {
14
+ const default_message = default_messages_by_status[status];
15
+ super(message !== undefined ? message : default_message !== undefined ? default_message : "Error");
16
+ this.name = "APIError";
17
+ this.status = status;
18
+ }
19
+ }
@@ -1,4 +1,4 @@
1
- import { StateID } from "../State.js";
1
+ import { StateID } from "../regions/State.js";
2
2
  export declare class FederalCongressDistrict {
3
3
  readonly federal_congress_district_id: string;
4
4
  readonly federal_congress_id: number;
@@ -1,4 +1,4 @@
1
- import { is_state_id } from "../State.js";
1
+ import { is_state_id } from "../regions/State.js";
2
2
  export class FederalCongressDistrict {
3
3
  federal_congress_district_id;
4
4
  federal_congress_id;
@@ -1,4 +1,4 @@
1
- import { StateID } from "../State.js";
1
+ import { StateID } from "../regions/State.js";
2
2
  export declare class FederalCongressMember {
3
3
  readonly federal_congress_member_id: string;
4
4
  readonly name: string;
@@ -1,4 +1,4 @@
1
- import { is_state_id } from "../State.js";
1
+ import { is_state_id } from "../regions/State.js";
2
2
  export class FederalCongressMember {
3
3
  federal_congress_member_id;
4
4
  name;
@@ -1,7 +1,7 @@
1
1
  import { FederalElectionCandidateAux } from "./FederalElectionCandidate.js";
2
2
  import { FederalElectionCommitteeAux } from "./FederalElectionCommittee.js";
3
3
  import { FederalElectionFileExpenditureAux } from "./FederalElectionFileExpenditure.js";
4
- import { StateID } from "../State.js";
4
+ import { StateID } from "../regions/State.js";
5
5
  declare const federal_election_office_ids: readonly ["H", "S", "P"];
6
6
  export type FederalElectionOfficeID = typeof federal_election_office_ids[number];
7
7
  export declare function is_federal_election_office_id(federal_election_office_id: any): federal_election_office_id is FederalElectionOfficeID;
@@ -1,7 +1,7 @@
1
1
  import { FederalElectionCandidateAux } from "./FederalElectionCandidate.js";
2
2
  import { FederalElectionCommitteeAux } from "./FederalElectionCommittee.js";
3
3
  import { FederalElectionFileExpenditureAux } from "./FederalElectionFileExpenditure.js";
4
- import { is_state_id } from "../State.js";
4
+ import { is_state_id } from "../regions/State.js";
5
5
  const federal_election_office_ids = ["H", "S", "P"];
6
6
  export function is_federal_election_office_id(federal_election_office_id) {
7
7
  return federal_election_office_ids.includes(federal_election_office_id);
@@ -2,7 +2,7 @@ import { FederalElectionCommitteeAux } from "./FederalElectionCommittee.js";
2
2
  import { FederalElectionID, FederalElectionOfficeID } from "./FederalElection.js";
3
3
  import { FederalElectionFileExpenditureAux } from "./FederalElectionFileExpenditure.js";
4
4
  import { FederalElectionF3File } from "./FederalElectionF3File.js";
5
- import { StateID } from "../State.js";
5
+ import { StateID } from "../regions/State.js";
6
6
  export declare class ActivityIndex {
7
7
  readonly news_index: number;
8
8
  readonly twitter_index: number;
@@ -2,7 +2,7 @@ import { FederalElectionCommitteeAux } from "./FederalElectionCommittee.js";
2
2
  import { is_federal_election_id, is_federal_election_office_id } from "./FederalElection.js";
3
3
  import { FederalElectionFileExpenditureAux } from "./FederalElectionFileExpenditure.js";
4
4
  import { FederalElectionF3File } from "./FederalElectionF3File.js";
5
- import { is_state_id } from "../State.js";
5
+ import { is_state_id } from "../regions/State.js";
6
6
  export class ActivityIndex {
7
7
  news_index;
8
8
  twitter_index;
@@ -1,4 +1,4 @@
1
- import { StateID } from "../State.js";
1
+ import { StateID } from "../regions/State.js";
2
2
  export declare class FederalElectionDonation {
3
3
  readonly federal_election_donation_id: string;
4
4
  readonly receipt_date: string;
@@ -1,6 +1,6 @@
1
1
  import { FederalElectionID, FederalElectionOfficeID } from "./FederalElection.js";
2
2
  import { FederalElectionFile } from "./FederalElectionFile.js";
3
- import { StateID } from "../State.js";
3
+ import { StateID } from "../regions/State.js";
4
4
  export declare class FederalElectionF2File extends FederalElectionFile {
5
5
  readonly federal_election_candidate_id: string;
6
6
  readonly name: string;
@@ -1,6 +1,6 @@
1
1
  import { is_federal_election_id, is_federal_election_office_id } from "./FederalElection.js";
2
2
  import { FederalElectionFile } from "./FederalElectionFile.js";
3
- import { is_state_id } from "../State.js";
3
+ import { is_state_id } from "../regions/State.js";
4
4
  export class FederalElectionF2File extends FederalElectionFile {
5
5
  federal_election_candidate_id;
6
6
  name;
@@ -1,4 +1,4 @@
1
- import { StateID } from "../State.js";
1
+ import { StateID } from "../regions/State.js";
2
2
  import { PrismSegment } from "./PrismSegment.js";
3
3
  import { PrismTarget } from "./PrismTarget.js";
4
4
  import { VoterPartyTypeID } from "./Voter.js";
@@ -11,7 +11,7 @@ export declare class Prism {
11
11
  readonly state_legislature_senate_district_id?: string;
12
12
  readonly county_id?: string;
13
13
  readonly school_district_id?: string;
14
- readonly party_type_id: VoterPartyTypeID;
14
+ readonly party_type_id?: VoterPartyTypeID;
15
15
  readonly [x: string]: any;
16
16
  constructor(prism: any);
17
17
  static is(prism: any): prism is Prism;
@@ -1,4 +1,4 @@
1
- import { is_state_id } from "../State.js";
1
+ import { is_state_id } from "../regions/State.js";
2
2
  import { PrismSegment } from "./PrismSegment.js";
3
3
  import { PrismTarget } from "./PrismTarget.js";
4
4
  import { is_voter_party_type_id } from "./Voter.js";
@@ -36,7 +36,7 @@ export class Prism {
36
36
  (prism.state_legislature_senate_district_id === undefined || typeof prism.state_legislature_senate_district_id === "string") &&
37
37
  (prism.county_id === undefined || typeof prism.county_id === "string") &&
38
38
  (prism.school_district_id === undefined || typeof prism.school_district_id === "string") &&
39
- is_voter_party_type_id(prism.party_type_id));
39
+ (prism.party_type_id === undefined || is_voter_party_type_id(prism.party_type_id)));
40
40
  }
41
41
  }
42
42
  export class PrismAux extends Prism {
@@ -1,4 +1,4 @@
1
- import { StateID } from "../State.js";
1
+ import { StateID } from "../regions/State.js";
2
2
  import { VoterFeature } from "./VoterFeature.js";
3
3
  import { VoterTarget } from "./VoterTarget.js";
4
4
  export declare const voter_party_type_ids: readonly ["D", "R", "I"];
@@ -1,4 +1,4 @@
1
- import { is_state_id } from "../State.js";
1
+ import { is_state_id } from "../regions/State.js";
2
2
  import { VoterFeature } from "./VoterFeature.js";
3
3
  import { VoterTarget } from "./VoterTarget.js";
4
4
  export const voter_party_type_ids = ["D", "R", "I"];
@@ -1,4 +1,4 @@
1
- import { StateID } from "../State.js";
1
+ import { StateID } from "../regions/State.js";
2
2
  import { VoterPartyTypeID } from "./Voter.js";
3
3
  export declare class VoterFeature {
4
4
  readonly voter_feature_id: string;
@@ -1,4 +1,4 @@
1
- import { is_state_id } from "../State.js";
1
+ import { is_state_id } from "../regions/State.js";
2
2
  import { is_voter_party_type_id } from "./Voter.js";
3
3
  export class VoterFeature {
4
4
  voter_feature_id;
@@ -1,4 +1,4 @@
1
- import { StateID } from "../State.js";
1
+ import { StateID } from "../regions/State.js";
2
2
  import { VoterPartyTypeID } from "./Voter.js";
3
3
  export declare class VoterTarget {
4
4
  readonly voter_target_id: string;
@@ -1,4 +1,4 @@
1
- import { is_state_id } from "../State.js";
1
+ import { is_state_id } from "../regions/State.js";
2
2
  import { is_voter_party_type_id } from "./Voter.js";
3
3
  export class VoterTarget {
4
4
  voter_target_id;
@@ -0,0 +1,8 @@
1
+ import { StateID } from "./State.js";
2
+ export declare class County {
3
+ readonly county_id: string;
4
+ readonly state_id: StateID;
5
+ readonly name: string;
6
+ constructor(county: any);
7
+ static is(county: any): county is County;
8
+ }
@@ -0,0 +1,25 @@
1
+ // export const county_type_ids = ["H1", "H4", "H5", "H6", "C7"] as const
2
+ import { is_state_id } from "./State.js";
3
+ // export type CountyTypeID = typeof county_type_ids[number]
4
+ // export function is_county_type_id(county_type_id : any) : county_type_id is CountyTypeID {
5
+ // return county_type_ids.includes(county_type_id)
6
+ // }
7
+ export class County {
8
+ county_id;
9
+ state_id;
10
+ name;
11
+ constructor(county) {
12
+ if (!County.is(county)) {
13
+ throw Error("Invalid input.");
14
+ }
15
+ this.county_id = county.county_id;
16
+ this.state_id = county.state_id;
17
+ this.name = county.name;
18
+ }
19
+ static is(county) {
20
+ return (county !== undefined &&
21
+ typeof county.county_id === "string" &&
22
+ is_state_id(county.state_id) &&
23
+ typeof county.name === "string");
24
+ }
25
+ }
@@ -0,0 +1,10 @@
1
+ import { StateID } from "./State.js";
2
+ export declare class SchoolDistrict {
3
+ readonly school_district_id: string;
4
+ readonly state_id: StateID;
5
+ readonly county_id: string;
6
+ readonly state_school_district_id: string;
7
+ readonly name: string;
8
+ constructor(school_district: any);
9
+ static is(school_district: any): school_district is SchoolDistrict;
10
+ }
@@ -0,0 +1,26 @@
1
+ import { is_state_id } from "./State.js";
2
+ export class SchoolDistrict {
3
+ school_district_id;
4
+ state_id;
5
+ county_id;
6
+ state_school_district_id;
7
+ name;
8
+ constructor(school_district) {
9
+ if (!SchoolDistrict.is(school_district)) {
10
+ throw Error("Invalid input.");
11
+ }
12
+ this.school_district_id = school_district.school_district_id;
13
+ this.state_id = school_district.state_id;
14
+ this.county_id = school_district.county_id;
15
+ this.state_school_district_id = school_district.state_school_district_id;
16
+ this.name = school_district.name;
17
+ }
18
+ static is(school_district) {
19
+ return (school_district !== undefined &&
20
+ typeof school_district.school_district_id === "string" &&
21
+ is_state_id(school_district.state_id) &&
22
+ typeof school_district.county_id === "string" &&
23
+ typeof school_district.state_school_district_id === "string" &&
24
+ typeof school_district.name === "string");
25
+ }
26
+ }
@@ -0,0 +1,8 @@
1
+ export declare const state_ids: readonly ["AL", "AK", "AZ", "AR", "CA", "CO", "CT", "DC", "DE", "FL", "GA", "HI", "ID", "IL", "IN", "IA", "KS", "KY", "LA", "ME", "MD", "MA", "MI", "MN", "MS", "MO", "MT", "NE", "NV", "NH", "NJ", "NM", "NY", "NC", "ND", "OH", "OK", "OR", "PA", "RI", "SC", "SD", "TN", "TX", "UT", "VT", "VA", "WA", "WV", "WI", "WY"];
2
+ export type StateID = typeof state_ids[number];
3
+ export declare function is_state_id(state_id: any): state_id is StateID;
4
+ export interface State {
5
+ state_id: StateID;
6
+ name: string;
7
+ }
8
+ export declare const states_by_state_id: Record<StateID, State>;
@@ -0,0 +1,210 @@
1
+ export const state_ids = ["AL", "AK", "AZ", "AR", "CA", "CO", "CT", "DC", "DE", "FL", "GA", "HI", "ID", "IL", "IN", "IA", "KS", "KY", "LA", "ME", "MD", "MA", "MI", "MN", "MS", "MO", "MT", "NE", "NV", "NH", "NJ", "NM", "NY", "NC", "ND", "OH", "OK", "OR", "PA", "RI", "SC", "SD", "TN", "TX", "UT", "VT", "VA", "WA", "WV", "WI", "WY"];
2
+ export function is_state_id(state_id) {
3
+ return state_ids.includes(state_id);
4
+ }
5
+ export const states_by_state_id = {
6
+ AL: {
7
+ state_id: "AL",
8
+ name: "Alabama"
9
+ },
10
+ AK: {
11
+ state_id: "AK",
12
+ name: "Alaska"
13
+ },
14
+ AZ: {
15
+ state_id: "AZ",
16
+ name: "Arizona"
17
+ },
18
+ AR: {
19
+ state_id: "AR",
20
+ name: "Arkansas"
21
+ },
22
+ CA: {
23
+ state_id: "CA",
24
+ name: "California"
25
+ },
26
+ CO: {
27
+ state_id: "CO",
28
+ name: "Colorado"
29
+ },
30
+ CT: {
31
+ state_id: "CT",
32
+ name: "Connecticut"
33
+ },
34
+ DC: {
35
+ state_id: "DC",
36
+ name: "Washington D.C."
37
+ },
38
+ DE: {
39
+ state_id: "DE",
40
+ name: "Delaware"
41
+ },
42
+ FL: {
43
+ state_id: "FL",
44
+ name: "Florida"
45
+ },
46
+ GA: {
47
+ state_id: "GA",
48
+ name: "Georgia"
49
+ },
50
+ HI: {
51
+ state_id: "HI",
52
+ name: "Hawaii"
53
+ },
54
+ ID: {
55
+ state_id: "ID",
56
+ name: "Idaho"
57
+ },
58
+ IL: {
59
+ state_id: "IL",
60
+ name: "Illinois"
61
+ },
62
+ IN: {
63
+ state_id: "IN",
64
+ name: "Indiana"
65
+ },
66
+ IA: {
67
+ state_id: "IA",
68
+ name: "Iowa"
69
+ },
70
+ KS: {
71
+ state_id: "KS",
72
+ name: "Kansas"
73
+ },
74
+ KY: {
75
+ state_id: "KY",
76
+ name: "Kentucky"
77
+ },
78
+ LA: {
79
+ state_id: "LA",
80
+ name: "Louisiana"
81
+ },
82
+ ME: {
83
+ state_id: "ME",
84
+ name: "Maine"
85
+ },
86
+ MD: {
87
+ state_id: "MD",
88
+ name: "Maryland"
89
+ },
90
+ MA: {
91
+ state_id: "MA",
92
+ name: "Massachusetts"
93
+ },
94
+ MI: {
95
+ state_id: "MI",
96
+ name: "Michigan"
97
+ },
98
+ MN: {
99
+ state_id: "MN",
100
+ name: "Minnesota"
101
+ },
102
+ MS: {
103
+ state_id: "MS",
104
+ name: "Mississippi"
105
+ },
106
+ MO: {
107
+ state_id: "MO",
108
+ name: "Missouri"
109
+ },
110
+ MT: {
111
+ state_id: "MT",
112
+ name: "Montana"
113
+ },
114
+ NE: {
115
+ state_id: "NE",
116
+ name: "Nebraska"
117
+ },
118
+ NV: {
119
+ state_id: "NV",
120
+ name: "Nevada"
121
+ },
122
+ NH: {
123
+ state_id: "NH",
124
+ name: "New Hampshire"
125
+ },
126
+ NJ: {
127
+ state_id: "NJ",
128
+ name: "New Jersey"
129
+ },
130
+ NM: {
131
+ state_id: "NM",
132
+ name: "New Mexico"
133
+ },
134
+ NY: {
135
+ state_id: "NY",
136
+ name: "New York"
137
+ },
138
+ NC: {
139
+ state_id: "NC",
140
+ name: "North Carolina"
141
+ },
142
+ ND: {
143
+ state_id: "ND",
144
+ name: "North Dakota"
145
+ },
146
+ OH: {
147
+ state_id: "OH",
148
+ name: "Ohio"
149
+ },
150
+ OK: {
151
+ state_id: "OK",
152
+ name: "Oklahoma"
153
+ },
154
+ OR: {
155
+ state_id: "OR",
156
+ name: "Oregon"
157
+ },
158
+ PA: {
159
+ state_id: "PA",
160
+ name: "Pennsylvania"
161
+ },
162
+ RI: {
163
+ state_id: "RI",
164
+ name: "Rhode Island"
165
+ },
166
+ SC: {
167
+ state_id: "SC",
168
+ name: "South Carolina"
169
+ },
170
+ SD: {
171
+ state_id: "SD",
172
+ name: "South Dakota"
173
+ },
174
+ TN: {
175
+ state_id: "TN",
176
+ name: "Tennessee"
177
+ },
178
+ TX: {
179
+ state_id: "TX",
180
+ name: "Texas"
181
+ },
182
+ UT: {
183
+ state_id: "UT",
184
+ name: "Utah"
185
+ },
186
+ VT: {
187
+ state_id: "VT",
188
+ name: "Vermont"
189
+ },
190
+ VA: {
191
+ state_id: "VA",
192
+ name: "Virginia"
193
+ },
194
+ WA: {
195
+ state_id: "WA",
196
+ name: "Washington"
197
+ },
198
+ WV: {
199
+ state_id: "WV",
200
+ name: "West Virginia"
201
+ },
202
+ WI: {
203
+ state_id: "WI",
204
+ name: "Wisconsin"
205
+ },
206
+ WY: {
207
+ state_id: "WY",
208
+ name: "Wyoming"
209
+ }
210
+ };
@@ -1,5 +1,5 @@
1
1
  import { DocumentTypeID } from "../fragments/Fragment.js";
2
- import { StateID } from "../State.js";
2
+ import { StateID } from "../regions/State.js";
3
3
  declare const scout_type_ids: readonly ["I", "O"];
4
4
  export type ScoutTypeID = typeof scout_type_ids[number];
5
5
  export declare function is_scout_type_id(scout_type_id: any): scout_type_id is ScoutTypeID;
@@ -1,4 +1,4 @@
1
- import { StateID } from "../State.js";
1
+ import { StateID } from "../regions/State.js";
2
2
  export declare class StateLegislatureDistrict {
3
3
  readonly state_legislature_district_id: string;
4
4
  readonly state_id: StateID;
@@ -1,4 +1,4 @@
1
- import { is_state_id } from "../State.js";
1
+ import { is_state_id } from "../regions/State.js";
2
2
  export class StateLegislatureDistrict {
3
3
  state_legislature_district_id;
4
4
  state_id;
@@ -1,4 +1,4 @@
1
- import { StateID } from "../State.js";
1
+ import { StateID } from "../regions/State.js";
2
2
  import { StatePermitAux } from "./StatePermit.js";
3
3
  export declare class StateFacility {
4
4
  readonly state_facility_id: string;
@@ -1,4 +1,4 @@
1
- import { is_state_id } from "../State.js";
1
+ import { is_state_id } from "../regions/State.js";
2
2
  import { StatePermitAux } from "./StatePermit.js";
3
3
  export class StateFacility {
4
4
  state_facility_id;
@@ -1,4 +1,4 @@
1
- import { StateID } from "../State.js";
1
+ import { StateID } from "../regions/State.js";
2
2
  import { StateFacility } from "./StateFacility.js";
3
3
  export declare class StatePermit {
4
4
  readonly state_permit_id: string;
@@ -1,4 +1,4 @@
1
- import { is_state_id } from "../State.js";
1
+ import { is_state_id } from "../regions/State.js";
2
2
  import { StateFacility } from "./StateFacility.js";
3
3
  export class StatePermit {
4
4
  state_permit_id;
@@ -1,4 +1,4 @@
1
- import { StateID } from "../State.js";
1
+ import { StateID } from "../regions/State.js";
2
2
  import { StatePermitDocumentSourceAux } from "./StatePermitDocumentSource.js";
3
3
  export declare class StatePermitComment {
4
4
  readonly comment_text: string;
@@ -1,4 +1,4 @@
1
- import { is_state_id } from "../State.js";
1
+ import { is_state_id } from "../regions/State.js";
2
2
  import { StatePermitDocumentSourceAux } from "./StatePermitDocumentSource.js";
3
3
  export class StatePermitComment {
4
4
  comment_text;
@@ -1,4 +1,4 @@
1
- import { StateID } from "../State.js";
1
+ import { StateID } from "../regions/State.js";
2
2
  import { StatePermitAux } from "./StatePermit.js";
3
3
  import { StatePermitDocument } from "./StatePermitDocument.js";
4
4
  import { StatePermitDocumentSourcePollutant } from "./StatePermitDocumentSourcePollutant.js";
@@ -1,4 +1,4 @@
1
- import { is_state_id } from "../State.js";
1
+ import { is_state_id } from "../regions/State.js";
2
2
  import { StatePermitAux } from "./StatePermit.js";
3
3
  import { StatePermitDocument } from "./StatePermitDocument.js";
4
4
  import { StatePermitDocumentSourcePollutant } from "./StatePermitDocumentSourcePollutant.js";
@@ -1,4 +1,4 @@
1
- import { StateID } from "../State.js";
1
+ import { StateID } from "../regions/State.js";
2
2
  export declare class StatePermitDocumentSourcePollutant {
3
3
  readonly state_permit_document_source_pollutant_id: string;
4
4
  readonly state_id: StateID;
@@ -1,4 +1,4 @@
1
- import { is_state_id } from "../State.js";
1
+ import { is_state_id } from "../regions/State.js";
2
2
  export class StatePermitDocumentSourcePollutant {
3
3
  state_permit_document_source_pollutant_id;
4
4
  state_id;
@@ -0,0 +1,6 @@
1
+ export declare class Tenant {
2
+ readonly tenant_id: string;
3
+ readonly name: string;
4
+ constructor(tenant: Tenant);
5
+ static is(tenant: any): tenant is Tenant;
6
+ }
@@ -0,0 +1,17 @@
1
+ export class Tenant {
2
+ tenant_id;
3
+ name;
4
+ // readonly [x : string] : any
5
+ constructor(tenant) {
6
+ if (!Tenant.is(tenant)) {
7
+ throw Error("Invalid Input.");
8
+ }
9
+ this.tenant_id = tenant.tenant_id;
10
+ this.name = tenant.name;
11
+ }
12
+ static is(tenant) {
13
+ return (tenant !== undefined &&
14
+ typeof tenant.tenant_id === "string" &&
15
+ typeof tenant.name === "string");
16
+ }
17
+ }
@@ -0,0 +1,6 @@
1
+ export declare class TenantProvision {
2
+ readonly tenant_id: string;
3
+ readonly provision_id: string;
4
+ constructor(tenant_provision: TenantProvision);
5
+ static is(tenant_provision: any): tenant_provision is TenantProvision;
6
+ }
@@ -0,0 +1,17 @@
1
+ export class TenantProvision {
2
+ tenant_id;
3
+ provision_id;
4
+ // readonly [x : string] : any
5
+ constructor(tenant_provision) {
6
+ if (!TenantProvision.is(tenant_provision)) {
7
+ throw Error("Invalid Input.");
8
+ }
9
+ this.tenant_id = tenant_provision.tenant_id;
10
+ this.provision_id = tenant_provision.provision_id;
11
+ }
12
+ static is(tenant_provision) {
13
+ return (tenant_provision !== undefined &&
14
+ typeof tenant_provision.tenant_id === "string" &&
15
+ typeof tenant_provision.provision_id === "string");
16
+ }
17
+ }
@@ -0,0 +1,7 @@
1
+ export declare class User {
2
+ readonly user_id: string;
3
+ readonly email: string;
4
+ readonly tenant_id?: string;
5
+ constructor(user: User);
6
+ static is(user: any): user is User;
7
+ }
@@ -0,0 +1,32 @@
1
+ export class User {
2
+ user_id;
3
+ email;
4
+ // readonly is_admin_elections : boolean
5
+ // readonly is_admin_prism : boolean
6
+ // readonly is_admin_scout : boolean
7
+ // readonly is_admin_triage : boolean
8
+ tenant_id;
9
+ // readonly [x : string] : any
10
+ constructor(user) {
11
+ if (!User.is(user)) {
12
+ throw Error("Invalid Input.");
13
+ }
14
+ this.user_id = user.user_id;
15
+ this.email = user.email;
16
+ // this.is_admin_elections = user.is_admin_elections
17
+ // this.is_admin_prism = user.is_admin_prism
18
+ // this.is_admin_scout = user.is_admin_scout
19
+ // this.is_admin_triage = user.is_admin_triage
20
+ this.tenant_id = user.tenant_id;
21
+ }
22
+ static is(user) {
23
+ return (user !== undefined &&
24
+ typeof user.user_id === "string" &&
25
+ typeof user.email === "string" &&
26
+ // typeof user.is_admin_elections === "boolean" &&
27
+ // typeof user.is_admin_prism === "boolean" &&
28
+ // typeof user.is_admin_scout === "boolean" &&
29
+ // typeof user.is_admin_triage === "boolean" &&
30
+ (user.tenant_id === undefined || typeof user.tenant_id === "string"));
31
+ }
32
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "triangle-types",
3
- "version": "1.0.113",
3
+ "version": "1.0.115",
4
4
  "main": "dist/src/index.js",
5
5
  "types": "dist/src/index.d.ts",
6
6
  "scripts": {
package/src/index.ts CHANGED
@@ -1,8 +1,4 @@
1
- export * from "./types/APIError"
2
- export * from "./types/County"
3
- export * from "./types/SchoolDistrict"
4
- export * from "./types/State"
5
- export * from "./types/User"
1
+ export * from "./types/errors/APIError"
6
2
 
7
3
  export * from "./types/application/ApplicationStage"
8
4
 
@@ -73,6 +69,10 @@ export * from "./types/prism/Voter"
73
69
  export * from "./types/prism/VoterFeature"
74
70
  export * from "./types/prism/VoterTarget"
75
71
 
72
+ export * from "./types/regions/County"
73
+ export * from "./types/regions/SchoolDistrict"
74
+ export * from "./types/regions/State"
75
+
76
76
  export * from "./types/scout/Scout"
77
77
  export * from "./types/scout/ScoutDocument"
78
78
  export * from "./types/scout/ScoutSubScout"
@@ -106,4 +106,8 @@ export * from "./types/state_permits/TN/TNStatePermit"
106
106
  export * from "./types/state_permits/TN/TNStatePermitDocument"
107
107
 
108
108
  export * from "./types/state_permits/WI/WIStatePermit"
109
- export * from "./types/state_permits/WI/WIStatePermitDocument"
109
+ export * from "./types/state_permits/WI/WIStatePermitDocument"
110
+
111
+ export * from "./types/user/User"
112
+ export * from "./types/user/Tenant"
113
+ export * from "./types/user/TenantProvision"
@@ -1,4 +1,4 @@
1
- import { is_state_id, StateID } from "../State"
1
+ import { is_state_id, StateID } from "../regions/State"
2
2
 
3
3
  export class FederalCongressDistrict {
4
4
  readonly federal_congress_district_id : string
@@ -1,4 +1,4 @@
1
- import { is_state_id, StateID } from "../State"
1
+ import { is_state_id, StateID } from "../regions/State"
2
2
 
3
3
  export class FederalCongressMember {
4
4
  readonly federal_congress_member_id : string
@@ -1,7 +1,7 @@
1
1
  import { FederalElectionCandidateAux } from "./FederalElectionCandidate"
2
2
  import { FederalElectionCommitteeAux } from "./FederalElectionCommittee"
3
3
  import { FederalElectionFileExpenditureAux } from "./FederalElectionFileExpenditure"
4
- import { is_state_id, StateID } from "../State"
4
+ import { is_state_id, StateID } from "../regions/State"
5
5
 
6
6
  const federal_election_office_ids = ["H", "S", "P"] as const
7
7
 
@@ -2,7 +2,7 @@ import { FederalElectionCommitteeAux } from "./FederalElectionCommittee"
2
2
  import { FederalElectionID, is_federal_election_id, is_federal_election_office_id, FederalElectionOfficeID } from "./FederalElection"
3
3
  import { FederalElectionFileExpenditureAux } from "./FederalElectionFileExpenditure"
4
4
  import { FederalElectionF3File } from "./FederalElectionF3File"
5
- import { is_state_id, StateID } from "../State"
5
+ import { is_state_id, StateID } from "../regions/State"
6
6
 
7
7
  export class ActivityIndex {
8
8
  readonly news_index : number
@@ -1,4 +1,4 @@
1
- import { StateID } from "../State"
1
+ import { StateID } from "../regions/State"
2
2
 
3
3
  export class FederalElectionDonation {
4
4
  readonly federal_election_donation_id : string
@@ -1,6 +1,6 @@
1
1
  import { FederalElectionID, is_federal_election_id, is_federal_election_office_id, FederalElectionOfficeID } from "./FederalElection"
2
2
  import { FederalElectionFile } from "./FederalElectionFile"
3
- import { is_state_id, StateID } from "../State"
3
+ import { is_state_id, StateID } from "../regions/State"
4
4
 
5
5
  export class FederalElectionF2File extends FederalElectionFile {
6
6
  readonly federal_election_candidate_id : string
@@ -1,4 +1,4 @@
1
- import { is_state_id, StateID } from "../State"
1
+ import { is_state_id, StateID } from "../regions/State"
2
2
  import { PrismSegment } from "./PrismSegment"
3
3
  import { PrismTarget } from "./PrismTarget"
4
4
  import { is_voter_party_type_id, VoterPartyTypeID } from "./Voter"
@@ -12,7 +12,7 @@ export class Prism {
12
12
  readonly state_legislature_senate_district_id? : string
13
13
  readonly county_id? : string
14
14
  readonly school_district_id? : string
15
- readonly party_type_id : VoterPartyTypeID
15
+ readonly party_type_id? : VoterPartyTypeID
16
16
  readonly [x : string] : any
17
17
 
18
18
  constructor(prism : any) {
@@ -41,7 +41,7 @@ export class Prism {
41
41
  (prism.state_legislature_senate_district_id === undefined || typeof prism.state_legislature_senate_district_id === "string") &&
42
42
  (prism.county_id === undefined || typeof prism.county_id === "string") &&
43
43
  (prism.school_district_id === undefined || typeof prism.school_district_id === "string") &&
44
- is_voter_party_type_id(prism.party_type_id)
44
+ (prism.party_type_id === undefined || is_voter_party_type_id(prism.party_type_id))
45
45
  )
46
46
  }
47
47
  }
@@ -1,4 +1,4 @@
1
- import { is_state_id, StateID } from "../State"
1
+ import { is_state_id, StateID } from "../regions/State"
2
2
  import { VoterFeature } from "./VoterFeature"
3
3
  import { VoterTarget } from "./VoterTarget"
4
4
 
@@ -1,4 +1,4 @@
1
- import { is_state_id, StateID } from "../State"
1
+ import { is_state_id, StateID } from "../regions/State"
2
2
  import { is_voter_party_type_id, VoterPartyTypeID } from "./Voter"
3
3
 
4
4
  export class VoterFeature {
@@ -1,4 +1,4 @@
1
- import { is_state_id, StateID } from "../State"
1
+ import { is_state_id, StateID } from "../regions/State"
2
2
  import { is_voter_party_type_id, VoterPartyTypeID } from "./Voter"
3
3
 
4
4
  export class VoterTarget {
@@ -1,5 +1,5 @@
1
1
  import { DocumentTypeID, is_document_type_id } from "../fragments/Fragment"
2
- import { StateID } from "../State"
2
+ import { StateID } from "../regions/State"
3
3
 
4
4
  const scout_type_ids = ["I", "O"] as const
5
5
 
@@ -1,4 +1,4 @@
1
- import { is_state_id, StateID } from "../State"
1
+ import { is_state_id, StateID } from "../regions/State"
2
2
 
3
3
  export class StateLegislatureDistrict {
4
4
  readonly state_legislature_district_id : string
@@ -1,4 +1,4 @@
1
- import { is_state_id, StateID } from "../../State"
1
+ import { is_state_id, StateID } from "../../regions/State"
2
2
  import { StateFacility } from "../StateFacility"
3
3
 
4
4
  export class KYStateFacility extends StateFacility {
@@ -1,4 +1,4 @@
1
- import { is_state_id, StateID } from "../State"
1
+ import { is_state_id, StateID } from "../regions/State"
2
2
  import { StatePermitAux } from "./StatePermit"
3
3
 
4
4
  export class StateFacility {
@@ -1,4 +1,4 @@
1
- import { is_state_id, StateID } from "../State"
1
+ import { is_state_id, StateID } from "../regions/State"
2
2
  import { StateFacility } from "./StateFacility"
3
3
 
4
4
  export class StatePermit {
@@ -1,4 +1,4 @@
1
- import { is_state_id, StateID } from "../State"
1
+ import { is_state_id, StateID } from "../regions/State"
2
2
  import { StatePermitDocumentSourceAux } from "./StatePermitDocumentSource"
3
3
 
4
4
  export class StatePermitComment {
@@ -1,4 +1,4 @@
1
- import { is_state_id, StateID } from "../State"
1
+ import { is_state_id, StateID } from "../regions/State"
2
2
  import { StatePermitAux } from "./StatePermit"
3
3
  import { StatePermitDocument } from "./StatePermitDocument"
4
4
  import { StatePermitDocumentSourcePollutant } from "./StatePermitDocumentSourcePollutant"
@@ -1,4 +1,4 @@
1
- import { is_state_id, StateID } from "../State"
1
+ import { is_state_id, StateID } from "../regions/State"
2
2
 
3
3
  export class StatePermitDocumentSourcePollutant {
4
4
  readonly state_permit_document_source_pollutant_id : string
@@ -0,0 +1,21 @@
1
+ export class Tenant {
2
+ readonly tenant_id : string
3
+ readonly name : string
4
+ // readonly [x : string] : any
5
+
6
+ constructor(tenant : Tenant) {
7
+ if (!Tenant.is(tenant)) {
8
+ throw Error("Invalid Input.")
9
+ }
10
+ this.tenant_id = tenant.tenant_id
11
+ this.name = tenant.name
12
+ }
13
+
14
+ static is(tenant : any) : tenant is Tenant {
15
+ return (
16
+ tenant !== undefined &&
17
+ typeof tenant.tenant_id === "string" &&
18
+ typeof tenant.name === "string"
19
+ )
20
+ }
21
+ }
@@ -0,0 +1,21 @@
1
+ export class TenantProvision {
2
+ readonly tenant_id : string
3
+ readonly provision_id : string
4
+ // readonly [x : string] : any
5
+
6
+ constructor(tenant_provision : TenantProvision) {
7
+ if (!TenantProvision.is(tenant_provision)) {
8
+ throw Error("Invalid Input.")
9
+ }
10
+ this.tenant_id = tenant_provision.tenant_id
11
+ this.provision_id = tenant_provision.provision_id
12
+ }
13
+
14
+ static is(tenant_provision : any) : tenant_provision is TenantProvision {
15
+ return (
16
+ tenant_provision !== undefined &&
17
+ typeof tenant_provision.tenant_id === "string" &&
18
+ typeof tenant_provision.provision_id === "string"
19
+ )
20
+ }
21
+ }
@@ -0,0 +1,36 @@
1
+ export class User {
2
+ readonly user_id : string
3
+ readonly email : string
4
+ // readonly is_admin_elections : boolean
5
+ // readonly is_admin_prism : boolean
6
+ // readonly is_admin_scout : boolean
7
+ // readonly is_admin_triage : boolean
8
+ readonly tenant_id? : string
9
+ // readonly [x : string] : any
10
+
11
+ constructor(user : User) {
12
+ if (!User.is(user)) {
13
+ throw Error("Invalid Input.")
14
+ }
15
+ this.user_id = user.user_id
16
+ this.email = user.email
17
+ // this.is_admin_elections = user.is_admin_elections
18
+ // this.is_admin_prism = user.is_admin_prism
19
+ // this.is_admin_scout = user.is_admin_scout
20
+ // this.is_admin_triage = user.is_admin_triage
21
+ this.tenant_id = user.tenant_id
22
+ }
23
+
24
+ static is(user : any) : user is User {
25
+ return (
26
+ user !== undefined &&
27
+ typeof user.user_id === "string" &&
28
+ typeof user.email === "string" &&
29
+ // typeof user.is_admin_elections === "boolean" &&
30
+ // typeof user.is_admin_prism === "boolean" &&
31
+ // typeof user.is_admin_scout === "boolean" &&
32
+ // typeof user.is_admin_triage === "boolean" &&
33
+ (user.tenant_id === undefined || typeof user.tenant_id === "string")
34
+ )
35
+ }
36
+ }
package/src/types/User.ts DELETED
@@ -1,33 +0,0 @@
1
- export class User {
2
- readonly user_id : string
3
- readonly email : string
4
- readonly is_admin_elections : boolean
5
- readonly is_admin_prism : boolean
6
- readonly is_admin_scout : boolean
7
- readonly is_admin_triage : boolean
8
- // readonly [x : string] : any
9
-
10
- constructor(user : User) {
11
- if (!User.is(user)) {
12
- throw Error("Invalid Input.")
13
- }
14
- this.user_id = user.user_id
15
- this.email = user.email
16
- this.is_admin_elections = user.is_admin_elections
17
- this.is_admin_prism = user.is_admin_prism
18
- this.is_admin_scout = user.is_admin_scout
19
- this.is_admin_triage = user.is_admin_triage
20
- }
21
-
22
- static is(user : any) : user is User {
23
- return (
24
- user !== undefined &&
25
- typeof user.user_id === "string" &&
26
- typeof user.email === "string" &&
27
- typeof user.is_admin_elections === "boolean" &&
28
- typeof user.is_admin_prism === "boolean" &&
29
- typeof user.is_admin_scout === "boolean" &&
30
- typeof user.is_admin_triage === "boolean"
31
- )
32
- }
33
- }
@@ -1,25 +0,0 @@
1
- // export const jurisdiction_type_ids = ["state", "federal_house_district", "state_house_district", "state_senate_district"] as const
2
-
3
- // export type JurisdictionTypeID = typeof jurisdiction_type_ids[number]
4
-
5
- // export function is_jurisdiction_type_id(jurisdiction_type_id : any) : jurisdiction_type_id is JurisdictionTypeID {
6
- // return jurisdiction_type_ids.includes(jurisdiction_type_id)
7
- // }
8
-
9
- // export class Jurisdiction {
10
- // readonly jurisdiction_id : string
11
-
12
- // constructor(jurisdiction : any) {
13
- // if (!Jurisdiction.is(jurisdiction)) {
14
- // throw Error("Invalid input.")
15
- // }
16
- // this.jurisdiction_id = jurisdiction.jurisdiction_id
17
- // }
18
-
19
- // static is(jurisdiction : any) : jurisdiction is Jurisdiction {
20
- // return (
21
- // jurisdiction !== undefined &&
22
- // typeof jurisdiction.jurisdiction_id === "string"
23
- // )
24
- // }
25
- // }
File without changes
File without changes
File without changes