@signaliz/sdk 1.0.42 → 1.0.43
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/{chunk-B4OMGBD5.mjs → chunk-HQS7N57T.mjs} +36 -1
- package/dist/index.js +36 -1
- package/dist/index.mjs +1 -1
- package/dist/mcp-config.js +36 -1
- package/dist/mcp-config.mjs +1 -1
- package/package.json +1 -1
|
@@ -358,6 +358,7 @@ function mapErrorTypeFromCode(code) {
|
|
|
358
358
|
}
|
|
359
359
|
|
|
360
360
|
// src/index.ts
|
|
361
|
+
var MAX_ROW_RATE_LIMIT_RETRIES = 2;
|
|
361
362
|
var Signaliz = class {
|
|
362
363
|
constructor(config) {
|
|
363
364
|
this.client = new HttpClient(config);
|
|
@@ -753,7 +754,7 @@ var Signaliz = class {
|
|
|
753
754
|
}
|
|
754
755
|
return results;
|
|
755
756
|
}
|
|
756
|
-
async runCoreBatchRound(path, tasks, options, companyRecoverableBatch) {
|
|
757
|
+
async runCoreBatchRound(path, tasks, options, companyRecoverableBatch, rowRateLimitAttempt = 0) {
|
|
757
758
|
const { serverConcurrency, chunkConcurrency } = batchConcurrencyPlan(options);
|
|
758
759
|
const deduplicated = dedupeExactBatchItems(tasks, (task) => JSON.stringify(task.request));
|
|
759
760
|
const uniqueTasks = deduplicated.uniqueItems;
|
|
@@ -818,6 +819,25 @@ var Signaliz = class {
|
|
|
818
819
|
};
|
|
819
820
|
}
|
|
820
821
|
}
|
|
822
|
+
if (rowRateLimitAttempt < MAX_ROW_RATE_LIMIT_RETRIES) {
|
|
823
|
+
const retryTasks = uniqueTasks.filter((_, index) => isRetryableRowRateLimit(uniqueResults[index]));
|
|
824
|
+
if (retryTasks.length > 0) {
|
|
825
|
+
const retryItems = uniqueResults.filter(isRetryableRowRateLimit);
|
|
826
|
+
await sleep2(rowRateLimitDelayMs(retryItems));
|
|
827
|
+
const retried = await this.runCoreBatchRound(
|
|
828
|
+
path,
|
|
829
|
+
retryTasks,
|
|
830
|
+
options,
|
|
831
|
+
void 0,
|
|
832
|
+
rowRateLimitAttempt + 1
|
|
833
|
+
);
|
|
834
|
+
const retriedByIndex = new Map(retried.map((item) => [item.index, item]));
|
|
835
|
+
for (let index = 0; index < uniqueResults.length; index += 1) {
|
|
836
|
+
const replacement = retriedByIndex.get(uniqueResults[index].index);
|
|
837
|
+
if (replacement) uniqueResults[index] = replacement;
|
|
838
|
+
}
|
|
839
|
+
}
|
|
840
|
+
}
|
|
821
841
|
return tasks.map((task, index) => ({
|
|
822
842
|
...uniqueResults[deduplicated.sourceIndexByInput[index]],
|
|
823
843
|
index: task.index
|
|
@@ -835,6 +855,21 @@ var Signaliz = class {
|
|
|
835
855
|
};
|
|
836
856
|
}
|
|
837
857
|
};
|
|
858
|
+
function isRetryableRowRateLimit(item) {
|
|
859
|
+
if (!item || item.success || !item.raw || item.raw.retry_eligible === false) return false;
|
|
860
|
+
const code = String(item.raw.error_code || item.raw.code || "").trim().toUpperCase();
|
|
861
|
+
return code === "RATE_LIMITED" || /^RATE_\d+$/.test(code);
|
|
862
|
+
}
|
|
863
|
+
function rowRateLimitDelayMs(items) {
|
|
864
|
+
const delays = items.map((item) => {
|
|
865
|
+
const retryAfterMs = Number(item.raw?.retry_after_ms);
|
|
866
|
+
if (Number.isFinite(retryAfterMs) && retryAfterMs > 0) return retryAfterMs;
|
|
867
|
+
const retryAfterSeconds = Number(item.raw?.retry_after_seconds ?? item.raw?.retry_after);
|
|
868
|
+
if (Number.isFinite(retryAfterSeconds) && retryAfterSeconds > 0) return retryAfterSeconds * 1e3;
|
|
869
|
+
return 6e4;
|
|
870
|
+
});
|
|
871
|
+
return Math.max(1, Math.min(6e4, Math.max(...delays)));
|
|
872
|
+
}
|
|
838
873
|
function recoverableJobRowFailed(row) {
|
|
839
874
|
return row.success === false || ["failed", "skipped"].includes(String(row._status || "").toLowerCase());
|
|
840
875
|
}
|
package/dist/index.js
CHANGED
|
@@ -385,6 +385,7 @@ function mapErrorTypeFromCode(code) {
|
|
|
385
385
|
}
|
|
386
386
|
|
|
387
387
|
// src/index.ts
|
|
388
|
+
var MAX_ROW_RATE_LIMIT_RETRIES = 2;
|
|
388
389
|
var Signaliz = class {
|
|
389
390
|
constructor(config) {
|
|
390
391
|
this.client = new HttpClient(config);
|
|
@@ -780,7 +781,7 @@ var Signaliz = class {
|
|
|
780
781
|
}
|
|
781
782
|
return results;
|
|
782
783
|
}
|
|
783
|
-
async runCoreBatchRound(path, tasks, options, companyRecoverableBatch) {
|
|
784
|
+
async runCoreBatchRound(path, tasks, options, companyRecoverableBatch, rowRateLimitAttempt = 0) {
|
|
784
785
|
const { serverConcurrency, chunkConcurrency } = batchConcurrencyPlan(options);
|
|
785
786
|
const deduplicated = dedupeExactBatchItems(tasks, (task) => JSON.stringify(task.request));
|
|
786
787
|
const uniqueTasks = deduplicated.uniqueItems;
|
|
@@ -845,6 +846,25 @@ var Signaliz = class {
|
|
|
845
846
|
};
|
|
846
847
|
}
|
|
847
848
|
}
|
|
849
|
+
if (rowRateLimitAttempt < MAX_ROW_RATE_LIMIT_RETRIES) {
|
|
850
|
+
const retryTasks = uniqueTasks.filter((_, index) => isRetryableRowRateLimit(uniqueResults[index]));
|
|
851
|
+
if (retryTasks.length > 0) {
|
|
852
|
+
const retryItems = uniqueResults.filter(isRetryableRowRateLimit);
|
|
853
|
+
await sleep2(rowRateLimitDelayMs(retryItems));
|
|
854
|
+
const retried = await this.runCoreBatchRound(
|
|
855
|
+
path,
|
|
856
|
+
retryTasks,
|
|
857
|
+
options,
|
|
858
|
+
void 0,
|
|
859
|
+
rowRateLimitAttempt + 1
|
|
860
|
+
);
|
|
861
|
+
const retriedByIndex = new Map(retried.map((item) => [item.index, item]));
|
|
862
|
+
for (let index = 0; index < uniqueResults.length; index += 1) {
|
|
863
|
+
const replacement = retriedByIndex.get(uniqueResults[index].index);
|
|
864
|
+
if (replacement) uniqueResults[index] = replacement;
|
|
865
|
+
}
|
|
866
|
+
}
|
|
867
|
+
}
|
|
848
868
|
return tasks.map((task, index) => ({
|
|
849
869
|
...uniqueResults[deduplicated.sourceIndexByInput[index]],
|
|
850
870
|
index: task.index
|
|
@@ -862,6 +882,21 @@ var Signaliz = class {
|
|
|
862
882
|
};
|
|
863
883
|
}
|
|
864
884
|
};
|
|
885
|
+
function isRetryableRowRateLimit(item) {
|
|
886
|
+
if (!item || item.success || !item.raw || item.raw.retry_eligible === false) return false;
|
|
887
|
+
const code = String(item.raw.error_code || item.raw.code || "").trim().toUpperCase();
|
|
888
|
+
return code === "RATE_LIMITED" || /^RATE_\d+$/.test(code);
|
|
889
|
+
}
|
|
890
|
+
function rowRateLimitDelayMs(items) {
|
|
891
|
+
const delays = items.map((item) => {
|
|
892
|
+
const retryAfterMs = Number(item.raw?.retry_after_ms);
|
|
893
|
+
if (Number.isFinite(retryAfterMs) && retryAfterMs > 0) return retryAfterMs;
|
|
894
|
+
const retryAfterSeconds = Number(item.raw?.retry_after_seconds ?? item.raw?.retry_after);
|
|
895
|
+
if (Number.isFinite(retryAfterSeconds) && retryAfterSeconds > 0) return retryAfterSeconds * 1e3;
|
|
896
|
+
return 6e4;
|
|
897
|
+
});
|
|
898
|
+
return Math.max(1, Math.min(6e4, Math.max(...delays)));
|
|
899
|
+
}
|
|
865
900
|
function recoverableJobRowFailed(row) {
|
|
866
901
|
return row.success === false || ["failed", "skipped"].includes(String(row._status || "").toLowerCase());
|
|
867
902
|
}
|
package/dist/index.mjs
CHANGED
package/dist/mcp-config.js
CHANGED
|
@@ -389,6 +389,7 @@ function mapErrorTypeFromCode(code) {
|
|
|
389
389
|
}
|
|
390
390
|
|
|
391
391
|
// src/index.ts
|
|
392
|
+
var MAX_ROW_RATE_LIMIT_RETRIES = 2;
|
|
392
393
|
var Signaliz = class {
|
|
393
394
|
constructor(config) {
|
|
394
395
|
this.client = new HttpClient(config);
|
|
@@ -784,7 +785,7 @@ var Signaliz = class {
|
|
|
784
785
|
}
|
|
785
786
|
return results;
|
|
786
787
|
}
|
|
787
|
-
async runCoreBatchRound(path2, tasks, options, companyRecoverableBatch) {
|
|
788
|
+
async runCoreBatchRound(path2, tasks, options, companyRecoverableBatch, rowRateLimitAttempt = 0) {
|
|
788
789
|
const { serverConcurrency, chunkConcurrency } = batchConcurrencyPlan(options);
|
|
789
790
|
const deduplicated = dedupeExactBatchItems(tasks, (task) => JSON.stringify(task.request));
|
|
790
791
|
const uniqueTasks = deduplicated.uniqueItems;
|
|
@@ -849,6 +850,25 @@ var Signaliz = class {
|
|
|
849
850
|
};
|
|
850
851
|
}
|
|
851
852
|
}
|
|
853
|
+
if (rowRateLimitAttempt < MAX_ROW_RATE_LIMIT_RETRIES) {
|
|
854
|
+
const retryTasks = uniqueTasks.filter((_, index) => isRetryableRowRateLimit(uniqueResults[index]));
|
|
855
|
+
if (retryTasks.length > 0) {
|
|
856
|
+
const retryItems = uniqueResults.filter(isRetryableRowRateLimit);
|
|
857
|
+
await sleep2(rowRateLimitDelayMs(retryItems));
|
|
858
|
+
const retried = await this.runCoreBatchRound(
|
|
859
|
+
path2,
|
|
860
|
+
retryTasks,
|
|
861
|
+
options,
|
|
862
|
+
void 0,
|
|
863
|
+
rowRateLimitAttempt + 1
|
|
864
|
+
);
|
|
865
|
+
const retriedByIndex = new Map(retried.map((item) => [item.index, item]));
|
|
866
|
+
for (let index = 0; index < uniqueResults.length; index += 1) {
|
|
867
|
+
const replacement = retriedByIndex.get(uniqueResults[index].index);
|
|
868
|
+
if (replacement) uniqueResults[index] = replacement;
|
|
869
|
+
}
|
|
870
|
+
}
|
|
871
|
+
}
|
|
852
872
|
return tasks.map((task, index) => ({
|
|
853
873
|
...uniqueResults[deduplicated.sourceIndexByInput[index]],
|
|
854
874
|
index: task.index
|
|
@@ -866,6 +886,21 @@ var Signaliz = class {
|
|
|
866
886
|
};
|
|
867
887
|
}
|
|
868
888
|
};
|
|
889
|
+
function isRetryableRowRateLimit(item) {
|
|
890
|
+
if (!item || item.success || !item.raw || item.raw.retry_eligible === false) return false;
|
|
891
|
+
const code = String(item.raw.error_code || item.raw.code || "").trim().toUpperCase();
|
|
892
|
+
return code === "RATE_LIMITED" || /^RATE_\d+$/.test(code);
|
|
893
|
+
}
|
|
894
|
+
function rowRateLimitDelayMs(items) {
|
|
895
|
+
const delays = items.map((item) => {
|
|
896
|
+
const retryAfterMs = Number(item.raw?.retry_after_ms);
|
|
897
|
+
if (Number.isFinite(retryAfterMs) && retryAfterMs > 0) return retryAfterMs;
|
|
898
|
+
const retryAfterSeconds = Number(item.raw?.retry_after_seconds ?? item.raw?.retry_after);
|
|
899
|
+
if (Number.isFinite(retryAfterSeconds) && retryAfterSeconds > 0) return retryAfterSeconds * 1e3;
|
|
900
|
+
return 6e4;
|
|
901
|
+
});
|
|
902
|
+
return Math.max(1, Math.min(6e4, Math.max(...delays)));
|
|
903
|
+
}
|
|
869
904
|
function recoverableJobRowFailed(row) {
|
|
870
905
|
return row.success === false || ["failed", "skipped"].includes(String(row._status || "").toLowerCase());
|
|
871
906
|
}
|
package/dist/mcp-config.mjs
CHANGED
package/package.json
CHANGED