orchid-orm 1.23.10 → 1.24.0
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 -0
- package/dist/index.js +31 -15
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +27 -16
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -5
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Query, SelectableFromShape, CreateMethodsNames, AddQueryDefaults, SetQueryReturnsOne, SetQueryReturnsOneOptional, RelationJoinQuery, UpdateData, WhereArg, CreateData, JoinQueryMethod, DeleteMethodsNames, Db, IsolationLevel, TransactionOptions, Adapter, FromArg, FromArgOptions, FromResult, AdapterOptions, QueryLogOptions, NoPrimaryKeyOption, RelationQuery, MapTableScopesOption, ComputedColumnsBase, QueryData, QueryBase, DbTableOptionScopes, DefaultSchemaConfig, DefaultColumnTypes, RelationQueryBase, QueryBeforeHook, QueryAfterHook, AfterHook, WhereResult, MergeQuery } from 'pqb';
|
|
2
2
|
export * from 'pqb';
|
|
3
3
|
import { ColumnsShapeBase, EmptyObject, MaybeArray, RecordUnknown, CoreQueryScopes, ColumnShapeOutput, ColumnShapeInput, ColumnShapeInputPartial, ColumnSchemaConfig, QueryReturnType } from 'orchid-core';
|
|
4
|
+
export * from 'orchid-core';
|
|
4
5
|
|
|
5
6
|
interface RelationCommonOptions<Related extends TableClass = TableClass, Scope extends Query = Query> {
|
|
6
7
|
scope?: ScopeFn<Related, Scope>;
|
package/dist/index.js
CHANGED
|
@@ -1035,7 +1035,7 @@ const nestedUpdate$1 = ({ query, primaryKeys, foreignKeys }) => {
|
|
|
1035
1035
|
),
|
|
1036
1036
|
obj
|
|
1037
1037
|
);
|
|
1038
|
-
if (params.set) {
|
|
1038
|
+
if (params.set && (Array.isArray(params.set) ? params.set.length : orchidCore.objectHasValues(params.set))) {
|
|
1039
1039
|
delete t.q[pqb.toSQLCacheKey];
|
|
1040
1040
|
const obj2 = {};
|
|
1041
1041
|
for (let i = 0; i < len; i++) {
|
|
@@ -1144,10 +1144,17 @@ const makeHasAndBelongsToManyMethod = (table, qb, relation, relationName, query)
|
|
|
1144
1144
|
throughForeignKeys = [options.associationForeignKey];
|
|
1145
1145
|
throughPrimaryKeys = [options.associationPrimaryKey];
|
|
1146
1146
|
}
|
|
1147
|
-
const
|
|
1148
|
-
const
|
|
1149
|
-
(
|
|
1150
|
-
|
|
1147
|
+
const { snakeCase } = table.internal;
|
|
1148
|
+
const foreignKeysFull = foreignKeys.map((key, i) => {
|
|
1149
|
+
if (snakeCase)
|
|
1150
|
+
key = foreignKeys[i] = orchidCore.toSnakeCase(key);
|
|
1151
|
+
return `${joinTable}.${key}`;
|
|
1152
|
+
});
|
|
1153
|
+
const throughForeignKeysFull = throughForeignKeys.map((key, i) => {
|
|
1154
|
+
if (snakeCase)
|
|
1155
|
+
key = throughForeignKeys[i] = orchidCore.toSnakeCase(key);
|
|
1156
|
+
return `${joinTable}.${key}`;
|
|
1157
|
+
});
|
|
1151
1158
|
const foreignTable = pqb.getQueryAs(query);
|
|
1152
1159
|
const throughPrimaryKeysFull = throughPrimaryKeys.map(
|
|
1153
1160
|
(key) => `${foreignTable}.${key}`
|
|
@@ -1533,15 +1540,17 @@ const nestedUpdate = (state) => {
|
|
|
1533
1540
|
const j = queryJoinTable(state, data);
|
|
1534
1541
|
await pqb._queryDelete(j);
|
|
1535
1542
|
delete j.q[pqb.toSQLCacheKey];
|
|
1536
|
-
|
|
1537
|
-
pqb.
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1543
|
+
if (Array.isArray(params.set) ? params.set.length : orchidCore.objectHasValues(params.set)) {
|
|
1544
|
+
const idsRows = await pqb._queryRows(
|
|
1545
|
+
pqb._querySelect(
|
|
1546
|
+
state.relatedTableQuery.where(
|
|
1547
|
+
conditionsToWhereArg(params.set)
|
|
1548
|
+
),
|
|
1549
|
+
state.throughPrimaryKeys
|
|
1550
|
+
)
|
|
1551
|
+
);
|
|
1552
|
+
await insertToJoinTable(state, j, data, idsRows);
|
|
1553
|
+
}
|
|
1545
1554
|
}
|
|
1546
1555
|
};
|
|
1547
1556
|
};
|
|
@@ -1858,7 +1867,8 @@ const orchidORM = (_a, tables) => {
|
|
|
1858
1867
|
schema: table.schema,
|
|
1859
1868
|
language: table.language,
|
|
1860
1869
|
scopes: table.scopes,
|
|
1861
|
-
softDelete: table.softDelete
|
|
1870
|
+
softDelete: table.softDelete,
|
|
1871
|
+
snakeCase: table.snakeCase
|
|
1862
1872
|
});
|
|
1863
1873
|
if (table.noPrimaryKey)
|
|
1864
1874
|
options2.noPrimaryKey = "ignore";
|
|
@@ -1947,4 +1957,10 @@ Object.keys(pqb).forEach(function (k) {
|
|
|
1947
1957
|
get: function () { return pqb[k]; }
|
|
1948
1958
|
});
|
|
1949
1959
|
});
|
|
1960
|
+
Object.keys(orchidCore).forEach(function (k) {
|
|
1961
|
+
if (k !== 'default' && !exports.hasOwnProperty(k)) Object.defineProperty(exports, k, {
|
|
1962
|
+
enumerable: true,
|
|
1963
|
+
get: function () { return orchidCore[k]; }
|
|
1964
|
+
});
|
|
1965
|
+
});
|
|
1950
1966
|
//# sourceMappingURL=index.js.map
|