@oneuptime/cli 14.0.74 → 14.0.75

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.
Files changed (2) hide show
  1. package/build/dist/Index.js +82 -12
  2. package/package.json +1 -1
@@ -15844,7 +15844,7 @@ var require_main = __commonJS({
15844
15844
  var packageJson = require_package();
15845
15845
  var version = packageJson.version;
15846
15846
  var LINE = /(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg;
15847
- function parse(src) {
15847
+ function parse2(src) {
15848
15848
  const obj = {};
15849
15849
  let lines = src.toString();
15850
15850
  lines = lines.replace(/\r\n?/mg, "\n");
@@ -15863,7 +15863,7 @@ var require_main = __commonJS({
15863
15863
  }
15864
15864
  return obj;
15865
15865
  }
15866
- __name(parse, "parse");
15866
+ __name(parse2, "parse");
15867
15867
  function _parseVault(options) {
15868
15868
  options = options || {};
15869
15869
  const vaultPath = _vaultPath(options);
@@ -16124,7 +16124,7 @@ var require_main = __commonJS({
16124
16124
  _parseVault,
16125
16125
  config,
16126
16126
  decrypt,
16127
- parse,
16127
+ parse: parse2,
16128
16128
  populate
16129
16129
  };
16130
16130
  module2.exports.configDotenv = DotenvModule.configDotenv;
@@ -26318,15 +26318,15 @@ var require_parse = __commonJS({
26318
26318
  "use strict";
26319
26319
  Object.defineProperty(exports2, "__esModule", { value: true });
26320
26320
  var validate_js_1 = require_validate();
26321
- function parse(uuid) {
26321
+ function parse2(uuid) {
26322
26322
  if (!(0, validate_js_1.default)(uuid)) {
26323
26323
  throw TypeError("Invalid UUID");
26324
26324
  }
26325
26325
  let v;
26326
26326
  return Uint8Array.of((v = parseInt(uuid.slice(0, 8), 16)) >>> 24, v >>> 16 & 255, v >>> 8 & 255, v & 255, (v = parseInt(uuid.slice(9, 13), 16)) >>> 8, v & 255, (v = parseInt(uuid.slice(14, 18), 16)) >>> 8, v & 255, (v = parseInt(uuid.slice(19, 23), 16)) >>> 8, v & 255, (v = parseInt(uuid.slice(24, 36), 16)) / 1099511627776 & 255, v / 4294967296 & 255, v >>> 24 & 255, v >>> 16 & 255, v >>> 8 & 255, v & 255);
26327
26327
  }
26328
- __name(parse, "parse");
26329
- exports2.default = parse;
26328
+ __name(parse2, "parse");
26329
+ exports2.default = parse2;
26330
26330
  }
26331
26331
  });
26332
26332
 
@@ -76908,7 +76908,7 @@ var require_ms = __commonJS({
76908
76908
  options = options || {};
76909
76909
  var type = typeof val;
76910
76910
  if (type === "string" && val.length > 0) {
76911
- return parse(val);
76911
+ return parse2(val);
76912
76912
  } else if (type === "number" && isFinite(val)) {
76913
76913
  return options.long ? fmtLong(val) : fmtShort(val);
76914
76914
  }
@@ -76916,7 +76916,7 @@ var require_ms = __commonJS({
76916
76916
  "val is not a non-empty string or a valid number. val=" + JSON.stringify(val)
76917
76917
  );
76918
76918
  };
76919
- function parse(str) {
76919
+ function parse2(str) {
76920
76920
  str = String(str);
76921
76921
  if (str.length > 100) {
76922
76922
  return;
@@ -76972,7 +76972,7 @@ var require_ms = __commonJS({
76972
76972
  return void 0;
76973
76973
  }
76974
76974
  }
76975
- __name(parse, "parse");
76975
+ __name(parse2, "parse");
76976
76976
  function fmtShort(ms) {
76977
76977
  var msAbs = Math.abs(ms);
76978
76978
  if (msAbs >= d) {
@@ -88421,7 +88421,7 @@ var require_parse2 = __commonJS({
88421
88421
  var token;
88422
88422
  var key;
88423
88423
  var root;
88424
- module2.exports = /* @__PURE__ */ __name(function parse(text, reviver) {
88424
+ module2.exports = /* @__PURE__ */ __name(function parse2(text, reviver) {
88425
88425
  source = String(text);
88426
88426
  parseState = "start";
88427
88427
  stack = [];
@@ -89501,10 +89501,10 @@ var require_stringify2 = __commonJS({
89501
89501
  var require_lib2 = __commonJS({
89502
89502
  "../Common/node_modules/json5/lib/index.js"(exports2, module2) {
89503
89503
  "use strict";
89504
- var parse = require_parse2();
89504
+ var parse2 = require_parse2();
89505
89505
  var stringify = require_stringify2();
89506
89506
  var JSON53 = {
89507
- parse,
89507
+ parse: parse2,
89508
89508
  stringify
89509
89509
  };
89510
89510
  module2.exports = JSON53;
@@ -471841,6 +471841,71 @@ var HTTPResponseBodyReader = class {
471841
471841
  }
471842
471842
  };
471843
471843
 
471844
+ // ../Common/Utils/SameServerRedirect.ts
471845
+ function parse(address) {
471846
+ try {
471847
+ return new globalThis.URL(address);
471848
+ } catch {
471849
+ return null;
471850
+ }
471851
+ }
471852
+ __name(parse, "parse");
471853
+ function isServerAddress(address) {
471854
+ return (address.protocol === "http:" || address.protocol === "https:") && address.hostname !== "";
471855
+ }
471856
+ __name(isServerAddress, "isServerAddress");
471857
+ function namesAUser(address) {
471858
+ return address.username !== "" || address.password !== "";
471859
+ }
471860
+ __name(namesAUser, "namesAUser");
471861
+ var isRedirectOnSameServer = /* @__PURE__ */ __name((requestUrl, redirectUrl) => {
471862
+ const from = parse(requestUrl);
471863
+ const to = parse(redirectUrl);
471864
+ if (!from || !to || !isServerAddress(from) || !isServerAddress(to) || namesAUser(to)) {
471865
+ return false;
471866
+ }
471867
+ if (to.hostname !== from.hostname) {
471868
+ return false;
471869
+ }
471870
+ if (to.protocol === from.protocol) {
471871
+ return to.port === from.port;
471872
+ }
471873
+ return from.protocol === "http:" && to.protocol === "https:" && from.port === "" && to.port === "";
471874
+ }, "isRedirectOnSameServer");
471875
+ function originOf(address) {
471876
+ const parsed = parse(address);
471877
+ if (!parsed || parsed.origin === "null") {
471878
+ return null;
471879
+ }
471880
+ return parsed.origin;
471881
+ }
471882
+ __name(originOf, "originOf");
471883
+ var RedirectOffServerError = class extends Error {
471884
+ static {
471885
+ __name(this, "RedirectOffServerError");
471886
+ }
471887
+ constructor(data) {
471888
+ const from = originOf(data.requestUrl) || "its server";
471889
+ const to = originOf(data.redirectUrl);
471890
+ super(
471891
+ to ? `The request to ${from} was redirected to ${to}, another server, so it was not sent on: a request that carries a key follows redirects only on the server it was sent to. If the server is at ${to}, set its address to that.` : `The request to ${from} was redirected to an address that could not be read, so it was not sent on: a request that carries a key follows redirects only on the server it was sent to.`
471892
+ );
471893
+ this.name = "RedirectOffServerError";
471894
+ }
471895
+ };
471896
+ var getSameServerRedirectCheck = /* @__PURE__ */ __name((requestUrl) => {
471897
+ return (redirectOptions) => {
471898
+ const href = redirectOptions["href"];
471899
+ const redirectUrl = typeof href === "string" ? href : "";
471900
+ if (!isRedirectOnSameServer(requestUrl, redirectUrl)) {
471901
+ throw new RedirectOffServerError({
471902
+ requestUrl,
471903
+ redirectUrl
471904
+ });
471905
+ }
471906
+ };
471907
+ }, "getSameServerRedirectCheck");
471908
+
471844
471909
  // ../Common/Utils/ProbeNetworkFailureUtil.ts
471845
471910
  var PROBE_SIDE_CAUSE_PREFIX = "This probe ";
471846
471911
  var OUTPUT_MARKERS = [
@@ -472481,6 +472546,11 @@ var API = class _API {
472481
472546
  if (options?.doNotFollowRedirects) {
472482
472547
  axiosOptions.maxRedirects = 0;
472483
472548
  }
472549
+ if (options?.sameServerRedirectsOnly) {
472550
+ axiosOptions.beforeRedirect = getSameServerRedirectCheck(
472551
+ options?.dispatchUrl ?? url2.toString()
472552
+ );
472553
+ }
472484
472554
  if (options?.maxContentLength !== void 0) {
472485
472555
  axiosOptions.maxContentLength = options.maxContentLength;
472486
472556
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oneuptime/cli",
3
- "version": "14.0.74",
3
+ "version": "14.0.75",
4
4
  "description": "OneUptime CLI - Command-line interface for managing OneUptime resources",
5
5
  "repository": {
6
6
  "type": "git",