interaqt 0.8.13 → 0.8.14

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.js CHANGED
@@ -3971,19 +3971,26 @@ class De {
3971
3971
  */
3972
3972
  async preprocessSameRowData(t, e = !1, i, r) {
3973
3973
  const s = t.getData();
3974
- !e && !s.id ? s.id = await this.database.getAutoId(t.recordName) : e && !s.id && (s.id = r.id), e ? t.valueAttributes.length && i?.push({
3975
- type: "update",
3976
- recordName: t.recordName,
3977
- record: { ...t.getData(), id: r.id },
3978
- oldRecord: r
3979
- }) : i?.push({
3980
- type: "create",
3981
- recordName: t.recordName,
3982
- record: {
3983
- ...t.defaultValues,
3984
- ...s
3985
- }
3986
- });
3974
+ if (!e && !s.id ? s.id = await this.database.getAutoId(t.recordName) : e && !s.id && (s.id = r.id), !e)
3975
+ i?.push({
3976
+ type: "create",
3977
+ recordName: t.recordName,
3978
+ record: {
3979
+ ...t.defaultValues,
3980
+ ...s
3981
+ }
3982
+ });
3983
+ else if (t.valueAttributes.length) {
3984
+ const n = t.getSameRowFieldAndValue(r), c = this.map.getRecordInfo(t.recordName), l = new Set(c.valueAttributes.map((h) => h.attributeName)), d = { ...t.getData() };
3985
+ n.forEach((h) => {
3986
+ l.has(h.name) && (d[h.name] = h.value);
3987
+ }), i?.push({
3988
+ type: "update",
3989
+ recordName: t.recordName,
3990
+ record: { ...d, id: r.id },
3991
+ oldRecord: r
3992
+ });
3993
+ }
3987
3994
  for (let n of t.combinedNewRecords)
3988
3995
  s[n.info.attributeName] = {
3989
3996
  ...s[n.info.attributeName],
@@ -5223,12 +5230,17 @@ class Je {
5223
5230
  if (!e)
5224
5231
  return this.creationExecutor.preprocessSameRowData(t, e, i, r);
5225
5232
  const s = t.getData();
5226
- e && !s.id && (s.id = r.id), t.valueAttributes.length && i?.push({
5227
- type: "update",
5228
- recordName: t.recordName,
5229
- record: { ...t.getData(), id: r.id },
5230
- oldRecord: r
5231
- });
5233
+ if (e && !s.id && (s.id = r.id), t.valueAttributes.length) {
5234
+ const n = t.getSameRowFieldAndValue(r), c = this.map.getRecordInfo(t.recordName), l = new Set(c.valueAttributes.map((h) => h.attributeName)), d = { ...t.getData() };
5235
+ n.forEach((h) => {
5236
+ l.has(h.name) && (d[h.name] = h.value);
5237
+ }), i?.push({
5238
+ type: "update",
5239
+ recordName: t.recordName,
5240
+ record: { ...d, id: r.id },
5241
+ oldRecord: r
5242
+ });
5243
+ }
5232
5244
  for (let n of t.combinedNewRecords)
5233
5245
  s[n.info.attributeName] = {
5234
5246
  ...s[n.info.attributeName],
@@ -7649,7 +7661,9 @@ class Ai {
7649
7661
  void 0,
7650
7662
  this.relationAttributeQuery
7651
7663
  ))[this.isSource ? "target" : "source"];
7652
- c["&"] = o, !!this.callback.call(this.controller, c, r) ? (await this.state.isItemMatchCount.set(o, !0), a = a + 1) : await this.state.isItemMatchCount.set(o, !1);
7664
+ c["&"] = o;
7665
+ const l = !!this.callback.call(this.controller, c, r), d = await this.state.isItemMatchCount.get(o);
7666
+ l && !d && (a = a + 1), await this.state.isItemMatchCount.set(o, l);
7653
7667
  } else
7654
7668
  a = a + 1;
7655
7669
  else if (s.type === "delete" && s.recordName === this.relation.name)