diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f72fe3e..f5a8f84 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -30,16 +30,16 @@ jobs: uses: actions/checkout@master - name: Build tests container - run: docker-compose build tests + run: docker compose build tests - name: Run tests - run: docker-compose run tests + run: docker compose run tests - name: Run tests without typechecking id: no_typecheck uses: mathiasvr/command-output@v2.0.0 with: - run: docker-compose run no_check_tests + run: docker compose run no_check_tests continue-on-error: true - name: Report no typechecking tests status diff --git a/.github/workflows/publish_jsr.yml b/.github/workflows/publish_jsr.yml index 50285a6..1548c84 100644 --- a/.github/workflows/publish_jsr.yml +++ b/.github/workflows/publish_jsr.yml @@ -39,10 +39,10 @@ jobs: run: deno test --doc client.ts mod.ts pool.ts client/ connection/ query/ utils/ - name: Build tests container - run: docker-compose build tests + run: docker compose build tests - name: Run tests - run: docker-compose run tests + run: docker compose run tests - name: Publish (dry run) if: startsWith(github.ref, 'refs/tags/') == false diff --git a/README.md b/README.md index d45e051..aeb6382 100644 --- a/README.md +++ b/README.md @@ -86,8 +86,8 @@ result assertions. To run the tests, run the following commands: -1. `docker-compose build tests` -2. `docker-compose run tests` +1. `docker compose build tests` +2. `docker compose run tests` The build step will check linting and formatting as well and report it to the command line diff --git a/client/error.ts b/client/error.ts index 7fc4ccc..35d0599 100644 --- a/client/error.ts +++ b/client/error.ts @@ -1,4 +1,4 @@ -import { type Notice } from "../connection/message.ts"; +import type { Notice } from "../connection/message.ts"; /** * A connection error diff --git a/connection/connection.ts b/connection/connection.ts index bc5d9cf..88cfa0f 100644 --- a/connection/connection.ts +++ b/connection/connection.ts @@ -54,7 +54,7 @@ import { type QueryResult, ResultType, } from "../query/query.ts"; -import { type ClientConfiguration } from "./connection_params.ts"; +import type { ClientConfiguration } from "./connection_params.ts"; import * as scram from "./scram.ts"; import { ConnectionError, @@ -295,7 +295,7 @@ export class Connection { } async #openTlsConnection( - connection: Deno.Conn, + connection: Deno.TcpConn, options: { hostname: string; caCerts: string[] }, ) { this.#conn = await Deno.startTls(connection, options); @@ -354,7 +354,9 @@ export class Connection { // https://www.postgresql.org/docs/14/protocol-flow.html#id-1.10.5.7.11 if (accepts_tls) { try { - await this.#openTlsConnection(this.#conn, { + // TODO: handle connection type without castinggaa + // https://github.com/denoland/deno/issues/10200 + await this.#openTlsConnection(this.#conn as Deno.TcpConn, { hostname, caCerts: caCertificates, }); diff --git a/connection/connection_params.ts b/connection/connection_params.ts index ac4f650..d59b9ac 100644 --- a/connection/connection_params.ts +++ b/connection/connection_params.ts @@ -1,9 +1,9 @@ import { parseConnectionUri } from "../utils/utils.ts"; import { ConnectionParamsError } from "../client/error.ts"; import { fromFileUrl, isAbsolute } from "../deps.ts"; -import { OidType } from "../query/oid.ts"; -import { DebugControls } from "../debug.ts"; -import { ParseArrayFunction } from "../query/array_parser.ts"; +import type { OidType } from "../query/oid.ts"; +import type { DebugControls } from "../debug.ts"; +import type { ParseArrayFunction } from "../query/array_parser.ts"; /** * The connection string must match the following URI structure. All parameters but database and user are optional diff --git a/docker-compose.yml b/docker-compose.yml index be91903..e49dc01 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,5 +1,3 @@ -version: '3.8' - x-database-env: &database-env POSTGRES_DB: "postgres" diff --git a/query/decode.ts b/query/decode.ts index 38df157..cb5d9fc 100644 --- a/query/decode.ts +++ b/query/decode.ts @@ -1,4 +1,4 @@ -import { Oid, OidType, OidTypes, OidValue } from "./oid.ts"; +import { Oid, type OidType, OidTypes, type OidValue } from "./oid.ts"; import { bold, yellow } from "../deps.ts"; import { decodeBigint, @@ -35,7 +35,7 @@ import { decodeTid, decodeTidArray, } from "./decoders.ts"; -import { ClientControls } from "../connection/connection_params.ts"; +import type { ClientControls } from "../connection/connection_params.ts"; import { parseArray } from "./array_parser.ts"; export class Column { diff --git a/query/query.ts b/query/query.ts index 9671f71..fa4eae8 100644 --- a/query/query.ts +++ b/query/query.ts @@ -1,7 +1,7 @@ import { encodeArgument, type EncodedArg } from "./encode.ts"; import { type Column, decode } from "./decode.ts"; -import { type Notice } from "../connection/message.ts"; -import { type ClientControls } from "../connection/connection_params.ts"; +import type { Notice } from "../connection/message.ts"; +import type { ClientControls } from "../connection/connection_params.ts"; // TODO // Limit the type of parameters that can be passed diff --git a/query/transaction.ts b/query/transaction.ts index 3dadd33..02ba019 100644 --- a/query/transaction.ts +++ b/query/transaction.ts @@ -1,4 +1,4 @@ -import { type QueryClient } from "../client.ts"; +import type { QueryClient } from "../client.ts"; import { Query, type QueryArguments, diff --git a/tests/README.md b/tests/README.md index c8c3e4e..38cc8c4 100644 --- a/tests/README.md +++ b/tests/README.md @@ -16,8 +16,8 @@ From within the project directory, run: deno test --allow-read --allow-net --allow-env # run in docker container -docker-compose build --no-cache -docker-compose run tests +docker compose build --no-cache +docker compose run tests ``` ## Docker Configuration diff --git a/tests/config.ts b/tests/config.ts index 17bf701..4a6784c 100644 --- a/tests/config.ts +++ b/tests/config.ts @@ -1,4 +1,4 @@ -import { +import type { ClientConfiguration, ClientOptions, } from "../connection/connection_params.ts"; diff --git a/tests/helpers.ts b/tests/helpers.ts index d1630d3..e26a7f2 100644 --- a/tests/helpers.ts +++ b/tests/helpers.ts @@ -1,6 +1,6 @@ import { Client } from "../client.ts"; import { Pool } from "../pool.ts"; -import { type ClientOptions } from "../connection/connection_params.ts"; +import type { ClientOptions } from "../connection/connection_params.ts"; export function generateSimpleClientTest( client_options: ClientOptions, diff --git a/tests/query_client_test.ts b/tests/query_client_test.ts index c096049..abc7332 100644 --- a/tests/query_client_test.ts +++ b/tests/query_client_test.ts @@ -14,8 +14,8 @@ import { assertThrows, } from "./test_deps.ts"; import { getMainConfiguration } from "./config.ts"; -import { PoolClient, QueryClient } from "../client.ts"; -import { ClientOptions } from "../connection/connection_params.ts"; +import type { PoolClient, QueryClient } from "../client.ts"; +import type { ClientOptions } from "../connection/connection_params.ts"; import { Oid } from "../query/oid.ts"; function withClient( diff --git a/tests/utils_test.ts b/tests/utils_test.ts index d5e418d..1491831 100644 --- a/tests/utils_test.ts +++ b/tests/utils_test.ts @@ -1,5 +1,5 @@ import { assertEquals, assertThrows } from "./test_deps.ts"; -import { parseConnectionUri, Uri } from "../utils/utils.ts"; +import { parseConnectionUri, type Uri } from "../utils/utils.ts"; import { DeferredAccessStack, DeferredStack } from "../utils/deferred.ts"; class LazilyInitializedObject {