@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.js CHANGED
@@ -11317,6 +11317,20 @@ var Tap = class {
11317
11317
 
11318
11318
  // src/sdk/models/tap/stream.ts
11319
11319
  var import_util2 = require("util");
11320
+ var DEFAULT_PROGRESS_LOG_PERCENT_STEP = 10;
11321
+ var DEFAULT_PROGRESS_LOG_FALLBACK_INTERVAL = 1e5;
11322
+ function getProgressLogPercentStep() {
11323
+ const raw = optionalEnv("PROGRESS_LOG_PERCENT_STEP", String(DEFAULT_PROGRESS_LOG_PERCENT_STEP));
11324
+ const n = parseInt(raw, 10);
11325
+ if (isNaN(n) || n <= 0) return DEFAULT_PROGRESS_LOG_PERCENT_STEP;
11326
+ return Math.min(n, 100);
11327
+ }
11328
+ function getProgressLogFallbackInterval() {
11329
+ const raw = optionalEnv("PROGRESS_LOG_FALLBACK_INTERVAL", String(DEFAULT_PROGRESS_LOG_FALLBACK_INTERVAL));
11330
+ const n = parseInt(raw, 10);
11331
+ if (isNaN(n) || n <= 0) return DEFAULT_PROGRESS_LOG_FALLBACK_INTERVAL;
11332
+ return n;
11333
+ }
11320
11334
  var Stream = class {
11321
11335
  // Runtime values, can't be overriden
11322
11336
  config;
@@ -11579,6 +11593,9 @@ var Stream = class {
11579
11593
  // Private sync methods:
11580
11594
  async _syncRecords(parent) {
11581
11595
  let rowsSent = 0;
11596
+ let lastLoggedPercent = 0;
11597
+ const progressPercentStep = getProgressLogPercentStep();
11598
+ const progressFallbackInterval = getProgressLogFallbackInterval();
11582
11599
  const dryRunLimit = isDryRun() ? getDryRunLimit() : void 0;
11583
11600
  let recordSyncedMetrics = [];
11584
11601
  if (this.rowsSyncedMetricsConf.isEnabled() === true) {
@@ -11625,9 +11642,14 @@ var Stream = class {
11625
11642
  logger.info(`\u{1F6D1} Stream: ${this.streamId} - DRY_RUN_LIMIT reached (${dryRunLimit} records), stopping.`);
11626
11643
  break;
11627
11644
  }
11628
- if (rowsSent % 1e3 === 0) {
11629
- const percentStr = this.totalRows ? ` (${Math.round(rowsSent / this.totalRows * 100)}%)` : "";
11630
- logger.info(`\u23F3 Stream: ${this.streamId} - ${rowsSent} records synced so far...${percentStr}`);
11645
+ if (this.totalRows) {
11646
+ const percent = Math.floor(rowsSent / this.totalRows * 100);
11647
+ if (percent >= lastLoggedPercent + progressPercentStep) {
11648
+ lastLoggedPercent = percent - percent % progressPercentStep;
11649
+ logger.info(`\u23F3 Stream: ${this.streamId} - ${rowsSent} records synced so far... (${percent}%)`);
11650
+ }
11651
+ } else if (rowsSent % progressFallbackInterval === 0) {
11652
+ logger.info(`\u23F3 Stream: ${this.streamId} - ${rowsSent} records synced so far...`);
11631
11653
  }
11632
11654
  }
11633
11655
  const stateServiceInst = StateService.getInstance();