@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/index.mjs
CHANGED
|
@@ -274,6 +274,11 @@ function optionalKeys(shape) {
|
|
|
274
274
|
}
|
|
275
275
|
function pick(schema, mask) {
|
|
276
276
|
const currDef = schema._zod.def;
|
|
277
|
+
const checks = currDef.checks;
|
|
278
|
+
const hasChecks = checks && checks.length > 0;
|
|
279
|
+
if (hasChecks) {
|
|
280
|
+
throw new Error(".pick() cannot be used on object schemas containing refinements");
|
|
281
|
+
}
|
|
277
282
|
const def = mergeDefs(schema._zod.def, {
|
|
278
283
|
get shape() {
|
|
279
284
|
const newShape = {};
|
|
@@ -294,6 +299,11 @@ function pick(schema, mask) {
|
|
|
294
299
|
}
|
|
295
300
|
function omit(schema, mask) {
|
|
296
301
|
const currDef = schema._zod.def;
|
|
302
|
+
const checks = currDef.checks;
|
|
303
|
+
const hasChecks = checks && checks.length > 0;
|
|
304
|
+
if (hasChecks) {
|
|
305
|
+
throw new Error(".omit() cannot be used on object schemas containing refinements");
|
|
306
|
+
}
|
|
297
307
|
const def = mergeDefs(schema._zod.def, {
|
|
298
308
|
get shape() {
|
|
299
309
|
const newShape = { ...schema._zod.def.shape };
|
|
@@ -319,7 +329,14 @@ function extend(schema, shape) {
|
|
|
319
329
|
const checks = schema._zod.def.checks;
|
|
320
330
|
const hasChecks = checks && checks.length > 0;
|
|
321
331
|
if (hasChecks) {
|
|
322
|
-
|
|
332
|
+
// Only throw if new shape overlaps with existing shape
|
|
333
|
+
// Use getOwnPropertyDescriptor to check key existence without accessing values
|
|
334
|
+
const existingShape = schema._zod.def.shape;
|
|
335
|
+
for (const key in shape) {
|
|
336
|
+
if (Object.getOwnPropertyDescriptor(existingShape, key) !== undefined) {
|
|
337
|
+
throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.");
|
|
338
|
+
}
|
|
339
|
+
}
|
|
323
340
|
}
|
|
324
341
|
const def = mergeDefs(schema._zod.def, {
|
|
325
342
|
get shape() {
|
|
@@ -327,7 +344,6 @@ function extend(schema, shape) {
|
|
|
327
344
|
assignProp(this, "shape", _shape); // self-caching
|
|
328
345
|
return _shape;
|
|
329
346
|
},
|
|
330
|
-
checks: [],
|
|
331
347
|
});
|
|
332
348
|
return clone(schema, def);
|
|
333
349
|
}
|
|
@@ -335,15 +351,13 @@ function safeExtend(schema, shape) {
|
|
|
335
351
|
if (!isPlainObject(shape)) {
|
|
336
352
|
throw new Error("Invalid input to safeExtend: expected a plain object");
|
|
337
353
|
}
|
|
338
|
-
const def = {
|
|
339
|
-
...schema._zod.def,
|
|
354
|
+
const def = mergeDefs(schema._zod.def, {
|
|
340
355
|
get shape() {
|
|
341
356
|
const _shape = { ...schema._zod.def.shape, ...shape };
|
|
342
357
|
assignProp(this, "shape", _shape); // self-caching
|
|
343
358
|
return _shape;
|
|
344
359
|
},
|
|
345
|
-
|
|
346
|
-
};
|
|
360
|
+
});
|
|
347
361
|
return clone(schema, def);
|
|
348
362
|
}
|
|
349
363
|
function merge(a, b) {
|
|
@@ -361,6 +375,12 @@ function merge(a, b) {
|
|
|
361
375
|
return clone(a, def);
|
|
362
376
|
}
|
|
363
377
|
function partial(Class, schema, mask) {
|
|
378
|
+
const currDef = schema._zod.def;
|
|
379
|
+
const checks = currDef.checks;
|
|
380
|
+
const hasChecks = checks && checks.length > 0;
|
|
381
|
+
if (hasChecks) {
|
|
382
|
+
throw new Error(".partial() cannot be used on object schemas containing refinements");
|
|
383
|
+
}
|
|
364
384
|
const def = mergeDefs(schema._zod.def, {
|
|
365
385
|
get shape() {
|
|
366
386
|
const oldShape = schema._zod.def.shape;
|
|
@@ -430,7 +450,6 @@ function required(Class, schema, mask) {
|
|
|
430
450
|
assignProp(this, "shape", shape); // self-caching
|
|
431
451
|
return shape;
|
|
432
452
|
},
|
|
433
|
-
checks: [],
|
|
434
453
|
});
|
|
435
454
|
return clone(schema, def);
|
|
436
455
|
}
|
|
@@ -680,7 +699,8 @@ const cidrv6 = /^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?:
|
|
|
680
699
|
const base64 = /^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/;
|
|
681
700
|
const base64url = /^[A-Za-z0-9_-]*$/;
|
|
682
701
|
// https://blog.stevenlevithan.com/archives/validate-phone-number#r4-3 (regex sans spaces)
|
|
683
|
-
|
|
702
|
+
// E.164: leading digit must be 1-9; total digits (excluding '+') between 7-15
|
|
703
|
+
const e164 = /^\+[1-9]\d{6,14}$/;
|
|
684
704
|
// 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])))`;
|
|
685
705
|
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])))`;
|
|
686
706
|
const date$1 = /*@__PURE__*/ new RegExp(`^${dateSource}$`);
|
|
@@ -984,8 +1004,8 @@ class Doc {
|
|
|
984
1004
|
|
|
985
1005
|
const version = {
|
|
986
1006
|
major: 4,
|
|
987
|
-
minor:
|
|
988
|
-
patch:
|
|
1007
|
+
minor: 3,
|
|
1008
|
+
patch: 6,
|
|
989
1009
|
};
|
|
990
1010
|
|
|
991
1011
|
const $ZodType = /*@__PURE__*/ $constructor("$ZodType", (inst, def) => {
|
|
@@ -1095,7 +1115,8 @@ const $ZodType = /*@__PURE__*/ $constructor("$ZodType", (inst, def) => {
|
|
|
1095
1115
|
return runChecks(result, checks, ctx);
|
|
1096
1116
|
};
|
|
1097
1117
|
}
|
|
1098
|
-
|
|
1118
|
+
// Lazy initialize ~standard to avoid creating objects for every schema
|
|
1119
|
+
defineLazy(inst, "~standard", () => ({
|
|
1099
1120
|
validate: (value) => {
|
|
1100
1121
|
try {
|
|
1101
1122
|
const r = safeParse$1(inst, value);
|
|
@@ -1107,7 +1128,7 @@ const $ZodType = /*@__PURE__*/ $constructor("$ZodType", (inst, def) => {
|
|
|
1107
1128
|
},
|
|
1108
1129
|
vendor: "zod",
|
|
1109
1130
|
version: 1,
|
|
1110
|
-
};
|
|
1131
|
+
}));
|
|
1111
1132
|
});
|
|
1112
1133
|
const $ZodString = /*@__PURE__*/ $constructor("$ZodString", (inst, def) => {
|
|
1113
1134
|
$ZodType.init(inst, def);
|
|
@@ -1477,8 +1498,12 @@ const $ZodArray = /*@__PURE__*/ $constructor("$ZodArray", (inst, def) => {
|
|
|
1477
1498
|
return payload; //handleArrayResultsAsync(parseResults, final);
|
|
1478
1499
|
};
|
|
1479
1500
|
});
|
|
1480
|
-
function handlePropertyResult(result, final, key, input) {
|
|
1501
|
+
function handlePropertyResult(result, final, key, input, isOptionalOut) {
|
|
1481
1502
|
if (result.issues.length) {
|
|
1503
|
+
// For optional-out schemas, ignore errors on absent keys
|
|
1504
|
+
if (isOptionalOut && !(key in input)) {
|
|
1505
|
+
return;
|
|
1506
|
+
}
|
|
1482
1507
|
final.issues.push(...prefixIssues(key, result.issues));
|
|
1483
1508
|
}
|
|
1484
1509
|
if (result.value === undefined) {
|
|
@@ -1512,6 +1537,7 @@ function handleCatchall(proms, input, payload, ctx, def, inst) {
|
|
|
1512
1537
|
const keySet = def.keySet;
|
|
1513
1538
|
const _catchall = def.catchall._zod;
|
|
1514
1539
|
const t = _catchall.def.type;
|
|
1540
|
+
const isOptionalOut = _catchall.optout === "optional";
|
|
1515
1541
|
for (const key in input) {
|
|
1516
1542
|
if (keySet.has(key))
|
|
1517
1543
|
continue;
|
|
@@ -1521,10 +1547,10 @@ function handleCatchall(proms, input, payload, ctx, def, inst) {
|
|
|
1521
1547
|
}
|
|
1522
1548
|
const r = _catchall.run({ value: input[key], issues: [] }, ctx);
|
|
1523
1549
|
if (r instanceof Promise) {
|
|
1524
|
-
proms.push(r.then((r) => handlePropertyResult(r, payload, key, input)));
|
|
1550
|
+
proms.push(r.then((r) => handlePropertyResult(r, payload, key, input, isOptionalOut)));
|
|
1525
1551
|
}
|
|
1526
1552
|
else {
|
|
1527
|
-
handlePropertyResult(r, payload, key, input);
|
|
1553
|
+
handlePropertyResult(r, payload, key, input, isOptionalOut);
|
|
1528
1554
|
}
|
|
1529
1555
|
}
|
|
1530
1556
|
if (unrecognized.length) {
|
|
@@ -1592,12 +1618,13 @@ const $ZodObject = /*@__PURE__*/ $constructor("$ZodObject", (inst, def) => {
|
|
|
1592
1618
|
const shape = value.shape;
|
|
1593
1619
|
for (const key of value.keys) {
|
|
1594
1620
|
const el = shape[key];
|
|
1621
|
+
const isOptionalOut = el._zod.optout === "optional";
|
|
1595
1622
|
const r = el._zod.run({ value: input[key], issues: [] }, ctx);
|
|
1596
1623
|
if (r instanceof Promise) {
|
|
1597
|
-
proms.push(r.then((r) => handlePropertyResult(r, payload, key, input)));
|
|
1624
|
+
proms.push(r.then((r) => handlePropertyResult(r, payload, key, input, isOptionalOut)));
|
|
1598
1625
|
}
|
|
1599
1626
|
else {
|
|
1600
|
-
handlePropertyResult(r, payload, key, input);
|
|
1627
|
+
handlePropertyResult(r, payload, key, input, isOptionalOut);
|
|
1601
1628
|
}
|
|
1602
1629
|
}
|
|
1603
1630
|
if (!catchall) {
|
|
@@ -1629,8 +1656,33 @@ const $ZodObjectJIT = /*@__PURE__*/ $constructor("$ZodObjectJIT", (inst, def) =>
|
|
|
1629
1656
|
for (const key of normalized.keys) {
|
|
1630
1657
|
const id = ids[key];
|
|
1631
1658
|
const k = esc(key);
|
|
1659
|
+
const schema = shape[key];
|
|
1660
|
+
const isOptionalOut = schema?._zod?.optout === "optional";
|
|
1632
1661
|
doc.write(`const ${id} = ${parseStr(key)};`);
|
|
1633
|
-
|
|
1662
|
+
if (isOptionalOut) {
|
|
1663
|
+
// For optional-out schemas, ignore errors on absent keys
|
|
1664
|
+
doc.write(`
|
|
1665
|
+
if (${id}.issues.length) {
|
|
1666
|
+
if (${k} in input) {
|
|
1667
|
+
payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
|
|
1668
|
+
...iss,
|
|
1669
|
+
path: iss.path ? [${k}, ...iss.path] : [${k}]
|
|
1670
|
+
})));
|
|
1671
|
+
}
|
|
1672
|
+
}
|
|
1673
|
+
|
|
1674
|
+
if (${id}.value === undefined) {
|
|
1675
|
+
if (${k} in input) {
|
|
1676
|
+
newResult[${k}] = undefined;
|
|
1677
|
+
}
|
|
1678
|
+
} else {
|
|
1679
|
+
newResult[${k}] = ${id}.value;
|
|
1680
|
+
}
|
|
1681
|
+
|
|
1682
|
+
`);
|
|
1683
|
+
}
|
|
1684
|
+
else {
|
|
1685
|
+
doc.write(`
|
|
1634
1686
|
if (${id}.issues.length) {
|
|
1635
1687
|
payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
|
|
1636
1688
|
...iss,
|
|
@@ -1638,7 +1690,6 @@ const $ZodObjectJIT = /*@__PURE__*/ $constructor("$ZodObjectJIT", (inst, def) =>
|
|
|
1638
1690
|
})));
|
|
1639
1691
|
}
|
|
1640
1692
|
|
|
1641
|
-
|
|
1642
1693
|
if (${id}.value === undefined) {
|
|
1643
1694
|
if (${k} in input) {
|
|
1644
1695
|
newResult[${k}] = undefined;
|
|
@@ -1648,6 +1699,7 @@ const $ZodObjectJIT = /*@__PURE__*/ $constructor("$ZodObjectJIT", (inst, def) =>
|
|
|
1648
1699
|
}
|
|
1649
1700
|
|
|
1650
1701
|
`);
|
|
1702
|
+
}
|
|
1651
1703
|
}
|
|
1652
1704
|
doc.write(`payload.value = newResult;`);
|
|
1653
1705
|
doc.write(`return payload;`);
|
|
@@ -1814,11 +1866,38 @@ function mergeValues(a, b) {
|
|
|
1814
1866
|
return { valid: false, mergeErrorPath: [] };
|
|
1815
1867
|
}
|
|
1816
1868
|
function handleIntersectionResults(result, left, right) {
|
|
1817
|
-
|
|
1818
|
-
|
|
1869
|
+
// Track which side(s) report each key as unrecognized
|
|
1870
|
+
const unrecKeys = new Map();
|
|
1871
|
+
let unrecIssue;
|
|
1872
|
+
for (const iss of left.issues) {
|
|
1873
|
+
if (iss.code === "unrecognized_keys") {
|
|
1874
|
+
unrecIssue ?? (unrecIssue = iss);
|
|
1875
|
+
for (const k of iss.keys) {
|
|
1876
|
+
if (!unrecKeys.has(k))
|
|
1877
|
+
unrecKeys.set(k, {});
|
|
1878
|
+
unrecKeys.get(k).l = true;
|
|
1879
|
+
}
|
|
1880
|
+
}
|
|
1881
|
+
else {
|
|
1882
|
+
result.issues.push(iss);
|
|
1883
|
+
}
|
|
1819
1884
|
}
|
|
1820
|
-
|
|
1821
|
-
|
|
1885
|
+
for (const iss of right.issues) {
|
|
1886
|
+
if (iss.code === "unrecognized_keys") {
|
|
1887
|
+
for (const k of iss.keys) {
|
|
1888
|
+
if (!unrecKeys.has(k))
|
|
1889
|
+
unrecKeys.set(k, {});
|
|
1890
|
+
unrecKeys.get(k).r = true;
|
|
1891
|
+
}
|
|
1892
|
+
}
|
|
1893
|
+
else {
|
|
1894
|
+
result.issues.push(iss);
|
|
1895
|
+
}
|
|
1896
|
+
}
|
|
1897
|
+
// Report only keys unrecognized by BOTH sides
|
|
1898
|
+
const bothKeys = [...unrecKeys].filter(([, f]) => f.l && f.r).map(([k]) => k);
|
|
1899
|
+
if (bothKeys.length && unrecIssue) {
|
|
1900
|
+
result.issues.push({ ...unrecIssue, keys: bothKeys });
|
|
1822
1901
|
}
|
|
1823
1902
|
if (aborted(result))
|
|
1824
1903
|
return result;
|
|
@@ -1903,6 +1982,17 @@ const $ZodOptional = /*@__PURE__*/ $constructor("$ZodOptional", (inst, def) => {
|
|
|
1903
1982
|
return def.innerType._zod.run(payload, ctx);
|
|
1904
1983
|
};
|
|
1905
1984
|
});
|
|
1985
|
+
const $ZodExactOptional = /*@__PURE__*/ $constructor("$ZodExactOptional", (inst, def) => {
|
|
1986
|
+
// Call parent init - inherits optin/optout = "optional"
|
|
1987
|
+
$ZodOptional.init(inst, def);
|
|
1988
|
+
// Override values/pattern to NOT add undefined
|
|
1989
|
+
defineLazy(inst._zod, "values", () => def.innerType._zod.values);
|
|
1990
|
+
defineLazy(inst._zod, "pattern", () => def.innerType._zod.pattern);
|
|
1991
|
+
// Override parse to just delegate (no undefined handling)
|
|
1992
|
+
inst._zod.parse = (payload, ctx) => {
|
|
1993
|
+
return def.innerType._zod.run(payload, ctx);
|
|
1994
|
+
};
|
|
1995
|
+
});
|
|
1906
1996
|
const $ZodNullable = /*@__PURE__*/ $constructor("$ZodNullable", (inst, def) => {
|
|
1907
1997
|
$ZodType.init(inst, def);
|
|
1908
1998
|
defineLazy(inst._zod, "optin", () => def.innerType._zod.optin);
|
|
@@ -2125,9 +2215,6 @@ class $ZodRegistry {
|
|
|
2125
2215
|
const meta = _meta[0];
|
|
2126
2216
|
this._map.set(schema, meta);
|
|
2127
2217
|
if (meta && typeof meta === "object" && "id" in meta) {
|
|
2128
|
-
if (this._idmap.has(meta.id)) {
|
|
2129
|
-
throw new Error(`ID ${meta.id} already exists in the registry`);
|
|
2130
|
-
}
|
|
2131
2218
|
this._idmap.set(meta.id, schema);
|
|
2132
2219
|
}
|
|
2133
2220
|
return this;
|
|
@@ -2168,12 +2255,14 @@ function registry() {
|
|
|
2168
2255
|
(_a = globalThis).__zod_globalRegistry ?? (_a.__zod_globalRegistry = registry());
|
|
2169
2256
|
const globalRegistry = globalThis.__zod_globalRegistry;
|
|
2170
2257
|
|
|
2258
|
+
// @__NO_SIDE_EFFECTS__
|
|
2171
2259
|
function _string(Class, params) {
|
|
2172
2260
|
return new Class({
|
|
2173
2261
|
type: "string",
|
|
2174
2262
|
...normalizeParams(params),
|
|
2175
2263
|
});
|
|
2176
2264
|
}
|
|
2265
|
+
// @__NO_SIDE_EFFECTS__
|
|
2177
2266
|
function _email(Class, params) {
|
|
2178
2267
|
return new Class({
|
|
2179
2268
|
type: "string",
|
|
@@ -2183,6 +2272,7 @@ function _email(Class, params) {
|
|
|
2183
2272
|
...normalizeParams(params),
|
|
2184
2273
|
});
|
|
2185
2274
|
}
|
|
2275
|
+
// @__NO_SIDE_EFFECTS__
|
|
2186
2276
|
function _guid(Class, params) {
|
|
2187
2277
|
return new Class({
|
|
2188
2278
|
type: "string",
|
|
@@ -2192,6 +2282,7 @@ function _guid(Class, params) {
|
|
|
2192
2282
|
...normalizeParams(params),
|
|
2193
2283
|
});
|
|
2194
2284
|
}
|
|
2285
|
+
// @__NO_SIDE_EFFECTS__
|
|
2195
2286
|
function _uuid(Class, params) {
|
|
2196
2287
|
return new Class({
|
|
2197
2288
|
type: "string",
|
|
@@ -2201,6 +2292,7 @@ function _uuid(Class, params) {
|
|
|
2201
2292
|
...normalizeParams(params),
|
|
2202
2293
|
});
|
|
2203
2294
|
}
|
|
2295
|
+
// @__NO_SIDE_EFFECTS__
|
|
2204
2296
|
function _uuidv4(Class, params) {
|
|
2205
2297
|
return new Class({
|
|
2206
2298
|
type: "string",
|
|
@@ -2211,6 +2303,7 @@ function _uuidv4(Class, params) {
|
|
|
2211
2303
|
...normalizeParams(params),
|
|
2212
2304
|
});
|
|
2213
2305
|
}
|
|
2306
|
+
// @__NO_SIDE_EFFECTS__
|
|
2214
2307
|
function _uuidv6(Class, params) {
|
|
2215
2308
|
return new Class({
|
|
2216
2309
|
type: "string",
|
|
@@ -2221,6 +2314,7 @@ function _uuidv6(Class, params) {
|
|
|
2221
2314
|
...normalizeParams(params),
|
|
2222
2315
|
});
|
|
2223
2316
|
}
|
|
2317
|
+
// @__NO_SIDE_EFFECTS__
|
|
2224
2318
|
function _uuidv7(Class, params) {
|
|
2225
2319
|
return new Class({
|
|
2226
2320
|
type: "string",
|
|
@@ -2231,6 +2325,7 @@ function _uuidv7(Class, params) {
|
|
|
2231
2325
|
...normalizeParams(params),
|
|
2232
2326
|
});
|
|
2233
2327
|
}
|
|
2328
|
+
// @__NO_SIDE_EFFECTS__
|
|
2234
2329
|
function _url(Class, params) {
|
|
2235
2330
|
return new Class({
|
|
2236
2331
|
type: "string",
|
|
@@ -2240,6 +2335,7 @@ function _url(Class, params) {
|
|
|
2240
2335
|
...normalizeParams(params),
|
|
2241
2336
|
});
|
|
2242
2337
|
}
|
|
2338
|
+
// @__NO_SIDE_EFFECTS__
|
|
2243
2339
|
function _emoji(Class, params) {
|
|
2244
2340
|
return new Class({
|
|
2245
2341
|
type: "string",
|
|
@@ -2249,6 +2345,7 @@ function _emoji(Class, params) {
|
|
|
2249
2345
|
...normalizeParams(params),
|
|
2250
2346
|
});
|
|
2251
2347
|
}
|
|
2348
|
+
// @__NO_SIDE_EFFECTS__
|
|
2252
2349
|
function _nanoid(Class, params) {
|
|
2253
2350
|
return new Class({
|
|
2254
2351
|
type: "string",
|
|
@@ -2258,6 +2355,7 @@ function _nanoid(Class, params) {
|
|
|
2258
2355
|
...normalizeParams(params),
|
|
2259
2356
|
});
|
|
2260
2357
|
}
|
|
2358
|
+
// @__NO_SIDE_EFFECTS__
|
|
2261
2359
|
function _cuid(Class, params) {
|
|
2262
2360
|
return new Class({
|
|
2263
2361
|
type: "string",
|
|
@@ -2267,6 +2365,7 @@ function _cuid(Class, params) {
|
|
|
2267
2365
|
...normalizeParams(params),
|
|
2268
2366
|
});
|
|
2269
2367
|
}
|
|
2368
|
+
// @__NO_SIDE_EFFECTS__
|
|
2270
2369
|
function _cuid2(Class, params) {
|
|
2271
2370
|
return new Class({
|
|
2272
2371
|
type: "string",
|
|
@@ -2276,6 +2375,7 @@ function _cuid2(Class, params) {
|
|
|
2276
2375
|
...normalizeParams(params),
|
|
2277
2376
|
});
|
|
2278
2377
|
}
|
|
2378
|
+
// @__NO_SIDE_EFFECTS__
|
|
2279
2379
|
function _ulid(Class, params) {
|
|
2280
2380
|
return new Class({
|
|
2281
2381
|
type: "string",
|
|
@@ -2285,6 +2385,7 @@ function _ulid(Class, params) {
|
|
|
2285
2385
|
...normalizeParams(params),
|
|
2286
2386
|
});
|
|
2287
2387
|
}
|
|
2388
|
+
// @__NO_SIDE_EFFECTS__
|
|
2288
2389
|
function _xid(Class, params) {
|
|
2289
2390
|
return new Class({
|
|
2290
2391
|
type: "string",
|
|
@@ -2294,6 +2395,7 @@ function _xid(Class, params) {
|
|
|
2294
2395
|
...normalizeParams(params),
|
|
2295
2396
|
});
|
|
2296
2397
|
}
|
|
2398
|
+
// @__NO_SIDE_EFFECTS__
|
|
2297
2399
|
function _ksuid(Class, params) {
|
|
2298
2400
|
return new Class({
|
|
2299
2401
|
type: "string",
|
|
@@ -2303,6 +2405,7 @@ function _ksuid(Class, params) {
|
|
|
2303
2405
|
...normalizeParams(params),
|
|
2304
2406
|
});
|
|
2305
2407
|
}
|
|
2408
|
+
// @__NO_SIDE_EFFECTS__
|
|
2306
2409
|
function _ipv4(Class, params) {
|
|
2307
2410
|
return new Class({
|
|
2308
2411
|
type: "string",
|
|
@@ -2312,6 +2415,7 @@ function _ipv4(Class, params) {
|
|
|
2312
2415
|
...normalizeParams(params),
|
|
2313
2416
|
});
|
|
2314
2417
|
}
|
|
2418
|
+
// @__NO_SIDE_EFFECTS__
|
|
2315
2419
|
function _ipv6(Class, params) {
|
|
2316
2420
|
return new Class({
|
|
2317
2421
|
type: "string",
|
|
@@ -2321,6 +2425,7 @@ function _ipv6(Class, params) {
|
|
|
2321
2425
|
...normalizeParams(params),
|
|
2322
2426
|
});
|
|
2323
2427
|
}
|
|
2428
|
+
// @__NO_SIDE_EFFECTS__
|
|
2324
2429
|
function _cidrv4(Class, params) {
|
|
2325
2430
|
return new Class({
|
|
2326
2431
|
type: "string",
|
|
@@ -2330,6 +2435,7 @@ function _cidrv4(Class, params) {
|
|
|
2330
2435
|
...normalizeParams(params),
|
|
2331
2436
|
});
|
|
2332
2437
|
}
|
|
2438
|
+
// @__NO_SIDE_EFFECTS__
|
|
2333
2439
|
function _cidrv6(Class, params) {
|
|
2334
2440
|
return new Class({
|
|
2335
2441
|
type: "string",
|
|
@@ -2339,6 +2445,7 @@ function _cidrv6(Class, params) {
|
|
|
2339
2445
|
...normalizeParams(params),
|
|
2340
2446
|
});
|
|
2341
2447
|
}
|
|
2448
|
+
// @__NO_SIDE_EFFECTS__
|
|
2342
2449
|
function _base64(Class, params) {
|
|
2343
2450
|
return new Class({
|
|
2344
2451
|
type: "string",
|
|
@@ -2348,6 +2455,7 @@ function _base64(Class, params) {
|
|
|
2348
2455
|
...normalizeParams(params),
|
|
2349
2456
|
});
|
|
2350
2457
|
}
|
|
2458
|
+
// @__NO_SIDE_EFFECTS__
|
|
2351
2459
|
function _base64url(Class, params) {
|
|
2352
2460
|
return new Class({
|
|
2353
2461
|
type: "string",
|
|
@@ -2357,6 +2465,7 @@ function _base64url(Class, params) {
|
|
|
2357
2465
|
...normalizeParams(params),
|
|
2358
2466
|
});
|
|
2359
2467
|
}
|
|
2468
|
+
// @__NO_SIDE_EFFECTS__
|
|
2360
2469
|
function _e164(Class, params) {
|
|
2361
2470
|
return new Class({
|
|
2362
2471
|
type: "string",
|
|
@@ -2366,6 +2475,7 @@ function _e164(Class, params) {
|
|
|
2366
2475
|
...normalizeParams(params),
|
|
2367
2476
|
});
|
|
2368
2477
|
}
|
|
2478
|
+
// @__NO_SIDE_EFFECTS__
|
|
2369
2479
|
function _jwt(Class, params) {
|
|
2370
2480
|
return new Class({
|
|
2371
2481
|
type: "string",
|
|
@@ -2375,6 +2485,7 @@ function _jwt(Class, params) {
|
|
|
2375
2485
|
...normalizeParams(params),
|
|
2376
2486
|
});
|
|
2377
2487
|
}
|
|
2488
|
+
// @__NO_SIDE_EFFECTS__
|
|
2378
2489
|
function _isoDateTime(Class, params) {
|
|
2379
2490
|
return new Class({
|
|
2380
2491
|
type: "string",
|
|
@@ -2386,6 +2497,7 @@ function _isoDateTime(Class, params) {
|
|
|
2386
2497
|
...normalizeParams(params),
|
|
2387
2498
|
});
|
|
2388
2499
|
}
|
|
2500
|
+
// @__NO_SIDE_EFFECTS__
|
|
2389
2501
|
function _isoDate(Class, params) {
|
|
2390
2502
|
return new Class({
|
|
2391
2503
|
type: "string",
|
|
@@ -2394,6 +2506,7 @@ function _isoDate(Class, params) {
|
|
|
2394
2506
|
...normalizeParams(params),
|
|
2395
2507
|
});
|
|
2396
2508
|
}
|
|
2509
|
+
// @__NO_SIDE_EFFECTS__
|
|
2397
2510
|
function _isoTime(Class, params) {
|
|
2398
2511
|
return new Class({
|
|
2399
2512
|
type: "string",
|
|
@@ -2403,6 +2516,7 @@ function _isoTime(Class, params) {
|
|
|
2403
2516
|
...normalizeParams(params),
|
|
2404
2517
|
});
|
|
2405
2518
|
}
|
|
2519
|
+
// @__NO_SIDE_EFFECTS__
|
|
2406
2520
|
function _isoDuration(Class, params) {
|
|
2407
2521
|
return new Class({
|
|
2408
2522
|
type: "string",
|
|
@@ -2411,17 +2525,20 @@ function _isoDuration(Class, params) {
|
|
|
2411
2525
|
...normalizeParams(params),
|
|
2412
2526
|
});
|
|
2413
2527
|
}
|
|
2528
|
+
// @__NO_SIDE_EFFECTS__
|
|
2414
2529
|
function _unknown(Class) {
|
|
2415
2530
|
return new Class({
|
|
2416
2531
|
type: "unknown",
|
|
2417
2532
|
});
|
|
2418
2533
|
}
|
|
2534
|
+
// @__NO_SIDE_EFFECTS__
|
|
2419
2535
|
function _never(Class, params) {
|
|
2420
2536
|
return new Class({
|
|
2421
2537
|
type: "never",
|
|
2422
2538
|
...normalizeParams(params),
|
|
2423
2539
|
});
|
|
2424
2540
|
}
|
|
2541
|
+
// @__NO_SIDE_EFFECTS__
|
|
2425
2542
|
function _maxLength(maximum, params) {
|
|
2426
2543
|
const ch = new $ZodCheckMaxLength({
|
|
2427
2544
|
check: "max_length",
|
|
@@ -2430,6 +2547,7 @@ function _maxLength(maximum, params) {
|
|
|
2430
2547
|
});
|
|
2431
2548
|
return ch;
|
|
2432
2549
|
}
|
|
2550
|
+
// @__NO_SIDE_EFFECTS__
|
|
2433
2551
|
function _minLength(minimum, params) {
|
|
2434
2552
|
return new $ZodCheckMinLength({
|
|
2435
2553
|
check: "min_length",
|
|
@@ -2437,6 +2555,7 @@ function _minLength(minimum, params) {
|
|
|
2437
2555
|
minimum,
|
|
2438
2556
|
});
|
|
2439
2557
|
}
|
|
2558
|
+
// @__NO_SIDE_EFFECTS__
|
|
2440
2559
|
function _length(length, params) {
|
|
2441
2560
|
return new $ZodCheckLengthEquals({
|
|
2442
2561
|
check: "length_equals",
|
|
@@ -2444,6 +2563,7 @@ function _length(length, params) {
|
|
|
2444
2563
|
length,
|
|
2445
2564
|
});
|
|
2446
2565
|
}
|
|
2566
|
+
// @__NO_SIDE_EFFECTS__
|
|
2447
2567
|
function _regex(pattern, params) {
|
|
2448
2568
|
return new $ZodCheckRegex({
|
|
2449
2569
|
check: "string_format",
|
|
@@ -2452,6 +2572,7 @@ function _regex(pattern, params) {
|
|
|
2452
2572
|
pattern,
|
|
2453
2573
|
});
|
|
2454
2574
|
}
|
|
2575
|
+
// @__NO_SIDE_EFFECTS__
|
|
2455
2576
|
function _lowercase(params) {
|
|
2456
2577
|
return new $ZodCheckLowerCase({
|
|
2457
2578
|
check: "string_format",
|
|
@@ -2459,6 +2580,7 @@ function _lowercase(params) {
|
|
|
2459
2580
|
...normalizeParams(params),
|
|
2460
2581
|
});
|
|
2461
2582
|
}
|
|
2583
|
+
// @__NO_SIDE_EFFECTS__
|
|
2462
2584
|
function _uppercase(params) {
|
|
2463
2585
|
return new $ZodCheckUpperCase({
|
|
2464
2586
|
check: "string_format",
|
|
@@ -2466,6 +2588,7 @@ function _uppercase(params) {
|
|
|
2466
2588
|
...normalizeParams(params),
|
|
2467
2589
|
});
|
|
2468
2590
|
}
|
|
2591
|
+
// @__NO_SIDE_EFFECTS__
|
|
2469
2592
|
function _includes(includes, params) {
|
|
2470
2593
|
return new $ZodCheckIncludes({
|
|
2471
2594
|
check: "string_format",
|
|
@@ -2474,6 +2597,7 @@ function _includes(includes, params) {
|
|
|
2474
2597
|
includes,
|
|
2475
2598
|
});
|
|
2476
2599
|
}
|
|
2600
|
+
// @__NO_SIDE_EFFECTS__
|
|
2477
2601
|
function _startsWith(prefix, params) {
|
|
2478
2602
|
return new $ZodCheckStartsWith({
|
|
2479
2603
|
check: "string_format",
|
|
@@ -2482,6 +2606,7 @@ function _startsWith(prefix, params) {
|
|
|
2482
2606
|
prefix,
|
|
2483
2607
|
});
|
|
2484
2608
|
}
|
|
2609
|
+
// @__NO_SIDE_EFFECTS__
|
|
2485
2610
|
function _endsWith(suffix, params) {
|
|
2486
2611
|
return new $ZodCheckEndsWith({
|
|
2487
2612
|
check: "string_format",
|
|
@@ -2490,6 +2615,7 @@ function _endsWith(suffix, params) {
|
|
|
2490
2615
|
suffix,
|
|
2491
2616
|
});
|
|
2492
2617
|
}
|
|
2618
|
+
// @__NO_SIDE_EFFECTS__
|
|
2493
2619
|
function _overwrite(tx) {
|
|
2494
2620
|
return new $ZodCheckOverwrite({
|
|
2495
2621
|
check: "overwrite",
|
|
@@ -2497,25 +2623,31 @@ function _overwrite(tx) {
|
|
|
2497
2623
|
});
|
|
2498
2624
|
}
|
|
2499
2625
|
// normalize
|
|
2626
|
+
// @__NO_SIDE_EFFECTS__
|
|
2500
2627
|
function _normalize(form) {
|
|
2501
2628
|
return _overwrite((input) => input.normalize(form));
|
|
2502
2629
|
}
|
|
2503
2630
|
// trim
|
|
2631
|
+
// @__NO_SIDE_EFFECTS__
|
|
2504
2632
|
function _trim() {
|
|
2505
2633
|
return _overwrite((input) => input.trim());
|
|
2506
2634
|
}
|
|
2507
2635
|
// toLowerCase
|
|
2636
|
+
// @__NO_SIDE_EFFECTS__
|
|
2508
2637
|
function _toLowerCase() {
|
|
2509
2638
|
return _overwrite((input) => input.toLowerCase());
|
|
2510
2639
|
}
|
|
2511
2640
|
// toUpperCase
|
|
2641
|
+
// @__NO_SIDE_EFFECTS__
|
|
2512
2642
|
function _toUpperCase() {
|
|
2513
2643
|
return _overwrite((input) => input.toUpperCase());
|
|
2514
2644
|
}
|
|
2515
2645
|
// slugify
|
|
2646
|
+
// @__NO_SIDE_EFFECTS__
|
|
2516
2647
|
function _slugify() {
|
|
2517
2648
|
return _overwrite((input) => slugify(input));
|
|
2518
2649
|
}
|
|
2650
|
+
// @__NO_SIDE_EFFECTS__
|
|
2519
2651
|
function _array(Class, element, params) {
|
|
2520
2652
|
return new Class({
|
|
2521
2653
|
type: "array",
|
|
@@ -2527,6 +2659,7 @@ function _array(Class, element, params) {
|
|
|
2527
2659
|
});
|
|
2528
2660
|
}
|
|
2529
2661
|
// same as _custom but defaults to abort:false
|
|
2662
|
+
// @__NO_SIDE_EFFECTS__
|
|
2530
2663
|
function _refine(Class, fn, _params) {
|
|
2531
2664
|
const schema = new Class({
|
|
2532
2665
|
type: "custom",
|
|
@@ -2536,6 +2669,7 @@ function _refine(Class, fn, _params) {
|
|
|
2536
2669
|
});
|
|
2537
2670
|
return schema;
|
|
2538
2671
|
}
|
|
2672
|
+
// @__NO_SIDE_EFFECTS__
|
|
2539
2673
|
function _superRefine(fn) {
|
|
2540
2674
|
const ch = _check((payload) => {
|
|
2541
2675
|
payload.addIssue = (issue$1) => {
|
|
@@ -2558,6 +2692,7 @@ function _superRefine(fn) {
|
|
|
2558
2692
|
});
|
|
2559
2693
|
return ch;
|
|
2560
2694
|
}
|
|
2695
|
+
// @__NO_SIDE_EFFECTS__
|
|
2561
2696
|
function _check(fn, params) {
|
|
2562
2697
|
const ch = new $ZodCheck({
|
|
2563
2698
|
check: "custom",
|
|
@@ -2624,14 +2759,7 @@ function process(schema, ctx, _params = { path: [], schemaPath: [] }) {
|
|
|
2624
2759
|
schemaPath: [..._params.schemaPath, schema],
|
|
2625
2760
|
path: _params.path,
|
|
2626
2761
|
};
|
|
2627
|
-
|
|
2628
|
-
if (parent) {
|
|
2629
|
-
// schema was cloned from another schema
|
|
2630
|
-
result.ref = parent;
|
|
2631
|
-
process(parent, ctx, params);
|
|
2632
|
-
ctx.seen.get(parent).isParent = true;
|
|
2633
|
-
}
|
|
2634
|
-
else if (schema._zod.processJSONSchema) {
|
|
2762
|
+
if (schema._zod.processJSONSchema) {
|
|
2635
2763
|
schema._zod.processJSONSchema(ctx, result.schema, params);
|
|
2636
2764
|
}
|
|
2637
2765
|
else {
|
|
@@ -2642,6 +2770,14 @@ function process(schema, ctx, _params = { path: [], schemaPath: [] }) {
|
|
|
2642
2770
|
}
|
|
2643
2771
|
processor(schema, ctx, _json, params);
|
|
2644
2772
|
}
|
|
2773
|
+
const parent = schema._zod.parent;
|
|
2774
|
+
if (parent) {
|
|
2775
|
+
// Also set ref if processor didn't (for inheritance)
|
|
2776
|
+
if (!result.ref)
|
|
2777
|
+
result.ref = parent;
|
|
2778
|
+
process(parent, ctx, params);
|
|
2779
|
+
ctx.seen.get(parent).isParent = true;
|
|
2780
|
+
}
|
|
2645
2781
|
}
|
|
2646
2782
|
// metadata
|
|
2647
2783
|
const meta = ctx.metadataRegistry.get(schema);
|
|
@@ -2667,6 +2803,18 @@ function extractDefs(ctx, schema
|
|
|
2667
2803
|
const root = ctx.seen.get(schema);
|
|
2668
2804
|
if (!root)
|
|
2669
2805
|
throw new Error("Unprocessed schema. This is a bug in Zod.");
|
|
2806
|
+
// Track ids to detect duplicates across different schemas
|
|
2807
|
+
const idToSchema = new Map();
|
|
2808
|
+
for (const entry of ctx.seen.entries()) {
|
|
2809
|
+
const id = ctx.metadataRegistry.get(entry[0])?.id;
|
|
2810
|
+
if (id) {
|
|
2811
|
+
const existing = idToSchema.get(id);
|
|
2812
|
+
if (existing && existing !== entry[0]) {
|
|
2813
|
+
throw new Error(`Duplicate schema id "${id}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);
|
|
2814
|
+
}
|
|
2815
|
+
idToSchema.set(id, entry[0]);
|
|
2816
|
+
}
|
|
2817
|
+
}
|
|
2670
2818
|
// returns a ref to the schema
|
|
2671
2819
|
// defId will be empty if the ref points to an external schema (or #)
|
|
2672
2820
|
const makeURI = (entry) => {
|
|
@@ -2768,43 +2916,84 @@ function extractDefs(ctx, schema
|
|
|
2768
2916
|
}
|
|
2769
2917
|
}
|
|
2770
2918
|
function finalize(ctx, schema) {
|
|
2771
|
-
//
|
|
2772
|
-
// iterate over seen map;
|
|
2773
2919
|
const root = ctx.seen.get(schema);
|
|
2774
2920
|
if (!root)
|
|
2775
2921
|
throw new Error("Unprocessed schema. This is a bug in Zod.");
|
|
2776
|
-
// flatten
|
|
2922
|
+
// flatten refs - inherit properties from parent schemas
|
|
2777
2923
|
const flattenRef = (zodSchema) => {
|
|
2778
2924
|
const seen = ctx.seen.get(zodSchema);
|
|
2925
|
+
// already processed
|
|
2926
|
+
if (seen.ref === null)
|
|
2927
|
+
return;
|
|
2779
2928
|
const schema = seen.def ?? seen.schema;
|
|
2780
2929
|
const _cached = { ...schema };
|
|
2781
|
-
// already seen
|
|
2782
|
-
if (seen.ref === null) {
|
|
2783
|
-
return;
|
|
2784
|
-
}
|
|
2785
|
-
// flatten ref if defined
|
|
2786
2930
|
const ref = seen.ref;
|
|
2787
|
-
seen.ref = null; // prevent recursion
|
|
2931
|
+
seen.ref = null; // prevent infinite recursion
|
|
2788
2932
|
if (ref) {
|
|
2789
2933
|
flattenRef(ref);
|
|
2934
|
+
const refSeen = ctx.seen.get(ref);
|
|
2935
|
+
const refSchema = refSeen.schema;
|
|
2790
2936
|
// merge referenced schema into current
|
|
2791
|
-
const refSchema = ctx.seen.get(ref).schema;
|
|
2792
2937
|
if (refSchema.$ref && (ctx.target === "draft-07" || ctx.target === "draft-04" || ctx.target === "openapi-3.0")) {
|
|
2938
|
+
// older drafts can't combine $ref with other properties
|
|
2793
2939
|
schema.allOf = schema.allOf ?? [];
|
|
2794
2940
|
schema.allOf.push(refSchema);
|
|
2795
2941
|
}
|
|
2796
2942
|
else {
|
|
2797
2943
|
Object.assign(schema, refSchema);
|
|
2798
|
-
|
|
2944
|
+
}
|
|
2945
|
+
// restore child's own properties (child wins)
|
|
2946
|
+
Object.assign(schema, _cached);
|
|
2947
|
+
const isParentRef = zodSchema._zod.parent === ref;
|
|
2948
|
+
// For parent chain, child is a refinement - remove parent-only properties
|
|
2949
|
+
if (isParentRef) {
|
|
2950
|
+
for (const key in schema) {
|
|
2951
|
+
if (key === "$ref" || key === "allOf")
|
|
2952
|
+
continue;
|
|
2953
|
+
if (!(key in _cached)) {
|
|
2954
|
+
delete schema[key];
|
|
2955
|
+
}
|
|
2956
|
+
}
|
|
2957
|
+
}
|
|
2958
|
+
// When ref was extracted to $defs, remove properties that match the definition
|
|
2959
|
+
if (refSchema.$ref && refSeen.def) {
|
|
2960
|
+
for (const key in schema) {
|
|
2961
|
+
if (key === "$ref" || key === "allOf")
|
|
2962
|
+
continue;
|
|
2963
|
+
if (key in refSeen.def && JSON.stringify(schema[key]) === JSON.stringify(refSeen.def[key])) {
|
|
2964
|
+
delete schema[key];
|
|
2965
|
+
}
|
|
2966
|
+
}
|
|
2967
|
+
}
|
|
2968
|
+
}
|
|
2969
|
+
// If parent was extracted (has $ref), propagate $ref to this schema
|
|
2970
|
+
// This handles cases like: readonly().meta({id}).describe()
|
|
2971
|
+
// where processor sets ref to innerType but parent should be referenced
|
|
2972
|
+
const parent = zodSchema._zod.parent;
|
|
2973
|
+
if (parent && parent !== ref) {
|
|
2974
|
+
// Ensure parent is processed first so its def has inherited properties
|
|
2975
|
+
flattenRef(parent);
|
|
2976
|
+
const parentSeen = ctx.seen.get(parent);
|
|
2977
|
+
if (parentSeen?.schema.$ref) {
|
|
2978
|
+
schema.$ref = parentSeen.schema.$ref;
|
|
2979
|
+
// De-duplicate with parent's definition
|
|
2980
|
+
if (parentSeen.def) {
|
|
2981
|
+
for (const key in schema) {
|
|
2982
|
+
if (key === "$ref" || key === "allOf")
|
|
2983
|
+
continue;
|
|
2984
|
+
if (key in parentSeen.def && JSON.stringify(schema[key]) === JSON.stringify(parentSeen.def[key])) {
|
|
2985
|
+
delete schema[key];
|
|
2986
|
+
}
|
|
2987
|
+
}
|
|
2988
|
+
}
|
|
2799
2989
|
}
|
|
2800
2990
|
}
|
|
2801
2991
|
// execute overrides
|
|
2802
|
-
|
|
2803
|
-
|
|
2804
|
-
|
|
2805
|
-
|
|
2806
|
-
|
|
2807
|
-
});
|
|
2992
|
+
ctx.override({
|
|
2993
|
+
zodSchema: zodSchema,
|
|
2994
|
+
jsonSchema: schema,
|
|
2995
|
+
path: seen.path ?? [],
|
|
2996
|
+
});
|
|
2808
2997
|
};
|
|
2809
2998
|
for (const entry of [...ctx.seen.entries()].reverse()) {
|
|
2810
2999
|
flattenRef(entry[0]);
|
|
@@ -2857,8 +3046,8 @@ function finalize(ctx, schema) {
|
|
|
2857
3046
|
value: {
|
|
2858
3047
|
...schema["~standard"],
|
|
2859
3048
|
jsonSchema: {
|
|
2860
|
-
input: createStandardJSONSchemaMethod(schema, "input"),
|
|
2861
|
-
output: createStandardJSONSchemaMethod(schema, "output"),
|
|
3049
|
+
input: createStandardJSONSchemaMethod(schema, "input", ctx.processors),
|
|
3050
|
+
output: createStandardJSONSchemaMethod(schema, "output", ctx.processors),
|
|
2862
3051
|
},
|
|
2863
3052
|
},
|
|
2864
3053
|
enumerable: false,
|
|
@@ -2937,9 +3126,9 @@ const createToJSONSchemaMethod = (schema, processors = {}) => (params) => {
|
|
|
2937
3126
|
extractDefs(ctx, schema);
|
|
2938
3127
|
return finalize(ctx, schema);
|
|
2939
3128
|
};
|
|
2940
|
-
const createStandardJSONSchemaMethod = (schema, io) => (params) => {
|
|
3129
|
+
const createStandardJSONSchemaMethod = (schema, io, processors = {}) => (params) => {
|
|
2941
3130
|
const { libraryOptions, target } = params ?? {};
|
|
2942
|
-
const ctx = initializeContext({ ...(libraryOptions ?? {}), target, io, processors
|
|
3131
|
+
const ctx = initializeContext({ ...(libraryOptions ?? {}), target, io, processors });
|
|
2943
3132
|
process(schema, ctx);
|
|
2944
3133
|
extractDefs(ctx, schema);
|
|
2945
3134
|
return finalize(ctx, schema);
|
|
@@ -2967,6 +3156,11 @@ const stringProcessor = (schema, ctx, _json, _params) => {
|
|
|
2967
3156
|
json.format = formatMap[format] ?? format;
|
|
2968
3157
|
if (json.format === "")
|
|
2969
3158
|
delete json.format; // empty format is not valid
|
|
3159
|
+
// JSON Schema format: "time" requires a full time with offset or Z
|
|
3160
|
+
// z.iso.time() does not include timezone information, so format: "time" should never be used
|
|
3161
|
+
if (format === "time") {
|
|
3162
|
+
delete json.format;
|
|
3163
|
+
}
|
|
2970
3164
|
}
|
|
2971
3165
|
if (contentEncoding)
|
|
2972
3166
|
json.contentEncoding = contentEncoding;
|
|
@@ -3275,8 +3469,11 @@ const ZodType = /*@__PURE__*/ $constructor("ZodType", (inst, def) => {
|
|
|
3275
3469
|
...(def.checks ?? []),
|
|
3276
3470
|
...checks.map((ch) => typeof ch === "function" ? { _zod: { check: ch, def: { check: "custom" }, onattach: [] } } : ch),
|
|
3277
3471
|
],
|
|
3278
|
-
})
|
|
3472
|
+
}), {
|
|
3473
|
+
parent: true,
|
|
3474
|
+
});
|
|
3279
3475
|
};
|
|
3476
|
+
inst.with = inst.check;
|
|
3280
3477
|
inst.clone = (def, params) => clone(inst, def, params);
|
|
3281
3478
|
inst.brand = () => inst;
|
|
3282
3479
|
inst.register = ((reg, meta) => {
|
|
@@ -3304,6 +3501,7 @@ const ZodType = /*@__PURE__*/ $constructor("ZodType", (inst, def) => {
|
|
|
3304
3501
|
inst.overwrite = (fn) => inst.check(_overwrite(fn));
|
|
3305
3502
|
// wrappers
|
|
3306
3503
|
inst.optional = () => optional(inst);
|
|
3504
|
+
inst.exactOptional = () => exactOptional(inst);
|
|
3307
3505
|
inst.nullable = () => nullable(inst);
|
|
3308
3506
|
inst.nullish = () => optional(nullable(inst));
|
|
3309
3507
|
inst.nonoptional = (params) => nonoptional(inst, params);
|
|
@@ -3340,6 +3538,7 @@ const ZodType = /*@__PURE__*/ $constructor("ZodType", (inst, def) => {
|
|
|
3340
3538
|
// helpers
|
|
3341
3539
|
inst.isOptional = () => inst.safeParse(undefined).success;
|
|
3342
3540
|
inst.isNullable = () => inst.safeParse(null).success;
|
|
3541
|
+
inst.apply = (fn) => fn(inst);
|
|
3343
3542
|
return inst;
|
|
3344
3543
|
});
|
|
3345
3544
|
/** @internal */
|
|
@@ -3690,6 +3889,18 @@ function optional(innerType) {
|
|
|
3690
3889
|
innerType: innerType,
|
|
3691
3890
|
});
|
|
3692
3891
|
}
|
|
3892
|
+
const ZodExactOptional = /*@__PURE__*/ $constructor("ZodExactOptional", (inst, def) => {
|
|
3893
|
+
$ZodExactOptional.init(inst, def);
|
|
3894
|
+
ZodType.init(inst, def);
|
|
3895
|
+
inst._zod.processJSONSchema = (ctx, json, params) => optionalProcessor(inst, ctx, json, params);
|
|
3896
|
+
inst.unwrap = () => inst._zod.def.innerType;
|
|
3897
|
+
});
|
|
3898
|
+
function exactOptional(innerType) {
|
|
3899
|
+
return new ZodExactOptional({
|
|
3900
|
+
type: "optional",
|
|
3901
|
+
innerType: innerType,
|
|
3902
|
+
});
|
|
3903
|
+
}
|
|
3693
3904
|
const ZodNullable = /*@__PURE__*/ $constructor("ZodNullable", (inst, def) => {
|
|
3694
3905
|
$ZodNullable.init(inst, def);
|
|
3695
3906
|
ZodType.init(inst, def);
|
|
@@ -3829,7 +4040,6 @@ class UiPathConfig {
|
|
|
3829
4040
|
class ExecutionContext {
|
|
3830
4041
|
constructor() {
|
|
3831
4042
|
this.context = new Map();
|
|
3832
|
-
this.headers = {};
|
|
3833
4043
|
}
|
|
3834
4044
|
/**
|
|
3835
4045
|
* Set a context value that will be available throughout the execution
|
|
@@ -3844,35 +4054,10 @@ class ExecutionContext {
|
|
|
3844
4054
|
return this.context.get(key);
|
|
3845
4055
|
}
|
|
3846
4056
|
/**
|
|
3847
|
-
*
|
|
3848
|
-
*/
|
|
3849
|
-
setHeaders(headers) {
|
|
3850
|
-
this.headers = { ...this.headers, ...headers };
|
|
3851
|
-
}
|
|
3852
|
-
/**
|
|
3853
|
-
* Get all custom headers
|
|
3854
|
-
*/
|
|
3855
|
-
getHeaders() {
|
|
3856
|
-
return { ...this.headers };
|
|
3857
|
-
}
|
|
3858
|
-
/**
|
|
3859
|
-
* Clear all context and headers
|
|
4057
|
+
* Clear all context
|
|
3860
4058
|
*/
|
|
3861
4059
|
clear() {
|
|
3862
4060
|
this.context.clear();
|
|
3863
|
-
this.headers = {};
|
|
3864
|
-
}
|
|
3865
|
-
/**
|
|
3866
|
-
* Create a request spec for an API call
|
|
3867
|
-
*/
|
|
3868
|
-
createRequestSpec(spec = {}) {
|
|
3869
|
-
return {
|
|
3870
|
-
...spec,
|
|
3871
|
-
headers: {
|
|
3872
|
-
...this.getHeaders(),
|
|
3873
|
-
...spec.headers
|
|
3874
|
-
}
|
|
3875
|
-
};
|
|
3876
4061
|
}
|
|
3877
4062
|
}
|
|
3878
4063
|
|
|
@@ -4688,10 +4873,12 @@ const DATA_FABRIC_ENDPOINTS = {
|
|
|
4688
4873
|
GET_RECORD_BY_ID: (entityId, recordId) => `${DATAFABRIC_BASE}/api/EntityService/entity/${entityId}/read/${recordId}`,
|
|
4689
4874
|
INSERT_BY_ID: (entityId) => `${DATAFABRIC_BASE}/api/EntityService/entity/${entityId}/insert`,
|
|
4690
4875
|
BATCH_INSERT_BY_ID: (entityId) => `${DATAFABRIC_BASE}/api/EntityService/entity/${entityId}/insert-batch`,
|
|
4876
|
+
UPDATE_RECORD_BY_ID: (entityId, recordId) => `${DATAFABRIC_BASE}/api/EntityService/entity/${entityId}/update/${recordId}`,
|
|
4691
4877
|
UPDATE_BY_ID: (entityId) => `${DATAFABRIC_BASE}/api/EntityService/entity/${entityId}/update-batch`,
|
|
4692
4878
|
DELETE_BY_ID: (entityId) => `${DATAFABRIC_BASE}/api/EntityService/entity/${entityId}/delete-batch`,
|
|
4693
|
-
DOWNLOAD_ATTACHMENT: (
|
|
4694
|
-
UPLOAD_ATTACHMENT: (
|
|
4879
|
+
DOWNLOAD_ATTACHMENT: (entityId, recordId, fieldName) => `${DATAFABRIC_BASE}/api/Attachment/entity/${entityId}/${recordId}/${fieldName}`,
|
|
4880
|
+
UPLOAD_ATTACHMENT: (entityId, recordId, fieldName) => `${DATAFABRIC_BASE}/api/Attachment/entity/${entityId}/${recordId}/${fieldName}`,
|
|
4881
|
+
DELETE_ATTACHMENT: (entityId, recordId, fieldName) => `${DATAFABRIC_BASE}/api/Attachment/entity/${entityId}/${recordId}/${fieldName}`,
|
|
4695
4882
|
},
|
|
4696
4883
|
CHOICESETS: {
|
|
4697
4884
|
GET_ALL: `${DATAFABRIC_BASE}/api/Entity/choiceset`,
|
|
@@ -5137,7 +5324,7 @@ function normalizeBaseUrl(url) {
|
|
|
5137
5324
|
// Connection string placeholder that will be replaced during build
|
|
5138
5325
|
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";
|
|
5139
5326
|
// SDK Version placeholder
|
|
5140
|
-
const SDK_VERSION = "1.1
|
|
5327
|
+
const SDK_VERSION = "1.2.1";
|
|
5141
5328
|
const VERSION = "Version";
|
|
5142
5329
|
const SERVICE = "Service";
|
|
5143
5330
|
const CLOUD_ORGANIZATION_NAME = "CloudOrganizationName";
|
|
@@ -5668,6 +5855,15 @@ let UiPath$1 = class UiPath {
|
|
|
5668
5855
|
__classPrivateFieldGet(this, _UiPath_authService, "f")?.logout();
|
|
5669
5856
|
__classPrivateFieldSet(this, _UiPath_initialized, false, "f");
|
|
5670
5857
|
}
|
|
5858
|
+
/**
|
|
5859
|
+
* Updates the access token used for API requests.
|
|
5860
|
+
* Use this to inject or refresh a token externally.
|
|
5861
|
+
*
|
|
5862
|
+
* @param tokenInfo - The token information containing the access token, type, expiration, and optional refresh token
|
|
5863
|
+
*/
|
|
5864
|
+
updateToken(tokenInfo) {
|
|
5865
|
+
__classPrivateFieldGet(this, _UiPath_authService, "f")?.updateToken(tokenInfo);
|
|
5866
|
+
}
|
|
5671
5867
|
};
|
|
5672
5868
|
_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) {
|
|
5673
5869
|
// Validate and normalize the configuration
|
|
@@ -6003,11 +6199,8 @@ class ApiClient {
|
|
|
6003
6199
|
return this.tokenManager.getValidToken();
|
|
6004
6200
|
}
|
|
6005
6201
|
async getDefaultHeaders() {
|
|
6006
|
-
// Get headers from execution context first
|
|
6007
|
-
const contextHeaders = this.executionContext.getHeaders();
|
|
6008
6202
|
const token = await this.getValidToken();
|
|
6009
6203
|
return {
|
|
6010
|
-
...contextHeaders,
|
|
6011
6204
|
'Authorization': `Bearer ${token}`,
|
|
6012
6205
|
'Content-Type': CONTENT_TYPES.JSON,
|
|
6013
6206
|
...this.defaultHeaders,
|
|
@@ -7304,6 +7497,13 @@ function createEntityMethods(entityData, service) {
|
|
|
7304
7497
|
throw new Error('Entity ID is undefined');
|
|
7305
7498
|
return service.insertRecordsById(entityData.id, data, options);
|
|
7306
7499
|
},
|
|
7500
|
+
async updateRecord(recordId, data, options) {
|
|
7501
|
+
if (!entityData.id)
|
|
7502
|
+
throw new Error('Entity ID is undefined');
|
|
7503
|
+
if (!recordId)
|
|
7504
|
+
throw new Error('Record ID is undefined');
|
|
7505
|
+
return service.updateRecordById(entityData.id, recordId, data, options);
|
|
7506
|
+
},
|
|
7307
7507
|
async updateRecords(data, options) {
|
|
7308
7508
|
if (!entityData.id)
|
|
7309
7509
|
throw new Error('Entity ID is undefined');
|
|
@@ -7327,24 +7527,19 @@ function createEntityMethods(entityData, service) {
|
|
|
7327
7527
|
return service.getRecordById(entityData.id, recordId, options);
|
|
7328
7528
|
},
|
|
7329
7529
|
async downloadAttachment(recordId, fieldName) {
|
|
7330
|
-
if (!entityData.
|
|
7331
|
-
throw new Error('Entity
|
|
7332
|
-
return service.downloadAttachment(
|
|
7333
|
-
entityName: entityData.name,
|
|
7334
|
-
recordId,
|
|
7335
|
-
fieldName
|
|
7336
|
-
});
|
|
7530
|
+
if (!entityData.id)
|
|
7531
|
+
throw new Error('Entity ID is undefined');
|
|
7532
|
+
return service.downloadAttachment(entityData.id, recordId, fieldName);
|
|
7337
7533
|
},
|
|
7338
|
-
async uploadAttachment(recordId, fieldName, file,
|
|
7339
|
-
if (!entityData.
|
|
7340
|
-
throw new Error('Entity
|
|
7341
|
-
return service.uploadAttachment(
|
|
7342
|
-
|
|
7343
|
-
|
|
7344
|
-
|
|
7345
|
-
|
|
7346
|
-
|
|
7347
|
-
});
|
|
7534
|
+
async uploadAttachment(recordId, fieldName, file, options) {
|
|
7535
|
+
if (!entityData.id)
|
|
7536
|
+
throw new Error('Entity ID is undefined');
|
|
7537
|
+
return service.uploadAttachment(entityData.id, recordId, fieldName, file, options);
|
|
7538
|
+
},
|
|
7539
|
+
async deleteAttachment(recordId, fieldName) {
|
|
7540
|
+
if (!entityData.id)
|
|
7541
|
+
throw new Error('Entity ID is undefined');
|
|
7542
|
+
return service.deleteAttachment(entityData.id, recordId, fieldName);
|
|
7348
7543
|
},
|
|
7349
7544
|
async insert(data, options) {
|
|
7350
7545
|
return this.insertRecord(data, options);
|
|
@@ -7717,6 +7912,42 @@ class EntityService extends BaseService {
|
|
|
7717
7912
|
const camelResponse = pascalToCamelCaseKeys(response.data);
|
|
7718
7913
|
return camelResponse;
|
|
7719
7914
|
}
|
|
7915
|
+
/**
|
|
7916
|
+
* Updates a single record in an entity by entity ID
|
|
7917
|
+
*
|
|
7918
|
+
* @param entityId - UUID of the entity
|
|
7919
|
+
* @param recordId - UUID of the record to update
|
|
7920
|
+
* @param data - Key-value pairs of fields to update
|
|
7921
|
+
* @param options - Update options
|
|
7922
|
+
* @returns Promise resolving to the updated record
|
|
7923
|
+
*
|
|
7924
|
+
* @example
|
|
7925
|
+
* ```typescript
|
|
7926
|
+
* import { Entities } from '@uipath/uipath-typescript/entities';
|
|
7927
|
+
*
|
|
7928
|
+
* const entities = new Entities(sdk);
|
|
7929
|
+
*
|
|
7930
|
+
* // Basic usage
|
|
7931
|
+
* const result = await entities.updateRecordById("<entityId>", "<recordId>", { name: "John Updated", age: 31 });
|
|
7932
|
+
*
|
|
7933
|
+
* // With options
|
|
7934
|
+
* const result = await entities.updateRecordById("<entityId>", "<recordId>", { name: "John Updated", age: 31 }, {
|
|
7935
|
+
* expansionLevel: 1
|
|
7936
|
+
* });
|
|
7937
|
+
* ```
|
|
7938
|
+
*/
|
|
7939
|
+
async updateRecordById(entityId, recordId, data, options = {}) {
|
|
7940
|
+
const params = createParams({
|
|
7941
|
+
expansionLevel: options.expansionLevel
|
|
7942
|
+
});
|
|
7943
|
+
const response = await this.post(DATA_FABRIC_ENDPOINTS.ENTITY.UPDATE_RECORD_BY_ID(entityId, recordId), data, {
|
|
7944
|
+
params,
|
|
7945
|
+
...options
|
|
7946
|
+
});
|
|
7947
|
+
// Convert PascalCase response to camelCase
|
|
7948
|
+
const camelResponse = pascalToCamelCaseKeys(response.data);
|
|
7949
|
+
return camelResponse;
|
|
7950
|
+
}
|
|
7720
7951
|
/**
|
|
7721
7952
|
* Updates data in an entity by entity ID
|
|
7722
7953
|
*
|
|
@@ -7826,7 +8057,9 @@ class EntityService extends BaseService {
|
|
|
7826
8057
|
/**
|
|
7827
8058
|
* Downloads an attachment from an entity record field
|
|
7828
8059
|
*
|
|
7829
|
-
* @param
|
|
8060
|
+
* @param entityId - UUID of the entity
|
|
8061
|
+
* @param recordId - UUID of the record containing the attachment
|
|
8062
|
+
* @param fieldName - Name of the File-type field containing the attachment
|
|
7830
8063
|
* @returns Promise resolving to Blob containing the file content
|
|
7831
8064
|
*
|
|
7832
8065
|
* @example
|
|
@@ -7835,16 +8068,20 @@ class EntityService extends BaseService {
|
|
|
7835
8068
|
*
|
|
7836
8069
|
* const entities = new Entities(sdk);
|
|
7837
8070
|
*
|
|
8071
|
+
* // Get the entityId from getAll()
|
|
8072
|
+
* const allEntities = await entities.getAll();
|
|
8073
|
+
* const entityId = allEntities[0].id;
|
|
8074
|
+
*
|
|
8075
|
+
* // Get the recordId from getAllRecords()
|
|
8076
|
+
* const records = await entities.getAllRecords(entityId);
|
|
8077
|
+
* const recordId = records[0].id;
|
|
8078
|
+
*
|
|
7838
8079
|
* // Download attachment for a specific record and field
|
|
7839
|
-
* const blob = await entities.downloadAttachment(
|
|
7840
|
-
*
|
|
7841
|
-
* recordId: '<record-uuid>',
|
|
7842
|
-
* fieldName: 'Documents'
|
|
7843
|
-
* });
|
|
8080
|
+
* const blob = await entities.downloadAttachment(entityId, recordId, 'Documents');
|
|
8081
|
+
* ```
|
|
7844
8082
|
*/
|
|
7845
|
-
async downloadAttachment(
|
|
7846
|
-
const
|
|
7847
|
-
const response = await this.get(DATA_FABRIC_ENDPOINTS.ENTITY.DOWNLOAD_ATTACHMENT(entityName, recordId, fieldName), {
|
|
8083
|
+
async downloadAttachment(entityId, recordId, fieldName) {
|
|
8084
|
+
const response = await this.get(DATA_FABRIC_ENDPOINTS.ENTITY.DOWNLOAD_ATTACHMENT(entityId, recordId, fieldName), {
|
|
7848
8085
|
responseType: RESPONSE_TYPES.BLOB
|
|
7849
8086
|
});
|
|
7850
8087
|
return response.data;
|
|
@@ -7852,8 +8089,12 @@ class EntityService extends BaseService {
|
|
|
7852
8089
|
/**
|
|
7853
8090
|
* Uploads an attachment to a File-type field of an entity record
|
|
7854
8091
|
*
|
|
7855
|
-
* @param
|
|
7856
|
-
* @
|
|
8092
|
+
* @param entityId - UUID of the entity
|
|
8093
|
+
* @param recordId - UUID of the record to upload the attachment to
|
|
8094
|
+
* @param fieldName - Name of the File-type field
|
|
8095
|
+
* @param file - File to upload (Blob, File, or Uint8Array)
|
|
8096
|
+
* @param options - Optional {@link EntityUploadAttachmentOptions} (e.g. expansionLevel)
|
|
8097
|
+
* @returns Promise resolving to {@link EntityUploadAttachmentResponse}
|
|
7857
8098
|
*
|
|
7858
8099
|
* @example
|
|
7859
8100
|
* ```typescript
|
|
@@ -7861,17 +8102,19 @@ class EntityService extends BaseService {
|
|
|
7861
8102
|
*
|
|
7862
8103
|
* const entities = new Entities(sdk);
|
|
7863
8104
|
*
|
|
8105
|
+
* // Get the entityId from getAll()
|
|
8106
|
+
* const allEntities = await entities.getAll();
|
|
8107
|
+
* const entityId = allEntities[0].id;
|
|
8108
|
+
*
|
|
8109
|
+
* // Get the recordId from getAllRecords()
|
|
8110
|
+
* const records = await entities.getAllRecords(entityId);
|
|
8111
|
+
* const recordId = records[0].id;
|
|
8112
|
+
*
|
|
7864
8113
|
* // Upload a file attachment
|
|
7865
|
-
* const response = await entities.uploadAttachment(
|
|
7866
|
-
* entityName: 'Invoice',
|
|
7867
|
-
* recordId: '<record-uuid>',
|
|
7868
|
-
* fieldName: 'Documents',
|
|
7869
|
-
* file: file
|
|
7870
|
-
* });
|
|
8114
|
+
* const response = await entities.uploadAttachment(entityId, recordId, 'Documents', file);
|
|
7871
8115
|
* ```
|
|
7872
8116
|
*/
|
|
7873
|
-
async uploadAttachment(options) {
|
|
7874
|
-
const { entityName, recordId, fieldName, file, expansionLevel } = options;
|
|
8117
|
+
async uploadAttachment(entityId, recordId, fieldName, file, options) {
|
|
7875
8118
|
const formData = new FormData();
|
|
7876
8119
|
if (file instanceof Uint8Array) {
|
|
7877
8120
|
formData.append('file', new Blob([file.buffer]));
|
|
@@ -7879,12 +8122,42 @@ class EntityService extends BaseService {
|
|
|
7879
8122
|
else {
|
|
7880
8123
|
formData.append('file', file);
|
|
7881
8124
|
}
|
|
7882
|
-
const params = createParams({ expansionLevel });
|
|
7883
|
-
const response = await this.post(DATA_FABRIC_ENDPOINTS.ENTITY.UPLOAD_ATTACHMENT(
|
|
8125
|
+
const params = createParams({ expansionLevel: options?.expansionLevel });
|
|
8126
|
+
const response = await this.post(DATA_FABRIC_ENDPOINTS.ENTITY.UPLOAD_ATTACHMENT(entityId, recordId, fieldName), formData, { params });
|
|
7884
8127
|
// Convert PascalCase response to camelCase
|
|
7885
8128
|
const camelResponse = pascalToCamelCaseKeys(response.data);
|
|
7886
8129
|
return camelResponse;
|
|
7887
8130
|
}
|
|
8131
|
+
/**
|
|
8132
|
+
* Removes an attachment from a File-type field of an entity record
|
|
8133
|
+
*
|
|
8134
|
+
* @param entityId - UUID of the entity
|
|
8135
|
+
* @param recordId - UUID of the record containing the attachment
|
|
8136
|
+
* @param fieldName - Name of the File-type field containing the attachment
|
|
8137
|
+
* @returns Promise resolving to {@link EntityDeleteAttachmentResponse}
|
|
8138
|
+
*
|
|
8139
|
+
* @example
|
|
8140
|
+
* ```typescript
|
|
8141
|
+
* import { Entities } from '@uipath/uipath-typescript/entities';
|
|
8142
|
+
*
|
|
8143
|
+
* const entities = new Entities(sdk);
|
|
8144
|
+
*
|
|
8145
|
+
* // Get the entityId from getAll()
|
|
8146
|
+
* const allEntities = await entities.getAll();
|
|
8147
|
+
* const entityId = allEntities[0].id;
|
|
8148
|
+
*
|
|
8149
|
+
* // Get the recordId from getAllRecords()
|
|
8150
|
+
* const records = await entities.getAllRecords(entityId);
|
|
8151
|
+
* const recordId = records[0].id;
|
|
8152
|
+
*
|
|
8153
|
+
* // Delete attachment for a specific record and field
|
|
8154
|
+
* await entities.deleteAttachment(entityId, recordId, 'Documents');
|
|
8155
|
+
* ```
|
|
8156
|
+
*/
|
|
8157
|
+
async deleteAttachment(entityId, recordId, fieldName) {
|
|
8158
|
+
const response = await this.delete(DATA_FABRIC_ENDPOINTS.ENTITY.DELETE_ATTACHMENT(entityId, recordId, fieldName));
|
|
8159
|
+
return response.data;
|
|
8160
|
+
}
|
|
7888
8161
|
/**
|
|
7889
8162
|
* @hidden
|
|
7890
8163
|
* @deprecated Use {@link getAllRecords} instead.
|
|
@@ -8006,6 +8279,9 @@ __decorate([
|
|
|
8006
8279
|
__decorate([
|
|
8007
8280
|
track('Entities.InsertRecordsById')
|
|
8008
8281
|
], EntityService.prototype, "insertRecordsById", null);
|
|
8282
|
+
__decorate([
|
|
8283
|
+
track('Entities.UpdateRecordById')
|
|
8284
|
+
], EntityService.prototype, "updateRecordById", null);
|
|
8009
8285
|
__decorate([
|
|
8010
8286
|
track('Entities.UpdateRecordsById')
|
|
8011
8287
|
], EntityService.prototype, "updateRecordsById", null);
|
|
@@ -8021,6 +8297,9 @@ __decorate([
|
|
|
8021
8297
|
__decorate([
|
|
8022
8298
|
track('Entities.UploadAttachment')
|
|
8023
8299
|
], EntityService.prototype, "uploadAttachment", null);
|
|
8300
|
+
__decorate([
|
|
8301
|
+
track('Entities.DeleteAttachment')
|
|
8302
|
+
], EntityService.prototype, "deleteAttachment", null);
|
|
8024
8303
|
|
|
8025
8304
|
class ChoiceSetService extends BaseService {
|
|
8026
8305
|
/**
|