@limetech/n8n-nodes-lime 2.5.5 → 2.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +24 -0
- package/credentials/LimeFormsApi.credentials.ts +100 -0
- package/credentials/index.ts +1 -0
- package/dist/credentials/LimeFormsApi.credentials.d.ts +10 -0
- package/dist/credentials/LimeFormsApi.credentials.js +65 -0
- package/dist/credentials/LimeFormsApi.credentials.js.map +1 -0
- package/dist/credentials/index.d.ts +1 -0
- package/dist/credentials/index.js +1 -0
- package/dist/credentials/index.js.map +1 -1
- package/dist/nodes/{lime-crm/utils/hmac.js → common.js} +1 -1
- package/dist/nodes/common.js.map +1 -0
- package/dist/nodes/index.d.ts +1 -0
- package/dist/nodes/index.js +1 -0
- package/dist/nodes/index.js.map +1 -1
- package/dist/nodes/lime-crm/LimeCrmTrigger.node.js +2 -1
- package/dist/nodes/lime-crm/LimeCrmTrigger.node.js.map +1 -1
- package/dist/nodes/lime-crm/utils/index.d.ts +0 -1
- package/dist/nodes/lime-crm/utils/index.js +1 -3
- package/dist/nodes/lime-crm/utils/index.js.map +1 -1
- package/dist/nodes/lime-forms/LimeFormsTrigger.node.d.ts +17 -0
- package/dist/nodes/lime-forms/LimeFormsTrigger.node.js +187 -0
- package/dist/nodes/lime-forms/LimeFormsTrigger.node.js.map +1 -0
- package/dist/nodes/lime-forms/assets/lime-crm.svg +1 -0
- package/dist/nodes/lime-forms/index.d.ts +1 -0
- package/dist/nodes/lime-forms/index.js +18 -0
- package/dist/nodes/lime-forms/index.js.map +1 -0
- package/dist/nodes/lime-forms/transport/request.d.ts +11 -0
- package/dist/nodes/lime-forms/transport/request.js +42 -0
- package/dist/nodes/lime-forms/transport/request.js.map +1 -0
- package/dist/nodes/lime-forms/types/enums/ObservableAction.d.ts +6 -0
- package/dist/nodes/lime-forms/types/enums/ObservableAction.js +11 -0
- package/dist/nodes/lime-forms/types/enums/ObservableAction.js.map +1 -0
- package/dist/nodes/lime-forms/types/enums/ObservableType.d.ts +3 -0
- package/dist/nodes/lime-forms/types/enums/ObservableType.js +8 -0
- package/dist/nodes/lime-forms/types/enums/ObservableType.js.map +1 -0
- package/dist/nodes/lime-forms/types/resources/BaseResponse.d.ts +4 -0
- package/dist/nodes/lime-forms/types/resources/BaseResponse.js +3 -0
- package/dist/nodes/lime-forms/types/resources/BaseResponse.js.map +1 -0
- package/dist/nodes/lime-forms/types/resources/FormExternalIntegrationSimpleResource.d.ts +4 -0
- package/dist/nodes/lime-forms/types/resources/FormExternalIntegrationSimpleResource.js +3 -0
- package/dist/nodes/lime-forms/types/resources/FormExternalIntegrationSimpleResource.js.map +1 -0
- package/dist/nodes/lime-forms/types/resources/ObservableWebhookResources.d.ts +13 -0
- package/dist/nodes/lime-forms/types/resources/ObservableWebhookResources.js +3 -0
- package/dist/nodes/lime-forms/types/resources/ObservableWebhookResources.js.map +1 -0
- package/dist/nodes/lime-forms/utils/workflow.d.ts +2 -0
- package/dist/nodes/lime-forms/utils/workflow.js +13 -0
- package/dist/nodes/lime-forms/utils/workflow.js.map +1 -0
- package/dist/package.json +7 -2
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/docker-compose.yml +0 -0
- package/nodes/index.ts +1 -0
- package/nodes/lime-crm/LimeCrmTrigger.node.ts +2 -1
- package/nodes/lime-crm/utils/index.ts +0 -1
- package/nodes/lime-forms/LimeFormsTrigger.node.ts +258 -0
- package/nodes/lime-forms/assets/lime-crm.svg +1 -0
- package/nodes/lime-forms/index.ts +1 -0
- package/nodes/lime-forms/transport/request.ts +60 -0
- package/nodes/lime-forms/types/enums/ObservableAction.ts +7 -0
- package/nodes/lime-forms/types/enums/ObservableType.ts +3 -0
- package/nodes/lime-forms/types/resources/BaseResponse.ts +4 -0
- package/nodes/lime-forms/types/resources/FormExternalIntegrationSimpleResource.ts +4 -0
- package/nodes/lime-forms/types/resources/ObservableWebhookResources.ts +16 -0
- package/nodes/lime-forms/utils/workflow.ts +17 -0
- package/package.json +8 -3
- package/dist/nodes/lime-crm/utils/hmac.js.map +0 -1
- /package/dist/nodes/{lime-crm/utils/hmac.d.ts → common.d.ts} +0 -0
- /package/nodes/{lime-crm/utils/hmac.ts → common.ts} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,27 @@
|
|
|
1
|
+
## [2.6.1](https://github.com/Lundalogik/lime-n8n/compare/v2.6.0...v2.6.1) (2026-01-16)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* forms trigger under CRM name and logo ([#215](https://github.com/Lundalogik/lime-n8n/issues/215)) ([a9de4cb](https://github.com/Lundalogik/lime-n8n/commit/a9de4cbc3a28feca6243a8e90d88cb8da7c91033))
|
|
7
|
+
|
|
8
|
+
# [2.6.0](https://github.com/Lundalogik/lime-n8n/compare/v2.5.5...v2.6.0) (2026-01-12)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* handle duplicates when mismatching state between n8n and forms ([8ea7732](https://github.com/Lundalogik/lime-n8n/commit/8ea773254d5358d0b895484277315e2999507bd5))
|
|
14
|
+
* use function from crm node to verify signature ([a5e3d9d](https://github.com/Lundalogik/lime-n8n/commit/a5e3d9d059a6a21b154a979f40f9cec6f6a31f8c))
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Features
|
|
18
|
+
|
|
19
|
+
* data integrity validation ([daadd60](https://github.com/Lundalogik/lime-n8n/commit/daadd6007d9ad0af1dd0eac95263da0001f3a723))
|
|
20
|
+
* expose local network ([d136246](https://github.com/Lundalogik/lime-n8n/commit/d136246ea3dd557a7878e0c40da82da213eb0e7f))
|
|
21
|
+
* generate webhook secret in credentials ([e76b39c](https://github.com/Lundalogik/lime-n8n/commit/e76b39c95962752418a0d10ad2d9b5eb3bc2524e))
|
|
22
|
+
* return editor url for node to webhook ([fc7190c](https://github.com/Lundalogik/lime-n8n/commit/fc7190c308d0375f60670c34a65a83596f0d58bd))
|
|
23
|
+
* update .gitignore ([c6dce23](https://github.com/Lundalogik/lime-n8n/commit/c6dce2339b50a834e913a0fdfebc9a1b899eac03))
|
|
24
|
+
|
|
1
25
|
## [2.5.5](https://github.com/Lundalogik/lime-n8n/compare/v2.5.4...v2.5.5) (2026-01-09)
|
|
2
26
|
|
|
3
27
|
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ICredentialTestRequest,
|
|
3
|
+
ICredentialType,
|
|
4
|
+
INodeProperties,
|
|
5
|
+
IAuthenticate,
|
|
6
|
+
IHttpRequestMethods,
|
|
7
|
+
} from 'n8n-workflow';
|
|
8
|
+
import crypto from 'node:crypto';
|
|
9
|
+
|
|
10
|
+
export const FORMS_API_CREDENTIALS_NAME = 'limeFormsApi';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Credentials for Lime Forms
|
|
14
|
+
* --------------------------
|
|
15
|
+
*
|
|
16
|
+
* Allows n8n to connect to Lime Forms API.
|
|
17
|
+
*
|
|
18
|
+
* ## Authentication
|
|
19
|
+
* Uses Bearer Token authentication with an API key/token.
|
|
20
|
+
* Once the credentials are set up, it can be reused across multiple nodes/workflows.
|
|
21
|
+
* N8N will automatically include the API key all requests in Forms nodes.
|
|
22
|
+
*
|
|
23
|
+
* ## Required Fields
|
|
24
|
+
* - **Server URL:** The base URL of your Lime Forms instance.
|
|
25
|
+
* - Example: `https://instance.lime-forms.com`
|
|
26
|
+
*
|
|
27
|
+
* - **API Key:** The API key generated in Lime Forms.
|
|
28
|
+
* - You can obtain it from Lime Forms Admin, under settings page.
|
|
29
|
+
*
|
|
30
|
+
* ## Additional Fields
|
|
31
|
+
* - **Webhook Secret:** A hidden, automatically generated secret (32-byte hex string) used to
|
|
32
|
+
* verify incoming webhook requests from Lime Forms to n8n. This ensures no other entity can
|
|
33
|
+
* send webhooks to your Forms nodes in n8n.
|
|
34
|
+
*
|
|
35
|
+
* ## Testing Connection
|
|
36
|
+
* The `test` property verifies credentials by pinging an endpoint of the provided Lime Forms instance.
|
|
37
|
+
* If the response is successful (HTTP 200), the credentials are valid.
|
|
38
|
+
*
|
|
39
|
+
* ## Related Documentation
|
|
40
|
+
* - Lime Forms Internal Documentation: https://docs.lime-forms.com/
|
|
41
|
+
* - n8n Credentials Guide: https://docs.n8n.io/integrations/credentials/
|
|
42
|
+
* - Forms authentication layer, Laravel Sanctum: https://laravel.com/docs/12.x/sanctum
|
|
43
|
+
*
|
|
44
|
+
*/
|
|
45
|
+
export class LimeFormsApi implements ICredentialType {
|
|
46
|
+
name = FORMS_API_CREDENTIALS_NAME;
|
|
47
|
+
displayName = 'Lime Forms API';
|
|
48
|
+
documentationUrl = 'https://docs.lime-forms.com/';
|
|
49
|
+
properties: INodeProperties[] = [
|
|
50
|
+
{
|
|
51
|
+
displayName: 'Server URL',
|
|
52
|
+
name: 'url',
|
|
53
|
+
type: 'string',
|
|
54
|
+
default: '',
|
|
55
|
+
placeholder: 'https://instance.lime-forms.com',
|
|
56
|
+
required: true,
|
|
57
|
+
description: 'The URL of your Lime Forms instance',
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
displayName: 'API Key',
|
|
61
|
+
name: 'apiKey',
|
|
62
|
+
type: 'string',
|
|
63
|
+
typeOptions: {
|
|
64
|
+
password: true,
|
|
65
|
+
},
|
|
66
|
+
default: '',
|
|
67
|
+
required: true,
|
|
68
|
+
description: 'API key obtained from Lime Forms',
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
displayName: 'Webhook secret',
|
|
72
|
+
name: 'webhookSecret',
|
|
73
|
+
type: 'hidden',
|
|
74
|
+
typeOptions: {
|
|
75
|
+
password: true,
|
|
76
|
+
},
|
|
77
|
+
default: crypto.randomBytes(32).toString('hex'),
|
|
78
|
+
required: true,
|
|
79
|
+
description:
|
|
80
|
+
'A secret to verify integrity of incoming webhooks from Lime Forms',
|
|
81
|
+
},
|
|
82
|
+
];
|
|
83
|
+
|
|
84
|
+
test: ICredentialTestRequest = {
|
|
85
|
+
request: {
|
|
86
|
+
baseURL: '={{$credentials.url}}'.replace('/+$', ''),
|
|
87
|
+
url: '/api/v1/external-integrations/ping',
|
|
88
|
+
method: 'GET' as IHttpRequestMethods,
|
|
89
|
+
},
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
authenticate: IAuthenticate = {
|
|
93
|
+
type: 'generic',
|
|
94
|
+
properties: {
|
|
95
|
+
headers: {
|
|
96
|
+
Authorization: '=Bearer {{$credentials.apiKey}}',
|
|
97
|
+
},
|
|
98
|
+
},
|
|
99
|
+
};
|
|
100
|
+
}
|
package/credentials/index.ts
CHANGED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ICredentialTestRequest, ICredentialType, INodeProperties, IAuthenticate } from 'n8n-workflow';
|
|
2
|
+
export declare const FORMS_API_CREDENTIALS_NAME = "limeFormsApi";
|
|
3
|
+
export declare class LimeFormsApi implements ICredentialType {
|
|
4
|
+
name: string;
|
|
5
|
+
displayName: string;
|
|
6
|
+
documentationUrl: string;
|
|
7
|
+
properties: INodeProperties[];
|
|
8
|
+
test: ICredentialTestRequest;
|
|
9
|
+
authenticate: IAuthenticate;
|
|
10
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.LimeFormsApi = exports.FORMS_API_CREDENTIALS_NAME = void 0;
|
|
7
|
+
const node_crypto_1 = __importDefault(require("node:crypto"));
|
|
8
|
+
exports.FORMS_API_CREDENTIALS_NAME = 'limeFormsApi';
|
|
9
|
+
class LimeFormsApi {
|
|
10
|
+
constructor() {
|
|
11
|
+
this.name = exports.FORMS_API_CREDENTIALS_NAME;
|
|
12
|
+
this.displayName = 'Lime Forms API';
|
|
13
|
+
this.documentationUrl = 'https://docs.lime-forms.com/';
|
|
14
|
+
this.properties = [
|
|
15
|
+
{
|
|
16
|
+
displayName: 'Server URL',
|
|
17
|
+
name: 'url',
|
|
18
|
+
type: 'string',
|
|
19
|
+
default: '',
|
|
20
|
+
placeholder: 'https://instance.lime-forms.com',
|
|
21
|
+
required: true,
|
|
22
|
+
description: 'The URL of your Lime Forms instance',
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
displayName: 'API Key',
|
|
26
|
+
name: 'apiKey',
|
|
27
|
+
type: 'string',
|
|
28
|
+
typeOptions: {
|
|
29
|
+
password: true,
|
|
30
|
+
},
|
|
31
|
+
default: '',
|
|
32
|
+
required: true,
|
|
33
|
+
description: 'API key obtained from Lime Forms',
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
displayName: 'Webhook secret',
|
|
37
|
+
name: 'webhookSecret',
|
|
38
|
+
type: 'hidden',
|
|
39
|
+
typeOptions: {
|
|
40
|
+
password: true,
|
|
41
|
+
},
|
|
42
|
+
default: node_crypto_1.default.randomBytes(32).toString('hex'),
|
|
43
|
+
required: true,
|
|
44
|
+
description: 'A secret to verify integrity of incoming webhooks from Lime Forms',
|
|
45
|
+
},
|
|
46
|
+
];
|
|
47
|
+
this.test = {
|
|
48
|
+
request: {
|
|
49
|
+
baseURL: '={{$credentials.url}}'.replace('/+$', ''),
|
|
50
|
+
url: '/api/v1/external-integrations/ping',
|
|
51
|
+
method: 'GET',
|
|
52
|
+
},
|
|
53
|
+
};
|
|
54
|
+
this.authenticate = {
|
|
55
|
+
type: 'generic',
|
|
56
|
+
properties: {
|
|
57
|
+
headers: {
|
|
58
|
+
Authorization: '=Bearer {{$credentials.apiKey}}',
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
exports.LimeFormsApi = LimeFormsApi;
|
|
65
|
+
//# sourceMappingURL=LimeFormsApi.credentials.js.map
|
|
@@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I,EAAE,SAAS;YACf,UAAU,EAAE;gBACR,OAAO,EAAE;oBACL,aAAa,EAAE,iCAAiC;iBACnD;aACJ;SACJ,CAAC;IACN,CAAC;CAAA;AAvDD,oCAuDC"}
|
|
@@ -16,4 +16,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./LimeCrmApi.credentials"), exports);
|
|
18
18
|
__exportStar(require("./FortnoxApi.credentials"), exports);
|
|
19
|
+
__exportStar(require("./LimeFormsApi.credentials"), exports);
|
|
19
20
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../credentials/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2DAAyC;AACzC,2DAAyC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../credentials/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2DAAyC;AACzC,2DAAyC;AACzC,6DAA2C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../nodes/common.ts"],"names":[],"mappings":";;AA4BA,gCAMC;AAlCD,6CAAyC;AAYzC,SAAS,YAAY,CAAC,GAAW,EAAE,IAAY;IAC3C,OAAO,SAAS,GAAG,IAAA,wBAAU,EAAC,QAAQ,EAAE,GAAG,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAC5E,CAAC;AAcD,SAAgB,UAAU,CACtB,GAAW,EACX,IAAY,EACZ,YAAoB;IAEpB,OAAO,YAAY,CAAC,GAAG,EAAE,IAAI,CAAC,KAAK,YAAY,CAAC;AACpD,CAAC"}
|
package/dist/nodes/index.d.ts
CHANGED
package/dist/nodes/index.js
CHANGED
|
@@ -18,4 +18,5 @@ __exportStar(require("./response"), exports);
|
|
|
18
18
|
__exportStar(require("./lime-crm"), exports);
|
|
19
19
|
__exportStar(require("./fortnox"), exports);
|
|
20
20
|
__exportStar(require("./modules"), exports);
|
|
21
|
+
__exportStar(require("./lime-forms"), exports);
|
|
21
22
|
//# sourceMappingURL=index.js.map
|
package/dist/nodes/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../nodes/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,6CAA2B;AAC3B,6CAA2B;AAC3B,4CAA0B;AAC1B,4CAA0B"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../nodes/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,6CAA2B;AAC3B,6CAA2B;AAC3B,4CAA0B;AAC1B,4CAA0B;AAC1B,+CAA6B"}
|
|
@@ -6,6 +6,7 @@ const models_1 = require("./models");
|
|
|
6
6
|
const methods_1 = require("./methods");
|
|
7
7
|
const transport_1 = require("./transport");
|
|
8
8
|
const utils_1 = require("./utils");
|
|
9
|
+
const common_1 = require("../common");
|
|
9
10
|
class LimeCrmTrigger {
|
|
10
11
|
constructor() {
|
|
11
12
|
this.description = {
|
|
@@ -193,7 +194,7 @@ class LimeCrmTrigger {
|
|
|
193
194
|
const bodyData = this.getBodyData();
|
|
194
195
|
const limeSignature = headerData['x-lime-signature'];
|
|
195
196
|
if ((webhookSecret || limeSignature) &&
|
|
196
|
-
!(0,
|
|
197
|
+
!(0, common_1.verifyHmac)(webhookSecret, requestObject.rawBody, limeSignature)) {
|
|
197
198
|
throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Webhook authentication failed, secret keys do not match!');
|
|
198
199
|
}
|
|
199
200
|
if (!bodyData || !bodyData.event || !bodyData.body) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LimeCrmTrigger.node.js","sourceRoot":"","sources":["../../../nodes/lime-crm/LimeCrmTrigger.node.ts"],"names":[],"mappings":";;;AAAA,+CAWsB;AAEtB,qCAAuD;AACvD,uCAAyC;AACzC,2CAKqB;AAErB,
|
|
1
|
+
{"version":3,"file":"LimeCrmTrigger.node.js","sourceRoot":"","sources":["../../../nodes/lime-crm/LimeCrmTrigger.node.ts"],"names":[],"mappings":";;;AAAA,+CAWsB;AAEtB,qCAAuD;AACvD,uCAAyC;AACzC,2CAKqB;AAErB,mCAAqC;AACrC,sCAAuC;AAqBvC,MAAa,cAAc;IAA3B;QAKI,gBAAW,GAAyB;YAChC,WAAW,EAAE,kBAAkB;YAC/B,IAAI,EAAE,gBAAgB;YACtB,IAAI,EAAE,0BAA0B;YAChC,KAAK,EAAE,CAAC,SAAS,CAAC;YAClB,OAAO,EAAE,CAAC;YACV,WAAW,EACP,4DAA4D;gBAC5D,sBAAsB;YAC1B,QAAQ,EAAE;gBACN,IAAI,EAAE,kBAAkB;aAC3B;YACD,MAAM,EAAE,EAAE;YACV,OAAO,EAAE,CAAC,kCAAmB,CAAC,IAAI,CAAC;YACnC,WAAW,EAAE;gBACT;oBACI,IAAI,EAAE,oCAA2B;oBACjC,QAAQ,EAAE,IAAI;iBACjB;aACJ;YACD,QAAQ,EAAE;gBACN;oBACI,IAAI,EAAE,SAAS;oBACf,UAAU,EAAE,MAAM;oBAClB,YAAY,EAAE,YAAY;oBAC1B,IAAI,EAAE,SAAS;iBAClB;aACJ;YACD,UAAU,EAAE;gBACR;oBACI,WAAW,EAAE,QAAQ;oBACrB,IAAI,EAAE,QAAQ;oBACd,IAAI,EAAE,iBAAiB;oBACvB,WAAW,EAAE;wBACT,cAAc,EAAE,IAAI;wBACpB,QAAQ,EAAE,IAAI;qBACjB;oBACD,OAAO,EAAE,EAAE;oBACX,WAAW,EAAE,WAAW;oBACxB,WAAW,EAAE,wBAAwB;oBACrC,OAAO,EAAE;wBACL;4BACI,IAAI,EAAE,OAAO;4BACb,WAAW,EAAE,OAAO;4BACpB,MAAM,EAAE;gCACJ;oCACI,WAAW,E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C,QAAQ,CAAC,KAAK,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;YACjD,0BAAM,CAAC,IAAI,CAAC,gDAAgD,EAAE;gBAC1D,GAAG,OAAO,CAAC,OAAO;aACrB,CAAC,CAAC;YACH,MAAM,IAAI,iCAAkB,CACxB,IAAI,CAAC,OAAO,EAAE,EACd,yBAAyB,CAC5B,CAAC;QACN,CAAC;QAED,MAAM,UAAU,GAAkB,EAAE,CAAC;QACrC,UAAU,CAAC,IAAI,CAAC;YACZ,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE,UAAU;YACnB,KAAK,EAAE,IAAI,CAAC,YAAY,EAAE;SAC7B,CAAC,CAAC;QAEH,OAAO,EAAE,YAAY,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,UAAU,CAAC,CAAC,EAAE,CAAC;IACxE,CAAC;CACJ;AApSD,wCAoSC"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
export { setFilename, getFilenameFromHeader, getFilePropertiesNames, processFileResponse, setFileProperties, } from './files';
|
|
2
|
-
export { verifyHmac } from './hmac';
|
|
3
2
|
export { getWebhook } from './webhook';
|
|
4
3
|
export { handleWorkflowError, WorkflowErrorContext } from '../../errorHandling';
|
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.handleWorkflowError = exports.getWebhook = exports.
|
|
3
|
+
exports.handleWorkflowError = exports.getWebhook = exports.setFileProperties = exports.processFileResponse = exports.getFilePropertiesNames = exports.getFilenameFromHeader = exports.setFilename = void 0;
|
|
4
4
|
var files_1 = require("./files");
|
|
5
5
|
Object.defineProperty(exports, "setFilename", { enumerable: true, get: function () { return files_1.setFilename; } });
|
|
6
6
|
Object.defineProperty(exports, "getFilenameFromHeader", { enumerable: true, get: function () { return files_1.getFilenameFromHeader; } });
|
|
7
7
|
Object.defineProperty(exports, "getFilePropertiesNames", { enumerable: true, get: function () { return files_1.getFilePropertiesNames; } });
|
|
8
8
|
Object.defineProperty(exports, "processFileResponse", { enumerable: true, get: function () { return files_1.processFileResponse; } });
|
|
9
9
|
Object.defineProperty(exports, "setFileProperties", { enumerable: true, get: function () { return files_1.setFileProperties; } });
|
|
10
|
-
var hmac_1 = require("./hmac");
|
|
11
|
-
Object.defineProperty(exports, "verifyHmac", { enumerable: true, get: function () { return hmac_1.verifyHmac; } });
|
|
12
10
|
var webhook_1 = require("./webhook");
|
|
13
11
|
Object.defineProperty(exports, "getWebhook", { enumerable: true, get: function () { return webhook_1.getWebhook; } });
|
|
14
12
|
var errorHandling_1 = require("../../errorHandling");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../nodes/lime-crm/utils/index.ts"],"names":[],"mappings":";;;AAAA,iCAMiB;AALb,oGAAA,WAAW,OAAA;AACX,8GAAA,qBAAqB,OAAA;AACrB,+GAAA,sBAAsB,OAAA;AACtB,4GAAA,mBAAmB,OAAA;AACnB,0GAAA,iBAAiB,OAAA;AAErB
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../nodes/lime-crm/utils/index.ts"],"names":[],"mappings":";;;AAAA,iCAMiB;AALb,oGAAA,WAAW,OAAA;AACX,8GAAA,qBAAqB,OAAA;AACrB,+GAAA,sBAAsB,OAAA;AACtB,4GAAA,mBAAmB,OAAA;AACnB,0GAAA,iBAAiB,OAAA;AAErB,qCAAuC;AAA9B,qGAAA,UAAU,OAAA;AACnB,qDAAgF;AAAvE,oHAAA,mBAAmB,OAAA"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { IHookFunctions, ILoadOptionsFunctions, INodePropertyOptions, INodeType, INodeTypeDescription, IWebhookFunctions, IWebhookResponseData } from 'n8n-workflow';
|
|
2
|
+
export declare class LimeFormsTrigger implements INodeType {
|
|
3
|
+
description: INodeTypeDescription;
|
|
4
|
+
methods: {
|
|
5
|
+
loadOptions: {
|
|
6
|
+
getForms(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;
|
|
7
|
+
};
|
|
8
|
+
};
|
|
9
|
+
webhookMethods: {
|
|
10
|
+
default: {
|
|
11
|
+
checkExists(this: IHookFunctions): Promise<boolean>;
|
|
12
|
+
create(this: IHookFunctions): Promise<boolean>;
|
|
13
|
+
delete(this: IHookFunctions): Promise<boolean>;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
webhook(this: IWebhookFunctions): Promise<IWebhookResponseData>;
|
|
17
|
+
}
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LimeFormsTrigger = void 0;
|
|
4
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
5
|
+
const request_1 = require("./transport/request");
|
|
6
|
+
const ObservableAction_1 = require("./types/enums/ObservableAction");
|
|
7
|
+
const ObservableType_1 = require("./types/enums/ObservableType");
|
|
8
|
+
const credentials_1 = require("../../credentials");
|
|
9
|
+
const workflow_1 = require("./utils/workflow");
|
|
10
|
+
const common_1 = require("../common");
|
|
11
|
+
const errorHandling_1 = require("../errorHandling");
|
|
12
|
+
const FORMS_OBSERVABLE_WEBHOOK_NAME_PREFIX = 'N8N';
|
|
13
|
+
class LimeFormsTrigger {
|
|
14
|
+
constructor() {
|
|
15
|
+
this.description = {
|
|
16
|
+
displayName: 'Lime CRM Forms Trigger',
|
|
17
|
+
name: 'limeCrmFormsTrigger',
|
|
18
|
+
group: ['trigger'],
|
|
19
|
+
version: 1,
|
|
20
|
+
icon: 'file:assets/lime-crm.svg',
|
|
21
|
+
description: 'Handle webhooks from Lime Forms',
|
|
22
|
+
defaults: {
|
|
23
|
+
name: 'Lime Forms',
|
|
24
|
+
},
|
|
25
|
+
credentials: [
|
|
26
|
+
{
|
|
27
|
+
name: credentials_1.FORMS_API_CREDENTIALS_NAME,
|
|
28
|
+
required: true,
|
|
29
|
+
},
|
|
30
|
+
],
|
|
31
|
+
inputs: [],
|
|
32
|
+
outputs: [n8n_workflow_1.NodeConnectionTypes.Main],
|
|
33
|
+
webhooks: [
|
|
34
|
+
{
|
|
35
|
+
name: 'default',
|
|
36
|
+
httpMethod: 'POST',
|
|
37
|
+
responseMode: 'onReceived',
|
|
38
|
+
path: 'lime-forms',
|
|
39
|
+
},
|
|
40
|
+
],
|
|
41
|
+
properties: [
|
|
42
|
+
{
|
|
43
|
+
displayName: 'Trigger Name',
|
|
44
|
+
name: 'name',
|
|
45
|
+
type: 'string',
|
|
46
|
+
default: '',
|
|
47
|
+
placeholder: 'my-lime-webhook',
|
|
48
|
+
required: true,
|
|
49
|
+
description: 'Name for this webhook subscription',
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
displayName: 'Form to monitor',
|
|
53
|
+
name: 'formId',
|
|
54
|
+
type: 'options',
|
|
55
|
+
typeOptions: {
|
|
56
|
+
loadOptionsMethod: 'getForms',
|
|
57
|
+
},
|
|
58
|
+
default: '',
|
|
59
|
+
description: 'Lime Forms to observe submissions for. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code/expressions/">expression</a>.',
|
|
60
|
+
},
|
|
61
|
+
],
|
|
62
|
+
};
|
|
63
|
+
this.methods = {
|
|
64
|
+
loadOptions: {
|
|
65
|
+
async getForms() {
|
|
66
|
+
const response = await new request_1.LimeFormsRequest(this).get('/api/v1/external-integrations/forms/');
|
|
67
|
+
if (!response.success) {
|
|
68
|
+
n8n_workflow_1.LoggerProxy.error(`Lime Forms: Failed to load list of forms`);
|
|
69
|
+
return [];
|
|
70
|
+
}
|
|
71
|
+
return response.data.map((form) => {
|
|
72
|
+
return {
|
|
73
|
+
name: form.name,
|
|
74
|
+
value: form.id,
|
|
75
|
+
};
|
|
76
|
+
});
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
};
|
|
80
|
+
this.webhookMethods = {
|
|
81
|
+
default: {
|
|
82
|
+
async checkExists() {
|
|
83
|
+
var _a;
|
|
84
|
+
const webhookData = this.getWorkflowStaticData('node');
|
|
85
|
+
const webhookId = webhookData.id;
|
|
86
|
+
if (webhookId === undefined) {
|
|
87
|
+
return false;
|
|
88
|
+
}
|
|
89
|
+
try {
|
|
90
|
+
const response = await new request_1.LimeFormsRequest(this).get(`/api/v1/observable-webhooks/${webhookId}`);
|
|
91
|
+
return response.data !== null;
|
|
92
|
+
}
|
|
93
|
+
catch (error) {
|
|
94
|
+
if ((error === null || error === void 0 ? void 0 : error.response) && ((_a = error.response) === null || _a === void 0 ? void 0 : _a.status) === 404) {
|
|
95
|
+
return false;
|
|
96
|
+
}
|
|
97
|
+
if (error.message) {
|
|
98
|
+
n8n_workflow_1.LoggerProxy.error(`Lime Forms: ${error.message}`);
|
|
99
|
+
}
|
|
100
|
+
throw new n8n_workflow_1.NodeApiError(this.getNode(), {
|
|
101
|
+
message: 'Failed to check if webhook exists in Lime Forms',
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
},
|
|
105
|
+
async create() {
|
|
106
|
+
var _a, _b, _c;
|
|
107
|
+
const credentials = await this.getCredentials(credentials_1.FORMS_API_CREDENTIALS_NAME);
|
|
108
|
+
const data = {
|
|
109
|
+
name: `${FORMS_OBSERVABLE_WEBHOOK_NAME_PREFIX}: ${this.getNodeParameter('name')}`,
|
|
110
|
+
observableType: ObservableType_1.ObservableType.FORM,
|
|
111
|
+
observableId: this.getNodeParameter('formId'),
|
|
112
|
+
action: ObservableAction_1.ObservableActionType.FORM_SUBMITTED,
|
|
113
|
+
webhookUrl: this.getNodeWebhookUrl('default'),
|
|
114
|
+
secret: credentials.webhookSecret,
|
|
115
|
+
workflowUrl: (0, workflow_1.getWorkflowUrl)(this.getNode(), this.getWorkflow().id),
|
|
116
|
+
};
|
|
117
|
+
const webhookData = this.getWorkflowStaticData('node');
|
|
118
|
+
try {
|
|
119
|
+
const response = await new request_1.LimeFormsRequest(this).post('/api/v1/observable-webhooks', data);
|
|
120
|
+
if (!response.success) {
|
|
121
|
+
throw new n8n_workflow_1.NodeApiError(this.getNode(), {
|
|
122
|
+
message: 'Failed to create webhook in Lime Forms',
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
webhookData.id = response.data.id;
|
|
126
|
+
return true;
|
|
127
|
+
}
|
|
128
|
+
catch (error) {
|
|
129
|
+
if ((error === null || error === void 0 ? void 0 : error.httpCode) == '409') {
|
|
130
|
+
n8n_workflow_1.LoggerProxy.info(`Webhook ${webhookData.name} already exists in Lime Forms, retrieving existing webhook ID`, { errorResponse: (_a = error.context) === null || _a === void 0 ? void 0 : _a.data });
|
|
131
|
+
const errorResponse = (_c = (_b = error.context) === null || _b === void 0 ? void 0 : _b.data) === null || _c === void 0 ? void 0 : _c.error;
|
|
132
|
+
webhookData.id = errorResponse.id;
|
|
133
|
+
webhookData.name = errorResponse.name.replace(`${FORMS_OBSERVABLE_WEBHOOK_NAME_PREFIX}: `, '');
|
|
134
|
+
return true;
|
|
135
|
+
}
|
|
136
|
+
throw new n8n_workflow_1.NodeApiError(this.getNode(), {
|
|
137
|
+
message: 'Failed to create webhook in Lime Forms',
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
},
|
|
141
|
+
async delete() {
|
|
142
|
+
const webhookData = this.getWorkflowStaticData('node');
|
|
143
|
+
const webhookId = webhookData.id;
|
|
144
|
+
if (webhookId === undefined) {
|
|
145
|
+
return false;
|
|
146
|
+
}
|
|
147
|
+
const response = await new request_1.LimeFormsRequest(this).delete(`/api/v1/observable-webhooks/${webhookId}`);
|
|
148
|
+
if (!response.success) {
|
|
149
|
+
throw new n8n_workflow_1.NodeApiError(this.getNode(), {
|
|
150
|
+
message: 'Failed to delete webhook in Lime Forms',
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
delete webhookData.id;
|
|
154
|
+
delete webhookData.secret;
|
|
155
|
+
return true;
|
|
156
|
+
},
|
|
157
|
+
},
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
async webhook() {
|
|
161
|
+
const body = this.getBodyData();
|
|
162
|
+
const headers = this.getHeaderData();
|
|
163
|
+
const returnData = [];
|
|
164
|
+
try {
|
|
165
|
+
if (!('x-signature' in headers)) {
|
|
166
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'No signature header passed. Unable to verify integrity of the data.');
|
|
167
|
+
}
|
|
168
|
+
const webhookSecret = await this.getCredentials(credentials_1.FORMS_API_CREDENTIALS_NAME).then((c) => c.webhookSecret);
|
|
169
|
+
const isValidSignature = (0, common_1.verifyHmac)(webhookSecret, Buffer.from(JSON.stringify(body)), ('sha256=' + headers['x-signature']));
|
|
170
|
+
if (!isValidSignature) {
|
|
171
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Invalid signature');
|
|
172
|
+
}
|
|
173
|
+
returnData.push(body);
|
|
174
|
+
}
|
|
175
|
+
catch (error) {
|
|
176
|
+
const response = (0, errorHandling_1.handleWorkflowError)(this, {
|
|
177
|
+
message: error.message,
|
|
178
|
+
});
|
|
179
|
+
returnData.push(response);
|
|
180
|
+
}
|
|
181
|
+
return {
|
|
182
|
+
workflowData: [this.helpers.returnJsonArray(returnData)],
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
exports.LimeFormsTrigger = LimeFormsTrigger;
|
|
187
|
+
//# sourceMappingURL=LimeFormsTrigger.node.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LimeFormsTrigger.node.js","sourceRoot":"","sources":["../../../nodes/lime-forms/LimeFormsTrigger.node.ts"],"names":[],"mappings":";;;AAAA,+CAasB;AACtB,iDAAuD;AAMvD,qEAAsE;AACtE,iEAA8D;AAC9D,mDAA+D;AAC/D,+CAAkD;AAClD,sCAAuC;AACvC,oDAAuD;AAEvD,MAAM,oCAAoC,GAAG,KAAK,CAAC;AAEnD,MAAa,gBAAgB;IAA7B;QACI,gBAAW,GAAyB;YAChC,WAAW,EAAE,wBAAwB;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,CAAC;QAErC,IAAI,CAAC;YACD,IAAI,CAAC,CAAC,aAAa,IAAI,OAAO,CAAC,EAAE,CAAC;gBAC9B,MAAM,IAAI,iCAAkB,CACxB,IAAI,CAAC,OAAO,EAAE,EACd,qEAAqE,CACxE,CAAC;YACN,CAAC;YAED,MAAM,aAAa,GAAG,MAAM,IAAI,CAAC,cAAc,CAC3C,wCAA0B,CAC7B,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,aAAuB,CAAC,CAAC;YACzC,MAAM,gBAAgB,GAAG,IAAA,mBAAU,EAC/B,aAAa,EACb,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,EACjC,CAAC,SAAS,GAAG,OAAO,CAAC,aAAa,CAAC,CAAW,CACjD,CAAC;YAEF,IAAI,CAAC,gBAAgB,EAAE,CAAC;gBACpB,MAAM,IAAI,iCAAkB,CACxB,IAAI,CAAC,OAAO,EAAE,EACd,mBAAmB,CACtB,CAAC;YACN,CAAC;YACD,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC1B,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACb,MAAM,QAAQ,GAAG,IAAA,mCAAmB,EAAC,IAAI,EAAE;gBACvC,OAAO,EAAE,KAAK,CAAC,OAAO;aACzB,CAAC,CAAC;YAEH,UAAU,CAAC,IAAI,CAAC,QAAuB,CAAC,CAAC;QAC7C,CAAC;QAED,OAAO;YACH,YAAY,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,UAAU,CAAC,CAAC;SAC3D,CAAC;IACN,CAAC;CACJ;AApOD,4CAoOC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg viewBox="0 0 1024 1025" xmlns="http://www.w3.org/2000/svg" xml:space="preserve"><clipPath id="a"><path d="M0 .03h1024v1024H0z"/></clipPath><g clip-path="url(#a)"><path d="M92.399 480.888c0-257.059 208.719-465.779 465.78-465.779C815.28 15.109 1024 223.829 1024 480.888c0 133.713-55.806 271.139-193.403 385.355-166.779 138.45-390.39 157.35-736.15 134.525-102.653-6.785-117.502-24.319-64.468-63.444 166.694-123.047 62.42-217.167 62.42-456.436Z" style="fill:#bee034"/><clipPath id="b"><path d="M92.399 480.888c0-257.059 208.719-465.779 465.78-465.779C815.28 15.109 1024 223.829 1024 480.888c0 133.713-55.806 271.139-193.403 385.355-166.779 138.45-390.39 157.35-736.15 134.525-102.653-6.785-117.502-24.319-64.468-63.444 166.694-123.047 62.42-217.167 62.42-456.436Z"/></clipPath><g clip-path="url(#b)"><path d="M1023-361.59c0 784.587-711.326 1420.62-1588.79 1420.62C-1402.638-283.55 1023-1146.18 1023-361.59Z" style="fill:#a6efff;filter:blur(200px)"/></g><path d="M433.85 723.911c-24.702-12.757-47.23-29.226-66.813-48.596-9.088-9.002-23.765-8.959-32.768.129-9.001 9.087-8.916 23.763.171 32.766 22.911 22.698 49.236 41.941 78.121 56.873 11.392 5.888 25.385 1.409 31.231-9.94 5.888-11.349 1.409-25.344-9.942-31.232Zm367.266-363.98a270.163 270.163 0 0 1 25.556 78.547c2.048 12.629 13.952 21.206 26.581 19.158 12.586-2.006 21.204-13.951 19.156-26.539a316.387 316.387 0 0 0-29.907-92.029c-5.803-11.434-19.754-15.999-31.146-10.24-11.393 5.76-16 19.713-10.24 31.103Zm-51.497 315.384c-19.584 19.37-42.069 35.839-66.815 48.596-11.349 5.888-15.786 19.883-9.94 31.232 5.887 11.349 19.881 15.828 31.229 9.94 28.929-14.932 55.253-34.175 78.164-56.873 9.045-9.003 9.131-23.679.128-32.766-9.002-9.088-23.678-9.131-32.766-.129ZM517.006 213.546a274.904 274.904 0 0 1 41.343-3.114c14.036 0 27.861 1.066 41.343 3.114 12.629 1.919 24.448-6.784 26.367-19.413 1.962-12.628-6.741-24.446-19.371-26.409a322.626 322.626 0 0 0-48.339-3.627 322.201 322.201 0 0 0-48.34 3.627c-12.672 1.963-21.332 13.781-19.413 26.409 1.92 12.629 13.739 21.332 26.41 19.413Zm41.343 490.355c-40.489 0-73.385 32.853-73.385 73.342s32.896 73.385 73.385 73.385c40.489 0 73.342-32.896 73.342-73.385 0-40.489-32.853-73.342-73.342-73.342ZM290.025 438.478c4.481-27.818 13.227-54.227 25.514-78.547 5.761-11.39 1.195-25.343-10.239-31.103-11.392-5.759-25.343-1.194-31.104 10.24a313.893 313.893 0 0 0-29.908 92.029c-2.048 12.588 6.527 24.533 19.157 26.539 12.629 2.048 24.532-6.529 26.58-19.158Zm479.092 112.254c-12.501 38.527 8.618 79.955 47.102 92.456 38.528 12.502 79.956-8.618 92.457-47.104 12.501-38.525-8.619-79.953-47.103-92.455-38.527-12.501-79.955 8.619-92.456 47.103Zm-80.51-247.802c32.766 23.808 78.675 16.554 102.482-16.212 23.808-32.767 16.512-78.675-16.256-102.482-32.723-23.809-78.675-16.512-102.439 16.254-23.808 32.725-16.555 78.633 16.213 102.44Zm-260.558 0c32.766-23.807 40.063-69.715 16.254-102.44-23.807-32.766-69.715-40.063-102.482-16.254-32.766 23.807-40.02 69.715-16.255 102.482 23.806 32.766 69.758 40.02 102.483 16.212Zm-80.51 247.802c-12.501-38.484-53.929-59.604-92.415-47.103-38.526 12.502-59.645 53.93-47.102 92.455 12.501 38.486 53.929 59.606 92.413 47.104 38.528-12.501 59.605-53.929 47.104-92.456Z" style="fill:#fff"/></g></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './LimeFormsTrigger.node';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./LimeFormsTrigger.node"), exports);
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../nodes/lime-forms/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0DAAwC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { IHookFunctions, ILoadOptionsFunctions } from 'n8n-workflow';
|
|
2
|
+
import { BaseResponse } from '../types/resources/BaseResponse';
|
|
3
|
+
export declare class LimeFormsRequest<T = unknown> {
|
|
4
|
+
private readonly loader;
|
|
5
|
+
constructor(loader: ILoadOptionsFunctions | IHookFunctions);
|
|
6
|
+
get(url: string): Promise<BaseResponse<T>>;
|
|
7
|
+
post(url: string, data: object): Promise<BaseResponse<T>>;
|
|
8
|
+
put(url: string, data: object): Promise<BaseResponse<T>>;
|
|
9
|
+
delete(url: string): Promise<BaseResponse<T>>;
|
|
10
|
+
private baseRequest;
|
|
11
|
+
}
|