orchid-orm 1.9.13 → 1.9.15
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 +7 -3
- package/dist/index.js +25 -12
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +22 -13
- package/dist/index.mjs.map +1 -1
- package/package.json +6 -6
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as pqb from 'pqb';
|
|
2
|
-
import { BelongsToRelation, HasManyRelation, HasOneRelation, Db, IsolationLevel, TransactionOptions, Adapter, FromArgs, Query, FromResult, AdapterOptions, QueryLogOptions, NoPrimaryKeyOption, HasAndBelongsToManyRelation, SetQueryTableAlias,
|
|
3
|
-
export { OrchidOrmError, OrchidOrmInternalError, columnTypes } from 'pqb';
|
|
2
|
+
import { BelongsToRelation, HasManyRelation, HasOneRelation, Db, IsolationLevel, TransactionOptions, Adapter, FromArgs, Query, FromResult, AdapterOptions, QueryLogOptions, NoPrimaryKeyOption, HasAndBelongsToManyRelation, SetQueryTableAlias, BaseRelation, RelationQuery, SetQueryReturnsOne, SetQueryReturnsOneOptional, SetQueryReturnsAll, DefaultColumnTypes, ColumnsShape, WhereResult, MergeQuery, SetQueryReturns, QueryReturnType } from 'pqb';
|
|
3
|
+
export { OrchidOrmError, OrchidOrmInternalError, columnTypes, testTransaction } from 'pqb';
|
|
4
4
|
import * as orchid_core from 'orchid-core';
|
|
5
5
|
import { StringKey, EmptyObject, ColumnTypesBase, ColumnShapeOutput } from 'orchid-core';
|
|
6
6
|
import { AppCodeUpdater } from 'rake-db';
|
|
@@ -74,6 +74,8 @@ type OrchidORM<T extends TableClasses = TableClasses> = {
|
|
|
74
74
|
$close(): Promise<void>;
|
|
75
75
|
};
|
|
76
76
|
declare const orchidORM: <T extends TableClasses>({ log, logger, autoPreparedStatements, noPrimaryKey, ...options }: (Omit<AdapterOptions, "log"> | {
|
|
77
|
+
db: Query;
|
|
78
|
+
} | {
|
|
77
79
|
adapter: Adapter;
|
|
78
80
|
}) & QueryLogOptions & {
|
|
79
81
|
autoPreparedStatements?: boolean | undefined;
|
|
@@ -109,7 +111,9 @@ type Relation<T extends Table, Relations extends RelationThunks, K extends Strin
|
|
|
109
111
|
joinQuery(fromQuery: Query, toQuery: Query): Query;
|
|
110
112
|
defaults: Info['populate'];
|
|
111
113
|
nestedCreateQuery: [Info['populate']] extends [never] ? M : M & {
|
|
112
|
-
|
|
114
|
+
meta: {
|
|
115
|
+
defaults: Record<Info['populate'], true>;
|
|
116
|
+
};
|
|
113
117
|
};
|
|
114
118
|
primaryKey: string;
|
|
115
119
|
options: Relations[K]['options'];
|
package/dist/index.js
CHANGED
|
@@ -1357,24 +1357,33 @@ const orchidORM = (_a, tables) => {
|
|
|
1357
1357
|
"autoPreparedStatements",
|
|
1358
1358
|
"noPrimaryKey"
|
|
1359
1359
|
]);
|
|
1360
|
-
const adapter = "adapter" in options ? options.adapter : new pqb.Adapter(options);
|
|
1361
1360
|
const commonOptions = {
|
|
1362
1361
|
log,
|
|
1363
1362
|
logger,
|
|
1364
1363
|
autoPreparedStatements,
|
|
1365
1364
|
noPrimaryKey
|
|
1366
1365
|
};
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1366
|
+
let adapter;
|
|
1367
|
+
let transactionStorage;
|
|
1368
|
+
let qb;
|
|
1369
|
+
if ("db" in options) {
|
|
1370
|
+
adapter = options.db.query.adapter;
|
|
1371
|
+
transactionStorage = options.db.internal.transactionStorage;
|
|
1372
|
+
qb = options.db.queryBuilder;
|
|
1373
|
+
} else {
|
|
1374
|
+
adapter = "adapter" in options ? options.adapter : new pqb.Adapter(options);
|
|
1375
|
+
transactionStorage = new node_async_hooks.AsyncLocalStorage();
|
|
1376
|
+
qb = new pqb.Db(
|
|
1377
|
+
adapter,
|
|
1378
|
+
void 0,
|
|
1379
|
+
void 0,
|
|
1380
|
+
pqb.anyShape,
|
|
1381
|
+
pqb.columnTypes,
|
|
1382
|
+
transactionStorage,
|
|
1383
|
+
commonOptions
|
|
1384
|
+
);
|
|
1385
|
+
qb.queryBuilder = qb;
|
|
1386
|
+
}
|
|
1378
1387
|
const result = {
|
|
1379
1388
|
$transaction: transaction,
|
|
1380
1389
|
$adapter: adapter,
|
|
@@ -2836,6 +2845,10 @@ Object.defineProperty(exports, 'columnTypes', {
|
|
|
2836
2845
|
enumerable: true,
|
|
2837
2846
|
get: function () { return pqb.columnTypes; }
|
|
2838
2847
|
});
|
|
2848
|
+
Object.defineProperty(exports, 'testTransaction', {
|
|
2849
|
+
enumerable: true,
|
|
2850
|
+
get: function () { return pqb.testTransaction; }
|
|
2851
|
+
});
|
|
2839
2852
|
exports.AppCodeUpdaterError = AppCodeUpdaterError;
|
|
2840
2853
|
exports.appCodeUpdater = appCodeUpdater;
|
|
2841
2854
|
exports.createBaseTable = createBaseTable;
|