@activepieces/pieces-common 0.2.16 → 0.2.17
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
CHANGED
|
@@ -1,19 +1,28 @@
|
|
|
1
|
-
import { OAuth2PropertyValue, PieceAuthProperty } from "@activepieces/pieces-framework";
|
|
1
|
+
import { OAuth2PropertyValue, PieceAuthProperty, Property, StaticDropdownProperty } from "@activepieces/pieces-framework";
|
|
2
2
|
import { HttpHeaders, HttpMethod } from "../http";
|
|
3
3
|
export declare const getAccessTokenOrThrow: (auth: OAuth2PropertyValue | undefined) => string;
|
|
4
|
-
export declare function createCustomApiCallAction({ auth, baseUrl, authMapping, description, displayName, name }: {
|
|
4
|
+
export declare function createCustomApiCallAction({ auth, baseUrl, authMapping, description, displayName, name, props }: {
|
|
5
5
|
auth?: PieceAuthProperty;
|
|
6
6
|
baseUrl: (auth?: unknown) => string;
|
|
7
7
|
authMapping?: (auth: unknown) => Promise<HttpHeaders>;
|
|
8
8
|
description?: string | null;
|
|
9
9
|
displayName?: string | null;
|
|
10
10
|
name?: string | null;
|
|
11
|
+
props?: {
|
|
12
|
+
url?: Partial<ReturnType<typeof Property.ShortText>>;
|
|
13
|
+
method?: Partial<StaticDropdownProperty<HttpMethod, boolean>>;
|
|
14
|
+
headers?: Partial<ReturnType<typeof Property.Object>>;
|
|
15
|
+
queryParams?: Partial<ReturnType<typeof Property.Object>>;
|
|
16
|
+
body?: Partial<ReturnType<typeof Property.Json>>;
|
|
17
|
+
failsafe?: Partial<ReturnType<typeof Property.Checkbox>>;
|
|
18
|
+
timeout?: Partial<ReturnType<typeof Property.Number>>;
|
|
19
|
+
};
|
|
11
20
|
}): import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").BasicAuthProperty | import("@activepieces/pieces-framework").CustomAuthProperty<any> | import("@activepieces/pieces-framework").OAuth2Property<any> | import("@activepieces/pieces-framework").SecretTextProperty<boolean>, {
|
|
12
21
|
url: import("@activepieces/pieces-framework").DynamicProperties<true>;
|
|
13
|
-
method:
|
|
14
|
-
headers: import("@activepieces/pieces-framework").ObjectProperty<true>;
|
|
15
|
-
queryParams: import("@activepieces/pieces-framework").ObjectProperty<true>;
|
|
16
|
-
body: import("@activepieces/pieces-framework").JsonProperty<false>;
|
|
17
|
-
failsafe: import("@activepieces/pieces-framework").CheckboxProperty<false>;
|
|
18
|
-
timeout: import("@activepieces/pieces-framework").NumberProperty<false>;
|
|
22
|
+
method: StaticDropdownProperty<HttpMethod, false> | StaticDropdownProperty<HttpMethod, true>;
|
|
23
|
+
headers: import("@activepieces/pieces-framework").ObjectProperty<false> | import("@activepieces/pieces-framework").ObjectProperty<true>;
|
|
24
|
+
queryParams: import("@activepieces/pieces-framework").ObjectProperty<false> | import("@activepieces/pieces-framework").ObjectProperty<true>;
|
|
25
|
+
body: import("@activepieces/pieces-framework").JsonProperty<false> | import("@activepieces/pieces-framework").JsonProperty<true>;
|
|
26
|
+
failsafe: import("@activepieces/pieces-framework").CheckboxProperty<false> | import("@activepieces/pieces-framework").CheckboxProperty<true>;
|
|
27
|
+
timeout: import("@activepieces/pieces-framework").NumberProperty<false> | import("@activepieces/pieces-framework").NumberProperty<true>;
|
|
19
28
|
}>;
|
package/src/lib/helpers/index.js
CHANGED
|
@@ -13,7 +13,8 @@ const getAccessTokenOrThrow = (auth) => {
|
|
|
13
13
|
return accessToken;
|
|
14
14
|
};
|
|
15
15
|
exports.getAccessTokenOrThrow = getAccessTokenOrThrow;
|
|
16
|
-
function createCustomApiCallAction({ auth, baseUrl, authMapping, description, displayName, name }) {
|
|
16
|
+
function createCustomApiCallAction({ auth, baseUrl, authMapping, description, displayName, name, props }) {
|
|
17
|
+
var _a, _b, _c, _d, _e, _f;
|
|
17
18
|
return (0, pieces_framework_1.createAction)({
|
|
18
19
|
name: name ? name : 'custom_api_call',
|
|
19
20
|
displayName: displayName ? displayName : 'Custom API Call',
|
|
@@ -25,50 +26,26 @@ function createCustomApiCallAction({ auth, baseUrl, authMapping, description, di
|
|
|
25
26
|
displayName: '',
|
|
26
27
|
required: true,
|
|
27
28
|
refreshers: [],
|
|
28
|
-
props: (
|
|
29
|
+
props: (_g) => tslib_1.__awaiter(this, [_g], void 0, function* ({ auth }) {
|
|
30
|
+
var _h;
|
|
29
31
|
return {
|
|
30
|
-
url: pieces_framework_1.Property.ShortText({
|
|
31
|
-
displayName: 'URL',
|
|
32
|
-
description: 'The full URL to use, including the base URL',
|
|
33
|
-
required: true,
|
|
34
|
-
defaultValue: baseUrl(auth)
|
|
35
|
-
})
|
|
32
|
+
url: pieces_framework_1.Property.ShortText(Object.assign({ displayName: 'URL', description: 'The full URL to use, including the base URL', required: true, defaultValue: baseUrl(auth) }, ((_h = props === null || props === void 0 ? void 0 : props.url) !== null && _h !== void 0 ? _h : {})))
|
|
36
33
|
};
|
|
37
34
|
})
|
|
38
35
|
}),
|
|
39
|
-
method: pieces_framework_1.Property.StaticDropdown({
|
|
40
|
-
displayName: 'Method',
|
|
41
|
-
required: true,
|
|
42
|
-
options: {
|
|
36
|
+
method: pieces_framework_1.Property.StaticDropdown(Object.assign({ displayName: 'Method', required: true, options: {
|
|
43
37
|
options: Object.values(http_1.HttpMethod).map(v => {
|
|
44
38
|
return {
|
|
45
39
|
label: v,
|
|
46
40
|
value: v,
|
|
47
41
|
};
|
|
48
42
|
})
|
|
49
|
-
}
|
|
50
|
-
}),
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
}),
|
|
56
|
-
queryParams: pieces_framework_1.Property.Object({
|
|
57
|
-
displayName: 'Query Parameters',
|
|
58
|
-
required: true,
|
|
59
|
-
}),
|
|
60
|
-
body: pieces_framework_1.Property.Json({
|
|
61
|
-
displayName: 'Body',
|
|
62
|
-
required: false,
|
|
63
|
-
}),
|
|
64
|
-
failsafe: pieces_framework_1.Property.Checkbox({
|
|
65
|
-
displayName: 'No Error on Failure',
|
|
66
|
-
required: false,
|
|
67
|
-
}),
|
|
68
|
-
timeout: pieces_framework_1.Property.Number({
|
|
69
|
-
displayName: 'Timeout (in seconds)',
|
|
70
|
-
required: false,
|
|
71
|
-
}),
|
|
43
|
+
} }, ((_a = props === null || props === void 0 ? void 0 : props.method) !== null && _a !== void 0 ? _a : {}))),
|
|
44
|
+
headers: pieces_framework_1.Property.Object(Object.assign({ displayName: 'Headers', description: 'Authorization headers are injected automatically from your connection.', required: true }, ((_b = props === null || props === void 0 ? void 0 : props.headers) !== null && _b !== void 0 ? _b : {}))),
|
|
45
|
+
queryParams: pieces_framework_1.Property.Object(Object.assign({ displayName: 'Query Parameters', required: true }, ((_c = props === null || props === void 0 ? void 0 : props.queryParams) !== null && _c !== void 0 ? _c : {}))),
|
|
46
|
+
body: pieces_framework_1.Property.Json(Object.assign({ displayName: 'Body', required: false }, ((_d = props === null || props === void 0 ? void 0 : props.body) !== null && _d !== void 0 ? _d : {}))),
|
|
47
|
+
failsafe: pieces_framework_1.Property.Checkbox(Object.assign({ displayName: 'No Error on Failure', required: false }, ((_e = props === null || props === void 0 ? void 0 : props.failsafe) !== null && _e !== void 0 ? _e : {}))),
|
|
48
|
+
timeout: pieces_framework_1.Property.Number(Object.assign({ displayName: 'Timeout (in seconds)', required: false }, ((_f = props === null || props === void 0 ? void 0 : props.timeout) !== null && _f !== void 0 ? _f : {}))),
|
|
72
49
|
},
|
|
73
50
|
run: (context) => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
74
51
|
const { method, url, headers, queryParams, body, failsafe, timeout } = context.propsValue;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/common/src/lib/helpers/index.ts"],"names":[],"mappings":";;;;AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/common/src/lib/helpers/index.ts"],"names":[],"mappings":";;;;AAAA,qEAAwI;AACxI,kCAAmG;AACnG,iDAAgE;AAEzD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