@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.
@@ -5399,7 +5399,6 @@ var __publicField = (obj, key, value) => {
5399
5399
  }
5400
5400
  return chunks;
5401
5401
  }
5402
- const BULK_ADD_ASSET_BATCH_SIZE = 1e3;
5403
5402
  class AssetService extends BaseApiService {
5404
5403
  // Basic CRUD functions
5405
5404
  add(asset, workspaceId) {
@@ -5477,25 +5476,23 @@ var __publicField = (obj, key, value) => {
5477
5476
  });
5478
5477
  }
5479
5478
  // TODO: payload does not require asset_type
5480
- bulkAdd(assetsToCreate, workspaceId, assetTypeId) {
5479
+ bulkAdd(assetsToCreate, workspaceId, assetTypeId, batchSize) {
5481
5480
  const { store } = this.client;
5482
5481
  const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
5483
- const assetBatches = chunkArray(assetsToCreate, BULK_ADD_ASSET_BATCH_SIZE).map(
5484
- (assetBatch) => {
5485
- const assetPayloads = assetBatch.map((assetPayload) => {
5486
- return offline({
5487
- ...assetPayload,
5488
- submitted_at: submittedAt
5489
- });
5482
+ const assetBatches = chunkArray(assetsToCreate, batchSize).map((assetBatch) => {
5483
+ const assetPayloads = assetBatch.map((assetPayload) => {
5484
+ return offline({
5485
+ ...assetPayload,
5486
+ submitted_at: submittedAt
5490
5487
  });
5491
- return {
5492
- batchId: uuid.v4(),
5493
- payload: {
5494
- assets: assetPayloads
5495
- }
5496
- };
5497
- }
5498
- );
5488
+ });
5489
+ return {
5490
+ batchId: uuid.v4(),
5491
+ payload: {
5492
+ assets: assetPayloads
5493
+ }
5494
+ };
5495
+ });
5499
5496
  const batchPromises = [];
5500
5497
  let prevBatchId = null;
5501
5498
  for (const assetBatch of assetBatches) {
@@ -7310,7 +7307,6 @@ var __publicField = (obj, key, value) => {
7310
7307
  }
7311
7308
  return { values: newValues, files };
7312
7309
  };
7313
- const MAX_BULK_ADD_SUBMISSIONS = 1e3;
7314
7310
  class UserFormSubmissionService extends BaseApiService {
7315
7311
  constructor() {
7316
7312
  super(...arguments);
@@ -7391,13 +7387,13 @@ var __publicField = (obj, key, value) => {
7391
7387
  }
7392
7388
  // Note currently the bulkAdd method is specific to form submissions for assets
7393
7389
  // TODO: adapt the support bulk adding to any model type
7394
- async bulkAdd(args) {
7390
+ async bulkAdd(args, batchSize) {
7395
7391
  const { store } = this.client;
7396
7392
  const { formRevision, commonFieldValues, fieldValuesByAsset } = args;
7397
7393
  const allFilesRecord = {};
7398
7394
  const { values: fileSeperatedCommonFieldValues, files: commonFiles } = separateFilesFromValues(commonFieldValues);
7399
7395
  const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
7400
- const assetIdBatches = chunkArray(Object.keys(fieldValuesByAsset), MAX_BULK_ADD_SUBMISSIONS);
7396
+ const assetIdBatches = chunkArray(Object.keys(fieldValuesByAsset), batchSize);
7401
7397
  const bulkAddBatches = await Promise.all(
7402
7398
  assetIdBatches.map(async (assetIdBatch) => {
7403
7399
  const batchId = uuid.v4();