From 5b42c397c1be8c0ee928f7e6375eb191f46f4f81 Mon Sep 17 00:00:00 2001 From: Kevin Date: Mon, 1 Jul 2024 15:13:27 +0200 Subject: [PATCH] chore (client): deprecation warnings for DAL (#1398) This PR adds deprecation warnings on all DAL methods. --- .changeset/itchy-badgers-collect.md | 5 ++ clients/typescript/src/client/model/table.ts | 56 ++++++++++++++++++++ 2 files changed, 61 insertions(+) create mode 100644 .changeset/itchy-badgers-collect.md diff --git a/.changeset/itchy-badgers-collect.md b/.changeset/itchy-badgers-collect.md new file mode 100644 index 0000000000..8c62282c08 --- /dev/null +++ b/.changeset/itchy-badgers-collect.md @@ -0,0 +1,5 @@ +--- +"electric-sql": patch +--- + +Add deprecation warnings to the public API methods of the DAL. diff --git a/clients/typescript/src/client/model/table.ts b/clients/typescript/src/client/model/table.ts index 3863f38010..e04b6f1b38 100644 --- a/clients/typescript/src/client/model/table.ts +++ b/clients/typescript/src/client/model/table.ts @@ -202,6 +202,10 @@ export class Table< return includedTables } + /** + * @deprecated The DAL is deprecated and will be removed in a future release. + * You can use the raw query API or a query builder/ORM integration. + */ sync>(i?: T): Promise { const validatedInput = this.syncSchema.parse(i ?? {}) const shape = computeShape( @@ -221,6 +225,10 @@ export class Table< * As such, one can compose these methods arbitrarily and then run them inside a single transaction. */ + /** + * @deprecated The DAL is deprecated and will be removed in a future release. + * You can use the raw query API or a query builder/ORM integration. + */ async create>( i: SelectSubset> ): Promise> { @@ -232,12 +240,20 @@ export class Table< ) } + /** + * @deprecated The DAL is deprecated and will be removed in a future release. + * You can use the raw query API or a query builder/ORM integration. + */ async createMany>( i: SelectSubset> ): Promise { return this._executor.execute(this._createMany.bind(this, i)) } + /** + * @deprecated The DAL is deprecated and will be removed in a future release. + * You can use the raw query API or a query builder/ORM integration. + */ async findUnique>( i: SelectSubset> ): Promise | null> { @@ -247,12 +263,20 @@ export class Table< ) } + /** + * @deprecated The DAL is deprecated and will be removed in a future release. + * You can use the raw query API or a query builder/ORM integration. + */ liveUnique>( i: SelectSubset> ): LiveResultContext | null> { return this.makeLiveResult(() => this.findUnique(i), i) } + /** + * @deprecated The DAL is deprecated and will be removed in a future release. + * You can use the raw query API or a query builder/ORM integration. + */ async findFirst< T extends FindInput >( @@ -267,6 +291,10 @@ export class Table< ) } + /** + * @deprecated The DAL is deprecated and will be removed in a future release. + * You can use the raw query API or a query builder/ORM integration. + */ liveFirst< T extends FindInput >( @@ -278,6 +306,10 @@ export class Table< return this.makeLiveResult(() => this.findFirst(i), i ?? {}) } + /** + * @deprecated The DAL is deprecated and will be removed in a future release. + * You can use the raw query API or a query builder/ORM integration. + */ async findMany< T extends FindInput >( @@ -292,6 +324,10 @@ export class Table< ) } + /** + * @deprecated The DAL is deprecated and will be removed in a future release. + * You can use the raw query API or a query builder/ORM integration. + */ liveMany< T extends FindInput >( @@ -303,6 +339,10 @@ export class Table< return this.makeLiveResult(() => this.findMany(i), i ?? {}) } + /** + * @deprecated The DAL is deprecated and will be removed in a future release. + * You can use the raw query API or a query builder/ORM integration. + */ async update>( i: SelectSubset> ): Promise> { @@ -311,12 +351,20 @@ export class Table< ) } + /** + * @deprecated The DAL is deprecated and will be removed in a future release. + * You can use the raw query API or a query builder/ORM integration. + */ async updateMany>( i: SelectSubset> ): Promise { return this._executor.execute(this._updateMany.bind(this, i)) } + /** + * @deprecated The DAL is deprecated and will be removed in a future release. + * You can use the raw query API or a query builder/ORM integration. + */ async upsert< T extends UpsertInput >( @@ -330,6 +378,10 @@ export class Table< ) } + /** + * @deprecated The DAL is deprecated and will be removed in a future release. + * You can use the raw query API or a query builder/ORM integration. + */ async delete>( i: SelectSubset> ): Promise> { @@ -338,6 +390,10 @@ export class Table< ) } + /** + * @deprecated The DAL is deprecated and will be removed in a future release. + * You can use the raw query API or a query builder/ORM integration. + */ async deleteMany>( i?: SelectSubset> ): Promise {