@easy8/n8n-nodes-easy8 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 +21 -0
- package/README.md +310 -0
- package/dist/credentials/Easy8.dark.svg +17 -0
- package/dist/credentials/Easy8.svg +16 -0
- package/dist/credentials/Easy8Api.credentials.d.ts +13 -0
- package/dist/credentials/Easy8Api.credentials.js +47 -0
- package/dist/credentials/Easy8Api.credentials.js.map +1 -0
- package/dist/images/cred-guide-1.png +0 -0
- package/dist/images/cred-guide-2.png +0 -0
- package/dist/images/cred-guide-3.png +0 -0
- package/dist/nodes/Easy8/Easy8.dark.svg +17 -0
- package/dist/nodes/Easy8/Easy8.node.d.ts +10 -0
- package/dist/nodes/Easy8/Easy8.node.js +283 -0
- package/dist/nodes/Easy8/Easy8.node.js.map +1 -0
- package/dist/nodes/Easy8/Easy8.svg +16 -0
- package/dist/nodes/Easy8/LoadOptions.d.ts +4 -0
- package/dist/nodes/Easy8/LoadOptions.js +157 -0
- package/dist/nodes/Easy8/LoadOptions.js.map +1 -0
- package/dist/nodes/Easy8/Model.d.ts +18 -0
- package/dist/nodes/Easy8/Model.js +24 -0
- package/dist/nodes/Easy8/Model.js.map +1 -0
- package/dist/nodes/Easy8/client/Autocomplete.d.ts +5 -0
- package/dist/nodes/Easy8/client/Autocomplete.js +3 -0
- package/dist/nodes/Easy8/client/Autocomplete.js.map +1 -0
- package/dist/nodes/Easy8/client/Easy8Client.d.ts +18 -0
- package/dist/nodes/Easy8/client/Easy8Client.js +124 -0
- package/dist/nodes/Easy8/client/Easy8Client.js.map +1 -0
- package/dist/nodes/Easy8/client/Issue.d.ts +15 -0
- package/dist/nodes/Easy8/client/Issue.js +3 -0
- package/dist/nodes/Easy8/client/Issue.js.map +1 -0
- package/dist/nodes/Easy8/client/Project.d.ts +10 -0
- package/dist/nodes/Easy8/client/Project.js +3 -0
- package/dist/nodes/Easy8/client/Project.js.map +1 -0
- package/dist/nodes/Easy8/client/Resources.d.ts +8 -0
- package/dist/nodes/Easy8/client/Resources.js +3 -0
- package/dist/nodes/Easy8/client/Resources.js.map +1 -0
- package/dist/nodes/Easy8/client/index.d.ts +3 -0
- package/dist/nodes/Easy8/client/index.js +20 -0
- package/dist/nodes/Easy8/client/index.js.map +1 -0
- package/dist/nodes/Easy8/fields/AccountFields.d.ts +2 -0
- package/dist/nodes/Easy8/fields/AccountFields.js +293 -0
- package/dist/nodes/Easy8/fields/AccountFields.js.map +1 -0
- package/dist/nodes/Easy8/fields/AttendanceFields.d.ts +2 -0
- package/dist/nodes/Easy8/fields/AttendanceFields.js +141 -0
- package/dist/nodes/Easy8/fields/AttendanceFields.js.map +1 -0
- package/dist/nodes/Easy8/fields/CustomFields.d.ts +2 -0
- package/dist/nodes/Easy8/fields/CustomFields.js +33 -0
- package/dist/nodes/Easy8/fields/CustomFields.js.map +1 -0
- package/dist/nodes/Easy8/fields/IssueFields.d.ts +2 -0
- package/dist/nodes/Easy8/fields/IssueFields.js +200 -0
- package/dist/nodes/Easy8/fields/IssueFields.js.map +1 -0
- package/dist/nodes/Easy8/fields/LeadFields.d.ts +2 -0
- package/dist/nodes/Easy8/fields/LeadFields.js +84 -0
- package/dist/nodes/Easy8/fields/LeadFields.js.map +1 -0
- package/dist/nodes/Easy8/fields/OpportunityFields.d.ts +3 -0
- package/dist/nodes/Easy8/fields/OpportunityFields.js +169 -0
- package/dist/nodes/Easy8/fields/OpportunityFields.js.map +1 -0
- package/dist/nodes/Easy8/fields/PersonalContactFields.d.ts +2 -0
- package/dist/nodes/Easy8/fields/PersonalContactFields.js +207 -0
- package/dist/nodes/Easy8/fields/PersonalContactFields.js.map +1 -0
- package/dist/nodes/Easy8/fields/ProjectFields.d.ts +2 -0
- package/dist/nodes/Easy8/fields/ProjectFields.js +61 -0
- package/dist/nodes/Easy8/fields/ProjectFields.js.map +1 -0
- package/dist/nodes/Easy8/fields/TimeEntryFields.d.ts +2 -0
- package/dist/nodes/Easy8/fields/TimeEntryFields.js +171 -0
- package/dist/nodes/Easy8/fields/TimeEntryFields.js.map +1 -0
- package/dist/nodes/Easy8/fields/UserFields.d.ts +2 -0
- package/dist/nodes/Easy8/fields/UserFields.js +195 -0
- package/dist/nodes/Easy8/fields/UserFields.js.map +1 -0
- package/dist/nodes/Easy8/operations/AddCommentOperation.d.ts +3 -0
- package/dist/nodes/Easy8/operations/AddCommentOperation.js +46 -0
- package/dist/nodes/Easy8/operations/AddCommentOperation.js.map +1 -0
- package/dist/nodes/Easy8/operations/BaseModel.d.ts +18 -0
- package/dist/nodes/Easy8/operations/BaseModel.js +3 -0
- package/dist/nodes/Easy8/operations/BaseModel.js.map +1 -0
- package/dist/nodes/Easy8/operations/CreateModel.d.ts +83 -0
- package/dist/nodes/Easy8/operations/CreateModel.js +3 -0
- package/dist/nodes/Easy8/operations/CreateModel.js.map +1 -0
- package/dist/nodes/Easy8/operations/CreateOperation.d.ts +6 -0
- package/dist/nodes/Easy8/operations/CreateOperation.js +211 -0
- package/dist/nodes/Easy8/operations/CreateOperation.js.map +1 -0
- package/dist/nodes/Easy8/operations/GetManyOperation.d.ts +3 -0
- package/dist/nodes/Easy8/operations/GetManyOperation.js +77 -0
- package/dist/nodes/Easy8/operations/GetManyOperation.js.map +1 -0
- package/dist/nodes/Easy8/operations/GetOneOperation.d.ts +3 -0
- package/dist/nodes/Easy8/operations/GetOneOperation.js +17 -0
- package/dist/nodes/Easy8/operations/GetOneOperation.js.map +1 -0
- package/dist/nodes/Easy8/operations/UpdateModel.d.ts +83 -0
- package/dist/nodes/Easy8/operations/UpdateModel.js +3 -0
- package/dist/nodes/Easy8/operations/UpdateModel.js.map +1 -0
- package/dist/nodes/Easy8/operations/UpdateOperation.d.ts +3 -0
- package/dist/nodes/Easy8/operations/UpdateOperation.js +188 -0
- package/dist/nodes/Easy8/operations/UpdateOperation.js.map +1 -0
- package/dist/nodes/Easy8/utils/ConvertToEasyDate.d.ts +1 -0
- package/dist/nodes/Easy8/utils/ConvertToEasyDate.js +26 -0
- package/dist/nodes/Easy8/utils/ConvertToEasyDate.js.map +1 -0
- package/dist/nodes/Easy8/utils/ExtractBillingOptions.d.ts +20 -0
- package/dist/nodes/Easy8/utils/ExtractBillingOptions.js +29 -0
- package/dist/nodes/Easy8/utils/ExtractBillingOptions.js.map +1 -0
- package/dist/nodes/Easy8/utils/SanitizeDomain.d.ts +1 -0
- package/dist/nodes/Easy8/utils/SanitizeDomain.js +10 -0
- package/dist/nodes/Easy8/utils/SanitizeDomain.js.map +1 -0
- package/dist/nodes/Easy8/utils/TryToParseParameterAsNumber.d.ts +2 -0
- package/dist/nodes/Easy8/utils/TryToParseParameterAsNumber.js +18 -0
- package/dist/nodes/Easy8/utils/TryToParseParameterAsNumber.js.map +1 -0
- package/dist/nodes/Easy8/utils/index.d.ts +4 -0
- package/dist/nodes/Easy8/utils/index.js +21 -0
- package/dist/nodes/Easy8/utils/index.js.map +1 -0
- package/dist/package.json +58 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +58 -0
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.addCommentOperation = addCommentOperation;
|
|
4
|
+
const Model_1 = require("../Model");
|
|
5
|
+
const utils_1 = require("../utils");
|
|
6
|
+
async function addCommentOperation(resource, itemIndex) {
|
|
7
|
+
const credentials = await this.getCredentials('easy8Api');
|
|
8
|
+
const domain = (0, utils_1.sanitizeDomain)(credentials.domain);
|
|
9
|
+
const id = this.getNodeParameter('id', itemIndex);
|
|
10
|
+
const comment = this.getNodeParameter('comment', itemIndex);
|
|
11
|
+
const entity = {
|
|
12
|
+
notes: comment,
|
|
13
|
+
};
|
|
14
|
+
if (resource === Model_1.EasyNodeResourceType.issues) {
|
|
15
|
+
entity['private_notes'] = this.getNodeParameter('privateNotes', itemIndex);
|
|
16
|
+
}
|
|
17
|
+
const body = {};
|
|
18
|
+
switch (resource) {
|
|
19
|
+
case Model_1.EasyNodeResourceType.issues:
|
|
20
|
+
body['issue'] = entity;
|
|
21
|
+
break;
|
|
22
|
+
case Model_1.EasyNodeResourceType.leads:
|
|
23
|
+
body['easy_lead'] = entity;
|
|
24
|
+
break;
|
|
25
|
+
case Model_1.EasyNodeResourceType.opportunities:
|
|
26
|
+
body['easy_crm_case'] = entity;
|
|
27
|
+
break;
|
|
28
|
+
case Model_1.EasyNodeResourceType.accounts:
|
|
29
|
+
body['easy_contact'] = entity;
|
|
30
|
+
break;
|
|
31
|
+
case Model_1.EasyNodeResourceType.personalContacts:
|
|
32
|
+
body['easy_personal_contact'] = entity;
|
|
33
|
+
break;
|
|
34
|
+
default:
|
|
35
|
+
throw new Error('Unsupported resource type: ' + resource);
|
|
36
|
+
}
|
|
37
|
+
const options = {
|
|
38
|
+
method: 'PUT',
|
|
39
|
+
url: `${domain}/${resource}/${id}.json`,
|
|
40
|
+
body,
|
|
41
|
+
json: true,
|
|
42
|
+
};
|
|
43
|
+
this.logger.debug(`Add comment ${resource} with ${JSON.stringify(options)}`);
|
|
44
|
+
return await this.helpers.httpRequestWithAuthentication.call(this, 'easy8Api', options);
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=AddCommentOperation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AddCommentOperation.js","sourceRoot":"","sources":["../../../../nodes/Easy8/operations/AddCommentOperation.ts"],"names":[],"mappings":";;AAIA,kDAiDC;AApDD,oCAAgD;AAChD,oCAA0C;AAEnC,KAAK,UAAU,mBAAmB,CAEvC,QAA8B,EAC9B,SAAiB;IAEjB,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC;IAC1D,MAAM,MAAM,GAAG,IAAA,sBAAc,EAAC,WAAW,CAAC,MAAgB,CAAC,CAAC;IAE5D,MAAM,EAAE,GAAG,IAAI,CAAC,gBAAgB,CAAC,IAAI,EAAE,SAAS,CAAW,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,OAAO,CAAC,6BAA6B,CAAC,IAAI,CAAC,IAAI,EAAE,UAAU,EAAE,OAAO,CAAC,CAAC;AAC1F,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { CustomField } from './UpdateModel';
|
|
2
|
+
export interface BaseIssueOptions {
|
|
3
|
+
assignedToId: number | undefined;
|
|
4
|
+
customFields: {
|
|
5
|
+
field: CustomField[];
|
|
6
|
+
} | undefined;
|
|
7
|
+
description: string | undefined;
|
|
8
|
+
doneRatio: number | undefined;
|
|
9
|
+
dueDate: string | undefined;
|
|
10
|
+
estimatedHours: number | undefined;
|
|
11
|
+
isPrivate: boolean | undefined;
|
|
12
|
+
parentIssueId: number | undefined;
|
|
13
|
+
priorityId: number | undefined;
|
|
14
|
+
projectId: number | undefined;
|
|
15
|
+
startDate: string | undefined;
|
|
16
|
+
statusId: number | undefined;
|
|
17
|
+
trackerId: number | undefined;
|
|
18
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BaseModel.js","sourceRoot":"","sources":["../../../../nodes/Easy8/operations/BaseModel.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { CustomField } from './UpdateModel';
|
|
2
|
+
import { BaseIssueOptions } from './BaseModel';
|
|
3
|
+
export type IssueCreateOptions = BaseIssueOptions;
|
|
4
|
+
export interface LeadCreateOptions {
|
|
5
|
+
description: string | undefined;
|
|
6
|
+
companyName: string | undefined;
|
|
7
|
+
customFields: {
|
|
8
|
+
field: CustomField[];
|
|
9
|
+
} | undefined;
|
|
10
|
+
}
|
|
11
|
+
export interface OpportunityCreateOptions {
|
|
12
|
+
statusId: number | undefined;
|
|
13
|
+
assignedToId: number | undefined;
|
|
14
|
+
externalAssignedToId: number | undefined;
|
|
15
|
+
price: number | undefined;
|
|
16
|
+
contractDate: string | undefined;
|
|
17
|
+
customFields: {
|
|
18
|
+
field: CustomField[];
|
|
19
|
+
} | undefined;
|
|
20
|
+
}
|
|
21
|
+
export interface TimeEntryCreateOptions {
|
|
22
|
+
activityId: number | undefined;
|
|
23
|
+
comment: string | undefined;
|
|
24
|
+
projectId: number | undefined;
|
|
25
|
+
spentOn: string | undefined;
|
|
26
|
+
userId: number | undefined;
|
|
27
|
+
customFields: {
|
|
28
|
+
field: CustomField[];
|
|
29
|
+
} | undefined;
|
|
30
|
+
}
|
|
31
|
+
export interface UserCreateOptions {
|
|
32
|
+
phone: string | undefined;
|
|
33
|
+
customFields: {
|
|
34
|
+
field: CustomField[];
|
|
35
|
+
} | undefined;
|
|
36
|
+
}
|
|
37
|
+
export interface AccountCreateOptions {
|
|
38
|
+
firstname: string | undefined;
|
|
39
|
+
industryId: number | undefined;
|
|
40
|
+
customFields: {
|
|
41
|
+
field: CustomField[];
|
|
42
|
+
} | undefined;
|
|
43
|
+
typeId: number | undefined;
|
|
44
|
+
assignedToId: number | undefined;
|
|
45
|
+
externalAssignedToId: number | undefined;
|
|
46
|
+
contactStatusId: number | undefined;
|
|
47
|
+
contactLevelId: number | undefined;
|
|
48
|
+
authorId: number | undefined;
|
|
49
|
+
accountOpened: string | undefined;
|
|
50
|
+
accountClosed: string | undefined;
|
|
51
|
+
customerLeftReasonId: number | undefined;
|
|
52
|
+
}
|
|
53
|
+
export interface AccountBillingCreateOptions {
|
|
54
|
+
organization: string | undefined;
|
|
55
|
+
street: string | undefined;
|
|
56
|
+
city: string | undefined;
|
|
57
|
+
countryCode: string | undefined;
|
|
58
|
+
countrySubdivisionCode: string | undefined;
|
|
59
|
+
postalCode: string | undefined;
|
|
60
|
+
email: string | undefined;
|
|
61
|
+
phone: string | undefined;
|
|
62
|
+
vatNo: string | undefined;
|
|
63
|
+
vatRate: number | undefined;
|
|
64
|
+
bankAccount: string | undefined;
|
|
65
|
+
iban: string | undefined;
|
|
66
|
+
variableSymbol: string | undefined;
|
|
67
|
+
swift: string | undefined;
|
|
68
|
+
bic: string | undefined;
|
|
69
|
+
}
|
|
70
|
+
export interface AttendanceCreateOptions {
|
|
71
|
+
departure: string | undefined;
|
|
72
|
+
description: string | undefined;
|
|
73
|
+
activityId: string | undefined;
|
|
74
|
+
}
|
|
75
|
+
export interface PersonalContactCreateOptions {
|
|
76
|
+
accountId: number | undefined;
|
|
77
|
+
partnerId: number | undefined;
|
|
78
|
+
jobTitle: string | undefined;
|
|
79
|
+
customFields: {
|
|
80
|
+
field: CustomField[];
|
|
81
|
+
} | undefined;
|
|
82
|
+
}
|
|
83
|
+
export type CreateOptionsWithCustomFields = AccountCreateOptions | IssueCreateOptions | LeadCreateOptions | OpportunityCreateOptions | PersonalContactCreateOptions | TimeEntryCreateOptions | UserCreateOptions;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CreateModel.js","sourceRoot":"","sources":["../../../../nodes/Easy8/operations/CreateModel.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { IExecuteFunctions } from 'n8n-workflow';
|
|
2
|
+
import { EasyNodeResourceType } from '../Model';
|
|
3
|
+
export declare function createBodyForAttendance(this: IExecuteFunctions, itemIndex: number): {
|
|
4
|
+
[key: string]: any;
|
|
5
|
+
};
|
|
6
|
+
export declare function createOperation(this: IExecuteFunctions, resource: EasyNodeResourceType, itemIndex: number): Promise<any>;
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createBodyForAttendance = createBodyForAttendance;
|
|
4
|
+
exports.createOperation = createOperation;
|
|
5
|
+
const Model_1 = require("../Model");
|
|
6
|
+
const utils_1 = require("../utils");
|
|
7
|
+
function convertCustomFields(options) {
|
|
8
|
+
var _a;
|
|
9
|
+
return (_a = options.customFields) === null || _a === void 0 ? void 0 : _a.field.map((customField) => ({
|
|
10
|
+
id: customField.id,
|
|
11
|
+
value: customField.value,
|
|
12
|
+
}));
|
|
13
|
+
}
|
|
14
|
+
function createBodyForAccount(itemIndex) {
|
|
15
|
+
const options = this.getNodeParameter('accountCreateOptions', itemIndex, {});
|
|
16
|
+
this.logger.debug(`Create account with : ${JSON.stringify(options)}`);
|
|
17
|
+
const primaryBillingOptions = (0, utils_1.extractBillingOptions)(this, 'accountPrimaryBillingCreateOptions', itemIndex, true);
|
|
18
|
+
const contactBillingOptions = (0, utils_1.extractBillingOptions)(this, 'accountContactBillingCreateOptions', itemIndex, false);
|
|
19
|
+
const customFields = convertCustomFields(options);
|
|
20
|
+
return {
|
|
21
|
+
easy_contact: {
|
|
22
|
+
firstname: options.firstname,
|
|
23
|
+
easy_contact_industry_id: options.industryId,
|
|
24
|
+
easy_contact_type_id: options.typeId,
|
|
25
|
+
custom_fields: customFields,
|
|
26
|
+
assigned_to_id: options.assignedToId,
|
|
27
|
+
external_assigned_to_id: options.externalAssignedToId,
|
|
28
|
+
easy_contact_status_id: options.contactStatusId,
|
|
29
|
+
easy_contact_level_id: options.contactLevelId,
|
|
30
|
+
author_id: options.authorId,
|
|
31
|
+
account_opened: options.accountOpened,
|
|
32
|
+
account_closed: options.accountClosed,
|
|
33
|
+
easy_contact_customer_left_reason_id: options.customerLeftReasonId,
|
|
34
|
+
contact_easy_billing_info_attributes: contactBillingOptions,
|
|
35
|
+
primary_easy_billing_info_attributes: primaryBillingOptions,
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
function createBodyForAttendance(itemIndex) {
|
|
40
|
+
const options = this.getNodeParameter('attendanceCreateOptions', itemIndex, {});
|
|
41
|
+
const arrival = this.getNodeParameter('arrival', itemIndex);
|
|
42
|
+
const body = {
|
|
43
|
+
easy_attendance: {
|
|
44
|
+
arrival,
|
|
45
|
+
departure: options.departure,
|
|
46
|
+
description: options.description,
|
|
47
|
+
easy_attendance_activity_id: options.activityId,
|
|
48
|
+
},
|
|
49
|
+
};
|
|
50
|
+
this.logger.debug(`Create attendance with : ${JSON.stringify(body)}`);
|
|
51
|
+
return body;
|
|
52
|
+
}
|
|
53
|
+
function createBodyForIssue(itemIndex) {
|
|
54
|
+
const options = this.getNodeParameter('issueCreateOptions', itemIndex, {});
|
|
55
|
+
this.logger.debug(`Create issue with subject: ${JSON.stringify(options)}`);
|
|
56
|
+
const subject = this.getNodeParameter('subject', itemIndex);
|
|
57
|
+
const projectId = this.getNodeParameter('projectId', itemIndex);
|
|
58
|
+
const customFields = convertCustomFields(options);
|
|
59
|
+
return {
|
|
60
|
+
issue: {
|
|
61
|
+
subject,
|
|
62
|
+
description: options.description,
|
|
63
|
+
project_id: projectId,
|
|
64
|
+
parent_issue_id: options.parentIssueId,
|
|
65
|
+
assigned_to_id: options.assignedToId,
|
|
66
|
+
estimated_hours: options.estimatedHours,
|
|
67
|
+
done_ratio: options.doneRatio,
|
|
68
|
+
start_date: (0, utils_1.convertToEasyDate)(options.startDate),
|
|
69
|
+
due_date: (0, utils_1.convertToEasyDate)(options.dueDate),
|
|
70
|
+
is_private: options.isPrivate,
|
|
71
|
+
priority_id: options.priorityId,
|
|
72
|
+
status_id: options.statusId,
|
|
73
|
+
tracker_id: options.trackerId,
|
|
74
|
+
custom_fields: customFields,
|
|
75
|
+
},
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
function createBodyForLead(itemIndex) {
|
|
79
|
+
const options = this.getNodeParameter('leadCreateOptions', itemIndex, {});
|
|
80
|
+
this.logger.debug(`Create lead with subject: ${JSON.stringify(options)}`);
|
|
81
|
+
const customFields = convertCustomFields(options);
|
|
82
|
+
return {
|
|
83
|
+
easy_lead: {
|
|
84
|
+
company_name: options.companyName,
|
|
85
|
+
description: options.description,
|
|
86
|
+
custom_fields: customFields,
|
|
87
|
+
},
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
function createBodyForOpportunity(itemIndex) {
|
|
91
|
+
const options = this.getNodeParameter('opportunityCreateOptions', itemIndex, {});
|
|
92
|
+
const projectId = this.getNodeParameter('projectId', itemIndex);
|
|
93
|
+
const name = this.getNodeParameter('name', itemIndex);
|
|
94
|
+
const accountId = this.getNodeParameter('accountId', itemIndex);
|
|
95
|
+
this.logger.debug(`Create opportunity with subject: ${JSON.stringify(options)}`);
|
|
96
|
+
const customFields = convertCustomFields(options);
|
|
97
|
+
return {
|
|
98
|
+
easy_crm_case: {
|
|
99
|
+
project_id: projectId,
|
|
100
|
+
name,
|
|
101
|
+
account_id: accountId,
|
|
102
|
+
custom_fields: customFields,
|
|
103
|
+
easy_crm_case_status_id: options.statusId,
|
|
104
|
+
assigned_to_id: options.assignedToId,
|
|
105
|
+
external_assigned_to_id: options.externalAssignedToId,
|
|
106
|
+
price: options.price,
|
|
107
|
+
contract_date: options.contractDate,
|
|
108
|
+
},
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
function createBodyForPersonalContact(itemIndex) {
|
|
112
|
+
const options = this.getNodeParameter('personalContactCreateOptions', itemIndex, {});
|
|
113
|
+
const firstname = this.getNodeParameter('firstname', itemIndex);
|
|
114
|
+
const lastname = this.getNodeParameter('lastname', itemIndex);
|
|
115
|
+
const email = this.getNodeParameter('email', itemIndex);
|
|
116
|
+
this.logger.debug(`Create personal contact with : ${JSON.stringify(options)}`);
|
|
117
|
+
const customFields = convertCustomFields(options);
|
|
118
|
+
const x = {
|
|
119
|
+
easy_personal_contact: {
|
|
120
|
+
account_id: options.accountId,
|
|
121
|
+
easy_partner_id: options.partnerId,
|
|
122
|
+
first_name: firstname,
|
|
123
|
+
last_name: lastname,
|
|
124
|
+
email,
|
|
125
|
+
job_title: options.jobTitle,
|
|
126
|
+
custom_fields: customFields,
|
|
127
|
+
},
|
|
128
|
+
};
|
|
129
|
+
this.logger.debug(`Create personal contact with : ${JSON.stringify(x)}`);
|
|
130
|
+
return x;
|
|
131
|
+
}
|
|
132
|
+
function createBodyForTimeEntry(itemIndex) {
|
|
133
|
+
const options = this.getNodeParameter('timeEntryCreateOptions', itemIndex, {});
|
|
134
|
+
const hours = this.getNodeParameter('hours', itemIndex);
|
|
135
|
+
const customFields = convertCustomFields(options);
|
|
136
|
+
const body = {
|
|
137
|
+
time_entry: {
|
|
138
|
+
hours,
|
|
139
|
+
activity_id: options.activityId,
|
|
140
|
+
comments: options.comment,
|
|
141
|
+
custom_fields: customFields,
|
|
142
|
+
project_id: options.projectId,
|
|
143
|
+
spent_on: options.spentOn,
|
|
144
|
+
user_id: options.userId,
|
|
145
|
+
},
|
|
146
|
+
};
|
|
147
|
+
this.logger.debug(`Create time entry with : ${JSON.stringify(body)}`);
|
|
148
|
+
return body;
|
|
149
|
+
}
|
|
150
|
+
function createBodyForUser(itemIndex) {
|
|
151
|
+
const options = this.getNodeParameter('userCreateOptions', itemIndex, {});
|
|
152
|
+
const login = this.getNodeParameter('login', itemIndex);
|
|
153
|
+
const firstname = this.getNodeParameter('firstname', itemIndex);
|
|
154
|
+
const lastname = this.getNodeParameter('lastname', itemIndex);
|
|
155
|
+
const email = this.getNodeParameter('email', itemIndex);
|
|
156
|
+
const customFields = convertCustomFields(options);
|
|
157
|
+
const body = {
|
|
158
|
+
user: {
|
|
159
|
+
login,
|
|
160
|
+
firstname: firstname,
|
|
161
|
+
lastname: lastname,
|
|
162
|
+
mail: email,
|
|
163
|
+
phone: options.phone,
|
|
164
|
+
custom_fields: customFields,
|
|
165
|
+
},
|
|
166
|
+
};
|
|
167
|
+
this.logger.debug(`Create user with : ${JSON.stringify(body)}`);
|
|
168
|
+
return body;
|
|
169
|
+
}
|
|
170
|
+
async function createOperation(resource, itemIndex) {
|
|
171
|
+
const credentials = await this.getCredentials('easy8Api');
|
|
172
|
+
const domain = (0, utils_1.sanitizeDomain)(credentials.domain);
|
|
173
|
+
let body;
|
|
174
|
+
switch (resource) {
|
|
175
|
+
case Model_1.EasyNodeResourceType.accounts:
|
|
176
|
+
body = createBodyForAccount.call(this, itemIndex);
|
|
177
|
+
break;
|
|
178
|
+
case Model_1.EasyNodeResourceType.attendances:
|
|
179
|
+
body = createBodyForAttendance.call(this, itemIndex);
|
|
180
|
+
break;
|
|
181
|
+
case Model_1.EasyNodeResourceType.issues:
|
|
182
|
+
body = createBodyForIssue.call(this, itemIndex);
|
|
183
|
+
break;
|
|
184
|
+
case Model_1.EasyNodeResourceType.leads:
|
|
185
|
+
body = createBodyForLead.call(this, itemIndex);
|
|
186
|
+
break;
|
|
187
|
+
case Model_1.EasyNodeResourceType.opportunities:
|
|
188
|
+
body = createBodyForOpportunity.call(this, itemIndex);
|
|
189
|
+
break;
|
|
190
|
+
case Model_1.EasyNodeResourceType.personalContacts:
|
|
191
|
+
body = createBodyForPersonalContact.call(this, itemIndex);
|
|
192
|
+
break;
|
|
193
|
+
case Model_1.EasyNodeResourceType.timeEntries:
|
|
194
|
+
body = createBodyForTimeEntry.call(this, itemIndex);
|
|
195
|
+
break;
|
|
196
|
+
case Model_1.EasyNodeResourceType.users:
|
|
197
|
+
body = createBodyForUser.call(this, itemIndex);
|
|
198
|
+
break;
|
|
199
|
+
default:
|
|
200
|
+
throw new Error('Unsupported resource type: ' + resource);
|
|
201
|
+
}
|
|
202
|
+
const options = {
|
|
203
|
+
method: 'POST',
|
|
204
|
+
url: `${domain}/${resource}.json`,
|
|
205
|
+
body,
|
|
206
|
+
json: true,
|
|
207
|
+
};
|
|
208
|
+
this.logger.debug(`Create ${resource} with ${JSON.stringify(options)}`);
|
|
209
|
+
return await this.helpers.httpRequestWithAuthentication.call(this, 'easy8Api', options);
|
|
210
|
+
}
|
|
211
|
+
//# sourceMappingURL=CreateOperation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CreateOperation.js","sourceRoot":"","sources":["../../../../nodes/Easy8/operations/CreateOperation.ts"],"names":[],"mappings":";;AAqEA,0DAsBC;AAoKD,0CAgDC;AA9SD,oCAAgD;AAahD,oCAAoF;AAEpF,SAAS,mBAAmB,CAAC,OAAsC;;IACjE,OAAO,MAAA,OAAO,CAAC,YAAY,0CAAE,KAAK,CAAC,GAAG,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;QACvD,EAAE,EAAE,WAAW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IAAI,GAAG,4BAA4B,CAAC,IAAI,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;YAC1D,MAAM;QACR,KAAK,4BAAoB,CAAC,WAAW;YACnC,IAAI,GAAG,sBAAsB,CAAC,IAAI,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;YACpD,MAAM;QACR,KAAK,4BAAoB,CAAC,KAAK;YAC7B,IAAI,GAAG,iBAAiB,CAAC,IAAI,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;YAC/C,MAAM;QACR;YACE,MAAM,IAAI,KAAK,CAAC,6BAA6B,GAAG,QAAQ,CAAC,CAAC;IAC9D,CAAC;IAED,MAAM,OAAO,GAAwB;QACnC,MAAM,EAAE,MAAM;QACd,GAAG,EAAE,GAAG,MAAM,IAAI,QAAQ,OAAO;QACjC,IAAI;QACJ,IAAI,EAAE,IAAI;KACX,CAAC;IAEF,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,UAAU,QAAQ,SAAS,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;IAExE,OAAO,MAAM,IAAI,CAAC,OAAO,CAAC,6BAA6B,CAAC,IAAI,CAAC,IAAI,EAAE,UAAU,EAAE,OAAO,CAAC,CAAC;AAC1F,CAAC"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.processGetManyOperation = processGetManyOperation;
|
|
4
|
+
const Model_1 = require("../Model");
|
|
5
|
+
const utils_1 = require("../utils");
|
|
6
|
+
async function processGetManyOperation(resource, itemIndex) {
|
|
7
|
+
const credentials = await this.getCredentials('easy8Api');
|
|
8
|
+
const qs = {};
|
|
9
|
+
let query_id_parameter;
|
|
10
|
+
switch (resource) {
|
|
11
|
+
case Model_1.EasyNodeResourceType.accounts:
|
|
12
|
+
query_id_parameter = 'accountQueryId';
|
|
13
|
+
break;
|
|
14
|
+
case Model_1.EasyNodeResourceType.attendances:
|
|
15
|
+
query_id_parameter = 'attendanceQueryId';
|
|
16
|
+
qs['tab'] = 'list';
|
|
17
|
+
break;
|
|
18
|
+
case Model_1.EasyNodeResourceType.issues:
|
|
19
|
+
query_id_parameter = 'issueQueryId';
|
|
20
|
+
break;
|
|
21
|
+
case Model_1.EasyNodeResourceType.leads:
|
|
22
|
+
query_id_parameter = 'leadQueryId';
|
|
23
|
+
break;
|
|
24
|
+
case Model_1.EasyNodeResourceType.opportunities:
|
|
25
|
+
query_id_parameter = 'opportunityQueryId';
|
|
26
|
+
break;
|
|
27
|
+
case Model_1.EasyNodeResourceType.personalContacts:
|
|
28
|
+
query_id_parameter = 'personalContactQueryId';
|
|
29
|
+
break;
|
|
30
|
+
case Model_1.EasyNodeResourceType.projects:
|
|
31
|
+
query_id_parameter = 'projectQueryId';
|
|
32
|
+
break;
|
|
33
|
+
case Model_1.EasyNodeResourceType.users:
|
|
34
|
+
query_id_parameter = 'userQueryId';
|
|
35
|
+
break;
|
|
36
|
+
case Model_1.EasyNodeResourceType.timeEntries:
|
|
37
|
+
query_id_parameter = 'timeEntryQueryId';
|
|
38
|
+
break;
|
|
39
|
+
default:
|
|
40
|
+
throw new Error(`Unsupported resource type: ${resource}`);
|
|
41
|
+
}
|
|
42
|
+
const queryId = this.getNodeParameter(query_id_parameter, itemIndex);
|
|
43
|
+
if (queryId) {
|
|
44
|
+
qs.query_id = queryId;
|
|
45
|
+
}
|
|
46
|
+
const domain = (0, utils_1.sanitizeDomain)(credentials.domain);
|
|
47
|
+
const returnAll = this.getNodeParameter('returnAll', itemIndex, false);
|
|
48
|
+
const resultItems = [];
|
|
49
|
+
let offset = 0;
|
|
50
|
+
let limit = 100;
|
|
51
|
+
if (!returnAll) {
|
|
52
|
+
offset = this.getNodeParameter('offset', itemIndex, 0);
|
|
53
|
+
limit = this.getNodeParameter('limit', itemIndex, 100);
|
|
54
|
+
}
|
|
55
|
+
let fetchedItemsCount = 0;
|
|
56
|
+
do {
|
|
57
|
+
const options = {
|
|
58
|
+
method: 'GET',
|
|
59
|
+
url: `${domain}/${resource}.json`,
|
|
60
|
+
qs: {
|
|
61
|
+
...qs,
|
|
62
|
+
offset,
|
|
63
|
+
limit,
|
|
64
|
+
},
|
|
65
|
+
json: true,
|
|
66
|
+
};
|
|
67
|
+
const subResult = await this.helpers.httpRequestWithAuthentication.call(this, 'easy8Api', options);
|
|
68
|
+
resultItems.push(...subResult[resource]);
|
|
69
|
+
fetchedItemsCount = subResult[resource].length;
|
|
70
|
+
offset += fetchedItemsCount;
|
|
71
|
+
} while (fetchedItemsCount >= limit && returnAll);
|
|
72
|
+
this.logger.debug(`Fetched all ${resource} ${resultItems.length} items`);
|
|
73
|
+
const result = {};
|
|
74
|
+
result[resource] = resultItems;
|
|
75
|
+
return result;
|
|
76
|
+
}
|
|
77
|
+
//# sourceMappingURL=GetManyOperation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GetManyOperation.js","sourceRoot":"","sources":["../../../../nodes/Easy8/operations/GetManyOperation.ts"],"names":[],"mappings":";;AAIA,0DAyFC;AA5FD,oCAAgD;AAChD,oCAA0C;AAEnC,KAAK,UAAU,uBAAuB,CAE3C,QAA8B,EAC9B,SAAiB;IAEjB,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC;IAC1D,MAAM,EAAE,GAAgB,EAAE,CAAC;IAE3B,IAAI,kBAA0B,CAAC;IAC/B,QAAQ,QAAQ,EAAE,CAAC;QACjB,KAAK,4BAAoB,CAAC,QAAQ;YAChC,kBAAkB,GAAG,gBAAgB,CAAC;YACtC,MAAM;QACR,KAAK,4BAAoB,CAAC,WAAW;YACnC,kBAAkB,GAAG,mBAAmB,CAAC;YACzC,EAAE,CAAC,KAAK,CAAC,GAAG,MAAM,CAAC;YACnB,MAAM;QACR,KAAK,4BAAoB,CAAC,MAAM;YAC9B,kBAAkB,GAAG,cAAc,CAAC;YACpC,MAAM;QACR,KA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AAG,CAAC,CAAC;IAC1B,GAAG,CAAC;QACF,MAAM,OAAO,GAAwB;YACnC,MAAM,EAAE,KAAK;YACb,GAAG,EAAE,GAAG,MAAM,IAAI,QAAQ,OAAO;YACjC,EAAE,EAAE;gBACF,GAAG,EAAE;gBACL,MAAM;gBACN,KAAK;aACN;YACD,IAAI,EAAE,IAAI;SACX,CAAC;QAEF,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,6BAA6B,CAAC,IAAI,CACrE,IAAI,EACJ,UAAU,EACV,OAAO,CACR,CAAC;QAEF,WAAW,CAAC,IAAI,CAAC,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC;QACzC,iBAAiB,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC;QAC/C,MAAM,IAAI,iBAAiB,CAAC;IAC9B,CAAC,QAAQ,iBAAiB,IAAI,KAAK,IAAI,SAAS,EAAE;IAElD,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,eAAe,QAAQ,IAAI,WAAW,CAAC,MAAM,QAAQ,CAAC,CAAC;IAEzE,MAAM,MAAM,GAAQ,EAAE,CAAC;IACvB,MAAM,CAAC,QAAQ,CAAC,GAAG,WAAW,CAAC;IAC/B,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.processGetOneOperation = processGetOneOperation;
|
|
4
|
+
const SanitizeDomain_1 = require("../utils/SanitizeDomain");
|
|
5
|
+
async function processGetOneOperation(resource, itemIndex) {
|
|
6
|
+
const credentials = await this.getCredentials('easy8Api');
|
|
7
|
+
const domain = (0, SanitizeDomain_1.sanitizeDomain)(credentials.domain);
|
|
8
|
+
const id = this.getNodeParameter('id', itemIndex);
|
|
9
|
+
const options = {
|
|
10
|
+
method: 'GET',
|
|
11
|
+
url: `${domain}/${resource}/${id}.json`,
|
|
12
|
+
json: true,
|
|
13
|
+
};
|
|
14
|
+
this.logger.debug(`Get one ${resource} with ${JSON.stringify(options)}`);
|
|
15
|
+
return await this.helpers.httpRequestWithAuthentication.call(this, 'easy8Api', options);
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=GetOneOperation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GetOneOperation.js","sourceRoot":"","sources":["../../../../nodes/Easy8/operations/GetOneOperation.ts"],"names":[],"mappings":";;AAIA,wDAkBC;AApBD,4DAAyD;AAElD,KAAK,UAAU,sBAAsB,CAE1C,QAA8B,EAC9B,SAAiB;IAEjB,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC;IAC1D,MAAM,MAAM,GAAG,IAAA,+BAAc,EAAC,WAAW,CAAC,MAAgB,CAAC,CAAC;IAC5D,MAAM,EAAE,GAAG,IAAI,CAAC,gBAAgB,CAAC,IAAI,EAAE,SAAS,CAAW,CAAC;IAE5D,MAAM,OAAO,GAAwB;QACnC,MAAM,EAAE,KAAK;QACb,GAAG,EAAE,GAAG,MAAM,IAAI,QAAQ,IAAI,EAAE,OAAO;QACvC,IAAI,EAAE,IAAI;KACX,CAAC;IAEF,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,WAAW,QAAQ,SAAS,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;IAEzE,OAAO,MAAM,IAAI,CAAC,OAAO,CAAC,6BAA6B,CAAC,IAAI,CAAC,IAAI,EAAE,UAAU,EAAE,OAAO,CAAC,CAAC;AAC1F,CAAC"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { BaseIssueOptions } from './BaseModel';
|
|
2
|
+
export interface CustomField {
|
|
3
|
+
id: number;
|
|
4
|
+
value: string;
|
|
5
|
+
}
|
|
6
|
+
export type IssueUpdateOptions = BaseIssueOptions & {
|
|
7
|
+
subject: string | undefined;
|
|
8
|
+
};
|
|
9
|
+
export interface LeadUpdateOptions {
|
|
10
|
+
description: string | undefined;
|
|
11
|
+
companyName: string | undefined;
|
|
12
|
+
customFields: {
|
|
13
|
+
field: CustomField[];
|
|
14
|
+
} | undefined;
|
|
15
|
+
}
|
|
16
|
+
export interface OpportunityUpdateOptions {
|
|
17
|
+
name: string | undefined;
|
|
18
|
+
description: string | undefined;
|
|
19
|
+
statusId: number | undefined;
|
|
20
|
+
assignedToId: number | undefined;
|
|
21
|
+
externalAssignedToId: number | undefined;
|
|
22
|
+
price: number | undefined;
|
|
23
|
+
contractDate: string | undefined;
|
|
24
|
+
projectId: number | undefined;
|
|
25
|
+
customFields: {
|
|
26
|
+
field: CustomField[];
|
|
27
|
+
} | undefined;
|
|
28
|
+
}
|
|
29
|
+
export interface AccountUpdateOptions {
|
|
30
|
+
firstname: string | undefined;
|
|
31
|
+
industryId: number | undefined;
|
|
32
|
+
typeId: number | undefined;
|
|
33
|
+
customFields: {
|
|
34
|
+
field: CustomField[];
|
|
35
|
+
} | undefined;
|
|
36
|
+
assignedToId: number | undefined;
|
|
37
|
+
externalAssignedToId: number | undefined;
|
|
38
|
+
contactStatusId: number | undefined;
|
|
39
|
+
contactLevelId: number | undefined;
|
|
40
|
+
authorId: number | undefined;
|
|
41
|
+
accountOpened: string | undefined;
|
|
42
|
+
accountClosed: string | undefined;
|
|
43
|
+
customerLeftReasonId: number | undefined;
|
|
44
|
+
}
|
|
45
|
+
export interface AttendanceUpdateOptions {
|
|
46
|
+
arrival: string | undefined;
|
|
47
|
+
departure: string | undefined;
|
|
48
|
+
description: string | undefined;
|
|
49
|
+
activityId: string | undefined;
|
|
50
|
+
}
|
|
51
|
+
export interface PersonalContactUpdateOptions {
|
|
52
|
+
partnerId: number | undefined;
|
|
53
|
+
accountId: number | undefined;
|
|
54
|
+
firstname: string | undefined;
|
|
55
|
+
lastname: string | undefined;
|
|
56
|
+
email: string | undefined;
|
|
57
|
+
jobTitle: string | undefined;
|
|
58
|
+
customFields: {
|
|
59
|
+
field: CustomField[];
|
|
60
|
+
} | undefined;
|
|
61
|
+
}
|
|
62
|
+
export interface TimeEntryUpdateOptions {
|
|
63
|
+
hours: number | undefined;
|
|
64
|
+
comment: string | undefined;
|
|
65
|
+
spentOn: string | undefined;
|
|
66
|
+
projectId: number | undefined;
|
|
67
|
+
activityId: number | undefined;
|
|
68
|
+
userId: number | undefined;
|
|
69
|
+
customFields: {
|
|
70
|
+
field: CustomField[];
|
|
71
|
+
} | undefined;
|
|
72
|
+
}
|
|
73
|
+
export interface UserUpdateOptions {
|
|
74
|
+
login: string | undefined;
|
|
75
|
+
firstname: string | undefined;
|
|
76
|
+
lastname: string | undefined;
|
|
77
|
+
mail: string | undefined;
|
|
78
|
+
phone: string | undefined;
|
|
79
|
+
customFields: {
|
|
80
|
+
field: CustomField[];
|
|
81
|
+
} | undefined;
|
|
82
|
+
}
|
|
83
|
+
export type UpdateOptionsWithCustomFields = AccountUpdateOptions | IssueUpdateOptions | LeadUpdateOptions | OpportunityUpdateOptions | PersonalContactUpdateOptions | TimeEntryUpdateOptions | UserUpdateOptions;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UpdateModel.js","sourceRoot":"","sources":["../../../../nodes/Easy8/operations/UpdateModel.ts"],"names":[],"mappings":""}
|