@uipath/docsai-tool 1.201.0-preview.128 → 1.201.0-preview.131

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 CHANGED
@@ -3,7 +3,7 @@ import {
3
3
  Command,
4
4
  metadata,
5
5
  registerCommands
6
- } from "./tool-drt9tqvj.js";
6
+ } from "./tool-d2w1vb10.js";
7
7
  import"./tool-9qecd4wb.js";
8
8
  import"./tool-4pvh3k50.js";
9
9
  import"./tool-5arsyj36.js";
@@ -5116,9 +5116,28 @@ var require_data = __commonJS((exports, module) => {
5116
5116
  var require_utils = __commonJS((exports, module) => {
5117
5117
  var isUUID = RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu);
5118
5118
  var isIPv4 = RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u);
5119
+ var isPort = RegExp.prototype.test.bind(/^\d*$/u);
5119
5120
  var isHexPair = RegExp.prototype.test.bind(/^[\da-f]{2}$/iu);
5120
5121
  var isUnreserved = RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu);
5121
- var isPathCharacter = RegExp.prototype.test.bind(/^[\da-z\-._~!$&'()*+,;=:@/]$/iu);
5122
+ var isPathCharacter = RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/]$/u);
5123
+ var isQueryFragmentCharacter = RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:@/?]$/u);
5124
+ var isUserinfoCharacter = RegExp.prototype.test.bind(/^[A-Za-z0-9\-._~!$&'()*+,;=:]$/u);
5125
+ var BYTE_HEX = new Array(256);
5126
+ {
5127
+ const HEX_DIGITS = "0123456789ABCDEF";
5128
+ for (let i = 0;i < 256; i++) {
5129
+ BYTE_HEX[i] = "%" + HEX_DIGITS[i >> 4] + HEX_DIGITS[i & 15];
5130
+ }
5131
+ }
5132
+ function percentEncodeNonAscii(cp) {
5133
+ if (cp < 2048) {
5134
+ return BYTE_HEX[192 | cp >> 6] + BYTE_HEX[128 | cp & 63];
5135
+ }
5136
+ if (cp < 65536) {
5137
+ return BYTE_HEX[224 | cp >> 12] + BYTE_HEX[128 | cp >> 6 & 63] + BYTE_HEX[128 | cp & 63];
5138
+ }
5139
+ return BYTE_HEX[240 | cp >> 18] + BYTE_HEX[128 | cp >> 12 & 63] + BYTE_HEX[128 | cp >> 6 & 63] + BYTE_HEX[128 | cp & 63];
5140
+ }
5122
5141
  function stringArrayToHexStripped(input) {
5123
5142
  let acc = "";
5124
5143
  let code = 0;
@@ -5143,91 +5162,122 @@ var require_utils = __commonJS((exports, module) => {
5143
5162
  }
5144
5163
  return acc;
5145
5164
  }
5165
+ var isHextet = RegExp.prototype.test.bind(/^[\dA-Fa-f]{1,4}$/);
5166
+ var isIPvFuture = RegExp.prototype.test.bind(/^[vV][\dA-Fa-f]+\.[A-Za-z\d\-._~!$&'()*+,;=:]+$/);
5167
+ var isZoneCharacter = RegExp.prototype.test.bind(/^[A-Za-z\d\-._~]$/);
5146
5168
  var nonSimpleDomain = RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);
5147
- function consumeIsZone(buffer) {
5148
- buffer.length = 0;
5149
- return true;
5150
- }
5151
- function consumeHextets(buffer, address, output) {
5152
- if (buffer.length) {
5153
- const hex = stringArrayToHexStripped(buffer);
5154
- if (hex !== "") {
5155
- address.push(hex);
5156
- } else {
5157
- output.error = true;
5158
- return false;
5169
+ function isZoneIdentifier(zone) {
5170
+ if (zone.length === 0)
5171
+ return false;
5172
+ for (let i = 0;i < zone.length; i++) {
5173
+ if (isZoneCharacter(zone[i]))
5174
+ continue;
5175
+ if (zone[i] === "%" && i + 2 < zone.length && isHexPair(zone.slice(i + 1, i + 3))) {
5176
+ i += 2;
5177
+ continue;
5159
5178
  }
5160
- buffer.length = 0;
5179
+ return false;
5161
5180
  }
5162
5181
  return true;
5163
5182
  }
5164
- function getIPV6(input) {
5165
- let tokenCount = 0;
5166
- const output = { error: false, address: "", zone: "" };
5167
- const address = [];
5168
- const buffer = [];
5169
- let endipv6Encountered = false;
5170
- let endIpv6 = false;
5171
- let consume = consumeHextets;
5172
- for (let i = 0;i < input.length; i++) {
5173
- const cursor = input[i];
5174
- if (cursor === "[" || cursor === "]") {
5175
- continue;
5176
- }
5177
- if (cursor === ":") {
5178
- if (endipv6Encountered === true) {
5179
- endIpv6 = true;
5180
- }
5181
- if (!consume(buffer, address, output)) {
5182
- break;
5183
- }
5184
- if (++tokenCount > 7) {
5185
- output.error = true;
5186
- break;
5187
- }
5188
- if (i > 0 && input[i - 1] === ":") {
5189
- endipv6Encountered = true;
5190
- }
5191
- address.push(":");
5192
- continue;
5193
- } else if (cursor === "%") {
5194
- if (!consume(buffer, address, output)) {
5195
- break;
5183
+ function compressIPv6ZeroRun(hextets) {
5184
+ let bestStart = -1;
5185
+ let bestLength = 0;
5186
+ let runStart = -1;
5187
+ let runLength = 0;
5188
+ for (let i = 0;i < hextets.length; i++) {
5189
+ if (hextets[i] === "0") {
5190
+ if (runStart === -1)
5191
+ runStart = i;
5192
+ runLength++;
5193
+ if (runLength > bestLength) {
5194
+ bestLength = runLength;
5195
+ bestStart = runStart;
5196
5196
  }
5197
- consume = consumeIsZone;
5198
5197
  } else {
5199
- buffer.push(cursor);
5200
- continue;
5198
+ runStart = -1;
5199
+ runLength = 0;
5201
5200
  }
5202
5201
  }
5203
- if (buffer.length) {
5204
- if (consume === consumeIsZone) {
5205
- output.zone = buffer.join("");
5206
- } else if (endIpv6) {
5207
- address.push(buffer.join(""));
5208
- } else {
5209
- address.push(stringArrayToHexStripped(buffer));
5202
+ if (bestLength < 2)
5203
+ return hextets.join(":");
5204
+ const head = hextets.slice(0, bestStart).join(":");
5205
+ const tail = hextets.slice(bestStart + bestLength).join(":");
5206
+ return head + "::" + tail;
5207
+ }
5208
+ function normalizeIPv6Address(input) {
5209
+ const compression = input.indexOf("::");
5210
+ if (compression !== -1 && input.indexOf("::", compression + 1) !== -1)
5211
+ return;
5212
+ const left = compression === -1 ? input.split(":") : input.slice(0, compression).split(":");
5213
+ const right = compression === -1 ? [] : input.slice(compression + 2).split(":");
5214
+ if (compression !== -1) {
5215
+ if (left.length === 1 && left[0] === "")
5216
+ left.length = 0;
5217
+ if (right.length === 1 && right[0] === "")
5218
+ right.length = 0;
5219
+ }
5220
+ const parts = left.concat(right);
5221
+ let hextetCount = 0;
5222
+ for (let i = 0;i < parts.length; i++) {
5223
+ const part = parts[i];
5224
+ if (part === "")
5225
+ return;
5226
+ if (part.indexOf(".") !== -1) {
5227
+ if (i !== parts.length - 1 || compression !== -1 && right.length === 0 || !isIPv4(part))
5228
+ return;
5229
+ hextetCount += 2;
5230
+ continue;
5210
5231
  }
5232
+ if (!isHextet(part))
5233
+ return;
5234
+ parts[i] = parseInt(part, 16).toString(16);
5235
+ hextetCount++;
5211
5236
  }
5212
- output.address = address.join("");
5213
- return output;
5237
+ if (compression === -1) {
5238
+ if (hextetCount !== 8)
5239
+ return;
5240
+ return compressIPv6ZeroRun(parts);
5241
+ }
5242
+ if (hextetCount >= 8)
5243
+ return;
5244
+ const expanded = parts.slice(0, left.length);
5245
+ for (let i = hextetCount;i < 8; i++)
5246
+ expanded.push("0");
5247
+ for (let i = left.length;i < parts.length; i++)
5248
+ expanded.push(parts[i]);
5249
+ return compressIPv6ZeroRun(expanded);
5214
5250
  }
5215
5251
  function normalizeIPv6(host) {
5216
- if (findToken(host, ":") < 2) {
5217
- return { host, isIPV6: false };
5218
- }
5219
- const ipv62 = getIPV6(host);
5220
- if (!ipv62.error) {
5221
- let newHost = ipv62.address;
5222
- let escapedHost = ipv62.address;
5223
- if (ipv62.zone) {
5224
- newHost += "%" + ipv62.zone;
5225
- escapedHost += "%25" + ipv62.zone;
5226
- }
5227
- return { host: newHost, isIPV6: true, escapedHost };
5228
- } else {
5229
- return { host, isIPV6: false };
5230
- }
5252
+ const bracketed = host[0] === "[" && host[host.length - 1] === "]";
5253
+ const hasBracket = host[0] === "[" || host[host.length - 1] === "]";
5254
+ if (hasBracket && !bracketed)
5255
+ return { host, isIPV6: false, error: true };
5256
+ let input = bracketed ? host.slice(1, -1) : host;
5257
+ if (bracketed && isIPvFuture(input)) {
5258
+ input = input.toLowerCase();
5259
+ return { host: `[${input}]`, escapedHost: input, isIPV6: false, isIPVFuture: true };
5260
+ }
5261
+ if (findToken(input, ":") < 2) {
5262
+ return { host, isIPV6: false, error: bracketed };
5263
+ }
5264
+ let zoneIdentifier = "";
5265
+ const zoneSeparator = input.indexOf("%");
5266
+ if (zoneSeparator !== -1) {
5267
+ const separatorLength = input.slice(zoneSeparator, zoneSeparator + 3).toLowerCase() === "%25" ? 3 : 1;
5268
+ zoneIdentifier = input.slice(zoneSeparator + separatorLength);
5269
+ if (!isZoneIdentifier(zoneIdentifier))
5270
+ return { host, isIPV6: false, error: true };
5271
+ input = input.slice(0, zoneSeparator);
5272
+ }
5273
+ const address = normalizeIPv6Address(input);
5274
+ if (address === undefined)
5275
+ return { host, isIPV6: false, error: true };
5276
+ return {
5277
+ host: address + (zoneIdentifier ? "%" + zoneIdentifier : ""),
5278
+ escapedHost: address + (zoneIdentifier ? "%25" + zoneIdentifier : ""),
5279
+ isIPV6: true
5280
+ };
5231
5281
  }
5232
5282
  function findToken(str, token) {
5233
5283
  let ind = 0;
@@ -5347,7 +5397,8 @@ var require_utils = __commonJS((exports, module) => {
5347
5397
  function normalizePathEncoding(input) {
5348
5398
  let output = "";
5349
5399
  for (let i = 0;i < input.length; i++) {
5350
- if (input[i] === "%" && i + 2 < input.length) {
5400
+ const ch = input[i];
5401
+ if (ch === "%" && i + 2 < input.length) {
5351
5402
  const hex = input.slice(i + 1, i + 3);
5352
5403
  if (isHexPair(hex)) {
5353
5404
  const normalizedHex = hex.toUpperCase();
@@ -5361,10 +5412,152 @@ var require_utils = __commonJS((exports, module) => {
5361
5412
  continue;
5362
5413
  }
5363
5414
  }
5364
- if (isPathCharacter(input[i])) {
5365
- output += input[i];
5415
+ if (isPathCharacter(ch)) {
5416
+ output += ch;
5366
5417
  } else {
5367
- output += escape(input[i]);
5418
+ const code = input.charCodeAt(i);
5419
+ if (code < 128) {
5420
+ output += isEscapeSafe(code) ? ch : BYTE_HEX[code];
5421
+ } else if (code < 55296 || code > 57343) {
5422
+ output += percentEncodeNonAscii(code);
5423
+ } else if (code <= 56319 && i + 1 < input.length) {
5424
+ const low = input.charCodeAt(i + 1);
5425
+ if (low >= 56320 && low <= 57343) {
5426
+ output += percentEncodeNonAscii(65536 + (code - 55296 << 10) + (low - 56320));
5427
+ i++;
5428
+ } else {
5429
+ output += percentEncodeNonAscii(65533);
5430
+ }
5431
+ } else {
5432
+ output += percentEncodeNonAscii(65533);
5433
+ }
5434
+ }
5435
+ }
5436
+ return output;
5437
+ }
5438
+ function serializePathEncoding(input, pathNoScheme = false) {
5439
+ let output = "";
5440
+ let firstSegment = pathNoScheme && input[0] !== "/";
5441
+ for (let i = 0;i < input.length; i++) {
5442
+ const ch = input[i];
5443
+ if (ch === "%" && i + 2 < input.length) {
5444
+ const hex = input.slice(i + 1, i + 3);
5445
+ if (isHexPair(hex)) {
5446
+ output += "%" + hex.toUpperCase();
5447
+ i += 2;
5448
+ continue;
5449
+ }
5450
+ }
5451
+ if (ch === "/") {
5452
+ firstSegment = false;
5453
+ }
5454
+ if (isPathCharacter(ch) && (ch !== ":" || !firstSegment)) {
5455
+ output += ch;
5456
+ } else {
5457
+ const code = input.charCodeAt(i);
5458
+ if (code < 128) {
5459
+ output += BYTE_HEX[code];
5460
+ } else if (code < 55296 || code > 57343) {
5461
+ output += percentEncodeNonAscii(code);
5462
+ } else if (code <= 56319 && i + 1 < input.length) {
5463
+ const low = input.charCodeAt(i + 1);
5464
+ if (low >= 56320 && low <= 57343) {
5465
+ output += percentEncodeNonAscii(65536 + (code - 55296 << 10) + (low - 56320));
5466
+ i++;
5467
+ } else {
5468
+ output += percentEncodeNonAscii(65533);
5469
+ }
5470
+ } else {
5471
+ output += percentEncodeNonAscii(65533);
5472
+ }
5473
+ }
5474
+ }
5475
+ return output;
5476
+ }
5477
+ function encodeComponent(input, isAllowed) {
5478
+ let output = "";
5479
+ for (let i = 0;i < input.length; i++) {
5480
+ const ch = input[i];
5481
+ if (ch === "%" && i + 2 < input.length) {
5482
+ const hex = input.slice(i + 1, i + 3);
5483
+ if (isHexPair(hex)) {
5484
+ output += "%" + hex.toUpperCase();
5485
+ i += 2;
5486
+ continue;
5487
+ }
5488
+ }
5489
+ if (isAllowed(ch)) {
5490
+ output += ch;
5491
+ } else {
5492
+ const code = input.charCodeAt(i);
5493
+ if (code < 128) {
5494
+ output += BYTE_HEX[code];
5495
+ } else if (code < 55296 || code > 57343) {
5496
+ output += percentEncodeNonAscii(code);
5497
+ } else if (code <= 56319 && i + 1 < input.length) {
5498
+ const low = input.charCodeAt(i + 1);
5499
+ if (low >= 56320 && low <= 57343) {
5500
+ output += percentEncodeNonAscii(65536 + (code - 55296 << 10) + (low - 56320));
5501
+ i++;
5502
+ } else {
5503
+ output += percentEncodeNonAscii(65533);
5504
+ }
5505
+ } else {
5506
+ output += percentEncodeNonAscii(65533);
5507
+ }
5508
+ }
5509
+ }
5510
+ return output;
5511
+ }
5512
+ function encodeUserinfo(input) {
5513
+ return encodeComponent(input, isUserinfoCharacter);
5514
+ }
5515
+ function encodeQuery(input) {
5516
+ return encodeComponent(input, isQueryFragmentCharacter);
5517
+ }
5518
+ function encodeFragment(input) {
5519
+ return encodeComponent(input, isQueryFragmentCharacter);
5520
+ }
5521
+ function isEscapeSafe(cp) {
5522
+ return cp >= 48 && cp <= 57 || cp >= 65 && cp <= 90 || cp >= 97 && cp <= 122 || cp === 42 || cp === 43 || cp === 45 || cp === 46 || cp === 47 || cp === 64 || cp === 95;
5523
+ }
5524
+ function normalizeQueryFragmentEncoding(input) {
5525
+ let output = "";
5526
+ for (let i = 0;i < input.length; i++) {
5527
+ const ch = input[i];
5528
+ if (ch === "%" && i + 2 < input.length) {
5529
+ const hex = input.slice(i + 1, i + 3);
5530
+ if (isHexPair(hex)) {
5531
+ const normalizedHex = hex.toUpperCase();
5532
+ const decoded = String.fromCharCode(parseInt(normalizedHex, 16));
5533
+ if (isUnreserved(decoded)) {
5534
+ output += decoded;
5535
+ } else {
5536
+ output += "%" + normalizedHex;
5537
+ }
5538
+ i += 2;
5539
+ continue;
5540
+ }
5541
+ }
5542
+ if (isQueryFragmentCharacter(ch)) {
5543
+ output += ch;
5544
+ } else {
5545
+ const code = input.charCodeAt(i);
5546
+ if (code < 128) {
5547
+ output += isEscapeSafe(code) ? ch : BYTE_HEX[code];
5548
+ } else if (code < 55296 || code > 57343) {
5549
+ output += percentEncodeNonAscii(code);
5550
+ } else if (code <= 56319 && i + 1 < input.length) {
5551
+ const low = input.charCodeAt(i + 1);
5552
+ if (low >= 56320 && low <= 57343) {
5553
+ output += percentEncodeNonAscii(65536 + (code - 55296 << 10) + (low - 56320));
5554
+ i++;
5555
+ } else {
5556
+ output += percentEncodeNonAscii(65533);
5557
+ }
5558
+ } else {
5559
+ output += percentEncodeNonAscii(65533);
5560
+ }
5368
5561
  }
5369
5562
  }
5370
5563
  return output;
@@ -5387,14 +5580,18 @@ var require_utils = __commonJS((exports, module) => {
5387
5580
  function recomposeAuthority(component) {
5388
5581
  const uriTokens = [];
5389
5582
  if (component.userinfo !== undefined) {
5390
- uriTokens.push(component.userinfo);
5583
+ uriTokens.push(encodeUserinfo(component.userinfo));
5391
5584
  uriTokens.push("@");
5392
5585
  }
5393
5586
  if (component.host !== undefined) {
5394
- let host = unescape(component.host);
5587
+ let host = component.host;
5395
5588
  if (!isIPv4(host)) {
5396
- const ipV6res = normalizeIPv6(host);
5397
- if (ipV6res.isIPV6 === true) {
5589
+ let ipV6res = normalizeIPv6(host);
5590
+ if (ipV6res.isIPV6 !== true && ipV6res.isIPVFuture !== true) {
5591
+ host = normalizePercentEncoding(host, true);
5592
+ ipV6res = normalizeIPv6(host);
5593
+ }
5594
+ if (ipV6res.isIPV6 === true || ipV6res.isIPVFuture === true) {
5398
5595
  host = `[${ipV6res.escapedHost}]`;
5399
5596
  } else {
5400
5597
  host = reescapeHostDelimiters(host, false);
@@ -5403,8 +5600,12 @@ var require_utils = __commonJS((exports, module) => {
5403
5600
  uriTokens.push(host);
5404
5601
  }
5405
5602
  if (typeof component.port === "number" || typeof component.port === "string") {
5603
+ const port = String(component.port);
5604
+ if (!isPort(port)) {
5605
+ throw new TypeError("URI port is malformed.");
5606
+ }
5406
5607
  uriTokens.push(":");
5407
- uriTokens.push(String(component.port));
5608
+ uriTokens.push(port);
5408
5609
  }
5409
5610
  return uriTokens.length ? uriTokens.join("") : undefined;
5410
5611
  }
@@ -5414,6 +5615,11 @@ var require_utils = __commonJS((exports, module) => {
5414
5615
  reescapeHostDelimiters,
5415
5616
  normalizePercentEncoding,
5416
5617
  normalizePathEncoding,
5618
+ serializePathEncoding,
5619
+ normalizeQueryFragmentEncoding,
5620
+ encodeUserinfo,
5621
+ encodeQuery,
5622
+ encodeFragment,
5417
5623
  escapePreservingEscapes,
5418
5624
  removeDotSegments,
5419
5625
  isIPv4,
@@ -5426,7 +5632,7 @@ var require_utils = __commonJS((exports, module) => {
5426
5632
  // ../../node_modules/fast-uri/lib/schemes.js
5427
5633
  var require_schemes = __commonJS((exports, module) => {
5428
5634
  var { isUUID } = require_utils();
5429
- var URN_REG = /([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu;
5635
+ var URN_REG = /^([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-./:;=@]|%[\da-f]{2})+)$/iu;
5430
5636
  var supportedSchemeNames = [
5431
5637
  "http",
5432
5638
  "https",
@@ -5481,9 +5687,10 @@ var require_schemes = __commonJS((exports, module) => {
5481
5687
  wsComponent.secure = undefined;
5482
5688
  }
5483
5689
  if (wsComponent.resourceName) {
5484
- const [path, query] = wsComponent.resourceName.split("?");
5690
+ const queryIndex = wsComponent.resourceName.indexOf("?");
5691
+ const path = queryIndex === -1 ? wsComponent.resourceName : wsComponent.resourceName.slice(0, queryIndex);
5485
5692
  wsComponent.path = path && path !== "/" ? path : undefined;
5486
- wsComponent.query = query;
5693
+ wsComponent.query = queryIndex === -1 ? undefined : wsComponent.resourceName.slice(queryIndex + 1);
5487
5694
  wsComponent.resourceName = undefined;
5488
5695
  }
5489
5696
  wsComponent.fragment = undefined;
@@ -5495,7 +5702,7 @@ var require_schemes = __commonJS((exports, module) => {
5495
5702
  return urnComponent;
5496
5703
  }
5497
5704
  const matches = urnComponent.path.match(URN_REG);
5498
- if (matches) {
5705
+ if (matches && matches[0] === urnComponent.path) {
5499
5706
  const scheme = options.scheme || urnComponent.scheme || "urn";
5500
5707
  urnComponent.nid = matches[1].toLowerCase();
5501
5708
  urnComponent.nss = matches[2];
@@ -5599,8 +5806,17 @@ var require_schemes = __commonJS((exports, module) => {
5599
5806
 
5600
5807
  // ../../node_modules/fast-uri/index.js
5601
5808
  var require_fast_uri = __commonJS((exports, module) => {
5602
- var { normalizeIPv6, removeDotSegments, recomposeAuthority, normalizePercentEncoding, normalizePathEncoding, escapePreservingEscapes, reescapeHostDelimiters, isIPv4, nonSimpleDomain } = require_utils();
5809
+ var { normalizeIPv6, removeDotSegments, recomposeAuthority, normalizePercentEncoding, normalizePathEncoding, serializePathEncoding, normalizeQueryFragmentEncoding, encodeQuery, encodeFragment, reescapeHostDelimiters, isIPv4, nonSimpleDomain } = require_utils();
5603
5810
  var { SCHEMES, getSchemeHandler } = require_schemes();
5811
+ var VALID_SCHEME = /^[A-Za-z][A-Za-z0-9+.-]*$/u;
5812
+ var MALFORMED_SCHEME_ERROR = "URI scheme is malformed.";
5813
+ function decodeValidScheme(scheme) {
5814
+ const decodedScheme = unescape(String(scheme));
5815
+ if (!VALID_SCHEME.test(decodedScheme)) {
5816
+ throw new TypeError(MALFORMED_SCHEME_ERROR);
5817
+ }
5818
+ return decodedScheme;
5819
+ }
5604
5820
  function normalize(uri, options) {
5605
5821
  if (typeof uri === "string") {
5606
5822
  uri = normalizeString(uri, options);
@@ -5611,12 +5827,34 @@ var require_fast_uri = __commonJS((exports, module) => {
5611
5827
  }
5612
5828
  function resolve(baseURI, relativeURI, options) {
5613
5829
  const schemelessOptions = options ? Object.assign({ scheme: "null" }, options) : { scheme: "null" };
5614
- const { parsed: baseParsed, malformedAuthorityOrPort: baseMalformed } = parseWithStatus(baseURI, schemelessOptions);
5615
- const { parsed: relativeParsed, malformedAuthorityOrPort: relativeMalformed } = parseWithStatus(relativeURI, schemelessOptions);
5616
- if (baseMalformed || relativeMalformed) {
5830
+ const {
5831
+ parsed: baseParsed,
5832
+ malformedAuthorityOrPort: baseMalformed,
5833
+ malformedPercentEncoding: baseMalformedPercentEncoding,
5834
+ malformedSchemeSpecific: baseMalformedSchemeSpecific,
5835
+ malformedHost: baseMalformedHost,
5836
+ malformedScheme: baseMalformedScheme
5837
+ } = parseWithStatus(baseURI, schemelessOptions);
5838
+ const {
5839
+ parsed: relativeParsed,
5840
+ malformedAuthorityOrPort: relativeMalformed,
5841
+ malformedPercentEncoding: relativeMalformedPercentEncoding,
5842
+ malformedSchemeSpecific: relativeMalformedSchemeSpecific,
5843
+ malformedHost: relativeMalformedHost,
5844
+ malformedScheme: relativeMalformedScheme
5845
+ } = parseWithStatus(relativeURI, schemelessOptions);
5846
+ if (baseMalformed || relativeMalformed || baseMalformedPercentEncoding || relativeMalformedPercentEncoding || baseMalformedSchemeSpecific || relativeMalformedSchemeSpecific || baseMalformedHost || relativeMalformedHost || baseMalformedScheme || relativeMalformedScheme) {
5617
5847
  throw new Error(baseParsed.error || relativeParsed.error || "URI is malformed.");
5618
5848
  }
5619
5849
  const resolved = resolveComponent(baseParsed, relativeParsed, schemelessOptions, true);
5850
+ const resolvedSchemeHandler = getSchemeHandler(options && options.scheme || resolved.scheme);
5851
+ const resolvedHost = resolved.host;
5852
+ const resolvedHostIsIP = resolvedHost !== undefined && resolvedHost !== "" && (isIPv4(resolvedHost) || normalizeIPv6(resolvedHost).isIPV6);
5853
+ canonicalizeHost(resolved, options || {}, resolvedSchemeHandler, resolvedHostIsIP);
5854
+ const encodedASCIIHost = resolvedHost && resolvedHost.indexOf("%") !== -1 && !/\P{ASCII}/u.test(resolvedHost);
5855
+ if (resolved.error && !encodedASCIIHost) {
5856
+ throw new Error(resolved.error);
5857
+ }
5620
5858
  schemelessOptions.skipEscape = true;
5621
5859
  return serialize(resolved, schemelessOptions);
5622
5860
  }
@@ -5676,7 +5914,7 @@ var require_fast_uri = __commonJS((exports, module) => {
5676
5914
  function equal(uriA, uriB, options) {
5677
5915
  const normalizedA = normalizeComparableURI(uriA, options);
5678
5916
  const normalizedB = normalizeComparableURI(uriB, options);
5679
- return normalizedA !== undefined && normalizedB !== undefined && normalizedA.toLowerCase() === normalizedB.toLowerCase();
5917
+ return normalizedA !== undefined && normalizedB !== undefined && normalizedA === normalizedB;
5680
5918
  }
5681
5919
  function serialize(cmpts, opts) {
5682
5920
  const component = {
@@ -5697,20 +5935,23 @@ var require_fast_uri = __commonJS((exports, module) => {
5697
5935
  };
5698
5936
  const options = Object.assign({}, opts);
5699
5937
  const uriTokens = [];
5938
+ if (component.scheme) {
5939
+ component.scheme = decodeValidScheme(component.scheme);
5940
+ }
5700
5941
  const schemeHandler = getSchemeHandler(options.scheme || component.scheme);
5701
5942
  if (schemeHandler && schemeHandler.serialize)
5702
5943
  schemeHandler.serialize(component, options);
5944
+ const hasAuthority = component.userinfo !== undefined || component.host !== undefined || component.port !== undefined;
5945
+ const pathNoScheme = !options.skipEscape && component.scheme === undefined && !hasAuthority;
5703
5946
  if (component.path !== undefined) {
5704
5947
  if (!options.skipEscape) {
5705
- component.path = escapePreservingEscapes(component.path);
5706
- if (component.scheme !== undefined) {
5707
- component.path = component.path.split("%3A").join(":");
5708
- }
5948
+ component.path = serializePathEncoding(component.path, pathNoScheme);
5709
5949
  } else {
5710
5950
  component.path = normalizePercentEncoding(component.path);
5711
5951
  }
5712
5952
  }
5713
5953
  if (options.reference !== "suffix" && component.scheme) {
5954
+ component.scheme = decodeValidScheme(component.scheme);
5714
5955
  uriTokens.push(component.scheme, ":");
5715
5956
  }
5716
5957
  const authority = recomposeAuthority(component);
@@ -5728,16 +5969,19 @@ var require_fast_uri = __commonJS((exports, module) => {
5728
5969
  if (!options.absolutePath && (!schemeHandler || !schemeHandler.absolutePath)) {
5729
5970
  s = removeDotSegments(s);
5730
5971
  }
5972
+ if (pathNoScheme) {
5973
+ s = serializePathEncoding(s, true);
5974
+ }
5731
5975
  if (authority === undefined && s[0] === "/" && s[1] === "/") {
5732
5976
  s = "/%2F" + s.slice(2);
5733
5977
  }
5734
5978
  uriTokens.push(s);
5735
5979
  }
5736
5980
  if (component.query !== undefined) {
5737
- uriTokens.push("?", component.query);
5981
+ uriTokens.push("?", encodeQuery(component.query));
5738
5982
  }
5739
5983
  if (component.fragment !== undefined) {
5740
- uriTokens.push("#", component.fragment);
5984
+ uriTokens.push("#", encodeFragment(component.fragment));
5741
5985
  }
5742
5986
  return uriTokens.join("");
5743
5987
  }
@@ -5753,6 +5997,36 @@ var require_fast_uri = __commonJS((exports, module) => {
5753
5997
  }
5754
5998
  return;
5755
5999
  }
6000
+ function hasMalformedPercentEncoding(component) {
6001
+ if (component === undefined)
6002
+ return false;
6003
+ let percent = component.indexOf("%");
6004
+ while (percent !== -1) {
6005
+ if (percent + 2 >= component.length || !/^[\da-f]{2}$/iu.test(component.slice(percent + 1, percent + 3))) {
6006
+ return true;
6007
+ }
6008
+ percent = component.indexOf("%", percent + 3);
6009
+ }
6010
+ return false;
6011
+ }
6012
+ function isIPLiteral(host) {
6013
+ return host[0] === "[" && host[host.length - 1] === "]";
6014
+ }
6015
+ function hasMalformedComponentPercentEncoding(matches) {
6016
+ const host = matches[4];
6017
+ return hasMalformedPercentEncoding(matches[3]) || host !== undefined && !isIPLiteral(host) && hasMalformedPercentEncoding(host) || hasMalformedPercentEncoding(matches[6]) || hasMalformedPercentEncoding(matches[7]) || hasMalformedPercentEncoding(matches[8]);
6018
+ }
6019
+ function canonicalizeHost(parsed, options, schemeHandler, isIP) {
6020
+ if (!options.unicodeSupport && (!schemeHandler || !schemeHandler.unicodeSupport) && parsed.host && !isIPLiteral(parsed.host) && (options.domainHost || schemeHandler && schemeHandler.domainHost) && isIP === false && nonSimpleDomain(parsed.host)) {
6021
+ try {
6022
+ parsed.host = new URL("http://" + parsed.host).hostname;
6023
+ } catch (e) {
6024
+ parsed.error = parsed.error || "Host's domain name can not be converted to ASCII: " + e;
6025
+ return true;
6026
+ }
6027
+ }
6028
+ return false;
6029
+ }
5756
6030
  function parseWithStatus(uri, opts) {
5757
6031
  const options = Object.assign({}, opts);
5758
6032
  const parsed = {
@@ -5765,6 +6039,11 @@ var require_fast_uri = __commonJS((exports, module) => {
5765
6039
  fragment: undefined
5766
6040
  };
5767
6041
  let malformedAuthorityOrPort = false;
6042
+ let malformedPercentEncoding = false;
6043
+ let malformedSchemeSpecific = false;
6044
+ let malformedHost = false;
6045
+ let malformedIPLiteral = false;
6046
+ let malformedScheme = false;
5768
6047
  let isIP = false;
5769
6048
  if (options.reference === "suffix") {
5770
6049
  if (options.scheme) {
@@ -5801,6 +6080,19 @@ var require_fast_uri = __commonJS((exports, module) => {
5801
6080
  parsed.path = matches[6] || "";
5802
6081
  parsed.query = matches[7];
5803
6082
  parsed.fragment = matches[8];
6083
+ if (parsed.scheme !== undefined) {
6084
+ const decodedScheme = unescape(parsed.scheme);
6085
+ if (VALID_SCHEME.test(decodedScheme)) {
6086
+ parsed.scheme = decodedScheme.toLowerCase();
6087
+ } else {
6088
+ parsed.error = parsed.error || MALFORMED_SCHEME_ERROR;
6089
+ malformedScheme = true;
6090
+ }
6091
+ }
6092
+ malformedPercentEncoding = hasMalformedComponentPercentEncoding(matches);
6093
+ if (malformedPercentEncoding) {
6094
+ parsed.error = parsed.error || "URI contains malformed percent-encoding.";
6095
+ }
5804
6096
  if (isNaN(parsed.port)) {
5805
6097
  parsed.port = matches[5];
5806
6098
  }
@@ -5812,9 +6104,16 @@ var require_fast_uri = __commonJS((exports, module) => {
5812
6104
  if (parsed.host) {
5813
6105
  const ipv4result = isIPv4(parsed.host);
5814
6106
  if (ipv4result === false) {
6107
+ const bracketedIPLiteral = isIPLiteral(parsed.host);
6108
+ const hasIPLiteralBracket = parsed.host.indexOf("[") !== -1 || parsed.host.indexOf("]") !== -1;
5815
6109
  const ipv6result = normalizeIPv6(parsed.host);
5816
- parsed.host = ipv6result.host.toLowerCase();
5817
- isIP = ipv6result.isIPV6;
6110
+ isIP = ipv6result.isIPV6 || ipv6result.isIPVFuture === true;
6111
+ malformedIPLiteral = hasIPLiteralBracket && (!bracketedIPLiteral || ipv6result.error === true);
6112
+ parsed.host = isIP ? ipv6result.host : ipv6result.host.toLowerCase();
6113
+ if (malformedIPLiteral) {
6114
+ parsed.error = parsed.error || "URI host is malformed.";
6115
+ malformedAuthorityOrPort = true;
6116
+ }
5818
6117
  } else {
5819
6118
  isIP = true;
5820
6119
  }
@@ -5832,42 +6131,36 @@ var require_fast_uri = __commonJS((exports, module) => {
5832
6131
  parsed.error = parsed.error || "URI is not a " + options.reference + " reference.";
5833
6132
  }
5834
6133
  const schemeHandler = getSchemeHandler(options.scheme || parsed.scheme);
5835
- if (!options.unicodeSupport && (!schemeHandler || !schemeHandler.unicodeSupport)) {
5836
- if (parsed.host && (options.domainHost || schemeHandler && schemeHandler.domainHost) && isIP === false && nonSimpleDomain(parsed.host)) {
5837
- try {
5838
- parsed.host = new URL("http://" + parsed.host).hostname;
5839
- } catch (e) {
5840
- parsed.error = parsed.error || "Host's domain name can not be converted to ASCII: " + e;
5841
- }
5842
- }
6134
+ if (!malformedIPLiteral) {
6135
+ malformedHost = canonicalizeHost(parsed, options, schemeHandler, isIP);
5843
6136
  }
5844
6137
  if (!schemeHandler || schemeHandler && !schemeHandler.skipNormalize) {
5845
6138
  if (uri.indexOf("%") !== -1) {
5846
- if (parsed.scheme !== undefined) {
5847
- parsed.scheme = unescape(parsed.scheme);
5848
- }
5849
- if (parsed.host !== undefined) {
5850
- parsed.host = reescapeHostDelimiters(unescape(parsed.host), isIP);
6139
+ if (parsed.host !== undefined && !malformedIPLiteral) {
6140
+ const host = isIP ? parsed.host : normalizePercentEncoding(parsed.host, true);
6141
+ parsed.host = reescapeHostDelimiters(host, isIP);
5851
6142
  }
5852
6143
  }
5853
6144
  if (parsed.path) {
5854
6145
  parsed.path = normalizePathEncoding(parsed.path);
5855
6146
  }
6147
+ if (parsed.query) {
6148
+ parsed.query = normalizeQueryFragmentEncoding(parsed.query);
6149
+ }
5856
6150
  if (parsed.fragment) {
5857
- try {
5858
- parsed.fragment = encodeURI(decodeURIComponent(parsed.fragment));
5859
- } catch {
5860
- parsed.error = parsed.error || "URI malformed";
5861
- }
6151
+ parsed.fragment = normalizeQueryFragmentEncoding(parsed.fragment);
5862
6152
  }
5863
6153
  }
5864
6154
  if (schemeHandler && schemeHandler.parse) {
5865
6155
  schemeHandler.parse(parsed, options);
6156
+ if (schemeHandler === SCHEMES.urn && parsed.nid === undefined) {
6157
+ malformedSchemeSpecific = true;
6158
+ }
5866
6159
  }
5867
6160
  } else {
5868
6161
  parsed.error = parsed.error || "URI can not be parsed.";
5869
6162
  }
5870
- return { parsed, malformedAuthorityOrPort };
6163
+ return { parsed, malformedAuthorityOrPort, malformedPercentEncoding, malformedSchemeSpecific, malformedHost, malformedScheme };
5871
6164
  }
5872
6165
  function parse5(uri, opts) {
5873
6166
  return parseWithStatus(uri, opts).parsed;
@@ -5876,20 +6169,28 @@ var require_fast_uri = __commonJS((exports, module) => {
5876
6169
  return normalizeStringWithStatus(uri, opts).normalized;
5877
6170
  }
5878
6171
  function normalizeStringWithStatus(uri, opts) {
5879
- const { parsed, malformedAuthorityOrPort } = parseWithStatus(uri, opts);
6172
+ const { parsed, malformedAuthorityOrPort, malformedPercentEncoding, malformedSchemeSpecific, malformedHost, malformedScheme } = parseWithStatus(uri, opts);
5880
6173
  return {
5881
- normalized: malformedAuthorityOrPort ? uri : serialize(parsed, opts),
5882
- malformedAuthorityOrPort
6174
+ normalized: malformedAuthorityOrPort || malformedPercentEncoding || malformedSchemeSpecific || malformedHost || malformedScheme ? uri : serialize(parsed, opts),
6175
+ malformedAuthorityOrPort,
6176
+ malformedPercentEncoding,
6177
+ malformedSchemeSpecific,
6178
+ malformedHost,
6179
+ malformedScheme
5883
6180
  };
5884
6181
  }
5885
6182
  function normalizeComparableURI(uri, opts) {
5886
- if (typeof uri === "string") {
5887
- const { normalized, malformedAuthorityOrPort } = normalizeStringWithStatus(uri, opts);
5888
- return malformedAuthorityOrPort ? undefined : normalized;
6183
+ if (typeof uri !== "string" && typeof uri !== "object") {
6184
+ return;
5889
6185
  }
5890
- if (typeof uri === "object") {
5891
- return serialize(uri, opts);
6186
+ let value;
6187
+ try {
6188
+ value = typeof uri === "string" ? uri : serialize(uri, opts);
6189
+ } catch {
6190
+ return;
5892
6191
  }
6192
+ const { normalized, malformedAuthorityOrPort, malformedPercentEncoding, malformedSchemeSpecific, malformedHost, malformedScheme } = normalizeStringWithStatus(value, opts);
6193
+ return malformedAuthorityOrPort || malformedPercentEncoding || malformedSchemeSpecific || malformedHost || malformedScheme ? undefined : normalized;
5893
6194
  }
5894
6195
  var fastUri = {
5895
6196
  SCHEMES,
@@ -8698,7 +8999,7 @@ var require_dist = __commonJS((exports, module) => {
8698
8999
  var package_default = {
8699
9000
  name: "@uipath/docsai-tool",
8700
9001
  license: "MIT",
8701
- version: "1.201.0-preview.128",
9002
+ version: "1.201.0-preview.131",
8702
9003
  description: "Search UiPath documentation with AI-powered answers.",
8703
9004
  private: false,
8704
9005
  repository: {
@@ -21482,4 +21783,4 @@ var registerCommands = async (program2) => {
21482
21783
 
21483
21784
  export { Command, metadata, registerCommands };
21484
21785
 
21485
- //# debugId=F7E7204E1216939B64756E2164756E21
21786
+ //# debugId=657D153C94D4E32064756E2164756E21
package/dist/tool.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  metadata,
3
3
  registerCommands
4
- } from "./tool-drt9tqvj.js";
4
+ } from "./tool-d2w1vb10.js";
5
5
  import"./tool-9qecd4wb.js";
6
6
  import"./tool-4pvh3k50.js";
7
7
  import"./tool-5arsyj36.js";
package/package.json CHANGED
@@ -1,30 +1,30 @@
1
1
  {
2
- "name": "@uipath/docsai-tool",
3
- "license": "MIT",
4
- "version": "1.201.0-preview.128",
5
- "description": "Search UiPath documentation with AI-powered answers.",
6
- "private": false,
7
- "repository": {
8
- "type": "git",
9
- "url": "https://github.com/UiPath/cli.git",
10
- "directory": "packages/docsai-tool"
11
- },
12
- "publishConfig": {
13
- "registry": "https://registry.npmjs.org/"
14
- },
15
- "keywords": [
16
- "cli-tool"
17
- ],
18
- "type": "module",
19
- "main": "./dist/tool.js",
20
- "exports": {
21
- ".": "./dist/tool.js"
22
- },
23
- "bin": {
24
- "docsai-tool": "./dist/index.js"
25
- },
26
- "files": [
27
- "dist"
28
- ],
29
- "gitHead": "a72e454cd7025bbbdac37d6105afef8282138c88"
2
+ "name": "@uipath/docsai-tool",
3
+ "license": "MIT",
4
+ "version": "1.201.0-preview.131",
5
+ "description": "Search UiPath documentation with AI-powered answers.",
6
+ "private": false,
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "https://github.com/UiPath/cli.git",
10
+ "directory": "packages/docsai-tool"
11
+ },
12
+ "publishConfig": {
13
+ "registry": "https://registry.npmjs.org/"
14
+ },
15
+ "keywords": [
16
+ "cli-tool"
17
+ ],
18
+ "type": "module",
19
+ "main": "./dist/tool.js",
20
+ "exports": {
21
+ ".": "./dist/tool.js"
22
+ },
23
+ "bin": {
24
+ "docsai-tool": "./dist/index.js"
25
+ },
26
+ "files": [
27
+ "dist"
28
+ ],
29
+ "gitHead": "5b0a03e4ee4be352459ac9fd82341ff77bc82ee6"
30
30
  }