juneezee-testtest 0.1.14
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/LICENSE.md +19 -0
- package/README.md +55 -0
- package/dist/credentials/CraftMyPdfApi.credentials.d.ts +10 -0
- package/dist/credentials/CraftMyPdfApi.credentials.js +36 -0
- package/dist/credentials/CraftMyPdfApi.credentials.js.map +1 -0
- package/dist/icons/craftmypdf.svg +1 -0
- package/dist/nodes/CraftMyPdf/CraftMyPdf.node.d.ts +5 -0
- package/dist/nodes/CraftMyPdf/CraftMyPdf.node.js +231 -0
- package/dist/nodes/CraftMyPdf/CraftMyPdf.node.js.map +1 -0
- package/dist/nodes/CraftMyPdf/CraftMyPdf.node.json +18 -0
- package/dist/nodes/CraftMyPdf/GenericFunctions.d.ts +4 -0
- package/dist/nodes/CraftMyPdf/GenericFunctions.js +62 -0
- package/dist/nodes/CraftMyPdf/GenericFunctions.js.map +1 -0
- package/dist/nodes/CraftMyPdf/descriptions/AccountDescription.d.ts +2 -0
- package/dist/nodes/CraftMyPdf/descriptions/AccountDescription.js +26 -0
- package/dist/nodes/CraftMyPdf/descriptions/AccountDescription.js.map +1 -0
- package/dist/nodes/CraftMyPdf/descriptions/ImageDescription.d.ts +3 -0
- package/dist/nodes/CraftMyPdf/descriptions/ImageDescription.js +148 -0
- package/dist/nodes/CraftMyPdf/descriptions/ImageDescription.js.map +1 -0
- package/dist/nodes/CraftMyPdf/descriptions/PdfDescription.d.ts +3 -0
- package/dist/nodes/CraftMyPdf/descriptions/PdfDescription.js +400 -0
- package/dist/nodes/CraftMyPdf/descriptions/PdfDescription.js.map +1 -0
- package/dist/nodes/CraftMyPdf/descriptions/SharedFields.d.ts +2 -0
- package/dist/nodes/CraftMyPdf/descriptions/SharedFields.js +54 -0
- package/dist/nodes/CraftMyPdf/descriptions/SharedFields.js.map +1 -0
- package/dist/nodes/CraftMyPdf/descriptions/TransactionDescription.d.ts +3 -0
- package/dist/nodes/CraftMyPdf/descriptions/TransactionDescription.js +60 -0
- package/dist/nodes/CraftMyPdf/descriptions/TransactionDescription.js.map +1 -0
- package/dist/package.json +60 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +60 -0
package/LICENSE.md
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
Copyright 2022 n8n
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
4
|
+
this software and associated documentation files (the "Software"), to deal in
|
|
5
|
+
the Software without restriction, including without limitation the rights to
|
|
6
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
|
7
|
+
of the Software, and to permit persons to whom the Software is furnished to do
|
|
8
|
+
so, subject to the following conditions:
|
|
9
|
+
|
|
10
|
+
The above copyright notice and this permission notice shall be included in all
|
|
11
|
+
copies or substantial portions of the Software.
|
|
12
|
+
|
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
16
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
17
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
18
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
19
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# n8n-nodes-craftmypdf
|
|
2
|
+
|
|
3
|
+
This is an n8n community node. It lets you use [CraftMyPdf](https://craftmypdf.com) in your n8n workflows.
|
|
4
|
+
|
|
5
|
+
[CraftMyPdf](https://craftmypdf.com) offers PDF generation API and image generation API. CraftMyPDF's advanced drag & drop editor lets you design PDF templates in any browser and generate pixel-perfect PDF documents from reusable templates and data with no-code platforms such as N8n, Zapier, Make, Bubble.io or REST API.
|
|
6
|
+
|
|
7
|
+
[n8n](https://n8n.io/) is a [fair-code licensed](https://docs.n8n.io/sustainable-use-license/) workflow automation platform.
|
|
8
|
+
|
|
9
|
+
The sections:
|
|
10
|
+
|
|
11
|
+
- [Installation](#installation)
|
|
12
|
+
- [Operations](#operations)
|
|
13
|
+
- [Credentials](#credentials) <!-- delete if no auth needed -->
|
|
14
|
+
- [Compatibility](#compatibility)
|
|
15
|
+
- [Usage](#usage) <!-- delete if not using this section -->
|
|
16
|
+
- [Resources](#resources)
|
|
17
|
+
- [License](#license)
|
|
18
|
+
|
|
19
|
+
## Installation
|
|
20
|
+
|
|
21
|
+
Follow the [installation guide](https://docs.n8n.io/integrations/community-nodes/installation/) in the n8n community nodes documentation.
|
|
22
|
+
|
|
23
|
+
## Operations
|
|
24
|
+
|
|
25
|
+
The following are the options:
|
|
26
|
+
|
|
27
|
+
| Name | Operation | Description | Action | Documentation Link |
|
|
28
|
+
| ------------- | -------------- | ---------------------------------------------------------------------------------------------------------------------------- | --------------------------- | ----------------------------------------------------------------------------------------------- |
|
|
29
|
+
| Create | `create` | Creates a PDF file with JSON data and your template. | Create a PDF | [Link](https://craftmypdf.com/docs/index.html#tag/PDF-Generation-API/operation/create) |
|
|
30
|
+
| Create Async | `createAsync` | Creates a PDF file asynchronously with JSON data and your template. The API returns immediately, and will retry for 3 times. | Create a PDF asynchronously | [Link](https://craftmypdf.com/docs/index.html#tag/PDF-Generation-API/operation/create-async) |
|
|
31
|
+
| Merge | `merge` | Merges multiple PDF URLs. | Merge multiple PDF files | [Link](https://craftmypdf.com/docs/index.html#tag/PDF-Manipulation-API/operation/merge-pdfs) |
|
|
32
|
+
| Add Watermark | `addWatermark` | Adds a watermark to a PDF. | Add watermark | [Link](https://craftmypdf.com/docs/index.html#tag/PDF-Manipulation-API/operation/add-watermark) |
|
|
33
|
+
|
|
34
|
+
## Credentials
|
|
35
|
+
|
|
36
|
+
You only need a CraftMyPdf API Key for this, you can get it in the API Integration tab in the web portal.
|
|
37
|
+
|
|
38
|
+
## Compatibility
|
|
39
|
+
|
|
40
|
+
Compatible with n8n@1.60.0 or later
|
|
41
|
+
|
|
42
|
+
## Usage
|
|
43
|
+
|
|
44
|
+
Please check out the [CraftMyPdf API Reference](https://craftmypdf.com/docs/index.html) for more information on how to use the integration.
|
|
45
|
+
|
|
46
|
+
Please check out the [N8n integration tutorial](https://craftmypdf.com/blog/automate-pdf-generation-with-n8n-and-craftmypdf/) for more information.
|
|
47
|
+
|
|
48
|
+
## License
|
|
49
|
+
|
|
50
|
+
CraftMyPDF/n8n-nodes-craftmypdf is licensed under the [MIT License](LICENSE.md).
|
|
51
|
+
|
|
52
|
+
## Resources
|
|
53
|
+
|
|
54
|
+
- [n8n community nodes documentation](https://docs.n8n.io/integrations/#community-nodes)
|
|
55
|
+
- [CraftMyPdf API Reference](https://craftmypdf.com/docs/index.html)
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { IAuthenticateGeneric, Icon, ICredentialTestRequest, ICredentialType, INodeProperties } from 'n8n-workflow';
|
|
2
|
+
export declare class CraftMyPdfApi implements ICredentialType {
|
|
3
|
+
name: string;
|
|
4
|
+
displayName: string;
|
|
5
|
+
icon: Icon;
|
|
6
|
+
documentationUrl: string;
|
|
7
|
+
properties: INodeProperties[];
|
|
8
|
+
authenticate: IAuthenticateGeneric;
|
|
9
|
+
test: ICredentialTestRequest;
|
|
10
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CraftMyPdfApi = void 0;
|
|
4
|
+
class CraftMyPdfApi {
|
|
5
|
+
constructor() {
|
|
6
|
+
this.name = 'craftMyPdfApi';
|
|
7
|
+
this.displayName = 'CraftMyPDF API';
|
|
8
|
+
this.icon = 'file:../icons/craftmypdf.svg';
|
|
9
|
+
this.documentationUrl = 'https://craftmypdf.com/docs/index.html#section/Authentication';
|
|
10
|
+
this.properties = [
|
|
11
|
+
{
|
|
12
|
+
displayName: 'API Key',
|
|
13
|
+
name: 'apiKey',
|
|
14
|
+
type: 'string',
|
|
15
|
+
typeOptions: { password: true },
|
|
16
|
+
default: '',
|
|
17
|
+
},
|
|
18
|
+
];
|
|
19
|
+
this.authenticate = {
|
|
20
|
+
type: 'generic',
|
|
21
|
+
properties: {
|
|
22
|
+
headers: {
|
|
23
|
+
'X-API-KEY': '={{$credentials.apiKey}}',
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
this.test = {
|
|
28
|
+
request: {
|
|
29
|
+
baseURL: 'https://api.craftmypdf.com/v1',
|
|
30
|
+
url: '/get-account-info',
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
exports.CraftMyPdfApi = CraftMyPdfApi;
|
|
36
|
+
//# sourceMappingURL=CraftMyPdfApi.credentials.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CraftMyPdfApi.credentials.js","sourceRoot":"","sources":["../../credentials/CraftMyPdfApi.credentials.ts"],"names":[],"mappings":";;;AAQA,MAAa,aAAa;IAA1B;QACC,SAAI,GAAG,eAAe,CAAC;QAEvB,gBAAW,GAAG,gBAAgB,CAAC;QAE/B,SAAI,GAAS,8BAA8B,CAAC;QAE5C,qBAAgB,GAAG,+DAA+D,CAAC;QAEnF,eAAU,GAAsB;YAC/B;gBACC,WAAW,EAAE,SAAS;gBACtB,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE;gBAC/B,OAAO,EAAE,EAAE;aACX;SACD,CAAC;QAEF,iBAAY,GAAyB;YACpC,IAAI,EAAE,SAAS;YACf,UAAU,EAAE;gBACX,OAAO,EAAE;oBACR,WAAW,EAAE,0BAA0B;iBACvC;aACD;SACD,CAAC;QAEF,SAAI,GAA2B;YAC9B,OAAO,EAAE;gBACR,OAAO,EAAE,+BAA+B;gBACxC,GAAG,EAAE,mBAAmB;aACxB;SACD,CAAC;IACH,CAAC;CAAA;AAlCD,sCAkCC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" version="1.2" viewBox="0 0 20 31"><path fill="#fc384c" d="M7.7 1.5V30l.1.3.2.3.4.1.3-.1L18 24l.4-.4.4-.5.2-.5.1-.6.2-13.7-.1-.6q0-.3-.2-.5l-.3-.5-.5-.4L8.8.7 8.4.6l-.3.2-.2.2-.1.4z"/><path fill="#fc384c" d="M3.7 3.8 3.6 29l.1.2.1.2h.3l.2-.1 1.8-2 .3-.4.2-.5.2-.5V6l-.1-.5-.1-.5-.3-.4-.4-.3-1.4-.9h-.3l-.2.1-.2.1-.1.3z" opacity=".8"/><path fill="#ff2e00" d="M.4 5.6v21l.1.2.1.1.2.1.2-.1 1.1-.6.3-.2.2-.3.1-.3.1-.4V7l-.1-.4-.1-.3-.2-.3-.3-.2-1-.6-.2-.1H.6l-.1.2-.1.2z" opacity=".4"/></svg>
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type IExecuteFunctions, type INodeExecutionData, type INodeType, type INodeTypeDescription } from 'n8n-workflow';
|
|
2
|
+
export declare class CraftMyPdf implements INodeType {
|
|
3
|
+
description: INodeTypeDescription;
|
|
4
|
+
execute(this: IExecuteFunctions): Promise<INodeExecutionData[][] | null>;
|
|
5
|
+
}
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CraftMyPdf = void 0;
|
|
4
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
5
|
+
const AccountDescription_1 = require("./descriptions/AccountDescription");
|
|
6
|
+
const ImageDescription_1 = require("./descriptions/ImageDescription");
|
|
7
|
+
const PdfDescription_1 = require("./descriptions/PdfDescription");
|
|
8
|
+
const SharedFields_1 = require("./descriptions/SharedFields");
|
|
9
|
+
const TransactionDescription_1 = require("./descriptions/TransactionDescription");
|
|
10
|
+
const GenericFunctions_1 = require("./GenericFunctions");
|
|
11
|
+
class CraftMyPdf {
|
|
12
|
+
constructor() {
|
|
13
|
+
this.description = {
|
|
14
|
+
displayName: 'CraftMyPdf',
|
|
15
|
+
name: 'craftMyPdf',
|
|
16
|
+
icon: 'file:../../icons/craftmypdf.svg',
|
|
17
|
+
group: ['transform'],
|
|
18
|
+
version: 1,
|
|
19
|
+
subtitle: '={{ $parameter["operation"] + ": " + $parameter["resource"] }}',
|
|
20
|
+
description: 'Consume the CraftMyPDF API',
|
|
21
|
+
defaults: {
|
|
22
|
+
name: 'CraftMyPDF',
|
|
23
|
+
},
|
|
24
|
+
usableAsTool: true,
|
|
25
|
+
inputs: [n8n_workflow_1.NodeConnectionTypes.Main],
|
|
26
|
+
outputs: [n8n_workflow_1.NodeConnectionTypes.Main],
|
|
27
|
+
credentials: [
|
|
28
|
+
{
|
|
29
|
+
name: 'craftMyPdfApi',
|
|
30
|
+
required: true,
|
|
31
|
+
},
|
|
32
|
+
],
|
|
33
|
+
properties: [
|
|
34
|
+
{
|
|
35
|
+
displayName: 'Resource',
|
|
36
|
+
name: 'resource',
|
|
37
|
+
type: 'options',
|
|
38
|
+
noDataExpression: true,
|
|
39
|
+
options: [
|
|
40
|
+
{
|
|
41
|
+
name: 'Account',
|
|
42
|
+
value: 'account',
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
name: 'Image',
|
|
46
|
+
value: 'image',
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
name: 'PDF',
|
|
50
|
+
value: 'pdf',
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
name: 'Transaction',
|
|
54
|
+
value: 'transaction',
|
|
55
|
+
},
|
|
56
|
+
],
|
|
57
|
+
default: 'account',
|
|
58
|
+
},
|
|
59
|
+
SharedFields_1.regionField,
|
|
60
|
+
...AccountDescription_1.accountOperations,
|
|
61
|
+
...ImageDescription_1.imageOperations,
|
|
62
|
+
...ImageDescription_1.imageFields,
|
|
63
|
+
...PdfDescription_1.pdfOperations,
|
|
64
|
+
...PdfDescription_1.pdfFields,
|
|
65
|
+
...TransactionDescription_1.transactionOperations,
|
|
66
|
+
...TransactionDescription_1.transactionFields,
|
|
67
|
+
],
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
async execute() {
|
|
71
|
+
const items = this.getInputData();
|
|
72
|
+
const returnData = [];
|
|
73
|
+
const length = items.length;
|
|
74
|
+
let responseData;
|
|
75
|
+
const resource = this.getNodeParameter('resource', 0);
|
|
76
|
+
const operation = this.getNodeParameter('operation', 0);
|
|
77
|
+
for (let i = 0; i < length; i++) {
|
|
78
|
+
try {
|
|
79
|
+
let region = this.getNodeParameter('region', i);
|
|
80
|
+
if (!region)
|
|
81
|
+
region = 'api';
|
|
82
|
+
if (resource === 'account') {
|
|
83
|
+
if (operation === 'get') {
|
|
84
|
+
responseData = await GenericFunctions_1.craftMyPdfApiRequest.call(this, 'GET', region, '/get-account-info');
|
|
85
|
+
returnData.push(responseData);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
if (resource === 'image') {
|
|
89
|
+
if (operation === 'create') {
|
|
90
|
+
const data = (0, GenericFunctions_1.validateJSON)(this.getNodeParameter('data', i));
|
|
91
|
+
if (data === undefined) {
|
|
92
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Data: Invalid JSON', {
|
|
93
|
+
itemIndex: i,
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
const export_type = this.getNodeParameter('export_type', i);
|
|
97
|
+
const output_file = this.getNodeParameter('output_file', i);
|
|
98
|
+
const body = {
|
|
99
|
+
template_id: this.getNodeParameter('templateId', i),
|
|
100
|
+
data,
|
|
101
|
+
version: this.getNodeParameter('version', i),
|
|
102
|
+
export_type,
|
|
103
|
+
expiration: this.getNodeParameter('expiration', i),
|
|
104
|
+
output_file,
|
|
105
|
+
output_type: this.getNodeParameter('output_type', i),
|
|
106
|
+
};
|
|
107
|
+
if (export_type === 'json') {
|
|
108
|
+
responseData = await GenericFunctions_1.craftMyPdfApiRequest.call(this, 'POST', region, '/create-image', {}, body);
|
|
109
|
+
returnData.push(responseData);
|
|
110
|
+
}
|
|
111
|
+
if (export_type === 'file') {
|
|
112
|
+
const binaryData = await GenericFunctions_1.returnFileExportType.call(this, 'POST', region, '/create-image', output_file, body);
|
|
113
|
+
returnData.push(binaryData);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
if (resource === 'pdf') {
|
|
118
|
+
if (operation === 'create') {
|
|
119
|
+
const data = (0, GenericFunctions_1.validateJSON)(this.getNodeParameter('data', i));
|
|
120
|
+
if (data === undefined) {
|
|
121
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Data: Invalid JSON', {
|
|
122
|
+
itemIndex: i,
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
const export_type = this.getNodeParameter('export_type', i);
|
|
126
|
+
const output_file = this.getNodeParameter('output_file', i);
|
|
127
|
+
const password_protected = this.getNodeParameter('password_protected', i);
|
|
128
|
+
const resize_images = this.getNodeParameter('resize_images', i);
|
|
129
|
+
const body = {
|
|
130
|
+
template_id: this.getNodeParameter('templateId', i),
|
|
131
|
+
data,
|
|
132
|
+
version: this.getNodeParameter('version', i),
|
|
133
|
+
export_type,
|
|
134
|
+
expiration: this.getNodeParameter('expiration', i),
|
|
135
|
+
output_file,
|
|
136
|
+
password_protected,
|
|
137
|
+
image_resample_res: this.getNodeParameter('image_resample_res', i),
|
|
138
|
+
resize_images,
|
|
139
|
+
};
|
|
140
|
+
if (password_protected) {
|
|
141
|
+
body.password = this.getNodeParameter('password', i);
|
|
142
|
+
}
|
|
143
|
+
if (resize_images) {
|
|
144
|
+
body.resize_max_width = this.getNodeParameter('resize_max_width', i);
|
|
145
|
+
body.resize_max_height = this.getNodeParameter('resize_max_height', i);
|
|
146
|
+
body.resize_format = this.getNodeParameter('resize_format', i);
|
|
147
|
+
}
|
|
148
|
+
if (export_type === 'json') {
|
|
149
|
+
responseData = await GenericFunctions_1.craftMyPdfApiRequest.call(this, 'POST', region, '/create', {}, body);
|
|
150
|
+
returnData.push(responseData);
|
|
151
|
+
}
|
|
152
|
+
if (export_type === 'file') {
|
|
153
|
+
const binaryData = await GenericFunctions_1.returnFileExportType.call(this, 'POST', region, '/create', output_file, body);
|
|
154
|
+
returnData.push(binaryData);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
if (operation === 'createAsync') {
|
|
158
|
+
const data = (0, GenericFunctions_1.validateJSON)(this.getNodeParameter('data', i));
|
|
159
|
+
if (data === undefined) {
|
|
160
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Data: Invalid JSON', {
|
|
161
|
+
itemIndex: i,
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
const resize_images = this.getNodeParameter('resize_images', i);
|
|
165
|
+
const body = {
|
|
166
|
+
template_id: this.getNodeParameter('templateId', i),
|
|
167
|
+
data,
|
|
168
|
+
version: this.getNodeParameter('version', i),
|
|
169
|
+
expiration: this.getNodeParameter('expiration', i),
|
|
170
|
+
webhook_url: this.getNodeParameter('webhook_url', i),
|
|
171
|
+
image_resample_res: this.getNodeParameter('image_resample_res', i),
|
|
172
|
+
resize_images,
|
|
173
|
+
};
|
|
174
|
+
if (resize_images) {
|
|
175
|
+
body.resize_max_width = this.getNodeParameter('resize_max_width', i);
|
|
176
|
+
body.resize_max_height = this.getNodeParameter('resize_max_height', i);
|
|
177
|
+
body.resize_format = this.getNodeParameter('resize_format', i);
|
|
178
|
+
}
|
|
179
|
+
responseData = await GenericFunctions_1.craftMyPdfApiRequest.call(this, 'POST', region, '/create-async', {}, body);
|
|
180
|
+
returnData.push(responseData);
|
|
181
|
+
}
|
|
182
|
+
if (operation === 'merge') {
|
|
183
|
+
const urls = this.getNodeParameter('urls', i);
|
|
184
|
+
const body = {
|
|
185
|
+
urls: urls.map((data) => data.url),
|
|
186
|
+
expiration: this.getNodeParameter('expiration', i),
|
|
187
|
+
output_file: this.getNodeParameter('output_file', i),
|
|
188
|
+
};
|
|
189
|
+
responseData = await GenericFunctions_1.craftMyPdfApiRequest.call(this, 'POST', region, '/merge-pdfs', {}, body);
|
|
190
|
+
returnData.push(responseData);
|
|
191
|
+
}
|
|
192
|
+
if (operation === 'addWatermark') {
|
|
193
|
+
const body = {
|
|
194
|
+
url: this.getNodeParameter('url', i),
|
|
195
|
+
text: this.getNodeParameter('text', i),
|
|
196
|
+
font_size: this.getNodeParameter('font_size', i),
|
|
197
|
+
opacity: this.getNodeParameter('opacity', i),
|
|
198
|
+
rotation: this.getNodeParameter('rotation', i),
|
|
199
|
+
hex_color: this.getNodeParameter('hex_color', i),
|
|
200
|
+
font_family: this.getNodeParameter('font_family', i),
|
|
201
|
+
expiration: this.getNodeParameter('expiration', i),
|
|
202
|
+
output_file: this.getNodeParameter('output_file', i),
|
|
203
|
+
};
|
|
204
|
+
responseData = await GenericFunctions_1.craftMyPdfApiRequest.call(this, 'POST', region, '/add-watermark', {}, body);
|
|
205
|
+
returnData.push(responseData);
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
if (resource === 'transaction') {
|
|
209
|
+
if (operation === 'list') {
|
|
210
|
+
const qs = {
|
|
211
|
+
limit: this.getNodeParameter('limit', i),
|
|
212
|
+
offset: this.getNodeParameter('offset', i),
|
|
213
|
+
};
|
|
214
|
+
responseData = await GenericFunctions_1.craftMyPdfApiRequest.call(this, 'GET', region, '/list-transactions', qs);
|
|
215
|
+
returnData.push(responseData);
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
catch (error) {
|
|
220
|
+
if (this.continueOnFail()) {
|
|
221
|
+
returnData.push({ error: error.message, json: {} });
|
|
222
|
+
continue;
|
|
223
|
+
}
|
|
224
|
+
throw error;
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
return [this.helpers.returnJsonArray(returnData)];
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
exports.CraftMyPdf = CraftMyPdf;
|
|
231
|
+
//# sourceMappingURL=CraftMyPdf.node.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CraftMyPdf.node.js","sourceRoot":"","sources":["../../../nodes/CraftMyPdf/CraftMyPdf.node.ts"],"names":[],"mappings":";;;AAAA,+CAQsB;AAEtB,0EAAsE;AACtE,sEAA+E;AAC/E,kEAAyE;AACzE,8DAA0D;AAC1D,kFAAiG;AACjG,yDAA8F;AAE9F,MAAa,UAAU;IAAvB;QACC,gBAAW,GAAyB;YACnC,WAAW,EAAE,YAAY;YACzB,IAAI,EAAE,YAAY;YAClB,IAAI,EAAE,iCAAiC;YACvC,KAAK,EAAE,CAAC,WAAW,CAAC;YACpB,OAAO,EAAE,CAAC;YACV,QAAQ,EAAE,gEAAgE;YAC1E,WAAW,EAAE,4BAA4B;YACzC,QAAQ,EAAE;gBACT,IAAI,EAAE,YAAY;aAClB;YACD,YAAY,EAAE,IAAI;YAClB,MAAM,EAAE,CAAC,kCAAmB,CAAC,IAAI,CAAC;YAClC,OAAO,EAAE,CAAC,kCAAmB,CAAC,IAAI,CAAC;YACnC,WAAW,EAAE;gBACZ;oBACC,IAAI,EAAE,eAAe;oBACrB,QAAQ,EAAE,IAAI;iBACd;aACD;YACD,UAAU,EAAE;gBACX;oBACC,WAAW,EAAE,UAAU;oBACvB,IAAI,EAAE,UAAU;oBAChB,IAAI,EAAE,SAAS;oBACf,gBAAgB,EAAE,IAAI;oBACtB,OAAO,EAAE;wBACR;4BACC,IAAI,EAAE,SAAS;4BACf,KAAK,EAAE,SAAS;yBAChB;wBACD;4BACC,IAAI,EAAE,OAAO;4BACb,KAAK,EAAE,OAAO;yBACd;wBACD;4BACC,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BAAgB,EAChB,EAAE,EACF,IAAI,CACJ,CAAC;wBACF,UAAU,CAAC,IAAI,CAAC,YAAkC,CAAC,CAAC;oBACrD,CAAC;gBACF,CAAC;gBACD,IAAI,QAAQ,KAAK,aAAa,EAAE,CAAC;oBAChC,IAAI,SAAS,KAAK,MAAM,EAAE,CAAC;wBAG1B,MAAM,EAAE,GAAgB;4BACvB,KAAK,EAAE,IAAI,CAAC,gBAAgB,CAAC,OAAO,EAAE,CAAC,CAAC;4BACxC,MAAM,EAAE,IAAI,CAAC,gBAAgB,CAAC,QAAQ,EAAE,CAAC,CAAC;yBAC1C,CAAC;wBAEF,YAAY,GAAG,MAAM,uCAAoB,CAAC,IAAI,CAC7C,IAAI,EACJ,KAAK,EACL,MAAM,EACN,oBAAoB,EACpB,EAAE,CACF,CAAC;wBAEF,UAAU,CAAC,IAAI,CAAC,YAAkC,CAAC,CAAC;oBACrD,CAAC;gBACF,CAAC;YACF,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBAChB,IAAI,IAAI,CAAC,cAAc,EAAE,EAAE,CAAC;oBAC3B,UAAU,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,OAAO,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,CAAC;oBACpD,SAAS;gBACV,CAAC;gBACD,MAAM,KAAK,CAAC;YACb,CAAC;QACF,CAAC;QACD,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,UAAU,CAAC,CAAC,CAAC;IACnD,CAAC;CACD;AApTD,gCAoTC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"node": "n8n-nodes-base.CraftMyPdf",
|
|
3
|
+
"nodeVersion": "1.0",
|
|
4
|
+
"codexVersion": "1.0",
|
|
5
|
+
"categories": ["Productivity", "Marketing"],
|
|
6
|
+
"resources": {
|
|
7
|
+
"credentialDocumentation": [
|
|
8
|
+
{
|
|
9
|
+
"url": "https://craftmypdf.com/docs/index.html#section/Authentication"
|
|
10
|
+
}
|
|
11
|
+
],
|
|
12
|
+
"primaryDocumentation": [
|
|
13
|
+
{
|
|
14
|
+
"url": "https://craftmypdf.com/docs/index.html"
|
|
15
|
+
}
|
|
16
|
+
]
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { IDataObject, IExecuteFunctions, IHttpRequestMethods, ILoadOptionsFunctions, INodeExecutionData } from 'n8n-workflow';
|
|
2
|
+
export declare function craftMyPdfApiRequest(this: IExecuteFunctions | ILoadOptionsFunctions, method: IHttpRequestMethods, region: string, endpoint: string, qs?: {}, body?: {}, option?: IDataObject): Promise<any>;
|
|
3
|
+
export declare function validateJSON(json: string | undefined): unknown;
|
|
4
|
+
export declare function returnFileExportType(this: IExecuteFunctions, method: IHttpRequestMethods, region: string, endpoint: string, outputFile: string, body?: {}): Promise<INodeExecutionData>;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.craftMyPdfApiRequest = craftMyPdfApiRequest;
|
|
4
|
+
exports.validateJSON = validateJSON;
|
|
5
|
+
exports.returnFileExportType = returnFileExportType;
|
|
6
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
7
|
+
async function craftMyPdfApiRequest(method, region, endpoint, qs = {}, body = {}, option = {}) {
|
|
8
|
+
let options = {
|
|
9
|
+
url: `https://${region}.craftmypdf.com/v1${endpoint}`,
|
|
10
|
+
headers: {
|
|
11
|
+
'user-agent': 'n8n',
|
|
12
|
+
Accept: 'application/json',
|
|
13
|
+
},
|
|
14
|
+
method,
|
|
15
|
+
qs,
|
|
16
|
+
body,
|
|
17
|
+
json: true,
|
|
18
|
+
};
|
|
19
|
+
if (Object.keys(option).length !== 0) {
|
|
20
|
+
options = Object.assign({}, options, option);
|
|
21
|
+
}
|
|
22
|
+
if (!Object.keys(body).length) {
|
|
23
|
+
delete options.body;
|
|
24
|
+
}
|
|
25
|
+
if (!Object.keys(qs).length) {
|
|
26
|
+
delete options.qs;
|
|
27
|
+
}
|
|
28
|
+
try {
|
|
29
|
+
const response = await this.helpers.httpRequestWithAuthentication.call(this, 'craftMyPdfApi', options);
|
|
30
|
+
if (response.status === 'error') {
|
|
31
|
+
throw new n8n_workflow_1.NodeApiError(this.getNode(), response.message);
|
|
32
|
+
}
|
|
33
|
+
return response;
|
|
34
|
+
}
|
|
35
|
+
catch (error) {
|
|
36
|
+
throw new n8n_workflow_1.NodeApiError(this.getNode(), error);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
function validateJSON(json) {
|
|
40
|
+
let result;
|
|
41
|
+
try {
|
|
42
|
+
result = JSON.parse(json);
|
|
43
|
+
}
|
|
44
|
+
catch {
|
|
45
|
+
result = undefined;
|
|
46
|
+
}
|
|
47
|
+
return result;
|
|
48
|
+
}
|
|
49
|
+
async function returnFileExportType(method, region, endpoint, outputFile, body = {}) {
|
|
50
|
+
const responseData = await craftMyPdfApiRequest.call(this, method, region, endpoint, {}, body, {
|
|
51
|
+
encoding: 'arraybuffer',
|
|
52
|
+
json: false,
|
|
53
|
+
});
|
|
54
|
+
const binaryData = await this.helpers.prepareBinaryData(responseData, outputFile);
|
|
55
|
+
return {
|
|
56
|
+
json: {},
|
|
57
|
+
binary: {
|
|
58
|
+
[outputFile]: binaryData,
|
|
59
|
+
},
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=GenericFunctions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GenericFunctions.js","sourceRoot":"","sources":["../../../nodes/CraftMyPdf/GenericFunctions.ts"],"names":[],"mappings":";;AAWA,oDA8CC;AAED,oCAQC;AAED,oDAqBC;AAjFD,+CAA4C;AAErC,KAAK,UAAU,oBAAoB,CAEzC,MAA2B,EAC3B,MAAc,EACd,QAAgB,EAChB,EAAE,GAAG,EAAE,EACP,IAAI,GAAG,EAA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,IAAI,CAAC,KAAK,CAAC,IAAK,CAAC,CAAC;IAC5B,CAAC;IAAC,MAAM,CAAC;QACR,MAAM,GAAG,SAAS,CAAC;IACpB,CAAC;IACD,OAAO,MAAM,CAAC;AACf,CAAC;AAEM,KAAK,UAAU,oBAAoB,CAEzC,MAA2B,EAC3B,MAAc,EACd,QAAgB,EAChB,UAAkB,EAClB,IAAI,GAAG,EAAE;IAET,MAAM,YAAY,GAAG,MAAM,oBAAoB,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,EAAE,IAAI,EAAE;QAC9F,QAAQ,EAAE,aAAa;QACvB,IAAI,EAAE,KAAK;KACX,CAAC,CAAC;IAEH,MAAM,UAAU,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,iBAAiB,CAAC,YAAY,EAAE,UAAU,CAAC,CAAC;IAElF,OAAO;QACN,IAAI,EAAE,EAAE;QACR,MAAM,EAAE;YACP,CAAC,UAAU,CAAC,EAAE,UAAU;SACxB;KACD,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.accountOperations = void 0;
|
|
4
|
+
exports.accountOperations = [
|
|
5
|
+
{
|
|
6
|
+
displayName: 'Operation',
|
|
7
|
+
name: 'operation',
|
|
8
|
+
type: 'options',
|
|
9
|
+
noDataExpression: true,
|
|
10
|
+
displayOptions: {
|
|
11
|
+
show: {
|
|
12
|
+
resource: ['account'],
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
options: [
|
|
16
|
+
{
|
|
17
|
+
name: 'Get',
|
|
18
|
+
value: 'get',
|
|
19
|
+
description: 'Get account information',
|
|
20
|
+
action: 'Get account information',
|
|
21
|
+
},
|
|
22
|
+
],
|
|
23
|
+
default: 'get',
|
|
24
|
+
},
|
|
25
|
+
];
|
|
26
|
+
//# sourceMappingURL=AccountDescription.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AccountDescription.js","sourceRoot":"","sources":["../../../../nodes/CraftMyPdf/descriptions/AccountDescription.ts"],"names":[],"mappings":";;;AAEa,QAAA,iBAAiB,GAAsB;IACnD;QACC,WAAW,EAAE,WAAW;QACxB,IAAI,EAAE,WAAW;QACjB,IAAI,EAAE,SAAS;QACf,gBAAgB,EAAE,IAAI;QACtB,cAAc,EAAE;YACf,IAAI,EAAE;gBACL,QAAQ,EAAE,CAAC,SAAS,CAAC;aACrB;SACD;QACD,OAAO,EAAE;YAER;gBACC,IAAI,EAAE,KAAK;gBACX,KAAK,EAAE,KAAK;gBACZ,WAAW,EAAE,yBAAyB;gBACtC,MAAM,EAAE,yBAAyB;aACjC;SACD;QACD,OAAO,EAAE,KAAK;KACd;CACD,CAAC"}
|