@uipath/uipath-typescript 1.1.3 → 1.2.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.
@@ -267,6 +267,11 @@ function optionalKeys(shape) {
267
267
  }
268
268
  function pick(schema, mask) {
269
269
  const currDef = schema._zod.def;
270
+ const checks = currDef.checks;
271
+ const hasChecks = checks && checks.length > 0;
272
+ if (hasChecks) {
273
+ throw new Error(".pick() cannot be used on object schemas containing refinements");
274
+ }
270
275
  const def = mergeDefs(schema._zod.def, {
271
276
  get shape() {
272
277
  const newShape = {};
@@ -287,6 +292,11 @@ function pick(schema, mask) {
287
292
  }
288
293
  function omit(schema, mask) {
289
294
  const currDef = schema._zod.def;
295
+ const checks = currDef.checks;
296
+ const hasChecks = checks && checks.length > 0;
297
+ if (hasChecks) {
298
+ throw new Error(".omit() cannot be used on object schemas containing refinements");
299
+ }
290
300
  const def = mergeDefs(schema._zod.def, {
291
301
  get shape() {
292
302
  const newShape = { ...schema._zod.def.shape };
@@ -312,7 +322,14 @@ function extend(schema, shape) {
312
322
  const checks = schema._zod.def.checks;
313
323
  const hasChecks = checks && checks.length > 0;
314
324
  if (hasChecks) {
315
- throw new Error("Object schemas containing refinements cannot be extended. Use `.safeExtend()` instead.");
325
+ // Only throw if new shape overlaps with existing shape
326
+ // Use getOwnPropertyDescriptor to check key existence without accessing values
327
+ const existingShape = schema._zod.def.shape;
328
+ for (const key in shape) {
329
+ if (Object.getOwnPropertyDescriptor(existingShape, key) !== undefined) {
330
+ throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.");
331
+ }
332
+ }
316
333
  }
317
334
  const def = mergeDefs(schema._zod.def, {
318
335
  get shape() {
@@ -320,7 +337,6 @@ function extend(schema, shape) {
320
337
  assignProp(this, "shape", _shape); // self-caching
321
338
  return _shape;
322
339
  },
323
- checks: [],
324
340
  });
325
341
  return clone(schema, def);
326
342
  }
@@ -328,15 +344,13 @@ function safeExtend(schema, shape) {
328
344
  if (!isPlainObject(shape)) {
329
345
  throw new Error("Invalid input to safeExtend: expected a plain object");
330
346
  }
331
- const def = {
332
- ...schema._zod.def,
347
+ const def = mergeDefs(schema._zod.def, {
333
348
  get shape() {
334
349
  const _shape = { ...schema._zod.def.shape, ...shape };
335
350
  assignProp(this, "shape", _shape); // self-caching
336
351
  return _shape;
337
352
  },
338
- checks: schema._zod.def.checks,
339
- };
353
+ });
340
354
  return clone(schema, def);
341
355
  }
342
356
  function merge(a, b) {
@@ -354,6 +368,12 @@ function merge(a, b) {
354
368
  return clone(a, def);
355
369
  }
356
370
  function partial(Class, schema, mask) {
371
+ const currDef = schema._zod.def;
372
+ const checks = currDef.checks;
373
+ const hasChecks = checks && checks.length > 0;
374
+ if (hasChecks) {
375
+ throw new Error(".partial() cannot be used on object schemas containing refinements");
376
+ }
357
377
  const def = mergeDefs(schema._zod.def, {
358
378
  get shape() {
359
379
  const oldShape = schema._zod.def.shape;
@@ -423,7 +443,6 @@ function required(Class, schema, mask) {
423
443
  assignProp(this, "shape", shape); // self-caching
424
444
  return shape;
425
445
  },
426
- checks: [],
427
446
  });
428
447
  return clone(schema, def);
429
448
  }
@@ -673,7 +692,8 @@ const cidrv6 = /^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?:
673
692
  const base64 = /^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/;
674
693
  const base64url = /^[A-Za-z0-9_-]*$/;
675
694
  // https://blog.stevenlevithan.com/archives/validate-phone-number#r4-3 (regex sans spaces)
676
- const e164 = /^\+(?:[0-9]){6,14}[0-9]$/;
695
+ // E.164: leading digit must be 1-9; total digits (excluding '+') between 7-15
696
+ const e164 = /^\+[1-9]\d{6,14}$/;
677
697
  // const dateSource = `((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))`;
678
698
  const dateSource = `(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`;
679
699
  const date$1 = /*@__PURE__*/ new RegExp(`^${dateSource}$`);
@@ -977,8 +997,8 @@ class Doc {
977
997
 
978
998
  const version = {
979
999
  major: 4,
980
- minor: 2,
981
- patch: 1,
1000
+ minor: 3,
1001
+ patch: 6,
982
1002
  };
983
1003
 
984
1004
  const $ZodType = /*@__PURE__*/ $constructor("$ZodType", (inst, def) => {
@@ -1088,7 +1108,8 @@ const $ZodType = /*@__PURE__*/ $constructor("$ZodType", (inst, def) => {
1088
1108
  return runChecks(result, checks, ctx);
1089
1109
  };
1090
1110
  }
1091
- inst["~standard"] = {
1111
+ // Lazy initialize ~standard to avoid creating objects for every schema
1112
+ defineLazy(inst, "~standard", () => ({
1092
1113
  validate: (value) => {
1093
1114
  try {
1094
1115
  const r = safeParse$1(inst, value);
@@ -1100,7 +1121,7 @@ const $ZodType = /*@__PURE__*/ $constructor("$ZodType", (inst, def) => {
1100
1121
  },
1101
1122
  vendor: "zod",
1102
1123
  version: 1,
1103
- };
1124
+ }));
1104
1125
  });
1105
1126
  const $ZodString = /*@__PURE__*/ $constructor("$ZodString", (inst, def) => {
1106
1127
  $ZodType.init(inst, def);
@@ -1470,8 +1491,12 @@ const $ZodArray = /*@__PURE__*/ $constructor("$ZodArray", (inst, def) => {
1470
1491
  return payload; //handleArrayResultsAsync(parseResults, final);
1471
1492
  };
1472
1493
  });
1473
- function handlePropertyResult(result, final, key, input) {
1494
+ function handlePropertyResult(result, final, key, input, isOptionalOut) {
1474
1495
  if (result.issues.length) {
1496
+ // For optional-out schemas, ignore errors on absent keys
1497
+ if (isOptionalOut && !(key in input)) {
1498
+ return;
1499
+ }
1475
1500
  final.issues.push(...prefixIssues(key, result.issues));
1476
1501
  }
1477
1502
  if (result.value === undefined) {
@@ -1505,6 +1530,7 @@ function handleCatchall(proms, input, payload, ctx, def, inst) {
1505
1530
  const keySet = def.keySet;
1506
1531
  const _catchall = def.catchall._zod;
1507
1532
  const t = _catchall.def.type;
1533
+ const isOptionalOut = _catchall.optout === "optional";
1508
1534
  for (const key in input) {
1509
1535
  if (keySet.has(key))
1510
1536
  continue;
@@ -1514,10 +1540,10 @@ function handleCatchall(proms, input, payload, ctx, def, inst) {
1514
1540
  }
1515
1541
  const r = _catchall.run({ value: input[key], issues: [] }, ctx);
1516
1542
  if (r instanceof Promise) {
1517
- proms.push(r.then((r) => handlePropertyResult(r, payload, key, input)));
1543
+ proms.push(r.then((r) => handlePropertyResult(r, payload, key, input, isOptionalOut)));
1518
1544
  }
1519
1545
  else {
1520
- handlePropertyResult(r, payload, key, input);
1546
+ handlePropertyResult(r, payload, key, input, isOptionalOut);
1521
1547
  }
1522
1548
  }
1523
1549
  if (unrecognized.length) {
@@ -1585,12 +1611,13 @@ const $ZodObject = /*@__PURE__*/ $constructor("$ZodObject", (inst, def) => {
1585
1611
  const shape = value.shape;
1586
1612
  for (const key of value.keys) {
1587
1613
  const el = shape[key];
1614
+ const isOptionalOut = el._zod.optout === "optional";
1588
1615
  const r = el._zod.run({ value: input[key], issues: [] }, ctx);
1589
1616
  if (r instanceof Promise) {
1590
- proms.push(r.then((r) => handlePropertyResult(r, payload, key, input)));
1617
+ proms.push(r.then((r) => handlePropertyResult(r, payload, key, input, isOptionalOut)));
1591
1618
  }
1592
1619
  else {
1593
- handlePropertyResult(r, payload, key, input);
1620
+ handlePropertyResult(r, payload, key, input, isOptionalOut);
1594
1621
  }
1595
1622
  }
1596
1623
  if (!catchall) {
@@ -1622,8 +1649,33 @@ const $ZodObjectJIT = /*@__PURE__*/ $constructor("$ZodObjectJIT", (inst, def) =>
1622
1649
  for (const key of normalized.keys) {
1623
1650
  const id = ids[key];
1624
1651
  const k = esc(key);
1652
+ const schema = shape[key];
1653
+ const isOptionalOut = schema?._zod?.optout === "optional";
1625
1654
  doc.write(`const ${id} = ${parseStr(key)};`);
1626
- doc.write(`
1655
+ if (isOptionalOut) {
1656
+ // For optional-out schemas, ignore errors on absent keys
1657
+ doc.write(`
1658
+ if (${id}.issues.length) {
1659
+ if (${k} in input) {
1660
+ payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
1661
+ ...iss,
1662
+ path: iss.path ? [${k}, ...iss.path] : [${k}]
1663
+ })));
1664
+ }
1665
+ }
1666
+
1667
+ if (${id}.value === undefined) {
1668
+ if (${k} in input) {
1669
+ newResult[${k}] = undefined;
1670
+ }
1671
+ } else {
1672
+ newResult[${k}] = ${id}.value;
1673
+ }
1674
+
1675
+ `);
1676
+ }
1677
+ else {
1678
+ doc.write(`
1627
1679
  if (${id}.issues.length) {
1628
1680
  payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
1629
1681
  ...iss,
@@ -1631,7 +1683,6 @@ const $ZodObjectJIT = /*@__PURE__*/ $constructor("$ZodObjectJIT", (inst, def) =>
1631
1683
  })));
1632
1684
  }
1633
1685
 
1634
-
1635
1686
  if (${id}.value === undefined) {
1636
1687
  if (${k} in input) {
1637
1688
  newResult[${k}] = undefined;
@@ -1641,6 +1692,7 @@ const $ZodObjectJIT = /*@__PURE__*/ $constructor("$ZodObjectJIT", (inst, def) =>
1641
1692
  }
1642
1693
 
1643
1694
  `);
1695
+ }
1644
1696
  }
1645
1697
  doc.write(`payload.value = newResult;`);
1646
1698
  doc.write(`return payload;`);
@@ -1807,11 +1859,38 @@ function mergeValues(a, b) {
1807
1859
  return { valid: false, mergeErrorPath: [] };
1808
1860
  }
1809
1861
  function handleIntersectionResults(result, left, right) {
1810
- if (left.issues.length) {
1811
- result.issues.push(...left.issues);
1862
+ // Track which side(s) report each key as unrecognized
1863
+ const unrecKeys = new Map();
1864
+ let unrecIssue;
1865
+ for (const iss of left.issues) {
1866
+ if (iss.code === "unrecognized_keys") {
1867
+ unrecIssue ?? (unrecIssue = iss);
1868
+ for (const k of iss.keys) {
1869
+ if (!unrecKeys.has(k))
1870
+ unrecKeys.set(k, {});
1871
+ unrecKeys.get(k).l = true;
1872
+ }
1873
+ }
1874
+ else {
1875
+ result.issues.push(iss);
1876
+ }
1877
+ }
1878
+ for (const iss of right.issues) {
1879
+ if (iss.code === "unrecognized_keys") {
1880
+ for (const k of iss.keys) {
1881
+ if (!unrecKeys.has(k))
1882
+ unrecKeys.set(k, {});
1883
+ unrecKeys.get(k).r = true;
1884
+ }
1885
+ }
1886
+ else {
1887
+ result.issues.push(iss);
1888
+ }
1812
1889
  }
1813
- if (right.issues.length) {
1814
- result.issues.push(...right.issues);
1890
+ // Report only keys unrecognized by BOTH sides
1891
+ const bothKeys = [...unrecKeys].filter(([, f]) => f.l && f.r).map(([k]) => k);
1892
+ if (bothKeys.length && unrecIssue) {
1893
+ result.issues.push({ ...unrecIssue, keys: bothKeys });
1815
1894
  }
1816
1895
  if (aborted(result))
1817
1896
  return result;
@@ -1896,6 +1975,17 @@ const $ZodOptional = /*@__PURE__*/ $constructor("$ZodOptional", (inst, def) => {
1896
1975
  return def.innerType._zod.run(payload, ctx);
1897
1976
  };
1898
1977
  });
1978
+ const $ZodExactOptional = /*@__PURE__*/ $constructor("$ZodExactOptional", (inst, def) => {
1979
+ // Call parent init - inherits optin/optout = "optional"
1980
+ $ZodOptional.init(inst, def);
1981
+ // Override values/pattern to NOT add undefined
1982
+ defineLazy(inst._zod, "values", () => def.innerType._zod.values);
1983
+ defineLazy(inst._zod, "pattern", () => def.innerType._zod.pattern);
1984
+ // Override parse to just delegate (no undefined handling)
1985
+ inst._zod.parse = (payload, ctx) => {
1986
+ return def.innerType._zod.run(payload, ctx);
1987
+ };
1988
+ });
1899
1989
  const $ZodNullable = /*@__PURE__*/ $constructor("$ZodNullable", (inst, def) => {
1900
1990
  $ZodType.init(inst, def);
1901
1991
  defineLazy(inst._zod, "optin", () => def.innerType._zod.optin);
@@ -2118,9 +2208,6 @@ class $ZodRegistry {
2118
2208
  const meta = _meta[0];
2119
2209
  this._map.set(schema, meta);
2120
2210
  if (meta && typeof meta === "object" && "id" in meta) {
2121
- if (this._idmap.has(meta.id)) {
2122
- throw new Error(`ID ${meta.id} already exists in the registry`);
2123
- }
2124
2211
  this._idmap.set(meta.id, schema);
2125
2212
  }
2126
2213
  return this;
@@ -2161,12 +2248,14 @@ function registry() {
2161
2248
  (_a = globalThis).__zod_globalRegistry ?? (_a.__zod_globalRegistry = registry());
2162
2249
  const globalRegistry = globalThis.__zod_globalRegistry;
2163
2250
 
2251
+ // @__NO_SIDE_EFFECTS__
2164
2252
  function _string(Class, params) {
2165
2253
  return new Class({
2166
2254
  type: "string",
2167
2255
  ...normalizeParams(params),
2168
2256
  });
2169
2257
  }
2258
+ // @__NO_SIDE_EFFECTS__
2170
2259
  function _email(Class, params) {
2171
2260
  return new Class({
2172
2261
  type: "string",
@@ -2176,6 +2265,7 @@ function _email(Class, params) {
2176
2265
  ...normalizeParams(params),
2177
2266
  });
2178
2267
  }
2268
+ // @__NO_SIDE_EFFECTS__
2179
2269
  function _guid(Class, params) {
2180
2270
  return new Class({
2181
2271
  type: "string",
@@ -2185,6 +2275,7 @@ function _guid(Class, params) {
2185
2275
  ...normalizeParams(params),
2186
2276
  });
2187
2277
  }
2278
+ // @__NO_SIDE_EFFECTS__
2188
2279
  function _uuid(Class, params) {
2189
2280
  return new Class({
2190
2281
  type: "string",
@@ -2194,6 +2285,7 @@ function _uuid(Class, params) {
2194
2285
  ...normalizeParams(params),
2195
2286
  });
2196
2287
  }
2288
+ // @__NO_SIDE_EFFECTS__
2197
2289
  function _uuidv4(Class, params) {
2198
2290
  return new Class({
2199
2291
  type: "string",
@@ -2204,6 +2296,7 @@ function _uuidv4(Class, params) {
2204
2296
  ...normalizeParams(params),
2205
2297
  });
2206
2298
  }
2299
+ // @__NO_SIDE_EFFECTS__
2207
2300
  function _uuidv6(Class, params) {
2208
2301
  return new Class({
2209
2302
  type: "string",
@@ -2214,6 +2307,7 @@ function _uuidv6(Class, params) {
2214
2307
  ...normalizeParams(params),
2215
2308
  });
2216
2309
  }
2310
+ // @__NO_SIDE_EFFECTS__
2217
2311
  function _uuidv7(Class, params) {
2218
2312
  return new Class({
2219
2313
  type: "string",
@@ -2224,6 +2318,7 @@ function _uuidv7(Class, params) {
2224
2318
  ...normalizeParams(params),
2225
2319
  });
2226
2320
  }
2321
+ // @__NO_SIDE_EFFECTS__
2227
2322
  function _url(Class, params) {
2228
2323
  return new Class({
2229
2324
  type: "string",
@@ -2233,6 +2328,7 @@ function _url(Class, params) {
2233
2328
  ...normalizeParams(params),
2234
2329
  });
2235
2330
  }
2331
+ // @__NO_SIDE_EFFECTS__
2236
2332
  function _emoji(Class, params) {
2237
2333
  return new Class({
2238
2334
  type: "string",
@@ -2242,6 +2338,7 @@ function _emoji(Class, params) {
2242
2338
  ...normalizeParams(params),
2243
2339
  });
2244
2340
  }
2341
+ // @__NO_SIDE_EFFECTS__
2245
2342
  function _nanoid(Class, params) {
2246
2343
  return new Class({
2247
2344
  type: "string",
@@ -2251,6 +2348,7 @@ function _nanoid(Class, params) {
2251
2348
  ...normalizeParams(params),
2252
2349
  });
2253
2350
  }
2351
+ // @__NO_SIDE_EFFECTS__
2254
2352
  function _cuid(Class, params) {
2255
2353
  return new Class({
2256
2354
  type: "string",
@@ -2260,6 +2358,7 @@ function _cuid(Class, params) {
2260
2358
  ...normalizeParams(params),
2261
2359
  });
2262
2360
  }
2361
+ // @__NO_SIDE_EFFECTS__
2263
2362
  function _cuid2(Class, params) {
2264
2363
  return new Class({
2265
2364
  type: "string",
@@ -2269,6 +2368,7 @@ function _cuid2(Class, params) {
2269
2368
  ...normalizeParams(params),
2270
2369
  });
2271
2370
  }
2371
+ // @__NO_SIDE_EFFECTS__
2272
2372
  function _ulid(Class, params) {
2273
2373
  return new Class({
2274
2374
  type: "string",
@@ -2278,6 +2378,7 @@ function _ulid(Class, params) {
2278
2378
  ...normalizeParams(params),
2279
2379
  });
2280
2380
  }
2381
+ // @__NO_SIDE_EFFECTS__
2281
2382
  function _xid(Class, params) {
2282
2383
  return new Class({
2283
2384
  type: "string",
@@ -2287,6 +2388,7 @@ function _xid(Class, params) {
2287
2388
  ...normalizeParams(params),
2288
2389
  });
2289
2390
  }
2391
+ // @__NO_SIDE_EFFECTS__
2290
2392
  function _ksuid(Class, params) {
2291
2393
  return new Class({
2292
2394
  type: "string",
@@ -2296,6 +2398,7 @@ function _ksuid(Class, params) {
2296
2398
  ...normalizeParams(params),
2297
2399
  });
2298
2400
  }
2401
+ // @__NO_SIDE_EFFECTS__
2299
2402
  function _ipv4(Class, params) {
2300
2403
  return new Class({
2301
2404
  type: "string",
@@ -2305,6 +2408,7 @@ function _ipv4(Class, params) {
2305
2408
  ...normalizeParams(params),
2306
2409
  });
2307
2410
  }
2411
+ // @__NO_SIDE_EFFECTS__
2308
2412
  function _ipv6(Class, params) {
2309
2413
  return new Class({
2310
2414
  type: "string",
@@ -2314,6 +2418,7 @@ function _ipv6(Class, params) {
2314
2418
  ...normalizeParams(params),
2315
2419
  });
2316
2420
  }
2421
+ // @__NO_SIDE_EFFECTS__
2317
2422
  function _cidrv4(Class, params) {
2318
2423
  return new Class({
2319
2424
  type: "string",
@@ -2323,6 +2428,7 @@ function _cidrv4(Class, params) {
2323
2428
  ...normalizeParams(params),
2324
2429
  });
2325
2430
  }
2431
+ // @__NO_SIDE_EFFECTS__
2326
2432
  function _cidrv6(Class, params) {
2327
2433
  return new Class({
2328
2434
  type: "string",
@@ -2332,6 +2438,7 @@ function _cidrv6(Class, params) {
2332
2438
  ...normalizeParams(params),
2333
2439
  });
2334
2440
  }
2441
+ // @__NO_SIDE_EFFECTS__
2335
2442
  function _base64(Class, params) {
2336
2443
  return new Class({
2337
2444
  type: "string",
@@ -2341,6 +2448,7 @@ function _base64(Class, params) {
2341
2448
  ...normalizeParams(params),
2342
2449
  });
2343
2450
  }
2451
+ // @__NO_SIDE_EFFECTS__
2344
2452
  function _base64url(Class, params) {
2345
2453
  return new Class({
2346
2454
  type: "string",
@@ -2350,6 +2458,7 @@ function _base64url(Class, params) {
2350
2458
  ...normalizeParams(params),
2351
2459
  });
2352
2460
  }
2461
+ // @__NO_SIDE_EFFECTS__
2353
2462
  function _e164(Class, params) {
2354
2463
  return new Class({
2355
2464
  type: "string",
@@ -2359,6 +2468,7 @@ function _e164(Class, params) {
2359
2468
  ...normalizeParams(params),
2360
2469
  });
2361
2470
  }
2471
+ // @__NO_SIDE_EFFECTS__
2362
2472
  function _jwt(Class, params) {
2363
2473
  return new Class({
2364
2474
  type: "string",
@@ -2368,6 +2478,7 @@ function _jwt(Class, params) {
2368
2478
  ...normalizeParams(params),
2369
2479
  });
2370
2480
  }
2481
+ // @__NO_SIDE_EFFECTS__
2371
2482
  function _isoDateTime(Class, params) {
2372
2483
  return new Class({
2373
2484
  type: "string",
@@ -2379,6 +2490,7 @@ function _isoDateTime(Class, params) {
2379
2490
  ...normalizeParams(params),
2380
2491
  });
2381
2492
  }
2493
+ // @__NO_SIDE_EFFECTS__
2382
2494
  function _isoDate(Class, params) {
2383
2495
  return new Class({
2384
2496
  type: "string",
@@ -2387,6 +2499,7 @@ function _isoDate(Class, params) {
2387
2499
  ...normalizeParams(params),
2388
2500
  });
2389
2501
  }
2502
+ // @__NO_SIDE_EFFECTS__
2390
2503
  function _isoTime(Class, params) {
2391
2504
  return new Class({
2392
2505
  type: "string",
@@ -2396,6 +2509,7 @@ function _isoTime(Class, params) {
2396
2509
  ...normalizeParams(params),
2397
2510
  });
2398
2511
  }
2512
+ // @__NO_SIDE_EFFECTS__
2399
2513
  function _isoDuration(Class, params) {
2400
2514
  return new Class({
2401
2515
  type: "string",
@@ -2404,17 +2518,20 @@ function _isoDuration(Class, params) {
2404
2518
  ...normalizeParams(params),
2405
2519
  });
2406
2520
  }
2521
+ // @__NO_SIDE_EFFECTS__
2407
2522
  function _unknown(Class) {
2408
2523
  return new Class({
2409
2524
  type: "unknown",
2410
2525
  });
2411
2526
  }
2527
+ // @__NO_SIDE_EFFECTS__
2412
2528
  function _never(Class, params) {
2413
2529
  return new Class({
2414
2530
  type: "never",
2415
2531
  ...normalizeParams(params),
2416
2532
  });
2417
2533
  }
2534
+ // @__NO_SIDE_EFFECTS__
2418
2535
  function _maxLength(maximum, params) {
2419
2536
  const ch = new $ZodCheckMaxLength({
2420
2537
  check: "max_length",
@@ -2423,6 +2540,7 @@ function _maxLength(maximum, params) {
2423
2540
  });
2424
2541
  return ch;
2425
2542
  }
2543
+ // @__NO_SIDE_EFFECTS__
2426
2544
  function _minLength(minimum, params) {
2427
2545
  return new $ZodCheckMinLength({
2428
2546
  check: "min_length",
@@ -2430,6 +2548,7 @@ function _minLength(minimum, params) {
2430
2548
  minimum,
2431
2549
  });
2432
2550
  }
2551
+ // @__NO_SIDE_EFFECTS__
2433
2552
  function _length(length, params) {
2434
2553
  return new $ZodCheckLengthEquals({
2435
2554
  check: "length_equals",
@@ -2437,6 +2556,7 @@ function _length(length, params) {
2437
2556
  length,
2438
2557
  });
2439
2558
  }
2559
+ // @__NO_SIDE_EFFECTS__
2440
2560
  function _regex(pattern, params) {
2441
2561
  return new $ZodCheckRegex({
2442
2562
  check: "string_format",
@@ -2445,6 +2565,7 @@ function _regex(pattern, params) {
2445
2565
  pattern,
2446
2566
  });
2447
2567
  }
2568
+ // @__NO_SIDE_EFFECTS__
2448
2569
  function _lowercase(params) {
2449
2570
  return new $ZodCheckLowerCase({
2450
2571
  check: "string_format",
@@ -2452,6 +2573,7 @@ function _lowercase(params) {
2452
2573
  ...normalizeParams(params),
2453
2574
  });
2454
2575
  }
2576
+ // @__NO_SIDE_EFFECTS__
2455
2577
  function _uppercase(params) {
2456
2578
  return new $ZodCheckUpperCase({
2457
2579
  check: "string_format",
@@ -2459,6 +2581,7 @@ function _uppercase(params) {
2459
2581
  ...normalizeParams(params),
2460
2582
  });
2461
2583
  }
2584
+ // @__NO_SIDE_EFFECTS__
2462
2585
  function _includes(includes, params) {
2463
2586
  return new $ZodCheckIncludes({
2464
2587
  check: "string_format",
@@ -2467,6 +2590,7 @@ function _includes(includes, params) {
2467
2590
  includes,
2468
2591
  });
2469
2592
  }
2593
+ // @__NO_SIDE_EFFECTS__
2470
2594
  function _startsWith(prefix, params) {
2471
2595
  return new $ZodCheckStartsWith({
2472
2596
  check: "string_format",
@@ -2475,6 +2599,7 @@ function _startsWith(prefix, params) {
2475
2599
  prefix,
2476
2600
  });
2477
2601
  }
2602
+ // @__NO_SIDE_EFFECTS__
2478
2603
  function _endsWith(suffix, params) {
2479
2604
  return new $ZodCheckEndsWith({
2480
2605
  check: "string_format",
@@ -2483,6 +2608,7 @@ function _endsWith(suffix, params) {
2483
2608
  suffix,
2484
2609
  });
2485
2610
  }
2611
+ // @__NO_SIDE_EFFECTS__
2486
2612
  function _overwrite(tx) {
2487
2613
  return new $ZodCheckOverwrite({
2488
2614
  check: "overwrite",
@@ -2490,25 +2616,31 @@ function _overwrite(tx) {
2490
2616
  });
2491
2617
  }
2492
2618
  // normalize
2619
+ // @__NO_SIDE_EFFECTS__
2493
2620
  function _normalize(form) {
2494
2621
  return _overwrite((input) => input.normalize(form));
2495
2622
  }
2496
2623
  // trim
2624
+ // @__NO_SIDE_EFFECTS__
2497
2625
  function _trim() {
2498
2626
  return _overwrite((input) => input.trim());
2499
2627
  }
2500
2628
  // toLowerCase
2629
+ // @__NO_SIDE_EFFECTS__
2501
2630
  function _toLowerCase() {
2502
2631
  return _overwrite((input) => input.toLowerCase());
2503
2632
  }
2504
2633
  // toUpperCase
2634
+ // @__NO_SIDE_EFFECTS__
2505
2635
  function _toUpperCase() {
2506
2636
  return _overwrite((input) => input.toUpperCase());
2507
2637
  }
2508
2638
  // slugify
2639
+ // @__NO_SIDE_EFFECTS__
2509
2640
  function _slugify() {
2510
2641
  return _overwrite((input) => slugify(input));
2511
2642
  }
2643
+ // @__NO_SIDE_EFFECTS__
2512
2644
  function _array(Class, element, params) {
2513
2645
  return new Class({
2514
2646
  type: "array",
@@ -2520,6 +2652,7 @@ function _array(Class, element, params) {
2520
2652
  });
2521
2653
  }
2522
2654
  // same as _custom but defaults to abort:false
2655
+ // @__NO_SIDE_EFFECTS__
2523
2656
  function _refine(Class, fn, _params) {
2524
2657
  const schema = new Class({
2525
2658
  type: "custom",
@@ -2529,6 +2662,7 @@ function _refine(Class, fn, _params) {
2529
2662
  });
2530
2663
  return schema;
2531
2664
  }
2665
+ // @__NO_SIDE_EFFECTS__
2532
2666
  function _superRefine(fn) {
2533
2667
  const ch = _check((payload) => {
2534
2668
  payload.addIssue = (issue$1) => {
@@ -2551,6 +2685,7 @@ function _superRefine(fn) {
2551
2685
  });
2552
2686
  return ch;
2553
2687
  }
2688
+ // @__NO_SIDE_EFFECTS__
2554
2689
  function _check(fn, params) {
2555
2690
  const ch = new $ZodCheck({
2556
2691
  check: "custom",
@@ -2617,14 +2752,7 @@ function process(schema, ctx, _params = { path: [], schemaPath: [] }) {
2617
2752
  schemaPath: [..._params.schemaPath, schema],
2618
2753
  path: _params.path,
2619
2754
  };
2620
- const parent = schema._zod.parent;
2621
- if (parent) {
2622
- // schema was cloned from another schema
2623
- result.ref = parent;
2624
- process(parent, ctx, params);
2625
- ctx.seen.get(parent).isParent = true;
2626
- }
2627
- else if (schema._zod.processJSONSchema) {
2755
+ if (schema._zod.processJSONSchema) {
2628
2756
  schema._zod.processJSONSchema(ctx, result.schema, params);
2629
2757
  }
2630
2758
  else {
@@ -2635,6 +2763,14 @@ function process(schema, ctx, _params = { path: [], schemaPath: [] }) {
2635
2763
  }
2636
2764
  processor(schema, ctx, _json, params);
2637
2765
  }
2766
+ const parent = schema._zod.parent;
2767
+ if (parent) {
2768
+ // Also set ref if processor didn't (for inheritance)
2769
+ if (!result.ref)
2770
+ result.ref = parent;
2771
+ process(parent, ctx, params);
2772
+ ctx.seen.get(parent).isParent = true;
2773
+ }
2638
2774
  }
2639
2775
  // metadata
2640
2776
  const meta = ctx.metadataRegistry.get(schema);
@@ -2660,6 +2796,18 @@ function extractDefs(ctx, schema
2660
2796
  const root = ctx.seen.get(schema);
2661
2797
  if (!root)
2662
2798
  throw new Error("Unprocessed schema. This is a bug in Zod.");
2799
+ // Track ids to detect duplicates across different schemas
2800
+ const idToSchema = new Map();
2801
+ for (const entry of ctx.seen.entries()) {
2802
+ const id = ctx.metadataRegistry.get(entry[0])?.id;
2803
+ if (id) {
2804
+ const existing = idToSchema.get(id);
2805
+ if (existing && existing !== entry[0]) {
2806
+ throw new Error(`Duplicate schema id "${id}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);
2807
+ }
2808
+ idToSchema.set(id, entry[0]);
2809
+ }
2810
+ }
2663
2811
  // returns a ref to the schema
2664
2812
  // defId will be empty if the ref points to an external schema (or #)
2665
2813
  const makeURI = (entry) => {
@@ -2761,43 +2909,84 @@ function extractDefs(ctx, schema
2761
2909
  }
2762
2910
  }
2763
2911
  function finalize(ctx, schema) {
2764
- //
2765
- // iterate over seen map;
2766
2912
  const root = ctx.seen.get(schema);
2767
2913
  if (!root)
2768
2914
  throw new Error("Unprocessed schema. This is a bug in Zod.");
2769
- // flatten _refs
2915
+ // flatten refs - inherit properties from parent schemas
2770
2916
  const flattenRef = (zodSchema) => {
2771
2917
  const seen = ctx.seen.get(zodSchema);
2918
+ // already processed
2919
+ if (seen.ref === null)
2920
+ return;
2772
2921
  const schema = seen.def ?? seen.schema;
2773
2922
  const _cached = { ...schema };
2774
- // already seen
2775
- if (seen.ref === null) {
2776
- return;
2777
- }
2778
- // flatten ref if defined
2779
2923
  const ref = seen.ref;
2780
- seen.ref = null; // prevent recursion
2924
+ seen.ref = null; // prevent infinite recursion
2781
2925
  if (ref) {
2782
2926
  flattenRef(ref);
2927
+ const refSeen = ctx.seen.get(ref);
2928
+ const refSchema = refSeen.schema;
2783
2929
  // merge referenced schema into current
2784
- const refSchema = ctx.seen.get(ref).schema;
2785
2930
  if (refSchema.$ref && (ctx.target === "draft-07" || ctx.target === "draft-04" || ctx.target === "openapi-3.0")) {
2931
+ // older drafts can't combine $ref with other properties
2786
2932
  schema.allOf = schema.allOf ?? [];
2787
2933
  schema.allOf.push(refSchema);
2788
2934
  }
2789
2935
  else {
2790
2936
  Object.assign(schema, refSchema);
2791
- Object.assign(schema, _cached); // prevent overwriting any fields in the original schema
2937
+ }
2938
+ // restore child's own properties (child wins)
2939
+ Object.assign(schema, _cached);
2940
+ const isParentRef = zodSchema._zod.parent === ref;
2941
+ // For parent chain, child is a refinement - remove parent-only properties
2942
+ if (isParentRef) {
2943
+ for (const key in schema) {
2944
+ if (key === "$ref" || key === "allOf")
2945
+ continue;
2946
+ if (!(key in _cached)) {
2947
+ delete schema[key];
2948
+ }
2949
+ }
2950
+ }
2951
+ // When ref was extracted to $defs, remove properties that match the definition
2952
+ if (refSchema.$ref && refSeen.def) {
2953
+ for (const key in schema) {
2954
+ if (key === "$ref" || key === "allOf")
2955
+ continue;
2956
+ if (key in refSeen.def && JSON.stringify(schema[key]) === JSON.stringify(refSeen.def[key])) {
2957
+ delete schema[key];
2958
+ }
2959
+ }
2960
+ }
2961
+ }
2962
+ // If parent was extracted (has $ref), propagate $ref to this schema
2963
+ // This handles cases like: readonly().meta({id}).describe()
2964
+ // where processor sets ref to innerType but parent should be referenced
2965
+ const parent = zodSchema._zod.parent;
2966
+ if (parent && parent !== ref) {
2967
+ // Ensure parent is processed first so its def has inherited properties
2968
+ flattenRef(parent);
2969
+ const parentSeen = ctx.seen.get(parent);
2970
+ if (parentSeen?.schema.$ref) {
2971
+ schema.$ref = parentSeen.schema.$ref;
2972
+ // De-duplicate with parent's definition
2973
+ if (parentSeen.def) {
2974
+ for (const key in schema) {
2975
+ if (key === "$ref" || key === "allOf")
2976
+ continue;
2977
+ if (key in parentSeen.def && JSON.stringify(schema[key]) === JSON.stringify(parentSeen.def[key])) {
2978
+ delete schema[key];
2979
+ }
2980
+ }
2981
+ }
2792
2982
  }
2793
2983
  }
2794
2984
  // execute overrides
2795
- if (!seen.isParent)
2796
- ctx.override({
2797
- zodSchema: zodSchema,
2798
- jsonSchema: schema,
2799
- path: seen.path ?? [],
2800
- });
2985
+ ctx.override({
2986
+ zodSchema: zodSchema,
2987
+ jsonSchema: schema,
2988
+ path: seen.path ?? [],
2989
+ });
2801
2990
  };
2802
2991
  for (const entry of [...ctx.seen.entries()].reverse()) {
2803
2992
  flattenRef(entry[0]);
@@ -2850,8 +3039,8 @@ function finalize(ctx, schema) {
2850
3039
  value: {
2851
3040
  ...schema["~standard"],
2852
3041
  jsonSchema: {
2853
- input: createStandardJSONSchemaMethod(schema, "input"),
2854
- output: createStandardJSONSchemaMethod(schema, "output"),
3042
+ input: createStandardJSONSchemaMethod(schema, "input", ctx.processors),
3043
+ output: createStandardJSONSchemaMethod(schema, "output", ctx.processors),
2855
3044
  },
2856
3045
  },
2857
3046
  enumerable: false,
@@ -2930,9 +3119,9 @@ const createToJSONSchemaMethod = (schema, processors = {}) => (params) => {
2930
3119
  extractDefs(ctx, schema);
2931
3120
  return finalize(ctx, schema);
2932
3121
  };
2933
- const createStandardJSONSchemaMethod = (schema, io) => (params) => {
3122
+ const createStandardJSONSchemaMethod = (schema, io, processors = {}) => (params) => {
2934
3123
  const { libraryOptions, target } = params ?? {};
2935
- const ctx = initializeContext({ ...(libraryOptions ?? {}), target, io, processors: {} });
3124
+ const ctx = initializeContext({ ...(libraryOptions ?? {}), target, io, processors });
2936
3125
  process(schema, ctx);
2937
3126
  extractDefs(ctx, schema);
2938
3127
  return finalize(ctx, schema);
@@ -2960,6 +3149,11 @@ const stringProcessor = (schema, ctx, _json, _params) => {
2960
3149
  json.format = formatMap[format] ?? format;
2961
3150
  if (json.format === "")
2962
3151
  delete json.format; // empty format is not valid
3152
+ // JSON Schema format: "time" requires a full time with offset or Z
3153
+ // z.iso.time() does not include timezone information, so format: "time" should never be used
3154
+ if (format === "time") {
3155
+ delete json.format;
3156
+ }
2963
3157
  }
2964
3158
  if (contentEncoding)
2965
3159
  json.contentEncoding = contentEncoding;
@@ -3268,8 +3462,11 @@ const ZodType = /*@__PURE__*/ $constructor("ZodType", (inst, def) => {
3268
3462
  ...(def.checks ?? []),
3269
3463
  ...checks.map((ch) => typeof ch === "function" ? { _zod: { check: ch, def: { check: "custom" }, onattach: [] } } : ch),
3270
3464
  ],
3271
- }));
3465
+ }), {
3466
+ parent: true,
3467
+ });
3272
3468
  };
3469
+ inst.with = inst.check;
3273
3470
  inst.clone = (def, params) => clone(inst, def, params);
3274
3471
  inst.brand = () => inst;
3275
3472
  inst.register = ((reg, meta) => {
@@ -3297,6 +3494,7 @@ const ZodType = /*@__PURE__*/ $constructor("ZodType", (inst, def) => {
3297
3494
  inst.overwrite = (fn) => inst.check(_overwrite(fn));
3298
3495
  // wrappers
3299
3496
  inst.optional = () => optional(inst);
3497
+ inst.exactOptional = () => exactOptional(inst);
3300
3498
  inst.nullable = () => nullable(inst);
3301
3499
  inst.nullish = () => optional(nullable(inst));
3302
3500
  inst.nonoptional = (params) => nonoptional(inst, params);
@@ -3333,6 +3531,7 @@ const ZodType = /*@__PURE__*/ $constructor("ZodType", (inst, def) => {
3333
3531
  // helpers
3334
3532
  inst.isOptional = () => inst.safeParse(undefined).success;
3335
3533
  inst.isNullable = () => inst.safeParse(null).success;
3534
+ inst.apply = (fn) => fn(inst);
3336
3535
  return inst;
3337
3536
  });
3338
3537
  /** @internal */
@@ -3683,6 +3882,18 @@ function optional(innerType) {
3683
3882
  innerType: innerType,
3684
3883
  });
3685
3884
  }
3885
+ const ZodExactOptional = /*@__PURE__*/ $constructor("ZodExactOptional", (inst, def) => {
3886
+ $ZodExactOptional.init(inst, def);
3887
+ ZodType.init(inst, def);
3888
+ inst._zod.processJSONSchema = (ctx, json, params) => optionalProcessor(inst, ctx, json, params);
3889
+ inst.unwrap = () => inst._zod.def.innerType;
3890
+ });
3891
+ function exactOptional(innerType) {
3892
+ return new ZodExactOptional({
3893
+ type: "optional",
3894
+ innerType: innerType,
3895
+ });
3896
+ }
3686
3897
  const ZodNullable = /*@__PURE__*/ $constructor("ZodNullable", (inst, def) => {
3687
3898
  $ZodNullable.init(inst, def);
3688
3899
  ZodType.init(inst, def);
@@ -3822,7 +4033,6 @@ class UiPathConfig {
3822
4033
  class ExecutionContext {
3823
4034
  constructor() {
3824
4035
  this.context = new Map();
3825
- this.headers = {};
3826
4036
  }
3827
4037
  /**
3828
4038
  * Set a context value that will be available throughout the execution
@@ -3837,35 +4047,10 @@ class ExecutionContext {
3837
4047
  return this.context.get(key);
3838
4048
  }
3839
4049
  /**
3840
- * Set custom headers that will be included in all API requests
3841
- */
3842
- setHeaders(headers) {
3843
- this.headers = { ...this.headers, ...headers };
3844
- }
3845
- /**
3846
- * Get all custom headers
3847
- */
3848
- getHeaders() {
3849
- return { ...this.headers };
3850
- }
3851
- /**
3852
- * Clear all context and headers
4050
+ * Clear all context
3853
4051
  */
3854
4052
  clear() {
3855
4053
  this.context.clear();
3856
- this.headers = {};
3857
- }
3858
- /**
3859
- * Create a request spec for an API call
3860
- */
3861
- createRequestSpec(spec = {}) {
3862
- return {
3863
- ...spec,
3864
- headers: {
3865
- ...this.getHeaders(),
3866
- ...spec.headers
3867
- }
3868
- };
3869
4054
  }
3870
4055
  }
3871
4056
 
@@ -4999,7 +5184,7 @@ function normalizeBaseUrl(url) {
4999
5184
  // Connection string placeholder that will be replaced during build
5000
5185
  const CONNECTION_STRING = "InstrumentationKey=a6efa11d-1feb-4508-9738-e13e12dcae5e;IngestionEndpoint=https://westeurope-5.in.applicationinsights.azure.com/;LiveEndpoint=https://westeurope.livediagnostics.monitor.azure.com/;ApplicationId=7c58eb1c-9581-4ba6-839e-11725848a037";
5001
5186
  // SDK Version placeholder
5002
- const SDK_VERSION = "1.1.3";
5187
+ const SDK_VERSION = "1.2.1";
5003
5188
  const VERSION = "Version";
5004
5189
  const SERVICE = "Service";
5005
5190
  const CLOUD_ORGANIZATION_NAME = "CloudOrganizationName";
@@ -5530,6 +5715,15 @@ class UiPath {
5530
5715
  __classPrivateFieldGet(this, _UiPath_authService, "f")?.logout();
5531
5716
  __classPrivateFieldSet(this, _UiPath_initialized, false, "f");
5532
5717
  }
5718
+ /**
5719
+ * Updates the access token used for API requests.
5720
+ * Use this to inject or refresh a token externally.
5721
+ *
5722
+ * @param tokenInfo - The token information containing the access token, type, expiration, and optional refresh token
5723
+ */
5724
+ updateToken(tokenInfo) {
5725
+ __classPrivateFieldGet(this, _UiPath_authService, "f")?.updateToken(tokenInfo);
5726
+ }
5533
5727
  }
5534
5728
  _UiPath_config = new WeakMap(), _UiPath_authService = new WeakMap(), _UiPath_initialized = new WeakMap(), _UiPath_partialConfig = new WeakMap(), _UiPath_instances = new WeakSet(), _UiPath_initializeWithConfig = function _UiPath_initializeWithConfig(config) {
5535
5729
  // Validate and normalize the configuration