bun-query-builder 0.1.40 → 0.1.41
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/bin/cli.js +8 -2
- package/dist/src/index.js +7 -1
- package/package.json +1 -1
package/dist/bin/cli.js
CHANGED
|
@@ -24660,7 +24660,8 @@ class ModelInstance {
|
|
|
24660
24660
|
const attrs = this._definition.attributes;
|
|
24661
24661
|
for (const [key, value] of Object.entries(data)) {
|
|
24662
24662
|
const attr = findAttributeDef(attrs, key);
|
|
24663
|
-
|
|
24663
|
+
const isImplicitForeignKey = !attr && toSnakeCase(key).endsWith("_id");
|
|
24664
|
+
if (attr?.fillable && !attr?.guarded || isImplicitForeignKey) {
|
|
24664
24665
|
if (this._original === null)
|
|
24665
24666
|
this._original = { ...this._attributes };
|
|
24666
24667
|
this._attributes[toSnakeCase(key)] = value;
|
|
@@ -24710,6 +24711,11 @@ class ModelInstance {
|
|
|
24710
24711
|
data[col] = this._attributes[col];
|
|
24711
24712
|
}
|
|
24712
24713
|
}
|
|
24714
|
+
for (const key of Object.keys(this._attributes)) {
|
|
24715
|
+
if (key.endsWith("_id") && key !== pk && !(key in data)) {
|
|
24716
|
+
data[key] = this._attributes[key];
|
|
24717
|
+
}
|
|
24718
|
+
}
|
|
24713
24719
|
if (timestampsEnabled(this._definition)) {
|
|
24714
24720
|
const now = formatNow();
|
|
24715
24721
|
data.created_at = now;
|
|
@@ -30768,7 +30774,7 @@ function getPrefix() {
|
|
|
30768
30774
|
}
|
|
30769
30775
|
var prefix = getPrefix();
|
|
30770
30776
|
// package.json
|
|
30771
|
-
var version2 = "0.1.
|
|
30777
|
+
var version2 = "0.1.41";
|
|
30772
30778
|
|
|
30773
30779
|
// bin/cli.ts
|
|
30774
30780
|
init_actions();
|
package/dist/src/index.js
CHANGED
|
@@ -24660,7 +24660,8 @@ class ModelInstance {
|
|
|
24660
24660
|
const attrs = this._definition.attributes;
|
|
24661
24661
|
for (const [key, value] of Object.entries(data)) {
|
|
24662
24662
|
const attr = findAttributeDef(attrs, key);
|
|
24663
|
-
|
|
24663
|
+
const isImplicitForeignKey = !attr && toSnakeCase(key).endsWith("_id");
|
|
24664
|
+
if (attr?.fillable && !attr?.guarded || isImplicitForeignKey) {
|
|
24664
24665
|
if (this._original === null)
|
|
24665
24666
|
this._original = { ...this._attributes };
|
|
24666
24667
|
this._attributes[toSnakeCase(key)] = value;
|
|
@@ -24710,6 +24711,11 @@ class ModelInstance {
|
|
|
24710
24711
|
data[col] = this._attributes[col];
|
|
24711
24712
|
}
|
|
24712
24713
|
}
|
|
24714
|
+
for (const key of Object.keys(this._attributes)) {
|
|
24715
|
+
if (key.endsWith("_id") && key !== pk && !(key in data)) {
|
|
24716
|
+
data[key] = this._attributes[key];
|
|
24717
|
+
}
|
|
24718
|
+
}
|
|
24713
24719
|
if (timestampsEnabled(this._definition)) {
|
|
24714
24720
|
const now = formatNow();
|
|
24715
24721
|
data.created_at = now;
|
package/package.json
CHANGED