triangle-utils 1.3.1 → 1.3.2
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/Utils.d.ts +17 -0
- package/dist/src/Utils_Bedrock.d.ts +10 -0
- package/dist/src/Utils_Bee.d.ts +11 -0
- package/dist/src/Utils_DynamoDB.d.ts +35 -0
- package/dist/src/Utils_Misc.d.ts +30 -0
- package/dist/src/Utils_S3.d.ts +14 -0
- package/dist/src/Utils_S3Vectors.d.ts +20 -0
- package/dist/src/Utils_Youtube.d.ts +8 -0
- package/dist/src/types/Config.d.ts +8 -0
- package/package.json +1 -1
- package/tsconfig.json +1 -1
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Utils_Misc } from "./Utils_Misc";
|
|
2
|
+
import { Utils_DynamoDB } from "./Utils_DynamoDB";
|
|
3
|
+
import { Utils_S3 } from "./Utils_S3";
|
|
4
|
+
import { Utils_Bedrock } from "./Utils_Bedrock";
|
|
5
|
+
import { Utils_Bee } from "./Utils_Bee";
|
|
6
|
+
import { Utils_S3Vectors } from "./Utils_S3Vectors";
|
|
7
|
+
import { Utils_Youtube } from "./Utils_Youtube";
|
|
8
|
+
import { Config } from "./types/Config";
|
|
9
|
+
export declare class Utils extends Utils_Misc {
|
|
10
|
+
readonly dynamodb: Utils_DynamoDB;
|
|
11
|
+
readonly s3: Utils_S3;
|
|
12
|
+
readonly s3vectors: Utils_S3Vectors;
|
|
13
|
+
readonly bedrock: Utils_Bedrock;
|
|
14
|
+
readonly bee: Utils_Bee;
|
|
15
|
+
readonly youtube: Utils_Youtube;
|
|
16
|
+
constructor(config: Config);
|
|
17
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { BedrockRuntime } from "@aws-sdk/client-bedrock-runtime";
|
|
2
|
+
import { Config } from "./types/Config";
|
|
3
|
+
export declare class Utils_Bedrock {
|
|
4
|
+
readonly bedrock: BedrockRuntime;
|
|
5
|
+
readonly text_decoder: TextDecoder;
|
|
6
|
+
constructor(config: Config);
|
|
7
|
+
llama_invoke(model_id: string, prompt: string, temperature?: number, max_gen_len?: number, top_p?: number): Promise<string | undefined>;
|
|
8
|
+
gpt_converse(model_id: string, prompt: string, temperature?: number, max_gen_len?: number, top_p?: number): Promise<string | undefined>;
|
|
9
|
+
titan_invoke(text: string): Promise<string | undefined>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ScrapingBeeClient } from "scrapingbee";
|
|
2
|
+
import { Config } from "./types/Config";
|
|
3
|
+
export declare class Utils_Bee {
|
|
4
|
+
readonly config: Config;
|
|
5
|
+
readonly bee: ScrapingBeeClient | undefined;
|
|
6
|
+
readonly text_decoder: TextDecoder;
|
|
7
|
+
constructor(config: Config);
|
|
8
|
+
get(url: string, params?: Record<string, string>): Promise<string>;
|
|
9
|
+
google_search(query: string, news?: boolean): Promise<any>;
|
|
10
|
+
youtube_search(query: string, options?: {}): Promise<any>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { DynamoDB } from "@aws-sdk/client-dynamodb";
|
|
2
|
+
import { Config } from "./types/Config";
|
|
3
|
+
export declare class Utils_DynamoDB {
|
|
4
|
+
readonly dynamodb: DynamoDB;
|
|
5
|
+
constructor(config: Config);
|
|
6
|
+
scan(table: string, options?: {
|
|
7
|
+
filters?: Record<string, any>;
|
|
8
|
+
undefined_attribute_names?: string[];
|
|
9
|
+
defined_attribute_names?: string[];
|
|
10
|
+
attribute_names?: string[];
|
|
11
|
+
concurrency?: number;
|
|
12
|
+
}): Promise<Record<string, any>[]>;
|
|
13
|
+
get(table: string, key: Record<string, any>, consistent?: boolean): Promise<Record<string, any> | undefined>;
|
|
14
|
+
get_max(table: string, primary_key: Record<string, any>): Promise<Record<string, any> | undefined>;
|
|
15
|
+
query(table: string, primary_key: Record<string, any>, options?: {
|
|
16
|
+
reverse?: boolean;
|
|
17
|
+
compile?: boolean;
|
|
18
|
+
}): Promise<Record<string, any>[] | undefined>;
|
|
19
|
+
query_prefix(table: string, primary_key: Record<string, any>, secondary_key_prefix: Record<string, string>, options?: {
|
|
20
|
+
reverse?: boolean;
|
|
21
|
+
compile?: boolean;
|
|
22
|
+
}): Promise<Record<string, any>[] | undefined>;
|
|
23
|
+
query_range(table: string, primary_key: Record<string, any>, secondary_key_range: Record<string, string | number[]>, options?: {
|
|
24
|
+
reverse?: boolean;
|
|
25
|
+
compile?: boolean;
|
|
26
|
+
}): Promise<Record<string, any>[] | undefined>;
|
|
27
|
+
set(table: string, key: Record<string, any>, attributes: Record<string, any>): Promise<void>;
|
|
28
|
+
append(table: string, key: Record<string, any>, attributes: Record<string, any[]>): Promise<void>;
|
|
29
|
+
add(table: string, key: Record<string, any>, attributes: Record<string, any[]>): Promise<void>;
|
|
30
|
+
remove(table: string, key: Record<string, any>, attributes: string[]): Promise<void>;
|
|
31
|
+
create(table: string, key: Record<string, any>, attributes?: Record<string, any[]>): Promise<void>;
|
|
32
|
+
delete(table: string, key: Record<string, any>): Promise<void>;
|
|
33
|
+
duplicate_attribute(table: string, attribute_name: string, new_attribute_name: string): Promise<void>;
|
|
34
|
+
remove_attribute(table: string, attribute_name: string): Promise<void>;
|
|
35
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import * as nodemailer from "nodemailer";
|
|
2
|
+
import { Config } from "./types/Config";
|
|
3
|
+
interface Encryption {
|
|
4
|
+
iv: string;
|
|
5
|
+
ciphertext: string;
|
|
6
|
+
}
|
|
7
|
+
export declare class Utils_Misc {
|
|
8
|
+
readonly config: Config;
|
|
9
|
+
readonly text_encoder: TextEncoder;
|
|
10
|
+
readonly transporter: nodemailer.Transporter<import("nodemailer/lib/smtp-transport").SentMessageInfo, import("nodemailer/lib/smtp-transport").Options>;
|
|
11
|
+
constructor(config: Config);
|
|
12
|
+
wait(duration: number): Promise<unknown>;
|
|
13
|
+
get_current_time(): string;
|
|
14
|
+
get_current_milliseconds(): number;
|
|
15
|
+
send_email(recipient: string, subject: string, text: string): Promise<void>;
|
|
16
|
+
admin_alert(text: string): Promise<void>;
|
|
17
|
+
safe_run(f: () => Promise<any>): Promise<void>;
|
|
18
|
+
iterate<T>(inputs: T[], f: (input: T) => Promise<any>, concurrency?: number, print_indices?: boolean): Promise<void>;
|
|
19
|
+
sha256(input: string): Promise<string>;
|
|
20
|
+
encrypt(text: string): Encryption;
|
|
21
|
+
decrypt(encryption: Encryption): string;
|
|
22
|
+
get_secret_hash(username: string): string;
|
|
23
|
+
get_election_id(year: string, office: string, state: string, district: string): string | undefined;
|
|
24
|
+
get_chunk_indices(text_length: number, max_length?: number, overlap?: number): [number, number][];
|
|
25
|
+
chunkify(text: string, max_length?: number, overlap?: number): {
|
|
26
|
+
chunk_index: [number, number];
|
|
27
|
+
chunk_text: string;
|
|
28
|
+
}[];
|
|
29
|
+
}
|
|
30
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { S3 } from "@aws-sdk/client-s3";
|
|
2
|
+
import { Config } from "./types/Config";
|
|
3
|
+
export declare class Utils_S3 {
|
|
4
|
+
readonly s3: S3;
|
|
5
|
+
constructor(config: Config);
|
|
6
|
+
file_exists(s3_filename: string): Promise<boolean>;
|
|
7
|
+
get_file(s3_filename: string): Promise<string | undefined>;
|
|
8
|
+
create_file(s3_filename: string, content: string | Buffer, options?: {
|
|
9
|
+
content_type?: string;
|
|
10
|
+
}): Promise<import("@aws-sdk/client-s3").PutObjectCommandOutput>;
|
|
11
|
+
delete_file(s3_filename: string): Promise<void>;
|
|
12
|
+
generate_download_url(s3_filename: string): Promise<string | undefined>;
|
|
13
|
+
generate_upload_url(s3_filename: string): Promise<string | undefined>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { S3Vectors } from "@aws-sdk/client-s3vectors";
|
|
2
|
+
import { Config } from "./types/Config";
|
|
3
|
+
interface Vector {
|
|
4
|
+
key: string;
|
|
5
|
+
data: number[];
|
|
6
|
+
metadata: any;
|
|
7
|
+
}
|
|
8
|
+
export declare class Utils_S3Vectors {
|
|
9
|
+
readonly s3vectors: S3Vectors;
|
|
10
|
+
constructor(config: Config);
|
|
11
|
+
scan(vector_bucket: string, vector_index: string): Promise<string[]>;
|
|
12
|
+
get(vector_bucket: string, vector_index: string, vector_key: string): Promise<Vector | undefined>;
|
|
13
|
+
batch_get(vector_bucket: string, vector_index: string, vector_keys: string[]): Promise<Vector[]>;
|
|
14
|
+
create(vector_bucket: string, vector_index: string, vector: Vector): Promise<void>;
|
|
15
|
+
batch_create(vector_bucket: string, vector_index: string, vectors: Vector[]): Promise<void>;
|
|
16
|
+
delete(vector_bucket: string, vector_index: string, vector_key: string): Promise<void>;
|
|
17
|
+
batch_delete(vector_bucket: string, vector_index: string, vector_keys: string[]): Promise<void>;
|
|
18
|
+
query(vector_bucket: string, vector_index: string, data: number[], num_vectors: number, filters?: Record<string, any>): Promise<import("@aws-sdk/client-s3vectors").QueryOutputVector[]>;
|
|
19
|
+
}
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { youtube_v3 } from "googleapis";
|
|
2
|
+
import { Config } from "./types/Config";
|
|
3
|
+
export declare class Utils_Youtube {
|
|
4
|
+
readonly config: Config;
|
|
5
|
+
readonly youtube: youtube_v3.Youtube;
|
|
6
|
+
constructor(config: Config);
|
|
7
|
+
batch_get_videos(video_ids: string[], attributes?: string[]): Promise<youtube_v3.Schema$Video[]>;
|
|
8
|
+
}
|
package/package.json
CHANGED