@dereekb/dbx-cli 13.23.0 → 13.25.0
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/eslint/index.cjs.js +2 -0
- package/eslint/index.esm.js +2 -0
- package/eslint/package.json +5 -4
- package/firebase-api-manifest/package.json +3 -3
- package/generate-firestore-indexes/main.js +2 -2
- package/generate-firestore-indexes/package.json +2 -2
- package/generate-mcp-manifest/package.json +3 -3
- package/generate-route-manifest/package.json +2 -2
- package/index.cjs.js +435 -991
- package/index.esm.js +433 -987
- package/lint-cache/package.json +2 -2
- package/manifest-extract/package.json +2 -2
- package/package.json +6 -6
- package/route/package.json +7 -7
- package/src/lib/auth/oidc.client.d.ts +7 -130
- package/src/lib/auth/oidc.flow.d.ts +9 -83
- package/src/lib/mcp-scan/manifest/css-utilities-schema.d.ts +2 -2
- package/src/lib/mcp-scan/manifest/pipes-schema.d.ts +2 -2
- package/test/package.json +9 -9
package/index.cjs.js
CHANGED
|
@@ -7,6 +7,7 @@ var util = require('@dereekb/util');
|
|
|
7
7
|
var date = require('@dereekb/date');
|
|
8
8
|
var nestjs = require('@dereekb/nestjs');
|
|
9
9
|
var node_os = require('node:os');
|
|
10
|
+
var oidc = require('@dereekb/util/oidc');
|
|
10
11
|
var node_readline = require('node:readline');
|
|
11
12
|
var model = require('@dereekb/model');
|
|
12
13
|
var yargs = require('yargs');
|
|
@@ -18,13 +19,13 @@ var node_url = require('node:url');
|
|
|
18
19
|
var posix = require('node:path/posix');
|
|
19
20
|
|
|
20
21
|
var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
|
|
21
|
-
function _array_like_to_array$
|
|
22
|
+
function _array_like_to_array$16(arr, len) {
|
|
22
23
|
if (len == null || len > arr.length) len = arr.length;
|
|
23
24
|
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
24
25
|
return arr2;
|
|
25
26
|
}
|
|
26
27
|
function _array_without_holes$$(arr) {
|
|
27
|
-
if (Array.isArray(arr)) return _array_like_to_array$
|
|
28
|
+
if (Array.isArray(arr)) return _array_like_to_array$16(arr);
|
|
28
29
|
}
|
|
29
30
|
function _assert_this_initialized(self) {
|
|
30
31
|
if (self === void 0) {
|
|
@@ -32,7 +33,7 @@ function _assert_this_initialized(self) {
|
|
|
32
33
|
}
|
|
33
34
|
return self;
|
|
34
35
|
}
|
|
35
|
-
function asyncGeneratorStep$
|
|
36
|
+
function asyncGeneratorStep$1e(gen, resolve, reject, _next, _throw, key, arg) {
|
|
36
37
|
try {
|
|
37
38
|
var info = gen[key](arg);
|
|
38
39
|
var value = info.value;
|
|
@@ -46,16 +47,16 @@ function asyncGeneratorStep$1f(gen, resolve, reject, _next, _throw, key, arg) {
|
|
|
46
47
|
Promise.resolve(value).then(_next, _throw);
|
|
47
48
|
}
|
|
48
49
|
}
|
|
49
|
-
function _async_to_generator$
|
|
50
|
+
function _async_to_generator$1e(fn) {
|
|
50
51
|
return function() {
|
|
51
52
|
var self = this, args = arguments;
|
|
52
53
|
return new Promise(function(resolve, reject) {
|
|
53
54
|
var gen = fn.apply(self, args);
|
|
54
55
|
function _next(value) {
|
|
55
|
-
asyncGeneratorStep$
|
|
56
|
+
asyncGeneratorStep$1e(gen, resolve, reject, _next, _throw, "next", value);
|
|
56
57
|
}
|
|
57
58
|
function _throw(err) {
|
|
58
|
-
asyncGeneratorStep$
|
|
59
|
+
asyncGeneratorStep$1e(gen, resolve, reject, _next, _throw, "throw", err);
|
|
59
60
|
}
|
|
60
61
|
_next(undefined);
|
|
61
62
|
});
|
|
@@ -87,7 +88,7 @@ function _construct(Parent, args, Class) {
|
|
|
87
88
|
}
|
|
88
89
|
return _construct.apply(null, arguments);
|
|
89
90
|
}
|
|
90
|
-
function _define_property$
|
|
91
|
+
function _define_property$N(obj, key, value) {
|
|
91
92
|
if (key in obj) {
|
|
92
93
|
Object.defineProperty(obj, key, {
|
|
93
94
|
value: value,
|
|
@@ -136,7 +137,7 @@ function _iterable_to_array$$(iter) {
|
|
|
136
137
|
function _non_iterable_spread$$() {
|
|
137
138
|
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
138
139
|
}
|
|
139
|
-
function _object_spread$
|
|
140
|
+
function _object_spread$N(target) {
|
|
140
141
|
for(var i = 1; i < arguments.length; i++){
|
|
141
142
|
var source = arguments[i] != null ? arguments[i] : {};
|
|
142
143
|
var ownKeys = Object.keys(source);
|
|
@@ -146,12 +147,12 @@ function _object_spread$M(target) {
|
|
|
146
147
|
}));
|
|
147
148
|
}
|
|
148
149
|
ownKeys.forEach(function(key) {
|
|
149
|
-
_define_property$
|
|
150
|
+
_define_property$N(target, key, source[key]);
|
|
150
151
|
});
|
|
151
152
|
}
|
|
152
153
|
return target;
|
|
153
154
|
}
|
|
154
|
-
function ownKeys$
|
|
155
|
+
function ownKeys$w(object, enumerableOnly) {
|
|
155
156
|
var keys = Object.keys(object);
|
|
156
157
|
if (Object.getOwnPropertySymbols) {
|
|
157
158
|
var symbols = Object.getOwnPropertySymbols(object);
|
|
@@ -159,12 +160,12 @@ function ownKeys$u(object, enumerableOnly) {
|
|
|
159
160
|
}
|
|
160
161
|
return keys;
|
|
161
162
|
}
|
|
162
|
-
function _object_spread_props$
|
|
163
|
+
function _object_spread_props$w(target, source) {
|
|
163
164
|
source = source != null ? source : {};
|
|
164
165
|
if (Object.getOwnPropertyDescriptors) {
|
|
165
166
|
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
166
167
|
} else {
|
|
167
|
-
ownKeys$
|
|
168
|
+
ownKeys$w(Object(source)).forEach(function(key) {
|
|
168
169
|
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
169
170
|
});
|
|
170
171
|
}
|
|
@@ -184,19 +185,19 @@ function _set_prototype_of(o, p) {
|
|
|
184
185
|
return _set_prototype_of(o, p);
|
|
185
186
|
}
|
|
186
187
|
function _to_consumable_array$$(arr) {
|
|
187
|
-
return _array_without_holes$$(arr) || _iterable_to_array$$(arr) || _unsupported_iterable_to_array$
|
|
188
|
+
return _array_without_holes$$(arr) || _iterable_to_array$$(arr) || _unsupported_iterable_to_array$16(arr) || _non_iterable_spread$$();
|
|
188
189
|
}
|
|
189
190
|
function _type_of$2(obj) {
|
|
190
191
|
"@swc/helpers - typeof";
|
|
191
192
|
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
192
193
|
}
|
|
193
|
-
function _unsupported_iterable_to_array$
|
|
194
|
+
function _unsupported_iterable_to_array$16(o, minLen) {
|
|
194
195
|
if (!o) return;
|
|
195
|
-
if (typeof o === "string") return _array_like_to_array$
|
|
196
|
+
if (typeof o === "string") return _array_like_to_array$16(o, minLen);
|
|
196
197
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
197
198
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
198
199
|
if (n === "Map" || n === "Set") return Array.from(n);
|
|
199
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$
|
|
200
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$16(o, minLen);
|
|
200
201
|
}
|
|
201
202
|
function _wrap_native_super(Class) {
|
|
202
203
|
var _cache = typeof Map === "function" ? new Map() : undefined;
|
|
@@ -232,7 +233,7 @@ function _is_native_reflect_construct() {
|
|
|
232
233
|
return !!result;
|
|
233
234
|
})();
|
|
234
235
|
}
|
|
235
|
-
function _ts_generator$
|
|
236
|
+
function _ts_generator$1e(thisArg, body) {
|
|
236
237
|
var f, y, t, _ = {
|
|
237
238
|
label: 0,
|
|
238
239
|
sent: function() {
|
|
@@ -416,10 +417,10 @@ var _timeoutMs = DEFAULT_CLI_HTTP_TIMEOUT_MS;
|
|
|
416
417
|
* @param init - The RequestInit. Any existing `signal` is preserved; we only attach our own when no signal was supplied.
|
|
417
418
|
* @returns The fetch Response.
|
|
418
419
|
*/ function tracedFetch(fetcher, input, init) {
|
|
419
|
-
return _async_to_generator$
|
|
420
|
+
return _async_to_generator$1e(function() {
|
|
420
421
|
var _ref, fetchImpl, timeoutMs, method, url, controller, timeoutHandle, finalInit, // Don't let the abort timer itself keep the Node event loop (or a test worker) alive.
|
|
421
422
|
_timeoutHandle_unref, localController, e;
|
|
422
|
-
return _ts_generator$
|
|
423
|
+
return _ts_generator$1e(this, function(_state) {
|
|
423
424
|
switch(_state.label){
|
|
424
425
|
case 0:
|
|
425
426
|
fetchImpl = fetcher !== null && fetcher !== void 0 ? fetcher : fetch;
|
|
@@ -441,7 +442,7 @@ var _timeoutMs = DEFAULT_CLI_HTTP_TIMEOUT_MS;
|
|
|
441
442
|
return localController.abort();
|
|
442
443
|
}, timeoutMs);
|
|
443
444
|
(_timeoutHandle_unref = timeoutHandle.unref) === null || _timeoutHandle_unref === void 0 ? void 0 : _timeoutHandle_unref.call(timeoutHandle);
|
|
444
|
-
finalInit = _object_spread_props$
|
|
445
|
+
finalInit = _object_spread_props$w(_object_spread$N({}, init), {
|
|
445
446
|
signal: localController.signal
|
|
446
447
|
});
|
|
447
448
|
}
|
|
@@ -590,7 +591,7 @@ function dumpResponse(data, meta) {
|
|
|
590
591
|
if (!filePath) {
|
|
591
592
|
return;
|
|
592
593
|
}
|
|
593
|
-
var content = _object_spread$
|
|
594
|
+
var content = _object_spread$N({
|
|
594
595
|
ok: true,
|
|
595
596
|
data: data
|
|
596
597
|
}, meta ? {
|
|
@@ -667,7 +668,7 @@ function stringifyEnvelope(value) {
|
|
|
667
668
|
*/ function outputResult(data, meta) {
|
|
668
669
|
dumpResponse(data, meta);
|
|
669
670
|
var outputData = _outputOptions.pick ? pickFields(data, _outputOptions.pick) : data;
|
|
670
|
-
var output = _object_spread$
|
|
671
|
+
var output = _object_spread$N({
|
|
671
672
|
ok: true,
|
|
672
673
|
data: outputData
|
|
673
674
|
}, meta ? {
|
|
@@ -696,7 +697,7 @@ function stringifyEnvelope(value) {
|
|
|
696
697
|
var _this;
|
|
697
698
|
_this = _call_super(this, CliError, [
|
|
698
699
|
input.message
|
|
699
|
-
]), _define_property$
|
|
700
|
+
]), _define_property$N(_this, "code", void 0), _define_property$N(_this, "suggestion", void 0);
|
|
700
701
|
_this.name = 'CliError';
|
|
701
702
|
_this.code = input.code;
|
|
702
703
|
_this.suggestion = input.suggestion;
|
|
@@ -724,7 +725,7 @@ function stringifyEnvelope(value) {
|
|
|
724
725
|
if (mapped) {
|
|
725
726
|
result = mapped;
|
|
726
727
|
} else if (_instanceof$o(error, CliError)) {
|
|
727
|
-
result = _object_spread$
|
|
728
|
+
result = _object_spread$N({
|
|
728
729
|
ok: false,
|
|
729
730
|
error: sanitizeString(error.message),
|
|
730
731
|
code: error.code
|
|
@@ -747,15 +748,15 @@ function stringifyEnvelope(value) {
|
|
|
747
748
|
return result;
|
|
748
749
|
}
|
|
749
750
|
|
|
750
|
-
function _array_like_to_array$
|
|
751
|
+
function _array_like_to_array$15(arr, len) {
|
|
751
752
|
if (len == null || len > arr.length) len = arr.length;
|
|
752
753
|
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
753
754
|
return arr2;
|
|
754
755
|
}
|
|
755
756
|
function _array_without_holes$_(arr) {
|
|
756
|
-
if (Array.isArray(arr)) return _array_like_to_array$
|
|
757
|
+
if (Array.isArray(arr)) return _array_like_to_array$15(arr);
|
|
757
758
|
}
|
|
758
|
-
function asyncGeneratorStep$
|
|
759
|
+
function asyncGeneratorStep$1d(gen, resolve, reject, _next, _throw, key, arg) {
|
|
759
760
|
try {
|
|
760
761
|
var info = gen[key](arg);
|
|
761
762
|
var value = info.value;
|
|
@@ -769,22 +770,22 @@ function asyncGeneratorStep$1e(gen, resolve, reject, _next, _throw, key, arg) {
|
|
|
769
770
|
Promise.resolve(value).then(_next, _throw);
|
|
770
771
|
}
|
|
771
772
|
}
|
|
772
|
-
function _async_to_generator$
|
|
773
|
+
function _async_to_generator$1d(fn) {
|
|
773
774
|
return function() {
|
|
774
775
|
var self = this, args = arguments;
|
|
775
776
|
return new Promise(function(resolve, reject) {
|
|
776
777
|
var gen = fn.apply(self, args);
|
|
777
778
|
function _next(value) {
|
|
778
|
-
asyncGeneratorStep$
|
|
779
|
+
asyncGeneratorStep$1d(gen, resolve, reject, _next, _throw, "next", value);
|
|
779
780
|
}
|
|
780
781
|
function _throw(err) {
|
|
781
|
-
asyncGeneratorStep$
|
|
782
|
+
asyncGeneratorStep$1d(gen, resolve, reject, _next, _throw, "throw", err);
|
|
782
783
|
}
|
|
783
784
|
_next(undefined);
|
|
784
785
|
});
|
|
785
786
|
};
|
|
786
787
|
}
|
|
787
|
-
function _define_property$
|
|
788
|
+
function _define_property$M(obj, key, value) {
|
|
788
789
|
if (key in obj) {
|
|
789
790
|
Object.defineProperty(obj, key, {
|
|
790
791
|
value: value,
|
|
@@ -803,7 +804,7 @@ function _iterable_to_array$_(iter) {
|
|
|
803
804
|
function _non_iterable_spread$_() {
|
|
804
805
|
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
805
806
|
}
|
|
806
|
-
function _object_spread$
|
|
807
|
+
function _object_spread$M(target) {
|
|
807
808
|
for(var i = 1; i < arguments.length; i++){
|
|
808
809
|
var source = arguments[i] != null ? arguments[i] : {};
|
|
809
810
|
var ownKeys = Object.keys(source);
|
|
@@ -813,12 +814,12 @@ function _object_spread$L(target) {
|
|
|
813
814
|
}));
|
|
814
815
|
}
|
|
815
816
|
ownKeys.forEach(function(key) {
|
|
816
|
-
_define_property$
|
|
817
|
+
_define_property$M(target, key, source[key]);
|
|
817
818
|
});
|
|
818
819
|
}
|
|
819
820
|
return target;
|
|
820
821
|
}
|
|
821
|
-
function ownKeys$
|
|
822
|
+
function ownKeys$v(object, enumerableOnly) {
|
|
822
823
|
var keys = Object.keys(object);
|
|
823
824
|
if (Object.getOwnPropertySymbols) {
|
|
824
825
|
var symbols = Object.getOwnPropertySymbols(object);
|
|
@@ -826,33 +827,33 @@ function ownKeys$t(object, enumerableOnly) {
|
|
|
826
827
|
}
|
|
827
828
|
return keys;
|
|
828
829
|
}
|
|
829
|
-
function _object_spread_props$
|
|
830
|
+
function _object_spread_props$v(target, source) {
|
|
830
831
|
source = source != null ? source : {};
|
|
831
832
|
if (Object.getOwnPropertyDescriptors) {
|
|
832
833
|
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
833
834
|
} else {
|
|
834
|
-
ownKeys$
|
|
835
|
+
ownKeys$v(Object(source)).forEach(function(key) {
|
|
835
836
|
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
836
837
|
});
|
|
837
838
|
}
|
|
838
839
|
return target;
|
|
839
840
|
}
|
|
840
841
|
function _to_consumable_array$_(arr) {
|
|
841
|
-
return _array_without_holes$_(arr) || _iterable_to_array$_(arr) || _unsupported_iterable_to_array$
|
|
842
|
+
return _array_without_holes$_(arr) || _iterable_to_array$_(arr) || _unsupported_iterable_to_array$15(arr) || _non_iterable_spread$_();
|
|
842
843
|
}
|
|
843
844
|
function _type_of$1(obj) {
|
|
844
845
|
"@swc/helpers - typeof";
|
|
845
846
|
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
846
847
|
}
|
|
847
|
-
function _unsupported_iterable_to_array$
|
|
848
|
+
function _unsupported_iterable_to_array$15(o, minLen) {
|
|
848
849
|
if (!o) return;
|
|
849
|
-
if (typeof o === "string") return _array_like_to_array$
|
|
850
|
+
if (typeof o === "string") return _array_like_to_array$15(o, minLen);
|
|
850
851
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
851
852
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
852
853
|
if (n === "Map" || n === "Set") return Array.from(n);
|
|
853
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$
|
|
854
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$15(o, minLen);
|
|
854
855
|
}
|
|
855
|
-
function _ts_generator$
|
|
856
|
+
function _ts_generator$1d(thisArg, body) {
|
|
856
857
|
var f, y, t, _ = {
|
|
857
858
|
label: 0,
|
|
858
859
|
sent: function() {
|
|
@@ -964,14 +965,14 @@ var MAX_MODEL_ACCESS_MULTI_READ_KEYS = 50;
|
|
|
964
965
|
* @param input - The call envelope describing the API target, access token, model params, and optional fetch override.
|
|
965
966
|
* @returns The parsed JSON response body cast to `R`.
|
|
966
967
|
*/ function callModelOverHttp(input) {
|
|
967
|
-
return _async_to_generator$
|
|
968
|
+
return _async_to_generator$1d(function() {
|
|
968
969
|
var _input_params_call;
|
|
969
|
-
return _ts_generator$
|
|
970
|
+
return _ts_generator$1d(this, function(_state) {
|
|
970
971
|
return [
|
|
971
972
|
2,
|
|
972
973
|
requestJson({
|
|
973
974
|
method: 'POST',
|
|
974
|
-
url: "".concat(trimSlash
|
|
975
|
+
url: "".concat(trimSlash(input.apiBaseUrl)).concat(CALL_MODEL_API_PATH),
|
|
975
976
|
accessToken: input.accessToken,
|
|
976
977
|
jsonBody: input.params,
|
|
977
978
|
fetcher: input.fetcher,
|
|
@@ -994,13 +995,13 @@ var MAX_MODEL_ACCESS_MULTI_READ_KEYS = 50;
|
|
|
994
995
|
* @param input - The request envelope describing the API target, access token, model + key, and optional fetch override.
|
|
995
996
|
* @returns The parsed `{ key, data }` envelope.
|
|
996
997
|
*/ function getModelOverHttp(input) {
|
|
997
|
-
return _async_to_generator$
|
|
998
|
-
return _ts_generator$
|
|
998
|
+
return _async_to_generator$1d(function() {
|
|
999
|
+
return _ts_generator$1d(this, function(_state) {
|
|
999
1000
|
return [
|
|
1000
1001
|
2,
|
|
1001
1002
|
requestJson({
|
|
1002
1003
|
method: 'GET',
|
|
1003
|
-
url: "".concat(trimSlash
|
|
1004
|
+
url: "".concat(trimSlash(input.apiBaseUrl), "/model/").concat(encodeURIComponent(input.modelType), "/get?key=").concat(encodeURIComponent(input.key)),
|
|
1004
1005
|
accessToken: input.accessToken,
|
|
1005
1006
|
fetcher: input.fetcher,
|
|
1006
1007
|
errorPrefix: "get ".concat(input.modelType, "/").concat(input.key, " failed")
|
|
@@ -1023,8 +1024,8 @@ var MAX_MODEL_ACCESS_MULTI_READ_KEYS = 50;
|
|
|
1023
1024
|
* @param input - The request envelope describing the API target, access token, model, keys, and optional fetch override.
|
|
1024
1025
|
* @returns The parsed `{ results, errors }` envelope.
|
|
1025
1026
|
*/ function getMultipleModelsOverHttp(input) {
|
|
1026
|
-
return _async_to_generator$
|
|
1027
|
-
return _ts_generator$
|
|
1027
|
+
return _async_to_generator$1d(function() {
|
|
1028
|
+
return _ts_generator$1d(this, function(_state) {
|
|
1028
1029
|
if (input.keys.length === 0) {
|
|
1029
1030
|
throw new CliError({
|
|
1030
1031
|
message: 'get-many requires at least one key.',
|
|
@@ -1041,7 +1042,7 @@ var MAX_MODEL_ACCESS_MULTI_READ_KEYS = 50;
|
|
|
1041
1042
|
2,
|
|
1042
1043
|
requestJson({
|
|
1043
1044
|
method: 'POST',
|
|
1044
|
-
url: "".concat(trimSlash
|
|
1045
|
+
url: "".concat(trimSlash(input.apiBaseUrl), "/model/").concat(encodeURIComponent(input.modelType), "/get"),
|
|
1045
1046
|
accessToken: input.accessToken,
|
|
1046
1047
|
jsonBody: {
|
|
1047
1048
|
keys: input.keys
|
|
@@ -1062,9 +1063,9 @@ var MAX_MODEL_ACCESS_MULTI_READ_KEYS = 50;
|
|
|
1062
1063
|
* @param input - Same shape as {@link GetMultipleModelsOverHttpInput} but without the 50-key cap.
|
|
1063
1064
|
* @returns The merged `{ results, errors }` envelope across all chunks.
|
|
1064
1065
|
*/ function getMultipleModelsOverHttpChunked(input) {
|
|
1065
|
-
return _async_to_generator$
|
|
1066
|
+
return _async_to_generator$1d(function() {
|
|
1066
1067
|
var chunks, i, mergedResults, mergedErrors, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, chunk, _mergedResults, _mergedErrors, batch, err;
|
|
1067
|
-
return _ts_generator$
|
|
1068
|
+
return _ts_generator$1d(this, function(_state) {
|
|
1068
1069
|
switch(_state.label){
|
|
1069
1070
|
case 0:
|
|
1070
1071
|
if (input.keys.length === 0) {
|
|
@@ -1098,7 +1099,7 @@ var MAX_MODEL_ACCESS_MULTI_READ_KEYS = 50;
|
|
|
1098
1099
|
chunk = _step.value;
|
|
1099
1100
|
return [
|
|
1100
1101
|
4,
|
|
1101
|
-
getMultipleModelsOverHttp(_object_spread_props$
|
|
1102
|
+
getMultipleModelsOverHttp(_object_spread_props$v(_object_spread$M({}, input), {
|
|
1102
1103
|
keys: chunk
|
|
1103
1104
|
}))
|
|
1104
1105
|
];
|
|
@@ -1152,15 +1153,15 @@ var MAX_MODEL_ACCESS_MULTI_READ_KEYS = 50;
|
|
|
1152
1153
|
})();
|
|
1153
1154
|
}
|
|
1154
1155
|
function requestJson(input) {
|
|
1155
|
-
return _async_to_generator$
|
|
1156
|
+
return _async_to_generator$1d(function() {
|
|
1156
1157
|
var hasJsonBody, init, res, _ref, ok, body, fallbackMessage;
|
|
1157
|
-
return _ts_generator$
|
|
1158
|
+
return _ts_generator$1d(this, function(_state) {
|
|
1158
1159
|
switch(_state.label){
|
|
1159
1160
|
case 0:
|
|
1160
1161
|
hasJsonBody = input.jsonBody !== undefined;
|
|
1161
|
-
init = _object_spread$
|
|
1162
|
+
init = _object_spread$M({
|
|
1162
1163
|
method: input.method,
|
|
1163
|
-
headers: _object_spread$
|
|
1164
|
+
headers: _object_spread$M({
|
|
1164
1165
|
Accept: 'application/json',
|
|
1165
1166
|
Authorization: "Bearer ".concat(input.accessToken)
|
|
1166
1167
|
}, hasJsonBody ? {
|
|
@@ -1197,9 +1198,9 @@ function requestJson(input) {
|
|
|
1197
1198
|
})();
|
|
1198
1199
|
}
|
|
1199
1200
|
function readJsonResponse(res) {
|
|
1200
|
-
return _async_to_generator$
|
|
1201
|
+
return _async_to_generator$1d(function() {
|
|
1201
1202
|
var text, body;
|
|
1202
|
-
return _ts_generator$
|
|
1203
|
+
return _ts_generator$1d(this, function(_state) {
|
|
1203
1204
|
switch(_state.label){
|
|
1204
1205
|
case 0:
|
|
1205
1206
|
return [
|
|
@@ -1251,7 +1252,7 @@ function codeForStatus(status) {
|
|
|
1251
1252
|
}
|
|
1252
1253
|
return result;
|
|
1253
1254
|
}
|
|
1254
|
-
function trimSlash
|
|
1255
|
+
function trimSlash(url) {
|
|
1255
1256
|
return url.endsWith('/') ? url.slice(0, -1) : url;
|
|
1256
1257
|
}
|
|
1257
1258
|
|
|
@@ -1355,7 +1356,7 @@ var getCliContext = _cliContextSlot.get;
|
|
|
1355
1356
|
};
|
|
1356
1357
|
}
|
|
1357
1358
|
|
|
1358
|
-
function asyncGeneratorStep$
|
|
1359
|
+
function asyncGeneratorStep$1c(gen, resolve, reject, _next, _throw, key, arg) {
|
|
1359
1360
|
try {
|
|
1360
1361
|
var info = gen[key](arg);
|
|
1361
1362
|
var value = info.value;
|
|
@@ -1369,22 +1370,22 @@ function asyncGeneratorStep$1d(gen, resolve, reject, _next, _throw, key, arg) {
|
|
|
1369
1370
|
Promise.resolve(value).then(_next, _throw);
|
|
1370
1371
|
}
|
|
1371
1372
|
}
|
|
1372
|
-
function _async_to_generator$
|
|
1373
|
+
function _async_to_generator$1c(fn) {
|
|
1373
1374
|
return function() {
|
|
1374
1375
|
var self = this, args = arguments;
|
|
1375
1376
|
return new Promise(function(resolve, reject) {
|
|
1376
1377
|
var gen = fn.apply(self, args);
|
|
1377
1378
|
function _next(value) {
|
|
1378
|
-
asyncGeneratorStep$
|
|
1379
|
+
asyncGeneratorStep$1c(gen, resolve, reject, _next, _throw, "next", value);
|
|
1379
1380
|
}
|
|
1380
1381
|
function _throw(err) {
|
|
1381
|
-
asyncGeneratorStep$
|
|
1382
|
+
asyncGeneratorStep$1c(gen, resolve, reject, _next, _throw, "throw", err);
|
|
1382
1383
|
}
|
|
1383
1384
|
_next(undefined);
|
|
1384
1385
|
});
|
|
1385
1386
|
};
|
|
1386
1387
|
}
|
|
1387
|
-
function _ts_generator$
|
|
1388
|
+
function _ts_generator$1c(thisArg, body) {
|
|
1388
1389
|
var f, y, t, _ = {
|
|
1389
1390
|
label: 0,
|
|
1390
1391
|
sent: function() {
|
|
@@ -1497,9 +1498,9 @@ function _ts_generator$1d(thisArg, body) {
|
|
|
1497
1498
|
*/ function wrapCommandHandler(handler) {
|
|
1498
1499
|
var exitCode = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : CLI_EXIT_CODE_HANDLER;
|
|
1499
1500
|
return function(argv) {
|
|
1500
|
-
return _async_to_generator$
|
|
1501
|
+
return _async_to_generator$1c(function() {
|
|
1501
1502
|
var e;
|
|
1502
|
-
return _ts_generator$
|
|
1503
|
+
return _ts_generator$1c(this, function(_state) {
|
|
1503
1504
|
switch(_state.label){
|
|
1504
1505
|
case 0:
|
|
1505
1506
|
_state.trys.push([
|
|
@@ -1560,7 +1561,7 @@ function _ts_generator$1d(thisArg, body) {
|
|
|
1560
1561
|
};
|
|
1561
1562
|
}
|
|
1562
1563
|
|
|
1563
|
-
function asyncGeneratorStep$
|
|
1564
|
+
function asyncGeneratorStep$1b(gen, resolve, reject, _next, _throw, key, arg) {
|
|
1564
1565
|
try {
|
|
1565
1566
|
var info = gen[key](arg);
|
|
1566
1567
|
var value = info.value;
|
|
@@ -1574,22 +1575,22 @@ function asyncGeneratorStep$1c(gen, resolve, reject, _next, _throw, key, arg) {
|
|
|
1574
1575
|
Promise.resolve(value).then(_next, _throw);
|
|
1575
1576
|
}
|
|
1576
1577
|
}
|
|
1577
|
-
function _async_to_generator$
|
|
1578
|
+
function _async_to_generator$1b(fn) {
|
|
1578
1579
|
return function() {
|
|
1579
1580
|
var self = this, args = arguments;
|
|
1580
1581
|
return new Promise(function(resolve, reject) {
|
|
1581
1582
|
var gen = fn.apply(self, args);
|
|
1582
1583
|
function _next(value) {
|
|
1583
|
-
asyncGeneratorStep$
|
|
1584
|
+
asyncGeneratorStep$1b(gen, resolve, reject, _next, _throw, "next", value);
|
|
1584
1585
|
}
|
|
1585
1586
|
function _throw(err) {
|
|
1586
|
-
asyncGeneratorStep$
|
|
1587
|
+
asyncGeneratorStep$1b(gen, resolve, reject, _next, _throw, "throw", err);
|
|
1587
1588
|
}
|
|
1588
1589
|
_next(undefined);
|
|
1589
1590
|
});
|
|
1590
1591
|
};
|
|
1591
1592
|
}
|
|
1592
|
-
function _ts_generator$
|
|
1593
|
+
function _ts_generator$1b(thisArg, body) {
|
|
1593
1594
|
var f, y, t, _ = {
|
|
1594
1595
|
label: 0,
|
|
1595
1596
|
sent: function() {
|
|
@@ -1709,9 +1710,9 @@ function _ts_generator$1c(thisArg, body) {
|
|
|
1709
1710
|
return spec.helpEpilogue ? built.epilogue(spec.helpEpilogue) : built;
|
|
1710
1711
|
},
|
|
1711
1712
|
handler: wrapCommandHandler(function(argv) {
|
|
1712
|
-
return _async_to_generator$
|
|
1713
|
+
return _async_to_generator$1b(function() {
|
|
1713
1714
|
var context, result;
|
|
1714
|
-
return _ts_generator$
|
|
1715
|
+
return _ts_generator$1b(this, function(_state) {
|
|
1715
1716
|
switch(_state.label){
|
|
1716
1717
|
case 0:
|
|
1717
1718
|
context = requireCliContext();
|
|
@@ -1735,21 +1736,21 @@ function _ts_generator$1c(thisArg, body) {
|
|
|
1735
1736
|
};
|
|
1736
1737
|
}
|
|
1737
1738
|
|
|
1738
|
-
function _array_like_to_array$
|
|
1739
|
+
function _array_like_to_array$14(arr, len) {
|
|
1739
1740
|
if (len == null || len > arr.length) len = arr.length;
|
|
1740
1741
|
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
1741
1742
|
return arr2;
|
|
1742
1743
|
}
|
|
1743
|
-
function _array_with_holes$
|
|
1744
|
+
function _array_with_holes$i(arr) {
|
|
1744
1745
|
if (Array.isArray(arr)) return arr;
|
|
1745
1746
|
}
|
|
1746
1747
|
function _array_without_holes$Z(arr) {
|
|
1747
|
-
if (Array.isArray(arr)) return _array_like_to_array$
|
|
1748
|
+
if (Array.isArray(arr)) return _array_like_to_array$14(arr);
|
|
1748
1749
|
}
|
|
1749
1750
|
function _iterable_to_array$Z(iter) {
|
|
1750
1751
|
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
1751
1752
|
}
|
|
1752
|
-
function _iterable_to_array_limit$
|
|
1753
|
+
function _iterable_to_array_limit$i(arr, i) {
|
|
1753
1754
|
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
1754
1755
|
if (_i == null) return;
|
|
1755
1756
|
var _arr = [];
|
|
@@ -1773,25 +1774,25 @@ function _iterable_to_array_limit$j(arr, i) {
|
|
|
1773
1774
|
}
|
|
1774
1775
|
return _arr;
|
|
1775
1776
|
}
|
|
1776
|
-
function _non_iterable_rest$
|
|
1777
|
+
function _non_iterable_rest$i() {
|
|
1777
1778
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
1778
1779
|
}
|
|
1779
1780
|
function _non_iterable_spread$Z() {
|
|
1780
1781
|
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
1781
1782
|
}
|
|
1782
|
-
function _sliced_to_array$
|
|
1783
|
-
return _array_with_holes$
|
|
1783
|
+
function _sliced_to_array$i(arr, i) {
|
|
1784
|
+
return _array_with_holes$i(arr) || _iterable_to_array_limit$i(arr, i) || _unsupported_iterable_to_array$14(arr, i) || _non_iterable_rest$i();
|
|
1784
1785
|
}
|
|
1785
1786
|
function _to_consumable_array$Z(arr) {
|
|
1786
|
-
return _array_without_holes$Z(arr) || _iterable_to_array$Z(arr) || _unsupported_iterable_to_array$
|
|
1787
|
+
return _array_without_holes$Z(arr) || _iterable_to_array$Z(arr) || _unsupported_iterable_to_array$14(arr) || _non_iterable_spread$Z();
|
|
1787
1788
|
}
|
|
1788
|
-
function _unsupported_iterable_to_array$
|
|
1789
|
+
function _unsupported_iterable_to_array$14(o, minLen) {
|
|
1789
1790
|
if (!o) return;
|
|
1790
|
-
if (typeof o === "string") return _array_like_to_array$
|
|
1791
|
+
if (typeof o === "string") return _array_like_to_array$14(o, minLen);
|
|
1791
1792
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
1792
1793
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
1793
1794
|
if (n === "Map" || n === "Set") return Array.from(n);
|
|
1794
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$
|
|
1795
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$14(o, minLen);
|
|
1795
1796
|
}
|
|
1796
1797
|
/**
|
|
1797
1798
|
* Default name of the parent command that groups all registered action specs.
|
|
@@ -1847,7 +1848,7 @@ function _unsupported_iterable_to_array$15(o, minLen) {
|
|
|
1847
1848
|
}
|
|
1848
1849
|
}
|
|
1849
1850
|
var sortedModels = _to_consumable_array$Z(byModel.entries()).sort(function(param, param1) {
|
|
1850
|
-
var _param = _sliced_to_array$
|
|
1851
|
+
var _param = _sliced_to_array$i(param, 1), a = _param[0], _param1 = _sliced_to_array$i(param1, 1), b = _param1[0];
|
|
1851
1852
|
return a.localeCompare(b);
|
|
1852
1853
|
});
|
|
1853
1854
|
result = [
|
|
@@ -1878,7 +1879,7 @@ function _unsupported_iterable_to_array$15(o, minLen) {
|
|
|
1878
1879
|
var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = undefined;
|
|
1879
1880
|
try {
|
|
1880
1881
|
var _loop = function() {
|
|
1881
|
-
var _step_value = _sliced_to_array$
|
|
1882
|
+
var _step_value = _sliced_to_array$i(_step1.value, 2), model = _step_value[0], modelSpecs = _step_value[1];
|
|
1882
1883
|
yargs.command({
|
|
1883
1884
|
command: "".concat(model, " <action>"),
|
|
1884
1885
|
describe: "Composite actions scoped to model '".concat(model, "' (").concat(modelSpecs.length, ")."),
|
|
@@ -1936,18 +1937,18 @@ function _unsupported_iterable_to_array$15(o, minLen) {
|
|
|
1936
1937
|
return result;
|
|
1937
1938
|
}
|
|
1938
1939
|
|
|
1939
|
-
function _array_like_to_array$
|
|
1940
|
+
function _array_like_to_array$13(arr, len) {
|
|
1940
1941
|
if (len == null || len > arr.length) len = arr.length;
|
|
1941
1942
|
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
1942
1943
|
return arr2;
|
|
1943
1944
|
}
|
|
1944
|
-
function _array_with_holes$
|
|
1945
|
+
function _array_with_holes$h(arr) {
|
|
1945
1946
|
if (Array.isArray(arr)) return arr;
|
|
1946
1947
|
}
|
|
1947
1948
|
function _array_without_holes$Y(arr) {
|
|
1948
|
-
if (Array.isArray(arr)) return _array_like_to_array$
|
|
1949
|
+
if (Array.isArray(arr)) return _array_like_to_array$13(arr);
|
|
1949
1950
|
}
|
|
1950
|
-
function asyncGeneratorStep$
|
|
1951
|
+
function asyncGeneratorStep$1a(gen, resolve, reject, _next, _throw, key, arg) {
|
|
1951
1952
|
try {
|
|
1952
1953
|
var info = gen[key](arg);
|
|
1953
1954
|
var value = info.value;
|
|
@@ -1961,22 +1962,22 @@ function asyncGeneratorStep$1b(gen, resolve, reject, _next, _throw, key, arg) {
|
|
|
1961
1962
|
Promise.resolve(value).then(_next, _throw);
|
|
1962
1963
|
}
|
|
1963
1964
|
}
|
|
1964
|
-
function _async_to_generator$
|
|
1965
|
+
function _async_to_generator$1a(fn) {
|
|
1965
1966
|
return function() {
|
|
1966
1967
|
var self = this, args = arguments;
|
|
1967
1968
|
return new Promise(function(resolve, reject) {
|
|
1968
1969
|
var gen = fn.apply(self, args);
|
|
1969
1970
|
function _next(value) {
|
|
1970
|
-
asyncGeneratorStep$
|
|
1971
|
+
asyncGeneratorStep$1a(gen, resolve, reject, _next, _throw, "next", value);
|
|
1971
1972
|
}
|
|
1972
1973
|
function _throw(err) {
|
|
1973
|
-
asyncGeneratorStep$
|
|
1974
|
+
asyncGeneratorStep$1a(gen, resolve, reject, _next, _throw, "throw", err);
|
|
1974
1975
|
}
|
|
1975
1976
|
_next(undefined);
|
|
1976
1977
|
});
|
|
1977
1978
|
};
|
|
1978
1979
|
}
|
|
1979
|
-
function _define_property$
|
|
1980
|
+
function _define_property$L(obj, key, value) {
|
|
1980
1981
|
if (key in obj) {
|
|
1981
1982
|
Object.defineProperty(obj, key, {
|
|
1982
1983
|
value: value,
|
|
@@ -1992,7 +1993,7 @@ function _define_property$K(obj, key, value) {
|
|
|
1992
1993
|
function _iterable_to_array$Y(iter) {
|
|
1993
1994
|
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
1994
1995
|
}
|
|
1995
|
-
function _iterable_to_array_limit$
|
|
1996
|
+
function _iterable_to_array_limit$h(arr, i) {
|
|
1996
1997
|
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
1997
1998
|
if (_i == null) return;
|
|
1998
1999
|
var _arr = [];
|
|
@@ -2016,13 +2017,13 @@ function _iterable_to_array_limit$i(arr, i) {
|
|
|
2016
2017
|
}
|
|
2017
2018
|
return _arr;
|
|
2018
2019
|
}
|
|
2019
|
-
function _non_iterable_rest$
|
|
2020
|
+
function _non_iterable_rest$h() {
|
|
2020
2021
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
2021
2022
|
}
|
|
2022
2023
|
function _non_iterable_spread$Y() {
|
|
2023
2024
|
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
2024
2025
|
}
|
|
2025
|
-
function _object_spread$
|
|
2026
|
+
function _object_spread$L(target) {
|
|
2026
2027
|
for(var i = 1; i < arguments.length; i++){
|
|
2027
2028
|
var source = arguments[i] != null ? arguments[i] : {};
|
|
2028
2029
|
var ownKeys = Object.keys(source);
|
|
@@ -2032,12 +2033,12 @@ function _object_spread$K(target) {
|
|
|
2032
2033
|
}));
|
|
2033
2034
|
}
|
|
2034
2035
|
ownKeys.forEach(function(key) {
|
|
2035
|
-
_define_property$
|
|
2036
|
+
_define_property$L(target, key, source[key]);
|
|
2036
2037
|
});
|
|
2037
2038
|
}
|
|
2038
2039
|
return target;
|
|
2039
2040
|
}
|
|
2040
|
-
function ownKeys$
|
|
2041
|
+
function ownKeys$u(object, enumerableOnly) {
|
|
2041
2042
|
var keys = Object.keys(object);
|
|
2042
2043
|
if (Object.getOwnPropertySymbols) {
|
|
2043
2044
|
var symbols = Object.getOwnPropertySymbols(object);
|
|
@@ -2045,32 +2046,32 @@ function ownKeys$s(object, enumerableOnly) {
|
|
|
2045
2046
|
}
|
|
2046
2047
|
return keys;
|
|
2047
2048
|
}
|
|
2048
|
-
function _object_spread_props$
|
|
2049
|
+
function _object_spread_props$u(target, source) {
|
|
2049
2050
|
source = source != null ? source : {};
|
|
2050
2051
|
if (Object.getOwnPropertyDescriptors) {
|
|
2051
2052
|
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
2052
2053
|
} else {
|
|
2053
|
-
ownKeys$
|
|
2054
|
+
ownKeys$u(Object(source)).forEach(function(key) {
|
|
2054
2055
|
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
2055
2056
|
});
|
|
2056
2057
|
}
|
|
2057
2058
|
return target;
|
|
2058
2059
|
}
|
|
2059
|
-
function _sliced_to_array$
|
|
2060
|
-
return _array_with_holes$
|
|
2060
|
+
function _sliced_to_array$h(arr, i) {
|
|
2061
|
+
return _array_with_holes$h(arr) || _iterable_to_array_limit$h(arr, i) || _unsupported_iterable_to_array$13(arr, i) || _non_iterable_rest$h();
|
|
2061
2062
|
}
|
|
2062
2063
|
function _to_consumable_array$Y(arr) {
|
|
2063
|
-
return _array_without_holes$Y(arr) || _iterable_to_array$Y(arr) || _unsupported_iterable_to_array$
|
|
2064
|
+
return _array_without_holes$Y(arr) || _iterable_to_array$Y(arr) || _unsupported_iterable_to_array$13(arr) || _non_iterable_spread$Y();
|
|
2064
2065
|
}
|
|
2065
|
-
function _unsupported_iterable_to_array$
|
|
2066
|
+
function _unsupported_iterable_to_array$13(o, minLen) {
|
|
2066
2067
|
if (!o) return;
|
|
2067
|
-
if (typeof o === "string") return _array_like_to_array$
|
|
2068
|
+
if (typeof o === "string") return _array_like_to_array$13(o, minLen);
|
|
2068
2069
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
2069
2070
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
2070
2071
|
if (n === "Map" || n === "Set") return Array.from(n);
|
|
2071
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$
|
|
2072
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$13(o, minLen);
|
|
2072
2073
|
}
|
|
2073
|
-
function _ts_generator$
|
|
2074
|
+
function _ts_generator$1a(thisArg, body) {
|
|
2074
2075
|
var f, y, t, _ = {
|
|
2075
2076
|
label: 0,
|
|
2076
2077
|
sent: function() {
|
|
@@ -2184,7 +2185,7 @@ var _defaultResponseAdapter = {
|
|
|
2184
2185
|
}
|
|
2185
2186
|
};
|
|
2186
2187
|
function _defaultBuildRequestData(params, state, limit) {
|
|
2187
|
-
var base = _object_spread$
|
|
2188
|
+
var base = _object_spread$L({}, params);
|
|
2188
2189
|
if (state.cursorDocumentKey != null) {
|
|
2189
2190
|
base.cursorDocumentKey = state.cursorDocumentKey;
|
|
2190
2191
|
}
|
|
@@ -2194,9 +2195,9 @@ function _defaultBuildRequestData(params, state, limit) {
|
|
|
2194
2195
|
return base;
|
|
2195
2196
|
}
|
|
2196
2197
|
function _runItemTasks(input) {
|
|
2197
|
-
return _async_to_generator$
|
|
2198
|
+
return _async_to_generator$1a(function() {
|
|
2198
2199
|
var context, items, keys, pageIndex, iterateItem, itemPerformTasksConfig, maxParallelPerPage, indexed, taskConfig, performResult;
|
|
2199
|
-
return _ts_generator$
|
|
2200
|
+
return _ts_generator$1a(this, function(_state) {
|
|
2200
2201
|
switch(_state.label){
|
|
2201
2202
|
case 0:
|
|
2202
2203
|
context = input.context, items = input.items, keys = input.keys, pageIndex = input.pageIndex, iterateItem = input.iterateItem, itemPerformTasksConfig = input.itemPerformTasksConfig, maxParallelPerPage = input.maxParallelPerPage;
|
|
@@ -2208,7 +2209,7 @@ function _runItemTasks(input) {
|
|
|
2208
2209
|
itemIndex: itemIndex
|
|
2209
2210
|
};
|
|
2210
2211
|
});
|
|
2211
|
-
taskConfig = _object_spread_props$
|
|
2212
|
+
taskConfig = _object_spread_props$u(_object_spread$L({
|
|
2212
2213
|
sequential: true,
|
|
2213
2214
|
throwError: true
|
|
2214
2215
|
}, itemPerformTasksConfig), {
|
|
@@ -2232,7 +2233,7 @@ function _runItemTasks(input) {
|
|
|
2232
2233
|
return [
|
|
2233
2234
|
2,
|
|
2234
2235
|
performResult.results.map(function(param) {
|
|
2235
|
-
var _param = _sliced_to_array$
|
|
2236
|
+
var _param = _sliced_to_array$h(param, 2), output = _param[1];
|
|
2236
2237
|
return output;
|
|
2237
2238
|
})
|
|
2238
2239
|
];
|
|
@@ -2241,9 +2242,9 @@ function _runItemTasks(input) {
|
|
|
2241
2242
|
})();
|
|
2242
2243
|
}
|
|
2243
2244
|
function _processPage(input) {
|
|
2244
|
-
return _async_to_generator$
|
|
2245
|
+
return _async_to_generator$1a(function() {
|
|
2245
2246
|
var context, raw, pageIndex, responseAdapter, iterateItem, iteratePage, itemPerformTasksConfig, maxParallelPerPage, items, keys, nextCursorDocumentKey, hasMore, itemResults, _tmp, pageResult, _tmp1, output;
|
|
2246
|
-
return _ts_generator$
|
|
2247
|
+
return _ts_generator$1a(this, function(_state) {
|
|
2247
2248
|
switch(_state.label){
|
|
2248
2249
|
case 0:
|
|
2249
2250
|
context = input.context, raw = input.raw, pageIndex = input.pageIndex, responseAdapter = input.responseAdapter, iterateItem = input.iterateItem, iteratePage = input.iteratePage, itemPerformTasksConfig = input.itemPerformTasksConfig, maxParallelPerPage = input.maxParallelPerPage;
|
|
@@ -2383,9 +2384,9 @@ function _evaluateLoopExit(input) {
|
|
|
2383
2384
|
* });
|
|
2384
2385
|
* ```
|
|
2385
2386
|
*/ function iterateDbxCliCallModel(config) {
|
|
2386
|
-
return _async_to_generator$
|
|
2387
|
+
return _async_to_generator$1a(function() {
|
|
2387
2388
|
var context, modelType, call, specifier, params, _config_buildRequestData, buildRequestData, _config_responseAdapter, responseAdapter, limitPerPage, totalItemsLimit, maxPages, iterateItem, iteratePage, itemPerformTasksConfig, maxParallelPerPage, _config_collectItems, collectItems, _config_collectItemResults, collectItemResults, _config_collectPageResults, collectPageResults, allItems, allItemResults, allPageResults, pageIndex, totalItems, cursorDocumentKey, hitLimit, keepGoing, collectItemsForPage, collectItemResultsForPage, collectPageResultsForPage, effectiveLimit, data, raw, pageOutcome, _allItems, _allItemResults, exit, result;
|
|
2388
|
-
return _ts_generator$
|
|
2389
|
+
return _ts_generator$1a(this, function(_state) {
|
|
2389
2390
|
switch(_state.label){
|
|
2390
2391
|
case 0:
|
|
2391
2392
|
context = config.context, modelType = config.modelType, call = config.call, specifier = config.specifier, params = config.params, _config_buildRequestData = config.buildRequestData, buildRequestData = _config_buildRequestData === void 0 ? _defaultBuildRequestData : _config_buildRequestData, _config_responseAdapter = config.responseAdapter, responseAdapter = _config_responseAdapter === void 0 ? _defaultResponseAdapter : _config_responseAdapter, limitPerPage = config.limitPerPage, totalItemsLimit = config.totalItemsLimit, maxPages = config.maxPages, iterateItem = config.iterateItem, iteratePage = config.iteratePage, itemPerformTasksConfig = config.itemPerformTasksConfig, maxParallelPerPage = config.maxParallelPerPage, _config_collectItems = config.collectItems, collectItems = _config_collectItems === void 0 ? true : _config_collectItems, _config_collectItemResults = config.collectItemResults, collectItemResults = _config_collectItemResults === void 0 ? iterateItem != null : _config_collectItemResults, _config_collectPageResults = config.collectPageResults, collectPageResults = _config_collectPageResults === void 0 ? iteratePage != null : _config_collectPageResults;
|
|
@@ -2465,7 +2466,7 @@ function _evaluateLoopExit(input) {
|
|
|
2465
2466
|
1
|
|
2466
2467
|
];
|
|
2467
2468
|
case 4:
|
|
2468
|
-
result = _object_spread$
|
|
2469
|
+
result = _object_spread$L({
|
|
2469
2470
|
totalPages: pageIndex,
|
|
2470
2471
|
totalItems: totalItems,
|
|
2471
2472
|
hitLimit: hitLimit,
|
|
@@ -2486,7 +2487,7 @@ function _evaluateLoopExit(input) {
|
|
|
2486
2487
|
})();
|
|
2487
2488
|
}
|
|
2488
2489
|
|
|
2489
|
-
function asyncGeneratorStep$
|
|
2490
|
+
function asyncGeneratorStep$19(gen, resolve, reject, _next, _throw, key, arg) {
|
|
2490
2491
|
try {
|
|
2491
2492
|
var info = gen[key](arg);
|
|
2492
2493
|
var value = info.value;
|
|
@@ -2500,22 +2501,22 @@ function asyncGeneratorStep$1a(gen, resolve, reject, _next, _throw, key, arg) {
|
|
|
2500
2501
|
Promise.resolve(value).then(_next, _throw);
|
|
2501
2502
|
}
|
|
2502
2503
|
}
|
|
2503
|
-
function _async_to_generator$
|
|
2504
|
+
function _async_to_generator$19(fn) {
|
|
2504
2505
|
return function() {
|
|
2505
2506
|
var self = this, args = arguments;
|
|
2506
2507
|
return new Promise(function(resolve, reject) {
|
|
2507
2508
|
var gen = fn.apply(self, args);
|
|
2508
2509
|
function _next(value) {
|
|
2509
|
-
asyncGeneratorStep$
|
|
2510
|
+
asyncGeneratorStep$19(gen, resolve, reject, _next, _throw, "next", value);
|
|
2510
2511
|
}
|
|
2511
2512
|
function _throw(err) {
|
|
2512
|
-
asyncGeneratorStep$
|
|
2513
|
+
asyncGeneratorStep$19(gen, resolve, reject, _next, _throw, "throw", err);
|
|
2513
2514
|
}
|
|
2514
2515
|
_next(undefined);
|
|
2515
2516
|
});
|
|
2516
2517
|
};
|
|
2517
2518
|
}
|
|
2518
|
-
function _define_property$
|
|
2519
|
+
function _define_property$K(obj, key, value) {
|
|
2519
2520
|
if (key in obj) {
|
|
2520
2521
|
Object.defineProperty(obj, key, {
|
|
2521
2522
|
value: value,
|
|
@@ -2528,7 +2529,7 @@ function _define_property$J(obj, key, value) {
|
|
|
2528
2529
|
}
|
|
2529
2530
|
return obj;
|
|
2530
2531
|
}
|
|
2531
|
-
function _object_spread$
|
|
2532
|
+
function _object_spread$K(target) {
|
|
2532
2533
|
for(var i = 1; i < arguments.length; i++){
|
|
2533
2534
|
var source = arguments[i] != null ? arguments[i] : {};
|
|
2534
2535
|
var ownKeys = Object.keys(source);
|
|
@@ -2538,12 +2539,12 @@ function _object_spread$J(target) {
|
|
|
2538
2539
|
}));
|
|
2539
2540
|
}
|
|
2540
2541
|
ownKeys.forEach(function(key) {
|
|
2541
|
-
_define_property$
|
|
2542
|
+
_define_property$K(target, key, source[key]);
|
|
2542
2543
|
});
|
|
2543
2544
|
}
|
|
2544
2545
|
return target;
|
|
2545
2546
|
}
|
|
2546
|
-
function ownKeys$
|
|
2547
|
+
function ownKeys$t(object, enumerableOnly) {
|
|
2547
2548
|
var keys = Object.keys(object);
|
|
2548
2549
|
if (Object.getOwnPropertySymbols) {
|
|
2549
2550
|
var symbols = Object.getOwnPropertySymbols(object);
|
|
@@ -2551,18 +2552,18 @@ function ownKeys$r(object, enumerableOnly) {
|
|
|
2551
2552
|
}
|
|
2552
2553
|
return keys;
|
|
2553
2554
|
}
|
|
2554
|
-
function _object_spread_props$
|
|
2555
|
+
function _object_spread_props$t(target, source) {
|
|
2555
2556
|
source = source != null ? source : {};
|
|
2556
2557
|
if (Object.getOwnPropertyDescriptors) {
|
|
2557
2558
|
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
2558
2559
|
} else {
|
|
2559
|
-
ownKeys$
|
|
2560
|
+
ownKeys$t(Object(source)).forEach(function(key) {
|
|
2560
2561
|
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
2561
2562
|
});
|
|
2562
2563
|
}
|
|
2563
2564
|
return target;
|
|
2564
2565
|
}
|
|
2565
|
-
function _ts_generator$
|
|
2566
|
+
function _ts_generator$19(thisArg, body) {
|
|
2566
2567
|
var f, y, t, _ = {
|
|
2567
2568
|
label: 0,
|
|
2568
2569
|
sent: function() {
|
|
@@ -2678,14 +2679,14 @@ function _ts_generator$1a(thisArg, body) {
|
|
|
2678
2679
|
return spec.builder ? spec.builder(yargs) : yargs;
|
|
2679
2680
|
},
|
|
2680
2681
|
handler: wrapCommandHandler(function(argv) {
|
|
2681
|
-
return _async_to_generator$
|
|
2682
|
+
return _async_to_generator$19(function() {
|
|
2682
2683
|
var context, data, params, result;
|
|
2683
|
-
return _ts_generator$
|
|
2684
|
+
return _ts_generator$19(this, function(_state) {
|
|
2684
2685
|
switch(_state.label){
|
|
2685
2686
|
case 0:
|
|
2686
2687
|
context = requireCliContext();
|
|
2687
2688
|
data = spec.buildParams(argv);
|
|
2688
|
-
params = _object_spread_props$
|
|
2689
|
+
params = _object_spread_props$t(_object_spread$K({
|
|
2689
2690
|
modelType: spec.model,
|
|
2690
2691
|
call: spec.verb
|
|
2691
2692
|
}, spec.specifier == null ? {} : {
|
|
@@ -2863,7 +2864,7 @@ function AsyncFromSyncIterator$4(s) {
|
|
|
2863
2864
|
}
|
|
2864
2865
|
}, new AsyncFromSyncIterator$4(s);
|
|
2865
2866
|
}
|
|
2866
|
-
function asyncGeneratorStep$
|
|
2867
|
+
function asyncGeneratorStep$18(gen, resolve, reject, _next, _throw, key, arg) {
|
|
2867
2868
|
try {
|
|
2868
2869
|
var info = gen[key](arg);
|
|
2869
2870
|
var value = info.value;
|
|
@@ -2877,22 +2878,22 @@ function asyncGeneratorStep$19(gen, resolve, reject, _next, _throw, key, arg) {
|
|
|
2877
2878
|
Promise.resolve(value).then(_next, _throw);
|
|
2878
2879
|
}
|
|
2879
2880
|
}
|
|
2880
|
-
function _async_to_generator$
|
|
2881
|
+
function _async_to_generator$18(fn) {
|
|
2881
2882
|
return function() {
|
|
2882
2883
|
var self = this, args = arguments;
|
|
2883
2884
|
return new Promise(function(resolve, reject) {
|
|
2884
2885
|
var gen = fn.apply(self, args);
|
|
2885
2886
|
function _next(value) {
|
|
2886
|
-
asyncGeneratorStep$
|
|
2887
|
+
asyncGeneratorStep$18(gen, resolve, reject, _next, _throw, "next", value);
|
|
2887
2888
|
}
|
|
2888
2889
|
function _throw(err) {
|
|
2889
|
-
asyncGeneratorStep$
|
|
2890
|
+
asyncGeneratorStep$18(gen, resolve, reject, _next, _throw, "throw", err);
|
|
2890
2891
|
}
|
|
2891
2892
|
_next(undefined);
|
|
2892
2893
|
});
|
|
2893
2894
|
};
|
|
2894
2895
|
}
|
|
2895
|
-
function _ts_generator$
|
|
2896
|
+
function _ts_generator$18(thisArg, body) {
|
|
2896
2897
|
var f, y, t, _ = {
|
|
2897
2898
|
label: 0,
|
|
2898
2899
|
sent: function() {
|
|
@@ -3011,9 +3012,9 @@ function _ts_generator$19(thisArg, body) {
|
|
|
3011
3012
|
*
|
|
3012
3013
|
* @returns The UTF-8 decoded stdin contents.
|
|
3013
3014
|
*/ function readAllStdin() {
|
|
3014
|
-
return _async_to_generator$
|
|
3015
|
+
return _async_to_generator$18(function() {
|
|
3015
3016
|
var chunks, _iteratorAbruptCompletion, _didIteratorError, _iteratorError, _iterator, _step, _value, chunk, err;
|
|
3016
|
-
return _ts_generator$
|
|
3017
|
+
return _ts_generator$18(this, function(_state) {
|
|
3017
3018
|
switch(_state.label){
|
|
3018
3019
|
case 0:
|
|
3019
3020
|
chunks = [];
|
|
@@ -3111,9 +3112,9 @@ function _ts_generator$19(thisArg, body) {
|
|
|
3111
3112
|
*
|
|
3112
3113
|
* @returns The tokens parsed from stdin.
|
|
3113
3114
|
*/ function readStdinTokens() {
|
|
3114
|
-
return _async_to_generator$
|
|
3115
|
+
return _async_to_generator$18(function() {
|
|
3115
3116
|
var raw;
|
|
3116
|
-
return _ts_generator$
|
|
3117
|
+
return _ts_generator$18(this, function(_state) {
|
|
3117
3118
|
switch(_state.label){
|
|
3118
3119
|
case 0:
|
|
3119
3120
|
return [
|
|
@@ -3133,7 +3134,7 @@ function _ts_generator$19(thisArg, body) {
|
|
|
3133
3134
|
})();
|
|
3134
3135
|
}
|
|
3135
3136
|
|
|
3136
|
-
function asyncGeneratorStep$
|
|
3137
|
+
function asyncGeneratorStep$17(gen, resolve, reject, _next, _throw, key, arg) {
|
|
3137
3138
|
try {
|
|
3138
3139
|
var info = gen[key](arg);
|
|
3139
3140
|
var value = info.value;
|
|
@@ -3147,22 +3148,22 @@ function asyncGeneratorStep$18(gen, resolve, reject, _next, _throw, key, arg) {
|
|
|
3147
3148
|
Promise.resolve(value).then(_next, _throw);
|
|
3148
3149
|
}
|
|
3149
3150
|
}
|
|
3150
|
-
function _async_to_generator$
|
|
3151
|
+
function _async_to_generator$17(fn) {
|
|
3151
3152
|
return function() {
|
|
3152
3153
|
var self = this, args = arguments;
|
|
3153
3154
|
return new Promise(function(resolve, reject) {
|
|
3154
3155
|
var gen = fn.apply(self, args);
|
|
3155
3156
|
function _next(value) {
|
|
3156
|
-
asyncGeneratorStep$
|
|
3157
|
+
asyncGeneratorStep$17(gen, resolve, reject, _next, _throw, "next", value);
|
|
3157
3158
|
}
|
|
3158
3159
|
function _throw(err) {
|
|
3159
|
-
asyncGeneratorStep$
|
|
3160
|
+
asyncGeneratorStep$17(gen, resolve, reject, _next, _throw, "throw", err);
|
|
3160
3161
|
}
|
|
3161
3162
|
_next(undefined);
|
|
3162
3163
|
});
|
|
3163
3164
|
};
|
|
3164
3165
|
}
|
|
3165
|
-
function _define_property$
|
|
3166
|
+
function _define_property$J(obj, key, value) {
|
|
3166
3167
|
if (key in obj) {
|
|
3167
3168
|
Object.defineProperty(obj, key, {
|
|
3168
3169
|
value: value,
|
|
@@ -3183,7 +3184,7 @@ function _instanceof$n(left, right) {
|
|
|
3183
3184
|
return left instanceof right;
|
|
3184
3185
|
}
|
|
3185
3186
|
}
|
|
3186
|
-
function _object_spread$
|
|
3187
|
+
function _object_spread$J(target) {
|
|
3187
3188
|
for(var i = 1; i < arguments.length; i++){
|
|
3188
3189
|
var source = arguments[i] != null ? arguments[i] : {};
|
|
3189
3190
|
var ownKeys = Object.keys(source);
|
|
@@ -3193,12 +3194,12 @@ function _object_spread$I(target) {
|
|
|
3193
3194
|
}));
|
|
3194
3195
|
}
|
|
3195
3196
|
ownKeys.forEach(function(key) {
|
|
3196
|
-
_define_property$
|
|
3197
|
+
_define_property$J(target, key, source[key]);
|
|
3197
3198
|
});
|
|
3198
3199
|
}
|
|
3199
3200
|
return target;
|
|
3200
3201
|
}
|
|
3201
|
-
function ownKeys$
|
|
3202
|
+
function ownKeys$s(object, enumerableOnly) {
|
|
3202
3203
|
var keys = Object.keys(object);
|
|
3203
3204
|
if (Object.getOwnPropertySymbols) {
|
|
3204
3205
|
var symbols = Object.getOwnPropertySymbols(object);
|
|
@@ -3206,18 +3207,18 @@ function ownKeys$q(object, enumerableOnly) {
|
|
|
3206
3207
|
}
|
|
3207
3208
|
return keys;
|
|
3208
3209
|
}
|
|
3209
|
-
function _object_spread_props$
|
|
3210
|
+
function _object_spread_props$s(target, source) {
|
|
3210
3211
|
source = source != null ? source : {};
|
|
3211
3212
|
if (Object.getOwnPropertyDescriptors) {
|
|
3212
3213
|
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
3213
3214
|
} else {
|
|
3214
|
-
ownKeys$
|
|
3215
|
+
ownKeys$s(Object(source)).forEach(function(key) {
|
|
3215
3216
|
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
3216
3217
|
});
|
|
3217
3218
|
}
|
|
3218
3219
|
return target;
|
|
3219
3220
|
}
|
|
3220
|
-
function _ts_generator$
|
|
3221
|
+
function _ts_generator$17(thisArg, body) {
|
|
3221
3222
|
var f, y, t, _ = {
|
|
3222
3223
|
label: 0,
|
|
3223
3224
|
sent: function() {
|
|
@@ -3328,9 +3329,9 @@ function _ts_generator$18(thisArg, body) {
|
|
|
3328
3329
|
return withCallModelArgs(yargs);
|
|
3329
3330
|
},
|
|
3330
3331
|
handler: wrapCommandHandler(function(argv) {
|
|
3331
|
-
return _async_to_generator$
|
|
3332
|
+
return _async_to_generator$17(function() {
|
|
3332
3333
|
var context, data, rawData, _tmp, params, result;
|
|
3333
|
-
return _ts_generator$
|
|
3334
|
+
return _ts_generator$17(this, function(_state) {
|
|
3334
3335
|
switch(_state.label){
|
|
3335
3336
|
case 0:
|
|
3336
3337
|
context = requireCliContext();
|
|
@@ -3370,7 +3371,7 @@ function _ts_generator$18(thisArg, body) {
|
|
|
3370
3371
|
});
|
|
3371
3372
|
}
|
|
3372
3373
|
}
|
|
3373
|
-
params = _object_spread_props$
|
|
3374
|
+
params = _object_spread_props$s(_object_spread$J({
|
|
3374
3375
|
modelType: argv.model,
|
|
3375
3376
|
call: argv.verb
|
|
3376
3377
|
}, argv.specifier == null ? {} : {
|
|
@@ -3394,12 +3395,12 @@ function _ts_generator$18(thisArg, body) {
|
|
|
3394
3395
|
})
|
|
3395
3396
|
};
|
|
3396
3397
|
|
|
3397
|
-
function _array_like_to_array$
|
|
3398
|
+
function _array_like_to_array$12(arr, len) {
|
|
3398
3399
|
if (len == null || len > arr.length) len = arr.length;
|
|
3399
3400
|
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
3400
3401
|
return arr2;
|
|
3401
3402
|
}
|
|
3402
|
-
function _array_with_holes$
|
|
3403
|
+
function _array_with_holes$g(arr) {
|
|
3403
3404
|
if (Array.isArray(arr)) return arr;
|
|
3404
3405
|
}
|
|
3405
3406
|
function _instanceof$m(left, right) {
|
|
@@ -3410,7 +3411,7 @@ function _instanceof$m(left, right) {
|
|
|
3410
3411
|
return left instanceof right;
|
|
3411
3412
|
}
|
|
3412
3413
|
}
|
|
3413
|
-
function _iterable_to_array_limit$
|
|
3414
|
+
function _iterable_to_array_limit$g(arr, i) {
|
|
3414
3415
|
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
3415
3416
|
if (_i == null) return;
|
|
3416
3417
|
var _arr = [];
|
|
@@ -3434,23 +3435,23 @@ function _iterable_to_array_limit$h(arr, i) {
|
|
|
3434
3435
|
}
|
|
3435
3436
|
return _arr;
|
|
3436
3437
|
}
|
|
3437
|
-
function _non_iterable_rest$
|
|
3438
|
+
function _non_iterable_rest$g() {
|
|
3438
3439
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
3439
3440
|
}
|
|
3440
|
-
function _sliced_to_array$
|
|
3441
|
-
return _array_with_holes$
|
|
3441
|
+
function _sliced_to_array$g(arr, i) {
|
|
3442
|
+
return _array_with_holes$g(arr) || _iterable_to_array_limit$g(arr, i) || _unsupported_iterable_to_array$12(arr, i) || _non_iterable_rest$g();
|
|
3442
3443
|
}
|
|
3443
3444
|
function _type_of(obj) {
|
|
3444
3445
|
"@swc/helpers - typeof";
|
|
3445
3446
|
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
3446
3447
|
}
|
|
3447
|
-
function _unsupported_iterable_to_array$
|
|
3448
|
+
function _unsupported_iterable_to_array$12(o, minLen) {
|
|
3448
3449
|
if (!o) return;
|
|
3449
|
-
if (typeof o === "string") return _array_like_to_array$
|
|
3450
|
+
if (typeof o === "string") return _array_like_to_array$12(o, minLen);
|
|
3450
3451
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
3451
3452
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
3452
3453
|
if (n === "Map" || n === "Set") return Array.from(n);
|
|
3453
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$
|
|
3454
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$12(o, minLen);
|
|
3454
3455
|
}
|
|
3455
3456
|
/**
|
|
3456
3457
|
* Resolves the manifest entry for `modelType`. Lookup tries
|
|
@@ -3543,7 +3544,7 @@ function rewriteWithFields(value, fields) {
|
|
|
3543
3544
|
var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = undefined;
|
|
3544
3545
|
try {
|
|
3545
3546
|
for(var _iterator1 = Object.entries(value)[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true){
|
|
3546
|
-
var _step_value = _sliced_to_array$
|
|
3547
|
+
var _step_value = _sliced_to_array$g(_step1.value, 2), key = _step_value[0], raw = _step_value[1];
|
|
3547
3548
|
var field1 = fieldByName.get(key);
|
|
3548
3549
|
if (field1) {
|
|
3549
3550
|
var longKey = field1.longName.length > 0 ? field1.longName : key;
|
|
@@ -3603,13 +3604,13 @@ function isPlainObject(value) {
|
|
|
3603
3604
|
return result;
|
|
3604
3605
|
}
|
|
3605
3606
|
|
|
3606
|
-
function _array_like_to_array$
|
|
3607
|
+
function _array_like_to_array$11(arr, len) {
|
|
3607
3608
|
if (len == null || len > arr.length) len = arr.length;
|
|
3608
3609
|
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
3609
3610
|
return arr2;
|
|
3610
3611
|
}
|
|
3611
3612
|
function _array_without_holes$X(arr) {
|
|
3612
|
-
if (Array.isArray(arr)) return _array_like_to_array$
|
|
3613
|
+
if (Array.isArray(arr)) return _array_like_to_array$11(arr);
|
|
3613
3614
|
}
|
|
3614
3615
|
function _iterable_to_array$X(iter) {
|
|
3615
3616
|
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
@@ -3618,15 +3619,15 @@ function _non_iterable_spread$X() {
|
|
|
3618
3619
|
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
3619
3620
|
}
|
|
3620
3621
|
function _to_consumable_array$X(arr) {
|
|
3621
|
-
return _array_without_holes$X(arr) || _iterable_to_array$X(arr) || _unsupported_iterable_to_array$
|
|
3622
|
+
return _array_without_holes$X(arr) || _iterable_to_array$X(arr) || _unsupported_iterable_to_array$11(arr) || _non_iterable_spread$X();
|
|
3622
3623
|
}
|
|
3623
|
-
function _unsupported_iterable_to_array$
|
|
3624
|
+
function _unsupported_iterable_to_array$11(o, minLen) {
|
|
3624
3625
|
if (!o) return;
|
|
3625
|
-
if (typeof o === "string") return _array_like_to_array$
|
|
3626
|
+
if (typeof o === "string") return _array_like_to_array$11(o, minLen);
|
|
3626
3627
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
3627
3628
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
3628
3629
|
if (n === "Map" || n === "Set") return Array.from(n);
|
|
3629
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$
|
|
3630
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$11(o, minLen);
|
|
3630
3631
|
}
|
|
3631
3632
|
/**
|
|
3632
3633
|
* Default command name for the model-decode command. Top-level so it stays
|
|
@@ -3795,21 +3796,21 @@ function renderAncestorLine(ancestor) {
|
|
|
3795
3796
|
return ancestor.modelName ? "- ".concat(ancestor.modelName, " — prefix ").concat(ancestor.prefix, ", id ").concat(ancestor.id) : "- <unknown> — prefix ".concat(ancestor.prefix, ", id ").concat(ancestor.id);
|
|
3796
3797
|
}
|
|
3797
3798
|
|
|
3798
|
-
function _array_like_to_array$
|
|
3799
|
+
function _array_like_to_array$10(arr, len) {
|
|
3799
3800
|
if (len == null || len > arr.length) len = arr.length;
|
|
3800
3801
|
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
3801
3802
|
return arr2;
|
|
3802
3803
|
}
|
|
3803
|
-
function _array_with_holes$
|
|
3804
|
+
function _array_with_holes$f(arr) {
|
|
3804
3805
|
if (Array.isArray(arr)) return arr;
|
|
3805
3806
|
}
|
|
3806
3807
|
function _array_without_holes$W(arr) {
|
|
3807
|
-
if (Array.isArray(arr)) return _array_like_to_array$
|
|
3808
|
+
if (Array.isArray(arr)) return _array_like_to_array$10(arr);
|
|
3808
3809
|
}
|
|
3809
3810
|
function _iterable_to_array$W(iter) {
|
|
3810
3811
|
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
3811
3812
|
}
|
|
3812
|
-
function _iterable_to_array_limit$
|
|
3813
|
+
function _iterable_to_array_limit$f(arr, i) {
|
|
3813
3814
|
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
3814
3815
|
if (_i == null) return;
|
|
3815
3816
|
var _arr = [];
|
|
@@ -3833,25 +3834,25 @@ function _iterable_to_array_limit$g(arr, i) {
|
|
|
3833
3834
|
}
|
|
3834
3835
|
return _arr;
|
|
3835
3836
|
}
|
|
3836
|
-
function _non_iterable_rest$
|
|
3837
|
+
function _non_iterable_rest$f() {
|
|
3837
3838
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
3838
3839
|
}
|
|
3839
3840
|
function _non_iterable_spread$W() {
|
|
3840
3841
|
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
3841
3842
|
}
|
|
3842
|
-
function _sliced_to_array$
|
|
3843
|
-
return _array_with_holes$
|
|
3843
|
+
function _sliced_to_array$f(arr, i) {
|
|
3844
|
+
return _array_with_holes$f(arr) || _iterable_to_array_limit$f(arr, i) || _unsupported_iterable_to_array$10(arr, i) || _non_iterable_rest$f();
|
|
3844
3845
|
}
|
|
3845
3846
|
function _to_consumable_array$W(arr) {
|
|
3846
|
-
return _array_without_holes$W(arr) || _iterable_to_array$W(arr) || _unsupported_iterable_to_array$
|
|
3847
|
+
return _array_without_holes$W(arr) || _iterable_to_array$W(arr) || _unsupported_iterable_to_array$10(arr) || _non_iterable_spread$W();
|
|
3847
3848
|
}
|
|
3848
|
-
function _unsupported_iterable_to_array$
|
|
3849
|
+
function _unsupported_iterable_to_array$10(o, minLen) {
|
|
3849
3850
|
if (!o) return;
|
|
3850
|
-
if (typeof o === "string") return _array_like_to_array$
|
|
3851
|
+
if (typeof o === "string") return _array_like_to_array$10(o, minLen);
|
|
3851
3852
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
3852
3853
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
3853
3854
|
if (n === "Map" || n === "Set") return Array.from(n);
|
|
3854
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$
|
|
3855
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$10(o, minLen);
|
|
3855
3856
|
}
|
|
3856
3857
|
/**
|
|
3857
3858
|
* Parses the positionals for the top-level `get <modelOrKey> [key]` command into a
|
|
@@ -4019,7 +4020,7 @@ function inferModelTypeFromKeys(keys, manifest) {
|
|
|
4019
4020
|
code: 'INVALID_ARGUMENT'
|
|
4020
4021
|
});
|
|
4021
4022
|
}
|
|
4022
|
-
var _decodedTypes = _sliced_to_array$
|
|
4023
|
+
var _decodedTypes = _sliced_to_array$f(decodedTypes, 1), modelType = _decodedTypes[0];
|
|
4023
4024
|
return {
|
|
4024
4025
|
modelType: modelType,
|
|
4025
4026
|
keys: keys
|
|
@@ -4032,7 +4033,7 @@ function manifestPrefixList(manifest) {
|
|
|
4032
4033
|
return prefixes.join(', ');
|
|
4033
4034
|
}
|
|
4034
4035
|
|
|
4035
|
-
function asyncGeneratorStep$
|
|
4036
|
+
function asyncGeneratorStep$16(gen, resolve, reject, _next, _throw, key, arg) {
|
|
4036
4037
|
try {
|
|
4037
4038
|
var info = gen[key](arg);
|
|
4038
4039
|
var value = info.value;
|
|
@@ -4046,22 +4047,22 @@ function asyncGeneratorStep$17(gen, resolve, reject, _next, _throw, key, arg) {
|
|
|
4046
4047
|
Promise.resolve(value).then(_next, _throw);
|
|
4047
4048
|
}
|
|
4048
4049
|
}
|
|
4049
|
-
function _async_to_generator$
|
|
4050
|
+
function _async_to_generator$16(fn) {
|
|
4050
4051
|
return function() {
|
|
4051
4052
|
var self = this, args = arguments;
|
|
4052
4053
|
return new Promise(function(resolve, reject) {
|
|
4053
4054
|
var gen = fn.apply(self, args);
|
|
4054
4055
|
function _next(value) {
|
|
4055
|
-
asyncGeneratorStep$
|
|
4056
|
+
asyncGeneratorStep$16(gen, resolve, reject, _next, _throw, "next", value);
|
|
4056
4057
|
}
|
|
4057
4058
|
function _throw(err) {
|
|
4058
|
-
asyncGeneratorStep$
|
|
4059
|
+
asyncGeneratorStep$16(gen, resolve, reject, _next, _throw, "throw", err);
|
|
4059
4060
|
}
|
|
4060
4061
|
_next(undefined);
|
|
4061
4062
|
});
|
|
4062
4063
|
};
|
|
4063
4064
|
}
|
|
4064
|
-
function _ts_generator$
|
|
4065
|
+
function _ts_generator$16(thisArg, body) {
|
|
4065
4066
|
var f, y, t, _ = {
|
|
4066
4067
|
label: 0,
|
|
4067
4068
|
sent: function() {
|
|
@@ -4182,9 +4183,9 @@ function _ts_generator$17(thisArg, body) {
|
|
|
4182
4183
|
});
|
|
4183
4184
|
},
|
|
4184
4185
|
handler: wrapCommandHandler(function(argv) {
|
|
4185
|
-
return _async_to_generator$
|
|
4186
|
+
return _async_to_generator$16(function() {
|
|
4186
4187
|
var context, _parseGetArgs, modelType, key, result;
|
|
4187
|
-
return _ts_generator$
|
|
4188
|
+
return _ts_generator$16(this, function(_state) {
|
|
4188
4189
|
switch(_state.label){
|
|
4189
4190
|
case 0:
|
|
4190
4191
|
context = requireCliContext();
|
|
@@ -4209,7 +4210,7 @@ function _ts_generator$17(thisArg, body) {
|
|
|
4209
4210
|
})
|
|
4210
4211
|
};
|
|
4211
4212
|
|
|
4212
|
-
function asyncGeneratorStep$
|
|
4213
|
+
function asyncGeneratorStep$15(gen, resolve, reject, _next, _throw, key, arg) {
|
|
4213
4214
|
try {
|
|
4214
4215
|
var info = gen[key](arg);
|
|
4215
4216
|
var value = info.value;
|
|
@@ -4223,22 +4224,22 @@ function asyncGeneratorStep$16(gen, resolve, reject, _next, _throw, key, arg) {
|
|
|
4223
4224
|
Promise.resolve(value).then(_next, _throw);
|
|
4224
4225
|
}
|
|
4225
4226
|
}
|
|
4226
|
-
function _async_to_generator$
|
|
4227
|
+
function _async_to_generator$15(fn) {
|
|
4227
4228
|
return function() {
|
|
4228
4229
|
var self = this, args = arguments;
|
|
4229
4230
|
return new Promise(function(resolve, reject) {
|
|
4230
4231
|
var gen = fn.apply(self, args);
|
|
4231
4232
|
function _next(value) {
|
|
4232
|
-
asyncGeneratorStep$
|
|
4233
|
+
asyncGeneratorStep$15(gen, resolve, reject, _next, _throw, "next", value);
|
|
4233
4234
|
}
|
|
4234
4235
|
function _throw(err) {
|
|
4235
|
-
asyncGeneratorStep$
|
|
4236
|
+
asyncGeneratorStep$15(gen, resolve, reject, _next, _throw, "throw", err);
|
|
4236
4237
|
}
|
|
4237
4238
|
_next(undefined);
|
|
4238
4239
|
});
|
|
4239
4240
|
};
|
|
4240
4241
|
}
|
|
4241
|
-
function _ts_generator$
|
|
4242
|
+
function _ts_generator$15(thisArg, body) {
|
|
4242
4243
|
var f, y, t, _ = {
|
|
4243
4244
|
label: 0,
|
|
4244
4245
|
sent: function() {
|
|
@@ -4364,9 +4365,9 @@ function _ts_generator$16(thisArg, body) {
|
|
|
4364
4365
|
});
|
|
4365
4366
|
},
|
|
4366
4367
|
handler: wrapCommandHandler(function(argv) {
|
|
4367
|
-
return _async_to_generator$
|
|
4368
|
+
return _async_to_generator$15(function() {
|
|
4368
4369
|
var context, firstArg, rest, resolvedFirst, resolvedRest, stdinKeys, _parseGetManyArgs, modelType, keys, result;
|
|
4369
|
-
return _ts_generator$
|
|
4370
|
+
return _ts_generator$15(this, function(_state) {
|
|
4370
4371
|
switch(_state.label){
|
|
4371
4372
|
case 0:
|
|
4372
4373
|
context = requireCliContext();
|
|
@@ -4409,7 +4410,7 @@ function _ts_generator$16(thisArg, body) {
|
|
|
4409
4410
|
})
|
|
4410
4411
|
};
|
|
4411
4412
|
|
|
4412
|
-
function asyncGeneratorStep$
|
|
4413
|
+
function asyncGeneratorStep$14(gen, resolve, reject, _next, _throw, key, arg) {
|
|
4413
4414
|
try {
|
|
4414
4415
|
var info = gen[key](arg);
|
|
4415
4416
|
var value = info.value;
|
|
@@ -4423,22 +4424,22 @@ function asyncGeneratorStep$15(gen, resolve, reject, _next, _throw, key, arg) {
|
|
|
4423
4424
|
Promise.resolve(value).then(_next, _throw);
|
|
4424
4425
|
}
|
|
4425
4426
|
}
|
|
4426
|
-
function _async_to_generator$
|
|
4427
|
+
function _async_to_generator$14(fn) {
|
|
4427
4428
|
return function() {
|
|
4428
4429
|
var self = this, args = arguments;
|
|
4429
4430
|
return new Promise(function(resolve, reject) {
|
|
4430
4431
|
var gen = fn.apply(self, args);
|
|
4431
4432
|
function _next(value) {
|
|
4432
|
-
asyncGeneratorStep$
|
|
4433
|
+
asyncGeneratorStep$14(gen, resolve, reject, _next, _throw, "next", value);
|
|
4433
4434
|
}
|
|
4434
4435
|
function _throw(err) {
|
|
4435
|
-
asyncGeneratorStep$
|
|
4436
|
+
asyncGeneratorStep$14(gen, resolve, reject, _next, _throw, "throw", err);
|
|
4436
4437
|
}
|
|
4437
4438
|
_next(undefined);
|
|
4438
4439
|
});
|
|
4439
4440
|
};
|
|
4440
4441
|
}
|
|
4441
|
-
function _define_property$
|
|
4442
|
+
function _define_property$I(obj, key, value) {
|
|
4442
4443
|
if (key in obj) {
|
|
4443
4444
|
Object.defineProperty(obj, key, {
|
|
4444
4445
|
value: value,
|
|
@@ -4451,7 +4452,7 @@ function _define_property$H(obj, key, value) {
|
|
|
4451
4452
|
}
|
|
4452
4453
|
return obj;
|
|
4453
4454
|
}
|
|
4454
|
-
function _object_spread$
|
|
4455
|
+
function _object_spread$I(target) {
|
|
4455
4456
|
for(var i = 1; i < arguments.length; i++){
|
|
4456
4457
|
var source = arguments[i] != null ? arguments[i] : {};
|
|
4457
4458
|
var ownKeys = Object.keys(source);
|
|
@@ -4461,12 +4462,12 @@ function _object_spread$H(target) {
|
|
|
4461
4462
|
}));
|
|
4462
4463
|
}
|
|
4463
4464
|
ownKeys.forEach(function(key) {
|
|
4464
|
-
_define_property$
|
|
4465
|
+
_define_property$I(target, key, source[key]);
|
|
4465
4466
|
});
|
|
4466
4467
|
}
|
|
4467
4468
|
return target;
|
|
4468
4469
|
}
|
|
4469
|
-
function _ts_generator$
|
|
4470
|
+
function _ts_generator$14(thisArg, body) {
|
|
4470
4471
|
var f, y, t, _ = {
|
|
4471
4472
|
label: 0,
|
|
4472
4473
|
sent: function() {
|
|
@@ -4622,9 +4623,9 @@ function _ts_generator$15(thisArg, body) {
|
|
|
4622
4623
|
* @param input.updates - The partial {@link CliConfig} to merge on top of the existing on-disk config.
|
|
4623
4624
|
* @returns The merged {@link CliConfig} that was just written.
|
|
4624
4625
|
*/ function mergeCliConfig(input) {
|
|
4625
|
-
return _async_to_generator$
|
|
4626
|
+
return _async_to_generator$14(function() {
|
|
4626
4627
|
var _ref, _input_updates_activeEnv, existing, merged;
|
|
4627
|
-
return _ts_generator$
|
|
4628
|
+
return _ts_generator$14(this, function(_state) {
|
|
4628
4629
|
switch(_state.label){
|
|
4629
4630
|
case 0:
|
|
4630
4631
|
return [
|
|
@@ -4637,7 +4638,7 @@ function _ts_generator$15(thisArg, body) {
|
|
|
4637
4638
|
existing = (_ref = _state.sent()) !== null && _ref !== void 0 ? _ref : {};
|
|
4638
4639
|
merged = {
|
|
4639
4640
|
activeEnv: (_input_updates_activeEnv = input.updates.activeEnv) !== null && _input_updates_activeEnv !== void 0 ? _input_updates_activeEnv : existing.activeEnv,
|
|
4640
|
-
envs: input.updates.envs ? _object_spread$
|
|
4641
|
+
envs: input.updates.envs ? _object_spread$I({}, existing.envs, input.updates.envs) : existing.envs,
|
|
4641
4642
|
output: input.updates.output === undefined ? existing.output : mergeOutputConfig(existing.output, input.updates.output)
|
|
4642
4643
|
};
|
|
4643
4644
|
return [
|
|
@@ -4679,12 +4680,12 @@ function mergeOutputCommandsConfig(existing, updates) {
|
|
|
4679
4680
|
var result;
|
|
4680
4681
|
if ('commands' in updates) {
|
|
4681
4682
|
if (updates.commands) {
|
|
4682
|
-
var merged = _object_spread$
|
|
4683
|
+
var merged = _object_spread$I({}, existing);
|
|
4683
4684
|
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
4684
4685
|
try {
|
|
4685
4686
|
for(var _iterator = Object.keys(updates.commands)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
4686
4687
|
var key = _step.value;
|
|
4687
|
-
merged[key] = _object_spread$
|
|
4688
|
+
merged[key] = _object_spread$I({}, existing === null || existing === void 0 ? void 0 : existing[key], updates.commands[key]);
|
|
4688
4689
|
}
|
|
4689
4690
|
} catch (err) {
|
|
4690
4691
|
_didIteratorError = true;
|
|
@@ -4749,15 +4750,15 @@ function mergeOutputCommandsConfig(existing, updates) {
|
|
|
4749
4750
|
return result;
|
|
4750
4751
|
}
|
|
4751
4752
|
|
|
4752
|
-
function _array_like_to_array
|
|
4753
|
+
function _array_like_to_array$$(arr, len) {
|
|
4753
4754
|
if (len == null || len > arr.length) len = arr.length;
|
|
4754
4755
|
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
4755
4756
|
return arr2;
|
|
4756
4757
|
}
|
|
4757
4758
|
function _array_without_holes$V(arr) {
|
|
4758
|
-
if (Array.isArray(arr)) return _array_like_to_array
|
|
4759
|
+
if (Array.isArray(arr)) return _array_like_to_array$$(arr);
|
|
4759
4760
|
}
|
|
4760
|
-
function _define_property$
|
|
4761
|
+
function _define_property$H(obj, key, value) {
|
|
4761
4762
|
if (key in obj) {
|
|
4762
4763
|
Object.defineProperty(obj, key, {
|
|
4763
4764
|
value: value,
|
|
@@ -4776,7 +4777,7 @@ function _iterable_to_array$V(iter) {
|
|
|
4776
4777
|
function _non_iterable_spread$V() {
|
|
4777
4778
|
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
4778
4779
|
}
|
|
4779
|
-
function _object_spread$
|
|
4780
|
+
function _object_spread$H(target) {
|
|
4780
4781
|
for(var i = 1; i < arguments.length; i++){
|
|
4781
4782
|
var source = arguments[i] != null ? arguments[i] : {};
|
|
4782
4783
|
var ownKeys = Object.keys(source);
|
|
@@ -4786,12 +4787,12 @@ function _object_spread$G(target) {
|
|
|
4786
4787
|
}));
|
|
4787
4788
|
}
|
|
4788
4789
|
ownKeys.forEach(function(key) {
|
|
4789
|
-
_define_property$
|
|
4790
|
+
_define_property$H(target, key, source[key]);
|
|
4790
4791
|
});
|
|
4791
4792
|
}
|
|
4792
4793
|
return target;
|
|
4793
4794
|
}
|
|
4794
|
-
function ownKeys$
|
|
4795
|
+
function ownKeys$r(object, enumerableOnly) {
|
|
4795
4796
|
var keys = Object.keys(object);
|
|
4796
4797
|
if (Object.getOwnPropertySymbols) {
|
|
4797
4798
|
var symbols = Object.getOwnPropertySymbols(object);
|
|
@@ -4799,27 +4800,27 @@ function ownKeys$p(object, enumerableOnly) {
|
|
|
4799
4800
|
}
|
|
4800
4801
|
return keys;
|
|
4801
4802
|
}
|
|
4802
|
-
function _object_spread_props$
|
|
4803
|
+
function _object_spread_props$r(target, source) {
|
|
4803
4804
|
source = source != null ? source : {};
|
|
4804
4805
|
if (Object.getOwnPropertyDescriptors) {
|
|
4805
4806
|
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
4806
4807
|
} else {
|
|
4807
|
-
ownKeys$
|
|
4808
|
+
ownKeys$r(Object(source)).forEach(function(key) {
|
|
4808
4809
|
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
4809
4810
|
});
|
|
4810
4811
|
}
|
|
4811
4812
|
return target;
|
|
4812
4813
|
}
|
|
4813
4814
|
function _to_consumable_array$V(arr) {
|
|
4814
|
-
return _array_without_holes$V(arr) || _iterable_to_array$V(arr) || _unsupported_iterable_to_array
|
|
4815
|
+
return _array_without_holes$V(arr) || _iterable_to_array$V(arr) || _unsupported_iterable_to_array$$(arr) || _non_iterable_spread$V();
|
|
4815
4816
|
}
|
|
4816
|
-
function _unsupported_iterable_to_array
|
|
4817
|
+
function _unsupported_iterable_to_array$$(o, minLen) {
|
|
4817
4818
|
if (!o) return;
|
|
4818
|
-
if (typeof o === "string") return _array_like_to_array
|
|
4819
|
+
if (typeof o === "string") return _array_like_to_array$$(o, minLen);
|
|
4819
4820
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
4820
4821
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
4821
4822
|
if (n === "Map" || n === "Set") return Array.from(n);
|
|
4822
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array
|
|
4823
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$$(o, minLen);
|
|
4823
4824
|
}
|
|
4824
4825
|
/**
|
|
4825
4826
|
* The default OAuth/OIDC scopes requested by the CLI when none are configured.
|
|
@@ -5020,7 +5021,7 @@ function nonEmpty(value) {
|
|
|
5020
5021
|
if (refreshToken) {
|
|
5021
5022
|
var accessToken = nonEmpty(process.env["".concat(prefix, "_ACCESS_TOKEN")]);
|
|
5022
5023
|
var scope = nonEmpty(process.env["".concat(prefix, "_TOKEN_SCOPE")]);
|
|
5023
|
-
result = _object_spread_props$
|
|
5024
|
+
result = _object_spread_props$r(_object_spread$H({
|
|
5024
5025
|
accessToken: accessToken !== null && accessToken !== void 0 ? accessToken : '',
|
|
5025
5026
|
refreshToken: refreshToken,
|
|
5026
5027
|
// No reliable expiry is supplied via env, so force a refresh on first use (expiresAt 0 = expired).
|
|
@@ -5034,7 +5035,7 @@ function nonEmpty(value) {
|
|
|
5034
5035
|
return result;
|
|
5035
5036
|
}
|
|
5036
5037
|
|
|
5037
|
-
function asyncGeneratorStep$
|
|
5038
|
+
function asyncGeneratorStep$13(gen, resolve, reject, _next, _throw, key, arg) {
|
|
5038
5039
|
try {
|
|
5039
5040
|
var info = gen[key](arg);
|
|
5040
5041
|
var value = info.value;
|
|
@@ -5048,22 +5049,22 @@ function asyncGeneratorStep$14(gen, resolve, reject, _next, _throw, key, arg) {
|
|
|
5048
5049
|
Promise.resolve(value).then(_next, _throw);
|
|
5049
5050
|
}
|
|
5050
5051
|
}
|
|
5051
|
-
function _async_to_generator$
|
|
5052
|
+
function _async_to_generator$13(fn) {
|
|
5052
5053
|
return function() {
|
|
5053
5054
|
var self = this, args = arguments;
|
|
5054
5055
|
return new Promise(function(resolve, reject) {
|
|
5055
5056
|
var gen = fn.apply(self, args);
|
|
5056
5057
|
function _next(value) {
|
|
5057
|
-
asyncGeneratorStep$
|
|
5058
|
+
asyncGeneratorStep$13(gen, resolve, reject, _next, _throw, "next", value);
|
|
5058
5059
|
}
|
|
5059
5060
|
function _throw(err) {
|
|
5060
|
-
asyncGeneratorStep$
|
|
5061
|
+
asyncGeneratorStep$13(gen, resolve, reject, _next, _throw, "throw", err);
|
|
5061
5062
|
}
|
|
5062
5063
|
_next(undefined);
|
|
5063
5064
|
});
|
|
5064
5065
|
};
|
|
5065
5066
|
}
|
|
5066
|
-
function _ts_generator$
|
|
5067
|
+
function _ts_generator$13(thisArg, body) {
|
|
5067
5068
|
var f, y, t, _ = {
|
|
5068
5069
|
label: 0,
|
|
5069
5070
|
sent: function() {
|
|
@@ -5190,9 +5191,9 @@ function _ts_generator$14(thisArg, body) {
|
|
|
5190
5191
|
* @param input - Resolution inputs.
|
|
5191
5192
|
* @returns The resolved env triple.
|
|
5192
5193
|
*/ function resolveCliEnv(input) {
|
|
5193
|
-
return _async_to_generator$
|
|
5194
|
+
return _async_to_generator$13(function() {
|
|
5194
5195
|
var _ref, _input_envVarName, _ref1, _input_flagEnv, _config_envs, _findCliEnvDefault, config, envVarName, envName, stored, defaultEnv, merged, env;
|
|
5195
|
-
return _ts_generator$
|
|
5196
|
+
return _ts_generator$13(this, function(_state) {
|
|
5196
5197
|
switch(_state.label){
|
|
5197
5198
|
case 0:
|
|
5198
5199
|
return [
|
|
@@ -5231,9 +5232,9 @@ function _ts_generator$14(thisArg, body) {
|
|
|
5231
5232
|
})();
|
|
5232
5233
|
}
|
|
5233
5234
|
function resolveCliEnvOrThrow(input) {
|
|
5234
|
-
return _async_to_generator$
|
|
5235
|
+
return _async_to_generator$13(function() {
|
|
5235
5236
|
var _ref, config, envName, env;
|
|
5236
|
-
return _ts_generator$
|
|
5237
|
+
return _ts_generator$13(this, function(_state) {
|
|
5237
5238
|
switch(_state.label){
|
|
5238
5239
|
case 0:
|
|
5239
5240
|
return [
|
|
@@ -5328,7 +5329,7 @@ function resolveCliEnvOrThrow(input) {
|
|
|
5328
5329
|
}).hasExpired();
|
|
5329
5330
|
}
|
|
5330
5331
|
|
|
5331
|
-
function asyncGeneratorStep$
|
|
5332
|
+
function asyncGeneratorStep$12(gen, resolve, reject, _next, _throw, key, arg) {
|
|
5332
5333
|
try {
|
|
5333
5334
|
var info = gen[key](arg);
|
|
5334
5335
|
var value = info.value;
|
|
@@ -5342,22 +5343,22 @@ function asyncGeneratorStep$13(gen, resolve, reject, _next, _throw, key, arg) {
|
|
|
5342
5343
|
Promise.resolve(value).then(_next, _throw);
|
|
5343
5344
|
}
|
|
5344
5345
|
}
|
|
5345
|
-
function _async_to_generator$
|
|
5346
|
+
function _async_to_generator$12(fn) {
|
|
5346
5347
|
return function() {
|
|
5347
5348
|
var self = this, args = arguments;
|
|
5348
5349
|
return new Promise(function(resolve, reject) {
|
|
5349
5350
|
var gen = fn.apply(self, args);
|
|
5350
5351
|
function _next(value) {
|
|
5351
|
-
asyncGeneratorStep$
|
|
5352
|
+
asyncGeneratorStep$12(gen, resolve, reject, _next, _throw, "next", value);
|
|
5352
5353
|
}
|
|
5353
5354
|
function _throw(err) {
|
|
5354
|
-
asyncGeneratorStep$
|
|
5355
|
+
asyncGeneratorStep$12(gen, resolve, reject, _next, _throw, "throw", err);
|
|
5355
5356
|
}
|
|
5356
5357
|
_next(undefined);
|
|
5357
5358
|
});
|
|
5358
5359
|
};
|
|
5359
5360
|
}
|
|
5360
|
-
function _define_property$
|
|
5361
|
+
function _define_property$G(obj, key, value) {
|
|
5361
5362
|
if (key in obj) {
|
|
5362
5363
|
Object.defineProperty(obj, key, {
|
|
5363
5364
|
value: value,
|
|
@@ -5378,7 +5379,7 @@ function _instanceof$l(left, right) {
|
|
|
5378
5379
|
return left instanceof right;
|
|
5379
5380
|
}
|
|
5380
5381
|
}
|
|
5381
|
-
function _object_spread$
|
|
5382
|
+
function _object_spread$G(target) {
|
|
5382
5383
|
for(var i = 1; i < arguments.length; i++){
|
|
5383
5384
|
var source = arguments[i] != null ? arguments[i] : {};
|
|
5384
5385
|
var ownKeys = Object.keys(source);
|
|
@@ -5388,12 +5389,31 @@ function _object_spread$F(target) {
|
|
|
5388
5389
|
}));
|
|
5389
5390
|
}
|
|
5390
5391
|
ownKeys.forEach(function(key) {
|
|
5391
|
-
_define_property$
|
|
5392
|
+
_define_property$G(target, key, source[key]);
|
|
5392
5393
|
});
|
|
5393
5394
|
}
|
|
5394
5395
|
return target;
|
|
5395
5396
|
}
|
|
5396
|
-
function
|
|
5397
|
+
function ownKeys$q(object, enumerableOnly) {
|
|
5398
|
+
var keys = Object.keys(object);
|
|
5399
|
+
if (Object.getOwnPropertySymbols) {
|
|
5400
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
5401
|
+
keys.push.apply(keys, symbols);
|
|
5402
|
+
}
|
|
5403
|
+
return keys;
|
|
5404
|
+
}
|
|
5405
|
+
function _object_spread_props$q(target, source) {
|
|
5406
|
+
source = source != null ? source : {};
|
|
5407
|
+
if (Object.getOwnPropertyDescriptors) {
|
|
5408
|
+
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
5409
|
+
} else {
|
|
5410
|
+
ownKeys$q(Object(source)).forEach(function(key) {
|
|
5411
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
5412
|
+
});
|
|
5413
|
+
}
|
|
5414
|
+
return target;
|
|
5415
|
+
}
|
|
5416
|
+
function _ts_generator$12(thisArg, body) {
|
|
5397
5417
|
var f, y, t, _ = {
|
|
5398
5418
|
label: 0,
|
|
5399
5419
|
sent: function() {
|
|
@@ -5492,842 +5512,268 @@ function _ts_generator$13(thisArg, body) {
|
|
|
5492
5512
|
};
|
|
5493
5513
|
}
|
|
5494
5514
|
}
|
|
5515
|
+
// The CLI's fetch transport: the global `fetch` wrapped with verbose tracing + the configured
|
|
5516
|
+
// `--timeout`. A plain transport — it injects no `Authorization` header (public + confidential
|
|
5517
|
+
// clients authenticate via `code_verifier` / `client_secret`, not a bearer token).
|
|
5518
|
+
var cliOidcFetch = function cliOidcFetch(input, init) {
|
|
5519
|
+
return tracedFetch(undefined, input, init);
|
|
5520
|
+
};
|
|
5495
5521
|
/**
|
|
5496
|
-
*
|
|
5497
|
-
*
|
|
5498
|
-
*
|
|
5499
|
-
|
|
5500
|
-
|
|
5501
|
-
|
|
5502
|
-
|
|
5503
|
-
|
|
5504
|
-
|
|
5505
|
-
|
|
5506
|
-
|
|
5507
|
-
|
|
5508
|
-
|
|
5509
|
-
|
|
5510
|
-
|
|
5511
|
-
|
|
5512
|
-
|
|
5513
|
-
|
|
5514
|
-
|
|
5515
|
-
|
|
5516
|
-
|
|
5517
|
-
|
|
5518
|
-
|
|
5519
|
-
|
|
5520
|
-
|
|
5521
|
-
|
|
5522
|
-
|
|
5522
|
+
* Maps each shared {@link OidcRelyingPartyErrorCode} back onto the CLI's historical error code +
|
|
5523
|
+
* suggestion, so refactoring the implementation onto the shared core does not change the
|
|
5524
|
+
* `{ ok: false, code, suggestion }` envelope users and scripts depend on.
|
|
5525
|
+
*/ var OIDC_ERROR_CODE_MAP = {
|
|
5526
|
+
DISCOVERY_FAILED: {
|
|
5527
|
+
code: 'OIDC_DISCOVERY_FAILED',
|
|
5528
|
+
suggestion: 'Verify the env oidcIssuer URL is reachable and serves /.well-known/openid-configuration.'
|
|
5529
|
+
},
|
|
5530
|
+
TOKEN_INVALID_GRANT: {
|
|
5531
|
+
code: 'TOKEN_INVALID_GRANT',
|
|
5532
|
+
suggestion: 'Re-run auth login to obtain a fresh code or refresh token.'
|
|
5533
|
+
},
|
|
5534
|
+
TOKEN_EXCHANGE_FAILED: {
|
|
5535
|
+
code: 'TOKEN_EXCHANGE_FAILED'
|
|
5536
|
+
},
|
|
5537
|
+
TOKEN_REVOCATION_FAILED: {
|
|
5538
|
+
code: 'TOKEN_REVOCATION_FAILED'
|
|
5539
|
+
},
|
|
5540
|
+
USERINFO_FAILED: {
|
|
5541
|
+
code: 'USERINFO_FAILED',
|
|
5542
|
+
suggestion: 'Try: <cli> auth login --env <name>'
|
|
5543
|
+
},
|
|
5544
|
+
SESSION_INFO_FAILED: {
|
|
5545
|
+
code: 'SESSION_INFO_FAILED'
|
|
5546
|
+
},
|
|
5547
|
+
AUTH_NO_CODE: {
|
|
5548
|
+
code: 'AUTH_NO_CODE'
|
|
5549
|
+
},
|
|
5550
|
+
AUTH_PROVIDER_ERROR: {
|
|
5551
|
+
code: 'AUTH_PROVIDER_ERROR'
|
|
5552
|
+
},
|
|
5553
|
+
AUTH_REDIRECT_PARSE_FAILED: {
|
|
5554
|
+
code: 'AUTH_REDIRECT_PARSE_FAILED'
|
|
5555
|
+
},
|
|
5556
|
+
INVALID_STATE: {
|
|
5557
|
+
code: 'AUTH_STATE_MISMATCH'
|
|
5558
|
+
},
|
|
5559
|
+
INVALID_SESSION_TTL: {
|
|
5560
|
+
code: 'AUTH_LOGIN_FOR_INVALID'
|
|
5523
5561
|
}
|
|
5524
|
-
|
|
5525
|
-
|
|
5526
|
-
|
|
5527
|
-
|
|
5528
|
-
|
|
5562
|
+
};
|
|
5563
|
+
/**
|
|
5564
|
+
* Converts an {@link OidcRelyingPartyError} thrown by the shared core into the CLI's {@link CliError}
|
|
5565
|
+
* (preserving message + mapped code + suggestion). Any other value is returned unchanged.
|
|
5566
|
+
*
|
|
5567
|
+
* @param error - The thrown value.
|
|
5568
|
+
* @returns A {@link CliError} for relying-party errors, otherwise the original value.
|
|
5569
|
+
*/ function oidcRelyingPartyErrorToCliError(error) {
|
|
5570
|
+
var result = error;
|
|
5571
|
+
if (_instanceof$l(error, util.OidcRelyingPartyError)) {
|
|
5572
|
+
var mapped = OIDC_ERROR_CODE_MAP[error.code];
|
|
5573
|
+
result = new CliError(_object_spread$G({
|
|
5574
|
+
message: error.message,
|
|
5575
|
+
code: mapped.code
|
|
5576
|
+
}, mapped.suggestion ? {
|
|
5577
|
+
suggestion: mapped.suggestion
|
|
5578
|
+
} : {}));
|
|
5529
5579
|
}
|
|
5530
|
-
return
|
|
5580
|
+
return result;
|
|
5531
5581
|
}
|
|
5532
|
-
|
|
5533
|
-
|
|
5534
|
-
|
|
5535
|
-
|
|
5536
|
-
* @param input - The discovery request.
|
|
5537
|
-
* @param input.issuer - The OIDC issuer URL whose `.well-known/openid-configuration` is fetched first.
|
|
5538
|
-
* @param input.fallbackBaseUrl - Optional sibling base URL tried after the issuer-prefixed and origin-rooted candidates.
|
|
5539
|
-
* @returns The parsed {@link OidcDiscoveryMetadata}. Throws a {@link CliError} (`OIDC_DISCOVERY_FAILED`) when every candidate fails.
|
|
5540
|
-
*/ function discoverOidcMetadata(input) {
|
|
5541
|
-
return _async_to_generator$13(function() {
|
|
5542
|
-
var _ref, candidates, lastError, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, url, res, e, err;
|
|
5543
|
-
return _ts_generator$13(this, function(_state) {
|
|
5582
|
+
function withCliErrors(fn) {
|
|
5583
|
+
return _async_to_generator$12(function() {
|
|
5584
|
+
var e;
|
|
5585
|
+
return _ts_generator$12(this, function(_state) {
|
|
5544
5586
|
switch(_state.label){
|
|
5545
5587
|
case 0:
|
|
5546
|
-
candidates = buildOidcDiscoveryCandidates(input);
|
|
5547
|
-
_iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
5548
|
-
_state.label = 1;
|
|
5549
|
-
case 1:
|
|
5550
5588
|
_state.trys.push([
|
|
5551
|
-
|
|
5552
|
-
|
|
5553
|
-
11,
|
|
5554
|
-
12
|
|
5555
|
-
]);
|
|
5556
|
-
_iterator = candidates[Symbol.iterator]();
|
|
5557
|
-
_state.label = 2;
|
|
5558
|
-
case 2:
|
|
5559
|
-
if (!!(_iteratorNormalCompletion = (_step = _iterator.next()).done)) return [
|
|
5560
|
-
3,
|
|
5561
|
-
9
|
|
5562
|
-
];
|
|
5563
|
-
url = _step.value;
|
|
5564
|
-
_state.label = 3;
|
|
5565
|
-
case 3:
|
|
5566
|
-
_state.trys.push([
|
|
5567
|
-
3,
|
|
5568
|
-
7,
|
|
5589
|
+
0,
|
|
5590
|
+
2,
|
|
5569
5591
|
,
|
|
5570
|
-
|
|
5592
|
+
3
|
|
5571
5593
|
]);
|
|
5572
5594
|
return [
|
|
5573
5595
|
4,
|
|
5574
|
-
|
|
5575
|
-
headers: {
|
|
5576
|
-
Accept: 'application/json'
|
|
5577
|
-
}
|
|
5578
|
-
})
|
|
5579
|
-
];
|
|
5580
|
-
case 4:
|
|
5581
|
-
res = _state.sent();
|
|
5582
|
-
if (!res.ok) return [
|
|
5583
|
-
3,
|
|
5584
|
-
6
|
|
5585
|
-
];
|
|
5586
|
-
return [
|
|
5587
|
-
4,
|
|
5588
|
-
res.json()
|
|
5596
|
+
fn()
|
|
5589
5597
|
];
|
|
5590
|
-
case
|
|
5598
|
+
case 1:
|
|
5591
5599
|
return [
|
|
5592
5600
|
2,
|
|
5593
5601
|
_state.sent()
|
|
5594
5602
|
];
|
|
5595
|
-
case
|
|
5596
|
-
lastError = new Error("OIDC discovery failed at ".concat(url, ": ").concat(res.status, " ").concat(res.statusText));
|
|
5597
|
-
return [
|
|
5598
|
-
3,
|
|
5599
|
-
8
|
|
5600
|
-
];
|
|
5601
|
-
case 7:
|
|
5603
|
+
case 2:
|
|
5602
5604
|
e = _state.sent();
|
|
5603
|
-
|
|
5604
|
-
|
|
5605
|
-
3,
|
|
5606
|
-
8
|
|
5607
|
-
];
|
|
5608
|
-
case 8:
|
|
5609
|
-
_iteratorNormalCompletion = true;
|
|
5605
|
+
throw oidcRelyingPartyErrorToCliError(e);
|
|
5606
|
+
case 3:
|
|
5610
5607
|
return [
|
|
5611
|
-
3,
|
|
5612
5608
|
2
|
|
5613
5609
|
];
|
|
5614
|
-
case 9:
|
|
5615
|
-
return [
|
|
5616
|
-
3,
|
|
5617
|
-
12
|
|
5618
|
-
];
|
|
5619
|
-
case 10:
|
|
5620
|
-
err = _state.sent();
|
|
5621
|
-
_didIteratorError = true;
|
|
5622
|
-
_iteratorError = err;
|
|
5623
|
-
return [
|
|
5624
|
-
3,
|
|
5625
|
-
12
|
|
5626
|
-
];
|
|
5627
|
-
case 11:
|
|
5628
|
-
try {
|
|
5629
|
-
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
5630
|
-
_iterator.return();
|
|
5631
|
-
}
|
|
5632
|
-
} finally{
|
|
5633
|
-
if (_didIteratorError) {
|
|
5634
|
-
throw _iteratorError;
|
|
5635
|
-
}
|
|
5636
|
-
}
|
|
5637
|
-
return [
|
|
5638
|
-
7
|
|
5639
|
-
];
|
|
5640
|
-
case 12:
|
|
5641
|
-
throw new CliError({
|
|
5642
|
-
message: (_ref = lastError === null || lastError === void 0 ? void 0 : lastError.message) !== null && _ref !== void 0 ? _ref : "OIDC discovery failed for all candidates: ".concat(candidates.join(', ')),
|
|
5643
|
-
code: 'OIDC_DISCOVERY_FAILED',
|
|
5644
|
-
suggestion: 'Verify the env oidcIssuer URL is reachable and serves /.well-known/openid-configuration.'
|
|
5645
|
-
});
|
|
5646
5610
|
}
|
|
5647
5611
|
});
|
|
5648
5612
|
})();
|
|
5649
5613
|
}
|
|
5650
5614
|
/**
|
|
5651
|
-
*
|
|
5615
|
+
* Fetches the OIDC discovery document for the given issuer.
|
|
5652
5616
|
*
|
|
5653
|
-
*
|
|
5617
|
+
* @param input - The discovery request.
|
|
5618
|
+
* @returns The parsed {@link OidcDiscoveryMetadata}. Throws a {@link CliError} (`OIDC_DISCOVERY_FAILED`) when every candidate fails.
|
|
5619
|
+
*/ function discoverOidcMetadata(input) {
|
|
5620
|
+
return withCliErrors(function() {
|
|
5621
|
+
return oidc.discoverOidcMetadata(_object_spread_props$q(_object_spread$G({}, input), {
|
|
5622
|
+
fetch: cliOidcFetch
|
|
5623
|
+
}));
|
|
5624
|
+
});
|
|
5625
|
+
}
|
|
5626
|
+
/**
|
|
5627
|
+
* Exchanges an authorization code (from the redirect) for an access token + refresh token.
|
|
5654
5628
|
*
|
|
5655
5629
|
* @param input - The token exchange parameters.
|
|
5656
|
-
* @param input.tokenEndpoint - The OIDC token endpoint URL discovered from the issuer.
|
|
5657
|
-
* @param input.clientId - The OAuth client ID.
|
|
5658
|
-
* @param input.clientSecret - The OAuth client secret used for `client_secret_post` auth.
|
|
5659
|
-
* @param input.redirectUri - The redirect URI registered with the OAuth client (must match the value used when requesting the code).
|
|
5660
|
-
* @param input.code - The authorization code returned to the redirect URI.
|
|
5661
|
-
* @param input.codeVerifier - The PKCE code verifier originally paired with the code challenge in the authorization request.
|
|
5662
5630
|
* @returns The parsed {@link OidcTokenResponse} with access/refresh tokens.
|
|
5663
5631
|
*/ function exchangeAuthorizationCode(input) {
|
|
5664
|
-
return
|
|
5665
|
-
|
|
5666
|
-
|
|
5667
|
-
|
|
5668
|
-
|
|
5669
|
-
client_id: input.clientId,
|
|
5670
|
-
client_secret: input.clientSecret,
|
|
5671
|
-
redirect_uri: input.redirectUri,
|
|
5672
|
-
code: input.code,
|
|
5673
|
-
code_verifier: input.codeVerifier
|
|
5674
|
-
});
|
|
5675
|
-
return [
|
|
5676
|
-
2,
|
|
5677
|
-
postTokenEndpoint({
|
|
5678
|
-
tokenEndpoint: input.tokenEndpoint,
|
|
5679
|
-
body: params
|
|
5680
|
-
})
|
|
5681
|
-
];
|
|
5682
|
-
});
|
|
5683
|
-
})();
|
|
5632
|
+
return withCliErrors(function() {
|
|
5633
|
+
return oidc.exchangeAuthorizationCode(_object_spread_props$q(_object_spread$G({}, input), {
|
|
5634
|
+
fetch: cliOidcFetch
|
|
5635
|
+
}));
|
|
5636
|
+
});
|
|
5684
5637
|
}
|
|
5685
5638
|
/**
|
|
5686
5639
|
* Exchanges a refresh token for a new access token (and possibly a rotated refresh token).
|
|
5687
5640
|
*
|
|
5688
5641
|
* @param input - The refresh request.
|
|
5689
|
-
* @param input.tokenEndpoint - The OIDC token endpoint URL discovered from the issuer.
|
|
5690
|
-
* @param input.clientId - The OAuth client ID.
|
|
5691
|
-
* @param input.clientSecret - The OAuth client secret used for `client_secret_post` auth.
|
|
5692
|
-
* @param input.refreshToken - The cached refresh token to redeem.
|
|
5693
5642
|
* @returns The parsed {@link OidcTokenResponse} with the refreshed access token.
|
|
5694
5643
|
*/ function refreshAccessToken(input) {
|
|
5695
|
-
return
|
|
5696
|
-
|
|
5697
|
-
|
|
5698
|
-
|
|
5699
|
-
|
|
5700
|
-
client_id: input.clientId,
|
|
5701
|
-
client_secret: input.clientSecret,
|
|
5702
|
-
refresh_token: input.refreshToken
|
|
5703
|
-
});
|
|
5704
|
-
return [
|
|
5705
|
-
2,
|
|
5706
|
-
postTokenEndpoint({
|
|
5707
|
-
tokenEndpoint: input.tokenEndpoint,
|
|
5708
|
-
body: params
|
|
5709
|
-
})
|
|
5710
|
-
];
|
|
5711
|
-
});
|
|
5712
|
-
})();
|
|
5644
|
+
return withCliErrors(function() {
|
|
5645
|
+
return oidc.refreshAccessToken(_object_spread_props$q(_object_spread$G({}, input), {
|
|
5646
|
+
fetch: cliOidcFetch
|
|
5647
|
+
}));
|
|
5648
|
+
});
|
|
5713
5649
|
}
|
|
5714
5650
|
/**
|
|
5715
5651
|
* Revokes an access or refresh token at the OIDC revocation endpoint.
|
|
5716
5652
|
*
|
|
5717
5653
|
* @param input - The revocation request.
|
|
5718
|
-
* @param input.revocationEndpoint - The OIDC revocation endpoint URL.
|
|
5719
|
-
* @param input.clientId - The OAuth client ID used for `client_secret_post` auth.
|
|
5720
|
-
* @param input.clientSecret - The OAuth client secret used for `client_secret_post` auth.
|
|
5721
|
-
* @param input.token - The access or refresh token to revoke.
|
|
5722
|
-
* @param input.tokenTypeHint - Optional hint passed as `token_type_hint` (`access_token` or `refresh_token`).
|
|
5723
5654
|
* @returns Resolves when the server returns a non-error status. Throws a {@link CliError} (`TOKEN_REVOCATION_FAILED`) on error.
|
|
5724
5655
|
*/ function revokeToken(input) {
|
|
5725
|
-
return
|
|
5726
|
-
|
|
5727
|
-
|
|
5728
|
-
|
|
5729
|
-
|
|
5730
|
-
params = new URLSearchParams(_object_spread$F({
|
|
5731
|
-
client_id: input.clientId,
|
|
5732
|
-
client_secret: input.clientSecret,
|
|
5733
|
-
token: input.token
|
|
5734
|
-
}, input.tokenTypeHint ? {
|
|
5735
|
-
token_type_hint: input.tokenTypeHint
|
|
5736
|
-
} : {}));
|
|
5737
|
-
return [
|
|
5738
|
-
4,
|
|
5739
|
-
tracedFetch(undefined, input.revocationEndpoint, {
|
|
5740
|
-
method: 'POST',
|
|
5741
|
-
headers: {
|
|
5742
|
-
'Content-Type': 'application/x-www-form-urlencoded',
|
|
5743
|
-
Accept: 'application/json'
|
|
5744
|
-
},
|
|
5745
|
-
body: params.toString()
|
|
5746
|
-
})
|
|
5747
|
-
];
|
|
5748
|
-
case 1:
|
|
5749
|
-
res = _state.sent();
|
|
5750
|
-
if (!res.ok) {
|
|
5751
|
-
throw new CliError({
|
|
5752
|
-
message: "Token revocation failed: ".concat(res.status, " ").concat(res.statusText),
|
|
5753
|
-
code: 'TOKEN_REVOCATION_FAILED'
|
|
5754
|
-
});
|
|
5755
|
-
}
|
|
5756
|
-
return [
|
|
5757
|
-
2
|
|
5758
|
-
];
|
|
5759
|
-
}
|
|
5760
|
-
});
|
|
5761
|
-
})();
|
|
5656
|
+
return withCliErrors(function() {
|
|
5657
|
+
return oidc.revokeToken(_object_spread_props$q(_object_spread$G({}, input), {
|
|
5658
|
+
fetch: cliOidcFetch
|
|
5659
|
+
}));
|
|
5660
|
+
});
|
|
5762
5661
|
}
|
|
5763
5662
|
/**
|
|
5764
5663
|
* Fetches the OIDC `userinfo` endpoint and returns the parsed claims object.
|
|
5765
5664
|
*
|
|
5766
5665
|
* @param input - The userinfo request.
|
|
5767
|
-
* @param input.userinfoEndpoint - The OIDC userinfo endpoint URL discovered from the issuer.
|
|
5768
|
-
* @param input.accessToken - The Bearer access token sent in the `Authorization` header.
|
|
5769
5666
|
* @returns The parsed userinfo claims. Throws a {@link CliError} (`USERINFO_FAILED`) on a non-OK response.
|
|
5770
5667
|
*/ function fetchUserInfo(input) {
|
|
5771
|
-
return
|
|
5772
|
-
|
|
5773
|
-
|
|
5774
|
-
|
|
5775
|
-
|
|
5776
|
-
return [
|
|
5777
|
-
4,
|
|
5778
|
-
tracedFetch(undefined, input.userinfoEndpoint, {
|
|
5779
|
-
headers: {
|
|
5780
|
-
Authorization: "Bearer ".concat(input.accessToken),
|
|
5781
|
-
Accept: 'application/json'
|
|
5782
|
-
}
|
|
5783
|
-
})
|
|
5784
|
-
];
|
|
5785
|
-
case 1:
|
|
5786
|
-
res = _state.sent();
|
|
5787
|
-
if (!res.ok) {
|
|
5788
|
-
throw new CliError({
|
|
5789
|
-
message: "Userinfo request failed: ".concat(res.status, " ").concat(res.statusText),
|
|
5790
|
-
code: 'USERINFO_FAILED',
|
|
5791
|
-
suggestion: 'Try: <cli> auth login --env <name>'
|
|
5792
|
-
});
|
|
5793
|
-
}
|
|
5794
|
-
return [
|
|
5795
|
-
4,
|
|
5796
|
-
res.json()
|
|
5797
|
-
];
|
|
5798
|
-
case 2:
|
|
5799
|
-
return [
|
|
5800
|
-
2,
|
|
5801
|
-
_state.sent()
|
|
5802
|
-
];
|
|
5803
|
-
}
|
|
5804
|
-
});
|
|
5805
|
-
})();
|
|
5668
|
+
return withCliErrors(function() {
|
|
5669
|
+
return oidc.fetchUserInfo(_object_spread_props$q(_object_spread$G({}, input), {
|
|
5670
|
+
fetch: cliOidcFetch
|
|
5671
|
+
}));
|
|
5672
|
+
});
|
|
5806
5673
|
}
|
|
5807
5674
|
/**
|
|
5808
5675
|
* Fetches the dbx-components `GET /oidc/session` route and returns the parsed session lifetime metadata.
|
|
5809
5676
|
*
|
|
5810
|
-
* Mirrors {@link fetchUserInfo}, but reads the access token's baked-in session-lifetime claims
|
|
5811
|
-
* (`dbx_session_expires_at` / `dbx_rotation_disabled`) which userinfo does not echo.
|
|
5812
|
-
*
|
|
5813
5677
|
* @param input - The session request.
|
|
5814
|
-
* @param input.sessionEndpoint - The `GET /oidc/session` endpoint URL.
|
|
5815
|
-
* @param input.accessToken - The Bearer access token sent in the `Authorization` header.
|
|
5816
5678
|
* @returns The parsed {@link OidcSessionInfo}. Throws a {@link CliError} (`SESSION_INFO_FAILED`) on a non-OK response.
|
|
5817
5679
|
*/ function fetchSessionInfo(input) {
|
|
5818
|
-
return
|
|
5819
|
-
|
|
5820
|
-
|
|
5821
|
-
|
|
5822
|
-
|
|
5823
|
-
return [
|
|
5824
|
-
4,
|
|
5825
|
-
tracedFetch(undefined, input.sessionEndpoint, {
|
|
5826
|
-
headers: {
|
|
5827
|
-
Authorization: "Bearer ".concat(input.accessToken),
|
|
5828
|
-
Accept: 'application/json'
|
|
5829
|
-
}
|
|
5830
|
-
})
|
|
5831
|
-
];
|
|
5832
|
-
case 1:
|
|
5833
|
-
res = _state.sent();
|
|
5834
|
-
if (!res.ok) {
|
|
5835
|
-
throw new CliError({
|
|
5836
|
-
message: "Session info request failed: ".concat(res.status, " ").concat(res.statusText),
|
|
5837
|
-
code: 'SESSION_INFO_FAILED'
|
|
5838
|
-
});
|
|
5839
|
-
}
|
|
5840
|
-
return [
|
|
5841
|
-
4,
|
|
5842
|
-
res.json()
|
|
5843
|
-
];
|
|
5844
|
-
case 2:
|
|
5845
|
-
return [
|
|
5846
|
-
2,
|
|
5847
|
-
_state.sent()
|
|
5848
|
-
];
|
|
5849
|
-
}
|
|
5850
|
-
});
|
|
5851
|
-
})();
|
|
5852
|
-
}
|
|
5853
|
-
function postTokenEndpoint(input) {
|
|
5854
|
-
return _async_to_generator$13(function() {
|
|
5855
|
-
var res, body, _ref, _body_error_description, message;
|
|
5856
|
-
return _ts_generator$13(this, function(_state) {
|
|
5857
|
-
switch(_state.label){
|
|
5858
|
-
case 0:
|
|
5859
|
-
return [
|
|
5860
|
-
4,
|
|
5861
|
-
tracedFetch(undefined, input.tokenEndpoint, {
|
|
5862
|
-
method: 'POST',
|
|
5863
|
-
headers: {
|
|
5864
|
-
'Content-Type': 'application/x-www-form-urlencoded',
|
|
5865
|
-
Accept: 'application/json'
|
|
5866
|
-
},
|
|
5867
|
-
body: input.body.toString()
|
|
5868
|
-
})
|
|
5869
|
-
];
|
|
5870
|
-
case 1:
|
|
5871
|
-
res = _state.sent();
|
|
5872
|
-
return [
|
|
5873
|
-
4,
|
|
5874
|
-
res.json().catch(function() {
|
|
5875
|
-
return {};
|
|
5876
|
-
})
|
|
5877
|
-
];
|
|
5878
|
-
case 2:
|
|
5879
|
-
body = _state.sent();
|
|
5880
|
-
if (!res.ok || body.error) {
|
|
5881
|
-
message = (_ref = (_body_error_description = body.error_description) !== null && _body_error_description !== void 0 ? _body_error_description : body.error) !== null && _ref !== void 0 ? _ref : "".concat(res.status, " ").concat(res.statusText);
|
|
5882
|
-
throw new CliError({
|
|
5883
|
-
message: "OIDC token endpoint error: ".concat(message),
|
|
5884
|
-
code: body.error === 'invalid_grant' ? 'TOKEN_INVALID_GRANT' : 'TOKEN_EXCHANGE_FAILED',
|
|
5885
|
-
suggestion: body.error === 'invalid_grant' ? 'Re-run auth login to obtain a fresh code or refresh token.' : undefined
|
|
5886
|
-
});
|
|
5887
|
-
}
|
|
5888
|
-
if (!body.access_token) {
|
|
5889
|
-
throw new CliError({
|
|
5890
|
-
message: 'OIDC token endpoint returned no access_token.',
|
|
5891
|
-
code: 'TOKEN_EXCHANGE_FAILED'
|
|
5892
|
-
});
|
|
5893
|
-
}
|
|
5894
|
-
return [
|
|
5895
|
-
2,
|
|
5896
|
-
body
|
|
5897
|
-
];
|
|
5898
|
-
}
|
|
5899
|
-
});
|
|
5900
|
-
})();
|
|
5901
|
-
}
|
|
5902
|
-
function trimSlash(url) {
|
|
5903
|
-
return url.endsWith('/') ? url.slice(0, -1) : url;
|
|
5680
|
+
return withCliErrors(function() {
|
|
5681
|
+
return oidc.fetchSessionInfo(_object_spread_props$q(_object_spread$G({}, input), {
|
|
5682
|
+
fetch: cliOidcFetch
|
|
5683
|
+
}));
|
|
5684
|
+
});
|
|
5904
5685
|
}
|
|
5905
5686
|
|
|
5906
|
-
function
|
|
5907
|
-
if (
|
|
5908
|
-
|
|
5909
|
-
|
|
5910
|
-
|
|
5911
|
-
|
|
5912
|
-
|
|
5913
|
-
}
|
|
5914
|
-
function asyncGeneratorStep$12(gen, resolve, reject, _next, _throw, key, arg) {
|
|
5915
|
-
try {
|
|
5916
|
-
var info = gen[key](arg);
|
|
5917
|
-
var value = info.value;
|
|
5918
|
-
} catch (error) {
|
|
5919
|
-
reject(error);
|
|
5920
|
-
return;
|
|
5921
|
-
}
|
|
5922
|
-
if (info.done) {
|
|
5923
|
-
resolve(value);
|
|
5687
|
+
function _define_property$F(obj, key, value) {
|
|
5688
|
+
if (key in obj) {
|
|
5689
|
+
Object.defineProperty(obj, key, {
|
|
5690
|
+
value: value,
|
|
5691
|
+
enumerable: true,
|
|
5692
|
+
configurable: true,
|
|
5693
|
+
writable: true
|
|
5694
|
+
});
|
|
5924
5695
|
} else {
|
|
5925
|
-
|
|
5696
|
+
obj[key] = value;
|
|
5926
5697
|
}
|
|
5698
|
+
return obj;
|
|
5927
5699
|
}
|
|
5928
|
-
function
|
|
5929
|
-
|
|
5930
|
-
var
|
|
5931
|
-
|
|
5932
|
-
|
|
5933
|
-
|
|
5934
|
-
|
|
5935
|
-
}
|
|
5936
|
-
function _throw(err) {
|
|
5937
|
-
asyncGeneratorStep$12(gen, resolve, reject, _next, _throw, "throw", err);
|
|
5938
|
-
}
|
|
5939
|
-
_next(undefined);
|
|
5940
|
-
});
|
|
5941
|
-
};
|
|
5942
|
-
}
|
|
5943
|
-
function _iterable_to_array_limit$f(arr, i) {
|
|
5944
|
-
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
5945
|
-
if (_i == null) return;
|
|
5946
|
-
var _arr = [];
|
|
5947
|
-
var _n = true;
|
|
5948
|
-
var _d = false;
|
|
5949
|
-
var _s, _e;
|
|
5950
|
-
try {
|
|
5951
|
-
for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
|
|
5952
|
-
_arr.push(_s.value);
|
|
5953
|
-
if (i && _arr.length === i) break;
|
|
5954
|
-
}
|
|
5955
|
-
} catch (err) {
|
|
5956
|
-
_d = true;
|
|
5957
|
-
_e = err;
|
|
5958
|
-
} finally{
|
|
5959
|
-
try {
|
|
5960
|
-
if (!_n && _i["return"] != null) _i["return"]();
|
|
5961
|
-
} finally{
|
|
5962
|
-
if (_d) throw _e;
|
|
5700
|
+
function _object_spread$F(target) {
|
|
5701
|
+
for(var i = 1; i < arguments.length; i++){
|
|
5702
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
5703
|
+
var ownKeys = Object.keys(source);
|
|
5704
|
+
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
5705
|
+
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
5706
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
5707
|
+
}));
|
|
5963
5708
|
}
|
|
5709
|
+
ownKeys.forEach(function(key) {
|
|
5710
|
+
_define_property$F(target, key, source[key]);
|
|
5711
|
+
});
|
|
5964
5712
|
}
|
|
5965
|
-
return
|
|
5966
|
-
}
|
|
5967
|
-
function _non_iterable_rest$f() {
|
|
5968
|
-
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
5969
|
-
}
|
|
5970
|
-
function _sliced_to_array$f(arr, i) {
|
|
5971
|
-
return _array_with_holes$f(arr) || _iterable_to_array_limit$f(arr, i) || _unsupported_iterable_to_array$$(arr, i) || _non_iterable_rest$f();
|
|
5972
|
-
}
|
|
5973
|
-
function _unsupported_iterable_to_array$$(o, minLen) {
|
|
5974
|
-
if (!o) return;
|
|
5975
|
-
if (typeof o === "string") return _array_like_to_array$$(o, minLen);
|
|
5976
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
5977
|
-
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
5978
|
-
if (n === "Map" || n === "Set") return Array.from(n);
|
|
5979
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$$(o, minLen);
|
|
5713
|
+
return target;
|
|
5980
5714
|
}
|
|
5981
|
-
function
|
|
5982
|
-
var
|
|
5983
|
-
|
|
5984
|
-
|
|
5985
|
-
|
|
5986
|
-
return t[1];
|
|
5987
|
-
},
|
|
5988
|
-
trys: [],
|
|
5989
|
-
ops: []
|
|
5990
|
-
}, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype), d = Object.defineProperty;
|
|
5991
|
-
return d(g, "next", {
|
|
5992
|
-
value: verb(0)
|
|
5993
|
-
}), d(g, "throw", {
|
|
5994
|
-
value: verb(1)
|
|
5995
|
-
}), d(g, "return", {
|
|
5996
|
-
value: verb(2)
|
|
5997
|
-
}), typeof Symbol === "function" && d(g, Symbol.iterator, {
|
|
5998
|
-
value: function() {
|
|
5999
|
-
return this;
|
|
6000
|
-
}
|
|
6001
|
-
}), g;
|
|
6002
|
-
function verb(n) {
|
|
6003
|
-
return function(v) {
|
|
6004
|
-
return step([
|
|
6005
|
-
n,
|
|
6006
|
-
v
|
|
6007
|
-
]);
|
|
6008
|
-
};
|
|
5715
|
+
function ownKeys$p(object, enumerableOnly) {
|
|
5716
|
+
var keys = Object.keys(object);
|
|
5717
|
+
if (Object.getOwnPropertySymbols) {
|
|
5718
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
5719
|
+
keys.push.apply(keys, symbols);
|
|
6009
5720
|
}
|
|
6010
|
-
|
|
6011
|
-
|
|
6012
|
-
|
|
6013
|
-
|
|
6014
|
-
|
|
6015
|
-
|
|
6016
|
-
|
|
6017
|
-
|
|
6018
|
-
|
|
6019
|
-
|
|
6020
|
-
case 1:
|
|
6021
|
-
t = op;
|
|
6022
|
-
break;
|
|
6023
|
-
case 4:
|
|
6024
|
-
_.label++;
|
|
6025
|
-
return {
|
|
6026
|
-
value: op[1],
|
|
6027
|
-
done: false
|
|
6028
|
-
};
|
|
6029
|
-
case 5:
|
|
6030
|
-
_.label++;
|
|
6031
|
-
y = op[1];
|
|
6032
|
-
op = [
|
|
6033
|
-
0
|
|
6034
|
-
];
|
|
6035
|
-
continue;
|
|
6036
|
-
case 7:
|
|
6037
|
-
op = _.ops.pop();
|
|
6038
|
-
_.trys.pop();
|
|
6039
|
-
continue;
|
|
6040
|
-
default:
|
|
6041
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
6042
|
-
_ = 0;
|
|
6043
|
-
continue;
|
|
6044
|
-
}
|
|
6045
|
-
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
6046
|
-
_.label = op[1];
|
|
6047
|
-
break;
|
|
6048
|
-
}
|
|
6049
|
-
if (op[0] === 6 && _.label < t[1]) {
|
|
6050
|
-
_.label = t[1];
|
|
6051
|
-
t = op;
|
|
6052
|
-
break;
|
|
6053
|
-
}
|
|
6054
|
-
if (t && _.label < t[2]) {
|
|
6055
|
-
_.label = t[2];
|
|
6056
|
-
_.ops.push(op);
|
|
6057
|
-
break;
|
|
6058
|
-
}
|
|
6059
|
-
if (t[2]) _.ops.pop();
|
|
6060
|
-
_.trys.pop();
|
|
6061
|
-
continue;
|
|
6062
|
-
}
|
|
6063
|
-
op = body.call(thisArg, _);
|
|
6064
|
-
} catch (e) {
|
|
6065
|
-
op = [
|
|
6066
|
-
6,
|
|
6067
|
-
e
|
|
6068
|
-
];
|
|
6069
|
-
y = 0;
|
|
6070
|
-
} finally{
|
|
6071
|
-
f = t = 0;
|
|
6072
|
-
}
|
|
6073
|
-
if (op[0] & 5) throw op[1];
|
|
6074
|
-
return {
|
|
6075
|
-
value: op[0] ? op[1] : void 0,
|
|
6076
|
-
done: true
|
|
6077
|
-
};
|
|
5721
|
+
return keys;
|
|
5722
|
+
}
|
|
5723
|
+
function _object_spread_props$p(target, source) {
|
|
5724
|
+
source = source != null ? source : {};
|
|
5725
|
+
if (Object.getOwnPropertyDescriptors) {
|
|
5726
|
+
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
5727
|
+
} else {
|
|
5728
|
+
ownKeys$p(Object(source)).forEach(function(key) {
|
|
5729
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
5730
|
+
});
|
|
6078
5731
|
}
|
|
5732
|
+
return target;
|
|
6079
5733
|
}
|
|
6080
5734
|
/**
|
|
6081
5735
|
* Builds the authorization URL the user opens in a browser to start the PKCE flow.
|
|
6082
5736
|
*
|
|
6083
|
-
*
|
|
6084
|
-
*
|
|
6085
|
-
*
|
|
6086
|
-
* deployment all three resolve to the same origin and the rebase is a no-op; in a split-host
|
|
6087
|
-
* setup (frontend dev server proxying `/oidc/**` to the API) `appClientUrl` redirects the user
|
|
6088
|
-
* through the frontend. When none of the three is provided, the discovered endpoint is used
|
|
6089
|
-
* unchanged.
|
|
5737
|
+
* Thin CLI wrapper over the shared {@link buildAuthorizationUrlHelper}: defaults the scope to
|
|
5738
|
+
* {@link DEFAULT_CLI_OIDC_SCOPES} when none is supplied, and re-wraps the shared
|
|
5739
|
+
* {@link OidcRelyingPartyError} into the CLI's {@link CliError} (`AUTH_LOGIN_FOR_INVALID`).
|
|
6090
5740
|
*
|
|
6091
|
-
*
|
|
6092
|
-
* and redirect to the app login page with a `uid`. (Earlier versions targeted a convenience
|
|
6093
|
-
* `/oidc/login/client` redirect that forwarded query params to the app without creating an
|
|
6094
|
-
* interaction — that branch is gone.)
|
|
6095
|
-
*
|
|
6096
|
-
* @param input - The authorization URL inputs.
|
|
6097
|
-
* @param input.authorizationEndpoint - The authorization endpoint discovered from OIDC metadata.
|
|
6098
|
-
* @param input.appClientUrl - Optional client origin to rebase the authorization endpoint onto. Takes precedence over `oidcIssuer` and `apiBaseUrl`.
|
|
6099
|
-
* @param input.oidcIssuer - Optional OIDC issuer URL; falls back to its origin as the rebase target when `appClientUrl` is missing.
|
|
6100
|
-
* @param input.apiBaseUrl - Optional API base URL; falls back to its origin as the rebase target when neither `appClientUrl` nor `oidcIssuer` is set.
|
|
6101
|
-
* @param input.clientId - The OAuth client ID.
|
|
6102
|
-
* @param input.redirectUri - The redirect URI registered with the OAuth client.
|
|
6103
|
-
* @param input.scopes - Space-separated scope list. Defaults to {@link DEFAULT_CLI_OIDC_SCOPES}.
|
|
6104
|
-
* @param input.state - The opaque OAuth state token used for CSRF protection.
|
|
6105
|
-
* @param input.codeChallenge - The PKCE code challenge derived from the verifier.
|
|
5741
|
+
* @param input - The authorization URL inputs. When `scopes` is omitted, the CLI default is used.
|
|
6106
5742
|
* @returns The full authorization URL with all OAuth params merged in.
|
|
6107
5743
|
* @throws {CliError} When `requestedSessionTtlSeconds` is provided but is not a positive integer.
|
|
6108
5744
|
*
|
|
6109
5745
|
* @__NO_SIDE_EFFECTS__
|
|
6110
5746
|
*/ function buildAuthorizationUrl(input) {
|
|
6111
|
-
var _input_scopes;
|
|
6112
|
-
var resolvedScope = (_input_scopes = input.scopes) !== null && _input_scopes !== void 0 ? _input_scopes : DEFAULT_CLI_OIDC_SCOPES;
|
|
6113
|
-
var authParams = {
|
|
6114
|
-
response_type: 'code',
|
|
6115
|
-
client_id: input.clientId,
|
|
6116
|
-
redirect_uri: input.redirectUri,
|
|
6117
|
-
scope: resolvedScope,
|
|
6118
|
-
code_challenge: input.codeChallenge,
|
|
6119
|
-
code_challenge_method: 'S256',
|
|
6120
|
-
state: input.state
|
|
6121
|
-
};
|
|
6122
|
-
// oidc-provider's check_scope middleware silently strips `offline_access` unless the
|
|
6123
|
-
// auth request also includes `prompt=consent`. Auto-add it so refresh tokens are
|
|
6124
|
-
// actually issued whenever the CLI requests offline access.
|
|
6125
|
-
if (resolvedScope.split(/\s+/).includes('offline_access')) {
|
|
6126
|
-
authParams.prompt = 'consent';
|
|
6127
|
-
}
|
|
6128
|
-
if (input.requestedSessionTtlSeconds != null) {
|
|
6129
|
-
if (!Number.isInteger(input.requestedSessionTtlSeconds) || input.requestedSessionTtlSeconds <= 0) {
|
|
6130
|
-
throw new CliError({
|
|
6131
|
-
message: "requestedSessionTtlSeconds must be a positive integer (got ".concat(input.requestedSessionTtlSeconds, ")."),
|
|
6132
|
-
code: 'AUTH_LOGIN_FOR_INVALID'
|
|
6133
|
-
});
|
|
6134
|
-
}
|
|
6135
|
-
authParams.dbx_session_ttl = String(input.requestedSessionTtlSeconds);
|
|
6136
|
-
}
|
|
6137
|
-
var rebaseOrigin = resolveAuthorizationRebaseOrigin({
|
|
6138
|
-
appClientUrl: input.appClientUrl,
|
|
6139
|
-
oidcIssuer: input.oidcIssuer,
|
|
6140
|
-
apiBaseUrl: input.apiBaseUrl
|
|
6141
|
-
});
|
|
6142
|
-
var endpoint = rebaseOrigin ? rebaseUrlOrigin({
|
|
6143
|
-
url: input.authorizationEndpoint,
|
|
6144
|
-
originUrl: rebaseOrigin
|
|
6145
|
-
}) : input.authorizationEndpoint;
|
|
6146
|
-
// Merge into the existing query string (preserving any params already on the endpoint) so
|
|
6147
|
-
// a pre-baked endpoint like `/oidc/auth?source=cli` survives unchanged.
|
|
6148
|
-
var url = new URL(endpoint);
|
|
6149
|
-
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
6150
5747
|
try {
|
|
6151
|
-
|
|
6152
|
-
|
|
6153
|
-
|
|
6154
|
-
}
|
|
6155
|
-
} catch (
|
|
6156
|
-
|
|
6157
|
-
_iteratorError = err;
|
|
6158
|
-
} finally{
|
|
6159
|
-
try {
|
|
6160
|
-
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
6161
|
-
_iterator.return();
|
|
6162
|
-
}
|
|
6163
|
-
} finally{
|
|
6164
|
-
if (_didIteratorError) {
|
|
6165
|
-
throw _iteratorError;
|
|
6166
|
-
}
|
|
6167
|
-
}
|
|
6168
|
-
}
|
|
6169
|
-
return url.toString();
|
|
6170
|
-
}
|
|
6171
|
-
/**
|
|
6172
|
-
* Picks the origin used to rebase the discovered authorization endpoint, in priority order:
|
|
6173
|
-
* 1. `appClientUrl` (verbatim — the explicit override)
|
|
6174
|
-
* 2. `oidcIssuer` (parsed `origin`, e.g. `https://api.example.com/oidc` → `https://api.example.com`)
|
|
6175
|
-
* 3. `apiBaseUrl` (parsed `origin`, e.g. `https://api.example.com/api` → `https://api.example.com`)
|
|
6176
|
-
*
|
|
6177
|
-
* Returns `undefined` when none is set or every candidate fails to parse; the caller should then
|
|
6178
|
-
* use the discovered endpoint unchanged.
|
|
6179
|
-
*
|
|
6180
|
-
* @param input - The candidate URLs in priority order.
|
|
6181
|
-
* @returns The selected origin, or `undefined` when no candidate yields one.
|
|
6182
|
-
*/ function resolveAuthorizationRebaseOrigin(input) {
|
|
6183
|
-
var result;
|
|
6184
|
-
if (input.appClientUrl) {
|
|
6185
|
-
result = input.appClientUrl;
|
|
6186
|
-
} else {
|
|
6187
|
-
var _input_oidcIssuer;
|
|
6188
|
-
var fallbackSource = (_input_oidcIssuer = input.oidcIssuer) !== null && _input_oidcIssuer !== void 0 ? _input_oidcIssuer : input.apiBaseUrl;
|
|
6189
|
-
if (fallbackSource) {
|
|
6190
|
-
try {
|
|
6191
|
-
result = new URL(fallbackSource).origin;
|
|
6192
|
-
} catch (unused) {
|
|
6193
|
-
// Fall through with result undefined
|
|
6194
|
-
}
|
|
6195
|
-
}
|
|
6196
|
-
}
|
|
6197
|
-
return result;
|
|
6198
|
-
}
|
|
6199
|
-
/**
|
|
6200
|
-
* Returns `url` with its origin replaced by the origin of `originUrl`. The path and search of
|
|
6201
|
-
* `url` are preserved. When `originUrl` is empty/missing or either URL fails to parse, returns
|
|
6202
|
-
* `url` unchanged.
|
|
6203
|
-
*
|
|
6204
|
-
* @param input - The rebase inputs.
|
|
6205
|
-
* @param input.url - The URL whose path/search should be preserved.
|
|
6206
|
-
* @param input.originUrl - The origin to rebase `url` onto.
|
|
6207
|
-
* @returns The rebased URL string, or `input.url` unchanged when rebasing isn't possible.
|
|
6208
|
-
*/ function rebaseUrlOrigin(input) {
|
|
6209
|
-
var result = input.url;
|
|
6210
|
-
if (input.originUrl) {
|
|
6211
|
-
try {
|
|
6212
|
-
var parsedUrl = new URL(input.url);
|
|
6213
|
-
var parsedOrigin = new URL(input.originUrl);
|
|
6214
|
-
parsedUrl.protocol = parsedOrigin.protocol;
|
|
6215
|
-
parsedUrl.host = parsedOrigin.host;
|
|
6216
|
-
result = parsedUrl.toString();
|
|
6217
|
-
} catch (unused) {
|
|
6218
|
-
// Fall through with the original url unchanged
|
|
6219
|
-
}
|
|
6220
|
-
}
|
|
6221
|
-
return result;
|
|
6222
|
-
}
|
|
6223
|
-
/**
|
|
6224
|
-
* Generates a fresh PKCE code verifier and the matching SHA-256 code challenge.
|
|
6225
|
-
*
|
|
6226
|
-
* @returns A {@link PkceMaterial} pair consisting of the random `codeVerifier` and its derived `codeChallenge`.
|
|
6227
|
-
*/ function generatePkceMaterial() {
|
|
6228
|
-
return _async_to_generator$12(function() {
|
|
6229
|
-
var codeVerifier, codeChallenge;
|
|
6230
|
-
return _ts_generator$12(this, function(_state) {
|
|
6231
|
-
switch(_state.label){
|
|
6232
|
-
case 0:
|
|
6233
|
-
codeVerifier = util.generatePkceCodeVerifier();
|
|
6234
|
-
return [
|
|
6235
|
-
4,
|
|
6236
|
-
util.generatePkceCodeChallenge(codeVerifier)
|
|
6237
|
-
];
|
|
6238
|
-
case 1:
|
|
6239
|
-
codeChallenge = _state.sent();
|
|
6240
|
-
return [
|
|
6241
|
-
2,
|
|
6242
|
-
{
|
|
6243
|
-
codeVerifier: codeVerifier,
|
|
6244
|
-
codeChallenge: codeChallenge
|
|
6245
|
-
}
|
|
6246
|
-
];
|
|
6247
|
-
}
|
|
6248
|
-
});
|
|
6249
|
-
})();
|
|
6250
|
-
}
|
|
6251
|
-
/**
|
|
6252
|
-
* Generates a random URL-safe state value for the OAuth state parameter.
|
|
6253
|
-
*
|
|
6254
|
-
* @returns A 32-character hex string derived from 16 random bytes.
|
|
6255
|
-
*/ function generateOAuthState() {
|
|
6256
|
-
var bytes = new Uint8Array(16);
|
|
6257
|
-
crypto.getRandomValues(bytes);
|
|
6258
|
-
return Array.from(bytes, function(b) {
|
|
6259
|
-
return b.toString(16).padStart(2, '0');
|
|
6260
|
-
}).join('');
|
|
6261
|
-
}
|
|
6262
|
-
function parseRedirectUrlOrThrow(trimmed) {
|
|
6263
|
-
var url;
|
|
6264
|
-
try {
|
|
6265
|
-
// Native URL doesn't parse all urn: schemes — handle the urn:ietf paste case explicitly
|
|
6266
|
-
url = trimmed.startsWith('urn:') ? new URL("https://placeholder.invalid?".concat(trimmed.split('?').slice(1).join('?'))) : new URL(trimmed);
|
|
6267
|
-
} catch (unused) {
|
|
6268
|
-
throw new CliError({
|
|
6269
|
-
message: 'Could not parse redirect URL',
|
|
6270
|
-
code: 'AUTH_REDIRECT_PARSE_FAILED'
|
|
6271
|
-
});
|
|
6272
|
-
}
|
|
6273
|
-
return url;
|
|
6274
|
-
}
|
|
6275
|
-
function throwForUrlMissingCode(url) {
|
|
6276
|
-
var errorParam = url.searchParams.get('error');
|
|
6277
|
-
if (errorParam) {
|
|
6278
|
-
var errorDescription = url.searchParams.get('error_description');
|
|
6279
|
-
var descriptionSuffix = errorDescription ? " (".concat(errorDescription, ")") : '';
|
|
6280
|
-
throw new CliError({
|
|
6281
|
-
message: "Authorization server returned an error: ".concat(errorParam).concat(descriptionSuffix),
|
|
6282
|
-
code: 'AUTH_PROVIDER_ERROR'
|
|
6283
|
-
});
|
|
6284
|
-
}
|
|
6285
|
-
throw new CliError({
|
|
6286
|
-
message: 'No `code` parameter found in the pasted URL.',
|
|
6287
|
-
code: 'AUTH_NO_CODE'
|
|
6288
|
-
});
|
|
6289
|
-
}
|
|
6290
|
-
function parseUrlRedirect(trimmed, expectedState) {
|
|
6291
|
-
var _url_searchParams_get;
|
|
6292
|
-
var url = parseRedirectUrlOrThrow(trimmed);
|
|
6293
|
-
var code = url.searchParams.get('code');
|
|
6294
|
-
if (!code) {
|
|
6295
|
-
throwForUrlMissingCode(url);
|
|
6296
|
-
}
|
|
6297
|
-
var state = (_url_searchParams_get = url.searchParams.get('state')) !== null && _url_searchParams_get !== void 0 ? _url_searchParams_get : undefined;
|
|
6298
|
-
if (expectedState && state !== expectedState) {
|
|
6299
|
-
throw new CliError({
|
|
6300
|
-
message: 'OAuth state mismatch — possible CSRF or stale flow.',
|
|
6301
|
-
code: 'AUTH_STATE_MISMATCH'
|
|
6302
|
-
});
|
|
5748
|
+
var _input_scopes;
|
|
5749
|
+
return util.buildAuthorizationUrl(_object_spread_props$p(_object_spread$F({}, input), {
|
|
5750
|
+
scopes: (_input_scopes = input.scopes) !== null && _input_scopes !== void 0 ? _input_scopes : DEFAULT_CLI_OIDC_SCOPES
|
|
5751
|
+
}));
|
|
5752
|
+
} catch (e) {
|
|
5753
|
+
throw oidcRelyingPartyErrorToCliError(e);
|
|
6303
5754
|
}
|
|
6304
|
-
return {
|
|
6305
|
-
code: code,
|
|
6306
|
-
state: state
|
|
6307
|
-
};
|
|
6308
5755
|
}
|
|
6309
5756
|
/**
|
|
6310
5757
|
* Parses an authorization code out of a pasted redirect URL or a bare code string.
|
|
6311
5758
|
*
|
|
6312
|
-
*
|
|
5759
|
+
* Thin CLI wrapper over the shared {@link parseAuthorizationRedirect}: keeps the CLI's pasted-string
|
|
5760
|
+
* input shape and re-wraps the shared {@link OidcRelyingPartyError} into the CLI's {@link CliError}
|
|
5761
|
+
* (`AUTH_NO_CODE` / `AUTH_PROVIDER_ERROR` / `AUTH_REDIRECT_PARSE_FAILED` / `AUTH_STATE_MISMATCH`).
|
|
6313
5762
|
*
|
|
6314
5763
|
* @param input - The parse inputs.
|
|
6315
5764
|
* @param input.pasted - The redirect URL or bare authorization code pasted by the user.
|
|
6316
5765
|
* @param input.expectedState - Optional state value to assert against `state` when present in the URL.
|
|
6317
5766
|
* @returns The {@link ParsedRedirect} containing `code` and (when present) `state`.
|
|
6318
|
-
* @throws {CliError} When `pasted` is empty,
|
|
5767
|
+
* @throws {CliError} When `pasted` is empty, contains no `code`, or the `state` does not match.
|
|
6319
5768
|
*/ function parsePastedRedirect(input) {
|
|
6320
|
-
|
|
6321
|
-
|
|
6322
|
-
|
|
6323
|
-
|
|
6324
|
-
code: 'AUTH_NO_CODE'
|
|
5769
|
+
try {
|
|
5770
|
+
return util.parseAuthorizationRedirect({
|
|
5771
|
+
url: input.pasted,
|
|
5772
|
+
expectedState: input.expectedState
|
|
6325
5773
|
});
|
|
5774
|
+
} catch (e) {
|
|
5775
|
+
throw oidcRelyingPartyErrorToCliError(e);
|
|
6326
5776
|
}
|
|
6327
|
-
var isUrl = trimmed.startsWith('http://') || trimmed.startsWith('https://') || trimmed.startsWith('urn:');
|
|
6328
|
-
return isUrl ? parseUrlRedirect(trimmed, input.expectedState) : {
|
|
6329
|
-
code: trimmed
|
|
6330
|
-
};
|
|
6331
5777
|
}
|
|
6332
5778
|
|
|
6333
5779
|
/**
|
|
@@ -6971,11 +6417,11 @@ function resolveAuthSetupPrompt(input) {
|
|
|
6971
6417
|
meta = _state.sent();
|
|
6972
6418
|
return [
|
|
6973
6419
|
4,
|
|
6974
|
-
generatePkceMaterial()
|
|
6420
|
+
util.generatePkceMaterial()
|
|
6975
6421
|
];
|
|
6976
6422
|
case 3:
|
|
6977
6423
|
_ref2 = _state.sent(), codeVerifier = _ref2.codeVerifier, codeChallenge = _ref2.codeChallenge;
|
|
6978
|
-
state = generateOAuthState();
|
|
6424
|
+
state = util.generateOAuthState();
|
|
6979
6425
|
requestedScopes = argv.readOnlyScopes ? filterReadOnlyModelScopes(env.scopes) : env.scopes;
|
|
6980
6426
|
if (argv.serviceToken) {
|
|
6981
6427
|
// Adds token.service + offline_access (de-duped); applied after the read-only filter so a
|
|
@@ -7721,7 +7167,7 @@ function _ts_generator$10(thisArg, body) {
|
|
|
7721
7167
|
3,
|
|
7722
7168
|
5
|
|
7723
7169
|
];
|
|
7724
|
-
candidates = buildOidcDiscoveryCandidates({
|
|
7170
|
+
candidates = util.buildOidcDiscoveryCandidates({
|
|
7725
7171
|
issuer: env.oidcIssuer,
|
|
7726
7172
|
fallbackBaseUrl: env.apiBaseUrl
|
|
7727
7173
|
});
|
|
@@ -60033,7 +59479,6 @@ exports.buildMcpToolName = buildMcpToolName;
|
|
|
60033
59479
|
exports.buildModelDecodeCommand = buildModelDecodeCommand;
|
|
60034
59480
|
exports.buildModelInfoCommand = buildModelInfoCommand;
|
|
60035
59481
|
exports.buildModelSnapshotFieldsManifest = buildModelSnapshotFieldsManifest;
|
|
60036
|
-
exports.buildOidcDiscoveryCandidates = buildOidcDiscoveryCandidates;
|
|
60037
59482
|
exports.buildPipesManifest = buildPipesManifest;
|
|
60038
59483
|
exports.buildRouteManifest = buildRouteManifest;
|
|
60039
59484
|
exports.buildRouteTree = buildRouteTree;
|
|
@@ -60120,8 +59565,6 @@ exports.findAndLoadConfig = findAndLoadConfig;
|
|
|
60120
59565
|
exports.findCliEnvDefault = findCliEnvDefault;
|
|
60121
59566
|
exports.findCliModelManifestEntry = findCliModelManifestEntry;
|
|
60122
59567
|
exports.flattenList = flattenList;
|
|
60123
|
-
exports.generateOAuthState = generateOAuthState;
|
|
60124
|
-
exports.generatePkceMaterial = generatePkceMaterial;
|
|
60125
59568
|
exports.getBundledManifestsDirectory = getBundledManifestsDirectory;
|
|
60126
59569
|
exports.getCliContext = getCliContext;
|
|
60127
59570
|
exports.getCliEnvVarName = getCliEnvVarName;
|
|
@@ -60206,6 +59649,7 @@ exports.mergeCliConfig = mergeCliConfig;
|
|
|
60206
59649
|
exports.mergeCliEnvWithDefault = mergeCliEnvWithDefault;
|
|
60207
59650
|
exports.mergeOutputConfig = mergeOutputConfig;
|
|
60208
59651
|
exports.normalizePathname = normalizePathname;
|
|
59652
|
+
exports.oidcRelyingPartyErrorToCliError = oidcRelyingPartyErrorToCliError;
|
|
60209
59653
|
exports.openStreamingDump = openStreamingDump;
|
|
60210
59654
|
exports.outputError = outputError;
|
|
60211
59655
|
exports.outputResult = outputResult;
|