@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.
- package/README.md +7 -0
- package/package.json +39 -0
- package/src/index.d.ts +4 -0
- package/src/index.js +48 -0
- package/src/index.js.map +1 -0
- package/src/lib/actions/create-image.d.ts +9 -0
- package/src/lib/actions/create-image.js +52 -0
- package/src/lib/actions/create-image.js.map +1 -0
- package/src/lib/actions/create-pdf-from-html.d.ts +23 -0
- package/src/lib/actions/create-pdf-from-html.js +207 -0
- package/src/lib/actions/create-pdf-from-html.js.map +1 -0
- package/src/lib/actions/create-pdf-from-url.d.ts +25 -0
- package/src/lib/actions/create-pdf-from-url.js +226 -0
- package/src/lib/actions/create-pdf-from-url.js.map +1 -0
- package/src/lib/actions/create-pdf.d.ts +10 -0
- package/src/lib/actions/create-pdf.js +70 -0
- package/src/lib/actions/create-pdf.js.map +1 -0
- package/src/lib/actions/delete-object.d.ts +6 -0
- package/src/lib/actions/delete-object.js +40 -0
- package/src/lib/actions/delete-object.js.map +1 -0
- package/src/lib/actions/get-account-information.d.ts +4 -0
- package/src/lib/actions/get-account-information.js +33 -0
- package/src/lib/actions/get-account-information.js.map +1 -0
- package/src/lib/actions/list-objects.d.ts +12 -0
- package/src/lib/actions/list-objects.js +95 -0
- package/src/lib/actions/list-objects.js.map +1 -0
- package/src/lib/common/auth.d.ts +4 -0
- package/src/lib/common/auth.js +63 -0
- package/src/lib/common/auth.js.map +1 -0
- package/src/lib/common/client.d.ts +18 -0
- package/src/lib/common/client.js +120 -0
- package/src/lib/common/client.js.map +1 -0
- package/src/lib/common/props.d.ts +3 -0
- package/src/lib/common/props.js +147 -0
- package/src/lib/common/props.js.map +1 -0
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createPdfFromUrl = 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.createPdfFromUrl = (0, pieces_framework_1.createAction)({
|
|
10
|
+
auth: auth_1.ApitemplateAuth,
|
|
11
|
+
name: 'createPdfFromUrl',
|
|
12
|
+
displayName: 'Create PDF From URL',
|
|
13
|
+
description: 'Creates a PDF from a webpage URL.',
|
|
14
|
+
props: {
|
|
15
|
+
url: pieces_framework_1.Property.ShortText({
|
|
16
|
+
displayName: 'URL',
|
|
17
|
+
description: 'The URL of the webpage to convert to PDF',
|
|
18
|
+
required: true,
|
|
19
|
+
}),
|
|
20
|
+
expiration: pieces_framework_1.Property.Number({
|
|
21
|
+
displayName: 'Expiration (minutes)',
|
|
22
|
+
description: 'Expiration of the generated PDF in minutes. Use 0 to store permanently, or 1-10080 minutes (7 days) to specify expiration.',
|
|
23
|
+
required: false,
|
|
24
|
+
}),
|
|
25
|
+
pageSize: pieces_framework_1.Property.StaticDropdown({
|
|
26
|
+
displayName: 'Page Size',
|
|
27
|
+
description: 'PDF page size format',
|
|
28
|
+
required: false,
|
|
29
|
+
defaultValue: 'A4',
|
|
30
|
+
options: {
|
|
31
|
+
options: [
|
|
32
|
+
{ label: 'A4', value: 'A4' },
|
|
33
|
+
{ label: 'A3', value: 'A3' },
|
|
34
|
+
{ label: 'A5', value: 'A5' },
|
|
35
|
+
{ label: 'Letter', value: 'Letter' },
|
|
36
|
+
{ label: 'Legal', value: 'Legal' },
|
|
37
|
+
{ label: 'Tabloid', value: 'Tabloid' },
|
|
38
|
+
],
|
|
39
|
+
},
|
|
40
|
+
}),
|
|
41
|
+
orientation: pieces_framework_1.Property.StaticDropdown({
|
|
42
|
+
displayName: 'Page Orientation',
|
|
43
|
+
description: 'PDF page orientation',
|
|
44
|
+
required: false,
|
|
45
|
+
defaultValue: 'portrait',
|
|
46
|
+
options: {
|
|
47
|
+
options: [
|
|
48
|
+
{ label: 'Portrait', value: 'portrait' },
|
|
49
|
+
{ label: 'Landscape', value: 'landscape' },
|
|
50
|
+
],
|
|
51
|
+
},
|
|
52
|
+
}),
|
|
53
|
+
marginTop: pieces_framework_1.Property.Number({
|
|
54
|
+
displayName: 'Margin Top (mm)',
|
|
55
|
+
description: 'Top margin in millimeters',
|
|
56
|
+
required: false,
|
|
57
|
+
}),
|
|
58
|
+
marginBottom: pieces_framework_1.Property.Number({
|
|
59
|
+
displayName: 'Margin Bottom (mm)',
|
|
60
|
+
description: 'Bottom margin in millimeters',
|
|
61
|
+
required: false,
|
|
62
|
+
}),
|
|
63
|
+
marginLeft: pieces_framework_1.Property.Number({
|
|
64
|
+
displayName: 'Margin Left (mm)',
|
|
65
|
+
description: 'Left margin in millimeters',
|
|
66
|
+
required: false,
|
|
67
|
+
}),
|
|
68
|
+
marginRight: pieces_framework_1.Property.Number({
|
|
69
|
+
displayName: 'Margin Right (mm)',
|
|
70
|
+
description: 'Right margin in millimeters',
|
|
71
|
+
required: false,
|
|
72
|
+
}),
|
|
73
|
+
printBackground: pieces_framework_1.Property.Checkbox({
|
|
74
|
+
displayName: 'Print Background',
|
|
75
|
+
description: 'Whether to print background graphics and colors',
|
|
76
|
+
required: false,
|
|
77
|
+
defaultValue: true,
|
|
78
|
+
}),
|
|
79
|
+
headerFontSize: pieces_framework_1.Property.ShortText({
|
|
80
|
+
displayName: 'Header Font Size',
|
|
81
|
+
description: 'Font size for header (e.g., "9px")',
|
|
82
|
+
required: false,
|
|
83
|
+
}),
|
|
84
|
+
displayHeaderFooter: pieces_framework_1.Property.Checkbox({
|
|
85
|
+
displayName: 'Display Header/Footer',
|
|
86
|
+
description: 'Whether to display header and footer',
|
|
87
|
+
required: false,
|
|
88
|
+
defaultValue: false,
|
|
89
|
+
}),
|
|
90
|
+
customHeader: pieces_framework_1.Property.LongText({
|
|
91
|
+
displayName: 'Custom Header HTML',
|
|
92
|
+
description: 'Custom HTML content for header',
|
|
93
|
+
required: false,
|
|
94
|
+
}),
|
|
95
|
+
customFooter: pieces_framework_1.Property.LongText({
|
|
96
|
+
displayName: 'Custom Footer HTML',
|
|
97
|
+
description: 'Custom HTML content for footer',
|
|
98
|
+
required: false,
|
|
99
|
+
}),
|
|
100
|
+
scale: pieces_framework_1.Property.Number({
|
|
101
|
+
displayName: 'Scale',
|
|
102
|
+
description: 'Scale factor for the PDF (0.1 to 2.0)',
|
|
103
|
+
required: false,
|
|
104
|
+
}),
|
|
105
|
+
waitForTimeout: pieces_framework_1.Property.Number({
|
|
106
|
+
displayName: 'Wait Timeout (ms)',
|
|
107
|
+
description: 'Time to wait for page to load before generating PDF (in milliseconds)',
|
|
108
|
+
required: false,
|
|
109
|
+
}),
|
|
110
|
+
waitForSelector: pieces_framework_1.Property.ShortText({
|
|
111
|
+
displayName: 'Wait for Selector',
|
|
112
|
+
description: 'CSS selector to wait for before generating PDF (e.g., ".content-loaded")',
|
|
113
|
+
required: false,
|
|
114
|
+
}),
|
|
115
|
+
viewportWidth: pieces_framework_1.Property.Number({
|
|
116
|
+
displayName: 'Viewport Width',
|
|
117
|
+
description: 'Browser viewport width in pixels (default: 1920)',
|
|
118
|
+
required: false,
|
|
119
|
+
defaultValue: 1920,
|
|
120
|
+
}),
|
|
121
|
+
viewportHeight: pieces_framework_1.Property.Number({
|
|
122
|
+
displayName: 'Viewport Height',
|
|
123
|
+
description: 'Browser viewport height in pixels (default: 1080)',
|
|
124
|
+
required: false,
|
|
125
|
+
defaultValue: 1080,
|
|
126
|
+
}),
|
|
127
|
+
fullPage: pieces_framework_1.Property.Checkbox({
|
|
128
|
+
displayName: 'Full Page',
|
|
129
|
+
description: 'Capture the full scrollable page',
|
|
130
|
+
required: false,
|
|
131
|
+
defaultValue: true,
|
|
132
|
+
}),
|
|
133
|
+
meta: pieces_framework_1.Property.ShortText({
|
|
134
|
+
displayName: 'External Reference ID',
|
|
135
|
+
description: 'Specify an external reference ID for your own reference',
|
|
136
|
+
required: false,
|
|
137
|
+
}),
|
|
138
|
+
},
|
|
139
|
+
run(_a) {
|
|
140
|
+
return tslib_1.__awaiter(this, arguments, void 0, function* ({ auth, propsValue }) {
|
|
141
|
+
const authConfig = auth;
|
|
142
|
+
const { url, expiration, pageSize, orientation, marginTop, marginBottom, marginLeft, marginRight, printBackground, headerFontSize, displayHeaderFooter, customHeader, customFooter, scale, waitForTimeout, waitForSelector, viewportWidth, viewportHeight, fullPage, meta, } = propsValue;
|
|
143
|
+
// Build query parameters for basic options
|
|
144
|
+
const queryParams = new URLSearchParams();
|
|
145
|
+
if (expiration !== undefined && expiration !== 0) {
|
|
146
|
+
queryParams.append('expiration', expiration.toString());
|
|
147
|
+
}
|
|
148
|
+
if (meta) {
|
|
149
|
+
queryParams.append('meta', meta);
|
|
150
|
+
}
|
|
151
|
+
const endpoint = `/create-pdf-from-url${queryParams.toString() ? `?${queryParams.toString()}` : ''}`;
|
|
152
|
+
// Build settings object for page configuration
|
|
153
|
+
const settings = {};
|
|
154
|
+
if (pageSize && pageSize !== 'A4') {
|
|
155
|
+
settings.paper_size = pageSize;
|
|
156
|
+
}
|
|
157
|
+
if (orientation) {
|
|
158
|
+
settings.orientation = orientation === 'landscape' ? '1' : '0';
|
|
159
|
+
}
|
|
160
|
+
if (marginTop !== undefined) {
|
|
161
|
+
settings.margin_top = marginTop.toString();
|
|
162
|
+
}
|
|
163
|
+
if (marginBottom !== undefined) {
|
|
164
|
+
settings.margin_bottom = marginBottom.toString();
|
|
165
|
+
}
|
|
166
|
+
if (marginLeft !== undefined) {
|
|
167
|
+
settings.margin_left = marginLeft.toString();
|
|
168
|
+
}
|
|
169
|
+
if (marginRight !== undefined) {
|
|
170
|
+
settings.margin_right = marginRight.toString();
|
|
171
|
+
}
|
|
172
|
+
if (printBackground !== undefined) {
|
|
173
|
+
settings.print_background = printBackground ? '1' : '0';
|
|
174
|
+
}
|
|
175
|
+
if (headerFontSize) {
|
|
176
|
+
settings.header_font_size = headerFontSize;
|
|
177
|
+
}
|
|
178
|
+
if (displayHeaderFooter !== undefined) {
|
|
179
|
+
settings.displayHeaderFooter = displayHeaderFooter;
|
|
180
|
+
}
|
|
181
|
+
if (customHeader) {
|
|
182
|
+
settings.custom_header = customHeader;
|
|
183
|
+
}
|
|
184
|
+
if (customFooter) {
|
|
185
|
+
settings.custom_footer = customFooter;
|
|
186
|
+
}
|
|
187
|
+
if (scale !== undefined) {
|
|
188
|
+
settings.scale = scale.toString();
|
|
189
|
+
}
|
|
190
|
+
if (waitForTimeout !== undefined) {
|
|
191
|
+
settings.wait_for_timeout = waitForTimeout.toString();
|
|
192
|
+
}
|
|
193
|
+
if (waitForSelector) {
|
|
194
|
+
settings.wait_for_selector = waitForSelector;
|
|
195
|
+
}
|
|
196
|
+
if (viewportWidth !== undefined && viewportWidth !== 1920) {
|
|
197
|
+
settings.viewport_width = viewportWidth.toString();
|
|
198
|
+
}
|
|
199
|
+
if (viewportHeight !== undefined && viewportHeight !== 1080) {
|
|
200
|
+
settings.viewport_height = viewportHeight.toString();
|
|
201
|
+
}
|
|
202
|
+
if (fullPage !== undefined) {
|
|
203
|
+
settings.full_page = fullPage ? '1' : '0';
|
|
204
|
+
}
|
|
205
|
+
// Build request body
|
|
206
|
+
const requestBody = {
|
|
207
|
+
url: url,
|
|
208
|
+
};
|
|
209
|
+
if (Object.keys(settings).length > 0) {
|
|
210
|
+
requestBody.settings = settings;
|
|
211
|
+
}
|
|
212
|
+
try {
|
|
213
|
+
const response = yield (0, client_1.makeRequest)(authConfig.apiKey, pieces_common_1.HttpMethod.POST, endpoint, requestBody, undefined, authConfig.region);
|
|
214
|
+
return response;
|
|
215
|
+
}
|
|
216
|
+
catch (error) {
|
|
217
|
+
if (error.message.includes('502') && authConfig.region !== 'default') {
|
|
218
|
+
throw new Error(`${error.message}\n\nThe ${authConfig.region} region appears to be experiencing issues. ` +
|
|
219
|
+
`Consider switching to the 'default' region in your authentication settings or try again later.`);
|
|
220
|
+
}
|
|
221
|
+
throw error;
|
|
222
|
+
}
|
|
223
|
+
});
|
|
224
|
+
},
|
|
225
|
+
});
|
|
226
|
+
//# sourceMappingURL=create-pdf-from-url.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-pdf-from-url.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/apitemplate-io/src/lib/actions/create-pdf-from-url.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,yCAAiD;AACjD,6CAAsE;AACtE,+DAAyD;AAE5C,QAAA,gBAAgB,GAAG,IAAA,+BAAY,EAAC;IAC3C,IAAI,EAAE,sBAAe;IACrB,IAAI,EAAE,kBAAkB;IACxB,WAAW,EAAE,qBAAqB;IAClC,WAAW,EAAE,mCAAmC;IAChD,KAAK,EAAE;QACL,GAAG,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACtB,WAAW,EAAE,KAAK;YAClB,WAAW,EAAE,0CAA0C;YACvD,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,UAAU,EAAE,2BAAQ,CAAC,MAAM,CAAC;YAC1B,WAAW,EAAE,sBAAsB;YACnC,WAAW,EAAE,4HAA4H;YACzI,QAAQ,EAAE,KAAK;SAChB,CAAC;QACF,QAAQ,EAAE,2BAAQ,CAAC,cAAc,CAAC;YAChC,WAAW,EAAE,WAAW;YACxB,WAAW,EAAE,sBAAsB;YACnC,QAAQ,EAAE,KAAK;YACf,YAAY,EAAE,IAAI;YAClB,OAAO,EAAE;gBACP,OAAO,EAAE;oBACP,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE;oBAC5B,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE;oBAC5B,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE;oBAC5B,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE;oBACpC,EAAE,KAAK,EAAE,O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,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,10 @@
|
|
|
1
|
+
export declare const createPdf: 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
|
+
expiration: import("@activepieces/pieces-framework").NumberProperty<false>;
|
|
8
|
+
generationDelay: import("@activepieces/pieces-framework").NumberProperty<false>;
|
|
9
|
+
meta: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
10
|
+
}>;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createPdf = 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.createPdf = (0, pieces_framework_1.createAction)({
|
|
11
|
+
auth: auth_1.ApitemplateAuth,
|
|
12
|
+
name: 'createPdf',
|
|
13
|
+
displayName: 'Create PDF',
|
|
14
|
+
description: 'Creates a PDF 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
|
+
expiration: pieces_framework_1.Property.Number({
|
|
23
|
+
displayName: 'Expiration (minutes)',
|
|
24
|
+
description: 'Expiration of the generated PDF in minutes. Use 0 to store permanently, or 1-10080 minutes (7 days) to specify expiration.',
|
|
25
|
+
required: false,
|
|
26
|
+
defaultValue: 0,
|
|
27
|
+
}),
|
|
28
|
+
generationDelay: pieces_framework_1.Property.Number({
|
|
29
|
+
displayName: 'Generation Delay (ms)',
|
|
30
|
+
description: 'Delay in milliseconds before PDF generation',
|
|
31
|
+
required: false,
|
|
32
|
+
}),
|
|
33
|
+
meta: pieces_framework_1.Property.ShortText({
|
|
34
|
+
displayName: 'External Reference ID',
|
|
35
|
+
description: 'Specify an external reference ID for your own reference',
|
|
36
|
+
required: false,
|
|
37
|
+
}),
|
|
38
|
+
},
|
|
39
|
+
run(_a) {
|
|
40
|
+
return tslib_1.__awaiter(this, arguments, void 0, function* ({ auth, propsValue }) {
|
|
41
|
+
const authConfig = auth;
|
|
42
|
+
const { templateId, data, expiration, generationDelay, meta, } = propsValue;
|
|
43
|
+
// Build query parameters according to API docs
|
|
44
|
+
const queryParams = new URLSearchParams();
|
|
45
|
+
queryParams.append('template_id', templateId);
|
|
46
|
+
if (expiration !== undefined && expiration !== 0) {
|
|
47
|
+
queryParams.append('expiration', expiration.toString());
|
|
48
|
+
}
|
|
49
|
+
if (generationDelay) {
|
|
50
|
+
queryParams.append('generation_delay', generationDelay.toString());
|
|
51
|
+
}
|
|
52
|
+
if (meta) {
|
|
53
|
+
queryParams.append('meta', meta);
|
|
54
|
+
}
|
|
55
|
+
const endpoint = `/create-pdf?${queryParams.toString()}`;
|
|
56
|
+
try {
|
|
57
|
+
const response = yield (0, client_1.makeRequest)(authConfig.apiKey, pieces_common_1.HttpMethod.POST, endpoint, data, undefined, authConfig.region);
|
|
58
|
+
return response;
|
|
59
|
+
}
|
|
60
|
+
catch (error) {
|
|
61
|
+
if (error.message.includes('502') && authConfig.region !== 'default') {
|
|
62
|
+
throw new Error(`${error.message}\n\nThe ${authConfig.region} region appears to be experiencing issues. ` +
|
|
63
|
+
`Consider switching to the 'default' region in your authentication settings or try again later.`);
|
|
64
|
+
}
|
|
65
|
+
throw error;
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
},
|
|
69
|
+
});
|
|
70
|
+
//# sourceMappingURL=create-pdf.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-pdf.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/apitemplate-io/src/lib/actions/create-pdf.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,yCAAiD;AACjD,6CAAsE;AACtE,+DAAyD;AACzD,2CAAqD;AAExC,QAAA,SAAS,GAAG,IAAA,+BAAY,EAAC;IACpC,IAAI,EAAE,sBAAe;IACrB,IAAI,EAAE,WAAW;IACjB,WAAW,EAAE,YAAY;IACzB,WAAW,EAAE,mDAAmD;IAChE,KAAK,EAAE;QACL,UAAU,EAAE,0BAAkB;QAC9B,IAAI,EAAE,2BAAQ,CAAC,IAAI,CAAC;YAClB,WAAW,EAAE,eAAe;YAC5B,WAAW,EACT,iIAAiI;YACnI,QAAQ,EAAE,IAAI;SACf,CAAC;QACF,UAAU,EAAE,2BAAQ,CAAC,MAAM,CAAC;YAC1B,WAAW,EAAE,sBAAsB;YACnC,WAAW,EACT,4HAA4H;YAC9H,QAAQ,EAAE,KAAK;YACf,YAAY,EAAE,CAAC;SAChB,CAAC;QACF,eAAe,EAAE,2BAAQ,CAAC,MAAM,CAAC;YAC/B,WAAW,EAAE,uBAAuB;YACpC,WAAW,EAAE,6CAA6C;YAC1D,QAAQ,EAAE,KAAK;S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CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;oBACrE,MAAM,IAAI,KAAK,CACb,GAAG,KAAK,CAAC,OAAO,WAAW,UAAU,CAAC,MAAM,6CAA6C;wBACvF,gGAAgG,CACnG,CAAC;gBACJ,CAAC;gBACD,MAAM,KAAK,CAAC;YACd,CAAC;QACH,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const deleteObject: 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
|
+
transactionRef: import("@activepieces/pieces-framework").DropdownProperty<any, false>;
|
|
6
|
+
}>;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.deleteObject = 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.deleteObject = (0, pieces_framework_1.createAction)({
|
|
11
|
+
auth: auth_1.ApitemplateAuth,
|
|
12
|
+
name: 'deleteObject',
|
|
13
|
+
displayName: 'Delete Object',
|
|
14
|
+
description: 'Deletes a generated PDF or image by its transaction reference or object ID.',
|
|
15
|
+
props: {
|
|
16
|
+
transactionRef: props_1.transactionRefDropdown,
|
|
17
|
+
},
|
|
18
|
+
run(_a) {
|
|
19
|
+
return tslib_1.__awaiter(this, arguments, void 0, function* ({ auth, propsValue }) {
|
|
20
|
+
const authConfig = auth;
|
|
21
|
+
const { transactionRef } = propsValue;
|
|
22
|
+
// Build query parameters according to API docs
|
|
23
|
+
const queryParams = new URLSearchParams();
|
|
24
|
+
queryParams.append('transaction_ref', transactionRef);
|
|
25
|
+
const endpoint = `/delete-object?${queryParams.toString()}`;
|
|
26
|
+
try {
|
|
27
|
+
const response = yield (0, client_1.makeRequest)(authConfig.apiKey, pieces_common_1.HttpMethod.GET, endpoint, undefined, undefined, authConfig.region);
|
|
28
|
+
return response;
|
|
29
|
+
}
|
|
30
|
+
catch (error) {
|
|
31
|
+
if (error.message.includes('502') && authConfig.region !== 'default') {
|
|
32
|
+
throw new Error(`${error.message}\n\nThe ${authConfig.region} region appears to be experiencing issues. ` +
|
|
33
|
+
`Consider switching to the 'default' region in your authentication settings or try again later.`);
|
|
34
|
+
}
|
|
35
|
+
throw error;
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
},
|
|
39
|
+
});
|
|
40
|
+
//# sourceMappingURL=delete-object.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delete-object.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/apitemplate-io/src/lib/actions/delete-object.ts"],"names":[],"mappings":";;;;AAAA,qEAA8D;AAC9D,yCAAiD;AACjD,6CAAsE;AACtE,+DAAyD;AACzD,2CAAyD;AAE5C,QAAA,YAAY,GAAG,IAAA,+BAAY,EAAC;IACvC,IAAI,EAAE,sBAAe;IACrB,IAAI,EAAE,cAAc;IACpB,WAAW,EAAE,eAAe;IAC5B,WAAW,EAAE,6EAA6E;IAC1F,KAAK,EAAE;QACL,cAAc,EAAE,8BAAsB;KACvC;IACK,GAAG;qEAAC,EAAE,IAAI,EAAE,UAAU,EAAE;YAC5B,MAAM,UAAU,GAAG,IAA6B,CAAC;YACjD,MAAM,EAAE,cAAc,EAAE,GAAG,UAAU,CAAC;YAEtC,+CAA+C;YAC/C,MAAM,WAAW,GAAG,IAAI,eAAe,EAAE,CAAC;YAC1C,WAAW,CAAC,MAAM,CAAC,iBAAiB,EAAE,cAAc,CAAC,CAAC;YAEtD,MAAM,QAAQ,GAAG,kBAAkB,WAAW,CAAC,QAAQ,EAAE,EAAE,CAAC;YAE5D,IAAI,CAAC;gBACH,MAAM,QAAQ,GAAG,MAAM,IAAA,oBAAW,EAChC,UAAU,CAAC,MAAM,EACjB,0BAAU,CAAC,GAAG,EACd,QAAQ,EACR,SAAS,EACT,SAAS,EACT,UAAU,CAAC,MAAM,CAClB,CAAC;gBAEF,OAAO,QAAQ,CAAC;YAClB,CAAC;YAAC,OAAO,KAAU,EAAE,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,4 @@
|
|
|
1
|
+
export declare const getAccountInformation: 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
|
+
}>, {}>;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getAccountInformation = 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.getAccountInformation = (0, pieces_framework_1.createAction)({
|
|
10
|
+
auth: auth_1.ApitemplateAuth,
|
|
11
|
+
name: 'getAccountInformation',
|
|
12
|
+
displayName: 'Get Account Information',
|
|
13
|
+
description: 'Retrieves account information including usage statistics and account details.',
|
|
14
|
+
props: {},
|
|
15
|
+
run(_a) {
|
|
16
|
+
return tslib_1.__awaiter(this, arguments, void 0, function* ({ auth }) {
|
|
17
|
+
const authConfig = auth;
|
|
18
|
+
const endpoint = '/account-information';
|
|
19
|
+
try {
|
|
20
|
+
const response = yield (0, client_1.makeRequest)(authConfig.apiKey, pieces_common_1.HttpMethod.GET, endpoint, undefined, undefined, authConfig.region);
|
|
21
|
+
return response;
|
|
22
|
+
}
|
|
23
|
+
catch (error) {
|
|
24
|
+
if (error.message.includes('502') && authConfig.region !== 'default') {
|
|
25
|
+
throw new Error(`${error.message}\n\nThe ${authConfig.region} region appears to be experiencing issues. ` +
|
|
26
|
+
`Consider switching to the 'default' region in your authentication settings or try again later.`);
|
|
27
|
+
}
|
|
28
|
+
throw error;
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
},
|
|
32
|
+
});
|
|
33
|
+
//# sourceMappingURL=get-account-information.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-account-information.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/apitemplate-io/src/lib/actions/get-account-information.ts"],"names":[],"mappings":";;;;AAAA,qEAA8D;AAC9D,yCAAiD;AACjD,6CAAsE;AACtE,+DAAyD;AAE5C,QAAA,qBAAqB,GAAG,IAAA,+BAAY,EAAC;IAChD,IAAI,EAAE,sBAAe;IACrB,IAAI,EAAE,uBAAuB;IAC7B,WAAW,EAAE,yBAAyB;IACtC,WAAW,EAAE,+EAA+E;IAC5F,KAAK,EAAE,EAAE;IACH,GAAG;qEAAC,EAAE,IAAI,EAAE;YAChB,MAAM,UAAU,GAAG,IAA6B,CAAC;YAEjD,MAAM,QAAQ,GAAG,sBAAsB,CAAC;YAExC,IAAI,CAAC;gBACH,MAAM,QAAQ,GAAG,MAAM,IAAA,oBAAW,EAChC,UAAU,CAAC,MAAM,EACjB,0BAAU,CAAC,GAAG,EACd,QAAQ,EACR,SAAS,EACT,SAAS,EACT,UAAU,CAAC,MAAM,CAClB,CAAC;gBAEF,OAAO,QAAQ,CAAC;YAClB,CAAC;YAAC,OAAO,KAAU,EAAE,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,12 @@
|
|
|
1
|
+
export declare const listObjects: 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
|
+
limit: import("@activepieces/pieces-framework").NumberProperty<false>;
|
|
6
|
+
offset: import("@activepieces/pieces-framework").NumberProperty<false>;
|
|
7
|
+
templateId: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
8
|
+
transactionRef: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
9
|
+
dateFrom: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
10
|
+
dateTo: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
11
|
+
meta: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
12
|
+
}>;
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.listObjects = 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.listObjects = (0, pieces_framework_1.createAction)({
|
|
10
|
+
auth: auth_1.ApitemplateAuth,
|
|
11
|
+
name: 'listObjects',
|
|
12
|
+
displayName: 'List Objects',
|
|
13
|
+
description: 'Retrieves a list of generated PDFs and images with optional filtering',
|
|
14
|
+
props: {
|
|
15
|
+
limit: pieces_framework_1.Property.Number({
|
|
16
|
+
displayName: 'Limit',
|
|
17
|
+
description: 'Maximum number of objects to return (default: 300, max: 300)',
|
|
18
|
+
required: false,
|
|
19
|
+
defaultValue: 300,
|
|
20
|
+
}),
|
|
21
|
+
offset: pieces_framework_1.Property.Number({
|
|
22
|
+
displayName: 'Offset',
|
|
23
|
+
description: 'Number of objects to skip for pagination (default: 0)',
|
|
24
|
+
required: false,
|
|
25
|
+
defaultValue: 0,
|
|
26
|
+
}),
|
|
27
|
+
templateId: pieces_framework_1.Property.ShortText({
|
|
28
|
+
displayName: 'Template ID',
|
|
29
|
+
description: 'Filter objects by template ID (optional)',
|
|
30
|
+
required: false,
|
|
31
|
+
}),
|
|
32
|
+
transactionRef: pieces_framework_1.Property.ShortText({
|
|
33
|
+
displayName: 'Transaction Reference',
|
|
34
|
+
description: 'Filter by specific transaction reference (optional)',
|
|
35
|
+
required: false,
|
|
36
|
+
}),
|
|
37
|
+
dateFrom: pieces_framework_1.Property.ShortText({
|
|
38
|
+
displayName: 'Date From',
|
|
39
|
+
description: 'Start date for filtering (YYYY-MM-DD format, optional)',
|
|
40
|
+
required: false,
|
|
41
|
+
}),
|
|
42
|
+
dateTo: pieces_framework_1.Property.ShortText({
|
|
43
|
+
displayName: 'Date To',
|
|
44
|
+
description: 'End date for filtering (YYYY-MM-DD format, optional)',
|
|
45
|
+
required: false,
|
|
46
|
+
}),
|
|
47
|
+
meta: pieces_framework_1.Property.ShortText({
|
|
48
|
+
displayName: 'Meta Filter',
|
|
49
|
+
description: 'Filter by external reference ID (meta field)',
|
|
50
|
+
required: false,
|
|
51
|
+
}),
|
|
52
|
+
},
|
|
53
|
+
run(_a) {
|
|
54
|
+
return tslib_1.__awaiter(this, arguments, void 0, function* ({ auth, propsValue }) {
|
|
55
|
+
const authConfig = auth;
|
|
56
|
+
const { limit, offset, templateId, transactionRef, dateFrom, dateTo, meta, } = propsValue;
|
|
57
|
+
// Build query parameters according to API docs
|
|
58
|
+
const queryParams = new URLSearchParams();
|
|
59
|
+
if (limit !== undefined && limit !== 300) {
|
|
60
|
+
queryParams.append('limit', Math.min(limit, 300).toString());
|
|
61
|
+
}
|
|
62
|
+
if (offset !== undefined && offset !== 0) {
|
|
63
|
+
queryParams.append('offset', offset.toString());
|
|
64
|
+
}
|
|
65
|
+
if (templateId) {
|
|
66
|
+
queryParams.append('template_id', templateId);
|
|
67
|
+
}
|
|
68
|
+
if (transactionRef) {
|
|
69
|
+
queryParams.append('transaction_ref', transactionRef);
|
|
70
|
+
}
|
|
71
|
+
if (dateFrom) {
|
|
72
|
+
queryParams.append('date_from', dateFrom);
|
|
73
|
+
}
|
|
74
|
+
if (dateTo) {
|
|
75
|
+
queryParams.append('date_to', dateTo);
|
|
76
|
+
}
|
|
77
|
+
if (meta) {
|
|
78
|
+
queryParams.append('meta', meta);
|
|
79
|
+
}
|
|
80
|
+
const endpoint = `/list-objects${queryParams.toString() ? `?${queryParams.toString()}` : ''}`;
|
|
81
|
+
try {
|
|
82
|
+
const response = yield (0, client_1.makeRequest)(authConfig.apiKey, pieces_common_1.HttpMethod.GET, endpoint, undefined, undefined, authConfig.region);
|
|
83
|
+
return response;
|
|
84
|
+
}
|
|
85
|
+
catch (error) {
|
|
86
|
+
if (error.message.includes('502') && authConfig.region !== 'default') {
|
|
87
|
+
throw new Error(`${error.message}\n\nThe ${authConfig.region} region appears to be experiencing issues. ` +
|
|
88
|
+
`Consider switching to the 'default' region in your authentication settings or try again later.`);
|
|
89
|
+
}
|
|
90
|
+
throw error;
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
},
|
|
94
|
+
});
|
|
95
|
+
//# sourceMappingURL=list-objects.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-objects.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/apitemplate-io/src/lib/actions/list-objects.ts"],"names":[],"mappings":";;;;AAAA,qEAAwE;AACxE,yCAAiD;AACjD,6CAAsE;AACtE,+DAAyD;AAE5C,QAAA,WAAW,GAAG,IAAA,+BAAY,EAAC;IACtC,IAAI,EAAE,sBAAe;IACrB,IAAI,EAAE,aAAa;IACnB,WAAW,EAAE,cAAc;IAC3B,WAAW,EACT,uEAAuE;IACzE,KAAK,EAAE;QACL,KAAK,EAAE,2BAAQ,CAAC,MAAM,CAAC;YACrB,WAAW,EAAE,OAAO;YACpB,WAAW,EACT,8DAA8D;YAChE,QAAQ,EAAE,KAAK;YACf,YAAY,EAAE,GAAG;SAClB,CAAC;QACF,MAAM,EAAE,2BAAQ,CAAC,MAAM,CAAC;YACtB,WAAW,EAAE,QAAQ;YACrB,WAAW,EAAE,uDAAuD;YACpE,QAAQ,EAAE,KAAK;YACf,YAAY,EAAE,CAAC;SAChB,CAAC;QACF,UAAU,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC7B,WAAW,EAAE,aAAa;YAC1B,WAAW,EAAE,0CAA0C;YACvD,QAAQ,EAAE,KAAK;SAChB,CAAC;QACF,cAAc,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACjC,WAAW,EAAE,uBAAuB;YACpC,WAAW,EAAE,qDAAqD;YAClE,QAAQ,EAAE,KAAK;SAChB,CAAC;QACF,QAAQ,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC3B,WAAW,EAAE,WAAW;YACxB,WAAW,EAAE,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CAAC;YAC5C,CAAC;YAED,IAAI,MAAM,EAAE,CAAC;gBACX,WAAW,CAAC,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;YACxC,CAAC;YAED,IAAI,IAAI,EAAE,CAAC;gBACT,WAAW,CAAC,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;YACnC,CAAC;YAED,MAAM,QAAQ,GAAG,gBACf,WAAW,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,IAAI,WAAW,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,CAAC,EAC1D,EAAE,CAAC;YAEH,IAAI,CAAC;gBACH,MAAM,QAAQ,GAAG,MAAM,IAAA,oBAAW,EAChC,UAAU,CAAC,MAAM,EACjB,0BAAU,CAAC,GAAG,EACd,QAAQ,EACR,SAAS,EACT,SAAS,EACT,UAAU,CAAC,MAAM,CAClB,CAAC;gBAEF,OAAO,QAAQ,CAAC;YAClB,CAAC;YAAC,OAAO,KAAU,EAAE,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;wBACvF,gGAAgG,CACnG,CAAC;gBACJ,CAAC;gBACD,MAAM,KAAK,CAAC;YACd,CAAC;QACH,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ApitemplateAuth = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
+
const client_1 = require("./client");
|
|
7
|
+
const props_1 = require("./props");
|
|
8
|
+
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
9
|
+
exports.ApitemplateAuth = pieces_framework_1.PieceAuth.CustomAuth({
|
|
10
|
+
description: `
|
|
11
|
+
To obtain your API key:
|
|
12
|
+
1. Go to https://app.apitemplate.io/.
|
|
13
|
+
2. Navigate to API Integration section.
|
|
14
|
+
3. Copy your API key.
|
|
15
|
+
|
|
16
|
+
Select the region closest to your location for better performance.
|
|
17
|
+
`,
|
|
18
|
+
props: {
|
|
19
|
+
region: props_1.regionDropdown,
|
|
20
|
+
apiKey: pieces_framework_1.Property.ShortText({
|
|
21
|
+
displayName: 'API Key',
|
|
22
|
+
description: 'Your APITemplate.io API key',
|
|
23
|
+
required: true,
|
|
24
|
+
}),
|
|
25
|
+
},
|
|
26
|
+
required: true,
|
|
27
|
+
validate: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth }) {
|
|
28
|
+
if (!(auth === null || auth === void 0 ? void 0 : auth.apiKey)) {
|
|
29
|
+
return {
|
|
30
|
+
valid: false,
|
|
31
|
+
error: 'API Key is required',
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
if (!(auth === null || auth === void 0 ? void 0 : auth.region)) {
|
|
35
|
+
return {
|
|
36
|
+
valid: false,
|
|
37
|
+
error: 'Region selection is required',
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
// Type-safe auth casting
|
|
41
|
+
const authConfig = auth;
|
|
42
|
+
try {
|
|
43
|
+
const response = yield (0, client_1.makeRequest)(authConfig.apiKey, pieces_common_1.HttpMethod.GET, '/account-information', undefined, undefined, authConfig.region);
|
|
44
|
+
// Check if we got a valid response
|
|
45
|
+
if (response && response.status === 'success') {
|
|
46
|
+
return {
|
|
47
|
+
valid: true,
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
return {
|
|
51
|
+
valid: false,
|
|
52
|
+
error: 'Invalid API response. Please check your credentials.',
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
catch (error) {
|
|
56
|
+
return {
|
|
57
|
+
valid: false,
|
|
58
|
+
error: `Authentication failed: ${error.message || 'Invalid API Key or region configuration'}`,
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
}),
|
|
62
|
+
});
|
|
63
|
+
//# sourceMappingURL=auth.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/apitemplate-io/src/lib/common/auth.ts"],"names":[],"mappings":";;;;AAAA,qEAAqE;AACrE,qCAA8D;AAC9D,mCAAyC;AACzC,+DAAyD;AAE5C,QAAA,eAAe,GAAG,4BAAS,CAAC,UAAU,CAAC;IAClD,WAAW,EAAE;;;;;;;CAOd;IACC,KAAK,EAAE;QACL,MAAM,EAAE,sBAAc;QACtB,MAAM,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACzB,WAAW,EAAE,SAAS;YACtB,WAAW,EAAE,6BAA6B;YAC1C,QAAQ,EAAE,IAAI;SACf,CAAC;KACH;IACD,QAAQ,EAAE,IAAI;IACd,QAAQ,EAAE,KAAiB,EAAE,oDAAZ,EAAE,IAAI,EAAE;QACvB,IAAI,CAAC,CAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,MAAM,CAAA,EAAE,CAAC;YAClB,OAAO;gBACL,KAAK,EAAE,KAAK;gBACZ,KAAK,EAAE,qBAAqB;aAC7B,CAAC;QACJ,CAAC;QAED,IAAI,CAAC,CAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,MAAM,CAAA,EAAE,CAAC;YAClB,OAAO;gBACL,KAAK,EAAE,KAAK;gBACZ,KAAK,EAAE,8BAA8B;aACtC,CAAC;QACJ,CAAC;QAED,yBAAyB;QACzB,MAAM,UAAU,GAAG,IAA6B,CAAC;QAEjD,IAAI,CAAC;YACH,MAAM,QAAQ,GAAG,MAAM,IAAA,oBAAW,EAChC,UAAU,CAAC,MAAM,EACjB,0BAAU,CAAC,GAAG,EACd,sBAAsB,EACtB,SAAS,EACT,SAAS,EACT,UAAU,CAAC,MAAM,CAClB,CAAC;YAEF,mCAAmC;YACnC,IAAI,QAAQ,IAAI,QAAQ,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;gBAC9C,OAAO;oBACL,KAAK,EAAE,IAAI;iBACZ,CAAC;YACJ,CAAC;YAED,OAAO;gBACL,KAAK,EAAE,KAAK;gBACZ,KAAK,EAAE,sDAAsD;aAC9D,CAAC;QACJ,CAAC;QAAC,OAAO,KAAU,EAAE,CAAC;YACpB,OAAO;gBACL,KAAK,EAAE,KAAK;gBACZ,KAAK,EAAE,0BACL,KAAK,CAAC,OAAO,IAAI,yCACnB,EAAE;aACH,CAAC;QACJ,CAAC;IACH,CAAC,CAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { HttpMethod } from '@activepieces/pieces-common';
|
|
2
|
+
export declare const APITEMPLATE_REGIONS: {
|
|
3
|
+
readonly default: "https://rest.apitemplate.io";
|
|
4
|
+
readonly europe: "https://rest-de.apitemplate.io";
|
|
5
|
+
readonly us: "https://rest-us.apitemplate.io";
|
|
6
|
+
readonly australia: "https://rest-au.apitemplate.io";
|
|
7
|
+
readonly 'alt-default': "https://rest-alt.apitemplate.io";
|
|
8
|
+
readonly 'alt-europe': "https://rest-alt-de.apitemplate.io";
|
|
9
|
+
readonly 'alt-us': "https://rest-alt-us.apitemplate.io";
|
|
10
|
+
};
|
|
11
|
+
export type ApitemplateRegion = keyof typeof APITEMPLATE_REGIONS;
|
|
12
|
+
export interface ApitemplateAuthConfig {
|
|
13
|
+
apiKey: string;
|
|
14
|
+
region: ApitemplateRegion;
|
|
15
|
+
}
|
|
16
|
+
export declare const BASE_URL: "https://rest.apitemplate.io";
|
|
17
|
+
export declare function getRegionalBaseUrl(region?: ApitemplateRegion): string;
|
|
18
|
+
export declare function makeRequest(apiKey: string, method: HttpMethod, path: string, body?: unknown, headers?: Record<string, string> | string, region?: ApitemplateRegion): Promise<any>;
|