@agentforge/tools 0.12.6 → 0.13.0
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/README.md +16 -0
- package/dist/index.cjs +5207 -57
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1894 -248
- package/dist/index.d.ts +1894 -248
- package/dist/index.js +5171 -58
- package/dist/index.js.map +1 -1
- package/package.json +25 -3
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import * as _agentforge_core from '@agentforge/core';
|
|
2
2
|
import { LogLevel, HumanRequestPriority } from '@agentforge/core';
|
|
3
3
|
import { z } from 'zod';
|
|
4
|
+
import { SQL } from 'drizzle-orm';
|
|
5
|
+
import { EventEmitter } from 'events';
|
|
6
|
+
import { Readable } from 'node:stream';
|
|
4
7
|
import { Session } from 'neo4j-driver';
|
|
5
8
|
|
|
6
9
|
/**
|
|
@@ -294,8 +297,7 @@ declare function createScraperTools(config?: ScraperToolsConfig): _agentforge_co
|
|
|
294
297
|
/**
|
|
295
298
|
* HTML parser tools configuration
|
|
296
299
|
*/
|
|
297
|
-
|
|
298
|
-
}
|
|
300
|
+
type HtmlParserToolsConfig = Record<string, never>;
|
|
299
301
|
/**
|
|
300
302
|
* HTML parser input schema
|
|
301
303
|
*/
|
|
@@ -571,8 +573,7 @@ interface UrlValidationResult {
|
|
|
571
573
|
/**
|
|
572
574
|
* URL validator tools configuration
|
|
573
575
|
*/
|
|
574
|
-
|
|
575
|
-
}
|
|
576
|
+
type UrlValidatorToolsConfig = Record<string, never>;
|
|
576
577
|
/**
|
|
577
578
|
* URL validator input schema
|
|
578
579
|
*/
|
|
@@ -2631,8 +2632,7 @@ declare const objectOmitSchema: z.ZodObject<{
|
|
|
2631
2632
|
/**
|
|
2632
2633
|
* Transformer tools configuration
|
|
2633
2634
|
*/
|
|
2634
|
-
|
|
2635
|
-
}
|
|
2635
|
+
type TransformerToolsConfig = Record<string, never>;
|
|
2636
2636
|
|
|
2637
2637
|
/**
|
|
2638
2638
|
* Array Filter Tool
|
|
@@ -4675,266 +4675,1917 @@ declare function createNeo4jTools(config?: Neo4jToolsConfig, includeEmbeddingToo
|
|
|
4675
4675
|
declare function initializeNeo4jTools(): Promise<void>;
|
|
4676
4676
|
|
|
4677
4677
|
/**
|
|
4678
|
-
*
|
|
4679
|
-
*
|
|
4680
|
-
* Type definitions and schemas for file operation tools.
|
|
4678
|
+
* Shared types for relational database operations
|
|
4679
|
+
* @module types
|
|
4681
4680
|
*/
|
|
4682
4681
|
|
|
4683
4682
|
/**
|
|
4684
|
-
*
|
|
4683
|
+
* Supported database vendors
|
|
4685
4684
|
*/
|
|
4686
|
-
|
|
4687
|
-
path: z.ZodString;
|
|
4688
|
-
encoding: z.ZodDefault<z.ZodEnum<["utf8", "utf-8", "ascii", "base64", "hex", "binary"]>>;
|
|
4689
|
-
}, "strip", z.ZodTypeAny, {
|
|
4690
|
-
path: string;
|
|
4691
|
-
encoding: "ascii" | "binary" | "base64" | "hex" | "utf-8" | "utf8";
|
|
4692
|
-
}, {
|
|
4693
|
-
path: string;
|
|
4694
|
-
encoding?: "ascii" | "binary" | "base64" | "hex" | "utf-8" | "utf8" | undefined;
|
|
4695
|
-
}>;
|
|
4685
|
+
type DatabaseVendor = 'postgresql' | 'mysql' | 'sqlite';
|
|
4696
4686
|
/**
|
|
4697
|
-
*
|
|
4687
|
+
* Database connection configuration
|
|
4698
4688
|
*/
|
|
4699
|
-
|
|
4700
|
-
|
|
4701
|
-
|
|
4702
|
-
|
|
4703
|
-
|
|
4704
|
-
|
|
4705
|
-
|
|
4706
|
-
|
|
4707
|
-
|
|
4708
|
-
|
|
4709
|
-
}
|
|
4710
|
-
|
|
4711
|
-
content: string;
|
|
4712
|
-
encoding?: "ascii" | "base64" | "hex" | "utf-8" | "utf8" | undefined;
|
|
4713
|
-
createDirs?: boolean | undefined;
|
|
4714
|
-
}>;
|
|
4689
|
+
interface DatabaseConfig {
|
|
4690
|
+
/** Database vendor type */
|
|
4691
|
+
vendor: DatabaseVendor;
|
|
4692
|
+
/** Connection string or configuration object */
|
|
4693
|
+
connection: string | Record<string, unknown>;
|
|
4694
|
+
/** Optional connection pool configuration */
|
|
4695
|
+
pool?: {
|
|
4696
|
+
min?: number;
|
|
4697
|
+
max?: number;
|
|
4698
|
+
idleTimeoutMillis?: number;
|
|
4699
|
+
};
|
|
4700
|
+
}
|
|
4715
4701
|
/**
|
|
4716
|
-
*
|
|
4702
|
+
* Database connection interface
|
|
4703
|
+
*
|
|
4704
|
+
* NOTE: The execute() signature was changed from execute(sql: string, params?: unknown)
|
|
4705
|
+
* to execute(query: SQL) in ST-02001 to align with Drizzle's type-safe SQL template design.
|
|
4706
|
+
* This is a breaking change but provides better type safety and prevents SQL injection.
|
|
4707
|
+
* Parameter binding is now handled by buildParameterizedQuery() before calling execute().
|
|
4708
|
+
*/
|
|
4709
|
+
interface DatabaseConnection {
|
|
4710
|
+
/** Execute a Drizzle SQL query */
|
|
4711
|
+
execute(query: SQL): Promise<unknown>;
|
|
4712
|
+
/** Close the connection */
|
|
4713
|
+
close(): Promise<void>;
|
|
4714
|
+
/** Check if connection is healthy */
|
|
4715
|
+
isHealthy(): Promise<boolean>;
|
|
4716
|
+
}
|
|
4717
|
+
/**
|
|
4718
|
+
* Query result metadata
|
|
4717
4719
|
*/
|
|
4718
|
-
|
|
4719
|
-
|
|
4720
|
-
|
|
4721
|
-
|
|
4722
|
-
|
|
4723
|
-
|
|
4724
|
-
|
|
4725
|
-
|
|
4726
|
-
}, {
|
|
4727
|
-
path: string;
|
|
4728
|
-
content: string;
|
|
4729
|
-
encoding?: "ascii" | "utf-8" | "utf8" | undefined;
|
|
4730
|
-
}>;
|
|
4720
|
+
interface QueryMetadata {
|
|
4721
|
+
/** Number of rows affected */
|
|
4722
|
+
rowCount?: number;
|
|
4723
|
+
/** Execution time in milliseconds */
|
|
4724
|
+
executionTime?: number;
|
|
4725
|
+
/** Additional vendor-specific metadata */
|
|
4726
|
+
[key: string]: unknown;
|
|
4727
|
+
}
|
|
4731
4728
|
/**
|
|
4732
|
-
*
|
|
4729
|
+
* Query result with data and metadata
|
|
4733
4730
|
*/
|
|
4734
|
-
|
|
4735
|
-
|
|
4736
|
-
|
|
4737
|
-
|
|
4738
|
-
|
|
4739
|
-
|
|
4740
|
-
|
|
4731
|
+
interface QueryResult<T = unknown> {
|
|
4732
|
+
/** Query result data */
|
|
4733
|
+
data: T[];
|
|
4734
|
+
/** Query metadata */
|
|
4735
|
+
metadata: QueryMetadata;
|
|
4736
|
+
}
|
|
4737
|
+
|
|
4741
4738
|
/**
|
|
4742
|
-
*
|
|
4739
|
+
* Runtime peer dependency checker for database drivers
|
|
4740
|
+
* @module utils/peer-dependency-checker
|
|
4743
4741
|
*/
|
|
4744
|
-
|
|
4745
|
-
path: z.ZodString;
|
|
4746
|
-
}, "strip", z.ZodTypeAny, {
|
|
4747
|
-
path: string;
|
|
4748
|
-
}, {
|
|
4749
|
-
path: string;
|
|
4750
|
-
}>;
|
|
4742
|
+
|
|
4751
4743
|
/**
|
|
4752
|
-
*
|
|
4744
|
+
* Error thrown when a required peer dependency is missing
|
|
4753
4745
|
*/
|
|
4754
|
-
|
|
4755
|
-
|
|
4756
|
-
|
|
4746
|
+
declare class MissingPeerDependencyError extends Error {
|
|
4747
|
+
readonly vendor: DatabaseVendor;
|
|
4748
|
+
readonly packageName: string;
|
|
4749
|
+
constructor(vendor: DatabaseVendor, packageName: string);
|
|
4757
4750
|
}
|
|
4758
|
-
|
|
4759
4751
|
/**
|
|
4760
|
-
*
|
|
4752
|
+
* Check if the required peer dependency for a database vendor is installed
|
|
4753
|
+
* @param vendor - Database vendor to check
|
|
4754
|
+
* @throws {MissingPeerDependencyError} If the required peer dependency is not installed
|
|
4761
4755
|
*/
|
|
4756
|
+
declare function checkPeerDependency(vendor: DatabaseVendor): void;
|
|
4762
4757
|
/**
|
|
4763
|
-
*
|
|
4758
|
+
* Get the required peer dependency package name for a database vendor
|
|
4759
|
+
* @param vendor - Database vendor
|
|
4760
|
+
* @returns Package name of the required peer dependency
|
|
4764
4761
|
*/
|
|
4765
|
-
declare function
|
|
4766
|
-
path: string;
|
|
4767
|
-
encoding?: "ascii" | "binary" | "base64" | "hex" | "utf-8" | "utf8" | undefined;
|
|
4768
|
-
}, {
|
|
4769
|
-
success: boolean;
|
|
4770
|
-
data?: {
|
|
4771
|
-
content: string;
|
|
4772
|
-
size: number;
|
|
4773
|
-
path: string;
|
|
4774
|
-
encoding: string;
|
|
4775
|
-
} | undefined;
|
|
4776
|
-
error?: string;
|
|
4777
|
-
}>;
|
|
4778
|
-
|
|
4762
|
+
declare function getPeerDependencyName(vendor: DatabaseVendor): string;
|
|
4779
4763
|
/**
|
|
4780
|
-
*
|
|
4764
|
+
* Get installation instructions for a database vendor
|
|
4765
|
+
* @param vendor - Database vendor
|
|
4766
|
+
* @returns Installation command for the required peer dependency
|
|
4781
4767
|
*/
|
|
4768
|
+
declare function getInstallationInstructions(vendor: DatabaseVendor): string;
|
|
4769
|
+
|
|
4782
4770
|
/**
|
|
4783
|
-
*
|
|
4771
|
+
* Query execution types for relational databases
|
|
4772
|
+
* @module query/types
|
|
4784
4773
|
*/
|
|
4785
|
-
declare function createFileWriterTool(defaultEncoding?: string, createDirsDefault?: boolean): _agentforge_core.Tool<{
|
|
4786
|
-
path: string;
|
|
4787
|
-
content: string;
|
|
4788
|
-
encoding?: "ascii" | "base64" | "hex" | "utf-8" | "utf8" | undefined;
|
|
4789
|
-
createDirs?: boolean | undefined;
|
|
4790
|
-
}, {
|
|
4791
|
-
success: boolean;
|
|
4792
|
-
data?: {
|
|
4793
|
-
path: string;
|
|
4794
|
-
size: number;
|
|
4795
|
-
encoding: string;
|
|
4796
|
-
} | undefined;
|
|
4797
|
-
error?: string;
|
|
4798
|
-
}>;
|
|
4799
4774
|
|
|
4800
4775
|
/**
|
|
4801
|
-
*
|
|
4776
|
+
* Query parameters for parameterized SQL execution
|
|
4777
|
+
*
|
|
4778
|
+
* Parameters can be provided as:
|
|
4779
|
+
* - An array for positional parameters (e.g., [value1, value2])
|
|
4780
|
+
* - An object for named parameters (e.g., { name: 'John', age: 30 })
|
|
4802
4781
|
*/
|
|
4782
|
+
type QueryParams = unknown[] | Record<string, unknown>;
|
|
4803
4783
|
/**
|
|
4804
|
-
*
|
|
4784
|
+
* Query execution input
|
|
4805
4785
|
*/
|
|
4806
|
-
|
|
4807
|
-
|
|
4808
|
-
|
|
4809
|
-
|
|
4810
|
-
|
|
4811
|
-
|
|
4812
|
-
|
|
4813
|
-
|
|
4814
|
-
size: number;
|
|
4815
|
-
} | undefined;
|
|
4816
|
-
error?: string;
|
|
4817
|
-
}>;
|
|
4818
|
-
|
|
4786
|
+
interface QueryInput {
|
|
4787
|
+
/** SQL query string */
|
|
4788
|
+
sql: string;
|
|
4789
|
+
/** Query parameters for parameter binding */
|
|
4790
|
+
params?: QueryParams;
|
|
4791
|
+
/** Database vendor */
|
|
4792
|
+
vendor: DatabaseVendor;
|
|
4793
|
+
}
|
|
4819
4794
|
/**
|
|
4820
|
-
*
|
|
4795
|
+
* Query execution result
|
|
4821
4796
|
*/
|
|
4797
|
+
interface QueryExecutionResult {
|
|
4798
|
+
/** Query result rows */
|
|
4799
|
+
rows: unknown[];
|
|
4800
|
+
/** Number of rows affected (for INSERT/UPDATE/DELETE) */
|
|
4801
|
+
rowCount: number;
|
|
4802
|
+
/** Execution time in milliseconds */
|
|
4803
|
+
executionTime: number;
|
|
4804
|
+
}
|
|
4822
4805
|
/**
|
|
4823
|
-
*
|
|
4806
|
+
* Minimal SQL executor abstraction.
|
|
4807
|
+
* Used by ConnectionManager and transaction contexts.
|
|
4824
4808
|
*/
|
|
4825
|
-
|
|
4826
|
-
|
|
4827
|
-
}
|
|
4828
|
-
success: boolean;
|
|
4829
|
-
data?: {
|
|
4830
|
-
path: string;
|
|
4831
|
-
message: string;
|
|
4832
|
-
} | undefined;
|
|
4833
|
-
error?: string;
|
|
4834
|
-
}>;
|
|
4809
|
+
interface SqlExecutor {
|
|
4810
|
+
execute(query: SQL): Promise<unknown>;
|
|
4811
|
+
}
|
|
4835
4812
|
|
|
4836
4813
|
/**
|
|
4837
|
-
*
|
|
4814
|
+
* Connection configuration types for relational databases
|
|
4815
|
+
* @module connection/types
|
|
4838
4816
|
*/
|
|
4817
|
+
|
|
4839
4818
|
/**
|
|
4840
|
-
*
|
|
4819
|
+
* Connection pool configuration options
|
|
4820
|
+
*
|
|
4821
|
+
* These options control how the connection pool manages database connections.
|
|
4822
|
+
* Different vendors may support different subsets of these options.
|
|
4823
|
+
*
|
|
4824
|
+
* Note: Some options are vendor-specific and may be ignored by certain drivers.
|
|
4825
|
+
* See vendor-specific documentation for supported options.
|
|
4826
|
+
*/
|
|
4827
|
+
interface PoolConfig {
|
|
4828
|
+
/** Maximum number of connections in the pool (default: vendor-specific) */
|
|
4829
|
+
max?: number;
|
|
4830
|
+
/** Maximum time (ms) to wait for a connection from the pool before timing out */
|
|
4831
|
+
acquireTimeoutMillis?: number;
|
|
4832
|
+
/** Time (ms) a connection can remain idle before being closed (default: vendor-specific) */
|
|
4833
|
+
idleTimeoutMillis?: number;
|
|
4834
|
+
}
|
|
4835
|
+
/**
|
|
4836
|
+
* PostgreSQL-specific connection configuration
|
|
4841
4837
|
*/
|
|
4842
|
-
|
|
4843
|
-
|
|
4844
|
-
|
|
4845
|
-
|
|
4846
|
-
|
|
4847
|
-
|
|
4848
|
-
|
|
4849
|
-
|
|
4850
|
-
|
|
4851
|
-
|
|
4852
|
-
|
|
4853
|
-
|
|
4854
|
-
|
|
4855
|
-
|
|
4856
|
-
|
|
4857
|
-
|
|
4858
|
-
|
|
4859
|
-
|
|
4838
|
+
interface PostgreSQLConnectionConfig {
|
|
4839
|
+
/** Connection string (e.g., postgresql://user:password@host:port/database) */
|
|
4840
|
+
connectionString?: string;
|
|
4841
|
+
/** Host address */
|
|
4842
|
+
host?: string;
|
|
4843
|
+
/** Port number (default: 5432) */
|
|
4844
|
+
port?: number;
|
|
4845
|
+
/** Database name */
|
|
4846
|
+
database?: string;
|
|
4847
|
+
/** Username */
|
|
4848
|
+
user?: string;
|
|
4849
|
+
/** Password */
|
|
4850
|
+
password?: string;
|
|
4851
|
+
/** Enable SSL */
|
|
4852
|
+
ssl?: boolean | Record<string, unknown>;
|
|
4853
|
+
/** Connection timeout in milliseconds */
|
|
4854
|
+
connectionTimeoutMillis?: number;
|
|
4855
|
+
/** Connection pool configuration */
|
|
4856
|
+
pool?: PoolConfig;
|
|
4857
|
+
/** Additional pg-specific options */
|
|
4858
|
+
[key: string]: unknown;
|
|
4859
|
+
}
|
|
4860
4860
|
/**
|
|
4861
|
-
*
|
|
4861
|
+
* MySQL-specific connection configuration
|
|
4862
|
+
*
|
|
4863
|
+
* Note: mysql2.createPool accepts connection strings directly as a parameter,
|
|
4864
|
+
* not as a property of the config object. Use the ConnectionConfig discriminated
|
|
4865
|
+
* union type which allows either a config object OR a string.
|
|
4866
|
+
*/
|
|
4867
|
+
interface MySQLConnectionConfig {
|
|
4868
|
+
/** Host address */
|
|
4869
|
+
host?: string;
|
|
4870
|
+
/** Port number (default: 3306) */
|
|
4871
|
+
port?: number;
|
|
4872
|
+
/** Database name */
|
|
4873
|
+
database?: string;
|
|
4874
|
+
/** Username */
|
|
4875
|
+
user?: string;
|
|
4876
|
+
/** Password */
|
|
4877
|
+
password?: string;
|
|
4878
|
+
/** Enable SSL */
|
|
4879
|
+
ssl?: boolean | Record<string, unknown>;
|
|
4880
|
+
/** Connection timeout in milliseconds */
|
|
4881
|
+
connectTimeout?: number;
|
|
4882
|
+
/** Connection pool configuration */
|
|
4883
|
+
pool?: PoolConfig;
|
|
4884
|
+
/** Additional mysql2-specific options */
|
|
4885
|
+
[key: string]: unknown;
|
|
4886
|
+
}
|
|
4887
|
+
/**
|
|
4888
|
+
* SQLite-specific connection configuration
|
|
4889
|
+
*
|
|
4890
|
+
* Note: SQLite typically uses a single connection with serialized access rather than a
|
|
4891
|
+
* traditional multi-connection pool. The `pool` configuration is accepted for API
|
|
4892
|
+
* consistency and future extensions, but it may not affect runtime behavior for SQLite.
|
|
4862
4893
|
*/
|
|
4863
|
-
|
|
4864
|
-
path:
|
|
4865
|
-
|
|
4866
|
-
|
|
4867
|
-
|
|
4868
|
-
|
|
4869
|
-
|
|
4870
|
-
|
|
4871
|
-
|
|
4872
|
-
|
|
4873
|
-
|
|
4874
|
-
|
|
4875
|
-
}
|
|
4876
|
-
declare const fileWriter: _agentforge_core.Tool<{
|
|
4877
|
-
path: string;
|
|
4878
|
-
content: string;
|
|
4879
|
-
encoding?: "ascii" | "base64" | "hex" | "utf-8" | "utf8" | undefined;
|
|
4880
|
-
createDirs?: boolean | undefined;
|
|
4881
|
-
}, {
|
|
4882
|
-
success: boolean;
|
|
4883
|
-
data?: {
|
|
4884
|
-
path: string;
|
|
4885
|
-
size: number;
|
|
4886
|
-
encoding: string;
|
|
4887
|
-
} | undefined;
|
|
4888
|
-
error?: string;
|
|
4889
|
-
}>;
|
|
4890
|
-
declare const fileAppend: _agentforge_core.Tool<{
|
|
4891
|
-
path: string;
|
|
4892
|
-
content: string;
|
|
4893
|
-
encoding?: "ascii" | "utf-8" | "utf8" | undefined;
|
|
4894
|
-
}, {
|
|
4895
|
-
success: boolean;
|
|
4896
|
-
data?: {
|
|
4897
|
-
path: string;
|
|
4898
|
-
size: number;
|
|
4899
|
-
} | undefined;
|
|
4900
|
-
error?: string;
|
|
4901
|
-
}>;
|
|
4902
|
-
declare const fileDelete: _agentforge_core.Tool<{
|
|
4903
|
-
path: string;
|
|
4904
|
-
}, {
|
|
4905
|
-
success: boolean;
|
|
4906
|
-
data?: {
|
|
4907
|
-
path: string;
|
|
4908
|
-
message: string;
|
|
4909
|
-
} | undefined;
|
|
4910
|
-
error?: string;
|
|
4911
|
-
}>;
|
|
4912
|
-
declare const fileExists: _agentforge_core.Tool<{
|
|
4913
|
-
path: string;
|
|
4914
|
-
}, {
|
|
4915
|
-
exists: boolean;
|
|
4916
|
-
path: string;
|
|
4917
|
-
isFile: boolean;
|
|
4918
|
-
isDirectory: boolean;
|
|
4919
|
-
size: number;
|
|
4920
|
-
modified: string;
|
|
4921
|
-
} | {
|
|
4922
|
-
exists: boolean;
|
|
4923
|
-
path: string;
|
|
4924
|
-
isFile?: undefined;
|
|
4925
|
-
isDirectory?: undefined;
|
|
4926
|
-
size?: undefined;
|
|
4927
|
-
modified?: undefined;
|
|
4928
|
-
}>;
|
|
4894
|
+
interface SQLiteConnectionConfig {
|
|
4895
|
+
/** Database file path or ':memory:' for in-memory database */
|
|
4896
|
+
url: string;
|
|
4897
|
+
/**
|
|
4898
|
+
* Connection pool configuration.
|
|
4899
|
+
*
|
|
4900
|
+
* For SQLite this is primarily for API compatibility with other vendors and may be
|
|
4901
|
+
* ignored by the underlying driver.
|
|
4902
|
+
*/
|
|
4903
|
+
pool?: PoolConfig;
|
|
4904
|
+
/** Additional better-sqlite3-specific options */
|
|
4905
|
+
[key: string]: unknown;
|
|
4906
|
+
}
|
|
4929
4907
|
/**
|
|
4930
|
-
*
|
|
4908
|
+
* Union type for vendor-specific connection configurations
|
|
4931
4909
|
*/
|
|
4932
|
-
|
|
4933
|
-
|
|
4934
|
-
|
|
4935
|
-
|
|
4936
|
-
|
|
4937
|
-
|
|
4910
|
+
type VendorConnectionConfig = PostgreSQLConnectionConfig | MySQLConnectionConfig | SQLiteConnectionConfig;
|
|
4911
|
+
/**
|
|
4912
|
+
* Connection configuration for ConnectionManager
|
|
4913
|
+
*
|
|
4914
|
+
* Uses a discriminated union to ensure that the connection string format
|
|
4915
|
+
* matches the selected database vendor at compile time.
|
|
4916
|
+
*/
|
|
4917
|
+
type ConnectionConfig = {
|
|
4918
|
+
/** PostgreSQL database vendor */
|
|
4919
|
+
vendor: Extract<DatabaseVendor, 'postgresql'>;
|
|
4920
|
+
/**
|
|
4921
|
+
* PostgreSQL-specific connection configuration or connection string.
|
|
4922
|
+
* When using a string, it should be a PostgreSQL URL
|
|
4923
|
+
* (e.g., "postgresql://user:password@host:port/database").
|
|
4924
|
+
*/
|
|
4925
|
+
connection: PostgreSQLConnectionConfig | string;
|
|
4926
|
+
} | {
|
|
4927
|
+
/** MySQL database vendor */
|
|
4928
|
+
vendor: Extract<DatabaseVendor, 'mysql'>;
|
|
4929
|
+
/**
|
|
4930
|
+
* MySQL-specific connection configuration or connection string.
|
|
4931
|
+
* When using a string, it should be a MySQL URL
|
|
4932
|
+
* (e.g., "mysql://user:password@host:port/database").
|
|
4933
|
+
*/
|
|
4934
|
+
connection: MySQLConnectionConfig | string;
|
|
4935
|
+
} | {
|
|
4936
|
+
/** SQLite database vendor */
|
|
4937
|
+
vendor: Extract<DatabaseVendor, 'sqlite'>;
|
|
4938
|
+
/**
|
|
4939
|
+
* SQLite-specific connection configuration or location.
|
|
4940
|
+
* Can be a file path, ':memory:' for in-memory database, or a config object.
|
|
4941
|
+
*/
|
|
4942
|
+
connection: SQLiteConnectionConfig | string;
|
|
4943
|
+
};
|
|
4944
|
+
|
|
4945
|
+
/**
|
|
4946
|
+
* Connection manager for relational databases using Drizzle ORM
|
|
4947
|
+
* @module connection/connection-manager
|
|
4948
|
+
*/
|
|
4949
|
+
|
|
4950
|
+
/**
|
|
4951
|
+
* Connection state enum
|
|
4952
|
+
*/
|
|
4953
|
+
declare enum ConnectionState {
|
|
4954
|
+
DISCONNECTED = "disconnected",
|
|
4955
|
+
CONNECTING = "connecting",
|
|
4956
|
+
CONNECTED = "connected",
|
|
4957
|
+
RECONNECTING = "reconnecting",
|
|
4958
|
+
ERROR = "error"
|
|
4959
|
+
}
|
|
4960
|
+
/**
|
|
4961
|
+
* Connection lifecycle events
|
|
4962
|
+
*/
|
|
4963
|
+
type ConnectionEvent = 'connected' | 'disconnected' | 'error' | 'reconnecting';
|
|
4964
|
+
/**
|
|
4965
|
+
* Reconnection configuration
|
|
4966
|
+
*/
|
|
4967
|
+
interface ReconnectionConfig {
|
|
4968
|
+
/** Enable automatic reconnection on connection loss */
|
|
4969
|
+
enabled: boolean;
|
|
4970
|
+
/** Maximum number of reconnection attempts (0 = infinite) */
|
|
4971
|
+
maxAttempts: number;
|
|
4972
|
+
/** Base delay in milliseconds for exponential backoff */
|
|
4973
|
+
baseDelayMs: number;
|
|
4974
|
+
/** Maximum delay in milliseconds between reconnection attempts */
|
|
4975
|
+
maxDelayMs: number;
|
|
4976
|
+
}
|
|
4977
|
+
/**
|
|
4978
|
+
* Connection manager that handles database connections for PostgreSQL, MySQL, and SQLite
|
|
4979
|
+
* using Drizzle ORM with lifecycle management and automatic reconnection
|
|
4980
|
+
*/
|
|
4981
|
+
declare class ConnectionManager extends EventEmitter implements DatabaseConnection {
|
|
4982
|
+
private vendor;
|
|
4983
|
+
private db;
|
|
4984
|
+
private client;
|
|
4985
|
+
private config;
|
|
4986
|
+
private state;
|
|
4987
|
+
private reconnectionConfig;
|
|
4988
|
+
private reconnectionAttempts;
|
|
4989
|
+
private reconnectionTimer;
|
|
4990
|
+
private connectPromise;
|
|
4991
|
+
private connectionGeneration;
|
|
4992
|
+
/**
|
|
4993
|
+
* Create a new ConnectionManager instance
|
|
4994
|
+
* @param config - Connection configuration
|
|
4995
|
+
* @param reconnectionConfig - Optional reconnection configuration
|
|
4996
|
+
*/
|
|
4997
|
+
constructor(config: ConnectionConfig, reconnectionConfig?: Partial<ReconnectionConfig>);
|
|
4998
|
+
/**
|
|
4999
|
+
* Connect to the database
|
|
5000
|
+
* Initializes the connection and sets up automatic reconnection if configured
|
|
5001
|
+
* @throws {Error} If connection fails or configuration is invalid
|
|
5002
|
+
*/
|
|
5003
|
+
connect(): Promise<void>;
|
|
5004
|
+
/**
|
|
5005
|
+
* Disconnect from the database
|
|
5006
|
+
* Closes the connection and cancels any pending reconnection attempts
|
|
5007
|
+
*
|
|
5008
|
+
* Note: Event listeners are NOT removed by this method. If you need to dispose
|
|
5009
|
+
* of the ConnectionManager instance entirely, call dispose() instead.
|
|
5010
|
+
*/
|
|
5011
|
+
disconnect(): Promise<void>;
|
|
5012
|
+
/**
|
|
5013
|
+
* Dispose of the ConnectionManager instance
|
|
5014
|
+
* Disconnects and removes all event listeners
|
|
5015
|
+
* Call this when you're done with the ConnectionManager and won't reuse it
|
|
5016
|
+
*/
|
|
5017
|
+
dispose(): Promise<void>;
|
|
5018
|
+
/**
|
|
5019
|
+
* Check if the connection is currently connected
|
|
5020
|
+
* @returns true if connected, false otherwise
|
|
5021
|
+
*/
|
|
5022
|
+
isConnected(): boolean;
|
|
5023
|
+
/**
|
|
5024
|
+
* Get the current connection state
|
|
5025
|
+
* @returns Current connection state
|
|
5026
|
+
*/
|
|
5027
|
+
getState(): ConnectionState;
|
|
5028
|
+
/**
|
|
5029
|
+
* Get the configured database vendor.
|
|
5030
|
+
*/
|
|
5031
|
+
getVendor(): DatabaseVendor;
|
|
5032
|
+
/**
|
|
5033
|
+
* Initialize the database connection
|
|
5034
|
+
*
|
|
5035
|
+
* This method is public to maintain compatibility with the DatabaseConnection interface
|
|
5036
|
+
* and existing code (e.g., relational-query.ts). For new code, prefer using connect()
|
|
5037
|
+
* which provides lifecycle management and automatic reconnection.
|
|
5038
|
+
*
|
|
5039
|
+
* @throws {Error} If connection fails or configuration is invalid
|
|
5040
|
+
*/
|
|
5041
|
+
initialize(): Promise<void>;
|
|
5042
|
+
/**
|
|
5043
|
+
* Set the connection state and log the change
|
|
5044
|
+
* @param newState - New connection state
|
|
5045
|
+
* @private
|
|
5046
|
+
*/
|
|
5047
|
+
private setState;
|
|
5048
|
+
/**
|
|
5049
|
+
* Schedule a reconnection attempt with exponential backoff
|
|
5050
|
+
* @private
|
|
5051
|
+
*/
|
|
5052
|
+
private scheduleReconnection;
|
|
5053
|
+
/**
|
|
5054
|
+
* Initialize PostgreSQL connection using Drizzle ORM with node-postgres
|
|
5055
|
+
*
|
|
5056
|
+
* Applies pool configuration options to pg.Pool for connection management.
|
|
5057
|
+
*/
|
|
5058
|
+
private initializePostgreSQL;
|
|
5059
|
+
/**
|
|
5060
|
+
* Initialize MySQL connection using Drizzle ORM with mysql2
|
|
5061
|
+
*
|
|
5062
|
+
* Applies pool configuration options to mysql2.createPool for connection management.
|
|
5063
|
+
*/
|
|
5064
|
+
private initializeMySQL;
|
|
5065
|
+
/**
|
|
5066
|
+
* Initialize SQLite connection using Drizzle ORM with better-sqlite3
|
|
5067
|
+
*
|
|
5068
|
+
* Note: SQLite uses a single connection. Pool configuration is logged but not applied
|
|
5069
|
+
* as SQLite handles concurrent access through its internal locking mechanism.
|
|
5070
|
+
*/
|
|
5071
|
+
private initializeSQLite;
|
|
5072
|
+
/**
|
|
5073
|
+
* Determine whether an error thrown by drizzle-orm's better-sqlite3 adapter
|
|
5074
|
+
* `.all()` indicates the statement does not return data (i.e. it is DML/DDL,
|
|
5075
|
+
* not a SELECT).
|
|
5076
|
+
*
|
|
5077
|
+
* The adapter may surface this as either a native `SqliteError` or a
|
|
5078
|
+
* `TypeError` depending on the drizzle-orm / better-sqlite3 version, so we
|
|
5079
|
+
* accept both types while still requiring the distinctive message substring
|
|
5080
|
+
* to avoid false positives from unrelated errors.
|
|
5081
|
+
*/
|
|
5082
|
+
private isSqliteNonQueryError;
|
|
5083
|
+
/**
|
|
5084
|
+
* Execute a SQL query
|
|
5085
|
+
*
|
|
5086
|
+
* Executes a parameterized SQL query using Drizzle's SQL template objects.
|
|
5087
|
+
* This method provides safe parameter binding to prevent SQL injection.
|
|
5088
|
+
*
|
|
5089
|
+
* @param query - Drizzle SQL template object with parameter binding
|
|
5090
|
+
* @returns Query result
|
|
5091
|
+
*
|
|
5092
|
+
* @example
|
|
5093
|
+
* ```typescript
|
|
5094
|
+
* import { sql } from 'drizzle-orm';
|
|
5095
|
+
*
|
|
5096
|
+
* const result = await manager.execute(
|
|
5097
|
+
* sql`SELECT * FROM users WHERE id = ${userId}`
|
|
5098
|
+
* );
|
|
5099
|
+
* ```
|
|
5100
|
+
*/
|
|
5101
|
+
execute(query: SQL): Promise<unknown>;
|
|
5102
|
+
/**
|
|
5103
|
+
* Execute a callback with a single dedicated database connection/session.
|
|
5104
|
+
*
|
|
5105
|
+
* This is required for multi-statement transactions so all statements run on
|
|
5106
|
+
* the same underlying connection.
|
|
5107
|
+
*/
|
|
5108
|
+
executeInConnection<T>(callback: (execute: (query: SQL) => Promise<unknown>) => Promise<T>): Promise<T>;
|
|
5109
|
+
/**
|
|
5110
|
+
* Get connection pool metrics
|
|
5111
|
+
*
|
|
5112
|
+
* Returns information about the current state of the connection pool.
|
|
5113
|
+
* For SQLite, returns basic connection status since it uses a single connection.
|
|
5114
|
+
*
|
|
5115
|
+
* @returns Pool metrics including total, active, idle, and waiting connections
|
|
5116
|
+
*/
|
|
5117
|
+
getPoolMetrics(): {
|
|
5118
|
+
totalCount: number;
|
|
5119
|
+
activeCount: number;
|
|
5120
|
+
idleCount: number;
|
|
5121
|
+
waitingCount: number;
|
|
5122
|
+
};
|
|
5123
|
+
/**
|
|
5124
|
+
* Close the database connection
|
|
5125
|
+
*
|
|
5126
|
+
* This method is public to maintain compatibility with the DatabaseConnection interface
|
|
5127
|
+
* and existing code (e.g., relational-query.ts). For new code, prefer using disconnect()
|
|
5128
|
+
* for connection lifecycle management. Note that disconnect() does NOT clean up event
|
|
5129
|
+
* listeners; call dispose() if you need full cleanup including listener removal.
|
|
5130
|
+
*
|
|
5131
|
+
* Note: This method coordinates with in-flight connect()/initialize() operations
|
|
5132
|
+
* and cancels pending reconnection timers to prevent unexpected reconnections.
|
|
5133
|
+
*/
|
|
5134
|
+
close(): Promise<void>;
|
|
5135
|
+
/**
|
|
5136
|
+
* Clean up resources when a connection is cancelled during initialization
|
|
5137
|
+
* This prevents connection leaks when disconnect() is called while initialize() is in-flight
|
|
5138
|
+
*/
|
|
5139
|
+
private cleanupCancelledConnection;
|
|
5140
|
+
/**
|
|
5141
|
+
* Check if the connection is healthy
|
|
5142
|
+
* @returns true if connection is healthy, false otherwise
|
|
5143
|
+
*/
|
|
5144
|
+
isHealthy(): Promise<boolean>;
|
|
5145
|
+
}
|
|
5146
|
+
|
|
5147
|
+
/**
|
|
5148
|
+
* Transaction helpers for relational databases.
|
|
5149
|
+
* @module query/transaction
|
|
5150
|
+
*/
|
|
5151
|
+
|
|
5152
|
+
/**
|
|
5153
|
+
* SQL transaction isolation level.
|
|
5154
|
+
*
|
|
5155
|
+
* Determines the visibility of changes made by concurrent transactions.
|
|
5156
|
+
* Supported by PostgreSQL and MySQL. SQLite supports `'read uncommitted'`
|
|
5157
|
+
* via `PRAGMA read_uncommitted = 1`; other levels are silently ignored
|
|
5158
|
+
* (SQLite uses serializable semantics by default).
|
|
5159
|
+
*/
|
|
5160
|
+
type TransactionIsolationLevel = 'read uncommitted' | 'read committed' | 'repeatable read' | 'serializable';
|
|
5161
|
+
/**
|
|
5162
|
+
* Options for configuring a database transaction.
|
|
5163
|
+
*
|
|
5164
|
+
* @property isolationLevel - SQL isolation level for the transaction
|
|
5165
|
+
* @property timeoutMs - Maximum duration in milliseconds before the transaction is rolled back
|
|
5166
|
+
*/
|
|
5167
|
+
interface TransactionOptions {
|
|
5168
|
+
isolationLevel?: TransactionIsolationLevel;
|
|
5169
|
+
timeoutMs?: number;
|
|
5170
|
+
}
|
|
5171
|
+
/**
|
|
5172
|
+
* Active transaction handle with savepoint support.
|
|
5173
|
+
*
|
|
5174
|
+
* Extends {@link SqlExecutor} so queries can be executed within the transaction.
|
|
5175
|
+
* The transaction is automatically rolled back if an error occurs and is not
|
|
5176
|
+
* explicitly committed.
|
|
5177
|
+
*
|
|
5178
|
+
* @property id - Unique identifier for this transaction
|
|
5179
|
+
* @property vendor - Database vendor this transaction belongs to
|
|
5180
|
+
*/
|
|
5181
|
+
interface TransactionContext extends SqlExecutor {
|
|
5182
|
+
id: string;
|
|
5183
|
+
vendor: DatabaseVendor;
|
|
5184
|
+
/** Whether the transaction is still active (not committed or rolled back). */
|
|
5185
|
+
isActive(): boolean;
|
|
5186
|
+
/** Commit all changes made within this transaction. */
|
|
5187
|
+
commit(): Promise<void>;
|
|
5188
|
+
/** Roll back all changes made within this transaction. */
|
|
5189
|
+
rollback(): Promise<void>;
|
|
5190
|
+
/** Create a savepoint within this transaction. Returns the savepoint name. */
|
|
5191
|
+
createSavepoint(name?: string): Promise<string>;
|
|
5192
|
+
/** Roll back to a previously created savepoint. */
|
|
5193
|
+
rollbackToSavepoint(name: string): Promise<void>;
|
|
5194
|
+
/** Release a savepoint, making its changes permanent within the transaction. */
|
|
5195
|
+
releaseSavepoint(name: string): Promise<void>;
|
|
5196
|
+
/** Execute an operation within a nested savepoint, with automatic rollback on failure. */
|
|
5197
|
+
withSavepoint<T>(operation: (transaction: TransactionContext) => Promise<T>, name?: string): Promise<T>;
|
|
5198
|
+
}
|
|
5199
|
+
/**
|
|
5200
|
+
* Execute a callback inside a database transaction.
|
|
5201
|
+
*
|
|
5202
|
+
* Automatically commits on success and rolls back on failure.
|
|
5203
|
+
*/
|
|
5204
|
+
declare function withTransaction<T>(manager: ConnectionManager, operation: (transaction: TransactionContext) => Promise<T>, options?: TransactionOptions): Promise<T>;
|
|
5205
|
+
|
|
5206
|
+
/**
|
|
5207
|
+
* Query executor for relational databases using Drizzle ORM
|
|
5208
|
+
* @module query/query-executor
|
|
5209
|
+
*/
|
|
5210
|
+
|
|
5211
|
+
/**
|
|
5212
|
+
* Execution context for raw SQL queries.
|
|
5213
|
+
*
|
|
5214
|
+
* @property transaction - Optional active transaction to execute within
|
|
5215
|
+
*/
|
|
5216
|
+
interface QueryExecutionContext {
|
|
5217
|
+
transaction?: TransactionContext;
|
|
5218
|
+
}
|
|
5219
|
+
/**
|
|
5220
|
+
* Execute a parameterized SQL query
|
|
5221
|
+
*
|
|
5222
|
+
* This function executes a SQL query with proper parameter binding to prevent
|
|
5223
|
+
* SQL injection. It supports SELECT, INSERT, UPDATE, DELETE, and other SQL statements.
|
|
5224
|
+
*
|
|
5225
|
+
* @param manager - ConnectionManager instance with initialized database connection
|
|
5226
|
+
* @param input - Query input with SQL string, parameters, and options
|
|
5227
|
+
* @returns Query execution result with rows, row count, and execution time
|
|
5228
|
+
* @throws {Error} If database is not initialized or query execution fails
|
|
5229
|
+
*/
|
|
5230
|
+
declare function executeQuery(manager: ConnectionManager, input: QueryInput, context?: QueryExecutionContext): Promise<QueryExecutionResult>;
|
|
5231
|
+
|
|
5232
|
+
/**
|
|
5233
|
+
* Query builder helpers for relational CRUD operations.
|
|
5234
|
+
* @module query/query-builder
|
|
5235
|
+
*/
|
|
5236
|
+
|
|
5237
|
+
/**
|
|
5238
|
+
* Supported scalar values for INSERT payloads.
|
|
5239
|
+
*/
|
|
5240
|
+
type InsertValue = string | number | boolean | null;
|
|
5241
|
+
/**
|
|
5242
|
+
* One INSERT row payload.
|
|
5243
|
+
*/
|
|
5244
|
+
type InsertRow = Record<string, InsertValue>;
|
|
5245
|
+
/**
|
|
5246
|
+
* INSERT payload input shape.
|
|
5247
|
+
*/
|
|
5248
|
+
type InsertData = InsertRow | InsertRow[];
|
|
5249
|
+
/**
|
|
5250
|
+
* INSERT RETURNING behavior.
|
|
5251
|
+
*/
|
|
5252
|
+
type InsertReturningMode = 'none' | 'id' | 'row';
|
|
5253
|
+
/**
|
|
5254
|
+
* INSERT RETURNING configuration.
|
|
5255
|
+
*/
|
|
5256
|
+
interface InsertReturningOptions {
|
|
5257
|
+
mode?: InsertReturningMode;
|
|
5258
|
+
idColumn?: string;
|
|
5259
|
+
}
|
|
5260
|
+
/**
|
|
5261
|
+
* Builder input for INSERT queries.
|
|
5262
|
+
*/
|
|
5263
|
+
interface InsertQueryInput {
|
|
5264
|
+
table: string;
|
|
5265
|
+
data: InsertData;
|
|
5266
|
+
returning?: InsertReturningOptions;
|
|
5267
|
+
vendor: DatabaseVendor;
|
|
5268
|
+
}
|
|
5269
|
+
/**
|
|
5270
|
+
* Built INSERT query with normalized metadata used by execution layer.
|
|
5271
|
+
*/
|
|
5272
|
+
interface BuiltInsertQuery {
|
|
5273
|
+
query: SQL | SQL[];
|
|
5274
|
+
rows: InsertRow[];
|
|
5275
|
+
returningMode: InsertReturningMode;
|
|
5276
|
+
idColumn: string;
|
|
5277
|
+
supportsReturning: boolean;
|
|
5278
|
+
}
|
|
5279
|
+
/**
|
|
5280
|
+
* Build a safe parameterized INSERT query from structured input.
|
|
5281
|
+
*/
|
|
5282
|
+
declare function buildInsertQuery(input: InsertQueryInput): BuiltInsertQuery;
|
|
5283
|
+
/**
|
|
5284
|
+
* Supported scalar values for UPDATE payloads.
|
|
5285
|
+
*/
|
|
5286
|
+
type UpdateValue = InsertValue;
|
|
5287
|
+
/**
|
|
5288
|
+
* UPDATE payload shape.
|
|
5289
|
+
*/
|
|
5290
|
+
type UpdateData = Record<string, UpdateValue>;
|
|
5291
|
+
/**
|
|
5292
|
+
* WHERE operator types for UPDATE conditions.
|
|
5293
|
+
*/
|
|
5294
|
+
type UpdateWhereOperator = 'eq' | 'ne' | 'gt' | 'lt' | 'gte' | 'lte' | 'like' | 'in' | 'notIn' | 'isNull' | 'isNotNull';
|
|
5295
|
+
/**
|
|
5296
|
+
* WHERE condition for UPDATE queries.
|
|
5297
|
+
*/
|
|
5298
|
+
interface UpdateWhereCondition {
|
|
5299
|
+
column: string;
|
|
5300
|
+
operator: UpdateWhereOperator;
|
|
5301
|
+
value?: string | number | boolean | null | Array<string | number>;
|
|
5302
|
+
}
|
|
5303
|
+
/**
|
|
5304
|
+
* Optional optimistic lock condition appended to WHERE.
|
|
5305
|
+
*/
|
|
5306
|
+
interface UpdateOptimisticLock {
|
|
5307
|
+
column: string;
|
|
5308
|
+
expectedValue: string | number;
|
|
5309
|
+
}
|
|
5310
|
+
/**
|
|
5311
|
+
* Builder input for UPDATE queries.
|
|
5312
|
+
*/
|
|
5313
|
+
interface UpdateQueryInput {
|
|
5314
|
+
table: string;
|
|
5315
|
+
data: UpdateData;
|
|
5316
|
+
where?: UpdateWhereCondition[];
|
|
5317
|
+
allowFullTableUpdate?: boolean;
|
|
5318
|
+
optimisticLock?: UpdateOptimisticLock;
|
|
5319
|
+
vendor: DatabaseVendor;
|
|
5320
|
+
}
|
|
5321
|
+
/**
|
|
5322
|
+
* Built UPDATE query with normalized metadata used by execution layer.
|
|
5323
|
+
*/
|
|
5324
|
+
interface BuiltUpdateQuery {
|
|
5325
|
+
query: SQL;
|
|
5326
|
+
whereApplied: boolean;
|
|
5327
|
+
usesOptimisticLock: boolean;
|
|
5328
|
+
}
|
|
5329
|
+
/**
|
|
5330
|
+
* WHERE condition for DELETE queries.
|
|
5331
|
+
*/
|
|
5332
|
+
interface DeleteWhereCondition {
|
|
5333
|
+
column: string;
|
|
5334
|
+
operator: UpdateWhereOperator;
|
|
5335
|
+
value?: string | number | boolean | null | Array<string | number>;
|
|
5336
|
+
}
|
|
5337
|
+
/**
|
|
5338
|
+
* Soft-delete configuration.
|
|
5339
|
+
*/
|
|
5340
|
+
interface DeleteSoftDeleteOptions {
|
|
5341
|
+
column?: string;
|
|
5342
|
+
value?: string | number;
|
|
5343
|
+
}
|
|
5344
|
+
/**
|
|
5345
|
+
* Builder input for DELETE queries.
|
|
5346
|
+
*/
|
|
5347
|
+
interface DeleteQueryInput {
|
|
5348
|
+
table: string;
|
|
5349
|
+
where?: DeleteWhereCondition[];
|
|
5350
|
+
allowFullTableDelete?: boolean;
|
|
5351
|
+
softDelete?: DeleteSoftDeleteOptions;
|
|
5352
|
+
vendor: DatabaseVendor;
|
|
5353
|
+
}
|
|
5354
|
+
/**
|
|
5355
|
+
* Built DELETE query with normalized metadata used by execution layer.
|
|
5356
|
+
*/
|
|
5357
|
+
interface BuiltDeleteQuery {
|
|
5358
|
+
query: SQL;
|
|
5359
|
+
whereApplied: boolean;
|
|
5360
|
+
usesSoftDelete: boolean;
|
|
5361
|
+
softDeleteColumn?: string;
|
|
5362
|
+
}
|
|
5363
|
+
/**
|
|
5364
|
+
* Build a safe parameterized UPDATE query from structured input.
|
|
5365
|
+
*/
|
|
5366
|
+
declare function buildUpdateQuery(input: UpdateQueryInput): BuiltUpdateQuery;
|
|
5367
|
+
/**
|
|
5368
|
+
* Build a safe parameterized DELETE query from structured input.
|
|
5369
|
+
*/
|
|
5370
|
+
declare function buildDeleteQuery(input: DeleteQueryInput): BuiltDeleteQuery;
|
|
5371
|
+
/**
|
|
5372
|
+
* ORDER BY direction for SELECT queries.
|
|
5373
|
+
*/
|
|
5374
|
+
type SelectOrderDirection = 'asc' | 'desc';
|
|
5375
|
+
/**
|
|
5376
|
+
* ORDER BY clause for SELECT queries.
|
|
5377
|
+
*/
|
|
5378
|
+
interface SelectOrderBy {
|
|
5379
|
+
column: string;
|
|
5380
|
+
direction: SelectOrderDirection;
|
|
5381
|
+
}
|
|
5382
|
+
/**
|
|
5383
|
+
* WHERE condition for SELECT queries.
|
|
5384
|
+
*/
|
|
5385
|
+
interface SelectWhereCondition {
|
|
5386
|
+
column: string;
|
|
5387
|
+
operator: UpdateWhereOperator;
|
|
5388
|
+
value?: string | number | boolean | null | Array<string | number>;
|
|
5389
|
+
}
|
|
5390
|
+
/**
|
|
5391
|
+
* Builder input for SELECT queries.
|
|
5392
|
+
*/
|
|
5393
|
+
interface SelectQueryInput {
|
|
5394
|
+
table: string;
|
|
5395
|
+
columns?: string[];
|
|
5396
|
+
where?: SelectWhereCondition[];
|
|
5397
|
+
orderBy?: SelectOrderBy[];
|
|
5398
|
+
limit?: number;
|
|
5399
|
+
offset?: number;
|
|
5400
|
+
vendor: DatabaseVendor;
|
|
5401
|
+
}
|
|
5402
|
+
/**
|
|
5403
|
+
* Build a safe parameterized SELECT query from structured input.
|
|
5404
|
+
*/
|
|
5405
|
+
declare function buildSelectQuery(input: SelectQueryInput): SQL;
|
|
5406
|
+
|
|
5407
|
+
/**
|
|
5408
|
+
* Generic batch execution helpers for relational operations.
|
|
5409
|
+
* @module query/batch-executor
|
|
5410
|
+
*/
|
|
5411
|
+
/** Default number of items processed per batch chunk. */
|
|
5412
|
+
declare const DEFAULT_BATCH_SIZE = 100;
|
|
5413
|
+
/** Maximum allowed batch size to prevent memory exhaustion. */
|
|
5414
|
+
declare const MAX_BATCH_SIZE = 5000;
|
|
5415
|
+
/**
|
|
5416
|
+
* Progress payload emitted after each processed batch.
|
|
5417
|
+
*/
|
|
5418
|
+
interface BatchProgressUpdate {
|
|
5419
|
+
operation: string;
|
|
5420
|
+
batchIndex: number;
|
|
5421
|
+
totalBatches: number;
|
|
5422
|
+
batchSize: number;
|
|
5423
|
+
processedItems: number;
|
|
5424
|
+
totalItems: number;
|
|
5425
|
+
successfulItems: number;
|
|
5426
|
+
failedItems: number;
|
|
5427
|
+
lastBatchSucceeded: boolean;
|
|
5428
|
+
}
|
|
5429
|
+
/**
|
|
5430
|
+
* Recorded batch failure metadata.
|
|
5431
|
+
*/
|
|
5432
|
+
interface BatchFailureDetail {
|
|
5433
|
+
operation: string;
|
|
5434
|
+
batchIndex: number;
|
|
5435
|
+
batchSize: number;
|
|
5436
|
+
attempts: number;
|
|
5437
|
+
error: string;
|
|
5438
|
+
}
|
|
5439
|
+
/**
|
|
5440
|
+
* Runtime options for batched execution.
|
|
5441
|
+
*/
|
|
5442
|
+
interface BatchExecutionOptions {
|
|
5443
|
+
batchSize?: number;
|
|
5444
|
+
continueOnError?: boolean;
|
|
5445
|
+
maxRetries?: number;
|
|
5446
|
+
retryDelayMs?: number;
|
|
5447
|
+
onProgress?: (progress: BatchProgressUpdate) => Promise<void> | void;
|
|
5448
|
+
}
|
|
5449
|
+
/**
|
|
5450
|
+
* Task descriptor for generic batched execution.
|
|
5451
|
+
*/
|
|
5452
|
+
interface BatchExecutionTask<TItem, TResult> {
|
|
5453
|
+
operation: string;
|
|
5454
|
+
items: TItem[];
|
|
5455
|
+
executeBatch: (batchItems: TItem[], batchIndex: number) => Promise<TResult>;
|
|
5456
|
+
getBatchSuccessCount?: (result: TResult, batchItems: TItem[]) => number;
|
|
5457
|
+
}
|
|
5458
|
+
/**
|
|
5459
|
+
* Batched execution summary.
|
|
5460
|
+
*/
|
|
5461
|
+
interface BatchExecutionResult<TResult> {
|
|
5462
|
+
results: TResult[];
|
|
5463
|
+
totalItems: number;
|
|
5464
|
+
processedItems: number;
|
|
5465
|
+
successfulItems: number;
|
|
5466
|
+
failedItems: number;
|
|
5467
|
+
totalBatches: number;
|
|
5468
|
+
retries: number;
|
|
5469
|
+
partialSuccess: boolean;
|
|
5470
|
+
executionTime: number;
|
|
5471
|
+
failures: BatchFailureDetail[];
|
|
5472
|
+
}
|
|
5473
|
+
/**
|
|
5474
|
+
* Synthetic benchmark output comparing individual and batched processing.
|
|
5475
|
+
*/
|
|
5476
|
+
interface BatchBenchmarkResult {
|
|
5477
|
+
itemCount: number;
|
|
5478
|
+
batchSize: number;
|
|
5479
|
+
batchCount: number;
|
|
5480
|
+
individualExecutionTime: number;
|
|
5481
|
+
batchedExecutionTime: number;
|
|
5482
|
+
timeSavedMs: number;
|
|
5483
|
+
speedupRatio: number;
|
|
5484
|
+
speedupPercent: number;
|
|
5485
|
+
}
|
|
5486
|
+
/**
|
|
5487
|
+
* Execute operation items in batches with retry and progress callbacks.
|
|
5488
|
+
*/
|
|
5489
|
+
declare function executeBatchedTask<TItem, TResult>(task: BatchExecutionTask<TItem, TResult>, options?: BatchExecutionOptions): Promise<BatchExecutionResult<TResult>>;
|
|
5490
|
+
/**
|
|
5491
|
+
* Benchmark individual vs batched execution.
|
|
5492
|
+
*
|
|
5493
|
+
* Note: callers should run this only for idempotent or isolated workloads.
|
|
5494
|
+
*/
|
|
5495
|
+
declare function benchmarkBatchExecution<TItem, TIndividualResult, TBatchResult>(params: {
|
|
5496
|
+
items: TItem[];
|
|
5497
|
+
batchSize?: number;
|
|
5498
|
+
runIndividual: (item: TItem, index: number) => Promise<TIndividualResult>;
|
|
5499
|
+
runBatch: (batchItems: TItem[], batchIndex: number) => Promise<TBatchResult>;
|
|
5500
|
+
}): Promise<BatchBenchmarkResult>;
|
|
5501
|
+
|
|
5502
|
+
/**
|
|
5503
|
+
* Streaming SELECT executor for large result sets.
|
|
5504
|
+
* @module query/stream-executor
|
|
5505
|
+
*/
|
|
5506
|
+
|
|
5507
|
+
/** Default number of rows fetched per streaming chunk. */
|
|
5508
|
+
declare const DEFAULT_CHUNK_SIZE = 100;
|
|
5509
|
+
/**
|
|
5510
|
+
* Memory usage information captured during streaming execution.
|
|
5511
|
+
*/
|
|
5512
|
+
interface StreamingMemoryUsage$1 {
|
|
5513
|
+
startHeapUsed: number;
|
|
5514
|
+
peakHeapUsed: number;
|
|
5515
|
+
endHeapUsed: number;
|
|
5516
|
+
deltaHeapUsed: number;
|
|
5517
|
+
}
|
|
5518
|
+
/**
|
|
5519
|
+
* One streamed chunk payload.
|
|
5520
|
+
*/
|
|
5521
|
+
interface StreamingSelectChunk {
|
|
5522
|
+
chunkIndex: number;
|
|
5523
|
+
offset: number;
|
|
5524
|
+
rows: unknown[];
|
|
5525
|
+
}
|
|
5526
|
+
/**
|
|
5527
|
+
* Streaming execution options.
|
|
5528
|
+
*/
|
|
5529
|
+
interface StreamingSelectOptions {
|
|
5530
|
+
chunkSize?: number;
|
|
5531
|
+
maxRows?: number;
|
|
5532
|
+
sampleSize?: number;
|
|
5533
|
+
collectAllRows?: boolean;
|
|
5534
|
+
signal?: AbortSignal;
|
|
5535
|
+
onChunk?: (chunk: StreamingSelectChunk) => Promise<void> | void;
|
|
5536
|
+
}
|
|
5537
|
+
/**
|
|
5538
|
+
* Streaming execution result.
|
|
5539
|
+
*/
|
|
5540
|
+
interface StreamingSelectResult {
|
|
5541
|
+
rows: unknown[];
|
|
5542
|
+
rowCount: number;
|
|
5543
|
+
chunkCount: number;
|
|
5544
|
+
executionTime: number;
|
|
5545
|
+
cancelled: boolean;
|
|
5546
|
+
memoryUsage: StreamingMemoryUsage$1;
|
|
5547
|
+
}
|
|
5548
|
+
/**
|
|
5549
|
+
* Optional benchmark result comparing regular vs streaming SELECT execution.
|
|
5550
|
+
*/
|
|
5551
|
+
interface StreamingBenchmarkResult {
|
|
5552
|
+
nonStreamingExecutionTime: number;
|
|
5553
|
+
nonStreamingPeakHeapUsed: number;
|
|
5554
|
+
streamingExecutionTime: number;
|
|
5555
|
+
streamingPeakHeapUsed: number;
|
|
5556
|
+
memorySavedBytes: number;
|
|
5557
|
+
memorySavedPercent: number;
|
|
5558
|
+
}
|
|
5559
|
+
/**
|
|
5560
|
+
* Yield SELECT rows chunk-by-chunk using LIMIT/OFFSET pagination.
|
|
5561
|
+
*
|
|
5562
|
+
* NOTE:
|
|
5563
|
+
* OFFSET-based pagination can degrade on very large offsets because many SQL
|
|
5564
|
+
* engines must scan/skip intermediate rows. For very large datasets, prefer
|
|
5565
|
+
* keyset/cursor pagination when available.
|
|
5566
|
+
*/
|
|
5567
|
+
declare function streamSelectChunks(executor: SqlExecutor, input: SelectQueryInput, options?: StreamingSelectOptions): AsyncGenerator<StreamingSelectChunk>;
|
|
5568
|
+
/**
|
|
5569
|
+
* Create a Node.js Readable stream that emits SELECT chunks in object mode.
|
|
5570
|
+
*/
|
|
5571
|
+
declare function createSelectReadableStream(executor: SqlExecutor, input: SelectQueryInput, options?: StreamingSelectOptions): Readable;
|
|
5572
|
+
/**
|
|
5573
|
+
* Execute a SELECT query in streaming mode while tracking memory usage.
|
|
5574
|
+
*/
|
|
5575
|
+
declare function executeStreamingSelect(executor: SqlExecutor, input: SelectQueryInput, options?: StreamingSelectOptions): Promise<StreamingSelectResult>;
|
|
5576
|
+
/**
|
|
5577
|
+
* Benchmark memory usage of regular SELECT execution vs streaming execution.
|
|
5578
|
+
*
|
|
5579
|
+
* NOTE:
|
|
5580
|
+
* This benchmark intentionally executes the SELECT query twice (one regular,
|
|
5581
|
+
* one streaming). Use only with side-effect-free queries.
|
|
5582
|
+
*/
|
|
5583
|
+
declare function benchmarkStreamingSelectMemory(executor: SqlExecutor, input: SelectQueryInput, options?: StreamingSelectOptions): Promise<StreamingBenchmarkResult>;
|
|
5584
|
+
|
|
5585
|
+
/**
|
|
5586
|
+
* Type definitions for relational schema introspection.
|
|
5587
|
+
* @module schema/types
|
|
5588
|
+
*/
|
|
5589
|
+
|
|
5590
|
+
/**
|
|
5591
|
+
* Foreign key definition for a table column.
|
|
5592
|
+
*/
|
|
5593
|
+
interface ForeignKeySchema {
|
|
5594
|
+
name?: string;
|
|
5595
|
+
column: string;
|
|
5596
|
+
referencedTable: string;
|
|
5597
|
+
referencedColumn: string;
|
|
5598
|
+
referencedSchema?: string;
|
|
5599
|
+
}
|
|
5600
|
+
/**
|
|
5601
|
+
* Index definition for a table.
|
|
5602
|
+
*/
|
|
5603
|
+
interface IndexSchema {
|
|
5604
|
+
name: string;
|
|
5605
|
+
columns: string[];
|
|
5606
|
+
isUnique: boolean;
|
|
5607
|
+
}
|
|
5608
|
+
/**
|
|
5609
|
+
* Column definition for a table.
|
|
5610
|
+
*/
|
|
5611
|
+
interface ColumnSchema {
|
|
5612
|
+
name: string;
|
|
5613
|
+
type: string;
|
|
5614
|
+
isNullable: boolean;
|
|
5615
|
+
defaultValue: unknown;
|
|
5616
|
+
isPrimaryKey: boolean;
|
|
5617
|
+
}
|
|
5618
|
+
/**
|
|
5619
|
+
* Table schema definition.
|
|
5620
|
+
*/
|
|
5621
|
+
interface TableSchema {
|
|
5622
|
+
name: string;
|
|
5623
|
+
schema?: string;
|
|
5624
|
+
columns: ColumnSchema[];
|
|
5625
|
+
primaryKey: string[];
|
|
5626
|
+
foreignKeys: ForeignKeySchema[];
|
|
5627
|
+
indexes: IndexSchema[];
|
|
5628
|
+
}
|
|
5629
|
+
/**
|
|
5630
|
+
* Introspected database schema.
|
|
5631
|
+
*/
|
|
5632
|
+
interface DatabaseSchema {
|
|
5633
|
+
vendor: DatabaseVendor;
|
|
5634
|
+
tables: TableSchema[];
|
|
5635
|
+
generatedAt: string;
|
|
5636
|
+
}
|
|
5637
|
+
/**
|
|
5638
|
+
* Runtime options for schema introspection.
|
|
5639
|
+
*/
|
|
5640
|
+
interface SchemaInspectOptions {
|
|
5641
|
+
tables?: string[];
|
|
5642
|
+
bypassCache?: boolean;
|
|
5643
|
+
}
|
|
5644
|
+
/**
|
|
5645
|
+
* Schema inspector configuration.
|
|
5646
|
+
*/
|
|
5647
|
+
interface SchemaInspectorConfig {
|
|
5648
|
+
cacheTtlMs?: number;
|
|
5649
|
+
cacheKey?: string;
|
|
5650
|
+
}
|
|
5651
|
+
|
|
5652
|
+
/**
|
|
5653
|
+
* Schema inspector for relational databases.
|
|
5654
|
+
* @module schema/schema-inspector
|
|
5655
|
+
*/
|
|
5656
|
+
|
|
5657
|
+
/**
|
|
5658
|
+
* Inspects database schemas across PostgreSQL, MySQL, and SQLite.
|
|
5659
|
+
*
|
|
5660
|
+
* Retrieves table, column, index, and foreign key metadata with built-in
|
|
5661
|
+
* caching support. Use {@link SchemaInspector.clearCache} to invalidate
|
|
5662
|
+
* cached schemas.
|
|
5663
|
+
*/
|
|
5664
|
+
declare class SchemaInspector {
|
|
5665
|
+
private readonly manager;
|
|
5666
|
+
private readonly vendor;
|
|
5667
|
+
private readonly cacheTtlMs;
|
|
5668
|
+
private readonly cacheKey?;
|
|
5669
|
+
/**
|
|
5670
|
+
* Create a new SchemaInspector.
|
|
5671
|
+
*
|
|
5672
|
+
* @param manager - ConnectionManager instance for database access
|
|
5673
|
+
* @param vendor - Database vendor ('postgresql' | 'mysql' | 'sqlite')
|
|
5674
|
+
* @param config - Optional configuration for cache TTL and cache key
|
|
5675
|
+
*/
|
|
5676
|
+
constructor(manager: ConnectionManager, vendor: DatabaseVendor, config?: SchemaInspectorConfig);
|
|
5677
|
+
/**
|
|
5678
|
+
* Clear cached schema data.
|
|
5679
|
+
*
|
|
5680
|
+
* @param cacheKey - Specific cache key to clear. If omitted, clears all cached schemas.
|
|
5681
|
+
*/
|
|
5682
|
+
static clearCache(cacheKey?: string): void;
|
|
5683
|
+
/** Invalidate this inspector's cached schema, if any. */
|
|
5684
|
+
invalidateCache(): void;
|
|
5685
|
+
/**
|
|
5686
|
+
* Inspect the database schema and return structured metadata.
|
|
5687
|
+
*
|
|
5688
|
+
* Results are cached when a `cacheKey` was provided at construction time.
|
|
5689
|
+
*
|
|
5690
|
+
* @param options - Optional table filters and cache bypass flag
|
|
5691
|
+
* @returns Structured schema with tables, columns, indexes, and foreign keys
|
|
5692
|
+
*/
|
|
5693
|
+
inspect(options?: SchemaInspectOptions): Promise<DatabaseSchema>;
|
|
5694
|
+
private inspectFromDatabase;
|
|
5695
|
+
private runQueryRows;
|
|
5696
|
+
private createTableMap;
|
|
5697
|
+
private getTableFromRow;
|
|
5698
|
+
private inspectPostgreSQL;
|
|
5699
|
+
private inspectMySQL;
|
|
5700
|
+
private inspectSQLite;
|
|
5701
|
+
private applyIndexRows;
|
|
5702
|
+
}
|
|
5703
|
+
|
|
5704
|
+
/**
|
|
5705
|
+
* Schema metadata validation utilities.
|
|
5706
|
+
*
|
|
5707
|
+
* Validates table existence, column existence, and column types
|
|
5708
|
+
* against an introspected {@link DatabaseSchema}.
|
|
5709
|
+
*
|
|
5710
|
+
* @module schema/schema-validator
|
|
5711
|
+
*/
|
|
5712
|
+
|
|
5713
|
+
/**
|
|
5714
|
+
* Result of a schema validation check.
|
|
5715
|
+
*/
|
|
5716
|
+
interface ValidationResult {
|
|
5717
|
+
/** Whether the validation passed */
|
|
5718
|
+
valid: boolean;
|
|
5719
|
+
/** Error messages (empty when valid) */
|
|
5720
|
+
errors: string[];
|
|
5721
|
+
}
|
|
5722
|
+
/**
|
|
5723
|
+
* Validate that a table exists in the database schema.
|
|
5724
|
+
*
|
|
5725
|
+
* Supports both plain table names (`users`) and schema-qualified names (`public.users`).
|
|
5726
|
+
*
|
|
5727
|
+
* @param schema - The introspected database schema
|
|
5728
|
+
* @param tableName - Table name to check (plain or schema-qualified)
|
|
5729
|
+
* @returns Validation result
|
|
5730
|
+
*/
|
|
5731
|
+
declare function validateTableExists(schema: DatabaseSchema, tableName: string): ValidationResult;
|
|
5732
|
+
/**
|
|
5733
|
+
* Validate that one or more columns exist in a table.
|
|
5734
|
+
*
|
|
5735
|
+
* @param schema - The introspected database schema
|
|
5736
|
+
* @param tableName - Table that should contain the columns
|
|
5737
|
+
* @param columnNames - Column names to verify
|
|
5738
|
+
* @returns Validation result
|
|
5739
|
+
*/
|
|
5740
|
+
declare function validateColumnsExist(schema: DatabaseSchema, tableName: string, columnNames: string[]): ValidationResult;
|
|
5741
|
+
/**
|
|
5742
|
+
* Validate that columns in a table match expected types.
|
|
5743
|
+
*
|
|
5744
|
+
* Type matching is case-insensitive and uses substring containment:
|
|
5745
|
+
* a match succeeds when either string contains the other. For example
|
|
5746
|
+
* `varchar` matches `varchar(255)` (the actual type contains the expected
|
|
5747
|
+
* string), but `varchar` does **not** match `character varying` because
|
|
5748
|
+
* neither is a substring of the other.
|
|
5749
|
+
*
|
|
5750
|
+
* @param schema - The introspected database schema
|
|
5751
|
+
* @param tableName - Table to validate against
|
|
5752
|
+
* @param expectedTypes - Map of column name → expected type substring
|
|
5753
|
+
* @returns Validation result
|
|
5754
|
+
*/
|
|
5755
|
+
declare function validateColumnTypes(schema: DatabaseSchema, tableName: string, expectedTypes: Record<string, string>): ValidationResult;
|
|
5756
|
+
|
|
5757
|
+
/**
|
|
5758
|
+
* Database type → TypeScript type mapper.
|
|
5759
|
+
*
|
|
5760
|
+
* Maps vendor-specific SQL column types to their closest TypeScript
|
|
5761
|
+
* equivalents. Used for code generation hints, documentation, and
|
|
5762
|
+
* schema-aware validation utilities.
|
|
5763
|
+
*
|
|
5764
|
+
* @module schema/type-mapper
|
|
5765
|
+
*/
|
|
5766
|
+
|
|
5767
|
+
/**
|
|
5768
|
+
* TypeScript type representation for a mapped database column.
|
|
5769
|
+
*/
|
|
5770
|
+
interface MappedType {
|
|
5771
|
+
/** The TypeScript type string (e.g. `string`, `number`, `boolean`) */
|
|
5772
|
+
tsType: string;
|
|
5773
|
+
/** Whether the column is nullable (adds `| null`) */
|
|
5774
|
+
nullable: boolean;
|
|
5775
|
+
/** The original database type string */
|
|
5776
|
+
dbType: string;
|
|
5777
|
+
/** Optional notes about precision loss, range, etc. */
|
|
5778
|
+
notes?: string;
|
|
5779
|
+
}
|
|
5780
|
+
/**
|
|
5781
|
+
* Map a single database column type to its TypeScript equivalent.
|
|
5782
|
+
*
|
|
5783
|
+
* Normalises the input type to lower-case and strips size suffixes
|
|
5784
|
+
* (e.g. `varchar(255)` → `varchar`) before looking up the mapping.
|
|
5785
|
+
*
|
|
5786
|
+
* @param vendor - Database vendor
|
|
5787
|
+
* @param dbType - The raw column type string from the database
|
|
5788
|
+
* @param nullable - Whether the column is nullable
|
|
5789
|
+
* @returns The mapped TypeScript type information
|
|
5790
|
+
*/
|
|
5791
|
+
declare function mapColumnType(vendor: DatabaseVendor, dbType: string, nullable?: boolean): MappedType;
|
|
5792
|
+
/**
|
|
5793
|
+
* Map all columns in a database schema to TypeScript types.
|
|
5794
|
+
*
|
|
5795
|
+
* Returns a nested map: `tableName → columnName → MappedType`.
|
|
5796
|
+
*
|
|
5797
|
+
* @param vendor - Database vendor
|
|
5798
|
+
* @param columns - Array of columns with their metadata
|
|
5799
|
+
* @returns Nested map from table to column to mapped type
|
|
5800
|
+
*/
|
|
5801
|
+
declare function mapSchemaTypes(vendor: DatabaseVendor, columns: Array<{
|
|
5802
|
+
table: string;
|
|
5803
|
+
name: string;
|
|
5804
|
+
type: string;
|
|
5805
|
+
nullable: boolean;
|
|
5806
|
+
}>): Map<string, Map<string, MappedType>>;
|
|
5807
|
+
/**
|
|
5808
|
+
* Get the full type map for a vendor (useful for documentation / tooling).
|
|
5809
|
+
*
|
|
5810
|
+
* @param vendor - Database vendor
|
|
5811
|
+
* @returns Read-only copy of the vendor's type mapping table
|
|
5812
|
+
*/
|
|
5813
|
+
declare function getVendorTypeMap(vendor: DatabaseVendor): Readonly<Record<string, string>>;
|
|
5814
|
+
|
|
5815
|
+
/**
|
|
5816
|
+
* Schema diff and serialisation utilities.
|
|
5817
|
+
*
|
|
5818
|
+
* Compare two {@link DatabaseSchema} instances and produce a structured
|
|
5819
|
+
* diff report. Also provide JSON export / import for snapshot testing
|
|
5820
|
+
* and cross-environment schema comparison.
|
|
5821
|
+
*
|
|
5822
|
+
* @module schema/schema-diff
|
|
5823
|
+
*/
|
|
5824
|
+
|
|
5825
|
+
/** Describes a difference for a single column. */
|
|
5826
|
+
interface ColumnDiff {
|
|
5827
|
+
column: string;
|
|
5828
|
+
type: 'added' | 'removed' | 'changed';
|
|
5829
|
+
/** Present when type is `changed` */
|
|
5830
|
+
changes?: Array<{
|
|
5831
|
+
property: string;
|
|
5832
|
+
before: unknown;
|
|
5833
|
+
after: unknown;
|
|
5834
|
+
}>;
|
|
5835
|
+
}
|
|
5836
|
+
/** Describes a difference for a single table. */
|
|
5837
|
+
interface TableDiff {
|
|
5838
|
+
table: string;
|
|
5839
|
+
type: 'added' | 'removed' | 'changed';
|
|
5840
|
+
/** Present when type is `changed` — per-column changes */
|
|
5841
|
+
columns?: ColumnDiff[];
|
|
5842
|
+
/** Present when type is `changed` — primary-key changes */
|
|
5843
|
+
primaryKeyChanged?: {
|
|
5844
|
+
before: string[];
|
|
5845
|
+
after: string[];
|
|
5846
|
+
};
|
|
5847
|
+
}
|
|
5848
|
+
/** Full diff report between two schemas. */
|
|
5849
|
+
interface SchemaDiffResult {
|
|
5850
|
+
/** Whether the schemas are identical */
|
|
5851
|
+
identical: boolean;
|
|
5852
|
+
/** Per-table differences */
|
|
5853
|
+
tables: TableDiff[];
|
|
5854
|
+
/** Summary counts */
|
|
5855
|
+
summary: {
|
|
5856
|
+
tablesAdded: number;
|
|
5857
|
+
tablesRemoved: number;
|
|
5858
|
+
tablesChanged: number;
|
|
5859
|
+
columnsAdded: number;
|
|
5860
|
+
columnsRemoved: number;
|
|
5861
|
+
columnsChanged: number;
|
|
5862
|
+
};
|
|
5863
|
+
}
|
|
5864
|
+
/**
|
|
5865
|
+
* Compare two database schemas and return a structured diff report.
|
|
5866
|
+
*
|
|
5867
|
+
* The comparison is name-based and case-insensitive. Schema-qualified
|
|
5868
|
+
* names are supported (e.g. `public.users`).
|
|
5869
|
+
*
|
|
5870
|
+
* @param before - The baseline schema
|
|
5871
|
+
* @param after - The schema to compare against the baseline
|
|
5872
|
+
* @returns A structured diff report
|
|
5873
|
+
*/
|
|
5874
|
+
declare function diffSchemas(before: DatabaseSchema, after: DatabaseSchema): SchemaDiffResult;
|
|
5875
|
+
/**
|
|
5876
|
+
* Export a {@link DatabaseSchema} to a JSON string.
|
|
5877
|
+
*
|
|
5878
|
+
* The output is deterministic (keys sorted, 2-space indent) so that it
|
|
5879
|
+
* can be used for snapshot testing.
|
|
5880
|
+
*
|
|
5881
|
+
* @param schema - The schema to serialise
|
|
5882
|
+
* @returns Pretty-printed JSON string
|
|
5883
|
+
*/
|
|
5884
|
+
declare function exportSchemaToJson(schema: DatabaseSchema): string;
|
|
5885
|
+
/**
|
|
5886
|
+
* Import a {@link DatabaseSchema} from a JSON string.
|
|
5887
|
+
*
|
|
5888
|
+
* Performs basic structural validation to ensure the parsed object has the
|
|
5889
|
+
* required shape.
|
|
5890
|
+
*
|
|
5891
|
+
* @param json - JSON string produced by {@link exportSchemaToJson}
|
|
5892
|
+
* @returns Parsed database schema
|
|
5893
|
+
* @throws Error when the JSON is not a valid DatabaseSchema
|
|
5894
|
+
*/
|
|
5895
|
+
declare function importSchemaFromJson(json: string): DatabaseSchema;
|
|
5896
|
+
|
|
5897
|
+
/**
|
|
5898
|
+
* Relational Query Tool - Execute raw SQL queries with parameter binding
|
|
5899
|
+
* @module tools/relational-query
|
|
5900
|
+
*/
|
|
5901
|
+
/**
|
|
5902
|
+
* Relational Query Tool
|
|
5903
|
+
*
|
|
5904
|
+
* Executes raw SQL queries against relational databases (PostgreSQL, MySQL, SQLite)
|
|
5905
|
+
* with proper parameter binding to prevent SQL injection.
|
|
5906
|
+
*
|
|
5907
|
+
* Features:
|
|
5908
|
+
* - Supports SELECT, INSERT, UPDATE, DELETE, and other SQL statements
|
|
5909
|
+
* - Parameter binding prevents SQL injection
|
|
5910
|
+
* - Supports positional ($1, ?) and named (:name) parameters
|
|
5911
|
+
* - Result formatting to JSON
|
|
5912
|
+
* - Error handling with sanitized messages
|
|
5913
|
+
*
|
|
5914
|
+
* @example
|
|
5915
|
+
* ```typescript
|
|
5916
|
+
* // SELECT with positional parameters
|
|
5917
|
+
* const result = await relationalQuery.invoke({
|
|
5918
|
+
* sql: 'SELECT * FROM users WHERE id = $1',
|
|
5919
|
+
* params: [42],
|
|
5920
|
+
* vendor: 'postgresql',
|
|
5921
|
+
* connectionString: 'postgresql://user:pass@localhost:5432/mydb'
|
|
5922
|
+
* });
|
|
5923
|
+
*
|
|
5924
|
+
* // INSERT with named parameters
|
|
5925
|
+
* const result = await relationalQuery.invoke({
|
|
5926
|
+
* sql: 'INSERT INTO users (name, email) VALUES (:name, :email)',
|
|
5927
|
+
* params: { name: 'John Doe', email: 'john@example.com' },
|
|
5928
|
+
* vendor: 'postgresql',
|
|
5929
|
+
* connectionString: 'postgresql://user:pass@localhost:5432/mydb'
|
|
5930
|
+
* });
|
|
5931
|
+
* ```
|
|
5932
|
+
*/
|
|
5933
|
+
declare const relationalQuery: _agentforge_core.Tool<{
|
|
5934
|
+
connectionString: string;
|
|
5935
|
+
vendor: "postgresql" | "mysql" | "sqlite";
|
|
5936
|
+
sql: string;
|
|
5937
|
+
params?: unknown[] | Record<string, unknown> | undefined;
|
|
5938
|
+
}, {
|
|
5939
|
+
success: boolean;
|
|
5940
|
+
rows: unknown[];
|
|
5941
|
+
rowCount: number;
|
|
5942
|
+
executionTime: number;
|
|
5943
|
+
error?: undefined;
|
|
5944
|
+
} | {
|
|
5945
|
+
success: boolean;
|
|
5946
|
+
error: string;
|
|
5947
|
+
rows: never[];
|
|
5948
|
+
rowCount: number;
|
|
5949
|
+
executionTime?: undefined;
|
|
5950
|
+
}>;
|
|
5951
|
+
|
|
5952
|
+
/**
|
|
5953
|
+
* Type definitions for relational SELECT operations
|
|
5954
|
+
* @module tools/relational-select/types
|
|
5955
|
+
*/
|
|
5956
|
+
|
|
5957
|
+
/** Re-export of streaming memory usage type from the query layer. */
|
|
5958
|
+
type StreamingMemoryUsage = StreamingMemoryUsage$1;
|
|
5959
|
+
/**
|
|
5960
|
+
* Optional streaming benchmark metadata.
|
|
5961
|
+
*/
|
|
5962
|
+
type StreamingBenchmarkMetadata = StreamingBenchmarkResult;
|
|
5963
|
+
/**
|
|
5964
|
+
* Streaming execution metadata.
|
|
5965
|
+
*/
|
|
5966
|
+
interface StreamingMetadata {
|
|
5967
|
+
enabled: true;
|
|
5968
|
+
chunkSize: number;
|
|
5969
|
+
chunkCount: number;
|
|
5970
|
+
sampledRowCount: number;
|
|
5971
|
+
streamedRowCount: number;
|
|
5972
|
+
cancelled: boolean;
|
|
5973
|
+
memoryUsage: StreamingMemoryUsage;
|
|
5974
|
+
benchmark?: StreamingBenchmarkMetadata;
|
|
5975
|
+
}
|
|
5976
|
+
/**
|
|
5977
|
+
* Tool success response
|
|
5978
|
+
*/
|
|
5979
|
+
interface SelectSuccessResponse {
|
|
5980
|
+
success: true;
|
|
5981
|
+
rows: unknown[];
|
|
5982
|
+
rowCount: number;
|
|
5983
|
+
executionTime: number;
|
|
5984
|
+
streaming?: StreamingMetadata;
|
|
5985
|
+
}
|
|
5986
|
+
/**
|
|
5987
|
+
* Tool error response
|
|
5988
|
+
*/
|
|
5989
|
+
interface SelectErrorResponse {
|
|
5990
|
+
success: false;
|
|
5991
|
+
error: string;
|
|
5992
|
+
rows: [];
|
|
5993
|
+
rowCount: 0;
|
|
5994
|
+
}
|
|
5995
|
+
/**
|
|
5996
|
+
* Tool response (success or error)
|
|
5997
|
+
*/
|
|
5998
|
+
type SelectResponse = SelectSuccessResponse | SelectErrorResponse;
|
|
5999
|
+
|
|
6000
|
+
/**
|
|
6001
|
+
* Relational SELECT Tool
|
|
6002
|
+
*
|
|
6003
|
+
* Execute type-safe SELECT queries using Drizzle ORM query builder.
|
|
6004
|
+
*
|
|
6005
|
+
* Features:
|
|
6006
|
+
* - Type-safe column selection
|
|
6007
|
+
* - WHERE conditions with multiple operators
|
|
6008
|
+
* - ORDER BY with ascending/descending
|
|
6009
|
+
* - LIMIT and OFFSET for pagination
|
|
6010
|
+
* - Optional chunked streaming mode for large result sets
|
|
6011
|
+
* - Result formatting to JSON
|
|
6012
|
+
* - Error handling with clear messages
|
|
6013
|
+
*
|
|
6014
|
+
* @example
|
|
6015
|
+
* ```typescript
|
|
6016
|
+
* // SELECT with WHERE and ORDER BY
|
|
6017
|
+
* const result = await relationalSelect.invoke({
|
|
6018
|
+
* table: 'users',
|
|
6019
|
+
* columns: ['id', 'name', 'email'],
|
|
6020
|
+
* where: [
|
|
6021
|
+
* { column: 'status', operator: 'eq', value: 'active' },
|
|
6022
|
+
* { column: 'age', operator: 'gte', value: 18 }
|
|
6023
|
+
* ],
|
|
6024
|
+
* orderBy: [{ column: 'name', direction: 'asc' }],
|
|
6025
|
+
* limit: 10,
|
|
6026
|
+
* vendor: 'postgresql',
|
|
6027
|
+
* connectionString: 'postgresql://user:pass@localhost:5432/mydb'
|
|
6028
|
+
* });
|
|
6029
|
+
* ```
|
|
6030
|
+
*/
|
|
6031
|
+
declare const relationalSelect: _agentforge_core.Tool<{
|
|
6032
|
+
table: string;
|
|
6033
|
+
connectionString: string;
|
|
6034
|
+
vendor: "postgresql" | "mysql" | "sqlite";
|
|
6035
|
+
limit?: number | undefined;
|
|
6036
|
+
columns?: string[] | undefined;
|
|
6037
|
+
where?: {
|
|
6038
|
+
operator: "eq" | "ne" | "gt" | "lt" | "gte" | "lte" | "like" | "in" | "notIn" | "isNull" | "isNotNull";
|
|
6039
|
+
column: string;
|
|
6040
|
+
value?: string | number | boolean | (string | number)[] | null | undefined;
|
|
6041
|
+
}[] | undefined;
|
|
6042
|
+
orderBy?: {
|
|
6043
|
+
direction: "asc" | "desc";
|
|
6044
|
+
column: string;
|
|
6045
|
+
}[] | undefined;
|
|
6046
|
+
offset?: number | undefined;
|
|
6047
|
+
streaming?: {
|
|
6048
|
+
enabled?: boolean | undefined;
|
|
6049
|
+
maxRows?: number | undefined;
|
|
6050
|
+
chunkSize?: number | undefined;
|
|
6051
|
+
sampleSize?: number | undefined;
|
|
6052
|
+
benchmark?: boolean | undefined;
|
|
6053
|
+
} | undefined;
|
|
6054
|
+
}, SelectResponse>;
|
|
6055
|
+
|
|
6056
|
+
/**
|
|
6057
|
+
* Type definitions for relational INSERT operations
|
|
6058
|
+
* @module tools/relational-insert/types
|
|
6059
|
+
*/
|
|
6060
|
+
|
|
6061
|
+
/**
|
|
6062
|
+
* Batch metadata returned by INSERT execution when batch mode is active.
|
|
6063
|
+
*/
|
|
6064
|
+
interface InsertBatchMetadata {
|
|
6065
|
+
enabled: boolean;
|
|
6066
|
+
batchSize: number;
|
|
6067
|
+
totalItems: number;
|
|
6068
|
+
processedItems: number;
|
|
6069
|
+
successfulItems: number;
|
|
6070
|
+
failedItems: number;
|
|
6071
|
+
totalBatches: number;
|
|
6072
|
+
retries: number;
|
|
6073
|
+
partialSuccess: boolean;
|
|
6074
|
+
failures: BatchFailureDetail[];
|
|
6075
|
+
benchmark?: BatchBenchmarkResult;
|
|
6076
|
+
}
|
|
6077
|
+
/**
|
|
6078
|
+
* Tool success response.
|
|
6079
|
+
*/
|
|
6080
|
+
interface InsertSuccessResponse {
|
|
6081
|
+
success: true;
|
|
6082
|
+
rowCount: number;
|
|
6083
|
+
insertedIds: Array<number | string>;
|
|
6084
|
+
rows: unknown[];
|
|
6085
|
+
executionTime: number;
|
|
6086
|
+
batch?: InsertBatchMetadata;
|
|
6087
|
+
}
|
|
6088
|
+
/**
|
|
6089
|
+
* Tool error response.
|
|
6090
|
+
*/
|
|
6091
|
+
interface InsertErrorResponse {
|
|
6092
|
+
success: false;
|
|
6093
|
+
error: string;
|
|
6094
|
+
rowCount: 0;
|
|
6095
|
+
insertedIds: [];
|
|
6096
|
+
rows: [];
|
|
6097
|
+
}
|
|
6098
|
+
/**
|
|
6099
|
+
* Tool response (success or error).
|
|
6100
|
+
*/
|
|
6101
|
+
type InsertResponse = InsertSuccessResponse | InsertErrorResponse;
|
|
6102
|
+
|
|
6103
|
+
/**
|
|
6104
|
+
* Relational INSERT Tool
|
|
6105
|
+
*
|
|
6106
|
+
* Execute type-safe INSERT queries using Drizzle ORM query builder.
|
|
6107
|
+
*/
|
|
6108
|
+
declare const relationalInsert: _agentforge_core.Tool<{
|
|
6109
|
+
data: Record<string, string | number | boolean | null> | Record<string, string | number | boolean | null>[];
|
|
6110
|
+
table: string;
|
|
6111
|
+
connectionString: string;
|
|
6112
|
+
vendor: "postgresql" | "mysql" | "sqlite";
|
|
6113
|
+
batch?: {
|
|
6114
|
+
enabled?: boolean | undefined;
|
|
6115
|
+
batchSize?: number | undefined;
|
|
6116
|
+
maxRetries?: number | undefined;
|
|
6117
|
+
retryDelayMs?: number | undefined;
|
|
6118
|
+
continueOnError?: boolean | undefined;
|
|
6119
|
+
benchmark?: boolean | undefined;
|
|
6120
|
+
} | undefined;
|
|
6121
|
+
returning?: {
|
|
6122
|
+
mode?: "row" | "none" | "id" | undefined;
|
|
6123
|
+
idColumn?: string | undefined;
|
|
6124
|
+
} | undefined;
|
|
6125
|
+
}, InsertResponse>;
|
|
6126
|
+
|
|
6127
|
+
/**
|
|
6128
|
+
* Type definitions for relational UPDATE operations
|
|
6129
|
+
* @module tools/relational-update/types
|
|
6130
|
+
*/
|
|
6131
|
+
|
|
6132
|
+
/**
|
|
6133
|
+
* Batch metadata returned by UPDATE execution when batch mode is active.
|
|
6134
|
+
*/
|
|
6135
|
+
interface UpdateBatchMetadata {
|
|
6136
|
+
enabled: boolean;
|
|
6137
|
+
batchSize: number;
|
|
6138
|
+
totalItems: number;
|
|
6139
|
+
processedItems: number;
|
|
6140
|
+
successfulItems: number;
|
|
6141
|
+
failedItems: number;
|
|
6142
|
+
totalBatches: number;
|
|
6143
|
+
retries: number;
|
|
6144
|
+
partialSuccess: boolean;
|
|
6145
|
+
failures: BatchFailureDetail[];
|
|
6146
|
+
benchmark?: BatchBenchmarkResult;
|
|
6147
|
+
}
|
|
6148
|
+
/**
|
|
6149
|
+
* Tool success response.
|
|
6150
|
+
*/
|
|
6151
|
+
interface UpdateSuccessResponse {
|
|
6152
|
+
success: true;
|
|
6153
|
+
rowCount: number;
|
|
6154
|
+
executionTime: number;
|
|
6155
|
+
batch?: UpdateBatchMetadata;
|
|
6156
|
+
}
|
|
6157
|
+
/**
|
|
6158
|
+
* Tool error response.
|
|
6159
|
+
*/
|
|
6160
|
+
interface UpdateErrorResponse {
|
|
6161
|
+
success: false;
|
|
6162
|
+
error: string;
|
|
6163
|
+
rowCount: 0;
|
|
6164
|
+
}
|
|
6165
|
+
/**
|
|
6166
|
+
* Tool response (success or error).
|
|
6167
|
+
*/
|
|
6168
|
+
type UpdateResponse = UpdateSuccessResponse | UpdateErrorResponse;
|
|
6169
|
+
|
|
6170
|
+
/**
|
|
6171
|
+
* Relational UPDATE Tool
|
|
6172
|
+
*
|
|
6173
|
+
* Execute type-safe UPDATE queries using Drizzle ORM query builder.
|
|
6174
|
+
*/
|
|
6175
|
+
declare const relationalUpdate: _agentforge_core.Tool<{
|
|
6176
|
+
table: string;
|
|
6177
|
+
connectionString: string;
|
|
6178
|
+
vendor: "postgresql" | "mysql" | "sqlite";
|
|
6179
|
+
data?: Record<string, string | number | boolean | null> | undefined;
|
|
6180
|
+
where?: {
|
|
6181
|
+
operator: "eq" | "ne" | "gt" | "lt" | "gte" | "lte" | "like" | "in" | "notIn" | "isNull" | "isNotNull";
|
|
6182
|
+
column: string;
|
|
6183
|
+
value?: string | number | boolean | (string | number)[] | null | undefined;
|
|
6184
|
+
}[] | undefined;
|
|
6185
|
+
batch?: {
|
|
6186
|
+
enabled?: boolean | undefined;
|
|
6187
|
+
batchSize?: number | undefined;
|
|
6188
|
+
maxRetries?: number | undefined;
|
|
6189
|
+
retryDelayMs?: number | undefined;
|
|
6190
|
+
continueOnError?: boolean | undefined;
|
|
6191
|
+
benchmark?: boolean | undefined;
|
|
6192
|
+
} | undefined;
|
|
6193
|
+
allowFullTableUpdate?: boolean | undefined;
|
|
6194
|
+
optimisticLock?: {
|
|
6195
|
+
column: string;
|
|
6196
|
+
expectedValue: string | number;
|
|
6197
|
+
} | undefined;
|
|
6198
|
+
operations?: {
|
|
6199
|
+
data: Record<string, string | number | boolean | null>;
|
|
6200
|
+
where?: {
|
|
6201
|
+
operator: "eq" | "ne" | "gt" | "lt" | "gte" | "lte" | "like" | "in" | "notIn" | "isNull" | "isNotNull";
|
|
6202
|
+
column: string;
|
|
6203
|
+
value?: string | number | boolean | (string | number)[] | null | undefined;
|
|
6204
|
+
}[] | undefined;
|
|
6205
|
+
allowFullTableUpdate?: boolean | undefined;
|
|
6206
|
+
optimisticLock?: {
|
|
6207
|
+
column: string;
|
|
6208
|
+
expectedValue: string | number;
|
|
6209
|
+
} | undefined;
|
|
6210
|
+
}[] | undefined;
|
|
6211
|
+
}, UpdateResponse>;
|
|
6212
|
+
|
|
6213
|
+
/**
|
|
6214
|
+
* Type definitions for relational DELETE operations
|
|
6215
|
+
* @module tools/relational-delete/types
|
|
6216
|
+
*/
|
|
6217
|
+
|
|
6218
|
+
/** Metadata returned after a batched DELETE operation completes. */
|
|
6219
|
+
interface DeleteBatchMetadata {
|
|
6220
|
+
enabled: boolean;
|
|
6221
|
+
batchSize: number;
|
|
6222
|
+
totalItems: number;
|
|
6223
|
+
processedItems: number;
|
|
6224
|
+
successfulItems: number;
|
|
6225
|
+
failedItems: number;
|
|
6226
|
+
totalBatches: number;
|
|
6227
|
+
retries: number;
|
|
6228
|
+
partialSuccess: boolean;
|
|
6229
|
+
failures: BatchFailureDetail[];
|
|
6230
|
+
benchmark?: BatchBenchmarkResult;
|
|
6231
|
+
}
|
|
6232
|
+
/** Successful DELETE response returned to the caller. */
|
|
6233
|
+
interface DeleteSuccessResponse {
|
|
6234
|
+
success: true;
|
|
6235
|
+
rowCount: number;
|
|
6236
|
+
executionTime: number;
|
|
6237
|
+
softDeleted: boolean;
|
|
6238
|
+
batch?: DeleteBatchMetadata;
|
|
6239
|
+
}
|
|
6240
|
+
/** Error DELETE response returned when the operation fails. */
|
|
6241
|
+
interface DeleteErrorResponse {
|
|
6242
|
+
success: false;
|
|
6243
|
+
error: string;
|
|
6244
|
+
rowCount: 0;
|
|
6245
|
+
softDeleted: false;
|
|
6246
|
+
}
|
|
6247
|
+
/** Union type representing either a successful or failed DELETE response. */
|
|
6248
|
+
type DeleteResponse = DeleteSuccessResponse | DeleteErrorResponse;
|
|
6249
|
+
|
|
6250
|
+
/**
|
|
6251
|
+
* LangGraph tool for type-safe DELETE queries with single and batched operation support.
|
|
6252
|
+
*
|
|
6253
|
+
* Supports WHERE conditions, full-table-delete protection, soft-delete mode,
|
|
6254
|
+
* batch operations with retry logic, and optional cascade hints.
|
|
6255
|
+
*/
|
|
6256
|
+
declare const relationalDelete: _agentforge_core.Tool<{
|
|
6257
|
+
table: string;
|
|
6258
|
+
connectionString: string;
|
|
6259
|
+
vendor: "postgresql" | "mysql" | "sqlite";
|
|
6260
|
+
where?: {
|
|
6261
|
+
operator: "eq" | "ne" | "gt" | "lt" | "gte" | "lte" | "like" | "in" | "notIn" | "isNull" | "isNotNull";
|
|
6262
|
+
column: string;
|
|
6263
|
+
value?: string | number | boolean | (string | number)[] | null | undefined;
|
|
6264
|
+
}[] | undefined;
|
|
6265
|
+
batch?: {
|
|
6266
|
+
enabled?: boolean | undefined;
|
|
6267
|
+
batchSize?: number | undefined;
|
|
6268
|
+
maxRetries?: number | undefined;
|
|
6269
|
+
retryDelayMs?: number | undefined;
|
|
6270
|
+
continueOnError?: boolean | undefined;
|
|
6271
|
+
benchmark?: boolean | undefined;
|
|
6272
|
+
} | undefined;
|
|
6273
|
+
operations?: {
|
|
6274
|
+
where?: {
|
|
6275
|
+
operator: "eq" | "ne" | "gt" | "lt" | "gte" | "lte" | "like" | "in" | "notIn" | "isNull" | "isNotNull";
|
|
6276
|
+
column: string;
|
|
6277
|
+
value?: string | number | boolean | (string | number)[] | null | undefined;
|
|
6278
|
+
}[] | undefined;
|
|
6279
|
+
allowFullTableDelete?: boolean | undefined;
|
|
6280
|
+
cascade?: boolean | undefined;
|
|
6281
|
+
softDelete?: {
|
|
6282
|
+
value?: string | number | undefined;
|
|
6283
|
+
column?: string | undefined;
|
|
6284
|
+
} | undefined;
|
|
6285
|
+
}[] | undefined;
|
|
6286
|
+
allowFullTableDelete?: boolean | undefined;
|
|
6287
|
+
cascade?: boolean | undefined;
|
|
6288
|
+
softDelete?: {
|
|
6289
|
+
value?: string | number | undefined;
|
|
6290
|
+
column?: string | undefined;
|
|
6291
|
+
} | undefined;
|
|
6292
|
+
}, DeleteResponse>;
|
|
6293
|
+
|
|
6294
|
+
/**
|
|
6295
|
+
* Relational Get Schema Tool
|
|
6296
|
+
* @module tools/relational-get-schema
|
|
6297
|
+
*/
|
|
6298
|
+
/**
|
|
6299
|
+
* Relational Get Schema Tool
|
|
6300
|
+
*
|
|
6301
|
+
* Introspects database schema metadata including tables, columns, primary keys,
|
|
6302
|
+
* foreign keys, and indexes for PostgreSQL, MySQL, and SQLite.
|
|
6303
|
+
*/
|
|
6304
|
+
declare const relationalGetSchema: _agentforge_core.Tool<{
|
|
6305
|
+
connectionString: string;
|
|
6306
|
+
vendor: "postgresql" | "mysql" | "sqlite";
|
|
6307
|
+
database?: string | undefined;
|
|
6308
|
+
tables?: string[] | undefined;
|
|
6309
|
+
cacheTtlMs?: number | undefined;
|
|
6310
|
+
refreshCache?: boolean | undefined;
|
|
6311
|
+
}, {
|
|
6312
|
+
success: boolean;
|
|
6313
|
+
schema: DatabaseSchema;
|
|
6314
|
+
summary: {
|
|
6315
|
+
tableCount: number;
|
|
6316
|
+
columnCount: number;
|
|
6317
|
+
foreignKeyCount: number;
|
|
6318
|
+
indexCount: number;
|
|
6319
|
+
};
|
|
6320
|
+
error?: undefined;
|
|
6321
|
+
} | {
|
|
6322
|
+
success: boolean;
|
|
6323
|
+
error: string;
|
|
6324
|
+
schema: null;
|
|
6325
|
+
summary?: undefined;
|
|
6326
|
+
}>;
|
|
6327
|
+
|
|
6328
|
+
/**
|
|
6329
|
+
* File Operations Types
|
|
6330
|
+
*
|
|
6331
|
+
* Type definitions and schemas for file operation tools.
|
|
6332
|
+
*/
|
|
6333
|
+
|
|
6334
|
+
/**
|
|
6335
|
+
* File reader schema
|
|
6336
|
+
*/
|
|
6337
|
+
declare const fileReaderSchema: z.ZodObject<{
|
|
6338
|
+
path: z.ZodString;
|
|
6339
|
+
encoding: z.ZodDefault<z.ZodEnum<["utf8", "utf-8", "ascii", "base64", "hex", "binary"]>>;
|
|
6340
|
+
}, "strip", z.ZodTypeAny, {
|
|
6341
|
+
path: string;
|
|
6342
|
+
encoding: "ascii" | "binary" | "base64" | "hex" | "utf-8" | "utf8";
|
|
6343
|
+
}, {
|
|
6344
|
+
path: string;
|
|
6345
|
+
encoding?: "ascii" | "binary" | "base64" | "hex" | "utf-8" | "utf8" | undefined;
|
|
6346
|
+
}>;
|
|
6347
|
+
/**
|
|
6348
|
+
* File writer schema
|
|
6349
|
+
*/
|
|
6350
|
+
declare const fileWriterSchema: z.ZodObject<{
|
|
6351
|
+
path: z.ZodString;
|
|
6352
|
+
content: z.ZodString;
|
|
6353
|
+
encoding: z.ZodDefault<z.ZodEnum<["utf8", "utf-8", "ascii", "base64", "hex"]>>;
|
|
6354
|
+
createDirs: z.ZodDefault<z.ZodBoolean>;
|
|
6355
|
+
}, "strip", z.ZodTypeAny, {
|
|
6356
|
+
path: string;
|
|
6357
|
+
content: string;
|
|
6358
|
+
encoding: "ascii" | "base64" | "hex" | "utf-8" | "utf8";
|
|
6359
|
+
createDirs: boolean;
|
|
6360
|
+
}, {
|
|
6361
|
+
path: string;
|
|
6362
|
+
content: string;
|
|
6363
|
+
encoding?: "ascii" | "base64" | "hex" | "utf-8" | "utf8" | undefined;
|
|
6364
|
+
createDirs?: boolean | undefined;
|
|
6365
|
+
}>;
|
|
6366
|
+
/**
|
|
6367
|
+
* File append schema
|
|
6368
|
+
*/
|
|
6369
|
+
declare const fileAppendSchema: z.ZodObject<{
|
|
6370
|
+
path: z.ZodString;
|
|
6371
|
+
content: z.ZodString;
|
|
6372
|
+
encoding: z.ZodDefault<z.ZodEnum<["utf8", "utf-8", "ascii"]>>;
|
|
6373
|
+
}, "strip", z.ZodTypeAny, {
|
|
6374
|
+
path: string;
|
|
6375
|
+
content: string;
|
|
6376
|
+
encoding: "ascii" | "utf-8" | "utf8";
|
|
6377
|
+
}, {
|
|
6378
|
+
path: string;
|
|
6379
|
+
content: string;
|
|
6380
|
+
encoding?: "ascii" | "utf-8" | "utf8" | undefined;
|
|
6381
|
+
}>;
|
|
6382
|
+
/**
|
|
6383
|
+
* File delete schema
|
|
6384
|
+
*/
|
|
6385
|
+
declare const fileDeleteSchema: z.ZodObject<{
|
|
6386
|
+
path: z.ZodString;
|
|
6387
|
+
}, "strip", z.ZodTypeAny, {
|
|
6388
|
+
path: string;
|
|
6389
|
+
}, {
|
|
6390
|
+
path: string;
|
|
6391
|
+
}>;
|
|
6392
|
+
/**
|
|
6393
|
+
* File exists schema
|
|
6394
|
+
*/
|
|
6395
|
+
declare const fileExistsSchema: z.ZodObject<{
|
|
6396
|
+
path: z.ZodString;
|
|
6397
|
+
}, "strip", z.ZodTypeAny, {
|
|
6398
|
+
path: string;
|
|
6399
|
+
}, {
|
|
6400
|
+
path: string;
|
|
6401
|
+
}>;
|
|
6402
|
+
/**
|
|
6403
|
+
* File operations configuration
|
|
6404
|
+
*/
|
|
6405
|
+
interface FileOperationsConfig {
|
|
6406
|
+
defaultEncoding?: 'utf8' | 'utf-8' | 'ascii' | 'base64' | 'hex';
|
|
6407
|
+
createDirsDefault?: boolean;
|
|
6408
|
+
}
|
|
6409
|
+
|
|
6410
|
+
/**
|
|
6411
|
+
* File Reader Tool
|
|
6412
|
+
*/
|
|
6413
|
+
/**
|
|
6414
|
+
* Create file reader tool
|
|
6415
|
+
*/
|
|
6416
|
+
declare function createFileReaderTool(defaultEncoding?: string): _agentforge_core.Tool<{
|
|
6417
|
+
path: string;
|
|
6418
|
+
encoding?: "ascii" | "binary" | "base64" | "hex" | "utf-8" | "utf8" | undefined;
|
|
6419
|
+
}, {
|
|
6420
|
+
success: boolean;
|
|
6421
|
+
data?: {
|
|
6422
|
+
content: string;
|
|
6423
|
+
size: number;
|
|
6424
|
+
path: string;
|
|
6425
|
+
encoding: string;
|
|
6426
|
+
} | undefined;
|
|
6427
|
+
error?: string;
|
|
6428
|
+
}>;
|
|
6429
|
+
|
|
6430
|
+
/**
|
|
6431
|
+
* File Writer Tool
|
|
6432
|
+
*/
|
|
6433
|
+
/**
|
|
6434
|
+
* Create file writer tool
|
|
6435
|
+
*/
|
|
6436
|
+
declare function createFileWriterTool(defaultEncoding?: string, createDirsDefault?: boolean): _agentforge_core.Tool<{
|
|
6437
|
+
path: string;
|
|
6438
|
+
content: string;
|
|
6439
|
+
encoding?: "ascii" | "base64" | "hex" | "utf-8" | "utf8" | undefined;
|
|
6440
|
+
createDirs?: boolean | undefined;
|
|
6441
|
+
}, {
|
|
6442
|
+
success: boolean;
|
|
6443
|
+
data?: {
|
|
6444
|
+
path: string;
|
|
6445
|
+
size: number;
|
|
6446
|
+
encoding: string;
|
|
6447
|
+
} | undefined;
|
|
6448
|
+
error?: string;
|
|
6449
|
+
}>;
|
|
6450
|
+
|
|
6451
|
+
/**
|
|
6452
|
+
* File Append Tool
|
|
6453
|
+
*/
|
|
6454
|
+
/**
|
|
6455
|
+
* Create file append tool
|
|
6456
|
+
*/
|
|
6457
|
+
declare function createFileAppendTool(defaultEncoding?: string): _agentforge_core.Tool<{
|
|
6458
|
+
path: string;
|
|
6459
|
+
content: string;
|
|
6460
|
+
encoding?: "ascii" | "utf-8" | "utf8" | undefined;
|
|
6461
|
+
}, {
|
|
6462
|
+
success: boolean;
|
|
6463
|
+
data?: {
|
|
6464
|
+
path: string;
|
|
6465
|
+
size: number;
|
|
6466
|
+
} | undefined;
|
|
6467
|
+
error?: string;
|
|
6468
|
+
}>;
|
|
6469
|
+
|
|
6470
|
+
/**
|
|
6471
|
+
* File Delete Tool
|
|
6472
|
+
*/
|
|
6473
|
+
/**
|
|
6474
|
+
* Create file delete tool
|
|
6475
|
+
*/
|
|
6476
|
+
declare function createFileDeleteTool(): _agentforge_core.Tool<{
|
|
6477
|
+
path: string;
|
|
6478
|
+
}, {
|
|
6479
|
+
success: boolean;
|
|
6480
|
+
data?: {
|
|
6481
|
+
path: string;
|
|
6482
|
+
message: string;
|
|
6483
|
+
} | undefined;
|
|
6484
|
+
error?: string;
|
|
6485
|
+
}>;
|
|
6486
|
+
|
|
6487
|
+
/**
|
|
6488
|
+
* File Exists Tool
|
|
6489
|
+
*/
|
|
6490
|
+
/**
|
|
6491
|
+
* Create file exists tool
|
|
6492
|
+
*/
|
|
6493
|
+
declare function createFileExistsTool(): _agentforge_core.Tool<{
|
|
6494
|
+
path: string;
|
|
6495
|
+
}, {
|
|
6496
|
+
exists: boolean;
|
|
6497
|
+
path: string;
|
|
6498
|
+
isFile: boolean;
|
|
6499
|
+
isDirectory: boolean;
|
|
6500
|
+
size: number;
|
|
6501
|
+
modified: string;
|
|
6502
|
+
} | {
|
|
6503
|
+
exists: boolean;
|
|
6504
|
+
path: string;
|
|
6505
|
+
isFile?: undefined;
|
|
6506
|
+
isDirectory?: undefined;
|
|
6507
|
+
size?: undefined;
|
|
6508
|
+
modified?: undefined;
|
|
6509
|
+
}>;
|
|
6510
|
+
|
|
6511
|
+
/**
|
|
6512
|
+
* Default file operation tool instances
|
|
6513
|
+
*/
|
|
6514
|
+
declare const fileReader: _agentforge_core.Tool<{
|
|
6515
|
+
path: string;
|
|
6516
|
+
encoding?: "ascii" | "binary" | "base64" | "hex" | "utf-8" | "utf8" | undefined;
|
|
6517
|
+
}, {
|
|
6518
|
+
success: boolean;
|
|
6519
|
+
data?: {
|
|
6520
|
+
content: string;
|
|
6521
|
+
size: number;
|
|
6522
|
+
path: string;
|
|
6523
|
+
encoding: string;
|
|
6524
|
+
} | undefined;
|
|
6525
|
+
error?: string;
|
|
6526
|
+
}>;
|
|
6527
|
+
declare const fileWriter: _agentforge_core.Tool<{
|
|
6528
|
+
path: string;
|
|
6529
|
+
content: string;
|
|
6530
|
+
encoding?: "ascii" | "base64" | "hex" | "utf-8" | "utf8" | undefined;
|
|
6531
|
+
createDirs?: boolean | undefined;
|
|
6532
|
+
}, {
|
|
6533
|
+
success: boolean;
|
|
6534
|
+
data?: {
|
|
6535
|
+
path: string;
|
|
6536
|
+
size: number;
|
|
6537
|
+
encoding: string;
|
|
6538
|
+
} | undefined;
|
|
6539
|
+
error?: string;
|
|
6540
|
+
}>;
|
|
6541
|
+
declare const fileAppend: _agentforge_core.Tool<{
|
|
6542
|
+
path: string;
|
|
6543
|
+
content: string;
|
|
6544
|
+
encoding?: "ascii" | "utf-8" | "utf8" | undefined;
|
|
6545
|
+
}, {
|
|
6546
|
+
success: boolean;
|
|
6547
|
+
data?: {
|
|
6548
|
+
path: string;
|
|
6549
|
+
size: number;
|
|
6550
|
+
} | undefined;
|
|
6551
|
+
error?: string;
|
|
6552
|
+
}>;
|
|
6553
|
+
declare const fileDelete: _agentforge_core.Tool<{
|
|
6554
|
+
path: string;
|
|
6555
|
+
}, {
|
|
6556
|
+
success: boolean;
|
|
6557
|
+
data?: {
|
|
6558
|
+
path: string;
|
|
6559
|
+
message: string;
|
|
6560
|
+
} | undefined;
|
|
6561
|
+
error?: string;
|
|
6562
|
+
}>;
|
|
6563
|
+
declare const fileExists: _agentforge_core.Tool<{
|
|
6564
|
+
path: string;
|
|
6565
|
+
}, {
|
|
6566
|
+
exists: boolean;
|
|
6567
|
+
path: string;
|
|
6568
|
+
isFile: boolean;
|
|
6569
|
+
isDirectory: boolean;
|
|
6570
|
+
size: number;
|
|
6571
|
+
modified: string;
|
|
6572
|
+
} | {
|
|
6573
|
+
exists: boolean;
|
|
6574
|
+
path: string;
|
|
6575
|
+
isFile?: undefined;
|
|
6576
|
+
isDirectory?: undefined;
|
|
6577
|
+
size?: undefined;
|
|
6578
|
+
modified?: undefined;
|
|
6579
|
+
}>;
|
|
6580
|
+
/**
|
|
6581
|
+
* Array of all file operation tools
|
|
6582
|
+
*/
|
|
6583
|
+
declare const fileOperationTools: (_agentforge_core.Tool<{
|
|
6584
|
+
path: string;
|
|
6585
|
+
encoding?: "ascii" | "binary" | "base64" | "hex" | "utf-8" | "utf8" | undefined;
|
|
6586
|
+
}, {
|
|
6587
|
+
success: boolean;
|
|
6588
|
+
data?: {
|
|
4938
6589
|
content: string;
|
|
4939
6590
|
size: number;
|
|
4940
6591
|
path: string;
|
|
@@ -5447,8 +7098,7 @@ declare const pathNormalizeSchema: z.ZodObject<{
|
|
|
5447
7098
|
/**
|
|
5448
7099
|
* Path utilities configuration
|
|
5449
7100
|
*/
|
|
5450
|
-
|
|
5451
|
-
}
|
|
7101
|
+
type PathUtilitiesConfig = Record<string, never>;
|
|
5452
7102
|
|
|
5453
7103
|
/**
|
|
5454
7104
|
* Path Join Tool
|
|
@@ -5813,8 +7463,7 @@ declare const DateComparisonSchema: z.ZodObject<{
|
|
|
5813
7463
|
/**
|
|
5814
7464
|
* Configuration for date/time tools
|
|
5815
7465
|
*/
|
|
5816
|
-
|
|
5817
|
-
}
|
|
7466
|
+
type DateTimeConfig = Record<string, never>;
|
|
5818
7467
|
type CurrentDateTimeInput = z.infer<typeof CurrentDateTimeSchema>;
|
|
5819
7468
|
type DateFormatterInput = z.infer<typeof DateFormatterSchema>;
|
|
5820
7469
|
type DateArithmeticInput = z.infer<typeof DateArithmeticSchema>;
|
|
@@ -6218,11 +7867,11 @@ declare const StringTrimSchema: z.ZodObject<{
|
|
|
6218
7867
|
characters: z.ZodOptional<z.ZodString>;
|
|
6219
7868
|
}, "strip", z.ZodTypeAny, {
|
|
6220
7869
|
text: string;
|
|
6221
|
-
mode: "both" | "
|
|
7870
|
+
mode: "both" | "end" | "start";
|
|
6222
7871
|
characters?: string | undefined;
|
|
6223
7872
|
}, {
|
|
6224
7873
|
text: string;
|
|
6225
|
-
mode?: "both" | "
|
|
7874
|
+
mode?: "both" | "end" | "start" | undefined;
|
|
6226
7875
|
characters?: string | undefined;
|
|
6227
7876
|
}>;
|
|
6228
7877
|
/**
|
|
@@ -6305,8 +7954,7 @@ declare const StringLengthSchema: z.ZodObject<{
|
|
|
6305
7954
|
/**
|
|
6306
7955
|
* Configuration for string utility tools
|
|
6307
7956
|
*/
|
|
6308
|
-
|
|
6309
|
-
}
|
|
7957
|
+
type StringUtilitiesConfig = Record<string, never>;
|
|
6310
7958
|
type StringCaseConverterInput = z.infer<typeof StringCaseConverterSchema>;
|
|
6311
7959
|
type StringTrimInput = z.infer<typeof StringTrimSchema>;
|
|
6312
7960
|
type StringReplaceInput = z.infer<typeof StringReplaceSchema>;
|
|
@@ -6338,7 +7986,7 @@ declare function createStringCaseConverterTool(): _agentforge_core.Tool<{
|
|
|
6338
7986
|
*/
|
|
6339
7987
|
declare function createStringTrimTool(): _agentforge_core.Tool<{
|
|
6340
7988
|
text: string;
|
|
6341
|
-
mode?: "both" | "
|
|
7989
|
+
mode?: "both" | "end" | "start" | undefined;
|
|
6342
7990
|
characters?: string | undefined;
|
|
6343
7991
|
}, {
|
|
6344
7992
|
original: string;
|
|
@@ -6435,7 +8083,7 @@ declare const stringCaseConverter: _agentforge_core.Tool<{
|
|
|
6435
8083
|
}>;
|
|
6436
8084
|
declare const stringTrim: _agentforge_core.Tool<{
|
|
6437
8085
|
text: string;
|
|
6438
|
-
mode?: "both" | "
|
|
8086
|
+
mode?: "both" | "end" | "start" | undefined;
|
|
6439
8087
|
characters?: string | undefined;
|
|
6440
8088
|
}, {
|
|
6441
8089
|
original: string;
|
|
@@ -6495,7 +8143,7 @@ declare const stringUtilityTools: (_agentforge_core.Tool<{
|
|
|
6495
8143
|
targetCase: "title" | "lowercase" | "uppercase" | "camel" | "snake" | "kebab" | "pascal";
|
|
6496
8144
|
}> | _agentforge_core.Tool<{
|
|
6497
8145
|
text: string;
|
|
6498
|
-
mode?: "both" | "
|
|
8146
|
+
mode?: "both" | "end" | "start" | undefined;
|
|
6499
8147
|
characters?: string | undefined;
|
|
6500
8148
|
}, {
|
|
6501
8149
|
original: string;
|
|
@@ -6553,7 +8201,7 @@ declare function createStringUtilityTools(config?: StringUtilitiesConfig): (_age
|
|
|
6553
8201
|
targetCase: "title" | "lowercase" | "uppercase" | "camel" | "snake" | "kebab" | "pascal";
|
|
6554
8202
|
}> | _agentforge_core.Tool<{
|
|
6555
8203
|
text: string;
|
|
6556
|
-
mode?: "both" | "
|
|
8204
|
+
mode?: "both" | "end" | "start" | undefined;
|
|
6557
8205
|
characters?: string | undefined;
|
|
6558
8206
|
}, {
|
|
6559
8207
|
original: string;
|
|
@@ -6642,12 +8290,12 @@ declare const RandomNumberSchema: z.ZodObject<{
|
|
|
6642
8290
|
integer: z.ZodDefault<z.ZodBoolean>;
|
|
6643
8291
|
}, "strip", z.ZodTypeAny, {
|
|
6644
8292
|
integer: boolean;
|
|
6645
|
-
min: number;
|
|
6646
8293
|
max: number;
|
|
8294
|
+
min: number;
|
|
6647
8295
|
}, {
|
|
6648
8296
|
integer?: boolean | undefined;
|
|
6649
|
-
min?: number | undefined;
|
|
6650
8297
|
max?: number | undefined;
|
|
8298
|
+
min?: number | undefined;
|
|
6651
8299
|
}>;
|
|
6652
8300
|
/**
|
|
6653
8301
|
* Schema for statistics tool
|
|
@@ -6662,8 +8310,7 @@ declare const StatisticsSchema: z.ZodObject<{
|
|
|
6662
8310
|
/**
|
|
6663
8311
|
* Configuration for math operations tools
|
|
6664
8312
|
*/
|
|
6665
|
-
|
|
6666
|
-
}
|
|
8313
|
+
type MathOperationsConfig = Record<string, never>;
|
|
6667
8314
|
type CalculatorInput = z.infer<typeof CalculatorSchema>;
|
|
6668
8315
|
type MathFunctionsInput = z.infer<typeof MathFunctionsSchema>;
|
|
6669
8316
|
type RandomNumberInput = z.infer<typeof RandomNumberSchema>;
|
|
@@ -6726,8 +8373,8 @@ declare function createMathFunctionsTool(): _agentforge_core.Tool<{
|
|
|
6726
8373
|
*/
|
|
6727
8374
|
declare function createRandomNumberTool(): _agentforge_core.Tool<{
|
|
6728
8375
|
integer?: boolean | undefined;
|
|
6729
|
-
min?: number | undefined;
|
|
6730
8376
|
max?: number | undefined;
|
|
8377
|
+
min?: number | undefined;
|
|
6731
8378
|
}, {
|
|
6732
8379
|
result: number;
|
|
6733
8380
|
min: number;
|
|
@@ -6804,8 +8451,8 @@ declare const mathFunctions: _agentforge_core.Tool<{
|
|
|
6804
8451
|
}>;
|
|
6805
8452
|
declare const randomNumber: _agentforge_core.Tool<{
|
|
6806
8453
|
integer?: boolean | undefined;
|
|
6807
|
-
min?: number | undefined;
|
|
6808
8454
|
max?: number | undefined;
|
|
8455
|
+
min?: number | undefined;
|
|
6809
8456
|
}, {
|
|
6810
8457
|
result: number;
|
|
6811
8458
|
min: number;
|
|
@@ -6872,8 +8519,8 @@ declare const mathOperationTools: (_agentforge_core.Tool<{
|
|
|
6872
8519
|
error?: undefined;
|
|
6873
8520
|
}> | _agentforge_core.Tool<{
|
|
6874
8521
|
integer?: boolean | undefined;
|
|
6875
|
-
min?: number | undefined;
|
|
6876
8522
|
max?: number | undefined;
|
|
8523
|
+
min?: number | undefined;
|
|
6877
8524
|
}, {
|
|
6878
8525
|
result: number;
|
|
6879
8526
|
min: number;
|
|
@@ -6942,8 +8589,8 @@ declare function createMathOperationTools(config?: MathOperationsConfig): (_agen
|
|
|
6942
8589
|
error?: undefined;
|
|
6943
8590
|
}> | _agentforge_core.Tool<{
|
|
6944
8591
|
integer?: boolean | undefined;
|
|
6945
|
-
min?: number | undefined;
|
|
6946
8592
|
max?: number | undefined;
|
|
8593
|
+
min?: number | undefined;
|
|
6947
8594
|
}, {
|
|
6948
8595
|
result: number;
|
|
6949
8596
|
min: number;
|
|
@@ -7048,8 +8695,7 @@ declare const UuidValidatorSchema: z.ZodObject<{
|
|
|
7048
8695
|
/**
|
|
7049
8696
|
* Configuration for validation tools
|
|
7050
8697
|
*/
|
|
7051
|
-
|
|
7052
|
-
}
|
|
8698
|
+
type ValidationConfig = Record<string, never>;
|
|
7053
8699
|
type EmailValidatorInput = z.infer<typeof EmailValidatorSchema>;
|
|
7054
8700
|
type UrlValidatorSimpleInput = z.infer<typeof UrlValidatorSimpleSchema>;
|
|
7055
8701
|
type PhoneValidatorInput = z.infer<typeof PhoneValidatorSchema>;
|
|
@@ -7435,4 +9081,4 @@ declare const askHumanTool: _agentforge_core.Tool<{
|
|
|
7435
9081
|
suggestions?: string[] | undefined;
|
|
7436
9082
|
}, AskHumanOutput>;
|
|
7437
9083
|
|
|
7438
|
-
export { type AskHumanInput, AskHumanInputSchema, type AskHumanOutput, type BatchEmbeddingResult, type CalculatorInput, CalculatorSchema, type ConfluenceAuth, type ConfluenceToolsConfig, type CreditCardValidatorInput, CreditCardValidatorSchema, type CsvToolsConfig, type CurrentDateTimeInput, CurrentDateTimeSchema, DEFAULT_RETRY_CONFIG, type DateArithmeticInput, DateArithmeticSchema, type DateComparisonInput, DateComparisonSchema, type DateDifferenceInput, DateDifferenceSchema, type DateFormatterInput, DateFormatterSchema, type DateTimeConfig, type DirectoryOperationsConfig, DuckDuckGoProvider, type EmailValidatorInput, EmailValidatorSchema, type EmbeddingConfig, EmbeddingManager, type EmbeddingProvider, type EmbeddingResult, type EmbeddingRetryConfig, type FileOperationsConfig, type HtmlParserToolsConfig, HttpMethod, type HttpResponse, type HttpToolsConfig, type IEmbeddingProvider, type IpValidatorInput, IpValidatorSchema, type JsonToolsConfig, type MathFunctionsInput, MathFunctionsSchema, type MathOperationsConfig, type Neo4jConfig, type Neo4jNode, type Neo4jPath, type Neo4jRelationship, type Neo4jSchema, type Neo4jToolsConfig, OpenAIEmbeddingProvider, type PathUtilitiesConfig, type PhoneValidatorInput, PhoneValidatorSchema, type RandomNumberInput, RandomNumberSchema, type RetryConfig, type ScraperResult, type ScraperToolsConfig, type SearchProvider, type SearchResult, SerperProvider, type SlackClientConfig, type SlackToolsConfig, type StatisticsInput, StatisticsSchema, type StringCaseConverterInput, StringCaseConverterSchema, type StringJoinInput, StringJoinSchema, type StringLengthInput, StringLengthSchema, type StringReplaceInput, StringReplaceSchema, type StringSplitInput, StringSplitSchema, type StringSubstringInput, StringSubstringSchema, type StringTrimInput, StringTrimSchema, type StringUtilitiesConfig, type TransformerToolsConfig, type UrlValidationResult, type UrlValidatorSimpleInput, UrlValidatorSimpleSchema, type UrlValidatorToolsConfig, type UuidValidatorInput, UuidValidatorSchema, type ValidationConfig, type WebSearchInput, type WebSearchOutput, type XmlToolsConfig, archiveConfluencePage, arrayFilter, arrayFilterSchema, arrayGroupBy, arrayGroupBySchema, arrayMap, arrayMapSchema, arraySort, arraySortSchema, askHumanTool, calculator, confluenceTools, createArrayFilterTool, createArrayGroupByTool, createArrayMapTool, createArraySortTool, createAskHumanTool, createCalculatorTool, createConfluencePage, createConfluenceTools, createCreditCardValidatorTool, createCsvGeneratorTool, createCsvParserTool, createCsvToJsonTool, createCsvTools, createCurrentDateTimeTool, createDateArithmeticTool, createDateComparisonTool, createDateDifferenceTool, createDateFormatterTool, createDateTimeTools, createDirectoryCreateTool, createDirectoryDeleteTool, createDirectoryListTool, createDirectoryOperationTools, createDuckDuckGoProvider, createEmailValidatorTool, createExtractImagesTool, createExtractLinksTool, createFileAppendTool, createFileDeleteTool, createFileExistsTool, createFileOperationTools, createFileReaderTool, createFileSearchTool, createFileWriterTool, createHtmlParserTool, createHtmlParserTools, createHttpTools, createIpValidatorTool, createJsonMergeTool, createJsonParserTool, createJsonQueryTool, createJsonStringifyTool, createJsonToCsvTool, createJsonToXmlTool, createJsonTools, createJsonValidatorTool, createMathFunctionsTool, createMathOperationTools, createNeo4jCreateNodeWithEmbeddingTool, createNeo4jFindNodesTool, createNeo4jGetSchemaTool, createNeo4jQueryTool, createNeo4jTools, createNeo4jTraverseTool, createNeo4jVectorSearchTool, createNeo4jVectorSearchWithEmbeddingTool, createObjectOmitTool, createObjectPickTool, createPathBasenameTool, createPathDirnameTool, createPathExtensionTool, createPathJoinTool, createPathNormalizeTool, createPathParseTool, createPathRelativeTool, createPathResolveTool, createPathUtilityTools, createPhoneValidatorTool, createRandomNumberTool, createScraperTools, createSerperProvider, createSlackTools, createStatisticsTool, createStringCaseConverterTool, createStringJoinTool, createStringLengthTool, createStringReplaceTool, createStringSplitTool, createStringSubstringTool, createStringTrimTool, createStringUtilityTools, createTransformerTools, createUrlBuilderTool, createUrlQueryParserTool, createUrlValidatorSimpleTool, createUrlValidatorTool, createUrlValidatorTools, createUuidValidatorTool, createValidationTools, createWebScraperTool, createXmlGeneratorTool, createXmlParserTool, createXmlToJsonTool, createXmlTools, creditCardValidator, csvGenerator, csvGeneratorSchema, csvParser, csvParserSchema, csvToJson, csvToJsonSchema, csvTools, currentDateTime, dateArithmetic, dateComparison, dateDifference, dateFormatter, dateTimeTools, directoryCreate, directoryCreateSchema, directoryDelete, directoryDeleteSchema, directoryList, directoryListSchema, directoryOperationTools, emailValidator, embeddingManager, extractImages, extractImagesSchema, extractLinks, extractLinksSchema, fileAppend, fileAppendSchema, fileDelete, fileDeleteSchema, fileExists, fileExistsSchema, fileOperationTools, fileReader, fileReaderSchema, fileSearch, fileSearchSchema, fileWriter, fileWriterSchema, generateBatchEmbeddings, generateEmbedding, getCohereApiKey, getConfluencePage, getEmbeddingModel, getEmbeddingProvider, getHuggingFaceApiKey, getOllamaBaseUrl, getOpenAIApiKey, getSlackChannels, getSlackMessages, getSpacePages, getVoyageApiKey, htmlParser, htmlParserSchema, htmlParserTools, httpClient, httpGet, httpGetSchema, httpPost, httpPostSchema, httpRequestSchema, httpTools, initializeEmbeddings, initializeEmbeddingsWithConfig, initializeFromEnv, initializeNeo4jTools, ipValidator, isRetryableError, jsonMerge, jsonMergeSchema, jsonParser, jsonParserSchema, jsonQuery, jsonQuerySchema, jsonStringify, jsonStringifySchema, jsonToCsv, jsonToCsvSchema, jsonToXml, jsonToXmlSchema, jsonTools, jsonValidator, jsonValidatorSchema, listConfluenceSpaces, mathFunctions, mathOperationTools, neo4jCoreTools, neo4jCreateNodeWithEmbedding, neo4jCreateNodeWithEmbeddingSchema, neo4jFindNodes, neo4jFindNodesSchema, neo4jGetSchema, neo4jGetSchemaSchema, neo4jPool, neo4jQuery, neo4jQuerySchema, neo4jTools, neo4jTraverse, neo4jTraverseSchema, neo4jVectorSearch, neo4jVectorSearchSchema, neo4jVectorSearchWithEmbedding, neo4jVectorSearchWithEmbeddingSchema, notifySlack, objectOmit, objectOmitSchema, objectPick, objectPickSchema, pathBasename, pathBasenameSchema, pathDirname, pathDirnameSchema, pathExtension, pathExtensionSchema, pathJoin, pathJoinSchema, pathNormalize, pathNormalizeSchema, pathParse, pathParseSchema, pathRelative, pathRelativeSchema, pathResolve, pathResolveSchema, pathUtilityTools, phoneValidator, randomNumber, retryWithBackoff, scraperTools, searchConfluence, searchResultSchema, sendSlackMessage, slackTools, statistics, stringCaseConverter, stringJoin, stringLength, stringReplace, stringSplit, stringSubstring, stringTrim, stringUtilityTools, transformerTools, updateConfluencePage, urlBuilder, urlBuilderSchema, urlQueryParser, urlQueryParserSchema, urlValidator, urlValidatorSchema, urlValidatorSimple, urlValidatorTools, uuidValidator, validateBatch, validateText, validationTools, webScraper, webScraperSchema, webSearch, webSearchOutputSchema, webSearchSchema, xmlGenerator, xmlGeneratorSchema, xmlParser, xmlParserSchema, xmlToJson, xmlToJsonSchema, xmlTools };
|
|
9084
|
+
export { type AskHumanInput, AskHumanInputSchema, type AskHumanOutput, type BatchBenchmarkResult, type BatchEmbeddingResult, type BatchExecutionOptions, type BatchExecutionResult, type BatchExecutionTask, type BatchFailureDetail, type BatchProgressUpdate, type BuiltDeleteQuery, type BuiltInsertQuery, type BuiltUpdateQuery, type CalculatorInput, CalculatorSchema, type ColumnDiff, type ColumnSchema, type ConfluenceAuth, type ConfluenceToolsConfig, type ConnectionConfig, type ConnectionEvent, ConnectionManager, ConnectionState, type CreditCardValidatorInput, CreditCardValidatorSchema, type CsvToolsConfig, type CurrentDateTimeInput, CurrentDateTimeSchema, DEFAULT_BATCH_SIZE, DEFAULT_CHUNK_SIZE, DEFAULT_RETRY_CONFIG, type DatabaseConfig, type DatabaseConnection, type DatabaseSchema, type DatabaseVendor, type DateArithmeticInput, DateArithmeticSchema, type DateComparisonInput, DateComparisonSchema, type DateDifferenceInput, DateDifferenceSchema, type DateFormatterInput, DateFormatterSchema, type DateTimeConfig, type DeleteQueryInput, type DeleteSoftDeleteOptions, type DeleteWhereCondition, type DirectoryOperationsConfig, DuckDuckGoProvider, type EmailValidatorInput, EmailValidatorSchema, type EmbeddingConfig, EmbeddingManager, type EmbeddingProvider, type EmbeddingResult, type EmbeddingRetryConfig, type FileOperationsConfig, type ForeignKeySchema, type HtmlParserToolsConfig, HttpMethod, type HttpResponse, type HttpToolsConfig, type IEmbeddingProvider, type IndexSchema, type InsertData, type InsertQueryInput, type InsertReturningMode, type InsertReturningOptions, type InsertRow, type InsertValue, type IpValidatorInput, IpValidatorSchema, type JsonToolsConfig, MAX_BATCH_SIZE, type MappedType, type MathFunctionsInput, MathFunctionsSchema, type MathOperationsConfig, MissingPeerDependencyError, type MySQLConnectionConfig, type Neo4jConfig, type Neo4jNode, type Neo4jPath, type Neo4jRelationship, type Neo4jSchema, type Neo4jToolsConfig, OpenAIEmbeddingProvider, type PathUtilitiesConfig, type PhoneValidatorInput, PhoneValidatorSchema, type PoolConfig, type PostgreSQLConnectionConfig, type QueryExecutionResult, type QueryInput, type QueryMetadata, type QueryParams, type QueryResult, type RandomNumberInput, RandomNumberSchema, type ReconnectionConfig, type RetryConfig, type SQLiteConnectionConfig, type SchemaDiffResult, type SchemaInspectOptions, SchemaInspector, type SchemaInspectorConfig, type ScraperResult, type ScraperToolsConfig, type SearchProvider, type SearchResult, type SelectOrderBy, type SelectOrderDirection, type SelectQueryInput, type SelectWhereCondition, SerperProvider, type SlackClientConfig, type SlackToolsConfig, type SqlExecutor, type StatisticsInput, StatisticsSchema, type StreamingBenchmarkResult, type StreamingMemoryUsage$1 as StreamingMemoryUsage, type StreamingSelectChunk, type StreamingSelectOptions, type StreamingSelectResult, type StringCaseConverterInput, StringCaseConverterSchema, type StringJoinInput, StringJoinSchema, type StringLengthInput, StringLengthSchema, type StringReplaceInput, StringReplaceSchema, type StringSplitInput, StringSplitSchema, type StringSubstringInput, StringSubstringSchema, type StringTrimInput, StringTrimSchema, type StringUtilitiesConfig, type TableDiff, type TableSchema, type TransactionContext, type TransactionIsolationLevel, type TransactionOptions, type TransformerToolsConfig, type UpdateData, type UpdateOptimisticLock, type UpdateQueryInput, type UpdateValue, type UpdateWhereCondition, type UpdateWhereOperator, type UrlValidationResult, type UrlValidatorSimpleInput, UrlValidatorSimpleSchema, type UrlValidatorToolsConfig, type UuidValidatorInput, UuidValidatorSchema, type ValidationConfig, type ValidationResult, type VendorConnectionConfig, type WebSearchInput, type WebSearchOutput, type XmlToolsConfig, archiveConfluencePage, arrayFilter, arrayFilterSchema, arrayGroupBy, arrayGroupBySchema, arrayMap, arrayMapSchema, arraySort, arraySortSchema, askHumanTool, benchmarkBatchExecution, benchmarkStreamingSelectMemory, buildDeleteQuery, buildInsertQuery, buildSelectQuery, buildUpdateQuery, calculator, checkPeerDependency, confluenceTools, createArrayFilterTool, createArrayGroupByTool, createArrayMapTool, createArraySortTool, createAskHumanTool, createCalculatorTool, createConfluencePage, createConfluenceTools, createCreditCardValidatorTool, createCsvGeneratorTool, createCsvParserTool, createCsvToJsonTool, createCsvTools, createCurrentDateTimeTool, createDateArithmeticTool, createDateComparisonTool, createDateDifferenceTool, createDateFormatterTool, createDateTimeTools, createDirectoryCreateTool, createDirectoryDeleteTool, createDirectoryListTool, createDirectoryOperationTools, createDuckDuckGoProvider, createEmailValidatorTool, createExtractImagesTool, createExtractLinksTool, createFileAppendTool, createFileDeleteTool, createFileExistsTool, createFileOperationTools, createFileReaderTool, createFileSearchTool, createFileWriterTool, createHtmlParserTool, createHtmlParserTools, createHttpTools, createIpValidatorTool, createJsonMergeTool, createJsonParserTool, createJsonQueryTool, createJsonStringifyTool, createJsonToCsvTool, createJsonToXmlTool, createJsonTools, createJsonValidatorTool, createMathFunctionsTool, createMathOperationTools, createNeo4jCreateNodeWithEmbeddingTool, createNeo4jFindNodesTool, createNeo4jGetSchemaTool, createNeo4jQueryTool, createNeo4jTools, createNeo4jTraverseTool, createNeo4jVectorSearchTool, createNeo4jVectorSearchWithEmbeddingTool, createObjectOmitTool, createObjectPickTool, createPathBasenameTool, createPathDirnameTool, createPathExtensionTool, createPathJoinTool, createPathNormalizeTool, createPathParseTool, createPathRelativeTool, createPathResolveTool, createPathUtilityTools, createPhoneValidatorTool, createRandomNumberTool, createScraperTools, createSelectReadableStream, createSerperProvider, createSlackTools, createStatisticsTool, createStringCaseConverterTool, createStringJoinTool, createStringLengthTool, createStringReplaceTool, createStringSplitTool, createStringSubstringTool, createStringTrimTool, createStringUtilityTools, createTransformerTools, createUrlBuilderTool, createUrlQueryParserTool, createUrlValidatorSimpleTool, createUrlValidatorTool, createUrlValidatorTools, createUuidValidatorTool, createValidationTools, createWebScraperTool, createXmlGeneratorTool, createXmlParserTool, createXmlToJsonTool, createXmlTools, creditCardValidator, csvGenerator, csvGeneratorSchema, csvParser, csvParserSchema, csvToJson, csvToJsonSchema, csvTools, currentDateTime, dateArithmetic, dateComparison, dateDifference, dateFormatter, dateTimeTools, diffSchemas, directoryCreate, directoryCreateSchema, directoryDelete, directoryDeleteSchema, directoryList, directoryListSchema, directoryOperationTools, emailValidator, embeddingManager, executeBatchedTask, executeQuery, executeStreamingSelect, exportSchemaToJson, extractImages, extractImagesSchema, extractLinks, extractLinksSchema, fileAppend, fileAppendSchema, fileDelete, fileDeleteSchema, fileExists, fileExistsSchema, fileOperationTools, fileReader, fileReaderSchema, fileSearch, fileSearchSchema, fileWriter, fileWriterSchema, generateBatchEmbeddings, generateEmbedding, getCohereApiKey, getConfluencePage, getEmbeddingModel, getEmbeddingProvider, getHuggingFaceApiKey, getInstallationInstructions, getOllamaBaseUrl, getOpenAIApiKey, getPeerDependencyName, getSlackChannels, getSlackMessages, getSpacePages, getVendorTypeMap, getVoyageApiKey, htmlParser, htmlParserSchema, htmlParserTools, httpClient, httpGet, httpGetSchema, httpPost, httpPostSchema, httpRequestSchema, httpTools, importSchemaFromJson, initializeEmbeddings, initializeEmbeddingsWithConfig, initializeFromEnv, initializeNeo4jTools, ipValidator, isRetryableError, jsonMerge, jsonMergeSchema, jsonParser, jsonParserSchema, jsonQuery, jsonQuerySchema, jsonStringify, jsonStringifySchema, jsonToCsv, jsonToCsvSchema, jsonToXml, jsonToXmlSchema, jsonTools, jsonValidator, jsonValidatorSchema, listConfluenceSpaces, mapColumnType, mapSchemaTypes, mathFunctions, mathOperationTools, neo4jCoreTools, neo4jCreateNodeWithEmbedding, neo4jCreateNodeWithEmbeddingSchema, neo4jFindNodes, neo4jFindNodesSchema, neo4jGetSchema, neo4jGetSchemaSchema, neo4jPool, neo4jQuery, neo4jQuerySchema, neo4jTools, neo4jTraverse, neo4jTraverseSchema, neo4jVectorSearch, neo4jVectorSearchSchema, neo4jVectorSearchWithEmbedding, neo4jVectorSearchWithEmbeddingSchema, notifySlack, objectOmit, objectOmitSchema, objectPick, objectPickSchema, pathBasename, pathBasenameSchema, pathDirname, pathDirnameSchema, pathExtension, pathExtensionSchema, pathJoin, pathJoinSchema, pathNormalize, pathNormalizeSchema, pathParse, pathParseSchema, pathRelative, pathRelativeSchema, pathResolve, pathResolveSchema, pathUtilityTools, phoneValidator, randomNumber, relationalDelete, relationalGetSchema, relationalInsert, relationalQuery, relationalSelect, relationalUpdate, retryWithBackoff, scraperTools, searchConfluence, searchResultSchema, sendSlackMessage, slackTools, statistics, streamSelectChunks, stringCaseConverter, stringJoin, stringLength, stringReplace, stringSplit, stringSubstring, stringTrim, stringUtilityTools, transformerTools, updateConfluencePage, urlBuilder, urlBuilderSchema, urlQueryParser, urlQueryParserSchema, urlValidator, urlValidatorSchema, urlValidatorSimple, urlValidatorTools, uuidValidator, validateBatch, validateColumnTypes, validateColumnsExist, validateTableExists, validateText, validationTools, webScraper, webScraperSchema, webSearch, webSearchOutputSchema, webSearchSchema, withTransaction, xmlGenerator, xmlGeneratorSchema, xmlParser, xmlParserSchema, xmlToJson, xmlToJsonSchema, xmlTools };
|