Skip to content

Commit 8049d19

Browse files
committed
Fixed custom sql operations typing in PongoCollection type
1 parent 85c6d4c commit 8049d19

File tree

2 files changed

+15
-15
lines changed

2 files changed

+15
-15
lines changed

src/packages/dumbo/src/postgres/pg/execute/execute.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,8 @@ async function batch<Result extends QueryResultRow = QueryResultRow>(
8888

8989
//TODO: make it smarter at some point
9090
for (let i = 0; i < sqls.length; i++) {
91-
const result = await client.query<Result>(sqls[i]!);
9291
tracer.info('db:sql:query', { sql: sqls[i]! });
92+
const result = await client.query<Result>(sqls[i]!);
9393
results[i] = { rowCount: result.rowCount, rows: result.rows };
9494
}
9595
return Array.isArray(sqlOrSqls) ? results : results[0]!;

src/packages/pongo/src/core/typing/operations.ts

+14-14
Original file line numberDiff line numberDiff line change
@@ -134,52 +134,52 @@ export interface PongoCollection<T extends PongoDocument> {
134134
options?: CollectionOperationOptions,
135135
): Promise<PongoInsertManyResult>;
136136
updateOne(
137-
filter: PongoFilter<T>,
138-
update: PongoUpdate<T>,
137+
filter: PongoFilter<T> | SQL,
138+
update: PongoUpdate<T> | SQL,
139139
options?: UpdateOneOptions,
140140
): Promise<PongoUpdateResult>;
141141
replaceOne(
142-
filter: PongoFilter<T>,
142+
filter: PongoFilter<T> | SQL,
143143
document: WithoutId<T>,
144144
options?: ReplaceOneOptions,
145145
): Promise<PongoUpdateResult>;
146146
updateMany(
147-
filter: PongoFilter<T>,
148-
update: PongoUpdate<T>,
147+
filter: PongoFilter<T> | SQL,
148+
update: PongoUpdate<T> | SQL,
149149
options?: UpdateManyOptions,
150150
): Promise<PongoUpdateManyResult>;
151151
deleteOne(
152-
filter?: PongoFilter<T>,
152+
filter?: PongoFilter<T> | SQL,
153153
options?: DeleteOneOptions,
154154
): Promise<PongoDeleteResult>;
155155
deleteMany(
156-
filter?: PongoFilter<T>,
156+
filter?: PongoFilter<T> | SQL,
157157
options?: DeleteManyOptions,
158158
): Promise<PongoDeleteResult>;
159159
findOne(
160-
filter?: PongoFilter<T>,
160+
filter?: PongoFilter<T> | SQL,
161161
options?: CollectionOperationOptions,
162162
): Promise<T | null>;
163163
find(
164-
filter?: PongoFilter<T>,
164+
filter?: PongoFilter<T> | SQL,
165165
options?: CollectionOperationOptions,
166166
): Promise<T[]>;
167167
findOneAndDelete(
168-
filter: PongoFilter<T>,
168+
filter: PongoFilter<T> | SQL,
169169
options?: DeleteOneOptions,
170170
): Promise<T | null>;
171171
findOneAndReplace(
172-
filter: PongoFilter<T>,
172+
filter: PongoFilter<T> | SQL,
173173
replacement: WithoutId<T>,
174174
options?: ReplaceOneOptions,
175175
): Promise<T | null>;
176176
findOneAndUpdate(
177-
filter: PongoFilter<T>,
178-
update: PongoUpdate<T>,
177+
filter: PongoFilter<T> | SQL,
178+
update: PongoUpdate<T> | SQL,
179179
options?: UpdateOneOptions,
180180
): Promise<T | null>;
181181
countDocuments(
182-
filter?: PongoFilter<T>,
182+
filter?: PongoFilter<T> | SQL,
183183
options?: CollectionOperationOptions,
184184
): Promise<number>;
185185
drop(options?: CollectionOperationOptions): Promise<boolean>;

0 commit comments

Comments
 (0)