@overmap-ai/core 1.0.62-store-clear-fixes.1 → 1.0.62-store-clear-fixes.3
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.
|
@@ -2571,6 +2571,34 @@ var __publicField = (obj, key, value) => {
|
|
|
2571
2571
|
}
|
|
2572
2572
|
)
|
|
2573
2573
|
);
|
|
2574
|
+
const selectAttachedFormSubmissionsOfIssue = restructureCreateSelectorWithArgs(
|
|
2575
|
+
toolkit.createSelector(
|
|
2576
|
+
[
|
|
2577
|
+
(state) => state.issueReducer.instances,
|
|
2578
|
+
(state) => state.formReducer.instances,
|
|
2579
|
+
(state) => state.formRevisionReducer.instances,
|
|
2580
|
+
(state) => state.formSubmissionReducer.instances,
|
|
2581
|
+
(_state, issueId) => issueId
|
|
2582
|
+
],
|
|
2583
|
+
(issues, forms, formRevisions, submissions, issueId) => {
|
|
2584
|
+
const issue = issues[issueId];
|
|
2585
|
+
if (!issue || !issue.issue_type) {
|
|
2586
|
+
return [];
|
|
2587
|
+
}
|
|
2588
|
+
const issueTypeForms = new Set(
|
|
2589
|
+
Object.keys(forms).filter((formId) => forms[formId].issue_type === issue.issue_type)
|
|
2590
|
+
);
|
|
2591
|
+
const issueTypeFormRevisions = new Set(
|
|
2592
|
+
Object.keys(formRevisions).filter(
|
|
2593
|
+
(formRevisionId) => issueTypeForms.has(formRevisions[formRevisionId].form)
|
|
2594
|
+
)
|
|
2595
|
+
);
|
|
2596
|
+
return Object.values(submissions).filter(
|
|
2597
|
+
(submission) => !issueTypeFormRevisions.has(submission.form_revision)
|
|
2598
|
+
);
|
|
2599
|
+
}
|
|
2600
|
+
)
|
|
2601
|
+
);
|
|
2574
2602
|
const selectFormSubmissionsByIssues = restructureCreateSelectorWithArgs(
|
|
2575
2603
|
toolkit.createSelector(
|
|
2576
2604
|
[selectFormSubmissions, (_state, issueIds) => issueIds],
|
|
@@ -2599,6 +2627,34 @@ var __publicField = (obj, key, value) => {
|
|
|
2599
2627
|
}
|
|
2600
2628
|
)
|
|
2601
2629
|
);
|
|
2630
|
+
const selectAttachedFormSubmissionsOfAssets = restructureCreateSelectorWithArgs(
|
|
2631
|
+
toolkit.createSelector(
|
|
2632
|
+
[
|
|
2633
|
+
(state) => state.assetReducer.instances,
|
|
2634
|
+
(state) => state.formReducer.instances,
|
|
2635
|
+
(state) => state.formRevisionReducer.instances,
|
|
2636
|
+
(state) => state.formSubmissionReducer.instances,
|
|
2637
|
+
(_state, assetId) => assetId
|
|
2638
|
+
],
|
|
2639
|
+
(assets, forms, formRevisions, submissions, assetId) => {
|
|
2640
|
+
const asset = assets[assetId];
|
|
2641
|
+
if (!asset || !asset.asset_type) {
|
|
2642
|
+
return [];
|
|
2643
|
+
}
|
|
2644
|
+
const issueTypeForms = new Set(
|
|
2645
|
+
Object.keys(forms).filter((formId) => forms[formId].asset_type === asset.asset_type)
|
|
2646
|
+
);
|
|
2647
|
+
const issueTypeFormRevisions = new Set(
|
|
2648
|
+
Object.keys(formRevisions).filter(
|
|
2649
|
+
(formRevisionId) => issueTypeForms.has(formRevisions[formRevisionId].form)
|
|
2650
|
+
)
|
|
2651
|
+
);
|
|
2652
|
+
return Object.values(submissions).filter(
|
|
2653
|
+
(submission) => !issueTypeFormRevisions.has(submission.form_revision)
|
|
2654
|
+
);
|
|
2655
|
+
}
|
|
2656
|
+
)
|
|
2657
|
+
);
|
|
2602
2658
|
const selectFormSubmissionsByAssets = toolkit.createSelector(
|
|
2603
2659
|
[selectFormSubmissionsMapping, selectAssetsMapping],
|
|
2604
2660
|
(submissions, assets) => {
|
|
@@ -4083,10 +4139,15 @@ var __publicField = (obj, key, value) => {
|
|
|
4083
4139
|
if (!assetToBeDeleted)
|
|
4084
4140
|
throw new Error(`No asset with id ${assetId} found in the store`);
|
|
4085
4141
|
const attachmentsOfAssets = selectAttachmentsOfAsset(assetId)(store.getState());
|
|
4086
|
-
store.
|
|
4142
|
+
const formSubmissionsOfAssets = selectFormSubmissionsOfAsset(assetId)(store.getState());
|
|
4143
|
+
this.dispatch(deleteAsset(assetId));
|
|
4087
4144
|
if (attachmentsOfAssets.length > 0) {
|
|
4088
4145
|
const attachmentsOfAssetIds = attachmentsOfAssets.map(({ offline_id }) => offline_id);
|
|
4089
|
-
|
|
4146
|
+
this.dispatch(deleteAssetAttachments(attachmentsOfAssetIds));
|
|
4147
|
+
}
|
|
4148
|
+
if (formSubmissionsOfAssets.length > 0) {
|
|
4149
|
+
const formSubmissionsOfAssetIds = formSubmissionsOfAssets.map(({ offline_id }) => offline_id);
|
|
4150
|
+
this.dispatch(deleteFormSubmissions(formSubmissionsOfAssetIds));
|
|
4090
4151
|
}
|
|
4091
4152
|
return this.enqueueRequest({
|
|
4092
4153
|
description: "Delete asset",
|
|
@@ -4095,8 +4156,9 @@ var __publicField = (obj, key, value) => {
|
|
|
4095
4156
|
blockers: [assetId],
|
|
4096
4157
|
blocks: []
|
|
4097
4158
|
}).catch((err) => {
|
|
4098
|
-
|
|
4099
|
-
|
|
4159
|
+
this.dispatch(addAsset(assetToBeDeleted));
|
|
4160
|
+
this.dispatch(addAssetAttachments(attachmentsOfAssets));
|
|
4161
|
+
this.dispatch(addFormSubmissions(formSubmissionsOfAssets));
|
|
4100
4162
|
throw err;
|
|
4101
4163
|
});
|
|
4102
4164
|
}
|
|
@@ -4971,12 +5033,15 @@ var __publicField = (obj, key, value) => {
|
|
|
4971
5033
|
}
|
|
4972
5034
|
const attachmentsOfIssue = selectAttachmentsOfIssue(id)(state);
|
|
4973
5035
|
const updatesOfIssue = selectIssueUpdatesOfIssue(id)(state);
|
|
5036
|
+
const formSubmissionsOfIssue = selectFormSubmissionsOfIssue(id)(state);
|
|
4974
5037
|
this.dispatch(deleteIssue(id));
|
|
4975
5038
|
this.dispatch(addActiveProjectIssuesCount(-1));
|
|
4976
5039
|
if (attachmentsOfIssue.length > 0)
|
|
4977
5040
|
this.dispatch(deleteIssueAttachments(attachmentsOfIssue.map(({ offline_id }) => offline_id)));
|
|
4978
5041
|
if (updatesOfIssue.length > 0)
|
|
4979
5042
|
this.dispatch(deleteIssueUpdates(updatesOfIssue.map(({ offline_id }) => offline_id)));
|
|
5043
|
+
if (formSubmissionsOfIssue.length > 0)
|
|
5044
|
+
this.dispatch(deleteFormSubmissions(formSubmissionsOfIssue.map(({ offline_id }) => offline_id)));
|
|
4980
5045
|
try {
|
|
4981
5046
|
return await this.enqueueRequest({
|
|
4982
5047
|
description: "Delete issue",
|
|
@@ -4990,6 +5055,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4990
5055
|
this.dispatch(addIssueAttachments(attachmentsOfIssue));
|
|
4991
5056
|
this.dispatch(addIssueUpdates(updatesOfIssue));
|
|
4992
5057
|
this.dispatch(addActiveProjectIssuesCount(1));
|
|
5058
|
+
this.dispatch(addFormSubmissions(formSubmissionsOfIssue));
|
|
4993
5059
|
throw e;
|
|
4994
5060
|
}
|
|
4995
5061
|
}
|
|
@@ -7470,6 +7536,8 @@ var __publicField = (obj, key, value) => {
|
|
|
7470
7536
|
exports2.selectAssets = selectAssets;
|
|
7471
7537
|
exports2.selectAssetsMapping = selectAssetsMapping;
|
|
7472
7538
|
exports2.selectAssetsOfAssetType = selectAssetsOfAssetType;
|
|
7539
|
+
exports2.selectAttachedFormSubmissionsOfAssets = selectAttachedFormSubmissionsOfAssets;
|
|
7540
|
+
exports2.selectAttachedFormSubmissionsOfIssue = selectAttachedFormSubmissionsOfIssue;
|
|
7473
7541
|
exports2.selectAttachmentsOfAsset = selectAttachmentsOfAsset;
|
|
7474
7542
|
exports2.selectAttachmentsOfAssetByType = selectAttachmentsOfAssetByType;
|
|
7475
7543
|
exports2.selectAttachmentsOfAssetType = selectAttachmentsOfAssetType;
|