n8n-nodes-newar 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.
Files changed (173) hide show
  1. package/LICENSE.md +21 -0
  2. package/README.md +232 -0
  3. package/dist/credentials/NewarApi.credentials.d.ts +10 -0
  4. package/dist/credentials/NewarApi.credentials.js +63 -0
  5. package/dist/credentials/NewarApi.credentials.js.map +1 -0
  6. package/dist/icons/newar.dark.svg +3 -0
  7. package/dist/icons/newar.svg +3 -0
  8. package/dist/nodes/Newar/Newar.node.d.ts +11 -0
  9. package/dist/nodes/Newar/Newar.node.js +151 -0
  10. package/dist/nodes/Newar/Newar.node.js.map +1 -0
  11. package/dist/nodes/Newar/Newar.node.json +19 -0
  12. package/dist/nodes/Newar/actions/common.d.ts +40 -0
  13. package/dist/nodes/Newar/actions/common.js +328 -0
  14. package/dist/nodes/Newar/actions/common.js.map +1 -0
  15. package/dist/nodes/Newar/actions/customField/index.d.ts +4 -0
  16. package/dist/nodes/Newar/actions/customField/index.js +50 -0
  17. package/dist/nodes/Newar/actions/customField/index.js.map +1 -0
  18. package/dist/nodes/Newar/actions/customFields.d.ts +5 -0
  19. package/dist/nodes/Newar/actions/customFields.js +53 -0
  20. package/dist/nodes/Newar/actions/customFields.js.map +1 -0
  21. package/dist/nodes/Newar/actions/deal/create.d.ts +4 -0
  22. package/dist/nodes/Newar/actions/deal/create.js +39 -0
  23. package/dist/nodes/Newar/actions/deal/create.js.map +1 -0
  24. package/dist/nodes/Newar/actions/deal/delete.d.ts +3 -0
  25. package/dist/nodes/Newar/actions/deal/delete.js +26 -0
  26. package/dist/nodes/Newar/actions/deal/delete.js.map +1 -0
  27. package/dist/nodes/Newar/actions/deal/fields.d.ts +7 -0
  28. package/dist/nodes/Newar/actions/deal/fields.js +182 -0
  29. package/dist/nodes/Newar/actions/deal/fields.js.map +1 -0
  30. package/dist/nodes/Newar/actions/deal/get.d.ts +3 -0
  31. package/dist/nodes/Newar/actions/deal/get.js +22 -0
  32. package/dist/nodes/Newar/actions/deal/get.js.map +1 -0
  33. package/dist/nodes/Newar/actions/deal/getAll.d.ts +4 -0
  34. package/dist/nodes/Newar/actions/deal/getAll.js +102 -0
  35. package/dist/nodes/Newar/actions/deal/getAll.js.map +1 -0
  36. package/dist/nodes/Newar/actions/deal/index.d.ts +4 -0
  37. package/dist/nodes/Newar/actions/deal/index.js +105 -0
  38. package/dist/nodes/Newar/actions/deal/index.js.map +1 -0
  39. package/dist/nodes/Newar/actions/deal/search.d.ts +4 -0
  40. package/dist/nodes/Newar/actions/deal/search.js +69 -0
  41. package/dist/nodes/Newar/actions/deal/search.js.map +1 -0
  42. package/dist/nodes/Newar/actions/deal/update.d.ts +4 -0
  43. package/dist/nodes/Newar/actions/deal/update.js +42 -0
  44. package/dist/nodes/Newar/actions/deal/update.js.map +1 -0
  45. package/dist/nodes/Newar/actions/lead/create.d.ts +4 -0
  46. package/dist/nodes/Newar/actions/lead/create.js +41 -0
  47. package/dist/nodes/Newar/actions/lead/create.js.map +1 -0
  48. package/dist/nodes/Newar/actions/lead/delete.d.ts +3 -0
  49. package/dist/nodes/Newar/actions/lead/delete.js +26 -0
  50. package/dist/nodes/Newar/actions/lead/delete.js.map +1 -0
  51. package/dist/nodes/Newar/actions/lead/fields.d.ts +6 -0
  52. package/dist/nodes/Newar/actions/lead/fields.js +231 -0
  53. package/dist/nodes/Newar/actions/lead/fields.js.map +1 -0
  54. package/dist/nodes/Newar/actions/lead/get.d.ts +3 -0
  55. package/dist/nodes/Newar/actions/lead/get.js +22 -0
  56. package/dist/nodes/Newar/actions/lead/get.js.map +1 -0
  57. package/dist/nodes/Newar/actions/lead/getAll.d.ts +4 -0
  58. package/dist/nodes/Newar/actions/lead/getAll.js +102 -0
  59. package/dist/nodes/Newar/actions/lead/getAll.js.map +1 -0
  60. package/dist/nodes/Newar/actions/lead/index.d.ts +4 -0
  61. package/dist/nodes/Newar/actions/lead/index.js +105 -0
  62. package/dist/nodes/Newar/actions/lead/index.js.map +1 -0
  63. package/dist/nodes/Newar/actions/lead/search.d.ts +3 -0
  64. package/dist/nodes/Newar/actions/lead/search.js +37 -0
  65. package/dist/nodes/Newar/actions/lead/search.js.map +1 -0
  66. package/dist/nodes/Newar/actions/lead/update.d.ts +4 -0
  67. package/dist/nodes/Newar/actions/lead/update.js +36 -0
  68. package/dist/nodes/Newar/actions/lead/update.js.map +1 -0
  69. package/dist/nodes/Newar/actions/lossReason/index.d.ts +4 -0
  70. package/dist/nodes/Newar/actions/lossReason/index.js +38 -0
  71. package/dist/nodes/Newar/actions/lossReason/index.js.map +1 -0
  72. package/dist/nodes/Newar/actions/note/create.d.ts +4 -0
  73. package/dist/nodes/Newar/actions/note/create.js +68 -0
  74. package/dist/nodes/Newar/actions/note/create.js.map +1 -0
  75. package/dist/nodes/Newar/actions/note/get.d.ts +3 -0
  76. package/dist/nodes/Newar/actions/note/get.js +20 -0
  77. package/dist/nodes/Newar/actions/note/get.js.map +1 -0
  78. package/dist/nodes/Newar/actions/note/getAll.d.ts +4 -0
  79. package/dist/nodes/Newar/actions/note/getAll.js +46 -0
  80. package/dist/nodes/Newar/actions/note/getAll.js.map +1 -0
  81. package/dist/nodes/Newar/actions/note/index.d.ts +4 -0
  82. package/dist/nodes/Newar/actions/note/index.js +78 -0
  83. package/dist/nodes/Newar/actions/note/index.js.map +1 -0
  84. package/dist/nodes/Newar/actions/pipeline/index.d.ts +4 -0
  85. package/dist/nodes/Newar/actions/pipeline/index.js +57 -0
  86. package/dist/nodes/Newar/actions/pipeline/index.js.map +1 -0
  87. package/dist/nodes/Newar/actions/router.d.ts +6 -0
  88. package/dist/nodes/Newar/actions/router.js +147 -0
  89. package/dist/nodes/Newar/actions/router.js.map +1 -0
  90. package/dist/nodes/Newar/actions/search/index.d.ts +4 -0
  91. package/dist/nodes/Newar/actions/search/index.js +75 -0
  92. package/dist/nodes/Newar/actions/search/index.js.map +1 -0
  93. package/dist/nodes/Newar/actions/search/term.d.ts +3 -0
  94. package/dist/nodes/Newar/actions/search/term.js +30 -0
  95. package/dist/nodes/Newar/actions/search/term.js.map +1 -0
  96. package/dist/nodes/Newar/actions/stage/index.d.ts +4 -0
  97. package/dist/nodes/Newar/actions/stage/index.js +77 -0
  98. package/dist/nodes/Newar/actions/stage/index.js.map +1 -0
  99. package/dist/nodes/Newar/actions/tag/index.d.ts +4 -0
  100. package/dist/nodes/Newar/actions/tag/index.js +154 -0
  101. package/dist/nodes/Newar/actions/tag/index.js.map +1 -0
  102. package/dist/nodes/Newar/actions/task/create.d.ts +4 -0
  103. package/dist/nodes/Newar/actions/task/create.js +44 -0
  104. package/dist/nodes/Newar/actions/task/create.js.map +1 -0
  105. package/dist/nodes/Newar/actions/task/delete.d.ts +3 -0
  106. package/dist/nodes/Newar/actions/task/delete.js +20 -0
  107. package/dist/nodes/Newar/actions/task/delete.js.map +1 -0
  108. package/dist/nodes/Newar/actions/task/fields.d.ts +9 -0
  109. package/dist/nodes/Newar/actions/task/fields.js +143 -0
  110. package/dist/nodes/Newar/actions/task/fields.js.map +1 -0
  111. package/dist/nodes/Newar/actions/task/get.d.ts +3 -0
  112. package/dist/nodes/Newar/actions/task/get.js +22 -0
  113. package/dist/nodes/Newar/actions/task/get.js.map +1 -0
  114. package/dist/nodes/Newar/actions/task/getAll.d.ts +4 -0
  115. package/dist/nodes/Newar/actions/task/getAll.js +113 -0
  116. package/dist/nodes/Newar/actions/task/getAll.js.map +1 -0
  117. package/dist/nodes/Newar/actions/task/index.d.ts +4 -0
  118. package/dist/nodes/Newar/actions/task/index.js +96 -0
  119. package/dist/nodes/Newar/actions/task/index.js.map +1 -0
  120. package/dist/nodes/Newar/actions/task/update.d.ts +4 -0
  121. package/dist/nodes/Newar/actions/task/update.js +31 -0
  122. package/dist/nodes/Newar/actions/task/update.js.map +1 -0
  123. package/dist/nodes/Newar/actions/user/index.d.ts +4 -0
  124. package/dist/nodes/Newar/actions/user/index.js +66 -0
  125. package/dist/nodes/Newar/actions/user/index.js.map +1 -0
  126. package/dist/nodes/Newar/helpers/customFields.d.ts +28 -0
  127. package/dist/nodes/Newar/helpers/customFields.js +131 -0
  128. package/dist/nodes/Newar/helpers/customFields.js.map +1 -0
  129. package/dist/nodes/Newar/helpers/dates.d.ts +4 -0
  130. package/dist/nodes/Newar/helpers/dates.js +134 -0
  131. package/dist/nodes/Newar/helpers/dates.js.map +1 -0
  132. package/dist/nodes/Newar/helpers/errors.d.ts +34 -0
  133. package/dist/nodes/Newar/helpers/errors.js +323 -0
  134. package/dist/nodes/Newar/helpers/errors.js.map +1 -0
  135. package/dist/nodes/Newar/helpers/fields.d.ts +26 -0
  136. package/dist/nodes/Newar/helpers/fields.js +141 -0
  137. package/dist/nodes/Newar/helpers/fields.js.map +1 -0
  138. package/dist/nodes/Newar/helpers/idempotency.d.ts +16 -0
  139. package/dist/nodes/Newar/helpers/idempotency.js +42 -0
  140. package/dist/nodes/Newar/helpers/idempotency.js.map +1 -0
  141. package/dist/nodes/Newar/helpers/output.d.ts +7 -0
  142. package/dist/nodes/Newar/helpers/output.js +131 -0
  143. package/dist/nodes/Newar/helpers/output.js.map +1 -0
  144. package/dist/nodes/Newar/helpers/pagination.d.ts +23 -0
  145. package/dist/nodes/Newar/helpers/pagination.js +43 -0
  146. package/dist/nodes/Newar/helpers/pagination.js.map +1 -0
  147. package/dist/nodes/Newar/methods/index.d.ts +3 -0
  148. package/dist/nodes/Newar/methods/index.js +40 -0
  149. package/dist/nodes/Newar/methods/index.js.map +1 -0
  150. package/dist/nodes/Newar/methods/listSearch.d.ts +9 -0
  151. package/dist/nodes/Newar/methods/listSearch.js +142 -0
  152. package/dist/nodes/Newar/methods/listSearch.js.map +1 -0
  153. package/dist/nodes/Newar/methods/loadOptions.d.ts +7 -0
  154. package/dist/nodes/Newar/methods/loadOptions.js +61 -0
  155. package/dist/nodes/Newar/methods/loadOptions.js.map +1 -0
  156. package/dist/nodes/Newar/methods/resourceMapping.d.ts +3 -0
  157. package/dist/nodes/Newar/methods/resourceMapping.js +26 -0
  158. package/dist/nodes/Newar/methods/resourceMapping.js.map +1 -0
  159. package/dist/nodes/Newar/methods/shared.d.ts +11 -0
  160. package/dist/nodes/Newar/methods/shared.js +65 -0
  161. package/dist/nodes/Newar/methods/shared.js.map +1 -0
  162. package/dist/nodes/Newar/transport/index.d.ts +36 -0
  163. package/dist/nodes/Newar/transport/index.js +114 -0
  164. package/dist/nodes/Newar/transport/index.js.map +1 -0
  165. package/dist/nodes/NewarTrigger/NewarTrigger.node.d.ts +14 -0
  166. package/dist/nodes/NewarTrigger/NewarTrigger.node.js +295 -0
  167. package/dist/nodes/NewarTrigger/NewarTrigger.node.js.map +1 -0
  168. package/dist/nodes/NewarTrigger/NewarTrigger.node.json +19 -0
  169. package/dist/nodes/NewarTrigger/polling.d.ts +38 -0
  170. package/dist/nodes/NewarTrigger/polling.js +211 -0
  171. package/dist/nodes/NewarTrigger/polling.js.map +1 -0
  172. package/dist/package.json +68 -0
  173. package/package.json +68 -0
@@ -0,0 +1,4 @@
1
+ import type { INodeProperties } from 'n8n-workflow';
2
+ import { type OperationHandler } from '../common';
3
+ export declare const description: INodeProperties[];
4
+ export declare const handlers: Record<string, OperationHandler>;
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.handlers = exports.description = void 0;
4
+ const transport_1 = require("../../transport");
5
+ const common_1 = require("../common");
6
+ exports.description = [
7
+ {
8
+ displayName: 'Operation',
9
+ name: 'operation',
10
+ type: 'options',
11
+ noDataExpression: true,
12
+ displayOptions: { show: { resource: ['lossReason'] } },
13
+ options: [
14
+ {
15
+ name: 'Get Many',
16
+ value: 'getAll',
17
+ description: 'Retrieve the reasons a deal can be lost for',
18
+ action: 'Get many loss reasons',
19
+ },
20
+ ],
21
+ default: 'getAll',
22
+ },
23
+ ...(0, common_1.updateDisplayOptions)({ show: { resource: ['lossReason'], operation: ['getAll'] } }, [
24
+ (0, common_1.returnAllProperty)(),
25
+ (0, common_1.limitProperty)(1000),
26
+ ]),
27
+ ];
28
+ async function getAll(itemIndex) {
29
+ var _a;
30
+ const response = await transport_1.newarApiRequest.call(this, {
31
+ method: 'GET',
32
+ path: '/v1/loss-reasons',
33
+ itemIndex,
34
+ });
35
+ return (0, common_1.applyLimit)(this, itemIndex, (_a = response.data) !== null && _a !== void 0 ? _a : []);
36
+ }
37
+ exports.handlers = { getAll };
38
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../nodes/Newar/actions/lossReason/index.ts"],"names":[],"mappings":";;;AAEA,+CAAkD;AAClD,sCAMmB;AAEN,QAAA,WAAW,GAAsB;IAC7C;QACC,WAAW,EAAE,WAAW;QACxB,IAAI,EAAE,WAAW;QACjB,IAAI,EAAE,SAAS;QACf,gBAAgB,EAAE,IAAI;QACtB,cAAc,EAAE,EAAE,IAAI,EAAE,EAAE,QAAQ,EAAE,CAAC,YAAY,CAAC,EAAE,EAAE;QACtD,OAAO,EAAE;YACR;gBACC,IAAI,EAAE,UAAU;gBAChB,KAAK,EAAE,QAAQ;gBACf,WAAW,EAAE,6CAA6C;gBAC1D,MAAM,EAAE,uBAAuB;aAC/B;SACD;QACD,OAAO,EAAE,QAAQ;KACjB;IACD,GAAG,IAAA,6BAAoB,EAAC,EAAE,IAAI,EAAE,EAAE,QAAQ,EAAE,CAAC,YAAY,CAAC,EAAE,SAAS,EAAE,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE;QACtF,IAAA,0BAAiB,GAAE;QACnB,IAAA,sBAAa,EAAC,IAAI,CAAC;KACnB,CAAC;CACF,CAAC;AAEF,KAAK,UAAU,MAAM,CAA0B,SAAiB;;IAC/D,MAAM,QAAQ,GAAG,MAAM,2BAAe,CAAC,IAAI,CAAC,IAAI,EAAE;QACjD,MAAM,EAAE,KAAK;QACb,IAAI,EAAE,kBAAkB;QACxB,SAAS;KACT,CAAC,CAAC;IACH,OAAO,IAAA,mBAAU,EAAC,IAAI,EAAE,SAAS,EAAE,MAAC,QAAQ,CAAC,IAAkC,mCAAI,EAAE,CAAC,CAAC;AACxF,CAAC;AAEY,QAAA,QAAQ,GAAqC,EAAE,MAAM,EAAE,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { IDataObject, IExecuteFunctions, INodeProperties } from 'n8n-workflow';
2
+ import { type ExecutionContext } from '../common';
3
+ export declare const description: INodeProperties[];
4
+ export declare function execute(this: IExecuteFunctions, itemIndex: number, context: ExecutionContext): Promise<IDataObject>;
@@ -0,0 +1,68 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.description = void 0;
4
+ exports.execute = execute;
5
+ const common_1 = require("../common");
6
+ const properties = [
7
+ {
8
+ displayName: 'Add To',
9
+ name: 'parent',
10
+ type: 'options',
11
+ noDataExpression: true,
12
+ options: [
13
+ {
14
+ name: 'Deal',
15
+ value: 'deal',
16
+ description: "The note appears on the deal and on the deal's lead",
17
+ },
18
+ {
19
+ name: 'Lead',
20
+ value: 'lead',
21
+ description: "The note appears on the lead's timeline",
22
+ },
23
+ ],
24
+ default: 'lead',
25
+ description: 'Where to add the note',
26
+ },
27
+ {
28
+ ...(0, common_1.recordLocator)({
29
+ displayName: 'Lead',
30
+ name: 'leadId',
31
+ searchListMethod: 'searchLeads',
32
+ noun: 'lead',
33
+ description: 'The lead to add the note to',
34
+ }),
35
+ displayOptions: { show: { parent: ['lead'] } },
36
+ },
37
+ {
38
+ ...(0, common_1.recordLocator)({
39
+ displayName: 'Deal',
40
+ name: 'dealId',
41
+ searchListMethod: 'searchDeals',
42
+ noun: 'deal',
43
+ description: 'The deal to add the note to',
44
+ }),
45
+ displayOptions: { show: { parent: ['deal'] } },
46
+ },
47
+ {
48
+ displayName: 'Content',
49
+ name: 'content',
50
+ type: 'string',
51
+ typeOptions: { rows: 4 },
52
+ required: true,
53
+ default: '',
54
+ placeholder: 'e.g. Asked us to call after 6 pm',
55
+ description: "Text of the note. The token's user is the author.",
56
+ },
57
+ (0, common_1.idempotencyOptions)('note'),
58
+ ];
59
+ exports.description = (0, common_1.updateDisplayOptions)({ show: { resource: ['note'], operation: ['create'] } }, properties);
60
+ async function execute(itemIndex, context) {
61
+ const parent = this.getNodeParameter('parent', itemIndex, 'lead');
62
+ const body = parent === 'deal'
63
+ ? { deal_id: (0, common_1.getRecordId)(this, 'dealId', itemIndex, 'Deal') }
64
+ : { lead_id: (0, common_1.getRecordId)(this, 'leadId', itemIndex, 'Lead') };
65
+ body.content = (0, common_1.getRequiredText)(this, 'content', itemIndex, 'Content');
66
+ return await common_1.createRecord.call(this, itemIndex, context, '/v1/notes', body);
67
+ }
68
+ //# sourceMappingURL=create.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create.js","sourceRoot":"","sources":["../../../../../nodes/Newar/actions/note/create.ts"],"names":[],"mappings":";;;AAuEA,0BAYC;AAjFD,sCAQmB;AAEnB,MAAM,UAAU,GAAsB;IACrC;QACC,WAAW,EAAE,QAAQ;QACrB,IAAI,EAAE,QAAQ;QACd,IAAI,EAAE,SAAS;QACf,gBAAgB,EAAE,IAAI;QACtB,OAAO,EAAE;YACR;gBACC,IAAI,EAAE,MAAM;gBACZ,KAAK,EAAE,MAAM;gBACb,WAAW,EAAE,qDAAqD;aAClE;YACD;gBACC,IAAI,EAAE,MAAM;gBACZ,KAAK,EAAE,MAAM;gBACb,WAAW,EAAE,yCAAyC;aACtD;SACD;QACD,OAAO,EAAE,MAAM;QACf,WAAW,EAAE,uBAAuB;KACpC;IACD;QACC,GAAG,IAAA,sBAAa,EAAC;YAChB,WAAW,EAAE,MAAM;YACnB,IAAI,EAAE,QAAQ;YACd,gBAAgB,EAAE,aAAa;YAC/B,IAAI,EAAE,MAAM;YACZ,WAAW,EAAE,6BAA6B;SAC1C,CAAC;QACF,cAAc,EAAE,EAAE,IAAI,EAAE,EAAE,MAAM,EAAE,CAAC,MAAM,CAAC,EAAE,EAAE;KAC9C;IACD;QACC,GAAG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AAO,MAAM,qBAAY,CAAC,IAAI,CAAC,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,WAAW,EAAE,IAAI,CAAC,CAAC;AAC7E,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { IDataObject, IExecuteFunctions, INodeProperties } from 'n8n-workflow';
2
+ export declare const description: INodeProperties[];
3
+ export declare function execute(this: IExecuteFunctions, itemIndex: number): Promise<IDataObject>;
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.description = void 0;
4
+ exports.execute = execute;
5
+ const common_1 = require("../common");
6
+ const properties = [
7
+ (0, common_1.recordLocator)({
8
+ displayName: 'Note',
9
+ name: 'noteId',
10
+ searchListMethod: 'searchNotes',
11
+ noun: 'note',
12
+ description: 'The note to retrieve. Deal notes need the Pipeline permission.',
13
+ }),
14
+ ];
15
+ exports.description = (0, common_1.updateDisplayOptions)({ show: { resource: ['note'], operation: ['get'] } }, properties);
16
+ async function execute(itemIndex) {
17
+ const id = (0, common_1.getRecordId)(this, 'noteId', itemIndex, 'Note');
18
+ return await common_1.getRecord.call(this, itemIndex, `/v1/notes/${id}`);
19
+ }
20
+ //# sourceMappingURL=get.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get.js","sourceRoot":"","sources":["../../../../../nodes/Newar/actions/note/get.ts"],"names":[],"mappings":";;;AAmBA,0BAGC;AApBD,sCAAwF;AAExF,MAAM,UAAU,GAAsB;IACrC,IAAA,sBAAa,EAAC;QACb,WAAW,EAAE,MAAM;QACnB,IAAI,EAAE,QAAQ;QACd,gBAAgB,EAAE,aAAa;QAC/B,IAAI,EAAE,MAAM;QACZ,WAAW,EAAE,gEAAgE;KAC7E,CAAC;CACF,CAAC;AAEW,QAAA,WAAW,GAAG,IAAA,6BAAoB,EAC9C,EAAE,IAAI,EAAE,EAAE,QAAQ,EAAE,CAAC,MAAM,CAAC,EAAE,SAAS,EAAE,CAAC,KAAK,CAAC,EAAE,EAAE,EACpD,UAAU,CACV,CAAC;AAEK,KAAK,UAAU,OAAO,CAA0B,SAAiB;IACvE,MAAM,EAAE,GAAG,IAAA,oBAAW,EAAC,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC;IAC1D,OAAO,MAAM,kBAAS,CAAC,IAAI,CAAC,IAAI,EAAE,SAAS,EAAE,aAAa,EAAE,EAAE,CAAC,CAAC;AACjE,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { IDataObject, IExecuteFunctions, INodeProperties } from 'n8n-workflow';
2
+ import { type ExecutionContext } from '../common';
3
+ export declare const description: INodeProperties[];
4
+ export declare function execute(this: IExecuteFunctions, itemIndex: number, context: ExecutionContext): Promise<IDataObject[]>;
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.description = void 0;
4
+ exports.execute = execute;
5
+ const fields_1 = require("../../helpers/fields");
6
+ const transport_1 = require("../../transport");
7
+ const common_1 = require("../common");
8
+ const NOTE_FILTERS = [
9
+ { param: 'dealId', api: 'deal_id', kind: 'id', label: 'Deal ID' },
10
+ { param: 'leadId', api: 'lead_id', kind: 'id', label: 'Lead ID' },
11
+ ];
12
+ const properties = [
13
+ (0, common_1.returnAllProperty)(),
14
+ (0, common_1.limitProperty)(1000),
15
+ {
16
+ displayName: 'Filters',
17
+ name: 'filters',
18
+ type: 'collection',
19
+ placeholder: 'Add Filter',
20
+ default: {},
21
+ options: [
22
+ {
23
+ displayName: 'Deal ID',
24
+ name: 'dealId',
25
+ type: 'string',
26
+ default: '',
27
+ placeholder: 'e.g. 0f8d3c2a-6b1e-4f7a-9c5d-2e4b8a1f6c3d',
28
+ description: 'Only notes of this deal',
29
+ },
30
+ {
31
+ displayName: 'Lead ID',
32
+ name: 'leadId',
33
+ type: 'string',
34
+ default: '',
35
+ placeholder: 'e.g. 0f8d3c2a-6b1e-4f7a-9c5d-2e4b8a1f6c3d',
36
+ description: "Only notes of this lead, including the notes of the lead's deals",
37
+ },
38
+ ],
39
+ },
40
+ ];
41
+ exports.description = (0, common_1.updateDisplayOptions)({ show: { resource: ['note'], operation: ['getAll'] } }, properties);
42
+ async function execute(itemIndex, context) {
43
+ const qs = (0, fields_1.buildQuery)((0, common_1.getCollection)(this, 'filters', itemIndex), NOTE_FILTERS, context.timeZone);
44
+ return await transport_1.newarApiRequestAllItems.call(this, { path: '/v1/notes', qs, itemIndex }, (0, common_1.readPaging)(this, itemIndex));
45
+ }
46
+ //# sourceMappingURL=getAll.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getAll.js","sourceRoot":"","sources":["../../../../../nodes/Newar/actions/note/getAll.ts"],"names":[],"mappings":";;;AAqDA,0BAWC;AA9DD,iDAAmE;AACnE,+CAA0D;AAC1D,sCAOmB;AAEnB,MAAM,YAAY,GAAiB;IAClC,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,SAAS,EAAE;IACjE,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,SAAS,EAAE;CACjE,CAAC;AAEF,MAAM,UAAU,GAAsB;IACrC,IAAA,0BAAiB,GAAE;IACnB,IAAA,sBAAa,EAAC,IAAI,CAAC;IACnB;QACC,WAAW,EAAE,SAAS;QACtB,IAAI,EAAE,SAAS;QACf,IAAI,EAAE,YAAY;QAClB,WAAW,EAAE,YAAY;QACzB,OAAO,EAAE,EAAE;QACX,OAAO,EAAE;YACR;gBACC,WAAW,EAAE,SAAS;gBACtB,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,EAAE;gBACX,WAAW,EAAE,2CAA2C;gBACxD,WAAW,EAAE,yBAAyB;aACtC;YACD;gBACC,WAAW,EAAE,SAAS;gBACtB,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,EAAE;gBACX,WAAW,EAAE,2CAA2C;gBACxD,WAAW,EAAE,kEAAkE;aAC/E;SACD;KACD;CACD,CAAC;AAEW,QAAA,WAAW,GAAG,IAAA,6BAAoB,EAC9C,EAAE,IAAI,EAAE,EAAE,QAAQ,EAAE,CAAC,MAAM,CAAC,EAAE,SAAS,EAAE,CAAC,QAAQ,CAAC,EAAE,EAAE,EACvD,UAAU,CACV,CAAC;AAEK,KAAK,UAAU,OAAO,CAE5B,SAAiB,EACjB,OAAyB;IAEzB,MAAM,EAAE,GAAG,IAAA,mBAAU,EAAC,IAAA,sBAAa,EAAC,IAAI,EAAE,SAAS,EAAE,SAAS,CAAC,EAAE,YAAY,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;IACjG,OAAO,MAAM,mCAAuB,CAAC,IAAI,CACxC,IAAI,EACJ,EAAE,IAAI,EAAE,WAAW,EAAE,EAAE,EAAE,SAAS,EAAE,EACpC,IAAA,mBAAU,EAAC,IAAI,EAAE,SAAS,CAAC,CAC3B,CAAC;AACH,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { INodeProperties } from 'n8n-workflow';
2
+ import type { OperationHandler } from '../common';
3
+ export declare const handlers: Record<string, OperationHandler>;
4
+ export declare const description: INodeProperties[];
@@ -0,0 +1,78 @@
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 () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.description = exports.handlers = void 0;
37
+ const create = __importStar(require("./create"));
38
+ const get = __importStar(require("./get"));
39
+ const getAll = __importStar(require("./getAll"));
40
+ exports.handlers = {
41
+ create: create.execute,
42
+ get: get.execute,
43
+ getAll: getAll.execute,
44
+ };
45
+ exports.description = [
46
+ {
47
+ displayName: 'Operation',
48
+ name: 'operation',
49
+ type: 'options',
50
+ noDataExpression: true,
51
+ displayOptions: { show: { resource: ['note'] } },
52
+ options: [
53
+ {
54
+ name: 'Create',
55
+ value: 'create',
56
+ description: "Add a note to a lead's or a deal's timeline",
57
+ action: 'Create note',
58
+ },
59
+ {
60
+ name: 'Get',
61
+ value: 'get',
62
+ description: 'Retrieve a note',
63
+ action: 'Get note',
64
+ },
65
+ {
66
+ name: 'Get Many',
67
+ value: 'getAll',
68
+ description: 'Retrieve a list of notes, newest first',
69
+ action: 'Get many notes',
70
+ },
71
+ ],
72
+ default: 'create',
73
+ },
74
+ ...create.description,
75
+ ...get.description,
76
+ ...getAll.description,
77
+ ];
78
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../nodes/Newar/actions/note/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,iDAAmC;AACnC,2CAA6B;AAC7B,iDAAmC;AAEtB,QAAA,QAAQ,GAAqC;IACzD,MAAM,EAAE,MAAM,CAAC,OAAO;IACtB,GAAG,EAAE,GAAG,CAAC,OAAO;IAChB,MAAM,EAAE,MAAM,CAAC,OAAO;CACtB,CAAC;AAEW,QAAA,WAAW,GAAsB;IAC7C;QACC,WAAW,EAAE,WAAW;QACxB,IAAI,EAAE,WAAW;QACjB,IAAI,EAAE,SAAS;QACf,gBAAgB,EAAE,IAAI;QACtB,cAAc,EAAE,EAAE,IAAI,EAAE,EAAE,QAAQ,EAAE,CAAC,MAAM,CAAC,EAAE,EAAE;QAChD,OAAO,EAAE;YACR;gBACC,IAAI,EAAE,QAAQ;gBACd,KAAK,EAAE,QAAQ;gBACf,WAAW,EAAE,6CAA6C;gBAC1D,MAAM,EAAE,aAAa;aACrB;YACD;gBACC,IAAI,EAAE,KAAK;gBACX,KAAK,EAAE,KAAK;gBACZ,WAAW,EAAE,iBAAiB;gBAC9B,MAAM,EAAE,UAAU;aAClB;YACD;gBACC,IAAI,EAAE,UAAU;gBAChB,KAAK,EAAE,QAAQ;gBACf,WAAW,EAAE,wCAAwC;gBACrD,MAAM,EAAE,gBAAgB;aACxB;SACD;QACD,OAAO,EAAE,QAAQ;KACjB;IACD,GAAG,MAAM,CAAC,WAAW;IACrB,GAAG,GAAG,CAAC,WAAW;IAClB,GAAG,MAAM,CAAC,WAAW;CACrB,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { INodeProperties } from 'n8n-workflow';
2
+ import { type OperationHandler } from '../common';
3
+ export declare const description: INodeProperties[];
4
+ export declare const handlers: Record<string, OperationHandler>;
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.handlers = exports.description = void 0;
4
+ const transport_1 = require("../../transport");
5
+ const common_1 = require("../common");
6
+ exports.description = [
7
+ {
8
+ displayName: 'Operation',
9
+ name: 'operation',
10
+ type: 'options',
11
+ noDataExpression: true,
12
+ displayOptions: { show: { resource: ['pipeline'] } },
13
+ options: [
14
+ {
15
+ name: 'Get',
16
+ value: 'get',
17
+ description: 'Retrieve a pipeline with its stages',
18
+ action: 'Get pipeline',
19
+ },
20
+ {
21
+ name: 'Get Many',
22
+ value: 'getAll',
23
+ description: 'Retrieve the pipelines of the workspace, each with its stages in order',
24
+ action: 'Get many pipelines',
25
+ },
26
+ ],
27
+ default: 'getAll',
28
+ },
29
+ ...(0, common_1.updateDisplayOptions)({ show: { resource: ['pipeline'], operation: ['get'] } }, [
30
+ (0, common_1.recordLocator)({
31
+ displayName: 'Pipeline',
32
+ name: 'pipelineId',
33
+ searchListMethod: 'searchPipelines',
34
+ noun: 'pipeline',
35
+ description: 'The pipeline to retrieve',
36
+ }),
37
+ ]),
38
+ ...(0, common_1.updateDisplayOptions)({ show: { resource: ['pipeline'], operation: ['getAll'] } }, [
39
+ (0, common_1.returnAllProperty)(),
40
+ (0, common_1.limitProperty)(1000),
41
+ ]),
42
+ ];
43
+ async function get(itemIndex) {
44
+ const id = (0, common_1.getRecordId)(this, 'pipelineId', itemIndex, 'Pipeline');
45
+ return await common_1.getRecord.call(this, itemIndex, `/v1/pipelines/${id}`);
46
+ }
47
+ async function getAll(itemIndex) {
48
+ var _a;
49
+ const response = await transport_1.newarApiRequest.call(this, {
50
+ method: 'GET',
51
+ path: '/v1/pipelines',
52
+ itemIndex,
53
+ });
54
+ return (0, common_1.applyLimit)(this, itemIndex, (_a = response.data) !== null && _a !== void 0 ? _a : []);
55
+ }
56
+ exports.handlers = { get, getAll };
57
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../nodes/Newar/actions/pipeline/index.ts"],"names":[],"mappings":";;;AAEA,+CAAkD;AAClD,sCASmB;AAEN,QAAA,WAAW,GAAsB;IAC7C;QACC,WAAW,EAAE,WAAW;QACxB,IAAI,EAAE,WA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AM,CAA0B,SAAiB;;IAC/D,MAAM,QAAQ,GAAG,MAAM,2BAAe,CAAC,IAAI,CAAC,IAAI,EAAE;QACjD,MAAM,EAAE,KAAK;QACb,IAAI,EAAE,eAAe;QACrB,SAAS;KACT,CAAC,CAAC;IACH,OAAO,IAAA,mBAAU,EAAC,IAAI,EAAE,SAAS,EAAE,MAAC,QAAQ,CAAC,IAAkC,mCAAI,EAAE,CAAC,CAAC;AACxF,CAAC;AAEY,QAAA,QAAQ,GAAqC,EAAE,GAAG,EAAE,MAAM,EAAE,CAAC"}
@@ -0,0 +1,6 @@
1
+ import type { IExecuteFunctions, INodeExecutionData } from 'n8n-workflow';
2
+ import { NodeApiError, NodeOperationError } from 'n8n-workflow';
3
+ import type { ExecutionContext } from './common';
4
+ export declare function createExecutionContext(ctx: IExecuteFunctions): ExecutionContext;
5
+ export declare function toNodeError(ctx: IExecuteFunctions, error: unknown, itemIndex: number): NodeApiError | NodeOperationError;
6
+ export declare function router(this: IExecuteFunctions): Promise<INodeExecutionData[][]>;
@@ -0,0 +1,147 @@
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 () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.createExecutionContext = createExecutionContext;
37
+ exports.toNodeError = toNodeError;
38
+ exports.router = router;
39
+ const n8n_workflow_1 = require("n8n-workflow");
40
+ const fields_1 = require("../helpers/fields");
41
+ const customField = __importStar(require("./customField"));
42
+ const deal = __importStar(require("./deal"));
43
+ const lead = __importStar(require("./lead"));
44
+ const lossReason = __importStar(require("./lossReason"));
45
+ const note = __importStar(require("./note"));
46
+ const pipeline = __importStar(require("./pipeline"));
47
+ const search = __importStar(require("./search"));
48
+ const stage = __importStar(require("./stage"));
49
+ const tag = __importStar(require("./tag"));
50
+ const task = __importStar(require("./task"));
51
+ const user = __importStar(require("./user"));
52
+ const HANDLERS = {
53
+ customField: customField.handlers,
54
+ deal: deal.handlers,
55
+ lead: lead.handlers,
56
+ lossReason: lossReason.handlers,
57
+ note: note.handlers,
58
+ pipeline: pipeline.handlers,
59
+ search: search.handlers,
60
+ stage: stage.handlers,
61
+ tag: tag.handlers,
62
+ task: task.handlers,
63
+ user: user.handlers,
64
+ };
65
+ function optional(read) {
66
+ try {
67
+ return read();
68
+ }
69
+ catch {
70
+ return undefined;
71
+ }
72
+ }
73
+ function readRunIndex(ctx) {
74
+ const runIndex = optional(() => {
75
+ var _a;
76
+ const proxy = ctx.getWorkflowDataProxy(0);
77
+ return ((_a = proxy.$runIndex) !== null && _a !== void 0 ? _a : proxy.$thisRunIndex);
78
+ });
79
+ return typeof runIndex === 'number' && Number.isInteger(runIndex) ? runIndex : 0;
80
+ }
81
+ function createExecutionContext(ctx) {
82
+ var _a;
83
+ const node = ctx.getNode();
84
+ return {
85
+ timeZone: (_a = optional(() => ctx.getTimezone())) !== null && _a !== void 0 ? _a : 'UTC',
86
+ idempotency: {
87
+ instanceId: optional(() => ctx.getInstanceId()),
88
+ workflowId: optional(() => ctx.getWorkflow().id),
89
+ executionId: optional(() => ctx.getExecutionId()),
90
+ nodeId: node.id,
91
+ nodeName: node.name,
92
+ runIndex: readRunIndex(ctx),
93
+ },
94
+ };
95
+ }
96
+ function toNodeError(ctx, error, itemIndex) {
97
+ if (error instanceof n8n_workflow_1.NodeApiError || error instanceof n8n_workflow_1.NodeOperationError) {
98
+ if (error.context.itemIndex === undefined)
99
+ error.context.itemIndex = itemIndex;
100
+ return error;
101
+ }
102
+ if (error instanceof fields_1.InvalidParameterError) {
103
+ return new n8n_workflow_1.NodeOperationError(ctx.getNode(), error.message, {
104
+ itemIndex,
105
+ description: error.description,
106
+ });
107
+ }
108
+ return new n8n_workflow_1.NodeOperationError(ctx.getNode(), error, { itemIndex });
109
+ }
110
+ function errorJson(error) {
111
+ const json = { error: error.message };
112
+ if (error.description)
113
+ json.description = error.description;
114
+ if (error instanceof n8n_workflow_1.NodeApiError && error.httpCode)
115
+ json.httpCode = error.httpCode;
116
+ return json;
117
+ }
118
+ async function router() {
119
+ var _a;
120
+ const items = this.getInputData();
121
+ const resource = this.getNodeParameter('resource', 0);
122
+ const operation = this.getNodeParameter('operation', 0);
123
+ const handler = (_a = HANDLERS[resource]) === null || _a === void 0 ? void 0 : _a[operation];
124
+ if (!handler) {
125
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), `The operation '${operation}' is not available for '${resource}'`);
126
+ }
127
+ const context = createExecutionContext(this);
128
+ const returnData = [];
129
+ for (let itemIndex = 0; itemIndex < items.length; itemIndex++) {
130
+ try {
131
+ const result = await handler.call(this, itemIndex, context);
132
+ for (const json of Array.isArray(result) ? result : [result]) {
133
+ returnData.push({ json, pairedItem: { item: itemIndex } });
134
+ }
135
+ }
136
+ catch (error) {
137
+ const nodeError = toNodeError(this, error, itemIndex);
138
+ if (this.continueOnFail()) {
139
+ returnData.push({ json: errorJson(nodeError), pairedItem: { item: itemIndex } });
140
+ continue;
141
+ }
142
+ throw nodeError;
143
+ }
144
+ }
145
+ return [returnData];
146
+ }
147
+ //# sourceMappingURL=router.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"router.js","sourceRoot":"","sources":["../../../../nodes/Newar/actions/router.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgDA,wDAaC;AAGD,kCAgBC;AASD,wBAgCC;AAxHD,+CAAgE;AAEhE,8CAA0D;AAE1D,2DAA6C;AAC7C,6CAA+B;AAC/B,6CAA+B;AAC/B,yDAA2C;AAC3C,6CAA+B;AAC/B,qDAAuC;AACvC,iDAAmC;AACnC,+CAAiC;AACjC,2CAA6B;AAC7B,6CAA+B;AAC/B,6CAA+B;AAE/B,MAAM,QAAQ,GAAqD;IAClE,WAAW,EAAE,WAAW,CAAC,QAAQ;IACjC,IAAI,EAAE,IAAI,CAAC,QAAQ;IACnB,IAAI,EAAE,IAAI,CAAC,QAAQ;IACnB,UAAU,EAAE,UAAU,CAAC,QAAQ;IAC/B,IAAI,EAAE,IAAI,CAAC,QAAQ;IACnB,QAAQ,EAAE,QAAQ,CAAC,QAAQ;IAC3B,MAAM,EAAE,MAAM,CAAC,QAAQ;IACvB,KAAK,EAAE,KAAK,CAAC,QAAQ;IACrB,GAAG,EAAE,GAAG,CAAC,QAAQ;IACjB,IAAI,EAAE,IAAI,CAAC,QAAQ;IACnB,IAAI,EAAE,IAAI,CAAC,QAAQ;CACnB,CAAC;AAEF,SAAS,QAAQ,CAAI,IAAa;IACjC,IAAI,CAAC;QACJ,OAAO,IAAI,EAAE,CAAC;IACf,CAAC;IAAC,MAAM,CAAC;QACR,OAAO,SAAS,CAAC;IAClB,CAAC;AACF,CAAC;AAGD,SAAS,YAAY,CAAC,GAAsB;IAC3C,M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7C,MAAM,UAAU,GAAyB,EAAE,CAAC;IAE5C,KAAK,IAAI,SAAS,GAAG,CAAC,EAAE,SAAS,GAAG,KAAK,CAAC,MAAM,EAAE,SAAS,EAAE,EAAE,CAAC;QAC/D,IAAI,CAAC;YACJ,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;YAC5D,KAAK,MAAM,IAAI,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC;gBAC9D,UAAU,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,CAAC,CAAC;YAC5D,CAAC;QACF,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YAChB,MAAM,SAAS,GAAG,WAAW,CAAC,IAAI,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC;YACtD,IAAI,IAAI,CAAC,cAAc,EAAE,EAAE,CAAC;gBAC3B,UAAU,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,SAAS,CAAC,SAAS,CAAC,EAAE,UAAU,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,CAAC,CAAC;gBACjF,SAAS;YACV,CAAC;YACD,MAAM,SAAS,CAAC;QACjB,CAAC;IACF,CAAC;IAED,OAAO,CAAC,UAAU,CAAC,CAAC;AACrB,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { INodeProperties } from 'n8n-workflow';
2
+ import { type OperationHandler } from '../common';
3
+ export declare const description: INodeProperties[];
4
+ export declare const handlers: Record<string, OperationHandler>;
@@ -0,0 +1,75 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.handlers = exports.description = void 0;
4
+ const n8n_workflow_1 = require("n8n-workflow");
5
+ const output_1 = require("../../helpers/output");
6
+ const transport_1 = require("../../transport");
7
+ const common_1 = require("../common");
8
+ const term_1 = require("./term");
9
+ const RECORD_TYPES = ['deal', 'lead', 'task'];
10
+ const properties = [
11
+ (0, term_1.searchTermProperty)('Text to look for in lead names, deal titles and task titles, like the search bar of the Newar app', 3),
12
+ {
13
+ displayName: 'Record Types',
14
+ name: 'recordTypes',
15
+ type: 'multiOptions',
16
+ options: [
17
+ { name: 'Deal', value: 'deal' },
18
+ { name: 'Lead', value: 'lead' },
19
+ { name: 'Task', value: 'task' },
20
+ ],
21
+ default: ['deal', 'lead', 'task'],
22
+ description: 'Types of record to search. Types your Newar user cannot see are skipped.',
23
+ },
24
+ {
25
+ displayName: 'Limit per Type',
26
+ name: 'limitPerType',
27
+ type: 'number',
28
+ typeOptions: { minValue: 1, maxValue: 30 },
29
+ default: 10,
30
+ description: 'Max number of results to return for each record type',
31
+ },
32
+ ];
33
+ exports.description = [
34
+ {
35
+ displayName: 'Operation',
36
+ name: 'operation',
37
+ type: 'options',
38
+ noDataExpression: true,
39
+ displayOptions: { show: { resource: ['search'] } },
40
+ options: [
41
+ {
42
+ name: 'Search Records',
43
+ value: 'search',
44
+ description: 'Search leads, deals and tasks at once, ordered by relevance',
45
+ action: 'Search all records',
46
+ },
47
+ ],
48
+ default: 'search',
49
+ },
50
+ ...(0, common_1.updateDisplayOptions)({ show: { resource: ['search'], operation: ['search'] } }, properties),
51
+ ];
52
+ async function searchRecords(itemIndex) {
53
+ var _a, _b, _c;
54
+ const term = (0, term_1.readSearchTerm)(this, itemIndex, 3);
55
+ const selected = (_a = this.getNodeParameter('recordTypes', itemIndex, RECORD_TYPES)) !== null && _a !== void 0 ? _a : [];
56
+ const recordTypes = selected.filter((type) => RECORD_TYPES.includes(type));
57
+ if (recordTypes.length === 0) {
58
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), "Choose at least one of the 'Record Types'", {
59
+ itemIndex,
60
+ });
61
+ }
62
+ const limit = this.getNodeParameter('limitPerType', itemIndex, 10);
63
+ const response = await transport_1.newarApiRequest.call(this, {
64
+ method: 'GET',
65
+ path: '/v1/search',
66
+ qs: { term, item_types: recordTypes.join(','), limit },
67
+ itemIndex,
68
+ });
69
+ const hits = (_c = (_b = response.data) === null || _b === void 0 ? void 0 : _b.items) !== null && _c !== void 0 ? _c : [];
70
+ return hits.map((hit) => ({ type: hit.type, ...(0, output_1.flattenSearchHit)(hit) }));
71
+ }
72
+ exports.handlers = {
73
+ search: searchRecords,
74
+ };
75
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../nodes/Newar/actions/search/index.ts"],"names":[],"mappings":";;;AACA,+CAAkD;AAElD,iDAAwD;AACxD,+CAAkD;AAClD,sCAAwE;AACxE,iCAA4D;AAE5D,MAAM,YAAY,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;AAE9C,MAAM,UAAU,GAAsB;IACrC,IAAA,yBAAkB,EACjB,mGAAmG,EACnG,CAAC,CACD;IACD;QACC,WAAW,EAAE,cAAc;QAC3B,IAAI,EAAE,aAAa;QACnB,IAAI,EAAE,cAAc;QACpB,OAAO,EAAE;YACR,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE;YAC/B,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE;YAC/B,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE;SAC/B;QACD,OAAO,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC;QACjC,WAAW,EAAE,0EAA0E;KACvF;IACD;QACC,WAAW,EAAE,gBAAgB;QAC7B,IAAI,EAAE,cAAc;QACpB,IAAI,EAAE,QAAQ;QACd,WAAW,EAAE,EAAE,QAAQ,EAAE,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE;QAC1C,OAAO,EAAE,EAAE;QACX,WAAW,EAAE,sDAAsD;KACnE;CACD,CAAC;A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,IAAI,CAAC,IAAI,EAAE;QACjD,MAAM,EAAE,KAAK;QACb,IAAI,EAAE,YAAY;QAClB,EAAE,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,KAAK,EAAE;QACtD,SAAS;KACT,CAAC,CAAC;IACH,MAAM,IAAI,GAAG,MAAA,MAAC,QAAQ,CAAC,IAA8C,0CAAE,KAAK,mCAAI,EAAE,CAAC;IACnF,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,GAAG,CAAC,IAAI,EAAE,GAAG,IAAA,yBAAgB,EAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC;AAC1E,CAAC;AAEY,QAAA,QAAQ,GAAqC;IACzD,MAAM,EAAE,aAAa;CACrB,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { IExecuteFunctions, INodeProperties } from 'n8n-workflow';
2
+ export declare function searchTermProperty(description: string, minLength: number): INodeProperties;
3
+ export declare function readSearchTerm(ctx: IExecuteFunctions, itemIndex: number, minLength: number): string;