pqb 0.5.1 → 0.5.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.esm.js +7 -4
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +7 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/queryMethods/create.ts +13 -4
- package/src/queryMethods/update.ts +19 -0
package/dist/index.js
CHANGED
|
@@ -4206,13 +4206,13 @@ const processCreateItem = (item, rowIndex, ctx, columns, encoders, columnsMap, s
|
|
|
4206
4206
|
item[key]
|
|
4207
4207
|
]);
|
|
4208
4208
|
} else {
|
|
4209
|
+
const value = item[key];
|
|
4210
|
+
if ((!value.create || Array.isArray(value.create) && value.create.length === 0) && (!value.connect || Array.isArray(value.connect) && value.connect.length === 0) && (!value.connectOrCreate || Array.isArray(value.connectOrCreate) && value.connectOrCreate.length === 0))
|
|
4211
|
+
return;
|
|
4209
4212
|
ctx.requiredReturning[ctx.relations[key].primaryKey] = true;
|
|
4210
4213
|
if (!ctx.appendRelations[key])
|
|
4211
4214
|
ctx.appendRelations[key] = [];
|
|
4212
|
-
ctx.appendRelations[key].push([
|
|
4213
|
-
rowIndex,
|
|
4214
|
-
item[key]
|
|
4215
|
-
]);
|
|
4215
|
+
ctx.appendRelations[key].push([rowIndex, value]);
|
|
4216
4216
|
}
|
|
4217
4217
|
} else if (columnsMap[key] === void 0 && (shape[key] || shape === anyShape)) {
|
|
4218
4218
|
columnsMap[key] = columns.length;
|
|
@@ -5155,6 +5155,9 @@ class Update {
|
|
|
5155
5155
|
if (relations[key].type === "belongsTo") {
|
|
5156
5156
|
prependRelations[key] = data[key];
|
|
5157
5157
|
} else {
|
|
5158
|
+
const value = data[key];
|
|
5159
|
+
if (!value.set && !("upsert" in value) && (!value.disconnect || Array.isArray(value.disconnect) && value.disconnect.length === 0) && (!value.delete || Array.isArray(value.delete) && value.delete.length === 0) && (!value.update || Array.isArray(value.update.where) && value.update.where.length === 0) && (!value.create || Array.isArray(value.create) && value.create.length === 0))
|
|
5160
|
+
continue;
|
|
5158
5161
|
if (!((_a = query.select) == null ? void 0 : _a.includes("*"))) {
|
|
5159
5162
|
const primaryKey = relations[key].primaryKey;
|
|
5160
5163
|
if (!((_b = query.select) == null ? void 0 : _b.includes(primaryKey))) {
|