triangle-utils 1.4.160 → 1.4.162

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.
@@ -134,7 +134,7 @@ export class UtilsBedrock {
134
134
  if (verbosity > 1) {
135
135
  console.log(JSON.stringify(body.content, undefined, 4));
136
136
  }
137
- const text = body.content.filter((content) => content.type === "text")[0].text;
137
+ const text = body.content.filter((content) => content.type === "text")[0]?.text;
138
138
  return text;
139
139
  }
140
140
  catch (error) {
@@ -21,6 +21,7 @@ export declare class GlobalConfig {
21
21
  readonly twitter_api_key: string;
22
22
  readonly youtube_api_key: string;
23
23
  readonly xai_api_key: string;
24
+ readonly ballotpedia_api_key: string;
24
25
  readonly [x: string]: any;
25
26
  constructor(global_config: GlobalConfig);
26
27
  static is(global_config: any): global_config is GlobalConfig;
@@ -21,6 +21,7 @@ export class GlobalConfig {
21
21
  twitter_api_key;
22
22
  youtube_api_key;
23
23
  xai_api_key;
24
+ ballotpedia_api_key;
24
25
  constructor(global_config) {
25
26
  if (!GlobalConfig.is(global_config)) {
26
27
  throw Error("Invalid input.");
@@ -47,6 +48,7 @@ export class GlobalConfig {
47
48
  this.twitter_api_key = global_config.twitter_api_key;
48
49
  this.youtube_api_key = global_config.youtube_api_key;
49
50
  this.xai_api_key = global_config.xai_api_key;
51
+ this.ballotpedia_api_key = global_config.ballotpedia_api_key;
50
52
  }
51
53
  static is(global_config) {
52
54
  return (global_config !== undefined &&
@@ -71,6 +73,7 @@ export class GlobalConfig {
71
73
  typeof global_config.scraping_bee_api_key === "string" &&
72
74
  typeof global_config.twitter_api_key === "string" &&
73
75
  typeof global_config.youtube_api_key === "string" &&
74
- typeof global_config.xai_api_key === "string");
76
+ typeof global_config.xai_api_key === "string" &&
77
+ typeof global_config.ballotpedia_api_key === "string");
75
78
  }
76
79
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "triangle-utils",
3
- "version": "1.4.160",
3
+ "version": "1.4.162",
4
4
  "main": "dist/src/index.js",
5
5
  "types": "dist/src/index.d.ts",
6
6
  "directories": {
@@ -166,7 +166,7 @@ export class UtilsBedrock {
166
166
  if (verbosity > 1) {
167
167
  console.log(JSON.stringify(body.content, undefined, 4))
168
168
  }
169
- const text = body.content.filter((content : any) => content.type === "text")[0].text
169
+ const text = body.content.filter((content : any) => content.type === "text")[0]?.text
170
170
  return text
171
171
  } catch (error) {
172
172
  if (error instanceof Error) {
@@ -21,6 +21,7 @@ export class GlobalConfig {
21
21
  readonly twitter_api_key : string
22
22
  readonly youtube_api_key : string
23
23
  readonly xai_api_key : string
24
+ readonly ballotpedia_api_key : string
24
25
  readonly [x : string] : any
25
26
 
26
27
  constructor(global_config : GlobalConfig) {
@@ -49,6 +50,7 @@ export class GlobalConfig {
49
50
  this.twitter_api_key = global_config.twitter_api_key
50
51
  this.youtube_api_key = global_config.youtube_api_key
51
52
  this.xai_api_key = global_config.xai_api_key
53
+ this.ballotpedia_api_key = global_config.ballotpedia_api_key
52
54
  }
53
55
 
54
56
  static is(global_config : any) : global_config is GlobalConfig {
@@ -75,7 +77,8 @@ export class GlobalConfig {
75
77
  typeof global_config.scraping_bee_api_key === "string" &&
76
78
  typeof global_config.twitter_api_key === "string" &&
77
79
  typeof global_config.youtube_api_key === "string" &&
78
- typeof global_config.xai_api_key === "string"
80
+ typeof global_config.xai_api_key === "string" &&
81
+ typeof global_config.ballotpedia_api_key === "string"
79
82
  )
80
83
  }
81
84
  }