@overmap-ai/core 1.0.65-org-projs-only.0 → 1.0.65-procedures.1

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.
Files changed (86) hide show
  1. package/dist/enums/access.d.ts +8 -0
  2. package/dist/enums/attachments.d.ts +7 -0
  3. package/dist/enums/index.d.ts +3 -0
  4. package/dist/enums/issue.d.ts +9 -0
  5. package/dist/enums/licenses.d.ts +14 -0
  6. package/dist/overmap-core.js +1444 -684
  7. package/dist/overmap-core.js.map +1 -1
  8. package/dist/overmap-core.umd.cjs +1440 -680
  9. package/dist/overmap-core.umd.cjs.map +1 -1
  10. package/dist/sdk/base.d.ts +1 -1
  11. package/dist/sdk/globals.d.ts +2 -2
  12. package/dist/sdk/sdk.d.ts +3 -3
  13. package/dist/sdk/services/AgentService.d.ts +1 -1
  14. package/dist/sdk/services/AssetAttachmentService.d.ts +3 -2
  15. package/dist/sdk/services/AssetProcedureCompletionService.d.ts +11 -0
  16. package/dist/sdk/services/AssetProcedureInstanceService.d.ts +10 -0
  17. package/dist/sdk/services/AssetProcedureService.d.ts +10 -0
  18. package/dist/sdk/services/AssetService.d.ts +5 -6
  19. package/dist/sdk/services/AssetStageCompletionService.d.ts +6 -12
  20. package/dist/sdk/services/AssetStageService.d.ts +6 -5
  21. package/dist/sdk/services/AssetTypeAttachmentService.d.ts +3 -2
  22. package/dist/sdk/services/AssetTypeService.d.ts +4 -4
  23. package/dist/sdk/services/BaseApiService.d.ts +1 -1
  24. package/dist/sdk/services/BaseAttachmentService.d.ts +3 -2
  25. package/dist/sdk/services/BaseAuthService.d.ts +1 -1
  26. package/dist/sdk/services/BaseService.d.ts +2 -2
  27. package/dist/sdk/services/BaseUploadService.d.ts +2 -2
  28. package/dist/sdk/services/CategoryService.d.ts +3 -3
  29. package/dist/sdk/services/DocumentAttachmentService.d.ts +3 -2
  30. package/dist/sdk/services/DocumentService.d.ts +2 -2
  31. package/dist/sdk/services/EmailDomainsService.d.ts +1 -1
  32. package/dist/sdk/services/EmailVerificationService.d.ts +1 -1
  33. package/dist/sdk/services/FileService.d.ts +1 -1
  34. package/dist/sdk/services/FormService.d.ts +3 -2
  35. package/dist/sdk/services/FormSubmissionService.d.ts +2 -3
  36. package/dist/sdk/services/GeoImageService.d.ts +2 -2
  37. package/dist/sdk/services/IssueAttachmentService.d.ts +3 -2
  38. package/dist/sdk/services/IssueCommentService.d.ts +2 -2
  39. package/dist/sdk/services/IssueService.d.ts +2 -2
  40. package/dist/sdk/services/IssueTypeService.d.ts +2 -2
  41. package/dist/sdk/services/IssueUpdateService.d.ts +1 -1
  42. package/dist/sdk/services/JWTAuthService.d.ts +2 -2
  43. package/dist/sdk/services/LicenseService.d.ts +1 -1
  44. package/dist/sdk/services/OrganizationAccessService.d.ts +1 -1
  45. package/dist/sdk/services/OrganizationService.d.ts +1 -1
  46. package/dist/sdk/services/ProjectAccessService.d.ts +1 -1
  47. package/dist/sdk/services/ProjectAttachmentService.d.ts +3 -2
  48. package/dist/sdk/services/ProjectFileService.d.ts +2 -3
  49. package/dist/sdk/services/ProjectService.d.ts +1 -2
  50. package/dist/sdk/services/TeamService.d.ts +2 -2
  51. package/dist/sdk/services/UserService.d.ts +2 -2
  52. package/dist/sdk/services/WorkspaceService.d.ts +3 -5
  53. package/dist/sdk/services/index.d.ts +3 -0
  54. package/dist/store/slices/assetProcedureCompletionSlice.d.ts +54 -0
  55. package/dist/store/slices/assetProcedureInstanceSlice.d.ts +54 -0
  56. package/dist/store/slices/assetProcedureSlice.d.ts +53 -0
  57. package/dist/store/slices/assetStageCompletionSlice.d.ts +42 -12
  58. package/dist/store/slices/assetStageSlice.d.ts +22 -11
  59. package/dist/store/slices/assetTypeSlice.d.ts +27 -3
  60. package/dist/store/slices/formSlice.d.ts +2 -0
  61. package/dist/store/slices/index.d.ts +3 -0
  62. package/dist/store/slices/userSlice.d.ts +13 -33
  63. package/dist/store/store.d.ts +4 -1
  64. package/dist/typings/models/access.d.ts +2 -9
  65. package/dist/typings/models/agents.d.ts +1 -1
  66. package/dist/typings/models/assets.d.ts +26 -15
  67. package/dist/typings/models/attachments.d.ts +2 -9
  68. package/dist/typings/models/base.d.ts +5 -4
  69. package/dist/typings/models/categories.d.ts +3 -3
  70. package/dist/typings/models/documents.d.ts +1 -1
  71. package/dist/typings/models/emailDomain.d.ts +1 -1
  72. package/dist/typings/models/emailVerification.d.ts +2 -2
  73. package/dist/typings/models/forms.d.ts +3 -2
  74. package/dist/typings/models/geoImages.d.ts +3 -3
  75. package/dist/typings/models/issueTypes.d.ts +2 -2
  76. package/dist/typings/models/issues.d.ts +2 -10
  77. package/dist/typings/models/license.d.ts +3 -16
  78. package/dist/typings/models/organizations.d.ts +1 -1
  79. package/dist/typings/models/projects.d.ts +6 -4
  80. package/dist/typings/models/store.d.ts +4 -1
  81. package/dist/typings/models/teams.d.ts +3 -3
  82. package/dist/typings/models/users.d.ts +1 -1
  83. package/dist/typings/models/workspace.d.ts +3 -3
  84. package/dist/typings/store.d.ts +1 -1
  85. package/dist/utils/colors.d.ts +0 -2
  86. package/package.json +1 -1
@@ -5,8 +5,8 @@ var __publicField = (obj, key, value) => {
5
5
  return value;
6
6
  };
7
7
  (function(global, factory) {
8
- typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("dependency-graph"), require("uuid"), require("@redux-offline/redux-offline"), require("@redux-offline/redux-offline/lib/defaults"), require("localforage"), require("redux-persist-migrate"), require("@reduxjs/toolkit"), require("superagent"), require("file-saver"), require("react"), require("color"), require("@radix-ui/colors"), require("@redux-offline/redux-offline/lib/constants"), require("jwt-decode"), require("@overmap-ai/blocks"), require("idb")) : typeof define === "function" && define.amd ? define(["exports", "dependency-graph", "uuid", "@redux-offline/redux-offline", "@redux-offline/redux-offline/lib/defaults", "localforage", "redux-persist-migrate", "@reduxjs/toolkit", "superagent", "file-saver", "react", "color", "@radix-ui/colors", "@redux-offline/redux-offline/lib/constants", "jwt-decode", "@overmap-ai/blocks", "idb"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global["overmap-core"] = {}, global.dependencyGraph, global.uuid, global.reduxOffline, global.offlineConfig, global.localforage, global.createMigration, global.toolkit, global.request, global.fileSaver, global.React, global.ColorCls, global.colors, global.constants, global.jwtDecode, global.blocks, global.idb));
9
- })(this, function(exports2, dependencyGraph, uuid, reduxOffline, offlineConfig, localforage, createMigration, toolkit, request, fileSaver, React, ColorCls, colors, constants, jwtDecode, blocks, idb) {
8
+ typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("dependency-graph"), require("uuid"), require("file-saver"), require("react"), require("color"), require("@radix-ui/colors"), require("@redux-offline/redux-offline"), require("@redux-offline/redux-offline/lib/defaults"), require("localforage"), require("redux-persist-migrate"), require("@reduxjs/toolkit"), require("superagent"), require("@overmap-ai/blocks"), require("@redux-offline/redux-offline/lib/constants"), require("jwt-decode"), require("idb")) : typeof define === "function" && define.amd ? define(["exports", "dependency-graph", "uuid", "file-saver", "react", "color", "@radix-ui/colors", "@redux-offline/redux-offline", "@redux-offline/redux-offline/lib/defaults", "localforage", "redux-persist-migrate", "@reduxjs/toolkit", "superagent", "@overmap-ai/blocks", "@redux-offline/redux-offline/lib/constants", "jwt-decode", "idb"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global["overmap-core"] = {}, global.dependencyGraph, global.uuid, global.fileSaver, global.React, global.ColorCls, global.colors, global.reduxOffline, global.offlineConfig, global.localforage, global.createMigration, global.toolkit, global.request, global.blocks, global.constants, global.jwtDecode, global.idb));
9
+ })(this, function(exports2, dependencyGraph, uuid, fileSaver, React, ColorCls, colors, reduxOffline, offlineConfig, localforage, createMigration, toolkit, request, blocks, constants, jwtDecode, idb) {
10
10
  var _a;
11
11
  "use strict";
12
12
  var HttpMethod = /* @__PURE__ */ ((HttpMethod2) => {
@@ -17,6 +17,14 @@ var __publicField = (obj, key, value) => {
17
17
  HttpMethod2["DELETE"] = "DELETE";
18
18
  return HttpMethod2;
19
19
  })(HttpMethod || {});
20
+ var AttachmentModel = /* @__PURE__ */ ((AttachmentModel2) => {
21
+ AttachmentModel2["Issue"] = "issue";
22
+ AttachmentModel2["Asset"] = "asset";
23
+ AttachmentModel2["AssetType"] = "asset_type";
24
+ AttachmentModel2["Project"] = "project";
25
+ AttachmentModel2["Document"] = "document";
26
+ return AttachmentModel2;
27
+ })(AttachmentModel || {});
20
28
  var IssuePriority = /* @__PURE__ */ ((IssuePriority2) => {
21
29
  IssuePriority2[IssuePriority2["LOWEST"] = 0] = "LOWEST";
22
30
  IssuePriority2[IssuePriority2["LOW"] = 2] = "LOW";
@@ -31,6 +39,43 @@ var __publicField = (obj, key, value) => {
31
39
  IssueStatus2[IssueStatus2["DONE"] = 4] = "DONE";
32
40
  return IssueStatus2;
33
41
  })(IssueStatus || {});
42
+ var IssueUpdateChange = /* @__PURE__ */ ((IssueUpdateChange2) => {
43
+ IssueUpdateChange2["STATUS"] = "status";
44
+ IssueUpdateChange2["PRIORITY"] = "priority";
45
+ IssueUpdateChange2["CATEGORY"] = "category";
46
+ IssueUpdateChange2["DESCRIPTION"] = "description";
47
+ IssueUpdateChange2["TITLE"] = "title";
48
+ IssueUpdateChange2["ASSIGNED_TO"] = "assigned_to";
49
+ IssueUpdateChange2["DUE_DATE"] = "due_date";
50
+ return IssueUpdateChange2;
51
+ })(IssueUpdateChange || {});
52
+ var ProjectAccessLevel = /* @__PURE__ */ ((ProjectAccessLevel2) => {
53
+ ProjectAccessLevel2[ProjectAccessLevel2["BASIC"] = 0] = "BASIC";
54
+ ProjectAccessLevel2[ProjectAccessLevel2["ADMIN"] = 2] = "ADMIN";
55
+ return ProjectAccessLevel2;
56
+ })(ProjectAccessLevel || {});
57
+ var OrganizationAccessLevel = /* @__PURE__ */ ((OrganizationAccessLevel2) => {
58
+ OrganizationAccessLevel2[OrganizationAccessLevel2["BASIC"] = 0] = "BASIC";
59
+ OrganizationAccessLevel2[OrganizationAccessLevel2["ADMIN"] = 2] = "ADMIN";
60
+ return OrganizationAccessLevel2;
61
+ })(OrganizationAccessLevel || {});
62
+ var PaddleCheckoutEvent = /* @__PURE__ */ ((PaddleCheckoutEvent2) => {
63
+ PaddleCheckoutEvent2["COMPLETED"] = "checkout.completed";
64
+ PaddleCheckoutEvent2["CLOSED"] = "checkout.closed";
65
+ return PaddleCheckoutEvent2;
66
+ })(PaddleCheckoutEvent || {});
67
+ var LicenseLevel = /* @__PURE__ */ ((LicenseLevel2) => {
68
+ LicenseLevel2[LicenseLevel2["PRO"] = 0] = "PRO";
69
+ return LicenseLevel2;
70
+ })(LicenseLevel || {});
71
+ var LicenseStatus = /* @__PURE__ */ ((LicenseStatus2) => {
72
+ LicenseStatus2[LicenseStatus2["ACTIVE"] = 0] = "ACTIVE";
73
+ LicenseStatus2[LicenseStatus2["PAUSED"] = 2] = "PAUSED";
74
+ LicenseStatus2[LicenseStatus2["CANCELLED"] = 4] = "CANCELLED";
75
+ LicenseStatus2[LicenseStatus2["INACTIVE"] = 6] = "INACTIVE";
76
+ LicenseStatus2[LicenseStatus2["PAST_DUE"] = 8] = "PAST_DUE";
77
+ return LicenseStatus2;
78
+ })(LicenseStatus || {});
34
79
  class OutboxCoordinator {
35
80
  constructor() {
36
81
  __publicField(this, "graph");
@@ -273,130 +318,6 @@ var __publicField = (obj, key, value) => {
273
318
  this.options = options;
274
319
  }
275
320
  }
276
- class DeferredPromise {
277
- constructor() {
278
- __publicField(this, _a, "Promise");
279
- __publicField(this, "_promise");
280
- __publicField(this, "_resolve");
281
- __publicField(this, "_reject");
282
- __publicField(this, "_state", "pending");
283
- this._resolve = null;
284
- this._reject = null;
285
- this._promise = new Promise((resolve, reject) => {
286
- this._resolve = resolve;
287
- this._reject = reject;
288
- });
289
- }
290
- get state() {
291
- return this._state;
292
- }
293
- then(onFulfilled, onRejected) {
294
- return this._promise.then(onFulfilled, onRejected);
295
- }
296
- catch(onRejected) {
297
- return this._promise.catch(onRejected);
298
- }
299
- resolve(value) {
300
- if (!this._resolve)
301
- throw new Error("No resolve callback");
302
- this._resolve(value);
303
- this._state = "fulfilled";
304
- }
305
- reject(reason) {
306
- if (!this._reject)
307
- throw reason;
308
- this._reject(reason);
309
- this._state = "rejected";
310
- }
311
- finally(_onFinally) {
312
- throw new Error("`finally` not implemented");
313
- }
314
- }
315
- _a = Symbol.toStringTag;
316
- var randomString = function randomString2() {
317
- return Math.random().toString(36).substring(7).split("").join(".");
318
- };
319
- ({
320
- INIT: "@@redux/INIT" + randomString(),
321
- REPLACE: "@@redux/REPLACE" + randomString(),
322
- PROBE_UNKNOWN_ACTION: function PROBE_UNKNOWN_ACTION() {
323
- return "@@redux/PROBE_UNKNOWN_ACTION" + randomString();
324
- }
325
- });
326
- function compose() {
327
- for (var _len = arguments.length, funcs = new Array(_len), _key = 0; _key < _len; _key++) {
328
- funcs[_key] = arguments[_key];
329
- }
330
- if (funcs.length === 0) {
331
- return function(arg) {
332
- return arg;
333
- };
334
- }
335
- if (funcs.length === 1) {
336
- return funcs[0];
337
- }
338
- return funcs.reduce(function(a, b) {
339
- return function() {
340
- return a(b.apply(void 0, arguments));
341
- };
342
- });
343
- }
344
- const VERSION_REDUCER_KEY$1 = "versioning";
345
- const latestVersion = () => migrations.length - 1;
346
- const initialVersioning = (state) => {
347
- state[VERSION_REDUCER_KEY$1] = { version: latestVersion() };
348
- return state;
349
- };
350
- const signOut = () => {
351
- return initialVersioning({});
352
- };
353
- const createOutboxState = (state) => {
354
- if (state.outboxReducer) {
355
- state.outboxReducer.deletedRequests = [];
356
- }
357
- return state;
358
- };
359
- const wrapMigration = (migrator) => (state) => {
360
- var _a2;
361
- if (state === void 0) {
362
- state = {};
363
- }
364
- if (((_a2 = state[VERSION_REDUCER_KEY$1]) == null ? void 0 : _a2.version) === latestVersion())
365
- return state;
366
- return migrator(state);
367
- };
368
- const migrations = [initialVersioning, signOut, signOut, createOutboxState];
369
- const manifest = Object.fromEntries(migrations.map((migration2, i) => [i, wrapMigration(migration2)]));
370
- const initialState$B = {
371
- accessToken: "",
372
- refreshToken: "",
373
- isLoggedIn: false
374
- };
375
- const authSlice = toolkit.createSlice({
376
- name: "auth",
377
- initialState: initialState$B,
378
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$B)),
379
- reducers: {
380
- setTokens: (state, action) => {
381
- state.accessToken = action.payload.accessToken;
382
- state.refreshToken = action.payload.refreshToken;
383
- },
384
- clearTokens: (state) => {
385
- state.accessToken = "";
386
- state.refreshToken = "";
387
- },
388
- setLoggedIn: (state, action) => {
389
- if (!action.payload) {
390
- authSlice.caseReducers.clearTokens(state);
391
- }
392
- state.isLoggedIn = action.payload;
393
- }
394
- }
395
- });
396
- const { setTokens, clearTokens, setLoggedIn } = authSlice.actions;
397
- const selectAccessToken = (state) => state.authReducer.accessToken;
398
- const selectIsLoggedIn = (state) => state.authReducer.isLoggedIn;
399
- const authReducer = authSlice.reducer;
400
321
  const coordinatesToLiteral = (coordinates) => {
401
322
  return { lng: coordinates[0], lat: coordinates[1] };
402
323
  };
@@ -741,19 +662,6 @@ var __publicField = (obj, key, value) => {
741
662
  mint: colors.mint.mint9,
742
663
  sky: colors.sky.sky9
743
664
  };
744
- const AssetStageColors = {
745
- indigo: colors.indigo.indigo9,
746
- red: colors.red.red9,
747
- violet: colors.violet.violet9,
748
- yellow: colors.yellow.yellow9,
749
- jade: colors.jade.jade9,
750
- cyan: colors.cyan.cyan9,
751
- gold: colors.gold.gold9,
752
- orange: colors.orange.orange9,
753
- lime: colors.lime.lime9,
754
- sky: colors.sky.sky9,
755
- pink: colors.pink.pink9
756
- };
757
665
  const defaultBadgeColor = "#868686";
758
666
  const generateBadgeColors = (rawColor) => {
759
667
  const color = ColorCls(rawColor);
@@ -762,9 +670,6 @@ var __publicField = (obj, key, value) => {
762
670
  const textColor = color.hex() === safety.hex() ? "#000000" : "#FFFFFF";
763
671
  return { backgroundColor, textColor };
764
672
  };
765
- function getStageColor(index) {
766
- return Object.values(AssetStageColors)[index % Object.keys(AssetStageColors).length];
767
- }
768
673
  const getLocalDateString = memoize((date) => {
769
674
  if (!date)
770
675
  return "";
@@ -781,12 +686,164 @@ var __publicField = (obj, key, value) => {
781
686
  const isToday = (date) => {
782
687
  return new Date(date).toDateString() === today.toDateString();
783
688
  };
784
- const getLocalRelativeDateString = memoize((date, min, max) => {
785
- const days = Math.round((new Date(date).getTime() - today.getTime()) / msInDay);
786
- if (days < min || days > max)
787
- return getLocalDateString(date);
788
- return relative.format(days, "days");
689
+ const getLocalRelativeDateString = memoize((date, min, max) => {
690
+ const days = Math.round((new Date(date).getTime() - today.getTime()) / msInDay);
691
+ if (days < min || days > max)
692
+ return getLocalDateString(date);
693
+ return relative.format(days, "days");
694
+ });
695
+ class DeferredPromise {
696
+ constructor() {
697
+ __publicField(this, _a, "Promise");
698
+ __publicField(this, "_promise");
699
+ __publicField(this, "_resolve");
700
+ __publicField(this, "_reject");
701
+ __publicField(this, "_state", "pending");
702
+ this._resolve = null;
703
+ this._reject = null;
704
+ this._promise = new Promise((resolve, reject) => {
705
+ this._resolve = resolve;
706
+ this._reject = reject;
707
+ });
708
+ }
709
+ get state() {
710
+ return this._state;
711
+ }
712
+ then(onFulfilled, onRejected) {
713
+ return this._promise.then(onFulfilled, onRejected);
714
+ }
715
+ catch(onRejected) {
716
+ return this._promise.catch(onRejected);
717
+ }
718
+ resolve(value) {
719
+ if (!this._resolve)
720
+ throw new Error("No resolve callback");
721
+ this._resolve(value);
722
+ this._state = "fulfilled";
723
+ }
724
+ reject(reason) {
725
+ if (!this._reject)
726
+ throw reason;
727
+ this._reject(reason);
728
+ this._state = "rejected";
729
+ }
730
+ finally(_onFinally) {
731
+ throw new Error("`finally` not implemented");
732
+ }
733
+ }
734
+ _a = Symbol.toStringTag;
735
+ var randomString = function randomString2() {
736
+ return Math.random().toString(36).substring(7).split("").join(".");
737
+ };
738
+ ({
739
+ INIT: "@@redux/INIT" + randomString(),
740
+ REPLACE: "@@redux/REPLACE" + randomString(),
741
+ PROBE_UNKNOWN_ACTION: function PROBE_UNKNOWN_ACTION() {
742
+ return "@@redux/PROBE_UNKNOWN_ACTION" + randomString();
743
+ }
744
+ });
745
+ function compose() {
746
+ for (var _len = arguments.length, funcs = new Array(_len), _key = 0; _key < _len; _key++) {
747
+ funcs[_key] = arguments[_key];
748
+ }
749
+ if (funcs.length === 0) {
750
+ return function(arg) {
751
+ return arg;
752
+ };
753
+ }
754
+ if (funcs.length === 1) {
755
+ return funcs[0];
756
+ }
757
+ return funcs.reduce(function(a, b) {
758
+ return function() {
759
+ return a(b.apply(void 0, arguments));
760
+ };
761
+ });
762
+ }
763
+ const VERSION_REDUCER_KEY$1 = "versioning";
764
+ const latestVersion = () => migrations.length - 1;
765
+ const initialVersioning = (state) => {
766
+ state[VERSION_REDUCER_KEY$1] = { version: latestVersion() };
767
+ return state;
768
+ };
769
+ const signOut = () => {
770
+ return initialVersioning({});
771
+ };
772
+ const createOutboxState = (state) => {
773
+ if (state.outboxReducer) {
774
+ state.outboxReducer.deletedRequests = [];
775
+ }
776
+ return state;
777
+ };
778
+ const wrapMigration = (migrator) => (state) => {
779
+ var _a2;
780
+ if (state === void 0) {
781
+ state = {};
782
+ }
783
+ if (((_a2 = state[VERSION_REDUCER_KEY$1]) == null ? void 0 : _a2.version) === latestVersion())
784
+ return state;
785
+ return migrator(state);
786
+ };
787
+ const migrations = [initialVersioning, signOut, signOut, createOutboxState];
788
+ const manifest = Object.fromEntries(migrations.map((migration2, i) => [i, wrapMigration(migration2)]));
789
+ let clientStore;
790
+ function setClientStore(store) {
791
+ clientStore = store;
792
+ }
793
+ function getClientStore() {
794
+ return clientStore;
795
+ }
796
+ let clientSDK;
797
+ function setClientSDK(sdkCtor) {
798
+ clientSDK = sdkCtor;
799
+ }
800
+ function getClientSDK() {
801
+ return clientSDK;
802
+ }
803
+ const CLASS_NAME_TO_SERVICE = {};
804
+ class BaseService {
805
+ constructor(sdk) {
806
+ __publicField(this, "client");
807
+ CLASS_NAME_TO_SERVICE[this.constructor.name] = this;
808
+ this.client = sdk;
809
+ }
810
+ async enqueueRequest(requestDetails) {
811
+ return this.client.enqueueRequest(requestDetails, this.host, this.constructor.name);
812
+ }
813
+ dispatch(action) {
814
+ this.client.store.dispatch(action);
815
+ }
816
+ }
817
+ const initialState$E = {
818
+ accessToken: "",
819
+ refreshToken: "",
820
+ isLoggedIn: false
821
+ };
822
+ const authSlice = toolkit.createSlice({
823
+ name: "auth",
824
+ initialState: initialState$E,
825
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$E)),
826
+ reducers: {
827
+ setTokens: (state, action) => {
828
+ state.accessToken = action.payload.accessToken;
829
+ state.refreshToken = action.payload.refreshToken;
830
+ },
831
+ clearTokens: (state) => {
832
+ state.accessToken = "";
833
+ state.refreshToken = "";
834
+ },
835
+ setLoggedIn: (state, action) => {
836
+ if (!action.payload) {
837
+ authSlice.caseReducers.clearTokens(state);
838
+ }
839
+ state.isLoggedIn = action.payload;
840
+ }
841
+ }
789
842
  });
843
+ const { setTokens, clearTokens, setLoggedIn } = authSlice.actions;
844
+ const selectAccessToken = (state) => state.authReducer.accessToken;
845
+ const selectIsLoggedIn = (state) => state.authReducer.isLoggedIn;
846
+ const authReducer = authSlice.reducer;
790
847
  function createModelAdapter(computeModelId) {
791
848
  const addOne = (state, action) => {
792
849
  const id = computeModelId(action.payload);
@@ -853,11 +910,11 @@ var __publicField = (obj, key, value) => {
853
910
  };
854
911
  }
855
912
  const categoryAdapter = createModelAdapter((category) => category.offline_id);
856
- const initialState$A = categoryAdapter.getInitialState({});
913
+ const initialState$D = categoryAdapter.getInitialState({});
857
914
  const categorySlice = toolkit.createSlice({
858
915
  name: "categories",
859
- initialState: initialState$A,
860
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$A)),
916
+ initialState: initialState$D,
917
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$D)),
861
918
  reducers: {
862
919
  initializeCategories: categoryAdapter.initialize,
863
920
  addCategory: categoryAdapter.addOne,
@@ -901,11 +958,11 @@ var __publicField = (obj, key, value) => {
901
958
  };
902
959
  const categoryReducer = categorySlice.reducer;
903
960
  const assetAdapter = createModelAdapter((asset) => asset.offline_id);
904
- const initialState$z = assetAdapter.getInitialState({});
961
+ const initialState$C = assetAdapter.getInitialState({});
905
962
  const assetSlice = toolkit.createSlice({
906
963
  name: "assets",
907
- initialState: initialState$z,
908
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$z)),
964
+ initialState: initialState$C,
965
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$C)),
909
966
  reducers: {
910
967
  initializeAssets: assetAdapter.initialize,
911
968
  addAsset: assetAdapter.addOne,
@@ -957,11 +1014,11 @@ var __publicField = (obj, key, value) => {
957
1014
  };
958
1015
  const assetReducer = assetSlice.reducer;
959
1016
  const assetAttachmentAdapter = createModelAdapter((attachment) => attachment.offline_id);
960
- const initialState$y = assetAttachmentAdapter.getInitialState({});
1017
+ const initialState$B = assetAttachmentAdapter.getInitialState({});
961
1018
  const assetAttachmentSlice = toolkit.createSlice({
962
1019
  name: "assetAttachments",
963
- initialState: initialState$y,
964
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$y)),
1020
+ initialState: initialState$B,
1021
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$B)),
965
1022
  reducers: {
966
1023
  initializeAssetAttachments: assetAttachmentAdapter.initialize,
967
1024
  addAssetAttachment: assetAttachmentAdapter.addOne,
@@ -1019,78 +1076,98 @@ var __publicField = (obj, key, value) => {
1019
1076
  )
1020
1077
  );
1021
1078
  const assetAttachmentReducer = assetAttachmentSlice.reducer;
1022
- const initialState$x = {
1023
- completionsByAssetId: {}
1024
- };
1079
+ const assetStageCompletionAdapter = createModelAdapter(
1080
+ (stageCompletion) => stageCompletion.offline_id
1081
+ );
1082
+ const initialState$A = assetStageCompletionAdapter.getInitialState({});
1025
1083
  const assetStageCompletionSlice = toolkit.createSlice({
1026
1084
  name: "assetStageCompletions",
1027
- initialState: initialState$x,
1028
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$x)),
1085
+ initialState: initialState$A,
1086
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$A)),
1029
1087
  reducers: {
1030
- addStageCompletion: (state, action) => {
1031
- let stageToCompletionDateMapping = state.completionsByAssetId[action.payload.asset];
1032
- if (!stageToCompletionDateMapping) {
1033
- stageToCompletionDateMapping = {};
1034
- state.completionsByAssetId[action.payload.asset] = stageToCompletionDateMapping;
1035
- }
1036
- stageToCompletionDateMapping[action.payload.stage] = (/* @__PURE__ */ new Date()).toISOString();
1037
- },
1038
- addStageCompletions: (state, action) => {
1039
- for (const [assetId, stageIdToCompletionDateMapping] of Object.entries(action.payload)) {
1040
- if (Object.keys(stageIdToCompletionDateMapping).length === 0)
1041
- throw new Error(`Encountered empty stageIdToCompletionDateMapping argument for asset ${assetId}`);
1042
- let thisAssetCompletions = state.completionsByAssetId[assetId];
1043
- if (thisAssetCompletions === void 0) {
1044
- thisAssetCompletions = {};
1045
- }
1046
- for (const [stageId, completionDate] of Object.entries(stageIdToCompletionDateMapping)) {
1047
- thisAssetCompletions[stageId] = completionDate;
1048
- }
1049
- state.completionsByAssetId[assetId] = thisAssetCompletions;
1050
- }
1051
- },
1052
- removeStageCompletions: (state, action) => {
1053
- for (const completion of action.payload) {
1054
- const thisAssetCompletions = state.completionsByAssetId[completion.asset];
1055
- if (!thisAssetCompletions || !(completion.stage in thisAssetCompletions)) {
1056
- console.warn(
1057
- "Skipping removal of uncompleted stage. This message indicates completion objects are created unnecessarily."
1058
- );
1059
- continue;
1060
- }
1061
- delete thisAssetCompletions[completion.stage];
1062
- }
1063
- },
1064
- setStageCompletions: (state, action) => {
1065
- state.completionsByAssetId = action.payload;
1066
- }
1088
+ initializeAssetStageCompletions: assetStageCompletionAdapter.initialize,
1089
+ addAssetStageCompletion: assetStageCompletionAdapter.addOne,
1090
+ addAssetStageCompletions: assetStageCompletionAdapter.addMany,
1091
+ updateAssetStageCompletion: assetStageCompletionAdapter.updateOne,
1092
+ updateAssetStageCompletions: assetStageCompletionAdapter.updateMany,
1093
+ deleteAssetStageCompletion: assetStageCompletionAdapter.deleteOne,
1094
+ deleteAssetStageCompletions: assetStageCompletionAdapter.deleteMany
1067
1095
  }
1068
1096
  });
1069
- const { addStageCompletion, addStageCompletions, removeStageCompletions, setStageCompletions } = assetStageCompletionSlice.actions;
1070
- const selectCompletedStages = (state) => {
1071
- return state.assetStageCompletionReducer.completionsByAssetId;
1097
+ const {
1098
+ initializeAssetStageCompletions,
1099
+ addAssetStageCompletion,
1100
+ addAssetStageCompletions,
1101
+ updateAssetStageCompletion,
1102
+ updateAssetStageCompletions,
1103
+ deleteAssetStageCompletion,
1104
+ deleteAssetStageCompletions
1105
+ } = assetStageCompletionSlice.actions;
1106
+ const assetStageCompletionReducer = assetStageCompletionSlice.reducer;
1107
+ const selectAssetStageCompletionMapping = (state) => {
1108
+ return state.assetStageCompletionReducer.instances;
1072
1109
  };
1073
- const selectCompletedStageIdsForAsset = restructureCreateSelectorWithArgs(
1074
- toolkit.createSelector([selectCompletedStages, (_state, asset) => asset], (completedStages, asset) => {
1075
- return Object.keys(completedStages[asset.offline_id] ?? {});
1110
+ const selectCompletedStagesByAssetProcedureCompletion = toolkit.createSelector(
1111
+ [selectAssetStageCompletionMapping],
1112
+ (completedStagesMapping) => {
1113
+ const completedStagesByAsset = {};
1114
+ for (const stageCompletion of Object.values(completedStagesMapping)) {
1115
+ const { asset_procedure_completion, stage, submitted_at } = stageCompletion;
1116
+ if (!completedStagesByAsset[asset_procedure_completion])
1117
+ completedStagesByAsset[asset_procedure_completion] = {};
1118
+ completedStagesByAsset[asset_procedure_completion][stage] = submitted_at;
1119
+ }
1120
+ return completedStagesByAsset;
1121
+ }
1122
+ );
1123
+ const selectCompletedStageIdsOfAssetProcedureCompletion = restructureCreateSelectorWithArgs(
1124
+ toolkit.createSelector([selectAssetStageCompletionMapping, (_state, id) => id], (completedStages, id) => {
1125
+ return Object.keys(completedStages[id] ?? {});
1126
+ })
1127
+ );
1128
+ const selectAssetStageCompletionById = (id) => (state) => {
1129
+ return state.assetStageCompletionReducer.instances[id];
1130
+ };
1131
+ const selectAssetStageCompletionsByIds = restructureCreateSelectorWithArgs(
1132
+ toolkit.createSelector([selectAssetStageCompletionMapping, (_, ids) => ids], (stageCompletionMapping, ids) => {
1133
+ const stageCompletionIdsSet = new Set(ids);
1134
+ return fallbackToEmptyArray(
1135
+ Object.values(stageCompletionMapping).filter(
1136
+ (stageCompletion) => stageCompletionIdsSet.has(stageCompletion.offline_id)
1137
+ )
1138
+ );
1076
1139
  })
1077
1140
  );
1078
- const assetStageCompletionReducer = assetStageCompletionSlice.reducer;
1079
1141
  const assetStageAdapter = createModelAdapter((assetStage) => assetStage.offline_id);
1080
- const initialState$w = assetStageAdapter.getInitialState({});
1142
+ const initialState$z = assetStageAdapter.getInitialState({});
1081
1143
  const assetStageSlice = toolkit.createSlice({
1082
1144
  name: "assetStages",
1083
- initialState: initialState$w,
1084
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$w)),
1145
+ initialState: initialState$z,
1146
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$z)),
1085
1147
  reducers: {
1086
- initializeStages: assetStageAdapter.initialize,
1087
- setStage: assetStageAdapter.setOne,
1088
- addStages: assetStageAdapter.addMany,
1089
- updateStage: assetStageAdapter.updateOne,
1090
- updateStages: assetStageAdapter.updateMany,
1091
- removeStages: assetStageAdapter.deleteMany
1148
+ initializeAssetStages: assetStageAdapter.initialize,
1149
+ setAssetStage: assetStageAdapter.setOne,
1150
+ setAssetStages: assetStageAdapter.setMany,
1151
+ addAssetStage: assetStageAdapter.addOne,
1152
+ addAssetStages: assetStageAdapter.addMany,
1153
+ updateAssetStage: assetStageAdapter.updateOne,
1154
+ updateAssetStages: assetStageAdapter.updateMany,
1155
+ deleteAssetStage: assetStageAdapter.deleteOne,
1156
+ deleteAssetStages: assetStageAdapter.deleteMany
1092
1157
  }
1093
1158
  });
1159
+ const {
1160
+ initializeAssetStages,
1161
+ setAssetStage,
1162
+ setAssetStages,
1163
+ addAssetStage,
1164
+ addAssetStages,
1165
+ updateAssetStage,
1166
+ updateAssetStages,
1167
+ deleteAssetStage,
1168
+ deleteAssetStages
1169
+ } = assetStageSlice.actions;
1170
+ const assetStageReducer = assetStageSlice.reducer;
1094
1171
  const selectStageMapping = (state) => state.assetStageReducer.instances;
1095
1172
  const selectAssetStageById = (id) => (state) => {
1096
1173
  return state.assetStageReducer.instances[id];
@@ -1098,40 +1175,20 @@ var __publicField = (obj, key, value) => {
1098
1175
  const selectAssetStages = toolkit.createSelector([selectStageMapping], (stageMapping) => {
1099
1176
  return Object.values(stageMapping);
1100
1177
  });
1101
- const selectStagesFromAssetTypeIds = restructureCreateSelectorWithArgs(
1102
- toolkit.createSelector([selectAssetStages, (_state, assetTypeIds) => assetTypeIds], (stages, assetTypeIds) => {
1103
- const assetTypeIdsSet = new Set(assetTypeIds);
1104
- const ret = {};
1105
- for (const stage of stages) {
1106
- if (assetTypeIdsSet.has(stage.asset_type)) {
1107
- if (!ret[stage.asset_type]) {
1108
- ret[stage.asset_type] = [];
1109
- }
1110
- ret[stage.asset_type].push(stage);
1111
- }
1112
- }
1113
- for (const key in ret) {
1114
- ret[key] = ret[key].sort((a, b) => a.priority - b.priority);
1115
- }
1116
- return ret;
1117
- })
1118
- );
1119
- const selectAssetTypeStagesMapping = restructureCreateSelectorWithArgs(
1120
- toolkit.createSelector([selectStageMapping, (_state, assetTypeId) => assetTypeId], (stagesMapping, assetTypeId) => {
1121
- const assetTypeStagesMapping = {};
1178
+ const selectAssetStagesMappingOfAssetProcedure = restructureCreateSelectorWithArgs(
1179
+ toolkit.createSelector([selectStageMapping, (_state, id) => id], (stagesMapping, id) => {
1180
+ const assetStageMapping = {};
1122
1181
  for (const [stageId, stage] of Object.entries(stagesMapping)) {
1123
- if (stage.asset_type === assetTypeId) {
1124
- assetTypeStagesMapping[stageId] = stage;
1182
+ if (stage.asset_procedure === id) {
1183
+ assetStageMapping[stageId] = stage;
1125
1184
  }
1126
1185
  }
1127
- return assetTypeStagesMapping;
1186
+ return assetStageMapping;
1128
1187
  })
1129
1188
  );
1130
- const selectStagesOfAssetType = restructureCreateSelectorWithArgs(
1131
- toolkit.createSelector([selectAssetStages, (_state, assetTypeId) => assetTypeId], (stages, assetTypeId) => {
1132
- return fallbackToEmptyArray(
1133
- stages.filter((stage) => stage.asset_type === assetTypeId).sort((a, b) => a.priority - b.priority)
1134
- );
1189
+ const selectAssetStagesOfAssetProcedure = restructureCreateSelectorWithArgs(
1190
+ toolkit.createSelector([selectAssetStages, (_state, id) => id], (stages, id) => {
1191
+ return fallbackToEmptyArray(stages.filter((stage) => stage.asset_procedure === id));
1135
1192
  })
1136
1193
  );
1137
1194
  const selectAssetStagesByIds = restructureCreateSelectorWithArgs(
@@ -1163,21 +1220,35 @@ var __publicField = (obj, key, value) => {
1163
1220
  return ret;
1164
1221
  })
1165
1222
  );
1166
- const { initializeStages, setStage, addStages, updateStages, removeStages, updateStage } = assetStageSlice.actions;
1167
- const assetStageReducer = assetStageSlice.reducer;
1168
1223
  const assetTypeAdapter = createModelAdapter((assetType) => assetType.offline_id);
1169
- const initialState$v = assetTypeAdapter.getInitialState({});
1224
+ const initialState$y = assetTypeAdapter.getInitialState({});
1170
1225
  const assetTypeSlice = toolkit.createSlice({
1171
1226
  name: "assetTypes",
1172
- initialState: initialState$v,
1173
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$v)),
1227
+ initialState: initialState$y,
1228
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$y)),
1174
1229
  reducers: {
1175
1230
  initializeAssetTypes: assetTypeAdapter.initialize,
1231
+ setAssetType: assetTypeAdapter.setOne,
1232
+ setAssetTypes: assetTypeAdapter.setMany,
1176
1233
  addAssetType: assetTypeAdapter.addOne,
1177
- deleteAssetType: assetTypeAdapter.deleteOne
1234
+ addAssetTypes: assetTypeAdapter.addMany,
1235
+ updateAssetType: assetTypeAdapter.updateOne,
1236
+ updateAssetTypes: assetTypeAdapter.updateMany,
1237
+ deleteAssetType: assetTypeAdapter.deleteOne,
1238
+ deleteAssetTypes: assetTypeAdapter.deleteMany
1178
1239
  }
1179
1240
  });
1180
- const { addAssetType, initializeAssetTypes, deleteAssetType } = assetTypeSlice.actions;
1241
+ const {
1242
+ initializeAssetTypes,
1243
+ setAssetType,
1244
+ setAssetTypes,
1245
+ addAssetType,
1246
+ addAssetTypes,
1247
+ updateAssetType,
1248
+ updateAssetTypes,
1249
+ deleteAssetType,
1250
+ deleteAssetTypes
1251
+ } = assetTypeSlice.actions;
1181
1252
  const selectAssetTypesMapping = (state) => state.assetTypeReducer.instances;
1182
1253
  const selectAssetTypes = toolkit.createSelector(
1183
1254
  [selectAssetTypesMapping],
@@ -1207,11 +1278,11 @@ var __publicField = (obj, key, value) => {
1207
1278
  const assetTypeAttachmentAdapter = createModelAdapter(
1208
1279
  (attachment) => attachment.offline_id
1209
1280
  );
1210
- const initialState$u = assetTypeAttachmentAdapter.getInitialState({});
1281
+ const initialState$x = assetTypeAttachmentAdapter.getInitialState({});
1211
1282
  const assetTypeAttachmentSlice = toolkit.createSlice({
1212
1283
  name: "assetTypeAttachments",
1213
- initialState: initialState$u,
1214
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$u)),
1284
+ initialState: initialState$x,
1285
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$x)),
1215
1286
  reducers: {
1216
1287
  initializeAssetTypeAttachments: assetTypeAttachmentAdapter.initialize,
1217
1288
  addAssetTypeAttachment: assetTypeAttachmentAdapter.addOne,
@@ -1270,10 +1341,10 @@ var __publicField = (obj, key, value) => {
1270
1341
  );
1271
1342
  const assetTypeAttachmentReducer = assetTypeAttachmentSlice.reducer;
1272
1343
  const workspaceAdapter = createModelAdapter((workspace) => workspace.offline_id);
1273
- const initialState$t = workspaceAdapter.getInitialState({});
1344
+ const initialState$w = workspaceAdapter.getInitialState({});
1274
1345
  const workspaceSlice = toolkit.createSlice({
1275
1346
  name: "workspace",
1276
- initialState: initialState$t,
1347
+ initialState: initialState$w,
1277
1348
  reducers: {
1278
1349
  initializeWorkspaces: workspaceAdapter.initialize,
1279
1350
  setWorkspaces: workspaceAdapter.setMany,
@@ -1305,14 +1376,14 @@ var __publicField = (obj, key, value) => {
1305
1376
  const workspaceReducer = workspaceSlice.reducer;
1306
1377
  const maxRecentIssues = 10;
1307
1378
  const issueAdapter = createModelAdapter((issue) => issue.offline_id);
1308
- const initialState$s = issueAdapter.getInitialState({
1379
+ const initialState$v = issueAdapter.getInitialState({
1309
1380
  recentIssueIds: []
1310
1381
  });
1311
1382
  const issueSlice = toolkit.createSlice({
1312
1383
  name: "issues",
1313
- initialState: initialState$s,
1384
+ initialState: initialState$v,
1314
1385
  extraReducers: (builder) => builder.addCase("RESET", (state) => {
1315
- Object.assign(state, initialState$s);
1386
+ Object.assign(state, initialState$v);
1316
1387
  }),
1317
1388
  reducers: {
1318
1389
  initializeIssues: issueAdapter.initialize,
@@ -1468,12 +1539,12 @@ var __publicField = (obj, key, value) => {
1468
1539
  );
1469
1540
  const issueReducer = issueSlice.reducer;
1470
1541
  const issueTypeAdapter = createModelAdapter((issueType) => issueType.offline_id);
1471
- const initialState$r = issueTypeAdapter.getInitialState({});
1542
+ const initialState$u = issueTypeAdapter.getInitialState({});
1472
1543
  const issueTypeSlice = toolkit.createSlice({
1473
1544
  name: "issueTypes",
1474
- initialState: initialState$r,
1545
+ initialState: initialState$u,
1475
1546
  extraReducers: (builder) => builder.addCase("RESET", (state) => {
1476
- Object.assign(state, initialState$r);
1547
+ Object.assign(state, initialState$u);
1477
1548
  }),
1478
1549
  reducers: {
1479
1550
  initializeIssueTypes: issueTypeAdapter.initialize,
@@ -1530,15 +1601,15 @@ var __publicField = (obj, key, value) => {
1530
1601
  return selectIssuesOfIssueType(issueTypeId)(state).length;
1531
1602
  };
1532
1603
  const issueTypeReducer = issueTypeSlice.reducer;
1533
- const initialState$q = {
1604
+ const initialState$t = {
1534
1605
  s3Urls: {}
1535
1606
  };
1536
1607
  const msPerHour = 1e3 * 60 * 60;
1537
1608
  const msPerWeek = msPerHour * 24 * 7;
1538
1609
  const fileSlice = toolkit.createSlice({
1539
1610
  name: "file",
1540
- initialState: initialState$q,
1541
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$q)),
1611
+ initialState: initialState$t,
1612
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$t)),
1542
1613
  reducers: {
1543
1614
  setUploadUrl: (state, action) => {
1544
1615
  const { url, fields, sha1 } = action.payload;
@@ -1565,73 +1636,14 @@ var __publicField = (obj, key, value) => {
1565
1636
  return url;
1566
1637
  };
1567
1638
  const fileReducer = fileSlice.reducer;
1568
- var ProjectAccessLevel = /* @__PURE__ */ ((ProjectAccessLevel2) => {
1569
- ProjectAccessLevel2[ProjectAccessLevel2["BASIC"] = 0] = "BASIC";
1570
- ProjectAccessLevel2[ProjectAccessLevel2["ADMIN"] = 2] = "ADMIN";
1571
- return ProjectAccessLevel2;
1572
- })(ProjectAccessLevel || {});
1573
- var OrganizationAccessLevel = /* @__PURE__ */ ((OrganizationAccessLevel2) => {
1574
- OrganizationAccessLevel2[OrganizationAccessLevel2["BASIC"] = 0] = "BASIC";
1575
- OrganizationAccessLevel2[OrganizationAccessLevel2["ADMIN"] = 2] = "ADMIN";
1576
- return OrganizationAccessLevel2;
1577
- })(OrganizationAccessLevel || {});
1578
- var AttachmentModel = /* @__PURE__ */ ((AttachmentModel2) => {
1579
- AttachmentModel2["Issue"] = "issue";
1580
- AttachmentModel2["Asset"] = "asset";
1581
- AttachmentModel2["AssetType"] = "asset_type";
1582
- AttachmentModel2["Project"] = "project";
1583
- AttachmentModel2["Document"] = "document";
1584
- return AttachmentModel2;
1585
- })(AttachmentModel || {});
1586
- var IssueUpdateChange = /* @__PURE__ */ ((IssueUpdateChange2) => {
1587
- IssueUpdateChange2["STATUS"] = "status";
1588
- IssueUpdateChange2["PRIORITY"] = "priority";
1589
- IssueUpdateChange2["CATEGORY"] = "category";
1590
- IssueUpdateChange2["DESCRIPTION"] = "description";
1591
- IssueUpdateChange2["TITLE"] = "title";
1592
- IssueUpdateChange2["ASSIGNED_TO"] = "assigned_to";
1593
- IssueUpdateChange2["DUE_DATE"] = "due_date";
1594
- return IssueUpdateChange2;
1595
- })(IssueUpdateChange || {});
1596
- var VerificationCodeType = /* @__PURE__ */ ((VerificationCodeType2) => {
1597
- VerificationCodeType2[VerificationCodeType2["USER_REGISTRATION"] = 0] = "USER_REGISTRATION";
1598
- VerificationCodeType2[VerificationCodeType2["APPLICATION_INVITE"] = 2] = "APPLICATION_INVITE";
1599
- VerificationCodeType2[VerificationCodeType2["PROJECT_INVITE"] = 4] = "PROJECT_INVITE";
1600
- VerificationCodeType2[VerificationCodeType2["ORGANIZATION_INVITE"] = 6] = "ORGANIZATION_INVITE";
1601
- VerificationCodeType2[VerificationCodeType2["ADD_EMAIL_DOMAIN"] = 8] = "ADD_EMAIL_DOMAIN";
1602
- VerificationCodeType2[VerificationCodeType2["RESET_PASSWORD"] = 10] = "RESET_PASSWORD";
1603
- return VerificationCodeType2;
1604
- })(VerificationCodeType || {});
1605
- var PaddleCheckoutEvent = /* @__PURE__ */ ((PaddleCheckoutEvent2) => {
1606
- PaddleCheckoutEvent2["COMPLETED"] = "checkout.completed";
1607
- PaddleCheckoutEvent2["CLOSED"] = "checkout.closed";
1608
- return PaddleCheckoutEvent2;
1609
- })(PaddleCheckoutEvent || {});
1610
- var LicenseLevel = /* @__PURE__ */ ((LicenseLevel2) => {
1611
- LicenseLevel2[LicenseLevel2["PRO"] = 0] = "PRO";
1612
- return LicenseLevel2;
1613
- })(LicenseLevel || {});
1614
- var LicenseStatus = /* @__PURE__ */ ((LicenseStatus2) => {
1615
- LicenseStatus2[LicenseStatus2["ACTIVE"] = 0] = "ACTIVE";
1616
- LicenseStatus2[LicenseStatus2["PAUSED"] = 2] = "PAUSED";
1617
- LicenseStatus2[LicenseStatus2["CANCELLED"] = 4] = "CANCELLED";
1618
- LicenseStatus2[LicenseStatus2["INACTIVE"] = 6] = "INACTIVE";
1619
- LicenseStatus2[LicenseStatus2["PAST_DUE"] = 8] = "PAST_DUE";
1620
- return LicenseStatus2;
1621
- })(LicenseStatus || {});
1622
- const initialState$p = {
1639
+ const initialState$s = {
1623
1640
  users: {},
1624
- currentUser: {
1625
- id: 0,
1626
- username: "",
1627
- email: "",
1628
- profile: { file: null, file_sha1: null, favourite_project_ids: [], tour_step: -1 }
1629
- }
1641
+ currentUser: null
1630
1642
  };
1631
1643
  const userSlice = toolkit.createSlice({
1632
1644
  name: "users",
1633
- initialState: initialState$p,
1634
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$p)),
1645
+ initialState: initialState$s,
1646
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$s)),
1635
1647
  reducers: {
1636
1648
  setUsers: (state, action) => {
1637
1649
  const usersMapping = {};
@@ -1649,6 +1661,8 @@ var __publicField = (obj, key, value) => {
1649
1661
  state.currentUser = action.payload;
1650
1662
  },
1651
1663
  setProfilePicture: (state, action) => {
1664
+ if (!state.currentUser)
1665
+ return;
1652
1666
  state.currentUser.profile.file = action.payload.file ?? null;
1653
1667
  state.currentUser.profile.file_sha1 = action.payload.file_sha1 ?? null;
1654
1668
  const currentUser = state.users[state.currentUser.id];
@@ -1658,32 +1672,12 @@ var __publicField = (obj, key, value) => {
1658
1672
  currentUser.profile.file = action.payload.file ?? null;
1659
1673
  currentUser.profile.file_sha1 = action.payload.file_sha1 ?? null;
1660
1674
  },
1661
- addFavouriteProjectId: (state, action) => {
1662
- state.currentUser.profile.favourite_project_ids.push(action.payload);
1663
- },
1664
- removeFavouriteProjectId: (state, action) => {
1665
- state.currentUser.profile.favourite_project_ids = state.currentUser.profile.favourite_project_ids.filter(
1666
- (id) => id !== action.payload
1667
- );
1668
- },
1669
- setTourStep: (state, action) => {
1670
- state.currentUser.profile.tour_step = action.payload;
1671
- },
1672
1675
  removeUser: (state, action) => {
1673
1676
  delete state.users[action.payload];
1674
1677
  }
1675
1678
  }
1676
1679
  });
1677
- const {
1678
- setCurrentUser,
1679
- setProfilePicture,
1680
- setUsers,
1681
- addUsers,
1682
- addFavouriteProjectId,
1683
- removeFavouriteProjectId,
1684
- setTourStep,
1685
- removeUser
1686
- } = userSlice.actions;
1680
+ const { setCurrentUser, setProfilePicture, setUsers, addUsers, removeUser } = userSlice.actions;
1687
1681
  const userReducer = userSlice.reducer;
1688
1682
  const selectCurrentUser = (state) => state.userReducer.currentUser;
1689
1683
  const selectUsersMapping = (state) => state.userReducer.users;
@@ -1704,15 +1698,14 @@ var __publicField = (obj, key, value) => {
1704
1698
  return fallbackToEmptyArray(users);
1705
1699
  })
1706
1700
  );
1707
- const selectFavouriteProjects = (state) => state.userReducer.currentUser.profile.favourite_project_ids;
1708
1701
  const organizationAccessAdapter = createModelAdapter(
1709
1702
  (organizationAccess) => organizationAccess.offline_id
1710
1703
  );
1711
- const initialState$o = organizationAccessAdapter.getInitialState({});
1704
+ const initialState$r = organizationAccessAdapter.getInitialState({});
1712
1705
  const organizationAccessSlice = toolkit.createSlice({
1713
1706
  name: "organizationAccess",
1714
- initialState: initialState$o,
1715
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$o)),
1707
+ initialState: initialState$r,
1708
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$r)),
1716
1709
  reducers: {
1717
1710
  initializeOrganizationAccesses: organizationAccessAdapter.initialize,
1718
1711
  updateOrganizationAccess: organizationAccessAdapter.updateOne,
@@ -1730,7 +1723,7 @@ var __publicField = (obj, key, value) => {
1730
1723
  [selectCurrentUser, selectOrganizationAccesses],
1731
1724
  (currentUser, organizationAccesses) => {
1732
1725
  const activeOrganizationAccess = Object.values(organizationAccesses).find(
1733
- (organizationAccess) => organizationAccess.user === currentUser.id
1726
+ (organizationAccess) => organizationAccess.user === (currentUser == null ? void 0 : currentUser.id)
1734
1727
  );
1735
1728
  return activeOrganizationAccess ?? null;
1736
1729
  }
@@ -1749,11 +1742,11 @@ var __publicField = (obj, key, value) => {
1749
1742
  };
1750
1743
  const organizationAccessReducer = organizationAccessSlice.reducer;
1751
1744
  const licenseAdapter = createModelAdapter((license) => license.offline_id);
1752
- const initialState$n = licenseAdapter.getInitialState({});
1745
+ const initialState$q = licenseAdapter.getInitialState({});
1753
1746
  const licenseSlice = toolkit.createSlice({
1754
1747
  name: "license",
1755
- initialState: initialState$n,
1756
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$n)),
1748
+ initialState: initialState$q,
1749
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$q)),
1757
1750
  reducers: {
1758
1751
  initializeLicences: licenseAdapter.initialize,
1759
1752
  addLicenses: licenseAdapter.addMany,
@@ -1778,11 +1771,11 @@ var __publicField = (obj, key, value) => {
1778
1771
  );
1779
1772
  const licenseReducer = licenseSlice.reducer;
1780
1773
  const projectAccessAdapter = createModelAdapter((projectAccess) => projectAccess.offline_id);
1781
- const initialState$m = projectAccessAdapter.getInitialState({});
1774
+ const initialState$p = projectAccessAdapter.getInitialState({});
1782
1775
  const projectAccessSlice = toolkit.createSlice({
1783
1776
  name: "projectAccess",
1784
- initialState: initialState$m,
1785
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$m)),
1777
+ initialState: initialState$p,
1778
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$p)),
1786
1779
  reducers: {
1787
1780
  initializeProjectAccesses: projectAccessAdapter.initialize,
1788
1781
  updateProjectAccess: projectAccessAdapter.updateOne,
@@ -1823,14 +1816,14 @@ var __publicField = (obj, key, value) => {
1823
1816
  return projectAccesses;
1824
1817
  };
1825
1818
  const projectAccessReducer = projectAccessSlice.reducer;
1826
- const initialState$l = {
1819
+ const initialState$o = {
1827
1820
  projects: {},
1828
1821
  activeProjectId: null
1829
1822
  };
1830
1823
  const projectSlice = toolkit.createSlice({
1831
1824
  name: "projects",
1832
- initialState: initialState$l,
1833
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$l)),
1825
+ initialState: initialState$o,
1826
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$o)),
1834
1827
  reducers: {
1835
1828
  setProjects: (state, action) => {
1836
1829
  const projectsMap = {};
@@ -1920,9 +1913,9 @@ var __publicField = (obj, key, value) => {
1920
1913
  [selectCurrentUser, selectProjectUsersAsMapping, selectProjectAccessUserMapping],
1921
1914
  (currentUser, userMapping, projectAccessMapping) => {
1922
1915
  return Object.values(userMapping).sort((userA, userB) => {
1923
- if (userA.id === currentUser.id) {
1916
+ if (userA.id === (currentUser == null ? void 0 : currentUser.id)) {
1924
1917
  return -1;
1925
- } else if (userB.id === currentUser.id) {
1918
+ } else if (userB.id === (currentUser == null ? void 0 : currentUser.id)) {
1926
1919
  return 1;
1927
1920
  }
1928
1921
  const projectAccessesA = projectAccessMapping[userA.id];
@@ -1937,13 +1930,13 @@ var __publicField = (obj, key, value) => {
1937
1930
  });
1938
1931
  }
1939
1932
  );
1940
- const initialState$k = {
1933
+ const initialState$n = {
1941
1934
  organizations: {}
1942
1935
  };
1943
1936
  const organizationSlice = toolkit.createSlice({
1944
1937
  name: "organizations",
1945
- initialState: initialState$k,
1946
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$k)),
1938
+ initialState: initialState$n,
1939
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$n)),
1947
1940
  reducers: {
1948
1941
  setOrganizations: (state, action) => {
1949
1942
  for (const org of action.payload) {
@@ -1999,9 +1992,9 @@ var __publicField = (obj, key, value) => {
1999
1992
  [selectCurrentUser, selectOrganizationUsersAsMapping, selectOrganizationAccessUserMapping],
2000
1993
  (currentUser, userMapping, organizationAccessMapping) => {
2001
1994
  return Object.values(userMapping).sort((userA, userB) => {
2002
- if (userA.id === currentUser.id) {
1995
+ if (userA.id === (currentUser == null ? void 0 : currentUser.id)) {
2003
1996
  return -1;
2004
- } else if (userB.id === currentUser.id) {
1997
+ } else if (userB.id === (currentUser == null ? void 0 : currentUser.id)) {
2005
1998
  return 1;
2006
1999
  }
2007
2000
  const organizationAccessesA = organizationAccessMapping[userA.id];
@@ -2034,14 +2027,14 @@ var __publicField = (obj, key, value) => {
2034
2027
  }
2035
2028
  };
2036
2029
  };
2037
- const initialState$j = {
2030
+ const initialState$m = {
2038
2031
  deletedRequests: [],
2039
2032
  latestRetryTime: 0
2040
2033
  };
2041
2034
  const outboxSlice = toolkit.createSlice({
2042
2035
  name: "outbox",
2043
- initialState: initialState$j,
2044
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$j)),
2036
+ initialState: initialState$m,
2037
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$m)),
2045
2038
  reducers: {
2046
2039
  // enqueueActions is a reducer that does nothing but enqueue API request to the Redux Offline outbox
2047
2040
  // Whenever an issue is being created, a reducer addIssue() is responsible for adding it to the offline store
@@ -2073,15 +2066,15 @@ var __publicField = (obj, key, value) => {
2073
2066
  const selectLatestRetryTime = (state) => state.outboxReducer.latestRetryTime;
2074
2067
  const { enqueueRequest, markForDeletion, markAsDeleted, _setLatestRetryTime } = outboxSlice.actions;
2075
2068
  const outboxReducer = outboxSlice.reducer;
2076
- const initialState$i = {
2069
+ const initialState$l = {
2077
2070
  projectFiles: {},
2078
2071
  activeProjectFileId: null,
2079
2072
  isImportingProjectFile: false
2080
2073
  };
2081
2074
  const projectFileSlice = toolkit.createSlice({
2082
2075
  name: "projectFiles",
2083
- initialState: initialState$i,
2084
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$i)),
2076
+ initialState: initialState$l,
2077
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$l)),
2085
2078
  reducers: {
2086
2079
  addOrReplaceProjectFiles: (state, action) => {
2087
2080
  for (let fileObj of action.payload) {
@@ -2168,11 +2161,11 @@ var __publicField = (obj, key, value) => {
2168
2161
  };
2169
2162
  const projectFileReducer = projectFileSlice.reducer;
2170
2163
  const projectAttachmentAdapter = createModelAdapter((attachment) => attachment.offline_id);
2171
- const initialState$h = projectAttachmentAdapter.getInitialState({});
2164
+ const initialState$k = projectAttachmentAdapter.getInitialState({});
2172
2165
  const projectAttachmentSlice = toolkit.createSlice({
2173
2166
  name: "projectAttachments",
2174
- initialState: initialState$h,
2175
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$h)),
2167
+ initialState: initialState$k,
2168
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$k)),
2176
2169
  reducers: {
2177
2170
  initializeProjectAttachments: projectAttachmentAdapter.initialize,
2178
2171
  addProjectAttachment: projectAttachmentAdapter.addOne,
@@ -2227,12 +2220,12 @@ var __publicField = (obj, key, value) => {
2227
2220
  )
2228
2221
  );
2229
2222
  const projectAttachmentReducer = projectAttachmentSlice.reducer;
2230
- const initialState$g = {
2223
+ const initialState$j = {
2231
2224
  isRehydrated: false
2232
2225
  };
2233
2226
  const rehydratedSlice = toolkit.createSlice({
2234
2227
  name: "rehydrated",
2235
- initialState: initialState$g,
2228
+ initialState: initialState$j,
2236
2229
  // The `reducers` field lets us define reducers and generate associated actions
2237
2230
  reducers: {
2238
2231
  setRehydrated: (state, action) => {
@@ -2257,11 +2250,11 @@ var __publicField = (obj, key, value) => {
2257
2250
  }
2258
2251
  };
2259
2252
  const formRevisionAdapter = createModelAdapter((revision) => revision.offline_id);
2260
- const initialState$f = formRevisionAdapter.getInitialState({});
2253
+ const initialState$i = formRevisionAdapter.getInitialState({});
2261
2254
  const formRevisionsSlice = toolkit.createSlice({
2262
2255
  name: "formRevisions",
2263
- initialState: initialState$f,
2264
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$f)),
2256
+ initialState: initialState$i,
2257
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$i)),
2265
2258
  reducers: {
2266
2259
  initializeFormRevisions: formRevisionAdapter.initialize,
2267
2260
  setFormRevision: formRevisionAdapter.setOne,
@@ -2333,11 +2326,11 @@ var __publicField = (obj, key, value) => {
2333
2326
  });
2334
2327
  const formRevisionReducer = formRevisionsSlice.reducer;
2335
2328
  const formAdapter = createModelAdapter((form) => form.offline_id);
2336
- const initialState$e = formAdapter.getInitialState({});
2329
+ const initialState$h = formAdapter.getInitialState({});
2337
2330
  const formSlice = toolkit.createSlice({
2338
2331
  name: "forms",
2339
- initialState: initialState$e,
2340
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$e)),
2332
+ initialState: initialState$h,
2333
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$h)),
2341
2334
  reducers: {
2342
2335
  initializeForms: formAdapter.initialize,
2343
2336
  setForm: formAdapter.setOne,
@@ -2363,18 +2356,29 @@ var __publicField = (obj, key, value) => {
2363
2356
  (_state, search) => search
2364
2357
  ],
2365
2358
  (formsMapping, revisions, search) => {
2366
- const { searchTerm, maxResults, organization } = search;
2359
+ const { searchTerm, maxResults, favorites, organization } = search;
2360
+ const favoriteMatches = [];
2367
2361
  const regularMatches = [];
2368
2362
  for (const [formId, form] of Object.entries(formsMapping)) {
2363
+ if (favorites !== void 0 && form.favorite != favorites)
2364
+ continue;
2369
2365
  if (Number.isInteger(organization) && organization !== form.organization) {
2370
2366
  continue;
2371
2367
  }
2372
2368
  const latestRevision = _selectLatestFormRevision(revisions, formId);
2373
2369
  if (latestRevision.title.toLowerCase().includes(searchTerm.toLowerCase())) {
2374
- regularMatches.push({ ...form, latestRevision });
2370
+ if (form.favorite) {
2371
+ favoriteMatches.push({ ...form, latestRevision });
2372
+ } else {
2373
+ regularMatches.push({ ...form, latestRevision });
2374
+ }
2375
+ }
2376
+ if (favoriteMatches.length >= maxResults) {
2377
+ break;
2375
2378
  }
2376
2379
  }
2377
- return [...regularMatches.slice(0, maxResults)];
2380
+ const maxRegularMatches = maxResults - favoriteMatches.length;
2381
+ return [...favoriteMatches, ...regularMatches.slice(0, maxRegularMatches)];
2378
2382
  },
2379
2383
  // as the argument is an object, we check the first level of properties for equality
2380
2384
  { memoizeOptions: { equalityCheck: shallowEqual } }
@@ -2406,11 +2410,11 @@ var __publicField = (obj, key, value) => {
2406
2410
  return Object.values(formsMapping).filter((form) => !form.asset_type).length;
2407
2411
  });
2408
2412
  const submissionAdapter = createModelAdapter((submission) => submission.offline_id);
2409
- const initialState$d = submissionAdapter.getInitialState({});
2413
+ const initialState$g = submissionAdapter.getInitialState({});
2410
2414
  const formSubmissionSlice = toolkit.createSlice({
2411
2415
  name: "formSubmissions",
2412
- initialState: initialState$d,
2413
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$d)),
2416
+ initialState: initialState$g,
2417
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$g)),
2414
2418
  reducers: {
2415
2419
  initializeFormSubmissions: submissionAdapter.initialize,
2416
2420
  setFormSubmission: submissionAdapter.setOne,
@@ -2622,11 +2626,11 @@ var __publicField = (obj, key, value) => {
2622
2626
  const formSubmissionAttachmentAdapter = createModelAdapter(
2623
2627
  (attachment) => attachment.offline_id
2624
2628
  );
2625
- const initialState$c = formSubmissionAttachmentAdapter.getInitialState({});
2629
+ const initialState$f = formSubmissionAttachmentAdapter.getInitialState({});
2626
2630
  const formSubmissionAttachmentSlice = toolkit.createSlice({
2627
2631
  name: "formSubmissionAttachments",
2628
- initialState: initialState$c,
2629
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$c)),
2632
+ initialState: initialState$f,
2633
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$f)),
2630
2634
  reducers: {
2631
2635
  initializeFormSubmissionAttachments: formSubmissionAttachmentAdapter.initialize,
2632
2636
  addFormSubmissionAttachment: formSubmissionAttachmentAdapter.addOne,
@@ -2678,11 +2682,11 @@ var __publicField = (obj, key, value) => {
2678
2682
  const formRevisionAttachmentAdapter = createModelAdapter(
2679
2683
  (attachment) => attachment.offline_id
2680
2684
  );
2681
- const initialState$b = formRevisionAttachmentAdapter.getInitialState({});
2685
+ const initialState$e = formRevisionAttachmentAdapter.getInitialState({});
2682
2686
  const formRevisionAttachmentSlice = toolkit.createSlice({
2683
2687
  name: "formRevisionAttachments",
2684
- initialState: initialState$b,
2685
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$b)),
2688
+ initialState: initialState$e,
2689
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$e)),
2686
2690
  reducers: {
2687
2691
  initializeFormRevisionAttachments: formRevisionAttachmentAdapter.initialize,
2688
2692
  addFormRevisionAttachment: formRevisionAttachmentAdapter.addOne,
@@ -2721,10 +2725,10 @@ var __publicField = (obj, key, value) => {
2721
2725
  );
2722
2726
  const formRevisionAttachmentReducer = formRevisionAttachmentSlice.reducer;
2723
2727
  const emailDomainAdapter = createModelAdapter((emailDomain) => emailDomain.offline_id);
2724
- const initialState$a = emailDomainAdapter.getInitialState({});
2728
+ const initialState$d = emailDomainAdapter.getInitialState({});
2725
2729
  const emailDomainsSlice = toolkit.createSlice({
2726
2730
  name: "emailDomains",
2727
- initialState: initialState$a,
2731
+ initialState: initialState$d,
2728
2732
  reducers: {
2729
2733
  initializeEmailDomains: emailDomainAdapter.initialize,
2730
2734
  addEmailDomain: emailDomainAdapter.addOne,
@@ -2745,14 +2749,14 @@ var __publicField = (obj, key, value) => {
2745
2749
  )
2746
2750
  );
2747
2751
  const emailDomainsReducer = emailDomainsSlice.reducer;
2748
- const initialState$9 = {
2752
+ const initialState$c = {
2749
2753
  documents: {}
2750
2754
  };
2751
2755
  const documentSlice = toolkit.createSlice({
2752
2756
  name: "documents",
2753
- initialState: initialState$9,
2757
+ initialState: initialState$c,
2754
2758
  extraReducers: (builder) => builder.addCase("RESET", (state) => {
2755
- Object.assign(state, initialState$9);
2759
+ Object.assign(state, initialState$c);
2756
2760
  }),
2757
2761
  reducers: {
2758
2762
  setDocuments: (state, action) => {
@@ -2941,11 +2945,11 @@ var __publicField = (obj, key, value) => {
2941
2945
  );
2942
2946
  const documentsReducer = documentSlice.reducer;
2943
2947
  const documentAttachmentAdapter = createModelAdapter((attachment) => attachment.offline_id);
2944
- const initialState$8 = documentAttachmentAdapter.getInitialState({});
2948
+ const initialState$b = documentAttachmentAdapter.getInitialState({});
2945
2949
  const documentAttachmentSlice = toolkit.createSlice({
2946
2950
  name: "documentAttachments",
2947
- initialState: initialState$8,
2948
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$8)),
2951
+ initialState: initialState$b,
2952
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$b)),
2949
2953
  reducers: {
2950
2954
  initializeDocumentAttachments: documentAttachmentAdapter.initialize,
2951
2955
  addDocumentAttachment: documentAttachmentAdapter.addOne,
@@ -3004,11 +3008,11 @@ var __publicField = (obj, key, value) => {
3004
3008
  );
3005
3009
  const documentAttachmentReducer = documentAttachmentSlice.reducer;
3006
3010
  const teamAdapter = createModelAdapter((team) => team.offline_id);
3007
- const initialState$7 = teamAdapter.getInitialState({});
3011
+ const initialState$a = teamAdapter.getInitialState({});
3008
3012
  const teamSlice = toolkit.createSlice({
3009
3013
  name: "teams",
3010
- initialState: initialState$7,
3011
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$7)),
3014
+ initialState: initialState$a,
3015
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$a)),
3012
3016
  reducers: {
3013
3017
  setTeam: teamAdapter.setOne,
3014
3018
  initializeTeams: teamAdapter.initialize,
@@ -3059,11 +3063,11 @@ var __publicField = (obj, key, value) => {
3059
3063
  const agentUserConversationAdapter = createModelAdapter(
3060
3064
  (conversation) => conversation.offline_id
3061
3065
  );
3062
- const initialState$6 = agentUserConversationAdapter.getInitialState({});
3066
+ const initialState$9 = agentUserConversationAdapter.getInitialState({});
3063
3067
  const agentsSlice = toolkit.createSlice({
3064
3068
  name: "agents",
3065
- initialState: initialState$6,
3066
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$6)),
3069
+ initialState: initialState$9,
3070
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$9)),
3067
3071
  reducers: {
3068
3072
  initializeConversations: agentUserConversationAdapter.initialize,
3069
3073
  addConversation: agentUserConversationAdapter.addOne,
@@ -3085,11 +3089,11 @@ var __publicField = (obj, key, value) => {
3085
3089
  );
3086
3090
  const agentsReducer = agentsSlice.reducer;
3087
3091
  const issueCommentAdapter = createModelAdapter((comment) => comment.offline_id);
3088
- const initialState$5 = issueCommentAdapter.getInitialState({});
3092
+ const initialState$8 = issueCommentAdapter.getInitialState({});
3089
3093
  const issueCommentSlice = toolkit.createSlice({
3090
3094
  name: "issueComments",
3091
- initialState: initialState$5,
3092
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$5)),
3095
+ initialState: initialState$8,
3096
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$8)),
3093
3097
  reducers: {
3094
3098
  addIssueComment: issueCommentAdapter.addOne,
3095
3099
  addIssueComments: issueCommentAdapter.addMany,
@@ -3118,11 +3122,11 @@ var __publicField = (obj, key, value) => {
3118
3122
  );
3119
3123
  const issueCommentReducer = issueCommentSlice.reducer;
3120
3124
  const issueUpdateAdapter = createModelAdapter((issueUpdate) => issueUpdate.offline_id);
3121
- const initialState$4 = issueUpdateAdapter.getInitialState({});
3125
+ const initialState$7 = issueUpdateAdapter.getInitialState({});
3122
3126
  const issueUpdateSlice = toolkit.createSlice({
3123
3127
  name: "issueUpdates",
3124
- initialState: initialState$4,
3125
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$4)),
3128
+ initialState: initialState$7,
3129
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$7)),
3126
3130
  reducers: {
3127
3131
  initializeIssueUpdates: issueUpdateAdapter.setMany,
3128
3132
  setIssueUpdate: issueUpdateAdapter.setOne,
@@ -3151,11 +3155,11 @@ var __publicField = (obj, key, value) => {
3151
3155
  );
3152
3156
  const issueUpdateReducer = issueUpdateSlice.reducer;
3153
3157
  const issueAttachmentAdapter = createModelAdapter((attachment) => attachment.offline_id);
3154
- const initialState$3 = issueAttachmentAdapter.getInitialState({});
3158
+ const initialState$6 = issueAttachmentAdapter.getInitialState({});
3155
3159
  const issueAttachmentSlice = toolkit.createSlice({
3156
3160
  name: "issueAttachments",
3157
- initialState: initialState$3,
3158
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$3)),
3161
+ initialState: initialState$6,
3162
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$6)),
3159
3163
  reducers: {
3160
3164
  initializeIssueAttachments: issueAttachmentAdapter.initialize,
3161
3165
  addIssueAttachment: issueAttachmentAdapter.addOne,
@@ -3213,23 +3217,23 @@ var __publicField = (obj, key, value) => {
3213
3217
  )
3214
3218
  );
3215
3219
  const issueAttachmentReducer = issueAttachmentSlice.reducer;
3216
- const initialState$2 = {
3220
+ const initialState$5 = {
3217
3221
  version: 0
3218
3222
  };
3219
3223
  const versioningSlice = toolkit.createSlice({
3220
3224
  name: "versioning",
3221
- initialState: initialState$2,
3225
+ initialState: initialState$5,
3222
3226
  reducers: {}
3223
3227
  });
3224
3228
  const versioningReducer = versioningSlice.reducer;
3225
3229
  const geoImageAdapter = createModelAdapter((model) => model.offline_id);
3226
- const initialState$1 = geoImageAdapter.getInitialState({});
3230
+ const initialState$4 = geoImageAdapter.getInitialState({});
3227
3231
  const geoImageSlice = toolkit.createSlice({
3228
3232
  name: "geoImages",
3229
- initialState: initialState$1,
3233
+ initialState: initialState$4,
3230
3234
  extraReducers: (builder) => {
3231
3235
  builder.addCase("RESET", (state) => {
3232
- Object.assign(state, initialState$1);
3236
+ Object.assign(state, initialState$4);
3233
3237
  });
3234
3238
  },
3235
3239
  reducers: {
@@ -3267,11 +3271,11 @@ var __publicField = (obj, key, value) => {
3267
3271
  );
3268
3272
  const geoImageReducer = geoImageSlice.reducer;
3269
3273
  const issueAssociationAdapter = createModelAdapter((assoc) => assoc.offline_id);
3270
- const initialState = issueAssociationAdapter.getInitialState({});
3274
+ const initialState$3 = issueAssociationAdapter.getInitialState({});
3271
3275
  const issueAssociationSlice = toolkit.createSlice({
3272
- name: "issueAssociations",
3273
- initialState,
3274
- extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState)),
3276
+ name: "issueAssociations",
3277
+ initialState: initialState$3,
3278
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$3)),
3275
3279
  reducers: {
3276
3280
  initializeIssueAssociations: issueAssociationAdapter.initialize,
3277
3281
  addIssueAssociation: issueAssociationAdapter.addOne,
@@ -3329,34 +3333,224 @@ var __publicField = (obj, key, value) => {
3329
3333
  )
3330
3334
  );
3331
3335
  const issueAssociationReducer = issueAssociationSlice.reducer;
3332
- let clientStore;
3333
- function setClientStore(store) {
3334
- clientStore = store;
3335
- }
3336
- function getClientStore() {
3337
- return clientStore;
3338
- }
3339
- let clientSDK;
3340
- function setClientSDK(sdkCtor) {
3341
- clientSDK = sdkCtor;
3342
- }
3343
- function getClientSDK() {
3344
- return clientSDK;
3345
- }
3346
- const CLASS_NAME_TO_SERVICE = {};
3347
- class BaseService {
3348
- constructor(sdk) {
3349
- __publicField(this, "client");
3350
- CLASS_NAME_TO_SERVICE[this.constructor.name] = this;
3351
- this.client = sdk;
3336
+ const assetProcedureAdapter = createModelAdapter((assetProcedure) => assetProcedure.offline_id);
3337
+ const initialState$2 = assetProcedureAdapter.getInitialState({});
3338
+ const assetProcedureSlice = toolkit.createSlice({
3339
+ name: "assetProcedures",
3340
+ initialState: initialState$2,
3341
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$2)),
3342
+ reducers: {
3343
+ initializeAssetProcedures: assetProcedureAdapter.initialize,
3344
+ addAssetProcedure: assetProcedureAdapter.addOne,
3345
+ addAssetProcedures: assetProcedureAdapter.addMany,
3346
+ setAssetProcedure: assetProcedureAdapter.setOne,
3347
+ setAssetProcedures: assetProcedureAdapter.setMany,
3348
+ updateAssetProcedure: assetProcedureAdapter.updateOne,
3349
+ updateAssetProcedures: assetProcedureAdapter.updateMany,
3350
+ deleteAssetProcedure: assetProcedureAdapter.deleteOne,
3351
+ deleteAssetProcedures: assetProcedureAdapter.deleteMany
3352
3352
  }
3353
- async enqueueRequest(requestDetails) {
3354
- return this.client.enqueueRequest(requestDetails, this.host, this.constructor.name);
3353
+ });
3354
+ const {
3355
+ initializeAssetProcedures,
3356
+ addAssetProcedure,
3357
+ addAssetProcedures,
3358
+ updateAssetProcedure,
3359
+ updateAssetProcedures,
3360
+ deleteAssetProcedure,
3361
+ deleteAssetProcedures,
3362
+ setAssetProcedure,
3363
+ setAssetProcedures
3364
+ } = assetProcedureSlice.actions;
3365
+ const selectAssetProceduresMapping = (state) => state.assetProcedureReducer.instances;
3366
+ const selectAssetProcedures = toolkit.createSelector([selectAssetProceduresMapping], (assetProceduresMapping) => {
3367
+ return Object.values(assetProceduresMapping);
3368
+ });
3369
+ const selectAssetProceduresOfOrganization = restructureCreateSelectorWithArgs(
3370
+ toolkit.createSelector(
3371
+ [selectAssetProcedures, (_state, organizationId) => organizationId],
3372
+ (assetProcedures, organizationId) => {
3373
+ return fallbackToEmptyArray(
3374
+ assetProcedures.filter((assetProcedure) => assetProcedure.organization === organizationId)
3375
+ );
3376
+ }
3377
+ )
3378
+ );
3379
+ const selectAssetProcedureById = (assetProcedureId) => (state) => {
3380
+ return state.assetProcedureReducer.instances[assetProcedureId];
3381
+ };
3382
+ const selectAssetProceduresByIds = restructureCreateSelectorWithArgs(
3383
+ toolkit.createSelector(
3384
+ [selectAssetProceduresMapping, (_, assetProcedureIds) => assetProcedureIds],
3385
+ (assetProceduresMapping, assetProcedureIds) => {
3386
+ const assetProcedures = [];
3387
+ for (const assetProcedureId of assetProcedureIds) {
3388
+ const assetProcedure = assetProceduresMapping[assetProcedureId];
3389
+ if (assetProcedure)
3390
+ assetProcedures.push(assetProcedure);
3391
+ }
3392
+ return fallbackToEmptyArray(assetProcedures);
3393
+ }
3394
+ )
3395
+ );
3396
+ const assetProcedureReducer = assetProcedureSlice.reducer;
3397
+ const assetProcedureInstanceAdapter = createModelAdapter(
3398
+ (assetProcedureInstance) => assetProcedureInstance.offline_id
3399
+ );
3400
+ const initialState$1 = assetProcedureInstanceAdapter.getInitialState({});
3401
+ const assetProcedureInstanceSlice = toolkit.createSlice({
3402
+ name: "assetProcedureInstances",
3403
+ initialState: initialState$1,
3404
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState$1)),
3405
+ reducers: {
3406
+ initializeAssetProcedureInstances: assetProcedureInstanceAdapter.initialize,
3407
+ addAssetProcedureInstance: assetProcedureInstanceAdapter.addOne,
3408
+ addAssetProcedureInstances: assetProcedureInstanceAdapter.addMany,
3409
+ setAssetProcedureInstance: assetProcedureInstanceAdapter.setOne,
3410
+ setAssetProcedureInstances: assetProcedureInstanceAdapter.setMany,
3411
+ updateAssetProcedureInstance: assetProcedureInstanceAdapter.updateOne,
3412
+ updateAssetProcedureInstances: assetProcedureInstanceAdapter.updateMany,
3413
+ deleteAssetProcedureInstance: assetProcedureInstanceAdapter.deleteOne,
3414
+ deleteAssetProcedureInstances: assetProcedureInstanceAdapter.deleteMany
3355
3415
  }
3356
- dispatch(action) {
3357
- this.client.store.dispatch(action);
3416
+ });
3417
+ const {
3418
+ initializeAssetProcedureInstances,
3419
+ addAssetProcedureInstance,
3420
+ addAssetProcedureInstances,
3421
+ updateAssetProcedureInstance,
3422
+ updateAssetProcedureInstances,
3423
+ deleteAssetProcedureInstance,
3424
+ deleteAssetProcedureInstances,
3425
+ setAssetProcedureInstance,
3426
+ setAssetProcedureInstances
3427
+ } = assetProcedureInstanceSlice.actions;
3428
+ const selectAssetProcedureInstancesMapping = (state) => state.assetProcedureInstanceReducer.instances;
3429
+ const selectAssetProcedureInstances = toolkit.createSelector(
3430
+ [selectAssetProcedureInstancesMapping],
3431
+ (assetProcedureInstancesMapping) => {
3432
+ return Object.values(assetProcedureInstancesMapping);
3358
3433
  }
3359
- }
3434
+ );
3435
+ const selectAssetProcedureInstancesOfAssetProcedure = restructureCreateSelectorWithArgs(
3436
+ toolkit.createSelector(
3437
+ [selectAssetProcedureInstances, (_state, assetProcedureId) => assetProcedureId],
3438
+ (assetProcedureInstances, assetProcedureId) => {
3439
+ return fallbackToEmptyArray(
3440
+ assetProcedureInstances.filter(
3441
+ (assetProcedureInstance) => assetProcedureInstance.asset_procedure === assetProcedureId
3442
+ )
3443
+ );
3444
+ }
3445
+ )
3446
+ );
3447
+ const selectAssetProcedureInstancesOfAssetType = restructureCreateSelectorWithArgs(
3448
+ toolkit.createSelector(
3449
+ [selectAssetProcedureInstances, (_state, assetTypeId) => assetTypeId],
3450
+ (assetProcedureInstances, assetTypeId) => {
3451
+ return fallbackToEmptyArray(
3452
+ assetProcedureInstances.filter(
3453
+ (assetProcedureInstance) => assetProcedureInstance.asset_type === assetTypeId
3454
+ )
3455
+ );
3456
+ }
3457
+ )
3458
+ );
3459
+ const selectAssetProcedureInstanceById = (assetProcedureInstanceId) => (state) => {
3460
+ return state.assetProcedureInstanceReducer.instances[assetProcedureInstanceId];
3461
+ };
3462
+ const selectAssetProcedureInstancesByIds = restructureCreateSelectorWithArgs(
3463
+ toolkit.createSelector(
3464
+ [selectAssetProcedureInstancesMapping, (_, assetProcedureInstanceIds) => assetProcedureInstanceIds],
3465
+ (assetProcedureInstancesMapping, assetProcedureInstanceIds) => {
3466
+ const assetProcedureInstances = [];
3467
+ for (const assetProcedureInstanceId of assetProcedureInstanceIds) {
3468
+ const assetProcedureInstance = assetProcedureInstancesMapping[assetProcedureInstanceId];
3469
+ if (assetProcedureInstance)
3470
+ assetProcedureInstances.push(assetProcedureInstance);
3471
+ }
3472
+ return fallbackToEmptyArray(assetProcedureInstances);
3473
+ }
3474
+ )
3475
+ );
3476
+ const assetProcedureInstanceReducer = assetProcedureInstanceSlice.reducer;
3477
+ const assetProcedureCompletionAdapter = createModelAdapter(
3478
+ (assetProcedureCompletion) => assetProcedureCompletion.offline_id
3479
+ );
3480
+ const initialState = assetProcedureCompletionAdapter.getInitialState({});
3481
+ const assetProcedureCompletionSlice = toolkit.createSlice({
3482
+ name: "assetProcedureCompletions",
3483
+ initialState,
3484
+ extraReducers: (builder) => builder.addCase("RESET", (state) => Object.assign(state, initialState)),
3485
+ reducers: {
3486
+ initializeAssetProcedureCompletions: assetProcedureCompletionAdapter.initialize,
3487
+ addAssetProcedureCompletion: assetProcedureCompletionAdapter.addOne,
3488
+ addAssetProcedureCompletions: assetProcedureCompletionAdapter.addMany,
3489
+ setAssetProcedureCompletion: assetProcedureCompletionAdapter.setOne,
3490
+ setAssetProcedureCompletions: assetProcedureCompletionAdapter.setMany,
3491
+ updateAssetProcedureCompletion: assetProcedureCompletionAdapter.updateOne,
3492
+ updateAssetProcedureCompletions: assetProcedureCompletionAdapter.updateMany,
3493
+ deleteAssetProcedureCompletion: assetProcedureCompletionAdapter.deleteOne,
3494
+ deleteAssetProcedureCompletions: assetProcedureCompletionAdapter.deleteMany
3495
+ }
3496
+ });
3497
+ const {
3498
+ initializeAssetProcedureCompletions,
3499
+ addAssetProcedureCompletion,
3500
+ addAssetProcedureCompletions,
3501
+ updateAssetProcedureCompletion,
3502
+ updateAssetProcedureCompletions,
3503
+ deleteAssetProcedureCompletion,
3504
+ deleteAssetProcedureCompletions,
3505
+ setAssetProcedureCompletion,
3506
+ setAssetProcedureCompletions
3507
+ } = assetProcedureCompletionSlice.actions;
3508
+ const assetProcedureCompletionReducer = assetProcedureCompletionSlice.reducer;
3509
+ const selectAssetProcedureCompletionsMapping = (state) => state.assetProcedureCompletionReducer.instances;
3510
+ const selectAssetProcedureCompletions = toolkit.createSelector(
3511
+ [selectAssetProcedureCompletionsMapping],
3512
+ (assetProcedureCompletionsMapping) => {
3513
+ return Object.values(assetProcedureCompletionsMapping);
3514
+ }
3515
+ );
3516
+ const selectAssetProcedureCompletionsOfAsset = restructureCreateSelectorWithArgs(
3517
+ toolkit.createSelector(
3518
+ [selectAssetProcedureCompletions, (_state, id) => id],
3519
+ (assetProcedureCompletions, id) => {
3520
+ return fallbackToEmptyArray(
3521
+ assetProcedureCompletions.filter(
3522
+ (assetProcedureCompletion) => assetProcedureCompletion.asset === id
3523
+ )
3524
+ );
3525
+ }
3526
+ )
3527
+ );
3528
+ const selectAssetProcedureCompletionsOfAssetProcedureInstance = restructureCreateSelectorWithArgs(
3529
+ toolkit.createSelector([selectAssetProcedureCompletions, (_state, id) => id], (assetProcedureCompletions, id) => {
3530
+ return fallbackToEmptyArray(
3531
+ assetProcedureCompletions.filter(
3532
+ (assetProcedureCompletion) => assetProcedureCompletion.asset_procedure_instance === id
3533
+ )
3534
+ );
3535
+ })
3536
+ );
3537
+ const selectAssetProcedureCompletionById = (assetProcedureCompletionId) => (state) => {
3538
+ return state.assetProcedureCompletionReducer.instances[assetProcedureCompletionId];
3539
+ };
3540
+ const selectAssetProcedureCompletionsByIds = restructureCreateSelectorWithArgs(
3541
+ toolkit.createSelector(
3542
+ [selectAssetProcedureCompletionsMapping, (_, ids) => ids],
3543
+ (assetProcedureCompletionsMapping, ids) => {
3544
+ const assetProcedureCompletions = [];
3545
+ for (const assetProcedureCompletionId of ids) {
3546
+ const assetProcedureCompletion = assetProcedureCompletionsMapping[assetProcedureCompletionId];
3547
+ if (assetProcedureCompletion)
3548
+ assetProcedureCompletions.push(assetProcedureCompletion);
3549
+ }
3550
+ return fallbackToEmptyArray(assetProcedureCompletions);
3551
+ }
3552
+ )
3553
+ );
3360
3554
  const VERSION_REDUCER_KEY = "versioning";
3361
3555
  const overmapReducers = {
3362
3556
  // TODO: attachmentReducer,
@@ -3401,11 +3595,62 @@ var __publicField = (obj, key, value) => {
3401
3595
  };
3402
3596
  const overmapReducer = toolkit.combineReducers(overmapReducers);
3403
3597
  const resetStore = "RESET";
3598
+ function handleWorkspaceRemoval(draft, action) {
3599
+ const workspaceId = action.payload;
3600
+ const issuesVisibleInWorkspace = Object.values(draft.issueReducer.instances).filter(
3601
+ (issue) => issue.visible_in_workspaces.includes(workspaceId)
3602
+ );
3603
+ const mainWorkspace = selectMainWorkspace(draft);
3604
+ if (!mainWorkspace) {
3605
+ throw new Error("Main workspace not found");
3606
+ }
3607
+ if (action.payload === mainWorkspace.offline_id) {
3608
+ throw new Error("Tried to delete main workspace");
3609
+ }
3610
+ const categoriesInThisWorkspace = new Set(
3611
+ selectCategoriesOfWorkspace(workspaceId)(draft).map((category) => category.offline_id)
3612
+ );
3613
+ for (const issue of issuesVisibleInWorkspace) {
3614
+ if (issue.category && categoriesInThisWorkspace.has(issue.category)) {
3615
+ issue.category = null;
3616
+ }
3617
+ }
3618
+ const issuesWithThisWorkspaceIndex = issuesVisibleInWorkspace.filter(
3619
+ (issue) => issue.index_workspace === action.payload
3620
+ );
3621
+ for (const issue of issuesWithThisWorkspaceIndex) {
3622
+ issue.index_workspace = mainWorkspace.offline_id;
3623
+ if (!issue.visible_in_workspaces.includes(mainWorkspace.offline_id)) {
3624
+ issue.visible_in_workspaces.push(mainWorkspace.offline_id);
3625
+ }
3626
+ }
3627
+ for (const issue of issuesVisibleInWorkspace) {
3628
+ const indexOfWorkspace = issue.visible_in_workspaces.indexOf(workspaceId);
3629
+ if (indexOfWorkspace === -1) {
3630
+ throw new Error("Workspace not found in issue's visible_in_workspaces");
3631
+ }
3632
+ issue.visible_in_workspaces.splice(indexOfWorkspace, 1);
3633
+ }
3634
+ for (const issue of issuesVisibleInWorkspace) {
3635
+ if (issue.visible_in_workspaces.length === 0) {
3636
+ throw new Error(`Unexpected error: Issue ${issue.offline_id} has no visible_in_workspaces`);
3637
+ }
3638
+ if (issue.index_workspace === action.payload || !issue.index_workspace) {
3639
+ throw new Error(`Failed to update index_workspace of issue ${issue.offline_id} to main workspace`);
3640
+ }
3641
+ }
3642
+ }
3404
3643
  const overmapRootReducer = (state, action) => {
3405
3644
  if (action.type === "auth/setLoggedIn" && !action.payload) {
3406
3645
  return overmapReducer(void 0, action);
3407
3646
  }
3408
- return overmapReducer(state, action);
3647
+ let mutatedState = state;
3648
+ if (state && action.type === "workspace/removeWorkspace") {
3649
+ mutatedState = toolkit.createNextState(state, (draft) => {
3650
+ handleWorkspaceRemoval(draft, action);
3651
+ });
3652
+ }
3653
+ return overmapReducer(mutatedState, action);
3409
3654
  };
3410
3655
  let __OUTBOX_COORDINATOR = null;
3411
3656
  function getOutboxCoordinator() {
@@ -4024,17 +4269,10 @@ var __publicField = (obj, key, value) => {
4024
4269
  }
4025
4270
  }
4026
4271
  class CategoryService extends BaseApiService {
4027
- add(payload, workspaceId) {
4028
- const { store } = this.client;
4029
- const createdBy = store.getState().userReducer.currentUser.id;
4030
- const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
4031
- const offlineCategory = offline({
4032
- ...payload,
4033
- created_by: createdBy,
4034
- submitted_at: submittedAt,
4035
- workspace: workspaceId
4036
- });
4037
- this.dispatch(addCategory(offlineCategory));
4272
+ add(category, workspaceId) {
4273
+ const offlineCategory = offline(category);
4274
+ const categoryWithWorkspace = { ...offlineCategory, workspace: workspaceId };
4275
+ this.dispatch(addCategory(categoryWithWorkspace));
4038
4276
  const promise = this.enqueueRequest({
4039
4277
  description: "Create Category",
4040
4278
  method: HttpMethod.POST,
@@ -4043,10 +4281,10 @@ var __publicField = (obj, key, value) => {
4043
4281
  workspace_id: workspaceId.toString()
4044
4282
  },
4045
4283
  payload: offlineCategory,
4046
- blockers: [workspaceId],
4284
+ blockers: [],
4047
4285
  blocks: [offlineCategory.offline_id]
4048
4286
  });
4049
- return [offlineCategory, promise];
4287
+ return [categoryWithWorkspace, promise];
4050
4288
  }
4051
4289
  update(category, workspaceId) {
4052
4290
  const state = this.client.store.getState();
@@ -4104,43 +4342,70 @@ var __publicField = (obj, key, value) => {
4104
4342
  return chunks;
4105
4343
  }
4106
4344
  class AssetService extends BaseApiService {
4107
- // Basic CRUD functions
4108
- add(asset, workspaceId) {
4109
- if (!asset.canvas_marker && !asset.geo_marker) {
4345
+ add(payload) {
4346
+ const { store } = this.client;
4347
+ if (!payload.canvas_marker && !payload.geo_marker) {
4110
4348
  throw new Error("Asset must have either a canvas_marker or geo_marker");
4111
4349
  }
4112
- const offlineAsset = offline(asset);
4350
+ const createdBy = store.getState().userReducer.currentUser.id;
4351
+ const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
4352
+ const offlineAsset = offline({
4353
+ ...payload,
4354
+ created_by: createdBy,
4355
+ submitted_at: submittedAt
4356
+ });
4113
4357
  this.dispatch(addAsset(offlineAsset));
4114
4358
  const promise = this.enqueueRequest({
4115
4359
  description: "Create asset",
4116
4360
  method: HttpMethod.POST,
4117
- url: `/assets/types/${offlineAsset.asset_type}/add-assets/`,
4118
- queryParams: {
4119
- workspace_id: workspaceId.toString()
4361
+ url: "/assets/",
4362
+ payload: {
4363
+ offline_id: offlineAsset.offline_id,
4364
+ submitted_at: offlineAsset.submitted_at,
4365
+ geo_marker: offlineAsset.geo_marker,
4366
+ canvas_marker: offlineAsset.canvas_marker,
4367
+ label: offlineAsset.label,
4368
+ description: offlineAsset.description,
4369
+ asset_type: offlineAsset.asset_type
4120
4370
  },
4121
- payload: { assets: [offlineAsset] },
4122
- blockers: [],
4371
+ blockers: [offlineAsset.asset_type],
4123
4372
  blocks: [offlineAsset.offline_id]
4124
4373
  });
4374
+ promise.then((createdAsset) => {
4375
+ this.dispatch(updateAsset(createdAsset));
4376
+ }).catch(() => {
4377
+ this.dispatch(deleteAsset(offlineAsset.offline_id));
4378
+ });
4125
4379
  return [offlineAsset, promise];
4126
4380
  }
4127
- update(asset, workspaceId) {
4128
- if (!asset.canvas_marker && !asset.geo_marker) {
4381
+ update(payload) {
4382
+ const { store } = this.client;
4383
+ if (!payload.canvas_marker && !payload.geo_marker) {
4129
4384
  throw new Error("Asset must have either a canvas_marker or geo_marker");
4130
4385
  }
4131
- this.client.store.dispatch(updateAsset(asset));
4386
+ const asset = selectAssetById(payload.offline_id)(store.getState());
4387
+ if (!asset) {
4388
+ throw new Error(`No asset with id ${payload.offline_id} found in the store`);
4389
+ }
4390
+ const updatedAsset = {
4391
+ ...asset,
4392
+ ...payload
4393
+ };
4394
+ this.dispatch(updateAsset(updatedAsset));
4132
4395
  const promise = this.enqueueRequest({
4133
4396
  description: "Edit asset",
4134
4397
  method: HttpMethod.PATCH,
4135
- url: `/assets/${asset.offline_id}/`,
4136
- queryParams: {
4137
- workspace_id: workspaceId.toString()
4138
- },
4139
- payload: asset,
4140
- blockers: [asset.offline_id],
4141
- blocks: [asset.offline_id]
4398
+ url: `/assets/${payload.offline_id}/`,
4399
+ payload,
4400
+ blockers: [payload.offline_id],
4401
+ blocks: [payload.offline_id]
4402
+ });
4403
+ promise.then((result) => {
4404
+ this.dispatch(updateAsset(result));
4405
+ }).catch(() => {
4406
+ this.dispatch(updateAsset(asset));
4142
4407
  });
4143
- return [asset, promise];
4408
+ return [updatedAsset, promise];
4144
4409
  }
4145
4410
  async remove(assetId) {
4146
4411
  const { store } = this.client;
@@ -4178,39 +4443,17 @@ var __publicField = (obj, key, value) => {
4178
4443
  throw err;
4179
4444
  });
4180
4445
  }
4181
- async deleteAllAssetsOfAssetType(assetTypeId) {
4182
- const { store } = this.client;
4183
- const state = store.getState();
4184
- const allAssetsOfAssetType = selectAssetsOfAssetType(assetTypeId)(state);
4185
- const allAssetsOfAssetTypeIds = allAssetsOfAssetType.map((c) => c.offline_id);
4186
- const affectedOfflineIds = [assetTypeId, ...allAssetsOfAssetTypeIds];
4187
- store.dispatch(deleteAssets(allAssetsOfAssetTypeIds));
4188
- return this.enqueueRequest({
4189
- description: "Delete all assets of asset type",
4190
- method: HttpMethod.DELETE,
4191
- url: `/assets/types/${assetTypeId}/delete-all-of-type/`,
4192
- blockers: affectedOfflineIds,
4193
- blocks: affectedOfflineIds
4194
- }).catch((err) => {
4195
- store.dispatch(addAssets(allAssetsOfAssetType));
4196
- throw err;
4197
- });
4198
- }
4199
- // TODO: payload does not require asset_type
4200
- bulkAdd(assetsToCreate, workspaceId, assetTypeId, batchSize) {
4446
+ bulkAdd(payloads, assetTypeId, batchSize) {
4201
4447
  const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
4202
4448
  const transactionId = uuid.v4();
4203
- const assetBatches = chunkArray(assetsToCreate, batchSize).map((assetBatch) => {
4204
- const assetPayloads = assetBatch.map((assetPayload) => {
4205
- return offline({
4206
- ...assetPayload,
4207
- submitted_at: submittedAt
4208
- });
4209
- });
4449
+ const assetBatches = chunkArray(payloads, batchSize).map((assetBatch) => {
4450
+ const assetPayloads = assetBatch.map((assetPayload) => offline(assetPayload));
4210
4451
  return {
4211
4452
  batchId: uuid.v4(),
4212
4453
  payload: {
4213
4454
  transaction_id: transactionId,
4455
+ submitted_at: submittedAt,
4456
+ asset_type: assetTypeId,
4214
4457
  assets: assetPayloads
4215
4458
  }
4216
4459
  };
@@ -4228,10 +4471,7 @@ var __publicField = (obj, key, value) => {
4228
4471
  const promise = this.enqueueRequest({
4229
4472
  description: "Batch create assets",
4230
4473
  method: HttpMethod.POST,
4231
- url: `/assets/types/${assetTypeId}/add-assets/`,
4232
- queryParams: {
4233
- workspace_id: workspaceId.toString()
4234
- },
4474
+ url: "/assets/bulk/",
4235
4475
  payload,
4236
4476
  blockers,
4237
4477
  blocks: blocks2
@@ -4249,7 +4489,10 @@ var __publicField = (obj, key, value) => {
4249
4489
  const result = await this.enqueueRequest({
4250
4490
  description: "Get assets",
4251
4491
  method: HttpMethod.GET,
4252
- url: `/projects/${projectId}/assets/`,
4492
+ url: "/assets/",
4493
+ queryParams: {
4494
+ project_id: projectId.toString()
4495
+ },
4253
4496
  blockers: [],
4254
4497
  blocks: []
4255
4498
  });
@@ -4257,154 +4500,217 @@ var __publicField = (obj, key, value) => {
4257
4500
  }
4258
4501
  }
4259
4502
  class AssetStageCompletionService extends BaseApiService {
4260
- add(assetId, stageId) {
4261
- var _a2;
4503
+ add(payload) {
4262
4504
  const { store } = this.client;
4263
- const assetTypeId = (_a2 = selectAssetById(assetId)(store.getState())) == null ? void 0 : _a2.asset_type;
4264
- if (!assetTypeId) {
4265
- throw new Error(`Asset with offline_id ${assetId} not found`);
4266
- }
4505
+ const createdBy = store.getState().userReducer.currentUser.id;
4506
+ const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
4267
4507
  const offlineStageCompletion = offline({
4268
- asset: assetId,
4269
- stage: stageId
4508
+ ...payload,
4509
+ created_by: createdBy,
4510
+ submitted_at: submittedAt
4270
4511
  });
4271
- this.dispatch(addStageCompletion(offlineStageCompletion));
4512
+ this.dispatch(addAssetStageCompletion(offlineStageCompletion));
4272
4513
  const promise = this.enqueueRequest({
4273
- description: "Complete stage",
4514
+ description: "Add asset stage completion",
4274
4515
  method: HttpMethod.POST,
4275
- url: `/assets/types/${assetTypeId}/complete-stages/`,
4276
- // TODO: Add submitted_at to model
4277
- payload: { completions: [{ ...offlineStageCompletion, submitted_at: (/* @__PURE__ */ new Date()).getTime() / 1e3 }] },
4278
- blockers: [assetId, stageId],
4516
+ url: "/asset-stage-completions/",
4517
+ payload: {
4518
+ offline_id: offlineStageCompletion.offline_id,
4519
+ submitted_at: submittedAt,
4520
+ asset_procedure_completion: payload.asset_procedure_completion,
4521
+ stage: payload.stage
4522
+ },
4523
+ blockers: [payload.asset_procedure_completion, payload.stage],
4279
4524
  blocks: [offlineStageCompletion.offline_id]
4280
4525
  });
4526
+ promise.then((result) => {
4527
+ this.dispatch(updateAssetStageCompletion(result));
4528
+ }).catch(() => {
4529
+ this.dispatch(deleteAssetStageCompletion(offlineStageCompletion.offline_id));
4530
+ });
4281
4531
  return [offlineStageCompletion, promise];
4282
4532
  }
4283
- async refreshStore(projectId) {
4284
- const result = await this.enqueueRequest({
4285
- description: "Get stage completions",
4286
- method: HttpMethod.GET,
4287
- url: `/projects/${projectId}/asset-stage-completions/`,
4288
- blockers: [],
4533
+ delete(id) {
4534
+ const { store } = this.client;
4535
+ const assetStageCompletion = selectAssetStageCompletionById(id)(store.getState());
4536
+ if (!assetStageCompletion) {
4537
+ throw new Error(`Expected asset stage completion with id ${id} to exist`);
4538
+ }
4539
+ this.dispatch(deleteAssetStageCompletion(id));
4540
+ const promise = this.enqueueRequest({
4541
+ description: "Delete asset stage completion",
4542
+ method: HttpMethod.DELETE,
4543
+ url: `/asset-stage-completions/${id}/`,
4544
+ blockers: [id],
4289
4545
  blocks: []
4290
4546
  });
4291
- this.dispatch(addStageCompletions(result));
4547
+ promise.catch(() => {
4548
+ this.dispatch(addAssetStageCompletion(assetStageCompletion));
4549
+ });
4550
+ return promise;
4292
4551
  }
4293
- /**
4294
- * Creates a collection of AssetStageCompletions, marking the referenced stages as completed for the referenced
4295
- * assets. It's REQUIRED that all assets referenced all have the SAME asset type.
4296
- * @param assetTypeId The ID of the asset type for which we are completing stages (we can only complete
4297
- * stages for one asset type at a time)
4298
- * @param stageCompletions
4299
- */
4300
- async bulkAdd(assetTypeId, stageCompletions) {
4301
- const offlineStageCompletions = stageCompletions.map((completion) => {
4302
- return offline(completion);
4303
- });
4304
- const asMapping = {};
4305
- for (const completion of stageCompletions) {
4306
- const stageToCompletionDateMapping = asMapping[completion.asset] || {};
4307
- stageToCompletionDateMapping[completion.stage] = (/* @__PURE__ */ new Date()).toISOString();
4308
- asMapping[completion.asset] = stageToCompletionDateMapping;
4309
- }
4310
- this.dispatch(addStageCompletions(asMapping));
4311
- await this.enqueueRequest({
4312
- description: "Bulk complete stages",
4552
+ bulkAdd(payloads) {
4553
+ const { store } = this.client;
4554
+ const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
4555
+ const createdBy = store.getState().userReducer.currentUser.id;
4556
+ const payload = payloads.map((payload2) => offline(payload2));
4557
+ const offlineStageCompletions = payload.map((completion) => {
4558
+ return {
4559
+ ...completion,
4560
+ created_by: createdBy,
4561
+ submitted_at: submittedAt
4562
+ };
4563
+ });
4564
+ const offlineIds = offlineStageCompletions.map(({ offline_id }) => offline_id);
4565
+ this.dispatch(addAssetStageCompletions(offlineStageCompletions));
4566
+ const promise = this.enqueueRequest({
4567
+ description: "Bulk create asset stage completions",
4313
4568
  method: HttpMethod.POST,
4314
- url: `/assets/types/${assetTypeId}/complete-stages/`,
4569
+ url: "/asset-stage-completions/bulk/",
4315
4570
  payload: {
4316
- completions: offlineStageCompletions
4571
+ submitted_at: submittedAt,
4572
+ completions: payload
4317
4573
  },
4318
- blockers: [assetTypeId, ...stageCompletions.map((c) => c.asset), ...stageCompletions.map((c) => c.stage)],
4319
- blocks: offlineStageCompletions.map((c) => c.offline_id)
4574
+ blockers: [...payloads.map((c) => c.asset_procedure_completion), ...payloads.map((c) => c.stage)],
4575
+ blocks: offlineIds
4320
4576
  });
4321
- }
4322
- bulkDelete(stageId, assetIds) {
4323
- const stageCompletionsToRemove = assetIds.map((assetId) => {
4324
- return {
4325
- asset: assetId,
4326
- stage: stageId
4327
- };
4577
+ promise.then((result) => {
4578
+ this.dispatch(updateAssetStageCompletions(result));
4579
+ }).catch(() => {
4580
+ this.dispatch(deleteAssetStageCompletions(offlineIds));
4328
4581
  });
4329
- this.dispatch(removeStageCompletions(stageCompletionsToRemove));
4330
- return this.enqueueRequest({
4331
- description: `Undo stage for ${assetIds.length} assets(s)`,
4332
- // TODO: Rename to setCompletedStages
4582
+ return [offlineStageCompletions, promise];
4583
+ }
4584
+ bulkDelete(ids) {
4585
+ const { store } = this.client;
4586
+ const assetStageCompletions = selectAssetStageCompletionsByIds(ids)(store.getState());
4587
+ this.dispatch(deleteAssetStageCompletions(ids));
4588
+ const promise = this.enqueueRequest({
4589
+ description: "Deleting asset stage completions",
4333
4590
  method: HttpMethod.DELETE,
4334
- url: `/assets/stages/${stageId}/undo-stages/`,
4591
+ url: "/asset-stage-completions/bulk/",
4335
4592
  payload: {
4336
- assets: assetIds
4593
+ completion_ids: ids
4594
+ },
4595
+ blockers: ids,
4596
+ blocks: []
4597
+ });
4598
+ promise.catch(() => {
4599
+ this.dispatch(addAssetStageCompletions(assetStageCompletions));
4600
+ });
4601
+ return promise;
4602
+ }
4603
+ async refreshStore(projectId) {
4604
+ const result = await this.enqueueRequest({
4605
+ description: "Get asset stage completions",
4606
+ method: HttpMethod.GET,
4607
+ url: "/asset-stage-completions/",
4608
+ queryParams: {
4609
+ project_id: projectId.toString()
4337
4610
  },
4338
- blockers: [stageId, ...assetIds],
4611
+ blockers: [],
4339
4612
  blocks: []
4340
4613
  });
4614
+ this.dispatch(initializeAssetStageCompletions(result));
4341
4615
  }
4342
4616
  }
4343
4617
  class AssetStageService extends BaseApiService {
4344
- async bulkCreateStages(stagesToSubmit, assetTypeId, workspaceId) {
4618
+ bulkAdd(stagesToSubmit, assetProcedureId) {
4619
+ const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
4620
+ const createdBy = this.client.store.getState().userReducer.currentUser.id;
4345
4621
  const payload = stagesToSubmit.map((stage) => {
4346
4622
  return offline(stage);
4347
4623
  });
4348
- const fullStages = payload.map((stage) => {
4349
- return { ...stage, asset_type: assetTypeId };
4624
+ const offlineStages = payload.map((stage) => {
4625
+ return { ...stage, asset_procedure: assetProcedureId, created_by: createdBy, submitted_at: submittedAt };
4350
4626
  });
4351
- this.dispatch(addStages(fullStages));
4352
- return this.enqueueRequest({
4627
+ this.dispatch(addAssetStages(offlineStages));
4628
+ const promise = this.enqueueRequest({
4353
4629
  description: "Add asset stages",
4354
4630
  method: HttpMethod.POST,
4355
- url: `/assets/types/${assetTypeId}/add-stages/`,
4631
+ url: "/asset-stages/bulk/",
4356
4632
  payload: {
4633
+ submitted_at: submittedAt,
4634
+ asset_procedure: assetProcedureId,
4357
4635
  stages: payload
4358
4636
  },
4359
- queryParams: {
4360
- workspace_id: workspaceId.toString()
4361
- },
4362
- blockers: [assetTypeId, workspaceId],
4637
+ blockers: [assetProcedureId],
4363
4638
  blocks: payload.map(({ offline_id }) => offline_id)
4364
4639
  });
4640
+ promise.then((result) => {
4641
+ this.dispatch(updateAssetStages(result));
4642
+ }).catch(() => {
4643
+ this.dispatch(deleteAssetStages(offlineStages.map(({ offline_id }) => offline_id)));
4644
+ });
4645
+ return [offlineStages, promise];
4365
4646
  }
4366
- async bulkUpdateStages(stagesToUpdate, assetTypeId) {
4647
+ async bulkUpdate(stagesToUpdate, assetProcedureId) {
4367
4648
  const store = this.client.store;
4368
4649
  const state = store.getState();
4369
4650
  const prevStages = selectAssetStagesByIds(stagesToUpdate.map(({ offline_id }) => offline_id))(state);
4370
- this.dispatch(updateStages(stagesToUpdate));
4651
+ this.dispatch(updateAssetStages(stagesToUpdate));
4371
4652
  return this.enqueueRequest({
4372
4653
  description: "Edit asset stages",
4373
4654
  method: HttpMethod.PATCH,
4374
- url: `/assets/types/${assetTypeId}/bulk-update-stages/`,
4655
+ url: `/asset-procedures/${assetProcedureId}/bulk-update-stages/`,
4375
4656
  payload: {
4376
4657
  stages: stagesToUpdate
4377
4658
  },
4378
- blockers: [assetTypeId],
4659
+ blockers: [assetProcedureId],
4379
4660
  blocks: stagesToUpdate.map(({ offline_id }) => offline_id)
4380
4661
  }).catch((e) => {
4381
- store.dispatch(updateStages(prevStages));
4662
+ this.dispatch(updateAssetStages(prevStages));
4382
4663
  throw e;
4383
4664
  });
4384
4665
  }
4385
4666
  async bulkDelete(idsToDelete) {
4386
- this.dispatch(removeStages(idsToDelete));
4387
- return this.enqueueRequest({
4667
+ const { store } = this.client;
4668
+ const assetStages = selectAssetStagesByIds(idsToDelete)(store.getState());
4669
+ this.dispatch(deleteAssetStages(idsToDelete));
4670
+ const promise = this.enqueueRequest({
4388
4671
  description: "Delete asset stages",
4389
4672
  method: HttpMethod.DELETE,
4390
- url: "/assets/stages/bulk-delete/",
4673
+ url: "/asset-stages/bulk/",
4391
4674
  payload: {
4392
4675
  stage_ids: idsToDelete
4393
4676
  },
4394
4677
  blockers: idsToDelete,
4395
4678
  blocks: []
4396
4679
  });
4680
+ promise.catch(() => {
4681
+ this.dispatch(addAssetStages(assetStages));
4682
+ });
4683
+ return promise;
4397
4684
  }
4398
- async update(assetStage) {
4399
- this.dispatch(addStages([assetStage]));
4400
- return this.enqueueRequest({
4685
+ update(payload) {
4686
+ const { store } = this.client;
4687
+ const assetStage = selectAssetStageById(payload.offline_id)(store.getState());
4688
+ if (!assetStage)
4689
+ throw new Error(`No asset stage with id ${payload.offline_id} found in the store`);
4690
+ const updatedAssetStage = {
4691
+ ...assetStage,
4692
+ ...payload
4693
+ };
4694
+ this.dispatch(updateAssetStage(updatedAssetStage));
4695
+ const promise = this.enqueueRequest({
4401
4696
  description: "Update asset stage",
4402
4697
  method: HttpMethod.PATCH,
4403
- url: `/assets/stages/${assetStage.offline_id}/`,
4404
- payload: assetStage,
4698
+ url: `/asset-stages/${assetStage.offline_id}/`,
4699
+ payload: {
4700
+ name: payload.name,
4701
+ description: payload.description,
4702
+ priority: payload.priority,
4703
+ color: payload.color
4704
+ },
4405
4705
  blockers: [assetStage.offline_id],
4406
4706
  blocks: [assetStage.offline_id]
4407
4707
  });
4708
+ promise.then((result) => {
4709
+ this.dispatch(updateAssetStage(result));
4710
+ }).catch(() => {
4711
+ this.dispatch(setAssetStage(assetStage));
4712
+ });
4713
+ return [updatedAssetStage, promise];
4408
4714
  }
4409
4715
  async linkForm(stageId, formId) {
4410
4716
  const { store } = this.client;
@@ -4412,18 +4718,18 @@ var __publicField = (obj, key, value) => {
4412
4718
  if (!stage) {
4413
4719
  throw new Error(`No asset stage with id ${stageId} found in the store`);
4414
4720
  }
4415
- this.dispatch(updateStage({ ...stage, form: formId }));
4721
+ this.dispatch(updateAssetStage({ ...stage, form: formId }));
4416
4722
  try {
4417
4723
  await this.enqueueRequest({
4418
4724
  description: "Link asset stage to form",
4419
4725
  method: HttpMethod.POST,
4420
- url: `/assets/stages/${stageId}/associate-with-form/`,
4726
+ url: `/asset-stages/${stageId}/associate-with-form/`,
4421
4727
  payload: { form: formId },
4422
4728
  blockers: [stageId, formId],
4423
4729
  blocks: [stageId]
4424
4730
  });
4425
4731
  } catch (e) {
4426
- this.dispatch(setStage(stage));
4732
+ this.dispatch(setAssetStage(stage));
4427
4733
  throw e;
4428
4734
  }
4429
4735
  }
@@ -4433,29 +4739,32 @@ var __publicField = (obj, key, value) => {
4433
4739
  if (!stage) {
4434
4740
  throw new Error(`No asset stage with id ${stageId} found in the store`);
4435
4741
  }
4436
- this.dispatch(updateStage({ ...stage, form: void 0 }));
4742
+ this.dispatch(updateAssetStage({ ...stage, form: void 0 }));
4437
4743
  try {
4438
4744
  await this.enqueueRequest({
4439
4745
  description: "Unlink asset stage from form",
4440
4746
  method: HttpMethod.DELETE,
4441
- url: `/assets/stages/${stageId}/associate-with-form/`,
4747
+ url: `/asset-stages/${stageId}/associate-with-form/`,
4442
4748
  blockers: [stageId, formId],
4443
4749
  blocks: [stageId]
4444
4750
  });
4445
4751
  } catch (e) {
4446
- this.dispatch(setStage(stage));
4752
+ this.dispatch(setAssetStage(stage));
4447
4753
  throw e;
4448
4754
  }
4449
4755
  }
4450
- async refreshStore(projectId) {
4756
+ async refreshStore(organizationId) {
4451
4757
  const result = await this.enqueueRequest({
4452
4758
  description: "Get asset stages",
4453
4759
  method: HttpMethod.GET,
4454
- url: `/projects/${projectId}/asset-stages/`,
4760
+ url: "/asset-stages/",
4761
+ queryParams: {
4762
+ organization_id: organizationId.toString()
4763
+ },
4455
4764
  blockers: [],
4456
4765
  blocks: []
4457
4766
  });
4458
- this.dispatch(initializeStages(result));
4767
+ this.dispatch(initializeAssetStages(result));
4459
4768
  }
4460
4769
  }
4461
4770
  class BaseUploadService extends BaseApiService {
@@ -4662,29 +4971,64 @@ var __publicField = (obj, key, value) => {
4662
4971
  }
4663
4972
  }
4664
4973
  class AssetTypeService extends BaseApiService {
4665
- add(assetType) {
4666
- const offlineAssetType = offline(assetType);
4974
+ add(payload) {
4975
+ const { store } = this.client;
4976
+ const createdBy = store.getState().userReducer.currentUser.id;
4977
+ const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
4978
+ const offlineAssetType = offline({
4979
+ ...payload,
4980
+ created_by: createdBy,
4981
+ submitted_at: submittedAt
4982
+ });
4667
4983
  this.dispatch(addAssetType(offlineAssetType));
4668
4984
  const promise = this.enqueueRequest({
4669
4985
  description: "Create asset type",
4670
4986
  method: HttpMethod.POST,
4671
- url: `/projects/${assetType.project}/asset-types/`,
4987
+ url: "/asset-types/",
4988
+ queryParams: {
4989
+ project_id: payload.project.toString()
4990
+ },
4672
4991
  payload: { ...offlineAssetType },
4673
4992
  blockers: [],
4674
4993
  blocks: [offlineAssetType.offline_id]
4675
4994
  });
4995
+ promise.then((result) => {
4996
+ this.dispatch(updateAssetType(result));
4997
+ }).catch(() => {
4998
+ this.dispatch(deleteAssetType(offlineAssetType.offline_id));
4999
+ });
4676
5000
  return [offlineAssetType, promise];
4677
5001
  }
4678
- update(assetType) {
4679
- this.dispatch(addAssetType(assetType));
4680
- return this.enqueueRequest({
5002
+ update(payload) {
5003
+ const { store } = this.client;
5004
+ const assetType = selectAssetTypeById(payload.offline_id)(store.getState());
5005
+ if (!assetType) {
5006
+ throw new Error(`Expected asset type with offline_id ${payload.offline_id} to exist`);
5007
+ }
5008
+ const updatedAssetType = {
5009
+ ...assetType,
5010
+ ...payload
5011
+ };
5012
+ this.dispatch(updateAssetType(updatedAssetType));
5013
+ const promise = this.enqueueRequest({
4681
5014
  description: "Update asset type",
4682
5015
  method: HttpMethod.PATCH,
4683
- url: `/assets/types/${assetType.offline_id}/`,
4684
- payload: assetType,
5016
+ url: `/asset-types/${payload.offline_id}/`,
5017
+ payload: {
5018
+ icon: payload.icon,
5019
+ color: payload.color,
5020
+ name: payload.name,
5021
+ description: payload.description
5022
+ },
4685
5023
  blockers: [assetType.offline_id],
4686
5024
  blocks: [assetType.offline_id]
4687
5025
  });
5026
+ promise.then((result) => {
5027
+ this.dispatch(updateAssetType(result));
5028
+ }).catch(() => {
5029
+ this.dispatch(updateAssetType(assetType));
5030
+ });
5031
+ return [updatedAssetType, promise];
4688
5032
  }
4689
5033
  async delete(assetTypeId) {
4690
5034
  const { store } = this.client;
@@ -4693,26 +5037,23 @@ var __publicField = (obj, key, value) => {
4693
5037
  if (!assetType) {
4694
5038
  throw new Error(`Expected asset type with offline_id ${assetTypeId} to exist`);
4695
5039
  }
4696
- const stagesOfAssetType = selectStagesOfAssetType(assetTypeId)(state);
5040
+ const assetsOfAssetType = selectAssetsOfAssetType(assetTypeId)(state);
5041
+ const stagesOfAssetType = selectAssetStagesOfAssetProcedure(assetTypeId)(state);
4697
5042
  const attachmentsOfAssetType = selectAttachmentsOfAssetType(assetTypeId)(state);
4698
5043
  this.dispatch(deleteAssetType(assetTypeId));
4699
- if (stagesOfAssetType.length > 0) {
4700
- const stagesOfAssetTypeIds = stagesOfAssetType.map((assetStage) => assetStage.offline_id);
4701
- this.dispatch(removeStages(stagesOfAssetTypeIds));
4702
- }
4703
- if (attachmentsOfAssetType.length > 0) {
4704
- const attachmentsOfAssetTypeIds = attachmentsOfAssetType.map(({ offline_id }) => offline_id);
4705
- this.dispatch(deleteAssetTypeAttachments(attachmentsOfAssetTypeIds));
4706
- }
5044
+ this.dispatch(deleteAssets(assetsOfAssetType.map((asset) => asset.offline_id)));
5045
+ this.dispatch(deleteAssetStages(stagesOfAssetType.map((assetStage) => assetStage.offline_id)));
5046
+ this.dispatch(deleteAssetTypeAttachments(attachmentsOfAssetType.map(({ offline_id }) => offline_id)));
4707
5047
  return this.enqueueRequest({
4708
5048
  description: "Delete asset type",
4709
5049
  method: HttpMethod.DELETE,
4710
- url: `/assets/types/${assetTypeId}/`,
5050
+ url: `/asset-types/${assetTypeId}/`,
4711
5051
  blockers: [assetTypeId],
4712
5052
  blocks: []
4713
5053
  }).catch((e) => {
4714
5054
  this.dispatch(addAssetType(assetType));
4715
- this.dispatch(addStages(stagesOfAssetType));
5055
+ this.dispatch(addAssets(assetsOfAssetType));
5056
+ this.dispatch(addAssetStages(stagesOfAssetType));
4716
5057
  this.dispatch(addAssetTypeAttachments(attachmentsOfAssetType));
4717
5058
  throw e;
4718
5059
  });
@@ -4721,7 +5062,10 @@ var __publicField = (obj, key, value) => {
4721
5062
  const result = await this.enqueueRequest({
4722
5063
  description: "Get asset types",
4723
5064
  method: HttpMethod.GET,
4724
- url: `/projects/${projectId}/asset-types/`,
5065
+ url: "/asset-types/",
5066
+ queryParams: {
5067
+ project_id: projectId.toString()
5068
+ },
4725
5069
  blockers: [],
4726
5070
  blocks: []
4727
5071
  });
@@ -4916,21 +5260,16 @@ var __publicField = (obj, key, value) => {
4916
5260
  ...issueType ? { issue_type: issueType } : {}
4917
5261
  },
4918
5262
  payload: issuePayload,
4919
- blockers: ["add-issue", ...issuePayload.index_workspace ? [issuePayload.index_workspace] : []],
5263
+ blockers: [
5264
+ "add-issue",
5265
+ ...issuePayload.index_workspace ? [issuePayload.index_workspace] : [],
5266
+ ...issuePayload.visible_in_workspaces
5267
+ ],
4920
5268
  blocks: [issuePayload.offline_id]
4921
5269
  });
4922
5270
  void promise.then((result) => {
4923
5271
  this.dispatch(updateIssue(result));
4924
5272
  }).catch((error) => {
4925
- var _a2;
4926
- console.error(error);
4927
- if (error instanceof APIError) {
4928
- (_a2 = blocks.unsafeShowToast) == null ? void 0 : _a2.call(blocks, {
4929
- title: "Could not create issue",
4930
- description: error.message,
4931
- accentColor: "red"
4932
- });
4933
- }
4934
5273
  this.dispatch(deleteIssue(issuePayload.offline_id));
4935
5274
  this.dispatch(addActiveProjectIssuesCount(-1));
4936
5275
  throw error;
@@ -5363,17 +5702,23 @@ var __publicField = (obj, key, value) => {
5363
5702
  * @throws An APIError if the server returns an error, or any other error that may occur.
5364
5703
  */
5365
5704
  async add(project) {
5705
+ if (!project.organization_owner && !project.user_owner) {
5706
+ throw new Error("Project type was not chosen when trying to create a project");
5707
+ }
5366
5708
  if (!project.bounds && !project.canvas_bounds) {
5367
5709
  throw new Error("Project must either have bounds or canvas_bounds set");
5368
5710
  }
5711
+ const isOrganizationProject = !!project.organization_owner;
5712
+ const url = isOrganizationProject ? `/organizations/${project.organization_owner}/projects/` : "/projects/";
5713
+ const projectType = isOrganizationProject ? { organization_owner: project.organization_owner } : { user_owner: project.user_owner };
5369
5714
  return await this.enqueueRequest({
5370
5715
  description: "Create project",
5371
5716
  method: HttpMethod.POST,
5372
- url: "/projects/",
5717
+ url,
5373
5718
  payload: {
5374
5719
  name: project.name,
5375
5720
  bounds: project.bounds,
5376
- organization_owner: project.organization_owner
5721
+ ...projectType
5377
5722
  },
5378
5723
  blockers: [],
5379
5724
  blocks: []
@@ -5691,6 +6036,48 @@ var __publicField = (obj, key, value) => {
5691
6036
  });
5692
6037
  return [fullRevision, offlineFormRevisionAttachments, promise, attachmentsPromise];
5693
6038
  }
6039
+ async favorite(formId, projectId) {
6040
+ const { store } = this.client;
6041
+ const state = store.getState();
6042
+ const form = state.formReducer.instances[formId];
6043
+ if (!form) {
6044
+ throw new Error(`Expected form to exist, got ${form}`);
6045
+ }
6046
+ this.dispatch(updateForm({ ...form, favorite: true }));
6047
+ try {
6048
+ await this.enqueueRequest({
6049
+ description: "Favorite form",
6050
+ method: HttpMethod.POST,
6051
+ url: `/forms/${formId}/favorite/${projectId}/`,
6052
+ blockers: [formId, `favorite-${formId}`],
6053
+ blocks: [`favorite-${formId}`]
6054
+ });
6055
+ } catch (e) {
6056
+ this.dispatch(updateForm(form));
6057
+ throw e;
6058
+ }
6059
+ }
6060
+ async unfavorite(formId, projectId) {
6061
+ const { store } = this.client;
6062
+ const state = store.getState();
6063
+ const form = state.formReducer.instances[formId];
6064
+ if (!form) {
6065
+ throw new Error(`Expected form to exist, got ${form}`);
6066
+ }
6067
+ this.dispatch(updateForm({ ...form, favorite: false }));
6068
+ try {
6069
+ return await this.enqueueRequest({
6070
+ description: "Unfavorite form",
6071
+ method: HttpMethod.DELETE,
6072
+ url: `/forms/${formId}/unfavorite/${projectId}/`,
6073
+ blockers: [formId, `favorite-${formId}`],
6074
+ blocks: [`favorite-${formId}`]
6075
+ });
6076
+ } catch (e) {
6077
+ this.dispatch(updateForm(form));
6078
+ throw e;
6079
+ }
6080
+ }
5694
6081
  async delete(formId) {
5695
6082
  const { store } = this.client;
5696
6083
  const state = store.getState();
@@ -6151,19 +6538,13 @@ var __publicField = (obj, key, value) => {
6151
6538
  }
6152
6539
  }
6153
6540
  class WorkspaceService extends BaseApiService {
6154
- add(payload) {
6155
- const { store } = this.client;
6156
- const createdBy = store.getState().userReducer.currentUser.id;
6157
- const offlineWorkspace = offline({
6158
- ...payload,
6159
- submitted_at: (/* @__PURE__ */ new Date()).toISOString(),
6160
- created_by: createdBy
6161
- });
6541
+ add(workspace) {
6542
+ const offlineWorkspace = offline(workspace);
6162
6543
  this.dispatch(addWorkspace(offlineWorkspace));
6163
6544
  const promise = this.enqueueRequest({
6164
6545
  description: "Create Workspace",
6165
6546
  method: HttpMethod.POST,
6166
- url: `/projects/${payload.project}/workspaces/`,
6547
+ url: `/projects/${workspace.project}/workspaces/`,
6167
6548
  payload: offlineWorkspace,
6168
6549
  blockers: ["add-workspace"],
6169
6550
  blocks: [offlineWorkspace.offline_id]
@@ -6580,7 +6961,9 @@ var __publicField = (obj, key, value) => {
6580
6961
  method: HttpMethod.GET,
6581
6962
  url: `/billing/${license.offline_id}/`,
6582
6963
  isAuthNeeded: true,
6583
- blockers: [license.organization_owner ? license.organization_owner.toString() : ""],
6964
+ blockers: [
6965
+ license.organization_owner ? license.organization_owner.toString() : license.user_owner ? license.user_owner.toString() : ""
6966
+ ],
6584
6967
  blocks: []
6585
6968
  });
6586
6969
  this.dispatch(updateLicense(result));
@@ -6592,7 +6975,9 @@ var __publicField = (obj, key, value) => {
6592
6975
  method: HttpMethod.DELETE,
6593
6976
  url: `/billing/${license.offline_id}/suspend/`,
6594
6977
  isAuthNeeded: true,
6595
- blockers: [license.organization_owner ? license.organization_owner.toString() : ""],
6978
+ blockers: [
6979
+ license.organization_owner ? license.organization_owner.toString() : license.user_owner ? license.user_owner.toString() : ""
6980
+ ],
6596
6981
  blocks: []
6597
6982
  });
6598
6983
  this.dispatch(updateLicense(result));
@@ -6604,7 +6989,9 @@ var __publicField = (obj, key, value) => {
6604
6989
  method: HttpMethod.PATCH,
6605
6990
  url: `/billing/${license.offline_id}/suspend/`,
6606
6991
  isAuthNeeded: true,
6607
- blockers: [license.organization_owner ? license.organization_owner.toString() : ""],
6992
+ blockers: [
6993
+ license.organization_owner ? license.organization_owner.toString() : license.user_owner ? license.user_owner.toString() : ""
6994
+ ],
6608
6995
  blocks: []
6609
6996
  });
6610
6997
  this.dispatch(updateLicense(result));
@@ -6616,7 +7003,9 @@ var __publicField = (obj, key, value) => {
6616
7003
  method: HttpMethod.DELETE,
6617
7004
  url: `/billing/${license.offline_id}/`,
6618
7005
  isAuthNeeded: true,
6619
- blockers: [license.organization_owner ? license.organization_owner.toString() : ""],
7006
+ blockers: [
7007
+ license.organization_owner ? license.organization_owner.toString() : license.user_owner ? license.user_owner.toString() : ""
7008
+ ],
6620
7009
  blocks: []
6621
7010
  });
6622
7011
  this.dispatch(updateLicense(result));
@@ -6630,7 +7019,7 @@ var __publicField = (obj, key, value) => {
6630
7019
  isAuthNeeded: true,
6631
7020
  payload: { project: project.id },
6632
7021
  blockers: [
6633
- license.organization_owner ? license.organization_owner.toString() : "",
7022
+ license.organization_owner ? license.organization_owner.toString() : license.user_owner ? license.user_owner.toString() : "",
6634
7023
  project.id ? project.id.toString() : ""
6635
7024
  ],
6636
7025
  blocks: ["add-issue", "add-form-entry", "change-access-level", "add-workspace"]
@@ -6644,7 +7033,9 @@ var __publicField = (obj, key, value) => {
6644
7033
  method: HttpMethod.DELETE,
6645
7034
  url: `/billing/${license.offline_id}/project/`,
6646
7035
  isAuthNeeded: true,
6647
- blockers: [license.organization_owner ? license.organization_owner.toString() : ""],
7036
+ blockers: [
7037
+ license.organization_owner ? license.organization_owner.toString() : license.user_owner ? license.user_owner.toString() : ""
7038
+ ],
6648
7039
  blocks: ["add-issue", "add-form-entry", "change-access-level", "add-workspace"]
6649
7040
  });
6650
7041
  this.dispatch(updateLicense(result));
@@ -7434,11 +7825,321 @@ var __publicField = (obj, key, value) => {
7434
7825
  this.dispatch(initializeIssueAssociations(issueAssociations));
7435
7826
  }
7436
7827
  }
7828
+ class AssetProcedureCompletionService extends BaseApiService {
7829
+ add(payload) {
7830
+ const { store } = this.client;
7831
+ const createdBy = store.getState().userReducer.currentUser.id;
7832
+ const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
7833
+ const offlineProcedureCompletion = offline({
7834
+ ...payload,
7835
+ created_by: createdBy,
7836
+ submitted_at: submittedAt
7837
+ });
7838
+ this.dispatch(addAssetProcedureCompletion(offlineProcedureCompletion));
7839
+ const promise = this.enqueueRequest({
7840
+ description: "Add asset procedure completion",
7841
+ method: HttpMethod.POST,
7842
+ url: "/asset-procedure-completions/",
7843
+ payload: {
7844
+ offline_id: offlineProcedureCompletion.offline_id,
7845
+ submitted_at: submittedAt,
7846
+ asset: payload.asset,
7847
+ asset_procedure_instance: payload.asset_procedure_instance
7848
+ },
7849
+ blockers: [payload.asset, payload.asset_procedure_instance],
7850
+ blocks: [offlineProcedureCompletion.offline_id]
7851
+ });
7852
+ promise.then((result) => {
7853
+ this.dispatch(updateAssetProcedureCompletion(result));
7854
+ }).catch(() => {
7855
+ this.dispatch(deleteAssetProcedureCompletion(offlineProcedureCompletion.offline_id));
7856
+ });
7857
+ return [offlineProcedureCompletion, promise];
7858
+ }
7859
+ bulkAdd(payloads) {
7860
+ const { store } = this.client;
7861
+ const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
7862
+ const createdBy = store.getState().userReducer.currentUser.id;
7863
+ const completionPayloads = payloads.map((payload) => offline(payload));
7864
+ const offlineProcedureCompletions = completionPayloads.map((completion) => {
7865
+ return {
7866
+ ...completion,
7867
+ created_by: createdBy,
7868
+ submitted_at: submittedAt
7869
+ };
7870
+ });
7871
+ const offlineIds = offlineProcedureCompletions.map(({ offline_id }) => offline_id);
7872
+ this.dispatch(addAssetProcedureCompletions(offlineProcedureCompletions));
7873
+ const promise = this.enqueueRequest({
7874
+ description: "Bulk create asset procedure completions",
7875
+ method: HttpMethod.POST,
7876
+ url: "/asset-procedure-completions/bulk/",
7877
+ payload: {
7878
+ submitted_at: submittedAt,
7879
+ asset_procedure_completions: completionPayloads
7880
+ },
7881
+ blockers: [...payloads.map((c) => c.asset), ...payloads.map((c) => c.asset_procedure_instance)],
7882
+ blocks: offlineIds
7883
+ });
7884
+ promise.then((result) => {
7885
+ this.dispatch(updateAssetProcedureCompletions(result));
7886
+ }).catch(() => {
7887
+ this.dispatch(deleteAssetProcedureCompletions(offlineIds));
7888
+ });
7889
+ return [offlineProcedureCompletions, promise];
7890
+ }
7891
+ async delete(id) {
7892
+ const { store } = this.client;
7893
+ const assetProcedureCompletion = selectAssetProcedureCompletionById(id)(store.getState());
7894
+ if (!assetProcedureCompletion) {
7895
+ throw new Error(`Expected asset procedure completion with id ${id} to exist`);
7896
+ }
7897
+ this.dispatch(deleteAssetProcedureCompletion(id));
7898
+ const promise = this.enqueueRequest({
7899
+ description: "Delete asset procedure completion",
7900
+ method: HttpMethod.DELETE,
7901
+ url: `/asset-procedure-completions/${id}/`,
7902
+ blockers: [id],
7903
+ blocks: []
7904
+ });
7905
+ promise.catch(() => {
7906
+ this.dispatch(addAssetProcedureCompletion(assetProcedureCompletion));
7907
+ });
7908
+ return promise;
7909
+ }
7910
+ async bulkDelete(ids) {
7911
+ const { store } = this.client;
7912
+ const assetProcedureCompletions = selectAssetProcedureCompletionsByIds(ids)(store.getState());
7913
+ this.dispatch(deleteAssetProcedureCompletions(ids));
7914
+ const promise = this.enqueueRequest({
7915
+ description: "Deleting asset procedure completions",
7916
+ method: HttpMethod.DELETE,
7917
+ url: "/asset-procedure-completions/bulk/",
7918
+ payload: {
7919
+ completion_ids: ids
7920
+ },
7921
+ blockers: ids,
7922
+ blocks: []
7923
+ });
7924
+ promise.catch(() => {
7925
+ this.dispatch(addAssetProcedureCompletions(assetProcedureCompletions));
7926
+ });
7927
+ return promise;
7928
+ }
7929
+ async refreshStore(projectId) {
7930
+ const result = await this.enqueueRequest({
7931
+ description: "Get asset procedure completions",
7932
+ method: HttpMethod.GET,
7933
+ url: "/asset-procedure-completions/",
7934
+ queryParams: {
7935
+ project_id: projectId.toString()
7936
+ },
7937
+ blockers: [],
7938
+ blocks: []
7939
+ });
7940
+ this.dispatch(initializeAssetProcedureCompletions(result));
7941
+ }
7942
+ }
7943
+ class AssetProcedureInstanceService extends BaseApiService {
7944
+ add(payload) {
7945
+ const { store } = this.client;
7946
+ const createdBy = store.getState().userReducer.currentUser.id;
7947
+ const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
7948
+ const offlineAssetProcedureInstance = offline({
7949
+ ...payload,
7950
+ created_by: createdBy,
7951
+ submitted_at: submittedAt
7952
+ });
7953
+ this.dispatch(addAssetProcedureInstance(offlineAssetProcedureInstance));
7954
+ const promise = this.enqueueRequest({
7955
+ description: "Create asset procedure instance",
7956
+ method: HttpMethod.POST,
7957
+ url: "/asset-procedure-instances/",
7958
+ payload: { ...offlineAssetProcedureInstance },
7959
+ blockers: [payload.asset_procedure, payload.asset_type],
7960
+ blocks: [offlineAssetProcedureInstance.offline_id]
7961
+ });
7962
+ promise.then((result) => {
7963
+ this.dispatch(updateAssetProcedureInstance(result));
7964
+ }).catch(() => {
7965
+ this.dispatch(deleteAssetProcedureInstance(offlineAssetProcedureInstance.offline_id));
7966
+ });
7967
+ return [offlineAssetProcedureInstance, promise];
7968
+ }
7969
+ update(payload) {
7970
+ const { store } = this.client;
7971
+ const assetProcedureInstance = selectAssetProcedureInstanceById(payload.offline_id)(store.getState());
7972
+ if (!assetProcedureInstance) {
7973
+ throw new Error(`Expected asset procedure instance with offline_id ${payload.offline_id} to exist`);
7974
+ }
7975
+ const updatedAssetProcedureInstance = {
7976
+ ...assetProcedureInstance,
7977
+ ...payload
7978
+ };
7979
+ this.dispatch(updateAssetProcedureInstance(updatedAssetProcedureInstance));
7980
+ const promise = this.enqueueRequest({
7981
+ description: "Update asset procedure instance",
7982
+ method: HttpMethod.PATCH,
7983
+ url: `/asset-procedure-instances/${payload.offline_id}/`,
7984
+ payload: {
7985
+ asset_procedure: payload.asset_procedure,
7986
+ asset_type: payload.asset_type
7987
+ },
7988
+ blockers: [assetProcedureInstance.offline_id],
7989
+ blocks: [assetProcedureInstance.offline_id]
7990
+ });
7991
+ promise.then((result) => {
7992
+ this.dispatch(updateAssetProcedureInstance(result));
7993
+ }).catch(() => {
7994
+ this.dispatch(updateAssetProcedureInstance(assetProcedureInstance));
7995
+ });
7996
+ return [updatedAssetProcedureInstance, promise];
7997
+ }
7998
+ async remove(assetProcedureInstanceId) {
7999
+ const { store } = this.client;
8000
+ const state = store.getState();
8001
+ const assetProcedureInstance = selectAssetProcedureInstanceById(assetProcedureInstanceId)(state);
8002
+ if (!assetProcedureInstance) {
8003
+ throw new Error(`Expected asset procedure instance with offline_id ${assetProcedureInstanceId} to exist`);
8004
+ }
8005
+ this.dispatch(deleteAssetProcedureInstance(assetProcedureInstanceId));
8006
+ return this.enqueueRequest({
8007
+ description: "Delete asset procedure instance",
8008
+ method: HttpMethod.DELETE,
8009
+ url: `/asset-procedure-instances/${assetProcedureInstanceId}/`,
8010
+ blockers: [assetProcedureInstanceId],
8011
+ blocks: []
8012
+ }).catch((e) => {
8013
+ this.dispatch(addAssetProcedureInstance(assetProcedureInstance));
8014
+ throw e;
8015
+ });
8016
+ }
8017
+ async refreshStore(projectId) {
8018
+ const result = await this.enqueueRequest({
8019
+ description: "Get asset procedure instances",
8020
+ method: HttpMethod.GET,
8021
+ url: "/asset-procedure-instances/",
8022
+ queryParams: {
8023
+ project_id: projectId.toString()
8024
+ },
8025
+ blockers: [],
8026
+ blocks: []
8027
+ });
8028
+ this.dispatch(initializeAssetProcedureInstances(result));
8029
+ }
8030
+ }
8031
+ class AssetProcedureService extends BaseApiService {
8032
+ add(payload) {
8033
+ const { store } = this.client;
8034
+ const createdBy = store.getState().userReducer.currentUser.id;
8035
+ const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
8036
+ const offlineAssetProcedure = offline({
8037
+ ...payload,
8038
+ created_by: createdBy,
8039
+ submitted_at: submittedAt
8040
+ });
8041
+ this.dispatch(addAssetProcedure(offlineAssetProcedure));
8042
+ const promise = this.enqueueRequest({
8043
+ description: "Create asset procedure",
8044
+ method: HttpMethod.POST,
8045
+ url: "/asset-procedures/",
8046
+ queryParams: {
8047
+ organization_id: payload.organization.toString()
8048
+ },
8049
+ payload: { ...offlineAssetProcedure },
8050
+ blockers: [],
8051
+ blocks: [offlineAssetProcedure.offline_id]
8052
+ });
8053
+ promise.then((result) => {
8054
+ this.dispatch(updateAssetProcedure(result));
8055
+ }).catch(() => {
8056
+ this.dispatch(deleteAssetProcedure(offlineAssetProcedure.offline_id));
8057
+ });
8058
+ return [offlineAssetProcedure, promise];
8059
+ }
8060
+ update(payload) {
8061
+ const { store } = this.client;
8062
+ const assetProcedure = selectAssetProcedureById(payload.offline_id)(store.getState());
8063
+ if (!assetProcedure) {
8064
+ throw new Error(`Expected asset procedure with offline_id ${payload.offline_id} to exist`);
8065
+ }
8066
+ const updatedAssetProcedure = {
8067
+ ...assetProcedure,
8068
+ ...payload
8069
+ };
8070
+ this.dispatch(updateAssetProcedure(updatedAssetProcedure));
8071
+ const promise = this.enqueueRequest({
8072
+ description: "Update asset procedure",
8073
+ method: HttpMethod.PATCH,
8074
+ url: `/asset-procedures/${payload.offline_id}/`,
8075
+ payload: {
8076
+ icon: payload.icon,
8077
+ color: payload.color,
8078
+ name: payload.name,
8079
+ description: payload.description
8080
+ },
8081
+ blockers: [assetProcedure.offline_id],
8082
+ blocks: [assetProcedure.offline_id]
8083
+ });
8084
+ promise.then((result) => {
8085
+ this.dispatch(updateAssetProcedure(result));
8086
+ }).catch(() => {
8087
+ this.dispatch(updateAssetProcedure(assetProcedure));
8088
+ });
8089
+ return [updatedAssetProcedure, promise];
8090
+ }
8091
+ async remove(assetProcedureId) {
8092
+ const { store } = this.client;
8093
+ const state = store.getState();
8094
+ const assetProcedure = selectAssetProcedureById(assetProcedureId)(state);
8095
+ if (!assetProcedure) {
8096
+ throw new Error(`Expected asset procedure with offline_id ${assetProcedureId} to exist`);
8097
+ }
8098
+ const instancesOfAssetProcedure = selectAssetProcedureInstancesOfAssetProcedure(assetProcedureId)(state);
8099
+ this.dispatch(deleteAssetProcedure(assetProcedureId));
8100
+ this.dispatch(deleteAssetProcedureInstances(instancesOfAssetProcedure.map((instance) => instance.offline_id)));
8101
+ return this.enqueueRequest({
8102
+ description: "Delete asset procedure",
8103
+ method: HttpMethod.DELETE,
8104
+ url: `/asset-procedures/${assetProcedureId}/`,
8105
+ blockers: [assetProcedureId],
8106
+ blocks: []
8107
+ }).catch((e) => {
8108
+ this.dispatch(addAssetProcedure(assetProcedure));
8109
+ this.dispatch(addAssetProcedureInstances(instancesOfAssetProcedure));
8110
+ throw e;
8111
+ });
8112
+ }
8113
+ async refreshStore(organizationId) {
8114
+ const result = await this.enqueueRequest({
8115
+ description: "Get asset procedures",
8116
+ method: HttpMethod.GET,
8117
+ url: "/asset-procedures/",
8118
+ queryParams: {
8119
+ organization_id: organizationId.toString()
8120
+ },
8121
+ blockers: [],
8122
+ blocks: []
8123
+ });
8124
+ this.dispatch(initializeAssetProcedures(result));
8125
+ }
8126
+ }
8127
+ var VerificationCodeType = /* @__PURE__ */ ((VerificationCodeType2) => {
8128
+ VerificationCodeType2[VerificationCodeType2["USER_REGISTRATION"] = 0] = "USER_REGISTRATION";
8129
+ VerificationCodeType2[VerificationCodeType2["APPLICATION_INVITE"] = 2] = "APPLICATION_INVITE";
8130
+ VerificationCodeType2[VerificationCodeType2["PROJECT_INVITE"] = 4] = "PROJECT_INVITE";
8131
+ VerificationCodeType2[VerificationCodeType2["ORGANIZATION_INVITE"] = 6] = "ORGANIZATION_INVITE";
8132
+ VerificationCodeType2[VerificationCodeType2["ADD_EMAIL_DOMAIN"] = 8] = "ADD_EMAIL_DOMAIN";
8133
+ VerificationCodeType2[VerificationCodeType2["RESET_PASSWORD"] = 10] = "RESET_PASSWORD";
8134
+ return VerificationCodeType2;
8135
+ })(VerificationCodeType || {});
7437
8136
  exports2.APIError = APIError;
7438
8137
  exports2.AgentService = AgentService;
7439
8138
  exports2.AssetAttachmentService = AssetAttachmentService;
8139
+ exports2.AssetProcedureCompletionService = AssetProcedureCompletionService;
8140
+ exports2.AssetProcedureInstanceService = AssetProcedureInstanceService;
8141
+ exports2.AssetProcedureService = AssetProcedureService;
7440
8142
  exports2.AssetService = AssetService;
7441
- exports2.AssetStageColors = AssetStageColors;
7442
8143
  exports2.AssetStageCompletionService = AssetStageCompletionService;
7443
8144
  exports2.AssetStageService = AssetStageService;
7444
8145
  exports2.AssetTypeAttachmentService = AssetTypeAttachmentService;
@@ -7500,9 +8201,20 @@ var __publicField = (obj, key, value) => {
7500
8201
  exports2.addAsset = addAsset;
7501
8202
  exports2.addAssetAttachment = addAssetAttachment;
7502
8203
  exports2.addAssetAttachments = addAssetAttachments;
8204
+ exports2.addAssetProcedure = addAssetProcedure;
8205
+ exports2.addAssetProcedureCompletion = addAssetProcedureCompletion;
8206
+ exports2.addAssetProcedureCompletions = addAssetProcedureCompletions;
8207
+ exports2.addAssetProcedureInstance = addAssetProcedureInstance;
8208
+ exports2.addAssetProcedureInstances = addAssetProcedureInstances;
8209
+ exports2.addAssetProcedures = addAssetProcedures;
8210
+ exports2.addAssetStage = addAssetStage;
8211
+ exports2.addAssetStageCompletion = addAssetStageCompletion;
8212
+ exports2.addAssetStageCompletions = addAssetStageCompletions;
8213
+ exports2.addAssetStages = addAssetStages;
7503
8214
  exports2.addAssetType = addAssetType;
7504
8215
  exports2.addAssetTypeAttachment = addAssetTypeAttachment;
7505
8216
  exports2.addAssetTypeAttachments = addAssetTypeAttachments;
8217
+ exports2.addAssetTypes = addAssetTypes;
7506
8218
  exports2.addAssets = addAssets;
7507
8219
  exports2.addCategory = addCategory;
7508
8220
  exports2.addConversation = addConversation;
@@ -7510,7 +8222,6 @@ var __publicField = (obj, key, value) => {
7510
8222
  exports2.addDocumentAttachments = addDocumentAttachments;
7511
8223
  exports2.addDocuments = addDocuments;
7512
8224
  exports2.addEmailDomain = addEmailDomain;
7513
- exports2.addFavouriteProjectId = addFavouriteProjectId;
7514
8225
  exports2.addForm = addForm;
7515
8226
  exports2.addFormRevision = addFormRevision;
7516
8227
  exports2.addFormRevisionAttachment = addFormRevisionAttachment;
@@ -7540,9 +8251,6 @@ var __publicField = (obj, key, value) => {
7540
8251
  exports2.addOrReplaceProjects = addOrReplaceProjects;
7541
8252
  exports2.addProjectAttachment = addProjectAttachment;
7542
8253
  exports2.addProjectAttachments = addProjectAttachments;
7543
- exports2.addStageCompletion = addStageCompletion;
7544
- exports2.addStageCompletions = addStageCompletions;
7545
- exports2.addStages = addStages;
7546
8254
  exports2.addTeam = addTeam;
7547
8255
  exports2.addToRecentIssues = addToRecentIssues;
7548
8256
  exports2.addUsers = addUsers;
@@ -7552,6 +8260,12 @@ var __publicField = (obj, key, value) => {
7552
8260
  exports2.areArraysEqual = areArraysEqual;
7553
8261
  exports2.assetAttachmentReducer = assetAttachmentReducer;
7554
8262
  exports2.assetAttachmentSlice = assetAttachmentSlice;
8263
+ exports2.assetProcedureCompletionReducer = assetProcedureCompletionReducer;
8264
+ exports2.assetProcedureCompletionSlice = assetProcedureCompletionSlice;
8265
+ exports2.assetProcedureInstanceReducer = assetProcedureInstanceReducer;
8266
+ exports2.assetProcedureInstanceSlice = assetProcedureInstanceSlice;
8267
+ exports2.assetProcedureReducer = assetProcedureReducer;
8268
+ exports2.assetProcedureSlice = assetProcedureSlice;
7555
8269
  exports2.assetReducer = assetReducer;
7556
8270
  exports2.assetSlice = assetSlice;
7557
8271
  exports2.assetStageCompletionReducer = assetStageCompletionReducer;
@@ -7583,9 +8297,20 @@ var __publicField = (obj, key, value) => {
7583
8297
  exports2.deleteAsset = deleteAsset;
7584
8298
  exports2.deleteAssetAttachment = deleteAssetAttachment;
7585
8299
  exports2.deleteAssetAttachments = deleteAssetAttachments;
8300
+ exports2.deleteAssetProcedure = deleteAssetProcedure;
8301
+ exports2.deleteAssetProcedureCompletion = deleteAssetProcedureCompletion;
8302
+ exports2.deleteAssetProcedureCompletions = deleteAssetProcedureCompletions;
8303
+ exports2.deleteAssetProcedureInstance = deleteAssetProcedureInstance;
8304
+ exports2.deleteAssetProcedureInstances = deleteAssetProcedureInstances;
8305
+ exports2.deleteAssetProcedures = deleteAssetProcedures;
8306
+ exports2.deleteAssetStage = deleteAssetStage;
8307
+ exports2.deleteAssetStageCompletion = deleteAssetStageCompletion;
8308
+ exports2.deleteAssetStageCompletions = deleteAssetStageCompletions;
8309
+ exports2.deleteAssetStages = deleteAssetStages;
7586
8310
  exports2.deleteAssetType = deleteAssetType;
7587
8311
  exports2.deleteAssetTypeAttachment = deleteAssetTypeAttachment;
7588
8312
  exports2.deleteAssetTypeAttachments = deleteAssetTypeAttachments;
8313
+ exports2.deleteAssetTypes = deleteAssetTypes;
7589
8314
  exports2.deleteAssets = deleteAssets;
7590
8315
  exports2.deleteCategory = deleteCategory;
7591
8316
  exports2.deleteDocumentAttachment = deleteDocumentAttachment;
@@ -7661,10 +8386,14 @@ var __publicField = (obj, key, value) => {
7661
8386
  exports2.getLocalRelativeDateString = getLocalRelativeDateString;
7662
8387
  exports2.getOutboxCoordinator = getOutboxCoordinator;
7663
8388
  exports2.getRenamedFile = getRenamedFile;
7664
- exports2.getStageColor = getStageColor;
7665
8389
  exports2.hashFile = hashFile;
7666
8390
  exports2.initSDK = initSDK;
7667
8391
  exports2.initializeAssetAttachments = initializeAssetAttachments;
8392
+ exports2.initializeAssetProcedureCompletions = initializeAssetProcedureCompletions;
8393
+ exports2.initializeAssetProcedureInstances = initializeAssetProcedureInstances;
8394
+ exports2.initializeAssetProcedures = initializeAssetProcedures;
8395
+ exports2.initializeAssetStageCompletions = initializeAssetStageCompletions;
8396
+ exports2.initializeAssetStages = initializeAssetStages;
7668
8397
  exports2.initializeAssetTypeAttachments = initializeAssetTypeAttachments;
7669
8398
  exports2.initializeAssetTypes = initializeAssetTypes;
7670
8399
  exports2.initializeAssets = initializeAssets;
@@ -7687,7 +8416,6 @@ var __publicField = (obj, key, value) => {
7687
8416
  exports2.initializeOrganizationAccesses = initializeOrganizationAccesses;
7688
8417
  exports2.initializeProjectAccesses = initializeProjectAccesses;
7689
8418
  exports2.initializeProjectAttachments = initializeProjectAttachments;
7690
- exports2.initializeStages = initializeStages;
7691
8419
  exports2.initializeTeams = initializeTeams;
7692
8420
  exports2.initializeWorkspaces = initializeWorkspaces;
7693
8421
  exports2.isToday = isToday;
@@ -7740,13 +8468,10 @@ var __publicField = (obj, key, value) => {
7740
8468
  exports2.rehydratedReducer = rehydratedReducer;
7741
8469
  exports2.rehydratedSlice = rehydratedSlice;
7742
8470
  exports2.removeDocuments = removeDocuments;
7743
- exports2.removeFavouriteProjectId = removeFavouriteProjectId;
7744
8471
  exports2.removeIssueType = removeIssueType;
7745
8472
  exports2.removeProjectFile = removeProjectFile;
7746
8473
  exports2.removeProjectFilesOfProject = removeProjectFilesOfProject;
7747
8474
  exports2.removeRecentIssue = removeRecentIssue;
7748
- exports2.removeStageCompletions = removeStageCompletions;
7749
- exports2.removeStages = removeStages;
7750
8475
  exports2.removeUser = removeUser;
7751
8476
  exports2.resetProjectFileObjectUrls = resetProjectFileObjectUrls;
7752
8477
  exports2.resetRecentIssues = resetRecentIssues;
@@ -7768,14 +8493,35 @@ var __publicField = (obj, key, value) => {
7768
8493
  exports2.selectAssetAttachmentMapping = selectAssetAttachmentMapping;
7769
8494
  exports2.selectAssetAttachments = selectAssetAttachments;
7770
8495
  exports2.selectAssetById = selectAssetById;
8496
+ exports2.selectAssetProcedureById = selectAssetProcedureById;
8497
+ exports2.selectAssetProcedureCompletionById = selectAssetProcedureCompletionById;
8498
+ exports2.selectAssetProcedureCompletions = selectAssetProcedureCompletions;
8499
+ exports2.selectAssetProcedureCompletionsByIds = selectAssetProcedureCompletionsByIds;
8500
+ exports2.selectAssetProcedureCompletionsMapping = selectAssetProcedureCompletionsMapping;
8501
+ exports2.selectAssetProcedureCompletionsOfAsset = selectAssetProcedureCompletionsOfAsset;
8502
+ exports2.selectAssetProcedureCompletionsOfAssetProcedureInstance = selectAssetProcedureCompletionsOfAssetProcedureInstance;
8503
+ exports2.selectAssetProcedureInstanceById = selectAssetProcedureInstanceById;
8504
+ exports2.selectAssetProcedureInstances = selectAssetProcedureInstances;
8505
+ exports2.selectAssetProcedureInstancesByIds = selectAssetProcedureInstancesByIds;
8506
+ exports2.selectAssetProcedureInstancesMapping = selectAssetProcedureInstancesMapping;
8507
+ exports2.selectAssetProcedureInstancesOfAssetProcedure = selectAssetProcedureInstancesOfAssetProcedure;
8508
+ exports2.selectAssetProcedureInstancesOfAssetType = selectAssetProcedureInstancesOfAssetType;
8509
+ exports2.selectAssetProcedures = selectAssetProcedures;
8510
+ exports2.selectAssetProceduresByIds = selectAssetProceduresByIds;
8511
+ exports2.selectAssetProceduresMapping = selectAssetProceduresMapping;
8512
+ exports2.selectAssetProceduresOfOrganization = selectAssetProceduresOfOrganization;
7771
8513
  exports2.selectAssetStageById = selectAssetStageById;
8514
+ exports2.selectAssetStageCompletionById = selectAssetStageCompletionById;
8515
+ exports2.selectAssetStageCompletionMapping = selectAssetStageCompletionMapping;
8516
+ exports2.selectAssetStageCompletionsByIds = selectAssetStageCompletionsByIds;
7772
8517
  exports2.selectAssetStages = selectAssetStages;
7773
8518
  exports2.selectAssetStagesByIds = selectAssetStagesByIds;
8519
+ exports2.selectAssetStagesMappingOfAssetProcedure = selectAssetStagesMappingOfAssetProcedure;
8520
+ exports2.selectAssetStagesOfAssetProcedure = selectAssetStagesOfAssetProcedure;
7774
8521
  exports2.selectAssetTypeAttachmentById = selectAssetTypeAttachmentById;
7775
8522
  exports2.selectAssetTypeAttachmentMapping = selectAssetTypeAttachmentMapping;
7776
8523
  exports2.selectAssetTypeAttachments = selectAssetTypeAttachments;
7777
8524
  exports2.selectAssetTypeById = selectAssetTypeById;
7778
- exports2.selectAssetTypeStagesMapping = selectAssetTypeStagesMapping;
7779
8525
  exports2.selectAssetTypes = selectAssetTypes;
7780
8526
  exports2.selectAssetTypesByIds = selectAssetTypesByIds;
7781
8527
  exports2.selectAssetTypesMapping = selectAssetTypesMapping;
@@ -7803,8 +8549,8 @@ var __publicField = (obj, key, value) => {
7803
8549
  exports2.selectCategoryById = selectCategoryById;
7804
8550
  exports2.selectCategoryMapping = selectCategoryMapping;
7805
8551
  exports2.selectCommentsOfIssue = selectCommentsOfIssue;
7806
- exports2.selectCompletedStageIdsForAsset = selectCompletedStageIdsForAsset;
7807
- exports2.selectCompletedStages = selectCompletedStages;
8552
+ exports2.selectCompletedStageIdsOfAssetProcedureCompletion = selectCompletedStageIdsOfAssetProcedureCompletion;
8553
+ exports2.selectCompletedStagesByAssetProcedureCompletion = selectCompletedStagesByAssetProcedureCompletion;
7808
8554
  exports2.selectConversation = selectConversation;
7809
8555
  exports2.selectConversationMapping = selectConversationMapping;
7810
8556
  exports2.selectConversations = selectConversations;
@@ -7819,7 +8565,6 @@ var __publicField = (obj, key, value) => {
7819
8565
  exports2.selectEmailDomains = selectEmailDomains;
7820
8566
  exports2.selectEmailDomainsAsMapping = selectEmailDomainsAsMapping;
7821
8567
  exports2.selectEmailDomainsOfOrganization = selectEmailDomainsOfOrganization;
7822
- exports2.selectFavouriteProjects = selectFavouriteProjects;
7823
8568
  exports2.selectFilteredForms = selectFilteredForms;
7824
8569
  exports2.selectFormById = selectFormById;
7825
8570
  exports2.selectFormMapping = selectFormMapping;
@@ -7918,8 +8663,6 @@ var __publicField = (obj, key, value) => {
7918
8663
  exports2.selectSortedProjectUsers = selectSortedProjectUsers;
7919
8664
  exports2.selectStageFormIdsFromStageIds = selectStageFormIdsFromStageIds;
7920
8665
  exports2.selectStageMapping = selectStageMapping;
7921
- exports2.selectStagesFromAssetTypeIds = selectStagesFromAssetTypeIds;
7922
- exports2.selectStagesOfAssetType = selectStagesOfAssetType;
7923
8666
  exports2.selectTeamById = selectTeamById;
7924
8667
  exports2.selectTeams = selectTeams;
7925
8668
  exports2.selectTeamsByIds = selectTeamsByIds;
@@ -7938,8 +8681,18 @@ var __publicField = (obj, key, value) => {
7938
8681
  exports2.setAsset = setAsset;
7939
8682
  exports2.setAssetAttachment = setAssetAttachment;
7940
8683
  exports2.setAssetAttachments = setAssetAttachments;
8684
+ exports2.setAssetProcedure = setAssetProcedure;
8685
+ exports2.setAssetProcedureCompletion = setAssetProcedureCompletion;
8686
+ exports2.setAssetProcedureCompletions = setAssetProcedureCompletions;
8687
+ exports2.setAssetProcedureInstance = setAssetProcedureInstance;
8688
+ exports2.setAssetProcedureInstances = setAssetProcedureInstances;
8689
+ exports2.setAssetProcedures = setAssetProcedures;
8690
+ exports2.setAssetStage = setAssetStage;
8691
+ exports2.setAssetStages = setAssetStages;
8692
+ exports2.setAssetType = setAssetType;
7941
8693
  exports2.setAssetTypeAttachment = setAssetTypeAttachment;
7942
8694
  exports2.setAssetTypeAttachments = setAssetTypeAttachments;
8695
+ exports2.setAssetTypes = setAssetTypes;
7943
8696
  exports2.setAssets = setAssets;
7944
8697
  exports2.setConversation = setConversation;
7945
8698
  exports2.setCurrentUser = setCurrentUser;
@@ -7972,11 +8725,8 @@ var __publicField = (obj, key, value) => {
7972
8725
  exports2.setProjectAttachments = setProjectAttachments;
7973
8726
  exports2.setProjects = setProjects;
7974
8727
  exports2.setRehydrated = setRehydrated;
7975
- exports2.setStage = setStage;
7976
- exports2.setStageCompletions = setStageCompletions;
7977
8728
  exports2.setTeam = setTeam;
7978
8729
  exports2.setTokens = setTokens;
7979
- exports2.setTourStep = setTourStep;
7980
8730
  exports2.setUploadUrl = setUploadUrl;
7981
8731
  exports2.setUsers = setUsers;
7982
8732
  exports2.setWorkspaces = setWorkspaces;
@@ -7992,8 +8742,20 @@ var __publicField = (obj, key, value) => {
7992
8742
  exports2.updateAsset = updateAsset;
7993
8743
  exports2.updateAssetAttachment = updateAssetAttachment;
7994
8744
  exports2.updateAssetAttachments = updateAssetAttachments;
8745
+ exports2.updateAssetProcedure = updateAssetProcedure;
8746
+ exports2.updateAssetProcedureCompletion = updateAssetProcedureCompletion;
8747
+ exports2.updateAssetProcedureCompletions = updateAssetProcedureCompletions;
8748
+ exports2.updateAssetProcedureInstance = updateAssetProcedureInstance;
8749
+ exports2.updateAssetProcedureInstances = updateAssetProcedureInstances;
8750
+ exports2.updateAssetProcedures = updateAssetProcedures;
8751
+ exports2.updateAssetStage = updateAssetStage;
8752
+ exports2.updateAssetStageCompletion = updateAssetStageCompletion;
8753
+ exports2.updateAssetStageCompletions = updateAssetStageCompletions;
8754
+ exports2.updateAssetStages = updateAssetStages;
8755
+ exports2.updateAssetType = updateAssetType;
7995
8756
  exports2.updateAssetTypeAttachment = updateAssetTypeAttachment;
7996
8757
  exports2.updateAssetTypeAttachments = updateAssetTypeAttachments;
8758
+ exports2.updateAssetTypes = updateAssetTypes;
7997
8759
  exports2.updateAssets = updateAssets;
7998
8760
  exports2.updateCategory = updateCategory;
7999
8761
  exports2.updateConversation = updateConversation;
@@ -8021,8 +8783,6 @@ var __publicField = (obj, key, value) => {
8021
8783
  exports2.updateProjectAccess = updateProjectAccess;
8022
8784
  exports2.updateProjectAttachment = updateProjectAttachment;
8023
8785
  exports2.updateProjectAttachments = updateProjectAttachments;
8024
- exports2.updateStage = updateStage;
8025
- exports2.updateStages = updateStages;
8026
8786
  exports2.updateTeam = updateTeam;
8027
8787
  exports2.updateWorkspace = updateWorkspace;
8028
8788
  exports2.useMemoCompare = useMemoCompare;