@mspcopilot/n8n-nodes-connectwise 0.1.1
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 +59 -0
- package/dist-community/LICENSE.md +21 -0
- package/dist-community/credentials/ConnectWisePsaApi.credentials.js +142 -0
- package/dist-community/credentials/connectwise.svg +1 -0
- package/dist-community/nodes/ConnectWise/PSA/ConnectWisePsa.node.js +180 -0
- package/dist-community/nodes/ConnectWise/PSA/connectwise.svg +1 -0
- package/dist-community/nodes/ConnectWise/PSA/descriptions/common.descriptions.js +46 -0
- package/dist-community/nodes/ConnectWise/PSA/descriptions/common.properties.js +353 -0
- package/dist-community/nodes/ConnectWise/PSA/descriptions/index.js +30 -0
- package/dist-community/nodes/ConnectWise/PSA/helpers/customFields.js +116 -0
- package/dist-community/nodes/ConnectWise/PSA/helpers/field-collector.js +83 -0
- package/dist-community/nodes/ConnectWise/PSA/helpers/field-conditions.js +86 -0
- package/dist-community/nodes/ConnectWise/PSA/helpers/index.js +33 -0
- package/dist-community/nodes/ConnectWise/PSA/helpers/logging.js +61 -0
- package/dist-community/nodes/ConnectWise/PSA/helpers/utils.js +128 -0
- package/dist-community/nodes/ConnectWise/PSA/methods/fieldOptions.js +223 -0
- package/dist-community/nodes/ConnectWise/PSA/methods/generated.js +53 -0
- package/dist-community/nodes/ConnectWise/PSA/methods/index.js +40 -0
- package/dist-community/nodes/ConnectWise/PSA/schema/converter/index.js +66 -0
- package/dist-community/nodes/ConnectWise/PSA/schema/converter/reference.generator.js +178 -0
- package/dist-community/nodes/ConnectWise/PSA/schema/index.js +39 -0
- package/dist-community/nodes/ConnectWise/PSA/schema/references.js +293 -0
- package/dist-community/nodes/ConnectWise/PSA/schema/reports-descriptions.js +300 -0
- package/dist-community/nodes/ConnectWise/PSA/schema/resources/activity.schema.js +413 -0
- package/dist-community/nodes/ConnectWise/PSA/schema/resources/alert-consolidation.js +42 -0
- package/dist-community/nodes/ConnectWise/PSA/schema/resources/company.schema.js +720 -0
- package/dist-community/nodes/ConnectWise/PSA/schema/resources/contact.schema.js +461 -0
- package/dist-community/nodes/ConnectWise/PSA/schema/resources/custom.schema.js +163 -0
- package/dist-community/nodes/ConnectWise/PSA/schema/resources/index.js +72 -0
- package/dist-community/nodes/ConnectWise/PSA/schema/resources/members.schema.js +361 -0
- package/dist-community/nodes/ConnectWise/PSA/schema/resources/reports.schema.js +177 -0
- package/dist-community/nodes/ConnectWise/PSA/schema/resources/ticket.schema.js +983 -0
- package/dist-community/nodes/ConnectWise/PSA/schema/resources/ticketNote.schema.js +289 -0
- package/dist-community/nodes/ConnectWise/PSA/schema/resources/timeEntry.schema.js +407 -0
- package/dist-community/nodes/ConnectWise/PSA/schema/static-fields.js +1813 -0
- package/dist-community/nodes/ConnectWise/PSA/schema/transformer.js +126 -0
- package/dist-community/nodes/ConnectWise/PSA/schema/types/index.js +33 -0
- package/dist-community/nodes/ConnectWise/PSA/schema/types/reference.types.js +23 -0
- package/dist-community/nodes/ConnectWise/PSA/schema/types/resource.types.js +23 -0
- package/dist-community/nodes/ConnectWise/PSA/transport/cache.js +81 -0
- package/dist-community/nodes/ConnectWise/PSA/transport/client.js +200 -0
- package/dist-community/nodes/ConnectWise/PSA/transport/index.js +105 -0
- package/dist-community/nodes/ConnectWise/PSA/transport/operations.js +167 -0
- package/dist-community/nodes/ConnectWise/PSA/transport/response-transformer.js +123 -0
- package/dist-community/nodes/ConnectWise/PSA/transport/version-check.js +128 -0
- package/dist-community/nodes/ConnectWise/PSA/types/n8n-augmentation.d.js +1 -0
- package/dist-community/nodes/ConnectWisePsa.node.json +25 -0
- package/docs/assets/screenshots/create-ticket.png +0 -0
- package/docs/assets/screenshots/field-list.png +0 -0
- package/docs/assets/screenshots/field-sort.png +0 -0
- package/index.js +0 -0
- package/package.json +73 -0
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
|
|
9
|
+
var __export = (target, all) => {
|
|
10
|
+
for (var name in all) __defProp(target, name, {
|
|
11
|
+
get: all[name],
|
|
12
|
+
enumerable: !0
|
|
13
|
+
});
|
|
14
|
+
}, __copyProps = (to, from, except, desc) => {
|
|
15
|
+
if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
|
|
16
|
+
get: () => from[key],
|
|
17
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
18
|
+
});
|
|
19
|
+
return to;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
23
|
+
value: !0
|
|
24
|
+
}), mod);
|
|
25
|
+
|
|
26
|
+
var reference_generator_exports = {};
|
|
27
|
+
|
|
28
|
+
__export(reference_generator_exports, {
|
|
29
|
+
generateLoadOptionsMethod: () => generateLoadOptionsMethod,
|
|
30
|
+
generateSearchMethod: () => generateSearchMethod,
|
|
31
|
+
loadOptionsConnectWise: () => loadOptionsConnectWise,
|
|
32
|
+
searchConnectWise: () => searchConnectWise
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
module.exports = __toCommonJS(reference_generator_exports);
|
|
36
|
+
|
|
37
|
+
var import_transport = require("../../transport"), import_references = require("../references"), import_reports_descriptions = require("../reports-descriptions");
|
|
38
|
+
|
|
39
|
+
const NOT_SPECIFIED_VALUE = "", NOT_SPECIFIED_DISPLAY = " ";
|
|
40
|
+
|
|
41
|
+
function getNestedProperty(obj, path) {
|
|
42
|
+
if (!obj || !path) return;
|
|
43
|
+
const keys = path.split("/");
|
|
44
|
+
let current = obj;
|
|
45
|
+
for (const key of keys) {
|
|
46
|
+
if (current == null || typeof current != "object") return;
|
|
47
|
+
current = current[key];
|
|
48
|
+
}
|
|
49
|
+
return current;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function applyReferenceDefaults(config) {
|
|
53
|
+
const displayField = config.displayField || "name";
|
|
54
|
+
return {
|
|
55
|
+
...config,
|
|
56
|
+
displayField: displayField,
|
|
57
|
+
valueField: config.valueField || "id",
|
|
58
|
+
pageSize: config.pageSize ?? 100,
|
|
59
|
+
orderBy: config.orderBy
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
async function loadOptionsCore(config, referenceKey) {
|
|
64
|
+
const configWithDefaults = applyReferenceDefaults(config);
|
|
65
|
+
let allParams = {};
|
|
66
|
+
try {
|
|
67
|
+
const currentParams = this.getCurrentNodeParameters();
|
|
68
|
+
if (currentParams && typeof currentParams == "object") for (const [key, value] of Object.entries(currentParams)) if (typeof value == "object" && value !== null && !Array.isArray(value)) {
|
|
69
|
+
allParams[key] = value;
|
|
70
|
+
for (const [fieldKey, fieldValue] of Object.entries(value)) allParams[fieldKey] = fieldValue;
|
|
71
|
+
} else allParams[key] = value;
|
|
72
|
+
} catch (e) {
|
|
73
|
+
console.error("Error getting parameters:", e);
|
|
74
|
+
}
|
|
75
|
+
const queryParams = {};
|
|
76
|
+
if (queryParams.pageSize = configWithDefaults.pageSize, configWithDefaults.orderBy ? queryParams.orderBy = configWithDefaults.orderBy : configWithDefaults.fields === void 0 && (queryParams.orderBy = "name"),
|
|
77
|
+
configWithDefaults.fields !== void 0) configWithDefaults.fields !== "" && (queryParams.fields = configWithDefaults.fields); else if (typeof configWithDefaults.displayField == "string") {
|
|
78
|
+
const fieldsToRequest = /* @__PURE__ */ new Set;
|
|
79
|
+
if (fieldsToRequest.add(configWithDefaults.valueField), fieldsToRequest.add(configWithDefaults.displayField),
|
|
80
|
+
configWithDefaults.descriptionField && fieldsToRequest.add(configWithDefaults.descriptionField),
|
|
81
|
+
configWithDefaults.orderBy) {
|
|
82
|
+
const orderByField = configWithDefaults.orderBy.split(" ")[0];
|
|
83
|
+
fieldsToRequest.add(orderByField);
|
|
84
|
+
}
|
|
85
|
+
queryParams.fields = Array.from(fieldsToRequest).join(",");
|
|
86
|
+
}
|
|
87
|
+
if (configWithDefaults.conditions) {
|
|
88
|
+
const conditions = configWithDefaults.conditions(allParams);
|
|
89
|
+
conditions && (queryParams.conditions = conditions);
|
|
90
|
+
}
|
|
91
|
+
let endpoint;
|
|
92
|
+
if (typeof configWithDefaults.endpoint == "function") {
|
|
93
|
+
endpoint = configWithDefaults.endpoint(allParams);
|
|
94
|
+
const serviceBoardsMatch = endpoint.match(/^\/service\/boards\/([^\/]+)/);
|
|
95
|
+
if (serviceBoardsMatch) {
|
|
96
|
+
const boardId = serviceBoardsMatch[1];
|
|
97
|
+
if (isNaN(Number(boardId))) return [ {
|
|
98
|
+
name: "Cannot Lookup by Name, Use Expression to Specify Value",
|
|
99
|
+
value: NOT_SPECIFIED_VALUE
|
|
100
|
+
} ];
|
|
101
|
+
}
|
|
102
|
+
} else endpoint = configWithDefaults.endpoint;
|
|
103
|
+
const items = await import_transport.connectWiseApiRequest.call(this, "GET", endpoint, {}, queryParams, {
|
|
104
|
+
returnAll: !1,
|
|
105
|
+
limit: configWithDefaults.pageSize,
|
|
106
|
+
optionsCache: !0
|
|
107
|
+
});
|
|
108
|
+
!configWithDefaults.orderBy && items.length > 0 && items.sort((a, b) => {
|
|
109
|
+
let aValue, bValue;
|
|
110
|
+
return typeof configWithDefaults.displayField == "function" ? (aValue = configWithDefaults.displayField(a) || "",
|
|
111
|
+
bValue = configWithDefaults.displayField(b) || "") : (aValue = a[configWithDefaults.displayField] || "",
|
|
112
|
+
bValue = b[configWithDefaults.displayField] || ""), aValue.toString().toLowerCase().localeCompare(bValue.toString().toLowerCase());
|
|
113
|
+
});
|
|
114
|
+
let options = items.map(item => {
|
|
115
|
+
const option = {
|
|
116
|
+
name: typeof configWithDefaults.displayField == "function" ? configWithDefaults.displayField(item) : item[configWithDefaults.displayField],
|
|
117
|
+
value: item[configWithDefaults.valueField]
|
|
118
|
+
};
|
|
119
|
+
return configWithDefaults.descriptionField && (option.description = getNestedProperty(item, configWithDefaults.descriptionField)),
|
|
120
|
+
referenceKey === "system_reports" && import_reports_descriptions.reportDescriptions[option.value] && (option.description = import_reports_descriptions.reportDescriptions[option.value]),
|
|
121
|
+
option;
|
|
122
|
+
});
|
|
123
|
+
if (referenceKey === "system_reports") {
|
|
124
|
+
const reportOrder = Object.keys(import_reports_descriptions.reportDescriptions);
|
|
125
|
+
options.sort((a, b) => {
|
|
126
|
+
const indexA = reportOrder.indexOf(a.value), indexB = reportOrder.indexOf(b.value);
|
|
127
|
+
return indexA !== -1 && indexB !== -1 ? indexA - indexB : indexA !== -1 ? -1 : indexB !== -1 ? 1 : a.name.localeCompare(b.name);
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
const infoFields = options.filter(opt => typeof opt.value == "string" && opt.value.includes("_info"));
|
|
131
|
+
return options = [ ...options.filter(opt => !(typeof opt.value == "string" && opt.value.includes("_info"))), ...infoFields ],
|
|
132
|
+
options.unshift({
|
|
133
|
+
name: NOT_SPECIFIED_DISPLAY,
|
|
134
|
+
value: NOT_SPECIFIED_VALUE
|
|
135
|
+
}), options;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
async function loadOptionsConnectWise(referenceKey) {
|
|
139
|
+
const config = import_references.allReferences[referenceKey];
|
|
140
|
+
if (!config) throw new Error(`Unknown reference: ${referenceKey}`);
|
|
141
|
+
return loadOptionsCore.call(this, config, referenceKey);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
async function searchConnectWise(referenceKey, filter) {
|
|
145
|
+
const config = import_references.allReferences[referenceKey];
|
|
146
|
+
if (!config) throw new Error(`Unknown reference: ${referenceKey}`);
|
|
147
|
+
let conditions;
|
|
148
|
+
filter && config.searchConditions && (conditions = config.searchConditions(filter));
|
|
149
|
+
const searchConfig = {
|
|
150
|
+
...config,
|
|
151
|
+
conditions: params => {
|
|
152
|
+
const baseConditions = config.conditions ? config.conditions(params) : "";
|
|
153
|
+
return conditions && baseConditions ? `${baseConditions} and ${conditions}` : conditions || baseConditions;
|
|
154
|
+
}
|
|
155
|
+
};
|
|
156
|
+
return {
|
|
157
|
+
results: await loadOptionsCore.call(this, searchConfig, referenceKey)
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
function generateLoadOptionsMethod(referenceKey) {
|
|
162
|
+
return async function() {
|
|
163
|
+
return loadOptionsConnectWise.call(this, referenceKey);
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
function generateSearchMethod(referenceKey) {
|
|
168
|
+
return async function(filter) {
|
|
169
|
+
return searchConnectWise.call(this, referenceKey, filter);
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
0 && (module.exports = {
|
|
174
|
+
generateLoadOptionsMethod: generateLoadOptionsMethod,
|
|
175
|
+
generateSearchMethod: generateSearchMethod,
|
|
176
|
+
loadOptionsConnectWise: loadOptionsConnectWise,
|
|
177
|
+
searchConnectWise: searchConnectWise
|
|
178
|
+
});
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
|
|
11
|
+
get: () => from[key],
|
|
12
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
13
|
+
});
|
|
14
|
+
return to;
|
|
15
|
+
}, __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"),
|
|
16
|
+
secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
17
|
+
|
|
18
|
+
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
19
|
+
value: !0
|
|
20
|
+
}), mod);
|
|
21
|
+
|
|
22
|
+
var schema_exports = {};
|
|
23
|
+
|
|
24
|
+
module.exports = __toCommonJS(schema_exports);
|
|
25
|
+
|
|
26
|
+
__reExport(schema_exports, require("./types"), module.exports);
|
|
27
|
+
|
|
28
|
+
__reExport(schema_exports, require("./resources"), module.exports);
|
|
29
|
+
|
|
30
|
+
__reExport(schema_exports, require("./references"), module.exports);
|
|
31
|
+
|
|
32
|
+
__reExport(schema_exports, require("./converter"), module.exports);
|
|
33
|
+
|
|
34
|
+
0 && (module.exports = {
|
|
35
|
+
...require("./types"),
|
|
36
|
+
...require("./resources"),
|
|
37
|
+
...require("./references"),
|
|
38
|
+
...require("./converter")
|
|
39
|
+
});
|
|
@@ -0,0 +1,293 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
|
|
9
|
+
var __export = (target, all) => {
|
|
10
|
+
for (var name in all) __defProp(target, name, {
|
|
11
|
+
get: all[name],
|
|
12
|
+
enumerable: !0
|
|
13
|
+
});
|
|
14
|
+
}, __copyProps = (to, from, except, desc) => {
|
|
15
|
+
if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
|
|
16
|
+
get: () => from[key],
|
|
17
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
18
|
+
});
|
|
19
|
+
return to;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
23
|
+
value: !0
|
|
24
|
+
}), mod);
|
|
25
|
+
|
|
26
|
+
var references_exports = {};
|
|
27
|
+
|
|
28
|
+
__export(references_exports, {
|
|
29
|
+
allReferences: () => allReferences
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
module.exports = __toCommonJS(references_exports);
|
|
33
|
+
|
|
34
|
+
const allReferences = {
|
|
35
|
+
company_companies_statuses: {
|
|
36
|
+
endpoint: "/company/companies/statuses"
|
|
37
|
+
},
|
|
38
|
+
company_companies_types: {
|
|
39
|
+
endpoint: "/company/companies/types"
|
|
40
|
+
},
|
|
41
|
+
company_companies: {
|
|
42
|
+
endpoint: "/company/companies",
|
|
43
|
+
descriptionField: "identifier",
|
|
44
|
+
searchConditions: filter => `(name contains "${filter}" or identifier contains "${filter}")`,
|
|
45
|
+
conditions: () => "deletedFlag=false",
|
|
46
|
+
fields: "id,name,identifier",
|
|
47
|
+
pageSize: 300,
|
|
48
|
+
orderBy: "_info/lastUpdated desc"
|
|
49
|
+
},
|
|
50
|
+
company_countries: {
|
|
51
|
+
endpoint: "/company/countries"
|
|
52
|
+
},
|
|
53
|
+
company_states: {
|
|
54
|
+
endpoint: "/company/states",
|
|
55
|
+
displayField: item => `${item.identifier} - ${item.name}`,
|
|
56
|
+
valueField: "identifier",
|
|
57
|
+
conditions: params => params.country ? `country/id=${params.country}` : "",
|
|
58
|
+
fields: "id,identifier,name"
|
|
59
|
+
},
|
|
60
|
+
company_contacts: {
|
|
61
|
+
endpoint: "/company/contacts",
|
|
62
|
+
displayField: item => `${item?.firstName || ""} ${item?.lastName || ""}`.trim(),
|
|
63
|
+
descriptionField: "title",
|
|
64
|
+
conditions: params => {
|
|
65
|
+
const baseConditions = "inactiveFlag=false";
|
|
66
|
+
return params.company ? `${baseConditions} and company/id=${params.company}` : baseConditions;
|
|
67
|
+
},
|
|
68
|
+
searchConditions: filter => {
|
|
69
|
+
if (!filter) return "";
|
|
70
|
+
const terms = filter.trim().split(/\s+/);
|
|
71
|
+
return `(${[ "firstName", "lastName" ].map(field => terms.map(term => `${field} contains "${term}"`).join(" and ")).join(" or ")})`;
|
|
72
|
+
},
|
|
73
|
+
fields: "id,firstName,lastName,title"
|
|
74
|
+
},
|
|
75
|
+
company_sicCodes: {
|
|
76
|
+
endpoint: "/company/sicCodes",
|
|
77
|
+
displayField: item => `${item.code} - ${item.description}`,
|
|
78
|
+
orderBy: "code",
|
|
79
|
+
fields: "id,code,description"
|
|
80
|
+
},
|
|
81
|
+
company_ownershipTypes: {
|
|
82
|
+
endpoint: "/company/ownershipTypes"
|
|
83
|
+
},
|
|
84
|
+
company_marketDescriptions: {
|
|
85
|
+
endpoint: "/company/marketDescriptions"
|
|
86
|
+
},
|
|
87
|
+
company_entityTypes: {
|
|
88
|
+
endpoint: "/company/entityTypes"
|
|
89
|
+
},
|
|
90
|
+
company_configurations_types: {
|
|
91
|
+
endpoint: "/company/configurations/types",
|
|
92
|
+
conditions: () => "inactiveFlag=false"
|
|
93
|
+
},
|
|
94
|
+
finance_taxCodes: {
|
|
95
|
+
endpoint: "/finance/taxCodes",
|
|
96
|
+
displayField: item => item.description || item.identifier,
|
|
97
|
+
descriptionField: "invoiceCaption",
|
|
98
|
+
orderBy: "description",
|
|
99
|
+
fields: "id,description,identifier,invoiceCaption",
|
|
100
|
+
conditions: params => {
|
|
101
|
+
const baseCondition = `(cancelDate>[${/* @__PURE__ */ (new Date).toISOString().split("T")[0]}] or cancelDate=null)`;
|
|
102
|
+
return params.country ? `${baseCondition} and country/id=${params.country}` : baseCondition;
|
|
103
|
+
}
|
|
104
|
+
},
|
|
105
|
+
finance_currencies: {
|
|
106
|
+
endpoint: "/finance/currencies",
|
|
107
|
+
displayField: item => `${item.name} (${item.currencyIdentifier})`,
|
|
108
|
+
fields: "id,name,currencyIdentifier"
|
|
109
|
+
},
|
|
110
|
+
finance_billingTerms: {
|
|
111
|
+
endpoint: "/finance/billingTerms"
|
|
112
|
+
},
|
|
113
|
+
finance_invoiceTemplates: {
|
|
114
|
+
endpoint: "/finance/invoiceTemplates"
|
|
115
|
+
},
|
|
116
|
+
finance_invoiceDeliveryMethods: {
|
|
117
|
+
endpoint: "/finance/deliveryMethods"
|
|
118
|
+
},
|
|
119
|
+
system_timeZoneSetups: {
|
|
120
|
+
endpoint: "/system/timeZoneSetups",
|
|
121
|
+
fields: ""
|
|
122
|
+
},
|
|
123
|
+
system_locations: {
|
|
124
|
+
endpoint: "/system/locations"
|
|
125
|
+
},
|
|
126
|
+
system_members: {
|
|
127
|
+
endpoint: "/system/members",
|
|
128
|
+
displayField: item => `${item?.firstName || ""} ${item?.lastName || ""}`.trim(),
|
|
129
|
+
descriptionField: "identifier",
|
|
130
|
+
searchConditions: filter => {
|
|
131
|
+
if (!filter) return "";
|
|
132
|
+
const terms = filter.trim().split(/\s+/);
|
|
133
|
+
return `(${[ "firstName", "lastName", "identifier", "officeEmail", "primaryEmail" ].map(field => terms.map(term => `${field} contains "${term}"`).join(" and ")).join(" or ")})`;
|
|
134
|
+
},
|
|
135
|
+
fields: "id,identifier,firstName,lastName",
|
|
136
|
+
orderBy: "identifier",
|
|
137
|
+
conditions: () => 'inactiveFlag=false and licenseClass="F"'
|
|
138
|
+
},
|
|
139
|
+
system_timeZones: {
|
|
140
|
+
endpoint: "/system/timeZones",
|
|
141
|
+
displayField: item => `${item.name} (${item.offset || ""})${item.defaultFlag ? " (default)" : ""}`,
|
|
142
|
+
descriptionField: "offset",
|
|
143
|
+
fields: "id,name,offset,daylightSavingsFlag,defaultFlag"
|
|
144
|
+
},
|
|
145
|
+
schedule_calendars: {
|
|
146
|
+
endpoint: "/schedule/calendars",
|
|
147
|
+
descriptionField: "holidayList/name",
|
|
148
|
+
fields: "id,name,holidayList/name"
|
|
149
|
+
},
|
|
150
|
+
procurement_pricingSchedules: {
|
|
151
|
+
endpoint: "/procurement/pricingSchedules"
|
|
152
|
+
},
|
|
153
|
+
sales_activities_types: {
|
|
154
|
+
endpoint: "/sales/activities/types"
|
|
155
|
+
},
|
|
156
|
+
sales_activities_statuses: {
|
|
157
|
+
endpoint: "/sales/activities/statuses"
|
|
158
|
+
},
|
|
159
|
+
schedule_statuses: {
|
|
160
|
+
endpoint: "/schedule/statuses"
|
|
161
|
+
},
|
|
162
|
+
schedule_reminderTimes: {
|
|
163
|
+
endpoint: "/schedule/reminderTimes"
|
|
164
|
+
},
|
|
165
|
+
service_locations: {
|
|
166
|
+
endpoint: "/service/locations"
|
|
167
|
+
},
|
|
168
|
+
finance_agreements: {
|
|
169
|
+
endpoint: "/finance/agreements",
|
|
170
|
+
displayField: item => `${item.name} (${item.type?.name || "Unknown"})`,
|
|
171
|
+
conditions: params => {
|
|
172
|
+
const baseConditions = 'agreementStatus="Active" and cancelledFlag=false';
|
|
173
|
+
return params.company ? `${baseConditions} and company/id=${params.company}` : baseConditions;
|
|
174
|
+
},
|
|
175
|
+
searchConditions: filter => `name contains "${filter}"`,
|
|
176
|
+
fields: "id,name,type/name",
|
|
177
|
+
orderBy: "name"
|
|
178
|
+
},
|
|
179
|
+
sales_opportunities: {
|
|
180
|
+
endpoint: "/sales/opportunities",
|
|
181
|
+
displayField: item => `${item.name} - ${item.stage?.name || "Unknown Stage"}`,
|
|
182
|
+
descriptionField: "primarySalesRep/identifier",
|
|
183
|
+
conditions: params => params.company ? `company/id=${params.company}` : "",
|
|
184
|
+
searchConditions: filter => `name contains "${filter}"`,
|
|
185
|
+
fields: "id,name,stage/name,primarySalesRep/identifier",
|
|
186
|
+
orderBy: "name"
|
|
187
|
+
},
|
|
188
|
+
marketing_campaigns: {
|
|
189
|
+
endpoint: "/marketing/campaigns",
|
|
190
|
+
conditions: () => "inactive=false",
|
|
191
|
+
fields: "id,name,status/name",
|
|
192
|
+
orderBy: "name"
|
|
193
|
+
},
|
|
194
|
+
service_boards: {
|
|
195
|
+
endpoint: "/service/boards",
|
|
196
|
+
orderBy: "name",
|
|
197
|
+
conditions: params => {
|
|
198
|
+
const ticketType = params.ticketType, baseConditions = "inactiveFlag=false";
|
|
199
|
+
return ticketType === "project" ? `${baseConditions} and projectFlag=true` : ticketType === "service" ? `${baseConditions} and projectFlag=false` : baseConditions;
|
|
200
|
+
}
|
|
201
|
+
},
|
|
202
|
+
service_priorities: {
|
|
203
|
+
endpoint: "/service/priorities",
|
|
204
|
+
orderBy: "sortOrder"
|
|
205
|
+
},
|
|
206
|
+
service_sources: {
|
|
207
|
+
endpoint: "/service/sources"
|
|
208
|
+
},
|
|
209
|
+
project_projects: {
|
|
210
|
+
endpoint: "/project/projects",
|
|
211
|
+
displayField: item => `${item.name} - ${item.status?.name || "Unknown Status"}`,
|
|
212
|
+
descriptionField: "manager/name",
|
|
213
|
+
searchConditions: filter => `name contains "${filter}"`,
|
|
214
|
+
conditions: params => {
|
|
215
|
+
const baseConditions = "closedFlag=false";
|
|
216
|
+
return params.company ? `${baseConditions} and company/id=${params.company}` : baseConditions;
|
|
217
|
+
},
|
|
218
|
+
fields: "id,name,status/name,manager/name",
|
|
219
|
+
orderBy: "name"
|
|
220
|
+
},
|
|
221
|
+
project_projects_phases: {
|
|
222
|
+
endpoint: params => `/project/projects/${params.project}/phases`,
|
|
223
|
+
displayField: "description",
|
|
224
|
+
descriptionField: "status/name",
|
|
225
|
+
fields: "id,description,status/name",
|
|
226
|
+
orderBy: "description"
|
|
227
|
+
},
|
|
228
|
+
service_boards_statuses: {
|
|
229
|
+
endpoint: params => `/service/boards/${params.board}/statuses`,
|
|
230
|
+
descriptionField: "defaultFlag",
|
|
231
|
+
fields: "id,name,defaultFlag",
|
|
232
|
+
orderBy: "sortOrder"
|
|
233
|
+
},
|
|
234
|
+
service_boards_types: {
|
|
235
|
+
endpoint: params => `/service/boards/${params.board}/types`
|
|
236
|
+
},
|
|
237
|
+
service_boards_subtypes: {
|
|
238
|
+
endpoint: params => `/service/boards/${params.board}/subtypes`
|
|
239
|
+
},
|
|
240
|
+
service_boards_items: {
|
|
241
|
+
endpoint: params => `/service/boards/${params.board}/items`
|
|
242
|
+
},
|
|
243
|
+
time_workRoles: {
|
|
244
|
+
endpoint: "/time/workRoles",
|
|
245
|
+
displayField: item => `${item.name} - $${item.hourlyRate || 0}`,
|
|
246
|
+
conditions: () => "inactiveFlag=false",
|
|
247
|
+
fields: "id,name,hourlyRate"
|
|
248
|
+
},
|
|
249
|
+
time_workTypes: {
|
|
250
|
+
endpoint: "/time/workTypes",
|
|
251
|
+
displayField: item => `${item.name} - ${item.billTime || ""}`,
|
|
252
|
+
conditions: () => "inactiveFlag=false",
|
|
253
|
+
fields: "id,name,billTime"
|
|
254
|
+
},
|
|
255
|
+
time_chargeCodes: {
|
|
256
|
+
endpoint: "/time/chargeCodes",
|
|
257
|
+
displayField: "name",
|
|
258
|
+
conditions: () => "timeEntryFlag=true",
|
|
259
|
+
fields: "id,name"
|
|
260
|
+
},
|
|
261
|
+
company_companies_sites: {
|
|
262
|
+
endpoint: params => `/company/companies/${params.companyId}/sites`,
|
|
263
|
+
displayField: "name",
|
|
264
|
+
valueField: "id",
|
|
265
|
+
orderBy: "name",
|
|
266
|
+
fields: "id,name"
|
|
267
|
+
},
|
|
268
|
+
contact_departments: {
|
|
269
|
+
endpoint: "/company/contacts/departments",
|
|
270
|
+
displayField: "name",
|
|
271
|
+
valueField: "id",
|
|
272
|
+
orderBy: "name",
|
|
273
|
+
fields: "id,name"
|
|
274
|
+
},
|
|
275
|
+
contact_types: {
|
|
276
|
+
endpoint: "/company/contacts/types",
|
|
277
|
+
displayField: "description",
|
|
278
|
+
valueField: "id",
|
|
279
|
+
orderBy: "description",
|
|
280
|
+
fields: "id,description"
|
|
281
|
+
},
|
|
282
|
+
system_reports: {
|
|
283
|
+
endpoint: "/system/reports",
|
|
284
|
+
displayField: "name",
|
|
285
|
+
valueField: "name",
|
|
286
|
+
orderBy: "name",
|
|
287
|
+
fields: "name"
|
|
288
|
+
}
|
|
289
|
+
};
|
|
290
|
+
|
|
291
|
+
0 && (module.exports = {
|
|
292
|
+
allReferences: allReferences
|
|
293
|
+
});
|