n8n-nodes-kapacity 0.1.0
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 +21 -0
- package/README.md +101 -0
- package/dist/credentials/KapacityApi.credentials.d.ts +10 -0
- package/dist/credentials/KapacityApi.credentials.js +56 -0
- package/dist/icons/kapacity.dark.svg +1 -0
- package/dist/icons/kapacity.svg +1 -0
- package/dist/nodes/Kapacity/Kapacity.node.d.ts +23 -0
- package/dist/nodes/Kapacity/Kapacity.node.js +92 -0
- package/dist/nodes/Kapacity/Kapacity.node.json +18 -0
- package/dist/nodes/Kapacity/actions.d.ts +13 -0
- package/dist/nodes/Kapacity/actions.js +277 -0
- package/dist/nodes/Kapacity/methods.d.ts +17 -0
- package/dist/nodes/Kapacity/methods.js +111 -0
- package/dist/nodes/Kapacity/resources/contact.d.ts +2 -0
- package/dist/nodes/Kapacity/resources/contact.js +111 -0
- package/dist/nodes/Kapacity/resources/contract.d.ts +6 -0
- package/dist/nodes/Kapacity/resources/contract.js +126 -0
- package/dist/nodes/Kapacity/resources/reading.d.ts +11 -0
- package/dist/nodes/Kapacity/resources/reading.js +137 -0
- package/dist/nodes/Kapacity/resources/row.d.ts +7 -0
- package/dist/nodes/Kapacity/resources/row.js +140 -0
- package/dist/nodes/Kapacity/shared/columns.d.ts +24 -0
- package/dist/nodes/Kapacity/shared/columns.js +158 -0
- package/dist/nodes/Kapacity/shared/descriptions.d.ts +16 -0
- package/dist/nodes/Kapacity/shared/descriptions.js +154 -0
- package/dist/nodes/Kapacity/shared/transport.d.ts +5 -0
- package/dist/nodes/Kapacity/shared/transport.js +91 -0
- package/dist/nodes/KapacityTrigger/KapacityTrigger.node.d.ts +12 -0
- package/dist/nodes/KapacityTrigger/KapacityTrigger.node.js +182 -0
- package/dist/nodes/KapacityTrigger/KapacityTrigger.node.json +18 -0
- package/dist/package.json +65 -0
- package/package.json +65 -0
package/LICENSE.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Kapacity FZE
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
# n8n-nodes-kapacity
|
|
2
|
+
|
|
3
|
+
This is an n8n community node. It lets you use [Kapacity](https://kapacity.app) in your n8n workflows.
|
|
4
|
+
|
|
5
|
+
Kapacity is an all-in-one sales platform for closing teams, coaches and course creators: a CRM built around the lead, appointment booking, qualification forms and e-signed contracts, in one pipeline.
|
|
6
|
+
|
|
7
|
+
[n8n](https://n8n.io/) is a [fair-code licensed](https://docs.n8n.io/sustainable-use-license/) workflow automation platform.
|
|
8
|
+
|
|
9
|
+
[Installation](#installation) ·
|
|
10
|
+
[Operations](#operations) ·
|
|
11
|
+
[Credentials](#credentials) ·
|
|
12
|
+
[Compatibility](#compatibility) ·
|
|
13
|
+
[Usage](#usage) ·
|
|
14
|
+
[Resources](#resources) ·
|
|
15
|
+
[Version history](#version-history)
|
|
16
|
+
|
|
17
|
+
## Installation
|
|
18
|
+
|
|
19
|
+
Follow the [installation guide](https://docs.n8n.io/integrations/community-nodes/installation/) in the n8n community nodes documentation.
|
|
20
|
+
|
|
21
|
+
On a self-hosted n8n: **Settings > Community Nodes > Install**, then enter `n8n-nodes-kapacity`.
|
|
22
|
+
|
|
23
|
+
## Operations
|
|
24
|
+
|
|
25
|
+
The package contains two nodes.
|
|
26
|
+
|
|
27
|
+
### Kapacity
|
|
28
|
+
|
|
29
|
+
| Resource | Operations |
|
|
30
|
+
| --- | --- |
|
|
31
|
+
| Contact | Create, Create or Update (by e-mail), Delete, Get, Get Many, Update |
|
|
32
|
+
| Row (your own CRM tables) | Create, Delete, Get, Get Many, Update |
|
|
33
|
+
| Table | Get Columns, Get Many |
|
|
34
|
+
| Contract | Send (from a template, for e-signature), Get (with its audit trail), Get Many |
|
|
35
|
+
| Contract Template | Get Many |
|
|
36
|
+
| Appointment | Get Many |
|
|
37
|
+
| Appointment Type | Get Many |
|
|
38
|
+
| Form | Get Many |
|
|
39
|
+
| Form Response | Get Many |
|
|
40
|
+
| Product | Get Many |
|
|
41
|
+
| Payment | Get Many |
|
|
42
|
+
| Member | Get Many |
|
|
43
|
+
| Workspace | Get |
|
|
44
|
+
|
|
45
|
+
What the node does for you, so you never write a request body:
|
|
46
|
+
|
|
47
|
+
- **Fields by name.** When you create or update a contact or a row, the node lists the columns of the chosen base or table. You fill them in by name, and pick choices and members from a list.
|
|
48
|
+
- **Amounts in euros.** You type `4500`, the node sends `450000` cents. It also converts amounts back to euros when it reads.
|
|
49
|
+
- **Readable output.** By default a contact or a row comes out with column names, option labels and member names instead of IDs. Choose **Output Format: Raw** to get the API response as is.
|
|
50
|
+
- **Pagination.** **Return All** reads every page for you.
|
|
51
|
+
- **Contacts found by e-mail.** **Create or Update** updates the contact that has this e-mail, or creates it.
|
|
52
|
+
|
|
53
|
+
### Kapacity Trigger
|
|
54
|
+
|
|
55
|
+
Starts a workflow when something happens in Kapacity:
|
|
56
|
+
|
|
57
|
+
Contact Created, Contact Updated, Row Created, Row Updated, Appointment Booked, Appointment Rescheduled, Appointment Canceled, Form Submitted, Contract Sent, Contract Signed, Payment Received.
|
|
58
|
+
|
|
59
|
+
The trigger registers its webhook in Kapacity when the workflow is activated, and deletes it when the workflow is deactivated. Every call is signed by Kapacity and the trigger checks the signature ([Standard Webhooks](https://www.standardwebhooks.com/)).
|
|
60
|
+
|
|
61
|
+
**Ignore Changes Made by the API** is on by default. Keep it on when the same workflow writes to Kapacity, otherwise it would start itself again, endlessly.
|
|
62
|
+
|
|
63
|
+
## Credentials
|
|
64
|
+
|
|
65
|
+
You need a Kapacity workspace, as an administrator, and an API key. The Kapacity interface is in French: the labels below are quoted as you will see them.
|
|
66
|
+
|
|
67
|
+
1. In Kapacity, open **Intégrations** and scroll down to the **API** card.
|
|
68
|
+
2. Click **Nouvelle clé**. Choose **Lecture et écriture** (read and write) if the workflow creates or changes data, or uses the trigger. Choose **Lecture seule** (read only) otherwise.
|
|
69
|
+
3. Click **Créer la clé** and copy the key (it starts with `kap_live_`): it is shown only once.
|
|
70
|
+
4. Copy the workspace ID shown in the same card (**Identifiant de votre espace**).
|
|
71
|
+
5. In n8n, create a **Kapacity API** credential and paste the key and the workspace ID. Leave **Base URL** as `https://kapacity.app`.
|
|
72
|
+
|
|
73
|
+
n8n checks the credential by calling the API: a wrong key or a key from another workspace is reported at once.
|
|
74
|
+
|
|
75
|
+
## Compatibility
|
|
76
|
+
|
|
77
|
+
Built with the n8n node CLI against `n8n-workflow` 2.x.
|
|
78
|
+
|
|
79
|
+
The trigger needs n8n to be reachable on a public **https** address: Kapacity never calls a private or plain http address. On a local n8n, set `WEBHOOK_URL` to a tunnel address.
|
|
80
|
+
|
|
81
|
+
## Usage
|
|
82
|
+
|
|
83
|
+
**Send a contract when a deal is won.** Kapacity Trigger (Contact Updated) → IF status is "Won" → Kapacity, Contract, Send: pick the template, the contact comes from the trigger, set the amount. The output contains the signing link, which you can also send by WhatsApp or SMS (turn off **Send E-Mail**).
|
|
84
|
+
|
|
85
|
+
**Import leads from another tool.** Your source node → Kapacity, Contact, Create or Update, map the e-mail and the fields. Turn off **Trigger Automations** in the options for a large import.
|
|
86
|
+
|
|
87
|
+
**Follow up after a signature.** Kapacity Trigger (Contract Signed) → your e-mail, Slack or invoicing node.
|
|
88
|
+
|
|
89
|
+
The API has a monthly quota per workspace. Each call counts, so prefer the trigger to a schedule that reads every five minutes.
|
|
90
|
+
|
|
91
|
+
## Resources
|
|
92
|
+
|
|
93
|
+
- [n8n community nodes documentation](https://docs.n8n.io/integrations/#community-nodes)
|
|
94
|
+
- [Kapacity API documentation](https://kapacity.app/docs/api)
|
|
95
|
+
- [Kapacity](https://kapacity.app)
|
|
96
|
+
|
|
97
|
+
## Version history
|
|
98
|
+
|
|
99
|
+
### 0.1.0
|
|
100
|
+
|
|
101
|
+
First release: Kapacity node (13 resources) and Kapacity Trigger (11 events).
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { IAuthenticateGeneric, Icon, ICredentialTestRequest, ICredentialType, INodeProperties } from 'n8n-workflow';
|
|
2
|
+
export declare class KapacityApi 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,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.KapacityApi = void 0;
|
|
4
|
+
class KapacityApi {
|
|
5
|
+
constructor() {
|
|
6
|
+
this.name = 'kapacityApi';
|
|
7
|
+
this.displayName = 'Kapacity API';
|
|
8
|
+
this.icon = { light: 'file:../icons/kapacity.svg', dark: 'file:../icons/kapacity.dark.svg' };
|
|
9
|
+
this.documentationUrl = 'https://github.com/kapacity-saas/n8n-nodes-kapacity?tab=readme-ov-file#credentials';
|
|
10
|
+
this.properties = [
|
|
11
|
+
{
|
|
12
|
+
displayName: 'API Key',
|
|
13
|
+
name: 'apiKey',
|
|
14
|
+
type: 'string',
|
|
15
|
+
typeOptions: { password: true },
|
|
16
|
+
required: true,
|
|
17
|
+
default: '',
|
|
18
|
+
placeholder: 'e.g. kap_live_…',
|
|
19
|
+
description: 'Create a key in Kapacity, page Integrations, API tab. Choose "Read and write" if the workflow creates or updates data.',
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
displayName: 'Workspace ID',
|
|
23
|
+
name: 'workspaceId',
|
|
24
|
+
type: 'string',
|
|
25
|
+
required: true,
|
|
26
|
+
default: '',
|
|
27
|
+
placeholder: 'e.g. 1c100b3a-4cf0-44f7-a39a-531d95b9b86d',
|
|
28
|
+
description: 'Shown in Kapacity, page Integrations, API tab, under "Workspace ID"',
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
displayName: 'Base URL',
|
|
32
|
+
name: 'baseUrl',
|
|
33
|
+
type: 'string',
|
|
34
|
+
default: 'https://kapacity.app',
|
|
35
|
+
description: 'Only change this if Kapacity gave you another address',
|
|
36
|
+
},
|
|
37
|
+
];
|
|
38
|
+
this.authenticate = {
|
|
39
|
+
type: 'generic',
|
|
40
|
+
properties: {
|
|
41
|
+
headers: {
|
|
42
|
+
Authorization: '=Bearer {{$credentials.apiKey}}',
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
};
|
|
46
|
+
this.test = {
|
|
47
|
+
request: {
|
|
48
|
+
baseURL: '={{$credentials.baseUrl.replace(/\\/+$/, "")}}/api/v1/w/{{$credentials.workspaceId}}',
|
|
49
|
+
url: '/me',
|
|
50
|
+
method: 'GET',
|
|
51
|
+
},
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
exports.KapacityApi = KapacityApi;
|
|
56
|
+
//# sourceMappingURL=KapacityApi.credentials.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 60 60" width="60" height="60"><path fill="#D9B57A" fill-rule="evenodd" d="M53.37 42.37C52.88 42.28 51.11 41.69 47.01 40.25C46.00 39.90 44.79 39.48 44.32 39.32C43.84 39.16 43.37 38.98 43.25 38.92L43.05 38.81L43.13 38.38C43.17 38.15 43.40 37.16 43.64 36.19L44.08 34.41L43.98 34.31L43.87 34.20L43.66 34.36C43.55 34.45 42.58 35.25 41.51 36.13C37.80 39.20 37.07 39.80 35.69 40.91L34.30 42.03L33.78 42.02L33.26 42.02L33.75 41.61C34.03 41.38 34.49 40.77 34.82 40.21C35.14 39.67 36.47 37.64 37.76 35.70C39.06 33.76 40.09 32.15 40.06 32.12C40.03 32.08 39.57 32.22 39.04 32.41C38.51 32.61 37.82 32.86 37.50 32.98C37.19 33.10 36.41 33.38 35.78 33.61C35.15 33.83 34.38 34.12 34.07 34.24C33.75 34.36 32.57 34.79 31.43 35.21C30.30 35.63 29.27 36.01 29.14 36.07C29.01 36.12 28.53 36.30 28.05 36.47C26.77 36.93 26.13 37.16 25.27 37.49C24.85 37.65 24.45 37.79 24.39 37.79C24.07 37.79 24.09 37.76 29.42 31.21C30.68 29.66 31.72 28.33 31.72 28.27C31.72 28.05 28.92 24.86 28.75 24.88C28.58 24.90 27.69 25.85 24.35 29.60C23.34 30.73 21.96 32.25 21.29 32.98C20.63 33.70 19.39 35.07 18.55 36.01C17.71 36.96 16.98 37.75 16.93 37.77C16.87 37.79 16.83 36.90 16.83 35.78L16.83 33.76L16.65 33.82C16.56 33.86 15.72 34.37 14.79 34.96C13.87 35.55 12.20 36.58 11.10 37.24C10.00 37.90 8.15 39.02 7.00 39.72C5.84 40.42 4.87 41.00 4.84 41.00C4.81 41.00 4.63 41.10 4.46 41.23C4.28 41.35 4.11 41.42 4.08 41.37C4.05 41.32 4.09 40.79 4.16 40.20L4.29 39.12L4.49 39.40L4.68 39.68L5.29 39.03C7.80 36.34 9.24 34.79 11.89 31.95C17.31 26.11 18.92 24.39 18.97 24.39C19.00 24.39 19.45 24.75 19.98 25.19C20.51 25.63 20.96 25.99 20.99 25.99C21.01 25.99 21.86 25.10 22.87 24.02C23.87 22.93 25.39 21.29 26.23 20.38C27.08 19.47 28.00 18.47 28.28 18.16L28.80 17.60L31.03 20.10C32.26 21.47 33.52 22.89 33.84 23.25C34.48 23.98 36.80 26.56 37.65 27.48L38.20 28.08L39.45 26.98C40.14 26.38 40.74 25.89 40.79 25.91C40.83 25.92 44.30 29.35 48.49 33.53L56.13 41.13L56.09 41.78L56.06 42.43L54.97 42.44C54.37 42.45 53.65 42.42 53.37 42.37Z"/></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 60 60" width="60" height="60"><path fill="#CB9F5F" fill-rule="evenodd" d="M53.37 42.37C52.88 42.28 51.11 41.69 47.01 40.25C46.00 39.90 44.79 39.48 44.32 39.32C43.84 39.16 43.37 38.98 43.25 38.92L43.05 38.81L43.13 38.38C43.17 38.15 43.40 37.16 43.64 36.19L44.08 34.41L43.98 34.31L43.87 34.20L43.66 34.36C43.55 34.45 42.58 35.25 41.51 36.13C37.80 39.20 37.07 39.80 35.69 40.91L34.30 42.03L33.78 42.02L33.26 42.02L33.75 41.61C34.03 41.38 34.49 40.77 34.82 40.21C35.14 39.67 36.47 37.64 37.76 35.70C39.06 33.76 40.09 32.15 40.06 32.12C40.03 32.08 39.57 32.22 39.04 32.41C38.51 32.61 37.82 32.86 37.50 32.98C37.19 33.10 36.41 33.38 35.78 33.61C35.15 33.83 34.38 34.12 34.07 34.24C33.75 34.36 32.57 34.79 31.43 35.21C30.30 35.63 29.27 36.01 29.14 36.07C29.01 36.12 28.53 36.30 28.05 36.47C26.77 36.93 26.13 37.16 25.27 37.49C24.85 37.65 24.45 37.79 24.39 37.79C24.07 37.79 24.09 37.76 29.42 31.21C30.68 29.66 31.72 28.33 31.72 28.27C31.72 28.05 28.92 24.86 28.75 24.88C28.58 24.90 27.69 25.85 24.35 29.60C23.34 30.73 21.96 32.25 21.29 32.98C20.63 33.70 19.39 35.07 18.55 36.01C17.71 36.96 16.98 37.75 16.93 37.77C16.87 37.79 16.83 36.90 16.83 35.78L16.83 33.76L16.65 33.82C16.56 33.86 15.72 34.37 14.79 34.96C13.87 35.55 12.20 36.58 11.10 37.24C10.00 37.90 8.15 39.02 7.00 39.72C5.84 40.42 4.87 41.00 4.84 41.00C4.81 41.00 4.63 41.10 4.46 41.23C4.28 41.35 4.11 41.42 4.08 41.37C4.05 41.32 4.09 40.79 4.16 40.20L4.29 39.12L4.49 39.40L4.68 39.68L5.29 39.03C7.80 36.34 9.24 34.79 11.89 31.95C17.31 26.11 18.92 24.39 18.97 24.39C19.00 24.39 19.45 24.75 19.98 25.19C20.51 25.63 20.96 25.99 20.99 25.99C21.01 25.99 21.86 25.10 22.87 24.02C23.87 22.93 25.39 21.29 26.23 20.38C27.08 19.47 28.00 18.47 28.28 18.16L28.80 17.60L31.03 20.10C32.26 21.47 33.52 22.89 33.84 23.25C34.48 23.98 36.80 26.56 37.65 27.48L38.20 28.08L39.45 26.98C40.14 26.38 40.74 25.89 40.79 25.91C40.83 25.92 44.30 29.35 48.49 33.53L56.13 41.13L56.09 41.78L56.06 42.43L54.97 42.44C54.37 42.45 53.65 42.42 53.37 42.37Z"/></svg>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { IExecuteFunctions, INodeExecutionData, INodeType, INodeTypeDescription } from 'n8n-workflow';
|
|
2
|
+
export declare class Kapacity implements INodeType {
|
|
3
|
+
description: INodeTypeDescription;
|
|
4
|
+
methods: {
|
|
5
|
+
listSearch: {
|
|
6
|
+
searchContacts(this: import("n8n-workflow").ILoadOptionsFunctions, filter?: string): Promise<import("n8n-workflow").INodeListSearchResult>;
|
|
7
|
+
searchAllContacts(this: import("n8n-workflow").ILoadOptionsFunctions, filter?: string): Promise<import("n8n-workflow").INodeListSearchResult>;
|
|
8
|
+
searchTables(this: import("n8n-workflow").ILoadOptionsFunctions, filter?: string): Promise<import("n8n-workflow").INodeListSearchResult>;
|
|
9
|
+
searchContractTemplates(this: import("n8n-workflow").ILoadOptionsFunctions, filter?: string): Promise<import("n8n-workflow").INodeListSearchResult>;
|
|
10
|
+
searchContracts(this: import("n8n-workflow").ILoadOptionsFunctions, filter?: string): Promise<import("n8n-workflow").INodeListSearchResult>;
|
|
11
|
+
searchForms(this: import("n8n-workflow").ILoadOptionsFunctions, filter?: string): Promise<import("n8n-workflow").INodeListSearchResult>;
|
|
12
|
+
};
|
|
13
|
+
loadOptions: {
|
|
14
|
+
getContactStatuses(this: import("n8n-workflow").ILoadOptionsFunctions): Promise<import("n8n-workflow").INodePropertyOptions[]>;
|
|
15
|
+
getTableColumns(this: import("n8n-workflow").ILoadOptionsFunctions): Promise<import("n8n-workflow").INodePropertyOptions[]>;
|
|
16
|
+
};
|
|
17
|
+
resourceMapping: {
|
|
18
|
+
getContactFields(this: import("n8n-workflow").ILoadOptionsFunctions): Promise<import("n8n-workflow").ResourceMapperFields>;
|
|
19
|
+
getRowFields(this: import("n8n-workflow").ILoadOptionsFunctions): Promise<import("n8n-workflow").ResourceMapperFields>;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]>;
|
|
23
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Kapacity = void 0;
|
|
4
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
5
|
+
const actions_1 = require("./actions");
|
|
6
|
+
const methods_1 = require("./methods");
|
|
7
|
+
const contact_1 = require("./resources/contact");
|
|
8
|
+
const contract_1 = require("./resources/contract");
|
|
9
|
+
const reading_1 = require("./resources/reading");
|
|
10
|
+
const row_1 = require("./resources/row");
|
|
11
|
+
class Kapacity {
|
|
12
|
+
constructor() {
|
|
13
|
+
this.description = {
|
|
14
|
+
displayName: 'Kapacity',
|
|
15
|
+
name: 'kapacity',
|
|
16
|
+
icon: { light: 'file:../../icons/kapacity.svg', dark: 'file:../../icons/kapacity.dark.svg' },
|
|
17
|
+
group: ['transform'],
|
|
18
|
+
version: 1,
|
|
19
|
+
subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
|
|
20
|
+
description: 'Work with the contacts, tables, contracts, appointments and payments of Kapacity',
|
|
21
|
+
defaults: { name: 'Kapacity' },
|
|
22
|
+
usableAsTool: true,
|
|
23
|
+
inputs: [n8n_workflow_1.NodeConnectionTypes.Main],
|
|
24
|
+
outputs: [n8n_workflow_1.NodeConnectionTypes.Main],
|
|
25
|
+
credentials: [{ name: 'kapacityApi', required: true }],
|
|
26
|
+
properties: [
|
|
27
|
+
{
|
|
28
|
+
displayName: 'Resource',
|
|
29
|
+
name: 'resource',
|
|
30
|
+
type: 'options',
|
|
31
|
+
noDataExpression: true,
|
|
32
|
+
options: [
|
|
33
|
+
{ name: 'Appointment', value: 'appointment' },
|
|
34
|
+
{ name: 'Appointment Type', value: 'appointmentType' },
|
|
35
|
+
{ name: 'Contact', value: 'contact' },
|
|
36
|
+
{ name: 'Contract', value: 'contract' },
|
|
37
|
+
{ name: 'Contract Template', value: 'contractTemplate' },
|
|
38
|
+
{ name: 'Form', value: 'form' },
|
|
39
|
+
{ name: 'Form Response', value: 'formResponse' },
|
|
40
|
+
{ name: 'Member', value: 'member' },
|
|
41
|
+
{ name: 'Payment', value: 'payment' },
|
|
42
|
+
{ name: 'Product', value: 'product' },
|
|
43
|
+
{ name: 'Row', value: 'row' },
|
|
44
|
+
{ name: 'Table', value: 'table' },
|
|
45
|
+
{ name: 'Workspace', value: 'workspace' },
|
|
46
|
+
],
|
|
47
|
+
default: 'contact',
|
|
48
|
+
},
|
|
49
|
+
...contact_1.contactDescription,
|
|
50
|
+
...row_1.rowDescription,
|
|
51
|
+
...reading_1.tableDescription,
|
|
52
|
+
...contract_1.contractDescription,
|
|
53
|
+
...reading_1.contractTemplateDescription,
|
|
54
|
+
...reading_1.appointmentDescription,
|
|
55
|
+
...reading_1.appointmentTypeDescription,
|
|
56
|
+
...reading_1.formDescription,
|
|
57
|
+
...reading_1.formResponseDescription,
|
|
58
|
+
...reading_1.productDescription,
|
|
59
|
+
...reading_1.paymentDescription,
|
|
60
|
+
...reading_1.memberDescription,
|
|
61
|
+
...reading_1.workspaceDescription,
|
|
62
|
+
],
|
|
63
|
+
};
|
|
64
|
+
this.methods = { listSearch: methods_1.listSearch, loadOptions: methods_1.loadOptions, resourceMapping: methods_1.resourceMapping };
|
|
65
|
+
}
|
|
66
|
+
async execute() {
|
|
67
|
+
const items = this.getInputData();
|
|
68
|
+
const returnData = [];
|
|
69
|
+
const cache = new actions_1.ExecutionCache(this);
|
|
70
|
+
for (let i = 0; i < items.length; i++) {
|
|
71
|
+
try {
|
|
72
|
+
const resource = this.getNodeParameter('resource', i);
|
|
73
|
+
const operation = this.getNodeParameter('operation', i);
|
|
74
|
+
const result = await (0, actions_1.runOperation)(this, cache, resource, operation, i);
|
|
75
|
+
const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(result), { itemData: { item: i } });
|
|
76
|
+
returnData.push(...executionData);
|
|
77
|
+
}
|
|
78
|
+
catch (error) {
|
|
79
|
+
if (this.continueOnFail()) {
|
|
80
|
+
returnData.push({ json: { error: error.message }, pairedItem: { item: i } });
|
|
81
|
+
continue;
|
|
82
|
+
}
|
|
83
|
+
if (error instanceof n8n_workflow_1.NodeApiError)
|
|
84
|
+
throw new n8n_workflow_1.NodeApiError(this.getNode(), error);
|
|
85
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), error, { itemIndex: i });
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
return [returnData];
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
exports.Kapacity = Kapacity;
|
|
92
|
+
//# sourceMappingURL=Kapacity.node.js.map
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"node": "n8n-nodes-kapacity.kapacity",
|
|
3
|
+
"nodeVersion": "1.0",
|
|
4
|
+
"codexVersion": "1.0",
|
|
5
|
+
"categories": ["Sales", "Productivity"],
|
|
6
|
+
"resources": {
|
|
7
|
+
"credentialDocumentation": [
|
|
8
|
+
{
|
|
9
|
+
"url": "https://github.com/kapacity-saas/n8n-nodes-kapacity#credentials"
|
|
10
|
+
}
|
|
11
|
+
],
|
|
12
|
+
"primaryDocumentation": [
|
|
13
|
+
{
|
|
14
|
+
"url": "https://kapacity.app/docs/api"
|
|
15
|
+
}
|
|
16
|
+
]
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { IDataObject, IExecuteFunctions } from 'n8n-workflow';
|
|
2
|
+
import { type KapacityColumn, type KapacityMember } from './shared/columns';
|
|
3
|
+
export declare class ExecutionCache {
|
|
4
|
+
private readonly ctx;
|
|
5
|
+
private columns;
|
|
6
|
+
private members;
|
|
7
|
+
constructor(ctx: IExecuteFunctions);
|
|
8
|
+
columnsOf(table: string): Promise<KapacityColumn[]>;
|
|
9
|
+
allMembers(): Promise<KapacityMember[]>;
|
|
10
|
+
}
|
|
11
|
+
type Result = IDataObject | IDataObject[];
|
|
12
|
+
export declare function runOperation(ctx: IExecuteFunctions, cache: ExecutionCache, resource: string, operation: string, i: number): Promise<Result>;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ExecutionCache = void 0;
|
|
4
|
+
exports.runOperation = runOperation;
|
|
5
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
6
|
+
const columns_1 = require("./shared/columns");
|
|
7
|
+
const transport_1 = require("./shared/transport");
|
|
8
|
+
class ExecutionCache {
|
|
9
|
+
constructor(ctx) {
|
|
10
|
+
this.ctx = ctx;
|
|
11
|
+
this.columns = new Map();
|
|
12
|
+
}
|
|
13
|
+
columnsOf(table) {
|
|
14
|
+
if (!this.columns.has(table))
|
|
15
|
+
this.columns.set(table, columns_1.getColumns.call(this.ctx, table));
|
|
16
|
+
return this.columns.get(table);
|
|
17
|
+
}
|
|
18
|
+
allMembers() {
|
|
19
|
+
if (!this.members)
|
|
20
|
+
this.members = columns_1.getMembers.call(this.ctx);
|
|
21
|
+
return this.members;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
exports.ExecutionCache = ExecutionCache;
|
|
25
|
+
const param = (ctx, name, i, fallback) => ctx.getNodeParameter(name, i, fallback);
|
|
26
|
+
const locator = (ctx, name, i) => { var _a; return String((_a = ctx.getNodeParameter(name, i, '', { extractValue: true })) !== null && _a !== void 0 ? _a : '').trim(); };
|
|
27
|
+
const automationsQs = (options) => options.triggerAutomations === false ? { automatisations: 'false' } : {};
|
|
28
|
+
function withFilters(path, filters) {
|
|
29
|
+
if (!filters.length)
|
|
30
|
+
return path;
|
|
31
|
+
return `${path}?${filters.map((f) => `filtre=${encodeURIComponent(f)}`).join('&')}`;
|
|
32
|
+
}
|
|
33
|
+
async function present(ctx, cache, table, record, options) {
|
|
34
|
+
if (options.outputFormat === 'raw')
|
|
35
|
+
return record;
|
|
36
|
+
const [columns, members] = await Promise.all([cache.columnsOf(table), cache.allMembers()]);
|
|
37
|
+
return (0, columns_1.toReadable)(record, columns, members);
|
|
38
|
+
}
|
|
39
|
+
async function listOf(ctx, i, path, listKey, qs = {}) {
|
|
40
|
+
const returnAll = param(ctx, 'returnAll', i, false);
|
|
41
|
+
const limit = returnAll ? 0 : param(ctx, 'limit', i, 50);
|
|
42
|
+
return transport_1.kapacityApiRequestAll.call(ctx, path, listKey, qs, limit);
|
|
43
|
+
}
|
|
44
|
+
async function mappedValues(ctx, cache, table, i) {
|
|
45
|
+
var _a;
|
|
46
|
+
const mapper = param(ctx, 'fields', i, { value: {} });
|
|
47
|
+
return (0, columns_1.toApiValues)(((_a = mapper.value) !== null && _a !== void 0 ? _a : {}), await cache.columnsOf(table));
|
|
48
|
+
}
|
|
49
|
+
async function createRecord(ctx, cache, table, i, extra = {}) {
|
|
50
|
+
const options = param(ctx, 'options', i, {});
|
|
51
|
+
const champs = { ...(await mappedValues(ctx, cache, table, i)), ...extra };
|
|
52
|
+
const response = await transport_1.kapacityApiRequest.call(ctx, 'POST', `/tables/${table}/records`, automationsQs(options), { champs });
|
|
53
|
+
return present(ctx, cache, table, response.ligne, options);
|
|
54
|
+
}
|
|
55
|
+
async function updateRecord(ctx, cache, table, id, i) {
|
|
56
|
+
const options = param(ctx, 'options', i, {});
|
|
57
|
+
const champs = await mappedValues(ctx, cache, table, i);
|
|
58
|
+
if (!Object.keys(champs).length) {
|
|
59
|
+
throw new n8n_workflow_1.NodeOperationError(ctx.getNode(), 'No field to update: fill in at least one field', { itemIndex: i });
|
|
60
|
+
}
|
|
61
|
+
const response = await transport_1.kapacityApiRequest.call(ctx, 'PATCH', `/records/${id}`, automationsQs(options), { champs });
|
|
62
|
+
return present(ctx, cache, table, response.ligne, options);
|
|
63
|
+
}
|
|
64
|
+
async function getRecord(ctx, cache, table, id, i) {
|
|
65
|
+
const options = param(ctx, 'options', i, {});
|
|
66
|
+
const response = await transport_1.kapacityApiRequest.call(ctx, 'GET', `/records/${id}`);
|
|
67
|
+
return present(ctx, cache, table, response.ligne, options);
|
|
68
|
+
}
|
|
69
|
+
async function deleteRecord(ctx, id) {
|
|
70
|
+
await transport_1.kapacityApiRequest.call(ctx, 'DELETE', `/records/${id}`);
|
|
71
|
+
return { deleted: true, id };
|
|
72
|
+
}
|
|
73
|
+
async function listRecords(ctx, cache, table, i, filtersIn, qs) {
|
|
74
|
+
const options = param(ctx, 'options', i, {});
|
|
75
|
+
const rows = await listOf(ctx, i, withFilters(`/tables/${table}/records`, filtersIn), 'lignes', qs);
|
|
76
|
+
return Promise.all(rows.map((row) => present(ctx, cache, table, row, options)));
|
|
77
|
+
}
|
|
78
|
+
async function contact(ctx, cache, operation, i) {
|
|
79
|
+
var _a;
|
|
80
|
+
const base = param(ctx, 'base', i, 'leads');
|
|
81
|
+
switch (operation) {
|
|
82
|
+
case 'create':
|
|
83
|
+
return createRecord(ctx, cache, base, i);
|
|
84
|
+
case 'upsert': {
|
|
85
|
+
const email = param(ctx, 'email', i, '').trim();
|
|
86
|
+
if (!email)
|
|
87
|
+
throw new n8n_workflow_1.NodeOperationError(ctx.getNode(), 'The e-mail is required to find the contact', { itemIndex: i });
|
|
88
|
+
const found = await transport_1.kapacityApiRequest.call(ctx, 'GET', withFilters(`/tables/${base}/records`, [`email:eq:${email}`]), {
|
|
89
|
+
limite: 1,
|
|
90
|
+
});
|
|
91
|
+
const existing = ((_a = found.lignes) !== null && _a !== void 0 ? _a : [])[0];
|
|
92
|
+
if (existing) {
|
|
93
|
+
const updated = await updateRecordOrKeep(ctx, cache, base, String(existing.id), i, existing);
|
|
94
|
+
return { ...updated, upsert: 'updated' };
|
|
95
|
+
}
|
|
96
|
+
return { ...(await createRecord(ctx, cache, base, i, { email })), upsert: 'created' };
|
|
97
|
+
}
|
|
98
|
+
case 'get':
|
|
99
|
+
return getRecord(ctx, cache, base, locator(ctx, 'contactId', i), i);
|
|
100
|
+
case 'update':
|
|
101
|
+
return updateRecord(ctx, cache, base, locator(ctx, 'contactId', i), i);
|
|
102
|
+
case 'delete':
|
|
103
|
+
return deleteRecord(ctx, locator(ctx, 'contactId', i));
|
|
104
|
+
case 'getAll': {
|
|
105
|
+
const filters = param(ctx, 'filters', i, {});
|
|
106
|
+
const conditions = [];
|
|
107
|
+
if (filters.email)
|
|
108
|
+
conditions.push(`email:eq:${String(filters.email).trim()}`);
|
|
109
|
+
if (filters.status)
|
|
110
|
+
conditions.push(`status_id:eq:${String(filters.status)}`);
|
|
111
|
+
const qs = {};
|
|
112
|
+
if (filters.search)
|
|
113
|
+
qs.recherche = filters.search;
|
|
114
|
+
if (filters.updatedSince)
|
|
115
|
+
qs.modifie_depuis = filters.updatedSince;
|
|
116
|
+
return listRecords(ctx, cache, base, i, conditions, qs);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
throw new n8n_workflow_1.NodeOperationError(ctx.getNode(), `Unknown contact operation "${operation}"`, { itemIndex: i });
|
|
120
|
+
}
|
|
121
|
+
async function updateRecordOrKeep(ctx, cache, table, id, i, existing) {
|
|
122
|
+
const champs = await mappedValues(ctx, cache, table, i);
|
|
123
|
+
if (!Object.keys(champs).length)
|
|
124
|
+
return present(ctx, cache, table, existing, param(ctx, 'options', i, {}));
|
|
125
|
+
return updateRecord(ctx, cache, table, id, i);
|
|
126
|
+
}
|
|
127
|
+
async function row(ctx, cache, operation, i) {
|
|
128
|
+
var _a, _b;
|
|
129
|
+
const table = locator(ctx, 'table', i);
|
|
130
|
+
if (!table)
|
|
131
|
+
throw new n8n_workflow_1.NodeOperationError(ctx.getNode(), 'Choose a table', { itemIndex: i });
|
|
132
|
+
switch (operation) {
|
|
133
|
+
case 'create':
|
|
134
|
+
return createRecord(ctx, cache, table, i);
|
|
135
|
+
case 'get':
|
|
136
|
+
return getRecord(ctx, cache, table, param(ctx, 'rowId', i).trim(), i);
|
|
137
|
+
case 'update':
|
|
138
|
+
return updateRecord(ctx, cache, table, param(ctx, 'rowId', i).trim(), i);
|
|
139
|
+
case 'delete':
|
|
140
|
+
return deleteRecord(ctx, param(ctx, 'rowId', i).trim());
|
|
141
|
+
case 'getAll': {
|
|
142
|
+
const filters = param(ctx, 'filters', i, {});
|
|
143
|
+
const columns = await cache.columnsOf(table);
|
|
144
|
+
const conditions = (_b = (_a = filters.conditions) === null || _a === void 0 ? void 0 : _a.condition) !== null && _b !== void 0 ? _b : [];
|
|
145
|
+
const filtersIn = conditions
|
|
146
|
+
.filter((c) => c.column)
|
|
147
|
+
.map((c) => { var _a; return `${String(c.column)}:${String((_a = c.operator) !== null && _a !== void 0 ? _a : 'eq')}:${filterValue(columns, c)}`.replace(/:$/, ''); });
|
|
148
|
+
const qs = {};
|
|
149
|
+
if (filters.search)
|
|
150
|
+
qs.recherche = filters.search;
|
|
151
|
+
if (filters.updatedSince)
|
|
152
|
+
qs.modifie_depuis = filters.updatedSince;
|
|
153
|
+
return listRecords(ctx, cache, table, i, filtersIn, qs);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
throw new n8n_workflow_1.NodeOperationError(ctx.getNode(), `Unknown row operation "${operation}"`, { itemIndex: i });
|
|
157
|
+
}
|
|
158
|
+
function filterValue(columns, condition) {
|
|
159
|
+
var _a, _b;
|
|
160
|
+
if (condition.operator === 'vide' || condition.operator === 'non_vide')
|
|
161
|
+
return '';
|
|
162
|
+
const raw = String((_a = condition.value) !== null && _a !== void 0 ? _a : '');
|
|
163
|
+
const column = columns.find((c) => c.id === condition.column);
|
|
164
|
+
if ((column === null || column === void 0 ? void 0 : column.type) === 'selection' || (column === null || column === void 0 ? void 0 : column.type) === 'selection_multiple') {
|
|
165
|
+
const option = (_b = column.options) === null || _b === void 0 ? void 0 : _b.find((o) => o.libelle.toLowerCase() === raw.trim().toLowerCase());
|
|
166
|
+
return option ? option.id : raw;
|
|
167
|
+
}
|
|
168
|
+
if ((column === null || column === void 0 ? void 0 : column.type) === 'monetaire') {
|
|
169
|
+
const amount = Number(raw.replace(',', '.'));
|
|
170
|
+
return Number.isFinite(amount) ? String(Math.round(amount * 100)) : raw;
|
|
171
|
+
}
|
|
172
|
+
return raw;
|
|
173
|
+
}
|
|
174
|
+
async function contract(ctx, operation, i) {
|
|
175
|
+
var _a, _b, _c;
|
|
176
|
+
switch (operation) {
|
|
177
|
+
case 'send': {
|
|
178
|
+
const more = param(ctx, 'additionalFields', i, {});
|
|
179
|
+
const amount = param(ctx, 'amount', i, 0);
|
|
180
|
+
const body = {
|
|
181
|
+
modele_id: locator(ctx, 'templateId', i),
|
|
182
|
+
contact_id: locator(ctx, 'signerId', i),
|
|
183
|
+
montant_cents: Math.round(Number(amount) * 100),
|
|
184
|
+
};
|
|
185
|
+
if (more.title)
|
|
186
|
+
body.titre = more.title;
|
|
187
|
+
if (more.sendEmail === false)
|
|
188
|
+
body.envoyer_email = false;
|
|
189
|
+
if (more.emailTemplateId)
|
|
190
|
+
body.message_email_id = String(more.emailTemplateId).trim();
|
|
191
|
+
const headers = more.idempotencyKey ? { 'Idempotency-Key': String(more.idempotencyKey) } : {};
|
|
192
|
+
const response = await transport_1.kapacityApiRequest.call(ctx, 'POST', '/contracts', automationsQs(more), body, headers);
|
|
193
|
+
const email = (_a = response.email) !== null && _a !== void 0 ? _a : {};
|
|
194
|
+
return {
|
|
195
|
+
...response.contrat,
|
|
196
|
+
email_sent: email.envoye === true,
|
|
197
|
+
email_to: (_b = email.a) !== null && _b !== void 0 ? _b : null,
|
|
198
|
+
email_not_sent_reason: (_c = email.raison) !== null && _c !== void 0 ? _c : null,
|
|
199
|
+
};
|
|
200
|
+
}
|
|
201
|
+
case 'get': {
|
|
202
|
+
const response = await transport_1.kapacityApiRequest.call(ctx, 'GET', `/contracts/${locator(ctx, 'contractId', i)}`);
|
|
203
|
+
return { ...response.contrat, audit_trail: response.piste_audit };
|
|
204
|
+
}
|
|
205
|
+
case 'getAll': {
|
|
206
|
+
const filters = param(ctx, 'filters', i, {});
|
|
207
|
+
const qs = {};
|
|
208
|
+
if (filters.since)
|
|
209
|
+
qs.depuis = filters.since;
|
|
210
|
+
if (filters.status)
|
|
211
|
+
qs.statut = filters.status;
|
|
212
|
+
if (filters.contact)
|
|
213
|
+
qs.contact = String(filters.contact).trim();
|
|
214
|
+
return listOf(ctx, i, '/contracts', 'contrats', qs);
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
throw new n8n_workflow_1.NodeOperationError(ctx.getNode(), `Unknown contract operation "${operation}"`, { itemIndex: i });
|
|
218
|
+
}
|
|
219
|
+
async function simpleList(ctx, path, key) {
|
|
220
|
+
var _a;
|
|
221
|
+
const response = await transport_1.kapacityApiRequest.call(ctx, 'GET', path);
|
|
222
|
+
return (_a = response[key]) !== null && _a !== void 0 ? _a : [];
|
|
223
|
+
}
|
|
224
|
+
function datesAndStatus(filters) {
|
|
225
|
+
const qs = {};
|
|
226
|
+
if (filters.since)
|
|
227
|
+
qs.depuis = filters.since;
|
|
228
|
+
if (filters.until)
|
|
229
|
+
qs.jusqu_a = filters.until;
|
|
230
|
+
if (filters.status)
|
|
231
|
+
qs.statut = filters.status;
|
|
232
|
+
if (filters.contact)
|
|
233
|
+
qs.contact = String(filters.contact).trim();
|
|
234
|
+
return qs;
|
|
235
|
+
}
|
|
236
|
+
async function runOperation(ctx, cache, resource, operation, i) {
|
|
237
|
+
switch (resource) {
|
|
238
|
+
case 'contact':
|
|
239
|
+
return contact(ctx, cache, operation, i);
|
|
240
|
+
case 'row':
|
|
241
|
+
return row(ctx, cache, operation, i);
|
|
242
|
+
case 'contract':
|
|
243
|
+
return contract(ctx, operation, i);
|
|
244
|
+
case 'table':
|
|
245
|
+
if (operation === 'getColumns') {
|
|
246
|
+
return (await cache.columnsOf(locator(ctx, 'table', i)));
|
|
247
|
+
}
|
|
248
|
+
return simpleList(ctx, '/tables', 'tables');
|
|
249
|
+
case 'contractTemplate':
|
|
250
|
+
return simpleList(ctx, '/contract-templates', 'modeles');
|
|
251
|
+
case 'appointment':
|
|
252
|
+
return listOf(ctx, i, '/bookings', 'rendez_vous', datesAndStatus(param(ctx, 'filters', i, {})));
|
|
253
|
+
case 'appointmentType':
|
|
254
|
+
return simpleList(ctx, '/event-types', 'types_de_rendez_vous');
|
|
255
|
+
case 'form':
|
|
256
|
+
return simpleList(ctx, '/forms', 'formulaires');
|
|
257
|
+
case 'formResponse': {
|
|
258
|
+
const filters = param(ctx, 'filters', i, {});
|
|
259
|
+
const qs = {};
|
|
260
|
+
if (filters.since)
|
|
261
|
+
qs.depuis = filters.since;
|
|
262
|
+
if (filters.qualified !== undefined)
|
|
263
|
+
qs.qualifie = filters.qualified ? 'true' : 'false';
|
|
264
|
+
return listOf(ctx, i, `/forms/${locator(ctx, 'formId', i)}/responses`, 'reponses', qs);
|
|
265
|
+
}
|
|
266
|
+
case 'product':
|
|
267
|
+
return simpleList(ctx, '/products', 'produits');
|
|
268
|
+
case 'payment':
|
|
269
|
+
return listOf(ctx, i, '/payments', 'paiements', datesAndStatus(param(ctx, 'filters', i, {})));
|
|
270
|
+
case 'member':
|
|
271
|
+
return simpleList(ctx, '/members', 'membres');
|
|
272
|
+
case 'workspace':
|
|
273
|
+
return transport_1.kapacityApiRequest.call(ctx, 'GET', '/me');
|
|
274
|
+
}
|
|
275
|
+
throw new n8n_workflow_1.NodeOperationError(ctx.getNode(), `Unknown resource "${resource}"`, { itemIndex: i });
|
|
276
|
+
}
|
|
277
|
+
//# sourceMappingURL=actions.js.map
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ILoadOptionsFunctions, INodeListSearchResult, INodePropertyOptions, ResourceMapperFields } from 'n8n-workflow';
|
|
2
|
+
export declare const listSearch: {
|
|
3
|
+
searchContacts(this: ILoadOptionsFunctions, filter?: string): Promise<INodeListSearchResult>;
|
|
4
|
+
searchAllContacts(this: ILoadOptionsFunctions, filter?: string): Promise<INodeListSearchResult>;
|
|
5
|
+
searchTables(this: ILoadOptionsFunctions, filter?: string): Promise<INodeListSearchResult>;
|
|
6
|
+
searchContractTemplates(this: ILoadOptionsFunctions, filter?: string): Promise<INodeListSearchResult>;
|
|
7
|
+
searchContracts(this: ILoadOptionsFunctions, filter?: string): Promise<INodeListSearchResult>;
|
|
8
|
+
searchForms(this: ILoadOptionsFunctions, filter?: string): Promise<INodeListSearchResult>;
|
|
9
|
+
};
|
|
10
|
+
export declare const loadOptions: {
|
|
11
|
+
getContactStatuses(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;
|
|
12
|
+
getTableColumns(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;
|
|
13
|
+
};
|
|
14
|
+
export declare const resourceMapping: {
|
|
15
|
+
getContactFields(this: ILoadOptionsFunctions): Promise<ResourceMapperFields>;
|
|
16
|
+
getRowFields(this: ILoadOptionsFunctions): Promise<ResourceMapperFields>;
|
|
17
|
+
};
|