@overmap-ai/core 1.1.0 → 1.1.1-allauth-2.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.
@@ -3,7 +3,7 @@ var Za = (t, s, e) => s in t ? Ja(t, s, { enumerable: !0, configurable: !0, writ
3
3
  var u = (t, s, e) => Za(t, typeof s != "symbol" ? s + "" : s, e);
4
4
  import "@redux-offline/redux-offline/lib/types";
5
5
  import { createAction as Kt, createSelector as p, createSlice as P, isAnyOf as M, combineReducers as Li } from "@reduxjs/toolkit";
6
- import pt from "superagent";
6
+ import ht from "superagent";
7
7
  import { v4 as ut } from "uuid";
8
8
  import { useMemo as Xa } from "react";
9
9
  import Qa from "fast-tree-builder";
@@ -279,7 +279,7 @@ function E(t) {
279
279
  function Rc(t, s) {
280
280
  return t.localeCompare(s);
281
281
  }
282
- function yt(t, s) {
282
+ function mt(t, s) {
283
283
  return Rc(t.uuid, s.uuid);
284
284
  }
285
285
  function bM(t, s = void 0, e = 255) {
@@ -1432,11 +1432,11 @@ const m = (
1432
1432
  setFormSubmission: Zh,
1433
1433
  setFormSubmissions: Xh,
1434
1434
  addFormSubmission: Qh,
1435
- addFormSubmissions: ft,
1435
+ addFormSubmissions: yt,
1436
1436
  updateFormSubmission: ep,
1437
1437
  updateFormSubmissions: tp,
1438
1438
  deleteFormSubmission: sp,
1439
- deleteFormSubmissions: St
1439
+ deleteFormSubmissions: ft
1440
1440
  } = Kn.actions, ip = (t) => t.formSubmissionReducer.instances, G = p(
1441
1441
  [ip],
1442
1442
  (t) => Object.values(t)
@@ -2739,27 +2739,27 @@ const m = (
2739
2739
  updateProcedures: wO,
2740
2740
  deleteProcedure: FO,
2741
2741
  deleteProcedures: Ft
2742
- } = Xr.actions, RO = Xr.reducer, EO = (t) => t.procedureReducer.instances, At = p(
2742
+ } = Xr.actions, RO = Xr.reducer, EO = (t) => t.procedureReducer.instances, St = p(
2743
2743
  [EO],
2744
2744
  (t) => Object.values(t)
2745
2745
  ), vO = (t) => (s) => s.procedureReducer.instances[t], BO = m(
2746
- p([At, (t, s) => s], (t, s) => {
2746
+ p([St, (t, s) => s], (t, s) => {
2747
2747
  const e = new Set(s);
2748
2748
  return f(t.filter(({ uuid: i }) => e.has(i)));
2749
2749
  })
2750
2750
  ), Gg = m(
2751
- p([At, (t, s) => s], (t, s) => f(t.filter((e) => e.project === s)))
2751
+ p([St, (t, s) => s], (t, s) => f(t.filter((e) => e.project === s)))
2752
2752
  ), kO = m(
2753
- p([At, (t, s) => s], (t, s) => f(t.filter((e) => e.procedure_type === s)))
2753
+ p([St, (t, s) => s], (t, s) => f(t.filter((e) => e.procedure_type === s)))
2754
2754
  ), zO = m(
2755
- p([At, (t, s) => s], (t, s) => f(t.filter((e) => e.asset === s)))
2755
+ p([St, (t, s) => s], (t, s) => f(t.filter((e) => e.asset === s)))
2756
2756
  ), DO = m(
2757
- p([At, (t, s) => s], (t, s) => {
2757
+ p([St, (t, s) => s], (t, s) => {
2758
2758
  const e = new Set(s);
2759
2759
  return f(t.filter(({ asset: i }) => e.has(i)));
2760
2760
  })
2761
2761
  ), qO = m(
2762
- p([At, (t, s) => s], (t, s) => f(t.filter((e) => e.procedure_initiative === s)))
2762
+ p([St, (t, s) => s], (t, s) => f(t.filter((e) => e.procedure_initiative === s)))
2763
2763
  ), Ne = b((t) => t.uuid), Ii = {
2764
2764
  instances: {}
2765
2765
  }, Qr = P({
@@ -3188,19 +3188,19 @@ const m = (
3188
3188
  updateProcedureStepFieldValuesMany: qI,
3189
3189
  deleteProcedureStepFieldValues: jI,
3190
3190
  deleteProcedureStepFieldValuesMany: $I
3191
- } = fa.actions, VI = fa.reducer, xI = (t) => t.procedureStepFieldValuesReducer.instances, Ot = p(
3191
+ } = fa.actions, VI = fa.reducer, xI = (t) => t.procedureStepFieldValuesReducer.instances, At = p(
3192
3192
  [xI],
3193
3193
  (t) => Object.values(t)
3194
3194
  ), cw = m(
3195
- p([Ot, (t, s) => s], (t, s) => f(t.filter((e) => e.procedure === s)))
3195
+ p([At, (t, s) => s], (t, s) => f(t.filter((e) => e.procedure === s)))
3196
3196
  ), dw = m(
3197
3197
  p(
3198
- [Ot, (t, s) => s],
3198
+ [At, (t, s) => s],
3199
3199
  (t, s) => f(t.filter((e) => e.procedure_step === s))
3200
3200
  )
3201
3201
  ), CI = (t) => (s) => s.procedureStepFieldValuesReducer.instances[t], UI = m(
3202
3202
  p(
3203
- [Ot, (t, s) => s],
3203
+ [At, (t, s) => s],
3204
3204
  (t, s) => {
3205
3205
  const e = new Set(s);
3206
3206
  return f(t.filter(({ uuid: i }) => e.has(i)));
@@ -3209,7 +3209,7 @@ const m = (
3209
3209
  ), ow = m(
3210
3210
  p(
3211
3211
  [
3212
- Ot,
3212
+ At,
3213
3213
  (t, s) => s,
3214
3214
  (t, s, e) => e
3215
3215
  ],
@@ -3249,12 +3249,12 @@ const m = (
3249
3249
  updateProcedureStepFieldValuesReviews: KI,
3250
3250
  deleteProcedureStepFieldValuesReview: YI,
3251
3251
  deleteProcedureStepFieldValuesReviews: Oa
3252
- } = Sa.actions, JI = (t) => t.procedureStepFieldValuesReviewReducer.instances, Tt = p(
3252
+ } = Sa.actions, JI = (t) => t.procedureStepFieldValuesReviewReducer.instances, Ot = p(
3253
3253
  [JI],
3254
3254
  (t) => Object.values(t)
3255
3255
  ), ZI = (t) => (s) => s.procedureStepFieldValuesReviewReducer.instances[t], XI = m(
3256
3256
  p(
3257
- [Tt, (t, s) => s],
3257
+ [Ot, (t, s) => s],
3258
3258
  (t, s) => {
3259
3259
  const e = new Set(s);
3260
3260
  return f(t.filter(({ uuid: i }) => e.has(i)));
@@ -3262,12 +3262,12 @@ const m = (
3262
3262
  )
3263
3263
  ), QI = m(
3264
3264
  p(
3265
- [Tt, (t, s) => s],
3265
+ [Ot, (t, s) => s],
3266
3266
  (t, s) => f(t.filter((e) => e.field_values === s))
3267
3267
  )
3268
3268
  ), uw = m(
3269
3269
  p(
3270
- [Tt, (t, s) => s],
3270
+ [Ot, (t, s) => s],
3271
3271
  (t, s) => {
3272
3272
  let e;
3273
3273
  for (const i of t) {
@@ -3280,8 +3280,8 @@ const m = (
3280
3280
  ), lw = m(
3281
3281
  p(
3282
3282
  [
3283
+ At,
3283
3284
  Ot,
3284
- Tt,
3285
3285
  (t, s) => s
3286
3286
  ],
3287
3287
  (t, s, e) => {
@@ -3298,8 +3298,8 @@ const m = (
3298
3298
  ), hw = m(
3299
3299
  p(
3300
3300
  [
3301
+ At,
3301
3302
  Ot,
3302
- Tt,
3303
3303
  (t, s) => s,
3304
3304
  (t, s, e) => e
3305
3305
  ],
@@ -3318,7 +3318,7 @@ const m = (
3318
3318
  );
3319
3319
  }
3320
3320
  )
3321
- ), pw = p([Tt], (t) => {
3321
+ ), pw = p([Ot], (t) => {
3322
3322
  const s = {};
3323
3323
  for (const e of t) {
3324
3324
  const { field_values: i } = e, n = s[i];
@@ -3903,10 +3903,10 @@ const M_ = (t) => {
3903
3903
  const s = Bt();
3904
3904
  s ? s.dispatch({ type: "rehydrated/setRehydrated", payload: !0 }) : console.error("Client store not set");
3905
3905
  }, g_ = (t, s, e) => {
3906
- const i = mt();
3906
+ const i = pt();
3907
3907
  return i ? (i.addRequest(s), i.getQueue()) : (console.warn("Outbox coordinator not set; cannot enqueue request yet."), []);
3908
3908
  }, w_ = (t, s, e) => {
3909
- const i = mt();
3909
+ const i = pt();
3910
3910
  if (!i)
3911
3911
  return console.warn("Outbox coordinator not set; cannot dequeue request yet."), [];
3912
3912
  const a = s.meta.offlineAction.payload.uuid;
@@ -3975,7 +3975,7 @@ Retries:`,
3975
3975
  const i = Bt(), a = i.getState().outboxReducer.deletedRequests, r = s.payload.uuid;
3976
3976
  function d() {
3977
3977
  i.dispatch(YS(r));
3978
- const l = mt();
3978
+ const l = pt();
3979
3979
  if (!l)
3980
3980
  throw new Error("Outbox coordinator not set");
3981
3981
  l.remove(s.payload.uuid);
@@ -3984,24 +3984,24 @@ Retries:`,
3984
3984
  }
3985
3985
  if (t instanceof U && t.options.discard && (console.debug("Discarding request due to explicit discard:", s.payload.url), d()), a.includes(r) && (console.debug("Discarding request due to deletion:", s.payload.url), d()), t instanceof U) {
3986
3986
  const l = t.status || ((h = t.response) == null ? void 0 : h.status);
3987
- if (l || console.warn("Error has no status code:", t), l !== void 0 && Ua.includes(l)) {
3987
+ if (l || console.warn("Error has no status code:", t), t.options.discard !== !1 && l !== void 0 && Ua.includes(l)) {
3988
3988
  console.warn("Discarding request due to error:", t, `
3989
3989
  Action:`, s);
3990
- const y = mt();
3990
+ const y = pt();
3991
3991
  if (!y)
3992
3992
  throw new Error("Outbox coordinator not set");
3993
3993
  y.remove(s.payload.uuid), t.options.discard = !0, d();
3994
3994
  }
3995
3995
  }
3996
3996
  console.debug("Registering a retry for request:", s.payload.uuid);
3997
- const c = mt();
3997
+ const c = pt();
3998
3998
  if (!c)
3999
3999
  throw new Error("Outbox coordinator not set");
4000
4000
  return c.registerRetry(s.payload.uuid), !1;
4001
4001
  }
4002
4002
  function B_(t, s, e) {
4003
4003
  var i;
4004
- return (i = mt()) == null ? void 0 : i.peek();
4004
+ return (i = pt()) == null ? void 0 : i.peek();
4005
4005
  }
4006
4006
  function k_(t, s) {
4007
4007
  return Bt().dispatch(JS((/* @__PURE__ */ new Date()).getTime())), cc;
@@ -4038,7 +4038,7 @@ class U extends Error {
4038
4038
  u(this, "message");
4039
4039
  u(this, "options");
4040
4040
  const { response: i, innerError: n } = e;
4041
- this.message = e.message ?? D_(i, n) ?? Rt, this.status = (i == null ? void 0 : i.status) ?? 0, this.response = i, e.discard = e.discard ?? !1, this.options = e;
4041
+ this.message = e.message ?? D_(i, n) ?? Rt, this.status = (i == null ? void 0 : i.status) ?? 0, this.response = i, this.options = e;
4042
4042
  }
4043
4043
  }
4044
4044
  function q_(t) {
@@ -4056,15 +4056,44 @@ class j_ extends Na {
4056
4056
  constructor(s) {
4057
4057
  super(s);
4058
4058
  }
4059
+ /**
4060
+ * Attaches this service's credentials to an outgoing request, and is the only place `performRequest` authenticates.
4061
+ *
4062
+ * A bearer token is a header and nothing else, so the default implementation just sets `Authorization` from
4063
+ * `getAuthHeader()`. A cookie-based scheme has no header to return: it needs `withCredentials()` on the request
4064
+ * itself, which a `getAuthHeader()` return value cannot express. Overriding this is how such a service reaches the
4065
+ * request at all.
4066
+ *
4067
+ * NOTE: The empty-header guard is not just tidiness. Sending `Authorization:` with an empty value still counts as a
4068
+ * non-simple header, so the browser would preflight every request to carry nothing.
4069
+ * @param request The request about to be sent.
4070
+ * @returns The request, with credentials attached.
4071
+ */
4072
+ applyAuth(s) {
4073
+ const e = this.getAuthHeader();
4074
+ return e ? s.set("Authorization", e) : s;
4075
+ }
4076
+ /**
4077
+ * Whether `response` means "you are not authenticated", as opposed to any other failure.
4078
+ *
4079
+ * Only responses this returns true for are routed to `handleUnauthorized`. A bearer token can only ever fail with a
4080
+ * 401, but a session-based service also has to recognise the 403 that Django's CSRF check produces, which is
4081
+ * otherwise indistinguishable from a genuine permission denial.
4082
+ * @param response The failing response.
4083
+ * @returns Whether the request failed because it was not authenticated.
4084
+ */
4085
+ isAuthFailure(s) {
4086
+ return s.status === 401;
4087
+ }
4059
4088
  }
4060
- class It extends Na {
4089
+ class Tt extends Na {
4061
4090
  constructor(e, i) {
4062
4091
  super(e);
4063
4092
  u(this, "auth");
4064
4093
  this.auth = i;
4065
4094
  }
4066
4095
  }
4067
- class kw extends It {
4096
+ class kw extends Tt {
4068
4097
  async startConversation(s, e) {
4069
4098
  return this.enqueueRequest({
4070
4099
  description: "Start agent conversation",
@@ -4164,7 +4193,7 @@ function R(t) {
4164
4193
  e in s && delete s[e];
4165
4194
  return s;
4166
4195
  }
4167
- class B extends It {
4196
+ class B extends Tt {
4168
4197
  async get(s, e) {
4169
4198
  return this.performRequest(
4170
4199
  {
@@ -4257,29 +4286,29 @@ class j extends B {
4257
4286
  for (const A of h) {
4258
4287
  const F = [], w = {}, v = [], k = [];
4259
4288
  for (const D of A) {
4260
- let V;
4289
+ let $;
4261
4290
  if ("file" in D) {
4262
- const { file: lt, ...Ya } = D, ht = await this.client.files.getFilePayload(lt);
4263
- ht.sha1 in w || (w[ht.sha1] = ht);
4264
- const As = URL.createObjectURL(lt);
4265
- c.add(As), V = {
4291
+ const { file: Pt, ...Ya } = D, lt = await this.client.files.getFilePayload(Pt);
4292
+ lt.sha1 in w || (w[lt.sha1] = lt);
4293
+ const As = URL.createObjectURL(Pt);
4294
+ c.add(As), $ = {
4266
4295
  ...Ya,
4267
- file_sha1: ht.sha1,
4268
- file_type: ht.file_type,
4269
- file_name: lt.name,
4270
- file_extension: ht.extension,
4296
+ file_sha1: lt.sha1,
4297
+ file_type: lt.file_type,
4298
+ file_name: Pt.name,
4299
+ file_extension: lt.extension,
4271
4300
  object_url: As
4272
4301
  };
4273
4302
  } else
4274
- V = D;
4275
- const x = this.buildModel(V);
4276
- d.push(x);
4277
- const kt = this.buildBulkPayload(x);
4303
+ $ = D;
4304
+ const L = this.buildModel($);
4305
+ d.push(L);
4306
+ const kt = this.buildBulkPayload(L);
4278
4307
  F.push(kt);
4279
- const $ = this.getBlockers(x);
4280
- v.push(...$);
4281
- const L = this.getBlocks(x);
4282
- k.push(...L);
4308
+ const V = this.getBlockers(L);
4309
+ v.push(...V);
4310
+ const x = this.getBlocks(L);
4311
+ k.push(...x);
4283
4312
  }
4284
4313
  const q = {
4285
4314
  payloads: F,
@@ -4590,7 +4619,7 @@ class qw extends B {
4590
4619
  const { addOne: i, deleteOne: n } = this.actions, { selectById: a } = this.selectors, r = this.select(a(e));
4591
4620
  if (!r) throw new Error(`No asset with uuid ${e} found in the store`);
4592
4621
  const d = this.select(Yc(e)), c = this.select(cd(e)), h = this.select(jp(e)), l = this.select(zO(e)), y = this.select(op(e));
4593
- this.dispatch(n(e)), this.dispatch(Xi(E(d))), this.dispatch(Wt(E(c))), this.dispatch(gt(E(h))), this.dispatch(Ft(E(l))), this.dispatch(St(E(y)));
4622
+ this.dispatch(n(e)), this.dispatch(Xi(E(d))), this.dispatch(Wt(E(c))), this.dispatch(gt(E(h))), this.dispatch(Ft(E(l))), this.dispatch(ft(E(y)));
4594
4623
  try {
4595
4624
  return await this.enqueueRequest({
4596
4625
  description: S(o.DELETE, this.name, !1),
@@ -4600,7 +4629,7 @@ class qw extends B {
4600
4629
  blocks: []
4601
4630
  });
4602
4631
  } catch (O) {
4603
- throw this.dispatch(i(r)), this.dispatch(Zi(d)), this.dispatch(Gt(c)), this.dispatch(Mt(h)), this.dispatch(wt(l)), this.dispatch(ft(y)), O;
4632
+ throw this.dispatch(i(r)), this.dispatch(Zi(d)), this.dispatch(Gt(c)), this.dispatch(Mt(h)), this.dispatch(wt(l)), this.dispatch(yt(y)), O;
4604
4633
  }
4605
4634
  }
4606
4635
  bulkAdd(e, i) {
@@ -4643,7 +4672,7 @@ class qw extends B {
4643
4672
  throw new Error(
4644
4673
  `Attempting to bulk update ${r.length - d.length} assets that dont exist in the store`
4645
4674
  );
4646
- const c = d.toSorted(yt), h = e.toSorted(yt), l = [];
4675
+ const c = d.toSorted(mt), h = e.toSorted(mt), l = [];
4647
4676
  for (let A = 0; A < r.length; A++)
4648
4677
  l.push({
4649
4678
  ...c[A],
@@ -4673,7 +4702,7 @@ class qw extends B {
4673
4702
  }
4674
4703
  async bulkDelete(e) {
4675
4704
  const { addMany: i, deleteMany: n } = this.actions, { selectByIds: a } = this.selectors, r = this.select(a(e)), d = this.select(dd(e)), c = this.select($p(e)), h = this.select(DO(e)), l = this.select(up(e));
4676
- this.dispatch(n(e)), this.dispatch(Wt(E(d))), this.dispatch(gt(E(c))), this.dispatch(Ft(E(h))), this.dispatch(St(E(l)));
4705
+ this.dispatch(n(e)), this.dispatch(Wt(E(d))), this.dispatch(gt(E(c))), this.dispatch(Ft(E(h))), this.dispatch(ft(E(l)));
4677
4706
  try {
4678
4707
  return await this.enqueueRequest({
4679
4708
  description: S(o.DELETE, this.name, !0),
@@ -4684,7 +4713,7 @@ class qw extends B {
4684
4713
  blocks: []
4685
4714
  });
4686
4715
  } catch (y) {
4687
- throw this.dispatch(i(r)), this.dispatch(Gt(d)), this.dispatch(Mt(c)), this.dispatch(wt(h)), this.dispatch(ft(l)), y;
4716
+ throw this.dispatch(i(r)), this.dispatch(Gt(d)), this.dispatch(Mt(c)), this.dispatch(wt(h)), this.dispatch(yt(l)), y;
4688
4717
  }
4689
4718
  }
4690
4719
  async refreshStore(e, i) {
@@ -5301,13 +5330,13 @@ class Lw extends B {
5301
5330
  created_by: c
5302
5331
  });
5303
5332
  y.push(D);
5304
- const V = {
5333
+ const $ = {
5305
5334
  uuid: D.uuid,
5306
5335
  asset: D.asset,
5307
5336
  asset_type_identifier: D.asset_type_identifier,
5308
5337
  value: D.value
5309
5338
  };
5310
- F.push(V), w.push(D.asset), w.push(D.asset_type_identifier), v.push(D.uuid);
5339
+ F.push($), w.push(D.asset), w.push(D.asset_type_identifier), v.push(D.uuid);
5311
5340
  }
5312
5341
  const k = {
5313
5342
  payloads: F,
@@ -5771,7 +5800,7 @@ class Ww extends B {
5771
5800
  return this.dispatch(n(c)), c;
5772
5801
  }
5773
5802
  }
5774
- class Pt extends It {
5803
+ class It extends Tt {
5775
5804
  async get(s, e) {
5776
5805
  return this.performRequest(
5777
5806
  {
@@ -5798,7 +5827,7 @@ class Pt extends It {
5798
5827
  );
5799
5828
  }
5800
5829
  }
5801
- class Kw extends Pt {
5830
+ class Kw extends It {
5802
5831
  constructor() {
5803
5832
  super(...arguments);
5804
5833
  u(this, "name", "Email Domains");
@@ -5856,7 +5885,7 @@ class Kw extends Pt {
5856
5885
  return this.dispatch(n(a)), a;
5857
5886
  }
5858
5887
  }
5859
- class Yw extends It {
5888
+ class Yw extends Tt {
5860
5889
  async getVerificationCode(s) {
5861
5890
  return this.enqueueRequest({
5862
5891
  description: "Get verification code",
@@ -5880,7 +5909,7 @@ class Yw extends It {
5880
5909
  }
5881
5910
  }
5882
5911
  const bt = {}, Ut = /* @__PURE__ */ new Set(), Lt = /* @__PURE__ */ new Set();
5883
- class Jw extends It {
5912
+ class Jw extends Tt {
5884
5913
  constructor() {
5885
5914
  super(...arguments);
5886
5915
  u(this, "host");
@@ -6406,7 +6435,7 @@ class tF extends B {
6406
6435
  if (!r)
6407
6436
  throw new Error("Expected form to exist");
6408
6437
  const d = this.select(ap(e)), c = this.select(hh(e)), h = this.select(_h(e));
6409
- this.dispatch(i(e)), this.dispatch(St(E(d))), this.dispatch(qn(E(c))), this.dispatch(Vn(E(h)));
6438
+ this.dispatch(i(e)), this.dispatch(ft(E(d))), this.dispatch(qn(E(c))), this.dispatch(Vn(E(h)));
6410
6439
  try {
6411
6440
  return await this.enqueueRequest({
6412
6441
  description: S(o.DELETE, this.name, !1),
@@ -6416,7 +6445,7 @@ class tF extends B {
6416
6445
  blocks: []
6417
6446
  });
6418
6447
  } catch (l) {
6419
- throw this.dispatch(n(r)), this.dispatch(Dn(c)), this.dispatch(ft(d)), this.dispatch($n(h)), l;
6448
+ throw this.dispatch(n(r)), this.dispatch(Dn(c)), this.dispatch(yt(d)), this.dispatch($n(h)), l;
6420
6449
  }
6421
6450
  }
6422
6451
  async refreshStore(e, i) {
@@ -6618,13 +6647,13 @@ class nF extends B {
6618
6647
  u(this, "url", "/form-submissions");
6619
6648
  u(this, "actions", {
6620
6649
  addOne: Qh,
6621
- addMany: ft,
6650
+ addMany: yt,
6622
6651
  setOne: Zh,
6623
6652
  setMany: Xh,
6624
6653
  updateOne: ep,
6625
6654
  updateMany: tp,
6626
6655
  deleteOne: sp,
6627
- deleteMany: St,
6656
+ deleteMany: ft,
6628
6657
  initialize: Jh
6629
6658
  });
6630
6659
  u(this, "selectors", {
@@ -7302,7 +7331,7 @@ class uF extends B {
7302
7331
  throw new Error(
7303
7332
  `Attempting to bulk update ${r.length - d.length} issues that dont exist in the store`
7304
7333
  );
7305
- const c = d.toSorted(yt), h = e.toSorted(yt), l = [];
7334
+ const c = d.toSorted(mt), h = e.toSorted(mt), l = [];
7306
7335
  for (let A = 0; A < r.length; A++)
7307
7336
  l.push({
7308
7337
  ...c[A],
@@ -7335,7 +7364,7 @@ class uF extends B {
7335
7364
  if (!r)
7336
7365
  throw new Error(`No issue with uuid ${e} found in the store`);
7337
7366
  const d = this.select(qp(e)), c = this.select(Kp(e)), h = this.select(dS(e)), l = this.select(cp(e));
7338
- this.dispatch(i(e)), this.dispatch(er(E(c))), this.dispatch(zr(E(h))), this.dispatch(gt(E(d))), this.dispatch(St(E(l)));
7367
+ this.dispatch(i(e)), this.dispatch(er(E(c))), this.dispatch(zr(E(h))), this.dispatch(gt(E(d))), this.dispatch(ft(E(l)));
7339
7368
  try {
7340
7369
  return await this.enqueueRequest({
7341
7370
  description: S(o.DELETE, this.name, !1),
@@ -7345,12 +7374,12 @@ class uF extends B {
7345
7374
  blocks: []
7346
7375
  });
7347
7376
  } catch (y) {
7348
- throw this.dispatch(n(r)), this.dispatch(Qn(c)), this.dispatch(Br(h)), this.dispatch(Mt(d)), this.dispatch(ft(l)), y;
7377
+ throw this.dispatch(n(r)), this.dispatch(Qn(c)), this.dispatch(Br(h)), this.dispatch(Mt(d)), this.dispatch(yt(l)), y;
7349
7378
  }
7350
7379
  }
7351
7380
  async bulkDelete(e) {
7352
7381
  const { addMany: i, deleteMany: n } = this.actions, { selectByIds: a } = this.selectors, r = this.select(a(e)), d = this.select(Dp(e)), c = this.select(dp(e));
7353
- this.dispatch(n(e)), this.dispatch(gt(E(d))), this.dispatch(St(E(c)));
7382
+ this.dispatch(n(e)), this.dispatch(gt(E(d))), this.dispatch(ft(E(c)));
7354
7383
  try {
7355
7384
  return await this.enqueueRequest({
7356
7385
  description: S(o.DELETE, this.name, !0),
@@ -7361,7 +7390,7 @@ class uF extends B {
7361
7390
  blocks: []
7362
7391
  });
7363
7392
  } catch (h) {
7364
- throw this.dispatch(i(r)), this.dispatch(Mt(d)), this.dispatch(ft(c)), h;
7393
+ throw this.dispatch(i(r)), this.dispatch(Mt(d)), this.dispatch(yt(c)), h;
7365
7394
  }
7366
7395
  }
7367
7396
  async refreshStore(e, i) {
@@ -8382,7 +8411,7 @@ class PF extends j_ {
8382
8411
  });
8383
8412
  }
8384
8413
  }
8385
- class bF extends Pt {
8414
+ class bF extends It {
8386
8415
  constructor() {
8387
8416
  super(...arguments);
8388
8417
  u(this, "name", "Organization Access");
@@ -8451,7 +8480,7 @@ class bF extends Pt {
8451
8480
  return this.dispatch(n(a)), a;
8452
8481
  }
8453
8482
  }
8454
- class _F extends Pt {
8483
+ class _F extends It {
8455
8484
  constructor() {
8456
8485
  super(...arguments);
8457
8486
  u(this, "name", "Organization");
@@ -8887,7 +8916,7 @@ class FF extends j {
8887
8916
  return this.dispatch(n(r)), r;
8888
8917
  }
8889
8918
  }
8890
- class RF extends Pt {
8919
+ class RF extends It {
8891
8920
  constructor() {
8892
8921
  super(...arguments);
8893
8922
  u(this, "name", "Project");
@@ -9002,17 +9031,17 @@ class EF extends B {
9002
9031
  for (const F of y) {
9003
9032
  const w = [], v = [], k = [];
9004
9033
  for (const D of F) {
9005
- const V = I({
9034
+ const $ = I({
9006
9035
  ...D,
9007
9036
  submitted_at: c,
9008
9037
  created_by: h
9009
9038
  });
9010
- l.push(V), w.push(R(V)), v.push(
9011
- V.procedure_type,
9012
- V.project,
9013
- V.asset,
9014
- ...V.procedure_initiative ? [V.procedure_initiative] : []
9015
- ), k.push(V.uuid);
9039
+ l.push($), w.push(R($)), v.push(
9040
+ $.procedure_type,
9041
+ $.project,
9042
+ $.asset,
9043
+ ...$.procedure_initiative ? [$.procedure_initiative] : []
9044
+ ), k.push($.uuid);
9016
9045
  }
9017
9046
  const q = {
9018
9047
  payload: {
@@ -9477,7 +9506,7 @@ class zF extends B {
9477
9506
  return this.dispatch(n(a)), a;
9478
9507
  }
9479
9508
  }
9480
- class DF extends Pt {
9509
+ class DF extends It {
9481
9510
  constructor() {
9482
9511
  super(...arguments);
9483
9512
  u(this, "name", "Procedure Step Event");
@@ -10308,7 +10337,7 @@ class LF extends B {
10308
10337
  throw new Error(
10309
10338
  `Attempting to bulk update ${r.length - d.length} ${this.name} that dont exist in the store`
10310
10339
  );
10311
- const c = d.toSorted(yt), h = e.toSorted(yt), l = [];
10340
+ const c = d.toSorted(mt), h = e.toSorted(mt), l = [];
10312
10341
  for (let A = 0; A < r.length; A++)
10313
10342
  l.push({
10314
10343
  ...c[A],
@@ -11077,7 +11106,7 @@ class ZF extends B {
11077
11106
  return this.dispatch(n(a)), a;
11078
11107
  }
11079
11108
  }
11080
- class XF extends Pt {
11109
+ class XF extends It {
11081
11110
  constructor() {
11082
11111
  super(...arguments);
11083
11112
  u(this, "name", "User");
@@ -11120,7 +11149,7 @@ class XF extends Pt {
11120
11149
  }
11121
11150
  }
11122
11151
  async function Ha(t, s, e, i, n) {
11123
- const a = i instanceof It;
11152
+ const a = i instanceof Tt;
11124
11153
  a && s.checkAuth !== !1 && await i.auth.prepareAuth();
11125
11154
  const r = {
11126
11155
  queryParams: "",
@@ -11148,54 +11177,55 @@ async function Ha(t, s, e, i, n) {
11148
11177
  throw new Error(`Cannot upload file ${O} because its has a size of 0.`);
11149
11178
  }
11150
11179
  !_ && !w.startsWith("http") && (!w.startsWith("/") && !w.startsWith("blob:") && (w = "/" + w), w = t + w);
11151
- const q = ($) => {
11180
+ const q = (V) => {
11152
11181
  if (O) {
11153
11182
  if (!d) throw new Error(`No S3 URL for file ${O}`);
11154
11183
  if ("warning" in d) throw new Error(`S3 URL warning for file ${O}`);
11155
11184
  if (!k) throw new Error(`No file for file ${O}`);
11156
- const L = d.fields["x-amz-checksum-sha1"];
11157
- if (!L) throw new Error(`No checksum for file ${O}`);
11158
- return $.set("x-amz-checksum-sha1", L).field({ ...c, ...d.fields }).attach("file", k);
11185
+ const x = d.fields["x-amz-checksum-sha1"];
11186
+ if (!x) throw new Error(`No checksum for file ${O}`);
11187
+ return V.set("x-amz-checksum-sha1", x).field({ ...c, ...d.fields }).attach("file", k);
11159
11188
  }
11160
- return $.send(c);
11161
- }, V = {
11162
- [o.GET]: () => F ? pt.get(w.toString()).responseType("blob") : pt.get(w.toString()),
11189
+ return V.send(c);
11190
+ }, $ = {
11191
+ [o.GET]: () => F ? ht.get(w.toString()).responseType("blob") : ht.get(w.toString()),
11163
11192
  [o.POST]: () => {
11164
- const $ = pt.post(w.toString());
11165
- return q($);
11193
+ const V = ht.post(w.toString());
11194
+ return q(V);
11166
11195
  },
11167
11196
  [o.PATCH]: () => {
11168
- const $ = pt.patch(w.toString());
11169
- return q($);
11197
+ const V = ht.patch(w.toString());
11198
+ return q(V);
11170
11199
  },
11171
11200
  [o.PUT]: () => {
11172
- const $ = pt.put(w.toString());
11173
- return q($);
11201
+ const V = ht.put(w.toString());
11202
+ return q(V);
11174
11203
  },
11175
11204
  [o.DELETE]: () => {
11176
- const $ = pt.delete(w.toString());
11177
- return q($);
11205
+ const V = ht.delete(w.toString());
11206
+ return q(V);
11178
11207
  }
11179
11208
  }[l];
11180
- let x = V();
11209
+ let L = $();
11181
11210
  const kt = () => {
11182
- console.debug("aborting request:", s.url), x.abort();
11211
+ console.debug("aborting request:", s.url), L.abort();
11183
11212
  };
11184
- if (n == null || n.addEventListener("abort", kt), A && a) {
11185
- const $ = i.auth.getAuthHeader();
11186
- x = x.set("Authorization", $);
11187
- }
11188
- h && (x = x.set(h));
11213
+ n == null || n.addEventListener("abort", kt), A && a && (L = i.auth.applyAuth(L)), h && (L = L.set(h));
11189
11214
  try {
11190
- return await x.query(y);
11191
- } catch ($) {
11192
- const L = q_($), lt = L == null ? void 0 : L.status;
11193
- if (a && lt === 401)
11194
- return await i.auth.handleUnauthorized(x, L), x.query(y);
11195
- throw new U({
11196
- response: L,
11197
- innerError: $,
11198
- discard: Ua.includes(lt)
11215
+ return await L.query(y);
11216
+ } catch (V) {
11217
+ const x = q_(V), Pt = x == null ? void 0 : x.status;
11218
+ throw a && x && i.auth.isAuthFailure(x) ? (await i.auth.handleUnauthorized(L, x), new U({
11219
+ response: x,
11220
+ innerError: V,
11221
+ // NOT `DISCARD_HTTP_STATUSES.includes(status)`. A CSRF failure is a 403, which is in that list, so
11222
+ // computing it would discard the request the auth service just repaired -- silent data loss on a stale
11223
+ // CSRF token. An auth failure the auth service handled is by definition retryable.
11224
+ discard: !1
11225
+ })) : new U({
11226
+ response: x,
11227
+ innerError: V,
11228
+ discard: Ua.includes(Pt)
11199
11229
  });
11200
11230
  } finally {
11201
11231
  n == null || n.removeEventListener("abort", kt);
@@ -11443,7 +11473,7 @@ function U_() {
11443
11473
  return Wa;
11444
11474
  }
11445
11475
  let Nt = null;
11446
- function mt() {
11476
+ function pt() {
11447
11477
  const t = Bt();
11448
11478
  if (!t)
11449
11479
  return console.warn("Client store not set; cannot get outbox coordinator yet."), null;
@@ -11525,8 +11555,9 @@ export {
11525
11555
  Lw as AssetTypeIdentifierValueService,
11526
11556
  Nw as AssetTypeService,
11527
11557
  Hw as AssetTypeStatusService,
11528
- It as BaseApiService,
11529
- Pt as BaseModelApiService,
11558
+ Tt as BaseApiService,
11559
+ j_ as BaseAuthService,
11560
+ It as BaseModelApiService,
11530
11561
  j as BaseOfflineFileModelApiService,
11531
11562
  B as BaseOfflineModelApiService,
11532
11563
  QF as BaseSDK,
@@ -11661,7 +11692,7 @@ export {
11661
11692
  Qh as addFormSubmission,
11662
11693
  xh as addFormSubmissionAttachment,
11663
11694
  Ln as addFormSubmissionAttachments,
11664
- ft as addFormSubmissions,
11695
+ yt as addFormSubmissions,
11665
11696
  yh as addFormSubscriber,
11666
11697
  $n as addFormSubscribers,
11667
11698
  Fh as addForms,
@@ -11840,7 +11871,7 @@ export {
11840
11871
  sp as deleteFormSubmission,
11841
11872
  Hh as deleteFormSubmissionAttachment,
11842
11873
  Nn as deleteFormSubmissionAttachments,
11843
- St as deleteFormSubmissions,
11874
+ ft as deleteFormSubmissions,
11844
11875
  Th as deleteFormSubscriber,
11845
11876
  Vn as deleteFormSubscribers,
11846
11877
  zh as deleteForms,
@@ -11980,7 +12011,7 @@ export {
11980
12011
  Ic as getFileExtension,
11981
12012
  fc as getLocalDateString,
11982
12013
  SM as getLocalRelativeDateString,
11983
- mt as getOutboxCoordinator,
12014
+ pt as getOutboxCoordinator,
11984
12015
  wc as getPresignedUrlExpiryDate,
11985
12016
  OM as getRenamedFile,
11986
12017
  S as getRequestDescription,
@@ -12472,7 +12503,7 @@ export {
12472
12503
  tw as selectProcedureStepEventsOfProcedure,
12473
12504
  iw as selectProcedureStepEventsOfProcedureAndProcedureStep,
12474
12505
  sw as selectProcedureStepEventsOfProcedureStep,
12475
- Ot as selectProcedureStepFieldValues,
12506
+ At as selectProcedureStepFieldValues,
12476
12507
  gI as selectProcedureStepFieldValuesAttachmentById,
12477
12508
  ya as selectProcedureStepFieldValuesAttachments,
12478
12509
  wI as selectProcedureStepFieldValuesAttachmentsByIds,
@@ -12484,7 +12515,7 @@ export {
12484
12515
  ow as selectProcedureStepFieldValuesOfProcedureAndProcedureStep,
12485
12516
  dw as selectProcedureStepFieldValuesOfProcedureStep,
12486
12517
  ZI as selectProcedureStepFieldValuesReviewById,
12487
- Tt as selectProcedureStepFieldValuesReviews,
12518
+ Ot as selectProcedureStepFieldValuesReviews,
12488
12519
  XI as selectProcedureStepFieldValuesReviewsByIds,
12489
12520
  JI as selectProcedureStepFieldValuesReviewsMapping,
12490
12521
  lw as selectProcedureStepFieldValuesReviewsOfProcedure,
@@ -12528,7 +12559,7 @@ export {
12528
12559
  Kb as selectProcedureTypesByIds,
12529
12560
  Gb as selectProcedureTypesMapping,
12530
12561
  _w as selectProcedureTypesOfOrganization,
12531
- At as selectProcedures,
12562
+ St as selectProcedures,
12532
12563
  BO as selectProceduresByIds,
12533
12564
  EO as selectProceduresMapping,
12534
12565
  zO as selectProceduresOfAsset,
@@ -12884,6 +12915,6 @@ export {
12884
12915
  SS as userReducer,
12885
12916
  jr as userSlice,
12886
12917
  I as uuidObj,
12887
- yt as uuidObjSortFn,
12918
+ mt as uuidObjSortFn,
12888
12919
  Rc as uuidSortFn
12889
12920
  };