@overmap-ai/core 1.0.81-fix-model-reducers.0 → 1.0.81-fix-model-reducers.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.
@@ -36,8 +36,7 @@ function P(t) {
36
36
  addMany: (l, y) => {
37
37
  for (const A of y.payload) {
38
38
  const g = t(A);
39
- if (g in l.instances) return;
40
- l.instances[g] = A;
39
+ g in l.instances || (l.instances[g] = A);
41
40
  }
42
41
  },
43
42
  updateOne: (l, y) => {
@@ -57,8 +56,7 @@ function P(t) {
57
56
  updateMany: (l, y) => {
58
57
  for (const A of y.payload) {
59
58
  const g = t(A);
60
- if (!(g in l.instances)) return;
61
- l.instances[g] = A;
59
+ g in l.instances && (l.instances[g] = A);
62
60
  }
63
61
  },
64
62
  deleteOne: (l, y) => {
@@ -5040,7 +5038,7 @@ class xw extends v {
5040
5038
  }), [c, p];
5041
5039
  }
5042
5040
  bulkAdd(e, i) {
5043
- const { payloads: n, values: a } = e, { addMany: r, setMany: d, deleteMany: c } = this.actions, p = (/* @__PURE__ */ new Date()).toISOString(), l = [], y = dt(n, Math.min(i ?? n.length, ct)), A = [];
5041
+ const { payloads: n, values: a } = e, { addMany: r, updateMany: d, deleteMany: c } = this.actions, p = (/* @__PURE__ */ new Date()).toISOString(), l = [], y = dt(n, Math.min(i ?? n.length, ct)), A = [];
5044
5042
  for (const b of y) {
5045
5043
  const F = [];
5046
5044
  for (const w of b) {
@@ -7153,7 +7151,7 @@ class dF extends v {
7153
7151
  }
7154
7152
  }
7155
7153
  async refreshStore(e, i) {
7156
- const { setMany: n } = this.actions, r = (await this.listPaginated(
7154
+ const { initialize: n } = this.actions, r = (await this.listPaginated(
7157
7155
  {
7158
7156
  queryParams: {
7159
7157
  issue__project: e
@@ -8114,11 +8112,11 @@ class AF extends v {
8114
8112
  }), [r, d];
8115
8113
  }
8116
8114
  async delete(e) {
8117
- const { deleteOne: i, updateOne: n } = this.actions, { selectById: a } = this.selectors, r = this.select(a(e));
8115
+ const { addOne: i, deleteOne: n } = this.actions, { selectById: a } = this.selectors, r = this.select(a(e));
8118
8116
  if (!r)
8119
8117
  throw new Error(`IssueType with uuid ${e} does not exist in the store.`);
8120
8118
  const d = this.select(km(e));
8121
- this.dispatch(i(e)), this.dispatch(ur(E(d)));
8119
+ this.dispatch(n(e)), this.dispatch(ur(E(d)));
8122
8120
  try {
8123
8121
  return await this.enqueueRequest({
8124
8122
  description: S(u.DELETE, this.name, !1),
@@ -8128,7 +8126,7 @@ class AF extends v {
8128
8126
  blocks: []
8129
8127
  });
8130
8128
  } catch (c) {
8131
- throw this.dispatch(n(r)), this.dispatch(dr(d)), c;
8129
+ throw this.dispatch(i(r)), this.dispatch(dr(d)), c;
8132
8130
  }
8133
8131
  }
8134
8132
  async refreshStore(e, i) {
@@ -9164,7 +9162,7 @@ class EF extends v {
9164
9162
  }), [r, d];
9165
9163
  }
9166
9164
  bulkAdd(e) {
9167
- const { addMany: i, setMany: n, deleteMany: a } = this.actions, r = this.select((l) => {
9165
+ const { addMany: i, updateMany: n, deleteMany: a } = this.actions, r = this.select((l) => {
9168
9166
  var y;
9169
9167
  return ((y = l.userReducer.currentUser) == null ? void 0 : y.id) ?? null;
9170
9168
  }), d = (/* @__PURE__ */ new Date()).toISOString(), c = e.map(
@@ -10055,7 +10053,7 @@ class xF extends v {
10055
10053
  }), [r, d];
10056
10054
  }
10057
10055
  bulkAdd(e) {
10058
- const { addMany: i, setMany: n, deleteMany: a } = this.actions, r = this.select((l) => {
10056
+ const { addMany: i, updateMany: n, deleteMany: a } = this.actions, r = this.select((l) => {
10059
10057
  var y;
10060
10058
  return ((y = l.userReducer.currentUser) == null ? void 0 : y.id) ?? null;
10061
10059
  }), d = (/* @__PURE__ */ new Date()).toISOString(), c = e.map(
@@ -10080,7 +10078,7 @@ class xF extends v {
10080
10078
  return p.then((l) => {
10081
10079
  this.dispatch(n(l));
10082
10080
  }).catch(() => {
10083
- this.dispatch(a(c.map((l) => l.uuid)));
10081
+ this.dispatch(a(E(c)));
10084
10082
  }), [c, p];
10085
10083
  }
10086
10084
  async delete(e) {
@@ -10903,7 +10901,7 @@ class YF extends v {
10903
10901
  }), [r, d];
10904
10902
  }
10905
10903
  bulkAdd(e) {
10906
- const { addMany: i, setMany: n, deleteMany: a } = this.actions, r = this.select((p) => {
10904
+ const { addMany: i, updateMany: n, deleteMany: a } = this.actions, r = this.select((p) => {
10907
10905
  var l;
10908
10906
  return ((l = p.userReducer.currentUser) == null ? void 0 : l.id) ?? null;
10909
10907
  }), d = e.map((p) => T({ ...p, created_by: r }));
@@ -10923,10 +10921,10 @@ class YF extends v {
10923
10921
  }), [d, c];
10924
10922
  }
10925
10923
  async delete(e) {
10926
- const { deleteOne: i, updateOne: n } = this.actions, { selectById: a } = this.selectors, r = this.select(a(e));
10924
+ const { addOne: i, deleteOne: n } = this.actions, { selectById: a } = this.selectors, r = this.select(a(e));
10927
10925
  if (!r)
10928
10926
  throw new Error(`Expected team membership with uuid ${e} to exist`);
10929
- this.dispatch(i(e));
10927
+ this.dispatch(n(e));
10930
10928
  try {
10931
10929
  return await this.enqueueRequest({
10932
10930
  description: S(u.DELETE, this.name, !1),
@@ -10936,7 +10934,7 @@ class YF extends v {
10936
10934
  blocks: [e]
10937
10935
  });
10938
10936
  } catch (d) {
10939
- throw this.dispatch(n(r)), d;
10937
+ throw this.dispatch(i(r)), d;
10940
10938
  }
10941
10939
  }
10942
10940
  async refreshStore(e, i) {
@@ -11020,10 +11018,10 @@ class JF extends v {
11020
11018
  }), [r, d];
11021
11019
  }
11022
11020
  async delete(e) {
11023
- const { deleteOne: i, updateOne: n } = this.actions, { selectById: a } = this.selectors, r = this.select(a(e));
11021
+ const { addOne: i, deleteOne: n } = this.actions, { selectById: a } = this.selectors, r = this.select(a(e));
11024
11022
  if (!r)
11025
11023
  throw new Error(`Expected team with uuid ${e} to exist`);
11026
- this.dispatch(i(e));
11024
+ this.dispatch(n(e));
11027
11025
  try {
11028
11026
  return await this.enqueueRequest({
11029
11027
  description: S(u.DELETE, this.name, !1),
@@ -11033,7 +11031,7 @@ class JF extends v {
11033
11031
  blocks: [e]
11034
11032
  });
11035
11033
  } catch (d) {
11036
- throw this.dispatch(n(r)), d;
11034
+ throw this.dispatch(i(r)), d;
11037
11035
  }
11038
11036
  }
11039
11037
  async refreshStore(e, i) {