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