@uipath/rpa-tool 1.199.0 → 1.199.1
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.js +215 -51
- package/dist/packager-tool.js +302 -17930
- package/dist/tool.js +5455 -22467
- package/package.json +14 -14
package/dist/index.js
CHANGED
|
@@ -2272,6 +2272,7 @@ import { execFile as execFile4, execFileSync } from "node:child_process";
|
|
|
2272
2272
|
import { promisify as promisify5 } from "node:util";
|
|
2273
2273
|
import { execFile as execFile5 } from "node:child_process";
|
|
2274
2274
|
import process7 from "node:process";
|
|
2275
|
+
import { spawn } from "node:child_process";
|
|
2275
2276
|
import { execFileSync as execFileSync2 } from "node:child_process";
|
|
2276
2277
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
2277
2278
|
var __create2 = Object.create;
|
|
@@ -8136,7 +8137,7 @@ function requireOmap() {
|
|
|
8136
8137
|
function resolveYamlOmap(data) {
|
|
8137
8138
|
if (data === null)
|
|
8138
8139
|
return true;
|
|
8139
|
-
const objectKeys =
|
|
8140
|
+
const objectKeys = {};
|
|
8140
8141
|
const object = data;
|
|
8141
8142
|
for (let index = 0, length = object.length;index < length; index += 1) {
|
|
8142
8143
|
const pair = object[index];
|
|
@@ -8154,10 +8155,9 @@ function requireOmap() {
|
|
|
8154
8155
|
}
|
|
8155
8156
|
if (!pairHasKey)
|
|
8156
8157
|
return false;
|
|
8157
|
-
if (
|
|
8158
|
-
objectKeys.push(pairKey);
|
|
8159
|
-
else
|
|
8158
|
+
if (_hasOwnProperty.call(objectKeys, pairKey))
|
|
8160
8159
|
return false;
|
|
8160
|
+
Object.defineProperty(objectKeys, pairKey, { value: true });
|
|
8161
8161
|
}
|
|
8162
8162
|
return true;
|
|
8163
8163
|
}
|
|
@@ -10784,7 +10784,7 @@ function buildCommandTerminalTelemetryProperties(input) {
|
|
|
10784
10784
|
}
|
|
10785
10785
|
var CommonTelemetryEvents = {
|
|
10786
10786
|
Error: "uip.error",
|
|
10787
|
-
ShipSucceeded: "
|
|
10787
|
+
ShipSucceeded: "uip.ship.succeeded"
|
|
10788
10788
|
};
|
|
10789
10789
|
function readRegistryValue(keyPath, valueName) {
|
|
10790
10790
|
if (process.platform !== "win32") {
|
|
@@ -11007,8 +11007,18 @@ function getInboundTraceContext() {
|
|
|
11007
11007
|
return parseInboundTraceparent(getProcessEnv()?.[TELEMETRY_TRACEPARENT_ENV]);
|
|
11008
11008
|
}
|
|
11009
11009
|
var TELEMETRY_SESSION_ID_ENV = "UIPATH_SESSION_ID";
|
|
11010
|
-
var
|
|
11011
|
-
var
|
|
11010
|
+
var SESSION_ID_MAX_LENGTH = 64;
|
|
11011
|
+
var RANDOM_SESSION_ID_LENGTH = 32;
|
|
11012
|
+
var TELEMETRY_SESSION_SOURCE_PROPERTY = "session_id_source";
|
|
11013
|
+
var CONTROL_CHARACTERS = /\p{Cc}/gu;
|
|
11014
|
+
var INHERITED_SESSION_SOURCES = [
|
|
11015
|
+
{ envVar: "CLAUDE_CODE_SESSION_ID", source: "claude-code" },
|
|
11016
|
+
{ envVar: "CODEX_THREAD_ID", source: "codex" },
|
|
11017
|
+
{ envVar: "ANTIGRAVITY_TRAJECTORY_ID", source: "antigravity" },
|
|
11018
|
+
{ envVar: "TERM_SESSION_ID", source: "terminal" },
|
|
11019
|
+
{ envVar: "WT_SESSION", source: "terminal" }
|
|
11020
|
+
];
|
|
11021
|
+
var telemetrySessionSlot = singleton("TelemetrySession");
|
|
11012
11022
|
var telemetryOperationIdSlot = singleton("TelemetryOperationId");
|
|
11013
11023
|
function getProcessEnv2() {
|
|
11014
11024
|
return globalThis.process?.env;
|
|
@@ -11017,27 +11027,45 @@ function normalizeSessionId(value) {
|
|
|
11017
11027
|
if (typeof value !== "string" && typeof value !== "number" && typeof value !== "boolean") {
|
|
11018
11028
|
return;
|
|
11019
11029
|
}
|
|
11020
|
-
const
|
|
11021
|
-
return
|
|
11030
|
+
const cleaned = String(value).replace(CONTROL_CHARACTERS, "").trim().slice(0, SESSION_ID_MAX_LENGTH);
|
|
11031
|
+
return cleaned || undefined;
|
|
11022
11032
|
}
|
|
11023
11033
|
function getConfiguredTelemetrySessionId() {
|
|
11024
11034
|
return normalizeSessionId(getProcessEnv2()?.[TELEMETRY_SESSION_ID_ENV]);
|
|
11025
11035
|
}
|
|
11026
|
-
function
|
|
11027
|
-
const
|
|
11028
|
-
|
|
11029
|
-
|
|
11036
|
+
function getInheritedSession(env) {
|
|
11037
|
+
for (const candidate of INHERITED_SESSION_SOURCES) {
|
|
11038
|
+
const handle = normalizeSessionId(env[candidate.envVar]);
|
|
11039
|
+
if (handle) {
|
|
11040
|
+
return { id: handle, source: candidate.source };
|
|
11041
|
+
}
|
|
11030
11042
|
}
|
|
11031
|
-
|
|
11043
|
+
return;
|
|
11044
|
+
}
|
|
11045
|
+
function generateRandomSession() {
|
|
11046
|
+
const bytes = new Uint8Array(RANDOM_SESSION_ID_LENGTH / 2);
|
|
11047
|
+
crypto.getRandomValues(bytes);
|
|
11048
|
+
let hex = "";
|
|
11049
|
+
for (const byte of bytes) {
|
|
11050
|
+
hex += byte.toString(16).padStart(2, "0");
|
|
11051
|
+
}
|
|
11052
|
+
return { id: hex, source: "random" };
|
|
11053
|
+
}
|
|
11054
|
+
function resolveTelemetrySession() {
|
|
11055
|
+
const existing = telemetrySessionSlot.get();
|
|
11032
11056
|
if (existing) {
|
|
11033
11057
|
return existing;
|
|
11034
11058
|
}
|
|
11035
|
-
const
|
|
11036
|
-
|
|
11037
|
-
|
|
11059
|
+
const declaredHandle = getConfiguredTelemetrySessionId();
|
|
11060
|
+
const resolved = declaredHandle ? { id: declaredHandle, source: "declared" } : getInheritedSession(getProcessEnv2() ?? {}) ?? generateRandomSession();
|
|
11061
|
+
telemetrySessionSlot.set(resolved);
|
|
11062
|
+
return resolved;
|
|
11063
|
+
}
|
|
11064
|
+
function getTelemetrySessionId() {
|
|
11065
|
+
return resolveTelemetrySession().id;
|
|
11038
11066
|
}
|
|
11039
|
-
function
|
|
11040
|
-
return
|
|
11067
|
+
function getTelemetrySessionSource() {
|
|
11068
|
+
return resolveTelemetrySession().source;
|
|
11041
11069
|
}
|
|
11042
11070
|
function getTelemetryOperationId() {
|
|
11043
11071
|
const existing = telemetryOperationIdSlot.get();
|
|
@@ -11285,14 +11313,11 @@ class TelemetryService {
|
|
|
11285
11313
|
}
|
|
11286
11314
|
async trackDependencyOperation(name, type2, fn, properties) {
|
|
11287
11315
|
const parentContext = this.getCurrentContext();
|
|
11288
|
-
|
|
11289
|
-
throw new Error("trackDependencyOperation must be called within a trackRequest block.");
|
|
11290
|
-
}
|
|
11291
|
-
const childContext = {
|
|
11316
|
+
const childContext = parentContext !== undefined ? {
|
|
11292
11317
|
operationId: parentContext.operationId,
|
|
11293
11318
|
parentId: parentContext.id,
|
|
11294
11319
|
id: this.generateId()
|
|
11295
|
-
};
|
|
11320
|
+
} : this.createRequestContext();
|
|
11296
11321
|
const startTime = performance.now();
|
|
11297
11322
|
try {
|
|
11298
11323
|
const result = await this.contextStorage.run(childContext, fn);
|
|
@@ -11313,24 +11338,18 @@ class TelemetryService {
|
|
|
11313
11338
|
}
|
|
11314
11339
|
enrichPropertiesWithContext(properties, context) {
|
|
11315
11340
|
const globalProperties = getGlobalTelemetryProperties();
|
|
11316
|
-
const existingSessionId = properties?.[TELEMETRY_SESSION_ID_PROPERTY] ?? this.defaultProperties?.[TELEMETRY_SESSION_ID_PROPERTY] ?? globalProperties?.[TELEMETRY_SESSION_ID_PROPERTY];
|
|
11317
|
-
const sessionId = resolveTelemetrySessionId(existingSessionId);
|
|
11318
11341
|
const enriched = {
|
|
11319
11342
|
...getExecutionContextTelemetryProperties(),
|
|
11320
11343
|
...globalProperties,
|
|
11321
11344
|
...this.defaultProperties,
|
|
11322
11345
|
...redactProperties(properties ?? {}),
|
|
11346
|
+
[TELEMETRY_SESSION_SOURCE_PROPERTY]: getTelemetrySessionSource(),
|
|
11323
11347
|
...context ? {
|
|
11324
11348
|
[TELEMETRY_OPERATION_ID_PROPERTY]: context.operationId,
|
|
11325
11349
|
...context.parentId !== undefined ? { [TELEMETRY_PARENT_ID_PROPERTY]: context.parentId } : {},
|
|
11326
11350
|
[TELEMETRY_SPAN_ID_PROPERTY]: context.id
|
|
11327
11351
|
} : {}
|
|
11328
11352
|
};
|
|
11329
|
-
if (sessionId === undefined) {
|
|
11330
|
-
delete enriched[TELEMETRY_SESSION_ID_PROPERTY];
|
|
11331
|
-
} else {
|
|
11332
|
-
enriched[TELEMETRY_SESSION_ID_PROPERTY] = sessionId;
|
|
11333
|
-
}
|
|
11334
11353
|
return enriched;
|
|
11335
11354
|
}
|
|
11336
11355
|
generateId() {
|
|
@@ -11412,6 +11431,9 @@ function normalizeFlushCallbackError(response) {
|
|
|
11412
11431
|
}
|
|
11413
11432
|
return extractAppInsightsDumpMessage(text) ?? text;
|
|
11414
11433
|
}
|
|
11434
|
+
function channelInternals(client) {
|
|
11435
|
+
return client.channel;
|
|
11436
|
+
}
|
|
11415
11437
|
function setDefaultAppInsightsEnv(name, value) {
|
|
11416
11438
|
if (process.env[name] === undefined) {
|
|
11417
11439
|
process.env[name] = value;
|
|
@@ -11501,16 +11523,6 @@ class NodeAppInsightsTelemetryProvider {
|
|
|
11501
11523
|
}
|
|
11502
11524
|
return { operationId, parentId, spanId };
|
|
11503
11525
|
}
|
|
11504
|
-
promoteSessionTag(merged, tags) {
|
|
11505
|
-
const client = this.client;
|
|
11506
|
-
if (!client || !merged)
|
|
11507
|
-
return;
|
|
11508
|
-
const sessionId = merged[TELEMETRY_SESSION_ID_PROPERTY];
|
|
11509
|
-
delete merged[TELEMETRY_SESSION_ID_PROPERTY];
|
|
11510
|
-
if (sessionId) {
|
|
11511
|
-
tags[client.context.keys.sessionId] = sessionId;
|
|
11512
|
-
}
|
|
11513
|
-
}
|
|
11514
11526
|
leafTagOverrides(properties) {
|
|
11515
11527
|
const client = this.client;
|
|
11516
11528
|
if (!client)
|
|
@@ -11523,7 +11535,6 @@ class NodeAppInsightsTelemetryProvider {
|
|
|
11523
11535
|
if (spanId) {
|
|
11524
11536
|
tags[keys.operationParentId] = spanId;
|
|
11525
11537
|
}
|
|
11526
|
-
this.promoteSessionTag(properties, tags);
|
|
11527
11538
|
return tags;
|
|
11528
11539
|
}
|
|
11529
11540
|
operationCorrelation(properties) {
|
|
@@ -11538,7 +11549,6 @@ class NodeAppInsightsTelemetryProvider {
|
|
|
11538
11549
|
if (parentId) {
|
|
11539
11550
|
tagOverrides[keys.operationParentId] = parentId;
|
|
11540
11551
|
}
|
|
11541
|
-
this.promoteSessionTag(properties, tagOverrides);
|
|
11542
11552
|
return { tagOverrides, id: spanId };
|
|
11543
11553
|
}
|
|
11544
11554
|
async trackEvent(eventName, properties) {
|
|
@@ -11631,6 +11641,32 @@ class NodeAppInsightsTelemetryProvider {
|
|
|
11631
11641
|
logger.warn(`[AppInsights] flush error (non-fatal): ${error.message}`);
|
|
11632
11642
|
}
|
|
11633
11643
|
}
|
|
11644
|
+
drainPendingEnvelopes() {
|
|
11645
|
+
const client = this.client;
|
|
11646
|
+
if (!client)
|
|
11647
|
+
return;
|
|
11648
|
+
const endpointUrl = client.config?.endpointUrl;
|
|
11649
|
+
if (!endpointUrl)
|
|
11650
|
+
return;
|
|
11651
|
+
const [error, envelopes] = catchError(() => {
|
|
11652
|
+
const channel = channelInternals(client);
|
|
11653
|
+
if (!channel || !Array.isArray(channel._buffer)) {
|
|
11654
|
+
throw new Error("unexpected channel shape");
|
|
11655
|
+
}
|
|
11656
|
+
if (channel._timeoutHandle) {
|
|
11657
|
+
clearTimeout(channel._timeoutHandle);
|
|
11658
|
+
channel._timeoutHandle = undefined;
|
|
11659
|
+
}
|
|
11660
|
+
const buffered = channel._buffer;
|
|
11661
|
+
channel._buffer = [];
|
|
11662
|
+
return buffered;
|
|
11663
|
+
});
|
|
11664
|
+
if (error) {
|
|
11665
|
+
logger.debug("[AppInsights] failed to drain the channel buffer");
|
|
11666
|
+
return;
|
|
11667
|
+
}
|
|
11668
|
+
return { endpointUrl, envelopes };
|
|
11669
|
+
}
|
|
11634
11670
|
async shutdown() {
|
|
11635
11671
|
const client = this.client;
|
|
11636
11672
|
if (client) {
|
|
@@ -11638,6 +11674,19 @@ class NodeAppInsightsTelemetryProvider {
|
|
|
11638
11674
|
if (statsbeatError) {
|
|
11639
11675
|
logger.debug("[AppInsights] failed to shut down Statsbeat");
|
|
11640
11676
|
}
|
|
11677
|
+
const [channelError] = catchError(() => {
|
|
11678
|
+
const channel = channelInternals(client);
|
|
11679
|
+
if (!channel)
|
|
11680
|
+
return;
|
|
11681
|
+
if (channel._timeoutHandle) {
|
|
11682
|
+
clearTimeout(channel._timeoutHandle);
|
|
11683
|
+
channel._timeoutHandle = undefined;
|
|
11684
|
+
}
|
|
11685
|
+
channel._buffer = [];
|
|
11686
|
+
});
|
|
11687
|
+
if (channelError) {
|
|
11688
|
+
logger.debug("[AppInsights] failed to clear the channel buffer");
|
|
11689
|
+
}
|
|
11641
11690
|
}
|
|
11642
11691
|
const appInsights = this.appInsightsModule;
|
|
11643
11692
|
if (appInsights) {
|
|
@@ -11676,6 +11725,29 @@ function isTelemetryDisabled() {
|
|
|
11676
11725
|
const value = process.env.UIPATH_TELEMETRY_DISABLED;
|
|
11677
11726
|
return value === "1" || value === "true";
|
|
11678
11727
|
}
|
|
11728
|
+
var TELEMETRY_DRAIN_ARGV = "__uip-drain-telemetry";
|
|
11729
|
+
var sidecarEntrySlot = singleton("TelemetrySidecarEntry");
|
|
11730
|
+
function getTelemetrySidecarEntry() {
|
|
11731
|
+
return sidecarEntrySlot.get();
|
|
11732
|
+
}
|
|
11733
|
+
var PENDING_SUFFIX = ".json";
|
|
11734
|
+
var WRITE_TEMP_SUFFIX = ".tmp";
|
|
11735
|
+
var MAX_SPOOL_AGE_MS = 72 * 60 * 60 * 1000;
|
|
11736
|
+
function getTelemetrySpoolDir() {
|
|
11737
|
+
const fs7 = getFileSystem();
|
|
11738
|
+
return fs7.path.join(fs7.env.homedir(), ".uipath", "telemetry", "pending");
|
|
11739
|
+
}
|
|
11740
|
+
async function writeTelemetrySpoolFile(payload) {
|
|
11741
|
+
const fs7 = getFileSystem();
|
|
11742
|
+
const dir = getTelemetrySpoolDir();
|
|
11743
|
+
await fs7.mkdir(dir);
|
|
11744
|
+
const name = `${Date.now()}-${process.pid}`;
|
|
11745
|
+
const finalPath = fs7.path.join(dir, `${name}${PENDING_SUFFIX}`);
|
|
11746
|
+
const tempPath = fs7.path.join(dir, `${name}${WRITE_TEMP_SUFFIX}`);
|
|
11747
|
+
await fs7.writeFile(tempPath, JSON.stringify(payload));
|
|
11748
|
+
await fs7.rename(tempPath, finalPath);
|
|
11749
|
+
return finalPath;
|
|
11750
|
+
}
|
|
11679
11751
|
var telemetryInstanceSlot = singleton("TelemetryService");
|
|
11680
11752
|
var DEFAULT_AI_CONNECTION_STRING = atob("SW5zdHJ1bWVudGF0aW9uS2V5PTliZDM3NDgyLTgxMGUtNDQyYS1hYWE2LWQzOGVmNjVjNjY3NDtJbmdlc3Rpb25FbmRwb2ludD1odHRwczovL3dlc3RldXJvcGUtNS5pbi5hcHBsaWNhdGlvbmluc2lnaHRzLmF6dXJlLmNvbS87TGl2ZUVuZHBvaW50PWh0dHBzOi8vd2VzdGV1cm9wZS5saXZlZGlhZ25vc3RpY3MubW9uaXRvci5henVyZS5jb20vO0FwcGxpY2F0aW9uSWQ9MzU2OTdlZjEtOGJkMC00ZjE5LWEyN2MtZDg3Y2NhYzY2ZDJj");
|
|
11681
11753
|
function getConnectionString() {
|
|
@@ -11768,6 +11840,56 @@ async function runWithTimeout(operation, timeoutMs) {
|
|
|
11768
11840
|
clearTimeout(timer);
|
|
11769
11841
|
}
|
|
11770
11842
|
}
|
|
11843
|
+
async function runProviderShutdown(provider) {
|
|
11844
|
+
const [shutdownError, shutdownResult] = await catchError(runWithTimeout(provider.shutdown(), FLUSH_SHUTDOWN_TIMEOUT_MS));
|
|
11845
|
+
if (shutdownError) {
|
|
11846
|
+
logger.warn(`[Telemetry] shutdown failed (non-fatal): ${shutdownError.message}`);
|
|
11847
|
+
} else if (shutdownResult === "timeout") {
|
|
11848
|
+
logger.warn(`[Telemetry] shutdown timed out after ${FLUSH_SHUTDOWN_TIMEOUT_MS}ms`);
|
|
11849
|
+
}
|
|
11850
|
+
}
|
|
11851
|
+
function isSyncFlushForced() {
|
|
11852
|
+
const value = process.env.UIPATH_TELEMETRY_SYNC_FLUSH;
|
|
11853
|
+
return value === "1" || value === "true";
|
|
11854
|
+
}
|
|
11855
|
+
function isDrainableTelemetryProvider(provider) {
|
|
11856
|
+
return "drainPendingEnvelopes" in provider && typeof provider.drainPendingEnvelopes === "function";
|
|
11857
|
+
}
|
|
11858
|
+
function spawnTelemetrySidecar(entryPath) {
|
|
11859
|
+
const child = spawn(process.execPath, [entryPath, TELEMETRY_DRAIN_ARGV], {
|
|
11860
|
+
cwd: getFileSystem().env.tmpdir(),
|
|
11861
|
+
detached: true,
|
|
11862
|
+
stdio: "ignore",
|
|
11863
|
+
windowsHide: true
|
|
11864
|
+
});
|
|
11865
|
+
child.on("error", (error) => {
|
|
11866
|
+
logger.debug(`[Telemetry] sidecar spawn failed (spool kept for a later run): ${error.message}`);
|
|
11867
|
+
});
|
|
11868
|
+
child.unref();
|
|
11869
|
+
}
|
|
11870
|
+
async function trySidecarHandoff(provider) {
|
|
11871
|
+
const entryPath = getTelemetrySidecarEntry();
|
|
11872
|
+
if (entryPath === undefined || isSyncFlushForced() || !isDrainableTelemetryProvider(provider)) {
|
|
11873
|
+
return false;
|
|
11874
|
+
}
|
|
11875
|
+
const pending = provider.drainPendingEnvelopes();
|
|
11876
|
+
if (!pending) {
|
|
11877
|
+
return false;
|
|
11878
|
+
}
|
|
11879
|
+
if (pending.envelopes.length > 0) {
|
|
11880
|
+
const [spoolError] = await catchError(writeTelemetrySpoolFile(pending));
|
|
11881
|
+
if (spoolError) {
|
|
11882
|
+
logger.debug(`[Telemetry] spool write failed; dropping ${pending.envelopes.length} pending envelope(s): ${spoolError.message}`);
|
|
11883
|
+
} else {
|
|
11884
|
+
const [spawnError] = catchError(() => spawnTelemetrySidecar(entryPath));
|
|
11885
|
+
if (spawnError) {
|
|
11886
|
+
logger.debug(`[Telemetry] sidecar spawn failed; spool will be sent by a future run: ${spawnError.message}`);
|
|
11887
|
+
}
|
|
11888
|
+
}
|
|
11889
|
+
}
|
|
11890
|
+
await runProviderShutdown(provider);
|
|
11891
|
+
return true;
|
|
11892
|
+
}
|
|
11771
11893
|
async function telemetryFlushAndShutdown() {
|
|
11772
11894
|
if (!isFlushableTelemetryProvider(telemetryProviderInstance)) {
|
|
11773
11895
|
return;
|
|
@@ -11775,18 +11897,16 @@ async function telemetryFlushAndShutdown() {
|
|
|
11775
11897
|
if (!telemetryFlushShutdownPromise) {
|
|
11776
11898
|
const provider = telemetryProviderInstance;
|
|
11777
11899
|
telemetryFlushShutdownPromise = (async () => {
|
|
11900
|
+
if (await trySidecarHandoff(provider)) {
|
|
11901
|
+
return;
|
|
11902
|
+
}
|
|
11778
11903
|
const [flushError, flushResult] = await catchError(runWithTimeout(provider.flush(), FLUSH_SHUTDOWN_TIMEOUT_MS));
|
|
11779
11904
|
if (flushError) {
|
|
11780
11905
|
logger.warn(`[Telemetry] flush failed (non-fatal): ${flushError.message}`);
|
|
11781
11906
|
} else if (flushResult === "timeout") {
|
|
11782
11907
|
logger.warn(`[Telemetry] flush timed out after ${FLUSH_SHUTDOWN_TIMEOUT_MS}ms`);
|
|
11783
11908
|
}
|
|
11784
|
-
|
|
11785
|
-
if (shutdownError) {
|
|
11786
|
-
logger.warn(`[Telemetry] shutdown failed (non-fatal): ${shutdownError.message}`);
|
|
11787
|
-
} else if (shutdownResult === "timeout") {
|
|
11788
|
-
logger.warn(`[Telemetry] shutdown timed out after ${FLUSH_SHUTDOWN_TIMEOUT_MS}ms`);
|
|
11789
|
-
}
|
|
11909
|
+
await runProviderShutdown(provider);
|
|
11790
11910
|
})();
|
|
11791
11911
|
}
|
|
11792
11912
|
await telemetryFlushShutdownPromise;
|
|
@@ -12140,6 +12260,19 @@ class FilterEvaluationError extends Error {
|
|
|
12140
12260
|
this.instructions = `The --output-filter expression '${filter}' failed at evaluation time. ` + "Note that --output-filter operates on the 'Data' field of the envelope, not the full object. " + "For example, on a list result use 'length(@)' instead of 'Data | length(@)'.";
|
|
12141
12261
|
}
|
|
12142
12262
|
}
|
|
12263
|
+
|
|
12264
|
+
class FilterImplicitLimitError extends Error {
|
|
12265
|
+
__brand = "FilterImplicitLimitError";
|
|
12266
|
+
errorCode = "invalid_argument";
|
|
12267
|
+
instructions;
|
|
12268
|
+
retry = "RetryWillNotFix";
|
|
12269
|
+
result = RESULTS.ValidationError;
|
|
12270
|
+
constructor(defaultLimit) {
|
|
12271
|
+
super(`--output-filter requires an explicit --limit: this command defaults to --limit ${defaultLimit}, ` + `so the filter would silently apply to only the first ${defaultLimit} records.`);
|
|
12272
|
+
this.name = "FilterImplicitLimitError";
|
|
12273
|
+
this.instructions = "Pass --limit <n> to choose how many records the filter applies to. " + "To filter over all records, pass the command's maximum accepted --limit (see the option's description in --help).";
|
|
12274
|
+
}
|
|
12275
|
+
}
|
|
12143
12276
|
function applyFilter(data, filter) {
|
|
12144
12277
|
let result;
|
|
12145
12278
|
try {
|
|
@@ -12530,6 +12663,16 @@ function commandHelpHint(commandPath) {
|
|
|
12530
12663
|
function isPromptCancellation(error) {
|
|
12531
12664
|
return error instanceof Error && error.name === "ExitPromptError";
|
|
12532
12665
|
}
|
|
12666
|
+
function implicitLimitViolation(cmd) {
|
|
12667
|
+
if (getOutputFilter() === undefined) {
|
|
12668
|
+
return;
|
|
12669
|
+
}
|
|
12670
|
+
const hasLimit = cmd.options.some((o) => o.attributeName() === "limit");
|
|
12671
|
+
if (!hasLimit || cmd.getOptionValueSource("limit") !== "default") {
|
|
12672
|
+
return;
|
|
12673
|
+
}
|
|
12674
|
+
return new FilterImplicitLimitError(String(cmd.opts().limit));
|
|
12675
|
+
}
|
|
12533
12676
|
function exitCodeFromProcess(fallback) {
|
|
12534
12677
|
return typeof process.exitCode === "number" ? process.exitCode : fallback;
|
|
12535
12678
|
}
|
|
@@ -12543,7 +12686,13 @@ Command2.prototype.trackedAction = function(context, fn, properties) {
|
|
|
12543
12686
|
let errorMessage;
|
|
12544
12687
|
let fallbackExitCode = EXIT_CODES.Success;
|
|
12545
12688
|
clearRecordedCommandFailureTelemetry();
|
|
12546
|
-
const [error] = await catchError(telemetry.runWithContext(requestContext, () =>
|
|
12689
|
+
const [error] = await catchError(telemetry.runWithContext(requestContext, () => {
|
|
12690
|
+
const violation = implicitLimitViolation(command);
|
|
12691
|
+
if (violation) {
|
|
12692
|
+
return Promise.reject(violation);
|
|
12693
|
+
}
|
|
12694
|
+
return fn(...args);
|
|
12695
|
+
}));
|
|
12547
12696
|
if (error) {
|
|
12548
12697
|
errorMessage = error instanceof Error ? error.message : String(error);
|
|
12549
12698
|
logger.debug(`[trackedAction] ${telemetryName} failed: ${errorMessage}`);
|
|
@@ -12599,6 +12748,20 @@ Command2.prototype.trackedAction = function(context, fn, properties) {
|
|
|
12599
12748
|
var guardInstalledSlot = singleton("ConsoleGuardInstalled");
|
|
12600
12749
|
var savedOriginalsSlot = singleton("ConsoleGuardOriginals");
|
|
12601
12750
|
var DEFAULT_AUTH_TIMEOUT_MS = 5 * 60 * 1000;
|
|
12751
|
+
var HOST_GLOBAL_OPTIONS_WITH_VALUE = [
|
|
12752
|
+
"--output",
|
|
12753
|
+
"--output-filter",
|
|
12754
|
+
"--log-level",
|
|
12755
|
+
"--log-file",
|
|
12756
|
+
"--profile"
|
|
12757
|
+
];
|
|
12758
|
+
var HOST_GLOBAL_FLAGS = [
|
|
12759
|
+
"--json",
|
|
12760
|
+
"--interactive",
|
|
12761
|
+
"--no-interactive"
|
|
12762
|
+
];
|
|
12763
|
+
var VALUE_OPTIONS = new Set(HOST_GLOBAL_OPTIONS_WITH_VALUE);
|
|
12764
|
+
var BOOLEAN_FLAGS = new Set(HOST_GLOBAL_FLAGS);
|
|
12602
12765
|
var modeSlot = singleton("InteractivityMode");
|
|
12603
12766
|
var interactiveFlagSlot = singleton("InteractiveFlag");
|
|
12604
12767
|
var PollOutcome = {
|
|
@@ -12650,8 +12813,9 @@ var ScreenLogger;
|
|
|
12650
12813
|
ScreenLogger2.progress = progress;
|
|
12651
12814
|
})(ScreenLogger ||= {});
|
|
12652
12815
|
var sdkUserAgentHostToken = singleton("SdkUserAgentHostToken");
|
|
12653
|
-
var shippedKeysSlot = singleton("ShipSucceededDedupeKeys");
|
|
12654
12816
|
var factorySlot = singleton("PackagerFactoryProvider");
|
|
12817
|
+
var moduleSlot = singleton("ToolModuleProvider");
|
|
12818
|
+
var shippedKeysSlot = singleton("ShipSucceededDedupeKeys");
|
|
12655
12819
|
|
|
12656
12820
|
// src/argv.ts
|
|
12657
12821
|
function extractArg(argv, name, defaultValue) {
|