@adaptic/lumic-utils 1.0.1

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.
Files changed (48) hide show
  1. package/README.md +637 -0
  2. package/dist/index-CcXQeJz8.js +1477 -0
  3. package/dist/index-CcXQeJz8.js.map +1 -0
  4. package/dist/index-CcgbRft2.js +1479 -0
  5. package/dist/index-CcgbRft2.js.map +1 -0
  6. package/dist/index.cjs +11420 -0
  7. package/dist/index.cjs.map +1 -0
  8. package/dist/index.mjs +11400 -0
  9. package/dist/index.mjs.map +1 -0
  10. package/dist/test.cjs +1119 -0
  11. package/dist/test.cjs.map +1 -0
  12. package/dist/test.mjs +1117 -0
  13. package/dist/test.mjs.map +1 -0
  14. package/dist/types/aws-types.ts +64 -0
  15. package/dist/types/functions/aws-lambda.d.ts +17 -0
  16. package/dist/types/functions/aws-s3-utils.d.ts +118 -0
  17. package/dist/types/functions/get-weather.d.ts +10 -0
  18. package/dist/types/functions/google-sheets.d.ts +40 -0
  19. package/dist/types/functions/json-llm-tools.d.ts +12 -0
  20. package/dist/types/functions/json-tools.d.ts +16 -0
  21. package/dist/types/functions/llm-call.d.ts +29 -0
  22. package/dist/types/functions/llm-config.d.ts +34 -0
  23. package/dist/types/functions/llm-deepseek.d.ts +11 -0
  24. package/dist/types/functions/llm-images.d.ts +48 -0
  25. package/dist/types/functions/llm-openai.d.ts +55 -0
  26. package/dist/types/functions/llm-utils.d.ts +15 -0
  27. package/dist/types/functions/pdf-create.d.ts +2 -0
  28. package/dist/types/functions/performance.d.ts +72 -0
  29. package/dist/types/functions/perplexity-api.d.ts +1 -0
  30. package/dist/types/functions/slack-utils.d.ts +11 -0
  31. package/dist/types/functions/utils.d.ts +22 -0
  32. package/dist/types/functions/zip-utils.d.ts +38 -0
  33. package/dist/types/google-types.ts +48 -0
  34. package/dist/types/index.d.ts +72 -0
  35. package/dist/types/index.ts +57 -0
  36. package/dist/types/llm-tools.d.ts +2 -0
  37. package/dist/types/openai-types.ts +92 -0
  38. package/dist/types/test-data.d.ts +14 -0
  39. package/dist/types/test-llm-functions-archive.d.ts +1 -0
  40. package/dist/types/test.d.ts +1 -0
  41. package/dist/types/types/aws-types.d.ts +53 -0
  42. package/dist/types/types/google-types.d.ts +41 -0
  43. package/dist/types/types/index.d.ts +44 -0
  44. package/dist/types/types/openai-types.d.ts +81 -0
  45. package/dist/types/utils/aws-initialise.d.ts +21 -0
  46. package/dist/types/utils/aws-s3-utils.d.ts +32 -0
  47. package/dist/types/utils/config.d.ts +11 -0
  48. package/package.json +56 -0
@@ -0,0 +1,22 @@
1
+ declare const LOG_TYPES: readonly ["info", "warn", "error", "debug", "trace"];
2
+ type LogType = typeof LOG_TYPES[number];
3
+ /**
4
+ * Debug logging utility that respects environment debug flags
5
+ * @param message - The message to log
6
+ * @param data - Optional data to log alongside the message
7
+ * @param type - Log level. One of: 'info' | 'warn' | 'error' | 'debug' | 'trace'
8
+ */
9
+ export declare const logIfDebug: (message: string, data?: unknown, type?: LogType) => void;
10
+ /**
11
+ * Fetches a URL with retry logic. If the response is not 2xx, it will retry up to `retries` times
12
+ * with an exponential backoff of `backoff` milliseconds between each attempt.
13
+ *
14
+ * @param url The URL to fetch
15
+ * @param options Optional `RequestInit` object to modify the request
16
+ * @param retries The number of times to retry the request (default: 3)
17
+ * @param backoff The initial backoff time in milliseconds (default: 300)
18
+ * @returns A `Response` object if the fetch is successful
19
+ * @throws An error if the fetch fails after all retries
20
+ */
21
+ export declare function fetchWithRetry(url: string, options?: RequestInit, retries?: number, backoff?: number): Promise<Response>;
22
+ export {};
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Creates a zip file containing the contents of the provided directory.
3
+ * The zip file is created in the /tmp directory.
4
+ * The source directory must be located in the /tmp directory.
5
+ * The zip file name is the same as the source directory name with a .zip extension.
6
+ * If a node_modules directory exists in the source directory,
7
+ * it is added separately to ensure it is included in the zip file.
8
+ * The function logs the original directory size and file count,
9
+ * as well as the final zip size.
10
+ * @param sourceDir The path to the directory to zip.
11
+ * @returns The path to the created zip file.
12
+ */
13
+ export declare function createZipFile(sourceDir: string): Promise<string>;
14
+ /**
15
+ * Extracts a zip archive into a specified directory.
16
+ *
17
+ * Both the zip file path and destination path must start with /tmp/.
18
+ *
19
+ * @param zipPath The path of the zip file to extract. Must start with /tmp/.
20
+ * @param destPath The path of the directory to extract the zip file into. Must start with /tmp/.
21
+ * @returns The path of the extracted directory.
22
+ * @throws If the zip file or destination path does not start with /tmp/.
23
+ * @throws If there is an error extracting the zip file.
24
+ */
25
+ export declare function extractZipFile(zipPath: string, destPath: string): Promise<string>;
26
+ /**
27
+ * Adds a file or directory to an existing zip file.
28
+ *
29
+ * The zip file path and item path must start with /tmp/.
30
+ *
31
+ * @param zipFilePath The path of the zip file to add the item to. Must start with /tmp/.
32
+ * @param itemPath The path of the item to add to the zip file. Must start with /tmp/.
33
+ * @param destPath Optional. The destination path inside the zip file to add the item to. Defaults to the root of the zip file.
34
+ * @returns The path of the updated zip file.
35
+ * @throws If the zip file or item path does not start with /tmp/.
36
+ * @throws If there is an error adding the item to the zip file.
37
+ */
38
+ export declare function addToZipFile(zipFilePath: string, itemPath: string, destPath?: string): Promise<string>;
@@ -0,0 +1,48 @@
1
+ export interface GoogleSheetConfig {
2
+ spreadsheetId: string;
3
+ sheetName: string;
4
+ }
5
+
6
+ export interface GoogleSheetCell {
7
+ row: number;
8
+ column: number;
9
+ }
10
+
11
+ export interface GoogleSheetRange {
12
+ startCell: GoogleSheetCell;
13
+ endCell: GoogleSheetCell;
14
+ }
15
+
16
+ export interface GoogleSheetResponse {
17
+ success: boolean;
18
+ error?: string;
19
+ data?: any;
20
+ }
21
+
22
+ export interface GoogleSheetAddRowResponse extends GoogleSheetResponse {
23
+ data?: {
24
+ rowNumber: number;
25
+ values: any[];
26
+ };
27
+ }
28
+
29
+ export interface GoogleSheetAddSheetResponse extends GoogleSheetResponse {
30
+ data?: {
31
+ sheetId: number;
32
+ title: string;
33
+ };
34
+ }
35
+
36
+ export interface GoogleSheetCellResponse extends GoogleSheetResponse {
37
+ data?: {
38
+ value: any;
39
+ };
40
+ }
41
+
42
+ export interface GoogleSheetWriteArrayResponse extends GoogleSheetResponse {
43
+ data?: {
44
+ updatedRange: string;
45
+ updatedRows: number;
46
+ updatedColumns: number;
47
+ };
48
+ }
@@ -0,0 +1,72 @@
1
+ import { makeLLMCall, makeResponsesCall } from './functions/llm-call';
2
+ import { makeImagesCall } from './functions/llm-images';
3
+ import { makeDeepseekCall } from './functions/llm-deepseek';
4
+ import { callPerplexityAPI } from './functions/perplexity-api';
5
+ import { invokeLambdaFunction } from './functions/aws-lambda';
6
+ import { sendMessageToSlack } from './functions/slack-utils';
7
+ import { createZipFile, extractZipFile, addToZipFile } from './functions/zip-utils';
8
+ import { PerformanceTimer } from './functions/performance';
9
+ import { generateBucketName, createS3, uploadToS3, readS3File, downloadFromS3, deleteS3FileFromUrl, destroyS3, saveToS3, loadFromS3, checkBucketForFileNamePart, ls } from './functions/aws-s3-utils';
10
+ import { logIfDebug } from './functions/utils';
11
+ import { fixBrokenJson, isValidJson } from './functions/json-tools';
12
+ import { fixJsonWithAI } from './functions/json-llm-tools';
13
+ import { createPDFFromMarkdown } from './functions/pdf-create';
14
+ import { addRow, addSheet, writeCell, getCell, writeArray } from './functions/google-sheets';
15
+ import { parseResponse } from './functions/llm-utils';
16
+ import { tools } from './llm-tools';
17
+ export * from './types';
18
+ interface LumicUtilities {
19
+ llm: {
20
+ call: typeof makeLLMCall;
21
+ seek: typeof makeDeepseekCall;
22
+ responses: typeof makeResponsesCall;
23
+ image: typeof makeImagesCall;
24
+ callPerplexity: typeof callPerplexityAPI;
25
+ tools: typeof tools;
26
+ };
27
+ lambda: {
28
+ invoke: typeof invokeLambdaFunction;
29
+ };
30
+ slack: {
31
+ sendMessage: typeof sendMessageToSlack;
32
+ };
33
+ pdf: {
34
+ create: typeof createPDFFromMarkdown;
35
+ };
36
+ zip: {
37
+ create: typeof createZipFile;
38
+ extract: typeof extractZipFile;
39
+ addTo: typeof addToZipFile;
40
+ };
41
+ gs: {
42
+ addRow: typeof addRow;
43
+ addSheet: typeof addSheet;
44
+ writeCell: typeof writeCell;
45
+ getCell: typeof getCell;
46
+ writeArray: typeof writeArray;
47
+ };
48
+ s3: {
49
+ generateBucketName: typeof generateBucketName;
50
+ create: typeof createS3;
51
+ upload: typeof uploadToS3;
52
+ readFile: typeof readS3File;
53
+ download: typeof downloadFromS3;
54
+ deleteFile: typeof deleteS3FileFromUrl;
55
+ destroy: typeof destroyS3;
56
+ saveTo: typeof saveToS3;
57
+ loadFrom: typeof loadFromS3;
58
+ checkBucketForFileNamePart: typeof checkBucketForFileNamePart;
59
+ ls: typeof ls;
60
+ };
61
+ json: {
62
+ parse: typeof parseResponse;
63
+ fix: typeof fixBrokenJson;
64
+ fixWithAI: typeof fixJsonWithAI;
65
+ isValid: typeof isValidJson;
66
+ };
67
+ utils: {
68
+ logIfDebug: typeof logIfDebug;
69
+ Timer: typeof PerformanceTimer;
70
+ };
71
+ }
72
+ export declare const lumic: LumicUtilities;
@@ -0,0 +1,57 @@
1
+ export * from './openai-types';
2
+ export * from './aws-types';
3
+ export * from './google-types';
4
+
5
+ export type JsonValue = string | number | boolean | null | JsonObject | JsonArray;
6
+ export interface JsonObject {
7
+ [key: string]: JsonValue;
8
+ }
9
+ export type JsonArray = JsonValue[];
10
+
11
+
12
+ export interface PerplexityMessage {
13
+ role: 'system' | 'user' | 'assistant';
14
+ content: string;
15
+ }
16
+
17
+ export interface PerplexityResponse {
18
+ choices: Array<{
19
+ message: {
20
+ content: string;
21
+ };
22
+ }>;
23
+ }
24
+
25
+ // Export types from invokeLambdaFunction
26
+ export type InvocationType = 'RequestResponse' | 'Event' | 'DryRun';
27
+
28
+ export interface LambdaResponse {
29
+ statusCode: number;
30
+ [key: string]: any;
31
+ }
32
+
33
+ // Export types from sendMessageToSlack
34
+ export interface SlackApiResponse {
35
+ ok: boolean;
36
+ error?: string;
37
+ }
38
+
39
+ // Re-export AWSAuth type
40
+ export { AWSAuth } from '../utils/aws-initialise';
41
+
42
+ export interface CreatePDFOptions {
43
+ title?: string;
44
+ author?: string;
45
+ margins?: {
46
+ top: number;
47
+ bottom: number;
48
+ left: number;
49
+ right: number;
50
+ };
51
+ }
52
+
53
+ export type WeatherReturnType = {
54
+ temperature: number;
55
+ description: string;
56
+ location: string;
57
+ }
@@ -0,0 +1,2 @@
1
+ import { ChatCompletionTool } from 'openai/resources/chat/completions';
2
+ export declare const tools: ChatCompletionTool[];
@@ -0,0 +1,92 @@
1
+ // openai-types.ts
2
+ import { ChatCompletionMessageParam, ChatCompletionTool, ChatCompletionMessageToolCall } from 'openai/resources/chat/completions';
3
+ import { ImageGenerateParams, ImageModel } from 'openai/resources/images';
4
+
5
+ /**
6
+ * Represents OpenAI models
7
+ */
8
+
9
+ export type OpenAIModel = 'gpt-5' | 'gpt-5-mini' | 'gpt-5-nano' | 'gpt-4.1' | 'gpt-4.1-mini' | 'gpt-4.1-nano'
10
+ /**
11
+ * Represents Deepseek models
12
+ */
13
+ export type DeepseekModel = 'deepseek-chat' | 'deepseek-reasoner';
14
+
15
+ /**
16
+ * Represents all supported LLM models
17
+ */
18
+ export type LLMModel = OpenAIModel | DeepseekModel;
19
+
20
+ /**
21
+ * Represents the usage of the LLM.
22
+ */
23
+ export interface LLMUsage {
24
+ prompt_tokens: number;
25
+ completion_tokens: number;
26
+ reasoning_tokens?: number;
27
+ provider: string;
28
+ model: LLMModel;
29
+ cache_hit_tokens?: number;
30
+ cost: number;
31
+ }
32
+
33
+ /**
34
+ * Represents the options for the LLM.
35
+ */
36
+ export interface LLMOptions {
37
+ model?: OpenAIModel | DeepseekModel;
38
+ temperature?: number;
39
+ top_p?: number;
40
+ frequency_penalty?: number;
41
+ presence_penalty?: number;
42
+ max_completion_tokens?: number;
43
+ tools?: ChatCompletionTool[];
44
+ developerPrompt?: string;
45
+ context?: ChatCompletionMessageParam[];
46
+ store?: boolean;
47
+ reasoning_effort?: 'low' | 'medium' | 'high';
48
+ metadata?: Record<string, string>;
49
+ parallel_tool_calls?: boolean;
50
+ service_tier?: 'auto' | 'default';
51
+ apiKey?: string;
52
+ }
53
+
54
+ /**
55
+ * Represents the response from the LLM.
56
+ */
57
+ export interface LLMResponse<T> {
58
+ response: T;
59
+ usage: LLMUsage;
60
+ tool_calls?: ChatCompletionMessageToolCall[];
61
+ }
62
+
63
+ /**
64
+ * Represents the format of the OpenAI response.
65
+ */
66
+ export type OpenAIResponseFormat = 'text' | 'json' | {
67
+ type: 'json_schema';
68
+ schema: {
69
+ type: 'object';
70
+ properties: Record<string, any>;
71
+ required?: string[];
72
+ }
73
+ };
74
+
75
+ /**
76
+ * Represents the options for the OpenAI Images API.
77
+ * Extends the official ImageGenerateParams but with more user-friendly option names.
78
+ */
79
+ export interface ImageGenerationOptions {
80
+ size?: ImageGenerateParams['size'];
81
+ outputFormat?: 'jpeg' | 'png' | 'webp';
82
+ compression?: number;
83
+ quality?: ImageGenerateParams['quality'];
84
+ count?: number | null;
85
+ apiKey?: string;
86
+ background?: ImageGenerateParams['background'];
87
+ moderation?: ImageGenerateParams['moderation'];
88
+ }
89
+
90
+ // Re-export OpenAI types for convenience
91
+ export type { ImageModel, ImageGenerateParams } from 'openai/resources/images';
92
+ export type { ImagesResponse, Image } from 'openai/resources/images';
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Test data for the Responses API.
3
+ * This is a minute-based time series stock data (provided as CSV).
4
+ */
5
+ export declare const testData: {
6
+ c: number;
7
+ h: number;
8
+ l: number;
9
+ n: number;
10
+ o: number;
11
+ t: string;
12
+ v: number;
13
+ vw: number;
14
+ }[];
@@ -0,0 +1 @@
1
+ import 'dotenv/config';
@@ -0,0 +1 @@
1
+ import 'dotenv/config';
@@ -0,0 +1,53 @@
1
+ import { AWSAuth } from '../utils/aws-initialise';
2
+ export interface AWSApiResponse {
3
+ statusCode: number;
4
+ body?: string;
5
+ error?: string;
6
+ }
7
+ export interface UploadResult {
8
+ fileCount: number;
9
+ totalSize: number;
10
+ s3Key: string;
11
+ VersionId?: string;
12
+ }
13
+ export type uploadToS3Response = {
14
+ statusCode: number;
15
+ body?: {
16
+ message: string;
17
+ s3Url: string;
18
+ s3Key: string;
19
+ };
20
+ error?: string;
21
+ };
22
+ export interface SaveToS3Response {
23
+ success: boolean;
24
+ filename?: string;
25
+ bucket?: string;
26
+ s3key?: string;
27
+ s3Path?: string;
28
+ error?: string;
29
+ }
30
+ export interface LoadFromS3Response {
31
+ success: boolean;
32
+ content?: any;
33
+ error?: string;
34
+ }
35
+ export interface CheckBucketResponse {
36
+ exists: boolean;
37
+ fileName: string;
38
+ lastModifiedDate: string;
39
+ }
40
+ export interface S3ObjectInfo {
41
+ key: string;
42
+ createdAt: number;
43
+ }
44
+ export interface ListS3Response {
45
+ success: boolean;
46
+ objects: S3ObjectInfo[];
47
+ error?: string;
48
+ }
49
+ export interface ListS3Options {
50
+ bucket?: string;
51
+ auth?: AWSAuth | null;
52
+ limit?: number;
53
+ }
@@ -0,0 +1,41 @@
1
+ export interface GoogleSheetConfig {
2
+ spreadsheetId: string;
3
+ sheetName: string;
4
+ }
5
+ export interface GoogleSheetCell {
6
+ row: number;
7
+ column: number;
8
+ }
9
+ export interface GoogleSheetRange {
10
+ startCell: GoogleSheetCell;
11
+ endCell: GoogleSheetCell;
12
+ }
13
+ export interface GoogleSheetResponse {
14
+ success: boolean;
15
+ error?: string;
16
+ data?: any;
17
+ }
18
+ export interface GoogleSheetAddRowResponse extends GoogleSheetResponse {
19
+ data?: {
20
+ rowNumber: number;
21
+ values: any[];
22
+ };
23
+ }
24
+ export interface GoogleSheetAddSheetResponse extends GoogleSheetResponse {
25
+ data?: {
26
+ sheetId: number;
27
+ title: string;
28
+ };
29
+ }
30
+ export interface GoogleSheetCellResponse extends GoogleSheetResponse {
31
+ data?: {
32
+ value: any;
33
+ };
34
+ }
35
+ export interface GoogleSheetWriteArrayResponse extends GoogleSheetResponse {
36
+ data?: {
37
+ updatedRange: string;
38
+ updatedRows: number;
39
+ updatedColumns: number;
40
+ };
41
+ }
@@ -0,0 +1,44 @@
1
+ export * from './openai-types';
2
+ export * from './aws-types';
3
+ export * from './google-types';
4
+ export type JsonValue = string | number | boolean | null | JsonObject | JsonArray;
5
+ export interface JsonObject {
6
+ [key: string]: JsonValue;
7
+ }
8
+ export type JsonArray = JsonValue[];
9
+ export interface PerplexityMessage {
10
+ role: 'system' | 'user' | 'assistant';
11
+ content: string;
12
+ }
13
+ export interface PerplexityResponse {
14
+ choices: Array<{
15
+ message: {
16
+ content: string;
17
+ };
18
+ }>;
19
+ }
20
+ export type InvocationType = 'RequestResponse' | 'Event' | 'DryRun';
21
+ export interface LambdaResponse {
22
+ statusCode: number;
23
+ [key: string]: any;
24
+ }
25
+ export interface SlackApiResponse {
26
+ ok: boolean;
27
+ error?: string;
28
+ }
29
+ export { AWSAuth } from '../utils/aws-initialise';
30
+ export interface CreatePDFOptions {
31
+ title?: string;
32
+ author?: string;
33
+ margins?: {
34
+ top: number;
35
+ bottom: number;
36
+ left: number;
37
+ right: number;
38
+ };
39
+ }
40
+ export type WeatherReturnType = {
41
+ temperature: number;
42
+ description: string;
43
+ location: string;
44
+ };
@@ -0,0 +1,81 @@
1
+ import { ChatCompletionMessageParam, ChatCompletionTool, ChatCompletionMessageToolCall } from 'openai/resources/chat/completions';
2
+ import { ImageGenerateParams } from 'openai/resources/images';
3
+ /**
4
+ * Represents OpenAI models
5
+ */
6
+ export type OpenAIModel = 'gpt-5' | 'gpt-5-mini' | 'gpt-5-nano' | 'gpt-4.1' | 'gpt-4.1-mini' | 'gpt-4.1-nano';
7
+ /**
8
+ * Represents Deepseek models
9
+ */
10
+ export type DeepseekModel = 'deepseek-chat' | 'deepseek-reasoner';
11
+ /**
12
+ * Represents all supported LLM models
13
+ */
14
+ export type LLMModel = OpenAIModel | DeepseekModel;
15
+ /**
16
+ * Represents the usage of the LLM.
17
+ */
18
+ export interface LLMUsage {
19
+ prompt_tokens: number;
20
+ completion_tokens: number;
21
+ reasoning_tokens?: number;
22
+ provider: string;
23
+ model: LLMModel;
24
+ cache_hit_tokens?: number;
25
+ cost: number;
26
+ }
27
+ /**
28
+ * Represents the options for the LLM.
29
+ */
30
+ export interface LLMOptions {
31
+ model?: OpenAIModel | DeepseekModel;
32
+ temperature?: number;
33
+ top_p?: number;
34
+ frequency_penalty?: number;
35
+ presence_penalty?: number;
36
+ max_completion_tokens?: number;
37
+ tools?: ChatCompletionTool[];
38
+ developerPrompt?: string;
39
+ context?: ChatCompletionMessageParam[];
40
+ store?: boolean;
41
+ reasoning_effort?: 'low' | 'medium' | 'high';
42
+ metadata?: Record<string, string>;
43
+ parallel_tool_calls?: boolean;
44
+ service_tier?: 'auto' | 'default';
45
+ apiKey?: string;
46
+ }
47
+ /**
48
+ * Represents the response from the LLM.
49
+ */
50
+ export interface LLMResponse<T> {
51
+ response: T;
52
+ usage: LLMUsage;
53
+ tool_calls?: ChatCompletionMessageToolCall[];
54
+ }
55
+ /**
56
+ * Represents the format of the OpenAI response.
57
+ */
58
+ export type OpenAIResponseFormat = 'text' | 'json' | {
59
+ type: 'json_schema';
60
+ schema: {
61
+ type: 'object';
62
+ properties: Record<string, any>;
63
+ required?: string[];
64
+ };
65
+ };
66
+ /**
67
+ * Represents the options for the OpenAI Images API.
68
+ * Extends the official ImageGenerateParams but with more user-friendly option names.
69
+ */
70
+ export interface ImageGenerationOptions {
71
+ size?: ImageGenerateParams['size'];
72
+ outputFormat?: 'jpeg' | 'png' | 'webp';
73
+ compression?: number;
74
+ quality?: ImageGenerateParams['quality'];
75
+ count?: number | null;
76
+ apiKey?: string;
77
+ background?: ImageGenerateParams['background'];
78
+ moderation?: ImageGenerateParams['moderation'];
79
+ }
80
+ export type { ImageModel, ImageGenerateParams } from 'openai/resources/images';
81
+ export type { ImagesResponse, Image } from 'openai/resources/images';
@@ -0,0 +1,21 @@
1
+ import { S3Client } from '@aws-sdk/client-s3';
2
+ import { Lambda } from '@aws-sdk/client-lambda';
3
+ interface ValidationResult {
4
+ isValid: boolean;
5
+ source: 'lambda' | 'my_prefix' | 'standard' | null;
6
+ vars?: {
7
+ accessKeyId: string;
8
+ secretAccessKey: string;
9
+ region: string;
10
+ };
11
+ missingVars?: string[];
12
+ }
13
+ interface AWSAuth {
14
+ AWS_ACCESS_KEY_ID: string;
15
+ AWS_SECRET_ACCESS_KEY: string;
16
+ AWS_REGION: string;
17
+ }
18
+ declare const validateEnvironmentVars: () => ValidationResult;
19
+ declare const initialiseS3Client: (auth?: AWSAuth | null) => S3Client;
20
+ declare const initialiseLambdaClient: (auth?: AWSAuth | null) => Lambda;
21
+ export { validateEnvironmentVars, initialiseS3Client, initialiseLambdaClient, AWSAuth };
@@ -0,0 +1,32 @@
1
+ import { S3Client } from "@aws-sdk/client-s3";
2
+ interface DirectoryStats {
3
+ totalFiles: number;
4
+ totalFolders: number;
5
+ totalSize: number;
6
+ fileList: string[];
7
+ }
8
+ interface UploadResult {
9
+ fileCount: number;
10
+ totalSize: number;
11
+ s3Key: string;
12
+ }
13
+ interface DownloadResult {
14
+ fileCount: number;
15
+ folderCount: number;
16
+ totalSize: number;
17
+ fileList: string[];
18
+ }
19
+ export declare const generateRandomHash: (length: number) => string;
20
+ export declare function generateDateTimeStamp(): string;
21
+ export declare const isValidBucketName: (name: string) => boolean;
22
+ export declare function uploadFile(s3Client: S3Client, bucketName: string, filePath: string, destinationPath: string, isPublic?: boolean): Promise<UploadResult>;
23
+ export declare function uploadDirectory(s3Client: S3Client, bucketName: string, dirPath: string, destinationPath: string, isPublic?: boolean): Promise<UploadResult>;
24
+ export declare function zipDirectory(sourceDir: string, outPath: string): Promise<number>;
25
+ export declare function downloadFromS3Helper(s3Client: S3Client, bucketName: string, s3Path: string, localPath: string): Promise<DownloadResult>;
26
+ export declare function downloadFile(s3Client: S3Client, bucketName: string, s3Key: string, localFilePath: string): Promise<void>;
27
+ export declare function unzipFile(zipPath: string, destPath: string): Promise<DirectoryStats>;
28
+ export declare function getDirectoryStats(dirPath: string): Promise<DirectoryStats>;
29
+ export declare function emptyBucket(s3Client: S3Client, bucketName: string): Promise<void>;
30
+ export declare function deleteBucket(s3Client: S3Client, bucketName: string): Promise<void>;
31
+ export declare function formatSize(bytes: number): string;
32
+ export {};
@@ -0,0 +1,11 @@
1
+ import { OpenAIModel } from "../types";
2
+ export declare const DEFAULT_MODEL: OpenAIModel;
3
+ export declare const PERPLEXITY_MODEL: string;
4
+ export declare const PERPLEXITY_API_URL = "https://api.perplexity.ai/chat/completions";
5
+ export interface Config {
6
+ DEFAULT_MODEL: string;
7
+ PERPLEXITY_MODEL: string;
8
+ PERPLEXITY_API_URL: string;
9
+ }
10
+ declare const config: Config;
11
+ export default config;