triangle-types 1.0.64 → 1.0.66
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.
package/dist/src/index.d.ts
CHANGED
|
@@ -50,6 +50,7 @@ export * from "./types/prism/PrismSubPrism.js";
|
|
|
50
50
|
export * from "./types/prism/PrismSegment.js";
|
|
51
51
|
export * from "./types/prism/PrismTarget.js";
|
|
52
52
|
export * from "./types/prism/UserPrism.js";
|
|
53
|
+
export * from "./types/prism/UserPrismSegment.js";
|
|
53
54
|
export * from "./types/prism/Voter.js";
|
|
54
55
|
export * from "./types/prism/VoterTarget.js";
|
|
55
56
|
export * from "./types/prism/VoterTurnout.js";
|
package/dist/src/index.js
CHANGED
|
@@ -50,6 +50,7 @@ export * from "./types/prism/PrismSubPrism.js";
|
|
|
50
50
|
export * from "./types/prism/PrismSegment.js";
|
|
51
51
|
export * from "./types/prism/PrismTarget.js";
|
|
52
52
|
export * from "./types/prism/UserPrism.js";
|
|
53
|
+
export * from "./types/prism/UserPrismSegment.js";
|
|
53
54
|
export * from "./types/prism/Voter.js";
|
|
54
55
|
export * from "./types/prism/VoterTarget.js";
|
|
55
56
|
export * from "./types/prism/VoterTurnout.js";
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export declare class UserPrismSegmentFilter {
|
|
2
|
+
readonly target_id: string;
|
|
3
|
+
readonly min: number;
|
|
4
|
+
readonly max: number;
|
|
5
|
+
constructor(filter: any);
|
|
6
|
+
static is(filter: any): filter is UserPrismSegmentFilter;
|
|
7
|
+
}
|
|
8
|
+
export declare class UserPrismSegment {
|
|
9
|
+
readonly user_prism_segment_id: string;
|
|
10
|
+
readonly user_id: string;
|
|
11
|
+
readonly prism_id: string;
|
|
12
|
+
readonly segment_id: string;
|
|
13
|
+
readonly name: string;
|
|
14
|
+
readonly prism_segment_ids: string[];
|
|
15
|
+
readonly filters: UserPrismSegmentFilter[];
|
|
16
|
+
readonly [x: string]: any;
|
|
17
|
+
constructor(user_prism_segment: any);
|
|
18
|
+
static is(user_prism_segment: any): user_prism_segment is UserPrismSegment;
|
|
19
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
export class UserPrismSegmentFilter {
|
|
2
|
+
target_id;
|
|
3
|
+
min;
|
|
4
|
+
max;
|
|
5
|
+
constructor(filter) {
|
|
6
|
+
if (!UserPrismSegmentFilter.is(filter)) {
|
|
7
|
+
throw Error("Invalid input.");
|
|
8
|
+
}
|
|
9
|
+
this.target_id = filter.target_id;
|
|
10
|
+
this.min = filter.min;
|
|
11
|
+
this.max = filter.max;
|
|
12
|
+
}
|
|
13
|
+
static is(filter) {
|
|
14
|
+
return (filter !== undefined &&
|
|
15
|
+
typeof filter.target_id === "string" &&
|
|
16
|
+
typeof filter.min === "number" &&
|
|
17
|
+
typeof filter.max === "number");
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
export class UserPrismSegment {
|
|
21
|
+
user_prism_segment_id;
|
|
22
|
+
user_id;
|
|
23
|
+
prism_id;
|
|
24
|
+
segment_id;
|
|
25
|
+
name;
|
|
26
|
+
prism_segment_ids;
|
|
27
|
+
filters;
|
|
28
|
+
constructor(user_prism_segment) {
|
|
29
|
+
if (!UserPrismSegment.is(user_prism_segment)) {
|
|
30
|
+
throw Error("Invalid input.");
|
|
31
|
+
}
|
|
32
|
+
this.user_prism_segment_id = user_prism_segment.user_prism_segment_id;
|
|
33
|
+
this.user_id = user_prism_segment.user_id;
|
|
34
|
+
this.prism_id = user_prism_segment.prism_id;
|
|
35
|
+
this.segment_id = user_prism_segment.segment_id;
|
|
36
|
+
this.name = user_prism_segment.name;
|
|
37
|
+
this.prism_segment_ids = user_prism_segment.prism_segment_ids;
|
|
38
|
+
this.filters = user_prism_segment.filters;
|
|
39
|
+
}
|
|
40
|
+
static is(user_prism_segment) {
|
|
41
|
+
return (user_prism_segment !== undefined &&
|
|
42
|
+
typeof user_prism_segment.user_prism_segment_id === "string" &&
|
|
43
|
+
typeof user_prism_segment.user_id === "string" &&
|
|
44
|
+
typeof user_prism_segment.prism_id === "string" &&
|
|
45
|
+
typeof user_prism_segment.segment_id === "string" &&
|
|
46
|
+
typeof user_prism_segment.name === "string" &&
|
|
47
|
+
Array.isArray(user_prism_segment.prism_segment_ids) && user_prism_segment.prism_segment_ids.every((prism_segment_id) => typeof prism_segment_id === "string") &&
|
|
48
|
+
Array.isArray(user_prism_segment.filters) && user_prism_segment.filters.every(UserPrismSegmentFilter.is));
|
|
49
|
+
}
|
|
50
|
+
}
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -60,6 +60,7 @@ export * from "./types/prism/PrismSubPrism"
|
|
|
60
60
|
export * from "./types/prism/PrismSegment"
|
|
61
61
|
export * from "./types/prism/PrismTarget"
|
|
62
62
|
export * from "./types/prism/UserPrism"
|
|
63
|
+
export * from "./types/prism/UserPrismSegment"
|
|
63
64
|
export * from "./types/prism/Voter"
|
|
64
65
|
export * from "./types/prism/VoterTarget"
|
|
65
66
|
export * from "./types/prism/VoterTurnout"
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
export class UserPrismSegmentFilter {
|
|
2
|
+
readonly target_id : string
|
|
3
|
+
readonly min : number
|
|
4
|
+
readonly max : number
|
|
5
|
+
|
|
6
|
+
constructor(filter : any) {
|
|
7
|
+
if (!UserPrismSegmentFilter.is(filter)) {
|
|
8
|
+
throw Error("Invalid input.")
|
|
9
|
+
}
|
|
10
|
+
this.target_id = filter.target_id
|
|
11
|
+
this.min = filter.min
|
|
12
|
+
this.max = filter.max
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
static is(filter : any) : filter is UserPrismSegmentFilter {
|
|
16
|
+
return (
|
|
17
|
+
filter !== undefined &&
|
|
18
|
+
typeof filter.target_id === "string" &&
|
|
19
|
+
typeof filter.min === "number" &&
|
|
20
|
+
typeof filter.max === "number"
|
|
21
|
+
)
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
export class UserPrismSegment {
|
|
27
|
+
readonly user_prism_segment_id : string
|
|
28
|
+
readonly user_id : string
|
|
29
|
+
readonly prism_id : string
|
|
30
|
+
readonly segment_id : string
|
|
31
|
+
readonly name : string
|
|
32
|
+
readonly prism_segment_ids : string[]
|
|
33
|
+
readonly filters : UserPrismSegmentFilter[]
|
|
34
|
+
readonly [x : string] : any
|
|
35
|
+
|
|
36
|
+
constructor(user_prism_segment : any) {
|
|
37
|
+
if (!UserPrismSegment.is(user_prism_segment)) {
|
|
38
|
+
throw Error("Invalid input.")
|
|
39
|
+
}
|
|
40
|
+
this.user_prism_segment_id = user_prism_segment.user_prism_segment_id
|
|
41
|
+
this.user_id = user_prism_segment.user_id
|
|
42
|
+
this.prism_id = user_prism_segment.prism_id
|
|
43
|
+
this.segment_id = user_prism_segment.segment_id
|
|
44
|
+
this.name = user_prism_segment.name
|
|
45
|
+
this.prism_segment_ids = user_prism_segment.prism_segment_ids
|
|
46
|
+
this.filters = user_prism_segment.filters
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
static is(user_prism_segment : any) : user_prism_segment is UserPrismSegment {
|
|
50
|
+
return (
|
|
51
|
+
user_prism_segment !== undefined &&
|
|
52
|
+
typeof user_prism_segment.user_prism_segment_id === "string" &&
|
|
53
|
+
typeof user_prism_segment.user_id === "string" &&
|
|
54
|
+
typeof user_prism_segment.prism_id === "string" &&
|
|
55
|
+
typeof user_prism_segment.segment_id === "string" &&
|
|
56
|
+
typeof user_prism_segment.name === "string" &&
|
|
57
|
+
Array.isArray(user_prism_segment.prism_segment_ids) && user_prism_segment.prism_segment_ids.every((prism_segment_id : any) => typeof prism_segment_id === "string") &&
|
|
58
|
+
Array.isArray(user_prism_segment.filters) && user_prism_segment.filters.every(UserPrismSegmentFilter.is)
|
|
59
|
+
)
|
|
60
|
+
}
|
|
61
|
+
}
|