triangle-types 1.0.289 → 1.0.291

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.
@@ -72,7 +72,7 @@ export * from "./types/prism/PrismSegment.js";
72
72
  export * from "./types/prism/PrismTarget.js";
73
73
  export * from "./types/prism/Target.js";
74
74
  export * from "./types/prism/TenantVoterTag.js";
75
- export * from "./types/prism/UserPrismSegment.js";
75
+ export * from "./types/prism/UserPrismSample.js";
76
76
  export * from "./types/prism/StateVoter.js";
77
77
  export * from "./types/prism/StateVoterFeature.js";
78
78
  export * from "./types/prism/StateVoterTarget.js";
package/dist/src/index.js CHANGED
@@ -72,7 +72,7 @@ export * from "./types/prism/PrismSegment.js";
72
72
  export * from "./types/prism/PrismTarget.js";
73
73
  export * from "./types/prism/Target.js";
74
74
  export * from "./types/prism/TenantVoterTag.js";
75
- export * from "./types/prism/UserPrismSegment.js";
75
+ export * from "./types/prism/UserPrismSample.js";
76
76
  export * from "./types/prism/StateVoter.js";
77
77
  export * from "./types/prism/StateVoterFeature.js";
78
78
  export * from "./types/prism/StateVoterTarget.js";
@@ -10,7 +10,7 @@ export declare class Prism {
10
10
  readonly sub_jurisdiction_type_ids: JurisdictionTypeID[];
11
11
  readonly party_type_ids?: VoterPartyTypeID[];
12
12
  readonly target_ids: string[];
13
- readonly layer_ids: string[];
13
+ readonly layers_json: string;
14
14
  readonly [x: string]: any;
15
15
  constructor(prism: any);
16
16
  static is(prism: any): prism is Prism;
@@ -10,7 +10,7 @@ export class Prism {
10
10
  sub_jurisdiction_type_ids;
11
11
  party_type_ids;
12
12
  target_ids;
13
- layer_ids;
13
+ layers_json;
14
14
  constructor(prism) {
15
15
  if (!Prism.is(prism)) {
16
16
  throw Error("Invalid input.");
@@ -23,7 +23,7 @@ export class Prism {
23
23
  this.sub_jurisdiction_type_ids = prism.sub_jurisdiction_type_ids;
24
24
  this.party_type_ids = prism.party_type_ids;
25
25
  this.target_ids = prism.target_ids;
26
- this.layer_ids = prism.layer_ids;
26
+ this.layers_json = prism.layers_json;
27
27
  }
28
28
  static is(prism) {
29
29
  return (prism !== undefined &&
@@ -35,6 +35,6 @@ export class Prism {
35
35
  Array.isArray(prism.sub_jurisdiction_type_ids) && prism.sub_jurisdiction_type_ids.every(is_jurisdiction_type_id) &&
36
36
  (prism.party_type_ids === undefined || Array.isArray(prism.party_type_ids) && prism.party_type_ids.every(is_voter_party_type_id)) &&
37
37
  Array.isArray(prism.target_ids) && prism.target_ids.every((target_id) => typeof target_id === "string") &&
38
- Array.isArray(prism.layer_ids) && prism.layer_ids.every((layer_id) => typeof layer_id === "string"));
38
+ typeof prism.layers_json === "string");
39
39
  }
40
40
  }
@@ -0,0 +1,12 @@
1
+ export declare class UserPrismSample {
2
+ readonly user_id: string;
3
+ readonly prism_id: string;
4
+ readonly sample_id: string;
5
+ readonly tenant_id: string;
6
+ readonly num_voters: number;
7
+ readonly name: string;
8
+ readonly seed: number;
9
+ readonly [x: string]: any;
10
+ constructor(prism_sample: any);
11
+ static is(prism_sample: any): prism_sample is UserPrismSample;
12
+ }
@@ -0,0 +1,31 @@
1
+ export class UserPrismSample {
2
+ user_id;
3
+ prism_id;
4
+ sample_id;
5
+ tenant_id;
6
+ num_voters;
7
+ name;
8
+ seed;
9
+ constructor(prism_sample) {
10
+ if (!UserPrismSample.is(prism_sample)) {
11
+ throw Error("Invalid input.");
12
+ }
13
+ this.user_id = prism_sample.user_id;
14
+ this.prism_id = prism_sample.prism_id;
15
+ this.sample_id = prism_sample.sample_id;
16
+ this.tenant_id = prism_sample.tenant_id;
17
+ this.num_voters = prism_sample.num_voters;
18
+ this.name = prism_sample.name;
19
+ this.seed = prism_sample.seed;
20
+ }
21
+ static is(prism_sample) {
22
+ return (prism_sample !== undefined &&
23
+ typeof prism_sample.user_id === "string" &&
24
+ typeof prism_sample.prism_id === "string" &&
25
+ typeof prism_sample.sample_id === "string" &&
26
+ typeof prism_sample.tenant_id === "string" &&
27
+ typeof prism_sample.num_voters === "number" &&
28
+ typeof prism_sample.name === "string" &&
29
+ typeof prism_sample.seed === "number");
30
+ }
31
+ }
@@ -1,4 +1,4 @@
1
- declare const resource_type_ids: readonly ["web_document", "twitter_tweet", "youtube_video", "document", "scout", "prism", "state_voter", "label", "target", "role", "user", "fragment_type", "palette"];
1
+ export declare const resource_type_ids: readonly ["web_document", "twitter_tweet", "youtube_video", "document", "scout", "prism", "state_voter", "label", "target", "role", "user", "fragment_type", "palette"];
2
2
  export type ResourceTypeID = typeof resource_type_ids[number];
3
3
  export declare function is_resource_type_id(resource_type_id: any): resource_type_id is ResourceTypeID;
4
4
  export declare class TenantProvision {
@@ -13,4 +13,3 @@ export declare class TenantProvision {
13
13
  constructor(tenant_provision: TenantProvision);
14
14
  static is(tenant_provision: any): tenant_provision is TenantProvision;
15
15
  }
16
- export {};
@@ -1,4 +1,4 @@
1
- const resource_type_ids = ["web_document", "twitter_tweet", "youtube_video", "document", "scout", "prism", "state_voter", "label", "target", "role", "user", "fragment_type", "palette"];
1
+ export const resource_type_ids = ["web_document", "twitter_tweet", "youtube_video", "document", "scout", "prism", "state_voter", "label", "target", "role", "user", "fragment_type", "palette"];
2
2
  export function is_resource_type_id(resource_type_id) {
3
3
  return resource_type_ids.includes(resource_type_id);
4
4
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "triangle-types",
3
- "version": "1.0.289",
3
+ "version": "1.0.291",
4
4
  "main": "dist/src/index.js",
5
5
  "types": "dist/src/index.d.ts",
6
6
  "scripts": {
package/src/index.ts CHANGED
@@ -87,7 +87,7 @@ export * from "./types/prism/PrismSegment"
87
87
  export * from "./types/prism/PrismTarget"
88
88
  export * from "./types/prism/Target"
89
89
  export * from "./types/prism/TenantVoterTag"
90
- export * from "./types/prism/UserPrismSegment"
90
+ export * from "./types/prism/UserPrismSample"
91
91
  export * from "./types/prism/StateVoter"
92
92
  export * from "./types/prism/StateVoterFeature"
93
93
  export * from "./types/prism/StateVoterTarget"
@@ -11,7 +11,7 @@ export class Prism {
11
11
  readonly sub_jurisdiction_type_ids : JurisdictionTypeID[]
12
12
  readonly party_type_ids? : VoterPartyTypeID[]
13
13
  readonly target_ids : string[]
14
- readonly layer_ids : string[]
14
+ readonly layers_json : string
15
15
  readonly [x : string] : any
16
16
 
17
17
  constructor(prism : any) {
@@ -26,7 +26,7 @@ export class Prism {
26
26
  this.sub_jurisdiction_type_ids = prism.sub_jurisdiction_type_ids
27
27
  this.party_type_ids = prism.party_type_ids
28
28
  this.target_ids = prism.target_ids
29
- this.layer_ids = prism.layer_ids
29
+ this.layers_json = prism.layers_json
30
30
  }
31
31
 
32
32
  static is(prism : any) : prism is Prism {
@@ -40,7 +40,7 @@ export class Prism {
40
40
  Array.isArray(prism.sub_jurisdiction_type_ids) && prism.sub_jurisdiction_type_ids.every(is_jurisdiction_type_id) &&
41
41
  (prism.party_type_ids === undefined || Array.isArray(prism.party_type_ids) && prism.party_type_ids.every(is_voter_party_type_id)) &&
42
42
  Array.isArray(prism.target_ids) && prism.target_ids.every((target_id : any) => typeof target_id === "string") &&
43
- Array.isArray(prism.layer_ids) && prism.layer_ids.every((layer_id : any) => typeof layer_id === "string")
43
+ typeof prism.layers_json === "string"
44
44
  )
45
45
  }
46
46
  }
@@ -0,0 +1,36 @@
1
+ export class UserPrismSample {
2
+ readonly user_id : string
3
+ readonly prism_id : string
4
+ readonly sample_id : string
5
+ readonly tenant_id : string
6
+ readonly num_voters : number
7
+ readonly name : string
8
+ readonly seed : number
9
+ readonly [x : string] : any
10
+
11
+ constructor(prism_sample : any) {
12
+ if (!UserPrismSample.is(prism_sample)) {
13
+ throw Error("Invalid input.")
14
+ }
15
+ this.user_id = prism_sample.user_id
16
+ this.prism_id = prism_sample.prism_id
17
+ this.sample_id = prism_sample.sample_id
18
+ this.tenant_id = prism_sample.tenant_id
19
+ this.num_voters = prism_sample.num_voters
20
+ this.name = prism_sample.name
21
+ this.seed = prism_sample.seed
22
+ }
23
+
24
+ static is(prism_sample : any) : prism_sample is UserPrismSample {
25
+ return (
26
+ prism_sample !== undefined &&
27
+ typeof prism_sample.user_id === "string" &&
28
+ typeof prism_sample.prism_id === "string" &&
29
+ typeof prism_sample.sample_id === "string" &&
30
+ typeof prism_sample.tenant_id === "string" &&
31
+ typeof prism_sample.num_voters === "number" &&
32
+ typeof prism_sample.name === "string" &&
33
+ typeof prism_sample.seed === "number"
34
+ )
35
+ }
36
+ }
@@ -1,4 +1,4 @@
1
- const resource_type_ids = ["web_document", "twitter_tweet", "youtube_video", "document", "scout", "prism", "state_voter", "label", "target", "role", "user", "fragment_type", "palette"] as const
1
+ export const resource_type_ids = ["web_document", "twitter_tweet", "youtube_video", "document", "scout", "prism", "state_voter", "label", "target", "role", "user", "fragment_type", "palette"] as const
2
2
 
3
3
  export type ResourceTypeID = typeof resource_type_ids[number]
4
4