orchid-orm 1.5.39 → 1.6.1
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 +167 -163
- package/dist/index.js +27 -22
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +18 -13
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -4
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { columnTypes, getColumnTypes, addQueryOn, VirtualColumn, pushQueryValue, isQueryReturnsAll, getQueryAs, toSqlCacheKey, NotFoundError, relationQueryKey, Db, Adapter, anyShape, getClonedQueryData,
|
|
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
4
|
import * as path from 'path';
|
|
4
5
|
import path__default from 'path';
|
|
5
6
|
import fs from 'fs/promises';
|
|
@@ -57,8 +58,8 @@ const create = (columnTypes2) => {
|
|
|
57
58
|
};
|
|
58
59
|
|
|
59
60
|
class BelongsToVirtualColumn extends VirtualColumn {
|
|
60
|
-
constructor(key, state) {
|
|
61
|
-
super();
|
|
61
|
+
constructor(types, key, state) {
|
|
62
|
+
super(types);
|
|
62
63
|
this.key = key;
|
|
63
64
|
this.state = state;
|
|
64
65
|
this.nestedInsert = nestedInsert$3(this.state);
|
|
@@ -111,7 +112,7 @@ const makeBelongsToMethod = (relation, relationName, query) => {
|
|
|
111
112
|
method: (params) => {
|
|
112
113
|
return query.findBy({ [primaryKey]: params[foreignKey] });
|
|
113
114
|
},
|
|
114
|
-
virtualColumn: new BelongsToVirtualColumn(relationName, state),
|
|
115
|
+
virtualColumn: new BelongsToVirtualColumn(emptyObject, relationName, state),
|
|
115
116
|
joinQuery(fromQuery, toQuery) {
|
|
116
117
|
return addQueryOn(toQuery, fromQuery, toQuery, primaryKey, foreignKey);
|
|
117
118
|
},
|
|
@@ -321,8 +322,8 @@ var __spreadValues$6 = (a, b) => {
|
|
|
321
322
|
};
|
|
322
323
|
var __spreadProps$5 = (a, b) => __defProps$5(a, __getOwnPropDescs$5(b));
|
|
323
324
|
class HasOneVirtualColumn extends VirtualColumn {
|
|
324
|
-
constructor(key, state) {
|
|
325
|
-
super();
|
|
325
|
+
constructor(types, key, state) {
|
|
326
|
+
super(types);
|
|
326
327
|
this.key = key;
|
|
327
328
|
this.state = state;
|
|
328
329
|
this.nestedInsert = nestedInsert$2(state);
|
|
@@ -402,7 +403,7 @@ const makeHasOneMethod = (table, relation, relationName, query) => {
|
|
|
402
403
|
const values = { [foreignKey]: params[primaryKey] };
|
|
403
404
|
return query.where(values)._defaults(values);
|
|
404
405
|
},
|
|
405
|
-
virtualColumn: new HasOneVirtualColumn(relationName, state),
|
|
406
|
+
virtualColumn: new HasOneVirtualColumn(emptyObject, relationName, state),
|
|
406
407
|
joinQuery(fromQuery, toQuery) {
|
|
407
408
|
return addQueryOn(toQuery, fromQuery, toQuery, foreignKey, primaryKey);
|
|
408
409
|
},
|
|
@@ -513,8 +514,8 @@ var __spreadValues$5 = (a, b) => {
|
|
|
513
514
|
};
|
|
514
515
|
var __spreadProps$4 = (a, b) => __defProps$4(a, __getOwnPropDescs$4(b));
|
|
515
516
|
class HasManyVirtualColumn extends VirtualColumn {
|
|
516
|
-
constructor(key, state) {
|
|
517
|
-
super();
|
|
517
|
+
constructor(types, key, state) {
|
|
518
|
+
super(types);
|
|
518
519
|
this.key = key;
|
|
519
520
|
this.state = state;
|
|
520
521
|
this.nestedInsert = nestedInsert$1(state);
|
|
@@ -593,7 +594,7 @@ const makeHasManyMethod = (table, relation, relationName, query) => {
|
|
|
593
594
|
const values = { [foreignKey]: params[primaryKey] };
|
|
594
595
|
return query.where(values)._defaults(values);
|
|
595
596
|
},
|
|
596
|
-
virtualColumn: new HasManyVirtualColumn(relationName, state),
|
|
597
|
+
virtualColumn: new HasManyVirtualColumn(emptyObject, relationName, state),
|
|
597
598
|
joinQuery(fromQuery, toQuery) {
|
|
598
599
|
return addQueryOn(toQuery, fromQuery, toQuery, foreignKey, primaryKey);
|
|
599
600
|
},
|
|
@@ -757,8 +758,8 @@ var __spreadValues$4 = (a, b) => {
|
|
|
757
758
|
};
|
|
758
759
|
var __spreadProps$3 = (a, b) => __defProps$3(a, __getOwnPropDescs$3(b));
|
|
759
760
|
class HasAndBelongsToManyVirtualColumn extends VirtualColumn {
|
|
760
|
-
constructor(key, state) {
|
|
761
|
-
super();
|
|
761
|
+
constructor(types, key, state) {
|
|
762
|
+
super(types);
|
|
762
763
|
this.key = key;
|
|
763
764
|
this.state = state;
|
|
764
765
|
this.nestedInsert = nestedInsert(state);
|
|
@@ -829,7 +830,11 @@ const makeHasAndBelongsToManyMethod = (table, qb, relation, relationName, query)
|
|
|
829
830
|
})
|
|
830
831
|
);
|
|
831
832
|
},
|
|
832
|
-
virtualColumn: new HasAndBelongsToManyVirtualColumn(
|
|
833
|
+
virtualColumn: new HasAndBelongsToManyVirtualColumn(
|
|
834
|
+
emptyObject,
|
|
835
|
+
relationName,
|
|
836
|
+
state
|
|
837
|
+
),
|
|
833
838
|
joinQuery(fromQuery, toQuery) {
|
|
834
839
|
return toQuery.whereExists(
|
|
835
840
|
subQuery,
|