n8n-nodes-kapacity 0.1.4 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
|
@@ -74,7 +74,7 @@ You need a Kapacity workspace, as an administrator, and an API key. The Kapacity
|
|
|
74
74
|
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.
|
|
75
75
|
3. Click **Créer la clé** and copy the key (it starts with `kap_live_`): it is shown only once.
|
|
76
76
|
4. Copy the workspace ID shown in the same card (**Identifiant de votre espace**).
|
|
77
|
-
5. In n8n, create a **Kapacity API** credential and paste the key and the workspace ID. Leave **Base URL** as `https://kapacity.app
|
|
77
|
+
5. In n8n, create a **Kapacity API** credential and paste the key and the workspace ID. Leave **Base URL** as `https://kapacity.app`: the Kapacity address only, without `/api/v1/w/…` after it (since 0.1.5, a Base URL pasted with that path is brought back to the Kapacity address).
|
|
78
78
|
|
|
79
79
|
n8n checks the credential by calling the API: a wrong key or a key from another workspace is reported at once.
|
|
80
80
|
|
|
@@ -32,7 +32,7 @@ class KapacityApi {
|
|
|
32
32
|
name: 'baseUrl',
|
|
33
33
|
type: 'string',
|
|
34
34
|
default: 'https://kapacity.app',
|
|
35
|
-
description: 'Only change this if Kapacity gave you another address',
|
|
35
|
+
description: 'The Kapacity address only, without /api/v1/w/… after it: the node adds that path itself. Only change this if Kapacity gave you another address',
|
|
36
36
|
},
|
|
37
37
|
];
|
|
38
38
|
this.authenticate = {
|
|
@@ -45,7 +45,7 @@ class KapacityApi {
|
|
|
45
45
|
};
|
|
46
46
|
this.test = {
|
|
47
47
|
request: {
|
|
48
|
-
baseURL: '={{$credentials.baseUrl.replace(/\\/+$/, "")}}/api/v1/w/{{$credentials.workspaceId}}',
|
|
48
|
+
baseURL: '={{$credentials.baseUrl.trim().replace(/\\/+$/, "").replace(/\\/api(\\/v1(\\/w(\\/[^/]*)?)?)?$/i, "")}}/api/v1/w/{{$credentials.workspaceId}}',
|
|
49
49
|
url: '/me',
|
|
50
50
|
method: 'GET',
|
|
51
51
|
},
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { IDataObject, IExecuteFunctions, IHookFunctions, IHttpRequestMethods, ILoadOptionsFunctions } from 'n8n-workflow';
|
|
2
2
|
type Context = IExecuteFunctions | ILoadOptionsFunctions | IHookFunctions;
|
|
3
|
+
export declare function kapacityOrigin(raw: unknown): string;
|
|
3
4
|
export declare function kapacityApiRequest(this: Context, method: IHttpRequestMethods, path: string, qs?: IDataObject, body?: IDataObject | undefined, headers?: IDataObject): Promise<IDataObject>;
|
|
4
5
|
export declare function kapacityApiRequestAll(this: IExecuteFunctions | ILoadOptionsFunctions, path: string, listKey: string, qs?: IDataObject, limit?: number): Promise<IDataObject[]>;
|
|
5
6
|
export {};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.kapacityOrigin = kapacityOrigin;
|
|
3
4
|
exports.kapacityApiRequest = kapacityApiRequest;
|
|
4
5
|
exports.kapacityApiRequestAll = kapacityApiRequestAll;
|
|
5
6
|
const n8n_workflow_1 = require("n8n-workflow");
|
|
@@ -19,11 +20,18 @@ const MESSAGES = {
|
|
|
19
20
|
disjoncteur: 'Writes to this record are paused: it was changed too often in a few seconds (loop protection)',
|
|
20
21
|
limite_plan: 'A limit of the workspace plan is reached',
|
|
21
22
|
api_fermee: 'The API is not open on this workspace yet',
|
|
23
|
+
adresse_de_base: 'The Base URL of the credentials already contains the API path: set it to https://kapacity.app only, the node adds the rest',
|
|
24
|
+
adresse_inconnue: 'This address does not exist in the Kapacity API',
|
|
22
25
|
};
|
|
26
|
+
function kapacityOrigin(raw) {
|
|
27
|
+
const base = String(raw || 'https://kapacity.app')
|
|
28
|
+
.trim()
|
|
29
|
+
.replace(/\/+$/, '');
|
|
30
|
+
return base.replace(/\/api(\/v1(\/w(\/[^/]*)?)?)?$/i, '') || 'https://kapacity.app';
|
|
31
|
+
}
|
|
23
32
|
async function baseOf(ctx) {
|
|
24
33
|
const credentials = await ctx.getCredentials('kapacityApi');
|
|
25
|
-
|
|
26
|
-
return `${base}/api/v1/w/${String(credentials.workspaceId).trim()}`;
|
|
34
|
+
return `${kapacityOrigin(credentials.baseUrl)}/api/v1/w/${String(credentials.workspaceId).trim()}`;
|
|
27
35
|
}
|
|
28
36
|
async function kapacityApiRequest(method, path, qs = {}, body = undefined, headers = {}) {
|
|
29
37
|
var _a;
|
package/dist/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "n8n-nodes-kapacity",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.5",
|
|
4
4
|
"description": "n8n nodes for Kapacity, the all-in-one sales CRM: contacts, CRM tables, contracts with e-signature, appointments, forms, payments and real-time webhooks.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://github.com/kapacity-saas/n8n-nodes-kapacity#readme",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "n8n-nodes-kapacity",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.5",
|
|
4
4
|
"description": "n8n nodes for Kapacity, the all-in-one sales CRM: contacts, CRM tables, contracts with e-signature, appointments, forms, payments and real-time webhooks.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://github.com/kapacity-saas/n8n-nodes-kapacity#readme",
|