@activepieces/pieces-common 0.1.0 → 0.2.1
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/package.json +5 -4
- package/src/lib/helpers/index.d.ts +0 -1
- package/src/lib/helpers/index.js +0 -2
- package/src/lib/helpers/index.js.map +1 -1
- package/src/lib/http/axios/axios-http-client.d.ts +1 -3
- package/src/lib/http/axios/axios-http-client.js +3 -3
- package/src/lib/http/axios/axios-http-client.js.map +1 -1
- package/src/lib/helpers/assertions.d.ts +0 -2
- package/src/lib/helpers/assertions.js +0 -14
- package/src/lib/helpers/assertions.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@activepieces/pieces-common",
|
|
3
|
-
"version": "0.1
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"type": "commonjs",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"@sinclair/typebox": "^0.26.3",
|
|
7
|
-
"axios": "1.
|
|
7
|
+
"axios": "1.4.0",
|
|
8
8
|
"nanoid": "^3.3.4",
|
|
9
|
-
"
|
|
10
|
-
"@activepieces/
|
|
9
|
+
"semver": "7.5.3",
|
|
10
|
+
"@activepieces/pieces-framework": "0.6.1",
|
|
11
|
+
"@activepieces/shared": "0.5.7",
|
|
11
12
|
"tslib": "1.14.1"
|
|
12
13
|
},
|
|
13
14
|
"main": "./src/index.js",
|
package/src/lib/helpers/index.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getAccessTokenOrThrow = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
4
|
const getAccessTokenOrThrow = (auth) => {
|
|
6
5
|
const accessToken = auth === null || auth === void 0 ? void 0 : auth.access_token;
|
|
7
6
|
if (accessToken === undefined) {
|
|
@@ -10,5 +9,4 @@ const getAccessTokenOrThrow = (auth) => {
|
|
|
10
9
|
return accessToken;
|
|
11
10
|
};
|
|
12
11
|
exports.getAccessTokenOrThrow = getAccessTokenOrThrow;
|
|
13
|
-
tslib_1.__exportStar(require("./assertions"), exports);
|
|
14
12
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../packages/pieces/common/src/lib/helpers/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../packages/pieces/common/src/lib/helpers/index.ts"],"names":[],"mappings":";;;AAEO,MAAM,qBAAqB,GAAG,CAAC,IAAqC,EAAU,EAAE;IACrF,MAAM,WAAW,GAAG,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,YAAY,CAAC;IAEvC,IAAI,WAAW,KAAK,SAAS,EAAE;QAC7B,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAC;KACzC;IAED,OAAO,WAAW,CAAC;AACrB,CAAC,CAAC;AARW,QAAA,qBAAqB,yBAQhC"}
|
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
import { AxiosStatic } from 'axios';
|
|
2
1
|
import { DelegatingAuthenticationConverter } from '../core/delegating-authentication-converter';
|
|
3
2
|
import { BaseHttpClient } from '../core/base-http-client';
|
|
4
3
|
import { HttpMessageBody } from '../core/http-message-body';
|
|
5
4
|
import { HttpRequest } from '../core/http-request';
|
|
6
5
|
import { HttpResponse } from '../core/http-response';
|
|
7
6
|
export declare class AxiosHttpClient extends BaseHttpClient {
|
|
8
|
-
|
|
9
|
-
constructor(baseUrl?: string, authenticationConverter?: DelegatingAuthenticationConverter, client?: AxiosStatic);
|
|
7
|
+
constructor(baseUrl?: string, authenticationConverter?: DelegatingAuthenticationConverter);
|
|
10
8
|
sendRequest<ResponseBody extends HttpMessageBody>(request: HttpRequest<HttpMessageBody>): Promise<HttpResponse<ResponseBody>>;
|
|
11
9
|
private getAxiosRequestMethod;
|
|
12
10
|
}
|
|
@@ -7,14 +7,14 @@ const delegating_authentication_converter_1 = require("../core/delegating-authen
|
|
|
7
7
|
const base_http_client_1 = require("../core/base-http-client");
|
|
8
8
|
const http_error_1 = require("../core/http-error");
|
|
9
9
|
class AxiosHttpClient extends base_http_client_1.BaseHttpClient {
|
|
10
|
-
constructor(baseUrl = '', authenticationConverter = new delegating_authentication_converter_1.DelegatingAuthenticationConverter()
|
|
10
|
+
constructor(baseUrl = '', authenticationConverter = new delegating_authentication_converter_1.DelegatingAuthenticationConverter()) {
|
|
11
11
|
super(baseUrl, authenticationConverter);
|
|
12
|
-
this.client = client;
|
|
13
12
|
}
|
|
14
13
|
sendRequest(request) {
|
|
15
14
|
var _a, _b;
|
|
16
15
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
17
16
|
try {
|
|
17
|
+
process.env['NODE_TLS_REJECT_UNAUTHORIZED'] = '0';
|
|
18
18
|
const url = this.getUrl(request);
|
|
19
19
|
const headers = this.getHeaders(request);
|
|
20
20
|
const axiosRequestMethod = this.getAxiosRequestMethod(request.method);
|
|
@@ -34,12 +34,12 @@ class AxiosHttpClient extends base_http_client_1.BaseHttpClient {
|
|
|
34
34
|
};
|
|
35
35
|
}
|
|
36
36
|
catch (e) {
|
|
37
|
+
console.error('[HttpClient#sendRequest] error:', e);
|
|
37
38
|
if (axios_1.default.isAxiosError(e)) {
|
|
38
39
|
console.error('[HttpClient#sendRequest] error, responseStatus:', (_a = e.response) === null || _a === void 0 ? void 0 : _a.status);
|
|
39
40
|
console.error('[HttpClient#sendRequest] error, responseBody:', (_b = e.response) === null || _b === void 0 ? void 0 : _b.data);
|
|
40
41
|
throw new http_error_1.HttpError(request.body, e);
|
|
41
42
|
}
|
|
42
|
-
console.error('[HttpClient#sendRequest] error:', e);
|
|
43
43
|
throw e;
|
|
44
44
|
}
|
|
45
45
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"axios-http-client.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/common/src/lib/http/axios/axios-http-client.ts"],"names":[],"mappings":";;;;AAAA,0DAA+D;AAC/D,qGAAgG;AAChG,+DAA0D;AAC1D,mDAA+C;
|
|
1
|
+
{"version":3,"file":"axios-http-client.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/common/src/lib/http/axios/axios-http-client.ts"],"names":[],"mappings":";;;;AAAA,0DAA+D;AAC/D,qGAAgG;AAChG,+DAA0D;AAC1D,mDAA+C;AAQ/C,MAAa,eAAgB,SAAQ,iCAAc;IAClD,YACC,OAAO,GAAG,EAAE,EACZ,0BAA6D,IAAI,uEAAiC,EAAE;QAEpG,KAAK,CAAC,OAAO,EAAE,uBAAuB,CAAC,CAAC;IACzC,CAAC;IAEK,WAAW,CAChB,OAAqC;;;YAErC,IAAI;gBACH,OAAO,CAAC,GAAG,CAAC,8BAA8B,CAAC,GAAG,GAAG,CAAC;gBAClD,MAAM,GAAG,GAAG,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;gBACjC,MAAM,OAAO,GAAG,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;gBACzC,MAAM,kBAAkB,GAAG,IAAI,CAAC,qBAAqB,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;gBAC7D,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;gBACtD,MAAM,MAAM,GAAsB;oBAC9B,MAAM,EAAE,kBAAkB;oBAC1B,GAAG;oBACH,OAAO;oBACP,IAAI,EAAE,OAAO,CAAC,IAAI;oBAClB,OAAO;iBACV,CAAC;gBAEF,MAAM,QAAQ,GAAG,MAAM,eAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAA;gBAErD,OAAO;oBACN,MAAM,EAAE,QAAQ,CAAC,MAAM;oBACvB,OAAO,EAAE,QAAQ,CAAC,OAAsB;oBACxC,IAAI,EAAE,QAAQ,CAAC,IAAI;iBACnB,CAAC;aACF;YAAC,OAAO,CAAC,EAAE;gBACX,OAAO,CAAC,KAAK,CAAC,iCAAiC,EAAE,CAAC,CAAC,CAAC;gBACpD,IAAI,eAAK,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE;oBACd,OAAO,CAAC,KAAK,CAAC,iDAAiD,EAAE,MAAA,CAAC,CAAC,QAAQ,0CAAE,MAAM,CAAC,CAAC;oBACrF,OAAO,CAAC,KAAK,CAAC,+CAA+C,EAAE,MAAA,CAAC,CAAC,QAAQ,0CAAE,IAAI,CAAC,CAAC;oBAE7F,MAAM,IAAI,sBAAS,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;iBACrC;gBAED,MAAM,CAAC,CAAC;aACR;;KACD;IAEO,qBAAqB,CAAC,UAAsB;QACnD,OAAO,UAAU,CAAC,QAAQ,EAAE,CAAC;IAC9B,CAAC;CACD;AAhDD,0CAgDC"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isNotUndefined = exports.assertNotNullOrUndefined = void 0;
|
|
4
|
-
function assertNotNullOrUndefined(value, fieldName) {
|
|
5
|
-
if (value === null || value === undefined) {
|
|
6
|
-
throw new Error(`${fieldName} is null or undefined`);
|
|
7
|
-
}
|
|
8
|
-
}
|
|
9
|
-
exports.assertNotNullOrUndefined = assertNotNullOrUndefined;
|
|
10
|
-
const isNotUndefined = (value) => {
|
|
11
|
-
return value !== undefined;
|
|
12
|
-
};
|
|
13
|
-
exports.isNotUndefined = isNotUndefined;
|
|
14
|
-
//# sourceMappingURL=assertions.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"assertions.js","sourceRoot":"","sources":["../../../../../../../packages/pieces/common/src/lib/helpers/assertions.ts"],"names":[],"mappings":";;;AAAA,SAAgB,wBAAwB,CACtC,KAA2B,EAC3B,SAAiB;IAEjB,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,EAAE;QACzC,MAAM,IAAI,KAAK,CAAC,GAAG,SAAS,uBAAuB,CAAC,CAAC;KACtD;AACH,CAAC;AAPD,4DAOC;AAEM,MAAM,cAAc,GAAG,CAAI,KAAoB,EAAc,EAAE;IACpE,OAAO,KAAK,KAAK,SAAS,CAAC;AAC7B,CAAC,CAAA;AAFY,QAAA,cAAc,kBAE1B"}
|