@overmap-ai/core 1.0.58-asset-description.9 → 1.0.58-asset-description.10
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 +16 -20
- package/dist/overmap-core.js.map +1 -1
- package/dist/overmap-core.umd.cjs +16 -20
- package/dist/overmap-core.umd.cjs.map +1 -1
- package/dist/sdk/services/AssetService.d.ts +1 -1
- package/dist/sdk/services/UserFormSubmissionService.d.ts +1 -1
- package/package.json +1 -1
package/dist/overmap-core.js
CHANGED
|
@@ -5409,7 +5409,6 @@ function chunkArray(arr, chunkSize) {
|
|
|
5409
5409
|
}
|
|
5410
5410
|
return chunks;
|
|
5411
5411
|
}
|
|
5412
|
-
const BULK_ADD_ASSET_BATCH_SIZE = 1e3;
|
|
5413
5412
|
class AssetService extends BaseApiService {
|
|
5414
5413
|
// Basic CRUD functions
|
|
5415
5414
|
add(asset, workspaceId) {
|
|
@@ -5487,25 +5486,23 @@ class AssetService extends BaseApiService {
|
|
|
5487
5486
|
});
|
|
5488
5487
|
}
|
|
5489
5488
|
// TODO: payload does not require asset_type
|
|
5490
|
-
bulkAdd(assetsToCreate, workspaceId, assetTypeId) {
|
|
5489
|
+
bulkAdd(assetsToCreate, workspaceId, assetTypeId, batchSize) {
|
|
5491
5490
|
const { store } = this.client;
|
|
5492
5491
|
const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
5493
|
-
const assetBatches = chunkArray(assetsToCreate,
|
|
5494
|
-
(
|
|
5495
|
-
|
|
5496
|
-
|
|
5497
|
-
|
|
5498
|
-
submitted_at: submittedAt
|
|
5499
|
-
});
|
|
5492
|
+
const assetBatches = chunkArray(assetsToCreate, batchSize).map((assetBatch) => {
|
|
5493
|
+
const assetPayloads = assetBatch.map((assetPayload) => {
|
|
5494
|
+
return offline({
|
|
5495
|
+
...assetPayload,
|
|
5496
|
+
submitted_at: submittedAt
|
|
5500
5497
|
});
|
|
5501
|
-
|
|
5502
|
-
|
|
5503
|
-
|
|
5504
|
-
|
|
5505
|
-
|
|
5506
|
-
}
|
|
5507
|
-
}
|
|
5508
|
-
);
|
|
5498
|
+
});
|
|
5499
|
+
return {
|
|
5500
|
+
batchId: v4(),
|
|
5501
|
+
payload: {
|
|
5502
|
+
assets: assetPayloads
|
|
5503
|
+
}
|
|
5504
|
+
};
|
|
5505
|
+
});
|
|
5509
5506
|
const batchPromises = [];
|
|
5510
5507
|
let prevBatchId = null;
|
|
5511
5508
|
for (const assetBatch of assetBatches) {
|
|
@@ -7320,7 +7317,6 @@ const separateFilesFromValues = (values) => {
|
|
|
7320
7317
|
}
|
|
7321
7318
|
return { values: newValues, files };
|
|
7322
7319
|
};
|
|
7323
|
-
const MAX_BULK_ADD_SUBMISSIONS = 1e3;
|
|
7324
7320
|
class UserFormSubmissionService extends BaseApiService {
|
|
7325
7321
|
constructor() {
|
|
7326
7322
|
super(...arguments);
|
|
@@ -7401,13 +7397,13 @@ class UserFormSubmissionService extends BaseApiService {
|
|
|
7401
7397
|
}
|
|
7402
7398
|
// Note currently the bulkAdd method is specific to form submissions for assets
|
|
7403
7399
|
// TODO: adapt the support bulk adding to any model type
|
|
7404
|
-
async bulkAdd(args) {
|
|
7400
|
+
async bulkAdd(args, batchSize) {
|
|
7405
7401
|
const { store } = this.client;
|
|
7406
7402
|
const { formRevision, commonFieldValues, fieldValuesByAsset } = args;
|
|
7407
7403
|
const allFilesRecord = {};
|
|
7408
7404
|
const { values: fileSeperatedCommonFieldValues, files: commonFiles } = separateFilesFromValues(commonFieldValues);
|
|
7409
7405
|
const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
7410
|
-
const assetIdBatches = chunkArray(Object.keys(fieldValuesByAsset),
|
|
7406
|
+
const assetIdBatches = chunkArray(Object.keys(fieldValuesByAsset), batchSize);
|
|
7411
7407
|
const bulkAddBatches = await Promise.all(
|
|
7412
7408
|
assetIdBatches.map(async (assetIdBatch) => {
|
|
7413
7409
|
const batchId = v4();
|