n8n-nodes-servicem8-jobcreation 1.0.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/README.md +517 -0
- package/dist/credentials/ServiceM8Api.credentials.d.ts +9 -0
- package/dist/credentials/ServiceM8Api.credentials.js +38 -0
- package/dist/credentials/ServiceM8Api.credentials.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -0
- package/dist/nodes/ServiceM8JobCreation/ServiceM8JobCreation.node.d.ts +18 -0
- package/dist/nodes/ServiceM8JobCreation/ServiceM8JobCreation.node.js +39 -0
- package/dist/nodes/ServiceM8JobCreation/ServiceM8JobCreation.node.js.map +1 -0
- package/dist/nodes/ServiceM8JobCreation/execute.d.ts +6 -0
- package/dist/nodes/ServiceM8JobCreation/execute.js +47 -0
- package/dist/nodes/ServiceM8JobCreation/execute.js.map +1 -0
- package/dist/nodes/ServiceM8JobCreation/helpers/addressUtils.d.ts +56 -0
- package/dist/nodes/ServiceM8JobCreation/helpers/addressUtils.js +124 -0
- package/dist/nodes/ServiceM8JobCreation/helpers/addressUtils.js.map +1 -0
- package/dist/nodes/ServiceM8JobCreation/helpers/api.d.ts +180 -0
- package/dist/nodes/ServiceM8JobCreation/helpers/api.js +418 -0
- package/dist/nodes/ServiceM8JobCreation/helpers/api.js.map +1 -0
- package/dist/nodes/ServiceM8JobCreation/helpers/clientMatcher.d.ts +67 -0
- package/dist/nodes/ServiceM8JobCreation/helpers/clientMatcher.js +216 -0
- package/dist/nodes/ServiceM8JobCreation/helpers/clientMatcher.js.map +1 -0
- package/dist/nodes/ServiceM8JobCreation/helpers/phoneUtils.d.ts +35 -0
- package/dist/nodes/ServiceM8JobCreation/helpers/phoneUtils.js +122 -0
- package/dist/nodes/ServiceM8JobCreation/helpers/phoneUtils.js.map +1 -0
- package/dist/nodes/ServiceM8JobCreation/methods/index.d.ts +13 -0
- package/dist/nodes/ServiceM8JobCreation/methods/index.js +17 -0
- package/dist/nodes/ServiceM8JobCreation/methods/index.js.map +1 -0
- package/dist/nodes/ServiceM8JobCreation/methods/loadOptions.d.ts +9 -0
- package/dist/nodes/ServiceM8JobCreation/methods/loadOptions.js +61 -0
- package/dist/nodes/ServiceM8JobCreation/methods/loadOptions.js.map +1 -0
- package/dist/nodes/ServiceM8JobCreation/operations/create/categoryAssign.d.ts +22 -0
- package/dist/nodes/ServiceM8JobCreation/operations/create/categoryAssign.js +61 -0
- package/dist/nodes/ServiceM8JobCreation/operations/create/categoryAssign.js.map +1 -0
- package/dist/nodes/ServiceM8JobCreation/operations/create/clientCreate.d.ts +36 -0
- package/dist/nodes/ServiceM8JobCreation/operations/create/clientCreate.js +66 -0
- package/dist/nodes/ServiceM8JobCreation/operations/create/clientCreate.js.map +1 -0
- package/dist/nodes/ServiceM8JobCreation/operations/create/clientLookup.d.ts +28 -0
- package/dist/nodes/ServiceM8JobCreation/operations/create/clientLookup.js +46 -0
- package/dist/nodes/ServiceM8JobCreation/operations/create/clientLookup.js.map +1 -0
- package/dist/nodes/ServiceM8JobCreation/operations/create/contactLookup.d.ts +18 -0
- package/dist/nodes/ServiceM8JobCreation/operations/create/contactLookup.js +48 -0
- package/dist/nodes/ServiceM8JobCreation/operations/create/contactLookup.js.map +1 -0
- package/dist/nodes/ServiceM8JobCreation/operations/create/index.d.ts +12 -0
- package/dist/nodes/ServiceM8JobCreation/operations/create/index.js +40 -0
- package/dist/nodes/ServiceM8JobCreation/operations/create/index.js.map +1 -0
- package/dist/nodes/ServiceM8JobCreation/operations/create/inputProcessor.d.ts +63 -0
- package/dist/nodes/ServiceM8JobCreation/operations/create/inputProcessor.js +176 -0
- package/dist/nodes/ServiceM8JobCreation/operations/create/inputProcessor.js.map +1 -0
- package/dist/nodes/ServiceM8JobCreation/operations/create/jobCreate.d.ts +43 -0
- package/dist/nodes/ServiceM8JobCreation/operations/create/jobCreate.js +82 -0
- package/dist/nodes/ServiceM8JobCreation/operations/create/jobCreate.js.map +1 -0
- package/dist/nodes/ServiceM8JobCreation/operations/create/notifications.d.ts +38 -0
- package/dist/nodes/ServiceM8JobCreation/operations/create/notifications.js +123 -0
- package/dist/nodes/ServiceM8JobCreation/operations/create/notifications.js.map +1 -0
- package/dist/nodes/ServiceM8JobCreation/operations/create/orchestrator.d.ts +12 -0
- package/dist/nodes/ServiceM8JobCreation/operations/create/orchestrator.js +192 -0
- package/dist/nodes/ServiceM8JobCreation/operations/create/orchestrator.js.map +1 -0
- package/dist/nodes/ServiceM8JobCreation/operations/create/queueAssign.d.ts +22 -0
- package/dist/nodes/ServiceM8JobCreation/operations/create/queueAssign.js +61 -0
- package/dist/nodes/ServiceM8JobCreation/operations/create/queueAssign.js.map +1 -0
- package/dist/nodes/ServiceM8JobCreation/operations/index.d.ts +8 -0
- package/dist/nodes/ServiceM8JobCreation/operations/index.js +35 -0
- package/dist/nodes/ServiceM8JobCreation/operations/index.js.map +1 -0
- package/dist/nodes/ServiceM8JobCreation/operations/shared/attachmentsUpload.d.ts +41 -0
- package/dist/nodes/ServiceM8JobCreation/operations/shared/attachmentsUpload.js +243 -0
- package/dist/nodes/ServiceM8JobCreation/operations/shared/attachmentsUpload.js.map +1 -0
- package/dist/nodes/ServiceM8JobCreation/operations/shared/badgesAssign.d.ts +21 -0
- package/dist/nodes/ServiceM8JobCreation/operations/shared/badgesAssign.js +65 -0
- package/dist/nodes/ServiceM8JobCreation/operations/shared/badgesAssign.js.map +1 -0
- package/dist/nodes/ServiceM8JobCreation/operations/shared/index.d.ts +7 -0
- package/dist/nodes/ServiceM8JobCreation/operations/shared/index.js +15 -0
- package/dist/nodes/ServiceM8JobCreation/operations/shared/index.js.map +1 -0
- package/dist/nodes/ServiceM8JobCreation/operations/shared/notesCreate.d.ts +42 -0
- package/dist/nodes/ServiceM8JobCreation/operations/shared/notesCreate.js +103 -0
- package/dist/nodes/ServiceM8JobCreation/operations/shared/notesCreate.js.map +1 -0
- package/dist/nodes/ServiceM8JobCreation/operations/update/index.d.ts +5 -0
- package/dist/nodes/ServiceM8JobCreation/operations/update/index.js +9 -0
- package/dist/nodes/ServiceM8JobCreation/operations/update/index.js.map +1 -0
- package/dist/nodes/ServiceM8JobCreation/operations/update/jobUpdate.d.ts +10 -0
- package/dist/nodes/ServiceM8JobCreation/operations/update/jobUpdate.js +239 -0
- package/dist/nodes/ServiceM8JobCreation/operations/update/jobUpdate.js.map +1 -0
- package/dist/nodes/ServiceM8JobCreation/properties/create/address.d.ts +5 -0
- package/dist/nodes/ServiceM8JobCreation/properties/create/address.js +145 -0
- package/dist/nodes/ServiceM8JobCreation/properties/create/address.js.map +1 -0
- package/dist/nodes/ServiceM8JobCreation/properties/create/business.d.ts +5 -0
- package/dist/nodes/ServiceM8JobCreation/properties/create/business.js +22 -0
- package/dist/nodes/ServiceM8JobCreation/properties/create/business.js.map +1 -0
- package/dist/nodes/ServiceM8JobCreation/properties/create/contact.d.ts +5 -0
- package/dist/nodes/ServiceM8JobCreation/properties/create/contact.js +85 -0
- package/dist/nodes/ServiceM8JobCreation/properties/create/contact.js.map +1 -0
- package/dist/nodes/ServiceM8JobCreation/properties/create/index.d.ts +10 -0
- package/dist/nodes/ServiceM8JobCreation/properties/create/index.js +30 -0
- package/dist/nodes/ServiceM8JobCreation/properties/create/index.js.map +1 -0
- package/dist/nodes/ServiceM8JobCreation/properties/create/job.d.ts +5 -0
- package/dist/nodes/ServiceM8JobCreation/properties/create/job.js +43 -0
- package/dist/nodes/ServiceM8JobCreation/properties/create/job.js.map +1 -0
- package/dist/nodes/ServiceM8JobCreation/properties/create/options/additionalOptions.d.ts +5 -0
- package/dist/nodes/ServiceM8JobCreation/properties/create/options/additionalOptions.js +49 -0
- package/dist/nodes/ServiceM8JobCreation/properties/create/options/additionalOptions.js.map +1 -0
- package/dist/nodes/ServiceM8JobCreation/properties/create/options/attachments.d.ts +5 -0
- package/dist/nodes/ServiceM8JobCreation/properties/create/options/attachments.js +151 -0
- package/dist/nodes/ServiceM8JobCreation/properties/create/options/attachments.js.map +1 -0
- package/dist/nodes/ServiceM8JobCreation/properties/create/options/badges.d.ts +5 -0
- package/dist/nodes/ServiceM8JobCreation/properties/create/options/badges.js +65 -0
- package/dist/nodes/ServiceM8JobCreation/properties/create/options/badges.js.map +1 -0
- package/dist/nodes/ServiceM8JobCreation/properties/create/options/category.d.ts +5 -0
- package/dist/nodes/ServiceM8JobCreation/properties/create/options/category.js +65 -0
- package/dist/nodes/ServiceM8JobCreation/properties/create/options/category.js.map +1 -0
- package/dist/nodes/ServiceM8JobCreation/properties/create/options/index.d.ts +12 -0
- package/dist/nodes/ServiceM8JobCreation/properties/create/options/index.js +38 -0
- package/dist/nodes/ServiceM8JobCreation/properties/create/options/index.js.map +1 -0
- package/dist/nodes/ServiceM8JobCreation/properties/create/options/notes.d.ts +5 -0
- package/dist/nodes/ServiceM8JobCreation/properties/create/options/notes.js +49 -0
- package/dist/nodes/ServiceM8JobCreation/properties/create/options/notes.js.map +1 -0
- package/dist/nodes/ServiceM8JobCreation/properties/create/options/notifications.d.ts +5 -0
- package/dist/nodes/ServiceM8JobCreation/properties/create/options/notifications.js +197 -0
- package/dist/nodes/ServiceM8JobCreation/properties/create/options/notifications.js.map +1 -0
- package/dist/nodes/ServiceM8JobCreation/properties/create/options/queue.d.ts +5 -0
- package/dist/nodes/ServiceM8JobCreation/properties/create/options/queue.js +65 -0
- package/dist/nodes/ServiceM8JobCreation/properties/create/options/queue.js.map +1 -0
- package/dist/nodes/ServiceM8JobCreation/properties/index.d.ts +9 -0
- package/dist/nodes/ServiceM8JobCreation/properties/index.js +23 -0
- package/dist/nodes/ServiceM8JobCreation/properties/index.js.map +1 -0
- package/dist/nodes/ServiceM8JobCreation/properties/operation.d.ts +5 -0
- package/dist/nodes/ServiceM8JobCreation/properties/operation.js +28 -0
- package/dist/nodes/ServiceM8JobCreation/properties/operation.js.map +1 -0
- package/dist/nodes/ServiceM8JobCreation/properties/update/fields.d.ts +5 -0
- package/dist/nodes/ServiceM8JobCreation/properties/update/fields.js +74 -0
- package/dist/nodes/ServiceM8JobCreation/properties/update/fields.js.map +1 -0
- package/dist/nodes/ServiceM8JobCreation/properties/update/index.d.ts +8 -0
- package/dist/nodes/ServiceM8JobCreation/properties/update/index.js +22 -0
- package/dist/nodes/ServiceM8JobCreation/properties/update/index.js.map +1 -0
- package/dist/nodes/ServiceM8JobCreation/properties/update/jobSelection.d.ts +5 -0
- package/dist/nodes/ServiceM8JobCreation/properties/update/jobSelection.js +63 -0
- package/dist/nodes/ServiceM8JobCreation/properties/update/jobSelection.js.map +1 -0
- package/dist/nodes/ServiceM8JobCreation/properties/update/options.d.ts +5 -0
- package/dist/nodes/ServiceM8JobCreation/properties/update/options.js +142 -0
- package/dist/nodes/ServiceM8JobCreation/properties/update/options.js.map +1 -0
- package/dist/nodes/ServiceM8JobCreation/servicem8.svg +75 -0
- package/dist/nodes/ServiceM8JobCreation/types/api.d.ts +59 -0
- package/dist/nodes/ServiceM8JobCreation/types/api.js +34 -0
- package/dist/nodes/ServiceM8JobCreation/types/api.js.map +1 -0
- package/dist/nodes/ServiceM8JobCreation/types/index.d.ts +7 -0
- package/dist/nodes/ServiceM8JobCreation/types/index.js +21 -0
- package/dist/nodes/ServiceM8JobCreation/types/index.js.map +1 -0
- package/dist/nodes/ServiceM8JobCreation/types/input.d.ts +119 -0
- package/dist/nodes/ServiceM8JobCreation/types/input.js +6 -0
- package/dist/nodes/ServiceM8JobCreation/types/input.js.map +1 -0
- package/dist/nodes/ServiceM8JobCreation/types/result.d.ts +79 -0
- package/dist/nodes/ServiceM8JobCreation/types/result.js +96 -0
- package/dist/nodes/ServiceM8JobCreation/types/result.js.map +1 -0
- package/package.json +66 -0
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Client Matching Logic
|
|
4
|
+
* Implements fuzzy name + address matching for client deduplication
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.determineAction = exports.findBestMatchingClient = exports.buildBothNameFormats = exports.buildClientName = exports.matchClientName = void 0;
|
|
8
|
+
const addressUtils_1 = require("./addressUtils");
|
|
9
|
+
/**
|
|
10
|
+
* Compare two names and return match quality
|
|
11
|
+
* - 'exact': normalized strings are equal
|
|
12
|
+
* - 'partial': one contains the other, or starts with the other
|
|
13
|
+
* - 'none': no match
|
|
14
|
+
*/
|
|
15
|
+
function matchClientName(searchName, clientName) {
|
|
16
|
+
const s = (0, addressUtils_1.normalizeForMatching)(searchName);
|
|
17
|
+
const c = (0, addressUtils_1.normalizeForMatching)(clientName);
|
|
18
|
+
if (!s || !c)
|
|
19
|
+
return 'none';
|
|
20
|
+
// Exact match
|
|
21
|
+
if (s === c)
|
|
22
|
+
return 'exact';
|
|
23
|
+
// Partial match: one contains the other
|
|
24
|
+
if (c.includes(s) || s.includes(c))
|
|
25
|
+
return 'partial';
|
|
26
|
+
// Partial match: one starts with the other
|
|
27
|
+
if (c.startsWith(s) || s.startsWith(c))
|
|
28
|
+
return 'partial';
|
|
29
|
+
return 'none';
|
|
30
|
+
}
|
|
31
|
+
exports.matchClientName = matchClientName;
|
|
32
|
+
/**
|
|
33
|
+
* Build a client name from first/last names or business name
|
|
34
|
+
* For individuals: format depends on nameFormat parameter
|
|
35
|
+
* - 'firstLast': "John Smith"
|
|
36
|
+
* - 'lastFirst': "Smith, John" (ServiceM8 default)
|
|
37
|
+
* For businesses: businessName
|
|
38
|
+
*/
|
|
39
|
+
function buildClientName(firstName, lastName, businessName, email, nameFormat = 'firstLast') {
|
|
40
|
+
const trimmedBusiness = (businessName || '').trim();
|
|
41
|
+
const trimmedFirst = (firstName || '').trim();
|
|
42
|
+
const trimmedLast = (lastName || '').trim();
|
|
43
|
+
const trimmedEmail = (email || '').trim().toLowerCase();
|
|
44
|
+
if (trimmedBusiness) {
|
|
45
|
+
return { name: trimmedBusiness, isBusiness: true };
|
|
46
|
+
}
|
|
47
|
+
// Individual: format based on nameFormat setting
|
|
48
|
+
if (trimmedLast && trimmedFirst) {
|
|
49
|
+
const name = nameFormat === 'lastFirst'
|
|
50
|
+
? `${trimmedLast}, ${trimmedFirst}`
|
|
51
|
+
: `${trimmedFirst} ${trimmedLast}`;
|
|
52
|
+
return { name, isBusiness: false };
|
|
53
|
+
}
|
|
54
|
+
// Only first name provided
|
|
55
|
+
if (trimmedFirst) {
|
|
56
|
+
return { name: trimmedFirst, isBusiness: false };
|
|
57
|
+
}
|
|
58
|
+
// Only last name provided
|
|
59
|
+
if (trimmedLast) {
|
|
60
|
+
return { name: trimmedLast, isBusiness: false };
|
|
61
|
+
}
|
|
62
|
+
// Fallback to email
|
|
63
|
+
const name = trimmedEmail || 'Unknown';
|
|
64
|
+
return { name, isBusiness: false };
|
|
65
|
+
}
|
|
66
|
+
exports.buildClientName = buildClientName;
|
|
67
|
+
/**
|
|
68
|
+
* Build both possible name formats for matching purposes
|
|
69
|
+
* Returns both "First Last" and "Last, First" versions
|
|
70
|
+
*/
|
|
71
|
+
function buildBothNameFormats(firstName, lastName) {
|
|
72
|
+
const trimmedFirst = (firstName || '').trim();
|
|
73
|
+
const trimmedLast = (lastName || '').trim();
|
|
74
|
+
if (trimmedFirst && trimmedLast) {
|
|
75
|
+
return {
|
|
76
|
+
firstLast: `${trimmedFirst} ${trimmedLast}`,
|
|
77
|
+
lastFirst: `${trimmedLast}, ${trimmedFirst}`,
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
// Only one name available
|
|
81
|
+
const single = trimmedFirst || trimmedLast || '';
|
|
82
|
+
return {
|
|
83
|
+
firstLast: single,
|
|
84
|
+
lastFirst: single,
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
exports.buildBothNameFormats = buildBothNameFormats;
|
|
88
|
+
/**
|
|
89
|
+
* Find the best matching client from a list
|
|
90
|
+
* Implements the decision matrix:
|
|
91
|
+
*
|
|
92
|
+
* For BUSINESSES:
|
|
93
|
+
* - Exact name → use existing
|
|
94
|
+
* - Partial name + exact/near address → use existing (same business, name variant)
|
|
95
|
+
* - Partial name + no address match → create new
|
|
96
|
+
*
|
|
97
|
+
* For INDIVIDUALS:
|
|
98
|
+
* - Exact name + exact address → use existing
|
|
99
|
+
* - Exact name + different address → create new (different person, same name)
|
|
100
|
+
* - Partial name + exact/near address → use existing
|
|
101
|
+
*/
|
|
102
|
+
function findBestMatchingClient(searchName, searchAddress, clients, isBusiness) {
|
|
103
|
+
let matchedClient = null;
|
|
104
|
+
let matchType = { name: 'none', address: 'none' };
|
|
105
|
+
let matchReason = '';
|
|
106
|
+
for (const client of clients) {
|
|
107
|
+
const nameMatch = matchClientName(searchName, client.name);
|
|
108
|
+
const addressMatch = (0, addressUtils_1.matchAddresses)(searchAddress, client);
|
|
109
|
+
if (nameMatch === 'exact') {
|
|
110
|
+
// EXACT name match
|
|
111
|
+
if (isBusiness) {
|
|
112
|
+
// Business: exact name always matches
|
|
113
|
+
matchedClient = client;
|
|
114
|
+
matchType = { name: 'exact', address: addressMatch };
|
|
115
|
+
matchReason = `Exact name match: "${client.name}"`;
|
|
116
|
+
break; // No need to check further
|
|
117
|
+
}
|
|
118
|
+
else {
|
|
119
|
+
// Individual: exact name + exact address = match
|
|
120
|
+
if (addressMatch === 'exact') {
|
|
121
|
+
matchedClient = client;
|
|
122
|
+
matchType = { name: 'exact', address: 'exact' };
|
|
123
|
+
matchReason = `Exact name match: "${client.name}" with exact address`;
|
|
124
|
+
break;
|
|
125
|
+
}
|
|
126
|
+
else {
|
|
127
|
+
// Same name but different address = different person
|
|
128
|
+
// Don't match, continue looking for a better match
|
|
129
|
+
// But record this as a potential issue
|
|
130
|
+
if (!matchedClient) {
|
|
131
|
+
matchReason = `Exact name match "${client.name}" but different address - different person`;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
else if (nameMatch === 'partial') {
|
|
137
|
+
// PARTIAL name match - need address to confirm
|
|
138
|
+
if (addressMatch === 'exact' || addressMatch === 'near') {
|
|
139
|
+
// Partial name + similar address = same client
|
|
140
|
+
if (!matchedClient || matchType.name !== 'exact') {
|
|
141
|
+
matchedClient = client;
|
|
142
|
+
matchType = { name: 'partial', address: addressMatch };
|
|
143
|
+
matchReason = `Partial name "${client.name}" + ${addressMatch} address match`;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
// Partial name + different address = different client (don't match)
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
if (!matchedClient) {
|
|
150
|
+
matchReason = matchReason || 'No matching client found';
|
|
151
|
+
}
|
|
152
|
+
return {
|
|
153
|
+
client: matchedClient,
|
|
154
|
+
matchType,
|
|
155
|
+
reason: matchReason,
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
exports.findBestMatchingClient = findBestMatchingClient;
|
|
159
|
+
function determineAction(input) {
|
|
160
|
+
const { contactExists, existingContactClientUuid, matchedClient, matchType, matchReason, isBusiness, kind, } = input;
|
|
161
|
+
let clientUuid = null;
|
|
162
|
+
let needsClient = true;
|
|
163
|
+
let needsContact = true;
|
|
164
|
+
if (matchedClient) {
|
|
165
|
+
// We found a matching client
|
|
166
|
+
clientUuid = matchedClient.uuid;
|
|
167
|
+
if (isBusiness) {
|
|
168
|
+
// BUSINESS rules: use existing if we have a match
|
|
169
|
+
needsClient = false;
|
|
170
|
+
}
|
|
171
|
+
else {
|
|
172
|
+
// INDIVIDUAL rules
|
|
173
|
+
if (matchType.name === 'exact' && matchType.address === 'exact') {
|
|
174
|
+
needsClient = false;
|
|
175
|
+
}
|
|
176
|
+
else if (matchType.name === 'exact') {
|
|
177
|
+
// Same name but different address = different person
|
|
178
|
+
needsClient = true;
|
|
179
|
+
clientUuid = null;
|
|
180
|
+
}
|
|
181
|
+
else {
|
|
182
|
+
// Partial match
|
|
183
|
+
needsClient = false;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
// Determine if we need to create a contact
|
|
188
|
+
if (contactExists && existingContactClientUuid === clientUuid && clientUuid !== null) {
|
|
189
|
+
// Contact already exists on our target client
|
|
190
|
+
needsContact = false;
|
|
191
|
+
}
|
|
192
|
+
// Build the action and reason
|
|
193
|
+
let action;
|
|
194
|
+
let reason;
|
|
195
|
+
if (needsClient) {
|
|
196
|
+
action = 'create_client_and_contact';
|
|
197
|
+
reason = `${kind}: ${matchReason}; creating new client and contact`;
|
|
198
|
+
}
|
|
199
|
+
else if (needsContact) {
|
|
200
|
+
action = 'create_contact_and_job';
|
|
201
|
+
reason = `${kind}: ${matchReason}; creating contact on existing client`;
|
|
202
|
+
}
|
|
203
|
+
else {
|
|
204
|
+
action = 'create_job_only';
|
|
205
|
+
reason = `${kind}: ${matchReason}; contact already exists on this client`;
|
|
206
|
+
}
|
|
207
|
+
return {
|
|
208
|
+
action,
|
|
209
|
+
reason,
|
|
210
|
+
needsClient,
|
|
211
|
+
needsContact,
|
|
212
|
+
clientUuid,
|
|
213
|
+
};
|
|
214
|
+
}
|
|
215
|
+
exports.determineAction = determineAction;
|
|
216
|
+
//# sourceMappingURL=clientMatcher.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clientMatcher.js","sourceRoot":"","sources":["../../../../nodes/ServiceM8JobCreation/helpers/clientMatcher.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AASH,iDAAsE;AAEtE;;;;;GAKG;AACH,SAAgB,eAAe,CAC9B,UAAkB,EAClB,UAAkB;IAElB,MAAM,CAAC,GAAG,IAAA,mCAAoB,EAAC,UAAU,CAAC,CAAC;IAC3C,MAAM,CAAC,GAAG,IAAA,mCAAoB,EAAC,UAAU,CAAC,CAAC;IAE3C,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC;QAAE,OAAO,MAAM,CAAC;IAE5B,cAAc;IACd,IAAI,CAAC,KAAK,CAAC;QAAE,OAAO,OAAO,CAAC;IAE5B,wCAAwC;IACxC,IAAI,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CA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K,WAAW,uCAAuC,CAAC;KACxE;SAAM;QACN,MAAM,GAAG,iBAAiB,CAAC;QAC3B,MAAM,GAAG,GAAG,IAAI,KAAK,WAAW,yCAAyC,CAAC;KAC1E;IAED,OAAO;QACN,MAAM;QACN,MAAM;QACN,WAAW;QACX,YAAY;QACZ,UAAU;KACV,CAAC;AACH,CAAC;AAjED,0CAiEC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Australian Phone Number Normalization Utilities
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Normalize an Australian mobile phone number to 04xx format
|
|
6
|
+
* Handles formats: 04xx, +614xx, 614xx, 4xx
|
|
7
|
+
* Returns null if not a valid mobile format
|
|
8
|
+
*/
|
|
9
|
+
export declare function normalizeAustralianMobile(phone: string | undefined | null): string | null;
|
|
10
|
+
/**
|
|
11
|
+
* Normalize an Australian landline phone number
|
|
12
|
+
* Handles formats: 0x xxxx xxxx, +61x xxxx xxxx, 8 digit local
|
|
13
|
+
* Returns null if not a valid landline format
|
|
14
|
+
*/
|
|
15
|
+
export declare function normalizeAustralianLandline(phone: string | undefined | null): string | null;
|
|
16
|
+
/**
|
|
17
|
+
* Smart phone derivation - determines mobile and landline from two input fields
|
|
18
|
+
* Prioritizes the correct field but will detect if values are swapped
|
|
19
|
+
*/
|
|
20
|
+
export declare function derivePhones(inputPhone: string | undefined | null, inputMobile: string | undefined | null): {
|
|
21
|
+
mobile: string | null;
|
|
22
|
+
phone: string | null;
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Format a phone number for display (with spaces)
|
|
26
|
+
*/
|
|
27
|
+
export declare function formatPhoneForDisplay(phone: string | null): string;
|
|
28
|
+
/**
|
|
29
|
+
* Check if a string looks like an Australian mobile number
|
|
30
|
+
*/
|
|
31
|
+
export declare function looksLikeMobile(phone: string | undefined | null): boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Check if a string looks like an Australian landline number
|
|
34
|
+
*/
|
|
35
|
+
export declare function looksLikeLandline(phone: string | undefined | null): boolean;
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Australian Phone Number Normalization Utilities
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.looksLikeLandline = exports.looksLikeMobile = exports.formatPhoneForDisplay = exports.derivePhones = exports.normalizeAustralianLandline = exports.normalizeAustralianMobile = void 0;
|
|
7
|
+
/**
|
|
8
|
+
* Remove all non-digit characters from a string
|
|
9
|
+
*/
|
|
10
|
+
function onlyDigits(str) {
|
|
11
|
+
return (str || '').replace(/\D+/g, '');
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Normalize an Australian mobile phone number to 04xx format
|
|
15
|
+
* Handles formats: 04xx, +614xx, 614xx, 4xx
|
|
16
|
+
* Returns null if not a valid mobile format
|
|
17
|
+
*/
|
|
18
|
+
function normalizeAustralianMobile(phone) {
|
|
19
|
+
if (!phone)
|
|
20
|
+
return null;
|
|
21
|
+
const digits = onlyDigits(phone);
|
|
22
|
+
// Already in 04xx format (10 digits starting with 04)
|
|
23
|
+
if (/^04\d{8}$/.test(digits)) {
|
|
24
|
+
return digits;
|
|
25
|
+
}
|
|
26
|
+
// International format: +614xx or 614xx (11-12 digits)
|
|
27
|
+
if (/^(?:61)?4\d{8}$/.test(digits)) {
|
|
28
|
+
return '0' + digits.slice(-9);
|
|
29
|
+
}
|
|
30
|
+
// Just the 9 digits without leading 0 (4xx xxx xxx)
|
|
31
|
+
if (/^4\d{8}$/.test(digits)) {
|
|
32
|
+
return '0' + digits;
|
|
33
|
+
}
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
exports.normalizeAustralianMobile = normalizeAustralianMobile;
|
|
37
|
+
/**
|
|
38
|
+
* Normalize an Australian landline phone number
|
|
39
|
+
* Handles formats: 0x xxxx xxxx, +61x xxxx xxxx, 8 digit local
|
|
40
|
+
* Returns null if not a valid landline format
|
|
41
|
+
*/
|
|
42
|
+
function normalizeAustralianLandline(phone) {
|
|
43
|
+
if (!phone)
|
|
44
|
+
return null;
|
|
45
|
+
const digits = onlyDigits(phone);
|
|
46
|
+
// Full Australian landline: 0[2378] followed by 8 digits
|
|
47
|
+
if (/^0[2378]\d{8}$/.test(digits)) {
|
|
48
|
+
return digits;
|
|
49
|
+
}
|
|
50
|
+
// International format: 61[2378] followed by 8 digits
|
|
51
|
+
if (/^61[2378]\d{8}$/.test(digits)) {
|
|
52
|
+
return '0' + digits.slice(2);
|
|
53
|
+
}
|
|
54
|
+
// Local 8-digit number (no area code)
|
|
55
|
+
if (/^\d{8}$/.test(digits)) {
|
|
56
|
+
return digits;
|
|
57
|
+
}
|
|
58
|
+
return null;
|
|
59
|
+
}
|
|
60
|
+
exports.normalizeAustralianLandline = normalizeAustralianLandline;
|
|
61
|
+
/**
|
|
62
|
+
* Smart phone derivation - determines mobile and landline from two input fields
|
|
63
|
+
* Prioritizes the correct field but will detect if values are swapped
|
|
64
|
+
*/
|
|
65
|
+
function derivePhones(inputPhone, inputMobile) {
|
|
66
|
+
// First try to normalize each from its expected field
|
|
67
|
+
let mobile = normalizeAustralianMobile(inputMobile);
|
|
68
|
+
let phone = normalizeAustralianLandline(inputPhone);
|
|
69
|
+
// If mobile field is empty but phone field contains a mobile number
|
|
70
|
+
if (!mobile) {
|
|
71
|
+
mobile = normalizeAustralianMobile(inputPhone);
|
|
72
|
+
}
|
|
73
|
+
// If phone field is empty but mobile field contains a landline
|
|
74
|
+
// Only do this if we didn't already get a mobile from it
|
|
75
|
+
if (!phone && !mobile) {
|
|
76
|
+
phone = normalizeAustralianLandline(inputMobile);
|
|
77
|
+
}
|
|
78
|
+
return { mobile, phone };
|
|
79
|
+
}
|
|
80
|
+
exports.derivePhones = derivePhones;
|
|
81
|
+
/**
|
|
82
|
+
* Format a phone number for display (with spaces)
|
|
83
|
+
*/
|
|
84
|
+
function formatPhoneForDisplay(phone) {
|
|
85
|
+
if (!phone)
|
|
86
|
+
return '';
|
|
87
|
+
// Mobile: 04xx xxx xxx
|
|
88
|
+
if (/^04\d{8}$/.test(phone)) {
|
|
89
|
+
return `${phone.slice(0, 4)} ${phone.slice(4, 7)} ${phone.slice(7)}`;
|
|
90
|
+
}
|
|
91
|
+
// Landline: 0x xxxx xxxx
|
|
92
|
+
if (/^0[2378]\d{8}$/.test(phone)) {
|
|
93
|
+
return `${phone.slice(0, 2)} ${phone.slice(2, 6)} ${phone.slice(6)}`;
|
|
94
|
+
}
|
|
95
|
+
// 8-digit local: xxxx xxxx
|
|
96
|
+
if (/^\d{8}$/.test(phone)) {
|
|
97
|
+
return `${phone.slice(0, 4)} ${phone.slice(4)}`;
|
|
98
|
+
}
|
|
99
|
+
return phone;
|
|
100
|
+
}
|
|
101
|
+
exports.formatPhoneForDisplay = formatPhoneForDisplay;
|
|
102
|
+
/**
|
|
103
|
+
* Check if a string looks like an Australian mobile number
|
|
104
|
+
*/
|
|
105
|
+
function looksLikeMobile(phone) {
|
|
106
|
+
if (!phone)
|
|
107
|
+
return false;
|
|
108
|
+
const digits = onlyDigits(phone);
|
|
109
|
+
return /^(?:0?4|61\s*4|\+61\s*4)/.test(phone) || /^(?:04|614|4)\d{8}$/.test(digits);
|
|
110
|
+
}
|
|
111
|
+
exports.looksLikeMobile = looksLikeMobile;
|
|
112
|
+
/**
|
|
113
|
+
* Check if a string looks like an Australian landline number
|
|
114
|
+
*/
|
|
115
|
+
function looksLikeLandline(phone) {
|
|
116
|
+
if (!phone)
|
|
117
|
+
return false;
|
|
118
|
+
const digits = onlyDigits(phone);
|
|
119
|
+
return /^(?:0[2378]|61[2378])\d{8}$/.test(digits) || /^\d{8}$/.test(digits);
|
|
120
|
+
}
|
|
121
|
+
exports.looksLikeLandline = looksLikeLandline;
|
|
122
|
+
//# sourceMappingURL=phoneUtils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"phoneUtils.js","s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IAAI,CAAC,KAAK,CAAC,EAAE;QAC1B,OAAO,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;KAChD;IAED,OAAO,KAAK,CAAC;AACd,CAAC;AAnBD,sDAmBC;AAED;;GAEG;AACH,SAAgB,eAAe,CAAC,KAAgC;IAC/D,IAAI,CAAC,KAAK;QAAE,OAAO,KAAK,CAAC;IACzB,MAAM,MAAM,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC;IACjC,OAAO,0BAA0B,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,qBAAqB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AACrF,CAAC;AAJD,0CAIC;AAED;;GAEG;AACH,SAAgB,iBAAiB,CAAC,KAAgC;IACjE,IAAI,CAAC,KAAK;QAAE,OAAO,KAAK,CAAC;IACzB,MAAM,MAAM,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC;IACjC,OAAO,6BAA6B,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AAC7E,CAAC;AAJD,8CAIC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Methods Index
|
|
3
|
+
* Exports all node methods (loadOptions, etc.)
|
|
4
|
+
*/
|
|
5
|
+
import { getCategories, getBadges, getQueues, getJobs } from './loadOptions';
|
|
6
|
+
export declare const methods: {
|
|
7
|
+
loadOptions: {
|
|
8
|
+
getCategories: typeof getCategories;
|
|
9
|
+
getBadges: typeof getBadges;
|
|
10
|
+
getQueues: typeof getQueues;
|
|
11
|
+
getJobs: typeof getJobs;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Methods Index
|
|
4
|
+
* Exports all node methods (loadOptions, etc.)
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.methods = void 0;
|
|
8
|
+
const loadOptions_1 = require("./loadOptions");
|
|
9
|
+
exports.methods = {
|
|
10
|
+
loadOptions: {
|
|
11
|
+
getCategories: loadOptions_1.getCategories,
|
|
12
|
+
getBadges: loadOptions_1.getBadges,
|
|
13
|
+
getQueues: loadOptions_1.getQueues,
|
|
14
|
+
getJobs: loadOptions_1.getJobs,
|
|
15
|
+
},
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../nodes/ServiceM8JobCreation/methods/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+CAA6E;AAEhE,QAAA,OAAO,GAAG;IACtB,WAAW,EAAE;QACZ,aAAa,EAAb,2BAAa;QACb,SAAS,EAAT,uBAAS;QACT,SAAS,EAAT,uBAAS;QACT,OAAO,EAAP,qBAAO;KACP;CACD,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Load Options Methods
|
|
3
|
+
* Dynamic dropdown data fetching for the node
|
|
4
|
+
*/
|
|
5
|
+
import type { ILoadOptionsFunctions, INodePropertyOptions } from 'n8n-workflow';
|
|
6
|
+
export declare function getCategories(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;
|
|
7
|
+
export declare function getBadges(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;
|
|
8
|
+
export declare function getQueues(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;
|
|
9
|
+
export declare function getJobs(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]>;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Load Options Methods
|
|
4
|
+
* Dynamic dropdown data fetching for the node
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.getJobs = exports.getQueues = exports.getBadges = exports.getCategories = void 0;
|
|
8
|
+
const api_1 = require("../helpers/api");
|
|
9
|
+
async function getCategories() {
|
|
10
|
+
const response = await (0, api_1.serviceM8Request)(this, {
|
|
11
|
+
method: 'GET',
|
|
12
|
+
endpoint: '/api_1.0/category.json',
|
|
13
|
+
query: { $filter: 'active eq 1' },
|
|
14
|
+
});
|
|
15
|
+
const categories = (0, api_1.parseArrayResponse)(response);
|
|
16
|
+
return categories.map((cat) => ({
|
|
17
|
+
name: cat.name,
|
|
18
|
+
value: cat.uuid,
|
|
19
|
+
}));
|
|
20
|
+
}
|
|
21
|
+
exports.getCategories = getCategories;
|
|
22
|
+
async function getBadges() {
|
|
23
|
+
const response = await (0, api_1.serviceM8Request)(this, {
|
|
24
|
+
method: 'GET',
|
|
25
|
+
endpoint: '/api_1.0/badge.json',
|
|
26
|
+
query: { $filter: 'active eq 1' },
|
|
27
|
+
});
|
|
28
|
+
const badges = (0, api_1.parseArrayResponse)(response);
|
|
29
|
+
return badges.map((badge) => ({
|
|
30
|
+
name: badge.name,
|
|
31
|
+
value: badge.uuid,
|
|
32
|
+
}));
|
|
33
|
+
}
|
|
34
|
+
exports.getBadges = getBadges;
|
|
35
|
+
async function getQueues() {
|
|
36
|
+
const response = await (0, api_1.serviceM8Request)(this, {
|
|
37
|
+
method: 'GET',
|
|
38
|
+
endpoint: '/api_1.0/queue.json',
|
|
39
|
+
query: { $filter: 'active eq 1' },
|
|
40
|
+
});
|
|
41
|
+
const queues = (0, api_1.parseArrayResponse)(response);
|
|
42
|
+
return queues.map((queue) => ({
|
|
43
|
+
name: queue.name,
|
|
44
|
+
value: queue.uuid,
|
|
45
|
+
}));
|
|
46
|
+
}
|
|
47
|
+
exports.getQueues = getQueues;
|
|
48
|
+
async function getJobs() {
|
|
49
|
+
const response = await (0, api_1.serviceM8Request)(this, {
|
|
50
|
+
method: 'GET',
|
|
51
|
+
endpoint: '/api_1.0/job.json',
|
|
52
|
+
query: { $filter: 'active eq 1', $orderby: 'edit_date desc' },
|
|
53
|
+
});
|
|
54
|
+
const jobs = (0, api_1.parseArrayResponse)(response);
|
|
55
|
+
return jobs.map((job) => ({
|
|
56
|
+
name: `${job.generated_job_id} - ${job.status}${job.job_description ? ` - ${job.job_description.substring(0, 50)}` : ''}`,
|
|
57
|
+
value: job.uuid,
|
|
58
|
+
}));
|
|
59
|
+
}
|
|
60
|
+
exports.getJobs = getJobs;
|
|
61
|
+
//# sourceMappingURL=loadOptions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loadOptions.js","sourceRoot":"","sources":["../../../../nodes/ServiceM8JobCreation/methods/loadOptions.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AASH,wCAAsE;AAE/D,KAAK,UAAU,aAAa;IAGlC,MAAM,QAAQ,GAAG,MAAM,IAAA,sBAAgB,EAAC,IAAI,EAAE;QAC7C,MAAM,EAAE,KAAK;QACb,QAAQ,EAAE,wBAAwB;QAClC,KAAK,EAAE,EAAE,OAAO,EAAE,aAAa,EAAE;KACjC,CAAC,CAAC;IAEH,MAAM,UAAU,GAAG,IAAA,wBAAkB,EAAoB,QAAQ,CAAC,CAAC;IACnE,OAAO,UAAU,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;QAC/B,IAAI,EAAE,GAAG,CAAC,IAAI;QACd,KAAK,EAAE,GAAG,CAAC,IAAI;KACf,CAAC,CAAC,CAAC;AACL,CAAC;AAdD,sCAcC;AAEM,KAAK,UAAU,SAAS;IAG9B,MAAM,QAAQ,GAAG,MAAM,IAAA,sBAAgB,EAAC,IAAI,EAAE;QAC7C,MAAM,EAAE,KAAK;QACb,QAAQ,EAAE,qBAAqB;QAC/B,KAAK,EAAE,EAAE,OAAO,EAAE,aAAa,EAAE;KACjC,CAAC,CAAC;IAEH,MAAM,MAAM,GAAG,IAAA,wBAAkB,EAAiB,QA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AE,CAAC,CAAC,CAAC,EAAE,EAAE;QACzH,KAAK,EAAE,GAAG,CAAC,IAAI;KACf,CAAC,CAAC,CAAC;AACL,CAAC;AAdD,0BAcC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Category Assignment Operations
|
|
3
|
+
* Assign category to job (static or dynamic)
|
|
4
|
+
*/
|
|
5
|
+
import type { IExecuteFunctions } from 'n8n-workflow';
|
|
6
|
+
export interface CategoryAssignInput {
|
|
7
|
+
jobUuid: string;
|
|
8
|
+
enableCategory: boolean;
|
|
9
|
+
categoryDynamic: boolean;
|
|
10
|
+
categoryUuidInput: string;
|
|
11
|
+
categoryNameInput: string;
|
|
12
|
+
}
|
|
13
|
+
export interface CategoryAssignResult {
|
|
14
|
+
categoryAssigned: boolean;
|
|
15
|
+
categoryName?: string;
|
|
16
|
+
categoryMissing?: string;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Assign a category to a job
|
|
20
|
+
* Handles both static (UUID from dropdown) and dynamic (name lookup) modes
|
|
21
|
+
*/
|
|
22
|
+
export declare function assignCategory(context: IExecuteFunctions, input: CategoryAssignInput): Promise<CategoryAssignResult>;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Category Assignment Operations
|
|
4
|
+
* Assign category to job (static or dynamic)
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.assignCategory = void 0;
|
|
8
|
+
const api_1 = require("../../helpers/api");
|
|
9
|
+
/**
|
|
10
|
+
* Assign a category to a job
|
|
11
|
+
* Handles both static (UUID from dropdown) and dynamic (name lookup) modes
|
|
12
|
+
*/
|
|
13
|
+
async function assignCategory(context, input) {
|
|
14
|
+
var _a;
|
|
15
|
+
if (!input.enableCategory) {
|
|
16
|
+
return { categoryAssigned: false };
|
|
17
|
+
}
|
|
18
|
+
let categoryUuid = input.categoryUuidInput;
|
|
19
|
+
let categoryName;
|
|
20
|
+
let categoryMissing;
|
|
21
|
+
// Handle dynamic category name lookup
|
|
22
|
+
if (input.categoryDynamic && input.categoryNameInput) {
|
|
23
|
+
const categoriesResponse = await (0, api_1.serviceM8Request)(context, {
|
|
24
|
+
method: 'GET',
|
|
25
|
+
endpoint: '/api_1.0/category.json',
|
|
26
|
+
query: { $filter: 'active eq 1' },
|
|
27
|
+
});
|
|
28
|
+
const allCategories = (0, api_1.parseArrayResponse)(categoriesResponse);
|
|
29
|
+
const foundCategory = (0, api_1.findCategoryByName)(allCategories, input.categoryNameInput);
|
|
30
|
+
if (foundCategory) {
|
|
31
|
+
categoryUuid = foundCategory.uuid;
|
|
32
|
+
categoryName = foundCategory.name;
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
categoryMissing = input.categoryNameInput;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
if (categoryUuid) {
|
|
39
|
+
await (0, api_1.updateJob)(context, input.jobUuid, { category_uuid: categoryUuid });
|
|
40
|
+
// Get category name for output if not already set
|
|
41
|
+
if (!categoryName) {
|
|
42
|
+
const categoriesResponse = await (0, api_1.serviceM8Request)(context, {
|
|
43
|
+
method: 'GET',
|
|
44
|
+
endpoint: '/api_1.0/category.json',
|
|
45
|
+
query: { $filter: `uuid eq '${categoryUuid}'` },
|
|
46
|
+
});
|
|
47
|
+
const categories = (0, api_1.parseArrayResponse)(categoriesResponse);
|
|
48
|
+
categoryName = (_a = categories[0]) === null || _a === void 0 ? void 0 : _a.name;
|
|
49
|
+
}
|
|
50
|
+
return {
|
|
51
|
+
categoryAssigned: true,
|
|
52
|
+
categoryName,
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
return {
|
|
56
|
+
categoryAssigned: false,
|
|
57
|
+
categoryMissing,
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
exports.assignCategory = assignCategory;
|
|
61
|
+
//# sourceMappingURL=categoryAssign.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"categoryAssign.js","sourceRoot":"","sources":["../../../../../nodes/ServiceM8JobCreation/operations/create/categoryAssign.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAIH,2CAK2B;AAgB3B;;;GAGG;AACI,KAAK,UAAU,cAAc,CACnC,OAA0B,EAC1B,KAA0B;;IAE1B,IAAI,CAAC,KAAK,CAAC,cAAc,EAAE;QAC1B,OAAO,EAAE,gBAAgB,EAAE,KAAK,EAAE,CAAC;KACnC;IAED,IAAI,YAAY,GAAG,KAAK,CAAC,iBAAiB,CAAC;IAC3C,IAAI,YAAgC,CAAC;IACrC,IAAI,eAAmC,CAAC;IAExC,sCAAsC;IACtC,IAAI,KAAK,CAAC,eAAe,IAAI,KAAK,CAAC,iBAAiB,EAAE;QACrD,MAAM,kBAAkB,GAAG,MAAM,IAAA,sBAAgB,EAAC,OAAO,EAAE;YAC1D,MAAM,EAAE,KAAK;YACb,QAAQ,EAAE,wBAAwB;YAClC,KAAK,EAAE,EAAE,OAAO,EAAE,aAAa,EAAE;SACjC,CAAC,CAAC;QACH,MAAM,aAAa,GAAG,IAAA,wBAAkB,EAAoB,kBAAkB,CAAC,CAAC;QAChF,MAAM,aAAa,GAAG,IAAA,wBAAkB,EAAC,aAAa,EAAE,KAAK,CAAC,iBAAiB,CAAC,CAAC;QAEjF,IAAI,aAAa,EAAE;YAClB,YAAY,GAAG,aAAa,CAAC,IAAI,CAAC;YAClC,YAAY,GAAG,aAAa,CAAC,IAAI,CAAC;SAClC;aAAM;YACN,eAAe,GAAG,KAAK,CAAC,iBAAiB,CAAC;SAC1C;KACD;IAED,IAAI,YAAY,EAAE;QACjB,MAAM,IAAA,eAAS,EAAC,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE,EAAE,aAAa,EAAE,YAAY,EAAE,CAAC,CAAC;QAEzE,kDAAkD;QAClD,IAAI,CAAC,YAAY,EAAE;YAClB,MAAM,kBAAkB,GAAG,MAAM,IAAA,sBAAgB,EAAC,OAAO,EAAE;gBAC1D,MAAM,EAAE,KAAK;gBACb,QAAQ,EAAE,wBAAwB;gBAClC,KAAK,EAAE,EAAE,OAAO,EAAE,YAAY,YAAY,GAAG,EAAE;aAC/C,CAAC,CAAC;YACH,MAAM,UAAU,GAAG,IAAA,wBAAkB,EAAoB,kBAAkB,CAAC,CAAC;YAC7E,YAAY,GAAG,MAAA,UAAU,CAAC,CAAC,CAAC,0CAAE,IAAI,CAAC;SACnC;QAED,OAAO;YACN,gBAAgB,EAAE,IAAI;YACtB,YAAY;SACZ,CAAC;KACF;IAED,OAAO;QACN,gBAAgB,EAAE,KAAK;QACvB,eAAe;KACf,CAAC;AACH,CAAC;AAtDD,wCAsDC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Client Creation Operations
|
|
3
|
+
* Create client and company contact
|
|
4
|
+
*/
|
|
5
|
+
import type { IExecuteFunctions } from 'n8n-workflow';
|
|
6
|
+
import type { AddressParts } from '../../types';
|
|
7
|
+
export interface ClientCreateInput {
|
|
8
|
+
clientName: string;
|
|
9
|
+
isIndividual: number;
|
|
10
|
+
clientAddress: string;
|
|
11
|
+
clientAddressParts: AddressParts;
|
|
12
|
+
}
|
|
13
|
+
export interface ContactCreateInput {
|
|
14
|
+
companyUuid: string;
|
|
15
|
+
firstName: string;
|
|
16
|
+
lastName: string;
|
|
17
|
+
email?: string;
|
|
18
|
+
phone?: string | null;
|
|
19
|
+
mobile?: string | null;
|
|
20
|
+
}
|
|
21
|
+
export interface ClientCreateResult {
|
|
22
|
+
clientUuid: string;
|
|
23
|
+
clientCreated: boolean;
|
|
24
|
+
}
|
|
25
|
+
export interface ContactCreateResult {
|
|
26
|
+
contactUuid?: string;
|
|
27
|
+
contactCreated: boolean;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Create a new client if needed
|
|
31
|
+
*/
|
|
32
|
+
export declare function createClientIfNeeded(context: IExecuteFunctions, needsClient: boolean, existingClientUuid: string | null, input: ClientCreateInput): Promise<ClientCreateResult>;
|
|
33
|
+
/**
|
|
34
|
+
* Create a company contact if needed
|
|
35
|
+
*/
|
|
36
|
+
export declare function createCompanyContactIfNeeded(context: IExecuteFunctions, needsContact: boolean, clientUuid: string, contactLookupField: 'email' | 'mobile' | 'phone' | null, input: ContactCreateInput): Promise<ContactCreateResult>;
|