pqb 0.18.26 → 0.18.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +1 -3
- package/dist/index.js +29 -9
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +29 -9
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -3
package/dist/index.d.ts
CHANGED
|
@@ -3852,12 +3852,10 @@ declare const queryMethodByReturnType: Record<QueryReturnType, 'query' | 'arrays
|
|
|
3852
3852
|
type Resolve = (result: any) => any;
|
|
3853
3853
|
type Reject = (error: any) => any;
|
|
3854
3854
|
declare class Then {
|
|
3855
|
-
|
|
3856
|
-
set then(value: typeof maybeWrappedThen);
|
|
3855
|
+
then: (this: Query, resolve?: Resolve, reject?: Reject) => Promise<unknown>;
|
|
3857
3856
|
catch(this: Query, fn: (reason: any) => unknown): Promise<unknown>;
|
|
3858
3857
|
}
|
|
3859
3858
|
declare const handleResult: CommonQueryData['handleResult'];
|
|
3860
|
-
declare function maybeWrappedThen(this: Query, resolve?: Resolve, reject?: Reject): Promise<unknown>;
|
|
3861
3859
|
declare const parseResult: (q: Query, parsers: ColumnsParsers | undefined, returnType: QueryReturnType | undefined, result: QueryResult, isSubQuery?: boolean) => unknown;
|
|
3862
3860
|
declare const parseRecord: (parsers: ColumnsParsers, row: any) => any;
|
|
3863
3861
|
|
package/dist/index.js
CHANGED
|
@@ -7659,22 +7659,42 @@ const queryMethodByReturnType = {
|
|
|
7659
7659
|
rowCount: "arrays",
|
|
7660
7660
|
void: "arrays"
|
|
7661
7661
|
};
|
|
7662
|
-
let queryError = void 0;
|
|
7663
7662
|
class Then {
|
|
7664
|
-
|
|
7663
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
7664
|
+
catch(fn) {
|
|
7665
|
+
return this.then(void 0, fn);
|
|
7666
|
+
}
|
|
7667
|
+
}
|
|
7668
|
+
let queryError = void 0;
|
|
7669
|
+
let getThen;
|
|
7670
|
+
if (process.versions.bun) {
|
|
7671
|
+
getThen = function() {
|
|
7672
|
+
queryError = new Error();
|
|
7673
|
+
if (!this.internal)
|
|
7674
|
+
return maybeWrappedThen;
|
|
7675
|
+
const trx = this.internal.transactionStorage.getStore();
|
|
7676
|
+
if (!trx)
|
|
7677
|
+
return maybeWrappedThen;
|
|
7678
|
+
return (resolve, reject) => {
|
|
7679
|
+
return this.internal.transactionStorage.run(trx, () => {
|
|
7680
|
+
return maybeWrappedThen.call(this, resolve, reject);
|
|
7681
|
+
});
|
|
7682
|
+
};
|
|
7683
|
+
};
|
|
7684
|
+
} else {
|
|
7685
|
+
getThen = function() {
|
|
7665
7686
|
queryError = new Error();
|
|
7666
7687
|
return maybeWrappedThen;
|
|
7667
|
-
}
|
|
7668
|
-
|
|
7688
|
+
};
|
|
7689
|
+
}
|
|
7690
|
+
Object.defineProperty(Then.prototype, "then", {
|
|
7691
|
+
get: getThen,
|
|
7692
|
+
set(value) {
|
|
7669
7693
|
Object.defineProperty(this, "then", {
|
|
7670
7694
|
value
|
|
7671
7695
|
});
|
|
7672
7696
|
}
|
|
7673
|
-
|
|
7674
|
-
catch(fn) {
|
|
7675
|
-
return this.then(void 0, fn);
|
|
7676
|
-
}
|
|
7677
|
-
}
|
|
7697
|
+
});
|
|
7678
7698
|
const handleResult = (q, returnType, result, isSubQuery) => {
|
|
7679
7699
|
return parseResult(q, q.q.parsers, returnType, result, isSubQuery);
|
|
7680
7700
|
};
|