@peopl-health/nexus 5.78.0-dev.16670 → 5.78.0-dev.16671

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.
@@ -138,6 +138,8 @@ const ARCHIVE_DELETE_ORDER = Object.freeze([
138
138
  ARCHIVE_TABLES.RESOLUTIONS, ARCHIVE_TABLES.ADDITIONAL_ANSWERS, ARCHIVE_TABLES.SYMPTOMS,
139
139
  ]);
140
140
  const ARCHIVE_DELETE_SPACING_MS = 250;
141
+ // Airtable deletes at most 10 records per request.
142
+ const ARCHIVE_DELETE_CHUNK_SIZE = 10;
141
143
  // The patients table: a mirrored record's patient is its link to it and the WhatsApp id looked up through that link.
142
144
  const PATIENT_TABLE = Object.freeze({ ID: 'tblUi9KbsefAbrvK2', WHATSAPP: 'fldMfzbVbAxIJ9345' });
143
145
  // Attachments re-hosted per mirror run; the rest wait for the next run, so the first runs over a full base stay bounded.
@@ -157,6 +159,7 @@ module.exports = {
157
159
  ARCHIVE_DELETE_MAX_GROUPS,
158
160
  ARCHIVE_DELETE_ORDER,
159
161
  ARCHIVE_DELETE_SPACING_MS,
162
+ ARCHIVE_DELETE_CHUNK_SIZE,
160
163
  PATIENT_TABLE,
161
164
  MIRROR_MAX_ATTACHMENTS_PER_RUN,
162
165
  MIRROR_GONE_MAX_SHARE,
@@ -5,7 +5,7 @@ const runtimeConfig = require('../config/runtimeConfig');
5
5
  const { uploadBufferToS3 } = require('../config/awsConfig');
6
6
  const {
7
7
  ARCHIVE_TABLES, MIN_ARCHIVE_AGE_DAYS, ARCHIVE_BATCH_SIZE, ARCHIVE_LEASE_MS, ARCHIVE_LEASE_RENEW_MS, ATTACHMENT_DOWNLOAD_TIMEOUT_MS, PATIENT_FIELDS, PLANNER_FIELDS,
8
- ARCHIVE_DELETE_MAX_GROUPS, ARCHIVE_DELETE_ORDER, ARCHIVE_DELETE_SPACING_MS, LINK_FIELD_TYPES,
8
+ ARCHIVE_DELETE_MAX_GROUPS, ARCHIVE_DELETE_ORDER, ARCHIVE_DELETE_SPACING_MS, ARCHIVE_DELETE_CHUNK_SIZE, LINK_FIELD_TYPES,
9
9
  } = require('../config/airtableArchiveConfig');
10
10
  const { logger } = require('../utils/logger');
11
11
  const { stableStringify } = require('../utils/jsonUtils');
@@ -430,8 +430,8 @@ async function deleteBatch({ baseId, runId, batch, schema, counts, groups, lease
430
430
 
431
431
  for (const tableId of ARCHIVE_DELETE_ORDER) {
432
432
  const entries = verified.filter(({ table }) => schema.tableIds[table] === tableId);
433
- for (let i = 0; i < entries.length; i += 10) {
434
- const chunk = entries.slice(i, i + 10);
433
+ for (let i = 0; i < entries.length; i += ARCHIVE_DELETE_CHUNK_SIZE) {
434
+ const chunk = entries.slice(i, i + ARCHIVE_DELETE_CHUNK_SIZE);
435
435
  // Re-checked right before its request, so an edit made while earlier chunks were deleted stops the run with its copy stamped.
436
436
  const changed = await findBlockers({ baseId, entries: chunk, schema, lease, liveIds, cutoff, models });
437
437
  if (changed.length) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@peopl-health/nexus",
3
- "version": "5.78.0-dev.16670",
3
+ "version": "5.78.0-dev.16671",
4
4
  "description": "Core messaging and assistant library for WhatsApp communication platforms",
5
5
  "keywords": [
6
6
  "whatsapp",