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.
- package/LICENSE.md +21 -0
- package/README.md +232 -0
- package/dist/credentials/NewarApi.credentials.d.ts +10 -0
- package/dist/credentials/NewarApi.credentials.js +63 -0
- package/dist/credentials/NewarApi.credentials.js.map +1 -0
- package/dist/icons/newar.dark.svg +3 -0
- package/dist/icons/newar.svg +3 -0
- package/dist/nodes/Newar/Newar.node.d.ts +11 -0
- package/dist/nodes/Newar/Newar.node.js +151 -0
- package/dist/nodes/Newar/Newar.node.js.map +1 -0
- package/dist/nodes/Newar/Newar.node.json +19 -0
- package/dist/nodes/Newar/actions/common.d.ts +40 -0
- package/dist/nodes/Newar/actions/common.js +328 -0
- package/dist/nodes/Newar/actions/common.js.map +1 -0
- package/dist/nodes/Newar/actions/customField/index.d.ts +4 -0
- package/dist/nodes/Newar/actions/customField/index.js +50 -0
- package/dist/nodes/Newar/actions/customField/index.js.map +1 -0
- package/dist/nodes/Newar/actions/customFields.d.ts +5 -0
- package/dist/nodes/Newar/actions/customFields.js +53 -0
- package/dist/nodes/Newar/actions/customFields.js.map +1 -0
- package/dist/nodes/Newar/actions/deal/create.d.ts +4 -0
- package/dist/nodes/Newar/actions/deal/create.js +39 -0
- package/dist/nodes/Newar/actions/deal/create.js.map +1 -0
- package/dist/nodes/Newar/actions/deal/delete.d.ts +3 -0
- package/dist/nodes/Newar/actions/deal/delete.js +26 -0
- package/dist/nodes/Newar/actions/deal/delete.js.map +1 -0
- package/dist/nodes/Newar/actions/deal/fields.d.ts +7 -0
- package/dist/nodes/Newar/actions/deal/fields.js +182 -0
- package/dist/nodes/Newar/actions/deal/fields.js.map +1 -0
- package/dist/nodes/Newar/actions/deal/get.d.ts +3 -0
- package/dist/nodes/Newar/actions/deal/get.js +22 -0
- package/dist/nodes/Newar/actions/deal/get.js.map +1 -0
- package/dist/nodes/Newar/actions/deal/getAll.d.ts +4 -0
- package/dist/nodes/Newar/actions/deal/getAll.js +102 -0
- package/dist/nodes/Newar/actions/deal/getAll.js.map +1 -0
- package/dist/nodes/Newar/actions/deal/index.d.ts +4 -0
- package/dist/nodes/Newar/actions/deal/index.js +105 -0
- package/dist/nodes/Newar/actions/deal/index.js.map +1 -0
- package/dist/nodes/Newar/actions/deal/search.d.ts +4 -0
- package/dist/nodes/Newar/actions/deal/search.js +69 -0
- package/dist/nodes/Newar/actions/deal/search.js.map +1 -0
- package/dist/nodes/Newar/actions/deal/update.d.ts +4 -0
- package/dist/nodes/Newar/actions/deal/update.js +42 -0
- package/dist/nodes/Newar/actions/deal/update.js.map +1 -0
- package/dist/nodes/Newar/actions/lead/create.d.ts +4 -0
- package/dist/nodes/Newar/actions/lead/create.js +41 -0
- package/dist/nodes/Newar/actions/lead/create.js.map +1 -0
- package/dist/nodes/Newar/actions/lead/delete.d.ts +3 -0
- package/dist/nodes/Newar/actions/lead/delete.js +26 -0
- package/dist/nodes/Newar/actions/lead/delete.js.map +1 -0
- package/dist/nodes/Newar/actions/lead/fields.d.ts +6 -0
- package/dist/nodes/Newar/actions/lead/fields.js +231 -0
- package/dist/nodes/Newar/actions/lead/fields.js.map +1 -0
- package/dist/nodes/Newar/actions/lead/get.d.ts +3 -0
- package/dist/nodes/Newar/actions/lead/get.js +22 -0
- package/dist/nodes/Newar/actions/lead/get.js.map +1 -0
- package/dist/nodes/Newar/actions/lead/getAll.d.ts +4 -0
- package/dist/nodes/Newar/actions/lead/getAll.js +102 -0
- package/dist/nodes/Newar/actions/lead/getAll.js.map +1 -0
- package/dist/nodes/Newar/actions/lead/index.d.ts +4 -0
- package/dist/nodes/Newar/actions/lead/index.js +105 -0
- package/dist/nodes/Newar/actions/lead/index.js.map +1 -0
- package/dist/nodes/Newar/actions/lead/search.d.ts +3 -0
- package/dist/nodes/Newar/actions/lead/search.js +37 -0
- package/dist/nodes/Newar/actions/lead/search.js.map +1 -0
- package/dist/nodes/Newar/actions/lead/update.d.ts +4 -0
- package/dist/nodes/Newar/actions/lead/update.js +36 -0
- package/dist/nodes/Newar/actions/lead/update.js.map +1 -0
- package/dist/nodes/Newar/actions/lossReason/index.d.ts +4 -0
- package/dist/nodes/Newar/actions/lossReason/index.js +38 -0
- package/dist/nodes/Newar/actions/lossReason/index.js.map +1 -0
- package/dist/nodes/Newar/actions/note/create.d.ts +4 -0
- package/dist/nodes/Newar/actions/note/create.js +68 -0
- package/dist/nodes/Newar/actions/note/create.js.map +1 -0
- package/dist/nodes/Newar/actions/note/get.d.ts +3 -0
- package/dist/nodes/Newar/actions/note/get.js +20 -0
- package/dist/nodes/Newar/actions/note/get.js.map +1 -0
- package/dist/nodes/Newar/actions/note/getAll.d.ts +4 -0
- package/dist/nodes/Newar/actions/note/getAll.js +46 -0
- package/dist/nodes/Newar/actions/note/getAll.js.map +1 -0
- package/dist/nodes/Newar/actions/note/index.d.ts +4 -0
- package/dist/nodes/Newar/actions/note/index.js +78 -0
- package/dist/nodes/Newar/actions/note/index.js.map +1 -0
- package/dist/nodes/Newar/actions/pipeline/index.d.ts +4 -0
- package/dist/nodes/Newar/actions/pipeline/index.js +57 -0
- package/dist/nodes/Newar/actions/pipeline/index.js.map +1 -0
- package/dist/nodes/Newar/actions/router.d.ts +6 -0
- package/dist/nodes/Newar/actions/router.js +147 -0
- package/dist/nodes/Newar/actions/router.js.map +1 -0
- package/dist/nodes/Newar/actions/search/index.d.ts +4 -0
- package/dist/nodes/Newar/actions/search/index.js +75 -0
- package/dist/nodes/Newar/actions/search/index.js.map +1 -0
- package/dist/nodes/Newar/actions/search/term.d.ts +3 -0
- package/dist/nodes/Newar/actions/search/term.js +30 -0
- package/dist/nodes/Newar/actions/search/term.js.map +1 -0
- package/dist/nodes/Newar/actions/stage/index.d.ts +4 -0
- package/dist/nodes/Newar/actions/stage/index.js +77 -0
- package/dist/nodes/Newar/actions/stage/index.js.map +1 -0
- package/dist/nodes/Newar/actions/tag/index.d.ts +4 -0
- package/dist/nodes/Newar/actions/tag/index.js +154 -0
- package/dist/nodes/Newar/actions/tag/index.js.map +1 -0
- package/dist/nodes/Newar/actions/task/create.d.ts +4 -0
- package/dist/nodes/Newar/actions/task/create.js +44 -0
- package/dist/nodes/Newar/actions/task/create.js.map +1 -0
- package/dist/nodes/Newar/actions/task/delete.d.ts +3 -0
- package/dist/nodes/Newar/actions/task/delete.js +20 -0
- package/dist/nodes/Newar/actions/task/delete.js.map +1 -0
- package/dist/nodes/Newar/actions/task/fields.d.ts +9 -0
- package/dist/nodes/Newar/actions/task/fields.js +143 -0
- package/dist/nodes/Newar/actions/task/fields.js.map +1 -0
- package/dist/nodes/Newar/actions/task/get.d.ts +3 -0
- package/dist/nodes/Newar/actions/task/get.js +22 -0
- package/dist/nodes/Newar/actions/task/get.js.map +1 -0
- package/dist/nodes/Newar/actions/task/getAll.d.ts +4 -0
- package/dist/nodes/Newar/actions/task/getAll.js +113 -0
- package/dist/nodes/Newar/actions/task/getAll.js.map +1 -0
- package/dist/nodes/Newar/actions/task/index.d.ts +4 -0
- package/dist/nodes/Newar/actions/task/index.js +96 -0
- package/dist/nodes/Newar/actions/task/index.js.map +1 -0
- package/dist/nodes/Newar/actions/task/update.d.ts +4 -0
- package/dist/nodes/Newar/actions/task/update.js +31 -0
- package/dist/nodes/Newar/actions/task/update.js.map +1 -0
- package/dist/nodes/Newar/actions/user/index.d.ts +4 -0
- package/dist/nodes/Newar/actions/user/index.js +66 -0
- package/dist/nodes/Newar/actions/user/index.js.map +1 -0
- package/dist/nodes/Newar/helpers/customFields.d.ts +28 -0
- package/dist/nodes/Newar/helpers/customFields.js +131 -0
- package/dist/nodes/Newar/helpers/customFields.js.map +1 -0
- package/dist/nodes/Newar/helpers/dates.d.ts +4 -0
- package/dist/nodes/Newar/helpers/dates.js +134 -0
- package/dist/nodes/Newar/helpers/dates.js.map +1 -0
- package/dist/nodes/Newar/helpers/errors.d.ts +34 -0
- package/dist/nodes/Newar/helpers/errors.js +323 -0
- package/dist/nodes/Newar/helpers/errors.js.map +1 -0
- package/dist/nodes/Newar/helpers/fields.d.ts +26 -0
- package/dist/nodes/Newar/helpers/fields.js +141 -0
- package/dist/nodes/Newar/helpers/fields.js.map +1 -0
- package/dist/nodes/Newar/helpers/idempotency.d.ts +16 -0
- package/dist/nodes/Newar/helpers/idempotency.js +42 -0
- package/dist/nodes/Newar/helpers/idempotency.js.map +1 -0
- package/dist/nodes/Newar/helpers/output.d.ts +7 -0
- package/dist/nodes/Newar/helpers/output.js +131 -0
- package/dist/nodes/Newar/helpers/output.js.map +1 -0
- package/dist/nodes/Newar/helpers/pagination.d.ts +23 -0
- package/dist/nodes/Newar/helpers/pagination.js +43 -0
- package/dist/nodes/Newar/helpers/pagination.js.map +1 -0
- package/dist/nodes/Newar/methods/index.d.ts +3 -0
- package/dist/nodes/Newar/methods/index.js +40 -0
- package/dist/nodes/Newar/methods/index.js.map +1 -0
- package/dist/nodes/Newar/methods/listSearch.d.ts +9 -0
- package/dist/nodes/Newar/methods/listSearch.js +142 -0
- package/dist/nodes/Newar/methods/listSearch.js.map +1 -0
- package/dist/nodes/Newar/methods/loadOptions.d.ts +7 -0
- package/dist/nodes/Newar/methods/loadOptions.js +61 -0
- package/dist/nodes/Newar/methods/loadOptions.js.map +1 -0
- package/dist/nodes/Newar/methods/resourceMapping.d.ts +3 -0
- package/dist/nodes/Newar/methods/resourceMapping.js +26 -0
- package/dist/nodes/Newar/methods/resourceMapping.js.map +1 -0
- package/dist/nodes/Newar/methods/shared.d.ts +11 -0
- package/dist/nodes/Newar/methods/shared.js +65 -0
- package/dist/nodes/Newar/methods/shared.js.map +1 -0
- package/dist/nodes/Newar/transport/index.d.ts +36 -0
- package/dist/nodes/Newar/transport/index.js +114 -0
- package/dist/nodes/Newar/transport/index.js.map +1 -0
- package/dist/nodes/NewarTrigger/NewarTrigger.node.d.ts +14 -0
- package/dist/nodes/NewarTrigger/NewarTrigger.node.js +295 -0
- package/dist/nodes/NewarTrigger/NewarTrigger.node.js.map +1 -0
- package/dist/nodes/NewarTrigger/NewarTrigger.node.json +19 -0
- package/dist/nodes/NewarTrigger/polling.d.ts +38 -0
- package/dist/nodes/NewarTrigger/polling.js +211 -0
- package/dist/nodes/NewarTrigger/polling.js.map +1 -0
- package/dist/package.json +68 -0
- package/package.json +68 -0
|
@@ -0,0 +1,328 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UUID_REGEX = void 0;
|
|
4
|
+
exports.updateDisplayOptions = updateDisplayOptions;
|
|
5
|
+
exports.recordLocator = recordLocator;
|
|
6
|
+
exports.returnAllProperty = returnAllProperty;
|
|
7
|
+
exports.limitProperty = limitProperty;
|
|
8
|
+
exports.idempotencyOptions = idempotencyOptions;
|
|
9
|
+
exports.outputProperties = outputProperties;
|
|
10
|
+
exports.shapeRecords = shapeRecords;
|
|
11
|
+
exports.getRecordId = getRecordId;
|
|
12
|
+
exports.getRequiredText = getRequiredText;
|
|
13
|
+
exports.getCollection = getCollection;
|
|
14
|
+
exports.createRecord = createRecord;
|
|
15
|
+
exports.getRecord = getRecord;
|
|
16
|
+
exports.deleteRecord = deleteRecord;
|
|
17
|
+
exports.updateRecord = updateRecord;
|
|
18
|
+
exports.applyLimit = applyLimit;
|
|
19
|
+
exports.sortProperty = sortProperty;
|
|
20
|
+
exports.readSort = readSort;
|
|
21
|
+
exports.readPaging = readPaging;
|
|
22
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
23
|
+
const fields_1 = require("../helpers/fields");
|
|
24
|
+
const idempotency_1 = require("../helpers/idempotency");
|
|
25
|
+
const output_1 = require("../helpers/output");
|
|
26
|
+
const transport_1 = require("../transport");
|
|
27
|
+
exports.UUID_REGEX = '^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$';
|
|
28
|
+
function updateDisplayOptions(displayOptions, properties) {
|
|
29
|
+
return properties.map((property) => {
|
|
30
|
+
var _a, _b, _c;
|
|
31
|
+
return ({
|
|
32
|
+
...property,
|
|
33
|
+
displayOptions: {
|
|
34
|
+
...property.displayOptions,
|
|
35
|
+
show: { ...displayOptions.show, ...(_a = property.displayOptions) === null || _a === void 0 ? void 0 : _a.show },
|
|
36
|
+
...(displayOptions.hide || ((_b = property.displayOptions) === null || _b === void 0 ? void 0 : _b.hide)
|
|
37
|
+
? { hide: { ...displayOptions.hide, ...(_c = property.displayOptions) === null || _c === void 0 ? void 0 : _c.hide } }
|
|
38
|
+
: {}),
|
|
39
|
+
},
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
function recordLocator(options) {
|
|
44
|
+
var _a;
|
|
45
|
+
return {
|
|
46
|
+
displayName: options.displayName,
|
|
47
|
+
name: options.name,
|
|
48
|
+
type: 'resourceLocator',
|
|
49
|
+
default: { mode: 'list', value: '' },
|
|
50
|
+
required: (_a = options.required) !== null && _a !== void 0 ? _a : true,
|
|
51
|
+
description: options.description,
|
|
52
|
+
modes: [
|
|
53
|
+
{
|
|
54
|
+
displayName: 'From List',
|
|
55
|
+
name: 'list',
|
|
56
|
+
type: 'list',
|
|
57
|
+
placeholder: `Select a ${options.noun}...`,
|
|
58
|
+
typeOptions: {
|
|
59
|
+
searchListMethod: options.searchListMethod,
|
|
60
|
+
searchable: true,
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
displayName: 'By ID',
|
|
65
|
+
name: 'id',
|
|
66
|
+
type: 'string',
|
|
67
|
+
placeholder: 'e.g. 0f8d3c2a-6b1e-4f7a-9c5d-2e4b8a1f6c3d',
|
|
68
|
+
validation: [
|
|
69
|
+
{
|
|
70
|
+
type: 'regex',
|
|
71
|
+
properties: {
|
|
72
|
+
regex: exports.UUID_REGEX,
|
|
73
|
+
errorMessage: 'Not a valid Newar ID. Newar IDs are UUIDs.',
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
],
|
|
77
|
+
},
|
|
78
|
+
],
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
function returnAllProperty() {
|
|
82
|
+
return {
|
|
83
|
+
displayName: 'Return All',
|
|
84
|
+
name: 'returnAll',
|
|
85
|
+
type: 'boolean',
|
|
86
|
+
default: false,
|
|
87
|
+
description: 'Whether to return all results or only up to a given limit',
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
function limitProperty(maxValue) {
|
|
91
|
+
return {
|
|
92
|
+
displayName: 'Limit',
|
|
93
|
+
name: 'limit',
|
|
94
|
+
type: 'number',
|
|
95
|
+
default: 50,
|
|
96
|
+
typeOptions: { minValue: 1, maxValue },
|
|
97
|
+
displayOptions: { show: { returnAll: [false] } },
|
|
98
|
+
description: 'Max number of results to return',
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
function idempotencyOptions(noun) {
|
|
102
|
+
return {
|
|
103
|
+
displayName: 'Options',
|
|
104
|
+
name: 'options',
|
|
105
|
+
type: 'collection',
|
|
106
|
+
placeholder: 'Add Option',
|
|
107
|
+
default: {},
|
|
108
|
+
options: [
|
|
109
|
+
{
|
|
110
|
+
displayName: 'Idempotency Key',
|
|
111
|
+
name: 'idempotencyKey',
|
|
112
|
+
type: 'string',
|
|
113
|
+
default: '',
|
|
114
|
+
placeholder: 'e.g. order-2026-000123',
|
|
115
|
+
description: `A stable value that identifies this ${noun} in the source system, such as its ID. Newar then creates it once, even if the workflow runs again within 24 hours. Leave empty to only protect against 'Retry On Fail' duplicates.`,
|
|
116
|
+
},
|
|
117
|
+
],
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
const FIELD_LABELS = {
|
|
121
|
+
assigned_to_id: 'Assignee ID',
|
|
122
|
+
close_reason: 'Close Reason',
|
|
123
|
+
closed_at: 'Closed At',
|
|
124
|
+
company: 'Company',
|
|
125
|
+
completed_at: 'Completed At',
|
|
126
|
+
created_at: 'Created At',
|
|
127
|
+
created_by_id: 'Created By ID',
|
|
128
|
+
custom_fields: 'Custom Fields',
|
|
129
|
+
deal_id: 'Deal ID',
|
|
130
|
+
description: 'Description',
|
|
131
|
+
due_at: 'Due At',
|
|
132
|
+
email: 'Email',
|
|
133
|
+
emails: 'Emails',
|
|
134
|
+
id: 'ID',
|
|
135
|
+
is_primary: 'Is Primary',
|
|
136
|
+
kind: 'Type',
|
|
137
|
+
lead_id: 'Lead ID',
|
|
138
|
+
loss_reason_id: 'Loss Reason ID',
|
|
139
|
+
name: 'Name',
|
|
140
|
+
next_step: 'Next Step',
|
|
141
|
+
next_step_due: 'Next Step Due',
|
|
142
|
+
observations: 'Observations',
|
|
143
|
+
opened_at: 'Opened At',
|
|
144
|
+
owner_id: 'Owner ID',
|
|
145
|
+
phone: 'Phone',
|
|
146
|
+
phones: 'Phones',
|
|
147
|
+
pipeline_id: 'Pipeline ID',
|
|
148
|
+
priority: 'Priority',
|
|
149
|
+
score: 'Score',
|
|
150
|
+
source: 'Source',
|
|
151
|
+
stage_entered_at: 'Stage Entered At',
|
|
152
|
+
stage_id: 'Stage ID',
|
|
153
|
+
status: 'Status',
|
|
154
|
+
tag_ids: 'Tag IDs',
|
|
155
|
+
title: 'Title',
|
|
156
|
+
updated_at: 'Updated At',
|
|
157
|
+
utm: 'UTM',
|
|
158
|
+
value: 'Value',
|
|
159
|
+
value_estimate: 'Value Estimate',
|
|
160
|
+
};
|
|
161
|
+
function fieldOptions(entity) {
|
|
162
|
+
return output_1.RECORD_FIELDS[entity]
|
|
163
|
+
.filter((field) => field !== 'id')
|
|
164
|
+
.map((field) => { var _a; return ({ name: (_a = FIELD_LABELS[field]) !== null && _a !== void 0 ? _a : field, value: field }); })
|
|
165
|
+
.sort((a, b) => a.name.localeCompare(b.name));
|
|
166
|
+
}
|
|
167
|
+
function outputProperties(entity) {
|
|
168
|
+
return [
|
|
169
|
+
{
|
|
170
|
+
displayName: 'Output',
|
|
171
|
+
name: 'output',
|
|
172
|
+
type: 'options',
|
|
173
|
+
default: 'simplified',
|
|
174
|
+
options: [
|
|
175
|
+
{
|
|
176
|
+
name: 'Simplified',
|
|
177
|
+
value: 'simplified',
|
|
178
|
+
description: 'Return the 10 most useful fields',
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
name: 'Raw',
|
|
182
|
+
value: 'raw',
|
|
183
|
+
description: 'Return every field Newar sends, including custom fields',
|
|
184
|
+
},
|
|
185
|
+
{
|
|
186
|
+
name: 'Selected Fields',
|
|
187
|
+
value: 'fields',
|
|
188
|
+
description: 'Return only the fields you choose',
|
|
189
|
+
},
|
|
190
|
+
],
|
|
191
|
+
},
|
|
192
|
+
{
|
|
193
|
+
displayName: 'Fields',
|
|
194
|
+
name: 'fields',
|
|
195
|
+
type: 'multiOptions',
|
|
196
|
+
default: [],
|
|
197
|
+
options: fieldOptions(entity),
|
|
198
|
+
displayOptions: { show: { output: ['fields'] } },
|
|
199
|
+
description: 'The fields to return. The ID is always included.',
|
|
200
|
+
},
|
|
201
|
+
];
|
|
202
|
+
}
|
|
203
|
+
function shapeRecords(ctx, itemIndex, entity, records) {
|
|
204
|
+
const mode = ctx.getNodeParameter('output', itemIndex, 'simplified');
|
|
205
|
+
const fields = mode === 'fields' ? ctx.getNodeParameter('fields', itemIndex, []) : [];
|
|
206
|
+
return records.map((record) => (0, output_1.applyOutput)(record, entity, mode, fields));
|
|
207
|
+
}
|
|
208
|
+
function getRecordId(ctx, parameterName, itemIndex, label) {
|
|
209
|
+
const raw = ctx.getNodeParameter(parameterName, itemIndex, '', { extractValue: true });
|
|
210
|
+
const value = typeof raw === 'string' ? raw.trim() : String(raw !== null && raw !== void 0 ? raw : '').trim();
|
|
211
|
+
if (value === '') {
|
|
212
|
+
throw new n8n_workflow_1.NodeOperationError(ctx.getNode(), `'${label}' is empty`, {
|
|
213
|
+
itemIndex,
|
|
214
|
+
description: `Pick a ${label.toLowerCase()} from the list or enter its ID.`,
|
|
215
|
+
});
|
|
216
|
+
}
|
|
217
|
+
if (!(0, fields_1.isUuid)(value)) {
|
|
218
|
+
throw new n8n_workflow_1.NodeOperationError(ctx.getNode(), `'${label}' is not a valid Newar ID`, {
|
|
219
|
+
itemIndex,
|
|
220
|
+
description: `Newar IDs are UUIDs such as 0f8d3c2a-6b1e-4f7a-9c5d-2e4b8a1f6c3d. Got '${value}'.`,
|
|
221
|
+
});
|
|
222
|
+
}
|
|
223
|
+
return value.toLowerCase();
|
|
224
|
+
}
|
|
225
|
+
function getRequiredText(ctx, parameterName, itemIndex, label) {
|
|
226
|
+
const value = ctx.getNodeParameter(parameterName, itemIndex, '');
|
|
227
|
+
const text = typeof value === 'string' ? value : String(value !== null && value !== void 0 ? value : '');
|
|
228
|
+
if (text.trim() === '') {
|
|
229
|
+
throw new n8n_workflow_1.NodeOperationError(ctx.getNode(), `'${label}' is empty`, {
|
|
230
|
+
itemIndex,
|
|
231
|
+
description: `Fill in '${label}' or map it from the input data.`,
|
|
232
|
+
});
|
|
233
|
+
}
|
|
234
|
+
return text;
|
|
235
|
+
}
|
|
236
|
+
function getCollection(ctx, parameterName, itemIndex) {
|
|
237
|
+
var _a;
|
|
238
|
+
return (_a = ctx.getNodeParameter(parameterName, itemIndex, {})) !== null && _a !== void 0 ? _a : {};
|
|
239
|
+
}
|
|
240
|
+
async function createRecord(itemIndex, context, path, body) {
|
|
241
|
+
var _a;
|
|
242
|
+
const options = getCollection(this, 'options', itemIndex);
|
|
243
|
+
const customKey = typeof options.idempotencyKey === 'string' ? options.idempotencyKey : '';
|
|
244
|
+
const key = customKey.trim() !== ''
|
|
245
|
+
? (0, idempotency_1.customIdempotencyKey)(path, customKey)
|
|
246
|
+
: (0, idempotency_1.deriveIdempotencyKey)({ ...context.idempotency, itemIndex }, { method: 'POST', path });
|
|
247
|
+
const response = await transport_1.newarApiRequest.call(this, {
|
|
248
|
+
method: 'POST',
|
|
249
|
+
path,
|
|
250
|
+
body,
|
|
251
|
+
headers: key ? { 'Idempotency-Key': key } : undefined,
|
|
252
|
+
itemIndex,
|
|
253
|
+
});
|
|
254
|
+
return ((_a = response.data) !== null && _a !== void 0 ? _a : {});
|
|
255
|
+
}
|
|
256
|
+
async function getRecord(itemIndex, path) {
|
|
257
|
+
var _a;
|
|
258
|
+
const response = await transport_1.newarApiRequest.call(this, { method: 'GET', path, itemIndex });
|
|
259
|
+
return ((_a = response.data) !== null && _a !== void 0 ? _a : {});
|
|
260
|
+
}
|
|
261
|
+
async function deleteRecord(itemIndex, path) {
|
|
262
|
+
var _a;
|
|
263
|
+
const response = await transport_1.newarApiRequest.call(this, { method: 'DELETE', path, itemIndex });
|
|
264
|
+
return ((_a = response.data) !== null && _a !== void 0 ? _a : { deleted: true });
|
|
265
|
+
}
|
|
266
|
+
async function updateRecord(itemIndex, path, body) {
|
|
267
|
+
var _a;
|
|
268
|
+
if (Object.keys(body).length === 0) {
|
|
269
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Nothing to update', {
|
|
270
|
+
itemIndex,
|
|
271
|
+
description: "Add at least one field under 'Update Fields' or 'Custom Fields'.",
|
|
272
|
+
});
|
|
273
|
+
}
|
|
274
|
+
const response = await transport_1.newarApiRequest.call(this, { method: 'PATCH', path, body, itemIndex });
|
|
275
|
+
return ((_a = response.data) !== null && _a !== void 0 ? _a : {});
|
|
276
|
+
}
|
|
277
|
+
function applyLimit(ctx, itemIndex, records) {
|
|
278
|
+
const returnAll = ctx.getNodeParameter('returnAll', itemIndex, false);
|
|
279
|
+
if (returnAll)
|
|
280
|
+
return records;
|
|
281
|
+
const limit = ctx.getNodeParameter('limit', itemIndex, 50);
|
|
282
|
+
return records.slice(0, Math.max(0, limit));
|
|
283
|
+
}
|
|
284
|
+
function sortProperty(fields, defaultField) {
|
|
285
|
+
return {
|
|
286
|
+
displayName: 'Sort',
|
|
287
|
+
name: 'sort',
|
|
288
|
+
type: 'collection',
|
|
289
|
+
placeholder: 'Add Sort Rule',
|
|
290
|
+
default: {},
|
|
291
|
+
options: [
|
|
292
|
+
{
|
|
293
|
+
displayName: 'Direction',
|
|
294
|
+
name: 'direction',
|
|
295
|
+
type: 'options',
|
|
296
|
+
options: [
|
|
297
|
+
{ name: 'Ascending', value: 'asc' },
|
|
298
|
+
{ name: 'Descending', value: 'desc' },
|
|
299
|
+
],
|
|
300
|
+
default: 'desc',
|
|
301
|
+
description: 'Order of the results. Newar defaults to descending.',
|
|
302
|
+
},
|
|
303
|
+
{
|
|
304
|
+
displayName: 'Field',
|
|
305
|
+
name: 'field',
|
|
306
|
+
type: 'options',
|
|
307
|
+
options: fields,
|
|
308
|
+
default: defaultField,
|
|
309
|
+
description: 'Field to sort the results by',
|
|
310
|
+
},
|
|
311
|
+
],
|
|
312
|
+
};
|
|
313
|
+
}
|
|
314
|
+
function readSort(ctx, itemIndex) {
|
|
315
|
+
const sort = getCollection(ctx, 'sort', itemIndex);
|
|
316
|
+
const query = {};
|
|
317
|
+
if (typeof sort.field === 'string' && sort.field !== '')
|
|
318
|
+
query.sort_by = sort.field;
|
|
319
|
+
if (typeof sort.direction === 'string' && sort.direction !== '')
|
|
320
|
+
query.sort_direction = sort.direction;
|
|
321
|
+
return query;
|
|
322
|
+
}
|
|
323
|
+
function readPaging(ctx, itemIndex) {
|
|
324
|
+
const returnAll = ctx.getNodeParameter('returnAll', itemIndex, false);
|
|
325
|
+
const limit = returnAll ? 0 : ctx.getNodeParameter('limit', itemIndex, 50);
|
|
326
|
+
return { returnAll, limit };
|
|
327
|
+
}
|
|
328
|
+
//# sourceMappingURL=common.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../../../nodes/Newar/actions/common.ts"],"names":[],"mappings":";;;AAiCA,oDAcC;AAaD,sCAoCC;AAED,8CAQC;AAED,sCAUC;AAED,gDAkBC;AAoDD,4CAmCC;AAGD,oCAUC;AAGD,kCAqBC;AAGD,0CAeC;AAED,sCAMC;AAGD,oCAwBC;AAGD,8BAOC;AAGD,oCAOC;AAGD,oCAcC;AAQD,gCASC;AAGD,oCAgCC;AAGD,4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ACH,CAAC;AAGD,SAAgB,QAAQ,CAAC,GAAsB,EAAE,SAAiB;IACjE,MAAM,IAAI,GAAG,aAAa,CAAC,GAAG,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC;IACnD,MAAM,KAAK,GAAgB,EAAE,CAAC;IAC9B,IAAI,OAAO,IAAI,CAAC,KAAK,KAAK,QAAQ,IAAI,IAAI,CAAC,KAAK,KAAK,EAAE;QAAE,KAAK,CAAC,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC;IACpF,IAAI,OAAO,IAAI,CAAC,SAAS,KAAK,QAAQ,IAAI,IAAI,CAAC,SAAS,KAAK,EAAE;QAC9D,KAAK,CAAC,cAAc,GAAG,IAAI,CAAC,SAAS,CAAC;IACvC,OAAO,KAAK,CAAC;AACd,CAAC;AAGD,SAAgB,UAAU,CACzB,GAAsB,EACtB,SAAiB;IAEjB,MAAM,SAAS,GAAG,GAAG,CAAC,gBAAgB,CAAC,WAAW,EAAE,SAAS,EAAE,KAAK,CAAY,CAAC;IACjF,MAAM,KAAK,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAE,GAAG,CAAC,gBAAgB,CAAC,OAAO,EAAE,SAAS,EAAE,EAAE,CAAY,CAAC;IACvF,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;AAC7B,CAAC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
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: ['customField'] } },
|
|
13
|
+
options: [
|
|
14
|
+
{
|
|
15
|
+
name: 'Get Many',
|
|
16
|
+
value: 'getAll',
|
|
17
|
+
description: 'Retrieve the custom fields of leads or deals, with their keys, types and options',
|
|
18
|
+
action: 'Get many custom fields',
|
|
19
|
+
},
|
|
20
|
+
],
|
|
21
|
+
default: 'getAll',
|
|
22
|
+
},
|
|
23
|
+
...(0, common_1.updateDisplayOptions)({ show: { resource: ['customField'], operation: ['getAll'] } }, [
|
|
24
|
+
{
|
|
25
|
+
displayName: 'Record Type',
|
|
26
|
+
name: 'entity',
|
|
27
|
+
type: 'options',
|
|
28
|
+
options: [
|
|
29
|
+
{ name: 'Deal', value: 'deal' },
|
|
30
|
+
{ name: 'Lead', value: 'lead' },
|
|
31
|
+
],
|
|
32
|
+
default: 'lead',
|
|
33
|
+
description: 'Whether to list the custom fields of leads or of deals',
|
|
34
|
+
},
|
|
35
|
+
(0, common_1.returnAllProperty)(),
|
|
36
|
+
(0, common_1.limitProperty)(1000),
|
|
37
|
+
]),
|
|
38
|
+
];
|
|
39
|
+
async function getAll(itemIndex) {
|
|
40
|
+
var _a;
|
|
41
|
+
const entity = this.getNodeParameter('entity', itemIndex, 'lead');
|
|
42
|
+
const response = await transport_1.newarApiRequest.call(this, {
|
|
43
|
+
method: 'GET',
|
|
44
|
+
path: entity === 'deal' ? '/v1/deal-fields' : '/v1/lead-fields',
|
|
45
|
+
itemIndex,
|
|
46
|
+
});
|
|
47
|
+
return (0, common_1.applyLimit)(this, itemIndex, (_a = response.data) !== null && _a !== void 0 ? _a : []);
|
|
48
|
+
}
|
|
49
|
+
exports.handlers = { getAll };
|
|
50
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../nodes/Newar/actions/customField/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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;AACxF,CAAC;AAEY,QAAA,QAAQ,GAAqC,EAAE,MAAM,EAAE,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { IDataObject, IExecuteFunctions, INodeProperties } from 'n8n-workflow';
|
|
2
|
+
import { type CustomFieldMode } from '../helpers/customFields';
|
|
3
|
+
export declare function customFieldsParameterName(entity: 'lead' | 'deal', mode: CustomFieldMode): string;
|
|
4
|
+
export declare function customFieldsProperty(entity: 'lead' | 'deal', mode: CustomFieldMode): INodeProperties;
|
|
5
|
+
export declare function readCustomFields(ctx: IExecuteFunctions, entity: 'lead' | 'deal', mode: CustomFieldMode, itemIndex: number, timeZone: string): IDataObject | undefined;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.customFieldsParameterName = customFieldsParameterName;
|
|
4
|
+
exports.customFieldsProperty = customFieldsProperty;
|
|
5
|
+
exports.readCustomFields = readCustomFields;
|
|
6
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
7
|
+
const customFields_1 = require("../helpers/customFields");
|
|
8
|
+
function customFieldsParameterName(entity, mode) {
|
|
9
|
+
return mode === 'create' ? `${entity}CustomFields` : `${entity}CustomFieldsUpdate`;
|
|
10
|
+
}
|
|
11
|
+
function customFieldsProperty(entity, mode) {
|
|
12
|
+
return {
|
|
13
|
+
displayName: 'Custom Fields',
|
|
14
|
+
name: customFieldsParameterName(entity, mode),
|
|
15
|
+
type: 'resourceMapper',
|
|
16
|
+
noDataExpression: true,
|
|
17
|
+
default: { mappingMode: 'defineBelow', value: null },
|
|
18
|
+
description: `Values for the ${entity}'s custom fields, as defined in Newar under Settings > Fields`,
|
|
19
|
+
hint: mode === 'update'
|
|
20
|
+
? 'Only the fields you add are changed. A field you add and leave empty is cleared.'
|
|
21
|
+
: 'Empty fields are skipped. Select fields take one of their options, date fields only use the date.',
|
|
22
|
+
typeOptions: {
|
|
23
|
+
resourceMapper: {
|
|
24
|
+
resourceMapperMethod: entity === 'lead' ? 'getLeadCustomFields' : 'getDealCustomFields',
|
|
25
|
+
mode: 'add',
|
|
26
|
+
fieldWords: { singular: 'custom field', plural: 'custom fields' },
|
|
27
|
+
addAllFields: mode === 'create',
|
|
28
|
+
multiKeyMatch: false,
|
|
29
|
+
supportAutoMap: false,
|
|
30
|
+
noFieldsError: `This Newar workspace has no custom ${entity} fields`,
|
|
31
|
+
hideNoDataError: true,
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
function readCustomFields(ctx, entity, mode, itemIndex, timeZone) {
|
|
37
|
+
const mapper = ctx.getNodeParameter(customFieldsParameterName(entity, mode), itemIndex, {
|
|
38
|
+
mappingMode: 'defineBelow',
|
|
39
|
+
value: null,
|
|
40
|
+
});
|
|
41
|
+
if (!(mapper === null || mapper === void 0 ? void 0 : mapper.value))
|
|
42
|
+
return undefined;
|
|
43
|
+
const { values, problems } = (0, customFields_1.coerceCustomFieldValues)(mapper.value, mapper.schema, mode, timeZone);
|
|
44
|
+
if (problems.length > 0) {
|
|
45
|
+
const [first] = problems;
|
|
46
|
+
throw new n8n_workflow_1.NodeOperationError(ctx.getNode(), `Custom field '${first.key}' ${first.message}`, {
|
|
47
|
+
itemIndex,
|
|
48
|
+
description: problems.map((problem) => `'${problem.key}' ${problem.message}`).join('; '),
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
return Object.keys(values).length > 0 ? values : undefined;
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=customFields.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"customFields.js","sourceRoot":"","sources":["../../../../nodes/Newar/actions/customFields.ts"],"names":[],"mappings":";;AAWA,8DAEC;AAGD,oDA4BC;AAGD,4CAsBC;AA/DD,+CAAkD;AAElD,0DAAwF;AAGxF,SAAgB,yBAAyB,CAAC,MAAuB,EAAE,IAAqB;IACvF,OA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M,uBAAN,MAAM,CAAE,KAAK,CAAA;QAAE,OAAO,SAAS,CAAC;IAErC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,IAAA,sCAAuB,EAAC,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAC;IAClG,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACzB,MAAM,CAAC,KAAK,CAAC,GAAG,QAAQ,CAAC;QACzB,MAAM,IAAI,iCAAkB,CAAC,GAAG,CAAC,OAAO,EAAE,EAAE,iBAAiB,KAAK,CAAC,GAAG,KAAK,KAAK,CAAC,OAAO,EAAE,EAAE;YAC3F,SAAS;YACT,WAAW,EAAE,QAAQ,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,IAAI,OAAO,CAAC,GAAG,KAAK,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;SACxF,CAAC,CAAC;IACJ,CAAC;IACD,OAAO,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC;AAC5D,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,39 @@
|
|
|
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 common_1 = require("../common");
|
|
7
|
+
const customFields_1 = require("../customFields");
|
|
8
|
+
const fields_2 = require("./fields");
|
|
9
|
+
const properties = [
|
|
10
|
+
(0, common_1.recordLocator)({
|
|
11
|
+
displayName: 'Lead',
|
|
12
|
+
name: 'leadId',
|
|
13
|
+
searchListMethod: 'searchLeads',
|
|
14
|
+
noun: 'lead',
|
|
15
|
+
description: 'The lead (contact) the deal belongs to',
|
|
16
|
+
}),
|
|
17
|
+
{
|
|
18
|
+
displayName: 'Additional Fields',
|
|
19
|
+
name: 'additionalFields',
|
|
20
|
+
type: 'collection',
|
|
21
|
+
placeholder: 'Add Field',
|
|
22
|
+
default: {},
|
|
23
|
+
options: fields_2.dealCreateFields,
|
|
24
|
+
},
|
|
25
|
+
(0, customFields_1.customFieldsProperty)('deal', 'create'),
|
|
26
|
+
(0, common_1.idempotencyOptions)('deal'),
|
|
27
|
+
];
|
|
28
|
+
exports.description = (0, common_1.updateDisplayOptions)({ show: { resource: ['deal'], operation: ['create'] } }, properties);
|
|
29
|
+
async function execute(itemIndex, context) {
|
|
30
|
+
const body = {
|
|
31
|
+
lead_id: (0, common_1.getRecordId)(this, 'leadId', itemIndex, 'Lead'),
|
|
32
|
+
...(0, fields_1.buildBody)((0, common_1.getCollection)(this, 'additionalFields', itemIndex), fields_2.DEAL_BODY_FIELDS, 'create', context.timeZone),
|
|
33
|
+
};
|
|
34
|
+
const customFields = (0, customFields_1.readCustomFields)(this, 'deal', 'create', itemIndex, context.timeZone);
|
|
35
|
+
if (customFields)
|
|
36
|
+
body.custom_fields = customFields;
|
|
37
|
+
return await common_1.createRecord.call(this, itemIndex, context, '/v1/deals', body);
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=create.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create.js","sourceRoot":"","sources":["../../../../../nodes/Newar/actions/deal/create.ts"],"names":[],"mappings":";;;AAwCA,0BAiBC;AAvDD,iDAAiD;AACjD,sCAQmB;AACnB,kDAAyE;AACzE,qCAA8D;AAE9D,MAAM,UAAU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AC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
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: 'Deal',
|
|
9
|
+
name: 'dealId',
|
|
10
|
+
searchListMethod: 'searchDeals',
|
|
11
|
+
noun: 'deal',
|
|
12
|
+
description: 'The deal to delete',
|
|
13
|
+
}),
|
|
14
|
+
{
|
|
15
|
+
displayName: "A lead's primary deal can't be deleted on its own: delete the lead, or mark the deal as lost. Newar keeps deleted records, and its support can restore them.",
|
|
16
|
+
name: 'deleteNotice',
|
|
17
|
+
type: 'notice',
|
|
18
|
+
default: '',
|
|
19
|
+
},
|
|
20
|
+
];
|
|
21
|
+
exports.description = (0, common_1.updateDisplayOptions)({ show: { resource: ['deal'], operation: ['delete'] } }, properties);
|
|
22
|
+
async function execute(itemIndex) {
|
|
23
|
+
const id = (0, common_1.getRecordId)(this, 'dealId', itemIndex, 'Deal');
|
|
24
|
+
return await common_1.deleteRecord.call(this, itemIndex, `/v1/deals/${id}`);
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=delete.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delete.js","sourceRoot":"","sources":["../../../../../nodes/Newar/actions/deal/delete.ts"],"names":[],"mappings":";;;AA0BA,0BAGC;AA3BD,sCAA2F;AAE3F,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,oBAAoB;KACjC,CAAC;IACF;QACC,WAAW,EACV,8JAA8J;QAC/J,IAAI,EAAE,cAAc;QACpB,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE,EAAE;KACX;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,CAA0B,SAAiB;IACvE,MAAM,EAAE,GAAG,IAAA,oBAAW,EAAC,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC;IAC1D,OAAO,MAAM,qBAAY,CAAC,IAAI,CAAC,IAAI,EAAE,SAAS,EAAE,aAAa,EAAE,EAAE,CAAC,CAAC;AACpE,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { INodeProperties, INodePropertyOptions } from 'n8n-workflow';
|
|
2
|
+
import type { BodyField, QueryField } from '../../helpers/fields';
|
|
3
|
+
export declare const DEAL_BODY_FIELDS: BodyField[];
|
|
4
|
+
export declare const DEAL_FILTERS: QueryField[];
|
|
5
|
+
export declare const DEAL_STATUS_OPTIONS: INodePropertyOptions[];
|
|
6
|
+
export declare const dealCreateFields: INodeProperties[];
|
|
7
|
+
export declare const dealUpdateFields: INodeProperties[];
|