Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 76 additions & 1 deletion types/defines/hyperdrive.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
/*
Expand All @@ -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<string>;
/*
* The randomly generated user to use when authenticating to your
* database via Hyperdrive.
*/
readonly user: Promise<string>;
/*
* The randomly generated password to use when authenticating to your
* database via Hyperdrive.
*/
readonly password: Promise<string>;
/**
* Open a TCP socket to the target database through this Hyperdrive.
*
*/
connect(): Promise<Socket>;
}

/**
* 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<HyperdriveDynamic>;
/**
* Get a pre-generated connection string used for connecting to dynamic Hyperdrive.
*/
getHyperdriveConnectionString(connectionString: string): Promise<string>;
}

/**
* 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;
}
72 changes: 72 additions & 0 deletions types/generated-snapshot/experimental/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14767,6 +14767,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<string>;
/*
* The randomly generated user to use when authenticating to your
* database via Hyperdrive.
*/
readonly user: Promise<string>;
/*
* The randomly generated password to use when authenticating to your
* database via Hyperdrive.
*/
readonly password: Promise<string>;
/**
* Open a TCP socket to the target database through this Hyperdrive.
*
*/
connect(): Promise<Socket>;
}
/**
* 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<HyperdriveDynamic>;
/**
* Get a pre-generated connection string used for connecting to dynamic Hyperdrive.
*/
getHyperdriveConnectionString(connectionString: string): Promise<string>;
}
/**
* 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
Expand Down
72 changes: 72 additions & 0 deletions types/generated-snapshot/experimental/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14784,6 +14784,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<string>;
/*
* The randomly generated user to use when authenticating to your
* database via Hyperdrive.
*/
readonly user: Promise<string>;
/*
* The randomly generated password to use when authenticating to your
* database via Hyperdrive.
*/
readonly password: Promise<string>;
/**
* Open a TCP socket to the target database through this Hyperdrive.
*
*/
connect(): Promise<Socket>;
}
/**
* 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<HyperdriveDynamic>;
/**
* Get a pre-generated connection string used for connecting to dynamic Hyperdrive.
*/
getHyperdriveConnectionString(connectionString: string): Promise<string>;
}
/**
* 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
Expand Down
72 changes: 72 additions & 0 deletions types/generated-snapshot/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14492,6 +14492,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<string>;
/*
* The randomly generated user to use when authenticating to your
* database via Hyperdrive.
*/
readonly user: Promise<string>;
/*
* The randomly generated password to use when authenticating to your
* database via Hyperdrive.
*/
readonly password: Promise<string>;
/**
* Open a TCP socket to the target database through this Hyperdrive.
*
*/
connect(): Promise<Socket>;
}
/**
* 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<HyperdriveDynamic>;
/**
* Get a pre-generated connection string used for connecting to dynamic Hyperdrive.
*/
getHyperdriveConnectionString(connectionString: string): Promise<string>;
}
/**
* 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
Expand Down
Loading
Loading