@activepieces/pieces-common 0.2.2 → 0.2.3
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 -5
- package/src/lib/http/core/base-http-client.d.ts +2 -2
- package/src/lib/http/core/base-http-client.js +10 -2
- package/src/lib/http/core/base-http-client.js.map +1 -1
- package/src/lib/http/core/media-type.d.ts +2 -1
- package/src/lib/http/core/media-type.js +1 -0
- package/src/lib/http/core/media-type.js.map +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@activepieces/pieces-common",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.3",
|
|
4
4
|
"type": "commonjs",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"@sinclair/typebox": "^0.26.3",
|
|
@@ -8,10 +8,10 @@
|
|
|
8
8
|
"dayjs": "^1.11.8",
|
|
9
9
|
"is-base64": "^1.1.0",
|
|
10
10
|
"nanoid": "^3.3.4",
|
|
11
|
-
"semver": "7.5.
|
|
12
|
-
"@activepieces/pieces-framework": "0.6.
|
|
13
|
-
"@activepieces/shared": "0.
|
|
14
|
-
"tslib": "
|
|
11
|
+
"semver": "7.5.4",
|
|
12
|
+
"@activepieces/pieces-framework": "0.6.17",
|
|
13
|
+
"@activepieces/shared": "0.8.3",
|
|
14
|
+
"tslib": "2.6.1"
|
|
15
15
|
},
|
|
16
16
|
"main": "./src/index.js",
|
|
17
17
|
"types": "./src/index.d.ts"
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import { DelegatingAuthenticationConverter } from './delegating-authentication-converter';
|
|
1
2
|
import type { HttpClient } from './http-client';
|
|
3
|
+
import type { HttpHeaders } from './http-headers';
|
|
2
4
|
import type { HttpMessageBody } from './http-message-body';
|
|
3
5
|
import type { HttpRequest } from './http-request';
|
|
4
|
-
import type { HttpHeaders } from './http-headers';
|
|
5
6
|
import { HttpResponse } from './http-response';
|
|
6
|
-
import { DelegatingAuthenticationConverter } from './delegating-authentication-converter';
|
|
7
7
|
export declare abstract class BaseHttpClient implements HttpClient {
|
|
8
8
|
private readonly baseUrl;
|
|
9
9
|
private readonly authenticationConverter;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.BaseHttpClient = void 0;
|
|
4
|
-
const node_url_1 = require("node:url");
|
|
5
4
|
const http_header_1 = require("./http-header");
|
|
6
5
|
const media_type_1 = require("./media-type");
|
|
6
|
+
const node_url_1 = require("node:url");
|
|
7
7
|
class BaseHttpClient {
|
|
8
8
|
constructor(baseUrl, authenticationConverter) {
|
|
9
9
|
this.baseUrl = baseUrl;
|
|
@@ -19,6 +19,7 @@ class BaseHttpClient {
|
|
|
19
19
|
return url.toString();
|
|
20
20
|
}
|
|
21
21
|
getHeaders(request) {
|
|
22
|
+
var _a;
|
|
22
23
|
let requestHeaders = {
|
|
23
24
|
[http_header_1.HttpHeader.ACCEPT]: media_type_1.MediaType.APPLICATION_JSON,
|
|
24
25
|
};
|
|
@@ -26,7 +27,14 @@ class BaseHttpClient {
|
|
|
26
27
|
this.populateAuthentication(request.authentication, requestHeaders);
|
|
27
28
|
}
|
|
28
29
|
if (request.body) {
|
|
29
|
-
|
|
30
|
+
switch ((_a = request.headers) === null || _a === void 0 ? void 0 : _a['Content-Type']) {
|
|
31
|
+
case 'text/csv':
|
|
32
|
+
requestHeaders[http_header_1.HttpHeader.CONTENT_TYPE] = media_type_1.MediaType.TEXT_CSV;
|
|
33
|
+
break;
|
|
34
|
+
default:
|
|
35
|
+
requestHeaders[http_header_1.HttpHeader.CONTENT_TYPE] = media_type_1.MediaType.APPLICATION_JSON;
|
|
36
|
+
break;
|
|
37
|
+
}
|
|
30
38
|
}
|
|
31
39
|
if (request.headers) {
|
|
32
40
|
requestHeaders = Object.assign(Object.assign({}, requestHeaders), request.headers);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base-http-client.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/common/src/lib/http/core/base-http-client.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"base-http-client.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/common/src/lib/http/core/base-http-client.ts"],"names":[],"mappings":";;;AAGA,+CAA2C;AAK3C,6CAAyC;AACzC,uCAA+B;AAE/B,MAAsB,cAAc;IAClC,YACmB,OAAe,EACf,uBAA0D;QAD1D,YAAO,GAAP,OAAO,CAAQ;QACf,4BAAuB,GAAvB,uBAAuB,CAAmC;IAC1E,CAAC;IAOM,MAAM,CACd,OAAiC;QAEjC,MAAM,GAAG,GAAG,IAAI,cAAG,CAAC,GAAG,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;QAErD,IAAI,OAAO,CAAC,WAAW,EAAE;YACvB,KAAK,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE;gBAC/D,GAAG,CAAC,YAAY,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;aACtC;SACF;QAED,OAAO,GAAG,CAAC,QAAQ,EAAE,CAAC;IACxB,CAAC;IAES,UAAU,CAClB,OAAiC;;QAEjC,IAAI,cAAc,GAAgB;YAChC,CAAC,wBAAU,CAAC,MAAM,CAAC,EAAE,sBAAS,CAAC,gBAAgB;SAChD,CAAC;QAEF,IAAI,OAAO,CAAC,cAAc,EAAE;YAC1B,IAAI,CAAC,sBAAsB,CAAC,OAAO,CAAC,cAAc,EAAE,cAAc,CAAC,CAAC;SACrE;QAED,IAAI,OAAO,CAAC,IAAI,EAAE;YAChB,QAAQ,MAAA,OAAO,CAAC,OAAO,0CAAG,cAAc,CAAC,EAAE;gBACzC,KAAK,UAAU;oBACb,cAAc,CAAC,wBAAU,CAAC,YAAY,CAAC,GAAG,sBAAS,CAAC,QAAQ,CAAC;oBAC7D,MAAM;gBAER;oBACE,cAAc,CAAC,wBAAU,CAAC,YAAY,CAAC,GAAG,sBAAS,CAAC,gBAAgB,CAAC;oBACrE,MAAM;aACT;SACF;QACD,IAAI,OAAO,CAAC,OAAO,EAAE;YACnB,cAAc,mCAAQ,cAAc,GAAK,OAAO,CAAC,OAAO,CAAE,CAAC;SAC5D;QACD,OAAO,cAAc,CAAC;IACxB,CAAC;IAEO,sBAAsB,CAC5B,cAA8B,EAC9B,OAAoB;QAEpB,IAAI,CAAC,uBAAuB,CAAC,OAAO,CAAC,cAAc,EAAE,OAAO,CAAC,CAAC;IAChE,CAAC;CACF;AA3DD,wCA2DC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"media-type.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/common/src/lib/http/core/media-type.ts"],"names":[],"mappings":";;;AAAA,IAAY,
|
|
1
|
+
{"version":3,"file":"media-type.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/common/src/lib/http/core/media-type.ts"],"names":[],"mappings":";;;AAAA,IAAY,SAGX;AAHD,WAAY,SAAS;IACnB,kDAAqC,CAAA;IACrC,kCAAqB,CAAA;AACvB,CAAC,EAHW,SAAS,yBAAT,SAAS,QAGpB"}
|