@uipath/ixp-sdk 1.202.0 → 1.203.0-preview.160

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +52 -13
  2. package/package.json +3 -2
package/dist/index.js CHANGED
@@ -1678,16 +1678,7 @@ var resolveEnvFilePathAsync = async (envFilePath = DEFAULT_ENV_FILENAME, opts) =
1678
1678
  errorMessage: location.source === "absolute" ? `Environment file not found: ${envFilePath}` : `Unable to locate environment file: ${envFilePath}. Run 'uip login' to authenticate.`
1679
1679
  };
1680
1680
  };
1681
- var loadEnvFileAsync = async ({ envPath }) => {
1682
- const fs7 = getFileSystem();
1683
- const absolutePath = fs7.path.isAbsolute(envPath) ? envPath : fs7.path.join(fs7.env.cwd(), envPath);
1684
- if (!await fs7.exists(absolutePath)) {
1685
- throw new Error(`Environment file not found: ${envPath}`);
1686
- }
1687
- const content = await fs7.readFile(absolutePath, "utf-8");
1688
- if (content === null) {
1689
- throw new Error(`Environment file not found: ${envPath}`);
1690
- }
1681
+ var parseEnvContent = (content) => {
1691
1682
  const env = {};
1692
1683
  for (const line of content.split(`
1693
1684
  `)) {
@@ -1708,6 +1699,18 @@ var loadEnvFileAsync = async ({ envPath }) => {
1708
1699
  }
1709
1700
  return env;
1710
1701
  };
1702
+ var loadEnvFileAsync = async ({ envPath }) => {
1703
+ const fs7 = getFileSystem();
1704
+ const absolutePath = fs7.path.isAbsolute(envPath) ? envPath : fs7.path.join(fs7.env.cwd(), envPath);
1705
+ if (!await fs7.exists(absolutePath)) {
1706
+ throw new Error(`Environment file not found: ${envPath}`);
1707
+ }
1708
+ const content = await fs7.readFile(absolutePath, "utf-8");
1709
+ if (content === null) {
1710
+ throw new Error(`Environment file not found: ${envPath}`);
1711
+ }
1712
+ return parseEnvContent(content);
1713
+ };
1711
1714
  var saveEnvFileAsync = async ({
1712
1715
  envPath,
1713
1716
  data,
@@ -2216,6 +2219,8 @@ function normalizeTokenRefreshUnavailableFailure() {
2216
2219
  function errorMessage(error) {
2217
2220
  return error instanceof Error ? error.message : String(error);
2218
2221
  }
2222
+ // ../auth/src/authProfileDetails.ts
2223
+ init_src();
2219
2224
  // ../auth/src/index.ts
2220
2225
  init_constants();
2221
2226
 
@@ -2266,8 +2271,20 @@ function singleton(ctorOrName) {
2266
2271
 
2267
2272
  // ../common/src/telemetry/global-telemetry-properties.ts
2268
2273
  var telemetryPropsSlot = singleton("TelemetryDefaultProps");
2274
+ function getGlobalTelemetryProperties() {
2275
+ return telemetryPropsSlot.get();
2276
+ }
2277
+
2278
+ // ../common/src/telemetry/telemetry-config.ts
2279
+ function isTelemetryDisabled() {
2280
+ const value = process.env.UIPATH_TELEMETRY_DISABLED;
2281
+ return value === "1" || value === "true";
2282
+ }
2269
2283
 
2270
2284
  // ../common/src/sdk-user-agent.ts
2285
+ var CODING_AGENT_HEADER = "x-coding-agent-info";
2286
+ var AGENT_PROPERTY = "agent";
2287
+ var CODING_AGENT_PROPERTY = "CodingAgent";
2271
2288
  var sdkUserAgentHostToken = singleton("SdkUserAgentHostToken");
2272
2289
  function splitUserAgentTokens(value) {
2273
2290
  return value?.trim().split(/\s+/).filter(Boolean) ?? [];
@@ -2286,15 +2303,37 @@ function appendUserAgentToken(value, userAgent) {
2286
2303
  function getEffectiveUserAgent(userAgent) {
2287
2304
  return appendUserAgentToken(sdkUserAgentHostToken.get(), userAgent);
2288
2305
  }
2306
+ function getHeaderName(headers, headerName) {
2307
+ return Object.keys(headers).find((key) => key.toLowerCase() === headerName.toLowerCase());
2308
+ }
2309
+ function getSdkAgentInfo() {
2310
+ if (isTelemetryDisabled()) {
2311
+ return;
2312
+ }
2313
+ const agent = getGlobalTelemetryProperties()?.[AGENT_PROPERTY];
2314
+ return agent === undefined ? undefined : String(agent);
2315
+ }
2289
2316
  function getSdkUserAgentToken(pkg) {
2290
2317
  const packageName = pkg.name.replace(/^@uipath\//, "");
2291
2318
  return getEffectiveUserAgent(`${packageName}/${pkg.version}`);
2292
2319
  }
2320
+ function addSdkCodingAgentHeader(headers, agent = getSdkAgentInfo()) {
2321
+ const result = { ...headers ?? {} };
2322
+ if (agent === undefined) {
2323
+ return result;
2324
+ }
2325
+ const headerName = getHeaderName(result, CODING_AGENT_HEADER);
2326
+ result[headerName ?? CODING_AGENT_HEADER] = JSON.stringify({
2327
+ [CODING_AGENT_PROPERTY]: agent
2328
+ });
2329
+ return result;
2330
+ }
2293
2331
  // package.json
2294
2332
  var package_default = {
2295
2333
  name: "@uipath/ixp-sdk",
2334
+ author: "UiPath",
2296
2335
  license: "SEE LICENSE IN LICENSE.txt",
2297
- version: "1.202.0",
2336
+ version: "1.203.0-preview.160",
2298
2337
  description: "SDK for the UiPath IXP (Intelligent eXtraction Platform) API — projects, taxonomies, prompts, predictions, and model publishing.",
2299
2338
  repository: {
2300
2339
  type: "git",
@@ -2383,7 +2422,7 @@ function baseHeaders(config) {
2383
2422
  if (config.userAgent) {
2384
2423
  headers["User-Agent"] = config.userAgent;
2385
2424
  }
2386
- return headers;
2425
+ return addSdkCodingAgentHeader(headers);
2387
2426
  }
2388
2427
  var JSON_CONTENT_HEADERS = {
2389
2428
  "Content-Type": "application/json",
@@ -2724,4 +2763,4 @@ export {
2724
2763
  uploadDocument
2725
2764
  };
2726
2765
 
2727
- //# debugId=9215C1AD0D1F632164756E2164756E21
2766
+ //# debugId=6D60CD608C323BEC64756E2164756E21
package/package.json CHANGED
@@ -1,7 +1,8 @@
1
1
  {
2
2
  "name": "@uipath/ixp-sdk",
3
+ "author": "UiPath",
3
4
  "license": "SEE LICENSE IN LICENSE.txt",
4
- "version": "1.202.0",
5
+ "version": "1.203.0-preview.160",
5
6
  "description": "SDK for the UiPath IXP (Intelligent eXtraction Platform) API — projects, taxonomies, prompts, predictions, and model publishing.",
6
7
  "repository": {
7
8
  "type": "git",
@@ -24,5 +25,5 @@
24
25
  "files": [
25
26
  "dist"
26
27
  ],
27
- "gitHead": "23b5a7038ead7264439af18f8b807c7cc99a29d5"
28
+ "gitHead": "3a42062ba731afca4595ba9aa8a80afc9667528d"
28
29
  }