@catladder/cli 0.0.0-main-3ce739ff → 0.0.0-main-7d749f5d
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bundles/catci/index.js +324 -95
- package/dist/bundles/catenv/index.js +1475 -1012
- package/dist/bundles/cli/index.js +2199 -1091
- package/dist/cli/src/packageInfos.js +0 -1
- package/dist/cli/src/packageInfos.js.map +1 -1
- package/dist/pipeline/src/build/cache/createJobCache.js +2 -2
- package/dist/pipeline/src/build/cache/createJobCache.js.map +1 -1
- package/dist/pipeline/src/build/sbom.js +2 -2
- package/dist/pipeline/src/build/sbom.js.map +1 -1
- package/dist/pipeline/src/config/readConfig.js +0 -1
- package/dist/pipeline/src/config/readConfig.js.map +1 -1
- package/dist/pipeline/src/context/createComponentContext.js +1 -1
- package/dist/pipeline/src/context/createComponentContext.js.map +1 -1
- package/dist/pipeline/src/context/getEnvironmentVariables.js.map +1 -1
- package/dist/pipeline/src/deploy/base/deploy.js +3 -3
- package/dist/pipeline/src/deploy/base/deploy.js.map +1 -1
- package/dist/pipeline/src/deploy/cloudRun/createJobs/cloudRunJobs.js +2 -10
- package/dist/pipeline/src/deploy/cloudRun/createJobs/cloudRunJobs.js.map +1 -1
- package/dist/pipeline/src/deploy/cloudRun/createJobs/cloudRunServices.js +2 -4
- package/dist/pipeline/src/deploy/cloudRun/createJobs/cloudRunServices.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +12 -12
- package/src/packageInfos.ts +0 -1
|
@@ -377,7 +377,6 @@ exports.makeSecurityAuditOverview = makeSecurityAuditOverview;
|
|
|
377
377
|
var _a;
|
|
378
378
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
379
379
|
const path = ((_a = require.main) === null || _a === void 0 ? void 0 : _a.path) + "/../package.json";
|
|
380
|
-
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
381
380
|
const ownPkg = require(path);
|
|
382
381
|
exports["default"] = ownPkg;
|
|
383
382
|
//# sourceMappingURL=packageInfos.js.map
|
|
@@ -10880,6 +10879,18 @@ exports.UserStarredMetricsDashboard = UserStarredMetricsDashboard;
|
|
|
10880
10879
|
exports.Users = Users;
|
|
10881
10880
|
|
|
10882
10881
|
|
|
10882
|
+
/***/ }),
|
|
10883
|
+
|
|
10884
|
+
/***/ 5067:
|
|
10885
|
+
/***/ ((module) => {
|
|
10886
|
+
|
|
10887
|
+
"use strict";
|
|
10888
|
+
|
|
10889
|
+
module.exports = function () {
|
|
10890
|
+
return /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-PRZcf-nqry=><]/g;
|
|
10891
|
+
};
|
|
10892
|
+
|
|
10893
|
+
|
|
10883
10894
|
/***/ }),
|
|
10884
10895
|
|
|
10885
10896
|
/***/ 7018:
|
|
@@ -22910,23 +22921,11 @@ module.exports = fill;
|
|
|
22910
22921
|
|
|
22911
22922
|
"use strict";
|
|
22912
22923
|
|
|
22913
|
-
var ansiRegex = __nccwpck_require__(
|
|
22924
|
+
var ansiRegex = __nccwpck_require__(5067);
|
|
22914
22925
|
var re = new RegExp(ansiRegex().source); // remove the `g` flag
|
|
22915
22926
|
module.exports = re.test.bind(re);
|
|
22916
22927
|
|
|
22917
22928
|
|
|
22918
|
-
/***/ }),
|
|
22919
|
-
|
|
22920
|
-
/***/ 1082:
|
|
22921
|
-
/***/ ((module) => {
|
|
22922
|
-
|
|
22923
|
-
"use strict";
|
|
22924
|
-
|
|
22925
|
-
module.exports = function () {
|
|
22926
|
-
return /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-PRZcf-nqry=><]/g;
|
|
22927
|
-
};
|
|
22928
|
-
|
|
22929
|
-
|
|
22930
22929
|
/***/ }),
|
|
22931
22930
|
|
|
22932
22931
|
/***/ 6324:
|
|
@@ -23317,7 +23316,7 @@ Separator.prototype.toString = function () {
|
|
|
23317
23316
|
var rx = __nccwpck_require__(1099);
|
|
23318
23317
|
var _ = __nccwpck_require__(6294);
|
|
23319
23318
|
var chalk = __nccwpck_require__(4664);
|
|
23320
|
-
var ansiRegex = __nccwpck_require__(
|
|
23319
|
+
var ansiRegex = __nccwpck_require__(5067);
|
|
23321
23320
|
var runAsync = __nccwpck_require__(2918);
|
|
23322
23321
|
var Choices = __nccwpck_require__(4467);
|
|
23323
23322
|
var ScreenManager = __nccwpck_require__(7522);
|
|
@@ -25445,18 +25444,6 @@ x.iTerm.setCwd = function (cwd) {
|
|
|
25445
25444
|
};
|
|
25446
25445
|
|
|
25447
25446
|
|
|
25448
|
-
/***/ }),
|
|
25449
|
-
|
|
25450
|
-
/***/ 9:
|
|
25451
|
-
/***/ ((module) => {
|
|
25452
|
-
|
|
25453
|
-
"use strict";
|
|
25454
|
-
|
|
25455
|
-
module.exports = function () {
|
|
25456
|
-
return /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-PRZcf-nqry=><]/g;
|
|
25457
|
-
};
|
|
25458
|
-
|
|
25459
|
-
|
|
25460
25447
|
/***/ }),
|
|
25461
25448
|
|
|
25462
25449
|
/***/ 6695:
|
|
@@ -38040,7 +38027,7 @@ module.exports = function (str) {
|
|
|
38040
38027
|
|
|
38041
38028
|
"use strict";
|
|
38042
38029
|
|
|
38043
|
-
var ansiRegex = __nccwpck_require__(
|
|
38030
|
+
var ansiRegex = __nccwpck_require__(5067)();
|
|
38044
38031
|
|
|
38045
38032
|
module.exports = function (str) {
|
|
38046
38033
|
return typeof str === 'string' ? str.replace(ansiRegex, '') : str;
|
|
@@ -69923,18 +69910,6 @@ x.iTerm.setCwd = function (cwd) {
|
|
|
69923
69910
|
};
|
|
69924
69911
|
|
|
69925
69912
|
|
|
69926
|
-
/***/ }),
|
|
69927
|
-
|
|
69928
|
-
/***/ 6901:
|
|
69929
|
-
/***/ ((module) => {
|
|
69930
|
-
|
|
69931
|
-
"use strict";
|
|
69932
|
-
|
|
69933
|
-
module.exports = function () {
|
|
69934
|
-
return /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-PRZcf-nqry=><]/g;
|
|
69935
|
-
};
|
|
69936
|
-
|
|
69937
|
-
|
|
69938
69913
|
/***/ }),
|
|
69939
69914
|
|
|
69940
69915
|
/***/ 1982:
|
|
@@ -70296,7 +70271,7 @@ module.exports = function (str) {
|
|
|
70296
70271
|
|
|
70297
70272
|
"use strict";
|
|
70298
70273
|
|
|
70299
|
-
var ansiRegex = __nccwpck_require__(
|
|
70274
|
+
var ansiRegex = __nccwpck_require__(5067)();
|
|
70300
70275
|
|
|
70301
70276
|
module.exports = function (str) {
|
|
70302
70277
|
return typeof str === 'string' ? str.replace(ansiRegex, '') : str;
|
|
@@ -70909,6 +70884,191 @@ module.exports = require("util");
|
|
|
70909
70884
|
|
|
70910
70885
|
/***/ }),
|
|
70911
70886
|
|
|
70887
|
+
/***/ 492:
|
|
70888
|
+
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
|
70889
|
+
|
|
70890
|
+
"use strict";
|
|
70891
|
+
|
|
70892
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
70893
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
70894
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
70895
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
70896
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
70897
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
70898
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
70899
|
+
});
|
|
70900
|
+
};
|
|
70901
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
70902
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
70903
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
70904
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
70905
|
+
function step(op) {
|
|
70906
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
70907
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
70908
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
70909
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
70910
|
+
switch (op[0]) {
|
|
70911
|
+
case 0: case 1: t = op; break;
|
|
70912
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
70913
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
70914
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
70915
|
+
default:
|
|
70916
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
70917
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
70918
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
70919
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
70920
|
+
if (t[2]) _.ops.pop();
|
|
70921
|
+
_.trys.pop(); continue;
|
|
70922
|
+
}
|
|
70923
|
+
op = body.call(thisArg, _);
|
|
70924
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
70925
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
70926
|
+
}
|
|
70927
|
+
};
|
|
70928
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
70929
|
+
exports.AsyncOption = void 0;
|
|
70930
|
+
var asyncresult_js_1 = __nccwpck_require__(6861);
|
|
70931
|
+
var option_js_1 = __nccwpck_require__(6456);
|
|
70932
|
+
/**
|
|
70933
|
+
* An async-aware `Option` counterpart.
|
|
70934
|
+
*
|
|
70935
|
+
* Can be combined with asynchronous code without having to ``await`` anything right until
|
|
70936
|
+
* the moment when you're ready to extract the final ``Option`` out of it.
|
|
70937
|
+
*
|
|
70938
|
+
* Can also be combined with synchronous code for convenience.
|
|
70939
|
+
*/
|
|
70940
|
+
var AsyncOption = /** @class */ (function () {
|
|
70941
|
+
/**
|
|
70942
|
+
* Constructs an `AsyncOption` from an `Option` or a `Promise` of an `Option`.
|
|
70943
|
+
*
|
|
70944
|
+
* @example
|
|
70945
|
+
* ```typescript
|
|
70946
|
+
* const option = new AsyncOption(Promise.resolve(Some('username')))
|
|
70947
|
+
* ```
|
|
70948
|
+
*/
|
|
70949
|
+
function AsyncOption(start) {
|
|
70950
|
+
this.promise = Promise.resolve(start);
|
|
70951
|
+
}
|
|
70952
|
+
/**
|
|
70953
|
+
* Calls `mapper` if the option is `Some`, otherwise keeps the `None` value intact.
|
|
70954
|
+
* This function can be used for control flow based on `Option` values.
|
|
70955
|
+
*
|
|
70956
|
+
* @example
|
|
70957
|
+
* ```typescript
|
|
70958
|
+
* let hasValue = Some(1).toAsyncOption()
|
|
70959
|
+
* let noValue = None.toAsyncOption()
|
|
70960
|
+
*
|
|
70961
|
+
* await hasValue.andThen(async (value) => Some(value * 2)).promise // Some(2)
|
|
70962
|
+
* await hasValue.andThen(async (value) => None).promise // None
|
|
70963
|
+
* await noValue.andThen(async (value) => Ok(value * 2)).promise // None
|
|
70964
|
+
* ```
|
|
70965
|
+
*/
|
|
70966
|
+
AsyncOption.prototype.andThen = function (mapper) {
|
|
70967
|
+
var _this = this;
|
|
70968
|
+
return this.thenInternal(function (option) { return __awaiter(_this, void 0, void 0, function () {
|
|
70969
|
+
var mapped;
|
|
70970
|
+
return __generator(this, function (_a) {
|
|
70971
|
+
if (option.isNone()) {
|
|
70972
|
+
return [2 /*return*/, option];
|
|
70973
|
+
}
|
|
70974
|
+
mapped = mapper(option.value);
|
|
70975
|
+
return [2 /*return*/, mapped instanceof AsyncOption ? mapped.promise : mapped];
|
|
70976
|
+
});
|
|
70977
|
+
}); });
|
|
70978
|
+
};
|
|
70979
|
+
/**
|
|
70980
|
+
* Maps an `AsyncOption<T>` to `AsyncOption<U>` by applying a function to a contained
|
|
70981
|
+
* `Some` value, leaving a `None` value untouched.
|
|
70982
|
+
*
|
|
70983
|
+
* This function can be used to compose the results of two functions.
|
|
70984
|
+
*
|
|
70985
|
+
* @example
|
|
70986
|
+
* ```typescript
|
|
70987
|
+
* let hasValue = Ok(1).toAsyncOption()
|
|
70988
|
+
* let noValue = None.toAsyncOption()
|
|
70989
|
+
*
|
|
70990
|
+
* await hasValue.map(async (value) => value * 2).promise // Some(2)
|
|
70991
|
+
* await noValue.map(async (value) => value * 2).promise // None
|
|
70992
|
+
* ```
|
|
70993
|
+
*/
|
|
70994
|
+
AsyncOption.prototype.map = function (mapper) {
|
|
70995
|
+
var _this = this;
|
|
70996
|
+
return this.thenInternal(function (option) { return __awaiter(_this, void 0, void 0, function () {
|
|
70997
|
+
var _a;
|
|
70998
|
+
return __generator(this, function (_b) {
|
|
70999
|
+
switch (_b.label) {
|
|
71000
|
+
case 0:
|
|
71001
|
+
if (option.isNone()) {
|
|
71002
|
+
return [2 /*return*/, option];
|
|
71003
|
+
}
|
|
71004
|
+
_a = option_js_1.Some;
|
|
71005
|
+
return [4 /*yield*/, mapper(option.value)];
|
|
71006
|
+
case 1: return [2 /*return*/, _a.apply(void 0, [_b.sent()])];
|
|
71007
|
+
}
|
|
71008
|
+
});
|
|
71009
|
+
}); });
|
|
71010
|
+
};
|
|
71011
|
+
/**
|
|
71012
|
+
* Returns the value from `other` if this `AsyncOption` contains `None`, otherwise returns self.
|
|
71013
|
+
*
|
|
71014
|
+
* If `other` is a result of a function call consider using `orElse` instead, it will
|
|
71015
|
+
* only evaluate the function when needed.
|
|
71016
|
+
*
|
|
71017
|
+
* @example
|
|
71018
|
+
* ```
|
|
71019
|
+
* const noValue = new AsyncOption(None)
|
|
71020
|
+
* const hasValue = new AsyncOption(Some(1))
|
|
71021
|
+
*
|
|
71022
|
+
* await noValue.or(Some(123)).promise // Some(123)
|
|
71023
|
+
* await hasValue.or(Some(123)).promise // Some(1)
|
|
71024
|
+
* ```
|
|
71025
|
+
*/
|
|
71026
|
+
AsyncOption.prototype.or = function (other) {
|
|
71027
|
+
return this.orElse(function () { return other; });
|
|
71028
|
+
};
|
|
71029
|
+
/**
|
|
71030
|
+
* Returns the value obtained by calling `other` if this `AsyncOption` contains `None`, otherwise
|
|
71031
|
+
* returns self.
|
|
71032
|
+
*
|
|
71033
|
+
* @example
|
|
71034
|
+
* ```
|
|
71035
|
+
* const noValue = new AsyncOption(None)
|
|
71036
|
+
* const hasValue = new AsyncOption(Some(1))
|
|
71037
|
+
*
|
|
71038
|
+
* await noValue.orElse(() => Some(123)).promise // Some(123)
|
|
71039
|
+
* await hasValue.orElse(() => Some(123)).promise // Some(1)
|
|
71040
|
+
* ```
|
|
71041
|
+
*/
|
|
71042
|
+
AsyncOption.prototype.orElse = function (other) {
|
|
71043
|
+
var _this = this;
|
|
71044
|
+
return this.thenInternal(function (option) { return __awaiter(_this, void 0, void 0, function () {
|
|
71045
|
+
var otherValue;
|
|
71046
|
+
return __generator(this, function (_a) {
|
|
71047
|
+
if (option.isSome()) {
|
|
71048
|
+
return [2 /*return*/, option];
|
|
71049
|
+
}
|
|
71050
|
+
otherValue = other();
|
|
71051
|
+
return [2 /*return*/, otherValue instanceof AsyncOption ? otherValue.promise : otherValue];
|
|
71052
|
+
});
|
|
71053
|
+
}); });
|
|
71054
|
+
};
|
|
71055
|
+
/**
|
|
71056
|
+
* Converts an `AsyncOption<T>` to an `AsyncResult<T, E>` so that `None` is converted to
|
|
71057
|
+
* `Err(error)` and `Some` is converted to `Ok`.
|
|
71058
|
+
*/
|
|
71059
|
+
AsyncOption.prototype.toResult = function (error) {
|
|
71060
|
+
return new asyncresult_js_1.AsyncResult(this.promise.then(function (option) { return option.toResult(error); }));
|
|
71061
|
+
};
|
|
71062
|
+
AsyncOption.prototype.thenInternal = function (mapper) {
|
|
71063
|
+
return new AsyncOption(this.promise.then(mapper));
|
|
71064
|
+
};
|
|
71065
|
+
return AsyncOption;
|
|
71066
|
+
}());
|
|
71067
|
+
exports.AsyncOption = AsyncOption;
|
|
71068
|
+
//# sourceMappingURL=asyncoption.js.map
|
|
71069
|
+
|
|
71070
|
+
/***/ }),
|
|
71071
|
+
|
|
70912
71072
|
/***/ 6861:
|
|
70913
71073
|
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
|
70914
71074
|
|
|
@@ -70952,6 +71112,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
70952
71112
|
};
|
|
70953
71113
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
70954
71114
|
exports.AsyncResult = void 0;
|
|
71115
|
+
var asyncoption_js_1 = __nccwpck_require__(492);
|
|
70955
71116
|
var result_js_1 = __nccwpck_require__(9293);
|
|
70956
71117
|
/**
|
|
70957
71118
|
* An async-aware `Result` counterpart.
|
|
@@ -71035,42 +71196,87 @@ var AsyncResult = /** @class */ (function () {
|
|
|
71035
71196
|
});
|
|
71036
71197
|
}); });
|
|
71037
71198
|
};
|
|
71038
|
-
|
|
71039
|
-
|
|
71040
|
-
|
|
71041
|
-
|
|
71042
|
-
|
|
71043
|
-
|
|
71044
|
-
|
|
71045
|
-
|
|
71046
|
-
|
|
71047
|
-
|
|
71048
|
-
|
|
71049
|
-
|
|
71050
|
-
|
|
71051
|
-
|
|
71052
|
-
|
|
71053
|
-
|
|
71054
|
-
|
|
71055
|
-
|
|
71056
|
-
|
|
71057
|
-
|
|
71058
|
-
|
|
71059
|
-
|
|
71060
|
-
|
|
71061
|
-
|
|
71062
|
-
|
|
71063
|
-
|
|
71064
|
-
|
|
71065
|
-
|
|
71066
|
-
|
|
71067
|
-
|
|
71068
|
-
|
|
71069
|
-
|
|
71070
|
-
|
|
71071
|
-
|
|
71072
|
-
|
|
71073
|
-
|
|
71199
|
+
/**
|
|
71200
|
+
* Maps an `AsyncResult<T, E>` to `AsyncResult<T, F>` by applying `mapper` to the `Err` value,
|
|
71201
|
+
* leaving `Ok` value untouched.
|
|
71202
|
+
*
|
|
71203
|
+
* @example
|
|
71204
|
+
* ```typescript
|
|
71205
|
+
* let goodResult = Ok(1).toAsyncResult()
|
|
71206
|
+
* let badResult = Err('boo').toAsyncResult()
|
|
71207
|
+
*
|
|
71208
|
+
* await goodResult.mapErr(async (error) => `Error is ${error}`).promise // Ok(1)
|
|
71209
|
+
* await badResult.mapErr(async (error) => `Error is ${error}`).promise // Err('Error is boo')
|
|
71210
|
+
* ```
|
|
71211
|
+
*/
|
|
71212
|
+
AsyncResult.prototype.mapErr = function (mapper) {
|
|
71213
|
+
var _this = this;
|
|
71214
|
+
return this.thenInternal(function (result) { return __awaiter(_this, void 0, void 0, function () {
|
|
71215
|
+
var _a;
|
|
71216
|
+
return __generator(this, function (_b) {
|
|
71217
|
+
switch (_b.label) {
|
|
71218
|
+
case 0:
|
|
71219
|
+
if (result.isOk()) {
|
|
71220
|
+
return [2 /*return*/, result];
|
|
71221
|
+
}
|
|
71222
|
+
_a = result_js_1.Err;
|
|
71223
|
+
return [4 /*yield*/, mapper(result.error)];
|
|
71224
|
+
case 1: return [2 /*return*/, _a.apply(void 0, [_b.sent()])];
|
|
71225
|
+
}
|
|
71226
|
+
});
|
|
71227
|
+
}); });
|
|
71228
|
+
};
|
|
71229
|
+
/**
|
|
71230
|
+
* Returns the value from `other` if this `AsyncResult` contains `Err`, otherwise returns self.
|
|
71231
|
+
*
|
|
71232
|
+
* If `other` is a result of a function call consider using `orElse` instead, it will
|
|
71233
|
+
* only evaluate the function when needed.
|
|
71234
|
+
*
|
|
71235
|
+
* @example
|
|
71236
|
+
* ```
|
|
71237
|
+
* const badResult = new AsyncResult(Err('Error message'))
|
|
71238
|
+
* const goodResult = new AsyncResult(Ok(1))
|
|
71239
|
+
*
|
|
71240
|
+
* await badResult.or(Ok(123)).promise // Ok(123)
|
|
71241
|
+
* await goodResult.or(Ok(123)).promise // Ok(1)
|
|
71242
|
+
* ```
|
|
71243
|
+
*/
|
|
71244
|
+
AsyncResult.prototype.or = function (other) {
|
|
71245
|
+
return this.orElse(function () { return other; });
|
|
71246
|
+
};
|
|
71247
|
+
/**
|
|
71248
|
+
* Returns the value obtained by calling `other` if this `AsyncResult` contains `Err`, otherwise
|
|
71249
|
+
* returns self.
|
|
71250
|
+
*
|
|
71251
|
+
* @example
|
|
71252
|
+
* ```
|
|
71253
|
+
* const badResult = new AsyncResult(Err('Error message'))
|
|
71254
|
+
* const goodResult = new AsyncResult(Ok(1))
|
|
71255
|
+
*
|
|
71256
|
+
* await badResult.orElse(() => Ok(123)).promise // Ok(123)
|
|
71257
|
+
* await goodResult.orElse(() => Ok(123)).promise // Ok(1)
|
|
71258
|
+
* ```
|
|
71259
|
+
*/
|
|
71260
|
+
AsyncResult.prototype.orElse = function (other) {
|
|
71261
|
+
var _this = this;
|
|
71262
|
+
return this.thenInternal(function (result) { return __awaiter(_this, void 0, void 0, function () {
|
|
71263
|
+
var otherValue;
|
|
71264
|
+
return __generator(this, function (_a) {
|
|
71265
|
+
if (result.isOk()) {
|
|
71266
|
+
return [2 /*return*/, result];
|
|
71267
|
+
}
|
|
71268
|
+
otherValue = other(result.error);
|
|
71269
|
+
return [2 /*return*/, otherValue instanceof AsyncResult ? otherValue.promise : otherValue];
|
|
71270
|
+
});
|
|
71271
|
+
}); });
|
|
71272
|
+
};
|
|
71273
|
+
/**
|
|
71274
|
+
* Converts from `AsyncResult<T, E>` to `AsyncOption<T>` so that `Err` is converted to `None`
|
|
71275
|
+
* and `Ok` is converted to `Some`.
|
|
71276
|
+
*/
|
|
71277
|
+
AsyncResult.prototype.toOption = function () {
|
|
71278
|
+
return new asyncoption_js_1.AsyncOption(this.promise.then(function (result) { return result.toOption(); }));
|
|
71279
|
+
};
|
|
71074
71280
|
AsyncResult.prototype.thenInternal = function (mapper) {
|
|
71075
71281
|
return new AsyncResult(this.promise.then(mapper));
|
|
71076
71282
|
};
|
|
@@ -71101,6 +71307,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
71101
71307
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
71102
71308
|
};
|
|
71103
71309
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
71310
|
+
__exportStar(__nccwpck_require__(492), exports);
|
|
71104
71311
|
__exportStar(__nccwpck_require__(6861), exports);
|
|
71105
71312
|
__exportStar(__nccwpck_require__(9293), exports);
|
|
71106
71313
|
__exportStar(__nccwpck_require__(6456), exports);
|
|
@@ -71115,6 +71322,7 @@ __exportStar(__nccwpck_require__(6456), exports);
|
|
|
71115
71322
|
|
|
71116
71323
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
71117
71324
|
exports.Option = exports.Some = exports.None = void 0;
|
|
71325
|
+
var asyncoption_js_1 = __nccwpck_require__(492);
|
|
71118
71326
|
var utils_js_1 = __nccwpck_require__(1414);
|
|
71119
71327
|
var result_js_1 = __nccwpck_require__(9293);
|
|
71120
71328
|
/**
|
|
@@ -71169,6 +71377,9 @@ var NoneImpl = /** @class */ (function () {
|
|
|
71169
71377
|
NoneImpl.prototype.toString = function () {
|
|
71170
71378
|
return 'None';
|
|
71171
71379
|
};
|
|
71380
|
+
NoneImpl.prototype.toAsyncOption = function () {
|
|
71381
|
+
return new asyncoption_js_1.AsyncOption(exports.None);
|
|
71382
|
+
};
|
|
71172
71383
|
return NoneImpl;
|
|
71173
71384
|
}());
|
|
71174
71385
|
// Export None as a singleton, then freeze it so it can't be modified
|
|
@@ -71233,6 +71444,9 @@ var SomeImpl = /** @class */ (function () {
|
|
|
71233
71444
|
SomeImpl.prototype.toResult = function (error) {
|
|
71234
71445
|
return (0, result_js_1.Ok)(this.value);
|
|
71235
71446
|
};
|
|
71447
|
+
SomeImpl.prototype.toAsyncOption = function () {
|
|
71448
|
+
return new asyncoption_js_1.AsyncOption(this);
|
|
71449
|
+
};
|
|
71236
71450
|
/**
|
|
71237
71451
|
* Returns the contained `Some` value, but never throws.
|
|
71238
71452
|
* Unlike `unwrap()`, this method doesn't throw and is only callable on an Some<T>
|
|
@@ -71293,7 +71507,7 @@ var Option;
|
|
|
71293
71507
|
return option;
|
|
71294
71508
|
}
|
|
71295
71509
|
else {
|
|
71296
|
-
|
|
71510
|
+
continue;
|
|
71297
71511
|
}
|
|
71298
71512
|
}
|
|
71299
71513
|
// it must be None
|
|
@@ -71310,10 +71524,19 @@ var Option;
|
|
|
71310
71524
|
/***/ }),
|
|
71311
71525
|
|
|
71312
71526
|
/***/ 9293:
|
|
71313
|
-
/***/ ((__unused_webpack_module, exports, __nccwpck_require__)
|
|
71527
|
+
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
|
71314
71528
|
|
|
71315
71529
|
"use strict";
|
|
71316
71530
|
|
|
71531
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
71532
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
71533
|
+
if (ar || !(i in from)) {
|
|
71534
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
71535
|
+
ar[i] = from[i];
|
|
71536
|
+
}
|
|
71537
|
+
}
|
|
71538
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
71539
|
+
};
|
|
71317
71540
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
71318
71541
|
exports.Result = exports.Ok = exports.OkImpl = exports.Err = exports.ErrImpl = void 0;
|
|
71319
71542
|
var utils_js_1 = __nccwpck_require__(1414);
|
|
@@ -71523,15 +71746,12 @@ exports.OkImpl = OkImpl;
|
|
|
71523
71746
|
exports.Ok = OkImpl;
|
|
71524
71747
|
var Result;
|
|
71525
71748
|
(function (Result) {
|
|
71526
|
-
|
|
71527
|
-
|
|
71528
|
-
|
|
71529
|
-
|
|
71530
|
-
function all() {
|
|
71531
|
-
var results = [];
|
|
71532
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
71533
|
-
results[_i] = arguments[_i];
|
|
71749
|
+
function all(arg0) {
|
|
71750
|
+
var argN = [];
|
|
71751
|
+
for (var _i = 1; _i < arguments.length; _i++) {
|
|
71752
|
+
argN[_i - 1] = arguments[_i];
|
|
71534
71753
|
}
|
|
71754
|
+
var results = arg0 === undefined ? [] : Array.isArray(arg0) ? arg0 : __spreadArray([arg0], argN, true);
|
|
71535
71755
|
var okResult = [];
|
|
71536
71756
|
for (var _a = 0, results_1 = results; _a < results_1.length; _a++) {
|
|
71537
71757
|
var result = results_1[_a];
|
|
@@ -71545,15 +71765,12 @@ var Result;
|
|
|
71545
71765
|
return new exports.Ok(okResult);
|
|
71546
71766
|
}
|
|
71547
71767
|
Result.all = all;
|
|
71548
|
-
|
|
71549
|
-
|
|
71550
|
-
|
|
71551
|
-
|
|
71552
|
-
function any() {
|
|
71553
|
-
var results = [];
|
|
71554
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
71555
|
-
results[_i] = arguments[_i];
|
|
71768
|
+
function any(arg0) {
|
|
71769
|
+
var argN = [];
|
|
71770
|
+
for (var _i = 1; _i < arguments.length; _i++) {
|
|
71771
|
+
argN[_i - 1] = arguments[_i];
|
|
71556
71772
|
}
|
|
71773
|
+
var results = arg0 === undefined ? [] : Array.isArray(arg0) ? arg0 : __spreadArray([arg0], argN, true);
|
|
71557
71774
|
var errResult = [];
|
|
71558
71775
|
// short-circuits
|
|
71559
71776
|
for (var _a = 0, results_2 = results; _a < results_2.length; _a++) {
|
|
@@ -71597,6 +71814,18 @@ var Result;
|
|
|
71597
71814
|
}
|
|
71598
71815
|
}
|
|
71599
71816
|
Result.wrapAsync = wrapAsync;
|
|
71817
|
+
/**
|
|
71818
|
+
* Partitions a set of results, separating the `Ok` and `Err` values.
|
|
71819
|
+
*/
|
|
71820
|
+
function partition(results) {
|
|
71821
|
+
return results.reduce(function (_a, v) {
|
|
71822
|
+
var oks = _a[0], errors = _a[1];
|
|
71823
|
+
return v.isOk()
|
|
71824
|
+
? [__spreadArray(__spreadArray([], oks, true), [v.value], false), errors]
|
|
71825
|
+
: [oks, __spreadArray(__spreadArray([], errors, true), [v.error], false)];
|
|
71826
|
+
}, [[], []]);
|
|
71827
|
+
}
|
|
71828
|
+
Result.partition = partition;
|
|
71600
71829
|
function isResult(val) {
|
|
71601
71830
|
return val instanceof exports.Err || val instanceof exports.Ok;
|
|
71602
71831
|
}
|