ag-common 0.0.576 → 0.0.577

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.
@@ -31,8 +31,6 @@ function cleanSrc() {
31
31
  c = c.replace(/cognitopreferred_role/, "'cognito:preferred_role'");
32
32
  c = c.replace(/cognitousername/, "'cognito:username'");
33
33
  c = c.replace(/cognitogroups/, "'cognito:groups'");
34
- c = `import {URL, URLSearchParams} from 'url'
35
- ${c}`;
36
34
  fs.writeFileSync(f, c);
37
35
  });
38
36
  //disable all errors
@@ -19,8 +19,8 @@ const stream_1 = require("../../../common/helpers/stream");
19
19
  * @returns
20
20
  */
21
21
  const apiResponseToAxiosResponse = (p) => __awaiter(void 0, void 0, void 0, function* () {
22
- return p()
23
- .then((r) => __awaiter(void 0, void 0, void 0, function* () {
22
+ try {
23
+ var r = yield p();
24
24
  const r1 = {
25
25
  status: r.raw.status,
26
26
  statusText: r.raw.statusText,
@@ -30,8 +30,8 @@ const apiResponseToAxiosResponse = (p) => __awaiter(void 0, void 0, void 0, func
30
30
  config: {},
31
31
  };
32
32
  return r1;
33
- }))
34
- .catch((e) => __awaiter(void 0, void 0, void 0, function* () {
33
+ }
34
+ catch (e) {
35
35
  const er = e;
36
36
  //try and get body
37
37
  let statusText = er.statusText;
@@ -53,6 +53,6 @@ const apiResponseToAxiosResponse = (p) => __awaiter(void 0, void 0, void 0, func
53
53
  config: {},
54
54
  };
55
55
  return ret;
56
- }));
56
+ }
57
57
  });
58
58
  exports.apiResponseToAxiosResponse = apiResponseToAxiosResponse;
@@ -4,6 +4,8 @@ export default useIsomorphicLayoutEffect;
4
4
  export declare function useInterval<T>(callback: () => T,
5
5
  /** ms delay */
6
6
  delay: number | null, opt?: {
7
+ /** if false, wont call callback. default true */
8
+ enabled?: boolean;
7
9
  /** called when cleaning up useEffect */
8
10
  onEnd?: () => void;
9
11
  /** will be passed result of callback, and can cancel interval if passed */
@@ -18,6 +18,9 @@ delay, opt) {
18
18
  }
19
19
  const id = setInterval(() => {
20
20
  var _a, _b;
21
+ if ((opt === null || opt === void 0 ? void 0 : opt.enabled) === false) {
22
+ return;
23
+ }
21
24
  const res = savedCallback.current();
22
25
  if ((_a = opt === null || opt === void 0 ? void 0 : opt.determineEnd) === null || _a === void 0 ? void 0 : _a.call(opt, res)) {
23
26
  clearInterval(id);
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.0.576",
2
+ "version": "0.0.577",
3
3
  "name": "ag-common",
4
4
  "main": "./dist/index.js",
5
5
  "types": "./dist/index.d.ts",