@uipath/common 1.201.0 → 1.202.0-preview.136

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.
Files changed (37) hide show
  1. package/dist/catch-error.d.ts +14 -0
  2. package/dist/catch-error.js +259 -10
  3. package/dist/classified-failure.d.ts +28 -0
  4. package/dist/entity-name-rules.d.ts +18 -0
  5. package/dist/entity-name-rules.js +241 -0
  6. package/dist/error-handler.d.ts +13 -0
  7. package/dist/exit-code.d.ts +42 -0
  8. package/dist/formatter.d.ts +34 -5
  9. package/dist/index.browser.d.ts +3 -0
  10. package/dist/index.browser.js +11328 -10486
  11. package/dist/index.d.ts +10 -1
  12. package/dist/index.js +12320 -11208
  13. package/dist/logger.d.ts +15 -0
  14. package/dist/package-metadata-options.js +3 -3
  15. package/dist/polling/poll-failure-mapping.d.ts +15 -1
  16. package/dist/sdk-user-agent.js +6 -6
  17. package/dist/telemetry/command-name.d.ts +60 -0
  18. package/dist/telemetry/console-telemetry-provider.d.ts +5 -6
  19. package/dist/telemetry/debug-telemetry-provider.d.ts +5 -6
  20. package/dist/telemetry/index.d.ts +3 -3
  21. package/dist/telemetry/index.js +18581 -105
  22. package/dist/telemetry/invocation-request.d.ts +38 -0
  23. package/dist/telemetry/logger-telemetry-provider.d.ts +5 -6
  24. package/dist/telemetry/node-appinsights-telemetry-provider.d.ts +17 -29
  25. package/dist/telemetry/node.d.ts +2 -2
  26. package/dist/telemetry/packaged-name.d.ts +22 -0
  27. package/dist/telemetry/pii-redactor.d.ts +110 -13
  28. package/dist/telemetry/pseudonymize.d.ts +57 -0
  29. package/dist/telemetry/span-clock.d.ts +27 -0
  30. package/dist/telemetry/supplied-values.d.ts +59 -0
  31. package/dist/telemetry/telemetry-init.d.ts +27 -0
  32. package/dist/telemetry/telemetry-provider.d.ts +84 -16
  33. package/dist/telemetry/telemetry-service.d.ts +71 -41
  34. package/dist/telemetry/telemetry-spool.d.ts +17 -0
  35. package/dist/timings.d.ts +99 -0
  36. package/dist/trackedAction.d.ts +25 -2
  37. package/package.json +6 -2
package/dist/logger.d.ts CHANGED
@@ -52,10 +52,25 @@ declare class SimpleLogger {
52
52
  /** Check if file logging is active (local or cross-bundle via globalThis). */
53
53
  private isFileLoggingActive;
54
54
  private writeToFile;
55
+ /**
56
+ * Route one already-formatted line: into the log file when `--log-file`
57
+ * configured one, to stderr through the sink otherwise. Every level goes
58
+ * through here, so the two destinations can never drift apart.
59
+ */
60
+ private write;
55
61
  debug(message: string, ...args: unknown[]): void;
56
62
  info(message: string, ...args: unknown[]): void;
57
63
  warn(message: string, ...args: unknown[]): void;
58
64
  error(message: string, ...args: unknown[]): void;
65
+ /**
66
+ * Write a line regardless of the level threshold.
67
+ *
68
+ * For output that has its own switch and so must not be silenced by
69
+ * `--log-level` — currently only the `UIP_TIMINGS` report. Routing matches
70
+ * the other levels: the log file when one is configured, stderr otherwise.
71
+ * No level tag is prepended; the caller owns the whole line.
72
+ */
73
+ report(message: string): void;
59
74
  /**
60
75
  * Get the current log level.
61
76
  */
@@ -26,8 +26,8 @@ function mapPackageMetadataOptions(opts) {
26
26
  return fields;
27
27
  }
28
28
  export {
29
- registerPackageMetadataOptions,
30
- mapPackageMetadataOptions
29
+ mapPackageMetadataOptions,
30
+ registerPackageMetadataOptions
31
31
  };
32
32
 
33
- //# debugId=D76F2616EBFEF0E864756E2164756E21
33
+ //# debugId=C8F478FA4BBCD51264756E2164756E21
@@ -1,3 +1,4 @@
1
+ import type { CliErrorCode, RetryHint } from "../formatter";
1
2
  import { PollOutcome } from "./types";
2
3
  /** Canonical taxonomy for poll-loop failures; library callers branch on this without parsing the message. */
3
4
  export type PollFailureReason = "poll_timeout" | "poll_failed" | "poll_aborted";
@@ -7,9 +8,22 @@ export interface PollFailureMapped {
7
8
  message: string;
8
9
  /** `2` for Timeout, `1` otherwise. */
9
10
  exitCode: number;
11
+ /**
12
+ * Classification for `OutputFormatter.error`, set only where the outcome
13
+ * settles it. A timeout is `timeout` / `RetryLater`: the operation was
14
+ * still running when we stopped watching, so the instructions say to check
15
+ * again — and the hint has to agree, or an agent reads
16
+ * `RetryWillNotFix` next to "may still be in progress". The other outcomes
17
+ * carry an underlying error the formatter can classify better than we can
18
+ * from the outcome alone, so they are left unset.
19
+ */
20
+ errorCode?: CliErrorCode;
21
+ /** See {@link PollFailureMapped.errorCode}. */
22
+ retry?: RetryHint;
10
23
  }
11
24
  /**
12
- * Maps a non-completed `pollUntil` result to `{ reason, message, exitCode }`.
25
+ * Maps a non-completed `pollUntil` result to `{ reason, message, exitCode }`,
26
+ * plus `errorCode` / `retry` for the outcomes that classify themselves.
13
27
  * `label` prefixes the message (e.g. `"Deployment"` → `"Deployment polling timed out"`).
14
28
  * Caller must check the outcome is non-completed before invoking.
15
29
  */
@@ -149,12 +149,12 @@ function installSdkCodingAgentHeader(BaseApiClass) {
149
149
  installRequestHeaderForwarding(BaseApiClass, codingAgentPatchKey(), (headers) => addSdkCodingAgentHeader(headers));
150
150
  }
151
151
  export {
152
- setSdkUserAgentHostToken,
153
- installSdkUserAgentHeader,
154
- installSdkCodingAgentHeader,
155
- getSdkUserAgentToken,
152
+ addSdkCodingAgentHeader,
156
153
  addSdkUserAgentHeader,
157
- addSdkCodingAgentHeader
154
+ getSdkUserAgentToken,
155
+ installSdkCodingAgentHeader,
156
+ installSdkUserAgentHeader,
157
+ setSdkUserAgentHostToken
158
158
  };
159
159
 
160
- //# debugId=9DC7523199926B8364756E2164756E21
160
+ //# debugId=6BBB85462D129AD364756E2164756E21
@@ -0,0 +1,60 @@
1
+ /**
2
+ * How a command's telemetry name is formed.
3
+ *
4
+ * `requests.name` is the column every command count, failure rate and duration
5
+ * percentile groups by, so the name has to be a command path and nothing else:
6
+ * lowercase tokens under a `uip.` root, one per level.
7
+ *
8
+ * Two places work out which command ran — `deriveCommandPath` walks up from the
9
+ * command object, and `cli.core.ts` walks the tree down from argv for the runs
10
+ * that never reach a handler. That difference is real; the parse-error path is
11
+ * handed the second one's answer rather than guessing a third. How the parts
12
+ * become a name was never each caller's business either, and having it written
13
+ * three times is what let argv text into the column: `uip.config --help` and
14
+ * `uip.help config` both shipped as request names.
15
+ *
16
+ * So the parts are each caller's business and the name is this module's.
17
+ */
18
+ /** Every CLI telemetry name sits under this root. */
19
+ export declare const TELEMETRY_COMMAND_ROOT = "uip";
20
+ /**
21
+ * Build a command's telemetry name from the path parts a caller resolved.
22
+ *
23
+ * Parts are taken as candidates, not as truth. A part is dropped when it is not
24
+ * a command token:
25
+ *
26
+ * - an option (`--help`, `-o`), which names no command and put argv text in the
27
+ * column. Its VALUE is the caller's business: skipping that needs the option
28
+ * grammar, which the argv walk in `cli.core.ts` has and this does not, so a
29
+ * second guess here would only contradict it;
30
+ * - a repeated root, so `uip.uip.tools` cannot happen.
31
+ *
32
+ * What survives is still not trusted to be a command, so shape is checked: a
33
+ * token has to look like a command name and not like an identifier, and
34
+ * anything else becomes `<unknown>` — which keeps the row, a failed run the user
35
+ * cared about, without the column carrying a key.
36
+ *
37
+ * Whitespace inside a part is a part that was never split — the name is
38
+ * dot-separated, so a space in it is a sign the caller handed over a joined
39
+ * string. It is split back into levels only when EVERY piece is a command name;
40
+ * one piece that is not means the part was never a joined path, and it collapses
41
+ * whole onto a single `<unknown>`. A single argv token therefore stays a single
42
+ * level: `uip "nope\nsecond"` is `uip.<unknown>`, not `uip.<unknown>.second` —
43
+ * one typo cannot invent a path level the user never typed.
44
+ *
45
+ * That check is the second line of defence, not the first. What a caller hands
46
+ * over is what bounds this column: `deriveCommandPath` walks the Commander tree
47
+ * and passes command names only, and `cli.core.ts`'s walk pushes at most ONE
48
+ * unrecognized token, in first position, then stops. So an argument never
49
+ * reaches here — `uip or assets get <guid>` is `uip.or.assets.get` and `uip or
50
+ * queues items add myqueue` stops at the last command it recognized. What a
51
+ * shape check is left to catch is the first token of a run that named no
52
+ * command at all, where the user typed something the CLI does not have.
53
+ *
54
+ * A token shaped like a command name IS kept there, deliberately: `uip deploy`
55
+ * or `uip login-sso` is a person or an agent guessing at syntax we do not have,
56
+ * and that is worth seeing rather than collapsing into one `<unknown>` row. The
57
+ * cost is that this column's values are not a closed set — one row per distinct
58
+ * guess — bounded by the shapes below rather than by a list.
59
+ */
60
+ export declare function commandTelemetryName(parts: readonly string[]): string;
@@ -1,12 +1,11 @@
1
- import type { ITelemetryProvider } from "./telemetry-provider.js";
2
- import type { TelemetryProperties } from "./telemetry-service.js";
1
+ import type { ITelemetryProvider, TrackedDependencySpan, TrackedEvent, TrackedException, TrackedSpan } from "./telemetry-provider.js";
3
2
  /**
4
3
  * A simple telemetry provider that logs events to the console.
5
4
  * Useful for development and testing. Browser-safe (no Node API dependencies).
6
5
  */
7
6
  export declare class ConsoleTelemetryProvider implements ITelemetryProvider {
8
- trackEvent(eventName: string, _properties?: TelemetryProperties): Promise<void>;
9
- trackException(error: Error, _properties?: TelemetryProperties): Promise<void>;
10
- trackRequest(name: string, duration: number, success: boolean, _properties?: TelemetryProperties): Promise<void>;
11
- trackDependency(name: string, type: string, duration: number, success: boolean, _properties?: TelemetryProperties): Promise<void>;
7
+ trackEvent({ name }: TrackedEvent): Promise<void>;
8
+ trackException({ error }: TrackedException): Promise<void>;
9
+ trackRequest({ name, durationMs, success, }: TrackedSpan): Promise<void>;
10
+ trackDependency({ name, type, durationMs, success, }: TrackedDependencySpan): Promise<void>;
12
11
  }
@@ -1,12 +1,11 @@
1
- import type { ITelemetryProvider } from "./telemetry-provider.js";
2
- import type { TelemetryProperties } from "./telemetry-service.js";
1
+ import type { ITelemetryProvider, TrackedDependencySpan, TrackedEvent, TrackedException, TrackedSpan } from "./telemetry-provider.js";
3
2
  /**
4
3
  * A simple telemetry provider that logs events via the shared logger.
5
4
  * Useful for development and testing.
6
5
  */
7
6
  export declare class DebugTelemetryProvider implements ITelemetryProvider {
8
- trackEvent(eventName: string, _properties?: TelemetryProperties): Promise<void>;
9
- trackException(error: Error, _properties?: TelemetryProperties): Promise<void>;
10
- trackRequest(name: string, duration: number, success: boolean, _properties?: TelemetryProperties): Promise<void>;
11
- trackDependency(name: string, type: string, duration: number, success: boolean, _properties?: TelemetryProperties): Promise<void>;
7
+ trackEvent({ name }: TrackedEvent): Promise<void>;
8
+ trackException({ error }: TrackedException): Promise<void>;
9
+ trackRequest({ name, durationMs, success, }: TrackedSpan): Promise<void>;
10
+ trackDependency({ name, type, durationMs, success, }: TrackedDependencySpan): Promise<void>;
12
11
  }
@@ -4,8 +4,8 @@ export { ConsoleTelemetryProvider } from "./console-telemetry-provider.js";
4
4
  export type { IContextStorage } from "./context-storage.js";
5
5
  export { buildEnvironmentProperties, type NormalizedEnvironment, normalizeBaseUrl, normalizeEnvironment, } from "./environment-info.js";
6
6
  export { type CiProvider, detectExecutionContext, EXECUTION_CONTEXT_VALUES, type ExecutionContext, type ExecutionContextDetection, type ExecutionContextDetectionOptions, getExecutionContextTelemetryProperties, setExecutionContextAuthSignal, } from "./execution-context.js";
7
- export { redactError, redactProperties, redactProperty, redactValue, } from "./pii-redactor.js";
7
+ export { redactError, redactProperties, redactProperty, } from "./pii-redactor.js";
8
8
  export { getConfiguredTelemetrySessionId, getTelemetrySessionId, getTelemetrySessionSource, TELEMETRY_SESSION_ID_ENV, TELEMETRY_SESSION_SOURCE_PROPERTY, } from "./session-id.js";
9
- export type { ITelemetryProvider } from "./telemetry-provider.js";
9
+ export type { ITelemetryProvider, TelemetryCorrelation, TrackedDependencySpan, TrackedEvent, TrackedException, TrackedSpan, } from "./telemetry-provider.js";
10
10
  export type { ITelemetryService, TelemetryContext, TelemetryProperties, } from "./telemetry-service.js";
11
- export { TELEMETRY_OPERATION_ID_PROPERTY, TELEMETRY_PARENT_ID_PROPERTY, TELEMETRY_SPAN_ID_PROPERTY, TelemetryService, } from "./telemetry-service.js";
11
+ export { TelemetryService } from "./telemetry-service.js";