@uipath/uipath-python-bridge 1.206.0-preview.303 → 1.207.0-preview.305
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 +370 -194
- package/package.json +2 -7
package/dist/index.js
CHANGED
|
@@ -740,12 +740,26 @@ class NodeFileSystem {
|
|
|
740
740
|
throw error;
|
|
741
741
|
}
|
|
742
742
|
}
|
|
743
|
-
async writeFile(filePath, data) {
|
|
743
|
+
async writeFile(filePath, data, options) {
|
|
744
744
|
const dir = path2.dirname(filePath);
|
|
745
745
|
if (dir) {
|
|
746
746
|
await fs6.mkdir(dir, { recursive: true });
|
|
747
747
|
}
|
|
748
|
-
|
|
748
|
+
if (options?.mode === undefined || process.platform === "win32") {
|
|
749
|
+
if (options?.exclusive) {
|
|
750
|
+
await fs6.writeFile(filePath, data, { flag: "wx" });
|
|
751
|
+
} else {
|
|
752
|
+
await fs6.writeFile(filePath, data);
|
|
753
|
+
}
|
|
754
|
+
return;
|
|
755
|
+
}
|
|
756
|
+
const handle = await fs6.open(filePath, options.exclusive ? "wx" : "w", options.mode);
|
|
757
|
+
try {
|
|
758
|
+
await handle.chmod(options.mode);
|
|
759
|
+
await handle.writeFile(data);
|
|
760
|
+
} finally {
|
|
761
|
+
await handle.close();
|
|
762
|
+
}
|
|
749
763
|
}
|
|
750
764
|
async appendFile(filePath, data) {
|
|
751
765
|
const dir = path2.dirname(filePath);
|
|
@@ -780,7 +794,8 @@ class NodeFileSystem {
|
|
|
780
794
|
isDirectory: () => stats.isDirectory(),
|
|
781
795
|
size: stats.size,
|
|
782
796
|
mtimeMs: stats.mtimeMs,
|
|
783
|
-
ctimeMs: stats.ctimeMs
|
|
797
|
+
ctimeMs: stats.ctimeMs,
|
|
798
|
+
mode: stats.mode
|
|
784
799
|
};
|
|
785
800
|
} catch (error) {
|
|
786
801
|
if (this.isEnoent(error))
|
|
@@ -791,8 +806,13 @@ class NodeFileSystem {
|
|
|
791
806
|
async exists(filePath) {
|
|
792
807
|
return existsSync(filePath);
|
|
793
808
|
}
|
|
794
|
-
async mkdir(dirPath) {
|
|
795
|
-
await fs6.mkdir(dirPath, { recursive: true });
|
|
809
|
+
async mkdir(dirPath, options) {
|
|
810
|
+
await fs6.mkdir(dirPath, { recursive: true, mode: options?.mode });
|
|
811
|
+
}
|
|
812
|
+
async chmod(targetPath, mode) {
|
|
813
|
+
if (process.platform === "win32")
|
|
814
|
+
return;
|
|
815
|
+
await fs6.chmod(targetPath, mode);
|
|
796
816
|
}
|
|
797
817
|
async acquireLock(lockPath) {
|
|
798
818
|
const canonicalPath = await this.canonicalizeLockTarget(lockPath);
|
|
@@ -942,7 +962,7 @@ class NodeFileSystem {
|
|
|
942
962
|
async getTempDir() {
|
|
943
963
|
return await fs6.mkdtemp(path2.join(os2.tmpdir(), "uipath-fs-"));
|
|
944
964
|
}
|
|
945
|
-
async copyDirectory(sourcePath, destPath) {
|
|
965
|
+
async copyDirectory(sourcePath, destPath, options) {
|
|
946
966
|
const sourceStats = await this.stat(sourcePath);
|
|
947
967
|
if (!sourceStats) {
|
|
948
968
|
throw new Error(`Source directory does not exist: ${sourcePath}`);
|
|
@@ -959,7 +979,9 @@ class NodeFileSystem {
|
|
|
959
979
|
if (!entryStats)
|
|
960
980
|
continue;
|
|
961
981
|
if (entryStats.isDirectory()) {
|
|
962
|
-
|
|
982
|
+
if (options?.skipDirectoryNames?.includes(entry))
|
|
983
|
+
continue;
|
|
984
|
+
await this.copyDirectory(srcEntry, destEntry, options);
|
|
963
985
|
} else if (entryStats.isFile()) {
|
|
964
986
|
const content = await this.readFile(srcEntry);
|
|
965
987
|
if (content !== null) {
|
|
@@ -7677,7 +7699,7 @@ function settlePromiseLike2(thenable) {
|
|
|
7677
7699
|
}
|
|
7678
7700
|
|
|
7679
7701
|
// ../auth/src/constants.ts
|
|
7680
|
-
var UIPATH_HOME_DIR2 = ".uipath", AUTH_FILENAME = ".auth", DEFAULT_BASE_URL = "https://cloud.uipath.com", DEFAULT_AUTH_TIMEOUT_MS2;
|
|
7702
|
+
var UIPATH_HOME_DIR2 = ".uipath", AUTH_FILENAME = ".auth", AUTH_FILE_MODE = 384, AUTH_DIR_MODE = 448, DEFAULT_BASE_URL = "https://cloud.uipath.com", DEFAULT_AUTH_TIMEOUT_MS2;
|
|
7681
7703
|
var init_constants = __esm(() => {
|
|
7682
7704
|
DEFAULT_AUTH_TIMEOUT_MS2 = 5 * 60 * 1000;
|
|
7683
7705
|
});
|
|
@@ -7732,13 +7754,15 @@ var ProjectDimensions = {
|
|
|
7732
7754
|
SolutionKey: "SolutionKey",
|
|
7733
7755
|
SolutionProjectKey: "SolutionProjectKey",
|
|
7734
7756
|
SolutionIdentityStatus: "SolutionIdentityStatus",
|
|
7735
|
-
PreviousSolutionKey: "PreviousSolutionKey"
|
|
7757
|
+
PreviousSolutionKey: "PreviousSolutionKey",
|
|
7758
|
+
PreviousProjectKey: "PreviousProjectKey"
|
|
7736
7759
|
};
|
|
7737
7760
|
var GUID_KEY_DIMENSIONS = new Set([
|
|
7738
7761
|
ProjectDimensions.ProjectKey,
|
|
7739
7762
|
ProjectDimensions.SolutionKey,
|
|
7740
7763
|
ProjectDimensions.SolutionProjectKey,
|
|
7741
|
-
ProjectDimensions.PreviousSolutionKey
|
|
7764
|
+
ProjectDimensions.PreviousSolutionKey,
|
|
7765
|
+
ProjectDimensions.PreviousProjectKey
|
|
7742
7766
|
]);
|
|
7743
7767
|
var ShipDimensions = {
|
|
7744
7768
|
ShipKind: "ShipKind",
|
|
@@ -7892,9 +7916,7 @@ async function withinProjectIdentityBudget(work, onTimeout) {
|
|
|
7892
7916
|
}
|
|
7893
7917
|
}
|
|
7894
7918
|
|
|
7895
|
-
// ../common/src/
|
|
7896
|
-
var PSEUDONYM_DOMAIN = "uipath-cli/telemetry/pseudonym/v1:";
|
|
7897
|
-
var PSEUDONYM_HEX_LENGTH = 32;
|
|
7919
|
+
// ../common/src/sha256.ts
|
|
7898
7920
|
var SHA256_K = new Uint32Array([
|
|
7899
7921
|
1116352408,
|
|
7900
7922
|
1899447441,
|
|
@@ -7974,7 +7996,7 @@ var SHA256_INITIAL_STATE = new Uint32Array([
|
|
|
7974
7996
|
function rotr(value, bits) {
|
|
7975
7997
|
return (value >>> bits | value << 32 - bits) >>> 0;
|
|
7976
7998
|
}
|
|
7977
|
-
function
|
|
7999
|
+
function sha256Words(input) {
|
|
7978
8000
|
const bytes = new TextEncoder().encode(input);
|
|
7979
8001
|
const paddedLength = bytes.length + 9 + 63 >> 6 << 6;
|
|
7980
8002
|
const buffer = new Uint8Array(paddedLength);
|
|
@@ -8030,12 +8052,19 @@ function sha256Hex(input) {
|
|
|
8030
8052
|
state[6] = state[6] + g >>> 0;
|
|
8031
8053
|
state[7] = state[7] + h >>> 0;
|
|
8032
8054
|
}
|
|
8055
|
+
return state;
|
|
8056
|
+
}
|
|
8057
|
+
function sha256Hex(input) {
|
|
8033
8058
|
let hex = "";
|
|
8034
|
-
for (const word of
|
|
8059
|
+
for (const word of sha256Words(input)) {
|
|
8035
8060
|
hex += word.toString(16).padStart(8, "0");
|
|
8036
8061
|
}
|
|
8037
8062
|
return hex;
|
|
8038
8063
|
}
|
|
8064
|
+
|
|
8065
|
+
// ../common/src/telemetry/pseudonymize.ts
|
|
8066
|
+
var PSEUDONYM_DOMAIN = "uipath-cli/telemetry/pseudonym/v1:";
|
|
8067
|
+
var PSEUDONYM_HEX_LENGTH = 32;
|
|
8039
8068
|
function resolveSha256Hex() {
|
|
8040
8069
|
try {
|
|
8041
8070
|
const nodeCrypto = __require("node:crypto");
|
|
@@ -8431,13 +8460,25 @@ function settlePromiseLike(thenable) {
|
|
|
8431
8460
|
return Promise.resolve(thenable).then((data) => [undefined, data]).catch((error) => [toError(error), undefined]);
|
|
8432
8461
|
}
|
|
8433
8462
|
|
|
8463
|
+
// ../common/src/result-types.ts
|
|
8464
|
+
var RESULTS = {
|
|
8465
|
+
Success: "Success",
|
|
8466
|
+
Failure: "Failure",
|
|
8467
|
+
ConfigError: "ConfigError",
|
|
8468
|
+
AuthenticationError: "AuthenticationError",
|
|
8469
|
+
ValidationError: "ValidationError",
|
|
8470
|
+
TimeoutError: "TimeoutError"
|
|
8471
|
+
};
|
|
8472
|
+
|
|
8434
8473
|
// ../common/src/error-codes.ts
|
|
8435
8474
|
var CLI_ERROR_CODES = [
|
|
8436
8475
|
"invalid_argument",
|
|
8476
|
+
"confirmation_required",
|
|
8437
8477
|
"authentication_required",
|
|
8438
8478
|
"permission_denied",
|
|
8439
8479
|
"local_permission_denied",
|
|
8440
8480
|
"not_found",
|
|
8481
|
+
"not_enabled",
|
|
8441
8482
|
"rate_limited",
|
|
8442
8483
|
"network_error",
|
|
8443
8484
|
"timeout",
|
|
@@ -8476,6 +8517,12 @@ function carriedRetry(error) {
|
|
|
8476
8517
|
const retry = error.retry;
|
|
8477
8518
|
return isRetryHint(retry) ? retry : undefined;
|
|
8478
8519
|
}
|
|
8520
|
+
function carriedResult(error) {
|
|
8521
|
+
if (!error || typeof error !== "object")
|
|
8522
|
+
return;
|
|
8523
|
+
const result = error.result;
|
|
8524
|
+
return typeof result === "string" && result !== RESULTS.Success && Object.values(RESULTS).includes(result) ? result : undefined;
|
|
8525
|
+
}
|
|
8479
8526
|
function defaultRetryForErrorCode(errorCode) {
|
|
8480
8527
|
switch (errorCode) {
|
|
8481
8528
|
case "network_error":
|
|
@@ -8865,6 +8912,8 @@ async function extractErrorDetails(error, options) {
|
|
|
8865
8912
|
}
|
|
8866
8913
|
if (parsedBody?.errorCode && typeof parsedBody.errorCode === "string") {
|
|
8867
8914
|
context.errorCode = parsedBody.errorCode;
|
|
8915
|
+
} else if (typeof parsedBody?.errorCode === "number") {
|
|
8916
|
+
context.errorCode = String(parsedBody.errorCode);
|
|
8868
8917
|
} else if (parsedBody?.code && typeof parsedBody.code === "string") {
|
|
8869
8918
|
context.errorCode = parsedBody.code;
|
|
8870
8919
|
}
|
|
@@ -8921,15 +8970,6 @@ async function extractErrorDetails(error, options) {
|
|
|
8921
8970
|
...parsedErrors ? { parsedErrors } : {}
|
|
8922
8971
|
};
|
|
8923
8972
|
}
|
|
8924
|
-
// ../common/src/result-types.ts
|
|
8925
|
-
var RESULTS = {
|
|
8926
|
-
Success: "Success",
|
|
8927
|
-
Failure: "Failure",
|
|
8928
|
-
ConfigError: "ConfigError",
|
|
8929
|
-
AuthenticationError: "AuthenticationError",
|
|
8930
|
-
ValidationError: "ValidationError",
|
|
8931
|
-
TimeoutError: "TimeoutError"
|
|
8932
|
-
};
|
|
8933
8973
|
// ../../node_modules/commander/index.js
|
|
8934
8974
|
var exports_commander = {};
|
|
8935
8975
|
__exportCjs(exports_commander, {
|
|
@@ -9371,7 +9411,10 @@ var AUTH_ERROR_CODES = new Set([
|
|
|
9371
9411
|
var LOCAL_PERMISSION_CLI_ERROR_CODES = new Set([
|
|
9372
9412
|
"local_permission_denied"
|
|
9373
9413
|
]);
|
|
9374
|
-
var VALIDATION_ERROR_CODES = new Set([
|
|
9414
|
+
var VALIDATION_ERROR_CODES = new Set([
|
|
9415
|
+
"invalid_argument",
|
|
9416
|
+
"confirmation_required"
|
|
9417
|
+
]);
|
|
9375
9418
|
var NETWORK_HTTP_ERROR_CODES = new Set([
|
|
9376
9419
|
"network_error",
|
|
9377
9420
|
"rate_limited",
|
|
@@ -9600,6 +9643,109 @@ var CommonTelemetryEvents = {
|
|
|
9600
9643
|
// ../common/src/telemetry/telemetry-init.ts
|
|
9601
9644
|
init_src();
|
|
9602
9645
|
|
|
9646
|
+
// ../common/src/telemetry/global-telemetry-properties.ts
|
|
9647
|
+
var telemetryPropsSlot = singleton("TelemetryDefaultProps");
|
|
9648
|
+
function getGlobalTelemetryProperties() {
|
|
9649
|
+
return telemetryPropsSlot.get();
|
|
9650
|
+
}
|
|
9651
|
+
|
|
9652
|
+
// ../common/src/telemetry/trace-context.ts
|
|
9653
|
+
var TELEMETRY_TRACEPARENT_ENV = "TRACEPARENT";
|
|
9654
|
+
var TRACEPARENT_PATTERN = /^00-([0-9a-f]{32})-([0-9a-f]{16})-[0-9a-f]{2}$/;
|
|
9655
|
+
function getProcessEnv() {
|
|
9656
|
+
return globalThis.process?.env;
|
|
9657
|
+
}
|
|
9658
|
+
function parseInboundTraceparent(value) {
|
|
9659
|
+
if (!value) {
|
|
9660
|
+
return;
|
|
9661
|
+
}
|
|
9662
|
+
const match = TRACEPARENT_PATTERN.exec(value.trim().toLowerCase());
|
|
9663
|
+
if (!match) {
|
|
9664
|
+
return;
|
|
9665
|
+
}
|
|
9666
|
+
const [, traceId, parentSpanId] = match;
|
|
9667
|
+
if (/^0+$/.test(traceId) || /^0+$/.test(parentSpanId)) {
|
|
9668
|
+
return;
|
|
9669
|
+
}
|
|
9670
|
+
return { traceId, parentSpanId };
|
|
9671
|
+
}
|
|
9672
|
+
function getInboundTraceContext() {
|
|
9673
|
+
return parseInboundTraceparent(getProcessEnv()?.[TELEMETRY_TRACEPARENT_ENV]);
|
|
9674
|
+
}
|
|
9675
|
+
|
|
9676
|
+
// ../common/src/telemetry/session-id.ts
|
|
9677
|
+
var TELEMETRY_SESSION_ID_ENV = "UIPATH_SESSION_ID";
|
|
9678
|
+
var SESSION_ID_MAX_LENGTH = 64;
|
|
9679
|
+
var RANDOM_SESSION_ID_LENGTH = 32;
|
|
9680
|
+
var TELEMETRY_SESSION_SOURCE_PROPERTY = "SessionIdSource";
|
|
9681
|
+
var CONTROL_CHARACTERS = /\p{Cc}/gu;
|
|
9682
|
+
var INHERITED_SESSION_SOURCES = [
|
|
9683
|
+
{ envVar: "CLAUDE_CODE_SESSION_ID", source: "claude-code" },
|
|
9684
|
+
{ envVar: "CODEX_THREAD_ID", source: "codex" },
|
|
9685
|
+
{ envVar: "ANTIGRAVITY_TRAJECTORY_ID", source: "antigravity" },
|
|
9686
|
+
{ envVar: "TERM_SESSION_ID", source: "terminal" },
|
|
9687
|
+
{ envVar: "WT_SESSION", source: "terminal" }
|
|
9688
|
+
];
|
|
9689
|
+
var telemetrySessionSlot = singleton("TelemetrySession");
|
|
9690
|
+
var telemetryOperationIdSlot = singleton("TelemetryOperationId");
|
|
9691
|
+
function getProcessEnv2() {
|
|
9692
|
+
return globalThis.process?.env;
|
|
9693
|
+
}
|
|
9694
|
+
function normalizeSessionId(value) {
|
|
9695
|
+
if (typeof value !== "string" && typeof value !== "number" && typeof value !== "boolean") {
|
|
9696
|
+
return;
|
|
9697
|
+
}
|
|
9698
|
+
const cleaned = String(value).replace(CONTROL_CHARACTERS, "").trim().slice(0, SESSION_ID_MAX_LENGTH);
|
|
9699
|
+
return cleaned || undefined;
|
|
9700
|
+
}
|
|
9701
|
+
function getConfiguredTelemetrySessionId() {
|
|
9702
|
+
return normalizeSessionId(getProcessEnv2()?.[TELEMETRY_SESSION_ID_ENV]);
|
|
9703
|
+
}
|
|
9704
|
+
function getInheritedSession(env) {
|
|
9705
|
+
for (const candidate of INHERITED_SESSION_SOURCES) {
|
|
9706
|
+
const handle = normalizeSessionId(env[candidate.envVar]);
|
|
9707
|
+
if (handle) {
|
|
9708
|
+
return { id: handle, source: candidate.source };
|
|
9709
|
+
}
|
|
9710
|
+
}
|
|
9711
|
+
return;
|
|
9712
|
+
}
|
|
9713
|
+
function generateRandomSession() {
|
|
9714
|
+
const bytes = new Uint8Array(RANDOM_SESSION_ID_LENGTH / 2);
|
|
9715
|
+
crypto.getRandomValues(bytes);
|
|
9716
|
+
let hex = "";
|
|
9717
|
+
for (const byte of bytes) {
|
|
9718
|
+
hex += byte.toString(16).padStart(2, "0");
|
|
9719
|
+
}
|
|
9720
|
+
return { id: hex, source: "random" };
|
|
9721
|
+
}
|
|
9722
|
+
function resolveTelemetrySession() {
|
|
9723
|
+
const existing = telemetrySessionSlot.get();
|
|
9724
|
+
if (existing) {
|
|
9725
|
+
return existing;
|
|
9726
|
+
}
|
|
9727
|
+
const declaredHandle = getConfiguredTelemetrySessionId();
|
|
9728
|
+
const resolved = declaredHandle ? { id: declaredHandle, source: "declared" } : getInheritedSession(getProcessEnv2() ?? {}) ?? generateRandomSession();
|
|
9729
|
+
telemetrySessionSlot.set(resolved);
|
|
9730
|
+
return resolved;
|
|
9731
|
+
}
|
|
9732
|
+
function getTelemetrySessionId() {
|
|
9733
|
+
return resolveTelemetrySession().id;
|
|
9734
|
+
}
|
|
9735
|
+
function getTelemetrySessionSource() {
|
|
9736
|
+
return resolveTelemetrySession().source;
|
|
9737
|
+
}
|
|
9738
|
+
function getTelemetryOperationId() {
|
|
9739
|
+
const existing = telemetryOperationIdSlot.get();
|
|
9740
|
+
if (existing) {
|
|
9741
|
+
return existing;
|
|
9742
|
+
}
|
|
9743
|
+
const inboundTraceId = getInboundTraceContext()?.traceId;
|
|
9744
|
+
const generated = inboundTraceId ?? crypto.randomUUID().replaceAll("-", "");
|
|
9745
|
+
telemetryOperationIdSlot.set(generated);
|
|
9746
|
+
return generated;
|
|
9747
|
+
}
|
|
9748
|
+
|
|
9603
9749
|
// ../common/src/registry.ts
|
|
9604
9750
|
import { execFileSync as execFileSync2 } from "node:child_process";
|
|
9605
9751
|
function readRegistryValue(keyPath, valueName) {
|
|
@@ -9821,108 +9967,6 @@ class NodeContextStorage {
|
|
|
9821
9967
|
return this.storage.getStore();
|
|
9822
9968
|
}
|
|
9823
9969
|
}
|
|
9824
|
-
// ../common/src/telemetry/trace-context.ts
|
|
9825
|
-
var TELEMETRY_TRACEPARENT_ENV = "TRACEPARENT";
|
|
9826
|
-
var TRACEPARENT_PATTERN = /^00-([0-9a-f]{32})-([0-9a-f]{16})-[0-9a-f]{2}$/;
|
|
9827
|
-
function getProcessEnv() {
|
|
9828
|
-
return globalThis.process?.env;
|
|
9829
|
-
}
|
|
9830
|
-
function parseInboundTraceparent(value) {
|
|
9831
|
-
if (!value) {
|
|
9832
|
-
return;
|
|
9833
|
-
}
|
|
9834
|
-
const match = TRACEPARENT_PATTERN.exec(value.trim().toLowerCase());
|
|
9835
|
-
if (!match) {
|
|
9836
|
-
return;
|
|
9837
|
-
}
|
|
9838
|
-
const [, traceId, parentSpanId] = match;
|
|
9839
|
-
if (/^0+$/.test(traceId) || /^0+$/.test(parentSpanId)) {
|
|
9840
|
-
return;
|
|
9841
|
-
}
|
|
9842
|
-
return { traceId, parentSpanId };
|
|
9843
|
-
}
|
|
9844
|
-
function getInboundTraceContext() {
|
|
9845
|
-
return parseInboundTraceparent(getProcessEnv()?.[TELEMETRY_TRACEPARENT_ENV]);
|
|
9846
|
-
}
|
|
9847
|
-
|
|
9848
|
-
// ../common/src/telemetry/session-id.ts
|
|
9849
|
-
var TELEMETRY_SESSION_ID_ENV = "UIPATH_SESSION_ID";
|
|
9850
|
-
var SESSION_ID_MAX_LENGTH = 64;
|
|
9851
|
-
var RANDOM_SESSION_ID_LENGTH = 32;
|
|
9852
|
-
var TELEMETRY_SESSION_SOURCE_PROPERTY = "SessionIdSource";
|
|
9853
|
-
var CONTROL_CHARACTERS = /\p{Cc}/gu;
|
|
9854
|
-
var INHERITED_SESSION_SOURCES = [
|
|
9855
|
-
{ envVar: "CLAUDE_CODE_SESSION_ID", source: "claude-code" },
|
|
9856
|
-
{ envVar: "CODEX_THREAD_ID", source: "codex" },
|
|
9857
|
-
{ envVar: "ANTIGRAVITY_TRAJECTORY_ID", source: "antigravity" },
|
|
9858
|
-
{ envVar: "TERM_SESSION_ID", source: "terminal" },
|
|
9859
|
-
{ envVar: "WT_SESSION", source: "terminal" }
|
|
9860
|
-
];
|
|
9861
|
-
var telemetrySessionSlot = singleton("TelemetrySession");
|
|
9862
|
-
var telemetryOperationIdSlot = singleton("TelemetryOperationId");
|
|
9863
|
-
function getProcessEnv2() {
|
|
9864
|
-
return globalThis.process?.env;
|
|
9865
|
-
}
|
|
9866
|
-
function normalizeSessionId(value) {
|
|
9867
|
-
if (typeof value !== "string" && typeof value !== "number" && typeof value !== "boolean") {
|
|
9868
|
-
return;
|
|
9869
|
-
}
|
|
9870
|
-
const cleaned = String(value).replace(CONTROL_CHARACTERS, "").trim().slice(0, SESSION_ID_MAX_LENGTH);
|
|
9871
|
-
return cleaned || undefined;
|
|
9872
|
-
}
|
|
9873
|
-
function getConfiguredTelemetrySessionId() {
|
|
9874
|
-
return normalizeSessionId(getProcessEnv2()?.[TELEMETRY_SESSION_ID_ENV]);
|
|
9875
|
-
}
|
|
9876
|
-
function getInheritedSession(env) {
|
|
9877
|
-
for (const candidate of INHERITED_SESSION_SOURCES) {
|
|
9878
|
-
const handle = normalizeSessionId(env[candidate.envVar]);
|
|
9879
|
-
if (handle) {
|
|
9880
|
-
return { id: handle, source: candidate.source };
|
|
9881
|
-
}
|
|
9882
|
-
}
|
|
9883
|
-
return;
|
|
9884
|
-
}
|
|
9885
|
-
function generateRandomSession() {
|
|
9886
|
-
const bytes = new Uint8Array(RANDOM_SESSION_ID_LENGTH / 2);
|
|
9887
|
-
crypto.getRandomValues(bytes);
|
|
9888
|
-
let hex = "";
|
|
9889
|
-
for (const byte of bytes) {
|
|
9890
|
-
hex += byte.toString(16).padStart(2, "0");
|
|
9891
|
-
}
|
|
9892
|
-
return { id: hex, source: "random" };
|
|
9893
|
-
}
|
|
9894
|
-
function resolveTelemetrySession() {
|
|
9895
|
-
const existing = telemetrySessionSlot.get();
|
|
9896
|
-
if (existing) {
|
|
9897
|
-
return existing;
|
|
9898
|
-
}
|
|
9899
|
-
const declaredHandle = getConfiguredTelemetrySessionId();
|
|
9900
|
-
const resolved = declaredHandle ? { id: declaredHandle, source: "declared" } : getInheritedSession(getProcessEnv2() ?? {}) ?? generateRandomSession();
|
|
9901
|
-
telemetrySessionSlot.set(resolved);
|
|
9902
|
-
return resolved;
|
|
9903
|
-
}
|
|
9904
|
-
function getTelemetrySessionId() {
|
|
9905
|
-
return resolveTelemetrySession().id;
|
|
9906
|
-
}
|
|
9907
|
-
function getTelemetrySessionSource() {
|
|
9908
|
-
return resolveTelemetrySession().source;
|
|
9909
|
-
}
|
|
9910
|
-
function getTelemetryOperationId() {
|
|
9911
|
-
const existing = telemetryOperationIdSlot.get();
|
|
9912
|
-
if (existing) {
|
|
9913
|
-
return existing;
|
|
9914
|
-
}
|
|
9915
|
-
const inboundTraceId = getInboundTraceContext()?.traceId;
|
|
9916
|
-
const generated = inboundTraceId ?? crypto.randomUUID().replaceAll("-", "");
|
|
9917
|
-
telemetryOperationIdSlot.set(generated);
|
|
9918
|
-
return generated;
|
|
9919
|
-
}
|
|
9920
|
-
// ../common/src/telemetry/global-telemetry-properties.ts
|
|
9921
|
-
var telemetryPropsSlot = singleton("TelemetryDefaultProps");
|
|
9922
|
-
function getGlobalTelemetryProperties() {
|
|
9923
|
-
return telemetryPropsSlot.get();
|
|
9924
|
-
}
|
|
9925
|
-
|
|
9926
9970
|
// ../common/src/telemetry/span-clock.ts
|
|
9927
9971
|
function startSpanClock() {
|
|
9928
9972
|
const started = performance.now();
|
|
@@ -10137,6 +10181,7 @@ var MAX_SPOOL_AGE_MS = 72 * 60 * 60 * 1000;
|
|
|
10137
10181
|
// ../common/src/telemetry/telemetry-init.ts
|
|
10138
10182
|
var telemetryInstanceSlot = singleton("TelemetryService");
|
|
10139
10183
|
var DEFAULT_AI_CONNECTION_STRING = atob("SW5zdHJ1bWVudGF0aW9uS2V5PTliZDM3NDgyLTgxMGUtNDQyYS1hYWE2LWQzOGVmNjVjNjY3NDtJbmdlc3Rpb25FbmRwb2ludD1odHRwczovL3dlc3RldXJvcGUtNS5pbi5hcHBsaWNhdGlvbmluc2lnaHRzLmF6dXJlLmNvbS87TGl2ZUVuZHBvaW50PWh0dHBzOi8vd2VzdGV1cm9wZS5saXZlZGlhZ25vc3RpY3MubW9uaXRvci5henVyZS5jb20vO0FwcGxpY2F0aW9uSWQ9MzU2OTdlZjEtOGJkMC00ZjE5LWEyN2MtZDg3Y2NhYzY2ZDJj");
|
|
10184
|
+
var browserProviderSlot = singleton("BrowserAppInsightsTelemetryProvider");
|
|
10140
10185
|
function getGlobalTelemetryInstance() {
|
|
10141
10186
|
const existing = telemetryInstanceSlot.get();
|
|
10142
10187
|
if (existing && typeof existing === "object" && "trackEvent" in existing && typeof existing.trackEvent === "function") {
|
|
@@ -10320,7 +10365,7 @@ function printOutput(data, format = "json", logFn, asciiSafe = false, tableRowSt
|
|
|
10320
10365
|
const pagedRows = extractPagedRows(data.Data);
|
|
10321
10366
|
const items = pagedRows ?? (Array.isArray(data.Data) ? data.Data : [data.Data]);
|
|
10322
10367
|
items.forEach((item) => {
|
|
10323
|
-
const values = Object.values(item).map((v) => v ?? "").join("\t");
|
|
10368
|
+
const values = item === null || typeof item !== "object" ? String(item ?? "") : Object.values(item).map((v) => v ?? "").join("\t");
|
|
10324
10369
|
logFn(values);
|
|
10325
10370
|
});
|
|
10326
10371
|
} else {
|
|
@@ -10335,7 +10380,8 @@ function printOutput(data, format = "json", logFn, asciiSafe = false, tableRowSt
|
|
|
10335
10380
|
default: {
|
|
10336
10381
|
const hasData = "Data" in data && data.Data != null;
|
|
10337
10382
|
const pagedRows = hasData ? extractPagedRows(data.Data) : null;
|
|
10338
|
-
const
|
|
10383
|
+
const resolvedRows = pagedRows ? pagedRows : Array.isArray(data.Data) ? data.Data : null;
|
|
10384
|
+
const rows = resolvedRows && isPrimitiveArray(resolvedRows) ? resolvedRows.map((entry) => ({ Value: entry })) : resolvedRows;
|
|
10339
10385
|
if (hasData && !(rows !== null && rows.length === 0)) {
|
|
10340
10386
|
const logValue = data.Log;
|
|
10341
10387
|
if (rows !== null) {
|
|
@@ -10392,6 +10438,9 @@ function printTable(data, logFn, externalLogValue, tableRowStyle) {
|
|
|
10392
10438
|
function isPlainObjectArray(value) {
|
|
10393
10439
|
return Array.isArray(value) && value.length > 0 && value.every(isPlainRecord);
|
|
10394
10440
|
}
|
|
10441
|
+
function isPrimitiveArray(value) {
|
|
10442
|
+
return Array.isArray(value) && value.length > 0 && value.every((entry) => entry === null || typeof entry !== "object");
|
|
10443
|
+
}
|
|
10395
10444
|
function isNonEmptyPlainObject(value) {
|
|
10396
10445
|
return isPlainRecord(value) && Object.keys(value).length > 0;
|
|
10397
10446
|
}
|
|
@@ -10738,12 +10787,12 @@ class FilterEvaluationError extends Error {
|
|
|
10738
10787
|
instructions;
|
|
10739
10788
|
retry = "RetryWillNotFix";
|
|
10740
10789
|
result = RESULTS.ValidationError;
|
|
10741
|
-
constructor(filter, cause) {
|
|
10790
|
+
constructor(filter, cause, hint) {
|
|
10742
10791
|
const underlying = cause instanceof Error ? cause.message : String(cause);
|
|
10743
|
-
super(`Filter '${filter}' failed to evaluate: ${underlying}`);
|
|
10792
|
+
super(`Filter '${filter}' failed to evaluate: ${underlying}` + (hint ? ` ${hint.detail}` : ""));
|
|
10744
10793
|
this.name = "FilterEvaluationError";
|
|
10745
10794
|
this.filter = filter;
|
|
10746
|
-
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(@)'.";
|
|
10795
|
+
this.instructions = (hint ? `${hint.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(@)'.";
|
|
10747
10796
|
}
|
|
10748
10797
|
}
|
|
10749
10798
|
|
|
@@ -10865,6 +10914,93 @@ function nameList(names, cap = 12) {
|
|
|
10865
10914
|
const rest = names.length - shown.length;
|
|
10866
10915
|
return shown.join(", ") + (rest > 0 ? `, and ${rest} more` : "");
|
|
10867
10916
|
}
|
|
10917
|
+
function notFieldsOn(names, scope) {
|
|
10918
|
+
return `${nameList(names)} ${names.length === 1 ? "is not a field" : "are not fields"} on the ${scope} it read`;
|
|
10919
|
+
}
|
|
10920
|
+
function failingFieldRead(ast, isList, fn, argIndex) {
|
|
10921
|
+
const [left, right, condition] = ast.children ?? [];
|
|
10922
|
+
let scopes = [];
|
|
10923
|
+
if (!isList) {
|
|
10924
|
+
scopes = [ast];
|
|
10925
|
+
} else if (ast.type === "FilterProjection" && left?.type === "Identity") {
|
|
10926
|
+
scopes = [condition, right];
|
|
10927
|
+
} else if (ast.type === "Projection" && (left?.type === "Identity" || left?.type === "Flatten" && left.children?.[0]?.type === "Identity")) {
|
|
10928
|
+
scopes = [right];
|
|
10929
|
+
}
|
|
10930
|
+
const reads = new Set;
|
|
10931
|
+
let tracked = 0;
|
|
10932
|
+
const visit = (node) => {
|
|
10933
|
+
if (!node)
|
|
10934
|
+
return;
|
|
10935
|
+
switch (node.type) {
|
|
10936
|
+
case "Function": {
|
|
10937
|
+
const arg = node.children?.[argIndex - 1];
|
|
10938
|
+
if (node.name === fn && arg?.type === "Field" && arg.name) {
|
|
10939
|
+
reads.add(arg.name);
|
|
10940
|
+
tracked++;
|
|
10941
|
+
}
|
|
10942
|
+
node.children?.forEach(visit);
|
|
10943
|
+
return;
|
|
10944
|
+
}
|
|
10945
|
+
case "AndExpression":
|
|
10946
|
+
case "OrExpression":
|
|
10947
|
+
case "NotExpression":
|
|
10948
|
+
case "Comparator":
|
|
10949
|
+
case "MultiSelectList":
|
|
10950
|
+
case "MultiSelectHash":
|
|
10951
|
+
node.children?.forEach(visit);
|
|
10952
|
+
return;
|
|
10953
|
+
case "KeyValuePair":
|
|
10954
|
+
visit(node.value);
|
|
10955
|
+
return;
|
|
10956
|
+
}
|
|
10957
|
+
};
|
|
10958
|
+
scopes.forEach(visit);
|
|
10959
|
+
const calls = (node) => {
|
|
10960
|
+
if (node === null || typeof node !== "object")
|
|
10961
|
+
return 0;
|
|
10962
|
+
const own = node.type === "Function" && node.name === fn ? 1 : 0;
|
|
10963
|
+
const next = node.type === "KeyValuePair" ? [node.value] : node.children ?? [];
|
|
10964
|
+
return own + next.reduce((sum, child) => sum + calls(child), 0);
|
|
10965
|
+
};
|
|
10966
|
+
return reads.size === 1 && tracked === calls(ast) ? [...reads][0] : undefined;
|
|
10967
|
+
}
|
|
10968
|
+
function fieldExpression(name) {
|
|
10969
|
+
return /^[A-Za-z_]\w*$/.test(name) ? name : JSON.stringify(name);
|
|
10970
|
+
}
|
|
10971
|
+
function evaluationHint(codec, filter, data, cause) {
|
|
10972
|
+
const underlying = cause instanceof Error ? cause.message : String(cause);
|
|
10973
|
+
const failure = /\b(\w+)\(\) expected argument (\d+) to be type (\S+) but received type null\b/.exec(underlying);
|
|
10974
|
+
if (!failure)
|
|
10975
|
+
return;
|
|
10976
|
+
const [, fn, position, expected] = failure;
|
|
10977
|
+
const name = failingFieldRead(codec.compile(filter), Array.isArray(data), fn, Number(position));
|
|
10978
|
+
if (name === undefined)
|
|
10979
|
+
return;
|
|
10980
|
+
const present = availableFields(data);
|
|
10981
|
+
if (present.length === 0)
|
|
10982
|
+
return;
|
|
10983
|
+
const scope = `${countRecords(data)} record(s)`;
|
|
10984
|
+
if (!present.includes(name)) {
|
|
10985
|
+
return {
|
|
10986
|
+
detail: `${notFieldsOn([name], scope)}. Available fields: ${nameList(present)}.`,
|
|
10987
|
+
instructions: "Use a field the records have; names are case-sensitive."
|
|
10988
|
+
};
|
|
10989
|
+
}
|
|
10990
|
+
const records = Array.isArray(data) ? data : [data];
|
|
10991
|
+
const unset = records.filter((r) => r?.[name] == null).length;
|
|
10992
|
+
const field = fieldExpression(name);
|
|
10993
|
+
let fallback;
|
|
10994
|
+
if (expected.split(",").includes("string")) {
|
|
10995
|
+
fallback = "''";
|
|
10996
|
+
} else if (expected.split(",").includes("array")) {
|
|
10997
|
+
fallback = "`[]`";
|
|
10998
|
+
}
|
|
10999
|
+
return {
|
|
11000
|
+
detail: `\`${name}\` is null or missing on ${unset} of the ${scope} it read.`,
|
|
11001
|
+
instructions: fallback ? `Give it a default where ${fn}() reads it, e.g. \`${field} || ${fallback}\`.` : `Filter out the records where \`${name}\` is null before ${fn}() reads it.`
|
|
11002
|
+
};
|
|
11003
|
+
}
|
|
10868
11004
|
function buildFilterWarning(filter, data, outcome) {
|
|
10869
11005
|
const present = availableFields(data);
|
|
10870
11006
|
const refs = referencedFields(filter);
|
|
@@ -10872,7 +11008,7 @@ function buildFilterWarning(filter, data, outcome) {
|
|
|
10872
11008
|
const unchecked = refs.nested.filter((name) => !present.includes(name));
|
|
10873
11009
|
const count = countRecords(data);
|
|
10874
11010
|
const scope = `${count} record(s)`;
|
|
10875
|
-
const isNotAField = (names) =>
|
|
11011
|
+
const isNotAField = (names) => notFieldsOn(names, scope);
|
|
10876
11012
|
const soundness = unchecked.length > 0 ? `${nameList(unchecked)} ${unchecked.length === 1 ? "reads" : "read"} below the top level, so ${unchecked.length === 1 ? "it was" : "they were"} not checked against the record keys` : refs.top.length > 0 ? "every field it names exists" : "";
|
|
10877
11013
|
const withSoundness = (base) => soundness ? `${base}, and ${soundness}` : base;
|
|
10878
11014
|
let detail;
|
|
@@ -10923,7 +11059,8 @@ function applyFilter(data, filter, onWarning) {
|
|
|
10923
11059
|
try {
|
|
10924
11060
|
result = codec.search(data, filter);
|
|
10925
11061
|
} catch (err) {
|
|
10926
|
-
|
|
11062
|
+
const [, hint] = catchError(() => evaluationHint(codec, filter, data, err));
|
|
11063
|
+
throw new FilterEvaluationError(filter, err, hint);
|
|
10927
11064
|
}
|
|
10928
11065
|
const inputCount = countRecords(data);
|
|
10929
11066
|
const warn = (outcome) => {
|
|
@@ -11814,7 +11951,7 @@ Command2.prototype.trackedAction = function(context, fn, properties) {
|
|
|
11814
11951
|
logger.debug(`[trackedAction] ${telemetryName} failed: ${errorMessage}`);
|
|
11815
11952
|
const typed = error;
|
|
11816
11953
|
const customInstructions = typeof typed.instructions === "string" ? typed.instructions : undefined;
|
|
11817
|
-
const customResult =
|
|
11954
|
+
const customResult = carriedResult(error);
|
|
11818
11955
|
const cancellationExitCode = typed.exitCode === 130 || isPromptCancellation(error) ? 130 : undefined;
|
|
11819
11956
|
const classified = cancellationExitCode === undefined ? await extractErrorDetails(error) : undefined;
|
|
11820
11957
|
const finalResult = customResult ?? classified?.result ?? RESULTS.Failure;
|
|
@@ -12179,6 +12316,8 @@ var FAILURE_STATUSES = new Set([
|
|
|
12179
12316
|
"canceled",
|
|
12180
12317
|
"stopped"
|
|
12181
12318
|
]);
|
|
12319
|
+
// ../common/src/relayed-output.ts
|
|
12320
|
+
var RELAYED_OUTPUT_SYMBOL = Symbol.for("@uipath/common/relayed-output");
|
|
12182
12321
|
// ../common/src/screen-logger.ts
|
|
12183
12322
|
var ScreenLogger;
|
|
12184
12323
|
((ScreenLogger) => {
|
|
@@ -12214,63 +12353,15 @@ async function readCache(cacheFile) {
|
|
|
12214
12353
|
}
|
|
12215
12354
|
return cache;
|
|
12216
12355
|
}
|
|
12217
|
-
//
|
|
12218
|
-
var
|
|
12219
|
-
name: "@uipath/uipath-python-bridge",
|
|
12220
|
-
author: "UiPath",
|
|
12221
|
-
license: "SEE LICENSE IN LICENSE.txt",
|
|
12222
|
-
version: "1.206.0-preview.303",
|
|
12223
|
-
description: "Shared Python detection, caching, and CLI bridge for UiPath Python SDK tools.",
|
|
12224
|
-
keywords: [
|
|
12225
|
-
"uip",
|
|
12226
|
-
"python",
|
|
12227
|
-
"bridge"
|
|
12228
|
-
],
|
|
12229
|
-
uipath: {
|
|
12230
|
-
requires: {
|
|
12231
|
-
uipath: ">=2.14.41"
|
|
12232
|
-
}
|
|
12233
|
-
},
|
|
12234
|
-
type: "module",
|
|
12235
|
-
main: "./dist/index.js",
|
|
12236
|
-
exports: {
|
|
12237
|
-
".": "./dist/index.js"
|
|
12238
|
-
},
|
|
12239
|
-
files: [
|
|
12240
|
-
"dist"
|
|
12241
|
-
],
|
|
12242
|
-
repository: {
|
|
12243
|
-
type: "git",
|
|
12244
|
-
url: "https://github.com/UiPath/cli.git",
|
|
12245
|
-
directory: "packages/uipath-python-bridge"
|
|
12246
|
-
},
|
|
12247
|
-
publishConfig: {
|
|
12248
|
-
registry: "https://npm.pkg.github.com/@uipath"
|
|
12249
|
-
},
|
|
12250
|
-
scripts: {
|
|
12251
|
-
build: "bun build ./src/index.ts --outdir dist --format esm --target node --external applicationinsights --sourcemap=linked",
|
|
12252
|
-
typecheck: "tsc --noEmit",
|
|
12253
|
-
test: "vitest run",
|
|
12254
|
-
"test:coverage": "vitest run --coverage",
|
|
12255
|
-
lint: "biome check .",
|
|
12256
|
-
"lint:fix": "biome check --write ."
|
|
12257
|
-
},
|
|
12258
|
-
devDependencies: {
|
|
12259
|
-
"@uipath/auth": "workspace:*",
|
|
12260
|
-
"@uipath/common": "workspace:*",
|
|
12261
|
-
"@uipath/filesystem": "workspace:*",
|
|
12262
|
-
"@types/bun": "^1.3.11",
|
|
12263
|
-
commander: "^14.0.3",
|
|
12264
|
-
typescript: "^7.0.2"
|
|
12265
|
-
}
|
|
12266
|
-
};
|
|
12356
|
+
// src/minimum-uipath-version.ts
|
|
12357
|
+
var MINIMUM_UIPATH_VERSION = "2.14.49";
|
|
12267
12358
|
|
|
12268
12359
|
// src/config.ts
|
|
12269
12360
|
var DEFAULT_CONFIG = {
|
|
12270
12361
|
allowedPythonVersions: ["3.14", "3.13", "3.12", "3.11", "3.15"],
|
|
12271
12362
|
packageName: "uipath",
|
|
12272
12363
|
cacheFileName: ".uipath-python-cache.json",
|
|
12273
|
-
uipathVersionRequirement:
|
|
12364
|
+
uipathVersionRequirement: `>=${MINIMUM_UIPATH_VERSION}`
|
|
12274
12365
|
};
|
|
12275
12366
|
function getAllowedPythonVersions() {
|
|
12276
12367
|
const envVersions = process.env.PYTHON_TOOL_PYTHON_VERSIONS;
|
|
@@ -13171,6 +13262,38 @@ var loadEnvFileAsync = async ({ envPath }) => {
|
|
|
13171
13262
|
}
|
|
13172
13263
|
return parseEnvContent(content);
|
|
13173
13264
|
};
|
|
13265
|
+
var findAuthHomeDir = (fs, dir) => {
|
|
13266
|
+
let current = dir;
|
|
13267
|
+
for (;; ) {
|
|
13268
|
+
if (fs.path.basename(current) === UIPATH_HOME_DIR2)
|
|
13269
|
+
return current;
|
|
13270
|
+
const parent = fs.path.dirname(current);
|
|
13271
|
+
if (parent === current)
|
|
13272
|
+
return;
|
|
13273
|
+
current = parent;
|
|
13274
|
+
}
|
|
13275
|
+
};
|
|
13276
|
+
var TEMP_FILE_ATTEMPTS = 5;
|
|
13277
|
+
var isFileExists = (error) => error instanceof Error && error.code === "EEXIST";
|
|
13278
|
+
var writeTempFile = async (fs, targetPath, content) => {
|
|
13279
|
+
for (let attempt = 1;; attempt++) {
|
|
13280
|
+
const tempPath = `${targetPath}.${crypto.randomUUID()}.tmp`;
|
|
13281
|
+
try {
|
|
13282
|
+
await fs.writeFile(tempPath, content, {
|
|
13283
|
+
mode: AUTH_FILE_MODE,
|
|
13284
|
+
exclusive: true
|
|
13285
|
+
});
|
|
13286
|
+
return tempPath;
|
|
13287
|
+
} catch (error) {
|
|
13288
|
+
if (!isFileExists(error)) {
|
|
13289
|
+
await fs.rm(tempPath).catch(() => {});
|
|
13290
|
+
throw error;
|
|
13291
|
+
}
|
|
13292
|
+
if (attempt === TEMP_FILE_ATTEMPTS)
|
|
13293
|
+
throw error;
|
|
13294
|
+
}
|
|
13295
|
+
}
|
|
13296
|
+
};
|
|
13174
13297
|
var saveEnvFileAsync = async ({
|
|
13175
13298
|
envPath,
|
|
13176
13299
|
data,
|
|
@@ -13198,10 +13321,18 @@ var saveEnvFileAsync = async ({
|
|
|
13198
13321
|
`)}
|
|
13199
13322
|
`;
|
|
13200
13323
|
const dir = fs.path.dirname(absolutePath);
|
|
13201
|
-
await fs.mkdir(dir);
|
|
13202
|
-
const
|
|
13203
|
-
|
|
13204
|
-
|
|
13324
|
+
await fs.mkdir(dir, { mode: AUTH_DIR_MODE });
|
|
13325
|
+
const authHomeDir = findAuthHomeDir(fs, dir);
|
|
13326
|
+
if (authHomeDir !== undefined) {
|
|
13327
|
+
await fs.chmod?.(authHomeDir, AUTH_DIR_MODE);
|
|
13328
|
+
}
|
|
13329
|
+
const tempPath = await writeTempFile(fs, absolutePath, content);
|
|
13330
|
+
try {
|
|
13331
|
+
await fs.rename(tempPath, absolutePath);
|
|
13332
|
+
} catch (error) {
|
|
13333
|
+
await fs.rm(tempPath).catch(() => {});
|
|
13334
|
+
throw error;
|
|
13335
|
+
}
|
|
13205
13336
|
};
|
|
13206
13337
|
|
|
13207
13338
|
// ../auth/src/loginStatus.ts
|
|
@@ -13792,6 +13923,8 @@ var TENANT_SELECTION_CODES = new Set([
|
|
|
13792
13923
|
]);
|
|
13793
13924
|
// ../auth/src/logout.ts
|
|
13794
13925
|
init_src();
|
|
13926
|
+
// ../auth/src/utils/lockedEnvFile.ts
|
|
13927
|
+
init_src();
|
|
13795
13928
|
// src/execute.ts
|
|
13796
13929
|
init_src();
|
|
13797
13930
|
|
|
@@ -13799,10 +13932,31 @@ init_src();
|
|
|
13799
13932
|
import { execFile as execFile7 } from "node:child_process";
|
|
13800
13933
|
var PROBE_TIMEOUT_MS = 15000;
|
|
13801
13934
|
var TYPE_OPTION = /^--type(=|$)/;
|
|
13935
|
+
var DIR_OPTION = /^--dir(=|$)/;
|
|
13802
13936
|
var TYPE_LISTED = /^[ \t]*--type(?![\w-])/m;
|
|
13937
|
+
var NEW_OPTIONS_WITH_VALUE = new Set([
|
|
13938
|
+
"--type",
|
|
13939
|
+
"--agent-framework",
|
|
13940
|
+
"--dir"
|
|
13941
|
+
]);
|
|
13803
13942
|
function hasTypeOption(args) {
|
|
13804
13943
|
return args.some((arg) => TYPE_OPTION.test(arg));
|
|
13805
13944
|
}
|
|
13945
|
+
function hasDirOption(args) {
|
|
13946
|
+
return args.some((arg) => DIR_OPTION.test(arg));
|
|
13947
|
+
}
|
|
13948
|
+
function scaffoldNameOf(args) {
|
|
13949
|
+
for (let i = 1;i < args.length; i++) {
|
|
13950
|
+
const arg = args[i] ?? "";
|
|
13951
|
+
if (!arg.startsWith("-")) {
|
|
13952
|
+
return arg === "" ? undefined : arg;
|
|
13953
|
+
}
|
|
13954
|
+
if (NEW_OPTIONS_WITH_VALUE.has(arg)) {
|
|
13955
|
+
i++;
|
|
13956
|
+
}
|
|
13957
|
+
}
|
|
13958
|
+
return;
|
|
13959
|
+
}
|
|
13806
13960
|
async function supportsNewTypeOption(exePath, cwd, env = {}, signal) {
|
|
13807
13961
|
return new Promise((resolve) => {
|
|
13808
13962
|
execFile7(exePath, ["new", "--help"], {
|
|
@@ -13961,6 +14115,10 @@ function applyOutputFormatOption(args, option, supportedFormats) {
|
|
|
13961
14115
|
}
|
|
13962
14116
|
return [...args, option, format];
|
|
13963
14117
|
}
|
|
14118
|
+
async function isSolutionRoot(fs, dir) {
|
|
14119
|
+
const [readError, entries] = await catchError(fs.readdir(dir));
|
|
14120
|
+
return !readError && Array.isArray(entries) && entries.some((entry) => entry.endsWith(".uipx"));
|
|
14121
|
+
}
|
|
13964
14122
|
function matchesRequiredCommand(args, commands) {
|
|
13965
14123
|
return args[0] !== undefined && commands.includes(args[0]);
|
|
13966
14124
|
}
|
|
@@ -14028,6 +14186,17 @@ async function runUipathPythonCommand(args, options = {}) {
|
|
|
14028
14186
|
if (options.pinNewType && processed.args[0] === "new" && !isHelpCommand(processed.args) && hasTypeOption(processed.args)) {
|
|
14029
14187
|
return fail("new_type_not_allowed", "--type is not a valid option.", "Remove --type and re-run.");
|
|
14030
14188
|
}
|
|
14189
|
+
const cwd = options.cwd ?? fs.env.cwd();
|
|
14190
|
+
let scaffoldDir;
|
|
14191
|
+
if (options.pinNewType && processed.args[0] === "new" && !isHelpCommand(processed.args) && !hasDirOption(processed.args)) {
|
|
14192
|
+
const name = scaffoldNameOf(processed.args);
|
|
14193
|
+
if (name !== undefined && await isSolutionRoot(fs, cwd)) {
|
|
14194
|
+
if (await fs.exists(fs.path.resolve(cwd, name))) {
|
|
14195
|
+
return fail("new_dir_exists", `'${name}' already exists in this solution folder.`, "Choose another project name, or pass --dir <path> to scaffold into a directory of your own.");
|
|
14196
|
+
}
|
|
14197
|
+
scaffoldDir = name;
|
|
14198
|
+
}
|
|
14199
|
+
}
|
|
14031
14200
|
const processedArgs = applyOutputFormatOption(processed.args, options.outputFormatOption, options.outputFormats);
|
|
14032
14201
|
const commandArgs = options.commandPrefix ? [options.commandPrefix, ...processedArgs] : [...processedArgs];
|
|
14033
14202
|
const requiredEnv = {};
|
|
@@ -14061,7 +14230,6 @@ async function runUipathPythonCommand(args, options = {}) {
|
|
|
14061
14230
|
}
|
|
14062
14231
|
}
|
|
14063
14232
|
const stdio = options.stdio ?? "inherit";
|
|
14064
|
-
const cwd = options.cwd ?? fs.env.cwd();
|
|
14065
14233
|
const versionCheck = await checkUipathVersion(cache.uipathExePath, {
|
|
14066
14234
|
cwd,
|
|
14067
14235
|
signal: options.signal
|
|
@@ -14070,8 +14238,13 @@ async function runUipathPythonCommand(args, options = {}) {
|
|
|
14070
14238
|
return fail(versionCheck.kind === "unsupported" ? "uipath_version_unsupported" : "uipath_version_unverifiable", versionCheck.message, uipathVersionInstructions(versionCheck, toolLabel));
|
|
14071
14239
|
}
|
|
14072
14240
|
logger.debug(`Using uipath ${versionCheck.version} at ${cache.uipathExePath} (source: ${cache.source ?? "unknown"}; requires uipath${versionCheck.requirement})`);
|
|
14073
|
-
if (options.pinNewType && processed.args[0] === "new" && !isHelpCommand(processed.args)
|
|
14074
|
-
|
|
14241
|
+
if (options.pinNewType && processed.args[0] === "new" && !isHelpCommand(processed.args)) {
|
|
14242
|
+
if (await supportsNewTypeOption(cache.uipathExePath, cwd, { ...authEnv, ...requiredEnv }, options.signal)) {
|
|
14243
|
+
commandArgs.push("--type", options.pinNewType);
|
|
14244
|
+
}
|
|
14245
|
+
if (scaffoldDir !== undefined) {
|
|
14246
|
+
commandArgs.push("--dir", scaffoldDir);
|
|
14247
|
+
}
|
|
14075
14248
|
}
|
|
14076
14249
|
const proc = spawn(cache.uipathExePath, commandArgs, {
|
|
14077
14250
|
cwd,
|
|
@@ -14131,6 +14304,7 @@ var CLI_RESULT_BY_REASON = {
|
|
|
14131
14304
|
uipath_version_unverifiable: RESULTS.ConfigError,
|
|
14132
14305
|
command_disabled: RESULTS.ValidationError,
|
|
14133
14306
|
new_type_not_allowed: RESULTS.ValidationError,
|
|
14307
|
+
new_dir_exists: RESULTS.ValidationError,
|
|
14134
14308
|
required_env_missing: RESULTS.ConfigError,
|
|
14135
14309
|
preflight_error: RESULTS.Failure,
|
|
14136
14310
|
preflight_rejected: RESULTS.ConfigError,
|
|
@@ -14738,6 +14912,7 @@ export {
|
|
|
14738
14912
|
getCacheFileName,
|
|
14739
14913
|
getPackageName,
|
|
14740
14914
|
getUipathVersionRequirement,
|
|
14915
|
+
hasDirOption,
|
|
14741
14916
|
hasTypeOption,
|
|
14742
14917
|
isPathInside,
|
|
14743
14918
|
parseMinimumVersion,
|
|
@@ -14747,8 +14922,9 @@ export {
|
|
|
14747
14922
|
readCache,
|
|
14748
14923
|
reportUipathPythonFailure,
|
|
14749
14924
|
runUipathPythonCommand,
|
|
14925
|
+
scaffoldNameOf,
|
|
14750
14926
|
supportsNewTypeOption,
|
|
14751
14927
|
uipathVersionInstructions
|
|
14752
14928
|
};
|
|
14753
14929
|
|
|
14754
|
-
//# debugId=
|
|
14930
|
+
//# debugId=91E424E71D4C87D464756E2164756E21
|
package/package.json
CHANGED
|
@@ -2,18 +2,13 @@
|
|
|
2
2
|
"name": "@uipath/uipath-python-bridge",
|
|
3
3
|
"author": "UiPath",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
5
|
-
"version": "1.
|
|
5
|
+
"version": "1.207.0-preview.305",
|
|
6
6
|
"description": "Shared Python detection, caching, and CLI bridge for UiPath Python SDK tools.",
|
|
7
7
|
"keywords": [
|
|
8
8
|
"uip",
|
|
9
9
|
"python",
|
|
10
10
|
"bridge"
|
|
11
11
|
],
|
|
12
|
-
"uipath": {
|
|
13
|
-
"requires": {
|
|
14
|
-
"uipath": ">=2.14.41"
|
|
15
|
-
}
|
|
16
|
-
},
|
|
17
12
|
"type": "module",
|
|
18
13
|
"main": "./dist/index.js",
|
|
19
14
|
"exports": {
|
|
@@ -30,5 +25,5 @@
|
|
|
30
25
|
"publishConfig": {
|
|
31
26
|
"registry": "https://registry.npmjs.org/"
|
|
32
27
|
},
|
|
33
|
-
"gitHead": "
|
|
28
|
+
"gitHead": "1600aa89255c37c1b8bc68d9882c3395c1d5bff4"
|
|
34
29
|
}
|