connectwise-rest 0.25.1 → 1.0.2
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/.eslintrc +17 -52
- package/.gitattributes +1 -0
- package/.mocharc.json +5 -0
- package/.prettierrc +7 -0
- package/README.md +293 -230
- package/api-extractor.json +364 -0
- package/dist/Automate/AVTemplatePoliciesAPI.d.ts +36 -0
- package/dist/Automate/AVTemplatePoliciesAPI.d.ts.map +1 -0
- package/dist/Automate/AVTemplatePoliciesAPI.js +92 -0
- package/dist/Automate/AVTemplatePoliciesAPI.js.map +1 -0
- package/dist/Automate/ClientsAPI.d.ts +44 -0
- package/dist/Automate/ClientsAPI.d.ts.map +1 -0
- package/dist/Automate/ClientsAPI.js +119 -0
- package/dist/Automate/ClientsAPI.js.map +1 -0
- package/dist/Automate/CommandsAPI.d.ts +20 -0
- package/dist/Automate/CommandsAPI.d.ts.map +1 -0
- package/dist/Automate/CommandsAPI.js +36 -0
- package/dist/Automate/CommandsAPI.js.map +1 -0
- package/dist/Automate/ComputersAPI.d.ts +131 -0
- package/dist/Automate/ComputersAPI.d.ts.map +1 -0
- package/dist/Automate/ComputersAPI.js +358 -0
- package/dist/Automate/ComputersAPI.js.map +1 -0
- package/dist/Automate/ContactsAPI.d.ts +24 -0
- package/dist/Automate/ContactsAPI.d.ts.map +1 -0
- package/dist/Automate/ContactsAPI.js +50 -0
- package/dist/Automate/ContactsAPI.js.map +1 -0
- package/dist/Automate/DataViewsAPI.d.ts +22 -0
- package/dist/Automate/DataViewsAPI.d.ts.map +1 -0
- package/dist/Automate/DataViewsAPI.js +36 -0
- package/dist/Automate/DataViewsAPI.js.map +1 -0
- package/dist/Automate/DrivesAPI.d.ts +25 -0
- package/dist/Automate/DrivesAPI.d.ts.map +1 -0
- package/dist/Automate/DrivesAPI.js +57 -0
- package/dist/Automate/DrivesAPI.js.map +1 -0
- package/dist/Automate/EventLogsAPI.d.ts +19 -0
- package/dist/Automate/EventLogsAPI.d.ts.map +1 -0
- package/dist/Automate/EventLogsAPI.js +29 -0
- package/dist/Automate/EventLogsAPI.js.map +1 -0
- package/dist/Automate/LocationsAPI.d.ts +57 -0
- package/dist/Automate/LocationsAPI.d.ts.map +1 -0
- package/dist/Automate/LocationsAPI.js +138 -0
- package/dist/Automate/LocationsAPI.js.map +1 -0
- package/dist/Automate/MaintenanceWindowDefinitionsAPI.d.ts +19 -0
- package/dist/Automate/MaintenanceWindowDefinitionsAPI.d.ts.map +1 -0
- package/dist/Automate/MaintenanceWindowDefinitionsAPI.js +29 -0
- package/dist/Automate/MaintenanceWindowDefinitionsAPI.js.map +1 -0
- package/dist/Automate/MonitorsAPI.d.ts +29 -0
- package/dist/Automate/MonitorsAPI.d.ts.map +1 -0
- package/dist/Automate/MonitorsAPI.js +85 -0
- package/dist/Automate/MonitorsAPI.js.map +1 -0
- package/dist/Automate/NetworkDevicesAPI.d.ts +23 -0
- package/dist/Automate/NetworkDevicesAPI.d.ts.map +1 -0
- package/dist/Automate/NetworkDevicesAPI.js +43 -0
- package/dist/Automate/NetworkDevicesAPI.js.map +1 -0
- package/dist/Automate/PatchingAPI.d.ts +33 -0
- package/dist/Automate/PatchingAPI.d.ts.map +1 -0
- package/dist/Automate/PatchingAPI.js +99 -0
- package/dist/Automate/PatchingAPI.js.map +1 -0
- package/dist/Automate/RemoteAgentAPI.d.ts +24 -0
- package/dist/Automate/RemoteAgentAPI.d.ts.map +1 -0
- package/dist/Automate/RemoteAgentAPI.js +50 -0
- package/dist/Automate/RemoteAgentAPI.js.map +1 -0
- package/dist/Automate/ScriptingAPI.d.ts +41 -0
- package/dist/Automate/ScriptingAPI.d.ts.map +1 -0
- package/dist/Automate/ScriptingAPI.js +109 -0
- package/dist/Automate/ScriptingAPI.js.map +1 -0
- package/dist/Automate/SearchesAPI.d.ts +23 -0
- package/dist/Automate/SearchesAPI.d.ts.map +1 -0
- package/dist/Automate/SearchesAPI.js +43 -0
- package/dist/Automate/SearchesAPI.js.map +1 -0
- package/dist/Automate/SystemAPI.d.ts +97 -0
- package/dist/Automate/SystemAPI.d.ts.map +1 -0
- package/dist/Automate/SystemAPI.js +273 -0
- package/dist/Automate/SystemAPI.js.map +1 -0
- package/dist/Automate/TicketsAPI.d.ts +14 -0
- package/dist/Automate/TicketsAPI.d.ts.map +1 -0
- package/dist/Automate/TicketsAPI.js +29 -0
- package/dist/Automate/TicketsAPI.js.map +1 -0
- package/dist/Automate/UserProfilesAPI.d.ts +19 -0
- package/dist/Automate/UserProfilesAPI.d.ts.map +1 -0
- package/dist/Automate/UserProfilesAPI.js +28 -0
- package/dist/Automate/UserProfilesAPI.js.map +1 -0
- package/dist/Automate.d.ts +43 -0
- package/dist/Automate.d.ts.map +1 -0
- package/dist/Automate.js +164 -0
- package/dist/Automate.js.map +1 -0
- package/dist/AutomateAPI.d.ts +129 -0
- package/dist/AutomateAPI.d.ts.map +1 -0
- package/dist/AutomateAPI.js +175 -0
- package/dist/AutomateAPI.js.map +1 -0
- package/dist/AutomateTypes.d.ts +10437 -0
- package/dist/AutomateTypes.d.ts.map +1 -0
- package/dist/AutomateTypes.js +3 -0
- package/dist/AutomateTypes.js.map +1 -0
- package/dist/BaseAPI.d.ts +26 -0
- package/dist/BaseAPI.d.ts.map +1 -0
- package/dist/BaseAPI.js +116 -0
- package/dist/BaseAPI.js.map +1 -0
- package/dist/Manage/CompanyAPI.d.ts +662 -0
- package/dist/Manage/CompanyAPI.d.ts.map +1 -0
- package/dist/Manage/CompanyAPI.js +3299 -0
- package/dist/Manage/CompanyAPI.js.map +1 -0
- package/dist/Manage/ConfigurationsAPI.d.ts +32 -0
- package/dist/Manage/ConfigurationsAPI.d.ts.map +1 -0
- package/dist/Manage/ConfigurationsAPI.js +78 -0
- package/dist/Manage/ConfigurationsAPI.js.map +1 -0
- package/dist/Manage/ExpenseAPI.d.ts +85 -0
- package/dist/Manage/ExpenseAPI.d.ts.map +1 -0
- package/dist/Manage/ExpenseAPI.js +311 -0
- package/dist/Manage/ExpenseAPI.js.map +1 -0
- package/dist/Manage/FinanceAPI.d.ts +538 -0
- package/dist/Manage/FinanceAPI.d.ts.map +1 -0
- package/dist/Manage/FinanceAPI.js +2592 -0
- package/dist/Manage/FinanceAPI.js.map +1 -0
- package/dist/Manage/MarketingAPI.d.ts +142 -0
- package/dist/Manage/MarketingAPI.d.ts.map +1 -0
- package/dist/Manage/MarketingAPI.js +634 -0
- package/dist/Manage/MarketingAPI.js.map +1 -0
- package/dist/Manage/ProcurementAPI.d.ts +435 -0
- package/dist/Manage/ProcurementAPI.d.ts.map +1 -0
- package/dist/Manage/ProcurementAPI.js +2103 -0
- package/dist/Manage/ProcurementAPI.js.map +1 -0
- package/dist/Manage/ProjectAPI.d.ts +215 -0
- package/dist/Manage/ProjectAPI.d.ts.map +1 -0
- package/dist/Manage/ProjectAPI.js +945 -0
- package/dist/Manage/ProjectAPI.js.map +1 -0
- package/dist/Manage/SalesAPI.d.ts +299 -0
- package/dist/Manage/SalesAPI.d.ts.map +1 -0
- package/dist/Manage/SalesAPI.js +1397 -0
- package/dist/Manage/SalesAPI.js.map +1 -0
- package/dist/Manage/ScheduleAPI.d.ts +132 -0
- package/dist/Manage/ScheduleAPI.d.ts.map +1 -0
- package/dist/Manage/ScheduleAPI.js +580 -0
- package/dist/Manage/ScheduleAPI.js.map +1 -0
- package/dist/Manage/ServiceAPI.d.ts +493 -0
- package/dist/Manage/ServiceAPI.d.ts.map +1 -0
- package/dist/Manage/ServiceAPI.js +2339 -0
- package/dist/Manage/ServiceAPI.js.map +1 -0
- package/dist/Manage/SystemAPI.d.ts +954 -0
- package/dist/Manage/SystemAPI.d.ts.map +1 -0
- package/dist/Manage/SystemAPI.js +4536 -0
- package/dist/Manage/SystemAPI.js.map +1 -0
- package/dist/Manage/TimeAPI.d.ts +186 -0
- package/dist/Manage/TimeAPI.d.ts.map +1 -0
- package/dist/Manage/TimeAPI.js +840 -0
- package/dist/Manage/TimeAPI.js.map +1 -0
- package/dist/Manage.d.ts +39 -0
- package/dist/Manage.d.ts.map +1 -0
- package/dist/Manage.js +137 -0
- package/dist/Manage.js.map +1 -0
- package/dist/ManageAPI.d.ts +135 -0
- package/dist/ManageAPI.d.ts.map +1 -0
- package/dist/ManageAPI.js +115 -0
- package/dist/ManageAPI.js.map +1 -0
- package/dist/ManageTypes.d.ts +91320 -0
- package/dist/ManageTypes.d.ts.map +1 -0
- package/dist/ManageTypes.js +7 -0
- package/dist/ManageTypes.js.map +1 -0
- package/dist/connectwise-rest.d.ts +108638 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +36 -0
- package/dist/index.js.map +1 -0
- package/dist/tsdoc-metadata.json +11 -0
- package/dist/types.d.ts +48 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +21 -0
- package/dist/types.js.map +1 -0
- package/dist/utils/Callback.d.ts +70 -0
- package/dist/utils/Callback.d.ts.map +1 -0
- package/dist/utils/Callback.js +109 -0
- package/dist/utils/Callback.js.map +1 -0
- package/dist/utils/Series.d.ts +42 -0
- package/dist/utils/Series.d.ts.map +1 -0
- package/dist/utils/Series.js +68 -0
- package/dist/utils/Series.js.map +1 -0
- package/dist/utils/index.d.ts +7 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +11 -0
- package/dist/utils/index.js.map +1 -0
- package/package.json +50 -19
- package/src/Automate/AVTemplatePoliciesAPI.ts +124 -0
- package/src/Automate/ClientsAPI.ts +172 -0
- package/src/Automate/CommandsAPI.ts +39 -0
- package/src/Automate/ComputersAPI.ts +588 -0
- package/src/Automate/ContactsAPI.ts +63 -0
- package/src/Automate/DataViewsAPI.ts +43 -0
- package/src/Automate/DrivesAPI.ts +81 -0
- package/src/Automate/EventLogsAPI.ts +31 -0
- package/src/Automate/LocationsAPI.ts +222 -0
- package/src/Automate/MaintenanceWindowDefinitionsAPI.ts +34 -0
- package/src/Automate/MonitorsAPI.ts +101 -0
- package/src/Automate/NetworkDevicesAPI.ts +51 -0
- package/src/Automate/PatchingAPI.ts +116 -0
- package/src/Automate/RemoteAgentAPI.ts +65 -0
- package/src/Automate/ScriptingAPI.ts +147 -0
- package/src/Automate/SearchesAPI.ts +49 -0
- package/src/Automate/SystemAPI.ts +412 -0
- package/src/Automate/TicketsAPI.ts +29 -0
- package/src/Automate/UserProfilesAPI.ts +31 -0
- package/src/Automate.ts +204 -0
- package/src/AutomateAPI.ts +178 -0
- package/src/AutomateTypes.ts +10492 -0
- package/src/BaseAPI.ts +180 -0
- package/src/Manage/CompanyAPI.ts +4941 -0
- package/src/Manage/ConfigurationsAPI.ts +116 -0
- package/src/Manage/ExpenseAPI.ts +413 -0
- package/src/Manage/FinanceAPI.ts +3930 -0
- package/src/Manage/MarketingAPI.ts +958 -0
- package/src/Manage/ProcurementAPI.ts +3107 -0
- package/src/Manage/ProjectAPI.ts +1437 -0
- package/src/Manage/SalesAPI.ts +1968 -0
- package/src/Manage/ScheduleAPI.ts +773 -0
- package/src/Manage/ServiceAPI.ts +3476 -0
- package/src/Manage/SystemAPI.ts +6415 -0
- package/src/Manage/TimeAPI.ts +1151 -0
- package/src/Manage.ts +161 -0
- package/src/ManageAPI.ts +170 -0
- package/src/ManageTypes.ts +91318 -0
- package/src/index.ts +13 -0
- package/src/types.ts +68 -0
- package/src/utils/Callback.ts +148 -0
- package/src/utils/Series.ts +89 -0
- package/src/utils/index.ts +7 -0
- package/swagger-errors.md +25 -0
- package/test/.env.example +12 -6
- package/test/test-utils.ts +27 -0
- package/test/test.js +331 -108
- package/tsconfig.json +29 -0
- package/.travis.yml +0 -9
- package/doc.md +0 -5984
- package/docs/jsdoc.json +0 -15
- package/index.js +0 -10
- package/src/CompanyAPI/Companies.js +0 -149
- package/src/CompanyAPI/CompanyCompanyTypeAssociations.js +0 -111
- package/src/CompanyAPI/CompanySites.js +0 -80
- package/src/CompanyAPI/CompanyTeams.js +0 -108
- package/src/CompanyAPI/CompanyTypeInfos.js +0 -58
- package/src/CompanyAPI/CompanyTypes.js +0 -52
- package/src/CompanyAPI/Configurations.js +0 -152
- package/src/CompanyAPI/ContactContactTypeAssociations.js +0 -55
- package/src/CompanyAPI/ContactRelationships.js +0 -36
- package/src/CompanyAPI/Contacts.js +0 -199
- package/src/CompanyAPI/index.js +0 -53
- package/src/ConnectWise.js +0 -339
- package/src/ConnectWiseRest.js +0 -515
- package/src/FinanceAPI/Additions.js +0 -127
- package/src/FinanceAPI/Adjustments.js +0 -109
- package/src/FinanceAPI/AgreementSites.js +0 -108
- package/src/FinanceAPI/Agreements.js +0 -220
- package/src/FinanceAPI/BoardDefaults.js +0 -109
- package/src/FinanceAPI/WorkRoles.js +0 -113
- package/src/FinanceAPI/WorkTypeExclusions.js +0 -78
- package/src/FinanceAPI/WorkTypes.js +0 -124
- package/src/FinanceAPI/index.js +0 -50
- package/src/ProcurementAPI/CatalogItems.js +0 -94
- package/src/ProcurementAPI/index.js +0 -22
- package/src/ProjectAPI/Projects.js +0 -142
- package/src/ProjectAPI/index.js +0 -28
- package/src/SalesAPI/Activities.js +0 -149
- package/src/SalesAPI/index.js +0 -14
- package/src/ScheduleAPI/ScheduleEntries.js +0 -109
- package/src/ScheduleAPI/ScheduleTypes.js +0 -101
- package/src/ScheduleAPI/index.js +0 -30
- package/src/ServiceDeskAPI/BoardItems.js +0 -134
- package/src/ServiceDeskAPI/BoardSubTypes.js +0 -112
- package/src/ServiceDeskAPI/BoardTeams.js +0 -108
- package/src/ServiceDeskAPI/BoardTypes.js +0 -139
- package/src/ServiceDeskAPI/Boards.js +0 -100
- package/src/ServiceDeskAPI/Priorities.js +0 -47
- package/src/ServiceDeskAPI/ServiceNotes.js +0 -172
- package/src/ServiceDeskAPI/Statuses.js +0 -116
- package/src/ServiceDeskAPI/Tickets.js +0 -588
- package/src/ServiceDeskAPI/index.js +0 -53
- package/src/SystemAPI/Members.js +0 -139
- package/src/SystemAPI/Reports.js +0 -116
- package/src/SystemAPI/index.js +0 -32
- package/src/TimeAPI/TimeEntries.js +0 -121
- package/src/TimeAPI/index.js +0 -27
- package/src/utils/Callback.js +0 -124
- package/src/utils/Series.js +0 -63
- package/src/utils/index.js +0 -21
package/src/SystemAPI/Members.js
DELETED
|
@@ -1,139 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Created by kgrube on 12/15/2015.
|
|
3
|
-
* @author kgrube
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
*
|
|
8
|
-
* @private
|
|
9
|
-
*/
|
|
10
|
-
const inherits = require('util').inherits;
|
|
11
|
-
const ConnectWise = require('../ConnectWise.js');
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* @typedef {object} Member
|
|
15
|
-
* @property id
|
|
16
|
-
* @property {boolean} adminFlag
|
|
17
|
-
* @property billableForecast
|
|
18
|
-
* @property {CalendarHref} calendar
|
|
19
|
-
* @property {CountryHref} country
|
|
20
|
-
* @property dailyCapacity
|
|
21
|
-
* @property defaultEmail
|
|
22
|
-
* @property {ProjectBoardHref} defaultProjectBoard
|
|
23
|
-
* @property defaultProjectDepartmentId
|
|
24
|
-
* @property defaultProjectLocationId
|
|
25
|
-
* @property defaultSalesLocationId
|
|
26
|
-
* @property defaultScheduleDepartmentId
|
|
27
|
-
* @property defaultScheduleLocationId
|
|
28
|
-
* @property {ServiceBoardHref} defaultServiceBoard
|
|
29
|
-
* @property defaultServiceDepartmentId
|
|
30
|
-
* @property defaultServiceLocationId
|
|
31
|
-
* @property defaultSystemDepartmentId
|
|
32
|
-
* @property defaultSystemLocationId
|
|
33
|
-
* @property {boolean} disableOnlineFlag
|
|
34
|
-
* @property emailAddress
|
|
35
|
-
* @property enableGpsFlag
|
|
36
|
-
* @property enableLdapAuthenticationFlag
|
|
37
|
-
* @property enableMobileFlag
|
|
38
|
-
* @property {MemberHref} expenseApprover
|
|
39
|
-
* @property {string} firstName
|
|
40
|
-
* @property {boolean} hideFromDispatchFlag
|
|
41
|
-
* @property {string} hireDate
|
|
42
|
-
* @property homeEmail
|
|
43
|
-
* @property homeExtension
|
|
44
|
-
* @property homePhone
|
|
45
|
-
* @property identifier
|
|
46
|
-
* @property inactiveDate
|
|
47
|
-
* @property {boolean} inactiveFlag
|
|
48
|
-
* @property lastName
|
|
49
|
-
* @property {string} licenseClass
|
|
50
|
-
* @property middleInitial
|
|
51
|
-
* @property mobileEmail
|
|
52
|
-
* @property mobileExtension
|
|
53
|
-
* @property mobilePhone
|
|
54
|
-
* @property notes
|
|
55
|
-
* @property officeEmail
|
|
56
|
-
* @property officeExtension
|
|
57
|
-
* @property officePhone
|
|
58
|
-
* @property {MemberHref} reportsTo
|
|
59
|
-
* @property restrictDefaultSalesTerritoryFlag
|
|
60
|
-
* @property restrictDefaultWarehouseBinFlag
|
|
61
|
-
* @property restrictDefaultWarehouseFlag
|
|
62
|
-
* @property restrictProjectDefaultDepartmentFlag
|
|
63
|
-
* @property restrictProjectDefaultLocationFlag
|
|
64
|
-
* @property restrictScheduleFlag
|
|
65
|
-
* @property restrictServiceDefaultDepartmentFlag
|
|
66
|
-
* @property restrictServiceDefaultLocationFlag
|
|
67
|
-
* @property scheduleCapacity
|
|
68
|
-
* @property {SecurityRoleHref} securityRole
|
|
69
|
-
* @property securityLevel
|
|
70
|
-
* @property securityLocationId
|
|
71
|
-
* @property serviceLocation
|
|
72
|
-
* @property serviceTeams
|
|
73
|
-
* @property systemRestrictToDefaultDepartmentFlag
|
|
74
|
-
* @property systemRestrictToDefaultLocationFlag
|
|
75
|
-
* @property {MemberHref} timeApprover
|
|
76
|
-
* @property {TimeZoneHref} timeZone
|
|
77
|
-
* @property title
|
|
78
|
-
* @property {MemberTypeHref} type
|
|
79
|
-
* @property vendorNumber
|
|
80
|
-
* @property warehouse
|
|
81
|
-
* @property warehouseBin
|
|
82
|
-
* @property {WorkRoleHref} workRole
|
|
83
|
-
* @property {WorkTypeHref} workType
|
|
84
|
-
* @property {object} _info
|
|
85
|
-
* @property {string} _info.lastUpdated
|
|
86
|
-
* @property {string} _info.updatedBy
|
|
87
|
-
* @property {string} _info.image_href
|
|
88
|
-
*/
|
|
89
|
-
|
|
90
|
-
/**
|
|
91
|
-
*
|
|
92
|
-
* @param {CWOptions} options
|
|
93
|
-
* @constructor
|
|
94
|
-
*/
|
|
95
|
-
function Members(options) {
|
|
96
|
-
ConnectWise.apply(this, Array.prototype.slice.call(arguments));
|
|
97
|
-
}
|
|
98
|
-
inherits(Members, ConnectWise);
|
|
99
|
-
|
|
100
|
-
/**
|
|
101
|
-
* GET
|
|
102
|
-
* @param {Params} params
|
|
103
|
-
* @returns {Promise<Member[]>}
|
|
104
|
-
*/
|
|
105
|
-
Members.prototype.getMembers = function (params) {
|
|
106
|
-
return this.api('/system/members', 'GET', params);
|
|
107
|
-
};
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
/**
|
|
111
|
-
* GET
|
|
112
|
-
* @param {string} identifier
|
|
113
|
-
* @returns {Promise<Member>}
|
|
114
|
-
*/
|
|
115
|
-
Members.prototype.getMemberByIdentifier = function (identifier) {
|
|
116
|
-
return this.api(`/system/members/${identifier}`, 'GET');
|
|
117
|
-
};
|
|
118
|
-
/**
|
|
119
|
-
* Alias for getMemberByIdentifier because I keep spelling it wrong
|
|
120
|
-
* @param identifier
|
|
121
|
-
* @returns {Promise<Member>}
|
|
122
|
-
*/
|
|
123
|
-
Members.prototype.getMemberByIdentifer = Members.prototype.getMemberByIdentifier;
|
|
124
|
-
|
|
125
|
-
/**
|
|
126
|
-
*
|
|
127
|
-
* @param identifier
|
|
128
|
-
* @param {ParamsImage} params
|
|
129
|
-
* @returns {Promise<*>}
|
|
130
|
-
*/
|
|
131
|
-
Members.prototype.getMemberImage = function (identifier, params) {
|
|
132
|
-
return this.api(`/system/members/${identifier}/image`, 'GET', params)
|
|
133
|
-
};
|
|
134
|
-
|
|
135
|
-
/**
|
|
136
|
-
*
|
|
137
|
-
* @type {Members}
|
|
138
|
-
*/
|
|
139
|
-
module.exports = Members;
|
package/src/SystemAPI/Reports.js
DELETED
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Created by kgrube on 12/28/2016.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* @private
|
|
7
|
-
*/
|
|
8
|
-
const inherits = require('util').inherits;
|
|
9
|
-
const ConnectWise = require('../ConnectWise');
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* @typedef {object} ReportNames
|
|
13
|
-
* @property {string} name
|
|
14
|
-
*/
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* row_values is not a keyed array
|
|
18
|
-
* @typedef {object} ReportData
|
|
19
|
-
* @property {object[]} column_definitions
|
|
20
|
-
* @property {Array} row_values mixed types, may be null, string, numeric, etc
|
|
21
|
-
*/
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Key-Vals interpolated into one object per row
|
|
25
|
-
* @typedef {object} ReportDataInterpolated
|
|
26
|
-
*/
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
*
|
|
30
|
-
* @typedef {object} ReportColumn
|
|
31
|
-
* @property {object} ColumnName the key of the object is the name of the column (not ColumnName)
|
|
32
|
-
* @property {boolean} ColumnName.isNullable
|
|
33
|
-
* @property {string} ColumnName.type ['Numeric', 'Text', 'DateTime', 'Boolean']
|
|
34
|
-
*/
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* @param {CWOptions} options
|
|
38
|
-
* @inherits {ConnectWise}
|
|
39
|
-
* @constructor
|
|
40
|
-
*/
|
|
41
|
-
function Reports(options) {
|
|
42
|
-
ConnectWise.apply(this, Array.prototype.slice.call(arguments));
|
|
43
|
-
}
|
|
44
|
-
inherits(Reports, ConnectWise);
|
|
45
|
-
|
|
46
|
-
function reportInterpolate() {
|
|
47
|
-
const data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {column_definitions: [], row_values: []};
|
|
48
|
-
|
|
49
|
-
/* report data comes in like this:
|
|
50
|
-
* {
|
|
51
|
-
* column_definitions: [{ ColumnName: { DataType: 'number', IsNullable: true/false } } ... { ... } ],
|
|
52
|
-
* row_values: [ [1, 2, 'some string', '1900-01-01etc', null, null, false, ... ], [ ... ] ]
|
|
53
|
-
* }
|
|
54
|
-
*/
|
|
55
|
-
|
|
56
|
-
const column_definitions = data.column_definitions;
|
|
57
|
-
const row_values = data.row_values;
|
|
58
|
-
|
|
59
|
-
return row_values.map(function (rowArray) {
|
|
60
|
-
const rowObj = {};
|
|
61
|
-
rowArray.forEach(function (value, idx) {
|
|
62
|
-
const key = Object.keys(column_definitions[idx])[0];
|
|
63
|
-
rowObj[key] = value;
|
|
64
|
-
});
|
|
65
|
-
return rowObj;
|
|
66
|
-
});
|
|
67
|
-
// return an array like: [ { key: value, key2: value2 ... }, ... ]
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
* @param {ParamsConditions} [params]
|
|
72
|
-
* @returns {Promise<ReportNames[]>}
|
|
73
|
-
*/
|
|
74
|
-
Reports.prototype.getReports = function (params) {
|
|
75
|
-
return this.api('/system/reports', 'GET', params);
|
|
76
|
-
};
|
|
77
|
-
|
|
78
|
-
/**
|
|
79
|
-
*
|
|
80
|
-
* @param {string} reportName
|
|
81
|
-
* @param {Params} [params]
|
|
82
|
-
* @param {boolean} [disableInterpolate]
|
|
83
|
-
* @returns {Promise<ReportData[]|ReportDataInterpolated[]>}
|
|
84
|
-
*/
|
|
85
|
-
Reports.prototype.getReport = function (reportName, params, disableInterpolate) {
|
|
86
|
-
return this.api(`/system/reports/${reportName}/`, 'GET', params)
|
|
87
|
-
.then(function (data) {
|
|
88
|
-
if (disableInterpolate) return data;
|
|
89
|
-
return reportInterpolate(data);
|
|
90
|
-
});
|
|
91
|
-
};
|
|
92
|
-
|
|
93
|
-
/**
|
|
94
|
-
*
|
|
95
|
-
* @param {string} reportName
|
|
96
|
-
* @param {ParamsConditions} params
|
|
97
|
-
* @returns {Promise<Count>}
|
|
98
|
-
*/
|
|
99
|
-
Reports.prototype.getReportResultsCount = function (reportName, params) {
|
|
100
|
-
return this.api(`/system/reports/${reportName}/count`, 'GET', params);
|
|
101
|
-
};
|
|
102
|
-
|
|
103
|
-
/**
|
|
104
|
-
*
|
|
105
|
-
* @param reportName
|
|
106
|
-
* @returns {Promise<ReportColumn[]>}
|
|
107
|
-
*/
|
|
108
|
-
Reports.prototype.getColumnDefinitions = function (reportName) {
|
|
109
|
-
return this.api(`/system/reports/${reportName}/columns`, 'GET');
|
|
110
|
-
};
|
|
111
|
-
|
|
112
|
-
/**
|
|
113
|
-
*
|
|
114
|
-
* @type {Reports}
|
|
115
|
-
*/
|
|
116
|
-
module.exports = Reports;
|
package/src/SystemAPI/index.js
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Created by kgrube on 7/14/2016.
|
|
3
|
-
* @author kgrube
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* @typedef {object} SystemAPI
|
|
8
|
-
* @property {Members} Members
|
|
9
|
-
* @property {Reports} Reports
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
*
|
|
14
|
-
* @param {CWOptions} options
|
|
15
|
-
* @returns {SystemAPI}
|
|
16
|
-
* @constructor
|
|
17
|
-
*/
|
|
18
|
-
function SystemAPI(options) {
|
|
19
|
-
const _Members = require('./Members');
|
|
20
|
-
const _Reports = require('./Reports');
|
|
21
|
-
|
|
22
|
-
return {
|
|
23
|
-
Members: new _Members(options),
|
|
24
|
-
Reports: new _Reports(options)
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
*
|
|
30
|
-
* @type {SystemAPI}
|
|
31
|
-
*/
|
|
32
|
-
module.exports = SystemAPI;
|
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Created by kgrube on 12/20/2015.
|
|
3
|
-
* @author kgrube
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* @private
|
|
8
|
-
*/
|
|
9
|
-
const inherits = require('util').inherits;
|
|
10
|
-
const ConnectWise = require('../ConnectWise.js');
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* @typedef {object} TimeEntry
|
|
14
|
-
* @property {number} id
|
|
15
|
-
* @property {CompanyHref} company
|
|
16
|
-
* @property {number} chargeToId
|
|
17
|
-
* @property {string} chargeToType ['ServiceTicket', 'ProjectTicket', 'ChargeCode', 'Activity']
|
|
18
|
-
* @property {MemberHref} member
|
|
19
|
-
* @property {number} locationId
|
|
20
|
-
* @property {number} businessUnitId
|
|
21
|
-
* @property {WorkTypeHref} workType
|
|
22
|
-
* @property {WorkRoleHref} workRole
|
|
23
|
-
* @property {AgreementHref} agreement
|
|
24
|
-
* @property {string} timeStart
|
|
25
|
-
* @property {string} timeEnd
|
|
26
|
-
* @property {number} hoursDeduct
|
|
27
|
-
* @property {number} actualHours
|
|
28
|
-
* @property {string} billableOption ['Billable', 'DoNotBill', 'NoCharge', 'NoDefault']
|
|
29
|
-
* @property {string} notes
|
|
30
|
-
* @property {string} internalNotes
|
|
31
|
-
* @property {boolean} addToDetailDescriptionFlag
|
|
32
|
-
* @property {boolean} addToInternalAnalysisFlag
|
|
33
|
-
* @property {boolean} addToResolutionFlag
|
|
34
|
-
* @property {boolean} emailResourceFlag
|
|
35
|
-
* @property {boolean} emailContactFlag
|
|
36
|
-
* @property {boolean} emailCcFlag
|
|
37
|
-
* @property {string} emailCc
|
|
38
|
-
* @property {number} hoursBilled
|
|
39
|
-
*/
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
*
|
|
43
|
-
* @param options
|
|
44
|
-
* @constructor
|
|
45
|
-
*/
|
|
46
|
-
function TimeEntries(options) {
|
|
47
|
-
ConnectWise.apply(this, Array.prototype.slice.call(arguments));
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
inherits(TimeEntries, ConnectWise);
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* GET
|
|
54
|
-
* @param {Params} params
|
|
55
|
-
* @returns {Promise<TimeEntry>}
|
|
56
|
-
*/
|
|
57
|
-
TimeEntries.prototype.getTimeEntries = function (params) {
|
|
58
|
-
return this.api('/time/entries', 'GET', params);
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
*
|
|
63
|
-
* @param {TimeEntry} timeEntry
|
|
64
|
-
* @returns {Promise<TimeEntry>}
|
|
65
|
-
*/
|
|
66
|
-
TimeEntries.prototype.createTimeEntry = function (timeEntry) {
|
|
67
|
-
return this.api('/time/entries', 'POST', timeEntry);
|
|
68
|
-
};
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
*
|
|
72
|
-
* @param {ParamsConditions} params
|
|
73
|
-
* @returns {Promise<Count>}
|
|
74
|
-
*/
|
|
75
|
-
TimeEntries.prototype.getTimeEntriesCount = function (params) {
|
|
76
|
-
return this.api('/time/entries/count', 'GET', params);
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
/**
|
|
80
|
-
*
|
|
81
|
-
* @param {number} id
|
|
82
|
-
* @returns {Promise<DeleteResponse>}
|
|
83
|
-
*/
|
|
84
|
-
TimeEntries.prototype.deleteTimeEntryById = function (id) {
|
|
85
|
-
return this.api(`/time/entries/${id}`, 'DELETE');
|
|
86
|
-
};
|
|
87
|
-
|
|
88
|
-
/**
|
|
89
|
-
*
|
|
90
|
-
* @param id
|
|
91
|
-
* @returns {Promise<TimeEntry>}
|
|
92
|
-
*/
|
|
93
|
-
TimeEntries.prototype.getTimeEntryById = function (id) {
|
|
94
|
-
return this.api(`/time/entries/${id}`, 'GET');
|
|
95
|
-
};
|
|
96
|
-
|
|
97
|
-
/**
|
|
98
|
-
*
|
|
99
|
-
* @param id
|
|
100
|
-
* @param {Operations[]} operations
|
|
101
|
-
* @returns {Promise<TimeEntry>}
|
|
102
|
-
*/
|
|
103
|
-
TimeEntries.prototype.updateTimeEntry = function (id, operations) {
|
|
104
|
-
return this.api(`/time/entries/${id}`, 'PATCH', operations);
|
|
105
|
-
};
|
|
106
|
-
|
|
107
|
-
/**
|
|
108
|
-
*
|
|
109
|
-
* @param id
|
|
110
|
-
* @param {TimeEntry} timeEntry
|
|
111
|
-
* @returns {Promise<TimeEntry>}
|
|
112
|
-
*/
|
|
113
|
-
TimeEntries.prototype.replaceTimeEntry = function (id, timeEntry) {
|
|
114
|
-
return this.api(`/time/entries/${id}`, 'PUT', timeEntry);
|
|
115
|
-
};
|
|
116
|
-
|
|
117
|
-
/**
|
|
118
|
-
*
|
|
119
|
-
* @type {TimeEntries}
|
|
120
|
-
*/
|
|
121
|
-
module.exports = TimeEntries;
|
package/src/TimeAPI/index.js
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Created by kgrube on 12/20/2015.
|
|
3
|
-
* @author kgrube
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* @typedef {object} TimeAPI
|
|
8
|
-
* @property TimeEntries
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* @param options
|
|
13
|
-
* @returns {{TimeEntries: TimeEntries}}
|
|
14
|
-
* @constructor
|
|
15
|
-
*/
|
|
16
|
-
function TimeAPI(options) {
|
|
17
|
-
const _TimeEntries = require('./TimeEntries');
|
|
18
|
-
return {
|
|
19
|
-
TimeEntries: new _TimeEntries(options)
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
*
|
|
25
|
-
* @type {TimeAPI}
|
|
26
|
-
*/
|
|
27
|
-
module.exports = TimeAPI;
|
package/src/utils/Callback.js
DELETED
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Created by kgrube on 4/3/2019
|
|
3
|
-
* @private
|
|
4
|
-
*/
|
|
5
|
-
const request = require('request');
|
|
6
|
-
const crypto = require('crypto');
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* @typedef {Object} CallbackPayload
|
|
10
|
-
* @property Action
|
|
11
|
-
* @property CompanyId
|
|
12
|
-
* @property Entity json string
|
|
13
|
-
* @property FromUrl
|
|
14
|
-
* @property ID
|
|
15
|
-
* @property MemberId
|
|
16
|
-
* @property {object} Metadata
|
|
17
|
-
* @property Metadata.key_url
|
|
18
|
-
* @property Type
|
|
19
|
-
*/
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* @typedef {object} CWCallback
|
|
23
|
-
* @property verifyCallback
|
|
24
|
-
* @property verifyMessage
|
|
25
|
-
* @property middleware
|
|
26
|
-
*
|
|
27
|
-
*/
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Load signing key and verify the message
|
|
31
|
-
* @param {CallbackPayload} callbackBody
|
|
32
|
-
* @param {string} contentSignature base64 content signature req.headers[x-content-signature]
|
|
33
|
-
* @return {Promise<boolean>}
|
|
34
|
-
*/
|
|
35
|
-
function verifyCallback(callbackBody, contentSignature) {
|
|
36
|
-
return new Promise((resolve, reject) => {
|
|
37
|
-
if (!callbackBody || !contentSignature) {
|
|
38
|
-
throw new Error('callbackBody and contentSignature must be defined.');
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
const key_url = callbackBody.Metadata && callbackBody.Metadata.key_url;
|
|
42
|
-
|
|
43
|
-
request(key_url, (err, res, body) => {
|
|
44
|
-
if (err) throw err;
|
|
45
|
-
try {
|
|
46
|
-
const parsed = JSON.parse(body);
|
|
47
|
-
const signingKey = parsed.signing_key;
|
|
48
|
-
|
|
49
|
-
return resolve(verifyMessage(callbackBody, contentSignature, signingKey));
|
|
50
|
-
} catch (parseErr) {
|
|
51
|
-
throw parseErr;
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* Validate a callback body against signed key
|
|
59
|
-
* @param {CallbackPayload} callbackBody
|
|
60
|
-
* @param {string} contentSignature
|
|
61
|
-
* @param {string} signingKey
|
|
62
|
-
* @returns {boolean}
|
|
63
|
-
*/
|
|
64
|
-
function verifyMessage(callbackBody, contentSignature, signingKey) {
|
|
65
|
-
const hash = crypto.createHash('sha256').update(signingKey).digest();
|
|
66
|
-
const hmac = crypto.createHmac('sha256', hash);
|
|
67
|
-
|
|
68
|
-
return contentSignature === hmac.update(JSON.stringify(callbackBody)).digest('base64');
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* Express style middleware
|
|
73
|
-
* @example
|
|
74
|
-
* app.post('/your/api', cw.utils.middleware((err, req, res, verified, payload) => {
|
|
75
|
-
* if (err) {
|
|
76
|
-
* //handle error
|
|
77
|
-
* res.status(500).end();
|
|
78
|
-
* } else if (!verified) {
|
|
79
|
-
* // send 403 on verification failure
|
|
80
|
-
* res.status(403).end();
|
|
81
|
-
* } else {
|
|
82
|
-
* res.status(200).end()
|
|
83
|
-
* }
|
|
84
|
-
* const {action, id} = req.query;
|
|
85
|
-
* // do something with the payload
|
|
86
|
-
* }));
|
|
87
|
-
*
|
|
88
|
-
* @param {function} cb callback(err, req, res, verified, payload)
|
|
89
|
-
*/
|
|
90
|
-
function middleware(cb) {
|
|
91
|
-
if (!cb || typeof cb !== 'function') {
|
|
92
|
-
throw new Error('callback must be a function.');
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
return (req, res) => {
|
|
96
|
-
if (!req || !req.body || !req.body.Metadata) {
|
|
97
|
-
return cb(new Error('callback payload is invalid.'), req, res, false);
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
const contentSignature = req.headers['x-content-signature'];
|
|
101
|
-
const callbackBody = req.body;
|
|
102
|
-
|
|
103
|
-
let parsedEntity;
|
|
104
|
-
try {
|
|
105
|
-
parsedEntity = JSON.parse(callbackBody.Entity);
|
|
106
|
-
} catch (parseErr) {
|
|
107
|
-
return cb(parseErr, req, res, false);
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
verifyCallback(callbackBody, contentSignature)
|
|
111
|
-
.then(verified => {
|
|
112
|
-
return cb(null, req, res, verified, Object.assign(callbackBody, {Entity: parsedEntity}));
|
|
113
|
-
})
|
|
114
|
-
.catch(err => {
|
|
115
|
-
return cb(err, req, res, false);
|
|
116
|
-
});
|
|
117
|
-
};
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
module.exports = {
|
|
121
|
-
verifyMessage,
|
|
122
|
-
verifyCallback,
|
|
123
|
-
middleware,
|
|
124
|
-
};
|
package/src/utils/Series.js
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Created by kgrube on 4/3/2019
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* @typedef {Object} CWSeries
|
|
7
|
-
* @property {function} all
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
*
|
|
12
|
-
* @param {array<Function|Promise>} series
|
|
13
|
-
* @param {number} concurrent number of concurrent requests
|
|
14
|
-
* @param {number} delay number of ms between request groups
|
|
15
|
-
* @returns {Promise<*>}
|
|
16
|
-
*/
|
|
17
|
-
function all({series, concurrent = 1, delay = 0}) {
|
|
18
|
-
const promises = series.slice();
|
|
19
|
-
const concurrency = concurrent;
|
|
20
|
-
let results = null;
|
|
21
|
-
|
|
22
|
-
return new Promise((resolve, reject) => {
|
|
23
|
-
function next(result) {
|
|
24
|
-
const concurrentPromises = [];
|
|
25
|
-
|
|
26
|
-
if (!results) {
|
|
27
|
-
results = [];
|
|
28
|
-
} else {
|
|
29
|
-
results = results.concat(result);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
if (promises.length) {
|
|
33
|
-
while (concurrentPromises.length < concurrency && promises.length) {
|
|
34
|
-
let promise = promises.shift();
|
|
35
|
-
|
|
36
|
-
if (typeof promise === 'function') {
|
|
37
|
-
promise = promise();
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
if (!promise || typeof promise.then !== 'function') {
|
|
41
|
-
promise = Promise.resolve(promise);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
concurrentPromises.push(promise);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
setTimeout(() => {
|
|
48
|
-
Promise.all(concurrentPromises)
|
|
49
|
-
.then(next)
|
|
50
|
-
.catch(reject);
|
|
51
|
-
}, delay);
|
|
52
|
-
} else {
|
|
53
|
-
resolve(results);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
next();
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
module.exports = {
|
|
62
|
-
all,
|
|
63
|
-
};
|
package/src/utils/index.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Created by kgrube on 4/3/2019
|
|
3
|
-
* @private
|
|
4
|
-
*/
|
|
5
|
-
const Series = require('./Series');
|
|
6
|
-
const Callback = require('./Callback');
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* @typedef {Object} CWUtils
|
|
10
|
-
* @property {CWCallback} Series
|
|
11
|
-
* @property {CWCallback} Callback
|
|
12
|
-
*/
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
*
|
|
16
|
-
* @type {CWUtils}
|
|
17
|
-
*/
|
|
18
|
-
module.exports = {
|
|
19
|
-
Series,
|
|
20
|
-
Callback,
|
|
21
|
-
};
|