@uipath/common 1.195.0 → 1.196.0
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/confirmation.d.ts +28 -0
- package/dist/content-hash.d.ts +8 -0
- package/dist/error-handler.d.ts +5 -1
- package/dist/formatter.d.ts +9 -1
- package/dist/index.browser.d.ts +2 -0
- package/dist/index.browser.js +17894 -48
- package/dist/index.d.ts +5 -0
- package/dist/index.js +3274 -2903
- package/dist/interactivity-context.d.ts +33 -0
- package/dist/package-metadata-options.d.ts +36 -0
- package/dist/package-metadata-options.js +27 -0
- package/dist/stdin.d.ts +1 -0
- package/dist/telemetry/global-telemetry-properties.d.ts +8 -0
- package/dist/telemetry/index.js +38 -1
- package/dist/telemetry/node-appinsights-telemetry-provider.d.ts +1 -2
- package/dist/telemetry/telemetry-service.d.ts +9 -1
- package/package.json +6 -2
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Process-wide interactivity mode.
|
|
3
|
+
*
|
|
4
|
+
* The CLI is non-interactive by default: an automation agent or CI runner can
|
|
5
|
+
* never answer a `y/N` prompt, so a hidden prompt hangs the caller forever.
|
|
6
|
+
* Commands consult {@link canPrompt} before showing any optional/selection
|
|
7
|
+
* prompt; when it returns `false` they must fall back to a flag-driven path or
|
|
8
|
+
* fail fast with a structured error naming the flag to pass.
|
|
9
|
+
*
|
|
10
|
+
* Modes:
|
|
11
|
+
* - "never" — never prompt (the default; the safe machine-first contract).
|
|
12
|
+
* - "auto" — prompt only when stdout is a TTY (opt-in via config for humans).
|
|
13
|
+
* - "always" — always prompt (assume a prompt-capable terminal).
|
|
14
|
+
*
|
|
15
|
+
* Stored via {@link singleton} so the value set once by the CLI host is visible
|
|
16
|
+
* from every tool bundle's own copy of `@uipath/common`.
|
|
17
|
+
*
|
|
18
|
+
* Note: destructive confirmation does NOT use this — it is flag-only and
|
|
19
|
+
* fail-closed (see `confirmation.ts`). Interactivity governs *optional* prompts.
|
|
20
|
+
*/
|
|
21
|
+
export type InteractivityMode = "never" | "auto" | "always";
|
|
22
|
+
/** Set the process-wide interactivity mode. Called once at CLI startup. */
|
|
23
|
+
export declare function setInteractivityMode(mode: InteractivityMode): void;
|
|
24
|
+
/** Get the current interactivity mode, defaulting to "never". */
|
|
25
|
+
export declare function getInteractivityMode(): InteractivityMode;
|
|
26
|
+
/**
|
|
27
|
+
* True when the CLI may show an interactive prompt right now.
|
|
28
|
+
*
|
|
29
|
+
* "always" always prompts; "never" never does; "auto" prompts only when the
|
|
30
|
+
* output sink reports an interactive (TTY) terminal — the canonical signal also
|
|
31
|
+
* used by `login` and `completion`.
|
|
32
|
+
*/
|
|
33
|
+
export declare function canPrompt(): boolean;
|
|
@@ -0,0 +1,36 @@
|
|
|
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
|
+
repositoryUrl?: string;
|
|
12
|
+
repositoryCommit?: string;
|
|
13
|
+
repositoryBranch?: string;
|
|
14
|
+
repositoryType?: string;
|
|
15
|
+
releaseNotes?: string;
|
|
16
|
+
projectUrl?: string;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Subset of `NugetPackageInfo` fields produced from the metadata options.
|
|
20
|
+
* Only defined fields are present so spreading this into a package literal
|
|
21
|
+
* never clobbers existing defaults with `undefined`.
|
|
22
|
+
*/
|
|
23
|
+
export type PackageMetadataFields = PackageMetadataCliOptions;
|
|
24
|
+
/**
|
|
25
|
+
* Register the shared package-metadata options on a commander command.
|
|
26
|
+
* Returns the command for chaining.
|
|
27
|
+
*/
|
|
28
|
+
export declare function registerPackageMetadataOptions(command: Command): Command;
|
|
29
|
+
/**
|
|
30
|
+
* Map parsed metadata options to the `NugetPackageInfo` fields the packager
|
|
31
|
+
* understands. Returns only fields the user actually supplied, and defaults
|
|
32
|
+
* `repositoryType` to `"git"` when a `repositoryUrl` is given but no type —
|
|
33
|
+
* the nuspec generator only emits the `<repository>` element when both type
|
|
34
|
+
* and url are present.
|
|
35
|
+
*/
|
|
36
|
+
export declare function mapPackageMetadataOptions(opts: PackageMetadataCliOptions): PackageMetadataFields;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
// src/package-metadata-options.ts
|
|
2
|
+
function registerPackageMetadataOptions(command) {
|
|
3
|
+
return command.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.releaseNotes !== undefined)
|
|
8
|
+
fields.releaseNotes = opts.releaseNotes;
|
|
9
|
+
if (opts.projectUrl !== undefined)
|
|
10
|
+
fields.projectUrl = opts.projectUrl;
|
|
11
|
+
if (opts.repositoryUrl !== undefined)
|
|
12
|
+
fields.repositoryUrl = opts.repositoryUrl;
|
|
13
|
+
if (opts.repositoryCommit !== undefined)
|
|
14
|
+
fields.repositoryCommit = opts.repositoryCommit;
|
|
15
|
+
if (opts.repositoryBranch !== undefined)
|
|
16
|
+
fields.repositoryBranch = opts.repositoryBranch;
|
|
17
|
+
if (opts.repositoryType !== undefined)
|
|
18
|
+
fields.repositoryType = opts.repositoryType;
|
|
19
|
+
if (fields.repositoryUrl !== undefined && fields.repositoryType === undefined) {
|
|
20
|
+
fields.repositoryType = "git";
|
|
21
|
+
}
|
|
22
|
+
return fields;
|
|
23
|
+
}
|
|
24
|
+
export {
|
|
25
|
+
registerPackageMetadataOptions,
|
|
26
|
+
mapPackageMetadataOptions
|
|
27
|
+
};
|
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
|
|
@@ -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).
|
|
@@ -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.196.0",
|
|
5
5
|
"description": "Common infrastructure needed by uip tools.",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -28,6 +28,10 @@
|
|
|
28
28
|
"types": "./dist/sdk-user-agent.d.ts",
|
|
29
29
|
"default": "./dist/sdk-user-agent.js"
|
|
30
30
|
},
|
|
31
|
+
"./package-metadata-options": {
|
|
32
|
+
"types": "./dist/package-metadata-options.d.ts",
|
|
33
|
+
"default": "./dist/package-metadata-options.js"
|
|
34
|
+
},
|
|
31
35
|
"./telemetry": {
|
|
32
36
|
"types": "./dist/telemetry/index.d.ts",
|
|
33
37
|
"default": "./dist/telemetry/index.js"
|
|
@@ -41,5 +45,5 @@
|
|
|
41
45
|
"mihaigirleanu",
|
|
42
46
|
"vlad-uipath"
|
|
43
47
|
],
|
|
44
|
-
"gitHead": "
|
|
48
|
+
"gitHead": "94d71f9c52214980a1f0ae62b3f5372095788553"
|
|
45
49
|
}
|