diff --git a/types/defines/hyperdrive.d.ts b/types/defines/hyperdrive.d.ts index 3399f889b20..5fa65b5a7d9 100644 --- a/types/defines/hyperdrive.d.ts +++ b/types/defines/hyperdrive.d.ts @@ -41,7 +41,7 @@ interface Hyperdrive { readonly port: number; /* * The username to use when authenticating to your database via Hyperdrive. - * Unlike the host and password, this will be the same every time + * Unlike the host and password, this will be the same every time */ readonly user: string; /* @@ -56,3 +56,78 @@ interface Hyperdrive { */ readonly database: string; } + +/** + * A handle to a dynamically-provisioned Hyperdrive connection, returned by + * `HyperdriveApi.get()`. + */ +interface HyperdriveDynamic extends Disposable { + /** + * The database name to use when connecting through this Hyperdrive. + */ + readonly database: Promise; + /* + * The randomly generated user to use when authenticating to your + * database via Hyperdrive. + */ + readonly user: Promise; + /* + * The randomly generated password to use when authenticating to your + * database via Hyperdrive. + */ + readonly password: Promise; + /** + * Open a TCP socket to the target database through this Hyperdrive. + * + */ + connect(): Promise; +} + +/** + * Binding that provisions Hyperdrive connections at request time, rather than + * from static configuration. + */ +interface HyperdriveDynamicApi { + /** + * Provision a connection for the database described by `args`. + * + */ + get(args: HyperdriveDynamicConfig): Promise; + /** + * Get a pre-generated connection string used for connecting to dynamic Hyperdrive. + */ + getHyperdriveConnectionString(connectionString: string): Promise; +} + +/** + * Parameters identifying the database that a dynamically-provisioned + * Hyperdrive connection should target. + */ +interface HyperdriveDynamicConfig { + /** + * Generated connection string to pass into the dynamic worker. + * + */ + dynamicHyperdriveConnectionString: string; + /** + * Connection string for the origin database Hyperdrive should connect to. + * Contains credentials, so treat it as a secret. + * + * The scheme selects the database engine. PostgreSQL origins are supported. + */ + connectionString: string; + /** + * Region in which to place the connection pool. See the Hyperdrive + * documentation for the set of supported regions. + */ + targetRegion: string; + /** + * Whether Hyperdrive should cache query results for this connection. + */ + cachingEnabled?: boolean; + /** + * Maximum number of connections the pool may open to the origin database. + * Defaults to 60. + */ + maxConnections?: number; +} diff --git a/types/generated-snapshot/experimental/index.d.ts b/types/generated-snapshot/experimental/index.d.ts index 123142b97cc..c08aed2ed14 100755 --- a/types/generated-snapshot/experimental/index.d.ts +++ b/types/generated-snapshot/experimental/index.d.ts @@ -14788,6 +14788,78 @@ interface Hyperdrive { */ readonly database: string; } +/** + * A handle to a dynamically-provisioned Hyperdrive connection, returned by + * `HyperdriveApi.get()`. + */ +interface HyperdriveDynamic extends Disposable { + /** + * The database name to use when connecting through this Hyperdrive. + */ + readonly database: Promise; + /* + * The randomly generated user to use when authenticating to your + * database via Hyperdrive. + */ + readonly user: Promise; + /* + * The randomly generated password to use when authenticating to your + * database via Hyperdrive. + */ + readonly password: Promise; + /** + * Open a TCP socket to the target database through this Hyperdrive. + * + */ + connect(): Promise; +} +/** + * Binding that provisions Hyperdrive connections at request time, rather than + * from static configuration. + */ +interface HyperdriveDynamicApi { + /** + * Provision a connection for the database described by `args`. + * + */ + get(args: HyperdriveDynamicConfig): Promise; + /** + * Get a pre-generated connection string used for connecting to dynamic Hyperdrive. + */ + getHyperdriveConnectionString(connectionString: string): Promise; +} +/** + * Parameters identifying the database that a dynamically-provisioned + * Hyperdrive connection should target. + */ +interface HyperdriveDynamicConfig { + /** + * Generated connection string to pass into the dynamic worker. + * + */ + dynamicHyperdriveConnectionString: string; + /** + * Connection string for the origin database Hyperdrive should connect to. + * Contains credentials, so treat it as a secret. + * + * The scheme selects the database engine. PostgreSQL origins are supported. + */ + connectionString: string; + /** + * Region in which to place the connection pool. See the Hyperdrive + * documentation for the set of supported regions. + */ + targetRegion: string; + /** + * Whether Hyperdrive should cache query results for this connection. + */ + cachingEnabled?: boolean; + /** + * Maximum number of connections the pool may open to the origin database. + * Defaults to 60. + */ + maxConnections?: number; +} // Copyright (c) 2024 Cloudflare, Inc. // Licensed under the Apache 2.0 license found in the LICENSE file or at: // https://opensource.org/licenses/Apache-2.0 diff --git a/types/generated-snapshot/experimental/index.ts b/types/generated-snapshot/experimental/index.ts index 2b17f950bc2..f8529fb0e1d 100755 --- a/types/generated-snapshot/experimental/index.ts +++ b/types/generated-snapshot/experimental/index.ts @@ -14805,6 +14805,78 @@ export interface Hyperdrive { */ readonly database: string; } +/** + * A handle to a dynamically-provisioned Hyperdrive connection, returned by + * `HyperdriveApi.get()`. + */ +export interface HyperdriveDynamic extends Disposable { + /** + * The database name to use when connecting through this Hyperdrive. + */ + readonly database: Promise; + /* + * The randomly generated user to use when authenticating to your + * database via Hyperdrive. + */ + readonly user: Promise; + /* + * The randomly generated password to use when authenticating to your + * database via Hyperdrive. + */ + readonly password: Promise; + /** + * Open a TCP socket to the target database through this Hyperdrive. + * + */ + connect(): Promise; +} +/** + * Binding that provisions Hyperdrive connections at request time, rather than + * from static configuration. + */ +export interface HyperdriveDynamicApi { + /** + * Provision a connection for the database described by `args`. + * + */ + get(args: HyperdriveDynamicConfig): Promise; + /** + * Get a pre-generated connection string used for connecting to dynamic Hyperdrive. + */ + getHyperdriveConnectionString(connectionString: string): Promise; +} +/** + * Parameters identifying the database that a dynamically-provisioned + * Hyperdrive connection should target. + */ +export interface HyperdriveDynamicConfig { + /** + * Generated connection string to pass into the dynamic worker. + * + */ + dynamicHyperdriveConnectionString: string; + /** + * Connection string for the origin database Hyperdrive should connect to. + * Contains credentials, so treat it as a secret. + * + * The scheme selects the database engine. PostgreSQL origins are supported. + */ + connectionString: string; + /** + * Region in which to place the connection pool. See the Hyperdrive + * documentation for the set of supported regions. + */ + targetRegion: string; + /** + * Whether Hyperdrive should cache query results for this connection. + */ + cachingEnabled?: boolean; + /** + * Maximum number of connections the pool may open to the origin database. + * Defaults to 60. + */ + maxConnections?: number; +} // Copyright (c) 2024 Cloudflare, Inc. // Licensed under the Apache 2.0 license found in the LICENSE file or at: // https://opensource.org/licenses/Apache-2.0 diff --git a/types/generated-snapshot/index.d.ts b/types/generated-snapshot/index.d.ts index e6902aba405..8426c37caf9 100755 --- a/types/generated-snapshot/index.d.ts +++ b/types/generated-snapshot/index.d.ts @@ -14513,6 +14513,78 @@ interface Hyperdrive { */ readonly database: string; } +/** + * A handle to a dynamically-provisioned Hyperdrive connection, returned by + * `HyperdriveApi.get()`. + */ +interface HyperdriveDynamic extends Disposable { + /** + * The database name to use when connecting through this Hyperdrive. + */ + readonly database: Promise; + /* + * The randomly generated user to use when authenticating to your + * database via Hyperdrive. + */ + readonly user: Promise; + /* + * The randomly generated password to use when authenticating to your + * database via Hyperdrive. + */ + readonly password: Promise; + /** + * Open a TCP socket to the target database through this Hyperdrive. + * + */ + connect(): Promise; +} +/** + * Binding that provisions Hyperdrive connections at request time, rather than + * from static configuration. + */ +interface HyperdriveDynamicApi { + /** + * Provision a connection for the database described by `args`. + * + */ + get(args: HyperdriveDynamicConfig): Promise; + /** + * Get a pre-generated connection string used for connecting to dynamic Hyperdrive. + */ + getHyperdriveConnectionString(connectionString: string): Promise; +} +/** + * Parameters identifying the database that a dynamically-provisioned + * Hyperdrive connection should target. + */ +interface HyperdriveDynamicConfig { + /** + * Generated connection string to pass into the dynamic worker. + * + */ + dynamicHyperdriveConnectionString: string; + /** + * Connection string for the origin database Hyperdrive should connect to. + * Contains credentials, so treat it as a secret. + * + * The scheme selects the database engine. PostgreSQL origins are supported. + */ + connectionString: string; + /** + * Region in which to place the connection pool. See the Hyperdrive + * documentation for the set of supported regions. + */ + targetRegion: string; + /** + * Whether Hyperdrive should cache query results for this connection. + */ + cachingEnabled?: boolean; + /** + * Maximum number of connections the pool may open to the origin database. + * Defaults to 60. + */ + maxConnections?: number; +} // Copyright (c) 2024 Cloudflare, Inc. // Licensed under the Apache 2.0 license found in the LICENSE file or at: // https://opensource.org/licenses/Apache-2.0 diff --git a/types/generated-snapshot/index.ts b/types/generated-snapshot/index.ts index f6b7657a6fe..6f92764fa9e 100755 --- a/types/generated-snapshot/index.ts +++ b/types/generated-snapshot/index.ts @@ -14530,6 +14530,78 @@ export interface Hyperdrive { */ readonly database: string; } +/** + * A handle to a dynamically-provisioned Hyperdrive connection, returned by + * `HyperdriveApi.get()`. + */ +export interface HyperdriveDynamic extends Disposable { + /** + * The database name to use when connecting through this Hyperdrive. + */ + readonly database: Promise; + /* + * The randomly generated user to use when authenticating to your + * database via Hyperdrive. + */ + readonly user: Promise; + /* + * The randomly generated password to use when authenticating to your + * database via Hyperdrive. + */ + readonly password: Promise; + /** + * Open a TCP socket to the target database through this Hyperdrive. + * + */ + connect(): Promise; +} +/** + * Binding that provisions Hyperdrive connections at request time, rather than + * from static configuration. + */ +export interface HyperdriveDynamicApi { + /** + * Provision a connection for the database described by `args`. + * + */ + get(args: HyperdriveDynamicConfig): Promise; + /** + * Get a pre-generated connection string used for connecting to dynamic Hyperdrive. + */ + getHyperdriveConnectionString(connectionString: string): Promise; +} +/** + * Parameters identifying the database that a dynamically-provisioned + * Hyperdrive connection should target. + */ +export interface HyperdriveDynamicConfig { + /** + * Generated connection string to pass into the dynamic worker. + * + */ + dynamicHyperdriveConnectionString: string; + /** + * Connection string for the origin database Hyperdrive should connect to. + * Contains credentials, so treat it as a secret. + * + * The scheme selects the database engine. PostgreSQL origins are supported. + */ + connectionString: string; + /** + * Region in which to place the connection pool. See the Hyperdrive + * documentation for the set of supported regions. + */ + targetRegion: string; + /** + * Whether Hyperdrive should cache query results for this connection. + */ + cachingEnabled?: boolean; + /** + * Maximum number of connections the pool may open to the origin database. + * Defaults to 60. + */ + maxConnections?: number; +} // Copyright (c) 2024 Cloudflare, Inc. // Licensed under the Apache 2.0 license found in the LICENSE file or at: // https://opensource.org/licenses/Apache-2.0