@activepieces/piece-rendex 0.0.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 +17 -0
- package/src/i18n/translation.json +25 -0
- package/src/index.d.ts +4 -0
- package/src/index.d.ts.map +1 -0
- package/src/index.js +34 -0
- package/src/index.js.map +1 -0
- package/src/lib/actions/render-to-image.d.ts +7 -0
- package/src/lib/actions/render-to-image.d.ts.map +1 -0
- package/src/lib/actions/render-to-image.js +116 -0
- package/src/lib/actions/render-to-image.js.map +1 -0
- package/src/lib/common/auth.d.ts +2 -0
- package/src/lib/common/auth.d.ts.map +1 -0
- package/src/lib/common/auth.js +28 -0
- package/src/lib/common/auth.js.map +1 -0
- package/src/lib/common/common.d.ts +2 -0
- package/src/lib/common/common.d.ts.map +1 -0
- package/src/lib/common/common.js +5 -0
- package/src/lib/common/common.js.map +1 -0
package/package.json
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@activepieces/piece-rendex",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"type": "commonjs",
|
|
5
|
+
"main": "./src/index.js",
|
|
6
|
+
"types": "./src/index.d.ts",
|
|
7
|
+
"dependencies": {
|
|
8
|
+
"@activepieces/pieces-common": "0.12.3",
|
|
9
|
+
"@activepieces/pieces-framework": "0.30.0",
|
|
10
|
+
"@activepieces/shared": "0.86.0",
|
|
11
|
+
"tslib": "2.6.2"
|
|
12
|
+
},
|
|
13
|
+
"scripts": {
|
|
14
|
+
"build": "tsc -p tsconfig.lib.json && cp package.json dist/",
|
|
15
|
+
"lint": "eslint 'src/**/*.ts'"
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"Rendex": "Rendex",
|
|
3
|
+
"Render raw HTML, a URL, or Markdown to a PNG, JPEG, or WebP image or a PDF via the Rendex API.": "Render raw HTML, a URL, or Markdown to a PNG, JPEG, or WebP image or a PDF via the Rendex API.",
|
|
4
|
+
"API Key": "API Key",
|
|
5
|
+
"Your Rendex API key. Create one in your dashboard at rendex.dev under API Keys (the free tier includes 500 renders per month).": "Your Rendex API key. Create one in your dashboard at rendex.dev under API Keys (the free tier includes 500 renders per month).",
|
|
6
|
+
"Render to Image": "Render to Image",
|
|
7
|
+
"Render raw HTML, a URL, or Markdown to an image (PNG, JPEG, WebP) or a PDF.": "Render raw HTML, a URL, or Markdown to an image (PNG, JPEG, WebP) or a PDF.",
|
|
8
|
+
"Source": "Source",
|
|
9
|
+
"Render from raw HTML, a live URL, or Markdown.": "Render from raw HTML, a live URL, or Markdown.",
|
|
10
|
+
"Content": "Content",
|
|
11
|
+
"The content to render, based on the Source you selected.": "The content to render, based on the Source you selected.",
|
|
12
|
+
"HTML": "HTML",
|
|
13
|
+
"The HTML markup to render.": "The HTML markup to render.",
|
|
14
|
+
"URL": "URL",
|
|
15
|
+
"The page URL to render.": "The page URL to render.",
|
|
16
|
+
"Markdown": "Markdown",
|
|
17
|
+
"The Markdown to render.": "The Markdown to render.",
|
|
18
|
+
"Format": "Format",
|
|
19
|
+
"PNG": "PNG",
|
|
20
|
+
"JPEG": "JPEG",
|
|
21
|
+
"WebP": "WebP",
|
|
22
|
+
"PDF": "PDF",
|
|
23
|
+
"Full Page": "Full Page",
|
|
24
|
+
"Capture the full scrollable page instead of just the viewport.": "Capture the full scrollable page instead of just the viewport."
|
|
25
|
+
}
|
package/src/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAI/C,eAAO,MAAM,MAAM,mHAoBjB,CAAC;AAEH,OAAO,EAAE,UAAU,EAAE,CAAC"}
|
package/src/index.js
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.rendexAuth = exports.rendex = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
+
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
7
|
+
const shared_1 = require("@activepieces/shared");
|
|
8
|
+
const auth_1 = require("./lib/common/auth");
|
|
9
|
+
Object.defineProperty(exports, "rendexAuth", { enumerable: true, get: function () { return auth_1.rendexAuth; } });
|
|
10
|
+
const common_1 = require("./lib/common/common");
|
|
11
|
+
const render_to_image_1 = require("./lib/actions/render-to-image");
|
|
12
|
+
exports.rendex = (0, pieces_framework_1.createPiece)({
|
|
13
|
+
displayName: 'Rendex',
|
|
14
|
+
description: 'Render raw HTML, a URL, or Markdown to a PNG, JPEG, or WebP image or a PDF via the Rendex API.',
|
|
15
|
+
auth: auth_1.rendexAuth,
|
|
16
|
+
minimumSupportedRelease: '0.36.1',
|
|
17
|
+
logoUrl: 'https://cdn.activepieces.com/pieces/rendex.png',
|
|
18
|
+
categories: [shared_1.PieceCategory.CONTENT_AND_FILES, shared_1.PieceCategory.DEVELOPER_TOOLS],
|
|
19
|
+
authors: ['Dan425953'],
|
|
20
|
+
actions: [
|
|
21
|
+
render_to_image_1.renderToImage,
|
|
22
|
+
(0, pieces_common_1.createCustomApiCallAction)({
|
|
23
|
+
baseUrl: () => common_1.RENDEX_BASE_URL,
|
|
24
|
+
auth: auth_1.rendexAuth,
|
|
25
|
+
authMapping: (auth) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
26
|
+
return ({
|
|
27
|
+
Authorization: `Bearer ${auth.secret_text}`,
|
|
28
|
+
});
|
|
29
|
+
}),
|
|
30
|
+
}),
|
|
31
|
+
],
|
|
32
|
+
triggers: [],
|
|
33
|
+
});
|
|
34
|
+
//# sourceMappingURL=index.js.map
|
package/src/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;AAAA,qEAA6D;AAC7D,+DAAwE;AACxE,iDAAqD;AACrD,4CAA+C;AA0BtC,2FA1BA,iBAAU,OA0BA;AAzBnB,gDAAsD;AACtD,mEAA8D;AAEjD,QAAA,MAAM,GAAG,IAAA,8BAAW,EAAC;IAChC,WAAW,EAAE,QAAQ;IACrB,WAAW,EACT,gGAAgG;IAClG,IAAI,EAAE,iBAAU;IAChB,uBAAuB,EAAE,QAAQ;IACjC,OAAO,EAAE,gDAAgD;IACzD,UAAU,EAAE,CAAC,sBAAa,CAAC,iBAAiB,EAAE,sBAAa,CAAC,eAAe,CAAC;IAC5E,OAAO,EAAE,CAAC,WAAW,CAAC;IACtB,OAAO,EAAE;QACP,+BAAa;QACb,IAAA,yCAAyB,EAAC;YACxB,OAAO,EAAE,GAAG,EAAE,CAAC,wBAAe;YAC9B,IAAI,EAAE,iBAAU;YAChB,WAAW,EAAE,CAAO,IAAI,EAAE,EAAE;gBAAC,OAAA,CAAC;oBAC5B,aAAa,EAAE,UAAU,IAAI,CAAC,WAAW,EAAE;iBAC5C,CAAC,CAAA;cAAA;SACH,CAAC;KACH;IACD,QAAQ,EAAE,EAAE;CACb,CAAC,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const renderToImage: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").SecretTextProperty<true>, {
|
|
2
|
+
source_type: import("@activepieces/pieces-framework").StaticDropdownProperty<string, true>;
|
|
3
|
+
content: import("@activepieces/pieces-framework").DynamicProperties<true, import("@activepieces/pieces-framework").SecretTextProperty<true>>;
|
|
4
|
+
format: import("@activepieces/pieces-framework").StaticDropdownProperty<string, false>;
|
|
5
|
+
full_page: import("@activepieces/pieces-framework").CheckboxProperty<false>;
|
|
6
|
+
}>;
|
|
7
|
+
//# sourceMappingURL=render-to-image.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render-to-image.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/render-to-image.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,aAAa;;;;;EA8GxB,CAAC"}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.renderToImage = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
+
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
7
|
+
const auth_1 = require("../common/auth");
|
|
8
|
+
const common_1 = require("../common/common");
|
|
9
|
+
exports.renderToImage = (0, pieces_framework_1.createAction)({
|
|
10
|
+
auth: auth_1.rendexAuth,
|
|
11
|
+
name: 'render_to_image',
|
|
12
|
+
displayName: 'Render to Image',
|
|
13
|
+
description: 'Render raw HTML, a URL, or Markdown to an image (PNG, JPEG, WebP) or a PDF.',
|
|
14
|
+
props: {
|
|
15
|
+
source_type: pieces_framework_1.Property.StaticDropdown({
|
|
16
|
+
displayName: 'Source',
|
|
17
|
+
description: 'Render from raw HTML, a live URL, or Markdown.',
|
|
18
|
+
required: true,
|
|
19
|
+
defaultValue: 'html',
|
|
20
|
+
options: {
|
|
21
|
+
options: [
|
|
22
|
+
{ label: 'HTML', value: 'html' },
|
|
23
|
+
{ label: 'URL', value: 'url' },
|
|
24
|
+
{ label: 'Markdown', value: 'markdown' },
|
|
25
|
+
],
|
|
26
|
+
},
|
|
27
|
+
}),
|
|
28
|
+
content: pieces_framework_1.Property.DynamicProperties({
|
|
29
|
+
auth: auth_1.rendexAuth,
|
|
30
|
+
displayName: 'Content',
|
|
31
|
+
description: 'The content to render, based on the Source you selected.',
|
|
32
|
+
required: true,
|
|
33
|
+
refreshers: ['source_type'],
|
|
34
|
+
props: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ source_type }) {
|
|
35
|
+
if (source_type === 'url') {
|
|
36
|
+
return {
|
|
37
|
+
url: pieces_framework_1.Property.ShortText({
|
|
38
|
+
displayName: 'URL',
|
|
39
|
+
description: 'The page URL to render.',
|
|
40
|
+
required: true,
|
|
41
|
+
}),
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
if (source_type === 'markdown') {
|
|
45
|
+
return {
|
|
46
|
+
markdown: pieces_framework_1.Property.LongText({
|
|
47
|
+
displayName: 'Markdown',
|
|
48
|
+
description: 'The Markdown to render.',
|
|
49
|
+
required: true,
|
|
50
|
+
}),
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
return {
|
|
54
|
+
html: pieces_framework_1.Property.LongText({
|
|
55
|
+
displayName: 'HTML',
|
|
56
|
+
description: 'The HTML markup to render.',
|
|
57
|
+
required: true,
|
|
58
|
+
}),
|
|
59
|
+
};
|
|
60
|
+
}),
|
|
61
|
+
}),
|
|
62
|
+
format: pieces_framework_1.Property.StaticDropdown({
|
|
63
|
+
displayName: 'Format',
|
|
64
|
+
required: false,
|
|
65
|
+
defaultValue: 'png',
|
|
66
|
+
options: {
|
|
67
|
+
options: [
|
|
68
|
+
{ label: 'PNG', value: 'png' },
|
|
69
|
+
{ label: 'JPEG', value: 'jpeg' },
|
|
70
|
+
{ label: 'WebP', value: 'webp' },
|
|
71
|
+
{ label: 'PDF', value: 'pdf' },
|
|
72
|
+
],
|
|
73
|
+
},
|
|
74
|
+
}),
|
|
75
|
+
full_page: pieces_framework_1.Property.Checkbox({
|
|
76
|
+
displayName: 'Full Page',
|
|
77
|
+
description: 'Capture the full scrollable page instead of just the viewport.',
|
|
78
|
+
required: false,
|
|
79
|
+
defaultValue: false,
|
|
80
|
+
}),
|
|
81
|
+
},
|
|
82
|
+
run(context) {
|
|
83
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
84
|
+
const { auth, propsValue, files } = context;
|
|
85
|
+
const { source_type, content, format, full_page } = propsValue;
|
|
86
|
+
// The Source values ("html" | "url" | "markdown") map 1:1 onto both the
|
|
87
|
+
// dynamic field key and the Rendex request field, so the value is forwarded
|
|
88
|
+
// under the same name.
|
|
89
|
+
const sourceValue = content[source_type];
|
|
90
|
+
if (!sourceValue) {
|
|
91
|
+
throw new Error('Please provide content for the selected source.');
|
|
92
|
+
}
|
|
93
|
+
const body = {
|
|
94
|
+
[source_type]: sourceValue,
|
|
95
|
+
format: format !== null && format !== void 0 ? format : 'png',
|
|
96
|
+
fullPage: full_page !== null && full_page !== void 0 ? full_page : false,
|
|
97
|
+
};
|
|
98
|
+
const response = yield pieces_common_1.httpClient.sendRequest({
|
|
99
|
+
method: pieces_common_1.HttpMethod.POST,
|
|
100
|
+
url: `${common_1.RENDEX_BASE_URL}/v1/screenshot/json`,
|
|
101
|
+
headers: {
|
|
102
|
+
Authorization: `Bearer ${auth.secret_text}`,
|
|
103
|
+
'Content-Type': 'application/json',
|
|
104
|
+
},
|
|
105
|
+
body,
|
|
106
|
+
});
|
|
107
|
+
const _a = response.body.data, { image } = _a, metadata = tslib_1.__rest(_a, ["image"]);
|
|
108
|
+
const file = yield files.write({
|
|
109
|
+
fileName: `rendex-capture.${metadata.format}`,
|
|
110
|
+
data: Buffer.from(image, 'base64'),
|
|
111
|
+
});
|
|
112
|
+
return Object.assign({ file }, metadata);
|
|
113
|
+
});
|
|
114
|
+
},
|
|
115
|
+
});
|
|
116
|
+
//# sourceMappingURL=render-to-image.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render-to-image.js","sourceRoot":"","sources":["../../../../src/lib/actions/render-to-image.ts"],"names":[],"mappings":";;;;AAAA,qEAIwC;AACxC,+DAAqE;AACrE,yCAA4C;AAC5C,6CAAmD;AAEtC,QAAA,aAAa,GAAG,IAAA,+BAAY,EAAC;IACxC,IAAI,EAAE,iBAAU;IAChB,IAAI,EAAE,iBAAiB;IACvB,WAAW,EAAE,iBAAiB;IAC9B,WAAW,EACT,6EAA6E;IAC/E,KAAK,EAAE;QACL,WAAW,EAAE,2BAAQ,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,MAAM,EAAE,0BAAU,CAAC,IAAI;gBACvB,GAAG,EAAE,GAAG,wBAAe,qBAAqB;gBAC5C,OAAO,EAAE;oBACP,aAAa,EAAE,UAAU,IAAI,CAAC,WAAW,EAAE;oBAC3C,cAAc,EAAE,kBAAkB;iBACnC;gBACD,IAAI;aACL,CAAC,CAAC;YAEH,MAAM,KAAyB,QAAQ,CAAC,IAAI,CAAC,IAAI,EAA3C,EAAE,KAAK,OAAoC,EAA/B,QAAQ,sBAApB,SAAsB,CAAqB,CAAC;YAClD,MAAM,IAAI,GAAG,MAAM,KAAK,CAAC,KAAK,CAAC;gBAC7B,QAAQ,EAAE,kBAAkB,QAAQ,CAAC,MAAM,EAAE;gBAC7C,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,QAAQ,CAAC;aACnC,CAAC,CAAC;YAEH,uBAAS,IAAI,IAAK,QAAQ,EAAG;QAC/B,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../../../src/lib/common/auth.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,UAAU,mEAmBrB,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.rendexAuth = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
+
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
7
|
+
const common_1 = require("./common");
|
|
8
|
+
exports.rendexAuth = pieces_framework_1.PieceAuth.SecretText({
|
|
9
|
+
displayName: 'API Key',
|
|
10
|
+
description: 'Your Rendex API key. Create one in your dashboard at rendex.dev under API Keys (the free tier includes 500 renders per month).',
|
|
11
|
+
required: true,
|
|
12
|
+
validate: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth }) {
|
|
13
|
+
try {
|
|
14
|
+
yield pieces_common_1.httpClient.sendRequest({
|
|
15
|
+
method: pieces_common_1.HttpMethod.GET,
|
|
16
|
+
url: `${common_1.RENDEX_BASE_URL}/v1/credential-check`,
|
|
17
|
+
headers: {
|
|
18
|
+
Authorization: `Bearer ${auth}`,
|
|
19
|
+
},
|
|
20
|
+
});
|
|
21
|
+
return { valid: true };
|
|
22
|
+
}
|
|
23
|
+
catch (e) {
|
|
24
|
+
return { valid: false, error: 'Invalid API key' };
|
|
25
|
+
}
|
|
26
|
+
}),
|
|
27
|
+
});
|
|
28
|
+
//# sourceMappingURL=auth.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../../../src/lib/common/auth.ts"],"names":[],"mappings":";;;;AAAA,qEAA2D;AAC3D,+DAAqE;AACrE,qCAA2C;AAE9B,QAAA,UAAU,GAAG,4BAAS,CAAC,UAAU,CAAC;IAC7C,WAAW,EAAE,SAAS;IACtB,WAAW,EACT,gIAAgI;IAClI,QAAQ,EAAE,IAAI;IACd,QAAQ,EAAE,KAAiB,EAAE,oDAAZ,EAAE,IAAI,EAAE;QACvB,IAAI,CAAC;YACH,MAAM,0BAAU,CAAC,WAAW,CAAC;gBAC3B,MAAM,EAAE,0BAAU,CAAC,GAAG;gBACtB,GAAG,EAAE,GAAG,wBAAe,sBAAsB;gBAC7C,OAAO,EAAE;oBACP,aAAa,EAAE,UAAU,IAAI,EAAE;iBAChC;aACF,CAAC,CAAC;YACH,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;QACzB,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,iBAAiB,EAAE,CAAC;QACpD,CAAC;IACH,CAAC,CAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../../src/lib/common/common.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,eAAe,2BAA2B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../../../src/lib/common/common.ts"],"names":[],"mappings":";;;AAAa,QAAA,eAAe,GAAG,wBAAwB,CAAC"}
|