@activepieces/piece-apitemplate-io 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.
Files changed (35) hide show
  1. package/README.md +7 -0
  2. package/package.json +39 -0
  3. package/src/index.d.ts +4 -0
  4. package/src/index.js +48 -0
  5. package/src/index.js.map +1 -0
  6. package/src/lib/actions/create-image.d.ts +9 -0
  7. package/src/lib/actions/create-image.js +52 -0
  8. package/src/lib/actions/create-image.js.map +1 -0
  9. package/src/lib/actions/create-pdf-from-html.d.ts +23 -0
  10. package/src/lib/actions/create-pdf-from-html.js +207 -0
  11. package/src/lib/actions/create-pdf-from-html.js.map +1 -0
  12. package/src/lib/actions/create-pdf-from-url.d.ts +25 -0
  13. package/src/lib/actions/create-pdf-from-url.js +226 -0
  14. package/src/lib/actions/create-pdf-from-url.js.map +1 -0
  15. package/src/lib/actions/create-pdf.d.ts +10 -0
  16. package/src/lib/actions/create-pdf.js +70 -0
  17. package/src/lib/actions/create-pdf.js.map +1 -0
  18. package/src/lib/actions/delete-object.d.ts +6 -0
  19. package/src/lib/actions/delete-object.js +40 -0
  20. package/src/lib/actions/delete-object.js.map +1 -0
  21. package/src/lib/actions/get-account-information.d.ts +4 -0
  22. package/src/lib/actions/get-account-information.js +33 -0
  23. package/src/lib/actions/get-account-information.js.map +1 -0
  24. package/src/lib/actions/list-objects.d.ts +12 -0
  25. package/src/lib/actions/list-objects.js +95 -0
  26. package/src/lib/actions/list-objects.js.map +1 -0
  27. package/src/lib/common/auth.d.ts +4 -0
  28. package/src/lib/common/auth.js +63 -0
  29. package/src/lib/common/auth.js.map +1 -0
  30. package/src/lib/common/client.d.ts +18 -0
  31. package/src/lib/common/client.js +120 -0
  32. package/src/lib/common/client.js.map +1 -0
  33. package/src/lib/common/props.d.ts +3 -0
  34. package/src/lib/common/props.js +147 -0
  35. package/src/lib/common/props.js.map +1 -0
package/README.md ADDED
@@ -0,0 +1,7 @@
1
+ # pieces-apitemplate-io
2
+
3
+ This library was generated with [Nx](https://nx.dev).
4
+
5
+ ## Building
6
+
7
+ Run `nx build pieces-apitemplate-io` to build the library.
package/package.json ADDED
@@ -0,0 +1,39 @@
1
+ {
2
+ "name": "@activepieces/piece-apitemplate-io",
3
+ "version": "0.0.1",
4
+ "type": "commonjs",
5
+ "main": "./src/index.js",
6
+ "types": "./src/index.d.ts",
7
+ "dependencies": {
8
+ "@ai-sdk/anthropic": "1.2.12",
9
+ "@ai-sdk/google": "1.2.19",
10
+ "@ai-sdk/openai": "1.3.22",
11
+ "@ai-sdk/replicate": "0.2.8",
12
+ "@sinclair/typebox": "0.34.11",
13
+ "ai": "4.3.16",
14
+ "axios": "1.8.3",
15
+ "axios-retry": "4.4.1",
16
+ "deepmerge-ts": "7.1.0",
17
+ "fast-glob": "3.3.3",
18
+ "mime-types": "2.1.35",
19
+ "nanoid": "3.3.8",
20
+ "semver": "7.6.0",
21
+ "tslib": "^2.3.0",
22
+ "zod": "3.25.76",
23
+ "@activepieces/pieces-common": "0.6.1",
24
+ "@activepieces/pieces-framework": "0.15.0",
25
+ "@activepieces/shared": "0.17.5"
26
+ },
27
+ "overrides": {
28
+ "@tryfabric/martian": {
29
+ "@notionhq/client": "$@notionhq/client"
30
+ },
31
+ "vite": {
32
+ "rollup": "npm:@rollup/wasm-node"
33
+ },
34
+ "stylus": "0.0.1-security"
35
+ },
36
+ "resolutions": {
37
+ "rollup": "npm:@rollup/wasm-node"
38
+ }
39
+ }
package/src/index.d.ts ADDED
@@ -0,0 +1,4 @@
1
+ export declare const apitemplateIo: import("@activepieces/pieces-framework").Piece<import("@activepieces/pieces-framework").CustomAuthProperty<{
2
+ region: import("@activepieces/pieces-framework").StaticDropdownProperty<string, true>;
3
+ apiKey: import("@activepieces/pieces-framework").ShortTextProperty<true>;
4
+ }>>;
package/src/index.js ADDED
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.apitemplateIo = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const pieces_framework_1 = require("@activepieces/pieces-framework");
6
+ const auth_1 = require("./lib/common/auth");
7
+ const create_image_1 = require("./lib/actions/create-image");
8
+ const create_pdf_1 = require("./lib/actions/create-pdf");
9
+ const get_account_information_1 = require("./lib/actions/get-account-information");
10
+ const delete_object_1 = require("./lib/actions/delete-object");
11
+ const list_objects_1 = require("./lib/actions/list-objects");
12
+ const create_pdf_from_html_1 = require("./lib/actions/create-pdf-from-html");
13
+ const create_pdf_from_url_1 = require("./lib/actions/create-pdf-from-url");
14
+ const shared_1 = require("@activepieces/shared");
15
+ const pieces_common_1 = require("@activepieces/pieces-common");
16
+ const client_1 = require("./lib/common/client");
17
+ exports.apitemplateIo = (0, pieces_framework_1.createPiece)({
18
+ displayName: 'APITemplate.io',
19
+ auth: auth_1.ApitemplateAuth,
20
+ minimumSupportedRelease: '0.36.1',
21
+ logoUrl: 'https://cdn.activepieces.com/pieces/apitemplate-io.png',
22
+ categories: [shared_1.PieceCategory.CONTENT_AND_FILES, shared_1.PieceCategory.PRODUCTIVITY],
23
+ authors: ['Sanket6652'],
24
+ actions: [
25
+ create_image_1.createImage,
26
+ create_pdf_from_html_1.createPdfFromHtml,
27
+ create_pdf_from_url_1.createPdfFromUrl,
28
+ create_pdf_1.createPdf,
29
+ delete_object_1.deleteObject,
30
+ get_account_information_1.getAccountInformation,
31
+ list_objects_1.listObjects,
32
+ (0, pieces_common_1.createCustomApiCallAction)({
33
+ auth: auth_1.ApitemplateAuth,
34
+ baseUrl: (auth) => {
35
+ const authConfig = auth;
36
+ return (0, client_1.getRegionalBaseUrl)(authConfig.region);
37
+ },
38
+ authMapping: (auth) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
39
+ const authConfig = auth;
40
+ return {
41
+ 'X-API-KEY': authConfig.apiKey,
42
+ };
43
+ }),
44
+ }),
45
+ ],
46
+ triggers: [],
47
+ });
48
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/pieces/community/apitemplate-io/src/index.ts"],"names":[],"mappings":";;;;AAAA,qEAA6D;AAC7D,4CAAoD;AACpD,6DAAyD;AACzD,yDAAqD;AACrD,mFAA8E;AAC9E,+DAA2D;AAC3D,6DAAyD;AACzD,6EAAuE;AACvE,2EAAqE;AACrE,iDAAqD;AACrD,+DAAwE;AACxE,gDAAgF;AAEnE,QAAA,aAAa,GAAG,IAAA,8BAAW,EAAC;IACvC,WAAW,EAAE,gBAAgB;IAC7B,IAAI,EAAE,sBAAe;IACrB,uBAAuB,EAAE,QAAQ;IACjC,OAAO,EAAE,wDAAwD;IACjE,UAAU,EAAE,CAAC,sBAAa,CAAC,iBAAiB,EAAE,sBAAa,CAAC,YAAY,CAAC;IACzE,OAAO,EAAE,CAAC,YAAY,CAAC;IACvB,OAAO,EAAE;QACP,0BAAW;QACX,wCAAiB;QACjB,sCAAgB;QAChB,sBAAS;QACT,4BAAY;QACZ,+CAAqB;QACrB,0BAAW;QACX,IAAA,yCAAyB,EAAC;YACxB,IAAI,EAAE,sBAAe;YACrB,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE;gBAChB,MAAM,UAAU,GAAG,IAA6B,CAAC;gBACjD,OAAO,IAAA,2BAAkB,EAAC,UAAU,CAAC,MAAM,CAAC,CAAC;YAC/C,CAAC;YACD,WAAW,EAAE,CAAO,IAAI,EAAE,EAAE;gBAC1B,MAAM,UAAU,GAAG,IAA6B,CAAC;gBACjD,OAAO;oBACL,WAAW,EAAE,UAAU,CAAC,MAAM;iBAC/B,CAAC;YACJ,CAAC,CAAA;SACF,CAAC;KACH;IACD,QAAQ,EAAE,EAAE;CACb,CAAC,CAAC"}
@@ -0,0 +1,9 @@
1
+ export declare const createImage: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").CustomAuthProperty<{
2
+ region: import("@activepieces/pieces-framework").StaticDropdownProperty<string, true>;
3
+ apiKey: import("@activepieces/pieces-framework").ShortTextProperty<true>;
4
+ }>, {
5
+ templateId: import("@activepieces/pieces-framework").DropdownProperty<any, true>;
6
+ data: import("@activepieces/pieces-framework").JsonProperty<true>;
7
+ generationDelay: import("@activepieces/pieces-framework").NumberProperty<false>;
8
+ meta: import("@activepieces/pieces-framework").ShortTextProperty<false>;
9
+ }>;
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createImage = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const pieces_framework_1 = require("@activepieces/pieces-framework");
6
+ const auth_1 = require("../common/auth");
7
+ const client_1 = require("../common/client");
8
+ const pieces_common_1 = require("@activepieces/pieces-common");
9
+ const props_1 = require("../common/props");
10
+ exports.createImage = (0, pieces_framework_1.createAction)({
11
+ auth: auth_1.ApitemplateAuth,
12
+ name: 'createImage',
13
+ displayName: 'Create Image',
14
+ description: 'Creates an image from a template with provided data.',
15
+ props: {
16
+ templateId: props_1.templateIdDropdown,
17
+ data: pieces_framework_1.Property.Json({
18
+ displayName: 'Template Data',
19
+ description: 'JSON data with overrides array to populate the template. Format: {"overrides": [{"name": "object_name", "property": "value"}]}.',
20
+ required: true,
21
+ }),
22
+ generationDelay: pieces_framework_1.Property.Number({
23
+ displayName: 'Generation Delay (ms)',
24
+ description: 'Delay in milliseconds before PDF generation',
25
+ required: false,
26
+ }),
27
+ meta: pieces_framework_1.Property.ShortText({
28
+ displayName: 'External Reference ID',
29
+ description: 'Specify an external reference ID for your own reference',
30
+ required: false,
31
+ }),
32
+ },
33
+ run(_a) {
34
+ return tslib_1.__awaiter(this, arguments, void 0, function* ({ auth, propsValue }) {
35
+ const authConfig = auth;
36
+ const { templateId, data, generationDelay, meta, } = propsValue;
37
+ // Build query parameters
38
+ const queryParams = new URLSearchParams();
39
+ queryParams.append('template_id', templateId);
40
+ if (generationDelay) {
41
+ queryParams.append('generation_delay', generationDelay.toString());
42
+ }
43
+ if (meta) {
44
+ queryParams.append('meta', meta);
45
+ }
46
+ const endpoint = `/create-image?${queryParams.toString()}`;
47
+ const response = yield (0, client_1.makeRequest)(authConfig.apiKey, pieces_common_1.HttpMethod.POST, endpoint, data, undefined, authConfig.region);
48
+ return response;
49
+ });
50
+ },
51
+ });
52
+ //# sourceMappingURL=create-image.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-image.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/apitemplate-io/src/lib/actions/create-image.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,yCAAiD;AACjD,6CAAsE;AACtE,+DAAyD;AACzD,2CAAqD;AAExC,QAAA,WAAW,GAAG,IAAA,+BAAY,EAAC;IACtC,IAAI,EAAE,sBAAe;IACrB,IAAI,EAAE,aAAa;IACnB,WAAW,EAAE,cAAc;IAC3B,WAAW,EAAE,sDAAsD;IACnE,KAAK,EAAE;QACL,UAAU,EAAE,0BAAkB;QAC1B,IAAI,EAAE,2BAAQ,CAAC,IAAI,CAAC;YACtB,WAAW,EAAE,eAAe;YAC5B,WAAW,EACT,iIAAiI;YACnI,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,eAAe,EAAE,2BAAQ,CAAC,MAAM,CAAC;YAC/B,WAAW,EAAE,uBAAuB;YACpC,WAAW,EAAE,6CAA6C;YAC1D,QAAQ,EAAE,KAAK;SAChB,CAAC;QACF,IAAI,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACvB,WAAW,EAAE,uBAAuB;YACpC,WAAW,EAAE,yDAAyD;YACtE,QAAQ,EAAE,KAAK;SAChB,CAAC;KACH;IACK,GAAG;qEAAC,EAAE,IAAI,EAAE,UAAU,EAAE;YAC5B,MAAM,UAAU,GAAG,IAA6B,CAAC;YACjD,MAAM,EACH,UAAU,EACX,IAAI,EACJ,eAAe,EACf,IAAI,GACL,GAAG,UAAU,CAAC;YAEf,yBAAyB;YACzB,MAAM,WAAW,GAAG,IAAI,eAAe,EAAE,CAAC;YAC1C,WAAW,CAAC,MAAM,CAAC,aAAa,EAAE,UAAU,CAAC,CAAC;YAE9C,IAAI,eAAe,EAAE,CAAC;gBACpB,WAAW,CAAC,MAAM,CAAC,kBAAkB,EAAE,eAAe,CAAC,QAAQ,EAAE,CAAC,CAAC;YACrE,CAAC;YAED,IAAI,IAAI,EAAE,CAAC;gBACT,WAAW,CAAC,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;YACnC,CAAC;YAED,MAAM,QAAQ,GAAG,iBAAiB,WAAW,CAAC,QAAQ,EAAE,EAAE,CAAC;YAE3D,MAAM,QAAQ,GAAG,MAAM,IAAA,oBAAW,EAChC,UAAU,CAAC,MAAM,EACjB,0BAAU,CAAC,IAAI,EACf,QAAQ,EACR,IAAI,EACJ,SAAS,EACT,UAAU,CAAC,MAAM,CAClB,CAAC;YAEF,OAAO,QAAQ,CAAC;QAClB,CAAC;KAAA;CACF,CAAC,CAAC"}
@@ -0,0 +1,23 @@
1
+ export declare const createPdfFromHtml: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").CustomAuthProperty<{
2
+ region: import("@activepieces/pieces-framework").StaticDropdownProperty<string, true>;
3
+ apiKey: import("@activepieces/pieces-framework").ShortTextProperty<true>;
4
+ }>, {
5
+ html: import("@activepieces/pieces-framework").LongTextProperty<true>;
6
+ css: import("@activepieces/pieces-framework").LongTextProperty<false>;
7
+ data: import("@activepieces/pieces-framework").JsonProperty<false>;
8
+ expiration: import("@activepieces/pieces-framework").NumberProperty<false>;
9
+ pageSize: import("@activepieces/pieces-framework").StaticDropdownProperty<string, false>;
10
+ orientation: import("@activepieces/pieces-framework").StaticDropdownProperty<string, false>;
11
+ marginTop: import("@activepieces/pieces-framework").NumberProperty<false>;
12
+ marginBottom: import("@activepieces/pieces-framework").NumberProperty<false>;
13
+ marginLeft: import("@activepieces/pieces-framework").NumberProperty<false>;
14
+ marginRight: import("@activepieces/pieces-framework").NumberProperty<false>;
15
+ printBackground: import("@activepieces/pieces-framework").CheckboxProperty<false>;
16
+ headerFontSize: import("@activepieces/pieces-framework").ShortTextProperty<false>;
17
+ displayHeaderFooter: import("@activepieces/pieces-framework").CheckboxProperty<false>;
18
+ customHeader: import("@activepieces/pieces-framework").LongTextProperty<false>;
19
+ customFooter: import("@activepieces/pieces-framework").LongTextProperty<false>;
20
+ scale: import("@activepieces/pieces-framework").NumberProperty<false>;
21
+ waitForTimeout: import("@activepieces/pieces-framework").NumberProperty<false>;
22
+ meta: import("@activepieces/pieces-framework").ShortTextProperty<false>;
23
+ }>;
@@ -0,0 +1,207 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createPdfFromHtml = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const pieces_framework_1 = require("@activepieces/pieces-framework");
6
+ const auth_1 = require("../common/auth");
7
+ const client_1 = require("../common/client");
8
+ const pieces_common_1 = require("@activepieces/pieces-common");
9
+ exports.createPdfFromHtml = (0, pieces_framework_1.createAction)({
10
+ auth: auth_1.ApitemplateAuth,
11
+ name: 'createPdfFromHtml',
12
+ displayName: 'Create PDF From HTML',
13
+ description: 'Creates a PDF from HTML.',
14
+ props: {
15
+ html: pieces_framework_1.Property.LongText({
16
+ displayName: 'HTML Content',
17
+ description: 'The HTML content to convert to PDF. Can include CSS styles and external resources.',
18
+ required: true,
19
+ }),
20
+ css: pieces_framework_1.Property.LongText({
21
+ displayName: 'CSS Styles',
22
+ description: 'Optional CSS styles to apply to the HTML content. Can include inline styles or external stylesheets.',
23
+ required: false,
24
+ }),
25
+ data: pieces_framework_1.Property.Json({
26
+ displayName: 'Data for Templating',
27
+ description: 'Optional JSON data to use for templating the HTML content. Can include variables and dynamic content.',
28
+ required: false,
29
+ }),
30
+ expiration: pieces_framework_1.Property.Number({
31
+ displayName: 'Expiration (minutes)',
32
+ description: 'Expiration of the generated PDF in minutes. Use 0 to store permanently, or 1-10080 minutes (7 days) to specify expiration.',
33
+ required: false,
34
+ }),
35
+ pageSize: pieces_framework_1.Property.StaticDropdown({
36
+ displayName: 'Page Size',
37
+ description: 'PDF page size format',
38
+ required: false,
39
+ defaultValue: 'A4',
40
+ options: {
41
+ options: [
42
+ { label: 'A4', value: 'A4' },
43
+ { label: 'A3', value: 'A3' },
44
+ { label: 'A5', value: 'A5' },
45
+ { label: 'Letter', value: 'Letter' },
46
+ { label: 'Legal', value: 'Legal' },
47
+ { label: 'Tabloid', value: 'Tabloid' },
48
+ ],
49
+ },
50
+ }),
51
+ orientation: pieces_framework_1.Property.StaticDropdown({
52
+ displayName: 'Page Orientation',
53
+ description: 'PDF page orientation',
54
+ required: false,
55
+ defaultValue: 'portrait',
56
+ options: {
57
+ options: [
58
+ { label: 'Portrait', value: 'portrait' },
59
+ { label: 'Landscape', value: 'landscape' },
60
+ ],
61
+ },
62
+ }),
63
+ marginTop: pieces_framework_1.Property.Number({
64
+ displayName: 'Margin Top (mm)',
65
+ description: 'Top margin in millimeters',
66
+ required: false,
67
+ }),
68
+ marginBottom: pieces_framework_1.Property.Number({
69
+ displayName: 'Margin Bottom (mm)',
70
+ description: 'Bottom margin in millimeters',
71
+ required: false,
72
+ }),
73
+ marginLeft: pieces_framework_1.Property.Number({
74
+ displayName: 'Margin Left (mm)',
75
+ description: 'Left margin in millimeters',
76
+ required: false,
77
+ }),
78
+ marginRight: pieces_framework_1.Property.Number({
79
+ displayName: 'Margin Right (mm)',
80
+ description: 'Right margin in millimeters',
81
+ required: false,
82
+ }),
83
+ printBackground: pieces_framework_1.Property.Checkbox({
84
+ displayName: 'Print Background',
85
+ description: 'Whether to print background graphics and colors',
86
+ required: false,
87
+ defaultValue: true,
88
+ }),
89
+ headerFontSize: pieces_framework_1.Property.ShortText({
90
+ displayName: 'Header Font Size',
91
+ description: 'Font size for header (e.g., "9px")',
92
+ required: false,
93
+ }),
94
+ displayHeaderFooter: pieces_framework_1.Property.Checkbox({
95
+ displayName: 'Display Header/Footer',
96
+ description: 'Whether to display header and footer',
97
+ required: false,
98
+ defaultValue: false,
99
+ }),
100
+ customHeader: pieces_framework_1.Property.LongText({
101
+ displayName: 'Custom Header HTML',
102
+ description: 'Custom HTML content for header',
103
+ required: false,
104
+ }),
105
+ customFooter: pieces_framework_1.Property.LongText({
106
+ displayName: 'Custom Footer HTML',
107
+ description: 'Custom HTML content for footer',
108
+ required: false,
109
+ }),
110
+ scale: pieces_framework_1.Property.Number({
111
+ displayName: 'Scale',
112
+ description: 'Scale factor for the PDF (0.1 to 2.0)',
113
+ required: false,
114
+ }),
115
+ waitForTimeout: pieces_framework_1.Property.Number({
116
+ displayName: 'Wait Timeout (ms)',
117
+ description: 'Time to wait before generating PDF (in milliseconds)',
118
+ required: false,
119
+ }),
120
+ meta: pieces_framework_1.Property.ShortText({
121
+ displayName: 'External Reference ID',
122
+ description: 'Specify an external reference ID for your own reference',
123
+ required: false,
124
+ }),
125
+ },
126
+ run(_a) {
127
+ return tslib_1.__awaiter(this, arguments, void 0, function* ({ auth, propsValue }) {
128
+ const authConfig = auth;
129
+ const { html, css, data, expiration, pageSize, orientation, marginTop, marginBottom, marginLeft, marginRight, printBackground, headerFontSize, displayHeaderFooter, customHeader, customFooter, scale, waitForTimeout, meta, } = propsValue;
130
+ // Build query parameters according to API docs
131
+ const queryParams = new URLSearchParams();
132
+ if (expiration !== undefined && expiration !== 0) {
133
+ queryParams.append('expiration', expiration.toString());
134
+ }
135
+ if (meta) {
136
+ queryParams.append('meta', meta);
137
+ }
138
+ const endpoint = `/create-pdf-from-html${queryParams.toString() ? `?${queryParams.toString()}` : ''}`;
139
+ // Build settings object
140
+ const settings = {};
141
+ if (pageSize && pageSize !== 'A4') {
142
+ settings.paper_size = pageSize;
143
+ }
144
+ if (orientation) {
145
+ settings.orientation = orientation === 'landscape' ? '1' : '0';
146
+ }
147
+ if (marginTop !== undefined) {
148
+ settings.margin_top = marginTop.toString();
149
+ }
150
+ if (marginBottom !== undefined) {
151
+ settings.margin_bottom = marginBottom.toString();
152
+ }
153
+ if (marginLeft !== undefined) {
154
+ settings.margin_left = marginLeft.toString();
155
+ }
156
+ if (marginRight !== undefined) {
157
+ settings.margin_right = marginRight.toString();
158
+ }
159
+ if (printBackground !== undefined) {
160
+ settings.print_background = printBackground ? '1' : '0';
161
+ }
162
+ if (headerFontSize) {
163
+ settings.header_font_size = headerFontSize;
164
+ }
165
+ if (displayHeaderFooter !== undefined) {
166
+ settings.displayHeaderFooter = displayHeaderFooter;
167
+ }
168
+ if (customHeader) {
169
+ settings.custom_header = customHeader;
170
+ }
171
+ if (customFooter) {
172
+ settings.custom_footer = customFooter;
173
+ }
174
+ if (scale !== undefined) {
175
+ settings.scale = scale.toString();
176
+ }
177
+ if (waitForTimeout !== undefined) {
178
+ settings.wait_for_timeout = waitForTimeout.toString();
179
+ }
180
+ // Build request body
181
+ const requestBody = {
182
+ body: html,
183
+ };
184
+ if (css) {
185
+ requestBody.css = css;
186
+ }
187
+ if (data) {
188
+ requestBody.data = data;
189
+ }
190
+ if (Object.keys(settings).length > 0) {
191
+ requestBody.settings = settings;
192
+ }
193
+ try {
194
+ const response = yield (0, client_1.makeRequest)(authConfig.apiKey, pieces_common_1.HttpMethod.POST, endpoint, requestBody, undefined, authConfig.region);
195
+ return response;
196
+ }
197
+ catch (error) {
198
+ if (error.message.includes('502') && authConfig.region !== 'default') {
199
+ throw new Error(`${error.message}\n\nThe ${authConfig.region} region appears to be experiencing issues. ` +
200
+ `Consider switching to the 'default' region in your authentication settings or try again later.`);
201
+ }
202
+ throw error;
203
+ }
204
+ });
205
+ },
206
+ });
207
+ //# sourceMappingURL=create-pdf-from-html.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-pdf-from-html.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/apitemplate-io/src/lib/actions/create-pdf-from-html.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,yCAAiD;AACjD,6CAAsE;AACtE,+DAAyD;AAE5C,QAAA,iBAAiB,GAAG,IAAA,+BAAY,EAAC;IAC5C,IAAI,EAAE,sBAAe;IACrB,IAAI,EAAE,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CAAC;gBAEpB,IAAI,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,UAAU,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;oBACrE,MAAM,IAAI,KAAK,CACb,GAAG,KAAK,CAAC,OAAO,WAAW,UAAU,CAAC,MAAM,6CAA6C;wBACzF,gGAAgG,CACjG,CAAC;gBACJ,CAAC;gBACD,MAAM,KAAK,CAAC;YACd,CAAC;QACH,CAAC;KAAA;CACF,CAAC,CAAC"}
@@ -0,0 +1,25 @@
1
+ export declare const createPdfFromUrl: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").CustomAuthProperty<{
2
+ region: import("@activepieces/pieces-framework").StaticDropdownProperty<string, true>;
3
+ apiKey: import("@activepieces/pieces-framework").ShortTextProperty<true>;
4
+ }>, {
5
+ url: import("@activepieces/pieces-framework").ShortTextProperty<true>;
6
+ expiration: import("@activepieces/pieces-framework").NumberProperty<false>;
7
+ pageSize: import("@activepieces/pieces-framework").StaticDropdownProperty<string, false>;
8
+ orientation: import("@activepieces/pieces-framework").StaticDropdownProperty<string, false>;
9
+ marginTop: import("@activepieces/pieces-framework").NumberProperty<false>;
10
+ marginBottom: import("@activepieces/pieces-framework").NumberProperty<false>;
11
+ marginLeft: import("@activepieces/pieces-framework").NumberProperty<false>;
12
+ marginRight: import("@activepieces/pieces-framework").NumberProperty<false>;
13
+ printBackground: import("@activepieces/pieces-framework").CheckboxProperty<false>;
14
+ headerFontSize: import("@activepieces/pieces-framework").ShortTextProperty<false>;
15
+ displayHeaderFooter: import("@activepieces/pieces-framework").CheckboxProperty<false>;
16
+ customHeader: import("@activepieces/pieces-framework").LongTextProperty<false>;
17
+ customFooter: import("@activepieces/pieces-framework").LongTextProperty<false>;
18
+ scale: import("@activepieces/pieces-framework").NumberProperty<false>;
19
+ waitForTimeout: import("@activepieces/pieces-framework").NumberProperty<false>;
20
+ waitForSelector: import("@activepieces/pieces-framework").ShortTextProperty<false>;
21
+ viewportWidth: import("@activepieces/pieces-framework").NumberProperty<false>;
22
+ viewportHeight: import("@activepieces/pieces-framework").NumberProperty<false>;
23
+ fullPage: import("@activepieces/pieces-framework").CheckboxProperty<false>;
24
+ meta: import("@activepieces/pieces-framework").ShortTextProperty<false>;
25
+ }>;