triangle-utils 1.4.178 → 1.4.179
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
|
@@ -12,7 +12,6 @@ import { UtilsAnthropic } from "./UtilsAnthropic.js";
|
|
|
12
12
|
import { UtilsTwitter } from "./UtilsTwitter.js";
|
|
13
13
|
import { GlobalConfig } from "./types/GlobalConfig.js";
|
|
14
14
|
import { UtilsRDS } from "./UtilsRDS.js";
|
|
15
|
-
import { ApplicationConfig } from "./types/ApplicationConfig.js";
|
|
16
15
|
import { UtilsTextract } from "./UtilsTextract.js";
|
|
17
16
|
import { UtilsBrave } from "./UtilsBrave.js";
|
|
18
17
|
export declare class TriangleUtils extends UtilsMisc {
|
|
@@ -30,9 +29,8 @@ export declare class TriangleUtils extends UtilsMisc {
|
|
|
30
29
|
readonly anthropic: UtilsAnthropic;
|
|
31
30
|
readonly xai: UtilsXAI;
|
|
32
31
|
readonly twitter: UtilsTwitter;
|
|
33
|
-
constructor(config:
|
|
32
|
+
constructor(config: GlobalConfig);
|
|
34
33
|
}
|
|
35
|
-
export * from "./types/ApplicationConfig.js";
|
|
36
34
|
export * from "./types/GlobalConfig.js";
|
|
37
35
|
export * from "./UtilsAnthropic.js";
|
|
38
36
|
export * from "./UtilsDynamoDB.js";
|
package/dist/src/index.js
CHANGED
|
@@ -46,7 +46,6 @@ export class TriangleUtils extends UtilsMisc {
|
|
|
46
46
|
this.twitter = new UtilsTwitter(config.twitter_api_key);
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
|
-
export * from "./types/ApplicationConfig.js";
|
|
50
49
|
export * from "./types/GlobalConfig.js";
|
|
51
50
|
export * from "./UtilsAnthropic.js";
|
|
52
51
|
export * from "./UtilsDynamoDB.js";
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
export declare class GlobalConfig {
|
|
2
2
|
readonly region: string;
|
|
3
3
|
readonly cognito_user_pool_id: string;
|
|
4
|
+
readonly cognito_client_id: string;
|
|
5
|
+
readonly cognito_client_secret: string;
|
|
4
6
|
readonly secret_key: string;
|
|
5
7
|
readonly auth_url: string;
|
|
6
8
|
readonly s3_triangle: string;
|
|
@@ -20,6 +22,7 @@ export declare class GlobalConfig {
|
|
|
20
22
|
readonly scraping_bee_api_key: string;
|
|
21
23
|
readonly twitter_api_key: string;
|
|
22
24
|
readonly youtube_api_key: string;
|
|
25
|
+
readonly anthropic_api_key: string;
|
|
23
26
|
readonly xai_api_key: string;
|
|
24
27
|
readonly ballotpedia_api_key: string;
|
|
25
28
|
readonly brave_api_key: string;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
export class GlobalConfig {
|
|
2
2
|
region;
|
|
3
3
|
cognito_user_pool_id;
|
|
4
|
+
cognito_client_id;
|
|
5
|
+
cognito_client_secret;
|
|
4
6
|
secret_key;
|
|
5
7
|
auth_url;
|
|
6
8
|
s3_triangle;
|
|
@@ -20,6 +22,7 @@ export class GlobalConfig {
|
|
|
20
22
|
scraping_bee_api_key;
|
|
21
23
|
twitter_api_key;
|
|
22
24
|
youtube_api_key;
|
|
25
|
+
anthropic_api_key;
|
|
23
26
|
xai_api_key;
|
|
24
27
|
ballotpedia_api_key;
|
|
25
28
|
brave_api_key;
|
|
@@ -29,6 +32,8 @@ export class GlobalConfig {
|
|
|
29
32
|
}
|
|
30
33
|
this.region = global_config.region;
|
|
31
34
|
this.cognito_user_pool_id = global_config.cognito_user_pool_id;
|
|
35
|
+
this.cognito_client_id = global_config.cognito_client_id;
|
|
36
|
+
this.cognito_client_secret = global_config.cognito_client_secret;
|
|
32
37
|
this.secret_key = global_config.secret_key;
|
|
33
38
|
this.auth_url = global_config.auth_url;
|
|
34
39
|
this.s3_triangle = global_config.s3_triangle;
|
|
@@ -48,6 +53,7 @@ export class GlobalConfig {
|
|
|
48
53
|
this.scraping_bee_api_key = global_config.scraping_bee_api_key;
|
|
49
54
|
this.twitter_api_key = global_config.twitter_api_key;
|
|
50
55
|
this.youtube_api_key = global_config.youtube_api_key;
|
|
56
|
+
this.anthropic_api_key = global_config.anthropic_api_key;
|
|
51
57
|
this.xai_api_key = global_config.xai_api_key;
|
|
52
58
|
this.ballotpedia_api_key = global_config.ballotpedia_api_key;
|
|
53
59
|
this.brave_api_key = global_config.brave_api_key;
|
|
@@ -56,6 +62,8 @@ export class GlobalConfig {
|
|
|
56
62
|
return (global_config !== undefined &&
|
|
57
63
|
typeof global_config.region === "string" &&
|
|
58
64
|
typeof global_config.cognito_user_pool_id === "string" &&
|
|
65
|
+
typeof global_config.cognito_client_id === "string" &&
|
|
66
|
+
typeof global_config.cognito_client_secret === "string" &&
|
|
59
67
|
typeof global_config.secret_key === "string" &&
|
|
60
68
|
typeof global_config.auth_url === "string" &&
|
|
61
69
|
typeof global_config.s3_triangle === "string" &&
|
|
@@ -75,6 +83,7 @@ export class GlobalConfig {
|
|
|
75
83
|
typeof global_config.scraping_bee_api_key === "string" &&
|
|
76
84
|
typeof global_config.twitter_api_key === "string" &&
|
|
77
85
|
typeof global_config.youtube_api_key === "string" &&
|
|
86
|
+
typeof global_config.anthropic_api_key === "string" &&
|
|
78
87
|
typeof global_config.xai_api_key === "string" &&
|
|
79
88
|
typeof global_config.ballotpedia_api_key === "string" &&
|
|
80
89
|
typeof global_config.brave_api_key === "string");
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -12,7 +12,6 @@ import { UtilsAnthropic } from "./UtilsAnthropic"
|
|
|
12
12
|
import { UtilsTwitter } from "./UtilsTwitter"
|
|
13
13
|
import { GlobalConfig } from "./types/GlobalConfig"
|
|
14
14
|
import { UtilsRDS } from "./UtilsRDS"
|
|
15
|
-
import { ApplicationConfig } from "./types/ApplicationConfig"
|
|
16
15
|
import { UtilsTextract } from "./UtilsTextract"
|
|
17
16
|
import { UtilsBrave } from "./UtilsBrave"
|
|
18
17
|
|
|
@@ -35,7 +34,7 @@ export class TriangleUtils extends UtilsMisc {
|
|
|
35
34
|
readonly xai : UtilsXAI
|
|
36
35
|
readonly twitter : UtilsTwitter
|
|
37
36
|
|
|
38
|
-
constructor(config :
|
|
37
|
+
constructor(config : GlobalConfig) {
|
|
39
38
|
super(config)
|
|
40
39
|
this.dynamodb = new UtilsDynamoDB(config.region)
|
|
41
40
|
this.rds = new UtilsRDS(config.region, config.rds_cluster_arn, config.rds_secret_arn, config.rds_host, config.rds_username, config.rds_password)
|
|
@@ -54,7 +53,6 @@ export class TriangleUtils extends UtilsMisc {
|
|
|
54
53
|
}
|
|
55
54
|
}
|
|
56
55
|
|
|
57
|
-
export * from "./types/ApplicationConfig"
|
|
58
56
|
export * from "./types/GlobalConfig"
|
|
59
57
|
export * from "./UtilsAnthropic"
|
|
60
58
|
export * from "./UtilsDynamoDB"
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
export class GlobalConfig {
|
|
2
2
|
readonly region : string
|
|
3
3
|
readonly cognito_user_pool_id : string
|
|
4
|
+
readonly cognito_client_id : string
|
|
5
|
+
readonly cognito_client_secret : string
|
|
4
6
|
readonly secret_key : string
|
|
5
7
|
readonly auth_url : string
|
|
6
8
|
readonly s3_triangle : string
|
|
@@ -20,6 +22,7 @@ export class GlobalConfig {
|
|
|
20
22
|
readonly scraping_bee_api_key : string
|
|
21
23
|
readonly twitter_api_key : string
|
|
22
24
|
readonly youtube_api_key : string
|
|
25
|
+
readonly anthropic_api_key : string
|
|
23
26
|
readonly xai_api_key : string
|
|
24
27
|
readonly ballotpedia_api_key : string
|
|
25
28
|
readonly brave_api_key : string
|
|
@@ -31,6 +34,8 @@ export class GlobalConfig {
|
|
|
31
34
|
}
|
|
32
35
|
this.region = global_config.region
|
|
33
36
|
this.cognito_user_pool_id = global_config.cognito_user_pool_id
|
|
37
|
+
this.cognito_client_id = global_config.cognito_client_id
|
|
38
|
+
this.cognito_client_secret = global_config.cognito_client_secret
|
|
34
39
|
this.secret_key = global_config.secret_key
|
|
35
40
|
this.auth_url = global_config.auth_url
|
|
36
41
|
this.s3_triangle = global_config.s3_triangle
|
|
@@ -50,6 +55,7 @@ export class GlobalConfig {
|
|
|
50
55
|
this.scraping_bee_api_key = global_config.scraping_bee_api_key
|
|
51
56
|
this.twitter_api_key = global_config.twitter_api_key
|
|
52
57
|
this.youtube_api_key = global_config.youtube_api_key
|
|
58
|
+
this.anthropic_api_key = global_config.anthropic_api_key
|
|
53
59
|
this.xai_api_key = global_config.xai_api_key
|
|
54
60
|
this.ballotpedia_api_key = global_config.ballotpedia_api_key
|
|
55
61
|
this.brave_api_key = global_config.brave_api_key
|
|
@@ -60,6 +66,8 @@ export class GlobalConfig {
|
|
|
60
66
|
global_config !== undefined &&
|
|
61
67
|
typeof global_config.region === "string" &&
|
|
62
68
|
typeof global_config.cognito_user_pool_id === "string" &&
|
|
69
|
+
typeof global_config.cognito_client_id === "string" &&
|
|
70
|
+
typeof global_config.cognito_client_secret === "string" &&
|
|
63
71
|
typeof global_config.secret_key === "string" &&
|
|
64
72
|
typeof global_config.auth_url === "string" &&
|
|
65
73
|
typeof global_config.s3_triangle === "string" &&
|
|
@@ -79,6 +87,7 @@ export class GlobalConfig {
|
|
|
79
87
|
typeof global_config.scraping_bee_api_key === "string" &&
|
|
80
88
|
typeof global_config.twitter_api_key === "string" &&
|
|
81
89
|
typeof global_config.youtube_api_key === "string" &&
|
|
90
|
+
typeof global_config.anthropic_api_key === "string" &&
|
|
82
91
|
typeof global_config.xai_api_key === "string" &&
|
|
83
92
|
typeof global_config.ballotpedia_api_key === "string" &&
|
|
84
93
|
typeof global_config.brave_api_key === "string"
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
export class ApplicationConfig {
|
|
3
|
-
readonly cognito_client_id : string
|
|
4
|
-
readonly cognito_client_secret : string
|
|
5
|
-
readonly anthropic_api_key? : string
|
|
6
|
-
readonly [x : string] : any
|
|
7
|
-
|
|
8
|
-
constructor(application_config : ApplicationConfig) {
|
|
9
|
-
if (!ApplicationConfig.is(application_config)) {
|
|
10
|
-
throw Error("Invalid input.")
|
|
11
|
-
}
|
|
12
|
-
this.cognito_client_id = application_config.cognito_client_id
|
|
13
|
-
this.cognito_client_secret = application_config.cognito_client_secret
|
|
14
|
-
this.anthropic_api_key = application_config.anthropic_api_key
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
static is(application_config : any) : application_config is ApplicationConfig {
|
|
18
|
-
return (
|
|
19
|
-
application_config !== undefined &&
|
|
20
|
-
typeof application_config.cognito_client_id === "string" &&
|
|
21
|
-
typeof application_config.cognito_client_secret === "string" &&
|
|
22
|
-
(application_config.anthropic_api_key === undefined || typeof application_config.anthropic_api_key === "string")
|
|
23
|
-
)
|
|
24
|
-
}
|
|
25
|
-
}
|