@owox/connectors 0.11.0-next-20251029124029 → 0.11.0-next-20251029133912

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.cjs CHANGED
@@ -2843,7 +2843,7 @@ OPTIONS(description="${this.description}")`;
2843
2843
  ${rows.join("\n\nUNION ALL\n\n")}
2844
2844
  ) AS source
2845
2845
 
2846
- ON ${this.uniqueKeyColumns.map((item) => "target." + item + " = source." + item).join("\n AND ")}
2846
+ ON ${this.uniqueKeyColumns.map((item) => `(target.${item} IS NOT DISTINCT FROM source.${item})`).join("\n AND ")}
2847
2847
 
2848
2848
  WHEN MATCHED THEN
2849
2849
  UPDATE SET
@@ -10865,15 +10865,23 @@ const MicrosoftAds = (function() {
10865
10865
  const startTime = Date.now();
10866
10866
  const timeout = 15 * 60 * 1e3;
10867
10867
  let statusResult;
10868
- do {
10869
- if (Date.now() - startTime > timeout) {
10870
- throw new Error("Polling timed out after 15 minutes");
10868
+ try {
10869
+ do {
10870
+ if (Date.now() - startTime > timeout) {
10871
+ throw new Error("Polling timed out after 15 minutes");
10872
+ }
10873
+ EnvironmentAdapter3.sleep(interval);
10874
+ const response = EnvironmentAdapter3.fetch(url, options);
10875
+ statusResult = JSON.parse(response.getContentText());
10876
+ } while (!isDone(statusResult));
10877
+ return statusResult;
10878
+ } catch (error) {
10879
+ if (statusResult) {
10880
+ throw new Error(`${error.message}
10881
+ API Response: ${JSON.stringify(statusResult, null, 2)}`);
10871
10882
  }
10872
- EnvironmentAdapter3.sleep(interval);
10873
- const response = EnvironmentAdapter3.fetch(url, options);
10874
- statusResult = JSON.parse(response.getContentText());
10875
- } while (!isDone(statusResult));
10876
- return statusResult;
10883
+ throw error;
10884
+ }
10877
10885
  },
10878
10886
  /**
10879
10887
  * Download, unzip and parse CSV rows from the given URL
@@ -12179,7 +12187,12 @@ const MicrosoftAds = (function() {
12179
12187
  const pollResult = MicrosoftAdsHelper.pollUntilStatus({
12180
12188
  url: pollUrl,
12181
12189
  options: pollOpts,
12182
- isDone: (status) => status.RequestStatus === "Completed"
12190
+ isDone: (status) => {
12191
+ if (!status.RequestStatus || status.RequestStatus === "Failed") {
12192
+ throw new Error("Bulk download failed");
12193
+ }
12194
+ return status.RequestStatus === "Completed";
12195
+ }
12183
12196
  });
12184
12197
  const csvRows = MicrosoftAdsHelper.downloadCsvRows(pollResult.ResultFileUrl);
12185
12198
  const result = MicrosoftAdsHelper.csvRowsToObjects(csvRows);
@@ -12392,7 +12405,12 @@ const MicrosoftAds = (function() {
12392
12405
  return MicrosoftAdsHelper.pollUntilStatus({
12393
12406
  url: pollUrl,
12394
12407
  options: pollOpts,
12395
- isDone: (status) => status.ReportRequestStatus.Status === "Success"
12408
+ isDone: (status) => {
12409
+ if (!status.ReportRequestStatus || status.ReportRequestStatus.Status === "Error") {
12410
+ throw new Error("Report generation failed");
12411
+ }
12412
+ return status.ReportRequestStatus.Status === "Success";
12413
+ }
12396
12414
  });
12397
12415
  }
12398
12416
  };
package/dist/index.js CHANGED
@@ -2848,7 +2848,7 @@ OPTIONS(description="${this.description}")`;
2848
2848
  ${rows.join("\n\nUNION ALL\n\n")}
2849
2849
  ) AS source
2850
2850
 
2851
- ON ${this.uniqueKeyColumns.map((item) => "target." + item + " = source." + item).join("\n AND ")}
2851
+ ON ${this.uniqueKeyColumns.map((item) => `(target.${item} IS NOT DISTINCT FROM source.${item})`).join("\n AND ")}
2852
2852
 
2853
2853
  WHEN MATCHED THEN
2854
2854
  UPDATE SET
@@ -10870,15 +10870,23 @@ OPTIONS(description="${this.description}")`;
10870
10870
  const startTime = Date.now();
10871
10871
  const timeout = 15 * 60 * 1e3;
10872
10872
  let statusResult;
10873
- do {
10874
- if (Date.now() - startTime > timeout) {
10875
- throw new Error("Polling timed out after 15 minutes");
10873
+ try {
10874
+ do {
10875
+ if (Date.now() - startTime > timeout) {
10876
+ throw new Error("Polling timed out after 15 minutes");
10877
+ }
10878
+ EnvironmentAdapter2.sleep(interval);
10879
+ const response = EnvironmentAdapter2.fetch(url, options);
10880
+ statusResult = JSON.parse(response.getContentText());
10881
+ } while (!isDone(statusResult));
10882
+ return statusResult;
10883
+ } catch (error) {
10884
+ if (statusResult) {
10885
+ throw new Error(`${error.message}
10886
+ API Response: ${JSON.stringify(statusResult, null, 2)}`);
10876
10887
  }
10877
- EnvironmentAdapter2.sleep(interval);
10878
- const response = EnvironmentAdapter2.fetch(url, options);
10879
- statusResult = JSON.parse(response.getContentText());
10880
- } while (!isDone(statusResult));
10881
- return statusResult;
10888
+ throw error;
10889
+ }
10882
10890
  },
10883
10891
  /**
10884
10892
  * Download, unzip and parse CSV rows from the given URL
@@ -12184,7 +12192,12 @@ OPTIONS(description="${this.description}")`;
12184
12192
  const pollResult = MicrosoftAdsHelper.pollUntilStatus({
12185
12193
  url: pollUrl,
12186
12194
  options: pollOpts,
12187
- isDone: (status) => status.RequestStatus === "Completed"
12195
+ isDone: (status) => {
12196
+ if (!status.RequestStatus || status.RequestStatus === "Failed") {
12197
+ throw new Error("Bulk download failed");
12198
+ }
12199
+ return status.RequestStatus === "Completed";
12200
+ }
12188
12201
  });
12189
12202
  const csvRows = MicrosoftAdsHelper.downloadCsvRows(pollResult.ResultFileUrl);
12190
12203
  const result = MicrosoftAdsHelper.csvRowsToObjects(csvRows);
@@ -12397,7 +12410,12 @@ OPTIONS(description="${this.description}")`;
12397
12410
  return MicrosoftAdsHelper.pollUntilStatus({
12398
12411
  url: pollUrl,
12399
12412
  options: pollOpts,
12400
- isDone: (status) => status.ReportRequestStatus.Status === "Success"
12413
+ isDone: (status) => {
12414
+ if (!status.ReportRequestStatus || status.ReportRequestStatus.Status === "Error") {
12415
+ throw new Error("Report generation failed");
12416
+ }
12417
+ return status.ReportRequestStatus.Status === "Success";
12418
+ }
12401
12419
  });
12402
12420
  }
12403
12421
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@owox/connectors",
3
- "version": "0.11.0-next-20251029124029",
3
+ "version": "0.11.0-next-20251029133912",
4
4
  "description": "Connectors and storages for different data sources",
5
5
  "license": "MIT",
6
6
  "publishConfig": {