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
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.resourceMapping = exports.loadOptions = exports.listSearch = void 0;
|
|
4
|
+
const columns_1 = require("./shared/columns");
|
|
5
|
+
const transport_1 = require("./shared/transport");
|
|
6
|
+
const locatorValue = (ctx, name) => { var _a; return String((_a = ctx.getCurrentNodeParameter(name, { extractValue: true })) !== null && _a !== void 0 ? _a : ''); };
|
|
7
|
+
const matches = (filter, ...texts) => {
|
|
8
|
+
if (!filter)
|
|
9
|
+
return true;
|
|
10
|
+
const f = filter.toLowerCase();
|
|
11
|
+
return texts.some((t) => typeof t === 'string' && t.toLowerCase().includes(f));
|
|
12
|
+
};
|
|
13
|
+
function contactItem(row, baseName) {
|
|
14
|
+
var _a;
|
|
15
|
+
const fields = (_a = row.champs) !== null && _a !== void 0 ? _a : {};
|
|
16
|
+
const name = [fields.first_name, fields.last_name].filter(Boolean).join(' ') || '(no name)';
|
|
17
|
+
const email = fields.email ? ` · ${String(fields.email)}` : '';
|
|
18
|
+
return { name: `${name}${email}${baseName ? ` (${baseName})` : ''}`, value: String(row.id) };
|
|
19
|
+
}
|
|
20
|
+
async function searchIn(ctx, base, filter) {
|
|
21
|
+
var _a;
|
|
22
|
+
const qs = { limite: 50 };
|
|
23
|
+
if (filter)
|
|
24
|
+
qs.recherche = filter;
|
|
25
|
+
const response = await transport_1.kapacityApiRequest.call(ctx, 'GET', `/tables/${base}/records`, qs);
|
|
26
|
+
return (_a = response.lignes) !== null && _a !== void 0 ? _a : [];
|
|
27
|
+
}
|
|
28
|
+
exports.listSearch = {
|
|
29
|
+
async searchContacts(filter) {
|
|
30
|
+
var _a;
|
|
31
|
+
const base = String((_a = this.getCurrentNodeParameter('base')) !== null && _a !== void 0 ? _a : 'leads');
|
|
32
|
+
return { results: (await searchIn(this, base, filter)).map((row) => contactItem(row)) };
|
|
33
|
+
},
|
|
34
|
+
async searchAllContacts(filter) {
|
|
35
|
+
const [pipe, setting] = await Promise.all([searchIn(this, 'leads', filter), searchIn(this, 'leads_setting', filter)]);
|
|
36
|
+
return {
|
|
37
|
+
results: [
|
|
38
|
+
...pipe.map((row) => contactItem(row, 'Mon Pipe')),
|
|
39
|
+
...setting.map((row) => contactItem(row, 'Setting')),
|
|
40
|
+
],
|
|
41
|
+
};
|
|
42
|
+
},
|
|
43
|
+
async searchTables(filter) {
|
|
44
|
+
var _a;
|
|
45
|
+
const response = await transport_1.kapacityApiRequest.call(this, 'GET', '/tables');
|
|
46
|
+
const tables = ((_a = response.tables) !== null && _a !== void 0 ? _a : []).filter((t) => !columns_1.CONTACT_BASES.includes(String(t.id)) && matches(filter, t.nom, t.base_libelle));
|
|
47
|
+
return {
|
|
48
|
+
results: tables.map((t) => { var _a; return ({ name: `${String(t.nom)} (${String((_a = t.base_libelle) !== null && _a !== void 0 ? _a : '')})`, value: String(t.id) }); }),
|
|
49
|
+
};
|
|
50
|
+
},
|
|
51
|
+
async searchContractTemplates(filter) {
|
|
52
|
+
var _a;
|
|
53
|
+
const response = await transport_1.kapacityApiRequest.call(this, 'GET', '/contract-templates');
|
|
54
|
+
const templates = ((_a = response.modeles) !== null && _a !== void 0 ? _a : []).filter((t) => matches(filter, t.titre));
|
|
55
|
+
return {
|
|
56
|
+
results: templates.map((t) => {
|
|
57
|
+
var _a;
|
|
58
|
+
return ({
|
|
59
|
+
name: t.utilisable ? String(t.titre) : `${String(t.titre)} (not available: ${String((_a = t.raison) !== null && _a !== void 0 ? _a : '')})`,
|
|
60
|
+
value: String(t.id),
|
|
61
|
+
});
|
|
62
|
+
}),
|
|
63
|
+
};
|
|
64
|
+
},
|
|
65
|
+
async searchContracts(filter) {
|
|
66
|
+
var _a;
|
|
67
|
+
const response = await transport_1.kapacityApiRequest.call(this, 'GET', '/contracts', { limite: 100 });
|
|
68
|
+
const contracts = ((_a = response.contrats) !== null && _a !== void 0 ? _a : []).filter((c) => { var _a; return matches(filter, c.titre, (_a = c.contact) === null || _a === void 0 ? void 0 : _a.nom); });
|
|
69
|
+
return {
|
|
70
|
+
results: contracts.map((c) => ({ name: `${String(c.titre)} · ${String(c.statut)}`, value: String(c.id) })),
|
|
71
|
+
};
|
|
72
|
+
},
|
|
73
|
+
async searchForms(filter) {
|
|
74
|
+
var _a;
|
|
75
|
+
const response = await transport_1.kapacityApiRequest.call(this, 'GET', '/forms');
|
|
76
|
+
const forms = ((_a = response.formulaires) !== null && _a !== void 0 ? _a : []).filter((f) => matches(filter, f.titre));
|
|
77
|
+
return { results: forms.map((f) => ({ name: String(f.titre), value: String(f.id) })) };
|
|
78
|
+
},
|
|
79
|
+
};
|
|
80
|
+
exports.loadOptions = {
|
|
81
|
+
async getContactStatuses() {
|
|
82
|
+
var _a, _b;
|
|
83
|
+
const base = String((_a = this.getCurrentNodeParameter('base')) !== null && _a !== void 0 ? _a : 'leads');
|
|
84
|
+
const status = (await columns_1.getColumns.call(this, base)).find((c) => c.id === 'status_id');
|
|
85
|
+
return ((_b = status === null || status === void 0 ? void 0 : status.options) !== null && _b !== void 0 ? _b : []).map((o) => ({ name: o.libelle, value: o.id }));
|
|
86
|
+
},
|
|
87
|
+
async getTableColumns() {
|
|
88
|
+
const table = locatorValue(this, 'table');
|
|
89
|
+
if (!table)
|
|
90
|
+
return [];
|
|
91
|
+
return (await columns_1.getColumns.call(this, table)).map((c) => ({ name: c.nom, value: c.id }));
|
|
92
|
+
},
|
|
93
|
+
};
|
|
94
|
+
exports.resourceMapping = {
|
|
95
|
+
async getContactFields() {
|
|
96
|
+
var _a, _b;
|
|
97
|
+
const base = String((_a = this.getCurrentNodeParameter('base')) !== null && _a !== void 0 ? _a : 'leads');
|
|
98
|
+
const operation = String((_b = this.getCurrentNodeParameter('operation')) !== null && _b !== void 0 ? _b : '');
|
|
99
|
+
const [columns, members] = await Promise.all([columns_1.getColumns.call(this, base), columns_1.getMembers.call(this)]);
|
|
100
|
+
const usable = operation === 'upsert' ? columns.filter((c) => c.id !== 'email') : columns;
|
|
101
|
+
return { fields: (0, columns_1.toMapperFields)(usable, base, members) };
|
|
102
|
+
},
|
|
103
|
+
async getRowFields() {
|
|
104
|
+
const table = locatorValue(this, 'table');
|
|
105
|
+
if (!table)
|
|
106
|
+
return { fields: [] };
|
|
107
|
+
const [columns, members] = await Promise.all([columns_1.getColumns.call(this, table), columns_1.getMembers.call(this)]);
|
|
108
|
+
return { fields: (0, columns_1.toMapperFields)(columns.filter((c) => (0, columns_1.isWritable)(c, table)), table, members) };
|
|
109
|
+
},
|
|
110
|
+
};
|
|
111
|
+
//# sourceMappingURL=methods.js.map
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.contactDescription = void 0;
|
|
4
|
+
const descriptions_1 = require("../shared/descriptions");
|
|
5
|
+
const show = { resource: ['contact'] };
|
|
6
|
+
const on = (...operation) => ({ resource: ['contact'], operation });
|
|
7
|
+
exports.contactDescription = [
|
|
8
|
+
{
|
|
9
|
+
displayName: 'Operation',
|
|
10
|
+
name: 'operation',
|
|
11
|
+
type: 'options',
|
|
12
|
+
noDataExpression: true,
|
|
13
|
+
displayOptions: { show },
|
|
14
|
+
options: [
|
|
15
|
+
{ name: 'Create', value: 'create', action: 'Create contact', description: 'Create a new contact' },
|
|
16
|
+
{
|
|
17
|
+
name: 'Create or Update',
|
|
18
|
+
value: 'upsert',
|
|
19
|
+
action: 'Create or update contact',
|
|
20
|
+
description: 'Create a new record, or update the current one if it already exists (upsert)',
|
|
21
|
+
},
|
|
22
|
+
{ name: 'Delete', value: 'delete', action: 'Delete contact', description: 'Delete a contact permanently' },
|
|
23
|
+
{ name: 'Get', value: 'get', action: 'Get contact', description: 'Retrieve a contact' },
|
|
24
|
+
{ name: 'Get Many', value: 'getAll', action: 'Get many contacts', description: 'Retrieve a list of contacts' },
|
|
25
|
+
{ name: 'Update', value: 'update', action: 'Update contact', description: 'Update the fields of a contact' },
|
|
26
|
+
],
|
|
27
|
+
default: 'create',
|
|
28
|
+
},
|
|
29
|
+
(0, descriptions_1.contactBaseSelect)(show),
|
|
30
|
+
(0, descriptions_1.contactLocator)(on('get', 'update', 'delete')),
|
|
31
|
+
{
|
|
32
|
+
displayName: 'E-Mail',
|
|
33
|
+
name: 'email',
|
|
34
|
+
type: 'string',
|
|
35
|
+
placeholder: 'e.g. nathan@example.com',
|
|
36
|
+
default: '',
|
|
37
|
+
required: true,
|
|
38
|
+
description: 'The e-mail that identifies the contact: if a contact of this base has it, it is updated, otherwise one is created',
|
|
39
|
+
displayOptions: { show: on('upsert') },
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
displayName: 'Fields',
|
|
43
|
+
name: 'fields',
|
|
44
|
+
type: 'resourceMapper',
|
|
45
|
+
noDataExpression: true,
|
|
46
|
+
default: { mappingMode: 'defineBelow', value: null },
|
|
47
|
+
required: true,
|
|
48
|
+
description: 'A new contact needs at least a first name or a last name. Fields left empty are not changed.',
|
|
49
|
+
typeOptions: {
|
|
50
|
+
loadOptionsDependsOn: ['base'],
|
|
51
|
+
resourceMapper: {
|
|
52
|
+
resourceMapperMethod: 'getContactFields',
|
|
53
|
+
mode: 'add',
|
|
54
|
+
fieldWords: { singular: 'field', plural: 'fields' },
|
|
55
|
+
addAllFields: false,
|
|
56
|
+
multiKeyMatch: false,
|
|
57
|
+
supportAutoMap: true,
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
displayOptions: { show: on('create', 'update', 'upsert') },
|
|
61
|
+
},
|
|
62
|
+
...(0, descriptions_1.paginationFields)(on('getAll')),
|
|
63
|
+
{
|
|
64
|
+
displayName: 'Filters',
|
|
65
|
+
name: 'filters',
|
|
66
|
+
type: 'collection',
|
|
67
|
+
placeholder: 'Add Filter',
|
|
68
|
+
default: {},
|
|
69
|
+
displayOptions: { show: on('getAll') },
|
|
70
|
+
options: [
|
|
71
|
+
{
|
|
72
|
+
displayName: 'E-Mail',
|
|
73
|
+
name: 'email',
|
|
74
|
+
type: 'string',
|
|
75
|
+
placeholder: 'e.g. nathan@example.com',
|
|
76
|
+
default: '',
|
|
77
|
+
description: 'Only the contact that has exactly this e-mail',
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
displayName: 'Search',
|
|
81
|
+
name: 'search',
|
|
82
|
+
type: 'string',
|
|
83
|
+
placeholder: 'e.g. Smith',
|
|
84
|
+
default: '',
|
|
85
|
+
description: 'Text searched in the name, e-mail, company, phone and text fields',
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
displayName: 'Status Name or ID',
|
|
89
|
+
name: 'status',
|
|
90
|
+
type: 'options',
|
|
91
|
+
typeOptions: { loadOptionsMethod: 'getContactStatuses', loadOptionsDependsOn: ['base'] },
|
|
92
|
+
default: '',
|
|
93
|
+
description: 'Only the contacts in this commercial status. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
|
|
94
|
+
},
|
|
95
|
+
(0, descriptions_1.dateFilter)('Updated Since', 'updatedSince', 'Only the contacts changed at or after this date'),
|
|
96
|
+
],
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
displayName: 'Options',
|
|
100
|
+
name: 'options',
|
|
101
|
+
type: 'collection',
|
|
102
|
+
placeholder: 'Add Option',
|
|
103
|
+
default: {},
|
|
104
|
+
displayOptions: { show: on('create', 'update', 'upsert', 'get', 'getAll') },
|
|
105
|
+
options: [
|
|
106
|
+
descriptions_1.outputFormatOption,
|
|
107
|
+
{ ...descriptions_1.triggerAutomationsOption, displayOptions: { show: { '/operation': ['create', 'update', 'upsert'] } } },
|
|
108
|
+
],
|
|
109
|
+
},
|
|
110
|
+
];
|
|
111
|
+
//# sourceMappingURL=contact.js.map
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.contractDescription = exports.CONTRACT_STATUSES = void 0;
|
|
4
|
+
const descriptions_1 = require("../shared/descriptions");
|
|
5
|
+
const show = { resource: ['contract'] };
|
|
6
|
+
const on = (...operation) => ({ resource: ['contract'], operation });
|
|
7
|
+
exports.CONTRACT_STATUSES = [
|
|
8
|
+
{ name: 'Draft', value: 'brouillon' },
|
|
9
|
+
{ name: 'Sent', value: 'envoye' },
|
|
10
|
+
{ name: 'Viewed', value: 'vu' },
|
|
11
|
+
{ name: 'Signed', value: 'signe' },
|
|
12
|
+
];
|
|
13
|
+
exports.contractDescription = [
|
|
14
|
+
{
|
|
15
|
+
displayName: 'Operation',
|
|
16
|
+
name: 'operation',
|
|
17
|
+
type: 'options',
|
|
18
|
+
noDataExpression: true,
|
|
19
|
+
displayOptions: { show },
|
|
20
|
+
options: [
|
|
21
|
+
{ name: 'Get', value: 'get', action: 'Get contract', description: 'Retrieve a contract and its audit trail' },
|
|
22
|
+
{ name: 'Get Many', value: 'getAll', action: 'Get many contracts', description: 'Retrieve a list of contracts' },
|
|
23
|
+
{
|
|
24
|
+
name: 'Send',
|
|
25
|
+
value: 'send',
|
|
26
|
+
action: 'Send contract',
|
|
27
|
+
description: 'Create a contract from a template and send it to a contact for e-signature',
|
|
28
|
+
},
|
|
29
|
+
],
|
|
30
|
+
default: 'send',
|
|
31
|
+
},
|
|
32
|
+
(0, descriptions_1.simpleLocator)(on('send'), {
|
|
33
|
+
displayName: 'Contract Template',
|
|
34
|
+
name: 'templateId',
|
|
35
|
+
method: 'searchContractTemplates',
|
|
36
|
+
placeholder: 'Select a template...',
|
|
37
|
+
description: 'The contract template to fill in and send',
|
|
38
|
+
}),
|
|
39
|
+
(0, descriptions_1.contactLocator)(on('send'), 'signerId'),
|
|
40
|
+
{
|
|
41
|
+
displayName: 'Amount (€)',
|
|
42
|
+
name: 'amount',
|
|
43
|
+
type: 'number',
|
|
44
|
+
typeOptions: { minValue: 0, numberPrecision: 2 },
|
|
45
|
+
default: 0,
|
|
46
|
+
required: true,
|
|
47
|
+
description: 'The contract amount, written in the contract in place of {{montant}}',
|
|
48
|
+
displayOptions: { show: on('send') },
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
displayName: 'Additional Fields',
|
|
52
|
+
name: 'additionalFields',
|
|
53
|
+
type: 'collection',
|
|
54
|
+
placeholder: 'Add Field',
|
|
55
|
+
default: {},
|
|
56
|
+
displayOptions: { show: on('send') },
|
|
57
|
+
options: [
|
|
58
|
+
{
|
|
59
|
+
displayName: 'E-Mail Template ID',
|
|
60
|
+
name: 'emailTemplateId',
|
|
61
|
+
type: 'string',
|
|
62
|
+
default: '',
|
|
63
|
+
placeholder: 'e.g. 8a6c4e2f-0b9d-4f7b-a5c3-1e9f7d5b3a1c',
|
|
64
|
+
description: 'Another contract e-mail template than the one attached to the contract template',
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
displayName: 'Idempotency Key',
|
|
68
|
+
name: 'idempotencyKey',
|
|
69
|
+
type: 'string',
|
|
70
|
+
default: '',
|
|
71
|
+
placeholder: 'e.g. deal-4821',
|
|
72
|
+
description: 'A unique text per contract (for example the ID of the deal). If the workflow runs twice with the same key, Kapacity returns the first contract instead of sending a second one.',
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
displayName: 'Send E-Mail',
|
|
76
|
+
name: 'sendEmail',
|
|
77
|
+
type: 'boolean',
|
|
78
|
+
default: true,
|
|
79
|
+
description: 'Whether Kapacity e-mails the contract to the contact. Turn off to send the signing link yourself (WhatsApp, SMS…): it is always in the output.',
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
displayName: 'Title',
|
|
83
|
+
name: 'title',
|
|
84
|
+
type: 'string',
|
|
85
|
+
default: '',
|
|
86
|
+
placeholder: 'e.g. Coaching programme · Nathan Smith',
|
|
87
|
+
description: 'Defaults to "<template> · <contact name>"',
|
|
88
|
+
},
|
|
89
|
+
descriptions_1.triggerAutomationsOption,
|
|
90
|
+
],
|
|
91
|
+
},
|
|
92
|
+
(0, descriptions_1.simpleLocator)(on('get'), {
|
|
93
|
+
displayName: 'Contract',
|
|
94
|
+
name: 'contractId',
|
|
95
|
+
method: 'searchContracts',
|
|
96
|
+
placeholder: 'Select a contract...',
|
|
97
|
+
description: 'The contract to retrieve',
|
|
98
|
+
}),
|
|
99
|
+
...(0, descriptions_1.paginationFields)(on('getAll')),
|
|
100
|
+
{
|
|
101
|
+
displayName: 'Filters',
|
|
102
|
+
name: 'filters',
|
|
103
|
+
type: 'collection',
|
|
104
|
+
placeholder: 'Add Filter',
|
|
105
|
+
default: {},
|
|
106
|
+
displayOptions: { show: on('getAll') },
|
|
107
|
+
options: [
|
|
108
|
+
{
|
|
109
|
+
displayName: 'Contact ID',
|
|
110
|
+
name: 'contact',
|
|
111
|
+
type: 'string',
|
|
112
|
+
default: '',
|
|
113
|
+
description: 'Only the contracts of this contact',
|
|
114
|
+
},
|
|
115
|
+
(0, descriptions_1.dateFilter)('Created Since', 'since', 'Only the contracts created at or after this date'),
|
|
116
|
+
{
|
|
117
|
+
displayName: 'Status',
|
|
118
|
+
name: 'status',
|
|
119
|
+
type: 'options',
|
|
120
|
+
options: exports.CONTRACT_STATUSES,
|
|
121
|
+
default: 'signe',
|
|
122
|
+
},
|
|
123
|
+
],
|
|
124
|
+
},
|
|
125
|
+
];
|
|
126
|
+
//# sourceMappingURL=contract.js.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { INodeProperties } from 'n8n-workflow';
|
|
2
|
+
export declare const tableDescription: INodeProperties[];
|
|
3
|
+
export declare const contractTemplateDescription: INodeProperties[];
|
|
4
|
+
export declare const appointmentDescription: INodeProperties[];
|
|
5
|
+
export declare const appointmentTypeDescription: INodeProperties[];
|
|
6
|
+
export declare const formDescription: INodeProperties[];
|
|
7
|
+
export declare const formResponseDescription: INodeProperties[];
|
|
8
|
+
export declare const productDescription: INodeProperties[];
|
|
9
|
+
export declare const paymentDescription: INodeProperties[];
|
|
10
|
+
export declare const memberDescription: INodeProperties[];
|
|
11
|
+
export declare const workspaceDescription: INodeProperties[];
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.workspaceDescription = exports.memberDescription = exports.paymentDescription = exports.productDescription = exports.formResponseDescription = exports.formDescription = exports.appointmentTypeDescription = exports.appointmentDescription = exports.contractTemplateDescription = exports.tableDescription = void 0;
|
|
4
|
+
const descriptions_1 = require("../shared/descriptions");
|
|
5
|
+
function operations(resource, options, defaultValue = 'getAll') {
|
|
6
|
+
return {
|
|
7
|
+
displayName: 'Operation',
|
|
8
|
+
name: 'operation',
|
|
9
|
+
type: 'options',
|
|
10
|
+
noDataExpression: true,
|
|
11
|
+
displayOptions: { show: { resource: [resource] } },
|
|
12
|
+
options,
|
|
13
|
+
default: defaultValue,
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
const getAll = (plural, description) => ({
|
|
17
|
+
name: 'Get Many',
|
|
18
|
+
value: 'getAll',
|
|
19
|
+
action: `Get many ${plural}`,
|
|
20
|
+
description,
|
|
21
|
+
});
|
|
22
|
+
exports.tableDescription = [
|
|
23
|
+
operations('table', [
|
|
24
|
+
{ name: 'Get Columns', value: 'getColumns', action: 'Get columns of table', description: 'List the columns of a table, with their type and choices' },
|
|
25
|
+
getAll('tables', 'Retrieve the tables of the CRM, contact bases included'),
|
|
26
|
+
], 'getColumns'),
|
|
27
|
+
(0, descriptions_1.tableLocator)({ resource: ['table'], operation: ['getColumns'] }),
|
|
28
|
+
];
|
|
29
|
+
exports.contractTemplateDescription = [
|
|
30
|
+
operations('contractTemplate', [
|
|
31
|
+
getAll('contract templates', 'Retrieve the contract templates, and whether each one can be sent now'),
|
|
32
|
+
]),
|
|
33
|
+
];
|
|
34
|
+
exports.appointmentDescription = [
|
|
35
|
+
operations('appointment', [getAll('appointments', 'Retrieve a list of appointments booked in Kapacity')]),
|
|
36
|
+
...(0, descriptions_1.paginationFields)({ resource: ['appointment'], operation: ['getAll'] }),
|
|
37
|
+
{
|
|
38
|
+
displayName: 'Filters',
|
|
39
|
+
name: 'filters',
|
|
40
|
+
type: 'collection',
|
|
41
|
+
placeholder: 'Add Filter',
|
|
42
|
+
default: {},
|
|
43
|
+
displayOptions: { show: { resource: ['appointment'], operation: ['getAll'] } },
|
|
44
|
+
options: [
|
|
45
|
+
{ displayName: 'Contact ID', name: 'contact', type: 'string', default: '', description: 'Only the appointments of this contact' },
|
|
46
|
+
(0, descriptions_1.dateFilter)('Starts After', 'since', 'Only the appointments starting at or after this date'),
|
|
47
|
+
(0, descriptions_1.dateFilter)('Starts Before', 'until', 'Only the appointments starting before this date'),
|
|
48
|
+
{
|
|
49
|
+
displayName: 'Status',
|
|
50
|
+
name: 'status',
|
|
51
|
+
type: 'options',
|
|
52
|
+
options: [
|
|
53
|
+
{ name: 'Canceled', value: 'annule' },
|
|
54
|
+
{ name: 'Completed', value: 'termine' },
|
|
55
|
+
{ name: 'Confirmed', value: 'confirme' },
|
|
56
|
+
],
|
|
57
|
+
default: 'confirme',
|
|
58
|
+
},
|
|
59
|
+
],
|
|
60
|
+
},
|
|
61
|
+
];
|
|
62
|
+
exports.appointmentTypeDescription = [
|
|
63
|
+
operations('appointmentType', [
|
|
64
|
+
getAll('appointment types', 'Retrieve the appointment types, with their public booking link'),
|
|
65
|
+
]),
|
|
66
|
+
];
|
|
67
|
+
exports.formDescription = [
|
|
68
|
+
operations('form', [getAll('forms', 'Retrieve the forms of the workspace, with their public link')]),
|
|
69
|
+
];
|
|
70
|
+
exports.formResponseDescription = [
|
|
71
|
+
operations('formResponse', [getAll('form responses', 'Retrieve the responses to a form, with their score')]),
|
|
72
|
+
(0, descriptions_1.simpleLocator)({ resource: ['formResponse'], operation: ['getAll'] }, {
|
|
73
|
+
displayName: 'Form',
|
|
74
|
+
name: 'formId',
|
|
75
|
+
method: 'searchForms',
|
|
76
|
+
placeholder: 'Select a form...',
|
|
77
|
+
description: 'The form whose responses to retrieve',
|
|
78
|
+
}),
|
|
79
|
+
...(0, descriptions_1.paginationFields)({ resource: ['formResponse'], operation: ['getAll'] }),
|
|
80
|
+
{
|
|
81
|
+
displayName: 'Filters',
|
|
82
|
+
name: 'filters',
|
|
83
|
+
type: 'collection',
|
|
84
|
+
placeholder: 'Add Filter',
|
|
85
|
+
default: {},
|
|
86
|
+
displayOptions: { show: { resource: ['formResponse'], operation: ['getAll'] } },
|
|
87
|
+
options: [
|
|
88
|
+
{
|
|
89
|
+
displayName: 'Qualified',
|
|
90
|
+
name: 'qualified',
|
|
91
|
+
type: 'boolean',
|
|
92
|
+
default: true,
|
|
93
|
+
description: 'Whether to keep only the qualified responses (on) or only the others (off)',
|
|
94
|
+
},
|
|
95
|
+
(0, descriptions_1.dateFilter)('Submitted Since', 'since', 'Only the responses submitted at or after this date'),
|
|
96
|
+
],
|
|
97
|
+
},
|
|
98
|
+
];
|
|
99
|
+
exports.productDescription = [
|
|
100
|
+
operations('product', [getAll('products', 'Retrieve the product catalogue, with prices')]),
|
|
101
|
+
];
|
|
102
|
+
exports.paymentDescription = [
|
|
103
|
+
operations('payment', [getAll('payments', 'Retrieve the payments received')]),
|
|
104
|
+
...(0, descriptions_1.paginationFields)({ resource: ['payment'], operation: ['getAll'] }),
|
|
105
|
+
{
|
|
106
|
+
displayName: 'Filters',
|
|
107
|
+
name: 'filters',
|
|
108
|
+
type: 'collection',
|
|
109
|
+
placeholder: 'Add Filter',
|
|
110
|
+
default: {},
|
|
111
|
+
displayOptions: { show: { resource: ['payment'], operation: ['getAll'] } },
|
|
112
|
+
options: [
|
|
113
|
+
{ displayName: 'Contact ID', name: 'contact', type: 'string', default: '', description: 'Only the payments of this contact' },
|
|
114
|
+
(0, descriptions_1.dateFilter)('Received After', 'since', 'Only the payments received at or after this date'),
|
|
115
|
+
(0, descriptions_1.dateFilter)('Received Before', 'until', 'Only the payments received before this date'),
|
|
116
|
+
{
|
|
117
|
+
displayName: 'Status',
|
|
118
|
+
name: 'status',
|
|
119
|
+
type: 'options',
|
|
120
|
+
options: [
|
|
121
|
+
{ name: 'Failed', value: 'failed' },
|
|
122
|
+
{ name: 'Succeeded', value: 'succeeded' },
|
|
123
|
+
],
|
|
124
|
+
default: 'succeeded',
|
|
125
|
+
},
|
|
126
|
+
],
|
|
127
|
+
},
|
|
128
|
+
];
|
|
129
|
+
exports.memberDescription = [
|
|
130
|
+
operations('member', [getAll('members', 'Retrieve the members of the workspace, with their roles and teams')]),
|
|
131
|
+
];
|
|
132
|
+
exports.workspaceDescription = [
|
|
133
|
+
operations('workspace', [
|
|
134
|
+
{ name: 'Get', value: 'get', action: 'Get workspace', description: 'Retrieve the workspace, its plan and the remaining API quota' },
|
|
135
|
+
], 'get'),
|
|
136
|
+
];
|
|
137
|
+
//# sourceMappingURL=reading.js.map
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ROW_ID_REGEX = exports.rowDescription = exports.ROW_OPERATORS = void 0;
|
|
4
|
+
const descriptions_1 = require("../shared/descriptions");
|
|
5
|
+
const show = { resource: ['row'] };
|
|
6
|
+
const on = (...operation) => ({ resource: ['row'], operation });
|
|
7
|
+
exports.ROW_OPERATORS = [
|
|
8
|
+
{ name: 'Equals', value: 'eq' },
|
|
9
|
+
{ name: 'Not Equals', value: 'ne' },
|
|
10
|
+
{ name: 'Contains', value: 'contient' },
|
|
11
|
+
{ name: 'Starts With', value: 'commence' },
|
|
12
|
+
{ name: 'Greater Than', value: 'gt' },
|
|
13
|
+
{ name: 'Greater Than or Equal', value: 'gte' },
|
|
14
|
+
{ name: 'Less Than', value: 'lt' },
|
|
15
|
+
{ name: 'Less Than or Equal', value: 'lte' },
|
|
16
|
+
{ name: 'Is Empty', value: 'vide' },
|
|
17
|
+
{ name: 'Is Not Empty', value: 'non_vide' },
|
|
18
|
+
];
|
|
19
|
+
exports.rowDescription = [
|
|
20
|
+
{
|
|
21
|
+
displayName: 'Operation',
|
|
22
|
+
name: 'operation',
|
|
23
|
+
type: 'options',
|
|
24
|
+
noDataExpression: true,
|
|
25
|
+
displayOptions: { show },
|
|
26
|
+
options: [
|
|
27
|
+
{ name: 'Create', value: 'create', action: 'Create row', description: 'Add a new row to a table' },
|
|
28
|
+
{ name: 'Delete', value: 'delete', action: 'Delete row', description: 'Delete a row permanently' },
|
|
29
|
+
{ name: 'Get', value: 'get', action: 'Get row', description: 'Retrieve a row from a table' },
|
|
30
|
+
{ name: 'Get Many', value: 'getAll', action: 'Get many rows', description: 'List the rows of a table' },
|
|
31
|
+
{ name: 'Update', value: 'update', action: 'Update row', description: 'Update the fields of a row' },
|
|
32
|
+
],
|
|
33
|
+
default: 'create',
|
|
34
|
+
},
|
|
35
|
+
(0, descriptions_1.tableLocator)(show),
|
|
36
|
+
{
|
|
37
|
+
displayName: 'Row ID',
|
|
38
|
+
name: 'rowId',
|
|
39
|
+
type: 'string',
|
|
40
|
+
default: '',
|
|
41
|
+
required: true,
|
|
42
|
+
placeholder: 'e.g. a1b2c3d4-5e6f-4a7b-8c9d-0e1f2a3b4c5d',
|
|
43
|
+
description: 'The ID of the row, as returned by "Get Many" or by the Kapacity Trigger',
|
|
44
|
+
displayOptions: { show: on('get', 'update', 'delete') },
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
displayName: 'Fields',
|
|
48
|
+
name: 'fields',
|
|
49
|
+
type: 'resourceMapper',
|
|
50
|
+
noDataExpression: true,
|
|
51
|
+
default: { mappingMode: 'defineBelow', value: null },
|
|
52
|
+
required: true,
|
|
53
|
+
description: 'Fields left empty are not changed. Formula, rollup and lookup columns cannot be written, so they are not listed.',
|
|
54
|
+
typeOptions: {
|
|
55
|
+
loadOptionsDependsOn: ['table.value'],
|
|
56
|
+
resourceMapper: {
|
|
57
|
+
resourceMapperMethod: 'getRowFields',
|
|
58
|
+
mode: 'add',
|
|
59
|
+
fieldWords: { singular: 'column', plural: 'columns' },
|
|
60
|
+
addAllFields: false,
|
|
61
|
+
supportAutoMap: true,
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
displayOptions: { show: on('create', 'update') },
|
|
65
|
+
},
|
|
66
|
+
...(0, descriptions_1.paginationFields)(on('getAll')),
|
|
67
|
+
{
|
|
68
|
+
displayName: 'Filters',
|
|
69
|
+
name: 'filters',
|
|
70
|
+
type: 'collection',
|
|
71
|
+
placeholder: 'Add Filter',
|
|
72
|
+
default: {},
|
|
73
|
+
displayOptions: { show: on('getAll') },
|
|
74
|
+
options: [
|
|
75
|
+
{
|
|
76
|
+
displayName: 'Search',
|
|
77
|
+
name: 'search',
|
|
78
|
+
type: 'string',
|
|
79
|
+
placeholder: 'e.g. Acme',
|
|
80
|
+
default: '',
|
|
81
|
+
description: 'Text searched in every text column of the table',
|
|
82
|
+
},
|
|
83
|
+
(0, descriptions_1.dateFilter)('Updated Since', 'updatedSince', 'Only the rows changed at or after this date'),
|
|
84
|
+
{
|
|
85
|
+
displayName: 'Conditions',
|
|
86
|
+
name: 'conditions',
|
|
87
|
+
type: 'fixedCollection',
|
|
88
|
+
typeOptions: { multipleValues: true },
|
|
89
|
+
placeholder: 'Add Condition',
|
|
90
|
+
default: {},
|
|
91
|
+
description: 'All conditions must match (AND)',
|
|
92
|
+
options: [
|
|
93
|
+
{
|
|
94
|
+
displayName: 'Condition',
|
|
95
|
+
name: 'condition',
|
|
96
|
+
values: [
|
|
97
|
+
{
|
|
98
|
+
displayName: 'Column Name or ID',
|
|
99
|
+
name: 'column',
|
|
100
|
+
type: 'options',
|
|
101
|
+
typeOptions: { loadOptionsMethod: 'getTableColumns', loadOptionsDependsOn: ['table.value'] },
|
|
102
|
+
default: '',
|
|
103
|
+
description: 'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>',
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
displayName: 'Operator',
|
|
107
|
+
name: 'operator',
|
|
108
|
+
type: 'options',
|
|
109
|
+
options: exports.ROW_OPERATORS,
|
|
110
|
+
default: 'eq',
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
displayName: 'Value',
|
|
114
|
+
name: 'value',
|
|
115
|
+
type: 'string',
|
|
116
|
+
default: '',
|
|
117
|
+
description: 'For a choice column, the label of the option (e.g. "Signed"). For an amount, the value in euros.',
|
|
118
|
+
displayOptions: { hide: { operator: ['vide', 'non_vide'] } },
|
|
119
|
+
},
|
|
120
|
+
],
|
|
121
|
+
},
|
|
122
|
+
],
|
|
123
|
+
},
|
|
124
|
+
],
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
displayName: 'Options',
|
|
128
|
+
name: 'options',
|
|
129
|
+
type: 'collection',
|
|
130
|
+
placeholder: 'Add Option',
|
|
131
|
+
default: {},
|
|
132
|
+
displayOptions: { show: on('create', 'update', 'get', 'getAll') },
|
|
133
|
+
options: [
|
|
134
|
+
descriptions_1.outputFormatOption,
|
|
135
|
+
{ ...descriptions_1.triggerAutomationsOption, displayOptions: { show: { '/operation': ['create', 'update'] } } },
|
|
136
|
+
],
|
|
137
|
+
},
|
|
138
|
+
];
|
|
139
|
+
exports.ROW_ID_REGEX = new RegExp(`^${descriptions_1.UUID_REGEX}$`);
|
|
140
|
+
//# sourceMappingURL=row.js.map
|