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,82 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Job Creation Operations
|
|
4
|
+
* Create job and job contact, clean up empty contacts
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.createJobWithContact = exports.cleanupEmptyJobContacts = exports.createNewJobContact = exports.createNewJob = void 0;
|
|
8
|
+
const api_1 = require("../../helpers/api");
|
|
9
|
+
/**
|
|
10
|
+
* Create a new job
|
|
11
|
+
*/
|
|
12
|
+
async function createNewJob(context, input) {
|
|
13
|
+
const jobResult = await (0, api_1.createJob)(context, {
|
|
14
|
+
company_uuid: input.clientUuid,
|
|
15
|
+
status: input.jobStatus,
|
|
16
|
+
job_address: input.jobAddress,
|
|
17
|
+
billing_address: input.clientAddress,
|
|
18
|
+
job_description: input.jobDetails,
|
|
19
|
+
});
|
|
20
|
+
return {
|
|
21
|
+
jobUuid: jobResult.uuid,
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
exports.createNewJob = createNewJob;
|
|
25
|
+
/**
|
|
26
|
+
* Create a job contact
|
|
27
|
+
*/
|
|
28
|
+
async function createNewJobContact(context, input) {
|
|
29
|
+
const contactUuid = await (0, api_1.createJobContact)(context, {
|
|
30
|
+
job_uuid: input.jobUuid,
|
|
31
|
+
first: input.firstName,
|
|
32
|
+
last: input.lastName,
|
|
33
|
+
email: input.email || undefined,
|
|
34
|
+
phone: input.phone || undefined,
|
|
35
|
+
mobile: input.mobile || undefined,
|
|
36
|
+
is_primary_contact: true,
|
|
37
|
+
});
|
|
38
|
+
return contactUuid;
|
|
39
|
+
}
|
|
40
|
+
exports.createNewJobContact = createNewJobContact;
|
|
41
|
+
/**
|
|
42
|
+
* Clean up empty auto-created job contacts
|
|
43
|
+
* ServiceM8 sometimes auto-creates empty contacts when creating a job
|
|
44
|
+
*/
|
|
45
|
+
async function cleanupEmptyJobContacts(context, jobUuid) {
|
|
46
|
+
const jobContactsResponse = await (0, api_1.serviceM8Request)(context, {
|
|
47
|
+
method: 'GET',
|
|
48
|
+
endpoint: '/api_1.0/jobcontact.json',
|
|
49
|
+
query: { $filter: `job_uuid eq '${jobUuid}'` },
|
|
50
|
+
});
|
|
51
|
+
const jobContacts = (0, api_1.parseArrayResponse)(jobContactsResponse);
|
|
52
|
+
let deletedCount = 0;
|
|
53
|
+
for (const contact of jobContacts) {
|
|
54
|
+
// Delete contacts that have no useful data
|
|
55
|
+
if (!contact.email && !contact.phone && !contact.mobile && !contact.first && !contact.last) {
|
|
56
|
+
await (0, api_1.deleteJobContact)(context, contact.uuid);
|
|
57
|
+
deletedCount++;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
return deletedCount;
|
|
61
|
+
}
|
|
62
|
+
exports.cleanupEmptyJobContacts = cleanupEmptyJobContacts;
|
|
63
|
+
/**
|
|
64
|
+
* Create a complete job with contact and cleanup
|
|
65
|
+
*/
|
|
66
|
+
async function createJobWithContact(context, jobInput, contactInput) {
|
|
67
|
+
// Create the job
|
|
68
|
+
const { jobUuid } = await createNewJob(context, jobInput);
|
|
69
|
+
// Create the job contact
|
|
70
|
+
const jobContactUuid = await createNewJobContact(context, {
|
|
71
|
+
...contactInput,
|
|
72
|
+
jobUuid,
|
|
73
|
+
});
|
|
74
|
+
// Clean up any empty auto-created contacts
|
|
75
|
+
await cleanupEmptyJobContacts(context, jobUuid);
|
|
76
|
+
return {
|
|
77
|
+
jobUuid,
|
|
78
|
+
jobContactUuid,
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
exports.createJobWithContact = createJobWithContact;
|
|
82
|
+
//# sourceMappingURL=jobCreate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jobCreate.js","sourceRoot":"","sources":["../../../../../nodes/ServiceM8JobCreation/operations/create/jobCreate.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAIH,2CAM2B;AAuB3B;;GAEG;AACI,KAAK,UAAU,YAAY,CACjC,OAA0B,EAC1B,KAAqB;IAErB,MAAM,SAAS,GAAG,MAAM,IAAA,eAAS,EAAC,OAAO,EAAE;QAC1C,YAAY,EAAE,KAAK,CAAC,UAAU;QAC9B,MAAM,EAAE,KAAK,CAAC,SAAS;QACvB,WAAW,E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AI,CAAC,OAAO,CAAC,IAAI,EAAE;YAC3F,MAAM,IAAA,sBAAgB,EAAC,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;YAC9C,YAAY,EAAE,CAAC;SACf;KACD;IAED,OAAO,YAAY,CAAC;AACrB,CAAC;AAtBD,0DAsBC;AAED;;GAEG;AACI,KAAK,UAAU,oBAAoB,CACzC,OAA0B,EAC1B,QAAwB,EACxB,YAA8C;IAE9C,iBAAiB;IACjB,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM,YAAY,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;IAE1D,yBAAyB;IACzB,MAAM,cAAc,GAAG,MAAM,mBAAmB,CAAC,OAAO,EAAE;QACzD,GAAG,YAAY;QACf,OAAO;KACP,CAAC,CAAC;IAEH,2CAA2C;IAC3C,MAAM,uBAAuB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IAEhD,OAAO;QACN,OAAO;QACP,cAAc;KACd,CAAC;AACH,CAAC;AArBD,oDAqBC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Notification Operations
|
|
3
|
+
* Send email/SMS notifications with support for HTML/text format and attachments
|
|
4
|
+
*/
|
|
5
|
+
import type { IExecuteFunctions } from 'n8n-workflow';
|
|
6
|
+
export type NotificationType = 'email' | 'sms';
|
|
7
|
+
export type EmailFormat = 'html' | 'text';
|
|
8
|
+
export interface NotificationRecipient {
|
|
9
|
+
notificationType: NotificationType;
|
|
10
|
+
email?: string;
|
|
11
|
+
phone?: string;
|
|
12
|
+
name?: string;
|
|
13
|
+
emailFormat?: EmailFormat;
|
|
14
|
+
subject?: string;
|
|
15
|
+
htmlMessage?: string;
|
|
16
|
+
textMessage?: string;
|
|
17
|
+
smsMessage?: string;
|
|
18
|
+
includeAttachments?: boolean;
|
|
19
|
+
}
|
|
20
|
+
export interface NotificationsInput {
|
|
21
|
+
jobUuid: string;
|
|
22
|
+
enableNotifications: boolean;
|
|
23
|
+
notificationRecipientsInput: {
|
|
24
|
+
recipient?: NotificationRecipient[];
|
|
25
|
+
};
|
|
26
|
+
clientName: string;
|
|
27
|
+
jobAddress: string;
|
|
28
|
+
jobDetails: string;
|
|
29
|
+
attachmentUuids?: string[];
|
|
30
|
+
}
|
|
31
|
+
export interface NotificationsResult {
|
|
32
|
+
emailsSent: number;
|
|
33
|
+
smsSent: number;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Send notifications for a new job
|
|
37
|
+
*/
|
|
38
|
+
export declare function sendNotifications(context: IExecuteFunctions, input: NotificationsInput): Promise<NotificationsResult>;
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Notification Operations
|
|
4
|
+
* Send email/SMS notifications with support for HTML/text format and attachments
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.sendNotifications = void 0;
|
|
8
|
+
const api_1 = require("../../helpers/api");
|
|
9
|
+
/**
|
|
10
|
+
* Replace placeholders in message templates
|
|
11
|
+
*/
|
|
12
|
+
function replacePlaceholders(template, values) {
|
|
13
|
+
return template
|
|
14
|
+
.replace(/\{\{name\}\}/g, values.name)
|
|
15
|
+
.replace(/\{\{jobNumber\}\}/g, values.jobNumber)
|
|
16
|
+
.replace(/\{\{clientName\}\}/g, values.clientName)
|
|
17
|
+
.replace(/\{\{jobAddress\}\}/g, values.jobAddress)
|
|
18
|
+
.replace(/\{\{jobDetails\}\}/g, values.jobDetails);
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Send email notification
|
|
22
|
+
*/
|
|
23
|
+
async function sendEmailNotification(context, recipient, jobUuid, jobNumber, clientName, jobAddress, jobDetails, attachmentUuids) {
|
|
24
|
+
const recipientEmail = recipient.email;
|
|
25
|
+
if (!recipientEmail) {
|
|
26
|
+
return false;
|
|
27
|
+
}
|
|
28
|
+
const recipientName = recipient.name || recipientEmail.split('@')[0] || 'there';
|
|
29
|
+
const emailFormat = recipient.emailFormat || 'html';
|
|
30
|
+
const placeholderValues = {
|
|
31
|
+
name: recipientName,
|
|
32
|
+
jobNumber,
|
|
33
|
+
clientName,
|
|
34
|
+
jobAddress,
|
|
35
|
+
jobDetails,
|
|
36
|
+
};
|
|
37
|
+
// Build subject (always use the field value, with default if empty)
|
|
38
|
+
const subjectTemplate = recipient.subject || '[SM8 NEW JOB] #{{jobNumber}} - {{clientName}}';
|
|
39
|
+
const subject = replacePlaceholders(subjectTemplate, placeholderValues);
|
|
40
|
+
// Build body
|
|
41
|
+
let htmlBody;
|
|
42
|
+
let textBody;
|
|
43
|
+
if (emailFormat === 'html') {
|
|
44
|
+
const htmlTemplate = recipient.htmlMessage || '<p>Hi {{name}},</p><p>A new job has been created.</p><ul><li><strong>Customer:</strong> {{clientName}}</li><li><strong>Job Address:</strong> {{jobAddress}}</li><li><strong>Job #:</strong> #{{jobNumber}}</li><li><strong>Description:</strong> {{jobDetails}}</li></ul><p>Thanks</p>';
|
|
45
|
+
htmlBody = replacePlaceholders(htmlTemplate, placeholderValues);
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
const textTemplate = recipient.textMessage || 'Hi {{name}},\n\nA new job has been created.\n\nCustomer: {{clientName}}\nJob Address: {{jobAddress}}\nJob #: #{{jobNumber}}\nDescription: {{jobDetails}}\n\nThanks';
|
|
49
|
+
textBody = replacePlaceholders(textTemplate, placeholderValues);
|
|
50
|
+
}
|
|
51
|
+
// Include attachments if enabled and available
|
|
52
|
+
const emailAttachments = recipient.includeAttachments ? attachmentUuids : [];
|
|
53
|
+
// Send email
|
|
54
|
+
await (0, api_1.sendEmail)(context, {
|
|
55
|
+
to: recipientEmail,
|
|
56
|
+
subject,
|
|
57
|
+
htmlBody,
|
|
58
|
+
textBody,
|
|
59
|
+
jobUuid,
|
|
60
|
+
attachmentUuids: emailAttachments.length > 0 ? emailAttachments : undefined,
|
|
61
|
+
});
|
|
62
|
+
return true;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Send SMS notification
|
|
66
|
+
*/
|
|
67
|
+
async function sendSmsNotification(context, recipient, jobUuid, jobNumber, clientName, jobAddress, jobDetails) {
|
|
68
|
+
const recipientPhone = recipient.phone;
|
|
69
|
+
if (!recipientPhone) {
|
|
70
|
+
return false;
|
|
71
|
+
}
|
|
72
|
+
const recipientName = recipient.name || 'there';
|
|
73
|
+
const placeholderValues = {
|
|
74
|
+
name: recipientName,
|
|
75
|
+
jobNumber,
|
|
76
|
+
clientName,
|
|
77
|
+
jobAddress,
|
|
78
|
+
jobDetails,
|
|
79
|
+
};
|
|
80
|
+
// Build message (always use the field value, with default if empty)
|
|
81
|
+
const messageTemplate = recipient.smsMessage || '[NEW JOB] #{{jobNumber}} - {{clientName}}. Check ServiceM8 for details.';
|
|
82
|
+
const message = replacePlaceholders(messageTemplate, placeholderValues);
|
|
83
|
+
await (0, api_1.sendSms)(context, recipientPhone, message, jobUuid);
|
|
84
|
+
return true;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Send notifications for a new job
|
|
88
|
+
*/
|
|
89
|
+
async function sendNotifications(context, input) {
|
|
90
|
+
if (!input.enableNotifications) {
|
|
91
|
+
return { emailsSent: 0, smsSent: 0 };
|
|
92
|
+
}
|
|
93
|
+
const recipients = input.notificationRecipientsInput.recipient || [];
|
|
94
|
+
let emailsSent = 0;
|
|
95
|
+
let smsSent = 0;
|
|
96
|
+
if (recipients.length === 0) {
|
|
97
|
+
return { emailsSent, smsSent };
|
|
98
|
+
}
|
|
99
|
+
// Get job details for notification
|
|
100
|
+
const jobData = await (0, api_1.getJob)(context, input.jobUuid);
|
|
101
|
+
const jobNumber = jobData.generated_job_id || '';
|
|
102
|
+
for (const recipient of recipients) {
|
|
103
|
+
const notificationType = recipient.notificationType || 'email';
|
|
104
|
+
if (notificationType === 'email') {
|
|
105
|
+
const sent = await sendEmailNotification(context, recipient, input.jobUuid, jobNumber, input.clientName, input.jobAddress, input.jobDetails, input.attachmentUuids || []);
|
|
106
|
+
if (sent) {
|
|
107
|
+
emailsSent++;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
else if (notificationType === 'sms') {
|
|
111
|
+
const sent = await sendSmsNotification(context, recipient, input.jobUuid, jobNumber, input.clientName, input.jobAddress, input.jobDetails);
|
|
112
|
+
if (sent) {
|
|
113
|
+
smsSent++;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
return {
|
|
118
|
+
emailsSent,
|
|
119
|
+
smsSent,
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
exports.sendNotifications = sendNotifications;
|
|
123
|
+
//# sourceMappingURL=notifications.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notifications.js","sourceRoot":"","sources":["../../../../../nodes/ServiceM8JobCreation/operations/create/notifications.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,2CAA+D;AAmC/D;;GAEG;AACH,SAAS,mBAAmB,CAC3B,QAAgB,EAChB,MAMC;IAED,OAAO,QAAQ;SACb,OAAO,CAAC,eAAe,EAAE,MAAM,CAAC,IAAI,CAAC;SACrC,OAAO,CAAC,oBAAoB,EAAE,MAAM,CAAC,SAAS,CAAC;SAC/C,OAAO,CAAC,qBAAqB,EAAE,MAAM,CAAC,UAAU,CAAC;SACjD,OAAO,CAAC,qBAAqB,EAAE,MAAM,CAAC,UAAU,CAAC;SACjD,OAAO,CAAC,qBAAqB,EAAE,MAAM,CAAC,UAAU,CAAC,CAAC;AACrD,CAAC;AAGD;;GAEG;AACH,KAAK,UAAU,qBAAqB,CACnC,OAA0B,EAC1B,SAAgC,EAChC,OAAe,EACf,SAAiB,EACjB,UAAkB,EAClB,UAAkB,EAClB,UAAkB,EAClB,eAAyB;IAEzB,MAAM,cAAc,GAAG,SAAS,CAAC,KAAK,CAAC;IACvC,IAAI,CAAC,cAAc,EAAE;QACpB,OAAO,KAAK,CA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gBAA2B,IAAI,EAAE,CAAC;IAE7D,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE;QACnC,MAAM,gBAAgB,GAAG,SAAS,CAAC,gBAAgB,IAAI,OAAO,CAAC;QAE/D,IAAI,gBAAgB,KAAK,OAAO,EAAE;YACjC,MAAM,IAAI,GAAG,MAAM,qBAAqB,CACvC,OAAO,EACP,SAAS,EACT,KAAK,CAAC,OAAO,EACb,SAAS,EACT,KAAK,CAAC,UAAU,EAChB,KAAK,CAAC,UAAU,EAChB,KAAK,CAAC,UAAU,EAChB,KAAK,CAAC,eAAe,IAAI,EAAE,CAC3B,CAAC;YACF,IAAI,IAAI,EAAE;gBACT,UAAU,EAAE,CAAC;aACb;SACD;aAAM,IAAI,gBAAgB,KAAK,KAAK,EAAE;YACtC,MAAM,IAAI,GAAG,MAAM,mBAAmB,CACrC,OAAO,EACP,SAAS,EACT,KAAK,CAAC,OAAO,EACb,SAAS,EACT,KAAK,CAAC,UAAU,EAChB,KAAK,CAAC,UAAU,EAChB,KAAK,CAAC,UAAU,CAChB,CAAC;YACF,IAAI,IAAI,EAAE;gBACT,OAAO,EAAE,CAAC;aACV;SACD;KACD;IAED,OAAO;QACN,UAAU;QACV,OAAO;KACP,CAAC;AACH,CAAC;AAzDD,8CAyDC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Job Creation Orchestrator
|
|
3
|
+
* Coordinates all operations for creating a ServiceM8 job
|
|
4
|
+
* This is the main execution flow extracted from the node execute method
|
|
5
|
+
*/
|
|
6
|
+
import type { IExecuteFunctions } from 'n8n-workflow';
|
|
7
|
+
import type { ExecutionResult } from '../../types';
|
|
8
|
+
/**
|
|
9
|
+
* Execute job creation for a single item
|
|
10
|
+
* This orchestrates all the operations in sequence
|
|
11
|
+
*/
|
|
12
|
+
export declare function executeJobCreation(context: IExecuteFunctions, itemIndex: number): Promise<ExecutionResult>;
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Job Creation Orchestrator
|
|
4
|
+
* Coordinates all operations for creating a ServiceM8 job
|
|
5
|
+
* This is the main execution flow extracted from the node execute method
|
|
6
|
+
*/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.executeJobCreation = void 0;
|
|
9
|
+
const types_1 = require("../../types");
|
|
10
|
+
const api_1 = require("../../helpers/api");
|
|
11
|
+
const inputProcessor_1 = require("./inputProcessor");
|
|
12
|
+
const contactLookup_1 = require("./contactLookup");
|
|
13
|
+
const clientLookup_1 = require("./clientLookup");
|
|
14
|
+
const clientCreate_1 = require("./clientCreate");
|
|
15
|
+
const jobCreate_1 = require("./jobCreate");
|
|
16
|
+
const categoryAssign_1 = require("./categoryAssign");
|
|
17
|
+
const queueAssign_1 = require("./queueAssign");
|
|
18
|
+
const notifications_1 = require("./notifications");
|
|
19
|
+
const badgesAssign_1 = require("../shared/badgesAssign");
|
|
20
|
+
const attachmentsUpload_1 = require("../shared/attachmentsUpload");
|
|
21
|
+
const notesCreate_1 = require("../shared/notesCreate");
|
|
22
|
+
/**
|
|
23
|
+
* Execute job creation for a single item
|
|
24
|
+
* This orchestrates all the operations in sequence
|
|
25
|
+
*/
|
|
26
|
+
async function executeJobCreation(context, itemIndex) {
|
|
27
|
+
var _a, _b, _c, _d, _e, _f;
|
|
28
|
+
const startTime = Date.now();
|
|
29
|
+
// 1. Process input parameters
|
|
30
|
+
const input = (0, inputProcessor_1.processInput)(context, itemIndex);
|
|
31
|
+
// 2. Look up existing contact
|
|
32
|
+
const { existingContact } = await (0, contactLookup_1.lookupContact)(context, input.contactLookupFilter, input.contactLookupField);
|
|
33
|
+
// 3. Look up clients and determine action
|
|
34
|
+
const allClients = await (0, clientLookup_1.lookupClients)(context, input.isIndividual);
|
|
35
|
+
const actionResult = (0, clientLookup_1.findMatchingClientAndDetermineAction)(input.clientName, input.clientAddressParts, allClients, input.isBusiness, input.kind, existingContact);
|
|
36
|
+
// 4. Create client if needed
|
|
37
|
+
const clientResult = await (0, clientCreate_1.createClientIfNeeded)(context, actionResult.needsClient, actionResult.clientUuid, {
|
|
38
|
+
clientName: input.clientName,
|
|
39
|
+
isIndividual: input.isIndividual,
|
|
40
|
+
clientAddress: input.clientAddress,
|
|
41
|
+
clientAddressParts: input.clientAddressParts,
|
|
42
|
+
});
|
|
43
|
+
if (!clientResult.clientUuid) {
|
|
44
|
+
throw new Error('Failed to determine or create client UUID');
|
|
45
|
+
}
|
|
46
|
+
// 5. Create company contact if needed
|
|
47
|
+
const contactResult = await (0, clientCreate_1.createCompanyContactIfNeeded)(context, actionResult.needsContact, clientResult.clientUuid, input.contactLookupField, {
|
|
48
|
+
companyUuid: clientResult.clientUuid,
|
|
49
|
+
firstName: input.firstName,
|
|
50
|
+
lastName: input.lastName,
|
|
51
|
+
email: input.email || undefined,
|
|
52
|
+
phone: input.phone,
|
|
53
|
+
mobile: input.mobile,
|
|
54
|
+
});
|
|
55
|
+
// 6. Create job with contact
|
|
56
|
+
const { jobUuid, jobContactUuid } = await (0, jobCreate_1.createJobWithContact)(context, {
|
|
57
|
+
clientUuid: clientResult.clientUuid,
|
|
58
|
+
jobStatus: input.jobStatus,
|
|
59
|
+
jobAddress: input.jobAddress,
|
|
60
|
+
clientAddress: input.clientAddress,
|
|
61
|
+
jobDetails: input.jobDetails,
|
|
62
|
+
}, {
|
|
63
|
+
firstName: input.firstName,
|
|
64
|
+
lastName: input.lastName,
|
|
65
|
+
email: input.email || undefined,
|
|
66
|
+
phone: input.phone,
|
|
67
|
+
mobile: input.mobile,
|
|
68
|
+
});
|
|
69
|
+
// 6b. Fetch job to get generated job number
|
|
70
|
+
const jobData = await (0, api_1.getJob)(context, jobUuid);
|
|
71
|
+
const jobNumber = jobData.generated_job_id || '';
|
|
72
|
+
// 7. Assign category
|
|
73
|
+
const categoryResult = await (0, categoryAssign_1.assignCategory)(context, {
|
|
74
|
+
jobUuid,
|
|
75
|
+
enableCategory: input.enableCategory,
|
|
76
|
+
categoryDynamic: input.categoryDynamic,
|
|
77
|
+
categoryUuidInput: input.categoryUuidInput,
|
|
78
|
+
categoryNameInput: input.categoryNameInput,
|
|
79
|
+
});
|
|
80
|
+
// 8. Assign badges
|
|
81
|
+
const badgesResult = await (0, badgesAssign_1.assignBadges)(context, {
|
|
82
|
+
jobUuid,
|
|
83
|
+
enableBadges: input.enableBadges,
|
|
84
|
+
badgesDynamic: input.badgesDynamic,
|
|
85
|
+
badgeUuidsInput: input.badgeUuidsInput,
|
|
86
|
+
badgeNamesInput: input.badgeNamesInput,
|
|
87
|
+
});
|
|
88
|
+
// 9. Assign queue
|
|
89
|
+
const queueResult = await (0, queueAssign_1.assignQueue)(context, {
|
|
90
|
+
jobUuid,
|
|
91
|
+
enableQueue: input.enableQueue,
|
|
92
|
+
queueDynamic: input.queueDynamic,
|
|
93
|
+
queueUuidInput: input.queueUuidInput,
|
|
94
|
+
queueNameInput: input.queueNameInput,
|
|
95
|
+
});
|
|
96
|
+
// 10. Upload attachments (before notifications so UUIDs can be included in emails)
|
|
97
|
+
const attachmentsResult = await (0, attachmentsUpload_1.uploadAttachments)(context, itemIndex, jobUuid, {
|
|
98
|
+
enableAttachments: input.enableAttachments,
|
|
99
|
+
attachmentMode: input.attachmentMode,
|
|
100
|
+
attachmentUrlList: input.attachmentUrlList,
|
|
101
|
+
attachmentsInput: input.attachmentsInput,
|
|
102
|
+
});
|
|
103
|
+
// 11. Send notifications (with attachment UUIDs for email inclusion)
|
|
104
|
+
const notificationsResult = await (0, notifications_1.sendNotifications)(context, {
|
|
105
|
+
jobUuid,
|
|
106
|
+
enableNotifications: input.enableNotifications,
|
|
107
|
+
notificationRecipientsInput: input.notificationRecipientsInput,
|
|
108
|
+
clientName: input.clientName,
|
|
109
|
+
jobAddress: input.jobAddress,
|
|
110
|
+
jobDetails: input.jobDetails,
|
|
111
|
+
attachmentUuids: attachmentsResult.attachmentUuids,
|
|
112
|
+
});
|
|
113
|
+
// 12. Create notes
|
|
114
|
+
const notesResult = await (0, notesCreate_1.createNotes)(context, jobUuid, {
|
|
115
|
+
jobUuid,
|
|
116
|
+
clientCreated: clientResult.clientCreated,
|
|
117
|
+
contactCreated: contactResult.contactCreated,
|
|
118
|
+
matchReason: actionResult.matchReason,
|
|
119
|
+
enableCategory: input.enableCategory,
|
|
120
|
+
categoryAssigned: categoryResult.categoryAssigned,
|
|
121
|
+
categoryName: categoryResult.categoryName,
|
|
122
|
+
categoryMissing: categoryResult.categoryMissing,
|
|
123
|
+
enableBadges: input.enableBadges,
|
|
124
|
+
badgesAssigned: badgesResult.badgesAssigned,
|
|
125
|
+
badgesMissing: badgesResult.badgesMissing,
|
|
126
|
+
enableQueue: input.enableQueue,
|
|
127
|
+
queueAssigned: queueResult.queueAssigned,
|
|
128
|
+
queueName: queueResult.queueName,
|
|
129
|
+
queueMissing: queueResult.queueMissing,
|
|
130
|
+
enableNotifications: input.enableNotifications,
|
|
131
|
+
emailsSent: notificationsResult.emailsSent,
|
|
132
|
+
smsSent: notificationsResult.smsSent,
|
|
133
|
+
enableAttachments: input.enableAttachments,
|
|
134
|
+
attachmentsUploaded: attachmentsResult.attachmentsUploaded,
|
|
135
|
+
attachmentsFailed: attachmentsResult.attachmentsFailed,
|
|
136
|
+
}, input.enableCustomNote, input.customNoteContent);
|
|
137
|
+
// Build output
|
|
138
|
+
const executionTimeMs = Date.now() - startTime;
|
|
139
|
+
// Build createdRecords (only populated when returnHeaders is true)
|
|
140
|
+
let createdRecords = (0, types_1.createEmptyCreatedRecords)();
|
|
141
|
+
if (input.returnHeaders) {
|
|
142
|
+
createdRecords = {
|
|
143
|
+
clientUuid: clientResult.clientUuid,
|
|
144
|
+
companyContactUuid: (_a = contactResult.contactUuid) !== null && _a !== void 0 ? _a : '',
|
|
145
|
+
jobUuid,
|
|
146
|
+
jobContactUuid,
|
|
147
|
+
systemNoteUuid: notesResult.systemNoteUuid,
|
|
148
|
+
customNoteUuid: notesResult.customNoteUuid,
|
|
149
|
+
attachmentUuids: attachmentsResult.attachmentUuids,
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
const summary = {
|
|
153
|
+
clientCreated: clientResult.clientCreated,
|
|
154
|
+
contactCreated: contactResult.contactCreated,
|
|
155
|
+
categoryAssigned: categoryResult.categoryAssigned,
|
|
156
|
+
categoryName: (_b = categoryResult.categoryName) !== null && _b !== void 0 ? _b : '',
|
|
157
|
+
categoryMissing: (_c = categoryResult.categoryMissing) !== null && _c !== void 0 ? _c : '',
|
|
158
|
+
badgesAssigned: badgesResult.badgesAssigned,
|
|
159
|
+
badgesMissing: badgesResult.badgesMissing,
|
|
160
|
+
queueAssigned: queueResult.queueAssigned,
|
|
161
|
+
queueName: (_d = queueResult.queueName) !== null && _d !== void 0 ? _d : '',
|
|
162
|
+
queueMissing: (_e = queueResult.queueMissing) !== null && _e !== void 0 ? _e : '',
|
|
163
|
+
notificationsSent: {
|
|
164
|
+
email: notificationsResult.emailsSent,
|
|
165
|
+
sms: notificationsResult.smsSent,
|
|
166
|
+
},
|
|
167
|
+
attachmentsUploaded: attachmentsResult.attachmentsUploaded,
|
|
168
|
+
attachmentsFailed: attachmentsResult.attachmentsFailed,
|
|
169
|
+
noteAdded: notesResult.systemNoteAdded,
|
|
170
|
+
customNoteAdded: notesResult.customNoteAdded,
|
|
171
|
+
};
|
|
172
|
+
return {
|
|
173
|
+
success: true,
|
|
174
|
+
error: '',
|
|
175
|
+
jobUuid,
|
|
176
|
+
jobNumber,
|
|
177
|
+
clientUuid: clientResult.clientUuid,
|
|
178
|
+
action: actionResult.action,
|
|
179
|
+
summary,
|
|
180
|
+
debug: {
|
|
181
|
+
classification: input.kind,
|
|
182
|
+
contactLookupField: (_f = input.contactLookupField) !== null && _f !== void 0 ? _f : '',
|
|
183
|
+
matchType: actionResult.matchType,
|
|
184
|
+
reason: actionResult.reason,
|
|
185
|
+
clientsChecked: actionResult.clientsChecked,
|
|
186
|
+
executionTimeMs,
|
|
187
|
+
},
|
|
188
|
+
createdRecords,
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
exports.executeJobCreation = executeJobCreation;
|
|
192
|
+
//# sourceMappingURL=orchestrator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"orchestrator.js","sourceRoot":"","sources":["../../../../../nodes/ServiceM8JobCreation/operations/create/orchestrator.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAIH,uCAAwD;AACxD,2CAA2C;AAE3C,qDAAgD;AAChD,mDAAgD;AAChD,iDAAqF;AACrF,iDAAoF;AACpF,2CAAmD;AACnD,qDAAkD;AAClD,+CAA4C;AAC5C,mDAAoD;AACpD,yDAAsD;AACtD,mEAAgE;AAChE,uDAAoD;AAEpD;;;GAGG;AACI,KAAK,UAAU,kBAAkB,CACvC,OAA0B,EAC1B,SAAiB;;IAEjB,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;IAE7B,8BAA8B;IAC9B,MAAM,KAAK,GAAG,IAAA,6BAAY,EAAC,OAAO,EAAE,SAAS,CAAC,CAAC;IAE/C,8BAA8B;IAC9B,MAAM,EAAE,eAAe,EAAE,GAAG,MAAM,IAAA,6BAAa,EAC9C,OAAO,EACP,KAAK,CAAC,mBAAmB,EACzB,KAAK,CAAC,kBAAkB,CACxB,CAAC;IAEF,0CAA0C;IAC1C,MAAM,UAAU,GAAG,MAAM,IAAA,4BAAa,EAAC,OAAO,EAAE,KAAK,CAAC,YAAY,CAAC,CAAC;IACpE,MAAM,YAAY,GAAG,IAAA,mDAAoC,EACxD,KAAK,CAAC,UAAU,EAChB,KAAK,CAAC,kBAAkB,EACxB,UAAU,EACV,KAAK,CAAC,UAAU,EAChB,KAAK,CAAC,IAAI,EACV,eAAe,CACf,CAAC;IAEF,6BAA6B;IAC7B,MAAM,YAAY,GAAG,MAAM,IAAA,mCAAoB,EAC9C,OAAO,EACP,YAAY,CAAC,WAAW,EACxB,YAAY,CAAC,UAAU,EACvB;QACC,UAAU,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,CAAC,UAAU;QACnC,MAAM,EAAE,YAAY,CAAC,MAAM;QAC3B,OAAO;QACP,KAAK,EAAE;YACN,cAAc,EAAE,KAAK,CAAC,IAAI;YAC1B,kBAAkB,EAAE,MAAA,KAAK,CAAC,kBAAkB,mCAAI,EAAE;YAClD,SAAS,EAAE,YAAY,CAAC,SAAS;YACjC,MAAM,EAAE,YAAY,CAAC,MAAM;YAC3B,cAAc,EAAE,YAAY,CAAC,cAAc;YAC3C,eAAe;SACf;QACD,cAAc;KACd,CAAC;AACH,CAAC;AA7ND,gDA6NC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Queue Assignment Operations
|
|
3
|
+
* Assign job to queue (static or dynamic)
|
|
4
|
+
*/
|
|
5
|
+
import type { IExecuteFunctions } from 'n8n-workflow';
|
|
6
|
+
export interface QueueAssignInput {
|
|
7
|
+
jobUuid: string;
|
|
8
|
+
enableQueue: boolean;
|
|
9
|
+
queueDynamic: boolean;
|
|
10
|
+
queueUuidInput: string;
|
|
11
|
+
queueNameInput: string;
|
|
12
|
+
}
|
|
13
|
+
export interface QueueAssignResult {
|
|
14
|
+
queueAssigned: boolean;
|
|
15
|
+
queueName?: string;
|
|
16
|
+
queueMissing?: string;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Assign a job to a queue
|
|
20
|
+
* Handles both static (UUID from dropdown) and dynamic (name lookup) modes
|
|
21
|
+
*/
|
|
22
|
+
export declare function assignQueue(context: IExecuteFunctions, input: QueueAssignInput): Promise<QueueAssignResult>;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Queue Assignment Operations
|
|
4
|
+
* Assign job to queue (static or dynamic)
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.assignQueue = void 0;
|
|
8
|
+
const api_1 = require("../../helpers/api");
|
|
9
|
+
/**
|
|
10
|
+
* Assign a job to a queue
|
|
11
|
+
* Handles both static (UUID from dropdown) and dynamic (name lookup) modes
|
|
12
|
+
*/
|
|
13
|
+
async function assignQueue(context, input) {
|
|
14
|
+
var _a;
|
|
15
|
+
if (!input.enableQueue) {
|
|
16
|
+
return { queueAssigned: false };
|
|
17
|
+
}
|
|
18
|
+
let queueUuid = input.queueUuidInput;
|
|
19
|
+
let queueName;
|
|
20
|
+
let queueMissing;
|
|
21
|
+
// Handle dynamic queue name lookup
|
|
22
|
+
if (input.queueDynamic && input.queueNameInput) {
|
|
23
|
+
const queuesResponse = await (0, api_1.serviceM8Request)(context, {
|
|
24
|
+
method: 'GET',
|
|
25
|
+
endpoint: '/api_1.0/queue.json',
|
|
26
|
+
query: { $filter: 'active eq 1' },
|
|
27
|
+
});
|
|
28
|
+
const allQueues = (0, api_1.parseArrayResponse)(queuesResponse);
|
|
29
|
+
const foundQueue = (0, api_1.findQueueByName)(allQueues, input.queueNameInput);
|
|
30
|
+
if (foundQueue) {
|
|
31
|
+
queueUuid = foundQueue.uuid;
|
|
32
|
+
queueName = foundQueue.name;
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
queueMissing = input.queueNameInput;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
if (queueUuid) {
|
|
39
|
+
await (0, api_1.assignJobToQueue)(context, input.jobUuid, queueUuid);
|
|
40
|
+
// Get queue name for output if not already set
|
|
41
|
+
if (!queueName) {
|
|
42
|
+
const queuesResponse = await (0, api_1.serviceM8Request)(context, {
|
|
43
|
+
method: 'GET',
|
|
44
|
+
endpoint: '/api_1.0/queue.json',
|
|
45
|
+
query: { $filter: `uuid eq '${queueUuid}'` },
|
|
46
|
+
});
|
|
47
|
+
const queues = (0, api_1.parseArrayResponse)(queuesResponse);
|
|
48
|
+
queueName = (_a = queues[0]) === null || _a === void 0 ? void 0 : _a.name;
|
|
49
|
+
}
|
|
50
|
+
return {
|
|
51
|
+
queueAssigned: true,
|
|
52
|
+
queueName,
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
return {
|
|
56
|
+
queueAssigned: false,
|
|
57
|
+
queueMissing,
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
exports.assignQueue = assignQueue;
|
|
61
|
+
//# sourceMappingURL=queueAssign.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"queueAssign.js","sourceRoot":"","sources":["../../../../../nodes/ServiceM8JobCreation/operations/create/queueAssign.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAIH,2CAK2B;AAgB3B;;;GAGG;AACI,KAAK,UAAU,WAAW,CAChC,OAA0B,EAC1B,KAAuB;;IAEvB,IAAI,CAAC,KAAK,CAAC,WAAW,EAAE;QACvB,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,CAAC;KAChC;IAED,IAAI,SAAS,GAAG,KAAK,CAAC,cAAc,CAAC;IACrC,IAAI,SAA6B,CAAC;IAClC,IAAI,YAAgC,CAAC;IAErC,mCAAmC;IACnC,IAAI,KAAK,CAAC,YAAY,IAAI,KAAK,CAAC,cAAc,EAAE;QAC/C,MAAM,cAAc,GAAG,MAAM,IAAA,sBAAgB,EAAC,OAAO,EAAE;YACtD,MAAM,EAAE,KAAK;YACb,QAAQ,EAAE,qBAAqB;YAC/B,KAAK,EAAE,EAAE,OAAO,EAAE,aAAa,EAAE;SACjC,CAAC,CAAC;QACH,MAAM,SAAS,GAAG,IAAA,wBAAkB,EAAiB,cAAc,CAAC,CAAC;QACrE,MAAM,UAAU,GAAG,IAAA,qBAAe,EAAC,SAAS,EAAE,KAAK,CAAC,cAAc,CAAC,CAAC;QAEpE,IAAI,UAAU,EAAE;YACf,SAAS,GAAG,UAAU,CAAC,IAAI,CAAC;YAC5B,SAAS,GAAG,UAAU,CAAC,IAAI,CAAC;SAC5B;aAAM;YACN,YAAY,GAAG,KAAK,CAAC,cAAc,CAAC;SACpC;KACD;IAED,IAAI,SAAS,EAAE;QACd,MAAM,IAAA,sBAAgB,EAAC,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;QAE1D,+CAA+C;QAC/C,IAAI,CAAC,SAAS,EAAE;YACf,MAAM,cAAc,GAAG,MAAM,IAAA,sBAAgB,EAAC,OAAO,EAAE;gBACtD,MAAM,EAAE,KAAK;gBACb,QAAQ,EAAE,qBAAqB;gBAC/B,KAAK,EAAE,EAAE,OAAO,EAAE,YAAY,SAAS,GAAG,EAAE;aAC5C,CAAC,CAAC;YACH,MAAM,MAAM,GAAG,IAAA,wBAAkB,EAAiB,cAAc,CAAC,CAAC;YAClE,SAAS,GAAG,MAAA,MAAM,CAAC,CAAC,CAAC,0CAAE,IAAI,CAAC;SAC5B;QAED,OAAO;YACN,aAAa,EAAE,IAAI;YACnB,SAAS;SACT,CAAC;KACF;IAED,OAAO;QACN,aAAa,EAAE,KAAK;QACpB,YAAY;KACZ,CAAC;AACH,CAAC;AAtDD,kCAsDC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Operations Index
|
|
3
|
+
* Re-exports all operations for the ServiceM8 Smart Job Creation node
|
|
4
|
+
*/
|
|
5
|
+
export { executeJobCreation } from './create';
|
|
6
|
+
export { executeJobUpdate, type JobUpdateResult } from './update';
|
|
7
|
+
export { uploadAttachments, assignBadges, createNotes, buildSystemReportNote, type AttachmentMode, type AttachmentInput, type AttachmentUploadResult, type AttachmentsResult, type AttachmentsConfig, type BadgesAssignInput, type BadgesAssignResult, type SystemReportInput, type NotesCreateResult, } from './shared';
|
|
8
|
+
export { processInput, lookupContact, checkContactExistsOnClient, lookupClients, findMatchingClientAndDetermineAction, createClientIfNeeded, createCompanyContactIfNeeded, createJobWithContact, createNewJob, createNewJobContact, cleanupEmptyJobContacts, assignCategory, assignQueue, sendNotifications, type ProcessedInput, type ContactLookupResult, type ClientLookupResult, type ActionResult, type ClientCreateInput, type ContactCreateInput, type ClientCreateResult, type ContactCreateResult, type JobCreateInput, type JobContactInput, type JobCreateResult, type CategoryAssignInput, type CategoryAssignResult, type QueueAssignInput, type QueueAssignResult, type NotificationRecipient, type NotificationsInput, type NotificationsResult, } from './create';
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Operations Index
|
|
4
|
+
* Re-exports all operations for the ServiceM8 Smart Job Creation node
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.sendNotifications = exports.assignQueue = exports.assignCategory = exports.cleanupEmptyJobContacts = exports.createNewJobContact = exports.createNewJob = exports.createJobWithContact = exports.createCompanyContactIfNeeded = exports.createClientIfNeeded = exports.findMatchingClientAndDetermineAction = exports.lookupClients = exports.checkContactExistsOnClient = exports.lookupContact = exports.processInput = exports.buildSystemReportNote = exports.createNotes = exports.assignBadges = exports.uploadAttachments = exports.executeJobUpdate = exports.executeJobCreation = void 0;
|
|
8
|
+
// Orchestrators (main entry points)
|
|
9
|
+
var create_1 = require("./create");
|
|
10
|
+
Object.defineProperty(exports, "executeJobCreation", { enumerable: true, get: function () { return create_1.executeJobCreation; } });
|
|
11
|
+
var update_1 = require("./update");
|
|
12
|
+
Object.defineProperty(exports, "executeJobUpdate", { enumerable: true, get: function () { return update_1.executeJobUpdate; } });
|
|
13
|
+
// Shared operations
|
|
14
|
+
var shared_1 = require("./shared");
|
|
15
|
+
Object.defineProperty(exports, "uploadAttachments", { enumerable: true, get: function () { return shared_1.uploadAttachments; } });
|
|
16
|
+
Object.defineProperty(exports, "assignBadges", { enumerable: true, get: function () { return shared_1.assignBadges; } });
|
|
17
|
+
Object.defineProperty(exports, "createNotes", { enumerable: true, get: function () { return shared_1.createNotes; } });
|
|
18
|
+
Object.defineProperty(exports, "buildSystemReportNote", { enumerable: true, get: function () { return shared_1.buildSystemReportNote; } });
|
|
19
|
+
// Create operations (for granular access)
|
|
20
|
+
var create_2 = require("./create");
|
|
21
|
+
Object.defineProperty(exports, "processInput", { enumerable: true, get: function () { return create_2.processInput; } });
|
|
22
|
+
Object.defineProperty(exports, "lookupContact", { enumerable: true, get: function () { return create_2.lookupContact; } });
|
|
23
|
+
Object.defineProperty(exports, "checkContactExistsOnClient", { enumerable: true, get: function () { return create_2.checkContactExistsOnClient; } });
|
|
24
|
+
Object.defineProperty(exports, "lookupClients", { enumerable: true, get: function () { return create_2.lookupClients; } });
|
|
25
|
+
Object.defineProperty(exports, "findMatchingClientAndDetermineAction", { enumerable: true, get: function () { return create_2.findMatchingClientAndDetermineAction; } });
|
|
26
|
+
Object.defineProperty(exports, "createClientIfNeeded", { enumerable: true, get: function () { return create_2.createClientIfNeeded; } });
|
|
27
|
+
Object.defineProperty(exports, "createCompanyContactIfNeeded", { enumerable: true, get: function () { return create_2.createCompanyContactIfNeeded; } });
|
|
28
|
+
Object.defineProperty(exports, "createJobWithContact", { enumerable: true, get: function () { return create_2.createJobWithContact; } });
|
|
29
|
+
Object.defineProperty(exports, "createNewJob", { enumerable: true, get: function () { return create_2.createNewJob; } });
|
|
30
|
+
Object.defineProperty(exports, "createNewJobContact", { enumerable: true, get: function () { return create_2.createNewJobContact; } });
|
|
31
|
+
Object.defineProperty(exports, "cleanupEmptyJobContacts", { enumerable: true, get: function () { return create_2.cleanupEmptyJobContacts; } });
|
|
32
|
+
Object.defineProperty(exports, "assignCategory", { enumerable: true, get: function () { return create_2.assignCategory; } });
|
|
33
|
+
Object.defineProperty(exports, "assignQueue", { enumerable: true, get: function () { return create_2.assignQueue; } });
|
|
34
|
+
Object.defineProperty(exports, "sendNotifications", { enumerable: true, get: function () { return create_2.sendNotifications; } });
|
|
35
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../nodes/ServiceM8JobCreation/operations/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,oCAAoC;AACpC,mCAA8C;AAArC,4GAAA,kBAAkB,OAAA;AAC3B,mCAAkE;AAAzD,0GAAA,gBAAgB,OAAA;AAEzB,oBAAoB;AACpB,mCAckB;AAbjB,2GAAA,iBAAiB,OAAA;AACjB,sGAAA,YAAY,OAAA;AACZ,qGAAA,WAAW,OAAA;AACX,+GAAA,qBAAqB,OAAA;AAYtB,0CAA0C;AAC1C,mCAiCkB;AAhCjB,sGAAA,YAAY,OAAA;AACZ,uGAAA,aAAa,OAAA;AACb,oHAAA,0BAA0B,OAAA;AAC1B,uGAAA,aAAa,OAAA;AACb,8HAAA,oCAAoC,OAAA;AACpC,8GAAA,oBAAoB,OAAA;AACpB,sHAAA,4BAA4B,OAAA;AAC5B,8GAAA,oBAAoB,OAAA;AACpB,sGAAA,YAAY,OAAA;AACZ,6GAAA,mBAAmB,OAAA;AACnB,iHAAA,uBAAuB,OAAA;AACvB,wGAAA,cAAc,OAAA;AACd,qGAAA,WAAW,OAAA;AACX,2GAAA,iBAAiB,OAAA"}
|