@whaly/connector-sdk 0.3.12 → 0.3.13

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/index.mjs CHANGED
@@ -11195,6 +11195,20 @@ var Tap = class {
11195
11195
 
11196
11196
  // src/sdk/models/tap/stream.ts
11197
11197
  import { format as format3 } from "util";
11198
+ var DEFAULT_PROGRESS_LOG_PERCENT_STEP = 10;
11199
+ var DEFAULT_PROGRESS_LOG_FALLBACK_INTERVAL = 1e5;
11200
+ function getProgressLogPercentStep() {
11201
+ const raw = optionalEnv("PROGRESS_LOG_PERCENT_STEP", String(DEFAULT_PROGRESS_LOG_PERCENT_STEP));
11202
+ const n = parseInt(raw, 10);
11203
+ if (isNaN(n) || n <= 0) return DEFAULT_PROGRESS_LOG_PERCENT_STEP;
11204
+ return Math.min(n, 100);
11205
+ }
11206
+ function getProgressLogFallbackInterval() {
11207
+ const raw = optionalEnv("PROGRESS_LOG_FALLBACK_INTERVAL", String(DEFAULT_PROGRESS_LOG_FALLBACK_INTERVAL));
11208
+ const n = parseInt(raw, 10);
11209
+ if (isNaN(n) || n <= 0) return DEFAULT_PROGRESS_LOG_FALLBACK_INTERVAL;
11210
+ return n;
11211
+ }
11198
11212
  var Stream = class {
11199
11213
  // Runtime values, can't be overriden
11200
11214
  config;
@@ -11457,6 +11471,9 @@ var Stream = class {
11457
11471
  // Private sync methods:
11458
11472
  async _syncRecords(parent) {
11459
11473
  let rowsSent = 0;
11474
+ let lastLoggedPercent = 0;
11475
+ const progressPercentStep = getProgressLogPercentStep();
11476
+ const progressFallbackInterval = getProgressLogFallbackInterval();
11460
11477
  const dryRunLimit = isDryRun() ? getDryRunLimit() : void 0;
11461
11478
  let recordSyncedMetrics = [];
11462
11479
  if (this.rowsSyncedMetricsConf.isEnabled() === true) {
@@ -11503,9 +11520,14 @@ var Stream = class {
11503
11520
  logger.info(`\u{1F6D1} Stream: ${this.streamId} - DRY_RUN_LIMIT reached (${dryRunLimit} records), stopping.`);
11504
11521
  break;
11505
11522
  }
11506
- if (rowsSent % 1e3 === 0) {
11507
- const percentStr = this.totalRows ? ` (${Math.round(rowsSent / this.totalRows * 100)}%)` : "";
11508
- logger.info(`\u23F3 Stream: ${this.streamId} - ${rowsSent} records synced so far...${percentStr}`);
11523
+ if (this.totalRows) {
11524
+ const percent = Math.floor(rowsSent / this.totalRows * 100);
11525
+ if (percent >= lastLoggedPercent + progressPercentStep) {
11526
+ lastLoggedPercent = percent - percent % progressPercentStep;
11527
+ logger.info(`\u23F3 Stream: ${this.streamId} - ${rowsSent} records synced so far... (${percent}%)`);
11528
+ }
11529
+ } else if (rowsSent % progressFallbackInterval === 0) {
11530
+ logger.info(`\u23F3 Stream: ${this.streamId} - ${rowsSent} records synced so far...`);
11509
11531
  }
11510
11532
  }
11511
11533
  const stateServiceInst = StateService.getInstance();