@uipath/common 1.195.0 → 1.197.0-preview.59
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/catch-error.js +32 -0
- package/dist/confirmation.d.ts +28 -0
- package/dist/content-hash.d.ts +8 -0
- package/dist/error-handler.d.ts +30 -1
- package/dist/formatter.d.ts +15 -1
- package/dist/index.browser.d.ts +9 -1
- package/dist/index.browser.js +18583 -1891
- package/dist/index.d.ts +8 -1
- package/dist/index.js +3423 -4281
- package/dist/interactivity-context.d.ts +33 -0
- package/dist/output-sink.d.ts +3 -1
- package/dist/package-metadata-options.d.ts +38 -0
- package/dist/package-metadata-options.js +33 -0
- package/dist/preview.d.ts +53 -0
- package/dist/sdk-user-agent.d.ts +14 -1
- package/dist/sdk-user-agent.js +59 -42
- package/dist/stdin.d.ts +1 -0
- package/dist/telemetry/global-telemetry-properties.d.ts +8 -0
- package/dist/telemetry/index.js +40 -1
- package/dist/telemetry/node-appinsights-telemetry-provider.d.ts +1 -2
- package/dist/telemetry/telemetry-config.d.ts +5 -0
- package/dist/telemetry/telemetry-init.d.ts +1 -6
- package/dist/telemetry/telemetry-service.d.ts +9 -1
- package/package.json +32 -6
- package/dist/jsonpath.d.ts +0 -11
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Process-wide interactivity mode.
|
|
3
|
+
*
|
|
4
|
+
* The CLI prompts by default only when both stdout and stdin are attached to an
|
|
5
|
+
* interactive terminal. An automation agent or CI runner can never answer a
|
|
6
|
+
* `y/N` prompt, so piped input or redirected output stays non-interactive.
|
|
7
|
+
* Commands consult {@link canPrompt} before showing any optional/selection
|
|
8
|
+
* prompt; when it returns `false` they must fall back to a flag-driven path or
|
|
9
|
+
* fail fast with a structured error naming the flag to pass.
|
|
10
|
+
*
|
|
11
|
+
* Modes:
|
|
12
|
+
* - "never" — never prompt.
|
|
13
|
+
* - "auto" — prompt only when stdout and stdin are TTYs (the default).
|
|
14
|
+
* - "always" — always prompt (assume a prompt-capable terminal).
|
|
15
|
+
*
|
|
16
|
+
* Stored via {@link singleton} so the value set once by the CLI host is visible
|
|
17
|
+
* from every tool bundle's own copy of `@uipath/common`.
|
|
18
|
+
*
|
|
19
|
+
* Note: destructive confirmation does NOT use this — it is flag-only and
|
|
20
|
+
* fail-closed (see `confirmation.ts`). Interactivity governs *optional* prompts.
|
|
21
|
+
*/
|
|
22
|
+
export type InteractivityMode = "never" | "auto" | "always";
|
|
23
|
+
/** Set the process-wide interactivity mode. Called once at CLI startup. */
|
|
24
|
+
export declare function setInteractivityMode(mode: InteractivityMode): void;
|
|
25
|
+
/** Get the current interactivity mode, defaulting to "auto". */
|
|
26
|
+
export declare function getInteractivityMode(): InteractivityMode;
|
|
27
|
+
/**
|
|
28
|
+
* True when the CLI may show an interactive prompt right now.
|
|
29
|
+
*
|
|
30
|
+
* "always" always prompts; "never" never does; "auto" prompts only when the
|
|
31
|
+
* output sink reports an interactive (TTY) terminal and prompt-readable stdin.
|
|
32
|
+
*/
|
|
33
|
+
export declare function canPrompt(): boolean;
|
package/dist/output-sink.d.ts
CHANGED
|
@@ -14,8 +14,10 @@ export interface OutputSink {
|
|
|
14
14
|
readonly capabilities: SinkCapabilities;
|
|
15
15
|
}
|
|
16
16
|
export interface SinkCapabilities {
|
|
17
|
-
/** True when
|
|
17
|
+
/** True when stdout is a TTY. False for piped output, MCP, browser. */
|
|
18
18
|
isInteractive: boolean;
|
|
19
|
+
/** True when stdin can be read interactively (TTY). False for piped input. */
|
|
20
|
+
canReadInput: boolean;
|
|
19
21
|
/** True when ANSI escape codes are supported. */
|
|
20
22
|
supportsColor: boolean;
|
|
21
23
|
/** Terminal width, or a sensible default (80/120). */
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared package-traceability metadata options for `pack` commands.
|
|
3
|
+
*
|
|
4
|
+
*/
|
|
5
|
+
import type { Command } from "commander";
|
|
6
|
+
/**
|
|
7
|
+
* Raw camelCased values commander produces for the shared metadata options.
|
|
8
|
+
* Commands extend their own option interface with this.
|
|
9
|
+
*/
|
|
10
|
+
export interface PackageMetadataCliOptions {
|
|
11
|
+
author?: string;
|
|
12
|
+
description?: string;
|
|
13
|
+
repositoryUrl?: string;
|
|
14
|
+
repositoryCommit?: string;
|
|
15
|
+
repositoryBranch?: string;
|
|
16
|
+
repositoryType?: string;
|
|
17
|
+
releaseNotes?: string;
|
|
18
|
+
projectUrl?: string;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Subset of `NugetPackageInfo` fields produced from the metadata options.
|
|
22
|
+
* Only defined fields are present so spreading this into a package literal
|
|
23
|
+
* never clobbers existing defaults with `undefined`.
|
|
24
|
+
*/
|
|
25
|
+
export type PackageMetadataFields = PackageMetadataCliOptions;
|
|
26
|
+
/**
|
|
27
|
+
* Register the shared package-metadata options on a commander command.
|
|
28
|
+
* Returns the command for chaining.
|
|
29
|
+
*/
|
|
30
|
+
export declare function registerPackageMetadataOptions(command: Command): Command;
|
|
31
|
+
/**
|
|
32
|
+
* Map parsed metadata options to the `NugetPackageInfo` fields the packager
|
|
33
|
+
* understands. Returns only fields the user actually supplied, and defaults
|
|
34
|
+
* `repositoryType` to `"git"` when a `repositoryUrl` is given but no type —
|
|
35
|
+
* the nuspec generator only emits the `<repository>` element when both type
|
|
36
|
+
* and url are present.
|
|
37
|
+
*/
|
|
38
|
+
export declare function mapPackageMetadataOptions(opts: PackageMetadataCliOptions): PackageMetadataFields;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// src/package-metadata-options.ts
|
|
2
|
+
function registerPackageMetadataOptions(command) {
|
|
3
|
+
return command.option("--author <author>", "Package author").option("--description <text>", "Package description").option("--repository-url <url>", "Source repository URL (recorded in the package for traceability)").option("--repository-commit <sha>", "Source repository commit hash (recorded in the package for traceability)").option("--repository-branch <branch>", "Source repository branch").option("--repository-type <type>", "Source repository type (defaults to 'git' when --repository-url is set)").option("--release-notes <text>", "Release notes for the package").option("--project-url <url>", "Automation Hub idea URL");
|
|
4
|
+
}
|
|
5
|
+
function mapPackageMetadataOptions(opts) {
|
|
6
|
+
const fields = {};
|
|
7
|
+
if (opts.author !== undefined)
|
|
8
|
+
fields.author = opts.author;
|
|
9
|
+
if (opts.description !== undefined)
|
|
10
|
+
fields.description = opts.description;
|
|
11
|
+
if (opts.releaseNotes !== undefined)
|
|
12
|
+
fields.releaseNotes = opts.releaseNotes;
|
|
13
|
+
if (opts.projectUrl !== undefined)
|
|
14
|
+
fields.projectUrl = opts.projectUrl;
|
|
15
|
+
if (opts.repositoryUrl !== undefined)
|
|
16
|
+
fields.repositoryUrl = opts.repositoryUrl;
|
|
17
|
+
if (opts.repositoryCommit !== undefined)
|
|
18
|
+
fields.repositoryCommit = opts.repositoryCommit;
|
|
19
|
+
if (opts.repositoryBranch !== undefined)
|
|
20
|
+
fields.repositoryBranch = opts.repositoryBranch;
|
|
21
|
+
if (opts.repositoryType !== undefined)
|
|
22
|
+
fields.repositoryType = opts.repositoryType;
|
|
23
|
+
if (fields.repositoryUrl !== undefined && fields.repositoryType === undefined) {
|
|
24
|
+
fields.repositoryType = "git";
|
|
25
|
+
}
|
|
26
|
+
return fields;
|
|
27
|
+
}
|
|
28
|
+
export {
|
|
29
|
+
registerPackageMetadataOptions,
|
|
30
|
+
mapPackageMetadataOptions
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
//# debugId=D76F2616EBFEF0E864756E2164756E21
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { type CommandOptions } from "commander";
|
|
2
|
+
/**
|
|
3
|
+
* Publish whether the running CLI is a preview build. Called once by the CLI
|
|
4
|
+
* host during startup, before any command (root or tool) is registered.
|
|
5
|
+
*
|
|
6
|
+
* "Preview" means the CLI binary's own version (`pkg.version`) carries any
|
|
7
|
+
* prerelease tag — `alpha`, `beta`, or `preview`. The host computes that from
|
|
8
|
+
* its version alone; this module stays free of any version-parsing logic so
|
|
9
|
+
* it can ship in every tool bundle.
|
|
10
|
+
*/
|
|
11
|
+
export declare function setPreviewBuild(isPreview: boolean): void;
|
|
12
|
+
/**
|
|
13
|
+
* True when the running CLI is a preview (prerelease) build.
|
|
14
|
+
*
|
|
15
|
+
* Defaults to `false` when the host never called {@link setPreviewBuild} —
|
|
16
|
+
* e.g. a tool's unit tests that don't boot the CLI host — so preview-only
|
|
17
|
+
* commands stay unregistered unless a preview build explicitly opted in.
|
|
18
|
+
*/
|
|
19
|
+
export declare function isPreviewBuild(): boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Register a command (or run any setup) only on preview builds.
|
|
22
|
+
*
|
|
23
|
+
* Ergonomic guard for `registerCommands`: on a stable build `register` is
|
|
24
|
+
* never called, so the command is not added to Commander at all — invoking it
|
|
25
|
+
* yields the standard "unknown command" error. On a preview build it
|
|
26
|
+
* registers normally.
|
|
27
|
+
*
|
|
28
|
+
* export const registerCommands = async (program: Command) => {
|
|
29
|
+
* registerStableCommand(program);
|
|
30
|
+
* previewOnly(() => registerExperimentalCommand(program));
|
|
31
|
+
* };
|
|
32
|
+
*/
|
|
33
|
+
export declare function previewOnly(register: () => void): void;
|
|
34
|
+
declare module "commander" {
|
|
35
|
+
interface Command {
|
|
36
|
+
/**
|
|
37
|
+
* Drop-in for `.command(nameAndArgs, opts)` that attaches the
|
|
38
|
+
* subcommand only on preview (prerelease) builds.
|
|
39
|
+
*
|
|
40
|
+
* On a preview build it behaves exactly like `.command(...)`. On a
|
|
41
|
+
* stable build it returns a *detached* Command: the chained
|
|
42
|
+
* `.description()` / `.option()` / `.trackedAction()` calls still
|
|
43
|
+
* type-check and run, but the command is never added to this program,
|
|
44
|
+
* so invoking it yields the standard "unknown command" error.
|
|
45
|
+
*
|
|
46
|
+
* entities
|
|
47
|
+
* .previewCommand("bulk-import <file>")
|
|
48
|
+
* .description("experimental bulk import")
|
|
49
|
+
* .trackedAction(processContext, async () => { ... });
|
|
50
|
+
*/
|
|
51
|
+
previewCommand(nameAndArgs: string, opts?: CommandOptions): Command;
|
|
52
|
+
}
|
|
53
|
+
}
|
package/dist/sdk-user-agent.d.ts
CHANGED
|
@@ -5,8 +5,21 @@ export interface SdkUserAgentPackageInfo {
|
|
|
5
5
|
export type SdkHttpHeaders = Record<string, string>;
|
|
6
6
|
export declare function getSdkUserAgentToken(pkg: SdkUserAgentPackageInfo): string;
|
|
7
7
|
export declare function setSdkUserAgentHostToken(token: string | undefined): void;
|
|
8
|
+
/**
|
|
9
|
+
* Forwards the SDK `User-Agent` token, prefixed with the host token (e.g.
|
|
10
|
+
* `uip/1.1.0`) when one is configured. Appends to any existing value without
|
|
11
|
+
* duplicating tokens and preserves the caller's header casing.
|
|
12
|
+
*/
|
|
8
13
|
export declare function addSdkUserAgentHeader(headers: SdkHttpHeaders | undefined, userAgent: string): SdkHttpHeaders;
|
|
9
|
-
|
|
14
|
+
/**
|
|
15
|
+
* Forwards the telemetry `agent` via `x-coding-agent-info` as a JSON envelope —
|
|
16
|
+
* `{"CodingAgent":"<agent>"}`; preserves the caller's header casing.
|
|
17
|
+
* Leaves the header absent when no agent is available.
|
|
18
|
+
*/
|
|
19
|
+
export declare function addSdkCodingAgentHeader(headers: SdkHttpHeaders | undefined, agent?: string | undefined): SdkHttpHeaders;
|
|
10
20
|
export declare function installSdkUserAgentHeader(BaseApiClass: {
|
|
11
21
|
prototype: unknown;
|
|
12
22
|
}, userAgent: string): void;
|
|
23
|
+
export declare function installSdkCodingAgentHeader(BaseApiClass: {
|
|
24
|
+
prototype: unknown;
|
|
25
|
+
}): void;
|
package/dist/sdk-user-agent.js
CHANGED
|
@@ -28,12 +28,30 @@ function singleton(ctorOrName) {
|
|
|
28
28
|
};
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
+
// src/telemetry/global-telemetry-properties.ts
|
|
32
|
+
var telemetryPropsSlot = singleton("TelemetryDefaultProps");
|
|
33
|
+
function getGlobalTelemetryProperties() {
|
|
34
|
+
return telemetryPropsSlot.get();
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// src/telemetry/telemetry-config.ts
|
|
38
|
+
function isTelemetryDisabled() {
|
|
39
|
+
const value = process.env.UIPATH_TELEMETRY_DISABLED;
|
|
40
|
+
return value === "1" || value === "true";
|
|
41
|
+
}
|
|
42
|
+
|
|
31
43
|
// src/sdk-user-agent.ts
|
|
32
44
|
var USER_AGENT_HEADER = "User-Agent";
|
|
45
|
+
var CODING_AGENT_HEADER = "x-coding-agent-info";
|
|
46
|
+
var AGENT_PROPERTY = "agent";
|
|
47
|
+
var CODING_AGENT_PROPERTY = "CodingAgent";
|
|
33
48
|
var sdkUserAgentHostToken = singleton("SdkUserAgentHostToken");
|
|
34
49
|
function userAgentPatchKey(userAgent) {
|
|
35
50
|
return Symbol.for(`@uipath/common/sdk-user-agent/${userAgent}`);
|
|
36
51
|
}
|
|
52
|
+
function codingAgentPatchKey() {
|
|
53
|
+
return Symbol.for("@uipath/common/sdk-coding-agent");
|
|
54
|
+
}
|
|
37
55
|
function splitUserAgentTokens(value) {
|
|
38
56
|
return value?.trim().split(/\s+/).filter(Boolean) ?? [];
|
|
39
57
|
}
|
|
@@ -51,8 +69,15 @@ function appendUserAgentToken(value, userAgent) {
|
|
|
51
69
|
function getEffectiveUserAgent(userAgent) {
|
|
52
70
|
return appendUserAgentToken(sdkUserAgentHostToken.get(), userAgent);
|
|
53
71
|
}
|
|
54
|
-
function
|
|
55
|
-
return
|
|
72
|
+
function getHeaderName(headers, headerName) {
|
|
73
|
+
return Object.keys(headers).find((key) => key.toLowerCase() === headerName.toLowerCase());
|
|
74
|
+
}
|
|
75
|
+
function getSdkAgentInfo() {
|
|
76
|
+
if (isTelemetryDisabled()) {
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
const agent = getGlobalTelemetryProperties()?.[AGENT_PROPERTY];
|
|
80
|
+
return agent === undefined ? undefined : String(agent);
|
|
56
81
|
}
|
|
57
82
|
function getSdkUserAgentToken(pkg) {
|
|
58
83
|
const packageName = pkg.name.replace(/^@uipath\//, "");
|
|
@@ -67,59 +92,42 @@ function setSdkUserAgentHostToken(token) {
|
|
|
67
92
|
}
|
|
68
93
|
function addSdkUserAgentHeader(headers, userAgent) {
|
|
69
94
|
const result = { ...headers ?? {} };
|
|
70
|
-
const
|
|
71
|
-
|
|
72
|
-
if (headerName) {
|
|
73
|
-
result[headerName] = appendUserAgentToken(result[headerName], effectiveUserAgent);
|
|
74
|
-
} else {
|
|
75
|
-
result[USER_AGENT_HEADER] = effectiveUserAgent;
|
|
76
|
-
}
|
|
95
|
+
const headerName = getHeaderName(result, USER_AGENT_HEADER);
|
|
96
|
+
result[headerName ?? USER_AGENT_HEADER] = appendUserAgentToken(headerName ? result[headerName] : undefined, getEffectiveUserAgent(userAgent));
|
|
77
97
|
return result;
|
|
78
98
|
}
|
|
79
|
-
function
|
|
80
|
-
const
|
|
81
|
-
if (
|
|
82
|
-
headers.set(USER_AGENT_HEADER, appendUserAgentToken(headers.get(USER_AGENT_HEADER), effectiveUserAgent));
|
|
83
|
-
return headers;
|
|
84
|
-
}
|
|
85
|
-
if (Array.isArray(headers)) {
|
|
86
|
-
const result = headers.map((entry) => {
|
|
87
|
-
const [key, value] = entry;
|
|
88
|
-
return [key, value];
|
|
89
|
-
});
|
|
90
|
-
const headerIndex = result.findIndex(([key]) => key.toLowerCase() === USER_AGENT_HEADER.toLowerCase());
|
|
91
|
-
if (headerIndex >= 0) {
|
|
92
|
-
const [key, value] = result[headerIndex];
|
|
93
|
-
result[headerIndex] = [
|
|
94
|
-
key,
|
|
95
|
-
appendUserAgentToken(value, effectiveUserAgent)
|
|
96
|
-
];
|
|
97
|
-
} else {
|
|
98
|
-
result.push([USER_AGENT_HEADER, effectiveUserAgent]);
|
|
99
|
-
}
|
|
99
|
+
function addSdkCodingAgentHeader(headers, agent = getSdkAgentInfo()) {
|
|
100
|
+
const result = { ...headers ?? {} };
|
|
101
|
+
if (agent === undefined) {
|
|
100
102
|
return result;
|
|
101
103
|
}
|
|
102
|
-
|
|
104
|
+
const headerName = getHeaderName(result, CODING_AGENT_HEADER);
|
|
105
|
+
result[headerName ?? CODING_AGENT_HEADER] = JSON.stringify({
|
|
106
|
+
[CODING_AGENT_PROPERTY]: agent
|
|
107
|
+
});
|
|
108
|
+
return result;
|
|
109
|
+
}
|
|
110
|
+
function asHeaderRecord(headers) {
|
|
111
|
+
return typeof headers === "object" && headers !== null ? { ...headers } : {};
|
|
103
112
|
}
|
|
104
|
-
function
|
|
113
|
+
function withForwardedHeadersInitOverride(initOverrides, forward) {
|
|
105
114
|
return async (requestContext) => {
|
|
106
|
-
const
|
|
115
|
+
const initWithHeaders = {
|
|
107
116
|
...requestContext.init,
|
|
108
|
-
headers:
|
|
117
|
+
headers: forward(asHeaderRecord(requestContext.init.headers))
|
|
109
118
|
};
|
|
110
119
|
const override = typeof initOverrides === "function" ? await initOverrides({
|
|
111
120
|
...requestContext,
|
|
112
|
-
init:
|
|
121
|
+
init: initWithHeaders
|
|
113
122
|
}) : initOverrides;
|
|
114
123
|
return {
|
|
115
124
|
...override ?? {},
|
|
116
|
-
headers:
|
|
125
|
+
headers: forward(asHeaderRecord(override?.headers ?? initWithHeaders.headers))
|
|
117
126
|
};
|
|
118
127
|
};
|
|
119
128
|
}
|
|
120
|
-
function
|
|
129
|
+
function installRequestHeaderForwarding(BaseApiClass, patchKey, forward) {
|
|
121
130
|
const prototype = BaseApiClass.prototype;
|
|
122
|
-
const patchKey = userAgentPatchKey(userAgent);
|
|
123
131
|
if (prototype[patchKey]) {
|
|
124
132
|
return;
|
|
125
133
|
}
|
|
@@ -127,17 +135,26 @@ function installSdkUserAgentHeader(BaseApiClass, userAgent) {
|
|
|
127
135
|
throw new Error("Generated BaseAPI request function not found.");
|
|
128
136
|
}
|
|
129
137
|
const originalRequest = prototype.request;
|
|
130
|
-
prototype.request = function
|
|
131
|
-
return originalRequest.call(this, context,
|
|
138
|
+
prototype.request = function requestWithForwardedHeaders(context, initOverrides) {
|
|
139
|
+
return originalRequest.call(this, context, withForwardedHeadersInitOverride(initOverrides, forward));
|
|
132
140
|
};
|
|
133
141
|
Object.defineProperty(prototype, patchKey, {
|
|
134
142
|
value: true
|
|
135
143
|
});
|
|
136
144
|
}
|
|
145
|
+
function installSdkUserAgentHeader(BaseApiClass, userAgent) {
|
|
146
|
+
installRequestHeaderForwarding(BaseApiClass, userAgentPatchKey(userAgent), (headers) => addSdkUserAgentHeader(headers, userAgent));
|
|
147
|
+
}
|
|
148
|
+
function installSdkCodingAgentHeader(BaseApiClass) {
|
|
149
|
+
installRequestHeaderForwarding(BaseApiClass, codingAgentPatchKey(), (headers) => addSdkCodingAgentHeader(headers));
|
|
150
|
+
}
|
|
137
151
|
export {
|
|
138
|
-
withSdkUserAgentHeader,
|
|
139
152
|
setSdkUserAgentHostToken,
|
|
140
153
|
installSdkUserAgentHeader,
|
|
154
|
+
installSdkCodingAgentHeader,
|
|
141
155
|
getSdkUserAgentToken,
|
|
142
|
-
addSdkUserAgentHeader
|
|
156
|
+
addSdkUserAgentHeader,
|
|
157
|
+
addSdkCodingAgentHeader
|
|
143
158
|
};
|
|
159
|
+
|
|
160
|
+
//# debugId=9DC7523199926B8364756E2164756E21
|
package/dist/stdin.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function readStdin(): Promise<string | null>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { TelemetryProperties } from "./telemetry-service.js";
|
|
2
|
+
/**
|
|
3
|
+
* Merge `properties` into the shared global base properties.
|
|
4
|
+
* Existing keys are preserved unless overwritten by `properties`, so callers
|
|
5
|
+
* can contribute base props incrementally (e.g. agent first, then auth context).
|
|
6
|
+
*/
|
|
7
|
+
export declare function setGlobalTelemetryProperties(properties: TelemetryProperties): void;
|
|
8
|
+
export declare function getGlobalTelemetryProperties(): TelemetryProperties | undefined;
|
package/dist/telemetry/index.js
CHANGED
|
@@ -159,6 +159,42 @@ function redactProperties(properties) {
|
|
|
159
159
|
}
|
|
160
160
|
return out;
|
|
161
161
|
}
|
|
162
|
+
// src/singleton.ts
|
|
163
|
+
var PREFIX = "@uipath/common/";
|
|
164
|
+
var _g = globalThis;
|
|
165
|
+
function singleton(ctorOrName) {
|
|
166
|
+
const name = typeof ctorOrName === "string" ? ctorOrName : ctorOrName.name;
|
|
167
|
+
const key = Symbol.for(PREFIX + name);
|
|
168
|
+
return {
|
|
169
|
+
get(fallback) {
|
|
170
|
+
return _g[key] ?? fallback;
|
|
171
|
+
},
|
|
172
|
+
set(value) {
|
|
173
|
+
_g[key] = value;
|
|
174
|
+
},
|
|
175
|
+
clear() {
|
|
176
|
+
delete _g[key];
|
|
177
|
+
},
|
|
178
|
+
getOrInit(factory, guard) {
|
|
179
|
+
const existing = _g[key];
|
|
180
|
+
if (existing != null && typeof existing === "object") {
|
|
181
|
+
if (!guard || guard(existing)) {
|
|
182
|
+
return existing;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
const instance = factory();
|
|
186
|
+
_g[key] = instance;
|
|
187
|
+
return instance;
|
|
188
|
+
}
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
// src/telemetry/global-telemetry-properties.ts
|
|
193
|
+
var telemetryPropsSlot = singleton("TelemetryDefaultProps");
|
|
194
|
+
function getGlobalTelemetryProperties() {
|
|
195
|
+
return telemetryPropsSlot.get();
|
|
196
|
+
}
|
|
197
|
+
|
|
162
198
|
// src/telemetry/telemetry-service.ts
|
|
163
199
|
class TelemetryService {
|
|
164
200
|
telemetryProvider;
|
|
@@ -176,7 +212,7 @@ class TelemetryService {
|
|
|
176
212
|
this.telemetryProvider = provider;
|
|
177
213
|
}
|
|
178
214
|
setDefaultProperties(properties) {
|
|
179
|
-
this.defaultProperties = properties;
|
|
215
|
+
this.defaultProperties = properties === undefined ? undefined : { ...this.defaultProperties, ...properties };
|
|
180
216
|
}
|
|
181
217
|
trackEvent(name, properties) {
|
|
182
218
|
const context = this.getCurrentContext();
|
|
@@ -238,6 +274,7 @@ class TelemetryService {
|
|
|
238
274
|
}
|
|
239
275
|
enrichPropertiesWithContext(properties, context) {
|
|
240
276
|
return {
|
|
277
|
+
...getGlobalTelemetryProperties(),
|
|
241
278
|
...this.defaultProperties,
|
|
242
279
|
...properties,
|
|
243
280
|
...context
|
|
@@ -254,3 +291,5 @@ export {
|
|
|
254
291
|
ConsoleTelemetryProvider,
|
|
255
292
|
BrowserContextStorage
|
|
256
293
|
};
|
|
294
|
+
|
|
295
|
+
//# debugId=71EE5BABB86B607F64756E2164756E21
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { ITelemetryProvider } from "./telemetry-provider.js";
|
|
2
2
|
import type { TelemetryProperties } from "./telemetry-service.js";
|
|
3
|
-
export
|
|
4
|
-
export declare function getGlobalTelemetryProperties(): TelemetryProperties | undefined;
|
|
3
|
+
export { getGlobalTelemetryProperties, setGlobalTelemetryProperties, } from "./global-telemetry-properties.js";
|
|
5
4
|
/**
|
|
6
5
|
* Node.js Application Insights telemetry provider.
|
|
7
6
|
* Uses the `applicationinsights` Node SDK (not the browser SDK).
|
|
@@ -6,11 +6,7 @@ import { type NodeAppInsightsTelemetryProvider } from "./node-appinsights-teleme
|
|
|
6
6
|
* Returns undefined if the applicationinsights package is not installed.
|
|
7
7
|
*/
|
|
8
8
|
export declare function createAppInsightsProvider(): Promise<NodeAppInsightsTelemetryProvider | undefined>;
|
|
9
|
-
|
|
10
|
-
* Check whether telemetry is disabled via environment variable.
|
|
11
|
-
* Set UIPATH_TELEMETRY_DISABLED=1 or UIPATH_TELEMETRY_DISABLED=true to opt out.
|
|
12
|
-
*/
|
|
13
|
-
export declare function isTelemetryDisabled(): boolean;
|
|
9
|
+
export { isTelemetryDisabled } from "./telemetry-config.js";
|
|
14
10
|
interface TelemetryProviderResult {
|
|
15
11
|
provider: ITelemetryProvider;
|
|
16
12
|
name: string;
|
|
@@ -50,4 +46,3 @@ export declare function telemetryInit(options?: TelemetryInitOptions): Promise<v
|
|
|
50
46
|
* Capped at FLUSH_SHUTDOWN_TIMEOUT_MS to avoid hanging on slow/unreachable endpoints.
|
|
51
47
|
*/
|
|
52
48
|
export declare function telemetryFlushAndShutdown(): Promise<void>;
|
|
53
|
-
export {};
|
|
@@ -147,7 +147,15 @@ export declare class TelemetryService implements ITelemetryService {
|
|
|
147
147
|
*/
|
|
148
148
|
private getCurrentContext;
|
|
149
149
|
/**
|
|
150
|
-
* Enriches properties with
|
|
150
|
+
* Enriches properties with the shared base properties, this service's
|
|
151
|
+
* default properties, and context information (operationId, parentId, id).
|
|
152
|
+
*
|
|
153
|
+
* The global base properties (app version, detected agent, authenticated
|
|
154
|
+
* user/tenant/org) are merged here — at the service level — rather than
|
|
155
|
+
* inside a specific provider, so EVERY event carries them regardless of
|
|
156
|
+
* which provider is active (AppInsights, logger fallback, or a tool
|
|
157
|
+
* bundle's early local instance). Precedence, lowest to highest: global
|
|
158
|
+
* base props → per-service defaults → per-call props → correlation context.
|
|
151
159
|
*/
|
|
152
160
|
private enrichPropertiesWithContext;
|
|
153
161
|
/**
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uipath/common",
|
|
3
3
|
"license": "MIT",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.197.0-preview.59",
|
|
5
5
|
"description": "Common infrastructure needed by uip tools.",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -24,13 +24,39 @@
|
|
|
24
24
|
"default": "./dist/index.js"
|
|
25
25
|
}
|
|
26
26
|
},
|
|
27
|
+
"./catch-error": {
|
|
28
|
+
"types": "./dist/catch-error.d.ts",
|
|
29
|
+
"default": "./dist/catch-error.js"
|
|
30
|
+
},
|
|
27
31
|
"./sdk-user-agent": {
|
|
28
|
-
"
|
|
29
|
-
|
|
32
|
+
"browser": {
|
|
33
|
+
"types": "./dist/sdk-user-agent.d.ts",
|
|
34
|
+
"default": "./dist/sdk-user-agent.js"
|
|
35
|
+
},
|
|
36
|
+
"default": {
|
|
37
|
+
"types": "./dist/sdk-user-agent.d.ts",
|
|
38
|
+
"default": "./dist/sdk-user-agent.js"
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
"./package-metadata-options": {
|
|
42
|
+
"browser": {
|
|
43
|
+
"types": "./dist/package-metadata-options.d.ts",
|
|
44
|
+
"default": "./dist/package-metadata-options.js"
|
|
45
|
+
},
|
|
46
|
+
"default": {
|
|
47
|
+
"types": "./dist/package-metadata-options.d.ts",
|
|
48
|
+
"default": "./dist/package-metadata-options.js"
|
|
49
|
+
}
|
|
30
50
|
},
|
|
31
51
|
"./telemetry": {
|
|
32
|
-
"
|
|
33
|
-
|
|
52
|
+
"browser": {
|
|
53
|
+
"types": "./dist/telemetry/index.d.ts",
|
|
54
|
+
"default": "./dist/telemetry/index.js"
|
|
55
|
+
},
|
|
56
|
+
"default": {
|
|
57
|
+
"types": "./dist/telemetry/index.d.ts",
|
|
58
|
+
"default": "./dist/telemetry/index.js"
|
|
59
|
+
}
|
|
34
60
|
}
|
|
35
61
|
},
|
|
36
62
|
"files": [
|
|
@@ -41,5 +67,5 @@
|
|
|
41
67
|
"mihaigirleanu",
|
|
42
68
|
"vlad-uipath"
|
|
43
69
|
],
|
|
44
|
-
"gitHead": "
|
|
70
|
+
"gitHead": "df0e2b8140cced13f463b487214927c82bc0f85b"
|
|
45
71
|
}
|
package/dist/jsonpath.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Evaluate a JSONPath expression against arbitrary data.
|
|
3
|
-
*
|
|
4
|
-
* Returns a newline-separated string of matched values.
|
|
5
|
-
* Objects/arrays are serialized to compact JSON.
|
|
6
|
-
* Returns an empty string when nothing matches or the expression is unrecognised.
|
|
7
|
-
*/
|
|
8
|
-
export declare function evaluateJsonPath(data: unknown, expression: string): string;
|
|
9
|
-
export declare class JsonPathError extends Error {
|
|
10
|
-
constructor(message: string);
|
|
11
|
-
}
|