@vention/vention-cli 0.36.4 → 0.36.5

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/main.esm.js CHANGED
@@ -3591,34 +3591,246 @@ for (var COLLECTION_NAME in DOMIterables) {
3591
3591
 
3592
3592
  handlePrototype(DOMTokenListPrototype, 'DOMTokenList');
3593
3593
 
3594
- var $$B = _export;
3594
+ var defineProperty = objectDefineProperty.f;
3595
+
3596
+ var proxyAccessor$2 = function (Target, Source, key) {
3597
+ key in Target || defineProperty(Target, key, {
3598
+ configurable: true,
3599
+ get: function () { return Source[key]; },
3600
+ set: function (it) { Source[key] = it; }
3601
+ });
3602
+ };
3603
+
3604
+ var isCallable$6 = isCallable$t;
3605
+ var isObject$9 = isObject$m;
3606
+ var setPrototypeOf$4 = objectSetPrototypeOf;
3607
+
3608
+ // makes subclassing work correct for wrapped built-ins
3609
+ var inheritIfRequired$4 = function ($this, dummy, Wrapper) {
3610
+ var NewTarget, NewTargetPrototype;
3611
+ if (
3612
+ // it can work only with native `setPrototypeOf`
3613
+ setPrototypeOf$4 &&
3614
+ // we haven't completely correct pre-ES6 way for getting `new.target`, so use this
3615
+ isCallable$6(NewTarget = dummy.constructor) &&
3616
+ NewTarget !== Wrapper &&
3617
+ isObject$9(NewTargetPrototype = NewTarget.prototype) &&
3618
+ NewTargetPrototype !== Wrapper.prototype
3619
+ ) setPrototypeOf$4($this, NewTargetPrototype);
3620
+ return $this;
3621
+ };
3622
+
3623
+ var toString$f = toString$j;
3624
+
3625
+ var normalizeStringArgument$1 = function (argument, $default) {
3626
+ return argument === undefined ? arguments.length < 2 ? '' : $default : toString$f(argument);
3627
+ };
3628
+
3629
+ var isObject$8 = isObject$m;
3630
+ var createNonEnumerableProperty$7 = createNonEnumerableProperty$d;
3631
+
3632
+ // `InstallErrorCause` abstract operation
3633
+ // https://tc39.es/ecma262/#sec-installerrorcause
3634
+ var installErrorCause$1 = function (O, options) {
3635
+ if (isObject$8(options) && 'cause' in options) {
3636
+ createNonEnumerableProperty$7(O, 'cause', options.cause);
3637
+ }
3638
+ };
3639
+
3640
+ var uncurryThis$v = functionUncurryThis;
3641
+
3642
+ var $Error = Error;
3643
+ var replace$7 = uncurryThis$v(''.replace);
3644
+
3645
+ var TEST = (function (arg) { return String(new $Error(arg).stack); })('zxcasd');
3646
+ // eslint-disable-next-line redos/no-vulnerable, sonarjs/slow-regex -- safe
3647
+ var V8_OR_CHAKRA_STACK_ENTRY = /\n\s*at [^:]*:[^\n]*/;
3648
+ var IS_V8_OR_CHAKRA_STACK = V8_OR_CHAKRA_STACK_ENTRY.test(TEST);
3649
+
3650
+ var errorStackClear = function (stack, dropEntries) {
3651
+ if (IS_V8_OR_CHAKRA_STACK && typeof stack == 'string' && !$Error.prepareStackTrace) {
3652
+ while (dropEntries--) stack = replace$7(stack, V8_OR_CHAKRA_STACK_ENTRY, '');
3653
+ } return stack;
3654
+ };
3655
+
3656
+ var fails$m = fails$F;
3657
+ var createPropertyDescriptor$2 = createPropertyDescriptor$7;
3658
+
3659
+ var errorStackInstallable = !fails$m(function () {
3660
+ var error = new Error('a');
3661
+ if (!('stack' in error)) return true;
3662
+ // eslint-disable-next-line es/no-object-defineproperty -- safe
3663
+ Object.defineProperty(error, 'stack', createPropertyDescriptor$2(1, 7));
3664
+ return error.stack !== 7;
3665
+ });
3666
+
3667
+ var createNonEnumerableProperty$6 = createNonEnumerableProperty$d;
3668
+ var clearErrorStack = errorStackClear;
3669
+ var ERROR_STACK_INSTALLABLE = errorStackInstallable;
3670
+
3671
+ // non-standard V8
3672
+ // eslint-disable-next-line es/no-nonstandard-error-properties -- safe
3673
+ var captureStackTrace = Error.captureStackTrace;
3674
+
3675
+ var errorStackInstall = function (error, C, stack, dropEntries) {
3676
+ if (ERROR_STACK_INSTALLABLE) {
3677
+ if (captureStackTrace) captureStackTrace(error, C);
3678
+ else createNonEnumerableProperty$6(error, 'stack', clearErrorStack(stack, dropEntries));
3679
+ }
3680
+ };
3681
+
3682
+ var getBuiltIn$3 = getBuiltIn$c;
3683
+ var hasOwn$8 = hasOwnProperty_1;
3684
+ var createNonEnumerableProperty$5 = createNonEnumerableProperty$d;
3685
+ var isPrototypeOf$4 = objectIsPrototypeOf;
3686
+ var setPrototypeOf$3 = objectSetPrototypeOf;
3687
+ var copyConstructorProperties$1 = copyConstructorProperties$4;
3688
+ var proxyAccessor$1 = proxyAccessor$2;
3689
+ var inheritIfRequired$3 = inheritIfRequired$4;
3690
+ var normalizeStringArgument = normalizeStringArgument$1;
3691
+ var installErrorCause = installErrorCause$1;
3692
+ var installErrorStack = errorStackInstall;
3595
3693
  var DESCRIPTORS$c = descriptors;
3694
+
3695
+ var wrapErrorConstructorWithCause$1 = function (FULL_NAME, wrapper, FORCED, IS_AGGREGATE_ERROR) {
3696
+ var STACK_TRACE_LIMIT = 'stackTraceLimit';
3697
+ var OPTIONS_POSITION = IS_AGGREGATE_ERROR ? 2 : 1;
3698
+ var path = FULL_NAME.split('.');
3699
+ var ERROR_NAME = path[path.length - 1];
3700
+ var OriginalError = getBuiltIn$3.apply(null, path);
3701
+
3702
+ if (!OriginalError) return;
3703
+
3704
+ var OriginalErrorPrototype = OriginalError.prototype;
3705
+
3706
+ // V8 9.3- bug https://bugs.chromium.org/p/v8/issues/detail?id=12006
3707
+ if (hasOwn$8(OriginalErrorPrototype, 'cause')) delete OriginalErrorPrototype.cause;
3708
+
3709
+ if (!FORCED) return OriginalError;
3710
+
3711
+ var BaseError = getBuiltIn$3('Error');
3712
+
3713
+ var WrappedError = wrapper(function (a, b) {
3714
+ var message = normalizeStringArgument(IS_AGGREGATE_ERROR ? b : a, undefined);
3715
+ var result = IS_AGGREGATE_ERROR ? new OriginalError(a) : new OriginalError();
3716
+ if (message !== undefined) createNonEnumerableProperty$5(result, 'message', message);
3717
+ installErrorStack(result, WrappedError, result.stack, 2);
3718
+ if (this && isPrototypeOf$4(OriginalErrorPrototype, this)) inheritIfRequired$3(result, this, WrappedError);
3719
+ if (arguments.length > OPTIONS_POSITION) installErrorCause(result, arguments[OPTIONS_POSITION]);
3720
+ return result;
3721
+ });
3722
+
3723
+ WrappedError.prototype = OriginalErrorPrototype;
3724
+
3725
+ if (ERROR_NAME !== 'Error') {
3726
+ if (setPrototypeOf$3) setPrototypeOf$3(WrappedError, BaseError);
3727
+ else copyConstructorProperties$1(WrappedError, BaseError, { name: true });
3728
+ } else if (DESCRIPTORS$c && STACK_TRACE_LIMIT in OriginalError) {
3729
+ proxyAccessor$1(WrappedError, OriginalError, STACK_TRACE_LIMIT);
3730
+ proxyAccessor$1(WrappedError, OriginalError, 'prepareStackTrace');
3731
+ }
3732
+
3733
+ copyConstructorProperties$1(WrappedError, OriginalError);
3734
+
3735
+ try {
3736
+ // Safari 13- bug: WebAssembly errors does not have a proper `.name`
3737
+ if (OriginalErrorPrototype.name !== ERROR_NAME) {
3738
+ createNonEnumerableProperty$5(OriginalErrorPrototype, 'name', ERROR_NAME);
3739
+ }
3740
+ OriginalErrorPrototype.constructor = WrappedError;
3741
+ } catch (error) { /* empty */ }
3742
+
3743
+ return WrappedError;
3744
+ };
3745
+
3746
+ /* eslint-disable no-unused-vars -- required for functions `.length` */
3747
+ var $$B = _export;
3596
3748
  var globalThis$t = globalThis_1;
3597
- var getBuiltIn$3 = getBuiltIn$c;
3598
- var uncurryThis$v = functionUncurryThis;
3749
+ var apply$2 = functionApply;
3750
+ var wrapErrorConstructorWithCause = wrapErrorConstructorWithCause$1;
3751
+
3752
+ var WEB_ASSEMBLY = 'WebAssembly';
3753
+ var WebAssembly = globalThis$t[WEB_ASSEMBLY];
3754
+
3755
+ // eslint-disable-next-line es/no-error-cause -- feature detection
3756
+ var FORCED$7 = new Error('e', { cause: 7 }).cause !== 7;
3757
+
3758
+ var exportGlobalErrorCauseWrapper = function (ERROR_NAME, wrapper) {
3759
+ var O = {};
3760
+ // eslint-disable-next-line unicorn/no-immediate-mutation -- ES3 syntax limitation
3761
+ O[ERROR_NAME] = wrapErrorConstructorWithCause(ERROR_NAME, wrapper, FORCED$7);
3762
+ $$B({ global: true, constructor: true, arity: 1, forced: FORCED$7 }, O);
3763
+ };
3764
+
3765
+ var exportWebAssemblyErrorCauseWrapper = function (ERROR_NAME, wrapper) {
3766
+ if (WebAssembly && WebAssembly[ERROR_NAME]) {
3767
+ var O = {};
3768
+ // eslint-disable-next-line unicorn/no-immediate-mutation -- ES3 syntax limitation
3769
+ O[ERROR_NAME] = wrapErrorConstructorWithCause(WEB_ASSEMBLY + '.' + ERROR_NAME, wrapper, FORCED$7);
3770
+ $$B({ target: WEB_ASSEMBLY, stat: true, constructor: true, arity: 1, forced: FORCED$7 }, O);
3771
+ }
3772
+ };
3773
+
3774
+ // https://tc39.es/ecma262/#sec-nativeerror
3775
+ exportGlobalErrorCauseWrapper('Error', function (init) {
3776
+ return function Error(message) { return apply$2(init, this, arguments); };
3777
+ });
3778
+ exportGlobalErrorCauseWrapper('EvalError', function (init) {
3779
+ return function EvalError(message) { return apply$2(init, this, arguments); };
3780
+ });
3781
+ exportGlobalErrorCauseWrapper('RangeError', function (init) {
3782
+ return function RangeError(message) { return apply$2(init, this, arguments); };
3783
+ });
3784
+ exportGlobalErrorCauseWrapper('ReferenceError', function (init) {
3785
+ return function ReferenceError(message) { return apply$2(init, this, arguments); };
3786
+ });
3787
+ exportGlobalErrorCauseWrapper('SyntaxError', function (init) {
3788
+ return function SyntaxError(message) { return apply$2(init, this, arguments); };
3789
+ });
3790
+ exportGlobalErrorCauseWrapper('TypeError', function (init) {
3791
+ return function TypeError(message) { return apply$2(init, this, arguments); };
3792
+ });
3793
+ exportGlobalErrorCauseWrapper('URIError', function (init) {
3794
+ return function URIError(message) { return apply$2(init, this, arguments); };
3795
+ });
3796
+ exportWebAssemblyErrorCauseWrapper('CompileError', function (init) {
3797
+ return function CompileError(message) { return apply$2(init, this, arguments); };
3798
+ });
3799
+ exportWebAssemblyErrorCauseWrapper('LinkError', function (init) {
3800
+ return function LinkError(message) { return apply$2(init, this, arguments); };
3801
+ });
3802
+ exportWebAssemblyErrorCauseWrapper('RuntimeError', function (init) {
3803
+ return function RuntimeError(message) { return apply$2(init, this, arguments); };
3804
+ });
3805
+
3806
+ var $$A = _export;
3807
+ var DESCRIPTORS$b = descriptors;
3808
+ var globalThis$s = globalThis_1;
3809
+ var getBuiltIn$2 = getBuiltIn$c;
3810
+ var uncurryThis$u = functionUncurryThis;
3599
3811
  var call$l = functionCall;
3600
- var isCallable$6 = isCallable$t;
3601
- var isObject$9 = isObject$m;
3812
+ var isCallable$5 = isCallable$t;
3813
+ var isObject$7 = isObject$m;
3602
3814
  var isArray$3 = isArray$5;
3603
- var hasOwn$8 = hasOwnProperty_1;
3604
- var toString$f = toString$j;
3815
+ var hasOwn$7 = hasOwnProperty_1;
3816
+ var toString$e = toString$j;
3605
3817
  var lengthOfArrayLike$d = lengthOfArrayLike$g;
3606
3818
  var createProperty$3 = createProperty$6;
3607
- var fails$m = fails$F;
3819
+ var fails$l = fails$F;
3608
3820
  var parseJSONString = parseJsonString;
3609
3821
  var NATIVE_SYMBOL = symbolConstructorDetection;
3610
3822
 
3611
- var JSON$1 = globalThis$t.JSON;
3612
- var Number$1 = globalThis$t.Number;
3613
- var SyntaxError$4 = globalThis$t.SyntaxError;
3823
+ var JSON$1 = globalThis$s.JSON;
3824
+ var Number$1 = globalThis$s.Number;
3825
+ var SyntaxError$4 = globalThis$s.SyntaxError;
3614
3826
  var nativeParse = JSON$1 && JSON$1.parse;
3615
- var enumerableOwnProperties = getBuiltIn$3('Object', 'keys');
3827
+ var enumerableOwnProperties = getBuiltIn$2('Object', 'keys');
3616
3828
  // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
3617
3829
  var getOwnPropertyDescriptor$3 = Object.getOwnPropertyDescriptor;
3618
- var at$1 = uncurryThis$v(''.charAt);
3619
- var slice$3 = uncurryThis$v(''.slice);
3620
- var exec$5 = uncurryThis$v(/./.exec);
3621
- var push$6 = uncurryThis$v([].push);
3830
+ var at$1 = uncurryThis$u(''.charAt);
3831
+ var slice$3 = uncurryThis$u(''.slice);
3832
+ var exec$5 = uncurryThis$u(/./.exec);
3833
+ var push$6 = uncurryThis$u([].push);
3622
3834
 
3623
3835
  var IS_DIGIT = /^\d$/;
3624
3836
  var IS_NON_ZERO_DIGIT = /^[1-9]$/;
@@ -3629,7 +3841,7 @@ var PRIMITIVE = 0;
3629
3841
  var OBJECT = 1;
3630
3842
 
3631
3843
  var $parse = function (source, reviver) {
3632
- source = toString$f(source);
3844
+ source = toString$e(source);
3633
3845
  var context = new Context(source, 0);
3634
3846
  var root = context.parse();
3635
3847
  var value = root.value;
@@ -3637,7 +3849,7 @@ var $parse = function (source, reviver) {
3637
3849
  if (endIndex < source.length) {
3638
3850
  throw new SyntaxError$4('Unexpected extra character: "' + at$1(source, endIndex) + '" after the parsed data at: ' + endIndex);
3639
3851
  }
3640
- return isCallable$6(reviver) ? internalize({ '': value }, '', reviver, root) : value;
3852
+ return isCallable$5(reviver) ? internalize({ '': value }, '', reviver, root) : value;
3641
3853
  };
3642
3854
 
3643
3855
  var internalize = function (holder, name, reviver, node) {
@@ -3645,7 +3857,7 @@ var internalize = function (holder, name, reviver, node) {
3645
3857
  var unmodified = node && val === node.value;
3646
3858
  var context = unmodified && typeof node.source == 'string' ? { source: node.source } : {};
3647
3859
  var elementRecordsLen, keys, len, i, P;
3648
- if (isObject$9(val)) {
3860
+ if (isObject$7(val)) {
3649
3861
  var nodeIsArray = isArray$3(val);
3650
3862
  var nodes = unmodified ? node.nodes : nodeIsArray ? [] : {};
3651
3863
  if (nodeIsArray) {
@@ -3659,7 +3871,7 @@ var internalize = function (holder, name, reviver, node) {
3659
3871
  len = lengthOfArrayLike$d(keys);
3660
3872
  for (i = 0; i < len; i++) {
3661
3873
  P = keys[i];
3662
- internalizeProperty(val, P, internalize(val, P, reviver, hasOwn$8(nodes, P) ? nodes[P] : undefined));
3874
+ internalizeProperty(val, P, internalize(val, P, reviver, hasOwn$7(nodes, P) ? nodes[P] : undefined));
3663
3875
  }
3664
3876
  }
3665
3877
  }
@@ -3667,7 +3879,7 @@ var internalize = function (holder, name, reviver, node) {
3667
3879
  };
3668
3880
 
3669
3881
  var internalizeProperty = function (object, key, value) {
3670
- if (DESCRIPTORS$c) {
3882
+ if (DESCRIPTORS$b) {
3671
3883
  var descriptor = getOwnPropertyDescriptor$3(object, key);
3672
3884
  if (descriptor && !descriptor.configurable) return;
3673
3885
  }
@@ -3831,7 +4043,7 @@ Context.prototype = {
3831
4043
  }
3832
4044
  };
3833
4045
 
3834
- var NO_SOURCE_SUPPORT = fails$m(function () {
4046
+ var NO_SOURCE_SUPPORT = fails$l(function () {
3835
4047
  var unsafeInt = '9007199254740993';
3836
4048
  var source;
3837
4049
  nativeParse(unsafeInt, function (key, value, context) {
@@ -3840,7 +4052,7 @@ var NO_SOURCE_SUPPORT = fails$m(function () {
3840
4052
  return source !== unsafeInt;
3841
4053
  });
3842
4054
 
3843
- var PROPER_BASE_PARSE = NATIVE_SYMBOL && !fails$m(function () {
4055
+ var PROPER_BASE_PARSE = NATIVE_SYMBOL && !fails$l(function () {
3844
4056
  // Safari 9 bug
3845
4057
  return 1 / nativeParse('-0 \t') !== -Infinity;
3846
4058
  });
@@ -3848,9 +4060,42 @@ var PROPER_BASE_PARSE = NATIVE_SYMBOL && !fails$m(function () {
3848
4060
  // `JSON.parse` method
3849
4061
  // https://tc39.es/ecma262/#sec-json.parse
3850
4062
  // https://github.com/tc39/proposal-json-parse-with-source
3851
- $$B({ target: 'JSON', stat: true, forced: NO_SOURCE_SUPPORT }, {
4063
+ $$A({ target: 'JSON', stat: true, forced: NO_SOURCE_SUPPORT }, {
3852
4064
  parse: function parse(text, reviver) {
3853
- return PROPER_BASE_PARSE && !isCallable$6(reviver) ? nativeParse(text) : $parse(text, reviver);
4065
+ return PROPER_BASE_PARSE && !isCallable$5(reviver) ? nativeParse(text) : $parse(text, reviver);
4066
+ }
4067
+ });
4068
+
4069
+ var $$z = _export;
4070
+ var uncurryThis$t = functionUncurryThisClause;
4071
+ var getOwnPropertyDescriptor$2 = objectGetOwnPropertyDescriptor.f;
4072
+ var toLength$5 = toLength$7;
4073
+ var toString$d = toString$j;
4074
+ var notARegExp$1 = notARegexp;
4075
+ var requireObjectCoercible$6 = requireObjectCoercible$b;
4076
+ var correctIsRegExpLogic$1 = correctIsRegexpLogic;
4077
+
4078
+ var slice$2 = uncurryThis$t(''.slice);
4079
+ var min$4 = Math.min;
4080
+
4081
+ var CORRECT_IS_REGEXP_LOGIC$1 = correctIsRegExpLogic$1('endsWith');
4082
+ // https://github.com/zloirock/core-js/pull/702
4083
+ var MDN_POLYFILL_BUG$1 = !CORRECT_IS_REGEXP_LOGIC$1 && !!function () {
4084
+ var descriptor = getOwnPropertyDescriptor$2(String.prototype, 'endsWith');
4085
+ return descriptor && !descriptor.writable;
4086
+ }();
4087
+
4088
+ // `String.prototype.endsWith` method
4089
+ // https://tc39.es/ecma262/#sec-string.prototype.endswith
4090
+ $$z({ target: 'String', proto: true, forced: !MDN_POLYFILL_BUG$1 && !CORRECT_IS_REGEXP_LOGIC$1 }, {
4091
+ endsWith: function endsWith(searchString /* , endPosition = @length */) {
4092
+ var that = toString$d(requireObjectCoercible$6(this));
4093
+ notARegExp$1(searchString);
4094
+ var search = toString$d(searchString);
4095
+ var endPosition = arguments.length > 1 ? arguments[1] : undefined;
4096
+ var len = that.length;
4097
+ var end = endPosition === undefined ? len : min$4(toLength$5(endPosition), len);
4098
+ return slice$2(that, end - search.length, end) === search;
3854
4099
  }
3855
4100
  });
3856
4101
 
@@ -3881,234 +4126,35 @@ const loadSession = async ({
3881
4126
  }
3882
4127
  return null;
3883
4128
  }
3884
- };
3885
-
3886
- var $$A = _export;
3887
- var globalThis$s = globalThis_1;
3888
-
3889
- // `globalThis` object
3890
- // https://tc39.es/ecma262/#sec-globalthis
3891
- $$A({ global: true, forced: globalThis$s.globalThis !== globalThis$s }, {
3892
- globalThis: globalThis$s
3893
- });
3894
-
3895
- var version = "0.36.4";
3896
- var packageJson$1 = {
3897
- version: version};
3898
-
3899
- var defineProperty = objectDefineProperty.f;
3900
-
3901
- var proxyAccessor$2 = function (Target, Source, key) {
3902
- key in Target || defineProperty(Target, key, {
3903
- configurable: true,
3904
- get: function () { return Source[key]; },
3905
- set: function (it) { Source[key] = it; }
3906
- });
3907
- };
3908
-
3909
- var isCallable$5 = isCallable$t;
3910
- var isObject$8 = isObject$m;
3911
- var setPrototypeOf$4 = objectSetPrototypeOf;
3912
-
3913
- // makes subclassing work correct for wrapped built-ins
3914
- var inheritIfRequired$4 = function ($this, dummy, Wrapper) {
3915
- var NewTarget, NewTargetPrototype;
3916
- if (
3917
- // it can work only with native `setPrototypeOf`
3918
- setPrototypeOf$4 &&
3919
- // we haven't completely correct pre-ES6 way for getting `new.target`, so use this
3920
- isCallable$5(NewTarget = dummy.constructor) &&
3921
- NewTarget !== Wrapper &&
3922
- isObject$8(NewTargetPrototype = NewTarget.prototype) &&
3923
- NewTargetPrototype !== Wrapper.prototype
3924
- ) setPrototypeOf$4($this, NewTargetPrototype);
3925
- return $this;
3926
- };
3927
-
3928
- var toString$e = toString$j;
3929
-
3930
- var normalizeStringArgument$1 = function (argument, $default) {
3931
- return argument === undefined ? arguments.length < 2 ? '' : $default : toString$e(argument);
3932
- };
3933
-
3934
- var isObject$7 = isObject$m;
3935
- var createNonEnumerableProperty$7 = createNonEnumerableProperty$d;
3936
-
3937
- // `InstallErrorCause` abstract operation
3938
- // https://tc39.es/ecma262/#sec-installerrorcause
3939
- var installErrorCause$1 = function (O, options) {
3940
- if (isObject$7(options) && 'cause' in options) {
3941
- createNonEnumerableProperty$7(O, 'cause', options.cause);
3942
- }
3943
- };
3944
-
3945
- var uncurryThis$u = functionUncurryThis;
3946
-
3947
- var $Error = Error;
3948
- var replace$7 = uncurryThis$u(''.replace);
3949
-
3950
- var TEST = (function (arg) { return String(new $Error(arg).stack); })('zxcasd');
3951
- // eslint-disable-next-line redos/no-vulnerable, sonarjs/slow-regex -- safe
3952
- var V8_OR_CHAKRA_STACK_ENTRY = /\n\s*at [^:]*:[^\n]*/;
3953
- var IS_V8_OR_CHAKRA_STACK = V8_OR_CHAKRA_STACK_ENTRY.test(TEST);
3954
-
3955
- var errorStackClear = function (stack, dropEntries) {
3956
- if (IS_V8_OR_CHAKRA_STACK && typeof stack == 'string' && !$Error.prepareStackTrace) {
3957
- while (dropEntries--) stack = replace$7(stack, V8_OR_CHAKRA_STACK_ENTRY, '');
3958
- } return stack;
3959
- };
3960
-
3961
- var fails$l = fails$F;
3962
- var createPropertyDescriptor$2 = createPropertyDescriptor$7;
3963
-
3964
- var errorStackInstallable = !fails$l(function () {
3965
- var error = new Error('a');
3966
- if (!('stack' in error)) return true;
3967
- // eslint-disable-next-line es/no-object-defineproperty -- safe
3968
- Object.defineProperty(error, 'stack', createPropertyDescriptor$2(1, 7));
3969
- return error.stack !== 7;
3970
- });
3971
-
3972
- var createNonEnumerableProperty$6 = createNonEnumerableProperty$d;
3973
- var clearErrorStack = errorStackClear;
3974
- var ERROR_STACK_INSTALLABLE = errorStackInstallable;
3975
-
3976
- // non-standard V8
3977
- // eslint-disable-next-line es/no-nonstandard-error-properties -- safe
3978
- var captureStackTrace = Error.captureStackTrace;
3979
-
3980
- var errorStackInstall = function (error, C, stack, dropEntries) {
3981
- if (ERROR_STACK_INSTALLABLE) {
3982
- if (captureStackTrace) captureStackTrace(error, C);
3983
- else createNonEnumerableProperty$6(error, 'stack', clearErrorStack(stack, dropEntries));
3984
- }
3985
- };
3986
-
3987
- var getBuiltIn$2 = getBuiltIn$c;
3988
- var hasOwn$7 = hasOwnProperty_1;
3989
- var createNonEnumerableProperty$5 = createNonEnumerableProperty$d;
3990
- var isPrototypeOf$4 = objectIsPrototypeOf;
3991
- var setPrototypeOf$3 = objectSetPrototypeOf;
3992
- var copyConstructorProperties$1 = copyConstructorProperties$4;
3993
- var proxyAccessor$1 = proxyAccessor$2;
3994
- var inheritIfRequired$3 = inheritIfRequired$4;
3995
- var normalizeStringArgument = normalizeStringArgument$1;
3996
- var installErrorCause = installErrorCause$1;
3997
- var installErrorStack = errorStackInstall;
3998
- var DESCRIPTORS$b = descriptors;
3999
-
4000
- var wrapErrorConstructorWithCause$1 = function (FULL_NAME, wrapper, FORCED, IS_AGGREGATE_ERROR) {
4001
- var STACK_TRACE_LIMIT = 'stackTraceLimit';
4002
- var OPTIONS_POSITION = IS_AGGREGATE_ERROR ? 2 : 1;
4003
- var path = FULL_NAME.split('.');
4004
- var ERROR_NAME = path[path.length - 1];
4005
- var OriginalError = getBuiltIn$2.apply(null, path);
4006
-
4007
- if (!OriginalError) return;
4008
-
4009
- var OriginalErrorPrototype = OriginalError.prototype;
4010
-
4011
- // V8 9.3- bug https://bugs.chromium.org/p/v8/issues/detail?id=12006
4012
- if (hasOwn$7(OriginalErrorPrototype, 'cause')) delete OriginalErrorPrototype.cause;
4013
-
4014
- if (!FORCED) return OriginalError;
4015
-
4016
- var BaseError = getBuiltIn$2('Error');
4017
-
4018
- var WrappedError = wrapper(function (a, b) {
4019
- var message = normalizeStringArgument(IS_AGGREGATE_ERROR ? b : a, undefined);
4020
- var result = IS_AGGREGATE_ERROR ? new OriginalError(a) : new OriginalError();
4021
- if (message !== undefined) createNonEnumerableProperty$5(result, 'message', message);
4022
- installErrorStack(result, WrappedError, result.stack, 2);
4023
- if (this && isPrototypeOf$4(OriginalErrorPrototype, this)) inheritIfRequired$3(result, this, WrappedError);
4024
- if (arguments.length > OPTIONS_POSITION) installErrorCause(result, arguments[OPTIONS_POSITION]);
4025
- return result;
4026
- });
4027
-
4028
- WrappedError.prototype = OriginalErrorPrototype;
4029
-
4030
- if (ERROR_NAME !== 'Error') {
4031
- if (setPrototypeOf$3) setPrototypeOf$3(WrappedError, BaseError);
4032
- else copyConstructorProperties$1(WrappedError, BaseError, { name: true });
4033
- } else if (DESCRIPTORS$b && STACK_TRACE_LIMIT in OriginalError) {
4034
- proxyAccessor$1(WrappedError, OriginalError, STACK_TRACE_LIMIT);
4035
- proxyAccessor$1(WrappedError, OriginalError, 'prepareStackTrace');
4036
- }
4037
-
4038
- copyConstructorProperties$1(WrappedError, OriginalError);
4039
-
4040
- try {
4041
- // Safari 13- bug: WebAssembly errors does not have a proper `.name`
4042
- if (OriginalErrorPrototype.name !== ERROR_NAME) {
4043
- createNonEnumerableProperty$5(OriginalErrorPrototype, 'name', ERROR_NAME);
4044
- }
4045
- OriginalErrorPrototype.constructor = WrappedError;
4046
- } catch (error) { /* empty */ }
4047
-
4048
- return WrappedError;
4049
- };
4050
-
4051
- /* eslint-disable no-unused-vars -- required for functions `.length` */
4052
- var $$z = _export;
4053
- var globalThis$r = globalThis_1;
4054
- var apply$2 = functionApply;
4055
- var wrapErrorConstructorWithCause = wrapErrorConstructorWithCause$1;
4056
-
4057
- var WEB_ASSEMBLY = 'WebAssembly';
4058
- var WebAssembly = globalThis$r[WEB_ASSEMBLY];
4059
-
4060
- // eslint-disable-next-line es/no-error-cause -- feature detection
4061
- var FORCED$7 = new Error('e', { cause: 7 }).cause !== 7;
4062
-
4063
- var exportGlobalErrorCauseWrapper = function (ERROR_NAME, wrapper) {
4064
- var O = {};
4065
- // eslint-disable-next-line unicorn/no-immediate-mutation -- ES3 syntax limitation
4066
- O[ERROR_NAME] = wrapErrorConstructorWithCause(ERROR_NAME, wrapper, FORCED$7);
4067
- $$z({ global: true, constructor: true, arity: 1, forced: FORCED$7 }, O);
4068
- };
4069
-
4070
- var exportWebAssemblyErrorCauseWrapper = function (ERROR_NAME, wrapper) {
4071
- if (WebAssembly && WebAssembly[ERROR_NAME]) {
4072
- var O = {};
4073
- // eslint-disable-next-line unicorn/no-immediate-mutation -- ES3 syntax limitation
4074
- O[ERROR_NAME] = wrapErrorConstructorWithCause(WEB_ASSEMBLY + '.' + ERROR_NAME, wrapper, FORCED$7);
4075
- $$z({ target: WEB_ASSEMBLY, stat: true, constructor: true, arity: 1, forced: FORCED$7 }, O);
4076
- }
4077
- };
4078
-
4079
- // https://tc39.es/ecma262/#sec-nativeerror
4080
- exportGlobalErrorCauseWrapper('Error', function (init) {
4081
- return function Error(message) { return apply$2(init, this, arguments); };
4082
- });
4083
- exportGlobalErrorCauseWrapper('EvalError', function (init) {
4084
- return function EvalError(message) { return apply$2(init, this, arguments); };
4085
- });
4086
- exportGlobalErrorCauseWrapper('RangeError', function (init) {
4087
- return function RangeError(message) { return apply$2(init, this, arguments); };
4088
- });
4089
- exportGlobalErrorCauseWrapper('ReferenceError', function (init) {
4090
- return function ReferenceError(message) { return apply$2(init, this, arguments); };
4091
- });
4092
- exportGlobalErrorCauseWrapper('SyntaxError', function (init) {
4093
- return function SyntaxError(message) { return apply$2(init, this, arguments); };
4094
- });
4095
- exportGlobalErrorCauseWrapper('TypeError', function (init) {
4096
- return function TypeError(message) { return apply$2(init, this, arguments); };
4097
- });
4098
- exportGlobalErrorCauseWrapper('URIError', function (init) {
4099
- return function URIError(message) { return apply$2(init, this, arguments); };
4100
- });
4101
- exportWebAssemblyErrorCauseWrapper('CompileError', function (init) {
4102
- return function CompileError(message) { return apply$2(init, this, arguments); };
4103
- });
4104
- exportWebAssemblyErrorCauseWrapper('LinkError', function (init) {
4105
- return function LinkError(message) { return apply$2(init, this, arguments); };
4106
- });
4107
- exportWebAssemblyErrorCauseWrapper('RuntimeError', function (init) {
4108
- return function RuntimeError(message) { return apply$2(init, this, arguments); };
4109
- });
4129
+ };
4130
+ const originSchema = z.url({
4131
+ protocol: /^https$/
4132
+ }).refine(url => !url.endsWith("/"));
4133
+ const getOriginOverride = variableName => {
4134
+ const override = process.env[variableName];
4135
+ if (!override) {
4136
+ return undefined;
4137
+ }
4138
+ if (!originSchema.safeParse(override).success) {
4139
+ throw new Error(`${variableName} must be an https URL without a trailing slash`);
4140
+ }
4141
+ return override;
4142
+ };
4110
4143
 
4111
4144
  var $$y = _export;
4145
+ var globalThis$r = globalThis_1;
4146
+
4147
+ // `globalThis` object
4148
+ // https://tc39.es/ecma262/#sec-globalthis
4149
+ $$y({ global: true, forced: globalThis$r.globalThis !== globalThis$r }, {
4150
+ globalThis: globalThis$r
4151
+ });
4152
+
4153
+ var version = "0.36.5";
4154
+ var packageJson$1 = {
4155
+ version: version};
4156
+
4157
+ var $$x = _export;
4112
4158
  var call$k = functionCall;
4113
4159
  var iterate$4 = iterate$8;
4114
4160
  var aCallable$b = aCallable$l;
@@ -4121,7 +4167,7 @@ var forEachWithoutClosingOnEarlyError = iteratorHelperWithoutClosingOnEarlyError
4121
4167
 
4122
4168
  // `Iterator.prototype.forEach` method
4123
4169
  // https://tc39.es/ecma262/#sec-iterator.prototype.foreach
4124
- $$y({ target: 'Iterator', proto: true, real: true, forced: forEachWithoutClosingOnEarlyError }, {
4170
+ $$x({ target: 'Iterator', proto: true, real: true, forced: forEachWithoutClosingOnEarlyError }, {
4125
4171
  forEach: function forEach(fn) {
4126
4172
  anObject$c(this);
4127
4173
  try {
@@ -4150,6 +4196,7 @@ class ApiError extends Error {
4150
4196
  this.name = "ApiError";
4151
4197
  }
4152
4198
  }
4199
+ const buildApiError = (response, responseBody, url) => new ApiError(`Request failed: ${response.status} ${response.statusText}`, response.status, response.statusText, responseBody, url);
4153
4200
  async function assertApiResponseOk(res, url) {
4154
4201
  if (!res.ok) {
4155
4202
  let responseBody;
@@ -4160,7 +4207,7 @@ async function assertApiResponseOk(res, url) {
4160
4207
  } catch (_a) {
4161
4208
  responseBody = text || null;
4162
4209
  }
4163
- throw new ApiError(`Request failed: ${res.status} ${res.statusText}`, res.status, res.statusText, responseBody, url);
4210
+ throw buildApiError(res, responseBody, url);
4164
4211
  }
4165
4212
  }
4166
4213
  const ERROR_SUGGESTIONS = {
@@ -4237,10 +4284,11 @@ const fetchJson = async (url, options = {}) => {
4237
4284
  const {
4238
4285
  method = "GET",
4239
4286
  headers = {},
4240
- body
4287
+ body,
4288
+ fetchImpl = fetchWithUserAgent
4241
4289
  } = options;
4242
4290
  verboseLog(`${method} ${url}`);
4243
- const res = await fetchWithUserAgent(url, {
4291
+ const res = await fetchImpl(url, {
4244
4292
  method,
4245
4293
  headers,
4246
4294
  body: body !== undefined ? JSON.stringify(body) : undefined
@@ -4375,18 +4423,18 @@ if (NOT_GENERIC || INCORRECT_NAME) {
4375
4423
  }, { unsafe: true });
4376
4424
  }
4377
4425
 
4378
- var uncurryThis$t = functionUncurryThis;
4426
+ var uncurryThis$s = functionUncurryThis;
4379
4427
  var toIntegerOrInfinity$8 = toIntegerOrInfinity$b;
4380
- var toString$d = toString$j;
4381
- var requireObjectCoercible$6 = requireObjectCoercible$b;
4428
+ var toString$c = toString$j;
4429
+ var requireObjectCoercible$5 = requireObjectCoercible$b;
4382
4430
 
4383
- var charAt$8 = uncurryThis$t(''.charAt);
4384
- var charCodeAt$1 = uncurryThis$t(''.charCodeAt);
4385
- var stringSlice$8 = uncurryThis$t(''.slice);
4431
+ var charAt$8 = uncurryThis$s(''.charAt);
4432
+ var charCodeAt$1 = uncurryThis$s(''.charCodeAt);
4433
+ var stringSlice$8 = uncurryThis$s(''.slice);
4386
4434
 
4387
4435
  var createMethod$4 = function (CONVERT_TO_STRING) {
4388
4436
  return function ($this, pos) {
4389
- var S = toString$d(requireObjectCoercible$6($this));
4437
+ var S = toString$c(requireObjectCoercible$5($this));
4390
4438
  var position = toIntegerOrInfinity$8(pos);
4391
4439
  var size = S.length;
4392
4440
  var first, second;
@@ -4413,7 +4461,7 @@ var stringMultibyte = {
4413
4461
  };
4414
4462
 
4415
4463
  var charAt$7 = stringMultibyte.charAt;
4416
- var toString$c = toString$j;
4464
+ var toString$b = toString$j;
4417
4465
  var InternalStateModule$5 = internalState;
4418
4466
  var defineIterator = iteratorDefine;
4419
4467
  var createIterResultObject$1 = createIterResultObject$4;
@@ -4427,7 +4475,7 @@ var getInternalState$4 = InternalStateModule$5.getterFor(STRING_ITERATOR);
4427
4475
  defineIterator(String, 'String', function (iterated) {
4428
4476
  setInternalState$4(this, {
4429
4477
  type: STRING_ITERATOR,
4430
- string: toString$c(iterated),
4478
+ string: toString$b(iterated),
4431
4479
  index: 0
4432
4480
  });
4433
4481
  // `%StringIteratorPrototype%.next` method
@@ -4490,7 +4538,7 @@ var isArray$2 = isArray$5;
4490
4538
 
4491
4539
  var $TypeError$b = TypeError;
4492
4540
  // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
4493
- var getOwnPropertyDescriptor$2 = Object.getOwnPropertyDescriptor;
4541
+ var getOwnPropertyDescriptor$1 = Object.getOwnPropertyDescriptor;
4494
4542
 
4495
4543
  // Safari < 13 does not throw an error in this case
4496
4544
  var SILENT_ON_NON_WRITABLE_LENGTH_SET = DESCRIPTORS$9 && !function () {
@@ -4505,7 +4553,7 @@ var SILENT_ON_NON_WRITABLE_LENGTH_SET = DESCRIPTORS$9 && !function () {
4505
4553
  }();
4506
4554
 
4507
4555
  var arraySetLength = SILENT_ON_NON_WRITABLE_LENGTH_SET ? function (O, length) {
4508
- if (isArray$2(O) && !getOwnPropertyDescriptor$2(O, 'length').writable) {
4556
+ if (isArray$2(O) && !getOwnPropertyDescriptor$1(O, 'length').writable) {
4509
4557
  throw new $TypeError$b('Cannot set read only .length');
4510
4558
  } return O.length = length;
4511
4559
  } : function (O, length) {
@@ -4565,7 +4613,7 @@ var arrayFrom$1 = function from(arrayLike /* , mapfn = undefined, thisArg = unde
4565
4613
  };
4566
4614
 
4567
4615
  // based on https://github.com/bestiejs/punycode.js/blob/master/punycode.js
4568
- var uncurryThis$s = functionUncurryThis;
4616
+ var uncurryThis$r = functionUncurryThis;
4569
4617
 
4570
4618
  var maxInt = 2147483647; // aka. 0x7FFFFFFF or 2^31-1
4571
4619
  var base = 36;
@@ -4582,15 +4630,15 @@ var OVERFLOW_ERROR = 'Overflow: input needs wider integers to process';
4582
4630
  var baseMinusTMin = base - tMin;
4583
4631
 
4584
4632
  var $RangeError$7 = RangeError;
4585
- var exec$4 = uncurryThis$s(regexSeparators.exec);
4633
+ var exec$4 = uncurryThis$r(regexSeparators.exec);
4586
4634
  var floor$7 = Math.floor;
4587
4635
  var fromCharCode$2 = String.fromCharCode;
4588
- var charCodeAt = uncurryThis$s(''.charCodeAt);
4589
- var join$4 = uncurryThis$s([].join);
4590
- var push$5 = uncurryThis$s([].push);
4591
- var replace$6 = uncurryThis$s(''.replace);
4592
- var split$2 = uncurryThis$s(''.split);
4593
- var toLowerCase$1 = uncurryThis$s(''.toLowerCase);
4636
+ var charCodeAt = uncurryThis$r(''.charCodeAt);
4637
+ var join$4 = uncurryThis$r([].join);
4638
+ var push$5 = uncurryThis$r([].push);
4639
+ var replace$6 = uncurryThis$r(''.replace);
4640
+ var split$2 = uncurryThis$r(''.split);
4641
+ var toLowerCase$1 = uncurryThis$r(''.toLowerCase);
4594
4642
 
4595
4643
  /**
4596
4644
  * Creates an array containing the numeric code points of each Unicode
@@ -4745,22 +4793,22 @@ var stringPunycodeToAscii = function (input) {
4745
4793
  return join$4(encoded, '.');
4746
4794
  };
4747
4795
 
4748
- var $$x = _export;
4749
- var uncurryThis$r = functionUncurryThis;
4796
+ var $$w = _export;
4797
+ var uncurryThis$q = functionUncurryThis;
4750
4798
  var toAbsoluteIndex$2 = toAbsoluteIndex$4;
4751
4799
 
4752
4800
  var $RangeError$6 = RangeError;
4753
4801
  var fromCharCode$1 = String.fromCharCode;
4754
4802
  // eslint-disable-next-line es/no-string-fromcodepoint -- required for testing
4755
4803
  var $fromCodePoint = String.fromCodePoint;
4756
- var join$3 = uncurryThis$r([].join);
4804
+ var join$3 = uncurryThis$q([].join);
4757
4805
 
4758
4806
  // length should be 1, old FF problem
4759
4807
  var INCORRECT_LENGTH = !!$fromCodePoint && $fromCodePoint.length !== 1;
4760
4808
 
4761
4809
  // `String.fromCodePoint` method
4762
4810
  // https://tc39.es/ecma262/#sec-string.fromcodepoint
4763
- $$x({ target: 'String', stat: true, arity: 1, forced: INCORRECT_LENGTH }, {
4811
+ $$w({ target: 'String', stat: true, arity: 1, forced: INCORRECT_LENGTH }, {
4764
4812
  // eslint-disable-next-line no-unused-vars -- required for `.length`
4765
4813
  fromCodePoint: function fromCodePoint(x) {
4766
4814
  var elements = [];
@@ -4822,12 +4870,12 @@ var arraySort$1 = sort$1;
4822
4870
  // TODO: in core-js@4, move /modules/ dependencies to public entries for better optimization by tools like `preset-env`
4823
4871
 
4824
4872
 
4825
- var $$w = _export;
4873
+ var $$v = _export;
4826
4874
  var globalThis$q = globalThis_1;
4827
4875
  var safeGetBuiltIn = safeGetBuiltIn$2;
4828
4876
  var getBuiltIn$1 = getBuiltIn$c;
4829
4877
  var call$h = functionCall;
4830
- var uncurryThis$q = functionUncurryThis;
4878
+ var uncurryThis$p = functionUncurryThis;
4831
4879
  var DESCRIPTORS$8 = descriptors;
4832
4880
  var USE_NATIVE_URL$1 = urlConstructorDetection;
4833
4881
  var defineBuiltIn$6 = defineBuiltIn$e;
@@ -4870,15 +4918,15 @@ var encodeURIComponent$1 = globalThis$q.encodeURIComponent;
4870
4918
  var fromCharCode = String.fromCharCode;
4871
4919
  var fromCodePoint = getBuiltIn$1('String', 'fromCodePoint');
4872
4920
  var $parseInt = parseInt;
4873
- var charAt$6 = uncurryThis$q(''.charAt);
4874
- var join$2 = uncurryThis$q([].join);
4875
- var push$4 = uncurryThis$q([].push);
4876
- var replace$5 = uncurryThis$q(''.replace);
4877
- var shift$1 = uncurryThis$q([].shift);
4878
- var splice = uncurryThis$q([].splice);
4879
- var split$1 = uncurryThis$q(''.split);
4880
- var stringSlice$7 = uncurryThis$q(''.slice);
4881
- var exec$3 = uncurryThis$q(/./.exec);
4921
+ var charAt$6 = uncurryThis$p(''.charAt);
4922
+ var join$2 = uncurryThis$p([].join);
4923
+ var push$4 = uncurryThis$p([].push);
4924
+ var replace$5 = uncurryThis$p(''.replace);
4925
+ var shift$1 = uncurryThis$p([].shift);
4926
+ var splice = uncurryThis$p([].splice);
4927
+ var split$1 = uncurryThis$p(''.split);
4928
+ var stringSlice$7 = uncurryThis$p(''.slice);
4929
+ var exec$3 = uncurryThis$p(/./.exec);
4882
4930
 
4883
4931
  var plus = /\+/g;
4884
4932
  var FALLBACK_REPLACER = '\uFFFD';
@@ -5291,14 +5339,14 @@ if (DESCRIPTORS$8) defineBuiltInAccessor$7(URLSearchParamsPrototype$3, 'size', {
5291
5339
 
5292
5340
  setToStringTag$2(URLSearchParamsConstructor, URL_SEARCH_PARAMS);
5293
5341
 
5294
- $$w({ global: true, constructor: true, forced: !USE_NATIVE_URL$1 }, {
5342
+ $$v({ global: true, constructor: true, forced: !USE_NATIVE_URL$1 }, {
5295
5343
  URLSearchParams: URLSearchParamsConstructor
5296
5344
  });
5297
5345
 
5298
5346
  // Wrap `fetch` and `Request` for correct work with polyfilled `URLSearchParams`
5299
5347
  if (!USE_NATIVE_URL$1 && isCallable$4(Headers)) {
5300
- var headersHas = uncurryThis$q(HeadersPrototype.has);
5301
- var headersSet = uncurryThis$q(HeadersPrototype.set);
5348
+ var headersHas = uncurryThis$p(HeadersPrototype.has);
5349
+ var headersSet = uncurryThis$p(HeadersPrototype.set);
5302
5350
 
5303
5351
  var wrapRequestOptions = function (init) {
5304
5352
  if (isObject$6(init)) {
@@ -5318,7 +5366,7 @@ if (!USE_NATIVE_URL$1 && isCallable$4(Headers)) {
5318
5366
  };
5319
5367
 
5320
5368
  if (isCallable$4(nativeFetch)) {
5321
- $$w({ global: true, enumerable: true, dontCallGetSet: true, forced: true }, {
5369
+ $$v({ global: true, enumerable: true, dontCallGetSet: true, forced: true }, {
5322
5370
  fetch: function fetch(input /* , init */) {
5323
5371
  return nativeFetch(input, arguments.length > 1 ? wrapRequestOptions(arguments[1]) : {});
5324
5372
  }
@@ -5334,7 +5382,7 @@ if (!USE_NATIVE_URL$1 && isCallable$4(Headers)) {
5334
5382
  RequestPrototype.constructor = RequestConstructor;
5335
5383
  RequestConstructor.prototype = RequestPrototype;
5336
5384
 
5337
- $$w({ global: true, constructor: true, dontCallGetSet: true, forced: true }, {
5385
+ $$v({ global: true, constructor: true, dontCallGetSet: true, forced: true }, {
5338
5386
  Request: RequestConstructor
5339
5387
  });
5340
5388
  }
@@ -5347,12 +5395,12 @@ var web_urlSearchParams_constructor = {
5347
5395
 
5348
5396
  // TODO: in core-js@4, move /modules/ dependencies to public entries for better optimization by tools like `preset-env`
5349
5397
 
5350
- var $$v = _export;
5398
+ var $$u = _export;
5351
5399
  var DESCRIPTORS$7 = descriptors;
5352
5400
  var USE_NATIVE_URL = urlConstructorDetection;
5353
5401
  var globalThis$p = globalThis_1;
5354
5402
  var bind$4 = functionBindContext;
5355
- var uncurryThis$p = functionUncurryThis;
5403
+ var uncurryThis$o = functionUncurryThis;
5356
5404
  var defineBuiltIn$5 = defineBuiltIn$e;
5357
5405
  var defineBuiltInAccessor$6 = defineBuiltInAccessor$c;
5358
5406
  var anInstance$2 = anInstance$6;
@@ -5379,18 +5427,18 @@ var encodeURIComponent = globalThis$p.encodeURIComponent;
5379
5427
  var parseInt$1 = globalThis$p.parseInt;
5380
5428
  var floor$5 = Math.floor;
5381
5429
  var pow$1 = Math.pow;
5382
- var charAt$5 = uncurryThis$p(''.charAt);
5383
- var exec$2 = uncurryThis$p(/./.exec);
5384
- var join$1 = uncurryThis$p([].join);
5385
- var numberToString$1 = uncurryThis$p(1.1.toString);
5386
- var pop = uncurryThis$p([].pop);
5387
- var push$3 = uncurryThis$p([].push);
5388
- var replace$4 = uncurryThis$p(''.replace);
5389
- var shift = uncurryThis$p([].shift);
5390
- var split = uncurryThis$p(''.split);
5391
- var stringSlice$6 = uncurryThis$p(''.slice);
5392
- var toLowerCase = uncurryThis$p(''.toLowerCase);
5393
- var unshift = uncurryThis$p([].unshift);
5430
+ var charAt$5 = uncurryThis$o(''.charAt);
5431
+ var exec$2 = uncurryThis$o(/./.exec);
5432
+ var join$1 = uncurryThis$o([].join);
5433
+ var numberToString$1 = uncurryThis$o(1.1.toString);
5434
+ var pop = uncurryThis$o([].pop);
5435
+ var push$3 = uncurryThis$o([].push);
5436
+ var replace$4 = uncurryThis$o(''.replace);
5437
+ var shift = uncurryThis$o([].shift);
5438
+ var split = uncurryThis$o(''.split);
5439
+ var stringSlice$6 = uncurryThis$o(''.slice);
5440
+ var toLowerCase = uncurryThis$o(''.toLowerCase);
5441
+ var unshift = uncurryThis$o([].unshift);
5394
5442
 
5395
5443
  var INVALID_AUTHORITY = 'Invalid authority';
5396
5444
  var INVALID_SCHEME = 'Invalid scheme';
@@ -6421,32 +6469,32 @@ if (NativeURL) {
6421
6469
 
6422
6470
  setToStringTag$1(URLConstructor, 'URL');
6423
6471
 
6424
- $$v({ global: true, constructor: true, forced: !USE_NATIVE_URL, sham: !DESCRIPTORS$7 }, {
6472
+ $$u({ global: true, constructor: true, forced: !USE_NATIVE_URL, sham: !DESCRIPTORS$7 }, {
6425
6473
  URL: URLConstructor
6426
6474
  });
6427
6475
 
6428
- var $$u = _export;
6476
+ var $$t = _export;
6429
6477
  var call$g = functionCall;
6430
6478
 
6431
6479
  // `URL.prototype.toJSON` method
6432
6480
  // https://url.spec.whatwg.org/#dom-url-tojson
6433
- $$u({ target: 'URL', proto: true, enumerable: true }, {
6481
+ $$t({ target: 'URL', proto: true, enumerable: true }, {
6434
6482
  toJSON: function toJSON() {
6435
6483
  return call$g(URL.prototype.toString, this);
6436
6484
  }
6437
6485
  });
6438
6486
 
6439
6487
  var defineBuiltIn$4 = defineBuiltIn$e;
6440
- var uncurryThis$o = functionUncurryThis;
6441
- var toString$b = toString$j;
6488
+ var uncurryThis$n = functionUncurryThis;
6489
+ var toString$a = toString$j;
6442
6490
  var validateArgumentsLength$1 = validateArgumentsLength$5;
6443
6491
 
6444
6492
  var $URLSearchParams$1 = URLSearchParams;
6445
6493
  var URLSearchParamsPrototype$2 = $URLSearchParams$1.prototype;
6446
- var append = uncurryThis$o(URLSearchParamsPrototype$2.append);
6447
- var $delete = uncurryThis$o(URLSearchParamsPrototype$2['delete']);
6448
- var forEach$3 = uncurryThis$o(URLSearchParamsPrototype$2.forEach);
6449
- var push$2 = uncurryThis$o([].push);
6494
+ var append = uncurryThis$n(URLSearchParamsPrototype$2.append);
6495
+ var $delete = uncurryThis$n(URLSearchParamsPrototype$2['delete']);
6496
+ var forEach$3 = uncurryThis$n(URLSearchParamsPrototype$2.forEach);
6497
+ var push$2 = uncurryThis$n([].push);
6450
6498
  var params$1 = new $URLSearchParams$1('a=1&a=2&b=3');
6451
6499
 
6452
6500
  params$1['delete']('a', 1);
@@ -6464,8 +6512,8 @@ if (params$1 + '' !== 'a=2') {
6464
6512
  push$2(entries, { key: k, value: v });
6465
6513
  });
6466
6514
  validateArgumentsLength$1(length, 1);
6467
- var key = toString$b(name);
6468
- var value = toString$b($value);
6515
+ var key = toString$a(name);
6516
+ var value = toString$a($value);
6469
6517
  var index = 0;
6470
6518
  var entriesLength = entries.length;
6471
6519
  var entry;
@@ -6483,14 +6531,14 @@ if (params$1 + '' !== 'a=2') {
6483
6531
  }
6484
6532
 
6485
6533
  var defineBuiltIn$3 = defineBuiltIn$e;
6486
- var uncurryThis$n = functionUncurryThis;
6487
- var toString$a = toString$j;
6534
+ var uncurryThis$m = functionUncurryThis;
6535
+ var toString$9 = toString$j;
6488
6536
  var validateArgumentsLength = validateArgumentsLength$5;
6489
6537
 
6490
6538
  var $URLSearchParams = URLSearchParams;
6491
6539
  var URLSearchParamsPrototype$1 = $URLSearchParams.prototype;
6492
- var getAll = uncurryThis$n(URLSearchParamsPrototype$1.getAll);
6493
- var $has = uncurryThis$n(URLSearchParamsPrototype$1.has);
6540
+ var getAll = uncurryThis$m(URLSearchParamsPrototype$1.getAll);
6541
+ var $has = uncurryThis$m(URLSearchParamsPrototype$1.has);
6494
6542
  var params = new $URLSearchParams('a=1');
6495
6543
 
6496
6544
  // `undefined` case is a Chromium 117 bug
@@ -6502,7 +6550,7 @@ if (params.has('a', 2) || !params.has('a', undefined)) {
6502
6550
  if (length && $value === undefined) return $has(this, name);
6503
6551
  var values = getAll(this, name); // also validates `this`
6504
6552
  validateArgumentsLength(length, 1);
6505
- var value = toString$a($value);
6553
+ var value = toString$9($value);
6506
6554
  var index = 0;
6507
6555
  while (index < values.length) {
6508
6556
  if (values[index++] === value) return true;
@@ -6511,11 +6559,11 @@ if (params.has('a', 2) || !params.has('a', undefined)) {
6511
6559
  }
6512
6560
 
6513
6561
  var DESCRIPTORS$6 = descriptors;
6514
- var uncurryThis$m = functionUncurryThis;
6562
+ var uncurryThis$l = functionUncurryThis;
6515
6563
  var defineBuiltInAccessor$5 = defineBuiltInAccessor$c;
6516
6564
 
6517
6565
  var URLSearchParamsPrototype = URLSearchParams.prototype;
6518
- var forEach$2 = uncurryThis$m(URLSearchParamsPrototype.forEach);
6566
+ var forEach$2 = uncurryThis$l(URLSearchParamsPrototype.forEach);
6519
6567
 
6520
6568
  // `URLSearchParams.prototype.size` getter
6521
6569
  // https://github.com/whatwg/url/pull/734
@@ -6769,39 +6817,6 @@ const loginWithSso = async environment => {
6769
6817
  };
6770
6818
  const getSsoEnvironmentConfig = getSsoConfig;
6771
6819
 
6772
- var $$t = _export;
6773
- var uncurryThis$l = functionUncurryThisClause;
6774
- var getOwnPropertyDescriptor$1 = objectGetOwnPropertyDescriptor.f;
6775
- var toLength$5 = toLength$7;
6776
- var toString$9 = toString$j;
6777
- var notARegExp$1 = notARegexp;
6778
- var requireObjectCoercible$5 = requireObjectCoercible$b;
6779
- var correctIsRegExpLogic$1 = correctIsRegexpLogic;
6780
-
6781
- var slice$2 = uncurryThis$l(''.slice);
6782
- var min$4 = Math.min;
6783
-
6784
- var CORRECT_IS_REGEXP_LOGIC$1 = correctIsRegExpLogic$1('endsWith');
6785
- // https://github.com/zloirock/core-js/pull/702
6786
- var MDN_POLYFILL_BUG$1 = !CORRECT_IS_REGEXP_LOGIC$1 && !!function () {
6787
- var descriptor = getOwnPropertyDescriptor$1(String.prototype, 'endsWith');
6788
- return descriptor && !descriptor.writable;
6789
- }();
6790
-
6791
- // `String.prototype.endsWith` method
6792
- // https://tc39.es/ecma262/#sec-string.prototype.endswith
6793
- $$t({ target: 'String', proto: true, forced: !MDN_POLYFILL_BUG$1 && !CORRECT_IS_REGEXP_LOGIC$1 }, {
6794
- endsWith: function endsWith(searchString /* , endPosition = @length */) {
6795
- var that = toString$9(requireObjectCoercible$5(this));
6796
- notARegExp$1(searchString);
6797
- var search = toString$9(searchString);
6798
- var endPosition = arguments.length > 1 ? arguments[1] : undefined;
6799
- var len = that.length;
6800
- var end = endPosition === undefined ? len : min$4(toLength$5(endPosition), len);
6801
- return slice$2(that, end - search.length, end) === search;
6802
- }
6803
- });
6804
-
6805
6820
  /******************************************************************************
6806
6821
  Copyright (c) Microsoft Corporation.
6807
6822
 
@@ -7135,22 +7150,9 @@ const PLATFORM_AUTH_ORIGINS = {
7135
7150
  demo: "https://platform-auth.vention.foo",
7136
7151
  prod: "https://platform-auth.vention.com"
7137
7152
  };
7138
- const originSchema = z.url({
7139
- protocol: /^https$/
7140
- }).refine(url => !url.endsWith("/"));
7141
- const originOverride = variableName => {
7142
- const override = process.env[variableName];
7143
- if (!override) {
7144
- return undefined;
7145
- }
7146
- if (!originSchema.safeParse(override).success) {
7147
- throw new Error(`${variableName} must be an https URL without a trailing slash`);
7148
- }
7149
- return override;
7150
- };
7151
7153
  const getPlatformAuthOrigin = environment => {
7152
7154
  var _a;
7153
- return (_a = originOverride("VENTION_CLI_PLATFORM_AUTH_ORIGIN")) !== null && _a !== void 0 ? _a : PLATFORM_AUTH_ORIGINS[environment];
7155
+ return (_a = getOriginOverride("VENTION_CLI_PLATFORM_AUTH_ORIGIN")) !== null && _a !== void 0 ? _a : PLATFORM_AUTH_ORIGINS[environment];
7154
7156
  };
7155
7157
  const gatewayTokenStore = session => ({
7156
7158
  read: async () => {
@@ -7382,44 +7384,23 @@ $$r({ target: 'Iterator', proto: true, real: true, forced: findWithoutClosingOnE
7382
7384
  }
7383
7385
  });
7384
7386
 
7385
- const getDigitalTwinUrl = (environment, sessionId) => {
7386
- switch (environment) {
7387
- case "local":
7388
- return `http://localhost:3101`;
7389
- case "demo":
7390
- return `https://digital-twin.vention.foo/digital-twin/machine-motion/passthrough/${sessionId}/80`;
7391
- case "prod":
7392
- return `https://digital-twin.vention.com/digital-twin/machine-motion/passthrough/${sessionId}/80`;
7393
- default:
7394
- throw new Error("Invalid environment");
7395
- }
7396
- };
7397
- const getAllApplicationsWithSourceCode = async (environment, designId, sessionId) => {
7398
- if (!sessionId) {
7399
- throw new Error("Linked session token is not set");
7400
- }
7401
- const digitalTwinUrl = getDigitalTwinUrl(environment, sessionId);
7402
- const url = `${digitalTwinUrl}/v2/library?shouldIncludeSourceCode=true`;
7403
- const response = await fetchJson(url, {
7404
- headers: {
7405
- Accept: "application/json",
7406
- Cookie: `digital-twin-session-${designId}=s%3A${sessionId}.s`
7407
- }
7387
+ const getAllApplicationsWithSourceCode = async connection => {
7388
+ const response = await fetchJson(`${connection.baseUrl}/v2/library?shouldIncludeSourceCode=true`, {
7389
+ headers: Object.assign({
7390
+ Accept: "application/json"
7391
+ }, connection.headers),
7392
+ fetchImpl: connection.fetch
7408
7393
  });
7409
7394
  return response.applications || [];
7410
7395
  };
7411
- const getLibraryAssets = async (environment, designId, sessionId) => {
7412
- if (!sessionId) {
7413
- throw new Error("Linked session token is not set");
7414
- }
7415
- const digitalTwinUrl = getDigitalTwinUrl(environment, sessionId);
7416
- const url = `${digitalTwinUrl}/v2/library/assets`;
7396
+ const getLibraryAssets = async connection => {
7397
+ const url = `${connection.baseUrl}/v2/library/assets`;
7417
7398
  try {
7418
7399
  const response = await fetchJson(url, {
7419
- headers: {
7420
- Accept: "application/json",
7421
- Cookie: `digital-twin-session-${designId}=s%3A${sessionId}.s`
7422
- }
7400
+ headers: Object.assign({
7401
+ Accept: "application/json"
7402
+ }, connection.headers),
7403
+ fetchImpl: connection.fetch
7423
7404
  });
7424
7405
  return response.assets;
7425
7406
  } catch (error) {
@@ -7429,47 +7410,33 @@ const getLibraryAssets = async (environment, designId, sessionId) => {
7429
7410
  throw error;
7430
7411
  }
7431
7412
  };
7432
- const getMmConfiguration = async (environment, designId, sessionId) => {
7433
- if (!sessionId) {
7434
- throw new Error("Linked session token is not set");
7435
- }
7436
- const digitalTwinUrl = getDigitalTwinUrl(environment, sessionId);
7437
- const url = `${digitalTwinUrl}/v2/mm-configuration`;
7413
+ const getMmConfiguration = async connection => {
7414
+ const url = `${connection.baseUrl}/v2/mm-configuration`;
7438
7415
  const response = await fetchJson(url, {
7439
- headers: {
7440
- Accept: "application/json",
7441
- Cookie: `digital-twin-session-${designId}=s%3A${sessionId}.s`
7442
- }
7416
+ headers: Object.assign({
7417
+ Accept: "application/json"
7418
+ }, connection.headers),
7419
+ fetchImpl: connection.fetch
7443
7420
  });
7444
7421
  return response.mmConfiguration;
7445
7422
  };
7446
- const pushApplicationToDigitalTwin = async (environment, designId, sessionId, application) => {
7447
- if (!sessionId) {
7448
- throw new Error("Linked session token is not set");
7449
- }
7450
- const digitalTwinUrl = getDigitalTwinUrl(environment, sessionId);
7451
- const url = `${digitalTwinUrl}/v1/library`;
7423
+ const pushApplicationToDigitalTwin = async (connection, application) => {
7424
+ const url = `${connection.baseUrl}/v1/library`;
7452
7425
  return await fetchJson(url, {
7453
7426
  method: "PUT",
7454
- headers: {
7427
+ headers: Object.assign({
7455
7428
  "Content-Type": "application/json",
7456
- Accept: "application/json",
7457
- Cookie: `digital-twin-session-${designId}=s%3A${sessionId}.s`
7458
- },
7459
- body: application
7429
+ Accept: "application/json"
7430
+ }, connection.headers),
7431
+ body: application,
7432
+ fetchImpl: connection.fetch
7460
7433
  });
7461
7434
  };
7462
- const getApplicationLogs = async (environment, designId, sessionId, applicationId) => {
7463
- if (!sessionId) {
7464
- throw new Error("Linked session token is not set");
7465
- }
7466
- const digitalTwinUrl = getDigitalTwinUrl(environment, sessionId);
7467
- const url = `${digitalTwinUrl}/v1/application/${applicationId}/logs`;
7468
- const response = await fetchWithUserAgent(url, {
7435
+ const getApplicationLogs = async (connection, applicationId) => {
7436
+ const url = `${connection.baseUrl}/v1/application/${applicationId}/logs`;
7437
+ const response = await connection.fetch(url, {
7469
7438
  method: "GET",
7470
- headers: {
7471
- Cookie: `digital-twin-session-${designId}=s%3A${sessionId}.s`
7472
- }
7439
+ headers: connection.headers
7473
7440
  });
7474
7441
  if (!response.ok) {
7475
7442
  throw new Error("Could not find logs for application");
@@ -7477,60 +7444,6 @@ const getApplicationLogs = async (environment, designId, sessionId, applicationI
7477
7444
  return await response.text();
7478
7445
  };
7479
7446
 
7480
- const getBaseRailsUrl = environment => {
7481
- switch (environment) {
7482
- case "local":
7483
- return "http://localhost:3000";
7484
- case "demo":
7485
- return "https://vention.foo";
7486
- case "prod":
7487
- return "https://vention.com";
7488
- default:
7489
- throw new Error("Invalid environment");
7490
- }
7491
- };
7492
- const getUserAllocations = async session => {
7493
- const baseUrl = getBaseRailsUrl(session.environment);
7494
- const headers = await getAuthHeaders(session);
7495
- const url = `${baseUrl}/api/v3/digital_twin_infrastructure/allocations`;
7496
- return await fetchJson(url, {
7497
- headers
7498
- });
7499
- };
7500
- const getAuthHeaders = async session => {
7501
- var _a;
7502
- const baseUrl = getBaseRailsUrl(session.environment);
7503
- const baseHeaders = {
7504
- Accept: "application/json",
7505
- Origin: baseUrl,
7506
- Referer: `${baseUrl}/`
7507
- };
7508
- if (session.environment === "local") {
7509
- if (!session.ventionSession) {
7510
- throw new Error("Local environment requires vention_session. Please run 'vention login' and provide the cookie value.");
7511
- }
7512
- return Object.assign(Object.assign({}, baseHeaders), {
7513
- Cookie: `vention_session=${session.ventionSession}`
7514
- });
7515
- }
7516
- if (!((_a = session.oauth) === null || _a === void 0 ? void 0 : _a.accessToken)) {
7517
- throw new Error("Not authenticated. Please run 'vention login' to authenticate via SSO.");
7518
- }
7519
- const bufferMs = 5 * 60 * 1000;
7520
- const shouldRefreshToken = session.oauth.expiresAt && Date.now() >= session.oauth.expiresAt - bufferMs;
7521
- if (shouldRefreshToken && session.oauth.refreshToken !== undefined) {
7522
- const ssoConfig = getSsoEnvironmentConfig(session.environment);
7523
- const refreshed = await refreshAccessToken(ssoConfig, session.oauth.refreshToken);
7524
- session.oauth.accessToken = refreshed.accessToken;
7525
- session.oauth.refreshToken = refreshed.refreshToken;
7526
- session.oauth.expiresAt = refreshed.expiresInSeconds ? Date.now() + refreshed.expiresInSeconds * 1000 : session.oauth.expiresAt;
7527
- await saveSession(session);
7528
- }
7529
- return Object.assign(Object.assign({}, baseHeaders), {
7530
- Authorization: `Bearer ${session.oauth.accessToken}`
7531
- });
7532
- };
7533
-
7534
7447
  // eslint-disable-next-line es/no-typed-arrays -- safe
7535
7448
  var arrayBufferBasicDetection = typeof ArrayBuffer != 'undefined' && typeof DataView != 'undefined';
7536
7449
 
@@ -10970,14 +10883,102 @@ const readMachineCodeAppDirectoryInfo = async projectPath => {
10970
10883
  }
10971
10884
  };
10972
10885
 
10973
- const checkIfDesignHasLiveAllocation = async (session, designId) => {
10886
+ const getBaseRailsUrl = environment => {
10887
+ switch (environment) {
10888
+ case "local":
10889
+ return "http://localhost:3000";
10890
+ case "demo":
10891
+ return "https://vention.foo";
10892
+ case "prod":
10893
+ return "https://vention.com";
10894
+ default:
10895
+ throw new Error("Invalid environment");
10896
+ }
10897
+ };
10898
+ const getUserAllocations = async session => {
10899
+ const baseUrl = getBaseRailsUrl(session.environment);
10900
+ const headers = await getAuthHeaders(session);
10901
+ const url = `${baseUrl}/api/v3/digital_twin_infrastructure/allocations`;
10902
+ return await fetchJson(url, {
10903
+ headers
10904
+ });
10905
+ };
10906
+ const getAuthHeaders = async session => {
10907
+ var _a;
10908
+ const baseUrl = getBaseRailsUrl(session.environment);
10909
+ const baseHeaders = {
10910
+ Accept: "application/json",
10911
+ Origin: baseUrl,
10912
+ Referer: `${baseUrl}/`
10913
+ };
10914
+ if (session.environment === "local") {
10915
+ if (!session.ventionSession) {
10916
+ throw new Error("Local environment requires vention_session. Please run 'vention login' and provide the cookie value.");
10917
+ }
10918
+ return Object.assign(Object.assign({}, baseHeaders), {
10919
+ Cookie: `vention_session=${session.ventionSession}`
10920
+ });
10921
+ }
10922
+ if (!((_a = session.oauth) === null || _a === void 0 ? void 0 : _a.accessToken)) {
10923
+ throw new Error("Not authenticated. Please run 'vention login' to authenticate via SSO.");
10924
+ }
10925
+ const bufferMs = 5 * 60 * 1000;
10926
+ const shouldRefreshToken = session.oauth.expiresAt && Date.now() >= session.oauth.expiresAt - bufferMs;
10927
+ if (shouldRefreshToken && session.oauth.refreshToken !== undefined) {
10928
+ const ssoConfig = getSsoEnvironmentConfig(session.environment);
10929
+ const refreshed = await refreshAccessToken(ssoConfig, session.oauth.refreshToken);
10930
+ session.oauth.accessToken = refreshed.accessToken;
10931
+ session.oauth.refreshToken = refreshed.refreshToken;
10932
+ session.oauth.expiresAt = refreshed.expiresInSeconds ? Date.now() + refreshed.expiresInSeconds * 1000 : session.oauth.expiresAt;
10933
+ await saveSession(session);
10934
+ }
10935
+ return Object.assign(Object.assign({}, baseHeaders), {
10936
+ Authorization: `Bearer ${session.oauth.accessToken}`
10937
+ });
10938
+ };
10939
+
10940
+ const getDigitalTwinUrl = (environment, sessionId) => {
10941
+ switch (environment) {
10942
+ case "local":
10943
+ return `http://localhost:3101`;
10944
+ case "demo":
10945
+ return `https://digital-twin.vention.foo/digital-twin/machine-motion/passthrough/${sessionId}/80`;
10946
+ case "prod":
10947
+ return `https://digital-twin.vention.com/digital-twin/machine-motion/passthrough/${sessionId}/80`;
10948
+ default:
10949
+ throw new Error("Invalid environment");
10950
+ }
10951
+ };
10952
+ const rejectMissingSession = async () => {
10953
+ throw new Error("Linked session token is not set");
10954
+ };
10955
+ const buildConnection = (environment, designId, sessionId) => ({
10956
+ baseUrl: getDigitalTwinUrl(environment, sessionId),
10957
+ headers: {
10958
+ Cookie: `digital-twin-session-${designId}=s%3A${sessionId}.s`
10959
+ },
10960
+ fetch: sessionId ? fetchWithUserAgent : rejectMissingSession
10961
+ });
10962
+ const resolveConnection = async (session, designId) => {
10963
+ const allocations = await getUserAllocations(session);
10964
+ const allocation = allocations.find(candidate => candidate.designId === designId);
10965
+ if (!allocation) {
10966
+ return undefined;
10967
+ }
10968
+ return buildConnection(session.environment, designId, allocation.sessionId);
10969
+ };
10970
+ const listDesigns = async session => {
10974
10971
  const allocations = await getUserAllocations(session);
10975
- const linkedAllocation = allocations.find(a => a.designId === designId);
10976
- return linkedAllocation;
10972
+ return allocations.map(allocation => ({
10973
+ id: allocation.designId,
10974
+ name: allocation.designName,
10975
+ connection: buildConnection(session.environment, allocation.designId, allocation.sessionId)
10976
+ }));
10977
10977
  };
10978
- const getAppFromDigitalTwin = async (environment, machineCodeAppDirectoryInfo, sessionId) => {
10978
+
10979
+ const getAppFromDigitalTwin = async (connection, machineCodeAppDirectoryInfo) => {
10979
10980
  console.log(chalk.blue("Fetching all applications with source code from digital twin..."));
10980
- const allApplications = await getAllApplicationsWithSourceCode(environment, machineCodeAppDirectoryInfo.designId, sessionId);
10981
+ const allApplications = await getAllApplicationsWithSourceCode(connection);
10981
10982
  const targetApp = allApplications.find(app => app.id === machineCodeAppDirectoryInfo.applicationId);
10982
10983
  if (!targetApp) {
10983
10984
  console.log();
@@ -10986,8 +10987,8 @@ const getAppFromDigitalTwin = async (environment, machineCodeAppDirectoryInfo, s
10986
10987
  }
10987
10988
  return targetApp;
10988
10989
  };
10989
- const getAvailableAppsFromDigitalTwin = async (environment, designId, sessionId) => {
10990
- const allApplications = await getAllApplicationsWithSourceCode(environment, designId, sessionId);
10990
+ const getAvailableAppsFromDigitalTwin = async connection => {
10991
+ const allApplications = await getAllApplicationsWithSourceCode(connection);
10991
10992
  return allApplications.filter(app => app.type === "machine_code");
10992
10993
  };
10993
10994
  const createNewAppDirectory = async (session, currentDir) => {
@@ -11010,7 +11011,7 @@ const createNewAppDirectory = async (session, currentDir) => {
11010
11011
  process.exit(1);
11011
11012
  }
11012
11013
  const appDirectoryPath = await writeApplicationToDisk(selectedApp.name, selectedApp.sourceCode, currentDir);
11013
- const [assets, mmConfiguration] = await Promise.all([getLibraryAssets(session.environment, selectedDesign.id, selectedDesign.sessionId), getMmConfiguration(session.environment, selectedDesign.id, selectedDesign.sessionId)]);
11014
+ const [assets, mmConfiguration] = await Promise.all([getLibraryAssets(selectedDesign.connection), getMmConfiguration(selectedDesign.connection)]);
11014
11015
  if (assets !== undefined) {
11015
11016
  await writeReadonlyJsonFile(appDirectoryPath, ".vention-design-scene-assets.json", assets);
11016
11017
  }
@@ -11032,16 +11033,16 @@ const createNewAppDirectory = async (session, currentDir) => {
11032
11033
  const updateExistingAppDirectory = async (session, machineCodeAppDirectoryInfo, currentDir) => {
11033
11034
  console.log(chalk.blue(`Found existing project: ${machineCodeAppDirectoryInfo.appName}`));
11034
11035
  console.log(chalk.blue(`Design ID: ${machineCodeAppDirectoryInfo.designId}, App ID: ${machineCodeAppDirectoryInfo.applicationId}`));
11035
- const linkedAllocation = await checkIfDesignHasLiveAllocation(session, machineCodeAppDirectoryInfo.designId);
11036
- if (!linkedAllocation) {
11036
+ const connection = await resolveConnection(session, machineCodeAppDirectoryInfo.designId);
11037
+ if (!connection) {
11037
11038
  console.log();
11038
11039
  console.error(chalk.red("Sorry, it seems you do not have that design open with the MachineLogic tab selected."));
11039
11040
  console.error(chalk.red("Please go to your browser, open your design, and navigate to the MachineLogic page."));
11040
11041
  process.exit(1);
11041
11042
  }
11042
- const appWithSourceCode = await getAppFromDigitalTwin(session.environment, machineCodeAppDirectoryInfo, linkedAllocation.sessionId);
11043
+ const appWithSourceCode = await getAppFromDigitalTwin(connection, machineCodeAppDirectoryInfo);
11043
11044
  await writeApplicationToDisk(appWithSourceCode.name, appWithSourceCode.sourceCode, currentDir, true);
11044
- const [assets, mmConfiguration] = await Promise.all([getLibraryAssets(session.environment, machineCodeAppDirectoryInfo.designId, linkedAllocation.sessionId), getMmConfiguration(session.environment, machineCodeAppDirectoryInfo.designId, linkedAllocation.sessionId)]);
11045
+ const [assets, mmConfiguration] = await Promise.all([getLibraryAssets(connection), getMmConfiguration(connection)]);
11045
11046
  if (assets !== undefined) {
11046
11047
  await writeReadonlyJsonFile(currentDir, ".vention-design-scene-assets.json", assets);
11047
11048
  }
@@ -11074,24 +11075,20 @@ const linkDirectory = async (session, currentDir) => {
11074
11075
  };
11075
11076
  };
11076
11077
  const selectDesignAndApp = async session => {
11077
- const allocations = await getUserAllocations(session);
11078
- if (allocations.length === 0) {
11078
+ const designs = await listDesigns(session);
11079
+ if (designs.length === 0) {
11079
11080
  console.log();
11080
11081
  console.log(chalk.yellow("No active allocations found. Please open a design and navigate to the machine logic tab to activate a digital twin."));
11081
11082
  process.exit(1);
11082
11083
  }
11083
11084
  const selectedDesign = await select({
11084
11085
  message: "Select a design:",
11085
- choices: allocations.map(allocation => ({
11086
- name: `${allocation.designName} (ID: ${allocation.designId})`,
11087
- value: {
11088
- id: allocation.designId,
11089
- name: allocation.designName,
11090
- sessionId: allocation.sessionId
11091
- }
11086
+ choices: designs.map(design => ({
11087
+ name: `${design.name} (ID: ${design.id})`,
11088
+ value: design
11092
11089
  }))
11093
11090
  });
11094
- const availableApps = await getAvailableAppsFromDigitalTwin(session.environment, selectedDesign.id, selectedDesign.sessionId);
11091
+ const availableApps = await getAvailableAppsFromDigitalTwin(selectedDesign.connection);
11095
11092
  if (availableApps.length === 0) {
11096
11093
  console.log();
11097
11094
  console.log(chalk.yellow("No machine code applications found in the digital twin"));
@@ -11138,6 +11135,7 @@ function createPushCommand() {
11138
11135
  }
11139
11136
  const currentDir = process.cwd();
11140
11137
  const machineCodeAppDirectoryInfo = await readMachineCodeAppDirectoryInfo(currentDir);
11138
+ let linkedConnection;
11141
11139
  if (!machineCodeAppDirectoryInfo) {
11142
11140
  console.log();
11143
11141
  console.log(chalk.yellow("This directory is not linked to a Vention application."));
@@ -11155,7 +11153,10 @@ function createPushCommand() {
11155
11153
  console.log(chalk.blue("Push operation cancelled. Run 'vention link' when you're ready to link this directory."));
11156
11154
  process.exit(0);
11157
11155
  }
11158
- await linkDirectory(session, currentDir);
11156
+ const {
11157
+ selectedDesign
11158
+ } = await linkDirectory(session, currentDir);
11159
+ linkedConnection = selectedDesign.connection;
11159
11160
  console.log(chalk.blue("Continuing with push operation..."));
11160
11161
  }
11161
11162
  const updatedMachineCodeAppDirectoryInfo = await readMachineCodeAppDirectoryInfo(currentDir);
@@ -11166,8 +11167,8 @@ function createPushCommand() {
11166
11167
  console.log();
11167
11168
  console.log(chalk.blue(`Pushing changes for project: ${updatedMachineCodeAppDirectoryInfo.appName}`));
11168
11169
  console.log(chalk.blue(`Design ID: ${updatedMachineCodeAppDirectoryInfo.designId}, App ID: ${updatedMachineCodeAppDirectoryInfo.applicationId}`));
11169
- const linkedAllocation = await checkIfDesignHasLiveAllocation(session, updatedMachineCodeAppDirectoryInfo.designId);
11170
- if (!linkedAllocation) {
11170
+ const connection = linkedConnection !== null && linkedConnection !== void 0 ? linkedConnection : await resolveConnection(session, updatedMachineCodeAppDirectoryInfo.designId);
11171
+ if (!connection) {
11171
11172
  console.log();
11172
11173
  console.error(chalk.red("Sorry, it seems you do not have that design open with the MachineLogic tab selected."));
11173
11174
  console.error(chalk.red("Please go to your browser, open your design, and navigate to the MachineLogic page."));
@@ -11185,7 +11186,7 @@ function createPushCommand() {
11185
11186
  uuid: updatedMachineCodeAppDirectoryInfo.uuid
11186
11187
  };
11187
11188
  console.log(chalk.blue("Pushing to digital twin..."));
11188
- await pushApplicationToDigitalTwin(session.environment, updatedMachineCodeAppDirectoryInfo.designId, linkedAllocation.sessionId, applicationToPush);
11189
+ await pushApplicationToDigitalTwin(connection, applicationToPush);
11189
11190
  await writeMachineCodeAppDirectoryInfo(currentDir, Object.assign(Object.assign({}, updatedMachineCodeAppDirectoryInfo), {
11190
11191
  lastPushedAt: new Date().toISOString()
11191
11192
  }));
@@ -11236,13 +11237,13 @@ function createLogsCommand() {
11236
11237
  console.error(chalk.red("Please run 'vention pull' or 'vention link' first."));
11237
11238
  process.exit(1);
11238
11239
  }
11239
- const linkedAllocation = await checkIfDesignHasLiveAllocation(session, machineCodeAppDirectoryInfo.designId);
11240
- if (!linkedAllocation) {
11240
+ const connection = await resolveConnection(session, machineCodeAppDirectoryInfo.designId);
11241
+ if (!connection) {
11241
11242
  console.error(chalk.red("Sorry, it seems you do not have that design open with the MachineLogic tab selected."));
11242
11243
  console.error(chalk.red("Please go to your browser, open your design, and navigate to the MachineLogic page."));
11243
11244
  process.exit(1);
11244
11245
  }
11245
- const logs = await getApplicationLogs(session.environment, linkedAllocation.designId, linkedAllocation.sessionId, machineCodeAppDirectoryInfo.applicationId);
11246
+ const logs = await getApplicationLogs(connection, machineCodeAppDirectoryInfo.applicationId);
11246
11247
  console.log(logs);
11247
11248
  } catch (error) {
11248
11249
  handleCommandError(error, "Failed to fetch application logs");