triangle-types 1.0.44 → 1.0.45

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.
@@ -44,6 +44,7 @@ export * from "./types/fragments/FragmentVector.js";
44
44
  export * from "./types/legistar/LegistarAgency.js";
45
45
  export * from "./types/legistar/LegistarDocument.js";
46
46
  export * from "./types/prism/Prism.js";
47
+ export * from "./types/prism/PrismMetric.js";
47
48
  export * from "./types/prism/PrismVoter.js";
48
49
  export * from "./types/prism/UserPrism.js";
49
50
  export * from "./types/prism/Voter.js";
package/dist/src/index.js CHANGED
@@ -44,6 +44,7 @@ export * from "./types/fragments/FragmentVector.js";
44
44
  export * from "./types/legistar/LegistarAgency.js";
45
45
  export * from "./types/legistar/LegistarDocument.js";
46
46
  export * from "./types/prism/Prism.js";
47
+ export * from "./types/prism/PrismMetric.js";
47
48
  export * from "./types/prism/PrismVoter.js";
48
49
  export * from "./types/prism/UserPrism.js";
49
50
  export * from "./types/prism/Voter.js";
@@ -0,0 +1,9 @@
1
+ export declare class PrismMetric {
2
+ readonly prism_metric_id: string;
3
+ readonly prism_id: string;
4
+ readonly metric_id: string;
5
+ readonly state_id: string;
6
+ readonly value: number;
7
+ constructor(prism_metric: any);
8
+ static is(prism_metric: any): prism_metric is PrismMetric;
9
+ }
@@ -0,0 +1,25 @@
1
+ export class PrismMetric {
2
+ prism_metric_id;
3
+ prism_id;
4
+ metric_id;
5
+ state_id;
6
+ value;
7
+ constructor(prism_metric) {
8
+ if (!PrismMetric.is(prism_metric)) {
9
+ throw Error("Invalid input.");
10
+ }
11
+ this.prism_metric_id = prism_metric.prism_metric_id;
12
+ this.prism_id = prism_metric.prism_id;
13
+ this.metric_id = prism_metric.metric_id;
14
+ this.state_id = prism_metric.state_id;
15
+ this.value = prism_metric.value;
16
+ }
17
+ static is(prism_metric) {
18
+ return (prism_metric !== undefined &&
19
+ typeof prism_metric.prism_metric_id === "string" &&
20
+ typeof prism_metric.prism_id === "string" &&
21
+ typeof prism_metric.metric_id === "string" &&
22
+ typeof prism_metric.state_id === "string" &&
23
+ typeof prism_metric.value === "number");
24
+ }
25
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "triangle-types",
3
- "version": "1.0.44",
3
+ "version": "1.0.45",
4
4
  "main": "dist/src/index.js",
5
5
  "types": "dist/src/index.d.ts",
6
6
  "scripts": {
package/src/index.ts CHANGED
@@ -54,6 +54,7 @@ export * from "./types/legistar/LegistarAgency"
54
54
  export * from "./types/legistar/LegistarDocument"
55
55
 
56
56
  export * from "./types/prism/Prism"
57
+ export * from "./types/prism/PrismMetric"
57
58
  export * from "./types/prism/PrismVoter"
58
59
  export * from "./types/prism/UserPrism"
59
60
  export * from "./types/prism/Voter"
@@ -0,0 +1,29 @@
1
+ export class PrismMetric {
2
+ readonly prism_metric_id : string
3
+ readonly prism_id : string
4
+ readonly metric_id : string
5
+ readonly state_id : string
6
+ readonly value : number
7
+
8
+ constructor(prism_metric : any) {
9
+ if (!PrismMetric.is(prism_metric)) {
10
+ throw Error("Invalid input.")
11
+ }
12
+ this.prism_metric_id = prism_metric.prism_metric_id
13
+ this.prism_id = prism_metric.prism_id
14
+ this.metric_id = prism_metric.metric_id
15
+ this.state_id = prism_metric.state_id
16
+ this.value = prism_metric.value
17
+ }
18
+
19
+ static is(prism_metric : any) : prism_metric is PrismMetric {
20
+ return (
21
+ prism_metric !== undefined &&
22
+ typeof prism_metric.prism_metric_id === "string" &&
23
+ typeof prism_metric.prism_id === "string" &&
24
+ typeof prism_metric.metric_id === "string" &&
25
+ typeof prism_metric.state_id === "string" &&
26
+ typeof prism_metric.value === "number"
27
+ )
28
+ }
29
+ }