@flakiness/sdk 0.146.0 → 0.147.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.
@@ -1,10 +1,8 @@
1
- // src/serverapi.ts
2
- import { TypedHTTP } from "@flakiness/shared/common/typedHttp.js";
3
-
4
- // src/utils.ts
5
- import { ReportUtils } from "@flakiness/report";
1
+ // src/httpUtils.ts
6
2
  import http from "http";
7
3
  import https from "https";
4
+
5
+ // src/utils.ts
8
6
  var FLAKINESS_DBG = !!process.env.FLAKINESS_DBG;
9
7
  function errorText(error) {
10
8
  return FLAKINESS_DBG ? error.stack : error.message;
@@ -25,6 +23,13 @@ async function retryWithBackoff(job, backoff = []) {
25
23
  }
26
24
  return await job();
27
25
  }
26
+ var ansiRegex = new RegExp("[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:[a-zA-Z\\d]*(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)|(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))", "g");
27
+
28
+ // src/httpUtils.ts
29
+ var FLAKINESS_DBG2 = !!process.env.FLAKINESS_DBG;
30
+ function errorText2(error) {
31
+ return FLAKINESS_DBG2 ? error.stack : error.message;
32
+ }
28
33
  var httpUtils;
29
34
  ((httpUtils2) => {
30
35
  function createRequest({ url, method = "get", headers = {} }) {
@@ -87,25 +92,8 @@ var httpUtils;
87
92
  }
88
93
  httpUtils2.postJSON = postJSON;
89
94
  })(httpUtils || (httpUtils = {}));
90
- var ansiRegex = new RegExp("[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:[a-zA-Z\\d]*(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)|(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))", "g");
91
- var IS_WIN32_PATH = new RegExp("^[a-zA-Z]:\\\\", "i");
92
- var IS_ALMOST_POSIX_PATH = new RegExp("^[a-zA-Z]:/", "i");
93
-
94
- // src/serverapi.ts
95
- function createServerAPI(endpoint, options) {
96
- endpoint += "/api/";
97
- const fetcher = options?.auth ? (url, init) => fetch(url, {
98
- ...init,
99
- headers: {
100
- ...init.headers,
101
- "Authorization": `Bearer ${options.auth}`
102
- }
103
- }) : fetch;
104
- if (options?.retries)
105
- return TypedHTTP.createClient(endpoint, (url, init) => retryWithBackoff(() => fetcher(url, init), options.retries));
106
- return TypedHTTP.createClient(endpoint, fetcher);
107
- }
108
95
  export {
109
- createServerAPI
96
+ errorText2 as errorText,
97
+ httpUtils
110
98
  };
111
- //# sourceMappingURL=serverapi.js.map
99
+ //# sourceMappingURL=httpUtils.js.map