hobots 1.7.5 → 1.7.6

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.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { Breadcrumb, EventUser, Severity, EventPayload, TransactionPayload, CheckInPayload, HeartbeatPayload, SpanStatus, RunLogLevel, SpanData, CheckInStatus } from './protocol.cjs';
1
+ import { Breadcrumb, EventUser, Severity, EventPayload, TransactionPayload, CheckInPayload, HeartbeatPayload, StepStatus, RunLogLevel, StepData, CheckInStatus } from './protocol.cjs';
2
2
  export { AgentInfo, Envelope, EnvelopeItem, ExceptionData, PollRequest, PollResponse, RunDescriptor, RunError, RunLogEntry, RunStatus, RunUpdateRequest, RunUpdateResponse, RunUpdateStatus, StackFrame } from './protocol.cjs';
3
3
 
4
4
  /** API oficial da Hobots — o SDK sempre fala com ela em produção. */
@@ -66,27 +66,27 @@ declare class Client {
66
66
 
67
67
  /** Recebe os eventos de lifecycle da transaction para espelhá-los nos logs da run. */
68
68
  type LifecycleSink = (level: RunLogLevel, message: string) => void;
69
- declare class Span {
69
+ declare class Step {
70
70
  private readonly transaction;
71
- readonly parentSpanId: string;
71
+ readonly parentStepId: string;
72
72
  readonly op?: string | undefined;
73
73
  readonly description?: string | undefined;
74
- readonly spanId: string;
74
+ readonly stepId: string;
75
75
  readonly startTimestamp: string;
76
- status: SpanStatus;
76
+ status: StepStatus;
77
77
  endTimestamp?: string;
78
78
  data?: Record<string, unknown>;
79
- constructor(transaction: Transaction, parentSpanId: string, op?: string | undefined, description?: string | undefined);
80
- setStatus(status: SpanStatus): this;
79
+ constructor(transaction: Transaction, parentStepId: string, op?: string | undefined, description?: string | undefined);
80
+ setStatus(status: StepStatus): this;
81
81
  setData(key: string, value: unknown): this;
82
- /** Span aninhado (filho deste span). */
83
- startChild(op?: string, description?: string): Span;
82
+ /** Step aninhada (filha desta step). */
83
+ startChild(op?: string, description?: string): Step;
84
84
  finish(): void;
85
- toJSON(): SpanData;
85
+ toJSON(): StepData;
86
86
  }
87
87
  /**
88
88
  * Uma unidade de trabalho nomeada (ex.: uma execução de rotina, uma sincronização).
89
- * Spans filhos medem as etapas internas (chamadas HTTP, queries, etc.).
89
+ * Steps filhas medem as etapas internas (chamadas HTTP, queries, etc.).
90
90
  */
91
91
  declare class Transaction {
92
92
  private readonly client;
@@ -96,10 +96,10 @@ declare class Transaction {
96
96
  /** Correlaciona a uma execução de task — preenchido automaticamente em ctx.tx */
97
97
  private readonly runId?;
98
98
  readonly eventId: string;
99
- readonly spanId: string;
99
+ readonly stepId: string;
100
100
  readonly startTimestamp: string;
101
101
  status: string;
102
- private readonly spans;
102
+ private readonly steps;
103
103
  private readonly tags;
104
104
  private finished;
105
105
  private lifecycleSink?;
@@ -108,16 +108,16 @@ declare class Transaction {
108
108
  /** Correlaciona a uma execução de task — preenchido automaticamente em ctx.tx */
109
109
  runId?: string | undefined);
110
110
  /**
111
- * Ecoa no terminal o início/fim de um span ou transaction (sempre, independente de
111
+ * Ecoa no terminal o início/fim de uma step ou transaction (sempre, independente de
112
112
  * sampling ou do debug) e espelha a linha no sink de lifecycle, se conectado — é
113
113
  * assim que os eventos de performance também aparecem nos logs da run no app.
114
114
  */
115
- emit(kind: 'transaction' | 'span', phase: 'start' | 'finish', label: string, startTs?: string, endTs?: string, status?: SpanStatus | string): void;
115
+ emit(kind: 'transaction' | 'step', phase: 'start' | 'finish', label: string, startTs?: string, endTs?: string, status?: StepStatus | string): void;
116
116
  /** Conecta o espelho de lifecycle (RunReporter) e faz replay do backlog em ordem. */
117
117
  setLifecycleSink(sink: LifecycleSink): void;
118
- createSpan(parentSpanId: string, op?: string, description?: string): Span;
119
- /** Span direto da transaction. */
120
- startChild(op?: string, description?: string): Span;
118
+ createStep(parentStepId: string, op?: string, description?: string): Step;
119
+ /** Step direta da transaction. */
120
+ startChild(op?: string, description?: string): Step;
121
121
  setTag(key: string, value: string): this;
122
122
  setStatus(status: string): this;
123
123
  setName(name: string): this;
@@ -284,4 +284,4 @@ declare function close(timeoutMs?: number): Promise<boolean>;
284
284
 
285
285
  declare function scrubSecrets(text: string): string;
286
286
 
287
- export { Breadcrumb, type BreadcrumbInput, type CaptureHint, type CheckInOptions, CheckInPayload, CheckInStatus, Client, DEFAULT_BASE_URL, EventPayload, EventUser, type HeartbeatOptions, HeartbeatPayload, type InitOptions, type RunContext, RunLogLevel, Scope, Severity, Span, SpanData, type TaskHandler, type TasksOptions, Transaction, TransactionPayload, type WithMonitorOptions, addBreadcrumb, captureException, captureMessage, checkIn, close, flush, getClient, init, register, scrubSecrets, setContext, setExtra, setTag, setTags, setUser, start, startTransaction, stop, withMonitor, withScope };
287
+ export { Breadcrumb, type BreadcrumbInput, type CaptureHint, type CheckInOptions, CheckInPayload, CheckInStatus, Client, DEFAULT_BASE_URL, EventPayload, EventUser, type HeartbeatOptions, HeartbeatPayload, type InitOptions, type RunContext, RunLogLevel, Scope, Severity, Step, StepData, type TaskHandler, type TasksOptions, Transaction, TransactionPayload, type WithMonitorOptions, addBreadcrumb, captureException, captureMessage, checkIn, close, flush, getClient, init, register, scrubSecrets, setContext, setExtra, setTag, setTags, setUser, start, startTransaction, stop, withMonitor, withScope };
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Breadcrumb, EventUser, Severity, EventPayload, TransactionPayload, CheckInPayload, HeartbeatPayload, SpanStatus, RunLogLevel, SpanData, CheckInStatus } from './protocol.js';
1
+ import { Breadcrumb, EventUser, Severity, EventPayload, TransactionPayload, CheckInPayload, HeartbeatPayload, StepStatus, RunLogLevel, StepData, CheckInStatus } from './protocol.js';
2
2
  export { AgentInfo, Envelope, EnvelopeItem, ExceptionData, PollRequest, PollResponse, RunDescriptor, RunError, RunLogEntry, RunStatus, RunUpdateRequest, RunUpdateResponse, RunUpdateStatus, StackFrame } from './protocol.js';
3
3
 
4
4
  /** API oficial da Hobots — o SDK sempre fala com ela em produção. */
@@ -66,27 +66,27 @@ declare class Client {
66
66
 
67
67
  /** Recebe os eventos de lifecycle da transaction para espelhá-los nos logs da run. */
68
68
  type LifecycleSink = (level: RunLogLevel, message: string) => void;
69
- declare class Span {
69
+ declare class Step {
70
70
  private readonly transaction;
71
- readonly parentSpanId: string;
71
+ readonly parentStepId: string;
72
72
  readonly op?: string | undefined;
73
73
  readonly description?: string | undefined;
74
- readonly spanId: string;
74
+ readonly stepId: string;
75
75
  readonly startTimestamp: string;
76
- status: SpanStatus;
76
+ status: StepStatus;
77
77
  endTimestamp?: string;
78
78
  data?: Record<string, unknown>;
79
- constructor(transaction: Transaction, parentSpanId: string, op?: string | undefined, description?: string | undefined);
80
- setStatus(status: SpanStatus): this;
79
+ constructor(transaction: Transaction, parentStepId: string, op?: string | undefined, description?: string | undefined);
80
+ setStatus(status: StepStatus): this;
81
81
  setData(key: string, value: unknown): this;
82
- /** Span aninhado (filho deste span). */
83
- startChild(op?: string, description?: string): Span;
82
+ /** Step aninhada (filha desta step). */
83
+ startChild(op?: string, description?: string): Step;
84
84
  finish(): void;
85
- toJSON(): SpanData;
85
+ toJSON(): StepData;
86
86
  }
87
87
  /**
88
88
  * Uma unidade de trabalho nomeada (ex.: uma execução de rotina, uma sincronização).
89
- * Spans filhos medem as etapas internas (chamadas HTTP, queries, etc.).
89
+ * Steps filhas medem as etapas internas (chamadas HTTP, queries, etc.).
90
90
  */
91
91
  declare class Transaction {
92
92
  private readonly client;
@@ -96,10 +96,10 @@ declare class Transaction {
96
96
  /** Correlaciona a uma execução de task — preenchido automaticamente em ctx.tx */
97
97
  private readonly runId?;
98
98
  readonly eventId: string;
99
- readonly spanId: string;
99
+ readonly stepId: string;
100
100
  readonly startTimestamp: string;
101
101
  status: string;
102
- private readonly spans;
102
+ private readonly steps;
103
103
  private readonly tags;
104
104
  private finished;
105
105
  private lifecycleSink?;
@@ -108,16 +108,16 @@ declare class Transaction {
108
108
  /** Correlaciona a uma execução de task — preenchido automaticamente em ctx.tx */
109
109
  runId?: string | undefined);
110
110
  /**
111
- * Ecoa no terminal o início/fim de um span ou transaction (sempre, independente de
111
+ * Ecoa no terminal o início/fim de uma step ou transaction (sempre, independente de
112
112
  * sampling ou do debug) e espelha a linha no sink de lifecycle, se conectado — é
113
113
  * assim que os eventos de performance também aparecem nos logs da run no app.
114
114
  */
115
- emit(kind: 'transaction' | 'span', phase: 'start' | 'finish', label: string, startTs?: string, endTs?: string, status?: SpanStatus | string): void;
115
+ emit(kind: 'transaction' | 'step', phase: 'start' | 'finish', label: string, startTs?: string, endTs?: string, status?: StepStatus | string): void;
116
116
  /** Conecta o espelho de lifecycle (RunReporter) e faz replay do backlog em ordem. */
117
117
  setLifecycleSink(sink: LifecycleSink): void;
118
- createSpan(parentSpanId: string, op?: string, description?: string): Span;
119
- /** Span direto da transaction. */
120
- startChild(op?: string, description?: string): Span;
118
+ createStep(parentStepId: string, op?: string, description?: string): Step;
119
+ /** Step direta da transaction. */
120
+ startChild(op?: string, description?: string): Step;
121
121
  setTag(key: string, value: string): this;
122
122
  setStatus(status: string): this;
123
123
  setName(name: string): this;
@@ -284,4 +284,4 @@ declare function close(timeoutMs?: number): Promise<boolean>;
284
284
 
285
285
  declare function scrubSecrets(text: string): string;
286
286
 
287
- export { Breadcrumb, type BreadcrumbInput, type CaptureHint, type CheckInOptions, CheckInPayload, CheckInStatus, Client, DEFAULT_BASE_URL, EventPayload, EventUser, type HeartbeatOptions, HeartbeatPayload, type InitOptions, type RunContext, RunLogLevel, Scope, Severity, Span, SpanData, type TaskHandler, type TasksOptions, Transaction, TransactionPayload, type WithMonitorOptions, addBreadcrumb, captureException, captureMessage, checkIn, close, flush, getClient, init, register, scrubSecrets, setContext, setExtra, setTag, setTags, setUser, start, startTransaction, stop, withMonitor, withScope };
287
+ export { Breadcrumb, type BreadcrumbInput, type CaptureHint, type CheckInOptions, CheckInPayload, CheckInStatus, Client, DEFAULT_BASE_URL, EventPayload, EventUser, type HeartbeatOptions, HeartbeatPayload, type InitOptions, type RunContext, RunLogLevel, Scope, Severity, Step, StepData, type TaskHandler, type TasksOptions, Transaction, TransactionPayload, type WithMonitorOptions, addBreadcrumb, captureException, captureMessage, checkIn, close, flush, getClient, init, register, scrubSecrets, setContext, setExtra, setTag, setTags, setUser, start, startTransaction, stop, withMonitor, withScope };
package/dist/index.js CHANGED
@@ -103,7 +103,7 @@ function scrubSecrets(text) {
103
103
 
104
104
  // src/utils.ts
105
105
  var SDK_NAME = "hobots";
106
- var SDK_VERSION = true ? "1.7.5" : "0.0.0-dev";
106
+ var SDK_VERSION = true ? "1.7.6" : "0.0.0-dev";
107
107
  function isNode() {
108
108
  return typeof process !== "undefined" && typeof process.versions?.node === "string";
109
109
  }
@@ -659,10 +659,10 @@ var Scope = class _Scope {
659
659
  };
660
660
 
661
661
  // src/transaction.ts
662
- function spanId() {
662
+ function stepId() {
663
663
  return uuid4().slice(0, 16);
664
664
  }
665
- function spanLabel(op, description) {
665
+ function stepLabel(op, description) {
666
666
  return [op, description].filter(Boolean).join(" \u2014 ") || "(sem nome)";
667
667
  }
668
668
  function levelForStatus(status) {
@@ -689,14 +689,14 @@ function colorForStatus(status) {
689
689
  return "green";
690
690
  }
691
691
  }
692
- var Span = class {
693
- constructor(transaction, parentSpanId, op, description) {
692
+ var Step = class {
693
+ constructor(transaction, parentStepId, op, description) {
694
694
  this.transaction = transaction;
695
- this.parentSpanId = parentSpanId;
695
+ this.parentStepId = parentStepId;
696
696
  this.op = op;
697
697
  this.description = description;
698
698
  }
699
- spanId = spanId();
699
+ stepId = stepId();
700
700
  startTimestamp = nowISO();
701
701
  status = "ok";
702
702
  endTimestamp;
@@ -709,17 +709,17 @@ var Span = class {
709
709
  this.data = { ...this.data, [key]: value };
710
710
  return this;
711
711
  }
712
- /** Span aninhado (filho deste span). */
712
+ /** Step aninhada (filha desta step). */
713
713
  startChild(op, description) {
714
- return this.transaction.createSpan(this.spanId, op, description);
714
+ return this.transaction.createStep(this.stepId, op, description);
715
715
  }
716
716
  finish() {
717
717
  if (this.endTimestamp) return;
718
718
  this.endTimestamp = nowISO();
719
719
  this.transaction.emit(
720
- "span",
720
+ "step",
721
721
  "finish",
722
- spanLabel(this.op, this.description),
722
+ stepLabel(this.op, this.description),
723
723
  this.startTimestamp,
724
724
  this.endTimestamp,
725
725
  this.status
@@ -727,8 +727,8 @@ var Span = class {
727
727
  }
728
728
  toJSON() {
729
729
  return {
730
- span_id: this.spanId,
731
- parent_span_id: this.parentSpanId,
730
+ step_id: this.stepId,
731
+ parent_step_id: this.parentStepId,
732
732
  op: this.op,
733
733
  description: this.description,
734
734
  status: this.status,
@@ -748,10 +748,10 @@ var Transaction = class {
748
748
  this.emit("transaction", "start", op ? `${name} (${op})` : name);
749
749
  }
750
750
  eventId = uuid4();
751
- spanId = spanId();
751
+ stepId = stepId();
752
752
  startTimestamp = nowISO();
753
753
  status = "ok";
754
- spans = [];
754
+ steps = [];
755
755
  tags = {};
756
756
  finished = false;
757
757
  lifecycleSink;
@@ -759,7 +759,7 @@ var Transaction = class {
759
759
  // antes do RunReporter conectar) — replay no setLifecycleSink
760
760
  lifecycleBacklog = [];
761
761
  /**
762
- * Ecoa no terminal o início/fim de um span ou transaction (sempre, independente de
762
+ * Ecoa no terminal o início/fim de uma step ou transaction (sempre, independente de
763
763
  * sampling ou do debug) e espelha a linha no sink de lifecycle, se conectado — é
764
764
  * assim que os eventos de performance também aparecem nos logs da run no app.
765
765
  */
@@ -780,15 +780,15 @@ var Transaction = class {
780
780
  this.lifecycleBacklog = [];
781
781
  for (const [level, message] of backlog) sink(level, message);
782
782
  }
783
- createSpan(parentSpanId, op, description) {
784
- const span = new Span(this, parentSpanId, op, description);
785
- this.spans.push(span);
786
- this.emit("span", "start", spanLabel(op, description));
787
- return span;
783
+ createStep(parentStepId, op, description) {
784
+ const step = new Step(this, parentStepId, op, description);
785
+ this.steps.push(step);
786
+ this.emit("step", "start", stepLabel(op, description));
787
+ return step;
788
788
  }
789
- /** Span direto da transaction. */
789
+ /** Step direta da transaction. */
790
790
  startChild(op, description) {
791
- return this.createSpan(this.spanId, op, description);
791
+ return this.createStep(this.stepId, op, description);
792
792
  }
793
793
  setTag(key, value) {
794
794
  this.tags[key] = value;
@@ -805,7 +805,7 @@ var Transaction = class {
805
805
  finish() {
806
806
  if (this.finished) return;
807
807
  this.finished = true;
808
- for (const span of this.spans) span.finish();
808
+ for (const step of this.steps) step.finish();
809
809
  const endTimestamp = nowISO();
810
810
  this.emit(
811
811
  "transaction",
@@ -823,7 +823,7 @@ var Transaction = class {
823
823
  status: this.status,
824
824
  start_timestamp: this.startTimestamp,
825
825
  timestamp: endTimestamp,
826
- spans: this.spans.map((span) => span.toJSON()),
826
+ steps: this.steps.map((step) => step.toJSON()),
827
827
  tags: Object.keys(this.tags).length > 0 ? this.tags : void 0,
828
828
  run_id: this.runId
829
829
  };
@@ -1654,7 +1654,7 @@ export {
1654
1654
  Client,
1655
1655
  DEFAULT_BASE_URL,
1656
1656
  Scope,
1657
- Span,
1657
+ Step,
1658
1658
  Transaction,
1659
1659
  addBreadcrumb,
1660
1660
  captureException,