orchid-orm 1.6.0 → 1.6.2
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 +67 -42
- package/dist/index.js +9 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +10 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -5
package/dist/index.mjs
CHANGED
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
import { columnTypes, getColumnTypes, addQueryOn, VirtualColumn, pushQueryValue, isQueryReturnsAll, getQueryAs, toSqlCacheKey, NotFoundError, relationQueryKey, Db, Adapter, anyShape, getClonedQueryData, columnsShapeToCode, codeToString, primaryKeyToCode, indexToCode, foreignKeyToCode, columnIndexesToCode, columnForeignKeysToCode, columnDefaultArgumentToCode } from 'pqb';
|
|
2
2
|
export { columnTypes } from 'pqb';
|
|
3
|
-
import { emptyObject, singleQuote, quoteObjectKey, addCode } from 'orchid-core';
|
|
3
|
+
import { snakeCaseKey, emptyObject, singleQuote, quoteObjectKey, addCode } from 'orchid-core';
|
|
4
4
|
import * as path from 'path';
|
|
5
5
|
import path__default from 'path';
|
|
6
6
|
import fs from 'fs/promises';
|
|
7
7
|
import typescript from 'typescript';
|
|
8
8
|
|
|
9
9
|
const createBaseTable = (options = { columnTypes }) => {
|
|
10
|
-
const ct = typeof options.columnTypes === "function" ? options.columnTypes(columnTypes) : options.columnTypes;
|
|
10
|
+
const ct = typeof options.columnTypes === "function" ? options.columnTypes(columnTypes) : options.columnTypes || columnTypes;
|
|
11
|
+
if (options.snakeCase) {
|
|
12
|
+
ct[snakeCaseKey] = true;
|
|
13
|
+
}
|
|
11
14
|
return create(ct);
|
|
12
15
|
};
|
|
13
16
|
const create = (columnTypes2) => {
|
|
@@ -1208,8 +1211,11 @@ const makeRelationQuery = (table, definedAs, relationName, data) => {
|
|
|
1208
1211
|
toTable._take();
|
|
1209
1212
|
}
|
|
1210
1213
|
const query = this.isSubQuery ? toTable : toTable._whereExists(
|
|
1211
|
-
this
|
|
1212
|
-
(q) => data.reverseJoin(
|
|
1214
|
+
this,
|
|
1215
|
+
(q) => data.reverseJoin(
|
|
1216
|
+
q,
|
|
1217
|
+
toTable
|
|
1218
|
+
)
|
|
1213
1219
|
);
|
|
1214
1220
|
query.query[relationQueryKey] = {
|
|
1215
1221
|
relationName,
|