@uipath/solution-tool 1.196.0 → 1.197.0-preview.59
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/README.md +19 -2
- package/dist/deploy.js +898 -1907
- package/dist/index.js +2 -0
- package/dist/init.js +106 -1415
- package/dist/models/pack-command-types.d.ts +9 -4
- package/dist/pack.js +180834 -150455
- package/dist/publish.js +833 -1868
- package/dist/resource.js +1310 -2084
- package/dist/services/pack-command-service.d.ts +0 -1
- package/dist/services/pack-service.d.ts +0 -10
- package/dist/services/solution-packager-helpers.d.ts +25 -0
- package/dist/services/sync-resources-from-bindings.d.ts +8 -0
- package/dist/templates/AGENTS.md +15 -2
- package/dist/tool.js +52509 -32947
- package/package.json +2 -2
package/dist/deploy.js
CHANGED
|
@@ -13520,8 +13520,8 @@ var require_Subscription = __commonJS((exports) => {
|
|
|
13520
13520
|
if (_parentOrParents instanceof Subscription2) {
|
|
13521
13521
|
_parentOrParents.remove(this);
|
|
13522
13522
|
} else if (_parentOrParents !== null) {
|
|
13523
|
-
for (var
|
|
13524
|
-
var parent_1 = _parentOrParents[
|
|
13523
|
+
for (var index = 0;index < _parentOrParents.length; ++index) {
|
|
13524
|
+
var parent_1 = _parentOrParents[index];
|
|
13525
13525
|
parent_1.remove(this);
|
|
13526
13526
|
}
|
|
13527
13527
|
}
|
|
@@ -13536,10 +13536,10 @@ var require_Subscription = __commonJS((exports) => {
|
|
|
13536
13536
|
}
|
|
13537
13537
|
}
|
|
13538
13538
|
if (isArray_1.isArray(_subscriptions)) {
|
|
13539
|
-
var
|
|
13539
|
+
var index = -1;
|
|
13540
13540
|
var len = _subscriptions.length;
|
|
13541
|
-
while (++
|
|
13542
|
-
var sub2 = _subscriptions[
|
|
13541
|
+
while (++index < len) {
|
|
13542
|
+
var sub2 = _subscriptions[index];
|
|
13543
13543
|
if (isObject_1.isObject(sub2)) {
|
|
13544
13544
|
try {
|
|
13545
13545
|
sub2.unsubscribe();
|
|
@@ -14969,13 +14969,13 @@ var require_AsyncAction = __commonJS((exports) => {
|
|
|
14969
14969
|
var id = this.id;
|
|
14970
14970
|
var scheduler = this.scheduler;
|
|
14971
14971
|
var actions = scheduler.actions;
|
|
14972
|
-
var
|
|
14972
|
+
var index = actions.indexOf(this);
|
|
14973
14973
|
this.work = null;
|
|
14974
14974
|
this.state = null;
|
|
14975
14975
|
this.pending = false;
|
|
14976
14976
|
this.scheduler = null;
|
|
14977
|
-
if (
|
|
14978
|
-
actions.splice(
|
|
14977
|
+
if (index !== -1) {
|
|
14978
|
+
actions.splice(index, 1);
|
|
14979
14979
|
}
|
|
14980
14980
|
if (id != null) {
|
|
14981
14981
|
this.id = this.recycleAsyncId(scheduler, id, null);
|
|
@@ -15819,17 +15819,17 @@ var require_AsapScheduler = __commonJS((exports) => {
|
|
|
15819
15819
|
this.scheduled = undefined;
|
|
15820
15820
|
var actions = this.actions;
|
|
15821
15821
|
var error;
|
|
15822
|
-
var
|
|
15822
|
+
var index = -1;
|
|
15823
15823
|
var count = actions.length;
|
|
15824
15824
|
action = action || actions.shift();
|
|
15825
15825
|
do {
|
|
15826
15826
|
if (error = action.execute(action.state, action.delay)) {
|
|
15827
15827
|
break;
|
|
15828
15828
|
}
|
|
15829
|
-
} while (++
|
|
15829
|
+
} while (++index < count && (action = actions.shift()));
|
|
15830
15830
|
this.active = false;
|
|
15831
15831
|
if (error) {
|
|
15832
|
-
while (++
|
|
15832
|
+
while (++index < count && (action = actions.shift())) {
|
|
15833
15833
|
action.unsubscribe();
|
|
15834
15834
|
}
|
|
15835
15835
|
throw error;
|
|
@@ -15952,17 +15952,17 @@ var require_AnimationFrameScheduler = __commonJS((exports) => {
|
|
|
15952
15952
|
this.scheduled = undefined;
|
|
15953
15953
|
var actions = this.actions;
|
|
15954
15954
|
var error;
|
|
15955
|
-
var
|
|
15955
|
+
var index = -1;
|
|
15956
15956
|
var count = actions.length;
|
|
15957
15957
|
action = action || actions.shift();
|
|
15958
15958
|
do {
|
|
15959
15959
|
if (error = action.execute(action.state, action.delay)) {
|
|
15960
15960
|
break;
|
|
15961
15961
|
}
|
|
15962
|
-
} while (++
|
|
15962
|
+
} while (++index < count && (action = actions.shift()));
|
|
15963
15963
|
this.active = false;
|
|
15964
15964
|
if (error) {
|
|
15965
|
-
while (++
|
|
15965
|
+
while (++index < count && (action = actions.shift())) {
|
|
15966
15966
|
action.unsubscribe();
|
|
15967
15967
|
}
|
|
15968
15968
|
throw error;
|
|
@@ -16046,16 +16046,16 @@ var require_VirtualTimeScheduler = __commonJS((exports) => {
|
|
|
16046
16046
|
exports.VirtualTimeScheduler = VirtualTimeScheduler;
|
|
16047
16047
|
var VirtualAction = function(_super) {
|
|
16048
16048
|
__extends(VirtualAction2, _super);
|
|
16049
|
-
function VirtualAction2(scheduler, work,
|
|
16050
|
-
if (
|
|
16051
|
-
|
|
16049
|
+
function VirtualAction2(scheduler, work, index) {
|
|
16050
|
+
if (index === undefined) {
|
|
16051
|
+
index = scheduler.index += 1;
|
|
16052
16052
|
}
|
|
16053
16053
|
var _this = _super.call(this, scheduler, work) || this;
|
|
16054
16054
|
_this.scheduler = scheduler;
|
|
16055
16055
|
_this.work = work;
|
|
16056
|
-
_this.index =
|
|
16056
|
+
_this.index = index;
|
|
16057
16057
|
_this.active = true;
|
|
16058
|
-
_this.index = scheduler.index =
|
|
16058
|
+
_this.index = scheduler.index = index;
|
|
16059
16059
|
return _this;
|
|
16060
16060
|
}
|
|
16061
16061
|
VirtualAction2.prototype.schedule = function(state, delay) {
|
|
@@ -17202,9 +17202,9 @@ var require_mergeMap = __commonJS((exports) => {
|
|
|
17202
17202
|
};
|
|
17203
17203
|
MergeMapSubscriber2.prototype._tryNext = function(value) {
|
|
17204
17204
|
var result;
|
|
17205
|
-
var
|
|
17205
|
+
var index = this.index++;
|
|
17206
17206
|
try {
|
|
17207
|
-
result = this.project(value,
|
|
17207
|
+
result = this.project(value, index);
|
|
17208
17208
|
} catch (err) {
|
|
17209
17209
|
this.destination.error(err);
|
|
17210
17210
|
return;
|
|
@@ -17784,12 +17784,12 @@ var require_pairs2 = __commonJS((exports) => {
|
|
|
17784
17784
|
}
|
|
17785
17785
|
exports.pairs = pairs;
|
|
17786
17786
|
function dispatch(state) {
|
|
17787
|
-
var { keys, index
|
|
17787
|
+
var { keys, index, subscriber, subscription, obj } = state;
|
|
17788
17788
|
if (!subscriber.closed) {
|
|
17789
|
-
if (
|
|
17790
|
-
var key = keys[
|
|
17789
|
+
if (index < keys.length) {
|
|
17790
|
+
var key = keys[index];
|
|
17791
17791
|
subscriber.next([key, obj[key]]);
|
|
17792
|
-
subscription.add(this.schedule({ keys, index:
|
|
17792
|
+
subscription.add(this.schedule({ keys, index: index + 1, subscriber, subscription, obj }));
|
|
17793
17793
|
} else {
|
|
17794
17794
|
subscriber.complete();
|
|
17795
17795
|
}
|
|
@@ -18002,18 +18002,18 @@ var require_range = __commonJS((exports) => {
|
|
|
18002
18002
|
count = start;
|
|
18003
18003
|
start = 0;
|
|
18004
18004
|
}
|
|
18005
|
-
var
|
|
18005
|
+
var index = 0;
|
|
18006
18006
|
var current = start;
|
|
18007
18007
|
if (scheduler) {
|
|
18008
18008
|
return scheduler.schedule(dispatch, 0, {
|
|
18009
|
-
index
|
|
18009
|
+
index,
|
|
18010
18010
|
count,
|
|
18011
18011
|
start,
|
|
18012
18012
|
subscriber
|
|
18013
18013
|
});
|
|
18014
18014
|
} else {
|
|
18015
18015
|
do {
|
|
18016
|
-
if (
|
|
18016
|
+
if (index++ >= count) {
|
|
18017
18017
|
subscriber.complete();
|
|
18018
18018
|
break;
|
|
18019
18019
|
}
|
|
@@ -18028,8 +18028,8 @@ var require_range = __commonJS((exports) => {
|
|
|
18028
18028
|
}
|
|
18029
18029
|
exports.range = range;
|
|
18030
18030
|
function dispatch(state) {
|
|
18031
|
-
var { start, index
|
|
18032
|
-
if (
|
|
18031
|
+
var { start, index, count, subscriber } = state;
|
|
18032
|
+
if (index >= count) {
|
|
18033
18033
|
subscriber.complete();
|
|
18034
18034
|
return;
|
|
18035
18035
|
}
|
|
@@ -18037,7 +18037,7 @@ var require_range = __commonJS((exports) => {
|
|
|
18037
18037
|
if (subscriber.closed) {
|
|
18038
18038
|
return;
|
|
18039
18039
|
}
|
|
18040
|
-
state.index =
|
|
18040
|
+
state.index = index + 1;
|
|
18041
18041
|
state.start = start + 1;
|
|
18042
18042
|
this.schedule(state);
|
|
18043
18043
|
}
|
|
@@ -18075,14 +18075,14 @@ var require_timer = __commonJS((exports) => {
|
|
|
18075
18075
|
}
|
|
18076
18076
|
exports.timer = timer;
|
|
18077
18077
|
function dispatch(state) {
|
|
18078
|
-
var { index
|
|
18079
|
-
subscriber.next(
|
|
18078
|
+
var { index, period, subscriber } = state;
|
|
18079
|
+
subscriber.next(index);
|
|
18080
18080
|
if (subscriber.closed) {
|
|
18081
18081
|
return;
|
|
18082
18082
|
} else if (period === -1) {
|
|
18083
18083
|
return subscriber.complete();
|
|
18084
18084
|
}
|
|
18085
|
-
state.index =
|
|
18085
|
+
state.index = index + 1;
|
|
18086
18086
|
this.schedule(state, period);
|
|
18087
18087
|
}
|
|
18088
18088
|
});
|
|
@@ -21780,6 +21780,8 @@ var require_Alias = __commonJS((exports) => {
|
|
|
21780
21780
|
});
|
|
21781
21781
|
}
|
|
21782
21782
|
resolve(doc, ctx) {
|
|
21783
|
+
if (ctx?.maxAliasCount === 0)
|
|
21784
|
+
throw new ReferenceError("Alias resolution is disabled");
|
|
21783
21785
|
let nodes;
|
|
21784
21786
|
if (ctx?.aliasResolveCache) {
|
|
21785
21787
|
nodes = ctx.aliasResolveCache;
|
|
@@ -22829,18 +22831,18 @@ var require_merge3 = __commonJS((exports) => {
|
|
|
22829
22831
|
};
|
|
22830
22832
|
var isMergeKey = (ctx, key) => (merge.identify(key) || identity.isScalar(key) && (!key.type || key.type === Scalar.Scalar.PLAIN) && merge.identify(key.value)) && ctx?.doc.schema.tags.some((tag) => tag.tag === merge.tag && tag.default);
|
|
22831
22833
|
function addMergeToJSMap(ctx, map, value) {
|
|
22832
|
-
|
|
22833
|
-
if (identity.isSeq(
|
|
22834
|
-
for (const it of
|
|
22834
|
+
const source = resolveAliasValue(ctx, value);
|
|
22835
|
+
if (identity.isSeq(source))
|
|
22836
|
+
for (const it of source.items)
|
|
22835
22837
|
mergeValue(ctx, map, it);
|
|
22836
|
-
else if (Array.isArray(
|
|
22837
|
-
for (const it of
|
|
22838
|
+
else if (Array.isArray(source))
|
|
22839
|
+
for (const it of source)
|
|
22838
22840
|
mergeValue(ctx, map, it);
|
|
22839
22841
|
else
|
|
22840
|
-
mergeValue(ctx, map,
|
|
22842
|
+
mergeValue(ctx, map, source);
|
|
22841
22843
|
}
|
|
22842
22844
|
function mergeValue(ctx, map, value) {
|
|
22843
|
-
const source = ctx
|
|
22845
|
+
const source = resolveAliasValue(ctx, value);
|
|
22844
22846
|
if (!identity.isMap(source))
|
|
22845
22847
|
throw new Error("Merge sources must be maps or map aliases");
|
|
22846
22848
|
const srcMap = source.toJSON(null, ctx, Map);
|
|
@@ -22861,6 +22863,9 @@ var require_merge3 = __commonJS((exports) => {
|
|
|
22861
22863
|
}
|
|
22862
22864
|
return map;
|
|
22863
22865
|
}
|
|
22866
|
+
function resolveAliasValue(ctx, value) {
|
|
22867
|
+
return ctx && identity.isAlias(value) ? value.resolve(ctx.doc, ctx) : value;
|
|
22868
|
+
}
|
|
22864
22869
|
exports.addMergeToJSMap = addMergeToJSMap;
|
|
22865
22870
|
exports.isMergeKey = isMergeKey;
|
|
22866
22871
|
exports.merge = merge;
|
|
@@ -23436,7 +23441,7 @@ var require_stringifyNumber = __commonJS((exports) => {
|
|
|
23436
23441
|
if (!isFinite(num))
|
|
23437
23442
|
return isNaN(num) ? ".nan" : num < 0 ? "-.inf" : ".inf";
|
|
23438
23443
|
let n = Object.is(value, -0) ? "-0" : JSON.stringify(value);
|
|
23439
|
-
if (!format && minFractionDigits && (!tag || tag === "tag:yaml.org,2002:float") &&
|
|
23444
|
+
if (!format && minFractionDigits && (!tag || tag === "tag:yaml.org,2002:float") && /^-?\d/.test(n) && !n.includes("e")) {
|
|
23440
23445
|
let i = n.indexOf(".");
|
|
23441
23446
|
if (i < 0) {
|
|
23442
23447
|
i = n.length;
|
|
@@ -25661,7 +25666,7 @@ var require_resolve_flow_scalar = __commonJS((exports) => {
|
|
|
25661
25666
|
while (next === " " || next === "\t")
|
|
25662
25667
|
next = source[++i + 1];
|
|
25663
25668
|
} else if (next === "x" || next === "u" || next === "U") {
|
|
25664
|
-
const length =
|
|
25669
|
+
const length = next === "x" ? 2 : next === "u" ? 4 : 8;
|
|
25665
25670
|
res += parseCharCode(source, i + 1, length, onError);
|
|
25666
25671
|
i += length;
|
|
25667
25672
|
} else {
|
|
@@ -25730,12 +25735,13 @@ var require_resolve_flow_scalar = __commonJS((exports) => {
|
|
|
25730
25735
|
const cc = source.substr(offset, length);
|
|
25731
25736
|
const ok = cc.length === length && /^[0-9a-fA-F]+$/.test(cc);
|
|
25732
25737
|
const code = ok ? parseInt(cc, 16) : NaN;
|
|
25733
|
-
|
|
25738
|
+
try {
|
|
25739
|
+
return String.fromCodePoint(code);
|
|
25740
|
+
} catch {
|
|
25734
25741
|
const raw = source.substr(offset - 2, length + 2);
|
|
25735
25742
|
onError(offset - 2, "BAD_DQ_ESCAPE", `Invalid escape sequence ${raw}`);
|
|
25736
25743
|
return raw;
|
|
25737
25744
|
}
|
|
25738
|
-
return String.fromCodePoint(code);
|
|
25739
25745
|
}
|
|
25740
25746
|
exports.resolveFlowScalar = resolveFlowScalar;
|
|
25741
25747
|
});
|
|
@@ -26074,8 +26080,10 @@ ${cb}` : comment;
|
|
|
26074
26080
|
}
|
|
26075
26081
|
}
|
|
26076
26082
|
if (afterDoc) {
|
|
26077
|
-
|
|
26078
|
-
|
|
26083
|
+
for (let i = 0;i < this.errors.length; ++i)
|
|
26084
|
+
doc.errors.push(this.errors[i]);
|
|
26085
|
+
for (let i = 0;i < this.warnings.length; ++i)
|
|
26086
|
+
doc.warnings.push(this.warnings[i]);
|
|
26079
26087
|
} else {
|
|
26080
26088
|
doc.errors = this.errors;
|
|
26081
26089
|
doc.warnings = this.warnings;
|
|
@@ -26440,10 +26448,10 @@ var require_cst_visit = __commonJS((exports) => {
|
|
|
26440
26448
|
visit.REMOVE = REMOVE;
|
|
26441
26449
|
visit.itemAtPath = (cst, path3) => {
|
|
26442
26450
|
let item = cst;
|
|
26443
|
-
for (const [field,
|
|
26451
|
+
for (const [field, index] of path3) {
|
|
26444
26452
|
const tok = item?.[field];
|
|
26445
26453
|
if (tok && "items" in tok) {
|
|
26446
|
-
item = tok.items[
|
|
26454
|
+
item = tok.items[index];
|
|
26447
26455
|
} else
|
|
26448
26456
|
return;
|
|
26449
26457
|
}
|
|
@@ -26787,7 +26795,7 @@ var require_lexer = __commonJS((exports) => {
|
|
|
26787
26795
|
const n = (yield* this.pushCount(1)) + (yield* this.pushSpaces(true));
|
|
26788
26796
|
this.indentNext = this.indentValue + 1;
|
|
26789
26797
|
this.indentValue += n;
|
|
26790
|
-
return
|
|
26798
|
+
return "block-start";
|
|
26791
26799
|
}
|
|
26792
26800
|
return "doc";
|
|
26793
26801
|
}
|
|
@@ -27094,26 +27102,37 @@ var require_lexer = __commonJS((exports) => {
|
|
|
27094
27102
|
return 0;
|
|
27095
27103
|
}
|
|
27096
27104
|
*pushIndicators() {
|
|
27097
|
-
|
|
27098
|
-
|
|
27099
|
-
|
|
27100
|
-
|
|
27101
|
-
|
|
27102
|
-
|
|
27103
|
-
|
|
27104
|
-
|
|
27105
|
-
|
|
27106
|
-
|
|
27107
|
-
|
|
27108
|
-
|
|
27109
|
-
|
|
27110
|
-
|
|
27111
|
-
|
|
27112
|
-
|
|
27105
|
+
let n = 0;
|
|
27106
|
+
loop:
|
|
27107
|
+
while (true) {
|
|
27108
|
+
switch (this.charAt(0)) {
|
|
27109
|
+
case "!":
|
|
27110
|
+
n += yield* this.pushTag();
|
|
27111
|
+
n += yield* this.pushSpaces(true);
|
|
27112
|
+
continue loop;
|
|
27113
|
+
case "&":
|
|
27114
|
+
n += yield* this.pushUntil(isNotAnchorChar);
|
|
27115
|
+
n += yield* this.pushSpaces(true);
|
|
27116
|
+
continue loop;
|
|
27117
|
+
case "-":
|
|
27118
|
+
case "?":
|
|
27119
|
+
case ":": {
|
|
27120
|
+
const inFlow = this.flowLevel > 0;
|
|
27121
|
+
const ch1 = this.charAt(1);
|
|
27122
|
+
if (isEmpty(ch1) || inFlow && flowIndicatorChars.has(ch1)) {
|
|
27123
|
+
if (!inFlow)
|
|
27124
|
+
this.indentNext = this.indentValue + 1;
|
|
27125
|
+
else if (this.flowKey)
|
|
27126
|
+
this.flowKey = false;
|
|
27127
|
+
n += yield* this.pushCount(1);
|
|
27128
|
+
n += yield* this.pushSpaces(true);
|
|
27129
|
+
continue loop;
|
|
27130
|
+
}
|
|
27131
|
+
}
|
|
27113
27132
|
}
|
|
27133
|
+
break loop;
|
|
27114
27134
|
}
|
|
27115
|
-
|
|
27116
|
-
return 0;
|
|
27135
|
+
return n;
|
|
27117
27136
|
}
|
|
27118
27137
|
*pushTag() {
|
|
27119
27138
|
if (this.charAt(1) === "<") {
|
|
@@ -27267,6 +27286,13 @@ var require_parser = __commonJS((exports) => {
|
|
|
27267
27286
|
while (prev[++i]?.type === "space") {}
|
|
27268
27287
|
return prev.splice(i, prev.length);
|
|
27269
27288
|
}
|
|
27289
|
+
function arrayPushArray(target, source) {
|
|
27290
|
+
if (source.length < 1e5)
|
|
27291
|
+
Array.prototype.push.apply(target, source);
|
|
27292
|
+
else
|
|
27293
|
+
for (let i = 0;i < source.length; ++i)
|
|
27294
|
+
target.push(source[i]);
|
|
27295
|
+
}
|
|
27270
27296
|
function fixFlowSeqItems(fc) {
|
|
27271
27297
|
if (fc.start.type === "flow-seq-start") {
|
|
27272
27298
|
for (const it of fc.items) {
|
|
@@ -27276,11 +27302,11 @@ var require_parser = __commonJS((exports) => {
|
|
|
27276
27302
|
delete it.key;
|
|
27277
27303
|
if (isFlowToken(it.value)) {
|
|
27278
27304
|
if (it.value.end)
|
|
27279
|
-
|
|
27305
|
+
arrayPushArray(it.value.end, it.sep);
|
|
27280
27306
|
else
|
|
27281
27307
|
it.value.end = it.sep;
|
|
27282
27308
|
} else
|
|
27283
|
-
|
|
27309
|
+
arrayPushArray(it.start, it.sep);
|
|
27284
27310
|
delete it.sep;
|
|
27285
27311
|
}
|
|
27286
27312
|
}
|
|
@@ -27620,7 +27646,7 @@ var require_parser = __commonJS((exports) => {
|
|
|
27620
27646
|
const prev = map.items[map.items.length - 2];
|
|
27621
27647
|
const end = prev?.value?.end;
|
|
27622
27648
|
if (Array.isArray(end)) {
|
|
27623
|
-
|
|
27649
|
+
arrayPushArray(end, it.start);
|
|
27624
27650
|
end.push(this.sourceToken);
|
|
27625
27651
|
map.items.pop();
|
|
27626
27652
|
return;
|
|
@@ -27808,7 +27834,7 @@ var require_parser = __commonJS((exports) => {
|
|
|
27808
27834
|
const prev = seq.items[seq.items.length - 2];
|
|
27809
27835
|
const end = prev?.value?.end;
|
|
27810
27836
|
if (Array.isArray(end)) {
|
|
27811
|
-
|
|
27837
|
+
arrayPushArray(end, it.start);
|
|
27812
27838
|
end.push(this.sourceToken);
|
|
27813
27839
|
seq.items.pop();
|
|
27814
27840
|
return;
|
|
@@ -28189,27 +28215,54 @@ var NETWORK_ERROR_CODES = new Set([
|
|
|
28189
28215
|
"ENETUNREACH",
|
|
28190
28216
|
"EAI_FAIL"
|
|
28191
28217
|
]);
|
|
28192
|
-
|
|
28193
|
-
|
|
28194
|
-
|
|
28195
|
-
|
|
28196
|
-
|
|
28197
|
-
|
|
28198
|
-
|
|
28199
|
-
|
|
28200
|
-
|
|
28201
|
-
|
|
28202
|
-
|
|
28203
|
-
|
|
28204
|
-
|
|
28205
|
-
|
|
28206
|
-
|
|
28207
|
-
|
|
28208
|
-
|
|
28218
|
+
var TLS_ERROR_CODES = new Set([
|
|
28219
|
+
"SELF_SIGNED_CERT_IN_CHAIN",
|
|
28220
|
+
"DEPTH_ZERO_SELF_SIGNED_CERT",
|
|
28221
|
+
"UNABLE_TO_VERIFY_LEAF_SIGNATURE",
|
|
28222
|
+
"UNABLE_TO_GET_ISSUER_CERT_LOCALLY",
|
|
28223
|
+
"UNABLE_TO_GET_ISSUER_CERT",
|
|
28224
|
+
"CERT_HAS_EXPIRED",
|
|
28225
|
+
"CERT_UNTRUSTED",
|
|
28226
|
+
"ERR_TLS_CERT_ALTNAME_INVALID"
|
|
28227
|
+
]);
|
|
28228
|
+
var TLS_INSTRUCTIONS = "The server's TLS certificate could not be verified. Most often a " + "corporate proxy/firewall re-signs HTTPS with a root CA that Node does " + "not trust — set NODE_EXTRA_CA_CERTS to that CA's PEM file (and HTTPS_PROXY " + "if you connect through a proxy). If the certificate is instead expired or " + "its hostname does not match, fix the endpoint URL or the system clock. " + "Then retry.";
|
|
28229
|
+
var NETWORK_INSTRUCTIONS = "Could not reach the UiPath service. Check your network connection and " + "VPN, confirm any HTTP_PROXY/HTTPS_PROXY/NO_PROXY settings are correct, " + "then retry.";
|
|
28230
|
+
function describeConnectivityError(error) {
|
|
28231
|
+
let current = error;
|
|
28232
|
+
for (let depth = 0;depth < 5 && current !== null && typeof current === "object"; depth++) {
|
|
28233
|
+
const cur = current;
|
|
28234
|
+
const code = typeof cur.code === "string" ? cur.code : undefined;
|
|
28235
|
+
const message = typeof cur.message === "string" ? cur.message : undefined;
|
|
28236
|
+
if (code && TLS_ERROR_CODES.has(code)) {
|
|
28237
|
+
return {
|
|
28238
|
+
code,
|
|
28239
|
+
kind: "tls",
|
|
28240
|
+
message: message ?? code,
|
|
28241
|
+
instructions: TLS_INSTRUCTIONS
|
|
28242
|
+
};
|
|
28209
28243
|
}
|
|
28244
|
+
if (code && NETWORK_ERROR_CODES.has(code)) {
|
|
28245
|
+
return {
|
|
28246
|
+
code,
|
|
28247
|
+
kind: "network",
|
|
28248
|
+
message: message ?? code,
|
|
28249
|
+
instructions: NETWORK_INSTRUCTIONS
|
|
28250
|
+
};
|
|
28251
|
+
}
|
|
28252
|
+
current = cur.cause;
|
|
28210
28253
|
}
|
|
28211
28254
|
return;
|
|
28212
28255
|
}
|
|
28256
|
+
function parseHttpStatusFromMessage(message) {
|
|
28257
|
+
const match = /^HTTP\s+(\d{3})(?::|\s|-|$)/i.exec(message.trim());
|
|
28258
|
+
if (!match)
|
|
28259
|
+
return;
|
|
28260
|
+
const status = Number(match[1]);
|
|
28261
|
+
return Number.isInteger(status) && status >= 100 && status <= 599 ? status : undefined;
|
|
28262
|
+
}
|
|
28263
|
+
function isHtmlDocument(body) {
|
|
28264
|
+
return /^\s*(<!doctype html|<html\b)/i.test(body);
|
|
28265
|
+
}
|
|
28213
28266
|
function retryHintForRetryAfter(seconds) {
|
|
28214
28267
|
if (seconds <= 1) {
|
|
28215
28268
|
return "RetryAfter1Second";
|
|
@@ -28250,15 +28303,28 @@ function classifyError(status, error) {
|
|
|
28250
28303
|
if (status !== undefined && status >= 500 && status < 600) {
|
|
28251
28304
|
return { errorCode: "server_error", retry: "RetryLater" };
|
|
28252
28305
|
}
|
|
28253
|
-
|
|
28254
|
-
|
|
28306
|
+
const connectivity = describeConnectivityError(error);
|
|
28307
|
+
if (connectivity) {
|
|
28308
|
+
return {
|
|
28309
|
+
errorCode: "network_error",
|
|
28310
|
+
retry: connectivity.kind === "tls" ? "RetryWillNotFix" : "RetryLater"
|
|
28311
|
+
};
|
|
28255
28312
|
}
|
|
28256
28313
|
return { errorCode: "unknown_error", retry: "RetryWillNotFix" };
|
|
28257
28314
|
}
|
|
28315
|
+
function formatHttpStatusMessage(status, rawMessage, extractedMessage, inferredStatus) {
|
|
28316
|
+
if (extractedMessage) {
|
|
28317
|
+
return `HTTP ${status}: ${extractedMessage}`;
|
|
28318
|
+
}
|
|
28319
|
+
return inferredStatus !== undefined ? rawMessage : `HTTP ${status}: ${rawMessage}`;
|
|
28320
|
+
}
|
|
28258
28321
|
async function extractErrorDetails(error, options) {
|
|
28259
28322
|
const err = error !== null && error !== undefined && typeof error === "object" ? error : {};
|
|
28260
28323
|
const response = err.response;
|
|
28261
|
-
const
|
|
28324
|
+
const rawMessage = typeof err.message === "string" ? err.message : "Unknown error";
|
|
28325
|
+
const explicitStatus = err.status ?? response?.status;
|
|
28326
|
+
const inferredStatus = explicitStatus === undefined ? parseHttpStatusFromMessage(rawMessage) : undefined;
|
|
28327
|
+
const status = explicitStatus ?? inferredStatus;
|
|
28262
28328
|
const isSuccessfulResponse = status !== undefined && status >= 200 && status < 300;
|
|
28263
28329
|
let rawBody;
|
|
28264
28330
|
let extractedMessage;
|
|
@@ -28293,7 +28359,6 @@ async function extractErrorDetails(error, options) {
|
|
|
28293
28359
|
}
|
|
28294
28360
|
}
|
|
28295
28361
|
}
|
|
28296
|
-
const rawMessage = typeof err.message === "string" ? err.message : "Unknown error";
|
|
28297
28362
|
let message;
|
|
28298
28363
|
let result = "Failure";
|
|
28299
28364
|
const classification = classifyError(status, error);
|
|
@@ -28307,10 +28372,10 @@ async function extractErrorDetails(error, options) {
|
|
|
28307
28372
|
} else if (status === 405) {
|
|
28308
28373
|
message = DEFAULT_405;
|
|
28309
28374
|
} else if (status === 400 || status === 422) {
|
|
28310
|
-
message =
|
|
28375
|
+
message = formatHttpStatusMessage(status, rawMessage, extractedMessage, inferredStatus);
|
|
28311
28376
|
result = "ValidationError";
|
|
28312
28377
|
} else if (status === 429) {
|
|
28313
|
-
message =
|
|
28378
|
+
message = formatHttpStatusMessage(status, rawMessage, extractedMessage, inferredStatus);
|
|
28314
28379
|
} else if (extractedMessage) {
|
|
28315
28380
|
if (isSuccessfulResponse && rawMessage !== "Unknown error") {
|
|
28316
28381
|
message = rawMessage;
|
|
@@ -28318,7 +28383,9 @@ async function extractErrorDetails(error, options) {
|
|
|
28318
28383
|
message = status ? `HTTP ${status}: ${extractedMessage}` : extractedMessage;
|
|
28319
28384
|
}
|
|
28320
28385
|
} else if (status) {
|
|
28321
|
-
if (
|
|
28386
|
+
if (inferredStatus !== undefined) {
|
|
28387
|
+
message = rawMessage;
|
|
28388
|
+
} else if (rawMessage === "Unknown error" && response) {
|
|
28322
28389
|
const statusText = response.statusText;
|
|
28323
28390
|
message = statusText ? `HTTP ${status} ${statusText}` : `HTTP ${status} - request failed`;
|
|
28324
28391
|
} else {
|
|
@@ -28327,6 +28394,12 @@ async function extractErrorDetails(error, options) {
|
|
|
28327
28394
|
} else {
|
|
28328
28395
|
message = rawMessage;
|
|
28329
28396
|
}
|
|
28397
|
+
if (status === undefined) {
|
|
28398
|
+
const connectivity = describeConnectivityError(error);
|
|
28399
|
+
if (connectivity && connectivity.message !== message && !message.includes(connectivity.message)) {
|
|
28400
|
+
message = `${message}: ${connectivity.message}`;
|
|
28401
|
+
}
|
|
28402
|
+
}
|
|
28330
28403
|
let details = rawMessage;
|
|
28331
28404
|
if (rawBody) {
|
|
28332
28405
|
if (parsedBody) {
|
|
@@ -28490,6 +28563,7 @@ var CONSOLE_FALLBACK = {
|
|
|
28490
28563
|
writeLog: (str) => process.stdout.write(str),
|
|
28491
28564
|
capabilities: {
|
|
28492
28565
|
isInteractive: false,
|
|
28566
|
+
canReadInput: false,
|
|
28493
28567
|
supportsColor: false,
|
|
28494
28568
|
outputWidth: 80
|
|
28495
28569
|
}
|
|
@@ -33690,6 +33764,29 @@ function isPlainRecord(value) {
|
|
|
33690
33764
|
const prototype = Object.getPrototypeOf(value);
|
|
33691
33765
|
return prototype === Object.prototype || prototype === null;
|
|
33692
33766
|
}
|
|
33767
|
+
function extractPagedRows(value) {
|
|
33768
|
+
if (Array.isArray(value) || !isPlainRecord(value))
|
|
33769
|
+
return null;
|
|
33770
|
+
const entries = Object.values(value);
|
|
33771
|
+
if (entries.length === 0)
|
|
33772
|
+
return null;
|
|
33773
|
+
let rows = null;
|
|
33774
|
+
let hasScalarSibling = false;
|
|
33775
|
+
for (const entry of entries) {
|
|
33776
|
+
if (Array.isArray(entry)) {
|
|
33777
|
+
if (rows !== null)
|
|
33778
|
+
return null;
|
|
33779
|
+
rows = entry;
|
|
33780
|
+
} else if (entry !== null && typeof entry === "object") {
|
|
33781
|
+
return null;
|
|
33782
|
+
} else {
|
|
33783
|
+
hasScalarSibling = true;
|
|
33784
|
+
}
|
|
33785
|
+
}
|
|
33786
|
+
if (rows === null || !hasScalarSibling)
|
|
33787
|
+
return null;
|
|
33788
|
+
return rows;
|
|
33789
|
+
}
|
|
33693
33790
|
function toLowerCamelCaseKey(key) {
|
|
33694
33791
|
if (!key)
|
|
33695
33792
|
return key;
|
|
@@ -33754,7 +33851,8 @@ function printOutput(data, format = "json", logFn, asciiSafe = false) {
|
|
|
33754
33851
|
break;
|
|
33755
33852
|
case "plain": {
|
|
33756
33853
|
if ("Data" in data && data.Data != null) {
|
|
33757
|
-
const
|
|
33854
|
+
const pagedRows = extractPagedRows(data.Data);
|
|
33855
|
+
const items = pagedRows ?? (Array.isArray(data.Data) ? data.Data : [data.Data]);
|
|
33758
33856
|
items.forEach((item) => {
|
|
33759
33857
|
const values = Object.values(item).map((v) => v ?? "").join("\t");
|
|
33760
33858
|
logFn(values);
|
|
@@ -33766,10 +33864,13 @@ function printOutput(data, format = "json", logFn, asciiSafe = false) {
|
|
|
33766
33864
|
break;
|
|
33767
33865
|
}
|
|
33768
33866
|
default: {
|
|
33769
|
-
|
|
33867
|
+
const hasData = "Data" in data && data.Data != null;
|
|
33868
|
+
const pagedRows = hasData ? extractPagedRows(data.Data) : null;
|
|
33869
|
+
const rows = pagedRows ? pagedRows : Array.isArray(data.Data) ? data.Data : null;
|
|
33870
|
+
if (hasData && !(rows !== null && rows.length === 0)) {
|
|
33770
33871
|
const logValue = data.Log;
|
|
33771
|
-
if (
|
|
33772
|
-
printResizableTable(
|
|
33872
|
+
if (rows !== null) {
|
|
33873
|
+
printResizableTable(rows, logFn, logValue);
|
|
33773
33874
|
} else {
|
|
33774
33875
|
printVerticalTable(data.Data, logFn, logValue);
|
|
33775
33876
|
}
|
|
@@ -33957,6 +34058,44 @@ function defaultErrorCodeForResult(result) {
|
|
|
33957
34058
|
return "unknown_error";
|
|
33958
34059
|
}
|
|
33959
34060
|
}
|
|
34061
|
+
function parseHttpStatusFromMessage2(message) {
|
|
34062
|
+
const match = /^HTTP\s+(\d{3})(?::|\s|-|$)/i.exec(message.trim());
|
|
34063
|
+
if (!match)
|
|
34064
|
+
return;
|
|
34065
|
+
const status = Number(match[1]);
|
|
34066
|
+
return Number.isInteger(status) && status >= 100 && status <= 599 ? status : undefined;
|
|
34067
|
+
}
|
|
34068
|
+
function defaultErrorCodeForHttpStatus(status) {
|
|
34069
|
+
if (status === undefined)
|
|
34070
|
+
return;
|
|
34071
|
+
if (status === 400 || status === 409 || status === 422) {
|
|
34072
|
+
return "invalid_argument";
|
|
34073
|
+
}
|
|
34074
|
+
if (status === 401)
|
|
34075
|
+
return "authentication_required";
|
|
34076
|
+
if (status === 403)
|
|
34077
|
+
return "permission_denied";
|
|
34078
|
+
if (status === 404)
|
|
34079
|
+
return "not_found";
|
|
34080
|
+
if (status === 405)
|
|
34081
|
+
return "method_not_allowed";
|
|
34082
|
+
if (status === 408)
|
|
34083
|
+
return "timeout";
|
|
34084
|
+
if (status === 429)
|
|
34085
|
+
return "rate_limited";
|
|
34086
|
+
if (status >= 500 && status < 600)
|
|
34087
|
+
return "server_error";
|
|
34088
|
+
return;
|
|
34089
|
+
}
|
|
34090
|
+
function defaultErrorCodeForFailure(data) {
|
|
34091
|
+
if (data.Result === RESULTS.Failure) {
|
|
34092
|
+
const status = data.Context?.httpStatus ?? parseHttpStatusFromMessage2(data.Message);
|
|
34093
|
+
const errorCode = defaultErrorCodeForHttpStatus(status);
|
|
34094
|
+
if (errorCode)
|
|
34095
|
+
return errorCode;
|
|
34096
|
+
}
|
|
34097
|
+
return defaultErrorCodeForResult(data.Result);
|
|
34098
|
+
}
|
|
33960
34099
|
function defaultRetryForErrorCode(errorCode) {
|
|
33961
34100
|
switch (errorCode) {
|
|
33962
34101
|
case "network_error":
|
|
@@ -33986,16 +34125,19 @@ var OutputFormatter;
|
|
|
33986
34125
|
OutputFormatter.success = success;
|
|
33987
34126
|
function error(data) {
|
|
33988
34127
|
data.Log ??= getLogFilePath() || undefined;
|
|
33989
|
-
data.ErrorCode ??=
|
|
34128
|
+
data.ErrorCode ??= defaultErrorCodeForFailure(data);
|
|
33990
34129
|
data.Retry ??= defaultRetryForErrorCode(data.ErrorCode);
|
|
33991
34130
|
process.exitCode = EXIT_CODES[data.Result] ?? 1;
|
|
33992
|
-
|
|
33993
|
-
|
|
33994
|
-
|
|
33995
|
-
|
|
33996
|
-
|
|
33997
|
-
|
|
33998
|
-
|
|
34131
|
+
const { SuppressTelemetry, ...envelope } = data;
|
|
34132
|
+
if (!SuppressTelemetry) {
|
|
34133
|
+
telemetry.trackEvent(CommonTelemetryEvents.Error, {
|
|
34134
|
+
result: data.Result,
|
|
34135
|
+
errorCode: data.ErrorCode,
|
|
34136
|
+
retry: data.Retry,
|
|
34137
|
+
message: data.Message
|
|
34138
|
+
});
|
|
34139
|
+
}
|
|
34140
|
+
logOutput(normalizeOutputKeys(envelope), getOutputFormat());
|
|
33999
34141
|
}
|
|
34000
34142
|
OutputFormatter.error = error;
|
|
34001
34143
|
function emitList(code, items, opts) {
|
|
@@ -34286,1543 +34428,140 @@ var DEFAULT_PAGE_SIZE = 50;
|
|
|
34286
34428
|
var DEFAULT_AUTH_TIMEOUT_MS = 5 * 60 * 1000;
|
|
34287
34429
|
// ../common/src/interactivity-context.ts
|
|
34288
34430
|
var modeSlot = singleton("InteractivityMode");
|
|
34289
|
-
//
|
|
34290
|
-
|
|
34291
|
-
|
|
34292
|
-
|
|
34293
|
-
add(name, callback, first) {
|
|
34294
|
-
if (typeof arguments[0] != "string") {
|
|
34295
|
-
for (let name2 in arguments[0]) {
|
|
34296
|
-
this.add(name2, arguments[0][name2], arguments[1]);
|
|
34297
|
-
}
|
|
34298
|
-
} else {
|
|
34299
|
-
(Array.isArray(name) ? name : [name]).forEach(function(name2) {
|
|
34300
|
-
this[name2] = this[name2] || [];
|
|
34301
|
-
if (callback) {
|
|
34302
|
-
this[name2][first ? "unshift" : "push"](callback);
|
|
34303
|
-
}
|
|
34304
|
-
}, this);
|
|
34305
|
-
}
|
|
34306
|
-
}
|
|
34307
|
-
run(name, env) {
|
|
34308
|
-
this[name] = this[name] || [];
|
|
34309
|
-
this[name].forEach(function(callback) {
|
|
34310
|
-
callback.call(env && env.context ? env.context : env, env);
|
|
34311
|
-
});
|
|
34431
|
+
// ../common/src/polling/format-utils.ts
|
|
34432
|
+
function msToDuration(ms) {
|
|
34433
|
+
if (!Number.isFinite(ms) || ms < 0) {
|
|
34434
|
+
return "00:00:00";
|
|
34312
34435
|
}
|
|
34436
|
+
const totalSec = Math.floor(ms / 1000);
|
|
34437
|
+
const h = Math.floor(totalSec / 3600);
|
|
34438
|
+
const m = Math.floor(totalSec % 3600 / 60);
|
|
34439
|
+
const s = totalSec % 60;
|
|
34440
|
+
return [h, m, s].map((v) => String(v).padStart(2, "0")).join(":");
|
|
34313
34441
|
}
|
|
34442
|
+
// ../common/src/polling/types.ts
|
|
34443
|
+
var PollOutcome = {
|
|
34444
|
+
Completed: "completed",
|
|
34445
|
+
Timeout: "timeout",
|
|
34446
|
+
Interrupted: "interrupted",
|
|
34447
|
+
Aborted: "aborted",
|
|
34448
|
+
Failed: "failed"
|
|
34449
|
+
};
|
|
34450
|
+
var ErrorDecision = {
|
|
34451
|
+
Abort: "abort"
|
|
34452
|
+
};
|
|
34453
|
+
var POLL_DEFAULTS = {
|
|
34454
|
+
intervalMs: 5000,
|
|
34455
|
+
timeoutMs: 1800000,
|
|
34456
|
+
maxConsecutiveErrors: 3,
|
|
34457
|
+
logIntervalMs: 30000,
|
|
34458
|
+
logPrefix: "wait"
|
|
34459
|
+
};
|
|
34460
|
+
var BACKOFF_DEFAULTS = {
|
|
34461
|
+
initialMs: 1000,
|
|
34462
|
+
multiplier: 2,
|
|
34463
|
+
maxMs: 30000,
|
|
34464
|
+
jitter: 0.5
|
|
34465
|
+
};
|
|
34466
|
+
var MIN_INTERVAL_MS = 100;
|
|
34314
34467
|
|
|
34315
|
-
|
|
34316
|
-
|
|
34317
|
-
|
|
34318
|
-
|
|
34319
|
-
|
|
34320
|
-
|
|
34321
|
-
|
|
34322
|
-
|
|
34323
|
-
|
|
34324
|
-
|
|
34325
|
-
|
|
34326
|
-
|
|
34327
|
-
|
|
34328
|
-
|
|
34329
|
-
|
|
34330
|
-
|
|
34331
|
-
|
|
34468
|
+
// ../common/src/polling/poll-failure-mapping.ts
|
|
34469
|
+
var REASON_BY_OUTCOME = {
|
|
34470
|
+
[PollOutcome.Timeout]: "poll_timeout",
|
|
34471
|
+
[PollOutcome.Failed]: "poll_failed",
|
|
34472
|
+
[PollOutcome.Interrupted]: "poll_failed",
|
|
34473
|
+
[PollOutcome.Aborted]: "poll_aborted"
|
|
34474
|
+
};
|
|
34475
|
+
function mapPollFailure(pollResult, label) {
|
|
34476
|
+
const outcome = pollResult.outcome;
|
|
34477
|
+
const errMsg = pollResult.error?.message ?? "too many consecutive errors";
|
|
34478
|
+
const messageByOutcome = {
|
|
34479
|
+
[PollOutcome.Timeout]: `${label} polling timed out`,
|
|
34480
|
+
[PollOutcome.Failed]: `${label} polling failed: ${errMsg}`,
|
|
34481
|
+
[PollOutcome.Interrupted]: `${label} polling was interrupted`,
|
|
34482
|
+
[PollOutcome.Aborted]: `${label} polling was aborted`
|
|
34483
|
+
};
|
|
34484
|
+
return {
|
|
34485
|
+
reason: REASON_BY_OUTCOME[outcome],
|
|
34486
|
+
message: messageByOutcome[outcome],
|
|
34487
|
+
exitCode: outcome === PollOutcome.Timeout ? 2 : 1
|
|
34488
|
+
};
|
|
34332
34489
|
}
|
|
34333
|
-
|
|
34334
|
-
|
|
34335
|
-
|
|
34336
|
-
return
|
|
34337
|
-
}
|
|
34338
|
-
static toString() {
|
|
34339
|
-
return "JavaScript Expression Parser (JSEP) v" + Jsep.version;
|
|
34340
|
-
}
|
|
34341
|
-
static addUnaryOp(op_name) {
|
|
34342
|
-
Jsep.max_unop_len = Math.max(op_name.length, Jsep.max_unop_len);
|
|
34343
|
-
Jsep.unary_ops[op_name] = 1;
|
|
34344
|
-
return Jsep;
|
|
34345
|
-
}
|
|
34346
|
-
static addBinaryOp(op_name, precedence, isRightAssociative) {
|
|
34347
|
-
Jsep.max_binop_len = Math.max(op_name.length, Jsep.max_binop_len);
|
|
34348
|
-
Jsep.binary_ops[op_name] = precedence;
|
|
34349
|
-
if (isRightAssociative) {
|
|
34350
|
-
Jsep.right_associative.add(op_name);
|
|
34351
|
-
} else {
|
|
34352
|
-
Jsep.right_associative.delete(op_name);
|
|
34353
|
-
}
|
|
34354
|
-
return Jsep;
|
|
34355
|
-
}
|
|
34356
|
-
static addIdentifierChar(char) {
|
|
34357
|
-
Jsep.additional_identifier_chars.add(char);
|
|
34358
|
-
return Jsep;
|
|
34359
|
-
}
|
|
34360
|
-
static addLiteral(literal_name, literal_value) {
|
|
34361
|
-
Jsep.literals[literal_name] = literal_value;
|
|
34362
|
-
return Jsep;
|
|
34363
|
-
}
|
|
34364
|
-
static removeUnaryOp(op_name) {
|
|
34365
|
-
delete Jsep.unary_ops[op_name];
|
|
34366
|
-
if (op_name.length === Jsep.max_unop_len) {
|
|
34367
|
-
Jsep.max_unop_len = Jsep.getMaxKeyLen(Jsep.unary_ops);
|
|
34368
|
-
}
|
|
34369
|
-
return Jsep;
|
|
34370
|
-
}
|
|
34371
|
-
static removeAllUnaryOps() {
|
|
34372
|
-
Jsep.unary_ops = {};
|
|
34373
|
-
Jsep.max_unop_len = 0;
|
|
34374
|
-
return Jsep;
|
|
34375
|
-
}
|
|
34376
|
-
static removeIdentifierChar(char) {
|
|
34377
|
-
Jsep.additional_identifier_chars.delete(char);
|
|
34378
|
-
return Jsep;
|
|
34379
|
-
}
|
|
34380
|
-
static removeBinaryOp(op_name) {
|
|
34381
|
-
delete Jsep.binary_ops[op_name];
|
|
34382
|
-
if (op_name.length === Jsep.max_binop_len) {
|
|
34383
|
-
Jsep.max_binop_len = Jsep.getMaxKeyLen(Jsep.binary_ops);
|
|
34384
|
-
}
|
|
34385
|
-
Jsep.right_associative.delete(op_name);
|
|
34386
|
-
return Jsep;
|
|
34387
|
-
}
|
|
34388
|
-
static removeAllBinaryOps() {
|
|
34389
|
-
Jsep.binary_ops = {};
|
|
34390
|
-
Jsep.max_binop_len = 0;
|
|
34391
|
-
return Jsep;
|
|
34392
|
-
}
|
|
34393
|
-
static removeLiteral(literal_name) {
|
|
34394
|
-
delete Jsep.literals[literal_name];
|
|
34395
|
-
return Jsep;
|
|
34396
|
-
}
|
|
34397
|
-
static removeAllLiterals() {
|
|
34398
|
-
Jsep.literals = {};
|
|
34399
|
-
return Jsep;
|
|
34400
|
-
}
|
|
34401
|
-
get char() {
|
|
34402
|
-
return this.expr.charAt(this.index);
|
|
34403
|
-
}
|
|
34404
|
-
get code() {
|
|
34405
|
-
return this.expr.charCodeAt(this.index);
|
|
34406
|
-
}
|
|
34407
|
-
constructor(expr) {
|
|
34408
|
-
this.expr = expr;
|
|
34409
|
-
this.index = 0;
|
|
34410
|
-
}
|
|
34411
|
-
static parse(expr) {
|
|
34412
|
-
return new Jsep(expr).parse();
|
|
34413
|
-
}
|
|
34414
|
-
static getMaxKeyLen(obj) {
|
|
34415
|
-
return Math.max(0, ...Object.keys(obj).map((k) => k.length));
|
|
34416
|
-
}
|
|
34417
|
-
static isDecimalDigit(ch) {
|
|
34418
|
-
return ch >= 48 && ch <= 57;
|
|
34419
|
-
}
|
|
34420
|
-
static binaryPrecedence(op_val) {
|
|
34421
|
-
return Jsep.binary_ops[op_val] || 0;
|
|
34422
|
-
}
|
|
34423
|
-
static isIdentifierStart(ch) {
|
|
34424
|
-
return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 || ch >= 128 && !Jsep.binary_ops[String.fromCharCode(ch)] || Jsep.additional_identifier_chars.has(String.fromCharCode(ch));
|
|
34425
|
-
}
|
|
34426
|
-
static isIdentifierPart(ch) {
|
|
34427
|
-
return Jsep.isIdentifierStart(ch) || Jsep.isDecimalDigit(ch);
|
|
34428
|
-
}
|
|
34429
|
-
throwError(message) {
|
|
34430
|
-
const error = new Error(message + " at character " + this.index);
|
|
34431
|
-
error.index = this.index;
|
|
34432
|
-
error.description = message;
|
|
34433
|
-
throw error;
|
|
34434
|
-
}
|
|
34435
|
-
runHook(name, node) {
|
|
34436
|
-
if (Jsep.hooks[name]) {
|
|
34437
|
-
const env = {
|
|
34438
|
-
context: this,
|
|
34439
|
-
node
|
|
34440
|
-
};
|
|
34441
|
-
Jsep.hooks.run(name, env);
|
|
34442
|
-
return env.node;
|
|
34443
|
-
}
|
|
34444
|
-
return node;
|
|
34490
|
+
// ../common/src/polling/poll-until.ts
|
|
34491
|
+
function resolveIntervalFn(options) {
|
|
34492
|
+
if (typeof options.intervalMs === "function") {
|
|
34493
|
+
return options.intervalMs;
|
|
34445
34494
|
}
|
|
34446
|
-
|
|
34447
|
-
|
|
34448
|
-
|
|
34449
|
-
|
|
34450
|
-
|
|
34451
|
-
|
|
34452
|
-
|
|
34453
|
-
|
|
34454
|
-
|
|
34455
|
-
|
|
34495
|
+
const staticInterval = options.intervalMs ?? POLL_DEFAULTS.intervalMs;
|
|
34496
|
+
return () => staticInterval;
|
|
34497
|
+
}
|
|
34498
|
+
function resolveBackoffFn(options) {
|
|
34499
|
+
if (!options.backoff)
|
|
34500
|
+
return;
|
|
34501
|
+
const config = options.backoff === true ? { ...BACKOFF_DEFAULTS } : {
|
|
34502
|
+
initialMs: options.backoff.initialMs ?? BACKOFF_DEFAULTS.initialMs,
|
|
34503
|
+
multiplier: options.backoff.multiplier ?? BACKOFF_DEFAULTS.multiplier,
|
|
34504
|
+
maxMs: options.backoff.maxMs ?? BACKOFF_DEFAULTS.maxMs,
|
|
34505
|
+
jitter: Math.min(1, Math.max(0, options.backoff.jitter ?? BACKOFF_DEFAULTS.jitter))
|
|
34506
|
+
};
|
|
34507
|
+
return (errorCount) => {
|
|
34508
|
+
const exponent = Math.min(errorCount - 1, 30);
|
|
34509
|
+
const raw = Math.min(config.initialMs * config.multiplier ** exponent, config.maxMs);
|
|
34510
|
+
if (config.jitter > 0) {
|
|
34511
|
+
const jitterAmount = raw * config.jitter;
|
|
34512
|
+
return raw - jitterAmount * Math.random();
|
|
34456
34513
|
}
|
|
34457
|
-
|
|
34458
|
-
|
|
34459
|
-
|
|
34460
|
-
|
|
34461
|
-
|
|
34514
|
+
return raw;
|
|
34515
|
+
};
|
|
34516
|
+
}
|
|
34517
|
+
function clampInterval(raw, label, prefix) {
|
|
34518
|
+
if (!Number.isFinite(raw) || Number.isNaN(raw)) {
|
|
34519
|
+
if (label) {
|
|
34520
|
+
logger.warn(`[${prefix}] ${label} — intervalMs returned ${raw}, falling back to ${POLL_DEFAULTS.intervalMs}ms`);
|
|
34462
34521
|
}
|
|
34463
|
-
|
|
34464
|
-
}
|
|
34465
|
-
parse() {
|
|
34466
|
-
this.runHook("before-all");
|
|
34467
|
-
const nodes = this.gobbleExpressions();
|
|
34468
|
-
const node = nodes.length === 1 ? nodes[0] : {
|
|
34469
|
-
type: Jsep.COMPOUND,
|
|
34470
|
-
body: nodes
|
|
34471
|
-
};
|
|
34472
|
-
return this.runHook("after-all", node);
|
|
34522
|
+
return POLL_DEFAULTS.intervalMs;
|
|
34473
34523
|
}
|
|
34474
|
-
|
|
34475
|
-
|
|
34476
|
-
|
|
34477
|
-
ch_i = this.code;
|
|
34478
|
-
if (ch_i === Jsep.SEMCOL_CODE || ch_i === Jsep.COMMA_CODE) {
|
|
34479
|
-
this.index++;
|
|
34480
|
-
} else {
|
|
34481
|
-
if (node = this.gobbleExpression()) {
|
|
34482
|
-
nodes.push(node);
|
|
34483
|
-
} else if (this.index < this.expr.length) {
|
|
34484
|
-
if (ch_i === untilICode) {
|
|
34485
|
-
break;
|
|
34486
|
-
}
|
|
34487
|
-
this.throwError('Unexpected "' + this.char + '"');
|
|
34488
|
-
}
|
|
34489
|
-
}
|
|
34524
|
+
if (raw < MIN_INTERVAL_MS) {
|
|
34525
|
+
if (label) {
|
|
34526
|
+
logger.warn(`[${prefix}] ${label} — intervalMs ${raw}ms clamped to minimum ${MIN_INTERVAL_MS}ms`);
|
|
34490
34527
|
}
|
|
34491
|
-
return
|
|
34528
|
+
return MIN_INTERVAL_MS;
|
|
34492
34529
|
}
|
|
34493
|
-
|
|
34494
|
-
|
|
34495
|
-
|
|
34496
|
-
|
|
34530
|
+
return raw;
|
|
34531
|
+
}
|
|
34532
|
+
function abortError(signal) {
|
|
34533
|
+
const reason = signal.reason;
|
|
34534
|
+
if (reason instanceof Error && reason.name === "AbortError") {
|
|
34535
|
+
return reason;
|
|
34497
34536
|
}
|
|
34498
|
-
|
|
34499
|
-
|
|
34500
|
-
|
|
34501
|
-
|
|
34502
|
-
|
|
34503
|
-
|
|
34504
|
-
|
|
34505
|
-
|
|
34506
|
-
|
|
34507
|
-
|
|
34537
|
+
const msg = reason instanceof Error ? reason.message : typeof reason === "string" || typeof reason === "number" ? String(reason) : "Aborted";
|
|
34538
|
+
const err = new Error(msg);
|
|
34539
|
+
err.name = "AbortError";
|
|
34540
|
+
return err;
|
|
34541
|
+
}
|
|
34542
|
+
function interruptibleSleep(ms, signal) {
|
|
34543
|
+
return new Promise((resolve2, reject) => {
|
|
34544
|
+
if (signal?.aborted) {
|
|
34545
|
+
reject(abortError(signal));
|
|
34546
|
+
return;
|
|
34508
34547
|
}
|
|
34509
|
-
|
|
34510
|
-
|
|
34511
|
-
|
|
34512
|
-
|
|
34513
|
-
left = this.gobbleToken();
|
|
34514
|
-
if (!left) {
|
|
34515
|
-
return left;
|
|
34516
|
-
}
|
|
34517
|
-
biop = this.gobbleBinaryOp();
|
|
34518
|
-
if (!biop) {
|
|
34519
|
-
return left;
|
|
34520
|
-
}
|
|
34521
|
-
biop_info = {
|
|
34522
|
-
value: biop,
|
|
34523
|
-
prec: Jsep.binaryPrecedence(biop),
|
|
34524
|
-
right_a: Jsep.right_associative.has(biop)
|
|
34525
|
-
};
|
|
34526
|
-
right = this.gobbleToken();
|
|
34527
|
-
if (!right) {
|
|
34528
|
-
this.throwError("Expected expression after " + biop);
|
|
34529
|
-
}
|
|
34530
|
-
stack = [left, biop_info, right];
|
|
34531
|
-
while (biop = this.gobbleBinaryOp()) {
|
|
34532
|
-
prec = Jsep.binaryPrecedence(biop);
|
|
34533
|
-
if (prec === 0) {
|
|
34534
|
-
this.index -= biop.length;
|
|
34535
|
-
break;
|
|
34536
|
-
}
|
|
34537
|
-
biop_info = {
|
|
34538
|
-
value: biop,
|
|
34539
|
-
prec,
|
|
34540
|
-
right_a: Jsep.right_associative.has(biop)
|
|
34541
|
-
};
|
|
34542
|
-
cur_biop = biop;
|
|
34543
|
-
const comparePrev = (prev) => biop_info.right_a && prev.right_a ? prec > prev.prec : prec <= prev.prec;
|
|
34544
|
-
while (stack.length > 2 && comparePrev(stack[stack.length - 2])) {
|
|
34545
|
-
right = stack.pop();
|
|
34546
|
-
biop = stack.pop().value;
|
|
34547
|
-
left = stack.pop();
|
|
34548
|
-
node = {
|
|
34549
|
-
type: Jsep.BINARY_EXP,
|
|
34550
|
-
operator: biop,
|
|
34551
|
-
left,
|
|
34552
|
-
right
|
|
34553
|
-
};
|
|
34554
|
-
stack.push(node);
|
|
34555
|
-
}
|
|
34556
|
-
node = this.gobbleToken();
|
|
34557
|
-
if (!node) {
|
|
34558
|
-
this.throwError("Expected expression after " + cur_biop);
|
|
34559
|
-
}
|
|
34560
|
-
stack.push(biop_info, node);
|
|
34561
|
-
}
|
|
34562
|
-
i = stack.length - 1;
|
|
34563
|
-
node = stack[i];
|
|
34564
|
-
while (i > 1) {
|
|
34565
|
-
node = {
|
|
34566
|
-
type: Jsep.BINARY_EXP,
|
|
34567
|
-
operator: stack[i - 1].value,
|
|
34568
|
-
left: stack[i - 2],
|
|
34569
|
-
right: node
|
|
34570
|
-
};
|
|
34571
|
-
i -= 2;
|
|
34572
|
-
}
|
|
34573
|
-
return node;
|
|
34574
|
-
}
|
|
34575
|
-
gobbleToken() {
|
|
34576
|
-
let ch, to_check, tc_len, node;
|
|
34577
|
-
this.gobbleSpaces();
|
|
34578
|
-
node = this.searchHook("gobble-token");
|
|
34579
|
-
if (node) {
|
|
34580
|
-
return this.runHook("after-token", node);
|
|
34581
|
-
}
|
|
34582
|
-
ch = this.code;
|
|
34583
|
-
if (Jsep.isDecimalDigit(ch) || ch === Jsep.PERIOD_CODE) {
|
|
34584
|
-
return this.gobbleNumericLiteral();
|
|
34585
|
-
}
|
|
34586
|
-
if (ch === Jsep.SQUOTE_CODE || ch === Jsep.DQUOTE_CODE) {
|
|
34587
|
-
node = this.gobbleStringLiteral();
|
|
34588
|
-
} else if (ch === Jsep.OBRACK_CODE) {
|
|
34589
|
-
node = this.gobbleArray();
|
|
34590
|
-
} else {
|
|
34591
|
-
to_check = this.expr.substr(this.index, Jsep.max_unop_len);
|
|
34592
|
-
tc_len = to_check.length;
|
|
34593
|
-
while (tc_len > 0) {
|
|
34594
|
-
if (Jsep.unary_ops.hasOwnProperty(to_check) && (!Jsep.isIdentifierStart(this.code) || this.index + to_check.length < this.expr.length && !Jsep.isIdentifierPart(this.expr.charCodeAt(this.index + to_check.length)))) {
|
|
34595
|
-
this.index += tc_len;
|
|
34596
|
-
const argument = this.gobbleToken();
|
|
34597
|
-
if (!argument) {
|
|
34598
|
-
this.throwError("missing unaryOp argument");
|
|
34599
|
-
}
|
|
34600
|
-
return this.runHook("after-token", {
|
|
34601
|
-
type: Jsep.UNARY_EXP,
|
|
34602
|
-
operator: to_check,
|
|
34603
|
-
argument,
|
|
34604
|
-
prefix: true
|
|
34605
|
-
});
|
|
34606
|
-
}
|
|
34607
|
-
to_check = to_check.substr(0, --tc_len);
|
|
34608
|
-
}
|
|
34609
|
-
if (Jsep.isIdentifierStart(ch)) {
|
|
34610
|
-
node = this.gobbleIdentifier();
|
|
34611
|
-
if (Jsep.literals.hasOwnProperty(node.name)) {
|
|
34612
|
-
node = {
|
|
34613
|
-
type: Jsep.LITERAL,
|
|
34614
|
-
value: Jsep.literals[node.name],
|
|
34615
|
-
raw: node.name
|
|
34616
|
-
};
|
|
34617
|
-
} else if (node.name === Jsep.this_str) {
|
|
34618
|
-
node = {
|
|
34619
|
-
type: Jsep.THIS_EXP
|
|
34620
|
-
};
|
|
34621
|
-
}
|
|
34622
|
-
} else if (ch === Jsep.OPAREN_CODE) {
|
|
34623
|
-
node = this.gobbleGroup();
|
|
34548
|
+
let onAbort;
|
|
34549
|
+
const cleanup = () => {
|
|
34550
|
+
if (onAbort) {
|
|
34551
|
+
signal?.removeEventListener("abort", onAbort);
|
|
34624
34552
|
}
|
|
34625
|
-
}
|
|
34626
|
-
|
|
34627
|
-
|
|
34628
|
-
|
|
34629
|
-
|
|
34630
|
-
|
|
34631
|
-
|
|
34632
|
-
|
|
34633
|
-
|
|
34634
|
-
|
|
34635
|
-
|
|
34636
|
-
|
|
34637
|
-
if (ch === Jsep.QUMARK_CODE) {
|
|
34638
|
-
if (this.expr.charCodeAt(this.index + 1) !== Jsep.PERIOD_CODE) {
|
|
34639
|
-
break;
|
|
34640
|
-
}
|
|
34641
|
-
optional = true;
|
|
34642
|
-
this.index += 2;
|
|
34643
|
-
this.gobbleSpaces();
|
|
34644
|
-
ch = this.code;
|
|
34645
|
-
}
|
|
34646
|
-
this.index++;
|
|
34647
|
-
if (ch === Jsep.OBRACK_CODE) {
|
|
34648
|
-
node = {
|
|
34649
|
-
type: Jsep.MEMBER_EXP,
|
|
34650
|
-
computed: true,
|
|
34651
|
-
object: node,
|
|
34652
|
-
property: this.gobbleExpression()
|
|
34653
|
-
};
|
|
34654
|
-
if (!node.property) {
|
|
34655
|
-
this.throwError('Unexpected "' + this.char + '"');
|
|
34656
|
-
}
|
|
34657
|
-
this.gobbleSpaces();
|
|
34658
|
-
ch = this.code;
|
|
34659
|
-
if (ch !== Jsep.CBRACK_CODE) {
|
|
34660
|
-
this.throwError("Unclosed [");
|
|
34661
|
-
}
|
|
34662
|
-
this.index++;
|
|
34663
|
-
} else if (ch === Jsep.OPAREN_CODE) {
|
|
34664
|
-
node = {
|
|
34665
|
-
type: Jsep.CALL_EXP,
|
|
34666
|
-
arguments: this.gobbleArguments(Jsep.CPAREN_CODE),
|
|
34667
|
-
callee: node
|
|
34668
|
-
};
|
|
34669
|
-
} else if (ch === Jsep.PERIOD_CODE || optional) {
|
|
34670
|
-
if (optional) {
|
|
34671
|
-
this.index--;
|
|
34672
|
-
}
|
|
34673
|
-
this.gobbleSpaces();
|
|
34674
|
-
node = {
|
|
34675
|
-
type: Jsep.MEMBER_EXP,
|
|
34676
|
-
computed: false,
|
|
34677
|
-
object: node,
|
|
34678
|
-
property: this.gobbleIdentifier()
|
|
34679
|
-
};
|
|
34680
|
-
}
|
|
34681
|
-
if (optional) {
|
|
34682
|
-
node.optional = true;
|
|
34683
|
-
}
|
|
34684
|
-
this.gobbleSpaces();
|
|
34685
|
-
ch = this.code;
|
|
34686
|
-
}
|
|
34687
|
-
return node;
|
|
34688
|
-
}
|
|
34689
|
-
gobbleNumericLiteral() {
|
|
34690
|
-
let number = "", ch, chCode;
|
|
34691
|
-
while (Jsep.isDecimalDigit(this.code)) {
|
|
34692
|
-
number += this.expr.charAt(this.index++);
|
|
34693
|
-
}
|
|
34694
|
-
if (this.code === Jsep.PERIOD_CODE) {
|
|
34695
|
-
number += this.expr.charAt(this.index++);
|
|
34696
|
-
while (Jsep.isDecimalDigit(this.code)) {
|
|
34697
|
-
number += this.expr.charAt(this.index++);
|
|
34698
|
-
}
|
|
34699
|
-
}
|
|
34700
|
-
ch = this.char;
|
|
34701
|
-
if (ch === "e" || ch === "E") {
|
|
34702
|
-
number += this.expr.charAt(this.index++);
|
|
34703
|
-
ch = this.char;
|
|
34704
|
-
if (ch === "+" || ch === "-") {
|
|
34705
|
-
number += this.expr.charAt(this.index++);
|
|
34706
|
-
}
|
|
34707
|
-
while (Jsep.isDecimalDigit(this.code)) {
|
|
34708
|
-
number += this.expr.charAt(this.index++);
|
|
34709
|
-
}
|
|
34710
|
-
if (!Jsep.isDecimalDigit(this.expr.charCodeAt(this.index - 1))) {
|
|
34711
|
-
this.throwError("Expected exponent (" + number + this.char + ")");
|
|
34712
|
-
}
|
|
34713
|
-
}
|
|
34714
|
-
chCode = this.code;
|
|
34715
|
-
if (Jsep.isIdentifierStart(chCode)) {
|
|
34716
|
-
this.throwError("Variable names cannot start with a number (" + number + this.char + ")");
|
|
34717
|
-
} else if (chCode === Jsep.PERIOD_CODE || number.length === 1 && number.charCodeAt(0) === Jsep.PERIOD_CODE) {
|
|
34718
|
-
this.throwError("Unexpected period");
|
|
34719
|
-
}
|
|
34720
|
-
return {
|
|
34721
|
-
type: Jsep.LITERAL,
|
|
34722
|
-
value: parseFloat(number),
|
|
34723
|
-
raw: number
|
|
34724
|
-
};
|
|
34725
|
-
}
|
|
34726
|
-
gobbleStringLiteral() {
|
|
34727
|
-
let str = "";
|
|
34728
|
-
const startIndex = this.index;
|
|
34729
|
-
const quote = this.expr.charAt(this.index++);
|
|
34730
|
-
let closed = false;
|
|
34731
|
-
while (this.index < this.expr.length) {
|
|
34732
|
-
let ch = this.expr.charAt(this.index++);
|
|
34733
|
-
if (ch === quote) {
|
|
34734
|
-
closed = true;
|
|
34735
|
-
break;
|
|
34736
|
-
} else if (ch === "\\") {
|
|
34737
|
-
ch = this.expr.charAt(this.index++);
|
|
34738
|
-
switch (ch) {
|
|
34739
|
-
case "n":
|
|
34740
|
-
str += `
|
|
34741
|
-
`;
|
|
34742
|
-
break;
|
|
34743
|
-
case "r":
|
|
34744
|
-
str += "\r";
|
|
34745
|
-
break;
|
|
34746
|
-
case "t":
|
|
34747
|
-
str += "\t";
|
|
34748
|
-
break;
|
|
34749
|
-
case "b":
|
|
34750
|
-
str += "\b";
|
|
34751
|
-
break;
|
|
34752
|
-
case "f":
|
|
34753
|
-
str += "\f";
|
|
34754
|
-
break;
|
|
34755
|
-
case "v":
|
|
34756
|
-
str += "\v";
|
|
34757
|
-
break;
|
|
34758
|
-
default:
|
|
34759
|
-
str += ch;
|
|
34760
|
-
}
|
|
34761
|
-
} else {
|
|
34762
|
-
str += ch;
|
|
34763
|
-
}
|
|
34764
|
-
}
|
|
34765
|
-
if (!closed) {
|
|
34766
|
-
this.throwError('Unclosed quote after "' + str + '"');
|
|
34767
|
-
}
|
|
34768
|
-
return {
|
|
34769
|
-
type: Jsep.LITERAL,
|
|
34770
|
-
value: str,
|
|
34771
|
-
raw: this.expr.substring(startIndex, this.index)
|
|
34772
|
-
};
|
|
34773
|
-
}
|
|
34774
|
-
gobbleIdentifier() {
|
|
34775
|
-
let ch = this.code, start = this.index;
|
|
34776
|
-
if (Jsep.isIdentifierStart(ch)) {
|
|
34777
|
-
this.index++;
|
|
34778
|
-
} else {
|
|
34779
|
-
this.throwError("Unexpected " + this.char);
|
|
34780
|
-
}
|
|
34781
|
-
while (this.index < this.expr.length) {
|
|
34782
|
-
ch = this.code;
|
|
34783
|
-
if (Jsep.isIdentifierPart(ch)) {
|
|
34784
|
-
this.index++;
|
|
34785
|
-
} else {
|
|
34786
|
-
break;
|
|
34787
|
-
}
|
|
34788
|
-
}
|
|
34789
|
-
return {
|
|
34790
|
-
type: Jsep.IDENTIFIER,
|
|
34791
|
-
name: this.expr.slice(start, this.index)
|
|
34792
|
-
};
|
|
34793
|
-
}
|
|
34794
|
-
gobbleArguments(termination) {
|
|
34795
|
-
const args = [];
|
|
34796
|
-
let closed = false;
|
|
34797
|
-
let separator_count = 0;
|
|
34798
|
-
while (this.index < this.expr.length) {
|
|
34799
|
-
this.gobbleSpaces();
|
|
34800
|
-
let ch_i = this.code;
|
|
34801
|
-
if (ch_i === termination) {
|
|
34802
|
-
closed = true;
|
|
34803
|
-
this.index++;
|
|
34804
|
-
if (termination === Jsep.CPAREN_CODE && separator_count && separator_count >= args.length) {
|
|
34805
|
-
this.throwError("Unexpected token " + String.fromCharCode(termination));
|
|
34806
|
-
}
|
|
34807
|
-
break;
|
|
34808
|
-
} else if (ch_i === Jsep.COMMA_CODE) {
|
|
34809
|
-
this.index++;
|
|
34810
|
-
separator_count++;
|
|
34811
|
-
if (separator_count !== args.length) {
|
|
34812
|
-
if (termination === Jsep.CPAREN_CODE) {
|
|
34813
|
-
this.throwError("Unexpected token ,");
|
|
34814
|
-
} else if (termination === Jsep.CBRACK_CODE) {
|
|
34815
|
-
for (let arg = args.length;arg < separator_count; arg++) {
|
|
34816
|
-
args.push(null);
|
|
34817
|
-
}
|
|
34818
|
-
}
|
|
34819
|
-
}
|
|
34820
|
-
} else if (args.length !== separator_count && separator_count !== 0) {
|
|
34821
|
-
this.throwError("Expected comma");
|
|
34822
|
-
} else {
|
|
34823
|
-
const node = this.gobbleExpression();
|
|
34824
|
-
if (!node || node.type === Jsep.COMPOUND) {
|
|
34825
|
-
this.throwError("Expected comma");
|
|
34826
|
-
}
|
|
34827
|
-
args.push(node);
|
|
34828
|
-
}
|
|
34829
|
-
}
|
|
34830
|
-
if (!closed) {
|
|
34831
|
-
this.throwError("Expected " + String.fromCharCode(termination));
|
|
34832
|
-
}
|
|
34833
|
-
return args;
|
|
34834
|
-
}
|
|
34835
|
-
gobbleGroup() {
|
|
34836
|
-
this.index++;
|
|
34837
|
-
let nodes = this.gobbleExpressions(Jsep.CPAREN_CODE);
|
|
34838
|
-
if (this.code === Jsep.CPAREN_CODE) {
|
|
34839
|
-
this.index++;
|
|
34840
|
-
if (nodes.length === 1) {
|
|
34841
|
-
return nodes[0];
|
|
34842
|
-
} else if (!nodes.length) {
|
|
34843
|
-
return false;
|
|
34844
|
-
} else {
|
|
34845
|
-
return {
|
|
34846
|
-
type: Jsep.SEQUENCE_EXP,
|
|
34847
|
-
expressions: nodes
|
|
34848
|
-
};
|
|
34849
|
-
}
|
|
34850
|
-
} else {
|
|
34851
|
-
this.throwError("Unclosed (");
|
|
34852
|
-
}
|
|
34853
|
-
}
|
|
34854
|
-
gobbleArray() {
|
|
34855
|
-
this.index++;
|
|
34856
|
-
return {
|
|
34857
|
-
type: Jsep.ARRAY_EXP,
|
|
34858
|
-
elements: this.gobbleArguments(Jsep.CBRACK_CODE)
|
|
34859
|
-
};
|
|
34860
|
-
}
|
|
34861
|
-
}
|
|
34862
|
-
var hooks = new Hooks;
|
|
34863
|
-
Object.assign(Jsep, {
|
|
34864
|
-
hooks,
|
|
34865
|
-
plugins: new Plugins(Jsep),
|
|
34866
|
-
COMPOUND: "Compound",
|
|
34867
|
-
SEQUENCE_EXP: "SequenceExpression",
|
|
34868
|
-
IDENTIFIER: "Identifier",
|
|
34869
|
-
MEMBER_EXP: "MemberExpression",
|
|
34870
|
-
LITERAL: "Literal",
|
|
34871
|
-
THIS_EXP: "ThisExpression",
|
|
34872
|
-
CALL_EXP: "CallExpression",
|
|
34873
|
-
UNARY_EXP: "UnaryExpression",
|
|
34874
|
-
BINARY_EXP: "BinaryExpression",
|
|
34875
|
-
ARRAY_EXP: "ArrayExpression",
|
|
34876
|
-
TAB_CODE: 9,
|
|
34877
|
-
LF_CODE: 10,
|
|
34878
|
-
CR_CODE: 13,
|
|
34879
|
-
SPACE_CODE: 32,
|
|
34880
|
-
PERIOD_CODE: 46,
|
|
34881
|
-
COMMA_CODE: 44,
|
|
34882
|
-
SQUOTE_CODE: 39,
|
|
34883
|
-
DQUOTE_CODE: 34,
|
|
34884
|
-
OPAREN_CODE: 40,
|
|
34885
|
-
CPAREN_CODE: 41,
|
|
34886
|
-
OBRACK_CODE: 91,
|
|
34887
|
-
CBRACK_CODE: 93,
|
|
34888
|
-
QUMARK_CODE: 63,
|
|
34889
|
-
SEMCOL_CODE: 59,
|
|
34890
|
-
COLON_CODE: 58,
|
|
34891
|
-
unary_ops: {
|
|
34892
|
-
"-": 1,
|
|
34893
|
-
"!": 1,
|
|
34894
|
-
"~": 1,
|
|
34895
|
-
"+": 1
|
|
34896
|
-
},
|
|
34897
|
-
binary_ops: {
|
|
34898
|
-
"||": 1,
|
|
34899
|
-
"??": 1,
|
|
34900
|
-
"&&": 2,
|
|
34901
|
-
"|": 3,
|
|
34902
|
-
"^": 4,
|
|
34903
|
-
"&": 5,
|
|
34904
|
-
"==": 6,
|
|
34905
|
-
"!=": 6,
|
|
34906
|
-
"===": 6,
|
|
34907
|
-
"!==": 6,
|
|
34908
|
-
"<": 7,
|
|
34909
|
-
">": 7,
|
|
34910
|
-
"<=": 7,
|
|
34911
|
-
">=": 7,
|
|
34912
|
-
"<<": 8,
|
|
34913
|
-
">>": 8,
|
|
34914
|
-
">>>": 8,
|
|
34915
|
-
"+": 9,
|
|
34916
|
-
"-": 9,
|
|
34917
|
-
"*": 10,
|
|
34918
|
-
"/": 10,
|
|
34919
|
-
"%": 10,
|
|
34920
|
-
"**": 11
|
|
34921
|
-
},
|
|
34922
|
-
right_associative: new Set(["**"]),
|
|
34923
|
-
additional_identifier_chars: new Set(["$", "_"]),
|
|
34924
|
-
literals: {
|
|
34925
|
-
true: true,
|
|
34926
|
-
false: false,
|
|
34927
|
-
null: null
|
|
34928
|
-
},
|
|
34929
|
-
this_str: "this"
|
|
34930
|
-
});
|
|
34931
|
-
Jsep.max_unop_len = Jsep.getMaxKeyLen(Jsep.unary_ops);
|
|
34932
|
-
Jsep.max_binop_len = Jsep.getMaxKeyLen(Jsep.binary_ops);
|
|
34933
|
-
var jsep = (expr) => new Jsep(expr).parse();
|
|
34934
|
-
var stdClassProps = Object.getOwnPropertyNames(class Test {
|
|
34935
|
-
});
|
|
34936
|
-
Object.getOwnPropertyNames(Jsep).filter((prop) => !stdClassProps.includes(prop) && jsep[prop] === undefined).forEach((m) => {
|
|
34937
|
-
jsep[m] = Jsep[m];
|
|
34938
|
-
});
|
|
34939
|
-
jsep.Jsep = Jsep;
|
|
34940
|
-
var CONDITIONAL_EXP = "ConditionalExpression";
|
|
34941
|
-
var ternary = {
|
|
34942
|
-
name: "ternary",
|
|
34943
|
-
init(jsep2) {
|
|
34944
|
-
jsep2.hooks.add("after-expression", function gobbleTernary(env) {
|
|
34945
|
-
if (env.node && this.code === jsep2.QUMARK_CODE) {
|
|
34946
|
-
this.index++;
|
|
34947
|
-
const test = env.node;
|
|
34948
|
-
const consequent = this.gobbleExpression();
|
|
34949
|
-
if (!consequent) {
|
|
34950
|
-
this.throwError("Expected expression");
|
|
34951
|
-
}
|
|
34952
|
-
this.gobbleSpaces();
|
|
34953
|
-
if (this.code === jsep2.COLON_CODE) {
|
|
34954
|
-
this.index++;
|
|
34955
|
-
const alternate = this.gobbleExpression();
|
|
34956
|
-
if (!alternate) {
|
|
34957
|
-
this.throwError("Expected expression");
|
|
34958
|
-
}
|
|
34959
|
-
env.node = {
|
|
34960
|
-
type: CONDITIONAL_EXP,
|
|
34961
|
-
test,
|
|
34962
|
-
consequent,
|
|
34963
|
-
alternate
|
|
34964
|
-
};
|
|
34965
|
-
if (test.operator && jsep2.binary_ops[test.operator] <= 0.9) {
|
|
34966
|
-
let newTest = test;
|
|
34967
|
-
while (newTest.right.operator && jsep2.binary_ops[newTest.right.operator] <= 0.9) {
|
|
34968
|
-
newTest = newTest.right;
|
|
34969
|
-
}
|
|
34970
|
-
env.node.test = newTest.right;
|
|
34971
|
-
newTest.right = env.node;
|
|
34972
|
-
env.node = test;
|
|
34973
|
-
}
|
|
34974
|
-
} else {
|
|
34975
|
-
this.throwError("Expected :");
|
|
34976
|
-
}
|
|
34977
|
-
}
|
|
34978
|
-
});
|
|
34979
|
-
}
|
|
34980
|
-
};
|
|
34981
|
-
jsep.plugins.register(ternary);
|
|
34982
|
-
var FSLASH_CODE = 47;
|
|
34983
|
-
var BSLASH_CODE = 92;
|
|
34984
|
-
var index = {
|
|
34985
|
-
name: "regex",
|
|
34986
|
-
init(jsep2) {
|
|
34987
|
-
jsep2.hooks.add("gobble-token", function gobbleRegexLiteral(env) {
|
|
34988
|
-
if (this.code === FSLASH_CODE) {
|
|
34989
|
-
const patternIndex = ++this.index;
|
|
34990
|
-
let inCharSet = false;
|
|
34991
|
-
while (this.index < this.expr.length) {
|
|
34992
|
-
if (this.code === FSLASH_CODE && !inCharSet) {
|
|
34993
|
-
const pattern = this.expr.slice(patternIndex, this.index);
|
|
34994
|
-
let flags = "";
|
|
34995
|
-
while (++this.index < this.expr.length) {
|
|
34996
|
-
const code = this.code;
|
|
34997
|
-
if (code >= 97 && code <= 122 || code >= 65 && code <= 90 || code >= 48 && code <= 57) {
|
|
34998
|
-
flags += this.char;
|
|
34999
|
-
} else {
|
|
35000
|
-
break;
|
|
35001
|
-
}
|
|
35002
|
-
}
|
|
35003
|
-
let value;
|
|
35004
|
-
try {
|
|
35005
|
-
value = new RegExp(pattern, flags);
|
|
35006
|
-
} catch (e) {
|
|
35007
|
-
this.throwError(e.message);
|
|
35008
|
-
}
|
|
35009
|
-
env.node = {
|
|
35010
|
-
type: jsep2.LITERAL,
|
|
35011
|
-
value,
|
|
35012
|
-
raw: this.expr.slice(patternIndex - 1, this.index)
|
|
35013
|
-
};
|
|
35014
|
-
env.node = this.gobbleTokenProperty(env.node);
|
|
35015
|
-
return env.node;
|
|
35016
|
-
}
|
|
35017
|
-
if (this.code === jsep2.OBRACK_CODE) {
|
|
35018
|
-
inCharSet = true;
|
|
35019
|
-
} else if (inCharSet && this.code === jsep2.CBRACK_CODE) {
|
|
35020
|
-
inCharSet = false;
|
|
35021
|
-
}
|
|
35022
|
-
this.index += this.code === BSLASH_CODE ? 2 : 1;
|
|
35023
|
-
}
|
|
35024
|
-
this.throwError("Unclosed Regex");
|
|
35025
|
-
}
|
|
35026
|
-
});
|
|
35027
|
-
}
|
|
35028
|
-
};
|
|
35029
|
-
var PLUS_CODE = 43;
|
|
35030
|
-
var MINUS_CODE = 45;
|
|
35031
|
-
var plugin = {
|
|
35032
|
-
name: "assignment",
|
|
35033
|
-
assignmentOperators: new Set(["=", "*=", "**=", "/=", "%=", "+=", "-=", "<<=", ">>=", ">>>=", "&=", "^=", "|=", "||=", "&&=", "??="]),
|
|
35034
|
-
updateOperators: [PLUS_CODE, MINUS_CODE],
|
|
35035
|
-
assignmentPrecedence: 0.9,
|
|
35036
|
-
init(jsep2) {
|
|
35037
|
-
const updateNodeTypes = [jsep2.IDENTIFIER, jsep2.MEMBER_EXP];
|
|
35038
|
-
plugin.assignmentOperators.forEach((op) => jsep2.addBinaryOp(op, plugin.assignmentPrecedence, true));
|
|
35039
|
-
jsep2.hooks.add("gobble-token", function gobbleUpdatePrefix(env) {
|
|
35040
|
-
const code = this.code;
|
|
35041
|
-
if (plugin.updateOperators.some((c) => c === code && c === this.expr.charCodeAt(this.index + 1))) {
|
|
35042
|
-
this.index += 2;
|
|
35043
|
-
env.node = {
|
|
35044
|
-
type: "UpdateExpression",
|
|
35045
|
-
operator: code === PLUS_CODE ? "++" : "--",
|
|
35046
|
-
argument: this.gobbleTokenProperty(this.gobbleIdentifier()),
|
|
35047
|
-
prefix: true
|
|
35048
|
-
};
|
|
35049
|
-
if (!env.node.argument || !updateNodeTypes.includes(env.node.argument.type)) {
|
|
35050
|
-
this.throwError(`Unexpected ${env.node.operator}`);
|
|
35051
|
-
}
|
|
35052
|
-
}
|
|
35053
|
-
});
|
|
35054
|
-
jsep2.hooks.add("after-token", function gobbleUpdatePostfix(env) {
|
|
35055
|
-
if (env.node) {
|
|
35056
|
-
const code = this.code;
|
|
35057
|
-
if (plugin.updateOperators.some((c) => c === code && c === this.expr.charCodeAt(this.index + 1))) {
|
|
35058
|
-
if (!updateNodeTypes.includes(env.node.type)) {
|
|
35059
|
-
this.throwError(`Unexpected ${env.node.operator}`);
|
|
35060
|
-
}
|
|
35061
|
-
this.index += 2;
|
|
35062
|
-
env.node = {
|
|
35063
|
-
type: "UpdateExpression",
|
|
35064
|
-
operator: code === PLUS_CODE ? "++" : "--",
|
|
35065
|
-
argument: env.node,
|
|
35066
|
-
prefix: false
|
|
35067
|
-
};
|
|
35068
|
-
}
|
|
35069
|
-
}
|
|
35070
|
-
});
|
|
35071
|
-
jsep2.hooks.add("after-expression", function gobbleAssignment(env) {
|
|
35072
|
-
if (env.node) {
|
|
35073
|
-
updateBinariesToAssignments(env.node);
|
|
35074
|
-
}
|
|
35075
|
-
});
|
|
35076
|
-
function updateBinariesToAssignments(node) {
|
|
35077
|
-
if (plugin.assignmentOperators.has(node.operator)) {
|
|
35078
|
-
node.type = "AssignmentExpression";
|
|
35079
|
-
updateBinariesToAssignments(node.left);
|
|
35080
|
-
updateBinariesToAssignments(node.right);
|
|
35081
|
-
} else if (!node.operator) {
|
|
35082
|
-
Object.values(node).forEach((val) => {
|
|
35083
|
-
if (val && typeof val === "object") {
|
|
35084
|
-
updateBinariesToAssignments(val);
|
|
35085
|
-
}
|
|
35086
|
-
});
|
|
35087
|
-
}
|
|
35088
|
-
}
|
|
35089
|
-
}
|
|
35090
|
-
};
|
|
35091
|
-
jsep.plugins.register(index, plugin);
|
|
35092
|
-
jsep.addUnaryOp("typeof");
|
|
35093
|
-
jsep.addUnaryOp("void");
|
|
35094
|
-
jsep.addLiteral("null", null);
|
|
35095
|
-
jsep.addLiteral("undefined", undefined);
|
|
35096
|
-
var BLOCKED_PROTO_PROPERTIES = new Set(["constructor", "__proto__", "__defineGetter__", "__defineSetter__", "__lookupGetter__", "__lookupSetter__"]);
|
|
35097
|
-
var SafeEval = {
|
|
35098
|
-
evalAst(ast, subs) {
|
|
35099
|
-
switch (ast.type) {
|
|
35100
|
-
case "BinaryExpression":
|
|
35101
|
-
case "LogicalExpression":
|
|
35102
|
-
return SafeEval.evalBinaryExpression(ast, subs);
|
|
35103
|
-
case "Compound":
|
|
35104
|
-
return SafeEval.evalCompound(ast, subs);
|
|
35105
|
-
case "ConditionalExpression":
|
|
35106
|
-
return SafeEval.evalConditionalExpression(ast, subs);
|
|
35107
|
-
case "Identifier":
|
|
35108
|
-
return SafeEval.evalIdentifier(ast, subs);
|
|
35109
|
-
case "Literal":
|
|
35110
|
-
return SafeEval.evalLiteral(ast, subs);
|
|
35111
|
-
case "MemberExpression":
|
|
35112
|
-
return SafeEval.evalMemberExpression(ast, subs);
|
|
35113
|
-
case "UnaryExpression":
|
|
35114
|
-
return SafeEval.evalUnaryExpression(ast, subs);
|
|
35115
|
-
case "ArrayExpression":
|
|
35116
|
-
return SafeEval.evalArrayExpression(ast, subs);
|
|
35117
|
-
case "CallExpression":
|
|
35118
|
-
return SafeEval.evalCallExpression(ast, subs);
|
|
35119
|
-
case "AssignmentExpression":
|
|
35120
|
-
return SafeEval.evalAssignmentExpression(ast, subs);
|
|
35121
|
-
default:
|
|
35122
|
-
throw SyntaxError("Unexpected expression", ast);
|
|
35123
|
-
}
|
|
35124
|
-
},
|
|
35125
|
-
evalBinaryExpression(ast, subs) {
|
|
35126
|
-
const result = {
|
|
35127
|
-
"||": (a, b) => a || b(),
|
|
35128
|
-
"&&": (a, b) => a && b(),
|
|
35129
|
-
"|": (a, b) => a | b(),
|
|
35130
|
-
"^": (a, b) => a ^ b(),
|
|
35131
|
-
"&": (a, b) => a & b(),
|
|
35132
|
-
"==": (a, b) => a == b(),
|
|
35133
|
-
"!=": (a, b) => a != b(),
|
|
35134
|
-
"===": (a, b) => a === b(),
|
|
35135
|
-
"!==": (a, b) => a !== b(),
|
|
35136
|
-
"<": (a, b) => a < b(),
|
|
35137
|
-
">": (a, b) => a > b(),
|
|
35138
|
-
"<=": (a, b) => a <= b(),
|
|
35139
|
-
">=": (a, b) => a >= b(),
|
|
35140
|
-
"<<": (a, b) => a << b(),
|
|
35141
|
-
">>": (a, b) => a >> b(),
|
|
35142
|
-
">>>": (a, b) => a >>> b(),
|
|
35143
|
-
"+": (a, b) => a + b(),
|
|
35144
|
-
"-": (a, b) => a - b(),
|
|
35145
|
-
"*": (a, b) => a * b(),
|
|
35146
|
-
"/": (a, b) => a / b(),
|
|
35147
|
-
"%": (a, b) => a % b()
|
|
35148
|
-
}[ast.operator](SafeEval.evalAst(ast.left, subs), () => SafeEval.evalAst(ast.right, subs));
|
|
35149
|
-
return result;
|
|
35150
|
-
},
|
|
35151
|
-
evalCompound(ast, subs) {
|
|
35152
|
-
let last;
|
|
35153
|
-
for (let i = 0;i < ast.body.length; i++) {
|
|
35154
|
-
if (ast.body[i].type === "Identifier" && ["var", "let", "const"].includes(ast.body[i].name) && ast.body[i + 1] && ast.body[i + 1].type === "AssignmentExpression") {
|
|
35155
|
-
i += 1;
|
|
35156
|
-
}
|
|
35157
|
-
const expr = ast.body[i];
|
|
35158
|
-
last = SafeEval.evalAst(expr, subs);
|
|
35159
|
-
}
|
|
35160
|
-
return last;
|
|
35161
|
-
},
|
|
35162
|
-
evalConditionalExpression(ast, subs) {
|
|
35163
|
-
if (SafeEval.evalAst(ast.test, subs)) {
|
|
35164
|
-
return SafeEval.evalAst(ast.consequent, subs);
|
|
35165
|
-
}
|
|
35166
|
-
return SafeEval.evalAst(ast.alternate, subs);
|
|
35167
|
-
},
|
|
35168
|
-
evalIdentifier(ast, subs) {
|
|
35169
|
-
if (Object.hasOwn(subs, ast.name)) {
|
|
35170
|
-
return subs[ast.name];
|
|
35171
|
-
}
|
|
35172
|
-
throw ReferenceError(`${ast.name} is not defined`);
|
|
35173
|
-
},
|
|
35174
|
-
evalLiteral(ast) {
|
|
35175
|
-
return ast.value;
|
|
35176
|
-
},
|
|
35177
|
-
evalMemberExpression(ast, subs) {
|
|
35178
|
-
const prop = String(ast.computed ? SafeEval.evalAst(ast.property) : ast.property.name);
|
|
35179
|
-
const obj = SafeEval.evalAst(ast.object, subs);
|
|
35180
|
-
if (obj === undefined || obj === null) {
|
|
35181
|
-
throw TypeError(`Cannot read properties of ${obj} (reading '${prop}')`);
|
|
35182
|
-
}
|
|
35183
|
-
if (!Object.hasOwn(obj, prop) && BLOCKED_PROTO_PROPERTIES.has(prop)) {
|
|
35184
|
-
throw TypeError(`Cannot read properties of ${obj} (reading '${prop}')`);
|
|
35185
|
-
}
|
|
35186
|
-
const result = obj[prop];
|
|
35187
|
-
if (typeof result === "function") {
|
|
35188
|
-
return result.bind(obj);
|
|
35189
|
-
}
|
|
35190
|
-
return result;
|
|
35191
|
-
},
|
|
35192
|
-
evalUnaryExpression(ast, subs) {
|
|
35193
|
-
const result = {
|
|
35194
|
-
"-": (a) => -SafeEval.evalAst(a, subs),
|
|
35195
|
-
"!": (a) => !SafeEval.evalAst(a, subs),
|
|
35196
|
-
"~": (a) => ~SafeEval.evalAst(a, subs),
|
|
35197
|
-
"+": (a) => +SafeEval.evalAst(a, subs),
|
|
35198
|
-
typeof: (a) => typeof SafeEval.evalAst(a, subs),
|
|
35199
|
-
void: (a) => void SafeEval.evalAst(a, subs)
|
|
35200
|
-
}[ast.operator](ast.argument);
|
|
35201
|
-
return result;
|
|
35202
|
-
},
|
|
35203
|
-
evalArrayExpression(ast, subs) {
|
|
35204
|
-
return ast.elements.map((el) => SafeEval.evalAst(el, subs));
|
|
35205
|
-
},
|
|
35206
|
-
evalCallExpression(ast, subs) {
|
|
35207
|
-
const args = ast.arguments.map((arg) => SafeEval.evalAst(arg, subs));
|
|
35208
|
-
const func = SafeEval.evalAst(ast.callee, subs);
|
|
35209
|
-
if (func === Function) {
|
|
35210
|
-
throw new Error("Function constructor is disabled");
|
|
35211
|
-
}
|
|
35212
|
-
return func(...args);
|
|
35213
|
-
},
|
|
35214
|
-
evalAssignmentExpression(ast, subs) {
|
|
35215
|
-
if (ast.left.type !== "Identifier") {
|
|
35216
|
-
throw SyntaxError("Invalid left-hand side in assignment");
|
|
35217
|
-
}
|
|
35218
|
-
const id = ast.left.name;
|
|
35219
|
-
const value = SafeEval.evalAst(ast.right, subs);
|
|
35220
|
-
subs[id] = value;
|
|
35221
|
-
return subs[id];
|
|
35222
|
-
}
|
|
35223
|
-
};
|
|
35224
|
-
|
|
35225
|
-
class SafeScript {
|
|
35226
|
-
constructor(expr) {
|
|
35227
|
-
this.code = expr;
|
|
35228
|
-
this.ast = jsep(this.code);
|
|
35229
|
-
}
|
|
35230
|
-
runInNewContext(context) {
|
|
35231
|
-
const keyMap = Object.assign(Object.create(null), context);
|
|
35232
|
-
return SafeEval.evalAst(this.ast, keyMap);
|
|
35233
|
-
}
|
|
35234
|
-
}
|
|
35235
|
-
function push(arr, item) {
|
|
35236
|
-
arr = arr.slice();
|
|
35237
|
-
arr.push(item);
|
|
35238
|
-
return arr;
|
|
35239
|
-
}
|
|
35240
|
-
function unshift(item, arr) {
|
|
35241
|
-
arr = arr.slice();
|
|
35242
|
-
arr.unshift(item);
|
|
35243
|
-
return arr;
|
|
35244
|
-
}
|
|
35245
|
-
|
|
35246
|
-
class NewError extends Error {
|
|
35247
|
-
constructor(value) {
|
|
35248
|
-
super('JSONPath should not be called with "new" (it prevents return ' + "of (unwrapped) scalar values)");
|
|
35249
|
-
this.avoidNew = true;
|
|
35250
|
-
this.value = value;
|
|
35251
|
-
this.name = "NewError";
|
|
35252
|
-
}
|
|
35253
|
-
}
|
|
35254
|
-
function JSONPath(opts, expr, obj, callback, otherTypeCallback) {
|
|
35255
|
-
if (!(this instanceof JSONPath)) {
|
|
35256
|
-
try {
|
|
35257
|
-
return new JSONPath(opts, expr, obj, callback, otherTypeCallback);
|
|
35258
|
-
} catch (e) {
|
|
35259
|
-
if (!e.avoidNew) {
|
|
35260
|
-
throw e;
|
|
35261
|
-
}
|
|
35262
|
-
return e.value;
|
|
35263
|
-
}
|
|
35264
|
-
}
|
|
35265
|
-
if (typeof opts === "string") {
|
|
35266
|
-
otherTypeCallback = callback;
|
|
35267
|
-
callback = obj;
|
|
35268
|
-
obj = expr;
|
|
35269
|
-
expr = opts;
|
|
35270
|
-
opts = null;
|
|
35271
|
-
}
|
|
35272
|
-
const optObj = opts && typeof opts === "object";
|
|
35273
|
-
opts = opts || {};
|
|
35274
|
-
this.json = opts.json || obj;
|
|
35275
|
-
this.path = opts.path || expr;
|
|
35276
|
-
this.resultType = opts.resultType || "value";
|
|
35277
|
-
this.flatten = opts.flatten || false;
|
|
35278
|
-
this.wrap = Object.hasOwn(opts, "wrap") ? opts.wrap : true;
|
|
35279
|
-
this.sandbox = opts.sandbox || {};
|
|
35280
|
-
this.eval = opts.eval === undefined ? "safe" : opts.eval;
|
|
35281
|
-
this.ignoreEvalErrors = typeof opts.ignoreEvalErrors === "undefined" ? false : opts.ignoreEvalErrors;
|
|
35282
|
-
this.parent = opts.parent || null;
|
|
35283
|
-
this.parentProperty = opts.parentProperty || null;
|
|
35284
|
-
this.callback = opts.callback || callback || null;
|
|
35285
|
-
this.otherTypeCallback = opts.otherTypeCallback || otherTypeCallback || function() {
|
|
35286
|
-
throw new TypeError("You must supply an otherTypeCallback callback option " + "with the @other() operator.");
|
|
35287
|
-
};
|
|
35288
|
-
if (opts.autostart !== false) {
|
|
35289
|
-
const args = {
|
|
35290
|
-
path: optObj ? opts.path : expr
|
|
35291
|
-
};
|
|
35292
|
-
if (!optObj) {
|
|
35293
|
-
args.json = obj;
|
|
35294
|
-
} else if ("json" in opts) {
|
|
35295
|
-
args.json = opts.json;
|
|
35296
|
-
}
|
|
35297
|
-
const ret = this.evaluate(args);
|
|
35298
|
-
if (!ret || typeof ret !== "object") {
|
|
35299
|
-
throw new NewError(ret);
|
|
35300
|
-
}
|
|
35301
|
-
return ret;
|
|
35302
|
-
}
|
|
35303
|
-
}
|
|
35304
|
-
JSONPath.prototype.evaluate = function(expr, json, callback, otherTypeCallback) {
|
|
35305
|
-
let currParent = this.parent, currParentProperty = this.parentProperty;
|
|
35306
|
-
let {
|
|
35307
|
-
flatten,
|
|
35308
|
-
wrap
|
|
35309
|
-
} = this;
|
|
35310
|
-
this.currResultType = this.resultType;
|
|
35311
|
-
this.currEval = this.eval;
|
|
35312
|
-
this.currSandbox = this.sandbox;
|
|
35313
|
-
callback = callback || this.callback;
|
|
35314
|
-
this.currOtherTypeCallback = otherTypeCallback || this.otherTypeCallback;
|
|
35315
|
-
json = json || this.json;
|
|
35316
|
-
expr = expr || this.path;
|
|
35317
|
-
if (expr && typeof expr === "object" && !Array.isArray(expr)) {
|
|
35318
|
-
if (!expr.path && expr.path !== "") {
|
|
35319
|
-
throw new TypeError('You must supply a "path" property when providing an object ' + "argument to JSONPath.evaluate().");
|
|
35320
|
-
}
|
|
35321
|
-
if (!Object.hasOwn(expr, "json")) {
|
|
35322
|
-
throw new TypeError('You must supply a "json" property when providing an object ' + "argument to JSONPath.evaluate().");
|
|
35323
|
-
}
|
|
35324
|
-
({
|
|
35325
|
-
json
|
|
35326
|
-
} = expr);
|
|
35327
|
-
flatten = Object.hasOwn(expr, "flatten") ? expr.flatten : flatten;
|
|
35328
|
-
this.currResultType = Object.hasOwn(expr, "resultType") ? expr.resultType : this.currResultType;
|
|
35329
|
-
this.currSandbox = Object.hasOwn(expr, "sandbox") ? expr.sandbox : this.currSandbox;
|
|
35330
|
-
wrap = Object.hasOwn(expr, "wrap") ? expr.wrap : wrap;
|
|
35331
|
-
this.currEval = Object.hasOwn(expr, "eval") ? expr.eval : this.currEval;
|
|
35332
|
-
callback = Object.hasOwn(expr, "callback") ? expr.callback : callback;
|
|
35333
|
-
this.currOtherTypeCallback = Object.hasOwn(expr, "otherTypeCallback") ? expr.otherTypeCallback : this.currOtherTypeCallback;
|
|
35334
|
-
currParent = Object.hasOwn(expr, "parent") ? expr.parent : currParent;
|
|
35335
|
-
currParentProperty = Object.hasOwn(expr, "parentProperty") ? expr.parentProperty : currParentProperty;
|
|
35336
|
-
expr = expr.path;
|
|
35337
|
-
}
|
|
35338
|
-
currParent = currParent || null;
|
|
35339
|
-
currParentProperty = currParentProperty || null;
|
|
35340
|
-
if (Array.isArray(expr)) {
|
|
35341
|
-
expr = JSONPath.toPathString(expr);
|
|
35342
|
-
}
|
|
35343
|
-
if (!expr && expr !== "" || !json) {
|
|
35344
|
-
return;
|
|
35345
|
-
}
|
|
35346
|
-
const exprList = JSONPath.toPathArray(expr);
|
|
35347
|
-
if (exprList[0] === "$" && exprList.length > 1) {
|
|
35348
|
-
exprList.shift();
|
|
35349
|
-
}
|
|
35350
|
-
this._hasParentSelector = null;
|
|
35351
|
-
const result = this._trace(exprList, json, ["$"], currParent, currParentProperty, callback).filter(function(ea) {
|
|
35352
|
-
return ea && !ea.isParentSelector;
|
|
35353
|
-
});
|
|
35354
|
-
if (!result.length) {
|
|
35355
|
-
return wrap ? [] : undefined;
|
|
35356
|
-
}
|
|
35357
|
-
if (!wrap && result.length === 1 && !result[0].hasArrExpr) {
|
|
35358
|
-
return this._getPreferredOutput(result[0]);
|
|
35359
|
-
}
|
|
35360
|
-
return result.reduce((rslt, ea) => {
|
|
35361
|
-
const valOrPath = this._getPreferredOutput(ea);
|
|
35362
|
-
if (flatten && Array.isArray(valOrPath)) {
|
|
35363
|
-
rslt = rslt.concat(valOrPath);
|
|
35364
|
-
} else {
|
|
35365
|
-
rslt.push(valOrPath);
|
|
35366
|
-
}
|
|
35367
|
-
return rslt;
|
|
35368
|
-
}, []);
|
|
35369
|
-
};
|
|
35370
|
-
JSONPath.prototype._getPreferredOutput = function(ea) {
|
|
35371
|
-
const resultType = this.currResultType;
|
|
35372
|
-
switch (resultType) {
|
|
35373
|
-
case "all": {
|
|
35374
|
-
const path3 = Array.isArray(ea.path) ? ea.path : JSONPath.toPathArray(ea.path);
|
|
35375
|
-
ea.pointer = JSONPath.toPointer(path3);
|
|
35376
|
-
ea.path = typeof ea.path === "string" ? ea.path : JSONPath.toPathString(ea.path);
|
|
35377
|
-
return ea;
|
|
35378
|
-
}
|
|
35379
|
-
case "value":
|
|
35380
|
-
case "parent":
|
|
35381
|
-
case "parentProperty":
|
|
35382
|
-
return ea[resultType];
|
|
35383
|
-
case "path":
|
|
35384
|
-
return JSONPath.toPathString(ea[resultType]);
|
|
35385
|
-
case "pointer":
|
|
35386
|
-
return JSONPath.toPointer(ea.path);
|
|
35387
|
-
default:
|
|
35388
|
-
throw new TypeError("Unknown result type");
|
|
35389
|
-
}
|
|
35390
|
-
};
|
|
35391
|
-
JSONPath.prototype._handleCallback = function(fullRetObj, callback, type) {
|
|
35392
|
-
if (callback) {
|
|
35393
|
-
const preferredOutput = this._getPreferredOutput(fullRetObj);
|
|
35394
|
-
fullRetObj.path = typeof fullRetObj.path === "string" ? fullRetObj.path : JSONPath.toPathString(fullRetObj.path);
|
|
35395
|
-
callback(preferredOutput, type, fullRetObj);
|
|
35396
|
-
}
|
|
35397
|
-
};
|
|
35398
|
-
JSONPath.prototype._trace = function(expr, val, path3, parent, parentPropName, callback, hasArrExpr, literalPriority) {
|
|
35399
|
-
let retObj;
|
|
35400
|
-
if (!expr.length) {
|
|
35401
|
-
retObj = {
|
|
35402
|
-
path: path3,
|
|
35403
|
-
value: val,
|
|
35404
|
-
parent,
|
|
35405
|
-
parentProperty: parentPropName,
|
|
35406
|
-
hasArrExpr
|
|
35407
|
-
};
|
|
35408
|
-
this._handleCallback(retObj, callback, "value");
|
|
35409
|
-
return retObj;
|
|
35410
|
-
}
|
|
35411
|
-
const loc = expr[0], x = expr.slice(1);
|
|
35412
|
-
const ret = [];
|
|
35413
|
-
function addRet(elems) {
|
|
35414
|
-
if (Array.isArray(elems)) {
|
|
35415
|
-
elems.forEach((t) => {
|
|
35416
|
-
ret.push(t);
|
|
35417
|
-
});
|
|
35418
|
-
} else {
|
|
35419
|
-
ret.push(elems);
|
|
35420
|
-
}
|
|
35421
|
-
}
|
|
35422
|
-
if ((typeof loc !== "string" || literalPriority) && val && Object.hasOwn(val, loc)) {
|
|
35423
|
-
addRet(this._trace(x, val[loc], push(path3, loc), val, loc, callback, hasArrExpr));
|
|
35424
|
-
} else if (loc === "*") {
|
|
35425
|
-
this._walk(val, (m) => {
|
|
35426
|
-
addRet(this._trace(x, val[m], push(path3, m), val, m, callback, true, true));
|
|
35427
|
-
});
|
|
35428
|
-
} else if (loc === "..") {
|
|
35429
|
-
addRet(this._trace(x, val, path3, parent, parentPropName, callback, hasArrExpr));
|
|
35430
|
-
this._walk(val, (m) => {
|
|
35431
|
-
if (typeof val[m] === "object") {
|
|
35432
|
-
addRet(this._trace(expr.slice(), val[m], push(path3, m), val, m, callback, true));
|
|
35433
|
-
}
|
|
35434
|
-
});
|
|
35435
|
-
} else if (loc === "^") {
|
|
35436
|
-
this._hasParentSelector = true;
|
|
35437
|
-
return {
|
|
35438
|
-
path: path3.slice(0, -1),
|
|
35439
|
-
expr: x,
|
|
35440
|
-
isParentSelector: true
|
|
35441
|
-
};
|
|
35442
|
-
} else if (loc === "~") {
|
|
35443
|
-
retObj = {
|
|
35444
|
-
path: push(path3, loc),
|
|
35445
|
-
value: parentPropName,
|
|
35446
|
-
parent,
|
|
35447
|
-
parentProperty: null
|
|
35448
|
-
};
|
|
35449
|
-
this._handleCallback(retObj, callback, "property");
|
|
35450
|
-
return retObj;
|
|
35451
|
-
} else if (loc === "$") {
|
|
35452
|
-
addRet(this._trace(x, val, path3, null, null, callback, hasArrExpr));
|
|
35453
|
-
} else if (/^(-?\d*):(-?\d*):?(\d*)$/u.test(loc)) {
|
|
35454
|
-
addRet(this._slice(loc, x, val, path3, parent, parentPropName, callback));
|
|
35455
|
-
} else if (loc.indexOf("?(") === 0) {
|
|
35456
|
-
if (this.currEval === false) {
|
|
35457
|
-
throw new Error("Eval [?(expr)] prevented in JSONPath expression.");
|
|
35458
|
-
}
|
|
35459
|
-
const safeLoc = loc.replace(/^\?\((.*?)\)$/u, "$1");
|
|
35460
|
-
const nested = /@.?([^?]*)[['](\??\(.*?\))(?!.\)\])[\]']/gu.exec(safeLoc);
|
|
35461
|
-
if (nested) {
|
|
35462
|
-
this._walk(val, (m) => {
|
|
35463
|
-
const npath = [nested[2]];
|
|
35464
|
-
const nvalue = nested[1] ? val[m][nested[1]] : val[m];
|
|
35465
|
-
const filterResults = this._trace(npath, nvalue, path3, parent, parentPropName, callback, true);
|
|
35466
|
-
if (filterResults.length > 0) {
|
|
35467
|
-
addRet(this._trace(x, val[m], push(path3, m), val, m, callback, true));
|
|
35468
|
-
}
|
|
35469
|
-
});
|
|
35470
|
-
} else {
|
|
35471
|
-
this._walk(val, (m) => {
|
|
35472
|
-
if (this._eval(safeLoc, val[m], m, path3, parent, parentPropName)) {
|
|
35473
|
-
addRet(this._trace(x, val[m], push(path3, m), val, m, callback, true));
|
|
35474
|
-
}
|
|
35475
|
-
});
|
|
35476
|
-
}
|
|
35477
|
-
} else if (loc[0] === "(") {
|
|
35478
|
-
if (this.currEval === false) {
|
|
35479
|
-
throw new Error("Eval [(expr)] prevented in JSONPath expression.");
|
|
35480
|
-
}
|
|
35481
|
-
addRet(this._trace(unshift(this._eval(loc, val, path3.at(-1), path3.slice(0, -1), parent, parentPropName), x), val, path3, parent, parentPropName, callback, hasArrExpr));
|
|
35482
|
-
} else if (loc[0] === "@") {
|
|
35483
|
-
let addType = false;
|
|
35484
|
-
const valueType = loc.slice(1, -2);
|
|
35485
|
-
switch (valueType) {
|
|
35486
|
-
case "scalar":
|
|
35487
|
-
if (!val || !["object", "function"].includes(typeof val)) {
|
|
35488
|
-
addType = true;
|
|
35489
|
-
}
|
|
35490
|
-
break;
|
|
35491
|
-
case "boolean":
|
|
35492
|
-
case "string":
|
|
35493
|
-
case "undefined":
|
|
35494
|
-
case "function":
|
|
35495
|
-
if (typeof val === valueType) {
|
|
35496
|
-
addType = true;
|
|
35497
|
-
}
|
|
35498
|
-
break;
|
|
35499
|
-
case "integer":
|
|
35500
|
-
if (Number.isFinite(val) && !(val % 1)) {
|
|
35501
|
-
addType = true;
|
|
35502
|
-
}
|
|
35503
|
-
break;
|
|
35504
|
-
case "number":
|
|
35505
|
-
if (Number.isFinite(val)) {
|
|
35506
|
-
addType = true;
|
|
35507
|
-
}
|
|
35508
|
-
break;
|
|
35509
|
-
case "nonFinite":
|
|
35510
|
-
if (typeof val === "number" && !Number.isFinite(val)) {
|
|
35511
|
-
addType = true;
|
|
35512
|
-
}
|
|
35513
|
-
break;
|
|
35514
|
-
case "object":
|
|
35515
|
-
if (val && typeof val === valueType) {
|
|
35516
|
-
addType = true;
|
|
35517
|
-
}
|
|
35518
|
-
break;
|
|
35519
|
-
case "array":
|
|
35520
|
-
if (Array.isArray(val)) {
|
|
35521
|
-
addType = true;
|
|
35522
|
-
}
|
|
35523
|
-
break;
|
|
35524
|
-
case "other":
|
|
35525
|
-
addType = this.currOtherTypeCallback(val, path3, parent, parentPropName);
|
|
35526
|
-
break;
|
|
35527
|
-
case "null":
|
|
35528
|
-
if (val === null) {
|
|
35529
|
-
addType = true;
|
|
35530
|
-
}
|
|
35531
|
-
break;
|
|
35532
|
-
default:
|
|
35533
|
-
throw new TypeError("Unknown value type " + valueType);
|
|
35534
|
-
}
|
|
35535
|
-
if (addType) {
|
|
35536
|
-
retObj = {
|
|
35537
|
-
path: path3,
|
|
35538
|
-
value: val,
|
|
35539
|
-
parent,
|
|
35540
|
-
parentProperty: parentPropName
|
|
35541
|
-
};
|
|
35542
|
-
this._handleCallback(retObj, callback, "value");
|
|
35543
|
-
return retObj;
|
|
35544
|
-
}
|
|
35545
|
-
} else if (loc[0] === "`" && val && Object.hasOwn(val, loc.slice(1))) {
|
|
35546
|
-
const locProp = loc.slice(1);
|
|
35547
|
-
addRet(this._trace(x, val[locProp], push(path3, locProp), val, locProp, callback, hasArrExpr, true));
|
|
35548
|
-
} else if (loc.includes(",")) {
|
|
35549
|
-
const parts = loc.split(",");
|
|
35550
|
-
for (const part of parts) {
|
|
35551
|
-
addRet(this._trace(unshift(part, x), val, path3, parent, parentPropName, callback, true));
|
|
35552
|
-
}
|
|
35553
|
-
} else if (!literalPriority && val && Object.hasOwn(val, loc)) {
|
|
35554
|
-
addRet(this._trace(x, val[loc], push(path3, loc), val, loc, callback, hasArrExpr, true));
|
|
35555
|
-
}
|
|
35556
|
-
if (this._hasParentSelector) {
|
|
35557
|
-
for (let t = 0;t < ret.length; t++) {
|
|
35558
|
-
const rett = ret[t];
|
|
35559
|
-
if (rett && rett.isParentSelector) {
|
|
35560
|
-
const tmp = this._trace(rett.expr, val, rett.path, parent, parentPropName, callback, hasArrExpr);
|
|
35561
|
-
if (Array.isArray(tmp)) {
|
|
35562
|
-
ret[t] = tmp[0];
|
|
35563
|
-
const tl = tmp.length;
|
|
35564
|
-
for (let tt = 1;tt < tl; tt++) {
|
|
35565
|
-
t++;
|
|
35566
|
-
ret.splice(t, 0, tmp[tt]);
|
|
35567
|
-
}
|
|
35568
|
-
} else {
|
|
35569
|
-
ret[t] = tmp;
|
|
35570
|
-
}
|
|
35571
|
-
}
|
|
35572
|
-
}
|
|
35573
|
-
}
|
|
35574
|
-
return ret;
|
|
35575
|
-
};
|
|
35576
|
-
JSONPath.prototype._walk = function(val, f) {
|
|
35577
|
-
if (Array.isArray(val)) {
|
|
35578
|
-
const n = val.length;
|
|
35579
|
-
for (let i = 0;i < n; i++) {
|
|
35580
|
-
f(i);
|
|
35581
|
-
}
|
|
35582
|
-
} else if (val && typeof val === "object") {
|
|
35583
|
-
Object.keys(val).forEach((m) => {
|
|
35584
|
-
f(m);
|
|
35585
|
-
});
|
|
35586
|
-
}
|
|
35587
|
-
};
|
|
35588
|
-
JSONPath.prototype._slice = function(loc, expr, val, path3, parent, parentPropName, callback) {
|
|
35589
|
-
if (!Array.isArray(val)) {
|
|
35590
|
-
return;
|
|
35591
|
-
}
|
|
35592
|
-
const len = val.length, parts = loc.split(":"), step = parts[2] && Number.parseInt(parts[2]) || 1;
|
|
35593
|
-
let start = parts[0] && Number.parseInt(parts[0]) || 0, end = parts[1] && Number.parseInt(parts[1]) || len;
|
|
35594
|
-
start = start < 0 ? Math.max(0, start + len) : Math.min(len, start);
|
|
35595
|
-
end = end < 0 ? Math.max(0, end + len) : Math.min(len, end);
|
|
35596
|
-
const ret = [];
|
|
35597
|
-
for (let i = start;i < end; i += step) {
|
|
35598
|
-
const tmp = this._trace(unshift(i, expr), val, path3, parent, parentPropName, callback, true);
|
|
35599
|
-
tmp.forEach((t) => {
|
|
35600
|
-
ret.push(t);
|
|
35601
|
-
});
|
|
35602
|
-
}
|
|
35603
|
-
return ret;
|
|
35604
|
-
};
|
|
35605
|
-
JSONPath.prototype._eval = function(code, _v, _vname, path3, parent, parentPropName) {
|
|
35606
|
-
this.currSandbox._$_parentProperty = parentPropName;
|
|
35607
|
-
this.currSandbox._$_parent = parent;
|
|
35608
|
-
this.currSandbox._$_property = _vname;
|
|
35609
|
-
this.currSandbox._$_root = this.json;
|
|
35610
|
-
this.currSandbox._$_v = _v;
|
|
35611
|
-
const containsPath = code.includes("@path");
|
|
35612
|
-
if (containsPath) {
|
|
35613
|
-
this.currSandbox._$_path = JSONPath.toPathString(path3.concat([_vname]));
|
|
35614
|
-
}
|
|
35615
|
-
const scriptCacheKey = this.currEval + "Script:" + code;
|
|
35616
|
-
if (!JSONPath.cache[scriptCacheKey]) {
|
|
35617
|
-
let script = code.replaceAll("@parentProperty", "_$_parentProperty").replaceAll("@parent", "_$_parent").replaceAll("@property", "_$_property").replaceAll("@root", "_$_root").replaceAll(/@([.\s)[])/gu, "_$_v$1");
|
|
35618
|
-
if (containsPath) {
|
|
35619
|
-
script = script.replaceAll("@path", "_$_path");
|
|
35620
|
-
}
|
|
35621
|
-
if (this.currEval === "safe" || this.currEval === true || this.currEval === undefined) {
|
|
35622
|
-
JSONPath.cache[scriptCacheKey] = new this.safeVm.Script(script);
|
|
35623
|
-
} else if (this.currEval === "native") {
|
|
35624
|
-
JSONPath.cache[scriptCacheKey] = new this.vm.Script(script);
|
|
35625
|
-
} else if (typeof this.currEval === "function" && this.currEval.prototype && Object.hasOwn(this.currEval.prototype, "runInNewContext")) {
|
|
35626
|
-
const CurrEval = this.currEval;
|
|
35627
|
-
JSONPath.cache[scriptCacheKey] = new CurrEval(script);
|
|
35628
|
-
} else if (typeof this.currEval === "function") {
|
|
35629
|
-
JSONPath.cache[scriptCacheKey] = {
|
|
35630
|
-
runInNewContext: (context) => this.currEval(script, context)
|
|
35631
|
-
};
|
|
35632
|
-
} else {
|
|
35633
|
-
throw new TypeError(`Unknown "eval" property "${this.currEval}"`);
|
|
35634
|
-
}
|
|
35635
|
-
}
|
|
35636
|
-
try {
|
|
35637
|
-
return JSONPath.cache[scriptCacheKey].runInNewContext(this.currSandbox);
|
|
35638
|
-
} catch (e) {
|
|
35639
|
-
if (this.ignoreEvalErrors) {
|
|
35640
|
-
return false;
|
|
35641
|
-
}
|
|
35642
|
-
throw new Error("jsonPath: " + e.message + ": " + code);
|
|
35643
|
-
}
|
|
35644
|
-
};
|
|
35645
|
-
JSONPath.cache = {};
|
|
35646
|
-
JSONPath.toPathString = function(pathArr) {
|
|
35647
|
-
const x = pathArr, n = x.length;
|
|
35648
|
-
let p = "$";
|
|
35649
|
-
for (let i = 1;i < n; i++) {
|
|
35650
|
-
if (!/^(~|\^|@.*?\(\))$/u.test(x[i])) {
|
|
35651
|
-
p += /^[0-9*]+$/u.test(x[i]) ? "[" + x[i] + "]" : "['" + x[i] + "']";
|
|
35652
|
-
}
|
|
35653
|
-
}
|
|
35654
|
-
return p;
|
|
35655
|
-
};
|
|
35656
|
-
JSONPath.toPointer = function(pointer) {
|
|
35657
|
-
const x = pointer, n = x.length;
|
|
35658
|
-
let p = "";
|
|
35659
|
-
for (let i = 1;i < n; i++) {
|
|
35660
|
-
if (!/^(~|\^|@.*?\(\))$/u.test(x[i])) {
|
|
35661
|
-
p += "/" + x[i].toString().replaceAll("~", "~0").replaceAll("/", "~1");
|
|
35662
|
-
}
|
|
35663
|
-
}
|
|
35664
|
-
return p;
|
|
35665
|
-
};
|
|
35666
|
-
JSONPath.toPathArray = function(expr) {
|
|
35667
|
-
const {
|
|
35668
|
-
cache
|
|
35669
|
-
} = JSONPath;
|
|
35670
|
-
if (cache[expr]) {
|
|
35671
|
-
return cache[expr].concat();
|
|
35672
|
-
}
|
|
35673
|
-
const subx = [];
|
|
35674
|
-
const normalized = expr.replaceAll(/@(?:null|boolean|number|string|integer|undefined|nonFinite|scalar|array|object|function|other)\(\)/gu, ";$&;").replaceAll(/[['](\??\(.*?\))[\]'](?!.\])/gu, function($0, $1) {
|
|
35675
|
-
return "[#" + (subx.push($1) - 1) + "]";
|
|
35676
|
-
}).replaceAll(/\[['"]([^'\]]*)['"]\]/gu, function($0, prop) {
|
|
35677
|
-
return "['" + prop.replaceAll(".", "%@%").replaceAll("~", "%%@@%%") + "']";
|
|
35678
|
-
}).replaceAll("~", ";~;").replaceAll(/['"]?\.['"]?(?![^[]*\])|\[['"]?/gu, ";").replaceAll("%@%", ".").replaceAll("%%@@%%", "~").replaceAll(/(?:;)?(\^+)(?:;)?/gu, function($0, ups) {
|
|
35679
|
-
return ";" + ups.split("").join(";") + ";";
|
|
35680
|
-
}).replaceAll(/;;;|;;/gu, ";..;").replaceAll(/;$|'?\]|'$/gu, "");
|
|
35681
|
-
const exprList = normalized.split(";").map(function(exp) {
|
|
35682
|
-
const match = exp.match(/#(\d+)/u);
|
|
35683
|
-
return !match || !match[1] ? exp : subx[match[1]];
|
|
35684
|
-
});
|
|
35685
|
-
cache[expr] = exprList;
|
|
35686
|
-
return cache[expr].concat();
|
|
35687
|
-
};
|
|
35688
|
-
JSONPath.prototype.safeVm = {
|
|
35689
|
-
Script: SafeScript
|
|
35690
|
-
};
|
|
35691
|
-
JSONPath.prototype.vm = vm;
|
|
35692
|
-
// ../common/src/polling/format-utils.ts
|
|
35693
|
-
function msToDuration(ms) {
|
|
35694
|
-
if (!Number.isFinite(ms) || ms < 0) {
|
|
35695
|
-
return "00:00:00";
|
|
35696
|
-
}
|
|
35697
|
-
const totalSec = Math.floor(ms / 1000);
|
|
35698
|
-
const h = Math.floor(totalSec / 3600);
|
|
35699
|
-
const m = Math.floor(totalSec % 3600 / 60);
|
|
35700
|
-
const s = totalSec % 60;
|
|
35701
|
-
return [h, m, s].map((v) => String(v).padStart(2, "0")).join(":");
|
|
35702
|
-
}
|
|
35703
|
-
// ../common/src/polling/types.ts
|
|
35704
|
-
var PollOutcome = {
|
|
35705
|
-
Completed: "completed",
|
|
35706
|
-
Timeout: "timeout",
|
|
35707
|
-
Interrupted: "interrupted",
|
|
35708
|
-
Aborted: "aborted",
|
|
35709
|
-
Failed: "failed"
|
|
35710
|
-
};
|
|
35711
|
-
var ErrorDecision = {
|
|
35712
|
-
Abort: "abort"
|
|
35713
|
-
};
|
|
35714
|
-
var POLL_DEFAULTS = {
|
|
35715
|
-
intervalMs: 5000,
|
|
35716
|
-
timeoutMs: 1800000,
|
|
35717
|
-
maxConsecutiveErrors: 3,
|
|
35718
|
-
logIntervalMs: 30000,
|
|
35719
|
-
logPrefix: "wait"
|
|
35720
|
-
};
|
|
35721
|
-
var BACKOFF_DEFAULTS = {
|
|
35722
|
-
initialMs: 1000,
|
|
35723
|
-
multiplier: 2,
|
|
35724
|
-
maxMs: 30000,
|
|
35725
|
-
jitter: 0.5
|
|
35726
|
-
};
|
|
35727
|
-
var MIN_INTERVAL_MS = 100;
|
|
35728
|
-
|
|
35729
|
-
// ../common/src/polling/poll-failure-mapping.ts
|
|
35730
|
-
var REASON_BY_OUTCOME = {
|
|
35731
|
-
[PollOutcome.Timeout]: "poll_timeout",
|
|
35732
|
-
[PollOutcome.Failed]: "poll_failed",
|
|
35733
|
-
[PollOutcome.Interrupted]: "poll_failed",
|
|
35734
|
-
[PollOutcome.Aborted]: "poll_aborted"
|
|
35735
|
-
};
|
|
35736
|
-
function mapPollFailure(pollResult, label) {
|
|
35737
|
-
const outcome = pollResult.outcome;
|
|
35738
|
-
const errMsg = pollResult.error?.message ?? "too many consecutive errors";
|
|
35739
|
-
const messageByOutcome = {
|
|
35740
|
-
[PollOutcome.Timeout]: `${label} polling timed out`,
|
|
35741
|
-
[PollOutcome.Failed]: `${label} polling failed: ${errMsg}`,
|
|
35742
|
-
[PollOutcome.Interrupted]: `${label} polling was interrupted`,
|
|
35743
|
-
[PollOutcome.Aborted]: `${label} polling was aborted`
|
|
35744
|
-
};
|
|
35745
|
-
return {
|
|
35746
|
-
reason: REASON_BY_OUTCOME[outcome],
|
|
35747
|
-
message: messageByOutcome[outcome],
|
|
35748
|
-
exitCode: outcome === PollOutcome.Timeout ? 2 : 1
|
|
35749
|
-
};
|
|
35750
|
-
}
|
|
35751
|
-
// ../common/src/polling/poll-until.ts
|
|
35752
|
-
function resolveIntervalFn(options) {
|
|
35753
|
-
if (typeof options.intervalMs === "function") {
|
|
35754
|
-
return options.intervalMs;
|
|
35755
|
-
}
|
|
35756
|
-
const staticInterval = options.intervalMs ?? POLL_DEFAULTS.intervalMs;
|
|
35757
|
-
return () => staticInterval;
|
|
35758
|
-
}
|
|
35759
|
-
function resolveBackoffFn(options) {
|
|
35760
|
-
if (!options.backoff)
|
|
35761
|
-
return;
|
|
35762
|
-
const config = options.backoff === true ? { ...BACKOFF_DEFAULTS } : {
|
|
35763
|
-
initialMs: options.backoff.initialMs ?? BACKOFF_DEFAULTS.initialMs,
|
|
35764
|
-
multiplier: options.backoff.multiplier ?? BACKOFF_DEFAULTS.multiplier,
|
|
35765
|
-
maxMs: options.backoff.maxMs ?? BACKOFF_DEFAULTS.maxMs,
|
|
35766
|
-
jitter: Math.min(1, Math.max(0, options.backoff.jitter ?? BACKOFF_DEFAULTS.jitter))
|
|
35767
|
-
};
|
|
35768
|
-
return (errorCount) => {
|
|
35769
|
-
const exponent = Math.min(errorCount - 1, 30);
|
|
35770
|
-
const raw = Math.min(config.initialMs * config.multiplier ** exponent, config.maxMs);
|
|
35771
|
-
if (config.jitter > 0) {
|
|
35772
|
-
const jitterAmount = raw * config.jitter;
|
|
35773
|
-
return raw - jitterAmount * Math.random();
|
|
35774
|
-
}
|
|
35775
|
-
return raw;
|
|
35776
|
-
};
|
|
35777
|
-
}
|
|
35778
|
-
function clampInterval(raw, label, prefix) {
|
|
35779
|
-
if (!Number.isFinite(raw) || Number.isNaN(raw)) {
|
|
35780
|
-
if (label) {
|
|
35781
|
-
logger.warn(`[${prefix}] ${label} — intervalMs returned ${raw}, falling back to ${POLL_DEFAULTS.intervalMs}ms`);
|
|
35782
|
-
}
|
|
35783
|
-
return POLL_DEFAULTS.intervalMs;
|
|
35784
|
-
}
|
|
35785
|
-
if (raw < MIN_INTERVAL_MS) {
|
|
35786
|
-
if (label) {
|
|
35787
|
-
logger.warn(`[${prefix}] ${label} — intervalMs ${raw}ms clamped to minimum ${MIN_INTERVAL_MS}ms`);
|
|
35788
|
-
}
|
|
35789
|
-
return MIN_INTERVAL_MS;
|
|
35790
|
-
}
|
|
35791
|
-
return raw;
|
|
35792
|
-
}
|
|
35793
|
-
function abortError(signal) {
|
|
35794
|
-
const reason = signal.reason;
|
|
35795
|
-
if (reason instanceof Error && reason.name === "AbortError") {
|
|
35796
|
-
return reason;
|
|
35797
|
-
}
|
|
35798
|
-
const msg = reason instanceof Error ? reason.message : typeof reason === "string" || typeof reason === "number" ? String(reason) : "Aborted";
|
|
35799
|
-
const err = new Error(msg);
|
|
35800
|
-
err.name = "AbortError";
|
|
35801
|
-
return err;
|
|
35802
|
-
}
|
|
35803
|
-
function interruptibleSleep(ms, signal) {
|
|
35804
|
-
return new Promise((resolve2, reject) => {
|
|
35805
|
-
if (signal?.aborted) {
|
|
35806
|
-
reject(abortError(signal));
|
|
35807
|
-
return;
|
|
35808
|
-
}
|
|
35809
|
-
let onAbort;
|
|
35810
|
-
const cleanup = () => {
|
|
35811
|
-
if (onAbort) {
|
|
35812
|
-
signal?.removeEventListener("abort", onAbort);
|
|
35813
|
-
}
|
|
35814
|
-
};
|
|
35815
|
-
const timer = setTimeout(() => {
|
|
35816
|
-
cleanup();
|
|
35817
|
-
resolve2();
|
|
35818
|
-
}, ms);
|
|
35819
|
-
if (signal) {
|
|
35820
|
-
onAbort = () => {
|
|
35821
|
-
clearTimeout(timer);
|
|
35822
|
-
cleanup();
|
|
35823
|
-
reject(abortError(signal));
|
|
35824
|
-
};
|
|
35825
|
-
signal.addEventListener("abort", onAbort, { once: true });
|
|
34553
|
+
};
|
|
34554
|
+
const timer = setTimeout(() => {
|
|
34555
|
+
cleanup();
|
|
34556
|
+
resolve2();
|
|
34557
|
+
}, ms);
|
|
34558
|
+
if (signal) {
|
|
34559
|
+
onAbort = () => {
|
|
34560
|
+
clearTimeout(timer);
|
|
34561
|
+
cleanup();
|
|
34562
|
+
reject(abortError(signal));
|
|
34563
|
+
};
|
|
34564
|
+
signal.addEventListener("abort", onAbort, { once: true });
|
|
35826
34565
|
}
|
|
35827
34566
|
});
|
|
35828
34567
|
}
|
|
@@ -36146,6 +34885,17 @@ var FAILURE_STATUSES = new Set([
|
|
|
36146
34885
|
"canceled",
|
|
36147
34886
|
"stopped"
|
|
36148
34887
|
]);
|
|
34888
|
+
// ../common/src/preview.ts
|
|
34889
|
+
var previewSlot = singleton("PreviewBuild");
|
|
34890
|
+
function isPreviewBuild() {
|
|
34891
|
+
return previewSlot.get(false) ?? false;
|
|
34892
|
+
}
|
|
34893
|
+
Command.prototype.previewCommand = function(nameAndArgs, opts) {
|
|
34894
|
+
if (isPreviewBuild()) {
|
|
34895
|
+
return this.command(nameAndArgs, opts);
|
|
34896
|
+
}
|
|
34897
|
+
return new Command(nameAndArgs.split(/\s+/)[0] ?? nameAndArgs);
|
|
34898
|
+
};
|
|
36149
34899
|
// ../common/src/screen-logger.ts
|
|
36150
34900
|
var ScreenLogger;
|
|
36151
34901
|
((ScreenLogger) => {
|
|
@@ -36178,8 +34928,8 @@ function appendUserAgentToken(value, userAgent) {
|
|
|
36178
34928
|
function getEffectiveUserAgent(userAgent) {
|
|
36179
34929
|
return appendUserAgentToken(sdkUserAgentHostToken.get(), userAgent);
|
|
36180
34930
|
}
|
|
36181
|
-
function
|
|
36182
|
-
return
|
|
34931
|
+
function getHeaderName(headers, headerName) {
|
|
34932
|
+
return Object.keys(headers).find((key) => key.toLowerCase() === headerName.toLowerCase());
|
|
36183
34933
|
}
|
|
36184
34934
|
function getSdkUserAgentToken(pkg) {
|
|
36185
34935
|
const packageName = pkg.name.replace(/^@uipath\//, "");
|
|
@@ -36187,59 +34937,31 @@ function getSdkUserAgentToken(pkg) {
|
|
|
36187
34937
|
}
|
|
36188
34938
|
function addSdkUserAgentHeader(headers, userAgent) {
|
|
36189
34939
|
const result = { ...headers ?? {} };
|
|
36190
|
-
const
|
|
36191
|
-
|
|
36192
|
-
if (headerName) {
|
|
36193
|
-
result[headerName] = appendUserAgentToken(result[headerName], effectiveUserAgent);
|
|
36194
|
-
} else {
|
|
36195
|
-
result[USER_AGENT_HEADER] = effectiveUserAgent;
|
|
36196
|
-
}
|
|
34940
|
+
const headerName = getHeaderName(result, USER_AGENT_HEADER);
|
|
34941
|
+
result[headerName ?? USER_AGENT_HEADER] = appendUserAgentToken(headerName ? result[headerName] : undefined, getEffectiveUserAgent(userAgent));
|
|
36197
34942
|
return result;
|
|
36198
34943
|
}
|
|
36199
|
-
function
|
|
36200
|
-
|
|
36201
|
-
if (isHeadersLike(headers)) {
|
|
36202
|
-
headers.set(USER_AGENT_HEADER, appendUserAgentToken(headers.get(USER_AGENT_HEADER), effectiveUserAgent));
|
|
36203
|
-
return headers;
|
|
36204
|
-
}
|
|
36205
|
-
if (Array.isArray(headers)) {
|
|
36206
|
-
const result = headers.map((entry) => {
|
|
36207
|
-
const [key, value] = entry;
|
|
36208
|
-
return [key, value];
|
|
36209
|
-
});
|
|
36210
|
-
const headerIndex = result.findIndex(([key]) => key.toLowerCase() === USER_AGENT_HEADER.toLowerCase());
|
|
36211
|
-
if (headerIndex >= 0) {
|
|
36212
|
-
const [key, value] = result[headerIndex];
|
|
36213
|
-
result[headerIndex] = [
|
|
36214
|
-
key,
|
|
36215
|
-
appendUserAgentToken(value, effectiveUserAgent)
|
|
36216
|
-
];
|
|
36217
|
-
} else {
|
|
36218
|
-
result.push([USER_AGENT_HEADER, effectiveUserAgent]);
|
|
36219
|
-
}
|
|
36220
|
-
return result;
|
|
36221
|
-
}
|
|
36222
|
-
return addSdkUserAgentHeader(typeof headers === "object" && headers !== null ? { ...headers } : {}, effectiveUserAgent);
|
|
34944
|
+
function asHeaderRecord(headers) {
|
|
34945
|
+
return typeof headers === "object" && headers !== null ? { ...headers } : {};
|
|
36223
34946
|
}
|
|
36224
|
-
function
|
|
34947
|
+
function withForwardedHeadersInitOverride(initOverrides, forward) {
|
|
36225
34948
|
return async (requestContext) => {
|
|
36226
|
-
const
|
|
34949
|
+
const initWithHeaders = {
|
|
36227
34950
|
...requestContext.init,
|
|
36228
|
-
headers:
|
|
34951
|
+
headers: forward(asHeaderRecord(requestContext.init.headers))
|
|
36229
34952
|
};
|
|
36230
34953
|
const override = typeof initOverrides === "function" ? await initOverrides({
|
|
36231
34954
|
...requestContext,
|
|
36232
|
-
init:
|
|
34955
|
+
init: initWithHeaders
|
|
36233
34956
|
}) : initOverrides;
|
|
36234
34957
|
return {
|
|
36235
34958
|
...override ?? {},
|
|
36236
|
-
headers:
|
|
34959
|
+
headers: forward(asHeaderRecord(override?.headers ?? initWithHeaders.headers))
|
|
36237
34960
|
};
|
|
36238
34961
|
};
|
|
36239
34962
|
}
|
|
36240
|
-
function
|
|
34963
|
+
function installRequestHeaderForwarding(BaseApiClass, patchKey, forward) {
|
|
36241
34964
|
const prototype = BaseApiClass.prototype;
|
|
36242
|
-
const patchKey = userAgentPatchKey(userAgent);
|
|
36243
34965
|
if (prototype[patchKey]) {
|
|
36244
34966
|
return;
|
|
36245
34967
|
}
|
|
@@ -36247,13 +34969,16 @@ function installSdkUserAgentHeader(BaseApiClass, userAgent) {
|
|
|
36247
34969
|
throw new Error("Generated BaseAPI request function not found.");
|
|
36248
34970
|
}
|
|
36249
34971
|
const originalRequest = prototype.request;
|
|
36250
|
-
prototype.request = function
|
|
36251
|
-
return originalRequest.call(this, context,
|
|
34972
|
+
prototype.request = function requestWithForwardedHeaders(context, initOverrides) {
|
|
34973
|
+
return originalRequest.call(this, context, withForwardedHeadersInitOverride(initOverrides, forward));
|
|
36252
34974
|
};
|
|
36253
34975
|
Object.defineProperty(prototype, patchKey, {
|
|
36254
34976
|
value: true
|
|
36255
34977
|
});
|
|
36256
34978
|
}
|
|
34979
|
+
function installSdkUserAgentHeader(BaseApiClass, userAgent) {
|
|
34980
|
+
installRequestHeaderForwarding(BaseApiClass, userAgentPatchKey(userAgent), (headers) => addSdkUserAgentHeader(headers, userAgent));
|
|
34981
|
+
}
|
|
36257
34982
|
// ../common/src/tool-provider.ts
|
|
36258
34983
|
var factorySlot = singleton("PackagerFactoryProvider");
|
|
36259
34984
|
// ../pipelines-sdk/generated/src/runtime.ts
|
|
@@ -36529,7 +35254,7 @@ class TextApiResponse {
|
|
|
36529
35254
|
var package_default = {
|
|
36530
35255
|
name: "@uipath/pipelines-sdk",
|
|
36531
35256
|
license: "MIT",
|
|
36532
|
-
version: "1.
|
|
35257
|
+
version: "1.197.0",
|
|
36533
35258
|
description: "Generated TypeScript client for UiPath Pipelines API (CI/CD deployment lifecycle)",
|
|
36534
35259
|
repository: {
|
|
36535
35260
|
type: "git",
|
|
@@ -36561,7 +35286,7 @@ var package_default = {
|
|
|
36561
35286
|
],
|
|
36562
35287
|
private: true,
|
|
36563
35288
|
scripts: {
|
|
36564
|
-
build: "bun build ./src/index.ts --outdir dist --format esm --target node && bun build ./src/scripts/generate-sdk.ts --outdir dist/scripts --format esm --target node && tsc -p tsconfig.build.json --noCheck",
|
|
35289
|
+
build: "bun build ./src/index.ts --outdir dist --format esm --target node --sourcemap=linked && bun build ./src/scripts/generate-sdk.ts --outdir dist/scripts --format esm --target node --sourcemap=linked && tsc -p tsconfig.build.json --noCheck",
|
|
36565
35290
|
generate: "bun run src/scripts/generate-sdk.ts",
|
|
36566
35291
|
lint: "biome check .",
|
|
36567
35292
|
test: "vitest run",
|
|
@@ -37944,7 +36669,7 @@ class JSONApiResponse2 {
|
|
|
37944
36669
|
var package_default2 = {
|
|
37945
36670
|
name: "@uipath/solution-sdk",
|
|
37946
36671
|
license: "MIT",
|
|
37947
|
-
version: "1.
|
|
36672
|
+
version: "1.197.0-preview.59",
|
|
37948
36673
|
repository: {
|
|
37949
36674
|
type: "git",
|
|
37950
36675
|
url: "https://github.com/UiPath/cli.git",
|
|
@@ -37975,7 +36700,7 @@ var package_default2 = {
|
|
|
37975
36700
|
],
|
|
37976
36701
|
private: false,
|
|
37977
36702
|
scripts: {
|
|
37978
|
-
build: "bun build ./src/index.ts --outdir dist --format esm --target node && bun build ./src/scripts/generate-sdk.ts --outdir dist/scripts --format esm --target node && tsc -p tsconfig.build.json --noCheck",
|
|
36703
|
+
build: "bun build ./src/index.ts --outdir dist --format esm --target node --sourcemap=linked && bun build ./src/scripts/generate-sdk.ts --outdir dist/scripts --format esm --target node --sourcemap=linked && tsc -p tsconfig.build.json --noCheck",
|
|
37979
36704
|
generate: "bun run src/scripts/generate-sdk.ts",
|
|
37980
36705
|
lint: "biome check .",
|
|
37981
36706
|
test: "vitest run",
|
|
@@ -38781,7 +37506,7 @@ async function isPipelineDeploymentNotFoundError(error) {
|
|
|
38781
37506
|
if (!error || typeof error !== "object") {
|
|
38782
37507
|
return false;
|
|
38783
37508
|
}
|
|
38784
|
-
const response = error
|
|
37509
|
+
const response = error.response;
|
|
38785
37510
|
if (!response || typeof response !== "object") {
|
|
38786
37511
|
return false;
|
|
38787
37512
|
}
|
|
@@ -38969,6 +37694,12 @@ var normalizeAndValidateBaseUrl = (rawUrl) => {
|
|
|
38969
37694
|
}
|
|
38970
37695
|
return url.pathname.length > 1 ? url.origin : baseUrl;
|
|
38971
37696
|
};
|
|
37697
|
+
var resolveScopes = (isExternalAppAuth, customScopes, fileScopes) => {
|
|
37698
|
+
const requestedScopes = customScopes?.length ? customScopes : fileScopes ?? [];
|
|
37699
|
+
if (isExternalAppAuth)
|
|
37700
|
+
return requestedScopes;
|
|
37701
|
+
return [...new Set([...DEFAULT_SCOPES, ...requestedScopes])];
|
|
37702
|
+
};
|
|
38972
37703
|
var resolveConfigAsync = async ({
|
|
38973
37704
|
customAuthority,
|
|
38974
37705
|
customClientId,
|
|
@@ -38999,7 +37730,7 @@ var resolveConfigAsync = async ({
|
|
|
38999
37730
|
clientSecret = fileAuth.clientSecret;
|
|
39000
37731
|
}
|
|
39001
37732
|
const isExternalAppAuth = clientId !== DEFAULT_CLIENT_ID && Boolean(clientSecret);
|
|
39002
|
-
const scopes =
|
|
37733
|
+
const scopes = resolveScopes(isExternalAppAuth, customScopes, fileAuth.scopes);
|
|
39003
37734
|
return {
|
|
39004
37735
|
clientId,
|
|
39005
37736
|
clientSecret,
|
|
@@ -39014,6 +37745,76 @@ var resolveConfigAsync = async ({
|
|
|
39014
37745
|
init_constants();
|
|
39015
37746
|
// ../auth/src/loginStatus.ts
|
|
39016
37747
|
init_src();
|
|
37748
|
+
|
|
37749
|
+
// ../auth/src/authProfile.ts
|
|
37750
|
+
init_src();
|
|
37751
|
+
init_constants();
|
|
37752
|
+
var DEFAULT_AUTH_PROFILE = "default";
|
|
37753
|
+
var PROFILE_DIR = "profiles";
|
|
37754
|
+
var PROFILE_NAME_RE = /^[A-Za-z0-9._-]+$/;
|
|
37755
|
+
var ACTIVE_AUTH_PROFILE_KEY = Symbol.for("@uipath/auth/ActiveAuthProfile");
|
|
37756
|
+
var AUTH_PROFILE_STORAGE_KEY = Symbol.for("@uipath/auth/ProfileStorage");
|
|
37757
|
+
var globalSlot2 = globalThis;
|
|
37758
|
+
function isAuthProfileStorage(value) {
|
|
37759
|
+
return value !== null && typeof value === "object" && "getStore" in value && "run" in value;
|
|
37760
|
+
}
|
|
37761
|
+
function createProfileStorage() {
|
|
37762
|
+
const [error, mod2] = catchError2(() => __require("node:async_hooks"));
|
|
37763
|
+
if (error || typeof mod2?.AsyncLocalStorage !== "function") {
|
|
37764
|
+
return {
|
|
37765
|
+
getStore: () => {
|
|
37766
|
+
return;
|
|
37767
|
+
},
|
|
37768
|
+
run: (_store, fn) => fn()
|
|
37769
|
+
};
|
|
37770
|
+
}
|
|
37771
|
+
return new mod2.AsyncLocalStorage;
|
|
37772
|
+
}
|
|
37773
|
+
function getProfileStorage() {
|
|
37774
|
+
const existing = globalSlot2[AUTH_PROFILE_STORAGE_KEY];
|
|
37775
|
+
if (isAuthProfileStorage(existing)) {
|
|
37776
|
+
return existing;
|
|
37777
|
+
}
|
|
37778
|
+
const storage = createProfileStorage();
|
|
37779
|
+
globalSlot2[AUTH_PROFILE_STORAGE_KEY] = storage;
|
|
37780
|
+
return storage;
|
|
37781
|
+
}
|
|
37782
|
+
var profileStorage = getProfileStorage();
|
|
37783
|
+
|
|
37784
|
+
class AuthProfileValidationError extends Error {
|
|
37785
|
+
constructor(message) {
|
|
37786
|
+
super(message);
|
|
37787
|
+
this.name = "AuthProfileValidationError";
|
|
37788
|
+
}
|
|
37789
|
+
}
|
|
37790
|
+
function normalizeAuthProfileName(profile) {
|
|
37791
|
+
if (profile === undefined || profile === DEFAULT_AUTH_PROFILE) {
|
|
37792
|
+
return;
|
|
37793
|
+
}
|
|
37794
|
+
if (profile.length === 0 || profile === "." || profile === ".." || !PROFILE_NAME_RE.test(profile)) {
|
|
37795
|
+
throw new AuthProfileValidationError(`Invalid profile name "${profile}". Profile names may contain only letters, numbers, '.', '_', and '-'.`);
|
|
37796
|
+
}
|
|
37797
|
+
return profile;
|
|
37798
|
+
}
|
|
37799
|
+
function getActiveAuthProfile() {
|
|
37800
|
+
const scopedState = profileStorage.getStore();
|
|
37801
|
+
if (scopedState !== undefined) {
|
|
37802
|
+
return scopedState.profile;
|
|
37803
|
+
}
|
|
37804
|
+
return globalSlot2[ACTIVE_AUTH_PROFILE_KEY]?.profile;
|
|
37805
|
+
}
|
|
37806
|
+
function resolveAuthProfileFilePath(profile) {
|
|
37807
|
+
const normalized = normalizeAuthProfileName(profile);
|
|
37808
|
+
if (normalized === undefined) {
|
|
37809
|
+
throw new AuthProfileValidationError(`"${DEFAULT_AUTH_PROFILE}" is the built-in profile and does not have a profile file path.`);
|
|
37810
|
+
}
|
|
37811
|
+
const fs7 = getFileSystem();
|
|
37812
|
+
return fs7.path.join(fs7.env.homedir(), UIPATH_HOME_DIR, PROFILE_DIR, normalized, AUTH_FILENAME);
|
|
37813
|
+
}
|
|
37814
|
+
function getActiveAuthProfileFilePath() {
|
|
37815
|
+
const profile = getActiveAuthProfile();
|
|
37816
|
+
return profile ? resolveAuthProfileFilePath(profile) : undefined;
|
|
37817
|
+
}
|
|
39017
37818
|
// ../auth/src/utils/jwt.ts
|
|
39018
37819
|
class InvalidIssuerError extends Error {
|
|
39019
37820
|
expected;
|
|
@@ -39142,23 +37943,74 @@ var readAuthFromEnv = () => {
|
|
|
39142
37943
|
organizationId,
|
|
39143
37944
|
tenantName,
|
|
39144
37945
|
tenantId,
|
|
39145
|
-
expiration
|
|
37946
|
+
expiration,
|
|
37947
|
+
source: "env" /* Env */
|
|
39146
37948
|
};
|
|
39147
37949
|
};
|
|
39148
37950
|
|
|
37951
|
+
// ../auth/src/refreshCircuitBreaker.ts
|
|
37952
|
+
init_src();
|
|
37953
|
+
var BREAKER_SUFFIX = ".refresh-state";
|
|
37954
|
+
var BACKOFF_BASE_MS = 60000;
|
|
37955
|
+
var BACKOFF_CAP_MS = 60 * 60 * 1000;
|
|
37956
|
+
var SURFACE_WINDOW_MS = 60 * 60 * 1000;
|
|
37957
|
+
async function refreshTokenFingerprint(refreshToken) {
|
|
37958
|
+
const bytes = new TextEncoder().encode(refreshToken);
|
|
37959
|
+
if (globalThis.crypto?.subtle) {
|
|
37960
|
+
const digest = await globalThis.crypto.subtle.digest("SHA-256", bytes);
|
|
37961
|
+
return Array.from(new Uint8Array(digest), (b) => b.toString(16).padStart(2, "0")).join("").slice(0, 16);
|
|
37962
|
+
}
|
|
37963
|
+
const { createHash } = await import("node:crypto");
|
|
37964
|
+
return createHash("sha256").update(refreshToken).digest("hex").slice(0, 16);
|
|
37965
|
+
}
|
|
37966
|
+
function breakerPathFor(authPath) {
|
|
37967
|
+
return `${authPath}${BREAKER_SUFFIX}`;
|
|
37968
|
+
}
|
|
37969
|
+
async function loadRefreshBreaker(authPath) {
|
|
37970
|
+
const fs7 = getFileSystem();
|
|
37971
|
+
try {
|
|
37972
|
+
const content = await fs7.readFile(breakerPathFor(authPath), "utf-8");
|
|
37973
|
+
if (!content)
|
|
37974
|
+
return {};
|
|
37975
|
+
const parsed = JSON.parse(content);
|
|
37976
|
+
return parsed && typeof parsed === "object" ? parsed : {};
|
|
37977
|
+
} catch {
|
|
37978
|
+
return {};
|
|
37979
|
+
}
|
|
37980
|
+
}
|
|
37981
|
+
async function saveRefreshBreaker(authPath, state) {
|
|
37982
|
+
try {
|
|
37983
|
+
const fs7 = getFileSystem();
|
|
37984
|
+
const path3 = breakerPathFor(authPath);
|
|
37985
|
+
await fs7.mkdir(fs7.path.dirname(path3));
|
|
37986
|
+
const tempPath = `${path3}.tmp`;
|
|
37987
|
+
await fs7.writeFile(tempPath, JSON.stringify(state));
|
|
37988
|
+
await fs7.rename(tempPath, path3);
|
|
37989
|
+
} catch {}
|
|
37990
|
+
}
|
|
37991
|
+
async function clearRefreshBreaker(authPath) {
|
|
37992
|
+
const fs7 = getFileSystem();
|
|
37993
|
+
const path3 = breakerPathFor(authPath);
|
|
37994
|
+
try {
|
|
37995
|
+
if (await fs7.exists(path3)) {
|
|
37996
|
+
await fs7.rm(path3);
|
|
37997
|
+
}
|
|
37998
|
+
} catch {}
|
|
37999
|
+
}
|
|
38000
|
+
function nextBackoffMs(attempts) {
|
|
38001
|
+
const shift = Math.max(0, attempts - 1);
|
|
38002
|
+
return Math.min(BACKOFF_BASE_MS * 2 ** shift, BACKOFF_CAP_MS);
|
|
38003
|
+
}
|
|
38004
|
+
function shouldSurface(state, nowMs) {
|
|
38005
|
+
if (state.lastSurfacedAtMs === undefined)
|
|
38006
|
+
return true;
|
|
38007
|
+
return nowMs - state.lastSurfacedAtMs >= SURFACE_WINDOW_MS;
|
|
38008
|
+
}
|
|
38009
|
+
|
|
39149
38010
|
// ../auth/src/robotClientFallback.ts
|
|
39150
38011
|
init_src();
|
|
39151
38012
|
var DEFAULT_TIMEOUT_MS = 1000;
|
|
39152
38013
|
var CLOSE_TIMEOUT_MS = 500;
|
|
39153
|
-
var NOTICE_SENTINEL = Symbol.for("@uipath/auth/robotFallbackNoticePrinted");
|
|
39154
|
-
var printNoticeOnce = () => {
|
|
39155
|
-
const slot = globalThis;
|
|
39156
|
-
if (slot[NOTICE_SENTINEL])
|
|
39157
|
-
return;
|
|
39158
|
-
slot[NOTICE_SENTINEL] = true;
|
|
39159
|
-
catchError2(() => process.stderr.write(`Using UiPath Robot credentials. Run 'uip login' for a dedicated session.
|
|
39160
|
-
`));
|
|
39161
|
-
};
|
|
39162
38014
|
var ROBOT_USER_SERVICES_PIPE = "UiPathUserServices";
|
|
39163
38015
|
var ROBOT_USER_SERVICES_ALTERNATE_PIPE = `${ROBOT_USER_SERVICES_PIPE}Alternate`;
|
|
39164
38016
|
var PIPE_NAME_MAX_LENGTH = 103;
|
|
@@ -39274,7 +38126,6 @@ var tryRobotClientFallback = async (options = {}) => {
|
|
|
39274
38126
|
issuerFromToken = issClaim;
|
|
39275
38127
|
}
|
|
39276
38128
|
}
|
|
39277
|
-
printNoticeOnce();
|
|
39278
38129
|
return {
|
|
39279
38130
|
accessToken,
|
|
39280
38131
|
baseUrl: parsedUrl.baseUrl,
|
|
@@ -39499,18 +38350,327 @@ var saveEnvFileAsync = async ({
|
|
|
39499
38350
|
};
|
|
39500
38351
|
|
|
39501
38352
|
// ../auth/src/loginStatus.ts
|
|
39502
|
-
|
|
39503
|
-
return
|
|
38353
|
+
var getLoginStatusAsync = async (options = {}) => {
|
|
38354
|
+
return getLoginStatusWithDeps(options);
|
|
38355
|
+
};
|
|
38356
|
+
var getLoginStatusWithDeps = async (options = {}, deps = {}) => {
|
|
38357
|
+
const {
|
|
38358
|
+
resolveEnvFilePath = resolveEnvFilePathAsync,
|
|
38359
|
+
loadEnvFile = loadEnvFileAsync,
|
|
38360
|
+
saveEnvFile = saveEnvFileAsync,
|
|
38361
|
+
getFs = getFileSystem,
|
|
38362
|
+
refreshToken: refreshTokenFn = refreshAccessToken,
|
|
38363
|
+
resolveConfig: resolveConfig2 = resolveConfigAsync,
|
|
38364
|
+
robotFallback = tryRobotClientFallback,
|
|
38365
|
+
loadBreaker = loadRefreshBreaker,
|
|
38366
|
+
saveBreaker = saveRefreshBreaker,
|
|
38367
|
+
clearBreaker = clearRefreshBreaker
|
|
38368
|
+
} = deps;
|
|
38369
|
+
if (isRobotAuthEnforced()) {
|
|
38370
|
+
return resolveRobotEnforcedStatus(robotFallback);
|
|
38371
|
+
}
|
|
38372
|
+
if (isEnvAuthEnabled()) {
|
|
38373
|
+
return readAuthFromEnv();
|
|
38374
|
+
}
|
|
38375
|
+
const activeProfile = getActiveAuthProfile();
|
|
38376
|
+
const activeProfileFilePath = getActiveAuthProfileFilePath();
|
|
38377
|
+
const usingActiveProfile = activeProfile !== undefined && (options.envFilePath === undefined || options.envFilePath === activeProfileFilePath);
|
|
38378
|
+
const envFilePath = options.envFilePath ?? activeProfileFilePath ?? DEFAULT_ENV_FILENAME;
|
|
38379
|
+
const { ensureTokenValidityMinutes } = options;
|
|
38380
|
+
const { absolutePath } = await resolveEnvFilePath(envFilePath);
|
|
38381
|
+
if (absolutePath === undefined) {
|
|
38382
|
+
if (usingActiveProfile) {
|
|
38383
|
+
return {
|
|
38384
|
+
loginStatus: "Not logged in",
|
|
38385
|
+
hint: `No credentials found for profile "${activeProfile}". Run 'uip login --profile ${activeProfile}' to authenticate this profile.`
|
|
38386
|
+
};
|
|
38387
|
+
}
|
|
38388
|
+
return resolveBorrowedRobotStatus(robotFallback);
|
|
38389
|
+
}
|
|
38390
|
+
const loaded = await loadFileCredentials(loadEnvFile, absolutePath);
|
|
38391
|
+
if ("status" in loaded) {
|
|
38392
|
+
return loaded.status;
|
|
38393
|
+
}
|
|
38394
|
+
const { credentials } = loaded;
|
|
38395
|
+
const globalHint = () => usingActiveProfile ? Promise.resolve(undefined) : getGlobalCredsHint(getFs, loadEnvFile, absolutePath, envFilePath);
|
|
38396
|
+
const expiration = getTokenExpiration(credentials.UIPATH_ACCESS_TOKEN);
|
|
38397
|
+
const outerThreshold = computeExpirationThreshold(ensureTokenValidityMinutes);
|
|
38398
|
+
let tokens = {
|
|
38399
|
+
accessToken: credentials.UIPATH_ACCESS_TOKEN,
|
|
38400
|
+
refreshToken: credentials.UIPATH_REFRESH_TOKEN,
|
|
38401
|
+
expiration,
|
|
38402
|
+
lockReleaseFailed: false
|
|
38403
|
+
};
|
|
38404
|
+
const refreshToken = credentials.UIPATH_REFRESH_TOKEN;
|
|
38405
|
+
if (expiration && expiration <= outerThreshold && refreshToken) {
|
|
38406
|
+
const refreshed = await attemptRefresh({
|
|
38407
|
+
absolutePath,
|
|
38408
|
+
credentials,
|
|
38409
|
+
accessToken: credentials.UIPATH_ACCESS_TOKEN,
|
|
38410
|
+
refreshToken,
|
|
38411
|
+
expiration,
|
|
38412
|
+
ensureTokenValidityMinutes,
|
|
38413
|
+
getFs,
|
|
38414
|
+
loadEnvFile,
|
|
38415
|
+
saveEnvFile,
|
|
38416
|
+
refreshFn: refreshTokenFn,
|
|
38417
|
+
resolveConfig: resolveConfig2,
|
|
38418
|
+
loadBreaker,
|
|
38419
|
+
saveBreaker,
|
|
38420
|
+
clearBreaker,
|
|
38421
|
+
globalHint
|
|
38422
|
+
});
|
|
38423
|
+
if (refreshed.kind === "terminal") {
|
|
38424
|
+
return refreshed.status;
|
|
38425
|
+
}
|
|
38426
|
+
tokens = refreshed.tokens;
|
|
38427
|
+
}
|
|
38428
|
+
return buildFileStatus(tokens, credentials, globalHint);
|
|
38429
|
+
};
|
|
38430
|
+
async function resolveRobotEnforcedStatus(robotFallback) {
|
|
38431
|
+
if (isEnvAuthEnabled()) {
|
|
38432
|
+
throw new EnvAuthConfigError(`${ENV_AUTH_ENABLE_VAR}=true and ${ENFORCE_ROBOT_AUTH_VAR}=true ` + `are mutually exclusive. Unset one of them and re-run.`);
|
|
38433
|
+
}
|
|
38434
|
+
const robotCreds = await robotFallback({ force: true });
|
|
38435
|
+
if (!robotCreds) {
|
|
38436
|
+
return {
|
|
38437
|
+
loginStatus: "Not logged in",
|
|
38438
|
+
hint: `${ENFORCE_ROBOT_AUTH_VAR}=true but the UiPath Robot ` + `session is unavailable. Start and sign in to the Assistant, ` + `or unset ${ENFORCE_ROBOT_AUTH_VAR} to fall back to file or ` + `env-var authentication.`
|
|
38439
|
+
};
|
|
38440
|
+
}
|
|
38441
|
+
return buildRobotStatus(robotCreds);
|
|
39504
38442
|
}
|
|
39505
|
-
function
|
|
39506
|
-
|
|
38443
|
+
async function resolveBorrowedRobotStatus(robotFallback) {
|
|
38444
|
+
const robotCreds = await robotFallback();
|
|
38445
|
+
return robotCreds ? buildRobotStatus(robotCreds) : { loginStatus: "Not logged in" };
|
|
39507
38446
|
}
|
|
39508
|
-
function
|
|
39509
|
-
|
|
38447
|
+
async function loadFileCredentials(loadEnvFile, absolutePath) {
|
|
38448
|
+
let credentials;
|
|
38449
|
+
try {
|
|
38450
|
+
credentials = await loadEnvFile({ envPath: absolutePath });
|
|
38451
|
+
} catch (error) {
|
|
38452
|
+
if (isFileNotFoundError(error)) {
|
|
38453
|
+
return { status: { loginStatus: "Not logged in" } };
|
|
38454
|
+
}
|
|
38455
|
+
throw error;
|
|
38456
|
+
}
|
|
38457
|
+
if (!credentials.UIPATH_ACCESS_TOKEN) {
|
|
38458
|
+
return { status: { loginStatus: "Not logged in" } };
|
|
38459
|
+
}
|
|
38460
|
+
return { credentials };
|
|
38461
|
+
}
|
|
38462
|
+
async function getGlobalCredsHint(getFs, loadEnvFile, absolutePath, envFilePath) {
|
|
38463
|
+
const fs7 = getFs();
|
|
38464
|
+
const globalPath = fs7.path.join(fs7.env.homedir(), envFilePath);
|
|
38465
|
+
if (absolutePath === globalPath)
|
|
38466
|
+
return;
|
|
38467
|
+
if (!await fs7.exists(globalPath))
|
|
38468
|
+
return;
|
|
38469
|
+
try {
|
|
38470
|
+
const globalCreds = await loadEnvFile({ envPath: globalPath });
|
|
38471
|
+
if (!globalCreds.UIPATH_ACCESS_TOKEN)
|
|
38472
|
+
return;
|
|
38473
|
+
const globalExp = getTokenExpiration(globalCreds.UIPATH_ACCESS_TOKEN);
|
|
38474
|
+
if (globalExp && globalExp <= new Date)
|
|
38475
|
+
return;
|
|
38476
|
+
return `Local credentials file at ${absolutePath} has expired credentials. Valid credentials exist in ${globalPath}. Remove the local file or run 'uip login' to re-authenticate.`;
|
|
38477
|
+
} catch {
|
|
38478
|
+
return;
|
|
38479
|
+
}
|
|
39510
38480
|
}
|
|
39511
38481
|
function computeExpirationThreshold(ensureTokenValidityMinutes) {
|
|
39512
38482
|
return new Date(Date.now() + (ensureTokenValidityMinutes ?? 0) * 60 * 1000);
|
|
39513
38483
|
}
|
|
38484
|
+
async function attemptRefresh(ctx) {
|
|
38485
|
+
const shortCircuit = await circuitBreakerShortCircuit(ctx);
|
|
38486
|
+
if (shortCircuit) {
|
|
38487
|
+
return { kind: "terminal", status: shortCircuit };
|
|
38488
|
+
}
|
|
38489
|
+
let release;
|
|
38490
|
+
try {
|
|
38491
|
+
release = await ctx.getFs().acquireLock(ctx.absolutePath);
|
|
38492
|
+
} catch (error) {
|
|
38493
|
+
return {
|
|
38494
|
+
kind: "terminal",
|
|
38495
|
+
status: await lockAcquireFailureStatus(ctx, error)
|
|
38496
|
+
};
|
|
38497
|
+
}
|
|
38498
|
+
let lockedFailure;
|
|
38499
|
+
let lockReleaseFailed = false;
|
|
38500
|
+
let success;
|
|
38501
|
+
try {
|
|
38502
|
+
const outcome = await runRefreshLocked({
|
|
38503
|
+
absolutePath: ctx.absolutePath,
|
|
38504
|
+
refreshToken: ctx.refreshToken,
|
|
38505
|
+
customAuthority: ctx.credentials.UIPATH_URL,
|
|
38506
|
+
ensureTokenValidityMinutes: ctx.ensureTokenValidityMinutes,
|
|
38507
|
+
loadEnvFile: ctx.loadEnvFile,
|
|
38508
|
+
saveEnvFile: ctx.saveEnvFile,
|
|
38509
|
+
refreshFn: ctx.refreshFn,
|
|
38510
|
+
resolveConfig: ctx.resolveConfig,
|
|
38511
|
+
loadBreaker: ctx.loadBreaker,
|
|
38512
|
+
saveBreaker: ctx.saveBreaker,
|
|
38513
|
+
clearBreaker: ctx.clearBreaker
|
|
38514
|
+
});
|
|
38515
|
+
if (outcome.kind === "fail") {
|
|
38516
|
+
lockedFailure = outcome.status;
|
|
38517
|
+
} else {
|
|
38518
|
+
success = outcome;
|
|
38519
|
+
}
|
|
38520
|
+
} finally {
|
|
38521
|
+
try {
|
|
38522
|
+
await release();
|
|
38523
|
+
} catch {
|
|
38524
|
+
lockReleaseFailed = true;
|
|
38525
|
+
}
|
|
38526
|
+
}
|
|
38527
|
+
if (lockedFailure) {
|
|
38528
|
+
const globalHint = await ctx.globalHint();
|
|
38529
|
+
const base = globalHint ? { ...lockedFailure, loginStatus: "Expired", hint: globalHint } : lockedFailure;
|
|
38530
|
+
return {
|
|
38531
|
+
kind: "terminal",
|
|
38532
|
+
status: lockReleaseFailed ? { ...base, lockReleaseFailed: true } : base
|
|
38533
|
+
};
|
|
38534
|
+
}
|
|
38535
|
+
return {
|
|
38536
|
+
kind: "refreshed",
|
|
38537
|
+
tokens: {
|
|
38538
|
+
accessToken: success?.accessToken,
|
|
38539
|
+
refreshToken: success?.refreshToken,
|
|
38540
|
+
expiration: success?.expiration,
|
|
38541
|
+
tokenRefresh: success?.tokenRefresh,
|
|
38542
|
+
persistenceWarning: success?.persistenceWarning,
|
|
38543
|
+
lockReleaseFailed
|
|
38544
|
+
}
|
|
38545
|
+
};
|
|
38546
|
+
}
|
|
38547
|
+
async function buildFileStatus(tokens, credentials, globalHint) {
|
|
38548
|
+
const result = {
|
|
38549
|
+
loginStatus: tokens.expiration && tokens.expiration <= new Date ? "Expired" : "Logged in",
|
|
38550
|
+
accessToken: tokens.accessToken,
|
|
38551
|
+
refreshToken: tokens.refreshToken,
|
|
38552
|
+
baseUrl: credentials.UIPATH_URL,
|
|
38553
|
+
organizationName: credentials.UIPATH_ORGANIZATION_NAME,
|
|
38554
|
+
organizationId: credentials.UIPATH_ORGANIZATION_ID,
|
|
38555
|
+
tenantName: credentials.UIPATH_TENANT_NAME,
|
|
38556
|
+
tenantId: credentials.UIPATH_TENANT_ID,
|
|
38557
|
+
expiration: tokens.expiration,
|
|
38558
|
+
source: "file" /* File */,
|
|
38559
|
+
...tokens.persistenceWarning ? { hint: tokens.persistenceWarning, persistenceFailed: true } : {},
|
|
38560
|
+
...tokens.lockReleaseFailed ? { lockReleaseFailed: true } : {},
|
|
38561
|
+
...tokens.tokenRefresh ? { tokenRefresh: tokens.tokenRefresh } : {}
|
|
38562
|
+
};
|
|
38563
|
+
if (result.loginStatus === "Expired") {
|
|
38564
|
+
const hint = await globalHint();
|
|
38565
|
+
if (hint) {
|
|
38566
|
+
result.hint = hint;
|
|
38567
|
+
}
|
|
38568
|
+
}
|
|
38569
|
+
return result;
|
|
38570
|
+
}
|
|
38571
|
+
function buildRobotStatus(robotCreds) {
|
|
38572
|
+
return {
|
|
38573
|
+
loginStatus: "Logged in",
|
|
38574
|
+
accessToken: robotCreds.accessToken,
|
|
38575
|
+
baseUrl: robotCreds.baseUrl,
|
|
38576
|
+
organizationName: robotCreds.organizationName,
|
|
38577
|
+
organizationId: robotCreds.organizationId,
|
|
38578
|
+
tenantName: robotCreds.tenantName,
|
|
38579
|
+
tenantId: robotCreds.tenantId,
|
|
38580
|
+
issuer: robotCreds.issuer,
|
|
38581
|
+
expiration: getTokenExpiration(robotCreds.accessToken),
|
|
38582
|
+
source: "robot" /* Robot */
|
|
38583
|
+
};
|
|
38584
|
+
}
|
|
38585
|
+
var isFileNotFoundError = (error) => {
|
|
38586
|
+
if (!(error instanceof Object))
|
|
38587
|
+
return false;
|
|
38588
|
+
return error.code === "ENOENT";
|
|
38589
|
+
};
|
|
38590
|
+
async function circuitBreakerShortCircuit(ctx) {
|
|
38591
|
+
const {
|
|
38592
|
+
absolutePath,
|
|
38593
|
+
refreshToken,
|
|
38594
|
+
accessToken,
|
|
38595
|
+
credentials,
|
|
38596
|
+
expiration,
|
|
38597
|
+
loadBreaker,
|
|
38598
|
+
saveBreaker,
|
|
38599
|
+
clearBreaker
|
|
38600
|
+
} = ctx;
|
|
38601
|
+
const fingerprint = await refreshTokenFingerprint(refreshToken);
|
|
38602
|
+
const breaker = await loadBreaker(absolutePath).catch(() => ({}));
|
|
38603
|
+
if (breaker.deadTokenFp && breaker.deadTokenFp !== fingerprint) {
|
|
38604
|
+
await clearBreaker(absolutePath);
|
|
38605
|
+
breaker.deadTokenFp = undefined;
|
|
38606
|
+
}
|
|
38607
|
+
const nowMs = Date.now();
|
|
38608
|
+
const tokenIsDead = breaker.deadTokenFp === fingerprint;
|
|
38609
|
+
const inBackoff = breaker.backoffUntilMs !== undefined && nowMs < breaker.backoffUntilMs;
|
|
38610
|
+
if (!tokenIsDead && !inBackoff)
|
|
38611
|
+
return;
|
|
38612
|
+
const globalHint = await ctx.globalHint();
|
|
38613
|
+
const suppressed = !shouldSurface(breaker, nowMs);
|
|
38614
|
+
if (!suppressed) {
|
|
38615
|
+
await saveBreaker(absolutePath, {
|
|
38616
|
+
...breaker,
|
|
38617
|
+
lastSurfacedAtMs: nowMs
|
|
38618
|
+
});
|
|
38619
|
+
}
|
|
38620
|
+
const deadHint = "Run 'uip login' to re-authenticate — the stored refresh token is invalid or expired. In a non-interactive context, authenticate with: uip login --client-id <id> --client-secret <secret> -t <tenant>.";
|
|
38621
|
+
const backoffHint = "Token refresh is temporarily backed off after a recent network error and will retry automatically once the backoff window elapses.";
|
|
38622
|
+
return {
|
|
38623
|
+
loginStatus: globalHint ? "Expired" : "Refresh Failed",
|
|
38624
|
+
...globalHint ? {
|
|
38625
|
+
accessToken,
|
|
38626
|
+
refreshToken,
|
|
38627
|
+
baseUrl: credentials.UIPATH_URL,
|
|
38628
|
+
organizationName: credentials.UIPATH_ORGANIZATION_NAME,
|
|
38629
|
+
organizationId: credentials.UIPATH_ORGANIZATION_ID,
|
|
38630
|
+
tenantName: credentials.UIPATH_TENANT_NAME,
|
|
38631
|
+
tenantId: credentials.UIPATH_TENANT_ID,
|
|
38632
|
+
expiration,
|
|
38633
|
+
source: "file" /* File */
|
|
38634
|
+
} : {},
|
|
38635
|
+
hint: globalHint ?? (tokenIsDead ? deadHint : backoffHint),
|
|
38636
|
+
refreshCircuitOpen: true,
|
|
38637
|
+
refreshTelemetrySuppressed: suppressed,
|
|
38638
|
+
tokenRefresh: { attempted: false, success: false }
|
|
38639
|
+
};
|
|
38640
|
+
}
|
|
38641
|
+
async function lockAcquireFailureStatus(ctx, error) {
|
|
38642
|
+
const msg = errorMessage(error);
|
|
38643
|
+
const globalHint = await ctx.globalHint();
|
|
38644
|
+
if (globalHint) {
|
|
38645
|
+
return {
|
|
38646
|
+
loginStatus: "Expired",
|
|
38647
|
+
accessToken: ctx.accessToken,
|
|
38648
|
+
refreshToken: ctx.refreshToken,
|
|
38649
|
+
baseUrl: ctx.credentials.UIPATH_URL,
|
|
38650
|
+
organizationName: ctx.credentials.UIPATH_ORGANIZATION_NAME,
|
|
38651
|
+
organizationId: ctx.credentials.UIPATH_ORGANIZATION_ID,
|
|
38652
|
+
tenantName: ctx.credentials.UIPATH_TENANT_NAME,
|
|
38653
|
+
tenantId: ctx.credentials.UIPATH_TENANT_ID,
|
|
38654
|
+
expiration: ctx.expiration,
|
|
38655
|
+
source: "file" /* File */,
|
|
38656
|
+
hint: globalHint,
|
|
38657
|
+
tokenRefresh: {
|
|
38658
|
+
attempted: false,
|
|
38659
|
+
success: false,
|
|
38660
|
+
errorMessage: `lock acquisition failed: ${msg}`
|
|
38661
|
+
}
|
|
38662
|
+
};
|
|
38663
|
+
}
|
|
38664
|
+
return {
|
|
38665
|
+
loginStatus: "Refresh Failed",
|
|
38666
|
+
hint: "Could not acquire the auth-file lock — too many concurrent `uip` processes, or a permission issue on the auth directory. Retry, or run 'uip login' to re-authenticate.",
|
|
38667
|
+
tokenRefresh: {
|
|
38668
|
+
attempted: false,
|
|
38669
|
+
success: false,
|
|
38670
|
+
errorMessage: `lock acquisition failed: ${msg}`
|
|
38671
|
+
}
|
|
38672
|
+
};
|
|
38673
|
+
}
|
|
39514
38674
|
async function runRefreshLocked(inputs) {
|
|
39515
38675
|
const {
|
|
39516
38676
|
absolutePath,
|
|
@@ -39520,7 +38680,10 @@ async function runRefreshLocked(inputs) {
|
|
|
39520
38680
|
loadEnvFile,
|
|
39521
38681
|
saveEnvFile,
|
|
39522
38682
|
refreshFn,
|
|
39523
|
-
resolveConfig: resolveConfig2
|
|
38683
|
+
resolveConfig: resolveConfig2,
|
|
38684
|
+
loadBreaker,
|
|
38685
|
+
saveBreaker,
|
|
38686
|
+
clearBreaker
|
|
39524
38687
|
} = inputs;
|
|
39525
38688
|
const expirationThreshold = computeExpirationThreshold(ensureTokenValidityMinutes);
|
|
39526
38689
|
let fresh;
|
|
@@ -39543,6 +38706,7 @@ async function runRefreshLocked(inputs) {
|
|
|
39543
38706
|
const freshAccess = fresh.UIPATH_ACCESS_TOKEN;
|
|
39544
38707
|
const freshExp = freshAccess ? getTokenExpiration(freshAccess) : undefined;
|
|
39545
38708
|
if (freshAccess && freshExp && freshExp > expirationThreshold) {
|
|
38709
|
+
await clearBreaker(absolutePath);
|
|
39546
38710
|
return {
|
|
39547
38711
|
kind: "ok",
|
|
39548
38712
|
accessToken: freshAccess,
|
|
@@ -39566,8 +38730,21 @@ async function runRefreshLocked(inputs) {
|
|
|
39566
38730
|
refreshedRefresh = refreshed.refreshToken;
|
|
39567
38731
|
} catch (error) {
|
|
39568
38732
|
const isOAuthFailure = isTokenRefreshOAuthFailure(error);
|
|
39569
|
-
const hint = isOAuthFailure ? "Run 'uip login' to re-authenticate — the stored refresh token is invalid or expired." : "Token refresh failed. Check your network connection, then retry or run 'uip login' to re-authenticate.";
|
|
38733
|
+
const hint = isOAuthFailure ? "Run 'uip login' to re-authenticate — the stored refresh token is invalid or expired. In a non-interactive context, authenticate with: uip login --client-id <id> --client-secret <secret> -t <tenant>." : "Token refresh failed. Check your network connection, then retry or run 'uip login' to re-authenticate.";
|
|
39570
38734
|
const message = isOAuthFailure ? normalizeTokenRefreshFailure() : normalizeTokenRefreshUnavailableFailure();
|
|
38735
|
+
const fp = await refreshTokenFingerprint(tokenForIdP);
|
|
38736
|
+
if (isOAuthFailure) {
|
|
38737
|
+
await saveBreaker(absolutePath, { deadTokenFp: fp });
|
|
38738
|
+
} else {
|
|
38739
|
+
const prior = await loadBreaker(absolutePath).catch(() => ({}));
|
|
38740
|
+
const attempts = (prior.attempts ?? 0) + 1;
|
|
38741
|
+
await saveBreaker(absolutePath, {
|
|
38742
|
+
...prior,
|
|
38743
|
+
deadTokenFp: undefined,
|
|
38744
|
+
attempts,
|
|
38745
|
+
backoffUntilMs: Date.now() + nextBackoffMs(attempts)
|
|
38746
|
+
});
|
|
38747
|
+
}
|
|
39571
38748
|
return {
|
|
39572
38749
|
kind: "fail",
|
|
39573
38750
|
status: {
|
|
@@ -39596,6 +38773,7 @@ async function runRefreshLocked(inputs) {
|
|
|
39596
38773
|
}
|
|
39597
38774
|
};
|
|
39598
38775
|
}
|
|
38776
|
+
await clearBreaker(absolutePath);
|
|
39599
38777
|
try {
|
|
39600
38778
|
await saveEnvFile({
|
|
39601
38779
|
envPath: absolutePath,
|
|
@@ -39628,212 +38806,15 @@ async function runRefreshLocked(inputs) {
|
|
|
39628
38806
|
};
|
|
39629
38807
|
}
|
|
39630
38808
|
}
|
|
39631
|
-
|
|
39632
|
-
|
|
39633
|
-
|
|
39634
|
-
|
|
39635
|
-
|
|
39636
|
-
|
|
39637
|
-
|
|
39638
|
-
|
|
39639
|
-
|
|
39640
|
-
} = deps;
|
|
39641
|
-
if (isRobotAuthEnforced()) {
|
|
39642
|
-
if (isEnvAuthEnabled()) {
|
|
39643
|
-
throw new EnvAuthConfigError(`${ENV_AUTH_ENABLE_VAR}=true and ${ENFORCE_ROBOT_AUTH_VAR}=true ` + `are mutually exclusive. Unset one of them and re-run.`);
|
|
39644
|
-
}
|
|
39645
|
-
const robotCreds = await robotFallback({ force: true });
|
|
39646
|
-
if (!robotCreds) {
|
|
39647
|
-
return {
|
|
39648
|
-
loginStatus: "Not logged in",
|
|
39649
|
-
hint: `${ENFORCE_ROBOT_AUTH_VAR}=true but the UiPath Robot ` + `session is unavailable. Start and sign in to the Assistant, ` + `or unset ${ENFORCE_ROBOT_AUTH_VAR} to fall back to file or ` + `env-var authentication.`
|
|
39650
|
-
};
|
|
39651
|
-
}
|
|
39652
|
-
const expiration2 = getTokenExpiration(robotCreds.accessToken);
|
|
39653
|
-
return {
|
|
39654
|
-
loginStatus: "Logged in",
|
|
39655
|
-
accessToken: robotCreds.accessToken,
|
|
39656
|
-
baseUrl: robotCreds.baseUrl,
|
|
39657
|
-
organizationName: robotCreds.organizationName,
|
|
39658
|
-
organizationId: robotCreds.organizationId,
|
|
39659
|
-
tenantName: robotCreds.tenantName,
|
|
39660
|
-
tenantId: robotCreds.tenantId,
|
|
39661
|
-
issuer: robotCreds.issuer,
|
|
39662
|
-
expiration: expiration2,
|
|
39663
|
-
source: "robot" /* Robot */
|
|
39664
|
-
};
|
|
39665
|
-
}
|
|
39666
|
-
if (isEnvAuthEnabled()) {
|
|
39667
|
-
return readAuthFromEnv();
|
|
39668
|
-
}
|
|
39669
|
-
const { envFilePath = DEFAULT_ENV_FILENAME, ensureTokenValidityMinutes } = options;
|
|
39670
|
-
const { absolutePath } = await resolveEnvFilePath(envFilePath);
|
|
39671
|
-
if (absolutePath === undefined) {
|
|
39672
|
-
const robotCreds = await robotFallback();
|
|
39673
|
-
if (robotCreds) {
|
|
39674
|
-
const expiration2 = getTokenExpiration(robotCreds.accessToken);
|
|
39675
|
-
const status = {
|
|
39676
|
-
loginStatus: "Logged in",
|
|
39677
|
-
accessToken: robotCreds.accessToken,
|
|
39678
|
-
baseUrl: robotCreds.baseUrl,
|
|
39679
|
-
organizationName: robotCreds.organizationName,
|
|
39680
|
-
organizationId: robotCreds.organizationId,
|
|
39681
|
-
tenantName: robotCreds.tenantName,
|
|
39682
|
-
tenantId: robotCreds.tenantId,
|
|
39683
|
-
issuer: robotCreds.issuer,
|
|
39684
|
-
expiration: expiration2,
|
|
39685
|
-
source: "robot" /* Robot */
|
|
39686
|
-
};
|
|
39687
|
-
return status;
|
|
39688
|
-
}
|
|
39689
|
-
return { loginStatus: "Not logged in" };
|
|
39690
|
-
}
|
|
39691
|
-
let credentials;
|
|
39692
|
-
try {
|
|
39693
|
-
credentials = await loadEnvFile({ envPath: absolutePath });
|
|
39694
|
-
} catch (error) {
|
|
39695
|
-
if (isFileNotFoundError(error)) {
|
|
39696
|
-
return { loginStatus: "Not logged in" };
|
|
39697
|
-
}
|
|
39698
|
-
throw error;
|
|
39699
|
-
}
|
|
39700
|
-
if (!credentials.UIPATH_ACCESS_TOKEN) {
|
|
39701
|
-
return { loginStatus: "Not logged in" };
|
|
39702
|
-
}
|
|
39703
|
-
let accessToken = credentials.UIPATH_ACCESS_TOKEN;
|
|
39704
|
-
let refreshToken = credentials.UIPATH_REFRESH_TOKEN;
|
|
39705
|
-
let expiration = getTokenExpiration(accessToken);
|
|
39706
|
-
let persistenceWarning;
|
|
39707
|
-
let lockReleaseFailed = false;
|
|
39708
|
-
let tokenRefresh;
|
|
39709
|
-
const outerThreshold = computeExpirationThreshold(ensureTokenValidityMinutes);
|
|
39710
|
-
const tryGlobalCredsHint = async () => {
|
|
39711
|
-
const fs7 = getFs();
|
|
39712
|
-
const globalPath = fs7.path.join(fs7.env.homedir(), envFilePath);
|
|
39713
|
-
if (absolutePath === globalPath)
|
|
39714
|
-
return;
|
|
39715
|
-
if (!await fs7.exists(globalPath))
|
|
39716
|
-
return;
|
|
39717
|
-
try {
|
|
39718
|
-
const globalCreds = await loadEnvFile({ envPath: globalPath });
|
|
39719
|
-
if (!globalCreds.UIPATH_ACCESS_TOKEN)
|
|
39720
|
-
return;
|
|
39721
|
-
const globalExp = getTokenExpiration(globalCreds.UIPATH_ACCESS_TOKEN);
|
|
39722
|
-
if (globalExp && globalExp <= new Date)
|
|
39723
|
-
return;
|
|
39724
|
-
return `Local credentials file at ${absolutePath} has expired credentials. Valid credentials exist in ${globalPath}. Remove the local file or run 'uip login' to re-authenticate.`;
|
|
39725
|
-
} catch {
|
|
39726
|
-
return;
|
|
39727
|
-
}
|
|
39728
|
-
};
|
|
39729
|
-
if (expiration && expiration <= outerThreshold && refreshToken) {
|
|
39730
|
-
let release;
|
|
39731
|
-
try {
|
|
39732
|
-
release = await getFs().acquireLock(absolutePath);
|
|
39733
|
-
} catch (error) {
|
|
39734
|
-
const msg = errorMessage(error);
|
|
39735
|
-
const globalHint = await tryGlobalCredsHint();
|
|
39736
|
-
if (globalHint) {
|
|
39737
|
-
return {
|
|
39738
|
-
loginStatus: "Expired",
|
|
39739
|
-
accessToken,
|
|
39740
|
-
refreshToken,
|
|
39741
|
-
baseUrl: credentials.UIPATH_URL,
|
|
39742
|
-
organizationName: credentials.UIPATH_ORGANIZATION_NAME,
|
|
39743
|
-
organizationId: credentials.UIPATH_ORGANIZATION_ID,
|
|
39744
|
-
tenantName: credentials.UIPATH_TENANT_NAME,
|
|
39745
|
-
tenantId: credentials.UIPATH_TENANT_ID,
|
|
39746
|
-
expiration,
|
|
39747
|
-
source: "file" /* File */,
|
|
39748
|
-
hint: globalHint,
|
|
39749
|
-
tokenRefresh: {
|
|
39750
|
-
attempted: false,
|
|
39751
|
-
success: false,
|
|
39752
|
-
errorMessage: `lock acquisition failed: ${msg}`
|
|
39753
|
-
}
|
|
39754
|
-
};
|
|
39755
|
-
}
|
|
39756
|
-
return {
|
|
39757
|
-
loginStatus: "Refresh Failed",
|
|
39758
|
-
hint: "Could not acquire the auth-file lock — too many concurrent `uip` processes, or a permission issue on the auth directory. Retry, or run 'uip login' to re-authenticate.",
|
|
39759
|
-
tokenRefresh: {
|
|
39760
|
-
attempted: false,
|
|
39761
|
-
success: false,
|
|
39762
|
-
errorMessage: `lock acquisition failed: ${msg}`
|
|
39763
|
-
}
|
|
39764
|
-
};
|
|
39765
|
-
}
|
|
39766
|
-
let lockedFailure;
|
|
39767
|
-
try {
|
|
39768
|
-
const outcome = await runRefreshLocked({
|
|
39769
|
-
absolutePath,
|
|
39770
|
-
refreshToken,
|
|
39771
|
-
customAuthority: credentials.UIPATH_URL,
|
|
39772
|
-
ensureTokenValidityMinutes,
|
|
39773
|
-
loadEnvFile,
|
|
39774
|
-
saveEnvFile,
|
|
39775
|
-
refreshFn: refreshTokenFn,
|
|
39776
|
-
resolveConfig: resolveConfig2
|
|
39777
|
-
});
|
|
39778
|
-
if (outcome.kind === "fail") {
|
|
39779
|
-
lockedFailure = outcome.status;
|
|
39780
|
-
} else {
|
|
39781
|
-
accessToken = outcome.accessToken;
|
|
39782
|
-
refreshToken = outcome.refreshToken;
|
|
39783
|
-
expiration = outcome.expiration;
|
|
39784
|
-
tokenRefresh = outcome.tokenRefresh;
|
|
39785
|
-
if (outcome.persistenceWarning) {
|
|
39786
|
-
persistenceWarning = outcome.persistenceWarning;
|
|
39787
|
-
}
|
|
39788
|
-
}
|
|
39789
|
-
} finally {
|
|
39790
|
-
try {
|
|
39791
|
-
await release();
|
|
39792
|
-
} catch {
|
|
39793
|
-
lockReleaseFailed = true;
|
|
39794
|
-
}
|
|
39795
|
-
}
|
|
39796
|
-
if (lockedFailure) {
|
|
39797
|
-
const globalHint = await tryGlobalCredsHint();
|
|
39798
|
-
const base = globalHint ? {
|
|
39799
|
-
...lockedFailure,
|
|
39800
|
-
loginStatus: "Expired",
|
|
39801
|
-
hint: globalHint
|
|
39802
|
-
} : lockedFailure;
|
|
39803
|
-
return lockReleaseFailed ? { ...base, lockReleaseFailed: true } : base;
|
|
39804
|
-
}
|
|
39805
|
-
}
|
|
39806
|
-
const result = {
|
|
39807
|
-
loginStatus: expiration && expiration <= new Date ? "Expired" : "Logged in",
|
|
39808
|
-
accessToken,
|
|
39809
|
-
refreshToken,
|
|
39810
|
-
baseUrl: credentials.UIPATH_URL,
|
|
39811
|
-
organizationName: credentials.UIPATH_ORGANIZATION_NAME,
|
|
39812
|
-
organizationId: credentials.UIPATH_ORGANIZATION_ID,
|
|
39813
|
-
tenantName: credentials.UIPATH_TENANT_NAME,
|
|
39814
|
-
tenantId: credentials.UIPATH_TENANT_ID,
|
|
39815
|
-
expiration,
|
|
39816
|
-
source: "file" /* File */,
|
|
39817
|
-
...persistenceWarning ? { hint: persistenceWarning, persistenceFailed: true } : {},
|
|
39818
|
-
...lockReleaseFailed ? { lockReleaseFailed: true } : {},
|
|
39819
|
-
...tokenRefresh ? { tokenRefresh } : {}
|
|
39820
|
-
};
|
|
39821
|
-
if (result.loginStatus === "Expired") {
|
|
39822
|
-
const globalHint = await tryGlobalCredsHint();
|
|
39823
|
-
if (globalHint) {
|
|
39824
|
-
result.hint = globalHint;
|
|
39825
|
-
}
|
|
39826
|
-
}
|
|
39827
|
-
return result;
|
|
39828
|
-
};
|
|
39829
|
-
var isFileNotFoundError = (error) => {
|
|
39830
|
-
if (!(error instanceof Object))
|
|
39831
|
-
return false;
|
|
39832
|
-
return error.code === "ENOENT";
|
|
39833
|
-
};
|
|
39834
|
-
var getLoginStatusAsync = async (options = {}) => {
|
|
39835
|
-
return getLoginStatusWithDeps(options);
|
|
39836
|
-
};
|
|
38809
|
+
function normalizeTokenRefreshFailure() {
|
|
38810
|
+
return "stored refresh token is invalid or expired";
|
|
38811
|
+
}
|
|
38812
|
+
function normalizeTokenRefreshUnavailableFailure() {
|
|
38813
|
+
return "token refresh failed before authentication completed";
|
|
38814
|
+
}
|
|
38815
|
+
function errorMessage(error) {
|
|
38816
|
+
return error instanceof Error ? error.message : String(error);
|
|
38817
|
+
}
|
|
39837
38818
|
|
|
39838
38819
|
// ../auth/src/authContext.ts
|
|
39839
38820
|
var getAuthContext = async (options = {}) => {
|
|
@@ -39868,6 +38849,14 @@ var getAuthContext = async (options = {}) => {
|
|
|
39868
38849
|
};
|
|
39869
38850
|
// ../auth/src/interactive.ts
|
|
39870
38851
|
init_src();
|
|
38852
|
+
|
|
38853
|
+
// ../auth/src/selectTenant.ts
|
|
38854
|
+
var TENANT_SELECTION_REQUIRED_CODE = "TENANT_SELECTION_REQUIRED";
|
|
38855
|
+
var INVALID_TENANT_CODE = "INVALID_TENANT";
|
|
38856
|
+
var TENANT_SELECTION_CODES = new Set([
|
|
38857
|
+
TENANT_SELECTION_REQUIRED_CODE,
|
|
38858
|
+
INVALID_TENANT_CODE
|
|
38859
|
+
]);
|
|
39871
38860
|
// ../auth/src/logout.ts
|
|
39872
38861
|
init_src();
|
|
39873
38862
|
|
|
@@ -40204,7 +39193,7 @@ class TextApiResponse3 {
|
|
|
40204
39193
|
var package_default3 = {
|
|
40205
39194
|
name: "@uipath/orchestrator-sdk",
|
|
40206
39195
|
license: "MIT",
|
|
40207
|
-
version: "1.
|
|
39196
|
+
version: "1.197.0",
|
|
40208
39197
|
repository: {
|
|
40209
39198
|
type: "git",
|
|
40210
39199
|
url: "https://github.com/UiPath/cli.git",
|
|
@@ -40238,7 +39227,7 @@ var package_default3 = {
|
|
|
40238
39227
|
],
|
|
40239
39228
|
private: true,
|
|
40240
39229
|
scripts: {
|
|
40241
|
-
build: "bun build ./src/index.ts --outdir dist --format esm --target node && bun build ./src/index.browser.ts --outdir dist --format esm --target browser --external @uipath/auth --external @uipath/common && tsc -p tsconfig.build.json --noCheck",
|
|
39230
|
+
build: "bun build ./src/index.ts --outdir dist --format esm --target node --sourcemap=linked && bun build ./src/index.browser.ts --outdir dist --format esm --target browser --external @uipath/auth --external @uipath/common --sourcemap=linked && tsc -p tsconfig.build.json --noCheck",
|
|
40242
39231
|
generate: "bun run src/scripts/generate-sdk.ts",
|
|
40243
39232
|
lint: "biome check .",
|
|
40244
39233
|
test: "vitest run",
|
|
@@ -43242,3 +42231,5 @@ export {
|
|
|
43242
42231
|
deployRunAsync,
|
|
43243
42232
|
activateDeploymentAsync
|
|
43244
42233
|
};
|
|
42234
|
+
|
|
42235
|
+
//# debugId=AA79FC1CA0530A4764756E2164756E21
|