hobots 3.2.1 → 3.2.2
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 +56 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +13 -2
- package/dist/index.d.ts +13 -2
- package/dist/index.js +56 -5
- package/dist/index.js.map +1 -1
- package/dist/protocol.d.cts +2 -2
- package/dist/protocol.d.ts +2 -2
- package/package.json +2 -1
package/dist/index.cjs
CHANGED
|
@@ -95,7 +95,7 @@ function scrubSecrets(text) {
|
|
|
95
95
|
|
|
96
96
|
// src/utils.ts
|
|
97
97
|
var SDK_NAME = "hobots";
|
|
98
|
-
var SDK_VERSION = true ? "3.2.
|
|
98
|
+
var SDK_VERSION = true ? "3.2.2" : "0.0.0-dev";
|
|
99
99
|
function isNode() {
|
|
100
100
|
return typeof process !== "undefined" && typeof process.versions?.node === "string";
|
|
101
101
|
}
|
|
@@ -611,6 +611,8 @@ var Heartbeat = class {
|
|
|
611
611
|
this.metadata = options.metadata;
|
|
612
612
|
this.keepAlive = options.keepAlive ?? false;
|
|
613
613
|
}
|
|
614
|
+
client;
|
|
615
|
+
sampler;
|
|
614
616
|
intervalMs;
|
|
615
617
|
instanceId;
|
|
616
618
|
name;
|
|
@@ -747,6 +749,8 @@ var MachineSampler = class {
|
|
|
747
749
|
this.instanceId = instanceId;
|
|
748
750
|
this.logger = logger;
|
|
749
751
|
}
|
|
752
|
+
instanceId;
|
|
753
|
+
logger;
|
|
750
754
|
os;
|
|
751
755
|
fs;
|
|
752
756
|
ready = false;
|
|
@@ -874,6 +878,7 @@ var TasksApiError = class extends Error {
|
|
|
874
878
|
this.status = status;
|
|
875
879
|
this.name = "TasksApiError";
|
|
876
880
|
}
|
|
881
|
+
status;
|
|
877
882
|
};
|
|
878
883
|
async function withRequestTimeout(timeoutMs, external, send) {
|
|
879
884
|
const { signal, cleanup } = withTimeoutSignal(timeoutMs, external);
|
|
@@ -1114,6 +1119,9 @@ var Backoff = class {
|
|
|
1114
1119
|
this.label = label;
|
|
1115
1120
|
this.floorMs = floorMs;
|
|
1116
1121
|
}
|
|
1122
|
+
logger;
|
|
1123
|
+
label;
|
|
1124
|
+
floorMs;
|
|
1117
1125
|
failures = 0;
|
|
1118
1126
|
authFailures = 0;
|
|
1119
1127
|
reset() {
|
|
@@ -1358,6 +1366,9 @@ var RunReporter = class {
|
|
|
1358
1366
|
retry: (fn, options) => retryWithBackoff(fn, { ...options, signal, wait: sleep2 })
|
|
1359
1367
|
};
|
|
1360
1368
|
}
|
|
1369
|
+
api;
|
|
1370
|
+
runId;
|
|
1371
|
+
logger;
|
|
1361
1372
|
context;
|
|
1362
1373
|
buffer = [];
|
|
1363
1374
|
dead = false;
|
|
@@ -1682,6 +1693,7 @@ var RunReporter = class {
|
|
|
1682
1693
|
}
|
|
1683
1694
|
if (error instanceof TasksApiError) {
|
|
1684
1695
|
this.logger.error(`lote de ${batch.length} item(ns) rejeitado pelo servidor:`, error);
|
|
1696
|
+
this.log("warning", `${batch.length} item(ns) descartado(s): envio rejeitado pelo servidor (HTTP ${error.status})`);
|
|
1685
1697
|
return;
|
|
1686
1698
|
}
|
|
1687
1699
|
this.itemsBuffer.unshift(...batch);
|
|
@@ -1908,6 +1920,10 @@ function currentRunReporter() {
|
|
|
1908
1920
|
}
|
|
1909
1921
|
|
|
1910
1922
|
// src/transaction.ts
|
|
1923
|
+
var MAX_STEP_MESSAGE_CHARS = 2e3;
|
|
1924
|
+
function stepMessage(text) {
|
|
1925
|
+
return truncate(scrubSecrets(text), MAX_STEP_MESSAGE_CHARS);
|
|
1926
|
+
}
|
|
1911
1927
|
function stepId() {
|
|
1912
1928
|
return uuid4().slice(0, 16);
|
|
1913
1929
|
}
|
|
@@ -1945,15 +1961,41 @@ var Step = class {
|
|
|
1945
1961
|
this.op = op;
|
|
1946
1962
|
this.description = description;
|
|
1947
1963
|
}
|
|
1964
|
+
transaction;
|
|
1965
|
+
parentStepId;
|
|
1966
|
+
op;
|
|
1967
|
+
description;
|
|
1948
1968
|
stepId = stepId();
|
|
1949
1969
|
startTimestamp = nowISO();
|
|
1950
1970
|
status = "ok";
|
|
1951
1971
|
endTimestamp;
|
|
1952
1972
|
data;
|
|
1953
|
-
|
|
1973
|
+
/**
|
|
1974
|
+
* Desfecho da step. `message` (opcional) é o motivo legível — vai em `data.message`
|
|
1975
|
+
* e aparece na Central (performance e banner da execução) e no log de FINISH.
|
|
1976
|
+
*/
|
|
1977
|
+
setStatus(status, message) {
|
|
1954
1978
|
this.status = status;
|
|
1979
|
+
if (message) this.setData("message", stepMessage(message));
|
|
1955
1980
|
return this;
|
|
1956
1981
|
}
|
|
1982
|
+
/**
|
|
1983
|
+
* Marca a step como `error` guardando o motivo em `data.error` ({ type, message }).
|
|
1984
|
+
* Aceita qualquer valor lançado; `message` sobrescreve a mensagem do erro.
|
|
1985
|
+
*/
|
|
1986
|
+
setError(error, message) {
|
|
1987
|
+
this.status = "error";
|
|
1988
|
+
const type = error instanceof Error ? error.name : typeof error === "object" && error !== null ? "Error" : void 0;
|
|
1989
|
+
const raw = message ?? (error instanceof Error ? error.message || error.name : String(error));
|
|
1990
|
+
this.setData("error", { ...type ? { type } : {}, message: stepMessage(raw) });
|
|
1991
|
+
return this;
|
|
1992
|
+
}
|
|
1993
|
+
/** Motivo registrado via setStatus(…, message) ou setError — usado no log de FINISH. */
|
|
1994
|
+
reason() {
|
|
1995
|
+
const error = this.data?.error;
|
|
1996
|
+
const text = typeof error?.message === "string" ? error.message : this.data?.message;
|
|
1997
|
+
return typeof text === "string" && text ? text : void 0;
|
|
1998
|
+
}
|
|
1957
1999
|
setData(key, value) {
|
|
1958
2000
|
this.data = { ...this.data, [key]: value };
|
|
1959
2001
|
return this;
|
|
@@ -1971,7 +2013,8 @@ var Step = class {
|
|
|
1971
2013
|
stepLabel(this.op, this.description),
|
|
1972
2014
|
this.startTimestamp,
|
|
1973
2015
|
this.endTimestamp,
|
|
1974
|
-
this.status
|
|
2016
|
+
this.status,
|
|
2017
|
+
this.reason()
|
|
1975
2018
|
);
|
|
1976
2019
|
}
|
|
1977
2020
|
toJSON() {
|
|
@@ -1995,6 +2038,10 @@ var Transaction = class {
|
|
|
1995
2038
|
this.runId = runId;
|
|
1996
2039
|
this.emit("transaction", "start", op ? `${name} (${op})` : name);
|
|
1997
2040
|
}
|
|
2041
|
+
client;
|
|
2042
|
+
name;
|
|
2043
|
+
op;
|
|
2044
|
+
runId;
|
|
1998
2045
|
eventId = uuid4();
|
|
1999
2046
|
stepId = stepId();
|
|
2000
2047
|
startTimestamp = nowISO();
|
|
@@ -2014,9 +2061,9 @@ var Transaction = class {
|
|
|
2014
2061
|
* logs da run no app), e ecoa no terminal apenas com `debug: true` — o SDK não
|
|
2015
2062
|
* escreve no stdout do processo do usuário sem permissão.
|
|
2016
2063
|
*/
|
|
2017
|
-
emit(kind, phase, label, startTs, endTs, status) {
|
|
2064
|
+
emit(kind, phase, label, startTs, endTs, status, reason) {
|
|
2018
2065
|
const durationMs = startTs && endTs ? new Date(endTs).getTime() - new Date(startTs).getTime() : void 0;
|
|
2019
|
-
const suffix = durationMs != null ? ` (${durationMs}ms)` : "";
|
|
2066
|
+
const suffix = (durationMs != null ? ` (${durationMs}ms)` : "") + (reason ? `: ${reason}` : "");
|
|
2020
2067
|
if (this.client?.debug) {
|
|
2021
2068
|
const tag = colorize(`[hobots:${kind}] ${phase.toUpperCase()}`, phase === "finish" ? colorForStatus(status ?? "ok") : "cyan");
|
|
2022
2069
|
console.log(`${tag} ${label}${suffix}`);
|
|
@@ -2221,6 +2268,7 @@ var TaskAgent = class {
|
|
|
2221
2268
|
this.pollIntervalMs = Math.max(MIN_POLL_INTERVAL_MS, options.pollIntervalMs ?? DEFAULT_POLL_INTERVAL_MS);
|
|
2222
2269
|
this.backoff = new Backoff(this.logger, "poll", this.pollIntervalMs);
|
|
2223
2270
|
}
|
|
2271
|
+
options;
|
|
2224
2272
|
logger;
|
|
2225
2273
|
pollIntervalMs;
|
|
2226
2274
|
api;
|
|
@@ -2387,6 +2435,8 @@ var LocalRunner = class {
|
|
|
2387
2435
|
this.resolveDone = resolve2;
|
|
2388
2436
|
});
|
|
2389
2437
|
}
|
|
2438
|
+
task;
|
|
2439
|
+
deps;
|
|
2390
2440
|
abort = new AbortController();
|
|
2391
2441
|
backoff;
|
|
2392
2442
|
/** Resolve quando a run terminou (ou o runner foi parado antes de abri-la). */
|
|
@@ -2472,6 +2522,7 @@ var RunTracker = class {
|
|
|
2472
2522
|
constructor(api) {
|
|
2473
2523
|
this.api = api;
|
|
2474
2524
|
}
|
|
2525
|
+
api;
|
|
2475
2526
|
reporters = /* @__PURE__ */ new Set();
|
|
2476
2527
|
waiters = /* @__PURE__ */ new Set();
|
|
2477
2528
|
add(reporter) {
|