@limetech/n8n-nodes-lime 0.3.2 → 0.3.3

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.
Files changed (131) hide show
  1. package/dist/package.json +1 -1
  2. package/dist/tsconfig.tsbuildinfo +1 -1
  3. package/package.json +1 -1
  4. package/dist/credentials/LimeGoApi.credentials.d.ts +0 -15
  5. package/dist/credentials/LimeGoApi.credentials.js +0 -32
  6. package/dist/credentials/LimeGoApi.credentials.js.map +0 -1
  7. package/dist/nodes/LimeCrm/GenericTypes.d.ts +0 -80
  8. package/dist/nodes/LimeCrm/GenericTypes.js +0 -7
  9. package/dist/nodes/LimeCrm/GenericTypes.js.map +0 -1
  10. package/dist/nodes/LimeCrm/LimeCrmNode.node.d.ts +0 -17
  11. package/dist/nodes/LimeCrm/LimeCrmNode.node.js +0 -114
  12. package/dist/nodes/LimeCrm/LimeCrmNode.node.js.map +0 -1
  13. package/dist/nodes/LimeCrm/LimeCrmTrigger/LimeCrmTrigger.node.d.ts +0 -17
  14. package/dist/nodes/LimeCrm/LimeCrmTrigger/LimeCrmTrigger.node.js +0 -408
  15. package/dist/nodes/LimeCrm/LimeCrmTrigger/LimeCrmTrigger.node.js.map +0 -1
  16. package/dist/nodes/LimeCrm/LimeCrmTrigger.node.d.ts +0 -17
  17. package/dist/nodes/LimeCrm/LimeCrmTrigger.node.js +0 -439
  18. package/dist/nodes/LimeCrm/LimeCrmTrigger.node.js.map +0 -1
  19. package/dist/nodes/LimeCrm/lime-crm.svg +0 -1
  20. package/dist/nodes/LimeCrm/methods/getAllSortableFields.d.ts +0 -7
  21. package/dist/nodes/LimeCrm/methods/getAllSortableFields.js +0 -53
  22. package/dist/nodes/LimeCrm/methods/getAllSortableFields.js.map +0 -1
  23. package/dist/nodes/LimeCrm/methods/getLimeTypeProperties.d.ts +0 -3
  24. package/dist/nodes/LimeCrm/methods/getLimeTypeProperties.js +0 -40
  25. package/dist/nodes/LimeCrm/methods/getLimeTypeProperties.js.map +0 -1
  26. package/dist/nodes/LimeCrm/methods/getLimeTypeRelations.d.ts +0 -7
  27. package/dist/nodes/LimeCrm/methods/getLimeTypeRelations.js +0 -30
  28. package/dist/nodes/LimeCrm/methods/getLimeTypeRelations.js.map +0 -1
  29. package/dist/nodes/LimeCrm/methods/getLimeTypes.d.ts +0 -3
  30. package/dist/nodes/LimeCrm/methods/getLimeTypes.js +0 -33
  31. package/dist/nodes/LimeCrm/methods/getLimeTypes.js.map +0 -1
  32. package/dist/nodes/LimeCrm/methods/getRelatedTypeProperties.d.ts +0 -7
  33. package/dist/nodes/LimeCrm/methods/getRelatedTypeProperties.js +0 -39
  34. package/dist/nodes/LimeCrm/methods/getRelatedTypeProperties.js.map +0 -1
  35. package/dist/nodes/LimeCrm/methods/index.d.ts +0 -5
  36. package/dist/nodes/LimeCrm/methods/index.js +0 -14
  37. package/dist/nodes/LimeCrm/methods/index.js.map +0 -1
  38. package/dist/nodes/LimeCrm/resources/limeObject/commonFields.d.ts +0 -4
  39. package/dist/nodes/LimeCrm/resources/limeObject/commonFields.js +0 -165
  40. package/dist/nodes/LimeCrm/resources/limeObject/commonFields.js.map +0 -1
  41. package/dist/nodes/LimeCrm/resources/limeObject/index.d.ts +0 -6
  42. package/dist/nodes/LimeCrm/resources/limeObject/index.js +0 -79
  43. package/dist/nodes/LimeCrm/resources/limeObject/index.js.map +0 -1
  44. package/dist/nodes/LimeCrm/resources/limeObject/operations/common.operation.d.ts +0 -2
  45. package/dist/nodes/LimeCrm/resources/limeObject/operations/common.operation.js +0 -36
  46. package/dist/nodes/LimeCrm/resources/limeObject/operations/common.operation.js.map +0 -1
  47. package/dist/nodes/LimeCrm/resources/limeObject/operations/create.operation.d.ts +0 -9
  48. package/dist/nodes/LimeCrm/resources/limeObject/operations/create.operation.js +0 -234
  49. package/dist/nodes/LimeCrm/resources/limeObject/operations/create.operation.js.map +0 -1
  50. package/dist/nodes/LimeCrm/resources/limeObject/operations/delete.operation.d.ts +0 -9
  51. package/dist/nodes/LimeCrm/resources/limeObject/operations/delete.operation.js +0 -136
  52. package/dist/nodes/LimeCrm/resources/limeObject/operations/delete.operation.js.map +0 -1
  53. package/dist/nodes/LimeCrm/resources/limeObject/operations/get.operation.d.ts +0 -9
  54. package/dist/nodes/LimeCrm/resources/limeObject/operations/get.operation.js +0 -125
  55. package/dist/nodes/LimeCrm/resources/limeObject/operations/get.operation.js.map +0 -1
  56. package/dist/nodes/LimeCrm/resources/limeObject/operations/getAll.operation.d.ts +0 -3
  57. package/dist/nodes/LimeCrm/resources/limeObject/operations/getAll.operation.js +0 -212
  58. package/dist/nodes/LimeCrm/resources/limeObject/operations/getAll.operation.js.map +0 -1
  59. package/dist/nodes/LimeCrm/resources/limeObject/operations/search.operation.d.ts +0 -9
  60. package/dist/nodes/LimeCrm/resources/limeObject/operations/search.operation.js +0 -232
  61. package/dist/nodes/LimeCrm/resources/limeObject/operations/search.operation.js.map +0 -1
  62. package/dist/nodes/LimeCrm/resources/limeObject/operations/update.operation.d.ts +0 -9
  63. package/dist/nodes/LimeCrm/resources/limeObject/operations/update.operation.js +0 -186
  64. package/dist/nodes/LimeCrm/resources/limeObject/operations/update.operation.js.map +0 -1
  65. package/dist/nodes/LimeCrm/resources/limeType/index.d.ts +0 -6
  66. package/dist/nodes/LimeCrm/resources/limeType/index.js +0 -81
  67. package/dist/nodes/LimeCrm/resources/limeType/index.js.map +0 -1
  68. package/dist/nodes/LimeCrm/resources/limeType/operations/getProperties.operation.d.ts +0 -9
  69. package/dist/nodes/LimeCrm/resources/limeType/operations/getProperties.operation.js +0 -112
  70. package/dist/nodes/LimeCrm/resources/limeType/operations/getProperties.operation.js.map +0 -1
  71. package/dist/nodes/LimeCrm/resources/limeType/operations/getRelations.operation.d.ts +0 -9
  72. package/dist/nodes/LimeCrm/resources/limeType/operations/getRelations.operation.js +0 -112
  73. package/dist/nodes/LimeCrm/resources/limeType/operations/getRelations.operation.js.map +0 -1
  74. package/dist/nodes/LimeCrm/resources/limeType/operations/getType.operation.d.ts +0 -9
  75. package/dist/nodes/LimeCrm/resources/limeType/operations/getType.operation.js +0 -70
  76. package/dist/nodes/LimeCrm/resources/limeType/operations/getType.operation.js.map +0 -1
  77. package/dist/nodes/LimeCrm/resources/limeType/operations/listTypes.operation.d.ts +0 -9
  78. package/dist/nodes/LimeCrm/resources/limeType/operations/listTypes.operation.js +0 -86
  79. package/dist/nodes/LimeCrm/resources/limeType/operations/listTypes.operation.js.map +0 -1
  80. package/dist/nodes/LimeCrm/resources/queryApi/index.d.ts +0 -6
  81. package/dist/nodes/LimeCrm/resources/queryApi/index.js +0 -57
  82. package/dist/nodes/LimeCrm/resources/queryApi/index.js.map +0 -1
  83. package/dist/nodes/LimeCrm/resources/queryApi/operations/executeQuery.operation.d.ts +0 -9
  84. package/dist/nodes/LimeCrm/resources/queryApi/operations/executeQuery.operation.js +0 -559
  85. package/dist/nodes/LimeCrm/resources/queryApi/operations/executeQuery.operation.js.map +0 -1
  86. package/dist/nodes/LimeCrm/transport/index.d.ts +0 -2
  87. package/dist/nodes/LimeCrm/transport/index.js +0 -50
  88. package/dist/nodes/LimeCrm/transport/index.js.map +0 -1
  89. package/dist/nodes/LimeGo/LimeGo.node.d.ts +0 -8
  90. package/dist/nodes/LimeGo/LimeGo.node.js +0 -123
  91. package/dist/nodes/LimeGo/LimeGo.node.js.map +0 -1
  92. package/dist/nodes/LimeGo/actions/organization/get.operation.d.ts +0 -5
  93. package/dist/nodes/LimeGo/actions/organization/get.operation.js +0 -39
  94. package/dist/nodes/LimeGo/actions/organization/get.operation.js.map +0 -1
  95. package/dist/nodes/LimeGo/actions/organization/getByExternalKey.operation.d.ts +0 -5
  96. package/dist/nodes/LimeGo/actions/organization/getByExternalKey.operation.js +0 -54
  97. package/dist/nodes/LimeGo/actions/organization/getByExternalKey.operation.js.map +0 -1
  98. package/dist/nodes/LimeGo/actions/organization/index.d.ts +0 -7
  99. package/dist/nodes/LimeGo/actions/organization/index.js +0 -92
  100. package/dist/nodes/LimeGo/actions/organization/index.js.map +0 -1
  101. package/dist/nodes/LimeGo/actions/organization/organizationFields.d.ts +0 -2
  102. package/dist/nodes/LimeGo/actions/organization/organizationFields.js +0 -162
  103. package/dist/nodes/LimeGo/actions/organization/organizationFields.js.map +0 -1
  104. package/dist/nodes/LimeGo/actions/organization/search.operation.d.ts +0 -5
  105. package/dist/nodes/LimeGo/actions/organization/search.operation.js +0 -70
  106. package/dist/nodes/LimeGo/actions/organization/search.operation.js.map +0 -1
  107. package/dist/nodes/LimeGo/actions/organization/update.operation.d.ts +0 -5
  108. package/dist/nodes/LimeGo/actions/organization/update.operation.js +0 -125
  109. package/dist/nodes/LimeGo/actions/organization/update.operation.js.map +0 -1
  110. package/dist/nodes/LimeGo/actions/person/createMail.operation.d.ts +0 -7
  111. package/dist/nodes/LimeGo/actions/person/createMail.operation.js +0 -130
  112. package/dist/nodes/LimeGo/actions/person/createMail.operation.js.map +0 -1
  113. package/dist/nodes/LimeGo/actions/person/get.operation.d.ts +0 -7
  114. package/dist/nodes/LimeGo/actions/person/get.operation.js +0 -45
  115. package/dist/nodes/LimeGo/actions/person/get.operation.js.map +0 -1
  116. package/dist/nodes/LimeGo/actions/person/index.d.ts +0 -7
  117. package/dist/nodes/LimeGo/actions/person/index.js +0 -92
  118. package/dist/nodes/LimeGo/actions/person/index.js.map +0 -1
  119. package/dist/nodes/LimeGo/actions/person/personFields.d.ts +0 -2
  120. package/dist/nodes/LimeGo/actions/person/personFields.js +0 -134
  121. package/dist/nodes/LimeGo/actions/person/personFields.js.map +0 -1
  122. package/dist/nodes/LimeGo/actions/person/search.operation.d.ts +0 -7
  123. package/dist/nodes/LimeGo/actions/person/search.operation.js +0 -81
  124. package/dist/nodes/LimeGo/actions/person/search.operation.js.map +0 -1
  125. package/dist/nodes/LimeGo/actions/person/update.operation.d.ts +0 -7
  126. package/dist/nodes/LimeGo/actions/person/update.operation.js +0 -104
  127. package/dist/nodes/LimeGo/actions/person/update.operation.js.map +0 -1
  128. package/dist/nodes/LimeGo/lime-go.svg +0 -1
  129. package/dist/nodes/LimeGo/transport/graphqlRequest.d.ts +0 -2
  130. package/dist/nodes/LimeGo/transport/graphqlRequest.js +0 -23
  131. package/dist/nodes/LimeGo/transport/graphqlRequest.js.map +0 -1
@@ -1,80 +0,0 @@
1
- import { IDataObject } from 'n8n-workflow';
2
- export interface IOperationParams {
3
- operation: string;
4
- i: number;
5
- }
6
- export interface ILimeCrmResponse {
7
- [key: string]: any;
8
- }
9
- export interface ILimeTypeObject {
10
- id?: number | string;
11
- [key: string]: any;
12
- }
13
- export interface IWebhookObject {
14
- name: string;
15
- events: string[];
16
- target_url: string;
17
- enabled: boolean;
18
- headers?: Array<{
19
- name: string;
20
- value: string;
21
- secret_value?: string;
22
- type: string;
23
- }>;
24
- secret?: string;
25
- }
26
- export interface IWebhookEventData {
27
- event: string;
28
- body: {
29
- id: string;
30
- values: IDataObject;
31
- [key: string]: any;
32
- };
33
- [key: string]: any;
34
- }
35
- export interface ILimeTypeResponse {
36
- _embedded?: {
37
- properties?: ILimeTypeProperty[];
38
- };
39
- _links?: {
40
- limetypes?: ILimeTypeLink[];
41
- };
42
- }
43
- export interface ILimeTypeLink {
44
- name: string;
45
- href: string;
46
- }
47
- export interface ILimeTypeProperty {
48
- id: string;
49
- name: string;
50
- localizedname: string;
51
- propertytype: string;
52
- readonly: boolean;
53
- required: boolean;
54
- [key: string]: any;
55
- }
56
- export interface ILimeObjectResponse {
57
- _embedded?: {
58
- limeobjects?: ILimeObject[];
59
- };
60
- _links?: {
61
- next?: {
62
- href: string;
63
- };
64
- self?: {
65
- href: string;
66
- };
67
- };
68
- }
69
- export interface ILimeObject {
70
- id: string;
71
- [key: string]: any;
72
- }
73
- export interface IQueryParams {
74
- _limit?: number;
75
- _offset?: number;
76
- _sort?: string;
77
- [key: string]: any;
78
- }
79
- export declare class GenericTypes {
80
- }
@@ -1,7 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.GenericTypes = void 0;
4
- class GenericTypes {
5
- }
6
- exports.GenericTypes = GenericTypes;
7
- //# sourceMappingURL=GenericTypes.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"GenericTypes.js","sourceRoot":"","sources":["../../../nodes/LimeCrm/GenericTypes.ts"],"names":[],"mappings":";;;AAiHA,MAAa,YAAY;CAAI;AAA7B,oCAA6B"}
@@ -1,17 +0,0 @@
1
- import { IExecuteFunctions, INodeExecutionData, INodeType, INodeTypeDescription } from 'n8n-workflow';
2
- import { getLimeTypes, getLimeTypeProperties, getLimeTypeRelations, getRelatedTypeProperties, getAllSortableFields } from './methods';
3
- import { LimeCrmTrigger } from './LimeCrmTrigger/LimeCrmTrigger.node';
4
- export declare class LimeCrmNode implements INodeType {
5
- description: INodeTypeDescription;
6
- methods: {
7
- loadOptions: {
8
- getLimeTypes: typeof getLimeTypes;
9
- getLimeTypeProperties: typeof getLimeTypeProperties;
10
- getLimeTypeRelations: typeof getLimeTypeRelations;
11
- getRelatedTypeProperties: typeof getRelatedTypeProperties;
12
- getAllSortableFields: typeof getAllSortableFields;
13
- };
14
- };
15
- execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]>;
16
- }
17
- export { LimeCrmTrigger };
@@ -1,114 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.LimeCrmTrigger = exports.LimeCrmNode = void 0;
4
- const n8n_workflow_1 = require("n8n-workflow");
5
- const limeType_1 = require("./resources/limeType");
6
- const limeObject_1 = require("./resources/limeObject");
7
- const queryApi_1 = require("./resources/queryApi");
8
- const methods_1 = require("./methods");
9
- const LimeCrmTrigger_node_1 = require("./LimeCrmTrigger/LimeCrmTrigger.node");
10
- Object.defineProperty(exports, "LimeCrmTrigger", { enumerable: true, get: function () { return LimeCrmTrigger_node_1.LimeCrmTrigger; } });
11
- class LimeCrmNode {
12
- constructor() {
13
- this.description = {
14
- displayName: 'Lime CRM',
15
- name: 'limeCrm',
16
- icon: 'file:lime-crm.svg',
17
- group: ['transform'],
18
- version: 1,
19
- subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
20
- description: 'Consume the Lime CRM API',
21
- defaults: {
22
- name: 'Lime CRM',
23
- },
24
- inputs: ["main"],
25
- outputs: ["main"],
26
- credentials: [
27
- {
28
- name: 'limeCrmApi',
29
- required: true,
30
- },
31
- ],
32
- properties: [
33
- {
34
- displayName: 'Resource',
35
- name: 'resource',
36
- type: 'options',
37
- noDataExpression: true,
38
- options: [
39
- {
40
- name: 'Lime Type',
41
- value: 'limeType',
42
- description: 'Work with entity type definitions',
43
- },
44
- {
45
- name: 'Lime Object',
46
- value: 'limeObject',
47
- description: 'Work with actual data records',
48
- },
49
- {
50
- name: 'Query API',
51
- value: 'queryApi',
52
- description: 'Execute custom queries against the database',
53
- },
54
- ],
55
- default: 'limeObject',
56
- },
57
- ...limeType_1.limeTypeFields,
58
- ...limeObject_1.limeObjectFields,
59
- ...queryApi_1.queryApiFields,
60
- ],
61
- };
62
- this.methods = {
63
- loadOptions: {
64
- getLimeTypes: methods_1.getLimeTypes,
65
- getLimeTypeProperties: methods_1.getLimeTypeProperties,
66
- getLimeTypeRelations: methods_1.getLimeTypeRelations,
67
- getRelatedTypeProperties: methods_1.getRelatedTypeProperties,
68
- getAllSortableFields: methods_1.getAllSortableFields,
69
- },
70
- };
71
- }
72
- async execute() {
73
- const items = this.getInputData();
74
- const returnData = [];
75
- let responseData;
76
- const resource = this.getNodeParameter('resource', 0);
77
- const operation = this.getNodeParameter('operation', 0);
78
- for (let i = 0; i < items.length; i++) {
79
- try {
80
- if (resource === 'limeType') {
81
- responseData = await limeType_1.limeTypeOperations.call(this, { operation, i });
82
- }
83
- else if (resource === 'limeObject') {
84
- responseData = await limeObject_1.limeObjectOperations.call(this, { operation, i });
85
- }
86
- else if (resource === 'queryApi') {
87
- responseData = await queryApi_1.queryApiOperations.call(this, { operation, i });
88
- }
89
- else {
90
- throw new n8n_workflow_1.NodeOperationError(this.getNode(), `The resource "${resource}" is not supported!`);
91
- }
92
- if (Array.isArray(responseData)) {
93
- returnData.push(...responseData);
94
- }
95
- else if (responseData !== undefined) {
96
- returnData.push(responseData);
97
- }
98
- }
99
- catch (error) {
100
- if (this.continueOnFail()) {
101
- returnData.push({
102
- error: error.message,
103
- json: { error: error.message },
104
- });
105
- continue;
106
- }
107
- throw error;
108
- }
109
- }
110
- return [this.helpers.returnJsonArray(returnData)];
111
- }
112
- }
113
- exports.LimeCrmNode = LimeCrmNode;
114
- //# sourceMappingURL=LimeCrmNode.node.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"LimeCrmNode.node.js","sourceRoot":"","sources":["../../../nodes/LimeCrm/LimeCrmNode.node.ts"],"names":[],"mappings":"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"}
@@ -1,17 +0,0 @@
1
- import { IHookFunctions, IWebhookFunctions, INodeType, INodeTypeDescription, IWebhookResponseData, ILoadOptionsFunctions, INodePropertyOptions } from 'n8n-workflow';
2
- export declare class LimeCrmTrigger implements INodeType {
3
- description: INodeTypeDescription;
4
- methods: {
5
- loadOptions: {
6
- getLimeTypes(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
- }
@@ -1,408 +0,0 @@
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.LimeCrmTrigger = void 0;
27
- const n8n_workflow_1 = require("n8n-workflow");
28
- const crypto = __importStar(require("crypto"));
29
- const methods_1 = require("../methods");
30
- class LimeCrmTrigger {
31
- constructor() {
32
- this.description = {
33
- displayName: 'Lime CRM Trigger',
34
- name: 'limeCrmTrigger',
35
- icon: 'file:lime-crm.svg',
36
- group: ['trigger'],
37
- version: 1,
38
- description: 'Handle Lime CRM webhook events',
39
- defaults: {
40
- name: 'Lime CRM Trigger',
41
- },
42
- inputs: [],
43
- outputs: ["main"],
44
- credentials: [
45
- {
46
- name: 'limeCrmApi',
47
- required: true,
48
- },
49
- ],
50
- webhooks: [
51
- {
52
- name: 'default',
53
- httpMethod: 'POST',
54
- responseMode: 'onReceived',
55
- path: 'webhook',
56
- },
57
- ],
58
- properties: [
59
- {
60
- displayName: 'Events',
61
- name: 'events',
62
- type: 'fixedCollection',
63
- typeOptions: {
64
- multipleValues: true,
65
- required: true,
66
- },
67
- default: {},
68
- placeholder: 'Add Event',
69
- description: 'Events to subscribe to',
70
- options: [
71
- {
72
- name: 'event',
73
- displayName: 'Event',
74
- values: [
75
- {
76
- displayName: 'Lime Type',
77
- name: 'limeType',
78
- type: 'options',
79
- typeOptions: {
80
- loadOptionsMethod: 'getLimeTypes',
81
- },
82
- default: '',
83
- description: 'Lime Type to subscribe to events for',
84
- },
85
- {
86
- displayName: 'Event Type',
87
- name: 'eventType',
88
- type: 'options',
89
- options: [
90
- {
91
- name: 'New',
92
- value: 'new',
93
- description: 'When a new record is created',
94
- },
95
- {
96
- name: 'Update',
97
- value: 'update',
98
- description: 'When a record is updated',
99
- },
100
- {
101
- name: 'Delete',
102
- value: 'delete',
103
- description: 'When a record is deleted',
104
- },
105
- ],
106
- default: 'new',
107
- description: 'Type of event to subscribe to',
108
- },
109
- ],
110
- },
111
- ],
112
- },
113
- {
114
- displayName: 'Name',
115
- name: 'name',
116
- type: 'string',
117
- default: '',
118
- placeholder: 'my-lime-webhook',
119
- required: true,
120
- description: 'Name for this webhook subscription',
121
- },
122
- {
123
- displayName: 'Options',
124
- name: 'options',
125
- type: 'collection',
126
- placeholder: 'Add Option',
127
- default: {},
128
- options: [
129
- {
130
- displayName: 'Include Headers',
131
- name: 'includeHeaders',
132
- type: 'fixedCollection',
133
- typeOptions: {
134
- multipleValues: true,
135
- },
136
- default: {},
137
- placeholder: 'Add Header',
138
- description: 'Headers to add to webhook requests',
139
- options: [
140
- {
141
- name: 'header',
142
- displayName: 'Header',
143
- values: [
144
- {
145
- displayName: 'Name',
146
- name: 'name',
147
- type: 'string',
148
- default: '',
149
- description: 'Name of the header',
150
- },
151
- {
152
- displayName: 'Value',
153
- name: 'value',
154
- type: 'string',
155
- default: '',
156
- description: 'Value of the header',
157
- },
158
- {
159
- displayName: 'Is Secret',
160
- name: 'isSecret',
161
- type: 'boolean',
162
- default: false,
163
- description: 'Whether this value is a secret',
164
- },
165
- ],
166
- },
167
- ],
168
- },
169
- {
170
- displayName: 'Secret',
171
- name: 'secret',
172
- type: 'string',
173
- typeOptions: {
174
- password: true,
175
- },
176
- default: '',
177
- description: 'Secret to verify the authenticity of received data',
178
- },
179
- ],
180
- },
181
- ],
182
- };
183
- this.methods = {
184
- loadOptions: {
185
- async getLimeTypes() {
186
- return methods_1.getLimeTypes.call(this);
187
- },
188
- },
189
- };
190
- this.webhookMethods = {
191
- default: {
192
- async checkExists() {
193
- const nodeId = this.getNode().id;
194
- const workflowId = this.getWorkflow().id;
195
- const workflowName = this.getWorkflow().name;
196
- const webhookData = this.getWorkflowStaticData('node');
197
- const webhookUrl = this.getNodeWebhookUrl('default');
198
- if (webhookData.webhookId) {
199
- try {
200
- const credentials = await this.getCredentials('limeCrmApi');
201
- if (!credentials) {
202
- throw new Error('No credentials provided');
203
- }
204
- const currentWebhook = await this.helpers.requestWithAuthentication.call(this, 'limeCrmApi', {
205
- method: 'GET',
206
- uri: `/api/v1/subscription/${webhookData.webhookId}/`,
207
- json: true,
208
- baseURL: credentials.url,
209
- headers: {
210
- 'X-API-Key': credentials.apiKey,
211
- 'Accept': 'application/json',
212
- },
213
- });
214
- if (currentWebhook && currentWebhook.target_url === webhookUrl) {
215
- n8n_workflow_1.LoggerProxy.debug(`Webhook exists: ${webhookData.webhookId}`, { webhookId: webhookData.webhookId, nodeId, workflowId, workflowName });
216
- return true;
217
- }
218
- }
219
- catch (error) {
220
- n8n_workflow_1.LoggerProxy.warn(`Webhook check failed: ${error}`, { webhookId: webhookData.webhookId, nodeId, workflowId, workflowName, error });
221
- delete webhookData.webhookId;
222
- return false;
223
- }
224
- }
225
- return false;
226
- },
227
- async create() {
228
- const nodeId = this.getNode().id;
229
- const workflowId = this.getWorkflow().id;
230
- const workflowName = this.getWorkflow().name;
231
- const webhookData = this.getWorkflowStaticData('node');
232
- const webhookUrl = this.getNodeWebhookUrl('default');
233
- if (!webhookUrl) {
234
- throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'No webhook URL was returned by the system');
235
- }
236
- const name = this.getNodeParameter('name');
237
- const eventsCollection = this.getNodeParameter('events.event', []);
238
- const options = this.getNodeParameter('options', {});
239
- const credentials = await this.getCredentials('limeCrmApi');
240
- if (!credentials) {
241
- throw new Error('No credentials provided');
242
- }
243
- const events = [];
244
- for (const eventItem of eventsCollection) {
245
- events.push(`${eventItem.limeType}.${eventItem.eventType}`);
246
- }
247
- events.sort();
248
- const headersCollection = (options.includeHeaders || {}).header || [];
249
- const headers = [];
250
- for (const header of headersCollection) {
251
- if (header.isSecret) {
252
- headers.push({
253
- name: header.name,
254
- value: '',
255
- secret_value: header.value,
256
- type: 'text',
257
- });
258
- }
259
- else {
260
- headers.push({
261
- name: header.name,
262
- value: header.value,
263
- type: 'text',
264
- });
265
- }
266
- }
267
- const body = {
268
- name,
269
- events,
270
- target_url: webhookUrl,
271
- enabled: true,
272
- headers,
273
- };
274
- const secret = options.secret;
275
- if (secret) {
276
- body.secret = secret;
277
- }
278
- try {
279
- n8n_workflow_1.LoggerProxy.info('Creating new webhook subscription', { nodeId, workflowId, workflowName });
280
- const webhookResponse = await this.helpers.requestWithAuthentication.call(this, 'limeCrmApi', {
281
- method: 'POST',
282
- uri: '/api/v1/subscription/',
283
- body,
284
- json: true,
285
- baseURL: credentials.url,
286
- headers: {
287
- 'X-API-Key': credentials.apiKey,
288
- 'Accept': 'application/json',
289
- 'Content-Type': 'application/json',
290
- },
291
- });
292
- if (webhookResponse.id) {
293
- webhookData.webhookId = webhookResponse.id;
294
- n8n_workflow_1.LoggerProxy.info(`Created webhook with ID: ${webhookResponse.id}`, { webhookId: webhookResponse.id, nodeId, workflowId, workflowName });
295
- return true;
296
- }
297
- throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Webhook creation failed: No ID was returned');
298
- }
299
- catch (error) {
300
- n8n_workflow_1.LoggerProxy.error(`Webhook creation failed: ${error}`, { nodeId, workflowId, workflowName, error });
301
- throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Webhook creation failed: ${error}`);
302
- }
303
- },
304
- async delete() {
305
- const nodeId = this.getNode().id;
306
- const workflowId = this.getWorkflow().id;
307
- const workflowName = this.getWorkflow().name;
308
- const webhookData = this.getWorkflowStaticData('node');
309
- const webhookId = webhookData.webhookId;
310
- if (webhookId !== undefined) {
311
- try {
312
- n8n_workflow_1.LoggerProxy.info(`Deleting webhook with ID: ${webhookId}`, { webhookId, nodeId, workflowId, workflowName });
313
- const credentials = await this.getCredentials('limeCrmApi');
314
- if (!credentials) {
315
- throw new Error('No credentials provided');
316
- }
317
- await this.helpers.requestWithAuthentication.call(this, 'limeCrmApi', {
318
- method: 'DELETE',
319
- uri: `/api/v1/subscription/${webhookId}/`,
320
- json: true,
321
- baseURL: credentials.url,
322
- headers: {
323
- 'X-API-Key': credentials.apiKey,
324
- 'Accept': 'application/json',
325
- },
326
- });
327
- delete webhookData.webhookId;
328
- n8n_workflow_1.LoggerProxy.info('Webhook deleted successfully', { webhookId, nodeId, workflowId, workflowName });
329
- return true;
330
- }
331
- catch (error) {
332
- n8n_workflow_1.LoggerProxy.error(`Webhook deletion failed: ${error}`, { webhookId, nodeId, workflowId, workflowName, error });
333
- return false;
334
- }
335
- }
336
- return true;
337
- },
338
- },
339
- };
340
- }
341
- async webhook() {
342
- const nodeId = this.getNode().id;
343
- const workflowId = this.getWorkflow().id;
344
- const workflowName = this.getWorkflow().name;
345
- n8n_workflow_1.LoggerProxy.info('Webhook received. Starting webhook processing...', { nodeId, workflowId, workflowName });
346
- try {
347
- const options = this.getNodeParameter('options', {});
348
- const secret = options.secret;
349
- const bodyData = this.getBodyData();
350
- const headerData = this.getHeaderData();
351
- if (secret && headerData['x-lime-signature']) {
352
- n8n_workflow_1.LoggerProxy.debug('Verifying webhook signature...', { nodeId, workflowId, workflowName });
353
- const signature = headerData['x-lime-signature'];
354
- const req = this.getRequestObject();
355
- const rawBody = req.rawBody || JSON.stringify(bodyData);
356
- const hmac = crypto.createHmac('sha256', secret);
357
- hmac.update(rawBody);
358
- const expectedSignature = hmac.digest('hex');
359
- if (signature !== expectedSignature) {
360
- n8n_workflow_1.LoggerProxy.warn('Signature verification FAILED!', { nodeId, workflowId, workflowName });
361
- throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Invalid webhook signature');
362
- }
363
- n8n_workflow_1.LoggerProxy.debug('Signature verification successful', { nodeId, workflowId, workflowName });
364
- }
365
- const typedBodyData = bodyData;
366
- if (!typedBodyData || !typedBodyData.event || !typedBodyData.body) {
367
- n8n_workflow_1.LoggerProxy.warn('Webhook data is invalid. Missing event or body', { nodeId, workflowId, workflowName });
368
- throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Webhook data is invalid');
369
- }
370
- const eventParts = typedBodyData.event.split('.');
371
- if (eventParts.length !== 2) {
372
- n8n_workflow_1.LoggerProxy.warn(`Invalid event format: ${typedBodyData.event}`, { nodeId, workflowId, workflowName, event: typedBodyData.event });
373
- throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Invalid event format: ${typedBodyData.event}`);
374
- }
375
- const limeType = eventParts[0];
376
- const eventType = eventParts[1];
377
- n8n_workflow_1.LoggerProxy.info(`Processing ${limeType}.${eventType} event for ID: ${typedBodyData.body.id}`, {
378
- limeType,
379
- eventType,
380
- recordId: typedBodyData.body.id,
381
- nodeId,
382
- workflowId,
383
- workflowName
384
- });
385
- const data = [
386
- {
387
- json: {
388
- limeType,
389
- eventType,
390
- id: typedBodyData.body.id,
391
- data: typedBodyData.body.values || {},
392
- rawEvent: typedBodyData,
393
- },
394
- },
395
- ];
396
- n8n_workflow_1.LoggerProxy.debug('Webhook processing complete', { nodeId, workflowId, workflowName });
397
- return {
398
- workflowData: [data],
399
- };
400
- }
401
- catch (error) {
402
- n8n_workflow_1.LoggerProxy.error('Error in webhook execution', { error, nodeId, workflowId, workflowName });
403
- throw error;
404
- }
405
- }
406
- }
407
- exports.LimeCrmTrigger = LimeCrmTrigger;
408
- //# sourceMappingURL=LimeCrmTrigger.node.js.map