triangle-types 1.0.19 → 1.0.20

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.
@@ -41,6 +41,7 @@ export * from "./types/federal_rules/FederalRuleTitle.js";
41
41
  export * from "./types/federal_rules/FederalRuleSection.js";
42
42
  export * from "./types/scout/Scout.js";
43
43
  export * from "./types/scout/ScoutDocument.js";
44
+ export * from "./types/scout/ScoutSubScout.js";
44
45
  export * from "./types/scout/ScoutTag.js";
45
46
  export * from "./types/scout/UserScout.js";
46
47
  export * from "./types/scout/UserScoutConversation.js";
package/dist/src/index.js CHANGED
@@ -41,6 +41,7 @@ export * from "./types/federal_rules/FederalRuleTitle.js";
41
41
  export * from "./types/federal_rules/FederalRuleSection.js";
42
42
  export * from "./types/scout/Scout.js";
43
43
  export * from "./types/scout/ScoutDocument.js";
44
+ export * from "./types/scout/ScoutSubScout.js";
44
45
  export * from "./types/scout/ScoutTag.js";
45
46
  export * from "./types/scout/UserScout.js";
46
47
  export * from "./types/scout/UserScoutConversation.js";
@@ -3,7 +3,7 @@ export declare class FederalRuleSection {
3
3
  readonly federal_rule_title_id: number;
4
4
  readonly section_id: string;
5
5
  readonly part_id: string;
6
- readonly sub_part_id?: string;
6
+ readonly subpart_id?: string;
7
7
  readonly name: string;
8
8
  readonly is_substantive: boolean;
9
9
  readonly is_removed: boolean;
@@ -3,7 +3,7 @@ export class FederalRuleSection {
3
3
  federal_rule_title_id;
4
4
  section_id;
5
5
  part_id;
6
- sub_part_id;
6
+ subpart_id;
7
7
  name;
8
8
  is_substantive;
9
9
  is_removed;
@@ -16,7 +16,7 @@ export class FederalRuleSection {
16
16
  this.federal_rule_title_id = federal_rule_section.federal_rule_title_id;
17
17
  this.section_id = federal_rule_section.section_id;
18
18
  this.part_id = federal_rule_section.part_id;
19
- this.sub_part_id = federal_rule_section.sub_part_id;
19
+ this.subpart_id = federal_rule_section.subpart_id;
20
20
  this.name = federal_rule_section.name;
21
21
  this.is_substantive = federal_rule_section.is_substantive;
22
22
  this.is_removed = federal_rule_section.is_removed;
@@ -28,7 +28,7 @@ export class FederalRuleSection {
28
28
  typeof federal_rule_section.federal_rule_title_id === "number" && !isNaN(federal_rule_section.federal_rule_title_id) &&
29
29
  typeof federal_rule_section.section_id === "string" &&
30
30
  typeof federal_rule_section.part_id === "string" &&
31
- (federal_rule_section.sub_part_id === undefined || typeof federal_rule_section.sub_part_id === "string") &&
31
+ (federal_rule_section.subpart_id === undefined || typeof federal_rule_section.subpart_id === "string") &&
32
32
  typeof federal_rule_section.name === "string" &&
33
33
  typeof federal_rule_section.is_substantive === "boolean" &&
34
34
  typeof federal_rule_section.is_removed === "boolean" &&
@@ -1,3 +1,4 @@
1
+ import { StateID } from "../State.js";
1
2
  declare const scout_type_ids: readonly ["I", "O"];
2
3
  export type ScoutTypeID = typeof scout_type_ids[number];
3
4
  export declare function is_scout_type_id(scout_type_id: any): scout_type_id is ScoutTypeID;
@@ -15,4 +16,14 @@ export declare class ScoutAux extends Scout {
15
16
  constructor(scout: any);
16
17
  static is(scout: any): scout is ScoutAux;
17
18
  }
19
+ declare const scout_office_ids: readonly ["USP", "USH", "USS", "STG", "STH", "STS"];
20
+ export type ScoutOfficeID = typeof scout_office_ids[number];
21
+ export declare function is_scout_office_id(scout_office_id: any): scout_office_id is ScoutOfficeID;
22
+ export declare class IndividualScout extends Scout {
23
+ readonly office_id: ScoutOfficeID;
24
+ readonly state_id?: StateID;
25
+ readonly district?: number;
26
+ constructor(scout: any);
27
+ static is(scout: any): scout is ScoutAux;
28
+ }
18
29
  export {};
@@ -38,3 +38,27 @@ export class ScoutAux extends Scout {
38
38
  (scout.s3_url_jpeg === undefined || typeof scout.s3_url_jpeg === "string"));
39
39
  }
40
40
  }
41
+ const scout_office_ids = ["USP", "USH", "USS", "STG", "STH", "STS"];
42
+ export function is_scout_office_id(scout_office_id) {
43
+ return scout_office_ids.includes(scout_office_id);
44
+ }
45
+ export class IndividualScout extends Scout {
46
+ office_id;
47
+ state_id;
48
+ district;
49
+ constructor(scout) {
50
+ if (!ScoutAux.is(scout)) {
51
+ throw Error("Invalid input.");
52
+ }
53
+ super(scout);
54
+ this.office_id = scout.office_id;
55
+ this.state_id = scout.state_id;
56
+ this.district = scout.district;
57
+ }
58
+ static is(scout) {
59
+ return (Scout.is(scout) &&
60
+ is_scout_office_id(scout.office_id) &&
61
+ (scout.state_id === undefined || typeof scout.state_id === "string") &&
62
+ (scout.district === undefined || typeof scout.district === "number"));
63
+ }
64
+ }
@@ -0,0 +1,7 @@
1
+ export declare class ScoutSubScout {
2
+ readonly scout_id: string;
3
+ readonly sub_scout_id: string;
4
+ readonly [x: string]: any;
5
+ constructor(scout_sub_scout: ScoutSubScout);
6
+ static is(scout_sub_scout: any): scout_sub_scout is ScoutSubScout;
7
+ }
@@ -0,0 +1,16 @@
1
+ export class ScoutSubScout {
2
+ scout_id;
3
+ sub_scout_id;
4
+ constructor(scout_sub_scout) {
5
+ if (!ScoutSubScout.is(scout_sub_scout)) {
6
+ throw Error("Invalid input.");
7
+ }
8
+ this.scout_id = scout_sub_scout.scout_id;
9
+ this.sub_scout_id = scout_sub_scout.sub_scout_id;
10
+ }
11
+ static is(scout_sub_scout) {
12
+ return (scout_sub_scout !== undefined &&
13
+ typeof scout_sub_scout.scout_id === "string" &&
14
+ typeof scout_sub_scout.sub_scout_id === "string");
15
+ }
16
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "triangle-types",
3
- "version": "1.0.19",
3
+ "version": "1.0.20",
4
4
  "main": "dist/src/index.js",
5
5
  "types": "dist/src/index.d.ts",
6
6
  "scripts": {
package/src/index.ts CHANGED
@@ -49,6 +49,7 @@ export * from "./types/federal_rules/FederalRuleSection"
49
49
 
50
50
  export * from "./types/scout/Scout"
51
51
  export * from "./types/scout/ScoutDocument"
52
+ export * from "./types/scout/ScoutSubScout"
52
53
  export * from "./types/scout/ScoutTag"
53
54
  export * from "./types/scout/UserScout"
54
55
  export * from "./types/scout/UserScoutConversation"
@@ -3,7 +3,7 @@ export class FederalRuleSection {
3
3
  readonly federal_rule_title_id : number
4
4
  readonly section_id : string
5
5
  readonly part_id : string
6
- readonly sub_part_id? : string
6
+ readonly subpart_id? : string
7
7
  readonly name : string
8
8
  readonly is_substantive : boolean
9
9
  readonly is_removed : boolean
@@ -18,7 +18,7 @@ export class FederalRuleSection {
18
18
  this.federal_rule_title_id = federal_rule_section.federal_rule_title_id
19
19
  this.section_id = federal_rule_section.section_id
20
20
  this.part_id = federal_rule_section.part_id
21
- this.sub_part_id = federal_rule_section.sub_part_id
21
+ this.subpart_id = federal_rule_section.subpart_id
22
22
  this.name = federal_rule_section.name
23
23
  this.is_substantive = federal_rule_section.is_substantive
24
24
  this.is_removed = federal_rule_section.is_removed
@@ -32,7 +32,7 @@ export class FederalRuleSection {
32
32
  typeof federal_rule_section.federal_rule_title_id === "number" && !isNaN(federal_rule_section.federal_rule_title_id) &&
33
33
  typeof federal_rule_section.section_id === "string" &&
34
34
  typeof federal_rule_section.part_id === "string" &&
35
- (federal_rule_section.sub_part_id === undefined || typeof federal_rule_section.sub_part_id === "string") &&
35
+ (federal_rule_section.subpart_id === undefined || typeof federal_rule_section.subpart_id === "string") &&
36
36
  typeof federal_rule_section.name === "string" &&
37
37
  typeof federal_rule_section.is_substantive === "boolean" &&
38
38
  typeof federal_rule_section.is_removed === "boolean" &&
@@ -1,3 +1,5 @@
1
+ import { StateID } from "../State"
2
+
1
3
  const scout_type_ids = ["I", "O"] as const
2
4
 
3
5
  export type ScoutTypeID = typeof scout_type_ids[number]
@@ -51,4 +53,37 @@ export class ScoutAux extends Scout {
51
53
  (scout.s3_url_jpeg === undefined || typeof scout.s3_url_jpeg === "string")
52
54
  )
53
55
  }
56
+ }
57
+
58
+ const scout_office_ids = ["USP", "USH", "USS", "STG", "STH", "STS"] as const
59
+
60
+ export type ScoutOfficeID = typeof scout_office_ids[number]
61
+
62
+ export function is_scout_office_id(scout_office_id : any) : scout_office_id is ScoutOfficeID {
63
+ return scout_office_ids.includes(scout_office_id)
64
+ }
65
+
66
+ export class IndividualScout extends Scout {
67
+ readonly office_id : ScoutOfficeID
68
+ readonly state_id? : StateID
69
+ readonly district? : number
70
+
71
+ constructor(scout : any) {
72
+ if (!ScoutAux.is(scout)) {
73
+ throw Error("Invalid input.")
74
+ }
75
+ super(scout)
76
+ this.office_id = scout.office_id
77
+ this.state_id = scout.state_id
78
+ this.district = scout.district
79
+ }
80
+
81
+ static is(scout : any) : scout is ScoutAux {
82
+ return (
83
+ Scout.is(scout) &&
84
+ is_scout_office_id(scout.office_id) &&
85
+ (scout.state_id === undefined || typeof scout.state_id === "string") &&
86
+ (scout.district === undefined || typeof scout.district === "number")
87
+ )
88
+ }
54
89
  }
@@ -0,0 +1,21 @@
1
+ export class ScoutSubScout {
2
+ readonly scout_id : string
3
+ readonly sub_scout_id : string
4
+ readonly [x : string] : any
5
+
6
+ constructor(scout_sub_scout : ScoutSubScout) {
7
+ if (!ScoutSubScout.is(scout_sub_scout)) {
8
+ throw Error("Invalid input.")
9
+ }
10
+ this.scout_id = scout_sub_scout.scout_id
11
+ this.sub_scout_id = scout_sub_scout.sub_scout_id
12
+ }
13
+
14
+ static is(scout_sub_scout : any) : scout_sub_scout is ScoutSubScout {
15
+ return (
16
+ scout_sub_scout !== undefined &&
17
+ typeof scout_sub_scout.scout_id === "string" &&
18
+ typeof scout_sub_scout.sub_scout_id === "string"
19
+ )
20
+ }
21
+ }