@runnerpro/backend 1.0.8 → 1.0.10
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/lib/cjs/err/index.js +1 -1
- package/lib/cjs/fetch/fetchIA.js +71 -0
- package/lib/cjs/index.js +3 -1
- package/lib/cjs/types/err/index.d.ts +1 -1
- package/lib/cjs/types/err/index.d.ts.map +1 -1
- package/lib/cjs/types/fetch/fetchIA.d.ts +8 -0
- package/lib/cjs/types/fetch/fetchIA.d.ts.map +1 -0
- package/lib/cjs/types/index.d.ts +2 -1
- package/lib/cjs/types/index.d.ts.map +1 -1
- package/package.json +1 -1
package/lib/cjs/err/index.js
CHANGED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.fetchIA = void 0;
|
|
13
|
+
const axios = require('axios');
|
|
14
|
+
const { err } = require('@runnerpro/backend');
|
|
15
|
+
const fetchIA = {
|
|
16
|
+
get: (url, params, options) => __awaiter(void 0, void 0, void 0, function* () {
|
|
17
|
+
return axios
|
|
18
|
+
.get(`${process.env.BACKEND_IA_URL}${!!(options === null || options === void 0 ? void 0 : options.exposed) ? '/exposed' : '/api'}${url}`, Object.assign({ params, headers: {
|
|
19
|
+
'ngrok-skip-browser-warning': true,
|
|
20
|
+
'Content-Type': 'application/json',
|
|
21
|
+
Authorization: `Bearer ${process.env.IA_ACCESS_TOKEN}`,
|
|
22
|
+
} }, options === null || options === void 0 ? void 0 : options.extra))
|
|
23
|
+
.then(({ data }) => data)
|
|
24
|
+
.catch((error) => catchAxios(error, !!(options === null || options === void 0 ? void 0 : options.bypassStatus), url));
|
|
25
|
+
}),
|
|
26
|
+
post: (url, body, options) => __awaiter(void 0, void 0, void 0, function* () {
|
|
27
|
+
return axios
|
|
28
|
+
.post(`${process.env.BACKEND_IA_URL}${!!(options === null || options === void 0 ? void 0 : options.exposed) ? '/exposed' : '/api'}${url}`, body, {
|
|
29
|
+
headers: {
|
|
30
|
+
'ngrok-skip-browser-warning': true,
|
|
31
|
+
'Content-Type': 'application/json',
|
|
32
|
+
Authorization: `Bearer ${process.env.IA_ACCESS_TOKEN}`,
|
|
33
|
+
},
|
|
34
|
+
})
|
|
35
|
+
.then(({ data }) => data)
|
|
36
|
+
.catch((error) => catchAxios(error, !!(options === null || options === void 0 ? void 0 : options.bypassStatus), url));
|
|
37
|
+
}),
|
|
38
|
+
put: (url, body, options) => __awaiter(void 0, void 0, void 0, function* () {
|
|
39
|
+
return axios
|
|
40
|
+
.put(`${process.env.BACKEND_IA_URL}${!!(options === null || options === void 0 ? void 0 : options.exposed) ? '/exposed' : '/api'}${url}`, JSON.stringify(body), {
|
|
41
|
+
headers: {
|
|
42
|
+
'ngrok-skip-browser-warning': true,
|
|
43
|
+
'Content-Type': 'application/json',
|
|
44
|
+
Authorization: `Bearer ${process.env.IA_ACCESS_TOKEN}`,
|
|
45
|
+
},
|
|
46
|
+
})
|
|
47
|
+
.then(({ data }) => data)
|
|
48
|
+
.catch((error) => catchAxios(error, !!(options === null || options === void 0 ? void 0 : options.bypassStatus), url));
|
|
49
|
+
}),
|
|
50
|
+
delete: (url, body, options) => __awaiter(void 0, void 0, void 0, function* () {
|
|
51
|
+
return axios
|
|
52
|
+
.delete(`${process.env.BACKEND_IA_URL}${!!(options === null || options === void 0 ? void 0 : options.exposed) ? '/exposed' : '/api'}${url}`, {
|
|
53
|
+
data: body,
|
|
54
|
+
headers: {
|
|
55
|
+
'ngrok-skip-browser-warning': true,
|
|
56
|
+
'Content-Type': 'application/json',
|
|
57
|
+
Authorization: `Bearer ${process.env.IA_ACCESS_TOKEN}`,
|
|
58
|
+
},
|
|
59
|
+
})
|
|
60
|
+
.then(({ data }) => data)
|
|
61
|
+
.catch((error) => catchAxios(error, !!(options === null || options === void 0 ? void 0 : options.bypassStatus), url));
|
|
62
|
+
}),
|
|
63
|
+
};
|
|
64
|
+
exports.fetchIA = fetchIA;
|
|
65
|
+
function catchAxios(error, bypassStatus, url) {
|
|
66
|
+
var _a, _b;
|
|
67
|
+
if (bypassStatus)
|
|
68
|
+
return error.response;
|
|
69
|
+
err('Error in fetchIA', url, (_a = error.response) === null || _a === void 0 ? void 0 : _a.status, (_b = error.response) === null || _b === void 0 ? void 0 : _b.data);
|
|
70
|
+
throw new Error('Error in fetchIA');
|
|
71
|
+
}
|
package/lib/cjs/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.err = exports.sendMail = exports.batchQuery = exports.query = exports.sleep = exports.sendNotification = void 0;
|
|
3
|
+
exports.fetchIA = exports.err = exports.sendMail = exports.batchQuery = exports.query = exports.sleep = exports.sendNotification = void 0;
|
|
4
4
|
const sendNotification_1 = require("./sendNotification");
|
|
5
5
|
Object.defineProperty(exports, "sendNotification", { enumerable: true, get: function () { return sendNotification_1.sendNotification; } });
|
|
6
6
|
const sleep_1 = require("./sleep");
|
|
@@ -12,3 +12,5 @@ const sendMail_1 = require("./sendMail");
|
|
|
12
12
|
Object.defineProperty(exports, "sendMail", { enumerable: true, get: function () { return sendMail_1.sendMail; } });
|
|
13
13
|
const err_1 = require("./err");
|
|
14
14
|
Object.defineProperty(exports, "err", { enumerable: true, get: function () { return err_1.err; } });
|
|
15
|
+
const fetchIA_1 = require("./fetch/fetchIA");
|
|
16
|
+
Object.defineProperty(exports, "fetchIA", { enumerable: true, get: function () { return fetchIA_1.fetchIA; } });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/err/index.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,GAAG,QAAS,GAAG,OAAO,GAAG,SAAS,GAAG,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/err/index.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,GAAG,QAAS,GAAG,OAAO,GAAG,SAAS,GAAG,SAE1C,CAAC;AAEF,OAAO,EAAE,GAAG,EAAE,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
declare const fetchIA: {
|
|
2
|
+
get: (url: string, params: any, options: any) => Promise<any>;
|
|
3
|
+
post: (url: string, body: any, options: any) => Promise<any>;
|
|
4
|
+
put: (url: string, body: any, options: any) => Promise<any>;
|
|
5
|
+
delete: (url: string, body: any, options: any) => Promise<any>;
|
|
6
|
+
};
|
|
7
|
+
export { fetchIA };
|
|
8
|
+
//# sourceMappingURL=fetchIA.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fetchIA.d.ts","sourceRoot":"","sources":["../../../../src/fetch/fetchIA.ts"],"names":[],"mappings":"AAGA,QAAA,MAAM,OAAO;eACM,MAAM,UAAU,GAAG,WAAW,GAAG;gBAmBhC,MAAM,QAAQ,GAAG,WAAW,GAAG;eAkBhC,MAAM,QAAQ,GAAG,WAAW,GAAG;kBAkB5B,MAAM,QAAQ,GAAG,WAAW,GAAG;CAkBpD,CAAC;AAQF,OAAO,EAAE,OAAO,EAAE,CAAC"}
|
package/lib/cjs/types/index.d.ts
CHANGED
|
@@ -3,5 +3,6 @@ import { sleep } from './sleep';
|
|
|
3
3
|
import { query, batchQuery } from './db';
|
|
4
4
|
import { sendMail } from './sendMail';
|
|
5
5
|
import { err } from './err';
|
|
6
|
-
|
|
6
|
+
import { fetchIA } from './fetch/fetchIA';
|
|
7
|
+
export { sendNotification, sleep, query, batchQuery, sendMail, err, fetchIA };
|
|
7
8
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAC5B,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAE1C,OAAO,EAAE,gBAAgB,EAAE,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,GAAG,EAAE,OAAO,EAAE,CAAC"}
|