@activepieces/piece-carbone 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 +18 -0
- package/src/i18n/translation.json +107 -0
- package/src/index.d.ts +2 -0
- package/src/index.d.ts.map +1 -0
- package/src/index.js +45 -0
- package/src/index.js.map +1 -0
- package/src/lib/actions/delete-template.d.ts +4 -0
- package/src/lib/actions/delete-template.d.ts.map +1 -0
- package/src/lib/actions/delete-template.js +45 -0
- package/src/lib/actions/delete-template.js.map +1 -0
- package/src/lib/actions/list-categories.d.ts +2 -0
- package/src/lib/actions/list-categories.d.ts.map +1 -0
- package/src/lib/actions/list-categories.js +37 -0
- package/src/lib/actions/list-categories.js.map +1 -0
- package/src/lib/actions/list-tags.d.ts +2 -0
- package/src/lib/actions/list-tags.d.ts.map +1 -0
- package/src/lib/actions/list-tags.js +37 -0
- package/src/lib/actions/list-tags.js.map +1 -0
- package/src/lib/actions/list-templates.d.ts +10 -0
- package/src/lib/actions/list-templates.d.ts.map +1 -0
- package/src/lib/actions/list-templates.js +93 -0
- package/src/lib/actions/list-templates.js.map +1 -0
- package/src/lib/actions/render-document.d.ts +14 -0
- package/src/lib/actions/render-document.d.ts.map +1 -0
- package/src/lib/actions/render-document.js +137 -0
- package/src/lib/actions/render-document.js.map +1 -0
- package/src/lib/actions/update-template.d.ts +10 -0
- package/src/lib/actions/update-template.d.ts.map +1 -0
- package/src/lib/actions/update-template.js +96 -0
- package/src/lib/actions/update-template.js.map +1 -0
- package/src/lib/actions/upload-template.d.ts +11 -0
- package/src/lib/actions/upload-template.d.ts.map +1 -0
- package/src/lib/actions/upload-template.js +104 -0
- package/src/lib/actions/upload-template.js.map +1 -0
- package/src/lib/auth.d.ts +2 -0
- package/src/lib/auth.d.ts.map +1 -0
- package/src/lib/auth.js +34 -0
- package/src/lib/auth.js.map +1 -0
- package/src/lib/common/constants.d.ts +3 -0
- package/src/lib/common/constants.d.ts.map +1 -0
- package/src/lib/common/constants.js +6 -0
- package/src/lib/common/constants.js.map +1 -0
- package/src/lib/common/props.d.ts +10 -0
- package/src/lib/common/props.d.ts.map +1 -0
- package/src/lib/common/props.js +52 -0
- package/src/lib/common/props.js.map +1 -0
package/package.json
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@activepieces/piece-carbone",
|
|
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.0",
|
|
9
|
+
"@activepieces/pieces-framework": "0.26.0",
|
|
10
|
+
"@activepieces/shared": "0.46.0",
|
|
11
|
+
"form-data": "4.0.4",
|
|
12
|
+
"tslib": "2.6.2"
|
|
13
|
+
},
|
|
14
|
+
"scripts": {
|
|
15
|
+
"build": "tsc -p tsconfig.lib.json && cp package.json dist/",
|
|
16
|
+
"lint": "eslint 'src/**/*.ts'"
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
{
|
|
2
|
+
"Generate documents (PDF, DOCX, XLSX, ODS, and more) from templates and JSON data using the Carbone report generator.": "Generate documents (PDF, DOCX, XLSX, ODS, and more) from templates and JSON data using the Carbone report generator.",
|
|
3
|
+
"\nTo get your Carbone API key:\n1. Log in to your [Carbone account](https://account.carbone.io/)\n2. Navigate to **API keys** in your account settings.\n3. Create or copy your API key.\n": "\nTo get your Carbone API key:\n1. Log in to your [Carbone account](https://account.carbone.io/)\n2. Navigate to **API keys** in your account settings.\n3. Create or copy your API key.\n",
|
|
4
|
+
"Render Document": "Render Document",
|
|
5
|
+
"Upload Template": "Upload Template",
|
|
6
|
+
"Delete Template": "Delete Template",
|
|
7
|
+
"Update Template Metadata": "Update Template Metadata",
|
|
8
|
+
"List Templates": "List Templates",
|
|
9
|
+
"List Categories": "List Categories",
|
|
10
|
+
"List Tags": "List Tags",
|
|
11
|
+
"Custom API Call": "Custom API Call",
|
|
12
|
+
"Render a Carbone template with JSON data and download the generated document.": "Render a Carbone template with JSON data and download the generated document.",
|
|
13
|
+
"Upload a template file to Carbone and get a template ID for rendering.": "Upload a template file to Carbone and get a template ID for rendering.",
|
|
14
|
+
"Delete a Carbone template by its ID.": "Delete a Carbone template by its ID.",
|
|
15
|
+
"Update the metadata of an existing Carbone template.": "Update the metadata of an existing Carbone template.",
|
|
16
|
+
"Retrieve a list of deployed Carbone templates with filtering and pagination.": "Retrieve a list of deployed Carbone templates with filtering and pagination.",
|
|
17
|
+
"List all categories used to organize your Carbone templates.": "List all categories used to organize your Carbone templates.",
|
|
18
|
+
"List all tags used to organize your Carbone templates.": "List all tags used to organize your Carbone templates.",
|
|
19
|
+
"Make a custom API call to a specific endpoint": "Make a custom API call to a specific endpoint",
|
|
20
|
+
"Template ID": "Template ID",
|
|
21
|
+
"Data (JSON)": "Data (JSON)",
|
|
22
|
+
"Convert To (optional)": "Convert To (optional)",
|
|
23
|
+
"Language (optional)": "Language (optional)",
|
|
24
|
+
"PDF Converter (optional)": "PDF Converter (optional)",
|
|
25
|
+
"Timezone (optional)": "Timezone (optional)",
|
|
26
|
+
"Report Name (optional)": "Report Name (optional)",
|
|
27
|
+
"Complement Data (optional)": "Complement Data (optional)",
|
|
28
|
+
"Currency Source (optional)": "Currency Source (optional)",
|
|
29
|
+
"Currency Target (optional)": "Currency Target (optional)",
|
|
30
|
+
"Currency Rates (optional)": "Currency Rates (optional)",
|
|
31
|
+
"Template File": "Template File",
|
|
32
|
+
"Filename": "Filename",
|
|
33
|
+
"Enable Versioning (optional)": "Enable Versioning (optional)",
|
|
34
|
+
"Existing Template ID (optional)": "Existing Template ID (optional)",
|
|
35
|
+
"Template Name (optional)": "Template Name (optional)",
|
|
36
|
+
"Comment (optional)": "Comment (optional)",
|
|
37
|
+
"Category (optional)": "Category (optional)",
|
|
38
|
+
"Tags (optional)": "Tags (optional)",
|
|
39
|
+
"Template ID or Version ID": "Template ID or Version ID",
|
|
40
|
+
"Deployed At (optional)": "Deployed At (optional)",
|
|
41
|
+
"Expire At (optional)": "Expire At (optional)",
|
|
42
|
+
"Template ID Filter (optional)": "Template ID Filter (optional)",
|
|
43
|
+
"Version ID Filter (optional)": "Version ID Filter (optional)",
|
|
44
|
+
"Category Filter (optional)": "Category Filter (optional)",
|
|
45
|
+
"Search (optional)": "Search (optional)",
|
|
46
|
+
"Include All Versions": "Include All Versions",
|
|
47
|
+
"Limit (optional)": "Limit (optional)",
|
|
48
|
+
"Cursor (optional)": "Cursor (optional)",
|
|
49
|
+
"Method": "Method",
|
|
50
|
+
"Headers": "Headers",
|
|
51
|
+
"Query Parameters": "Query Parameters",
|
|
52
|
+
"Body Type": "Body Type",
|
|
53
|
+
"Body": "Body",
|
|
54
|
+
"Response is Binary ?": "Response is Binary ?",
|
|
55
|
+
"No Error on Failure": "No Error on Failure",
|
|
56
|
+
"Timeout (in seconds)": "Timeout (in seconds)",
|
|
57
|
+
"Follow redirects": "Follow redirects",
|
|
58
|
+
"Select a template to render.": "Select a template to render.",
|
|
59
|
+
"JSON object containing the data to inject into the template. Keys must match the `{d.variableName}` placeholders in your template.": "JSON object containing the data to inject into the template. Keys must match the `{d.variableName}` placeholders in your template.",
|
|
60
|
+
"Output format (e.g. `pdf`, `xlsx`, `csv`, `docx`). For PDF, you can also use advanced options via JSON like `{\"formatName\":\"pdf\",\"formatOptions\":{\"Watermark\":\"Confidential\"}}`.": "Output format (e.g. `pdf`, `xlsx`, `csv`, `docx`). For PDF, you can also use advanced options via JSON like `{\"formatName\":\"pdf\",\"formatOptions\":{\"Watermark\":\"Confidential\"}}`.",
|
|
61
|
+
"Locale for number/date formatting (e.g. `en-us`, `fr-fr`, `de-de`). Defaults to `en-us`.": "Locale for number/date formatting (e.g. `en-us`, `fr-fr`, `de-de`). Defaults to `en-us`.",
|
|
62
|
+
"PDF converter engine: **L** (LibreOffice, default - best balance), **O** (OnlyOffice - ideal for DOCX/XLSX/PPTX), **C** (Chromium - high-fidelity HTML-to-PDF). Only applies when convertTo is \"pdf\" or an object with formatName \"pdf\".": "PDF converter engine: **L** (LibreOffice, default - best balance), **O** (OnlyOffice - ideal for DOCX/XLSX/PPTX), **C** (Chromium - high-fidelity HTML-to-PDF). Only applies when convertTo is \"pdf\" or an object with formatName \"pdf\".",
|
|
63
|
+
"Timezone for date formatting (e.g. `Europe/Paris`, `America/New_York`). Defaults to UTC.": "Timezone for date formatting (e.g. `Europe/Paris`, `America/New_York`). Defaults to UTC.",
|
|
64
|
+
"Custom filename for the generated document. Can use template variables like `{d.date}`. Returned in Content-Disposition header.": "Custom filename for the generated document. Can use template variables like `{d.date}`. Returned in Content-Disposition header.",
|
|
65
|
+
"Extra data object merged into template with tags `{c.}` (complement prefix).": "Extra data object merged into template with tags `{c.}` (complement prefix).",
|
|
66
|
+
"Source currency code (e.g. `EUR`) for currency conversion. Use with Currency Target and Currency Rates.": "Source currency code (e.g. `EUR`) for currency conversion. Use with Currency Target and Currency Rates.",
|
|
67
|
+
"Target currency code (e.g. `USD`) for currency conversion. Used by formatC formatter.": "Target currency code (e.g. `USD`) for currency conversion. Used by formatC formatter.",
|
|
68
|
+
"Exchange rates object for currency conversion. Example: `{\"EUR\": 1, \"USD\": 1.14}`.": "Exchange rates object for currency conversion. Example: `{\"EUR\": 1, \"USD\": 1.14}`.",
|
|
69
|
+
"Supported formats: DOCX, XLSX, ODS, ODT, PPTX, CSV, HTML.": "Supported formats: DOCX, XLSX, ODS, ODT, PPTX, CSV, HTML.",
|
|
70
|
+
"The filename including extension (e.g. `invoice-template.docx`). The extension determines the output format.": "The filename including extension (e.g. `invoice-template.docx`). The extension determines the output format.",
|
|
71
|
+
"If enabled (default), creates a template ID that can hold multiple versions. If disabled, creates a standalone template (legacy mode).": "If enabled (default), creates a template ID that can hold multiple versions. If disabled, creates a standalone template (legacy mode).",
|
|
72
|
+
"If provided, adds this upload as a new version to an existing template ID. Only works when versioning is enabled.": "If provided, adds this upload as a new version to an existing template ID. Only works when versioning is enabled.",
|
|
73
|
+
"Friendly name for the template.": "Friendly name for the template.",
|
|
74
|
+
"Description or notes about the template.": "Description or notes about the template.",
|
|
75
|
+
"Category/folder to organize templates (e.g. \"invoices\", \"contracts\").": "Category/folder to organize templates (e.g. \"invoices\", \"contracts\").",
|
|
76
|
+
"Tags to categorize the template (e.g. \"v1\", \"2024\").": "Tags to categorize the template (e.g. \"v1\", \"2024\").",
|
|
77
|
+
"Select a template to delete.": "Select a template to delete.",
|
|
78
|
+
"Select a template to update.": "Select a template to update.",
|
|
79
|
+
"New name for the template.": "New name for the template.",
|
|
80
|
+
"New comment/description for the template.": "New comment/description for the template.",
|
|
81
|
+
"New category for the template.": "New category for the template.",
|
|
82
|
+
"Replace tags with a new list.": "Replace tags with a new list.",
|
|
83
|
+
"UTC Unix timestamp for when this version should be considered deployed. Values >= 42000000000 (year 3300) = \"NOW\". Used to determine active version.": "UTC Unix timestamp for when this version should be considered deployed. Values >= 42000000000 (year 3300) = \"NOW\". Used to determine active version.",
|
|
84
|
+
"UTC Unix timestamp for when to delete the template. Values >= 42000000000 (year 3300) = \"now\". This effectively schedules deletion.": "UTC Unix timestamp for when to delete the template. Values >= 42000000000 (year 3300) = \"now\". This effectively schedules deletion.",
|
|
85
|
+
"Filter by specific Template ID (64-bit format). Exact match.": "Filter by specific Template ID (64-bit format). Exact match.",
|
|
86
|
+
"Filter by specific Version ID (SHA256 format). Exact match.": "Filter by specific Version ID (SHA256 format). Exact match.",
|
|
87
|
+
"Filter by category name.": "Filter by category name.",
|
|
88
|
+
"Fuzzy search in template name, or exact match for ID/Version ID.": "Fuzzy search in template name, or exact match for ID/Version ID.",
|
|
89
|
+
"If checked, returns all versions for a specific template ID (when ID filter is provided).": "If checked, returns all versions for a specific template ID (when ID filter is provided).",
|
|
90
|
+
"Maximum number of templates to return. Default is 100.": "Maximum number of templates to return. Default is 100.",
|
|
91
|
+
"Pagination cursor for fetching the next set of results.": "Pagination cursor for fetching the next set of results.",
|
|
92
|
+
"Authorization headers are injected automatically from your connection.": "Authorization headers are injected automatically from your connection.",
|
|
93
|
+
"Enable for files like PDFs, images, etc.": "Enable for files like PDFs, images, etc.",
|
|
94
|
+
"LibreOffice (L) - Default": "LibreOffice (L) - Default",
|
|
95
|
+
"OnlyOffice (O) - Office docs": "OnlyOffice (O) - Office docs",
|
|
96
|
+
"Chromium (C) - HTML-to-PDF": "Chromium (C) - HTML-to-PDF",
|
|
97
|
+
"GET": "GET",
|
|
98
|
+
"POST": "POST",
|
|
99
|
+
"PATCH": "PATCH",
|
|
100
|
+
"PUT": "PUT",
|
|
101
|
+
"DELETE": "DELETE",
|
|
102
|
+
"HEAD": "HEAD",
|
|
103
|
+
"None": "None",
|
|
104
|
+
"JSON": "JSON",
|
|
105
|
+
"Form Data": "Form Data",
|
|
106
|
+
"Raw": "Raw"
|
|
107
|
+
}
|
package/src/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAaA,eAAO,MAAM,OAAO,mHA0BlB,CAAC"}
|
package/src/index.js
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.carbone = 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 render_document_1 = require("./lib/actions/render-document");
|
|
9
|
+
const upload_template_1 = require("./lib/actions/upload-template");
|
|
10
|
+
const delete_template_1 = require("./lib/actions/delete-template");
|
|
11
|
+
const update_template_1 = require("./lib/actions/update-template");
|
|
12
|
+
const list_templates_1 = require("./lib/actions/list-templates");
|
|
13
|
+
const list_categories_1 = require("./lib/actions/list-categories");
|
|
14
|
+
const list_tags_1 = require("./lib/actions/list-tags");
|
|
15
|
+
const auth_1 = require("./lib/auth");
|
|
16
|
+
const constants_1 = require("./lib/common/constants");
|
|
17
|
+
exports.carbone = (0, pieces_framework_1.createPiece)({
|
|
18
|
+
displayName: 'Carbone',
|
|
19
|
+
description: 'Generate documents (PDF, DOCX, XLSX, ODS, and more) from templates and JSON data using the Carbone report generator.',
|
|
20
|
+
auth: auth_1.carboneAuth,
|
|
21
|
+
minimumSupportedRelease: '0.30.0',
|
|
22
|
+
logoUrl: 'https://cdn.activepieces.com/pieces/carbone.png',
|
|
23
|
+
categories: [shared_1.PieceCategory.PRODUCTIVITY],
|
|
24
|
+
authors: ['Harmatta', 'onyedikachi-david'],
|
|
25
|
+
actions: [
|
|
26
|
+
render_document_1.renderDocumentAction,
|
|
27
|
+
upload_template_1.uploadTemplateAction,
|
|
28
|
+
delete_template_1.deleteTemplateAction,
|
|
29
|
+
update_template_1.updateTemplateAction,
|
|
30
|
+
list_templates_1.listTemplatesAction,
|
|
31
|
+
list_categories_1.listCategoriesAction,
|
|
32
|
+
list_tags_1.listTagsAction,
|
|
33
|
+
(0, pieces_common_1.createCustomApiCallAction)({
|
|
34
|
+
auth: auth_1.carboneAuth,
|
|
35
|
+
baseUrl: () => constants_1.CARBONE_API_URL,
|
|
36
|
+
authMapping: (auth) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
37
|
+
return ({
|
|
38
|
+
Authorization: `Bearer ${auth.secret_text}`,
|
|
39
|
+
});
|
|
40
|
+
}),
|
|
41
|
+
}),
|
|
42
|
+
],
|
|
43
|
+
triggers: [],
|
|
44
|
+
});
|
|
45
|
+
//# 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,mEAAqE;AACrE,mEAAqE;AACrE,mEAAqE;AACrE,mEAAqE;AACrE,iEAAmE;AACnE,mEAAqE;AACrE,uDAAyD;AACzD,qCAAyC;AACzC,sDAAyD;AAE5C,QAAA,OAAO,GAAG,IAAA,8BAAW,EAAC;IACjC,WAAW,EAAE,SAAS;IACtB,WAAW,EACT,sHAAsH;IACxH,IAAI,EAAE,kBAAW;IACjB,uBAAuB,EAAE,QAAQ;IACjC,OAAO,EAAE,iDAAiD;IAC1D,UAAU,EAAE,CAAC,sBAAa,CAAC,YAAY,CAAC;IACxC,OAAO,EAAE,CAAC,UAAU,EAAE,mBAAmB,CAAC;IAC1C,OAAO,EAAE;QACP,sCAAoB;QACpB,sCAAoB;QACpB,sCAAoB;QACpB,sCAAoB;QACpB,oCAAmB;QACnB,sCAAoB;QACpB,0BAAc;QACd,IAAA,yCAAyB,EAAC;YACxB,IAAI,EAAE,kBAAW;YACjB,OAAO,EAAE,GAAG,EAAE,CAAC,2BAAe;YAC9B,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,4 @@
|
|
|
1
|
+
export declare const deleteTemplateAction: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").SecretTextProperty<true>, {
|
|
2
|
+
templateId: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").SecretTextProperty<true>>;
|
|
3
|
+
}>;
|
|
4
|
+
//# sourceMappingURL=delete-template.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delete-template.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/delete-template.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,oBAAoB;;EAwC/B,CAAC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.deleteTemplateAction = 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 constants_1 = require("../common/constants");
|
|
8
|
+
const auth_1 = require("../auth");
|
|
9
|
+
const props_1 = require("../common/props");
|
|
10
|
+
exports.deleteTemplateAction = (0, pieces_framework_1.createAction)({
|
|
11
|
+
auth: auth_1.carboneAuth,
|
|
12
|
+
name: 'carbone_delete_template',
|
|
13
|
+
displayName: 'Delete Template',
|
|
14
|
+
description: 'Delete a Carbone template by its ID.',
|
|
15
|
+
props: {
|
|
16
|
+
templateId: props_1.carboneProps.templateDropdown({
|
|
17
|
+
displayName: 'Template ID or Version ID',
|
|
18
|
+
description: 'Select a template to delete.',
|
|
19
|
+
}),
|
|
20
|
+
},
|
|
21
|
+
run(context) {
|
|
22
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
23
|
+
var _a;
|
|
24
|
+
const { templateId } = context.propsValue;
|
|
25
|
+
const request = {
|
|
26
|
+
method: pieces_common_1.HttpMethod.DELETE,
|
|
27
|
+
url: `${constants_1.CARBONE_API_URL}/template/${templateId}`,
|
|
28
|
+
headers: {
|
|
29
|
+
Authorization: `Bearer ${context.auth.secret_text}`,
|
|
30
|
+
'carbone-version': constants_1.CARBONE_VERSION,
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
const response = yield pieces_common_1.httpClient.sendRequest(request);
|
|
34
|
+
if (!response.body.success) {
|
|
35
|
+
throw new Error(`Failed to delete template: ${(_a = response.body.error) !== null && _a !== void 0 ? _a : 'Unknown error'}`);
|
|
36
|
+
}
|
|
37
|
+
return {
|
|
38
|
+
success: true,
|
|
39
|
+
templateId,
|
|
40
|
+
message: `Template ${templateId} deleted successfully.`,
|
|
41
|
+
};
|
|
42
|
+
});
|
|
43
|
+
},
|
|
44
|
+
});
|
|
45
|
+
//# sourceMappingURL=delete-template.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delete-template.js","sourceRoot":"","sources":["../../../../src/lib/actions/delete-template.ts"],"names":[],"mappings":";;;;AAAA,qEAA8D;AAC9D,+DAIqC;AACrC,mDAAuE;AACvE,kCAAsC;AACtC,2CAA+C;AAElC,QAAA,oBAAoB,GAAG,IAAA,+BAAY,EAAC;IAC/C,IAAI,EAAE,kBAAW;IACjB,IAAI,EAAE,yBAAyB;IAC/B,WAAW,EAAE,iBAAiB;IAC9B,WAAW,EAAE,sCAAsC;IACnD,KAAK,EAAE;QACL,UAAU,EAAE,oBAAY,CAAC,gBAAgB,CAAC;YACxC,WAAW,EAAE,2BAA2B;YACxC,WAAW,EAAE,8BAA8B;SAC5C,CAAC;KACH;IACK,GAAG,CAAC,OAAO;;;YACf,MAAM,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC;YAE1C,MAAM,OAAO,GAAgB;gBAC3B,MAAM,EAAE,0BAAU,CAAC,MAAM;gBACzB,GAAG,EAAE,GAAG,2BAAe,aAAa,UAAU,EAAE;gBAChD,OAAO,EAAE;oBACP,aAAa,EAAE,UAAU,OAAO,CAAC,IAAI,CAAC,WAAW,EAAE;oBACnD,iBAAiB,EAAE,2BAAe;iBACnC;aACF,CAAC;YAEF,MAAM,QAAQ,GAAG,MAAM,0BAAU,CAAC,WAAW,CAG1C,OAAO,CAAC,CAAC;YAEZ,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;gBAC3B,MAAM,IAAI,KAAK,CACb,8BAA8B,MAAA,QAAQ,CAAC,IAAI,CAAC,KAAK,mCAAI,eAAe,EAAE,CACvE,CAAC;YACJ,CAAC;YAED,OAAO;gBACL,OAAO,EAAE,IAAI;gBACb,UAAU;gBACV,OAAO,EAAE,YAAY,UAAU,wBAAwB;aACxD,CAAC;QACJ,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-categories.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/list-categories.ts"],"names":[],"mappings":"AAWA,eAAO,MAAM,oBAAoB,yHAiC/B,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.listCategoriesAction = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const auth_1 = require("../auth");
|
|
6
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
7
|
+
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
8
|
+
const constants_1 = require("../common/constants");
|
|
9
|
+
exports.listCategoriesAction = (0, pieces_framework_1.createAction)({
|
|
10
|
+
auth: auth_1.carboneAuth,
|
|
11
|
+
name: 'carbone_list_categories',
|
|
12
|
+
displayName: 'List Categories',
|
|
13
|
+
description: 'List all categories used to organize your Carbone templates.',
|
|
14
|
+
props: {},
|
|
15
|
+
run(context) {
|
|
16
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
17
|
+
var _a;
|
|
18
|
+
const request = {
|
|
19
|
+
method: pieces_common_1.HttpMethod.GET,
|
|
20
|
+
url: `${constants_1.CARBONE_API_URL}/templates/categories`,
|
|
21
|
+
headers: {
|
|
22
|
+
Authorization: `Bearer ${context.auth.secret_text}`,
|
|
23
|
+
'carbone-version': constants_1.CARBONE_VERSION,
|
|
24
|
+
},
|
|
25
|
+
};
|
|
26
|
+
const response = yield pieces_common_1.httpClient.sendRequest(request);
|
|
27
|
+
if (!response.body.success) {
|
|
28
|
+
throw new Error(`Failed to list categories: ${(_a = response.body.error) !== null && _a !== void 0 ? _a : 'Unknown error'}`);
|
|
29
|
+
}
|
|
30
|
+
return {
|
|
31
|
+
categories: response.body.data.map((c) => c.name),
|
|
32
|
+
count: response.body.data.length,
|
|
33
|
+
};
|
|
34
|
+
});
|
|
35
|
+
},
|
|
36
|
+
});
|
|
37
|
+
//# sourceMappingURL=list-categories.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-categories.js","sourceRoot":"","sources":["../../../../src/lib/actions/list-categories.ts"],"names":[],"mappings":";;;;AAAA,kCAAsC;AACtC,qEAA8D;AAC9D,+DAIqC;AAErC,mDAAuE;AAG1D,QAAA,oBAAoB,GAAG,IAAA,+BAAY,EAAC;IAC/C,IAAI,EAAE,kBAAW;IACjB,IAAI,EAAE,yBAAyB;IAC/B,WAAW,EAAE,iBAAiB;IAC9B,WAAW,EAAE,8DAA8D;IAC3E,KAAK,EAAE,EAAE;IACH,GAAG,CAAC,OAAO;;;YACf,MAAM,OAAO,GAAgB;gBAC3B,MAAM,EAAE,0BAAU,CAAC,GAAG;gBACtB,GAAG,EAAE,GAAG,2BAAe,uBAAuB;gBAC9C,OAAO,EAAE;oBACP,aAAa,EAAE,UAAU,OAAO,CAAC,IAAI,CAAC,WAAW,EAAE;oBACnD,iBAAiB,EAAE,2BAAe;iBACnC;aACF,CAAC;YAEF,MAAM,QAAQ,GAAG,MAAM,0BAAU,CAAC,WAAW,CAI1C,OAAO,CAAC,CAAC;YAEZ,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;gBAC3B,MAAM,IAAI,KAAK,CACb,8BAA8B,MAAA,QAAQ,CAAC,IAAI,CAAC,KAAK,mCAAI,eAAe,EAAE,CACvE,CAAC;YACJ,CAAC;YAED,OAAO;gBACL,UAAU,EAAE,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;gBACjD,KAAK,EAAE,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM;aACjC,CAAC;QACJ,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-tags.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/list-tags.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,cAAc,yHAiCzB,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.listTagsAction = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const auth_1 = require("../auth");
|
|
6
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
7
|
+
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
8
|
+
const constants_1 = require("../common/constants");
|
|
9
|
+
exports.listTagsAction = (0, pieces_framework_1.createAction)({
|
|
10
|
+
auth: auth_1.carboneAuth,
|
|
11
|
+
name: 'carbone_list_tags',
|
|
12
|
+
displayName: 'List Tags',
|
|
13
|
+
description: 'List all tags used to organize your Carbone templates.',
|
|
14
|
+
props: {},
|
|
15
|
+
run(context) {
|
|
16
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
17
|
+
var _a;
|
|
18
|
+
const request = {
|
|
19
|
+
method: pieces_common_1.HttpMethod.GET,
|
|
20
|
+
url: `${constants_1.CARBONE_API_URL}/templates/tags`,
|
|
21
|
+
headers: {
|
|
22
|
+
Authorization: `Bearer ${context.auth.secret_text}`,
|
|
23
|
+
'carbone-version': constants_1.CARBONE_VERSION,
|
|
24
|
+
},
|
|
25
|
+
};
|
|
26
|
+
const response = yield pieces_common_1.httpClient.sendRequest(request);
|
|
27
|
+
if (!response.body.success) {
|
|
28
|
+
throw new Error(`Failed to list tags: ${(_a = response.body.error) !== null && _a !== void 0 ? _a : 'Unknown error'}`);
|
|
29
|
+
}
|
|
30
|
+
return {
|
|
31
|
+
tags: response.body.data.map((t) => t.name),
|
|
32
|
+
count: response.body.data.length,
|
|
33
|
+
};
|
|
34
|
+
});
|
|
35
|
+
},
|
|
36
|
+
});
|
|
37
|
+
//# sourceMappingURL=list-tags.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-tags.js","sourceRoot":"","sources":["../../../../src/lib/actions/list-tags.ts"],"names":[],"mappings":";;;;AAAA,kCAAsC;AACtC,qEAA8D;AAC9D,+DAIqC;AAErC,mDAAuE;AAE1D,QAAA,cAAc,GAAG,IAAA,+BAAY,EAAC;IACzC,IAAI,EAAE,kBAAW;IACjB,IAAI,EAAE,mBAAmB;IACzB,WAAW,EAAE,WAAW;IACxB,WAAW,EAAE,wDAAwD;IACrE,KAAK,EAAE,EAAE;IACH,GAAG,CAAC,OAAO;;;YACf,MAAM,OAAO,GAAgB;gBAC3B,MAAM,EAAE,0BAAU,CAAC,GAAG;gBACtB,GAAG,EAAE,GAAG,2BAAe,iBAAiB;gBACxC,OAAO,EAAE;oBACP,aAAa,EAAE,UAAU,OAAO,CAAC,IAAI,CAAC,WAAW,EAAE;oBACnD,iBAAiB,EAAE,2BAAe;iBACnC;aACF,CAAC;YAEF,MAAM,QAAQ,GAAG,MAAM,0BAAU,CAAC,WAAW,CAI1C,OAAO,CAAC,CAAC;YAEZ,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;gBAC3B,MAAM,IAAI,KAAK,CACb,wBAAwB,MAAA,QAAQ,CAAC,IAAI,CAAC,KAAK,mCAAI,eAAe,EAAE,CACjE,CAAC;YACJ,CAAC;YAED,OAAO;gBACL,IAAI,EAAE,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;gBAC3C,KAAK,EAAE,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM;aACjC,CAAC;QACJ,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare const listTemplatesAction: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").SecretTextProperty<true>, {
|
|
2
|
+
id: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
3
|
+
versionId: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
4
|
+
category: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
5
|
+
search: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
6
|
+
includeVersions: import("@activepieces/pieces-framework").CheckboxProperty<false>;
|
|
7
|
+
limit: import("@activepieces/pieces-framework").NumberProperty<false>;
|
|
8
|
+
cursor: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
9
|
+
}>;
|
|
10
|
+
//# sourceMappingURL=list-templates.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-templates.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/list-templates.ts"],"names":[],"mappings":"AAWA,eAAO,MAAM,mBAAmB;;;;;;;;EA8G9B,CAAC"}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.listTemplatesAction = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const auth_1 = require("../auth");
|
|
6
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
7
|
+
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
8
|
+
const constants_1 = require("../common/constants");
|
|
9
|
+
exports.listTemplatesAction = (0, pieces_framework_1.createAction)({
|
|
10
|
+
auth: auth_1.carboneAuth,
|
|
11
|
+
name: 'carbone_list_templates',
|
|
12
|
+
displayName: 'List Templates',
|
|
13
|
+
description: 'Retrieve a list of deployed Carbone templates with filtering and pagination.',
|
|
14
|
+
props: {
|
|
15
|
+
id: pieces_framework_1.Property.ShortText({
|
|
16
|
+
displayName: 'Template ID Filter (optional)',
|
|
17
|
+
required: false,
|
|
18
|
+
description: 'Filter by specific Template ID (64-bit format). Exact match.',
|
|
19
|
+
}),
|
|
20
|
+
versionId: pieces_framework_1.Property.ShortText({
|
|
21
|
+
displayName: 'Version ID Filter (optional)',
|
|
22
|
+
required: false,
|
|
23
|
+
description: 'Filter by specific Version ID (SHA256 format). Exact match.',
|
|
24
|
+
}),
|
|
25
|
+
category: pieces_framework_1.Property.ShortText({
|
|
26
|
+
displayName: 'Category Filter (optional)',
|
|
27
|
+
required: false,
|
|
28
|
+
description: 'Filter by category name.',
|
|
29
|
+
}),
|
|
30
|
+
search: pieces_framework_1.Property.ShortText({
|
|
31
|
+
displayName: 'Search (optional)',
|
|
32
|
+
required: false,
|
|
33
|
+
description: 'Fuzzy search in template name, or exact match for ID/Version ID.',
|
|
34
|
+
}),
|
|
35
|
+
includeVersions: pieces_framework_1.Property.Checkbox({
|
|
36
|
+
displayName: 'Include All Versions',
|
|
37
|
+
required: false,
|
|
38
|
+
defaultValue: false,
|
|
39
|
+
description: 'If checked, returns all versions for a specific template ID (when ID filter is provided).',
|
|
40
|
+
}),
|
|
41
|
+
limit: pieces_framework_1.Property.Number({
|
|
42
|
+
displayName: 'Limit (optional)',
|
|
43
|
+
required: false,
|
|
44
|
+
description: 'Maximum number of templates to return. Default is 100.',
|
|
45
|
+
}),
|
|
46
|
+
cursor: pieces_framework_1.Property.ShortText({
|
|
47
|
+
displayName: 'Cursor (optional)',
|
|
48
|
+
required: false,
|
|
49
|
+
description: 'Pagination cursor for fetching the next set of results.',
|
|
50
|
+
}),
|
|
51
|
+
},
|
|
52
|
+
run(context) {
|
|
53
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
54
|
+
var _a;
|
|
55
|
+
const { id, versionId, category, search, includeVersions, limit, cursor } = context.propsValue;
|
|
56
|
+
const queryParams = {};
|
|
57
|
+
if (id)
|
|
58
|
+
queryParams['id'] = id;
|
|
59
|
+
if (versionId)
|
|
60
|
+
queryParams['versionId'] = versionId;
|
|
61
|
+
if (category)
|
|
62
|
+
queryParams['category'] = category;
|
|
63
|
+
if (search)
|
|
64
|
+
queryParams['search'] = search;
|
|
65
|
+
if (includeVersions !== undefined)
|
|
66
|
+
queryParams['includeVersions'] = String(includeVersions);
|
|
67
|
+
if (limit)
|
|
68
|
+
queryParams['limit'] = String(limit);
|
|
69
|
+
if (cursor)
|
|
70
|
+
queryParams['cursor'] = cursor;
|
|
71
|
+
const request = {
|
|
72
|
+
method: pieces_common_1.HttpMethod.GET,
|
|
73
|
+
url: `${constants_1.CARBONE_API_URL}/templates`,
|
|
74
|
+
headers: {
|
|
75
|
+
Authorization: `Bearer ${context.auth.secret_text}`,
|
|
76
|
+
'carbone-version': constants_1.CARBONE_VERSION,
|
|
77
|
+
},
|
|
78
|
+
queryParams,
|
|
79
|
+
};
|
|
80
|
+
const response = yield pieces_common_1.httpClient.sendRequest(request);
|
|
81
|
+
if (!response.body.success) {
|
|
82
|
+
throw new Error(`Failed to list templates: ${(_a = response.body.error) !== null && _a !== void 0 ? _a : 'Unknown error'}`);
|
|
83
|
+
}
|
|
84
|
+
return {
|
|
85
|
+
templates: response.body.data,
|
|
86
|
+
hasMore: response.body.hasMore,
|
|
87
|
+
nextCursor: response.body.nextCursor,
|
|
88
|
+
count: response.body.data.length,
|
|
89
|
+
};
|
|
90
|
+
});
|
|
91
|
+
},
|
|
92
|
+
});
|
|
93
|
+
//# sourceMappingURL=list-templates.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-templates.js","sourceRoot":"","sources":["../../../../src/lib/actions/list-templates.ts"],"names":[],"mappings":";;;;AAAA,kCAAsC;AACtC,qEAAwE;AACxE,+DAIqC;AAErC,mDAAuE;AAG1D,QAAA,mBAAmB,GAAG,IAAA,+BAAY,EAAC;IAC9C,IAAI,EAAE,kBAAW;IACjB,IAAI,EAAE,wBAAwB;IAC9B,WAAW,EAAE,gBAAgB;IAC7B,WAAW,EACT,8EAA8E;IAChF,KAAK,EAAE;QACL,EAAE,EAAE,2BAAQ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@@
|
|
|
1
|
+
export declare const renderDocumentAction: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").SecretTextProperty<true>, {
|
|
2
|
+
templateId: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").SecretTextProperty<true>>;
|
|
3
|
+
data: import("@activepieces/pieces-framework").JsonProperty<true>;
|
|
4
|
+
convertTo: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
5
|
+
lang: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
6
|
+
converter: import("@activepieces/pieces-framework").StaticDropdownProperty<string, false>;
|
|
7
|
+
timezone: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
8
|
+
reportName: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
9
|
+
complement: import("@activepieces/pieces-framework").JsonProperty<false>;
|
|
10
|
+
currencySource: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
11
|
+
currencyTarget: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
12
|
+
currencyRates: import("@activepieces/pieces-framework").JsonProperty<false>;
|
|
13
|
+
}>;
|
|
14
|
+
//# sourceMappingURL=render-document.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render-document.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/render-document.ts"],"names":[],"mappings":"AAWA,eAAO,MAAM,oBAAoB;;;;;;;;;;;;EAgJ/B,CAAC"}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.renderDocumentAction = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const auth_1 = require("../auth");
|
|
6
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
7
|
+
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
8
|
+
const constants_1 = require("../common/constants");
|
|
9
|
+
const props_1 = require("../common/props");
|
|
10
|
+
exports.renderDocumentAction = (0, pieces_framework_1.createAction)({
|
|
11
|
+
auth: auth_1.carboneAuth,
|
|
12
|
+
name: 'carbone_render_document',
|
|
13
|
+
displayName: 'Render Document',
|
|
14
|
+
description: 'Render a Carbone template with JSON data and download the generated document.',
|
|
15
|
+
props: {
|
|
16
|
+
templateId: props_1.carboneProps.templateDropdown({
|
|
17
|
+
displayName: 'Template ID',
|
|
18
|
+
description: 'Select a template to render.',
|
|
19
|
+
showIdInLabel: false,
|
|
20
|
+
}),
|
|
21
|
+
data: pieces_framework_1.Property.Json({
|
|
22
|
+
displayName: 'Data (JSON)',
|
|
23
|
+
required: true,
|
|
24
|
+
description: 'JSON object containing the data to inject into the template. Keys must match the `{d.variableName}` placeholders in your template.',
|
|
25
|
+
}),
|
|
26
|
+
convertTo: pieces_framework_1.Property.ShortText({
|
|
27
|
+
displayName: 'Convert To (optional)',
|
|
28
|
+
required: false,
|
|
29
|
+
description: 'Output format (e.g. `pdf`, `xlsx`, `csv`, `docx`). For PDF, you can also use advanced options via JSON like `{"formatName":"pdf","formatOptions":{"Watermark":"Confidential"}}`.',
|
|
30
|
+
}),
|
|
31
|
+
lang: pieces_framework_1.Property.ShortText({
|
|
32
|
+
displayName: 'Language (optional)',
|
|
33
|
+
required: false,
|
|
34
|
+
description: 'Locale for number/date formatting (e.g. `en-us`, `fr-fr`, `de-de`). Defaults to `en-us`.',
|
|
35
|
+
}),
|
|
36
|
+
converter: pieces_framework_1.Property.StaticDropdown({
|
|
37
|
+
displayName: 'PDF Converter (optional)',
|
|
38
|
+
required: false,
|
|
39
|
+
description: 'PDF converter engine: **L** (LibreOffice, default - best balance), **O** (OnlyOffice - ideal for DOCX/XLSX/PPTX), **C** (Chromium - high-fidelity HTML-to-PDF). Only applies when convertTo is "pdf" or an object with formatName "pdf".',
|
|
40
|
+
options: {
|
|
41
|
+
options: [
|
|
42
|
+
{ label: 'LibreOffice (L) - Default', value: 'L' },
|
|
43
|
+
{ label: 'OnlyOffice (O) - Office docs', value: 'O' },
|
|
44
|
+
{ label: 'Chromium (C) - HTML-to-PDF', value: 'C' },
|
|
45
|
+
],
|
|
46
|
+
},
|
|
47
|
+
}),
|
|
48
|
+
timezone: pieces_framework_1.Property.ShortText({
|
|
49
|
+
displayName: 'Timezone (optional)',
|
|
50
|
+
required: false,
|
|
51
|
+
description: 'Timezone for date formatting (e.g. `Europe/Paris`, `America/New_York`). Defaults to UTC.',
|
|
52
|
+
}),
|
|
53
|
+
reportName: pieces_framework_1.Property.ShortText({
|
|
54
|
+
displayName: 'Report Name (optional)',
|
|
55
|
+
required: false,
|
|
56
|
+
description: 'Custom filename for the generated document. Can use template variables like `{d.date}`. Returned in Content-Disposition header.',
|
|
57
|
+
}),
|
|
58
|
+
complement: pieces_framework_1.Property.Json({
|
|
59
|
+
displayName: 'Complement Data (optional)',
|
|
60
|
+
required: false,
|
|
61
|
+
description: 'Extra data object merged into template with tags `{c.}` (complement prefix).',
|
|
62
|
+
}),
|
|
63
|
+
currencySource: pieces_framework_1.Property.ShortText({
|
|
64
|
+
displayName: 'Currency Source (optional)',
|
|
65
|
+
required: false,
|
|
66
|
+
description: 'Source currency code (e.g. `EUR`) for currency conversion. Use with Currency Target and Currency Rates.',
|
|
67
|
+
}),
|
|
68
|
+
currencyTarget: pieces_framework_1.Property.ShortText({
|
|
69
|
+
displayName: 'Currency Target (optional)',
|
|
70
|
+
required: false,
|
|
71
|
+
description: 'Target currency code (e.g. `USD`) for currency conversion. Used by formatC formatter.',
|
|
72
|
+
}),
|
|
73
|
+
currencyRates: pieces_framework_1.Property.Json({
|
|
74
|
+
displayName: 'Currency Rates (optional)',
|
|
75
|
+
required: false,
|
|
76
|
+
description: 'Exchange rates object for currency conversion. Example: `{"EUR": 1, "USD": 1.14}`.',
|
|
77
|
+
}),
|
|
78
|
+
},
|
|
79
|
+
run(context) {
|
|
80
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
81
|
+
var _a, _b, _c, _d;
|
|
82
|
+
const { templateId, data, convertTo, converter, lang, timezone, reportName, complement, currencySource, currencyTarget, currencyRates } = context.propsValue;
|
|
83
|
+
const body = {
|
|
84
|
+
data: data,
|
|
85
|
+
convertTo: convertTo || undefined,
|
|
86
|
+
converter: converter || undefined,
|
|
87
|
+
lang: lang || 'en-us',
|
|
88
|
+
timezone: timezone || 'UTC',
|
|
89
|
+
reportName: reportName || undefined,
|
|
90
|
+
complement: complement || undefined,
|
|
91
|
+
currencySource: currencySource || undefined,
|
|
92
|
+
currencyTarget: currencyTarget || undefined,
|
|
93
|
+
currencyRates: currencyRates || undefined,
|
|
94
|
+
};
|
|
95
|
+
Object.keys(body).forEach((key) => {
|
|
96
|
+
if (body[key] === undefined) {
|
|
97
|
+
delete body[key];
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
// Call render with download=true to get file directly (v5 feature)
|
|
101
|
+
const renderRequest = {
|
|
102
|
+
method: pieces_common_1.HttpMethod.POST,
|
|
103
|
+
url: `${constants_1.CARBONE_API_URL}/render/${templateId}?download=true`,
|
|
104
|
+
headers: {
|
|
105
|
+
Authorization: `Bearer ${context.auth.secret_text}`,
|
|
106
|
+
'carbone-version': constants_1.CARBONE_VERSION,
|
|
107
|
+
'Content-Type': 'application/json',
|
|
108
|
+
},
|
|
109
|
+
body,
|
|
110
|
+
responseType: 'arraybuffer',
|
|
111
|
+
};
|
|
112
|
+
const renderResponse = yield pieces_common_1.httpClient.sendRequest(renderRequest);
|
|
113
|
+
const fileBuffer = Buffer.from(renderResponse.body);
|
|
114
|
+
// Determine the content-type from the response headers
|
|
115
|
+
const contentType = (_b = (_a = renderResponse.headers) === null || _a === void 0 ? void 0 : _a['content-type']) !== null && _b !== void 0 ? _b : 'application/octet-stream';
|
|
116
|
+
const contentDispositionHeader = (_d = (_c = renderResponse.headers) === null || _c === void 0 ? void 0 : _c['content-disposition']) !== null && _d !== void 0 ? _d : '';
|
|
117
|
+
const contentDisposition = Array.isArray(contentDispositionHeader)
|
|
118
|
+
? contentDispositionHeader[0]
|
|
119
|
+
: contentDispositionHeader;
|
|
120
|
+
// Extract filename from Content-Disposition if available
|
|
121
|
+
const filenameMatch = contentDisposition.match(/filename="?([^"]+)"?/);
|
|
122
|
+
const filename = filenameMatch ? filenameMatch[1] : `report-${Date.now()}`;
|
|
123
|
+
// Save file
|
|
124
|
+
const file = yield context.files.write({
|
|
125
|
+
fileName: filename,
|
|
126
|
+
data: fileBuffer,
|
|
127
|
+
});
|
|
128
|
+
return {
|
|
129
|
+
filename,
|
|
130
|
+
contentType,
|
|
131
|
+
file,
|
|
132
|
+
sizeBytes: fileBuffer.length,
|
|
133
|
+
};
|
|
134
|
+
});
|
|
135
|
+
},
|
|
136
|
+
});
|
|
137
|
+
//# sourceMappingURL=render-document.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render-document.js","sourceRoot":"","sources":["../../../../src/lib/actions/render-document.ts"],"names":[],"mappings":";;;;AAAA,kCAAsC;AACtC,qEAAwE;AACxE,+DAIqC;AAErC,mDAAuE;AACvE,2CAA+C;AAElC,QAAA,oBAAoB,GAAG,IAAA,+BAAY,EAAC;IAC/C,IAAI,EAAE,kBAAW;IACjB,IAAI,EAAE,yBAAyB;IAC/B,WAAW,EAAE,iBAAiB;IAC9B,WAAW,EAAE,+EAA+E;IAC5F,KAAK,EAAE;QACL,UAAU,EAAE,oBAAY,CAAC,gBAAgB,CAAC;YACxC,WAAW,EAAE,aAAa;YAC1B,WAAW,EAAE,8BAA8B;YAC3C,aAAa,EAAE,KAAK;SACrB,CAAC;QACF,IAAI,EAAE,2BAAQ,CAAC,IAAI,CAAC;YAClB,WAAW,EAAE,aAAa;YAC1B,QAAQ,EAAE,IAAI;YACd,WAAW,EACT,oIAAoI;SACvI,CAAC;QACF,SAAS,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC5B,WAAW,EAAE,uBAAuB;YACpC,QAAQ,EAAE,KAAK;YACf,WAAW,EACT,kLAAkL;SACrL,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5B,CAAC;YAEF,MAAM,cAAc,GAAG,MAAM,0BAAU,CAAC,WAAW,CAAc,aAAa,CAAC,CAAC;YAEhF,MAAM,UAAU,GAAG,MAAM,CAAC,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;YAEpD,uDAAuD;YACvD,MAAM,WAAW,GACf,MAAA,MAAA,cAAc,CAAC,OAAO,0CAAG,cAAc,CAAC,mCAAI,0BAA0B,CAAC;YACzE,MAAM,wBAAwB,GAC5B,MAAA,MAAA,cAAc,CAAC,OAAO,0CAAG,qBAAqB,CAAC,mCAAI,EAAE,CAAC;YACxD,MAAM,kBAAkB,GAAG,KAAK,CAAC,OAAO,CAAC,wBAAwB,CAAC;gBAChE,CAAC,CAAC,wBAAwB,CAAC,CAAC,CAAC;gBAC7B,CAAC,CAAC,wBAAwB,CAAC;YAE7B,yDAAyD;YACzD,MAAM,aAAa,GAAG,kBAAkB,CAAC,KAAK,CAAC,sBAAsB,CAAC,CAAC;YACvE,MAAM,QAAQ,GAAG,aAAa,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,UAAU,IAAI,CAAC,GAAG,EAAE,EAAE,CAAC;YAE3E,YAAY;YACZ,MAAM,IAAI,GAAG,MAAM,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC;gBACrC,QAAQ,EAAE,QAAQ;gBAClB,IAAI,EAAE,UAAU;aACjB,CAAC,CAAC;YAEH,OAAO;gBACL,QAAQ;gBACR,WAAW;gBACX,IAAI;gBACJ,SAAS,EAAE,UAAU,CAAC,MAAM;aAC7B,CAAC;QACJ,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare const updateTemplateAction: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").SecretTextProperty<true>, {
|
|
2
|
+
templateId: import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").SecretTextProperty<true>>;
|
|
3
|
+
name: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
4
|
+
comment: import("@activepieces/pieces-framework").LongTextProperty<false>;
|
|
5
|
+
category: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
6
|
+
tags: import("@activepieces/pieces-framework").ArrayProperty<true> | import("@activepieces/pieces-framework").ArrayProperty<false>;
|
|
7
|
+
deployedAt: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
8
|
+
expireAt: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
9
|
+
}>;
|
|
10
|
+
//# sourceMappingURL=update-template.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-template.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/update-template.ts"],"names":[],"mappings":"AAYA,eAAO,MAAM,oBAAoB;;;;;;;;EA6F/B,CAAC"}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.updateTemplateAction = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const auth_1 = require("../auth");
|
|
6
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
7
|
+
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
8
|
+
const constants_1 = require("../common/constants");
|
|
9
|
+
const props_1 = require("../common/props");
|
|
10
|
+
exports.updateTemplateAction = (0, pieces_framework_1.createAction)({
|
|
11
|
+
auth: auth_1.carboneAuth,
|
|
12
|
+
name: 'carbone_update_template',
|
|
13
|
+
displayName: 'Update Template Metadata',
|
|
14
|
+
description: 'Update the metadata of an existing Carbone template.',
|
|
15
|
+
props: {
|
|
16
|
+
templateId: props_1.carboneProps.templateDropdown({
|
|
17
|
+
displayName: 'Template ID or Version ID',
|
|
18
|
+
description: 'Select a template to update.',
|
|
19
|
+
}),
|
|
20
|
+
name: pieces_framework_1.Property.ShortText({
|
|
21
|
+
displayName: 'Template Name (optional)',
|
|
22
|
+
required: false,
|
|
23
|
+
description: 'New name for the template.',
|
|
24
|
+
}),
|
|
25
|
+
comment: pieces_framework_1.Property.LongText({
|
|
26
|
+
displayName: 'Comment (optional)',
|
|
27
|
+
required: false,
|
|
28
|
+
description: 'New comment/description for the template.',
|
|
29
|
+
}),
|
|
30
|
+
category: pieces_framework_1.Property.ShortText({
|
|
31
|
+
displayName: 'Category (optional)',
|
|
32
|
+
required: false,
|
|
33
|
+
description: 'New category for the template.',
|
|
34
|
+
}),
|
|
35
|
+
tags: pieces_framework_1.Property.Array({
|
|
36
|
+
displayName: 'Tags (optional)',
|
|
37
|
+
required: false,
|
|
38
|
+
description: 'Replace tags with a new list.',
|
|
39
|
+
properties: {
|
|
40
|
+
tag: pieces_framework_1.Property.ShortText({
|
|
41
|
+
displayName: 'Tag',
|
|
42
|
+
required: true,
|
|
43
|
+
}),
|
|
44
|
+
}
|
|
45
|
+
}),
|
|
46
|
+
deployedAt: pieces_framework_1.Property.ShortText({
|
|
47
|
+
displayName: 'Deployed At (optional)',
|
|
48
|
+
required: false,
|
|
49
|
+
description: 'UTC Unix timestamp for when this version should be considered deployed. Values >= 42000000000 (year 3300) = "NOW". Used to determine active version.',
|
|
50
|
+
}),
|
|
51
|
+
expireAt: pieces_framework_1.Property.ShortText({
|
|
52
|
+
displayName: 'Expire At (optional)',
|
|
53
|
+
required: false,
|
|
54
|
+
description: 'UTC Unix timestamp for when to delete the template. Values >= 42000000000 (year 3300) = "now". This effectively schedules deletion.',
|
|
55
|
+
}),
|
|
56
|
+
},
|
|
57
|
+
run(context) {
|
|
58
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
59
|
+
var _a;
|
|
60
|
+
const { templateId, name, comment, category, tags, deployedAt, expireAt } = context.propsValue;
|
|
61
|
+
const body = {};
|
|
62
|
+
if (name !== undefined)
|
|
63
|
+
body['name'] = name;
|
|
64
|
+
if (comment !== undefined)
|
|
65
|
+
body['comment'] = comment;
|
|
66
|
+
if (category !== undefined)
|
|
67
|
+
body['category'] = category;
|
|
68
|
+
if (tags !== undefined)
|
|
69
|
+
body['tags'] = tags.map((t) => t.tag);
|
|
70
|
+
if (deployedAt !== undefined)
|
|
71
|
+
body['deployedAt'] = Number(deployedAt);
|
|
72
|
+
if (expireAt !== undefined)
|
|
73
|
+
body['expireAt'] = Number(expireAt);
|
|
74
|
+
const request = {
|
|
75
|
+
method: pieces_common_1.HttpMethod.PATCH,
|
|
76
|
+
url: `${constants_1.CARBONE_API_URL}/template/${templateId}`,
|
|
77
|
+
headers: {
|
|
78
|
+
Authorization: `Bearer ${context.auth.secret_text}`,
|
|
79
|
+
'carbone-version': constants_1.CARBONE_VERSION,
|
|
80
|
+
'Content-Type': 'application/json',
|
|
81
|
+
},
|
|
82
|
+
body,
|
|
83
|
+
};
|
|
84
|
+
const response = yield pieces_common_1.httpClient.sendRequest(request);
|
|
85
|
+
if (!response.body.success) {
|
|
86
|
+
throw new Error(`Failed to update template: ${(_a = response.body.error) !== null && _a !== void 0 ? _a : 'Unknown error'}`);
|
|
87
|
+
}
|
|
88
|
+
return {
|
|
89
|
+
success: true,
|
|
90
|
+
templateId,
|
|
91
|
+
updated: body,
|
|
92
|
+
};
|
|
93
|
+
});
|
|
94
|
+
},
|
|
95
|
+
});
|
|
96
|
+
//# sourceMappingURL=update-template.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-template.js","sourceRoot":"","sources":["../../../../src/lib/actions/update-template.ts"],"names":[],"mappings":";;;;AAAA,kCAAsC;AACtC,qEAAwE;AACxE,+DAIqC;AAErC,mDAAuE;AACvE,2CAA+C;AAGlC,QAAA,oBAAoB,GAAG,IAAA,+BAAY,EAAC;IAC/C,IAAI,EAAE,kBAAW;IACjB,IAAI,EAAE,yBAAyB;IAC/B,WAAW,EAAE,0BAA0B;IACvC,WAAW,EAAE,sDAAsD;IACnE,KAAK,EAAE;QACL,UAAU,EAAE,oBAAY,CAAC,gBAAgB,CAAC;Y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0 +1,11 @@
|
|
|
1
|
+
export declare const uploadTemplateAction: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").SecretTextProperty<true>, {
|
|
2
|
+
file: import("@activepieces/pieces-framework").FileProperty<true>;
|
|
3
|
+
filename: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
4
|
+
versioning: import("@activepieces/pieces-framework").CheckboxProperty<false>;
|
|
5
|
+
existingTemplateId: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
6
|
+
name: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
7
|
+
comment: import("@activepieces/pieces-framework").LongTextProperty<false>;
|
|
8
|
+
category: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
9
|
+
tags: import("@activepieces/pieces-framework").ArrayProperty<true> | import("@activepieces/pieces-framework").ArrayProperty<false>;
|
|
10
|
+
}>;
|
|
11
|
+
//# sourceMappingURL=upload-template.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"upload-template.d.ts","sourceRoot":"","sources":["../../../../src/lib/actions/upload-template.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,oBAAoB;;;;;;;;;EAiH/B,CAAC"}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.uploadTemplateAction = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const form_data_1 = tslib_1.__importDefault(require("form-data"));
|
|
6
|
+
const auth_1 = require("../auth");
|
|
7
|
+
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
8
|
+
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
9
|
+
const constants_1 = require("../common/constants");
|
|
10
|
+
exports.uploadTemplateAction = (0, pieces_framework_1.createAction)({
|
|
11
|
+
auth: auth_1.carboneAuth,
|
|
12
|
+
name: 'carbone_upload_template',
|
|
13
|
+
displayName: 'Upload Template',
|
|
14
|
+
description: 'Upload a template file to Carbone and get a template ID for rendering.',
|
|
15
|
+
props: {
|
|
16
|
+
file: pieces_framework_1.Property.File({
|
|
17
|
+
displayName: 'Template File',
|
|
18
|
+
required: true,
|
|
19
|
+
description: 'Supported formats: DOCX, XLSX, ODS, ODT, PPTX, CSV, HTML.',
|
|
20
|
+
}),
|
|
21
|
+
filename: pieces_framework_1.Property.ShortText({
|
|
22
|
+
displayName: 'Filename',
|
|
23
|
+
required: true,
|
|
24
|
+
description: 'The filename including extension (e.g. `invoice-template.docx`). The extension determines the output format.',
|
|
25
|
+
}),
|
|
26
|
+
versioning: pieces_framework_1.Property.Checkbox({
|
|
27
|
+
displayName: 'Enable Versioning (optional)',
|
|
28
|
+
required: false,
|
|
29
|
+
defaultValue: true,
|
|
30
|
+
description: 'If enabled (default), creates a template ID that can hold multiple versions. If disabled, creates a standalone template (legacy mode).',
|
|
31
|
+
}),
|
|
32
|
+
existingTemplateId: pieces_framework_1.Property.ShortText({
|
|
33
|
+
displayName: 'Existing Template ID (optional)',
|
|
34
|
+
required: false,
|
|
35
|
+
description: 'If provided, adds this upload as a new version to an existing template ID. Only works when versioning is enabled.',
|
|
36
|
+
}),
|
|
37
|
+
name: pieces_framework_1.Property.ShortText({
|
|
38
|
+
displayName: 'Template Name (optional)',
|
|
39
|
+
required: false,
|
|
40
|
+
description: 'Friendly name for the template.',
|
|
41
|
+
}),
|
|
42
|
+
comment: pieces_framework_1.Property.LongText({
|
|
43
|
+
displayName: 'Comment (optional)',
|
|
44
|
+
required: false,
|
|
45
|
+
description: 'Description or notes about the template.',
|
|
46
|
+
}),
|
|
47
|
+
category: pieces_framework_1.Property.ShortText({
|
|
48
|
+
displayName: 'Category (optional)',
|
|
49
|
+
required: false,
|
|
50
|
+
description: 'Category/folder to organize templates (e.g. "invoices", "contracts").',
|
|
51
|
+
}),
|
|
52
|
+
tags: pieces_framework_1.Property.Array({
|
|
53
|
+
displayName: 'Tags (optional)',
|
|
54
|
+
required: false,
|
|
55
|
+
description: 'Tags to categorize the template (e.g. "v1", "2024").',
|
|
56
|
+
properties: {
|
|
57
|
+
tag: pieces_framework_1.Property.ShortText({
|
|
58
|
+
displayName: 'Tag',
|
|
59
|
+
required: true,
|
|
60
|
+
})
|
|
61
|
+
}
|
|
62
|
+
}),
|
|
63
|
+
},
|
|
64
|
+
run(context) {
|
|
65
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
66
|
+
var _a, _b;
|
|
67
|
+
const { file, filename, versioning, existingTemplateId, name, comment, category, tags } = context.propsValue;
|
|
68
|
+
// Metadata fields must come before the template file in Carbone v5
|
|
69
|
+
const form = new form_data_1.default();
|
|
70
|
+
if (versioning !== undefined)
|
|
71
|
+
form.append('versioning', String(versioning));
|
|
72
|
+
if (existingTemplateId)
|
|
73
|
+
form.append('id', existingTemplateId);
|
|
74
|
+
if (name)
|
|
75
|
+
form.append('name', name);
|
|
76
|
+
if (comment)
|
|
77
|
+
form.append('comment', comment);
|
|
78
|
+
if (category)
|
|
79
|
+
form.append('category', category);
|
|
80
|
+
if (tags && tags.length > 0)
|
|
81
|
+
form.append('tags', JSON.stringify(tags.map((t) => t.tag)));
|
|
82
|
+
// Template file must be last in Carbone v5
|
|
83
|
+
form.append('template', Buffer.from(file.base64, 'base64'), filename);
|
|
84
|
+
const response = yield pieces_common_1.httpClient.sendRequest({
|
|
85
|
+
method: pieces_common_1.HttpMethod.POST,
|
|
86
|
+
url: `${constants_1.CARBONE_API_URL}/template`,
|
|
87
|
+
headers: Object.assign({ Authorization: `Bearer ${context.auth.secret_text}`, 'carbone-version': constants_1.CARBONE_VERSION }, form.getHeaders()),
|
|
88
|
+
body: form,
|
|
89
|
+
});
|
|
90
|
+
if (!response.body.success) {
|
|
91
|
+
throw new Error(`Failed to upload template: ${(_a = response.body.error) !== null && _a !== void 0 ? _a : 'Unknown error'}`);
|
|
92
|
+
}
|
|
93
|
+
return {
|
|
94
|
+
templateId: (_b = response.body.data.id) !== null && _b !== void 0 ? _b : response.body.data.templateId,
|
|
95
|
+
versionId: response.body.data.versionId,
|
|
96
|
+
filename,
|
|
97
|
+
type: response.body.data.type,
|
|
98
|
+
size: response.body.data.size,
|
|
99
|
+
createdAt: response.body.data.createdAt,
|
|
100
|
+
};
|
|
101
|
+
});
|
|
102
|
+
},
|
|
103
|
+
});
|
|
104
|
+
//# sourceMappingURL=upload-template.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"upload-template.js","sourceRoot":"","sources":["../../../../src/lib/actions/upload-template.ts"],"names":[],"mappings":";;;;AAAA,kEAAiC;AACjC,kCAAsC;AACtC,qEAAwE;AACxE,+DAAqE;AACrE,mDAAuE;AAG1D,QAAA,oBAAoB,GAAG,IAAA,+BAAY,EAAC;IAC/C,IAAI,EAAE,kBAAW;IACjB,IAAI,EAAE,yBAAyB;IAC/B,WAAW,EAAE,iBAAiB;IAC9B,WAAW,EAAE,wEAAwE;IACrF,KAAK,EAAE;QACL,IAAI,EAAE,2BAAQ,CAAC,IAAI,CAAC;YAClB,WAAW,EAAE,eAAe;YAC5B,QAAQ,EAAE,IAAI;YACd,WAAW,EACT,2DAA2D;SAC9D,CAAC;QACF,QAAQ,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC3B,WAAW,EAAE,UAAU;YACvB,QAAQ,EAAE,IAAI;YACd,WAAW,EACT,8GAA8G;SACjH,CAAC;QACF,UAAU,EAAE,2BAAQ,CAAC,QAAQ,CAAC;YAC5B,WAAW,EAAE,8BAA8B;YAC3C,QAAQ,EAAE,KAAK;YACf,YAAY,EAAE,IAAI;YAClB,WAAW,EACT,wIAAwI;SAC3I,CAAC;QACF,kBAAkB,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACrC,WAAW,EAAE,iCAAiC;YAC9C,QAAQ,EAAE,KAAK;YACf,WAAW,EACT,mHAAmH;SACtH,CAAC;QACF,IAAI,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACvB,WAAW,EAAE,0BAA0B;YAC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AI;gBAC7B,SAAS,EAAE,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS;aACxC,CAAC;QACJ,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../../src/lib/auth.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,WAAW,mEAyBtB,CAAC"}
|
package/src/lib/auth.js
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.carboneAuth = 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 constants_1 = require("./common/constants");
|
|
8
|
+
exports.carboneAuth = pieces_framework_1.PieceAuth.SecretText({
|
|
9
|
+
displayName: 'API Key',
|
|
10
|
+
required: true,
|
|
11
|
+
description: `
|
|
12
|
+
To get your Carbone API key:
|
|
13
|
+
1. Log in to your [Carbone account](https://account.carbone.io/)
|
|
14
|
+
2. Navigate to **API keys** in your account settings.
|
|
15
|
+
3. Create or copy your API key.
|
|
16
|
+
`,
|
|
17
|
+
validate: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth }) {
|
|
18
|
+
try {
|
|
19
|
+
yield pieces_common_1.httpClient.sendRequest({
|
|
20
|
+
method: pieces_common_1.HttpMethod.GET,
|
|
21
|
+
url: `${constants_1.CARBONE_API_URL}/templates?limit=1`,
|
|
22
|
+
headers: {
|
|
23
|
+
Authorization: `Bearer ${auth}`,
|
|
24
|
+
'carbone-version': constants_1.CARBONE_VERSION,
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
return { valid: true };
|
|
28
|
+
}
|
|
29
|
+
catch (_b) {
|
|
30
|
+
return { valid: false, error: 'Invalid API key' };
|
|
31
|
+
}
|
|
32
|
+
}),
|
|
33
|
+
});
|
|
34
|
+
//# sourceMappingURL=auth.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../../src/lib/auth.ts"],"names":[],"mappings":";;;;AAAA,qEAA2D;AAC3D,+DAAqE;AACrE,kDAAsE;AAEzD,QAAA,WAAW,GAAG,4BAAS,CAAC,UAAU,CAAC;IAC9C,WAAW,EAAE,SAAS;IACtB,QAAQ,EAAE,IAAI;IACd,WAAW,EAAE;;;;;CAKd;IACC,QAAQ,EAAE,KAAiB,EAAE,oDAAZ,EAAE,IAAI,EAAE;QACvB,IAAI,CAAC;YACH,MAAM,0BAAU,CAAC,WAAW,CAAuC;gBACjE,MAAM,EAAE,0BAAU,CAAC,GAAG;gBACtB,GAAG,EAAE,GAAG,2BAAe,oBAAoB;gBAC3C,OAAO,EAAE;oBACP,aAAa,EAAE,UAAU,IAAI,EAAE;oBAC/B,iBAAiB,EAAE,2BAAe;iBACnC;aACF,CAAC,CAAC;YAEH,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;QACzB,CAAC;QAAC,WAAM,CAAC;YACP,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":"constants.d.ts","sourceRoot":"","sources":["../../../../src/lib/common/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,eAAe,2BAA2B,CAAC;AACxD,eAAO,MAAM,eAAe,MAAM,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../src/lib/common/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,eAAe,GAAG,wBAAwB,CAAC;AAC3C,QAAA,eAAe,GAAG,GAAG,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
declare function templateDropdown({ displayName, description, showIdInLabel, }: {
|
|
2
|
+
displayName: string;
|
|
3
|
+
description: string;
|
|
4
|
+
showIdInLabel?: boolean;
|
|
5
|
+
}): import("@activepieces/pieces-framework").DropdownProperty<string, true, import("@activepieces/pieces-framework").SecretTextProperty<true>>;
|
|
6
|
+
export declare const carboneProps: {
|
|
7
|
+
templateDropdown: typeof templateDropdown;
|
|
8
|
+
};
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=props.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"props.d.ts","sourceRoot":"","sources":["../../../../src/lib/common/props.ts"],"names":[],"mappings":"AAKA,iBAAS,gBAAgB,CAAC,EACxB,WAAW,EACX,WAAW,EACX,aAAoB,GACrB,EAAE;IACD,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB,8IAyCA;AAED,eAAO,MAAM,YAAY;;CAExB,CAAC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.carboneProps = 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("../auth");
|
|
8
|
+
const constants_1 = require("./constants");
|
|
9
|
+
function templateDropdown({ displayName, description, showIdInLabel = true, }) {
|
|
10
|
+
return pieces_framework_1.Property.Dropdown({
|
|
11
|
+
auth: auth_1.carboneAuth,
|
|
12
|
+
displayName,
|
|
13
|
+
required: true,
|
|
14
|
+
description,
|
|
15
|
+
refreshers: [],
|
|
16
|
+
options: (_a) => tslib_1.__awaiter(this, [_a], void 0, function* ({ auth }) {
|
|
17
|
+
if (!auth) {
|
|
18
|
+
return { disabled: true, placeholder: 'Connect your account first', options: [] };
|
|
19
|
+
}
|
|
20
|
+
try {
|
|
21
|
+
const response = yield pieces_common_1.httpClient.sendRequest({
|
|
22
|
+
method: pieces_common_1.HttpMethod.GET,
|
|
23
|
+
url: `${constants_1.CARBONE_API_URL}/templates`,
|
|
24
|
+
headers: {
|
|
25
|
+
Authorization: `Bearer ${auth}`,
|
|
26
|
+
'carbone-version': constants_1.CARBONE_VERSION,
|
|
27
|
+
},
|
|
28
|
+
queryParams: { limit: '100' },
|
|
29
|
+
});
|
|
30
|
+
if (!response.body.success) {
|
|
31
|
+
return { disabled: false, placeholder: 'Failed to fetch templates', options: [] };
|
|
32
|
+
}
|
|
33
|
+
return {
|
|
34
|
+
disabled: false,
|
|
35
|
+
options: response.body.data.map((template) => ({
|
|
36
|
+
label: showIdInLabel
|
|
37
|
+
? `${template.name || template.id} (${template.id})`
|
|
38
|
+
: template.name || template.id,
|
|
39
|
+
value: template.id,
|
|
40
|
+
})),
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
catch (_b) {
|
|
44
|
+
return { disabled: false, placeholder: 'Error loading templates', options: [] };
|
|
45
|
+
}
|
|
46
|
+
}),
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
exports.carboneProps = {
|
|
50
|
+
templateDropdown,
|
|
51
|
+
};
|
|
52
|
+
//# sourceMappingURL=props.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"props.js","sourceRoot":"","sources":["../../../../src/lib/common/props.ts"],"names":[],"mappings":";;;;AAAA,qEAA0D;AAC1D,+DAAqE;AACrE,kCAAsC;AACtC,2CAA+D;AAE/D,SAAS,gBAAgB,CAAC,EACxB,WAAW,EACX,WAAW,EACX,aAAa,GAAG,IAAI,GAKrB;IACC,OAAO,2BAAQ,CAAC,QAAQ,CAAC;QACvB,IAAI,EAAE,kBAAW;QACjB,WAAW;QACX,QAAQ,EAAE,IAAI;QACd,WAAW;QACX,U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