@overmap-ai/core 1.0.71-fields.13 → 1.0.71-fields.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.
- package/dist/overmap-core.js +151 -145
- package/dist/overmap-core.js.map +1 -1
- package/dist/overmap-core.umd.cjs +151 -145
- package/dist/overmap-core.umd.cjs.map +1 -1
- package/dist/sdk/services/AssetTypeFieldValuesAttachmentService.d.ts +3 -2
- package/dist/sdk/services/AssetTypeFieldValuesService.d.ts +2 -2
- package/dist/sdk/services/FormService.d.ts +2 -2
- package/dist/store/slices/assetTypeFieldValuesAttachmentSlice.d.ts +1 -2
- package/dist/store/slices/formRevisionSlice.d.ts +2 -1
- package/dist/store/slices/formSlice.d.ts +3 -1
- package/dist/store/slices/formSubmissionSlice.d.ts +2 -0
- package/dist/store/slices/issueTypeFieldValuesAttachmentSlice.d.ts +1 -2
- package/package.json +1 -1
|
@@ -2093,6 +2093,17 @@ var __publicField = (obj, key, value) => {
|
|
|
2093
2093
|
}
|
|
2094
2094
|
)
|
|
2095
2095
|
);
|
|
2096
|
+
const selectLatestFormRevisionByForm = toolkit.createSelector([selectFormRevisionMapping], (revisions) => {
|
|
2097
|
+
const latestRevisions = {};
|
|
2098
|
+
for (const revision of Object.values(revisions)) {
|
|
2099
|
+
const formId = revision.form;
|
|
2100
|
+
const currentLatestRevision = latestRevisions[formId];
|
|
2101
|
+
if (!currentLatestRevision || currentLatestRevision.revision < revision.revision) {
|
|
2102
|
+
latestRevisions[formId] = revision;
|
|
2103
|
+
}
|
|
2104
|
+
}
|
|
2105
|
+
return latestRevisions;
|
|
2106
|
+
});
|
|
2096
2107
|
const formRevisionReducer = formRevisionsSlice.reducer;
|
|
2097
2108
|
const formAdapter = createModelAdapter((form) => form.offline_id);
|
|
2098
2109
|
const initialState$n = formAdapter.getInitialState({});
|
|
@@ -2117,9 +2128,6 @@ var __publicField = (obj, key, value) => {
|
|
|
2117
2128
|
const selectForms = toolkit.createSelector([selectFormMapping], (formsMapping) => {
|
|
2118
2129
|
return Object.values(formsMapping);
|
|
2119
2130
|
});
|
|
2120
|
-
const selectFormById = (formId) => (state) => {
|
|
2121
|
-
return state.formReducer.instances[formId];
|
|
2122
|
-
};
|
|
2123
2131
|
const selectFilteredForms = restructureCreateSelectorWithArgs(
|
|
2124
2132
|
toolkit.createSelector(
|
|
2125
2133
|
[
|
|
@@ -2145,6 +2153,15 @@ var __publicField = (obj, key, value) => {
|
|
|
2145
2153
|
{ memoizeOptions: { equalityCheck: shallowEqual } }
|
|
2146
2154
|
)
|
|
2147
2155
|
);
|
|
2156
|
+
const selectFormById = (formId) => (state) => {
|
|
2157
|
+
return state.formReducer.instances[formId];
|
|
2158
|
+
};
|
|
2159
|
+
const selectFormsCount = toolkit.createSelector([selectFormMapping], (formsMapping) => {
|
|
2160
|
+
return Object.keys(formsMapping).length;
|
|
2161
|
+
});
|
|
2162
|
+
const selectGeneralFormCount = toolkit.createSelector([selectFormMapping], (formsMapping) => {
|
|
2163
|
+
return Object.values(formsMapping).length;
|
|
2164
|
+
});
|
|
2148
2165
|
const submissionAdapter = createModelAdapter((submission) => submission.offline_id);
|
|
2149
2166
|
const initialState$m = submissionAdapter.getInitialState({});
|
|
2150
2167
|
const formSubmissionSlice = toolkit.createSlice({
|
|
@@ -2206,6 +2223,43 @@ var __publicField = (obj, key, value) => {
|
|
|
2206
2223
|
}
|
|
2207
2224
|
)
|
|
2208
2225
|
);
|
|
2226
|
+
const selectFormSubmissionsByFormRevisions = toolkit.createSelector([selectFormRevisionMapping, selectFormSubmissions], (revisions, submissions) => {
|
|
2227
|
+
var _a2;
|
|
2228
|
+
const submissionMapping = {};
|
|
2229
|
+
for (const revisionId in revisions) {
|
|
2230
|
+
submissionMapping[revisionId] = [];
|
|
2231
|
+
}
|
|
2232
|
+
for (const submission of submissions) {
|
|
2233
|
+
(_a2 = submissionMapping[submission.form_revision]) == null ? void 0 : _a2.push(submission);
|
|
2234
|
+
}
|
|
2235
|
+
return submissionMapping;
|
|
2236
|
+
});
|
|
2237
|
+
const selectSortedFormSubmissionsOfForm = restructureCreateSelectorWithArgs(
|
|
2238
|
+
toolkit.createSelector(
|
|
2239
|
+
[
|
|
2240
|
+
selectFormRevisionMapping,
|
|
2241
|
+
selectFormSubmissionsByFormRevisions,
|
|
2242
|
+
(_state, formId) => formId
|
|
2243
|
+
],
|
|
2244
|
+
(revisionsMapping, submissionsByRevision, formId) => {
|
|
2245
|
+
const submissionsByFormRevisions = {};
|
|
2246
|
+
for (const revisionId in revisionsMapping) {
|
|
2247
|
+
const revision = revisionsMapping[revisionId];
|
|
2248
|
+
const submissionsOfRevision = submissionsByRevision[revisionId];
|
|
2249
|
+
if (revision && submissionsOfRevision && revision.form === formId) {
|
|
2250
|
+
submissionsByFormRevisions[revisionId] = submissionsOfRevision.sort(
|
|
2251
|
+
(a, b) => a.submitted_at < b.submitted_at ? -1 : 1
|
|
2252
|
+
);
|
|
2253
|
+
}
|
|
2254
|
+
}
|
|
2255
|
+
return Object.entries(submissionsByFormRevisions).sort((a, b) => {
|
|
2256
|
+
const aRevision = revisionsMapping[a[0]];
|
|
2257
|
+
const bRevision = revisionsMapping[b[0]];
|
|
2258
|
+
return formRevisionSortFn(aRevision, bRevision);
|
|
2259
|
+
}).map(([_revisionId, submissions]) => submissions).flat();
|
|
2260
|
+
}
|
|
2261
|
+
)
|
|
2262
|
+
);
|
|
2209
2263
|
const selectFormSubmissionsOfIssue = restructureCreateSelectorWithArgs(
|
|
2210
2264
|
toolkit.createSelector(
|
|
2211
2265
|
[selectFormSubmissions, (_state, issueId) => issueId],
|
|
@@ -3057,7 +3111,7 @@ var __publicField = (obj, key, value) => {
|
|
|
3057
3111
|
);
|
|
3058
3112
|
const selectLatestIssueTypeFieldsOfIssueType = restructureCreateSelectorWithArgs(
|
|
3059
3113
|
toolkit.createSelector([selectIssueTypeFields, (_state, id) => id], (fields, id) => {
|
|
3060
|
-
return fields.filter((field) => field.issue_type === id).sort((a, b) => a.submitted_at
|
|
3114
|
+
return fields.filter((field) => field.issue_type === id).sort((a, b) => a.submitted_at < b.submitted_at ? -1 : 1)[0];
|
|
3061
3115
|
})
|
|
3062
3116
|
);
|
|
3063
3117
|
const selectIssueTypeValuesOfIssueType = restructureCreateSelectorWithArgs(
|
|
@@ -3165,20 +3219,6 @@ var __publicField = (obj, key, value) => {
|
|
|
3165
3219
|
return Object.values(attachmentsMapping);
|
|
3166
3220
|
}
|
|
3167
3221
|
);
|
|
3168
|
-
const selectIssueTypeFieldValuesAttachmentById = (attachmentId) => (state) => {
|
|
3169
|
-
return state.issueTypeFieldValuesAttachmentReducer.instances[attachmentId];
|
|
3170
|
-
};
|
|
3171
|
-
const selectIssueTypeFieldValuesAttachmentsByIds = restructureCreateSelectorWithArgs(
|
|
3172
|
-
toolkit.createSelector(
|
|
3173
|
-
[selectIssueTypeFieldValuesAttachmentsMapping, (_, attachmentIds) => attachmentIds],
|
|
3174
|
-
(mapping, attachmentIds) => {
|
|
3175
|
-
const attachmentIdsSet = new Set(attachmentIds);
|
|
3176
|
-
return fallbackToEmptyArray(
|
|
3177
|
-
Object.values(mapping).filter((attachment) => attachmentIdsSet.has(attachment.offline_id))
|
|
3178
|
-
);
|
|
3179
|
-
}
|
|
3180
|
-
)
|
|
3181
|
-
);
|
|
3182
3222
|
const selectAttachmentsOfIssueTypeFieldValues = restructureCreateSelectorWithArgs(
|
|
3183
3223
|
toolkit.createSelector(
|
|
3184
3224
|
[selectIssueTypeFieldValuesAttachments, (_state, fieldValuesId) => fieldValuesId],
|
|
@@ -3187,6 +3227,9 @@ var __publicField = (obj, key, value) => {
|
|
|
3187
3227
|
}
|
|
3188
3228
|
)
|
|
3189
3229
|
);
|
|
3230
|
+
const selectIssueTypeFieldValuesAttachmentById = (attachmentId) => (state) => {
|
|
3231
|
+
return state.issueTypeFieldValuesAttachmentReducer.instances[attachmentId];
|
|
3232
|
+
};
|
|
3190
3233
|
const issueTypeFieldValuesAttachmentReducer = issueTypeFieldValuesAttachmentSlice.reducer;
|
|
3191
3234
|
const assetTypeFieldsAdapter = createModelAdapter((fields) => fields.offline_id);
|
|
3192
3235
|
const initialState$3 = assetTypeFieldsAdapter.getInitialState({});
|
|
@@ -3228,7 +3271,7 @@ var __publicField = (obj, key, value) => {
|
|
|
3228
3271
|
);
|
|
3229
3272
|
const selectLatestAssetTypeFieldsOfAssetType = restructureCreateSelectorWithArgs(
|
|
3230
3273
|
toolkit.createSelector([selectAssetTypeFields, (_state, id) => id], (fields, id) => {
|
|
3231
|
-
return fields.filter((field) => field.asset_type === id).sort((a, b) => a.submitted_at
|
|
3274
|
+
return fields.filter((field) => field.asset_type === id).sort((a, b) => a.submitted_at < b.submitted_at ? -1 : 1)[0];
|
|
3232
3275
|
})
|
|
3233
3276
|
);
|
|
3234
3277
|
const selectAssetTypeFieldsById = (fieldsId) => (state) => {
|
|
@@ -3375,25 +3418,14 @@ var __publicField = (obj, key, value) => {
|
|
|
3375
3418
|
return Object.values(attachmentsMapping);
|
|
3376
3419
|
}
|
|
3377
3420
|
);
|
|
3378
|
-
const selectAssetTypeFieldValuesAttachmentById = (attachmentId) => (state) => {
|
|
3379
|
-
return state.assetTypeFieldValuesAttachmentReducer.instances[attachmentId];
|
|
3380
|
-
};
|
|
3381
|
-
const selectAssetTypeFieldValuesAttachmentsByIds = restructureCreateSelectorWithArgs(
|
|
3382
|
-
toolkit.createSelector(
|
|
3383
|
-
[selectAssetTypeFieldValuesAttachmentsMapping, (_, attachmentIds) => attachmentIds],
|
|
3384
|
-
(mapping, attachmentIds) => {
|
|
3385
|
-
const attachmentIdsSet = new Set(attachmentIds);
|
|
3386
|
-
return fallbackToEmptyArray(
|
|
3387
|
-
Object.values(mapping).filter((attachment) => attachmentIdsSet.has(attachment.offline_id))
|
|
3388
|
-
);
|
|
3389
|
-
}
|
|
3390
|
-
)
|
|
3391
|
-
);
|
|
3392
3421
|
const selectAttachmentsOfAssetTypeFieldValues = restructureCreateSelectorWithArgs(
|
|
3393
3422
|
toolkit.createSelector([selectAssetTypeFieldValuesAttachments, (_state, id) => id], (attachments, id) => {
|
|
3394
3423
|
return fallbackToEmptyArray(attachments.filter((attachment) => attachment.field_values === id));
|
|
3395
3424
|
})
|
|
3396
3425
|
);
|
|
3426
|
+
const selectAssetTypeFieldValuesAttachmentById = (attachmentId) => (state) => {
|
|
3427
|
+
return state.assetTypeFieldValuesAttachmentReducer.instances[attachmentId];
|
|
3428
|
+
};
|
|
3397
3429
|
const assetTypeFieldValuesAttachmentReducer = assetTypeFieldValuesAttachmentSlice.reducer;
|
|
3398
3430
|
let clientStore;
|
|
3399
3431
|
function setClientStore(store) {
|
|
@@ -5288,7 +5320,15 @@ var __publicField = (obj, key, value) => {
|
|
|
5288
5320
|
const promise = this.enqueueRequest({
|
|
5289
5321
|
method: HttpMethod.POST,
|
|
5290
5322
|
url: "/issue-types/",
|
|
5291
|
-
|
|
5323
|
+
// Sending only whats needed here
|
|
5324
|
+
payload: {
|
|
5325
|
+
offline_id: offlineIssueType.offline_id,
|
|
5326
|
+
submitted_at: offlineIssueType.submitted_at,
|
|
5327
|
+
icon: offlineIssueType.icon,
|
|
5328
|
+
color: offlineIssueType.color,
|
|
5329
|
+
name: offlineIssueType.name,
|
|
5330
|
+
description: offlineIssueType.description
|
|
5331
|
+
},
|
|
5292
5332
|
blockers: [],
|
|
5293
5333
|
blocks: [offlineIssueType.offline_id]
|
|
5294
5334
|
});
|
|
@@ -5708,7 +5748,9 @@ var __publicField = (obj, key, value) => {
|
|
|
5708
5748
|
method: HttpMethod.POST,
|
|
5709
5749
|
url: "/forms/",
|
|
5710
5750
|
payload: {
|
|
5711
|
-
|
|
5751
|
+
// Sending exactly what is currently needed for the endpoint
|
|
5752
|
+
offline_id: offlineForm.offline_id,
|
|
5753
|
+
submitted_at: offlineForm.submitted_at,
|
|
5712
5754
|
initial_revision: {
|
|
5713
5755
|
offline_id: offlineFormRevision.offline_id,
|
|
5714
5756
|
submitted_at: offlineFormRevision.submitted_at,
|
|
@@ -5717,7 +5759,10 @@ var __publicField = (obj, key, value) => {
|
|
|
5717
5759
|
fields: offlineFormRevision.fields
|
|
5718
5760
|
}
|
|
5719
5761
|
},
|
|
5720
|
-
blockers: [
|
|
5762
|
+
blockers: [
|
|
5763
|
+
...payload.project ? [payload.project.toString()] : [],
|
|
5764
|
+
...payload.organization ? [payload.organization.toString()] : []
|
|
5765
|
+
],
|
|
5721
5766
|
blocks: [offlineForm.offline_id, offlineFormRevision.offline_id]
|
|
5722
5767
|
});
|
|
5723
5768
|
void formPromise.catch((e) => {
|
|
@@ -6671,8 +6716,7 @@ var __publicField = (obj, key, value) => {
|
|
|
6671
6716
|
file_name: offlineAttachment.file_name,
|
|
6672
6717
|
file_sha1: offlineAttachment.file_sha1,
|
|
6673
6718
|
file_extension: filePayload.extension,
|
|
6674
|
-
description: offlineAttachment.description
|
|
6675
|
-
document: documentId
|
|
6719
|
+
description: offlineAttachment.description
|
|
6676
6720
|
});
|
|
6677
6721
|
sha1ToAttachmentIds[filePayload.sha1].push(offlineAttachment.offline_id);
|
|
6678
6722
|
}
|
|
@@ -7571,39 +7615,24 @@ var __publicField = (obj, key, value) => {
|
|
|
7571
7615
|
return [offlineAssetTypeFieldValues, promise];
|
|
7572
7616
|
}
|
|
7573
7617
|
bulkAdd(payload, batchSize) {
|
|
7574
|
-
var _a2;
|
|
7575
7618
|
const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
7576
7619
|
const { values } = separateFilesFromValues(payload.values);
|
|
7577
|
-
const
|
|
7578
|
-
const
|
|
7579
|
-
|
|
7580
|
-
for (const batch of batches) {
|
|
7581
|
-
const assetTypeFieldValuesPayloads = [];
|
|
7582
|
-
for (const payload2 of batch) {
|
|
7583
|
-
const offlineAssetTypeFieldValues = offline({
|
|
7584
|
-
...payload2,
|
|
7585
|
-
values: separateFilesFromValues(payload2.values).values,
|
|
7586
|
-
created_by: (_a2 = this.client.store.getState().userReducer.currentUser) == null ? void 0 : _a2.id,
|
|
7587
|
-
submitted_at: submittedAt
|
|
7588
|
-
});
|
|
7589
|
-
offlineAssetTypeFieldValuesMany.push(offlineAssetTypeFieldValues);
|
|
7590
|
-
assetTypeFieldValuesPayloads.push({
|
|
7591
|
-
offline_id: offlineAssetTypeFieldValues.offline_id,
|
|
7592
|
-
asset: payload2.asset,
|
|
7593
|
-
fields_revision: payload2.fields_revision,
|
|
7594
|
-
published_at: payload2.published_at,
|
|
7595
|
-
values: offlineAssetTypeFieldValues.values
|
|
7596
|
-
});
|
|
7597
|
-
}
|
|
7598
|
-
batchPayloads.push({
|
|
7620
|
+
const payloadsBatches = chunkArray(payload.payloads, batchSize);
|
|
7621
|
+
const bulkAddPayloads = payloadsBatches.map((batch) => {
|
|
7622
|
+
return {
|
|
7599
7623
|
submitted_at: submittedAt,
|
|
7600
7624
|
values,
|
|
7601
|
-
field_values:
|
|
7602
|
-
|
|
7603
|
-
|
|
7604
|
-
|
|
7625
|
+
field_values: batch.map((payload2) => {
|
|
7626
|
+
const { values: values2 } = separateFilesFromValues(payload2.values);
|
|
7627
|
+
return offline({
|
|
7628
|
+
...payload2,
|
|
7629
|
+
values: values2
|
|
7630
|
+
});
|
|
7631
|
+
})
|
|
7632
|
+
};
|
|
7633
|
+
});
|
|
7605
7634
|
const promises = [];
|
|
7606
|
-
for (const payload2 of
|
|
7635
|
+
for (const payload2 of bulkAddPayloads) {
|
|
7607
7636
|
const assetIds = payload2.field_values.map((x) => x.asset);
|
|
7608
7637
|
const assetTypeFieldsIds = payload2.field_values.map((x) => x.fields_revision);
|
|
7609
7638
|
const assetTypeFieldValuesIds = payload2.field_values.map((x) => x.offline_id);
|
|
@@ -7618,11 +7647,9 @@ var __publicField = (obj, key, value) => {
|
|
|
7618
7647
|
promises.push(promise);
|
|
7619
7648
|
}
|
|
7620
7649
|
void Promise.all(promises).then((results) => {
|
|
7621
|
-
this.dispatch(
|
|
7622
|
-
}).catch(() => {
|
|
7623
|
-
this.dispatch(deleteAssetTypeFieldValuesMany(offlineAssetTypeFieldValuesMany.map((x) => x.offline_id)));
|
|
7650
|
+
this.dispatch(addAssetTypeFieldValuesMany(results.flat()));
|
|
7624
7651
|
});
|
|
7625
|
-
return
|
|
7652
|
+
return promises;
|
|
7626
7653
|
}
|
|
7627
7654
|
update(payload) {
|
|
7628
7655
|
const { store } = this.client;
|
|
@@ -7646,13 +7673,7 @@ var __publicField = (obj, key, value) => {
|
|
|
7646
7673
|
description: "Delete asset type field values",
|
|
7647
7674
|
method: HttpMethod.PATCH,
|
|
7648
7675
|
url: `/asset-type-field-values/${payload.offline_id}/`,
|
|
7649
|
-
payload
|
|
7650
|
-
...payload,
|
|
7651
|
-
values: {
|
|
7652
|
-
...assetTypeFieldValues.values,
|
|
7653
|
-
...values
|
|
7654
|
-
}
|
|
7655
|
-
},
|
|
7676
|
+
payload,
|
|
7656
7677
|
blockers: [
|
|
7657
7678
|
updatedAssetTypeFieldValues.offline_id,
|
|
7658
7679
|
updatedAssetTypeFieldValues.fields_revision,
|
|
@@ -7706,63 +7727,54 @@ var __publicField = (obj, key, value) => {
|
|
|
7706
7727
|
}
|
|
7707
7728
|
}
|
|
7708
7729
|
class AssetTypeFieldValuesAttachmentService extends BaseUploadService {
|
|
7709
|
-
async bulkAdd(payloads
|
|
7730
|
+
async bulkAdd(payloads) {
|
|
7710
7731
|
var _a2;
|
|
7711
7732
|
const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
7712
7733
|
const createdBy = (_a2 = this.client.store.getState().userReducer.currentUser) == null ? void 0 : _a2.id;
|
|
7713
|
-
const
|
|
7734
|
+
const filePayloads = {};
|
|
7714
7735
|
const offlineAssetTypeFieldValuesAttachments = [];
|
|
7715
|
-
const
|
|
7716
|
-
for (const
|
|
7717
|
-
const
|
|
7718
|
-
const
|
|
7719
|
-
|
|
7720
|
-
|
|
7721
|
-
|
|
7722
|
-
|
|
7723
|
-
|
|
7724
|
-
|
|
7725
|
-
|
|
7726
|
-
|
|
7727
|
-
|
|
7728
|
-
file_sha1: filePayload.sha1,
|
|
7729
|
-
created_by: createdBy,
|
|
7730
|
-
field_values: fieldValuesId,
|
|
7731
|
-
submitted_at: submittedAt,
|
|
7732
|
-
field_identifier: fieldIdentifier
|
|
7733
|
-
});
|
|
7734
|
-
offlineAssetTypeFieldValuesAttachments.push(offlineAssetTypeFieldValuesAttachment);
|
|
7735
|
-
const attachmentPayload = {
|
|
7736
|
-
offline_id: offlineAssetTypeFieldValuesAttachment.offline_id,
|
|
7737
|
-
file_name: file.name,
|
|
7738
|
-
file_sha1: filePayload.sha1,
|
|
7739
|
-
file_extension: filePayload.extension,
|
|
7740
|
-
field_identifier: fieldIdentifier,
|
|
7741
|
-
field_values: fieldValuesId
|
|
7742
|
-
};
|
|
7743
|
-
attachmentPayloads.push(attachmentPayload);
|
|
7744
|
-
}
|
|
7745
|
-
batchPayloads.push({
|
|
7736
|
+
const attachmentPayloads = [];
|
|
7737
|
+
for (const payload of payloads) {
|
|
7738
|
+
const { fieldValuesId, fieldIdentifier, file } = payload;
|
|
7739
|
+
const filePayload = await this.getFilePayload(file);
|
|
7740
|
+
if (!(filePayload.sha1 in filePayloads))
|
|
7741
|
+
filePayloads[filePayload.sha1] = filePayload;
|
|
7742
|
+
const offlineAssetTypeFieldValuesAttachment = offline({
|
|
7743
|
+
file: URL.createObjectURL(file),
|
|
7744
|
+
file_type: file.type,
|
|
7745
|
+
file_name: file.name,
|
|
7746
|
+
file_sha1: filePayload.sha1,
|
|
7747
|
+
created_by: createdBy,
|
|
7748
|
+
field_values: fieldValuesId,
|
|
7746
7749
|
submitted_at: submittedAt,
|
|
7747
|
-
|
|
7748
|
-
files: Object.values(filePayloads)
|
|
7750
|
+
field_identifier: fieldIdentifier
|
|
7749
7751
|
});
|
|
7752
|
+
offlineAssetTypeFieldValuesAttachments.push(offlineAssetTypeFieldValuesAttachment);
|
|
7753
|
+
const attachmentPayload = {
|
|
7754
|
+
offline_id: offlineAssetTypeFieldValuesAttachment.offline_id,
|
|
7755
|
+
file_name: file.name,
|
|
7756
|
+
file_sha1: filePayload.sha1,
|
|
7757
|
+
file_extension: filePayload.extension,
|
|
7758
|
+
field_identifier: fieldIdentifier,
|
|
7759
|
+
field_values: fieldValuesId
|
|
7760
|
+
};
|
|
7761
|
+
attachmentPayloads.push(attachmentPayload);
|
|
7750
7762
|
}
|
|
7751
7763
|
this.dispatch(addAssetTypeFieldValuesAttachments(offlineAssetTypeFieldValuesAttachments));
|
|
7752
|
-
const
|
|
7753
|
-
|
|
7754
|
-
|
|
7755
|
-
|
|
7756
|
-
|
|
7757
|
-
|
|
7758
|
-
|
|
7759
|
-
|
|
7760
|
-
}
|
|
7764
|
+
const promise = this.enqueueRequest({
|
|
7765
|
+
description: "Add asset type field values attachments",
|
|
7766
|
+
method: HttpMethod.POST,
|
|
7767
|
+
url: "/asset-type-field-values-attachments/bulk/",
|
|
7768
|
+
payload: {
|
|
7769
|
+
submitted_at: submittedAt,
|
|
7770
|
+
attachments: attachmentPayloads,
|
|
7771
|
+
files: Object.values(filePayloads)
|
|
7772
|
+
},
|
|
7773
|
+
blockers: offlineAssetTypeFieldValuesAttachments.map((attachment) => attachment.field_values),
|
|
7774
|
+
blocks: offlineAssetTypeFieldValuesAttachments.map((attachment) => attachment.offline_id)
|
|
7761
7775
|
});
|
|
7762
|
-
|
|
7763
|
-
|
|
7764
|
-
this.processPresignedUrls(res.presigned_urls);
|
|
7765
|
-
const attachments = result.flatMap((res) => res.attachments);
|
|
7776
|
+
promise.then(({ presigned_urls, attachments }) => {
|
|
7777
|
+
this.processPresignedUrls(presigned_urls);
|
|
7766
7778
|
this.dispatch(updateAssetTypeFieldValuesAttachments(attachments));
|
|
7767
7779
|
}).catch((error) => {
|
|
7768
7780
|
this.dispatch(
|
|
@@ -7772,16 +7784,13 @@ var __publicField = (obj, key, value) => {
|
|
|
7772
7784
|
);
|
|
7773
7785
|
throw error;
|
|
7774
7786
|
});
|
|
7775
|
-
return [
|
|
7776
|
-
offlineAssetTypeFieldValuesAttachments,
|
|
7777
|
-
promises.map((promise) => promise.then(({ attachments }) => attachments))
|
|
7778
|
-
];
|
|
7787
|
+
return [offlineAssetTypeFieldValuesAttachments, promise.then(({ attachments }) => attachments)];
|
|
7779
7788
|
}
|
|
7780
7789
|
async bulkDelete(ids) {
|
|
7781
7790
|
const { store } = this.client;
|
|
7782
7791
|
const state = store.getState();
|
|
7783
|
-
const
|
|
7784
|
-
this.dispatch(
|
|
7792
|
+
const formSubmissionAttachments = selectFormSubmissionAttachemntsByIds(ids)(state);
|
|
7793
|
+
this.dispatch(deleteFormSubmissionAttachments(ids));
|
|
7785
7794
|
try {
|
|
7786
7795
|
await this.enqueueRequest({
|
|
7787
7796
|
description: "Delete asset type field values attachments",
|
|
@@ -7792,13 +7801,13 @@ var __publicField = (obj, key, value) => {
|
|
|
7792
7801
|
blocks: []
|
|
7793
7802
|
});
|
|
7794
7803
|
} catch (e) {
|
|
7795
|
-
this.dispatch(
|
|
7804
|
+
this.dispatch(addFormSubmissionAttachments(formSubmissionAttachments));
|
|
7796
7805
|
throw e;
|
|
7797
7806
|
}
|
|
7798
7807
|
}
|
|
7799
7808
|
async refreshStore(projectId) {
|
|
7800
7809
|
const result = await this.enqueueRequest({
|
|
7801
|
-
description: "
|
|
7810
|
+
description: "Gfet asset type field values attachments",
|
|
7802
7811
|
method: HttpMethod.GET,
|
|
7803
7812
|
url: "/asset-type-field-values-attachments/",
|
|
7804
7813
|
queryParams: {
|
|
@@ -7988,8 +7997,8 @@ var __publicField = (obj, key, value) => {
|
|
|
7988
7997
|
async bulkDelete(attachmentsIds) {
|
|
7989
7998
|
const { store } = this.client;
|
|
7990
7999
|
const state = store.getState();
|
|
7991
|
-
const
|
|
7992
|
-
this.dispatch(
|
|
8000
|
+
const formSubmissionAttachments = selectFormSubmissionAttachemntsByIds(attachmentsIds)(state);
|
|
8001
|
+
this.dispatch(deleteFormSubmissionAttachments(attachmentsIds));
|
|
7993
8002
|
try {
|
|
7994
8003
|
await this.enqueueRequest({
|
|
7995
8004
|
description: "Delete issue type field values attachments",
|
|
@@ -8000,7 +8009,7 @@ var __publicField = (obj, key, value) => {
|
|
|
8000
8009
|
blocks: []
|
|
8001
8010
|
});
|
|
8002
8011
|
} catch (e) {
|
|
8003
|
-
this.dispatch(
|
|
8012
|
+
this.dispatch(addFormSubmissionAttachments(formSubmissionAttachments));
|
|
8004
8013
|
throw e;
|
|
8005
8014
|
}
|
|
8006
8015
|
}
|
|
@@ -8069,13 +8078,7 @@ var __publicField = (obj, key, value) => {
|
|
|
8069
8078
|
description: "Update issue type field values",
|
|
8070
8079
|
method: HttpMethod.PATCH,
|
|
8071
8080
|
url: `/issue-type-field-values/${payload.offline_id}/`,
|
|
8072
|
-
payload
|
|
8073
|
-
...payload,
|
|
8074
|
-
values: {
|
|
8075
|
-
...issueTypeFieldValues.values,
|
|
8076
|
-
...values
|
|
8077
|
-
}
|
|
8078
|
-
},
|
|
8081
|
+
payload,
|
|
8079
8082
|
blockers: [
|
|
8080
8083
|
updatedIssueTypeFieldValues.offline_id,
|
|
8081
8084
|
updatedIssueTypeFieldValues.fields_revision,
|
|
@@ -8544,7 +8547,6 @@ var __publicField = (obj, key, value) => {
|
|
|
8544
8547
|
exports2.selectAssetTypeFieldValues = selectAssetTypeFieldValues;
|
|
8545
8548
|
exports2.selectAssetTypeFieldValuesAttachmentById = selectAssetTypeFieldValuesAttachmentById;
|
|
8546
8549
|
exports2.selectAssetTypeFieldValuesAttachments = selectAssetTypeFieldValuesAttachments;
|
|
8547
|
-
exports2.selectAssetTypeFieldValuesAttachmentsByIds = selectAssetTypeFieldValuesAttachmentsByIds;
|
|
8548
8550
|
exports2.selectAssetTypeFieldValuesAttachmentsMapping = selectAssetTypeFieldValuesAttachmentsMapping;
|
|
8549
8551
|
exports2.selectAssetTypeFieldValuesById = selectAssetTypeFieldValuesById;
|
|
8550
8552
|
exports2.selectAssetTypeFieldValuesMapping = selectAssetTypeFieldValuesMapping;
|
|
@@ -8615,11 +8617,14 @@ var __publicField = (obj, key, value) => {
|
|
|
8615
8617
|
exports2.selectFormSubmissionAttachmentsMapping = selectFormSubmissionAttachmentsMapping;
|
|
8616
8618
|
exports2.selectFormSubmissionById = selectFormSubmissionById;
|
|
8617
8619
|
exports2.selectFormSubmissions = selectFormSubmissions;
|
|
8620
|
+
exports2.selectFormSubmissionsByFormRevisions = selectFormSubmissionsByFormRevisions;
|
|
8618
8621
|
exports2.selectFormSubmissionsMapping = selectFormSubmissionsMapping;
|
|
8619
8622
|
exports2.selectFormSubmissionsOfAsset = selectFormSubmissionsOfAsset;
|
|
8620
8623
|
exports2.selectFormSubmissionsOfForm = selectFormSubmissionsOfForm;
|
|
8621
8624
|
exports2.selectFormSubmissionsOfIssue = selectFormSubmissionsOfIssue;
|
|
8622
8625
|
exports2.selectForms = selectForms;
|
|
8626
|
+
exports2.selectFormsCount = selectFormsCount;
|
|
8627
|
+
exports2.selectGeneralFormCount = selectGeneralFormCount;
|
|
8623
8628
|
exports2.selectGeoImageById = selectGeoImageById;
|
|
8624
8629
|
exports2.selectGeoImageMapping = selectGeoImageMapping;
|
|
8625
8630
|
exports2.selectGeoImages = selectGeoImages;
|
|
@@ -8644,7 +8649,6 @@ var __publicField = (obj, key, value) => {
|
|
|
8644
8649
|
exports2.selectIssueTypeFieldValues = selectIssueTypeFieldValues;
|
|
8645
8650
|
exports2.selectIssueTypeFieldValuesAttachmentById = selectIssueTypeFieldValuesAttachmentById;
|
|
8646
8651
|
exports2.selectIssueTypeFieldValuesAttachments = selectIssueTypeFieldValuesAttachments;
|
|
8647
|
-
exports2.selectIssueTypeFieldValuesAttachmentsByIds = selectIssueTypeFieldValuesAttachmentsByIds;
|
|
8648
8652
|
exports2.selectIssueTypeFieldValuesAttachmentsMapping = selectIssueTypeFieldValuesAttachmentsMapping;
|
|
8649
8653
|
exports2.selectIssueTypeFieldValuesById = selectIssueTypeFieldValuesById;
|
|
8650
8654
|
exports2.selectIssueTypeFieldValuesMapping = selectIssueTypeFieldValuesMapping;
|
|
@@ -8667,6 +8671,7 @@ var __publicField = (obj, key, value) => {
|
|
|
8667
8671
|
exports2.selectIssuesOfIssueType = selectIssuesOfIssueType;
|
|
8668
8672
|
exports2.selectIssuesOfIssueTypeCount = selectIssuesOfIssueTypeCount;
|
|
8669
8673
|
exports2.selectLatestAssetTypeFieldsOfAssetType = selectLatestAssetTypeFieldsOfAssetType;
|
|
8674
|
+
exports2.selectLatestFormRevisionByForm = selectLatestFormRevisionByForm;
|
|
8670
8675
|
exports2.selectLatestFormRevisionOfForm = selectLatestFormRevisionOfForm;
|
|
8671
8676
|
exports2.selectLatestIssueTypeFieldsOfIssueType = selectLatestIssueTypeFieldsOfIssueType;
|
|
8672
8677
|
exports2.selectLatestRetryTime = selectLatestRetryTime;
|
|
@@ -8705,6 +8710,7 @@ var __publicField = (obj, key, value) => {
|
|
|
8705
8710
|
exports2.selectProjectsOfOrganization = selectProjectsOfOrganization;
|
|
8706
8711
|
exports2.selectRehydrated = selectRehydrated;
|
|
8707
8712
|
exports2.selectRootDocuments = selectRootDocuments;
|
|
8713
|
+
exports2.selectSortedFormSubmissionsOfForm = selectSortedFormSubmissionsOfForm;
|
|
8708
8714
|
exports2.selectSortedOrganizationUsers = selectSortedOrganizationUsers;
|
|
8709
8715
|
exports2.selectSortedProjectUsers = selectSortedProjectUsers;
|
|
8710
8716
|
exports2.selectStageFormIdsFromStageIds = selectStageFormIdsFromStageIds;
|