@overmap-ai/core 1.0.58-export-overmap-reducer.0 → 1.0.58-export-overmap-reducer.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/forms/fields/BaseField/BaseField.d.ts +3 -1
- package/dist/forms/fields/MultiStringField/MultiStringField.d.ts +6 -6
- package/dist/forms/fields/typings.d.ts +1 -1
- package/dist/forms/fields/utils.d.ts +3 -0
- package/dist/forms/index.d.ts +1 -0
- package/dist/forms/typings.d.ts +1 -1
- package/dist/overmap-core.js +246 -123
- package/dist/overmap-core.js.map +1 -1
- package/dist/overmap-core.umd.cjs +246 -123
- package/dist/overmap-core.umd.cjs.map +1 -1
- package/dist/sdk/services/AssetService.d.ts +2 -2
- package/dist/sdk/services/UserFormSubmissionService.d.ts +13 -6
- package/dist/store/slices/assetSlice.d.ts +3 -1
- package/dist/typings/models/components.d.ts +1 -0
- package/dist/utils/array.d.ts +1 -0
- package/package.json +1 -1
|
@@ -1452,6 +1452,16 @@ var __publicField = (obj, key, value) => {
|
|
|
1452
1452
|
}
|
|
1453
1453
|
prevAssets = null;
|
|
1454
1454
|
},
|
|
1455
|
+
updateAssets: (state, action) => {
|
|
1456
|
+
for (const asset of action.payload) {
|
|
1457
|
+
if (asset.offline_id in state.assets) {
|
|
1458
|
+
state.assets[asset.offline_id] = asset;
|
|
1459
|
+
} else {
|
|
1460
|
+
throw new Error(`Tried to update asset with ID that doesn't exist: ${asset.offline_id}`);
|
|
1461
|
+
}
|
|
1462
|
+
}
|
|
1463
|
+
prevAssets = null;
|
|
1464
|
+
},
|
|
1455
1465
|
removeAsset: (state, action) => {
|
|
1456
1466
|
if (action.payload in state.assets) {
|
|
1457
1467
|
delete state.assets[action.payload];
|
|
@@ -1460,6 +1470,16 @@ var __publicField = (obj, key, value) => {
|
|
|
1460
1470
|
}
|
|
1461
1471
|
prevAssets = null;
|
|
1462
1472
|
},
|
|
1473
|
+
removeAssets: (state, action) => {
|
|
1474
|
+
for (const assetId of action.payload) {
|
|
1475
|
+
if (assetId in state.assets) {
|
|
1476
|
+
delete state.assets[assetId];
|
|
1477
|
+
} else {
|
|
1478
|
+
throw new Error(`Failed to remove asset because ID doesn't exist: ${assetId}`);
|
|
1479
|
+
}
|
|
1480
|
+
}
|
|
1481
|
+
prevAssets = null;
|
|
1482
|
+
},
|
|
1463
1483
|
removeAllAssetsOfType: (state, action) => {
|
|
1464
1484
|
var _a2;
|
|
1465
1485
|
for (const componentId in state.assets) {
|
|
@@ -1483,7 +1503,9 @@ var __publicField = (obj, key, value) => {
|
|
|
1483
1503
|
const {
|
|
1484
1504
|
addAsset,
|
|
1485
1505
|
updateAsset,
|
|
1506
|
+
updateAssets,
|
|
1486
1507
|
removeAsset,
|
|
1508
|
+
removeAssets,
|
|
1487
1509
|
addAssetsInBatches,
|
|
1488
1510
|
setAssets,
|
|
1489
1511
|
removeAllAssetsOfType,
|
|
@@ -5100,6 +5122,15 @@ var __publicField = (obj, key, value) => {
|
|
|
5100
5122
|
store.dispatch(setCategories(result));
|
|
5101
5123
|
}
|
|
5102
5124
|
}
|
|
5125
|
+
function chunkArray(arr, chunkSize) {
|
|
5126
|
+
const chunks = [];
|
|
5127
|
+
let index2 = 0;
|
|
5128
|
+
const arrLength = arr.length;
|
|
5129
|
+
while (index2 < arrLength) {
|
|
5130
|
+
chunks.push(arr.slice(index2, index2 += chunkSize));
|
|
5131
|
+
}
|
|
5132
|
+
return chunks;
|
|
5133
|
+
}
|
|
5103
5134
|
class AssetService extends BaseApiService {
|
|
5104
5135
|
// Basic CRUD functions
|
|
5105
5136
|
add(asset, workspaceId) {
|
|
@@ -5176,36 +5207,55 @@ var __publicField = (obj, key, value) => {
|
|
|
5176
5207
|
throw err;
|
|
5177
5208
|
});
|
|
5178
5209
|
}
|
|
5179
|
-
|
|
5180
|
-
|
|
5181
|
-
return { ...offline(asset), submitted_at: (/* @__PURE__ */ new Date()).toISOString() };
|
|
5182
|
-
});
|
|
5210
|
+
// TODO: payload does not require asset_type
|
|
5211
|
+
bulkAdd(assetsToCreate, workspaceId, assetTypeId, batchSize) {
|
|
5183
5212
|
const { store } = this.client;
|
|
5184
|
-
|
|
5185
|
-
const
|
|
5186
|
-
|
|
5187
|
-
|
|
5188
|
-
|
|
5189
|
-
|
|
5190
|
-
|
|
5191
|
-
|
|
5192
|
-
|
|
5193
|
-
|
|
5194
|
-
|
|
5195
|
-
|
|
5196
|
-
|
|
5213
|
+
const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
5214
|
+
const transactionId = uuid.v4();
|
|
5215
|
+
const assetBatches = chunkArray(assetsToCreate, batchSize).map((assetBatch) => {
|
|
5216
|
+
const assetPayloads = assetBatch.map((assetPayload) => {
|
|
5217
|
+
return offline({
|
|
5218
|
+
...assetPayload,
|
|
5219
|
+
submitted_at: submittedAt
|
|
5220
|
+
});
|
|
5221
|
+
});
|
|
5222
|
+
return {
|
|
5223
|
+
batchId: uuid.v4(),
|
|
5224
|
+
payload: {
|
|
5225
|
+
transaction_id: transactionId,
|
|
5226
|
+
assets: assetPayloads
|
|
5227
|
+
}
|
|
5228
|
+
};
|
|
5197
5229
|
});
|
|
5198
|
-
|
|
5199
|
-
|
|
5200
|
-
|
|
5201
|
-
}
|
|
5202
|
-
|
|
5203
|
-
|
|
5204
|
-
|
|
5205
|
-
|
|
5206
|
-
|
|
5230
|
+
const batchPromises = [];
|
|
5231
|
+
let prevBatchId = null;
|
|
5232
|
+
for (const assetBatch of assetBatches) {
|
|
5233
|
+
const { batchId, payload } = assetBatch;
|
|
5234
|
+
const batchAssetOfflineIds = payload.assets.map((c) => c.offline_id);
|
|
5235
|
+
const blockers = [assetTypeId];
|
|
5236
|
+
if (prevBatchId)
|
|
5237
|
+
blockers.push(prevBatchId);
|
|
5238
|
+
const blocks2 = batchAssetOfflineIds;
|
|
5239
|
+
blocks2.push(batchId);
|
|
5240
|
+
const promise = this.client.enqueueRequest({
|
|
5241
|
+
description: "Batch create assets",
|
|
5242
|
+
method: HttpMethod.POST,
|
|
5243
|
+
url: `/assets/types/${assetTypeId}/add-assets/`,
|
|
5244
|
+
queryParams: {
|
|
5245
|
+
workspace_id: workspaceId.toString()
|
|
5246
|
+
},
|
|
5247
|
+
payload,
|
|
5248
|
+
blockers,
|
|
5249
|
+
blocks: blocks2
|
|
5250
|
+
});
|
|
5251
|
+
prevBatchId = assetBatch.batchId;
|
|
5252
|
+
batchPromises.push(promise);
|
|
5253
|
+
}
|
|
5254
|
+
void Promise.all(batchPromises).then((result) => {
|
|
5255
|
+
const allCreatedAssets = result.flat();
|
|
5256
|
+
store.dispatch(addAssetsInBatches(allCreatedAssets));
|
|
5207
5257
|
});
|
|
5208
|
-
return
|
|
5258
|
+
return batchPromises;
|
|
5209
5259
|
}
|
|
5210
5260
|
async refreshStore() {
|
|
5211
5261
|
const { store } = this.client;
|
|
@@ -7071,100 +7121,120 @@ var __publicField = (obj, key, value) => {
|
|
|
7071
7121
|
}
|
|
7072
7122
|
// Note currently the bulkAdd method is specific to form submissions for assets
|
|
7073
7123
|
// TODO: adapt the support bulk adding to any model type
|
|
7074
|
-
async bulkAdd(args) {
|
|
7075
|
-
const { formRevision, values: argsValues, assetOfflineIds } = args;
|
|
7124
|
+
async bulkAdd(args, batchSize) {
|
|
7076
7125
|
const { store } = this.client;
|
|
7077
|
-
const
|
|
7078
|
-
const
|
|
7079
|
-
const
|
|
7080
|
-
const submissionsPayload = [];
|
|
7081
|
-
const attachmentsPayload = [];
|
|
7082
|
-
const { values, files } = separateFilesFromValues(argsValues);
|
|
7126
|
+
const { formRevision, commonFieldValues, fieldValuesByAsset } = args;
|
|
7127
|
+
const allFilesRecord = {};
|
|
7128
|
+
const { values: fileSeperatedCommonFieldValues, files: commonFiles } = separateFilesFromValues(commonFieldValues);
|
|
7083
7129
|
const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
7084
|
-
const
|
|
7085
|
-
|
|
7086
|
-
|
|
7087
|
-
|
|
7088
|
-
|
|
7089
|
-
|
|
7090
|
-
|
|
7091
|
-
|
|
7092
|
-
|
|
7093
|
-
|
|
7094
|
-
|
|
7095
|
-
|
|
7096
|
-
|
|
7097
|
-
|
|
7098
|
-
const sha1 = await hashFile(file);
|
|
7099
|
-
await this.client.files.addCache(file, sha1);
|
|
7100
|
-
const offlineAttachment = offline({
|
|
7101
|
-
file_name: file.name,
|
|
7102
|
-
file_sha1: sha1,
|
|
7103
|
-
file: URL.createObjectURL(file),
|
|
7104
|
-
submission: submission.offline_id,
|
|
7105
|
-
field_identifier: fieldIdentifier
|
|
7130
|
+
const transactionId = uuid.v4();
|
|
7131
|
+
const assetIdBatches = chunkArray(Object.keys(fieldValuesByAsset), batchSize);
|
|
7132
|
+
const bulkAddBatches = await Promise.all(
|
|
7133
|
+
assetIdBatches.map(async (assetIdBatch) => {
|
|
7134
|
+
const batchId = uuid.v4();
|
|
7135
|
+
const submissionPayloads = [];
|
|
7136
|
+
const attachmentPayloads = [];
|
|
7137
|
+
const files = { ...commonFiles };
|
|
7138
|
+
for (const assetId of assetIdBatch) {
|
|
7139
|
+
const { values: fileSeperatedSubmissionSpecificValues, files: submissionSpecificFiles } = separateFilesFromValues(fieldValuesByAsset[assetId] ?? {});
|
|
7140
|
+
Object.assign(files, submissionSpecificFiles);
|
|
7141
|
+
const submissionPayload = offline({
|
|
7142
|
+
asset_id: assetId,
|
|
7143
|
+
form_data: fileSeperatedSubmissionSpecificValues
|
|
7106
7144
|
});
|
|
7107
|
-
|
|
7108
|
-
|
|
7109
|
-
|
|
7110
|
-
|
|
7145
|
+
submissionPayloads.push(submissionPayload);
|
|
7146
|
+
for (const [fieldIdentifier, fileArray] of Object.entries(files)) {
|
|
7147
|
+
for (const file of fileArray) {
|
|
7148
|
+
const sha1 = await hashFile(file);
|
|
7149
|
+
await this.client.files.addCache(file, sha1);
|
|
7150
|
+
const attachmentPayload = offline({
|
|
7151
|
+
submission_id: submissionPayload.offline_id,
|
|
7152
|
+
sha1,
|
|
7153
|
+
name: file.name,
|
|
7154
|
+
field_identifier: fieldIdentifier
|
|
7155
|
+
});
|
|
7156
|
+
attachmentPayloads.push(attachmentPayload);
|
|
7157
|
+
}
|
|
7158
|
+
}
|
|
7159
|
+
}
|
|
7160
|
+
const filePaylods = [];
|
|
7161
|
+
for (const file of Object.values(files).flat()) {
|
|
7162
|
+
const sha1 = await hashFile(file);
|
|
7163
|
+
const filePayload = {
|
|
7111
7164
|
sha1,
|
|
7112
|
-
|
|
7113
|
-
|
|
7165
|
+
extension: file.name.split(".").pop() || "",
|
|
7166
|
+
file_type: file.type,
|
|
7167
|
+
size: file.size
|
|
7168
|
+
};
|
|
7169
|
+
allFilesRecord[sha1] = filePayload;
|
|
7170
|
+
filePaylods.push(filePayload);
|
|
7171
|
+
}
|
|
7172
|
+
return {
|
|
7173
|
+
batchId,
|
|
7174
|
+
payload: {
|
|
7175
|
+
transaction_id: transactionId,
|
|
7176
|
+
form_data: fileSeperatedCommonFieldValues,
|
|
7177
|
+
submitted_at: submittedAt,
|
|
7178
|
+
submissions: submissionPayloads,
|
|
7179
|
+
attachments: attachmentPayloads,
|
|
7180
|
+
files: filePaylods
|
|
7181
|
+
}
|
|
7182
|
+
};
|
|
7183
|
+
})
|
|
7184
|
+
);
|
|
7185
|
+
const batchPromises = [];
|
|
7186
|
+
let prevBatchId = null;
|
|
7187
|
+
for (const batch of bulkAddBatches) {
|
|
7188
|
+
const { payload, batchId } = batch;
|
|
7189
|
+
const batchAssetIds = payload.submissions.map((x) => x.asset_id);
|
|
7190
|
+
const batchSubmissionOfflineIds = payload.submissions.map((x) => x.offline_id);
|
|
7191
|
+
const batchAttachmentsOfflineIds = payload.attachments.map((x) => x.offline_id);
|
|
7192
|
+
const blockers = batchAssetIds;
|
|
7193
|
+
if (prevBatchId)
|
|
7194
|
+
blockers.push(prevBatchId);
|
|
7195
|
+
const blocks2 = [...batchSubmissionOfflineIds, ...batchAttachmentsOfflineIds, batchId];
|
|
7196
|
+
const promise = this.client.enqueueRequest({
|
|
7197
|
+
description: "Bulk add form submissions",
|
|
7198
|
+
method: HttpMethod.POST,
|
|
7199
|
+
url: `/forms/revisions/${formRevision}/bulk-respond/`,
|
|
7200
|
+
payload,
|
|
7201
|
+
blockers,
|
|
7202
|
+
blocks: blocks2
|
|
7203
|
+
});
|
|
7204
|
+
void promise.then(({ presigned_urls }) => {
|
|
7205
|
+
for (const [sha1, presignedUrl] of Object.entries(presigned_urls)) {
|
|
7206
|
+
const file = allFilesRecord[sha1];
|
|
7207
|
+
if (!file)
|
|
7208
|
+
continue;
|
|
7209
|
+
void this.client.enqueueRequest({
|
|
7210
|
+
url: presignedUrl.url,
|
|
7211
|
+
description: "Upload file",
|
|
7212
|
+
method: HttpMethod.POST,
|
|
7213
|
+
isExternalUrl: true,
|
|
7214
|
+
isAuthNeeded: false,
|
|
7215
|
+
attachmentHash: sha1,
|
|
7216
|
+
blockers: [`s3-${file.sha1}.${file.extension}`],
|
|
7217
|
+
blocks: [sha1],
|
|
7218
|
+
s3url: presignedUrl
|
|
7114
7219
|
});
|
|
7115
7220
|
}
|
|
7116
|
-
}
|
|
7117
|
-
|
|
7118
|
-
|
|
7119
|
-
|
|
7120
|
-
|
|
7121
|
-
|
|
7122
|
-
|
|
7123
|
-
|
|
7124
|
-
|
|
7125
|
-
|
|
7126
|
-
|
|
7127
|
-
|
|
7128
|
-
|
|
7129
|
-
|
|
7130
|
-
|
|
7131
|
-
description: "Bulk add form submissions",
|
|
7132
|
-
method: HttpMethod.POST,
|
|
7133
|
-
url: `/forms/revisions/${formRevision}/bulk-respond/`,
|
|
7134
|
-
payload: {
|
|
7135
|
-
form_data: values,
|
|
7136
|
-
submitted_at: submittedAt,
|
|
7137
|
-
submissions: submissionsPayload,
|
|
7138
|
-
attachments: attachmentsPayload,
|
|
7139
|
-
files: Object.values(filesRecord)
|
|
7140
|
-
},
|
|
7141
|
-
blockers: assetOfflineIds,
|
|
7142
|
-
blocks: submissionOfflineIds
|
|
7143
|
-
});
|
|
7144
|
-
promise.then(({ submissions, attachments, presigned_urls }) => {
|
|
7145
|
-
store.dispatch(updateFormSubmissions(submissions));
|
|
7146
|
-
store.dispatch(updateFormSubmissionAttachments(attachments));
|
|
7147
|
-
for (const [sha1, presigned_url] of Object.entries(presigned_urls)) {
|
|
7148
|
-
const file = filesRecord[sha1];
|
|
7149
|
-
if (!file)
|
|
7150
|
-
continue;
|
|
7151
|
-
void this.client.enqueueRequest({
|
|
7152
|
-
url: presigned_url.url,
|
|
7153
|
-
description: "Upload file",
|
|
7154
|
-
method: HttpMethod.POST,
|
|
7155
|
-
isExternalUrl: true,
|
|
7156
|
-
isAuthNeeded: false,
|
|
7157
|
-
attachmentHash: sha1,
|
|
7158
|
-
blockers: [`s3-${file.sha1}.${file.extension}`],
|
|
7159
|
-
blocks: [sha1],
|
|
7160
|
-
s3url: presigned_url
|
|
7161
|
-
});
|
|
7162
|
-
}
|
|
7163
|
-
}).catch(() => {
|
|
7164
|
-
store.dispatch(deleteFormSubmissions(submissionOfflineIds));
|
|
7165
|
-
store.dispatch(deleteFormSubmissionAttachments(offlineAttachments.map((x) => x.offline_id)));
|
|
7221
|
+
});
|
|
7222
|
+
prevBatchId = batchId;
|
|
7223
|
+
batchPromises.push(promise);
|
|
7224
|
+
}
|
|
7225
|
+
void Promise.all(batchPromises).then((results) => {
|
|
7226
|
+
const createdSubmissions = [];
|
|
7227
|
+
const createdAttachments = [];
|
|
7228
|
+
for (const result of results) {
|
|
7229
|
+
for (const createdSubmission of result.submissions)
|
|
7230
|
+
createdSubmissions.push(createdSubmission);
|
|
7231
|
+
for (const createdAttachment of result.attachments)
|
|
7232
|
+
createdAttachments.push(createdAttachment);
|
|
7233
|
+
}
|
|
7234
|
+
store.dispatch(addFormSubmissions(createdSubmissions));
|
|
7235
|
+
store.dispatch(addFormSubmissionAttachments(createdAttachments));
|
|
7166
7236
|
});
|
|
7167
|
-
return
|
|
7237
|
+
return batchPromises;
|
|
7168
7238
|
}
|
|
7169
7239
|
update(submission) {
|
|
7170
7240
|
const { store } = this.client;
|
|
@@ -8519,6 +8589,12 @@ var __publicField = (obj, key, value) => {
|
|
|
8519
8589
|
getFormValidators() {
|
|
8520
8590
|
return [...this.formValidators];
|
|
8521
8591
|
}
|
|
8592
|
+
encodeValueToJson(value) {
|
|
8593
|
+
return JSON.stringify(value);
|
|
8594
|
+
}
|
|
8595
|
+
decodeJsonToValue(json) {
|
|
8596
|
+
return JSON.parse(json);
|
|
8597
|
+
}
|
|
8522
8598
|
}
|
|
8523
8599
|
__publicField(BaseField, "fieldTypeName");
|
|
8524
8600
|
__publicField(BaseField, "fieldTypeDescription");
|
|
@@ -16932,10 +17008,7 @@ Defaulting to \`${$89eedd556c436f6a$var$DEFAULT_ORIENTATION}\`.`;
|
|
|
16932
17008
|
helpText = showInputOnly ? null : helpText;
|
|
16933
17009
|
label = showInputOnly ? "" : label;
|
|
16934
17010
|
const color = blocks.useSeverityColor(severity);
|
|
16935
|
-
const value = React.useMemo(
|
|
16936
|
-
() => Array.isArray(fieldProps.value) ? fieldProps.value : [],
|
|
16937
|
-
[fieldProps.value]
|
|
16938
|
-
);
|
|
17011
|
+
const value = React.useMemo(() => Array.isArray(fieldProps.value) ? fieldProps.value : [], [fieldProps.value]);
|
|
16939
17012
|
const { onChange, onBlur } = fieldProps;
|
|
16940
17013
|
const droppableId = `${inputId}-droppable`;
|
|
16941
17014
|
const { disabled } = rest;
|
|
@@ -16952,7 +17025,7 @@ Defaulting to \`${$89eedd556c436f6a$var$DEFAULT_ORIENTATION}\`.`;
|
|
|
16952
17025
|
);
|
|
16953
17026
|
const handleChange = React.useCallback(
|
|
16954
17027
|
(e) => {
|
|
16955
|
-
if (value.findIndex((option) => option
|
|
17028
|
+
if (value.findIndex((option) => option === e.target.value.trim()) >= 0) {
|
|
16956
17029
|
setInternalError("All options must be unique");
|
|
16957
17030
|
} else if (!e.target.value) {
|
|
16958
17031
|
setInternalError("Option cannot be empty");
|
|
@@ -16971,7 +17044,7 @@ Defaulting to \`${$89eedd556c436f6a$var$DEFAULT_ORIENTATION}\`.`;
|
|
|
16971
17044
|
return;
|
|
16972
17045
|
}
|
|
16973
17046
|
const trimmedValue = intermediateValue.trim();
|
|
16974
|
-
setValueAndTouched([...value,
|
|
17047
|
+
setValueAndTouched([...value, trimmedValue]);
|
|
16975
17048
|
setIntermediateValue("");
|
|
16976
17049
|
}, [intermediateValue, internalError, setValueAndTouched, value]);
|
|
16977
17050
|
const handleKeyDown = React.useCallback(
|
|
@@ -17041,7 +17114,7 @@ Defaulting to \`${$89eedd556c436f6a$var$DEFAULT_ORIENTATION}\`.`;
|
|
|
17041
17114
|
value.map((option, index2) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
17042
17115
|
dnd.Draggable,
|
|
17043
17116
|
{
|
|
17044
|
-
draggableId: `${option
|
|
17117
|
+
draggableId: `${option}-draggable`,
|
|
17045
17118
|
index: index2,
|
|
17046
17119
|
isDragDisabled: disabled,
|
|
17047
17120
|
children: ({ draggableProps, dragHandleProps, innerRef }) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -17056,7 +17129,7 @@ Defaulting to \`${$89eedd556c436f6a$var$DEFAULT_ORIENTATION}\`.`;
|
|
|
17056
17129
|
mb: "1",
|
|
17057
17130
|
asChild: true,
|
|
17058
17131
|
children: /* @__PURE__ */ jsxRuntime.jsxs(blocks.Badge, { color: "gray", size: "2", children: [
|
|
17059
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { children: option
|
|
17132
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: option }),
|
|
17060
17133
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
17061
17134
|
blocks.IconButton,
|
|
17062
17135
|
{
|
|
@@ -17076,7 +17149,7 @@ Defaulting to \`${$89eedd556c436f6a$var$DEFAULT_ORIENTATION}\`.`;
|
|
|
17076
17149
|
}
|
|
17077
17150
|
)
|
|
17078
17151
|
},
|
|
17079
|
-
option
|
|
17152
|
+
option
|
|
17080
17153
|
)),
|
|
17081
17154
|
droppableProvided.placeholder
|
|
17082
17155
|
] }) })
|
|
@@ -18744,6 +18817,44 @@ Defaulting to \`${$89eedd556c436f6a$var$DEFAULT_ORIENTATION}\`.`;
|
|
|
18744
18817
|
meta: { readonly }
|
|
18745
18818
|
};
|
|
18746
18819
|
}
|
|
18820
|
+
function flattenFields(schema) {
|
|
18821
|
+
const allFields = [];
|
|
18822
|
+
for (const field of schema.fields) {
|
|
18823
|
+
if (field instanceof FieldSection) {
|
|
18824
|
+
for (const subField of field.fields) {
|
|
18825
|
+
allFields.push(subField);
|
|
18826
|
+
}
|
|
18827
|
+
} else {
|
|
18828
|
+
if (!(field instanceof BaseField)) {
|
|
18829
|
+
throw new Error(`Invalid field type: ${field.type}`);
|
|
18830
|
+
}
|
|
18831
|
+
allFields.push(field);
|
|
18832
|
+
}
|
|
18833
|
+
}
|
|
18834
|
+
return allFields;
|
|
18835
|
+
}
|
|
18836
|
+
function decodeFormValues(schema, values) {
|
|
18837
|
+
const allFields = flattenFields(schema);
|
|
18838
|
+
const result = {};
|
|
18839
|
+
for (const field of allFields) {
|
|
18840
|
+
const value = values[field.identifier] ?? null;
|
|
18841
|
+
if (value !== null) {
|
|
18842
|
+
result[field.identifier] = field.decodeJsonToValue(value);
|
|
18843
|
+
} else {
|
|
18844
|
+
result[field.identifier] = value;
|
|
18845
|
+
}
|
|
18846
|
+
}
|
|
18847
|
+
return result;
|
|
18848
|
+
}
|
|
18849
|
+
function encodeFormValues(schema, values) {
|
|
18850
|
+
const allFields = flattenFields(schema);
|
|
18851
|
+
const result = {};
|
|
18852
|
+
for (const field of allFields) {
|
|
18853
|
+
const value = values[field.identifier];
|
|
18854
|
+
result[field.identifier] = field.encodeValueToJson(value);
|
|
18855
|
+
}
|
|
18856
|
+
return result;
|
|
18857
|
+
}
|
|
18747
18858
|
function valueIsFile(v) {
|
|
18748
18859
|
return Array.isArray(v) && v.some((v2) => v2 instanceof File || v2 instanceof Promise);
|
|
18749
18860
|
}
|
|
@@ -20423,6 +20534,7 @@ Defaulting to \`${$89eedd556c436f6a$var$DEFAULT_ORIENTATION}\`.`;
|
|
|
20423
20534
|
StringInput,
|
|
20424
20535
|
TextField,
|
|
20425
20536
|
TextInput,
|
|
20537
|
+
decodeFormValues,
|
|
20426
20538
|
deserialize,
|
|
20427
20539
|
deserializeField,
|
|
20428
20540
|
emptyBaseField,
|
|
@@ -20435,11 +20547,15 @@ Defaulting to \`${$89eedd556c436f6a$var$DEFAULT_ORIENTATION}\`.`;
|
|
|
20435
20547
|
emptySelectField,
|
|
20436
20548
|
emptyStringField,
|
|
20437
20549
|
emptyTextField,
|
|
20550
|
+
encodeFormValues,
|
|
20551
|
+
flattenFields,
|
|
20438
20552
|
formRevisionToSchema,
|
|
20553
|
+
initialFormValues,
|
|
20439
20554
|
isConditionMet,
|
|
20440
20555
|
useFieldInput,
|
|
20441
20556
|
useFieldInputs,
|
|
20442
20557
|
useFormikInput,
|
|
20558
|
+
validateForm,
|
|
20443
20559
|
valueIsFile
|
|
20444
20560
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
20445
20561
|
exports2.APIError = APIError;
|
|
@@ -20630,6 +20746,7 @@ Defaulting to \`${$89eedd556c436f6a$var$DEFAULT_ORIENTATION}\`.`;
|
|
|
20630
20746
|
exports2.coordinatesToUrlText = coordinatesToUrlText;
|
|
20631
20747
|
exports2.createOfflineAction = createOfflineAction;
|
|
20632
20748
|
exports2.createPointMarker = createPointMarker;
|
|
20749
|
+
exports2.decodeFormValues = decodeFormValues;
|
|
20633
20750
|
exports2.defaultBadgeColor = defaultBadgeColor;
|
|
20634
20751
|
exports2.deleteAssetType = deleteAssetType;
|
|
20635
20752
|
exports2.deleteForm = deleteForm;
|
|
@@ -20664,6 +20781,7 @@ Defaulting to \`${$89eedd556c436f6a$var$DEFAULT_ORIENTATION}\`.`;
|
|
|
20664
20781
|
exports2.emptySelectField = emptySelectField;
|
|
20665
20782
|
exports2.emptyStringField = emptyStringField;
|
|
20666
20783
|
exports2.emptyTextField = emptyTextField;
|
|
20784
|
+
exports2.encodeFormValues = encodeFormValues;
|
|
20667
20785
|
exports2.enqueue = enqueue;
|
|
20668
20786
|
exports2.enqueueRequest = enqueueRequest;
|
|
20669
20787
|
exports2.errorColor = errorColor;
|
|
@@ -20671,6 +20789,7 @@ Defaulting to \`${$89eedd556c436f6a$var$DEFAULT_ORIENTATION}\`.`;
|
|
|
20671
20789
|
exports2.fileReducer = fileReducer;
|
|
20672
20790
|
exports2.fileSlice = fileSlice;
|
|
20673
20791
|
exports2.fileToBlob = fileToBlob;
|
|
20792
|
+
exports2.flattenFields = flattenFields;
|
|
20674
20793
|
exports2.flipCoordinates = flipCoordinates;
|
|
20675
20794
|
exports2.formReducer = formReducer;
|
|
20676
20795
|
exports2.formRevisionReducer = formRevisionReducer;
|
|
@@ -20694,6 +20813,7 @@ Defaulting to \`${$89eedd556c436f6a$var$DEFAULT_ORIENTATION}\`.`;
|
|
|
20694
20813
|
exports2.hashFile = hashFile;
|
|
20695
20814
|
exports2.hideAllCategories = hideAllCategories;
|
|
20696
20815
|
exports2.hideCategory = hideCategory;
|
|
20816
|
+
exports2.initialFormValues = initialFormValues;
|
|
20697
20817
|
exports2.isConditionMet = isConditionMet;
|
|
20698
20818
|
exports2.isToday = isToday;
|
|
20699
20819
|
exports2.issueReducer = issueReducer;
|
|
@@ -20747,6 +20867,7 @@ Defaulting to \`${$89eedd556c436f6a$var$DEFAULT_ORIENTATION}\`.`;
|
|
|
20747
20867
|
exports2.removeAssetAttachments = removeAssetAttachments;
|
|
20748
20868
|
exports2.removeAssetTypeAttachment = removeAssetTypeAttachment;
|
|
20749
20869
|
exports2.removeAssetTypeAttachments = removeAssetTypeAttachments;
|
|
20870
|
+
exports2.removeAssets = removeAssets;
|
|
20750
20871
|
exports2.removeAttachmentsOfIssue = removeAttachmentsOfIssue;
|
|
20751
20872
|
exports2.removeCategory = removeCategory;
|
|
20752
20873
|
exports2.removeColor = removeColor;
|
|
@@ -21066,6 +21187,7 @@ Defaulting to \`${$89eedd556c436f6a$var$DEFAULT_ORIENTATION}\`.`;
|
|
|
21066
21187
|
exports2.updateAssetAttachments = updateAssetAttachments;
|
|
21067
21188
|
exports2.updateAssetTypeAttachment = updateAssetTypeAttachment;
|
|
21068
21189
|
exports2.updateAssetTypeAttachments = updateAssetTypeAttachments;
|
|
21190
|
+
exports2.updateAssets = updateAssets;
|
|
21069
21191
|
exports2.updateConversation = updateConversation;
|
|
21070
21192
|
exports2.updateDocumentAttachment = updateDocumentAttachment;
|
|
21071
21193
|
exports2.updateDocumentAttachments = updateDocumentAttachments;
|
|
@@ -21094,6 +21216,7 @@ Defaulting to \`${$89eedd556c436f6a$var$DEFAULT_ORIENTATION}\`.`;
|
|
|
21094
21216
|
exports2.useSDK = useSDK;
|
|
21095
21217
|
exports2.userReducer = userReducer;
|
|
21096
21218
|
exports2.userSlice = userSlice;
|
|
21219
|
+
exports2.validateForm = validateForm;
|
|
21097
21220
|
exports2.valueIsFile = valueIsFile;
|
|
21098
21221
|
exports2.warningColor = warningColor;
|
|
21099
21222
|
exports2.workspaceReducer = workspaceReducer;
|