Skip to content

Commit df2faf9

Browse files
authored
Introduce client.withCodecs() (#1161)
1 parent ad87fa7 commit df2faf9

37 files changed

+1515
-1577
lines changed

.github/workflows/tests.yml

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,13 @@ jobs:
2525
edgedb-version: "nightly"
2626
- os: ubuntu-latest
2727
node-version: "20"
28-
edgedb-version: "4"
29-
- os: ubuntu-latest
30-
node-version: "20"
31-
edgedb-version: "3"
28+
edgedb-version: "5"
3229
- os: ubuntu-latest
3330
node-version: "20"
34-
edgedb-version: "2"
31+
edgedb-version: "4"
32+
# - os: ubuntu-latest
33+
# node-version: "20"
34+
# edgedb-version: "3"
3535
# XXX: macOS is currently unsupported by setup-edgedb
3636
# - os: macos-latest
3737
# node-version: "20"
@@ -91,11 +91,6 @@ jobs:
9191
run: |
9292
yarn ci:test
9393
94-
- name: Run query builder integration tests legacy
95-
if: ${{ matrix.edgedb-version == '2' }}
96-
run: |
97-
turbo run ci:integration-test --filter=@edgedb/integration-legacy
98-
9994
- name: Run query builder integration tests lts
10095
if: ${{ matrix.edgedb-version == '3' || matrix.edgedb-version == '4' || matrix.edgedb-version == 'stable' || matrix.edgedb-version == 'nightly' }}
10196
run: |

packages/driver/src/baseClient.ts

Lines changed: 11 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
*/
1818

1919
import type { Duration } from "./datatypes/datetime";
20+
import type { Codecs } from "./codecs/codecs";
2021
import { CodecsRegistry } from "./codecs/registry";
2122
import type {
2223
ConnectArgumentsParser,
@@ -35,7 +36,6 @@ import {
3536
} from "./ifaces";
3637
import type {
3738
RetryOptions,
38-
Session,
3939
SimpleRetryOptions,
4040
SimpleTransactionOptions,
4141
TransactionOptions,
@@ -190,7 +190,7 @@ export class ClientConnectionHolder {
190190
args,
191191
outputFormat,
192192
expectedCardinality,
193-
this.options.session,
193+
this.options,
194194
false /* privilegedMode */,
195195
language,
196196
);
@@ -581,34 +581,24 @@ export class Client implements Executor {
581581
return new Client(this.pool, this.options.withRetryOptions(opts));
582582
}
583583

584-
withSession(session: Session): Client {
585-
return new Client(this.pool, this.options.withSession(session));
586-
}
587-
588584
withModuleAliases(aliases: Record<string, string>) {
589-
return new Client(
590-
this.pool,
591-
this.options.withSession(this.options.session.withModuleAliases(aliases)),
592-
);
585+
return new Client(this.pool, this.options.withModuleAliases(aliases));
593586
}
594587

595588
withConfig(config: SimpleConfig): Client {
596-
const newConfig = this.options.session.withConfig(config);
597-
return new Client(this.pool, this.options.withSession(newConfig));
589+
return new Client(this.pool, this.options.withConfig(config));
590+
}
591+
592+
withCodecs(codecs: Codecs.CodecSpec): Client {
593+
return new Client(this.pool, this.options.withCodecs(codecs));
598594
}
599595

600596
withGlobals(globals: Record<string, any>): Client {
601-
return new Client(
602-
this.pool,
603-
this.options.withSession(this.options.session.withGlobals(globals)),
604-
);
597+
return new Client(this.pool, this.options.withGlobals(globals));
605598
}
606599

607600
withQueryTag(tag: string | null): Client {
608-
return new Client(
609-
this.pool,
610-
this.options.withSession(this.options.session.withQueryTag(tag)),
611-
);
601+
return new Client(this.pool, this.options.withQueryTag(tag));
612602
}
613603

614604
withWarningHandler(handler: WarningHandler): Client {
@@ -775,7 +765,7 @@ export class Client implements Executor {
775765
query,
776766
OutputFormat.BINARY,
777767
Cardinality.MANY,
778-
this.options.session,
768+
this.options,
779769
);
780770
const cardinality = util.parseCardinality(result[0]);
781771

0 commit comments

Comments
 (0)