cityworks 1.0.4 → 1.0.6
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/dist/activity_link.d.ts +5 -0
- package/dist/attachments.d.ts +17 -1
- package/dist/case_data.d.ts +4 -2
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.m.js +1 -1
- package/dist/index.m.js.map +1 -1
- package/dist/index.modern.mjs +1 -1
- package/dist/index.modern.mjs.map +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/dist/activity_link.js +0 -219
- package/dist/briefcase.js +0 -327
- package/dist/case.d.ts +0 -114
- package/dist/case_admin.js +0 -821
- package/dist/case_assets.js +0 -129
- package/dist/case_data.js +0 -416
- package/dist/case_financial.js +0 -848
- package/dist/case_workflow.js +0 -455
- package/dist/cityworks.d.ts +0 -224
- package/dist/comments.js +0 -126
- package/dist/error.js +0 -30
- package/dist/event_layer.d.ts +0 -97
- package/dist/event_layer.js +0 -207
- package/dist/general.js +0 -212
- package/dist/gis.js +0 -250
- package/dist/index.cjs +0 -2
- package/dist/index.cjs.map +0 -1
- package/dist/index.modern.js +0 -2
- package/dist/index.modern.js.map +0 -1
- package/dist/inspection.js +0 -933
- package/dist/inspection_admin.js +0 -43
- package/dist/inspection_costs.js +0 -200
- package/dist/message_queue.js +0 -248
- package/dist/query.js +0 -242
- package/dist/request.js +0 -899
- package/dist/request_admin.js +0 -32
- package/dist/request_costs.js +0 -113
- package/dist/search.js +0 -371
- package/dist/workorder.js +0 -951
- package/dist/workorder_admin.js +0 -248
- package/dist/workorder_costs.js +0 -274
package/dist/gis.js
DELETED
|
@@ -1,250 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Gis = void 0;
|
|
4
|
-
var _ = require('lodash');
|
|
5
|
-
var Gis = /** @class */ (function () {
|
|
6
|
-
/**
|
|
7
|
-
* @hidden
|
|
8
|
-
*/
|
|
9
|
-
function Gis(cw) {
|
|
10
|
-
this.cw = cw;
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* Get gis service configuration for user, group, domain, or service id
|
|
14
|
-
*
|
|
15
|
-
* @param {string} [whichType] - domain, group, mapservice, or user
|
|
16
|
-
* @param {number} [whichId] - domain, group, mapservice, or user Id
|
|
17
|
-
* @param {number} [getGisData] - If true, check for feature server JSON data, default is true
|
|
18
|
-
* @param {Array<string>} [context] Filter returned list by specific context, i.e. Office, Field, Mobile, Public, etc. Default is all.
|
|
19
|
-
* @return {Object} Returns Promise object that represents an Object with the desired GIS service definitions
|
|
20
|
-
*/
|
|
21
|
-
Gis.prototype.getConfig = function (whichType, whichId, getGisData, context) {
|
|
22
|
-
var _this = this;
|
|
23
|
-
if (getGisData === void 0) { getGisData = true; }
|
|
24
|
-
if (context === void 0) { context = []; }
|
|
25
|
-
return new Promise(function (resolve, reject) {
|
|
26
|
-
var path = 'Gis/MapService/Domain';
|
|
27
|
-
whichType = whichType.toLowerCase();
|
|
28
|
-
var data;
|
|
29
|
-
switch (whichType) {
|
|
30
|
-
case 'domain':
|
|
31
|
-
data = { DomainId: whichId, GetGisData: getGisData, Security: context };
|
|
32
|
-
break;
|
|
33
|
-
case 'group':
|
|
34
|
-
data = { GroupId: whichId, GetGisData: getGisData, Security: context };
|
|
35
|
-
break;
|
|
36
|
-
case 'mapservice':
|
|
37
|
-
data = { MapServiceId: whichId, GetGisData: getGisData, Security: context };
|
|
38
|
-
break;
|
|
39
|
-
case 'user':
|
|
40
|
-
data = { UserId: whichId, GetGisData: getGisData, Security: context };
|
|
41
|
-
break;
|
|
42
|
-
}
|
|
43
|
-
_this.cw.runRequest(path, {}).then(function (response) {
|
|
44
|
-
resolve(response.Value);
|
|
45
|
-
}).catch(function (e) {
|
|
46
|
-
reject(e);
|
|
47
|
-
});
|
|
48
|
-
});
|
|
49
|
-
};
|
|
50
|
-
/**
|
|
51
|
-
* Get domain gis services
|
|
52
|
-
*
|
|
53
|
-
* @param {number} domainId - The mobile map cache Id to download
|
|
54
|
-
* @return {Object} Returns Promise object that represents an Object with the domain's default GIS services
|
|
55
|
-
*/
|
|
56
|
-
Gis.prototype.domain = function (domainId, getGisData) {
|
|
57
|
-
var _this = this;
|
|
58
|
-
if (getGisData === void 0) { getGisData = true; }
|
|
59
|
-
return new Promise(function (resolve, reject) {
|
|
60
|
-
var path = 'Gis/MapService/Domain';
|
|
61
|
-
var data = {
|
|
62
|
-
DomainId: domainId
|
|
63
|
-
};
|
|
64
|
-
_this.cw.runRequest(path, {}).then(function (response) {
|
|
65
|
-
resolve(response.Value);
|
|
66
|
-
}).catch(function (e) {
|
|
67
|
-
reject(e);
|
|
68
|
-
});
|
|
69
|
-
});
|
|
70
|
-
};
|
|
71
|
-
/**
|
|
72
|
-
* Download mobile map cache
|
|
73
|
-
*
|
|
74
|
-
* @param {number} cacheId - The mobile map cache Id to download
|
|
75
|
-
* @return {Object} Returns Promise object that represents a streaming download (?)
|
|
76
|
-
*/
|
|
77
|
-
Gis.prototype.downloadMobile = function (cacheId, getGisData) {
|
|
78
|
-
var _this = this;
|
|
79
|
-
if (getGisData === void 0) { getGisData = true; }
|
|
80
|
-
return new Promise(function (resolve, reject) {
|
|
81
|
-
var path = 'Gis/MapService/DownloadMobileMapCache';
|
|
82
|
-
var data = {
|
|
83
|
-
MobileMapCacheId: cacheId
|
|
84
|
-
};
|
|
85
|
-
_this.cw.runRequest(path, {}).then(function (response) {
|
|
86
|
-
resolve(response.Value);
|
|
87
|
-
}).catch(function (e) {
|
|
88
|
-
reject(e);
|
|
89
|
-
});
|
|
90
|
-
});
|
|
91
|
-
};
|
|
92
|
-
/**
|
|
93
|
-
* Get initial extent for user
|
|
94
|
-
*
|
|
95
|
-
* @return {Object} Returns Promise object that represents ... (?)
|
|
96
|
-
*/
|
|
97
|
-
Gis.prototype.initialExtent = function () {
|
|
98
|
-
var _this = this;
|
|
99
|
-
return new Promise(function (resolve, reject) {
|
|
100
|
-
var path = 'Gis/MapService/InitialExtent';
|
|
101
|
-
var data = {};
|
|
102
|
-
_this.cw.runRequest(path, {}).then(function (response) {
|
|
103
|
-
resolve(response.Value);
|
|
104
|
-
}).catch(function (e) {
|
|
105
|
-
reject(e);
|
|
106
|
-
});
|
|
107
|
-
});
|
|
108
|
-
};
|
|
109
|
-
/**
|
|
110
|
-
* Get service request gis services
|
|
111
|
-
*
|
|
112
|
-
* @param {number} requestId - The WorkOrder to check against.
|
|
113
|
-
* @param {boolean} getGisData - If true, check for feature server JSON data, default is true.
|
|
114
|
-
* @return {Object} Returns Promise object that represents an Object with the specified request's entit(y|ies)
|
|
115
|
-
*/
|
|
116
|
-
Gis.prototype.request = function (requestId, getGisData) {
|
|
117
|
-
var _this = this;
|
|
118
|
-
if (getGisData === void 0) { getGisData = true; }
|
|
119
|
-
return new Promise(function (resolve, reject) {
|
|
120
|
-
var path = 'Gis/MapService/ServiceRequestConfiguration';
|
|
121
|
-
var data = {
|
|
122
|
-
RequestId: requestId,
|
|
123
|
-
GetGisData: getGisData
|
|
124
|
-
};
|
|
125
|
-
_this.cw.runRequest(path, {}).then(function (response) {
|
|
126
|
-
resolve(response.Value);
|
|
127
|
-
}).catch(function (e) {
|
|
128
|
-
reject(e);
|
|
129
|
-
});
|
|
130
|
-
});
|
|
131
|
-
};
|
|
132
|
-
/**
|
|
133
|
-
* Get inspection gis services
|
|
134
|
-
*
|
|
135
|
-
* @param {number} inspectionId - The WorkOrder to check against.
|
|
136
|
-
* @param {boolean} getGisData - If true, check for feature server JSON data, default is true.
|
|
137
|
-
* @return {Object} Returns Promise object that represents an Object with the specified inspection's entity
|
|
138
|
-
*/
|
|
139
|
-
Gis.prototype.inspection = function (inspectionId, getGisData) {
|
|
140
|
-
var _this = this;
|
|
141
|
-
if (getGisData === void 0) { getGisData = true; }
|
|
142
|
-
return new Promise(function (resolve, reject) {
|
|
143
|
-
var path = 'Gis/MapService/InspectionConfiguration';
|
|
144
|
-
var data = {
|
|
145
|
-
InspectionId: inspectionId,
|
|
146
|
-
GetGisData: getGisData
|
|
147
|
-
};
|
|
148
|
-
_this.cw.runRequest(path, {}).then(function (response) {
|
|
149
|
-
resolve(response.Value);
|
|
150
|
-
}).catch(function (e) {
|
|
151
|
-
reject(e);
|
|
152
|
-
});
|
|
153
|
-
});
|
|
154
|
-
};
|
|
155
|
-
/**
|
|
156
|
-
* Get workorder gis services
|
|
157
|
-
*
|
|
158
|
-
* @param {number} workOrderSid - The WorkOrder to check against.
|
|
159
|
-
* @param {boolean} getGisData - If true, check for feature server JSON data, default is true.
|
|
160
|
-
* @return {Object} Returns Promise object that represents an Object with the specified WorkOrder's entit(y|ies)
|
|
161
|
-
*/
|
|
162
|
-
Gis.prototype.workOrder = function (workOrderSid, getGisData) {
|
|
163
|
-
var _this = this;
|
|
164
|
-
if (getGisData === void 0) { getGisData = true; }
|
|
165
|
-
return new Promise(function (resolve, reject) {
|
|
166
|
-
var path = 'Gis/MapService/WorkOrderConfiguration';
|
|
167
|
-
var data = {
|
|
168
|
-
WorkOrderSid: workOrderSid,
|
|
169
|
-
GetGisData: getGisData
|
|
170
|
-
};
|
|
171
|
-
_this.cw.runRequest(path, {}).then(function (response) {
|
|
172
|
-
resolve(response.Value);
|
|
173
|
-
}).catch(function (e) {
|
|
174
|
-
reject(e);
|
|
175
|
-
});
|
|
176
|
-
});
|
|
177
|
-
};
|
|
178
|
-
/**
|
|
179
|
-
* Get service request gis services
|
|
180
|
-
*
|
|
181
|
-
* @param {Array<string>} [context] Filter returned list by specific context, i.e. Office, Field, Mobile, Public, etc. Default is all.
|
|
182
|
-
* @param {boolean} [allDomains] services assigned to any domain the user belongs to, default is true
|
|
183
|
-
* @param {boolean} [allGroups] services assigned to any groups the user belongs to regardless of domain, default is true
|
|
184
|
-
* @param {boolean} [getGisData] If true, check for feature server JSON data, default is true
|
|
185
|
-
* @return {Object} Returns Promise object that represents an Object with the user's GIS services
|
|
186
|
-
*/
|
|
187
|
-
Gis.prototype.user = function (context, allDomains, allGroups, getGisData) {
|
|
188
|
-
var _this = this;
|
|
189
|
-
if (context === void 0) { context = []; }
|
|
190
|
-
if (allDomains === void 0) { allDomains = true; }
|
|
191
|
-
if (allGroups === void 0) { allGroups = true; }
|
|
192
|
-
if (getGisData === void 0) { getGisData = true; }
|
|
193
|
-
return new Promise(function (resolve, reject) {
|
|
194
|
-
var path = 'Gis/MapService/User';
|
|
195
|
-
var data = {
|
|
196
|
-
AllDomains: allDomains,
|
|
197
|
-
AllGroups: allGroups,
|
|
198
|
-
GetGisData: getGisData,
|
|
199
|
-
Security: context
|
|
200
|
-
};
|
|
201
|
-
_this.cw.runRequest(path, {}).then(function (response) {
|
|
202
|
-
resolve(response.Value);
|
|
203
|
-
}).catch(function (e) {
|
|
204
|
-
reject(e);
|
|
205
|
-
});
|
|
206
|
-
});
|
|
207
|
-
};
|
|
208
|
-
/**
|
|
209
|
-
* Get Geocode server info by ServerId
|
|
210
|
-
*
|
|
211
|
-
* @param {number} ServiceId
|
|
212
|
-
* @return {Object} Returns Promise object that represents an object describing the provided Geocoder service configuration
|
|
213
|
-
*/
|
|
214
|
-
// Gis/GeoCode/GeocodeServer
|
|
215
|
-
/**
|
|
216
|
-
* Get currently selected entities from the Cityworks install's session for your user
|
|
217
|
-
* @return {Object} Returns Promise object that represents an Object with the currently-selected entities
|
|
218
|
-
*/
|
|
219
|
-
Gis.prototype.selectedEntities = function () {
|
|
220
|
-
var _this = this;
|
|
221
|
-
return new Promise(function (resolve, reject) {
|
|
222
|
-
var path = 'General/AppData/SelectedEntities';
|
|
223
|
-
_this.cw.runRequest(path, {}).then(function (response) {
|
|
224
|
-
resolve(response.Value);
|
|
225
|
-
}).catch(function (e) {
|
|
226
|
-
reject(e);
|
|
227
|
-
});
|
|
228
|
-
});
|
|
229
|
-
};
|
|
230
|
-
/**
|
|
231
|
-
* Get attributes available for provided entity
|
|
232
|
-
*
|
|
233
|
-
* @param {string} entityType - The entity type to describe
|
|
234
|
-
* @return {Object} Returns Promise object that represents a collection of attribute description objects
|
|
235
|
-
*/
|
|
236
|
-
Gis.prototype.getEntityAttributes = function (entityType) {
|
|
237
|
-
var _this = this;
|
|
238
|
-
return new Promise(function (resolve, reject) {
|
|
239
|
-
var data = { EntityType: entityType };
|
|
240
|
-
var path = 'AMS/Entity/Attributes';
|
|
241
|
-
_this.cw.runRequest(path, data).then(function (response) {
|
|
242
|
-
resolve(response.Value);
|
|
243
|
-
}).catch(function (e) {
|
|
244
|
-
reject(e);
|
|
245
|
-
});
|
|
246
|
-
});
|
|
247
|
-
};
|
|
248
|
-
return Gis;
|
|
249
|
-
}());
|
|
250
|
-
exports.Gis = Gis;
|
package/dist/index.cjs
DELETED
package/dist/index.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../src/index.ts"],"sourcesContent":["require('./cityworks')\n\n// import CWError from './error'\n// import { General } from 'general'\n// import { MessageQueueImpl } from './message_queue'\n// import { Case } from './case'\n// import { ActivityLink } from './activity_link'\n// import { Gis } from './gis'\n// import { Request } from './request'\n// import { Inspection } from './inspection'\n// import { WorkOrder } from './workorder'\n\n// var Cityworks = new CityworksObj();\n\n// export {\n// Cityworks,\n// // General,\n// // MessageQueue\n// // ActivityLink,\n// // Case,\n// // Gis,\n// // Request,\n// // Inspection,\n// // Workorder\n// }\n"],"names":["require"],"mappings":"AAAAA,QAAQ"}
|
package/dist/index.modern.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import e from"reversible-map";const t=require("lodash");class s{constructor(e,s,r){this.name=void 0,this.code=void 0,this.message=void 0,this.info=void 0,this.name="Cityworks Exception",this.code=e,this.message=s,void 0!==r&&(t.has(r,"Message")&&(this.message=t.get(r,"Message")),this.info=JSON.stringify(r))}}const r=require("lodash");class n{constructor(e){this.cw=void 0,this.cw=e}notifications(){return new Promise((e,t)=>{this.cw.runRequest("General/ActivityNotification/User",{}).then(t=>{e(t.Value)}).catch(e=>{t(e)})})}amIWatching(e,t){return new Promise((r,n)=>{let i={null:0,case:1,task:2};void 0===i[e]?n(new s(1,"Activity type provided does not exist.",{provided:e,potential_activities:i})):this.cw.runRequest("General/ActivityNotification/UserWatching",{ActivityType:i[e],ActivityId:t}).then(e=>{r(e.Value)}).catch(e=>{n(e)})})}getActivityMetadataByIds(e,t){return new Promise((n,i)=>{let a=["INSPECTION","REQUEST","WORKORDER"];-1==r.indexOf(a,t)&&i(new s(2,"TableName provided does not exist or is mispelled.",{provided:t,available:a})),this.cw.runRequest("General/CwMetaData/ByTableNameSids",{Ids:e,TableName:t}).then(e=>{console.log(e),n(e.Value)}).catch(e=>{i(e)})})}getHistory(){return new Promise((e,t)=>{this.cw.runRequest("Ams/Search/RecentActivity",{}).then(t=>{console.log(t),e(t.Value)}).catch(e=>{t(e)})})}getWOEntityCostSummary(e){return new Promise((t,s)=>{this.cw.runRequest("General/CostSummary/WorkOrderEntity",{ObjectIds:e}).then(e=>{console.log(e),t(e.Value)}).catch(e=>{s(e)})})}searchWOEntityCostSummary(e){return new Promise((t,s)=>{this.cw.runRequest("General/CostSummary/WorkOrderEntitySearch",{SearchId:e}).then(e=>{console.log(e),t(e.Value)}).catch(e=>{s(e)})})}}const i=require("lodash");class a{constructor(t){this.activityTypes=void 0,this.linkTypes=void 0,this.cw=void 0,this.cw=t,this.activityTypes=new e,this.activityTypes.set("null",0),this.activityTypes.set("case",1),this.activityTypes.set("inspection",2),this.activityTypes.set("request",3),this.activityTypes.set("workorder",4),this.activityTypes.set("wipcase",5),this.linkTypes=new e,this.linkTypes.set("null",0),this.linkTypes.set("parent",1),this.linkTypes.set("related",2)}add(e,t,r,n,i="related"){return new Promise((a,u)=>{this.activityTypes.has(e)||u(new s(1,"Source type not found.",{provided:e,options:this.activityTypes})),this.activityTypes.has(r)||u(new s(2,"Destination type not found.",{provided:r,options:this.activityTypes})),this.linkTypes.has(i)||u(new s(3,"Link type not found.",{provided:i,options:this.linkTypes}));let o={SourceType:this.activityTypes.get(e),SourceSid:t,DestType:this.activityTypes.get(r),DestSid:n,LinkType:this.linkTypes.get(i)};this.cw.runRequest("General/ActivityLink/Add",o).then(e=>{a(e.Value)}).catch(e=>{u(e)})})}get(e,t){return new Promise((r,n)=>{this.activityTypes.has(e)||n(new s(4,"Activity type not found.",{provided:e,options:this.activityTypes}));let a={ActivityType:this.activityTypes.get(e),ActivitySids:t},u=this;this.cw.runRequest("General/ActivityLink/ByActivitySids",a).then(e=>{let t=new Array;i.forEach(e.Value,(e,s)=>{e.DestType=u.activityTypes.get(e.DestType),e.SourceType=u.activityTypes.get(e.SourceType),e.LinkType=u.linkTypes.get(e.LinkType),t.push(e)}),r(t)}).catch(e=>{n(e)})})}clone(e,t,r,n){return new Promise((i,a)=>{this.activityTypes.has(e)||a(new s(1,"Source type not found.",{provided:e,options:this.activityTypes})),this.activityTypes.has(r)||a(new s(2,"Destination type not found.",{provided:r,options:this.activityTypes}));let u={SourceActivityType:this.activityTypes.get(e),SourceActivitySid:t,DestinationActivityType:this.activityTypes.get(r),DestinationActivitySid:n};this.cw.runRequest("General/ActivityLink/CloneByActivitySid",u).then(e=>{i(e.Value)}).catch(e=>{a(e)})})}delete(e){return new Promise((t,s)=>{this.cw.runRequest("General/ActivityLink/Delete",{ActivityLinkId:e}).then(e=>{t(e.Value)}).catch(e=>{s(e)})})}remove(e,t,r,n,i="related"){return new Promise((a,u)=>{this.activityTypes.has(e)||u(new s(1,"Source type not found.",{provided:e,options:this.activityTypes})),this.activityTypes.has(r)||u(new s(1,"Destination type not found.",{provided:r,options:this.activityTypes})),this.linkTypes.has(i)||u(new s(1,"Link type not found.",{provided:i,options:this.linkTypes}));let o={SourceType:this.activityTypes.get(e),SourceSid:t,DestType:this.activityTypes.get(r),DestSid:n,LinkType:this.linkTypes.get(i)};this.cw.runRequest("General/ActivityLink/Remove",o).then(e=>{a(e.Value)}).catch(e=>{u(e)})})}}require("lodash");class u{constructor(e){this.cw=void 0,this.cw=e}getConfig(e,t,s=!0,r=[]){return new Promise((t,s)=>{e=e.toLowerCase(),this.cw.runRequest("Gis/MapService/Domain",{}).then(e=>{t(e.Value)}).catch(e=>{s(e)})})}domain(e,t=!0){return new Promise((e,t)=>{this.cw.runRequest("Gis/MapService/Domain",{}).then(t=>{e(t.Value)}).catch(e=>{t(e)})})}downloadMobile(e,t=!0){return new Promise((e,t)=>{this.cw.runRequest("Gis/MapService/DownloadMobileMapCache",{}).then(t=>{e(t.Value)}).catch(e=>{t(e)})})}initialExtent(){return new Promise((e,t)=>{this.cw.runRequest("Gis/MapService/InitialExtent",{}).then(t=>{e(t.Value)}).catch(e=>{t(e)})})}request(e,t=!0){return new Promise((e,t)=>{this.cw.runRequest("Gis/MapService/ServiceRequestConfiguration",{}).then(t=>{e(t.Value)}).catch(e=>{t(e)})})}inspection(e,t=!0){return new Promise((e,t)=>{this.cw.runRequest("Gis/MapService/InspectionConfiguration",{}).then(t=>{e(t.Value)}).catch(e=>{t(e)})})}workOrder(e,t=!0){return new Promise((e,t)=>{this.cw.runRequest("Gis/MapService/WorkOrderConfiguration",{}).then(t=>{e(t.Value)}).catch(e=>{t(e)})})}user(e=[],t=!0,s=!0,r=!0){return new Promise((e,t)=>{this.cw.runRequest("Gis/MapService/User",{}).then(t=>{e(t.Value)}).catch(e=>{t(e)})})}selectedEntities(){return new Promise((e,t)=>{this.cw.runRequest("General/AppData/SelectedEntities",{}).then(t=>{e(t.Value)}).catch(e=>{t(e)})})}getEntityAttributes(e){return new Promise((t,s)=>{this.cw.runRequest("AMS/Entity/Attributes",{EntityType:e}).then(e=>{t(e.Value)}).catch(e=>{s(e)})})}}const o=require("lodash");class c{constructor(e){this.cw=void 0,this.status={Pending:0,Processing:1,Complete:2,Failed:3},this.hook_types={Unknown:0,ActivityUpdate:1,Email:2,WebHook:3},this.cw=e}processMessages(e,t=!1){return new Promise((s,r)=>{this.cw.runRequest("General/WebHookEvent/ProcessMessages",{Ids:e,Delete:t}).then(e=>{}).catch(e=>{r(e)})})}get(e,t,r=15){return new Promise((n,i)=>{void 0===this.status[t]&&i(new s(1,"Status provided does not exist or is mispelled.",{provided:t,available:this.status})),this.cw.runRequest("General/MessageQueue/ByIds",{Ids:e,MaxCount:void 0!==r?r:15,Status:this.status[t]}).then(e=>{}).catch(e=>{i(e)})})}delete(e,t,r){return new Promise((n,i)=>{void 0===this.status[t]&&i(new s(2,"Status provided does not exist or is mispelled.",{provided:t,available:this.status})),this.cw.runRequest("General/MessageQueue/Delete",{Ids:e,Status:this.status[t],HoursToKeep:r}).then(e=>{}).catch(e=>{i(e)})})}preferences(){return new Promise((e,t)=>{this.cw.runRequest("General/MessageQueue/Preferences",{}).then(e=>{}).catch(e=>{t(e)})})}search(e,t){let r;return new Promise((n,i)=>{void 0!==e.status&&void 0===this.status[e.status]?i(new s(3,"Status provided does not exist or is mispelled.",{provided:e.status,available:this.status})):void 0!==e.status&&void 0!==this.status[e.status]&&(r.Status=this.status[e.status]),void 0!==t&&(r.MaxResults=t);let a=["Id","HookId","HookType","Result","DateCreatedBegin","DateCreatedEnd","DateUpdatedBegin","DateUpdatedEnd"],u=["Status","MaxResults"];o.forEach(e,(e,t)=>{-1!=o.indexOf(a,t)&&-1==o.indexOf(u,t)?r[t]=e:-1==o.indexOf(u,t)&&i(new s(4,"Provided parameter does not exist or is mispelled.",{provided:t,value:e,available:o.concat(a,u)}))}),this.cw.runRequest("General/MessageQueue/Search",r).then(e=>{void 0===e.Value&&(e.Value=[]),n(e.Value)}).catch(e=>{i(e)})})}update(e){let t;return new Promise((r,n)=>{void 0!==e.status&&void 0===this.status[e.status]?n(new s(3,"Status provided does not exist or is mispelled.",{provided:e.status,available:this.status})):void 0!==e.status&&void 0!==this.status[e.status]&&(t.Status=this.status[e.status]),void 0!==e.hook_types&&void 0===this.hook_types[e.hook_types]?n(new s(3,"Status provided does not exist or is mispelled.",{provided:e.hook_types,available:this.hook_types})):void 0!==e.hook_types&&void 0!==this.hook_types[e.hook_types]&&(t.HookType=this.hook_types[e.hook_types]);let i=["Id","HookId","Packet","Result"],a=["Status","HookType"];o.forEach(e,(e,r)=>{-1!=o.indexOf(i,r)&&-1==o.indexOf(a,r)?t[r]=e:-1==o.indexOf(a,r)&&n(new s(5,"Provided parameter does not exist or is mispelled.",{provided:r,value:e,available:o.concat(i,a)}))}),this.cw.runRequest("General/MessageQueue/Update",t).then(e=>{void 0===e.Value&&(e.Value=[]),r(e.Value)})})}updateMessageStatus(e,t,r){return new Promise((n,i)=>{void 0===this.status[t]&&i(new s(2,"Status provided does not exist or is mispelled.",{provided:t,available:this.status})),this.cw.runRequest("General/MessageQueue/UpdateMessageStatus",{Ids:e,Status:this.status[t],HoursToKeep:r}).then(e=>{})})}getWebooks(e){return new Promise((t,s)=>{this.cw.runRequest("General/MessageQueue/WebHooks",{HookIds:e}).then(e=>{})})}}const h=require("lodash");class d{constructor(e){this.cw=void 0,this.searchTypes={Null:0,Request:1,WorkOrder:2,Inspection:3,Contract:4,Permit:5,GIS:6,PermitTask:7,PermitAddress:8,InspCommon:9,Case:10,WorkOrderEntity:11,StoreTransaction:12,Requisition:13,Material:14,WorkActivity:15,MaterialLeaf:16,WoTemplate:17,Unknown:18,Employee:19,MessageQueue:20,Analytics:21,TokenState:22,AssetCalculationResult:23,Equipment:24,CustomerAccount:25,InspTemplate:26,ProblemLeaf:27,AssetSplitRecord:28,PavementInsp:29,TvInspection:30,Projects:31},this.cw=e}quick(e){return new Promise((t,s)=>{this.cw.runRequest("General/QuickSearch/QuickSearch",{QuickSearchText:e}).then(e=>{t(e.Value)}).catch(e=>{s(e)})})}execute(e,t){return new Promise((s,r)=>{var n={SearchId:e};n=h.merge(n,t),this.cw.runRequest("Ams/Search/Execute",n).then(e=>{s(e.Value)}).catch(e=>{r(e)})})}getSaved(e,t,r,n){return new Promise((i,a)=>{h.has(this.searchTypes,e)?void 0!==t&&null!=t&&t.length>0&&(void 0!==r||void 0!==n)&&a(new s(3,"You cannot specify both applyToEntities AND employeeSid/domainId")):a(new s(2,"SearchType provided does not exist or is mispelled.",{provided:e,available:this.searchTypes}));var u={},o="";void 0!==r||void 0!==n?(o="SavedByType",void 0!==r&&null!=r&&h.set(u,"EmployeeSid",r),void 0!==n&&null!=n&&h.set(u,"DomainId",n)):(o="Case"==e?"PllSavedSaved":e+"Saved",void 0!==t&&null!=t&&h.set(u,"ApplyToEntities",t)),this.cw.runRequest("Ams/Search/"+o,u).then(e=>{i(e.Value)}).catch(e=>{a(e)})})}displayFields(e){return new Promise((t,r)=>{h.has(this.searchTypes,e)||r(new s(1,"SearchType provided does not exist or is mispelled.",{provided:e,available:this.searchTypes}));var n={searchType:h.get(this.searchTypes,e)};this.cw.runRequest("Ams/Search/DisplayFields",n).then(e=>{t(e.Value)}).catch(e=>{r(e)})})}types(){return new Promise((e,t)=>{this.cw.runRequest("Ams/Search/Types",{}).then(t=>{e(t.Value)}).catch(e=>{t(e)})})}enableServices(e){return new Promise((t,s)=>{this.cw.runRequest("Ams/Search/UpdateEurl",{Enable:!0,SearchIds:e}).then(e=>{t(e.Value)}).catch(e=>{s(e)})})}disableServices(e){return new Promise((t,s)=>{this.cw.runRequest("Ams/Search/UpdateEurl",{Enable:!1,SearchIds:e}).then(e=>{t(e.Value)}).catch(e=>{s(e)})})}getDefinition(e,t){return new Promise((s,r)=>{var n={SearchId:e};void 0!==t&&h.set(n,"EmployeeSid",t),this.cw.runRequest("Ams/Search/Definition",n).then(e=>{s(e.Value)}).catch(e=>{r(e)})})}getDefinitions(e,t){return new Promise((s,r)=>{var n={SearchIds:e};void 0!==t&&h.set(n,"EmployeeSid",t),this.cw.runRequest("Ams/Search/Definitions",n).then(e=>{s(e.Value)}).catch(e=>{r(e)})})}getDefinitionNames(e){return new Promise((t,s)=>{this.cw.runRequest("Ams/Search/DefinitionNames",{SearchIds:e}).then(e=>{t(e.Value)}).catch(e=>{s(e)})})}deleteDefinitions(e){return new Promise((t,s)=>{this.cw.runRequest("Ams/Search/DeleteDefinitions",{SearchIds:e}).then(e=>{t(e.Value)}).catch(e=>{s(e)})})}saveDefinition(e,t,r=0){return new Promise((n,i)=>{h.has(this.searchTypes,e)||i(new s(1,"SearchType provided does not exist or is mispelled.",{provided:e,available:this.searchTypes}));var a={SearchFor:h.get(this.searchTypes,e),SearchId:r};a=h.merge(a,t),this.cw.runRequest("Ams/Search/SaveDefinition",a).then(e=>{n(e.Value)}).catch(e=>{i(e)})})}}require("lodash");class l{constructor(e){this.cw=void 0,this.cw=e}getTemplates(e){return new Promise((t,s)=>{this.cw.runRequest("Ams/ServiceRequestTemplate/Templates",e).then(e=>{t(e.Value)}).catch(e=>{s(e)})})}}const m=require("lodash");class p{constructor(t,r){if(this.cw=void 0,this.activityTypes=void 0,this.currentActivityType=void 0,this.cw=t,this.activityTypes=new e,this.activityTypes.set("Unknown",0),this.activityTypes.set("Request",1),this.activityTypes.set("WorkOrder",2),this.activityTypes.set("CaTask",3),this.activityTypes.set("CaObject",4),this.activityTypes.set("CaCorrection",5),this.activityTypes.set("Project",6),this.activityTypes.set("Contract",7),!this.activityTypes.has(r))throw new s(1,"Activity type not found.",{provided:r,options:this.activityTypes});this.currentActivityType=r}add(e,t){return new Promise((s,r)=>{var n={ActivityType:this.activityTypes.get(this.currentActivityType),ActivitySid:e,Comments:t};this.cw.runRequest("Ams/Comment/Add",n).then(e=>{s(e.Value)}).catch(e=>{r(e)})})}update(e,t){return new Promise((s,r)=>{var n={ActivityType:this.activityTypes.get(this.currentActivityType),CommentId:e,Comments:t};this.cw.runRequest("Ams/Comment/Update",n).then(e=>{s(e.Value)}).catch(e=>{r(e)})})}get(e){return new Promise((t,s)=>{if(void 0!==e&&null!=e){var r={ActivitySids:e,ActivityType:this.activityTypes.get(this.currentActivityType)};this.cw.runRequest("Ams/Comment/ByActivitySids",r).then(s=>{t(1==e.length?s.Value[e[0]]:s.Value)})}})}getPredefined(e,t){return new Promise((s,r)=>{var n={};"Request"==this.currentActivityType&&m.set(n,"ProblemSid",e),void 0===t||"Request"!=this.currentActivityType&&"WorkOrder"!=this.currentActivityType||m.set(n,"Category",t),m.set(n,"ActivityType",this.activityTypes.get(this.currentActivityType)),this.cw.runRequest("Ams/Comment/PredefinedComments",n).then(e=>{s(e.Value)}).catch(e=>{r(e)})})}}const w=require("lodash");class y{constructor(e){this.cw=void 0,this.admin=void 0,this.comment=void 0,this.cw=e,this.admin=new l(e),this.comment=new p(e,"Request")}create(e){return new Promise((t,r)=>{w.has(e,"ProblemSid")?this.cw.runRequest("Ams/ServiceRequest/Create",e).then(e=>{t(e.Value)}).catch(e=>{r(e)}):r(new s(2,"ProblemSid must be provided.",{provided:e}))})}update(e){return new Promise((t,r)=>{w.has(e,"RequestId")?this.cw.runRequest("Ams/ServiceRequest/Update",e).then(e=>{t(e.Value)}).catch(e=>{r(e)}):r(new s(3,"RequestId must be provided.",{provided:e}))})}move(e,t,r,n,i){return new Promise((a,u)=>{w.has(n,"WKID")||w.has(n,"WKT")||u(new s(6,"You must provide either the WKID or WKT for the x/y coordinates.",{projection:n}));var o={RequestId:e,X:t,Y:r};void 0!==i&&w.set(o,"Z",i);var c=w.merge(o,n);this.cw.runRequest("Ams/ServiceRequest/Move",c).then(e=>{a(e.Value)}).catch(e=>{u(e)})})}changeProblem(e,t){return new Promise((s,r)=>{this.cw.runRequest("Ams/ServiceRequest/ChangeProblem",{RequestId:e,ProblemSid:t}).then(e=>{s(e.Value)}).catch(e=>{r(e)})})}getById(e){return new Promise((t,s)=>{this.cw.runRequest("Ams/ServiceRequest/ById",{RequestId:e}).then(e=>{t(e.Value)}).catch(e=>{s(e)})})}getByIds(e){return new Promise((t,s)=>{this.cw.runRequest("Ams/ServiceRequest/ByIds",{RequestIds:e}).then(e=>{t(e.Value)}).catch(e=>{s(e)})})}getAuditLog(e){return new Promise((t,s)=>{this.cw.runRequest("Ams/ServiceRequest/AuditLog",{RequestId:e}).then(e=>{t(e.Value)}).catch(e=>{s(e)})})}getCustomFields(e){return new Promise((t,s)=>{this.cw.runRequest("Ams/ServiceRequest/CustomFields",{RequestIds:e}).then(e=>{t(e.Value)}).catch(e=>{s(e)})})}changeCustomFieldCategory(e,t){return new Promise((s,r)=>{this.cw.runRequest("Ams/ServiceRequest/ChangeCustomFieldCategory",{RequestIds:e,CategoryId:t}).then(e=>{s(e.Value)}).catch(e=>{r(e)})})}cancel(e,t,s){return new Promise((r,n)=>{var i={RequestIds:e};void 0!==t&&w.set(i,"CancelReason",t),void 0!==s&&w.set(i,"DateCancelled",s),this.cw.runRequest("Ams/ServiceRequest/Cancel",i).then(e=>{r(e.Value)}).catch(e=>{n(e)})})}uncancel(e){return new Promise((t,s)=>{this.cw.runRequest("Ams/ServiceRequest/Uncancel",{RequestIds:e}).then(e=>{t(e.Value)}).catch(e=>{s(e)})})}close(e){return new Promise((t,r)=>{this.cw.runRequest("Ams/ServiceRequest/Close",{RequestIds:e}).then(e=>{e.Status>0?r(new s(5,e.Message,{response:e})):t(e.Value)}).catch(e=>{r(e)})})}reopen(e){return new Promise((t,s)=>{this.cw.runRequest("Ams/ServiceRequest/ReOpen",{RequestIds:e}).then(e=>{t(e.Value)}).catch(e=>{s(e)})})}delete(e){return new Promise((t,r)=>{this.cw.runRequest("Ams/ServiceRequest/Delete",{RequestIds:e}).then(e=>{e.Status>0?r(new s(4,e.Message,{response:e})):t(e.Value)}).catch(e=>{r(e)})})}search(e){return new Promise((t,s)=>{this.cw.runRequest("Ams/ServiceRequest/Search",e).then(e=>{t(e.Value)}).catch(e=>{s(e)})})}searchObject(e){return new Promise((t,s)=>{this.cw.runRequest("Ams/ServiceRequest/SearchObject",{RequestId:e}).then(e=>{t(e.Value)}).catch(e=>{s(e)})})}createSearchDefinition(e,t,s,r=!0,n=!0){return new Promise((s,i)=>{var a=e;w.isString(t)&&(w.set(a,"SearchName",t),w.set(a,"SaveDefinition",r),w.set(a,"EnableEurl",n)),this.cw.runRequest("Ams/ServiceRequest/CreateSearchDefinition",a).then(e=>{s(e.Value)}).catch(e=>{i(e)})})}getProblemNodes(e,t=!1,s,r=!1){return new Promise((n,i)=>{var a={DomainId:e,IncludeCancelled:r,ViewOnly:t};null!=s&&w.has(s,"DisplayTextMode")&&(w.set(a,"DisplayTextMode",w.get(s,"DisplayTextMode")),"CD"==w.get(s,"DisplayTextMode")&&w.has(s,"DisplayTextDelimeter")&&w.set(a,"DisplayTextDelimeter",w.get(s,"DisplayTextDelimeter"))),this.cw.runRequest("Ams/ServiceRequest/ProblemNodes",a).then(e=>{n(e.Value)}).catch(e=>{i(e)})})}getProblems(e=!1,t=!0,s){return new Promise((r,n)=>{var i={ForPublicOnly:e,OnlyActiveTemplates:t};void 0!==s&&w.set(i,"DomainIds",s),this.cw.runRequest("Ams/ServiceRequest/Problems",i).then(e=>{r(e.Value)}).catch(e=>{n(e)})})}getProblemsByKeywords(e){return new Promise((t,s)=>{this.cw.runRequest("Ams/ServiceRequest/ProblemsByKeywords",{Keywords:e}).then(e=>{t(e.Value)}).catch(e=>{s(e)})})}getPriorities(e){return new Promise((t,s)=>{this.cw.runRequest("Ams/ServiceRequest/Priorities",{ProblemSids:e}).then(e=>{t(e.Value)}).catch(e=>{s(e)})})}getCustomFieldTemplate(e){return new Promise((t,s)=>{this.cw.runRequest("Ams/ServiceRequest/TemplateCustomFields",{ProblemSids:e}).then(e=>{t(e.Value)}).catch(e=>{s(e)})})}getQASettings(e){return new Promise((t,s)=>{this.cw.runRequest("Ams/ServiceRequest/QA",{ProblemSids:e}).then(e=>{t(e.Value)}).catch(e=>{s(e)})})}getProblemLeaf(e){return new Promise((t,s)=>{this.cw.runRequest("Ams/ServiceRequest/ProblemLeafBySid",{ProblemSid:e}).then(e=>{t(e.Value)}).catch(e=>{s(e)})})}getStatuses(e){return new Promise((t,s)=>{this.cw.runRequest("Ams/ServiceRequest/DefaultStatus",{DomainIds:e}).then(e=>{t(e.Value)}).catch(e=>{s(e)})})}getEmployeeLists(e,t){return new Promise((r,n)=>{var i={DomainId:t};w.includes(["DispatchTo","SubmitTo"],e)?this.cw.runRequest(`Ams/ServiceRequest/${e}`,i).then(e=>{r(e.Value)}).catch(e=>{n(e)}):n(new s(2,"listType must be either SubmitTo or DispatchTo.",{provided:e}))})}getDispatchTos(e){return this.getEmployeeLists("DispatchTo",e)}getSubmitTos(e){return this.getEmployeeLists("SubmitTo",e)}streetCodes(){return new Promise((e,t)=>{this.cw.runRequest("Ams/ServiceRequest/AllStreetCode",{}).then(t=>{e(t.Value)}).catch(e=>{t(e)})})}getTemplatesById(e,t,s){return new Promise((e,r)=>{var n={ProblemSids:null};void 0!==t&&w.set(n,"MinimumDateModified",t),void 0!==s&&w.set(n,"MaximumDateModified",s),this.cw.runRequest("Ams/ServiceRequestTemplate/ByIds",n).then(t=>{e(t.Value)}).catch(e=>{r(e)})})}createTemplateSearchDefinition(e,t,s,r=!0){return new Promise((s,n)=>{var i=e;w.isString(t)&&(w.set(i,"SearchName",t),w.set(i,"SaveDefinition",r)),this.cw.runRequest("Ams/ServiceRequestTemplate/CreateSearchDefinition",i).then(e=>{s(e.Value)}).catch(e=>{n(e)})})}getTemplateQAs(e,t,s){return new Promise((e,t)=>{this.cw.runRequest("Ams/ServiceRequestTemplate/QA",{ProblemSids:null}).then(t=>{e(t.Value)}).catch(e=>{t(e)})})}searchTemplates(e){return new Promise((t,s)=>{this.cw.runRequest("Ams/ServiceRequestTemplate/Search",e).then(e=>{t(e.Value)}).catch(e=>{s(e)})})}getTemplates(e,t=!1,s=!1,r,n){return new Promise((i,a)=>{var u={CanCreate:t,IncludeInactiveIf:s};void 0!==e&&w.set(u,"TemplateIds",e),void 0!==r&&w.set(u,"MinimumDateModified",r),void 0!==n&&w.set(u,"MaximumDateModified",n),this.cw.runRequest("Ams/ServiceRequestTemplate/Templates",u).then(e=>{i(e.Value)}).catch(e=>{a(e)})})}getWOTemplates(e,t=!1){return new Promise((s,r)=>{this.cw.runRequest("Ams/ServiceRequestTemplate/WorkOrderTemplates",{ProblemSids:e,IncludeInactive:t}).then(e=>{s(e.Value)}).catch(e=>{r(e)})})}}const v=require("lodash");class I{constructor(e){this.cw=void 0,this.cw=e}getTemplates(e,t,s){return new Promise((r,n)=>{var i={};void 0!==e&&(i.EntityTypes=e),i.CanCreate=void 0===t||t,"object"==typeof s&&v.forIn(s,(e,t)=>{i[t]=e}),this.cw.runRequest("Ams/InspectionTemplate/Templates",i).then(e=>{r(e.Value)}).catch(e=>{n(e)})})}}const P=require("lodash");class T{constructor(e){this.cw=void 0,this.admin=void 0,this.cw=e,this.admin=new I(e)}create(e){return new Promise((t,r)=>{P.has(e,"EntityType")&&P.has(e,"InspTemplateId")?this.cw.runRequest("Ams/Inspection/Create",e).then(e=>{t(e.Value)}).catch(e=>{r(e)}):r(new s(1,"EntityType and InspTemplateId properties must be provided.",{provided:e}))})}createFromEntities(e){return new Promise((t,r)=>{P.has(e,"EntityType")&&P.has(e,"InspTemplateId")?this.cw.runRequest("Ams/Inspection/CreateFromEntities",e).then(e=>{t(e.Value)}).catch(e=>{r(e)}):r(new s(1,"EntityType and InspTemplateId properties must be provided.",{provided:e}))})}createFromParent(e){return new Promise((t,r)=>{P.has(e,"EntityType")&&P.has(e,"InspTemplateId")&&P.has(e,"InspectionId")?this.cw.runRequest("Ams/Inspection/CreateFromParent",e).then(e=>{t(e.Value)}).catch(e=>{r(e)}):r(new s(1,"EntityType and InspTemplateId properties must be provided.",{provided:e}))})}createFromServiceRequest(e){return new Promise((t,r)=>{P.has(e,"EntityType")&&P.has(e,"InspTemplateId")&&P.has(e,"RequestId")?this.cw.runRequest("Ams/Inspection/CreateFromServiceRequest",e).then(e=>{t(e.Value)}).catch(e=>{r(e)}):r(new s(1,"EntityType and InspTemplateId properties must be provided.",{provided:e}))})}createFromWorkOrder(e){return new Promise((t,r)=>{P.has(e,"EntityType")&&P.has(e,"InspTemplateId")&&P.has(e,"WorkOrderSid")?this.cw.runRequest("Ams/Inspection/CreateFromWorkOrder",e).then(e=>{t(e.Value)}).catch(e=>{r(e)}):r(new s(1,"EntityType and InspTemplateId properties must be provided.",{provided:e}))})}update(e){return new Promise((t,r)=>new Promise((t,r)=>{P.has(e,"InspectionId")?this.cw.runRequest("Ams/Inspection/Update",e).then(e=>{t(e.Value)}).catch(e=>{r(e)}):r(new s(1,"InspectionId must be provided.",{provided:e}))}))}getById(e){return new Promise((t,s)=>{this.cw.runRequest("Ams/Inspection/ById",{InspectionId:e}).then(e=>{t(e.Value)}).catch(e=>{s(e)})})}getByIds(e){return new Promise((t,s)=>{this.cw.runRequest("Ams/Inspection/ByIds",{InspectionIds:e}).then(e=>{t(e.Value)}).catch(e=>{s(e)})})}cancel(e,t,s){return new Promise((r,n)=>{var i={InspectionIds:e};void 0!==t&&(i.CancelReason=t),void 0!==s&&(i.DateCancelled=s),this.cw.runRequest("Ams/Inspection/Cancel",i).then(e=>{r(e.Value)}).catch(e=>{n(e)})})}uncancel(e){return new Promise((t,s)=>{this.cw.runRequest("Ams/Inspection/Uncancel",{InspectionIds:e}).then(e=>{t(e.Value)}).catch(e=>{s(e)})})}close(e){return new Promise((t,s)=>{this.cw.runRequest("Ams/Inspection/Close",{InspectionIds:e}).then(e=>{t(e.Value)}).catch(e=>{s(e)})})}reopen(e){return new Promise((t,s)=>{this.cw.runRequest("Ams/Inspection/Reopen",{InspectionIds:e}).then(e=>{t(e.Value)}).catch(e=>{s(e)})})}delete(e){return new Promise((t,s)=>{this.cw.runRequest("Ams/Inspection/Delete",{InspectionIds:e}).then(e=>{t(e.Value)}).catch(e=>{s(e)})})}search(e){return new Promise((t,s)=>{this.cw.runRequest("Ams/Inspection/Search",e).then(e=>{t(e.Value)}).catch(e=>{s(e)})})}searchObject(e){return new Promise((t,s)=>{this.cw.runRequest("Ams/ServiceRequest/SearchObject",{InspectionId:e}).then(e=>{t(e.Value)}).catch(e=>{s(e)})})}statuses(){return new Promise((e,t)=>{this.cw.runRequest("Ams/Inspection/Statuses",{}).then(t=>{e(t.Value)}).catch(e=>{t(e)})})}submitTos(e=!1,t){return new Promise((s,r)=>{var n={};e&&(n.IncludeInactiveEmployees=!0),void 0!==t&&(n.DomainIds=t),this.cw.runRequest("Ams/Inspection/SubmitTos",n).then(e=>{s(e.Value)}).catch(e=>{r(e)})})}connectAsset(e,t,s=!0,r={}){return new Promise((s,n)=>{var i={InspectionId:t};P.has(e,"EntityType")&&P.has(e,"EntityUid")?(i.EntityType=e.EntityType,i.EntityUid=e.EntityUid):P.has(e,"Entity")&&(i.Entity=e.Entity),P.has(r,"Facility_Id")&&(i.Facility_Id=r.Facility_Id),P.has(r,"Level_Id")&&(i.Level_Id=r.Level_Id),this.cw.runRequest("Ams/Inspection/AddEntity",i).then(e=>{s(e.Value)}).catch(e=>{n(e)})})}getAnswers(e){return new Promise((t,s)=>{var r={};0==e.length?r.InspectionId=e[0]:r.InspectionIds=e,this.cw.runRequest("Ams/Inspection/Answers",r).then(e=>{t(e.Value)}).catch(e=>{s(e)})})}getAuditLog(e){return new Promise((t,s)=>{this.cw.runRequest("Ams/Inspection/AuditLog",{InspectionId:e}).then(e=>{t(e.Value)}).catch(e=>{s(e)})})}createSearchDefinition(e,t,s,r=!0,n=!0){return new Promise((s,i)=>{var a=e;P.isString(t)&&(P.set(a,"SearchName",t),P.set(a,"SaveDefinition",r),P.set(a,"EnableEurl",n)),this.cw.runRequest("Ams/Inspection/CreateSearchDefinition",a).then(e=>{s(e.Value)}).catch(e=>{i(e)})})}getCycleFrom(){return new Promise((e,t)=>{this.cw.runRequest("Ams/Inspection/CycleFrom",{}).then(t=>{e(t.Value)}).catch(e=>{t(e)})})}getCycleIntervals(){return new Promise((e,t)=>{this.cw.runRequest("Ams/Inspection/CycleIntervals",{}).then(t=>{e(t.Value)}).catch(e=>{t(e)})})}getCycleTypes(){return new Promise((e,t)=>{this.cw.runRequest("Ams/Inspection/CycleTypes",{}).then(t=>{e(t.Value)}).catch(e=>{t(e)})})}getDistricts(){return new Promise((e,t)=>{this.cw.runRequest("Ams/Inspection/Districts",{}).then(t=>{e(t.Value)}).catch(e=>{t(e)})})}getEmployeeLists(e,t=!1,r){return new Promise((n,i)=>{var a={IncludeInactiveEmployees:t};void 0!==r&&null!=r&&P.set(a,"DomainIds",r),"SubmitTos"!=e?i(new s(2,'listType must be "SubmitTos".',{provided:e})):this.cw.runRequest(`Ams/Inspection/${e}`,a).then(e=>{n(e.Value)}).catch(e=>{i(e)})})}getSubmitTos(e=!1,t){return this.getEmployeeLists("SubmitTos",e,t)}move(e,t,r,n,i){return new Promise((a,u)=>{P.has(n,"WKID")||P.has(n,"WKT")||u(new s(3,"You must provide either the WKID or WKT for the x/y coordinates.",{projection:n}));var o={InspectionId:e,X:t,Y:r};void 0!==i&&P.set(o,"Z",i);var c=P.merge(o,n);this.cw.runRequest("Ams/Inspection/Move",c).then(e=>{a(e.Value)}).catch(e=>{u(e)})})}getTemplates(e,t,s){return new Promise((r,n)=>{var i={};void 0!==e&&(i.EntityTypes=e),i.CanCreate=void 0===t||t,"object"==typeof s&&P.forIn(s,(e,t)=>{i[t]=e}),this.cw.runRequest("Ams/InspectionTemplate/Templates",i).then(e=>{r(e.Value)}).catch(e=>{n(e)})})}getTemplatesByIds(e,t){return new Promise((s,r)=>{var n={InspTemplateIds:e};"object"==typeof t&&P.forIn(t,(e,t)=>{n[t]=e}),this.cw.runRequest("Ams/InspectionTemplate/ByIds",n).then(e=>{s(e.Value)}).catch(e=>{r(e)})})}getTemplateEntityTypes(e){return new Promise((t,s)=>{this.cw.runRequest("Ams/InspectionTemplate/EntityTypes",{InspTemplateIds:e}).then(e=>{t(e.Value)}).catch(e=>{s(e)})})}getQA(e){return new Promise((t,s)=>{this.cw.runRequest("Ams/InspectionTemplate/QA",{InspTemplateIds:e}).then(e=>{t(e.Value)}).catch(e=>{s(e)})})}getQConditions(e){return new Promise((t,s)=>{this.cw.runRequest("Ams/InspectionTemplate/QuestionConditions",{InspTemplateIds:e}).then(e=>{t(e.Value)}).catch(e=>{s(e)})})}deleteAttachments(e){return new Promise((t,s)=>{this.cw.runRequest("Ams/Attachments/DeleteInspectionAttachments",{AttachmentIds:e}).then(e=>{t(e.Value)}).catch(e=>{s(e)})})}downloadAttachment(e){return new Promise((t,s)=>{this.cw.runRequest("Ams/Attachments/DownloadInspectionAttachment",{AttachmentId:e}).then(e=>{}).catch(e=>{s(e)})})}getAttachmentById(e){return new Promise((t,s)=>{this.cw.runRequest("Ams/Attachments/InspectionAttachmentById",{AttachmentId:e}).then(e=>{t(e.Value)}).catch(e=>{s(e)})})}getAttachments(e){return new Promise((t,s)=>{this.cw.runRequest("Ams/Attachments/InspectionAttachments",{InspectionIds:e}).then(e=>{t(e.Value)}).catch(e=>{s(e)})})}}require("lodash");class C{constructor(e){this.cw=void 0,this.cw=e}getEntityGroups(){return new Promise((e,t)=>{this.cw.runRequest("Ams/Entity/Groups",{}).then(t=>{e(t.Value)}).catch(e=>{t(e)})})}getEntityTypes(e){return new Promise((t,s)=>{this.cw.runRequest("Ams/Designer/WOTemplates",{EntityGroups:e}).then(e=>{t(e.Value)}).catch(e=>{s(e)})})}getTemplates(e,t=!0,s=!0){return new Promise((r,n)=>{this.cw.runRequest("Ams/Designer/WOTemplates",{EntityType:e,IncludeComments:t,IncludeInstructions:s}).then(e=>{r(e.Value)}).catch(e=>{n(e)})})}updateTemplate(e){return new Promise((t,s)=>{this.cw.runRequest("Ams/Designer/WOTemplates",e).then(e=>{t(e.Value)}).catch(e=>{s(e)})})}getTemplateGroupRights(e){return new Promise((t,s)=>{this.cw.runRequest("Ams/Designer/WOTemplates",{WOTemplateIds:e}).then(e=>{t(e.Value)}).catch(e=>{s(e)})})}getTemplateActivity(e){return new Promise((t,s)=>{this.cw.runRequest("Ams/Designer/WOTemplateActivityService",{WOTemplateIds:e}).then(e=>{t(e.Value)}).catch(e=>{s(e)})})}getUpdateFields(e){return new Promise((t,s)=>{this.cw.runRequest("Ams/Designer/WOTemplateUpdateFields",{WOTemplateIds:e}).then(e=>{t(e.Value)}).catch(e=>{s(e)})})}getTemplateEquipment(e){return new Promise((t,s)=>{this.cw.runRequest("Ams/Designer/WOTemplateEquipment",{WOTemplateId:e}).then(e=>{t(e.Value)}).catch(e=>{s(e)})})}getTemplateLabor(e){return new Promise((t,s)=>{this.cw.runRequest("Ams/Designer/WOTemplateLabor",{WOTemplateId:e}).then(e=>{t(e.Value)}).catch(e=>{s(e)})})}getTemplateMaterial(e){return new Promise((t,s)=>{this.cw.runRequest("Ams/Designer/WOTemplateMaterial",{WOTemplateId:e}).then(e=>{t(e.Value)}).catch(e=>{s(e)})})}getTemplateMapLayerFields(e){return new Promise((t,s)=>{this.cw.runRequest("Ams/Designer/WorkOrderTemplateMapLayerFields",{WorkOrderTemplateId:e}).then(e=>{t(e.Value)}).catch(e=>{s(e)})})}getTemplateTasks(e){return new Promise((t,s)=>{this.cw.runRequest("Ams/Tasks/ByWorkOrderTemplate",{WOTemplateId:e}).then(e=>{t(e.Value)}).catch(e=>{s(e)})})}getRelatedInspectionTemplates(e){return new Promise((t,s)=>{this.cw.runRequest("Ams/Designer/WOTemplateInspections",{WOTemplateId:e}).then(e=>{t(e.Value)}).catch(e=>{s(e)})})}}const R=require("lodash");class q{constructor(e){this.cw=void 0,this.admin=void 0,this.comment=void 0,this.cw=e,this.admin=new C(e),this.comment=new p(e,"WorkOrder")}create(e,t,r){return new Promise((n,i)=>{if(R.has(e,"WOTemplateId")&&R.has(e,"EntityType")){var a=e;void 0===t||null==t||R.has(a,"InspectionIds")||R.set(a,"InspectionIds",t),void 0===r||null==r||R.has(a,"RequestIds")||R.set(a,"RequestIds",r),this.cw.runRequest("Ams/WorkOrder/Create",a).then(e=>{n(e.Value)}).catch(e=>{i(e)})}else i(new s(2,"WOTemplateId & EntityType must be provided.",{provided:e}))})}createFromParent(e,t,r=!0){return new Promise((r,n)=>{if(R.has(e,"WOTemplateId")&&R.has(e,"EntityType")){var i=e;R.isString(t)?R.set(i,"WorkOrderId",t):R.set(i,"WorkOrderSid",t),this.cw.runRequest("Ams/WorkOrder/Create",i).then(e=>{r(e.Value)}).catch(e=>{n(e)})}else n(new s(2,"WOTemplateId & EntityType must be provided.",{provided:e}))})}update(e){return new Promise((t,r)=>{R.has(e,"WorkOrderSid")||R.has(e,"WorkOrderId")?this.cw.runRequest("Ams/WorkOrder/Update",e).then(e=>{t(e.Value)}).catch(e=>{r(e)}):r(new s(3,"WorkOrderId or WorkOrderSid must be provided.",{provided:e}))})}combine(e,t,r=!0){return new Promise((n,i)=>{this.cw.runRequest("Ams/WorkOrder/Combine",{CancelCombinedWorkOrders:r,ToWorkOrderId:t,FromWorkOrderIds:e}).then(e=>{e.Status>0?i(new s(4,e.Message,{response:e})):n(e.Value)}).catch(e=>{i(e)})})}move(e,t,r,n,i){return new Promise((a,u)=>{R.has(n,"WKID")||R.has(n,"WKT")||u(new s(6,"You must provide either the WKID or WKT for the x/y coordinates.",{projection:n}));var o={WorkOrderId:e,X:t,Y:r};void 0!==i&&R.set(o,"z",i);var c=R.merge(o,n);this.cw.runRequest("Ams/WorkOrder/Move",c).then(e=>{a(e.Value)}).catch(e=>{u(e)})})}getById(e,t=!0){return new Promise((t,s)=>{var r={};if(R.isString(e)){R.set(r,"WorkOrderId",e);var n="Ams/WorkOrder/ById"}else R.set(r,"WorkOrderSid",e),n="Ams/WorkOrder/BySid";this.cw.runRequest(n,r).then(e=>{t(e.Value)}).catch(e=>{s(e)})})}getByIds(e){return new Promise((t,r)=>{var n={};if(0==e.length)r(new s(101,"No workorder S/IDs were provided.",{workorderSId:e}));else{var i="Ams/WorkOrder/ByIds";R.isString(e[0])?(R.set(n,"WorkOrderIds",e),i="Ams/WorkOrder/ByIds"):R.isNumber(e[0])?(R.set(n,"WorkOrderSids",e),i="Ams/WorkOrder/BySids"):r(new s(9,"No workorder S/IDs were provided.",{workorderSId:e})),this.cw.runRequest(i,n).then(e=>{t(e.Value)}).catch(e=>{r(e)})}})}getInstructions(e){return new Promise((t,r)=>{var n={};if(0==e.length)r(new s(102,"No workorder S/IDs were provided.",{workorderSId:e}));else{var i="Ams/WorkOrder/ByIds";R.isString(e[0])?(R.set(n,"WorkOrderIds",e),i="Ams/WorkOrder/InstructionsByWorkOrderIds"):R.isNumber(e[0])?(R.set(n,"WorkOrderSids",e),i="Ams/WorkOrder/InstructionsByWorkOrderSids"):r(new s(9,"No workorder S/IDs were provided.",{workorderSId:e})),this.cw.runRequest(i,n).then(e=>{t(e.Value)}).catch(e=>{r(e)})}})}getAuditLog(e){return new Promise((t,r)=>{var n={};R.isString(e)?R.set(n,"WorkOrderId",e):R.isNumber(e)?R.set(n,"WorkOrderSid",e):r(new s(9,"Workorder S/IDs was not provided.",{workorderSId:e})),this.cw.runRequest("Ams/WorkOrder/AuditLog",n).then(e=>{t(e.Value)}).catch(e=>{r(e)})})}getCustomFieldValues(e){return new Promise((t,r)=>{var n={},i="Ams/WorkOrder/CustomFields";R.isString(e[0])?(R.set(n,"WorkOrderIds",e),i="Ams/WorkOrder/CustomFields"):R.isNumber(e[0])?(R.set(n,"WorkOrderSids",e),i="Ams/WorkOrder/CustomFieldsByWorkOrderSids"):r(new s(9,"No workorder S/IDs were provided.",{workorderSIds:e})),this.cw.runRequest(i,n).then(e=>{t(e.Value)}).catch(e=>{r(e)})})}getEntities(e,t=!0){return new Promise((r,n)=>{var i={GetGisData:t};0==e.length?n(new s(11,"No workorder S/IDs were provided.",{workorderSId:e})):R.isString(e[0])?R.set(i,"WorkOrderIds",e):R.isNumber(e[0])?R.set(i,"WorkOrderSids",e):n(new s(12,"No workorder S/IDs were provided.",{workorderSId:e})),this.cw.runRequest("Ams/WorkOrder/Entities",i).then(e=>{e.Status>0?n(new s(4,e.Message,{response:e})):r(e.Value)}).catch(e=>{n(e)})})}addEntities(e,t,r=!0){return new Promise((n,i)=>{var a={UpdateXY:r};R.isString(e)?R.set(a,"WorkOrderId",e):R.set(a,"WorkOrderSid",e),R.has(t,"Facility_Id")&&R.set(a,"Facility_Id",R.get(t,"Facility_Id")),R.has(t,"Level_Id")&&R.set(a,"Level_Id",R.get(t,"Level_Id")),R.has(t,"EntityUids")&&R.has(t,"EntityType")?(R.set(a,"EntityUids",R.get(t,"EntityUids")),R.set(a,"EntityType",R.get(t,"EntityType"))):i(new s(7,"No entity info was provided.",{workorderSId:e,entityInfo:t})),this.cw.runRequest("Ams/WorkOrder/AddEntities",a).then(e=>{e.Status>0?i(new s(4,e.Message,{response:e})):n(e.Value)}).catch(e=>{i(e)})})}updateEntity(e,t,r=!1){return new Promise((n,i)=>{var a={WorkComplete:r};R.isString(e)?R.set(a,"WorkOrderId",e):R.set(a,"WorkOrderSid",e),R.has(t,"Facility_Id")&&R.set(a,"Facility_Id",R.get(t,"Facility_Id")),R.has(t,"Level_Id")&&R.set(a,"Level_Id",R.get(t,"Level_Id")),R.has(t,"EntityUids")&&R.has(t,"EntityType")?(R.set(a,"EntityUid",R.get(t,"EntityUid")),R.set(a,"EntityType",R.get(t,"EntityType"))):i(new s(7,"No entity info was provided.",{workorderSId:e,entityInfo:t})),this.cw.runRequest("Ams/WorkOrder/UpdateEntity",a).then(e=>{e.Status>0?i(new s(4,e.Message,{response:e})):n(e.Value)}).catch(e=>{i(e)})})}removeEntities(e,t,r=!0){return new Promise((n,i)=>{var a={UpdateXY:r};R.isString(e)?R.set(a,"WorkOrderId",e):R.set(a,"WorkOrderSid",e),R.has(t,"ObjectIds")?R.set(a,"ObjectIds",R.get(t,"ObjectIds")):R.has(t,"EntityUids")&&R.has(t,"EntityType")?(R.set(a,"EntityUids",R.get(t,"EntityUids")),R.set(a,"EntityType",R.get(t,"EntityType"))):i(new s(8,"No entity info was provided.",{workorderSId:e,entityInfo:t})),this.cw.runRequest("Ams/WorkOrder/RemoveEntities",a).then(e=>{e.Status>0?i(new s(4,e.Message,{response:e})):n(e.Value)}).catch(e=>{i(e)})})}cancel(e,t,s){return new Promise((r,n)=>{var i={WorkOrderIds:e};void 0!==t&&R.set(i,"CancelReason",t),void 0!==s&&R.set(i,"DateCancelled",s),this.cw.runRequest("Ams/WorkOrder/Cancel",i).then(e=>{r(e.Value)}).catch(e=>{n(e)})})}uncancel(e){return new Promise((t,s)=>{this.cw.runRequest("Ams/WorkOrder/Uncancel",{WorkOrderIds:e}).then(e=>{t(e.Value)}).catch(e=>{s(e)})})}close(e){return new Promise((t,r)=>{this.cw.runRequest("Ams/WorkOrder/Close",{WorkOrderIds:e}).then(e=>{e.Status>0?r(new s(5,e.Message,{response:e})):t(e.Value)}).catch(e=>{r(e)})})}reopen(e){return new Promise((t,s)=>{this.cw.runRequest("Ams/WorkOrder/ReOpen",{WorkOrderIds:e}).then(e=>{t(e.Value)}).catch(e=>{s(e)})})}delete(e){return new Promise((t,r)=>{this.cw.runRequest("Ams/WorkOrder/Delete",{WorkOrderIds:e}).then(e=>{e.Status>0?r(new s(4,e.Message,{response:e})):t(e.Value)}).catch(e=>{r(e)})})}getWOsByEntities(e,t,r,n=!0){return new Promise((i,a)=>{var u={};void 0!==r&&R.merge(u,r),R.has(u,"EntityType")||R.set(u,"EntityType",e),R.has(u,"EntityUids")||R.set(u,"EntityUids",t);var o="Ams/WorkOrder/SearchForSids";n||(o="Ams/WorkOrder/Search"),this.cw.runRequest(o,u).then(e=>{e.Status>0?a(new s(4,e.Message,{response:e})):i(e.Value)}).catch(e=>{a(e)})})}getSearchList(e){return new Promise((t,r)=>{var n={};R.set(n,"WorkOrderId",e),this.cw.runRequest("Ams/WorkOrder/SearchObject",n).then(e=>{e.Status>0?r(new s(4,e.Message,{response:e})):t(e.Value)}).catch(e=>{r(e)})})}getEmployeeLists(e,t=!1,r){return new Promise((n,i)=>{var a={IncludeInactiveEmployees:t};void 0!==r&&null!=r&&R.set(a,"DomainIds",r),R.includes(["Supervisors","SubmitTos"],e)?this.cw.runRequest(`Ams/WorkOrder/${e}`,a).then(e=>{n(e.Value)}).catch(e=>{i(e)}):i(new s(2,"listType must be either SubmitTos or Supervisors.",{provided:e}))})}getSubmitTos(e=!1,t){return this.getEmployeeLists("SubmitTos",e,t)}getSupervisors(e=!1,t){return this.getEmployeeLists("Supervisors",e,t)}getStatuses(){return new Promise((e,t)=>{this.cw.runRequest("Ams/WorkOrder/Statuses",{}).then(t=>{e(t.Value)}).catch(e=>{t(e)})})}getCategories(){return new Promise((e,t)=>{this.cw.runRequest("Ams/WorkOrder/Categories",{}).then(t=>{e(t.Value)}).catch(e=>{t(e)})})}getPriorities(){return new Promise((e,t)=>{this.cw.runRequest("Ams/WorkOrder/Priorities",{}).then(t=>{e(t.Value)}).catch(e=>{t(e)})})}getCycleFrom(){return new Promise((e,t)=>{this.cw.runRequest("Ams/WorkOrder/CycleFrom",{}).then(t=>{e(t.Value)}).catch(e=>{t(e)})})}getCycleIntervals(){return new Promise((e,t)=>{this.cw.runRequest("Ams/WorkOrder/CycleIntervals",{}).then(t=>{e(t.Value)}).catch(e=>{t(e)})})}getCycleTypes(){return new Promise((e,t)=>{this.cw.runRequest("Ams/WorkOrder/CycleTypes",{}).then(t=>{e(t.Value)}).catch(e=>{t(e)})})}getStages(){return new Promise((e,t)=>{this.cw.runRequest("Ams/WorkOrder/Stages",{}).then(t=>{e(t.Value)}).catch(e=>{t(e)})})}getExpenseTypes(){return new Promise((e,t)=>{this.cw.runRequest("Ams/WorkOrder/ExpenseTypes",{}).then(t=>{e(t.Value)}).catch(e=>{t(e)})})}}const g=require("lodash");class k{constructor(e){this.cw=void 0,this.cw=e}addGroup(e,t,s,r){return new Promise((n,i)=>{var a={CaObjectId:e,CaseDataGroupId:t,GroupCode:s};void 0!==r&&(a=g.merge(a,r)),this.cw.runRequest("Pll/CaseDataGroup/Add",a).then(e=>{n(e.Value)}).catch(e=>{i(e)})})}addDefaultGroups(e,t){return new Promise((s,r)=>{this.cw.runRequest("Pll/CaseDataGroup/AddDefault",{CaObjectId:e,BusCaseId:t}).then(e=>{s(e.Value)}).catch(e=>{r(e)})})}wipAddDetail(e,t,s,r,n,i){return new Promise((a,u)=>{var o=g.merge({CaseDataDetailId:e,CaDataGroupId:t,ColumnSequence:s,DetailCode:r,DetailSequence:n},i);this.cw.runRequest("Pll/CaseDataGroup/Add",o).then(e=>{a(e.Value)}).catch(e=>{u(e)})})}getGroupsByCaseId(e){return new Promise((t,s)=>{this.cw.runRequest("Pll/CaseDataGroup/ByCaObjectId",{CaObjectId:e}).then(e=>{t(e.Value)}).catch(e=>{s(e)})})}deleteGroupsByCaseId(e){return new Promise((t,s)=>{this.cw.runRequest("Pll/CaseDataGroup/DeleteByCaObjectId",{CaObjectId:e}).then(e=>{t(e.Value)}).catch(e=>{s(e)})})}searchForGroups(e){return new Promise((t,r)=>{0==g.intersectionBy(g.keysIn(e),["CaDataGroupId","CaseDataGroupId","GroupCode","GroupDesc","GroupSum","SumFlag"]).length&&r(new s(2,"At least one of the attributes (CaDataGroupId, CaseDataGroupId, GroupCode, GroupDesc, GroupSum, SumFlag) must be defined.")),this.cw.runRequest("Pll/CaseDataGroup/Search",e).then(e=>{t(e.Value)}).catch(e=>{r(e)})})}checkGIS(e,t,r){return new Promise((n,i)=>{var a={EntityType:e,EntityUid:t};g.has(r,"CaObjectId")?g.set(a,"CaObjectId",g.get(r,"CaObjectId")):g.has(r,"CaseDataGroupId")?g.set(a,"CaseDataGroupId",g.get(r,"CaseDataGroupId")):i(new s(1,"Either CaObjectId or CaseDataGroupId is required.",{provided:r})),g.has(r,"CaseDataDetailId")&&g.set(a,"CaseDataDetailId",g.get(r,"CaseDataDetailId")),this.cw.runRequest("Pll/CaseDataGroup/CheckGISChanges",a).then(e=>{n(e.Value)}).catch(e=>{i(e)})})}updateGroupsFromAsset(e,t,s,r){return new Promise((n,i)=>{var a={CaObjectId:e,EntityType:t,EntityUid:s};void 0!==r&&g.set(a,"CaDataGroupId",r),this.cw.runRequest("Pll/CaseDataGroup/UpdateFromAsset",a).then(e=>{n(e.Value)}).catch(e=>{i(e)})})}addDetail(e,t,s){return new Promise((r,n)=>{var i={CaDataGroupId:e,CaseDataDetailId:t};void 0!==s&&(i=g.merge(i,s)),this.cw.runRequest("Pll/CaseDataDetail/Add",i).then(e=>{r(e.Value)}).catch(e=>{n(e)})})}updateDetail(e,t){return new Promise((s,r)=>{var n={CaDataDetailId:e};void 0!==t&&(n=g.merge(n,t)),this.cw.runRequest("Pll/CaseDataDetail/Update",n).then(e=>{s(e.Value)}).catch(e=>{r(e)})})}lockDetail(e){return new Promise((t,s)=>{this.cw.runRequest("Pll/CaseDataDetail/UpdateLock",{CaDataDetailId:e,Lock:!0}).then(e=>{t(e.Value)}).catch(e=>{s(e)})})}unlockDetail(e){return new Promise((t,s)=>{this.cw.runRequest("Pll/CaseDataDetail/UpdateLock",{CaDataDetailId:e,Lock:!1}).then(e=>{t(e.Value)}).catch(e=>{s(e)})})}addListValue(e,t){return new Promise((s,r)=>{this.cw.runRequest("Pll/CaseDataListValues/Add",{CaDataDetailId:e,ListValue:t}).then(e=>{s(e.Value)}).catch(e=>{r(e)})})}deleteListValue(e){return new Promise((t,s)=>{this.cw.runRequest("Pll/CaseDataListValues/Delete",{CaDataDetailId:e}).then(e=>{t(e.Value)}).catch(e=>{s(e)})})}searchForListValueIds(e){return new Promise((t,r)=>{0==g.intersectionBy(g.keysIn(e),["CaDataDetailId","CaDataListId","ListValue"]).length&&r(new s(3,"At least one of the attributes (CaDataDetailId, CaDataListId, ListValue) must be defined.")),this.cw.runRequest("Pll/CaseDataGroup/Search",e).then(e=>{t(e.Value)}).catch(e=>{r(e)})})}searchForListValueObjects(e){return new Promise((t,r)=>{0==g.intersectionBy(g.keysIn(e),["CaDataDetailId","CaDataListId","ListValue"]).length&&r(new s(4,"At least one of the attributes (CaDataDetailId, CaDataListId, ListValue) must be defined.")),this.cw.runRequest("Pll/CaseDataGroup/SearchObject",e).then(e=>{t(e.Value)}).catch(e=>{r(e)})})}}const S=require("lodash");class A{constructor(e){this.cw=void 0,this.cw=e}addFee(e,t,s){return new Promise((r,n)=>{var i=S.merge({CaObjectId:e,FeeSetupId:t},s);this.cw.runRequest("Pll/CaseFees/Add",i).then(e=>{r(e.Value)}).catch(e=>{n(e)})})}addPayment(e,t){return new Promise((s,r)=>{var n=S.merge({CaObjectId:e},t);this.cw.runRequest("Pll/CasePayment/Add",n).then(e=>{s(e.Value)}).catch(e=>{r(e)})})}addRefund(e,t,s){return new Promise((r,n)=>{this.cw.runRequest("Pll/CasePaymentRefund/Add",{CaPaymentId:e,RefundAmount:t,Comments:s}).then(e=>{r(e.Value)}).catch(e=>{n(e)})})}addDepositPayment(e,t){return new Promise((s,r)=>{var n=S.merge({CaDepositId:e},t);this.cw.runRequest("Pll/CasePayment/AddDeposit",n).then(e=>{s(e.Value)}).catch(e=>{r(e)})})}addDeposit(e,t,s,r){return new Promise((n,i)=>{var a={CaObjectId:e,DepositId:t};void 0!==s&&S.set(a,"Amount",s),void 0!==r&&S.set(a,"CommentText",r),this.cw.runRequest("CaseDeposit/Add",a).then(e=>{n(e.Value)}).catch(e=>{i(e)})})}addInstrument(e,t,s,r,n){return new Promise((i,a)=>{var u=S.merge({CaObjectId:e,InstTypeId:t,Amount:s,DateExpire:r},n);this.cw.runRequest("Pll/CaseInstrument/Add",u).then(e=>{i(e.Value)}).catch(e=>{a(e)})})}updateFee(e,t){return new Promise((s,r)=>{var n=S.merge({CaFeeId:e},t);this.cw.runRequest("Pll/CaseFees/Update",n).then(e=>{s(e.Value)}).catch(e=>{r(e)})})}voidRefund(e,t){return new Promise((s,r)=>{this.cw.runRequest("Pll/CasePaymentRefund/Update",{CaPaymentRefundId:e,Voided:t}).then(e=>{s(e.Value)}).catch(e=>{r(e)})})}addDefaultFees(e,t){return new Promise((s,r)=>{this.cw.runRequest("Pll/CaseFees/AddDefault",{CaObjectId:e,BusCaseId:t}).then(e=>{s(e.Value)}).catch(e=>{r(e)})})}addDefaultDeposits(e,t){return new Promise((s,r)=>{this.cw.runRequest("Pll/CaseDeposit/AddDefault",{CaObjectId:e,BusCaseId:t}).then(e=>{s(e.Value)}).catch(e=>{r(e)})})}getFees(e){return new Promise((t,s)=>{this.cw.runRequest("Pll/CaseFees/ByCaObjectId",{CaObjectId:e}).then(e=>{t(e.Value)}).catch(e=>{s(e)})})}getDeposits(e){return new Promise((t,s)=>{this.cw.runRequest("Pll/CaseDeposit/ByCaObjectId",{CaObjectId:e}).then(e=>{t(e.Value)}).catch(e=>{s(e)})})}getPayments(e){return new Promise((t,s)=>{this.cw.runRequest("Pll/CasePayment/ByCaObjectId",{CaObjectId:e}).then(e=>{t(e.Value)}).catch(e=>{s(e)})})}getInstruments(e){return new Promise((t,s)=>{this.cw.runRequest("Pll/CaseInstrument/ByCaObjectId",{CaObjectId:e}).then(e=>{t(e.Value)}).catch(e=>{s(e)})})}deleteFee(e){return new Promise((t,s)=>{this.cw.runRequest("Pll/CaseFees/Delete",{CaFeeId:e}).then(e=>{t(e.Value)}).catch(e=>{s(e)})})}deleteFeesByCaseId(e){return new Promise((t,s)=>{this.cw.runRequest("Pll/CaseFees/DeleteByCaObjectId",{CaObjectId:e}).then(e=>{t(e.Value)}).catch(e=>{s(e)})})}deletePayment(e){return new Promise((t,s)=>{this.cw.runRequest("Pll/CasePayment/Delete",{CaFeeId:e}).then(e=>{t(e.Value)}).catch(e=>{s(e)})})}deleteRefund(e){return new Promise((t,s)=>{this.cw.runRequest("Pll/CasePaymentRefund/Delete",{CaPaymentRefundId:e}).then(e=>{t(e.Value)}).catch(e=>{s(e)})})}deletePaymentsByCaseId(e){return new Promise((t,s)=>{this.cw.runRequest("Pll/CasePayment/DeleteByCaObjectId",{CaObjectId:e}).then(e=>{t(e.Value)}).catch(e=>{s(e)})})}deleteDeposit(e){return new Promise((t,s)=>{this.cw.runRequest("Pll/CaseDeposit/Delete",{CaDepositId:e}).then(e=>{t(e.Value)}).catch(e=>{s(e)})})}deleteDepositsByCaseId(e){return new Promise((t,s)=>{this.cw.runRequest("Pll/CaseDeposit/DeleteByCaObjectId",{CaObjectId:e}).then(e=>{t(e.Value)}).catch(e=>{s(e)})})}deleteInstrument(e){return new Promise((t,s)=>{this.cw.runRequest("Pll/CaseInstrument/Delete",{CaInstrumentId:e}).then(e=>{t(e.Value)}).catch(e=>{s(e)})})}deleteInstrumentsByCaseId(e){return new Promise((t,s)=>{this.cw.runRequest("Pll/CaseInstrument/DeleteByCaObjectId",{CaObjectId:e}).then(e=>{t(e.Value)}).catch(e=>{s(e)})})}searchFees(e){return new Promise((t,r)=>{0==S.intersectionBy(S.keysIn(e),["CaFeeId","CaObjectId","FeeCode","FeeDesc"]).length&&r(new s(4,"At least one of the attributes (CaFeeId, CaObjectId, FeeCode, FeeDesc) must be defined.")),this.cw.runRequest("Pll/CaseFees/Search",e).then(e=>{t(e.Value)}).catch(e=>{r(e)})})}searchPayments(e){return new Promise((t,r)=>{0==S.intersectionBy(S.keysIn(e),["CaPaymentId","CommentText","FeeAmount","FeeCode","FeeDesc","PaymentAccount","PaymentAmount","TenderType"]).length&&r(new s(5,"At least one of the attributes (CaPaymentId, CommentText, FeeAmount, FeeCode, FeeDesc, PaymentAccount, PaymentAmount, TenderType) must be defined.")),this.cw.runRequest("Pll/CasePayment/Search",e).then(e=>{t(e.Value)}).catch(e=>{r(e)})})}searchRefunds(e){return new Promise((t,r)=>{0==S.intersectionBy(S.keysIn(e),["CaPaymentId","CaPaymentRefundId","Comments","RefundAmount"]).length&&r(new s(6,"At least one of the attributes (CaPaymentId, CaPaymentRefundId, Comments, RefundAmount) must be defined.")),this.cw.runRequest("Pll/CasePayment/Search",e).then(e=>{t(e.Value)}).catch(e=>{r(e)})})}searchDeposits(e){return new Promise((t,r)=>{0==S.intersectionBy(S.keysIn(e),["CaDepositId","CaObjectId","DepositCode","DepositDesc"]).length&&r(new s(1,"At least one of the arguments (CaDepositId, CaObjectId, DepositCode, DepositDesc) must be defined.")),this.cw.runRequest("Pll/CaseDeposit/Search",e).then(e=>{t(e.Value)}).catch(e=>{r(e)})})}getAllFeeTemplates(){return new Promise((e,t)=>{this.cw.runRequest("Pll/FeeSetup/All",{}).then(t=>{e(t.Value)}).catch(e=>{t(e)})})}searchFeeTemplates(e){return new Promise((t,r)=>{0==S.intersectionBy(S.keysIn(e),["FeeSetupId","FeeTypeId","FeeCode","FeeDesc","AccountCode"]).length&&r(new s(7,"At least one of the arguments (FeeSetupId, FeeTypeId, FeeCode, FeeDesc, AccountCode) must be defined.")),this.cw.runRequest("Pll/FeeSetup/Search",e).then(e=>{t(e.Value)}).catch(e=>{r(e)})})}searchCaseInstruments(e){return new Promise((t,r)=>{0==S.intersectionBy(S.keysIn(e),["AddressLine1","Amount","CaInstrumentId","CityName","CommentText","Company","ContactEmail","ContactName","ContactPhone","CountryCode","InstTypeId","SerialNumber","StateCode","ZipCode"]).length&&r(new s(9,"At least one of the arguments (AddressLine1, Amount, CaInstrumentId, CityName, CommentText, Company, ContactEmail, ContactName, ContactPhone, CountryCode, InstTypeId, SerialNumber, StateCode, ZipCode) must be defined.")),this.cw.runRequest("Pll/CaseInstrument/Search",e).then(e=>{t(e.Value)}).catch(e=>{r(e)})})}getInstrumentList(e){return new Promise((t,s)=>{this.cw.runRequest("Pll/CaseInstrument/GetList",e).then(e=>{t(e.Value)}).catch(e=>{s(e)})})}addCaseInstrumentRelease(e,t,r,n,i,a){return new Promise((u,o)=>{var c={CaInstrumentId:e,DateReleased:r,ReleasedBy:t};void 0===i&&null==i||void 0===n&&null==n?void 0!==i&&null!=i?S.set(c,"PercentReleased",i):void 0!==n&&null!=n&&S.set(c,"AmountReleased",n):o(new s(2,"Either amountReleased or percentReleased must be specified.")),void 0!==a&&S.set(c,"CommentText",a),this.cw.runRequest("Pll/CaseInstReleases/Add",c).then(e=>{u(e.Value)}).catch(e=>{o(e)})})}deleteCaseInstrumentRelease(e){return new Promise((t,s)=>{this.cw.runRequest("Pll/CaseInstReleases/Delete",{CaInstReleasesId:e}).then(e=>{t(e.Value)}).catch(e=>{s(e)})})}searchCaseInstrumentReleases(e){return new Promise((t,r)=>{var n=e;0==S.intersectionBy(S.keysIn(e),["AmountReleased","CaInstReleasesId","CaInstrumentId","CommentText","PercentReleased","ReleasedBy"]).length&&r(new s(3,"At least one of the attributes (AmountReleased, CaInstReleasesId, CaInstrumentId, CommentText, PercentReleased, ReleasedBy) must be defined.")),this.cw.runRequest("Pll/CaseInstReleases/Search",n).then(e=>{t(e.Value)}).catch(e=>{r(e)})})}fees(){return new Promise((e,t)=>{this.cw.runRequest("Pll/FeeSetup/All",{}).then(t=>{e(t.Value)}).catch(e=>{t(e)})})}searchAvailableFees(e){return new Promise((t,r)=>{0==S.intersectionBy(S.keysIn(e),["AccountCode","FeeCode","FeeDesc","FeeSetupId","FeeTypeId"]).length&&r(new s(8,"At least one of the attributes (AccountCode, FeeCode, FeeDesc, FeeSetupId, FeeTypeId) must be defined.")),this.cw.runRequest("Pll/FeeSetup/Search",e).then(e=>{t(e.Value)}).catch(e=>{r(e)})})}getTenderTypes(){return new Promise((e,t)=>{this.cw.runRequest("Pll/TenderType/All",{}).then(t=>{e(t.Value)}).catch(e=>{t(e)})})}addTenderType(e){return new Promise((t,s)=>{this.cw.runRequest("Pll/TenderType/Add",e).then(e=>{t(e.Value)}).catch(e=>{s(e)})})}updateTenderType(e,t){return new Promise((s,r)=>{var n=S.merge({TenderTypeId:e},t);this.cw.runRequest("Pll/TenderType/Update",n).then(e=>{s(e.Value)}).catch(e=>{r(e)})})}}const V=require("lodash");class D{constructor(e){this.cw=void 0,this.task=void 0,this.cw=e,this.task={comment:new p(e,"CaTask")}}addTask(e,t,s,r,n){return new Promise((i,a)=>{var u={CaObjectId:e,TaskId:t,StartPoint:s,EndPoint:r};void 0!==n&&(u=V.merge(u,n)),this.cw.runRequest("Pll/CaseTask/Add",u).then(e=>{i(e.Value)}).catch(e=>{a(e)})})}addTaskResult(e,t,s,r,n,i){return new Promise((a,u)=>{var o={CaObjectId:e,CaTaskId:t,ResultCode:s,ResultID:r,ResultSetID:n};void 0!==i&&(o=V.merge(o,i)),this.cw.runRequest("Pll/CaseTaskResults/Add",o).then(e=>{a(e.Value)}).catch(e=>{u(e)})})}addTaskComment(e,t){return new Promise((s,r)=>{this.cw.runRequest("Pll/CaseTaskComments/Add",{CaTaskId:e,CommentText:t}).then(e=>{s(e.Value)}).catch(e=>{r(e)})})}getTasksByCaseId(e,t=!1){return new Promise((s,r)=>{this.cw.runRequest("Pll/CaseTask/ByCaObjectId",{CaObjectId:e,CheckRelatedItems:t}).then(e=>{s(e.Value)}).catch(e=>{r(e)})})}getTasksById(e,t=!1){return new Promise((s,r)=>{this.cw.runRequest("Pll/CaseTask/ByIds",{CaTaskIds:e,CheckRelatedItems:t}).then(e=>{s(e.Value)}).catch(e=>{r(e)})})}getResultsByTaskId(e){return new Promise((t,s)=>{this.cw.runRequest("Pll/CaseTaskResults/ByCaTaskIds",{CaTaskIds:e}).then(e=>{t(e.Value)}).catch(e=>{s(e)})})}getCommentsForTask(e){return new Promise((t,s)=>{this.cw.runRequest("Pll/CaseTaskComments/ByCaTaskId",{caTaskId:e}).then(e=>{t(e.Value)}).catch(e=>{s(e)})})}getCommentsForTasks(e){return new Promise((t,s)=>{this.cw.runRequest("Pll/CaseTaskComments/ByCaTaskIds",{caTaskIds:e}).then(e=>{t(e.Value)}).catch(e=>{s(e)})})}updateTask(e,t){return new Promise((s,r)=>{var n={CaTaskId:e};void 0!==t&&(n=V.merge(n,t)),this.cw.runRequest("Pll/CaseTask/Update",n).then(e=>{s(e.Value)}).catch(e=>{r(e)})})}updateTaskComment(e,t,s){return new Promise((r,n)=>{var i={CaTaskCommentId:e,CommentText:t};void 0!==s&&V.set(i,"CommentId",s),this.cw.runRequest("Pll/CaseTaskComments/Update",i).then(e=>{r(e.Value)}).catch(e=>{n(e)})})}setTaskResult(e,t,r){return new Promise((t,n)=>{var i={CaTaskId:e};0==V.intersectionBy(V.keysIn(r),["TaskCompleteDate","TaskCompletedBy"]).length&&n(new s(2,"At least one of the attributes (TaskCompletedBy, TaskCompleteDate) must be defined.")),void 0!==r&&(i=V.merge(i,r)),this.cw.runRequest("Pll/CaseTask/SetResult",i).then(e=>{t(e.Value)}).catch(e=>{n(e)})})}deleteTask(e){return new Promise((t,s)=>{this.cw.runRequest("Pll/CaseTask/Delete",{CaTaskId:e}).then(e=>{t(e.Value)}).catch(e=>{s(e)})})}deleteTasksOnCase(e){return new Promise((t,s)=>{this.cw.runRequest("Pll/CaseTask/DeleteByCaObjectId",{CaObjectId:e}).then(e=>{t(e.Value)}).catch(e=>{s(e)})})}deleteTaskComments(e){return new Promise((t,s)=>{this.cw.runRequest("Pll/CaseTaskComments/Delete",{CaTaskCommentIds:e}).then(e=>{t(e.Value)}).catch(e=>{s(e)})})}searchForTasks(e){return new Promise((t,r)=>{0==V.intersectionBy(V.keysIn(e),["ResponsibleUserId","TaskAvailable","TaskComplete","TaskType"]).length&&r(new s(1,"At least one of the attributes (ResponsibleUserId, TaskAvailable, TaskComplete, TaskType) must be defined.")),this.cw.runRequest("Pll/CaseTask/Search",e).then(e=>{t(e.Value)}).catch(e=>{r(e)})})}searchForTaskResults(e){return new Promise((t,s)=>{this.cw.runRequest("Pll/CaseTaskResults/Search",e).then(e=>{t(e.Value)}).catch(e=>{s(e)})})}}const b=require("lodash");class O{constructor(e){this.cw=void 0,this.cw=e}addBusinessCaseTemplate(e){return new Promise((t,s)=>{this.cw.runRequest("Pll/BusinessCase/Add",e).then(e=>{t(e.Value)}).catch(e=>{s(e)})})}updateBusinessCaseTemplate(e,t){return new Promise((s,r)=>{var n=b.merge({BusCaseId:e},t);this.cw.runRequest("Pll/BusinessCase/Update",n).then(e=>{s(e.Value)}).catch(e=>{r(e)})})}getBusinessCaseTemplates(){return new Promise((e,t)=>{this.cw.runRequest("Pll/BusinessCase/GetList",{}).then(t=>{e(t.Value)}).catch(e=>{t(e)})})}addCaseType(e,t,s){return new Promise((r,n)=>{var i=b.merge({CaseType:e,CaseTypeDesciption:t},s);this.cw.runRequest("Pll/CaseType/Add",i).then(e=>{r(e.Value)}).catch(e=>{n(e)})})}updateCaseType(e,t){return new Promise((s,r)=>{var n=b.merge({CaseTypeId:e},t);this.cw.runRequest("Pll/CaseType/GetList",n).then(e=>{s(e.Value)}).catch(e=>{r(e)})})}getCaseTypes(){return new Promise((e,t)=>{this.cw.runRequest("Pll/CaseType/GetList",{}).then(t=>{e(t.Value)}).catch(e=>{t(e)})})}searchCaseTypeIDs(e){return new Promise((t,r)=>{0==b.intersectionBy(b.keysIn(e),["CaseType","CaseTypeDesc","CaseTypeId"]).length&&r(new s(2,"At least one of the attributes (CaFeeId, CaObjectId, FeeCode, FeeDesc) must be defined.")),this.cw.runRequest("Pll/CaseType/Search",e).then(e=>{t(e.Value)}).catch(e=>{r(e)})})}searchCaseTypeObjects(e){return new Promise((t,r)=>{0==b.intersectionBy(b.keysIn(e),["CaseType","CaseTypeDesc","CaseTypeId"]).length&&r(new s(3,"At least one of the attributes (CaseType, CaseTypeDesc, CaseTypeId) must be defined.")),this.cw.runRequest("Pll/CaseType/SearchObject",e).then(e=>{t(e.Value)}).catch(e=>{r(e)})})}addSubtype(e,t,s){return new Promise((r,n)=>{var i=b.merge({SubType:e,SubTypeDesc:t},s);this.cw.runRequest("Pll/SubType/Add",i).then(e=>{r(e.Value)}).catch(e=>{n(e)})})}updateSubtype(e,t){return new Promise((s,r)=>{var n=b.merge({SubTypeId:e},t);this.cw.runRequest("Pll/SubType/Update",n).then(e=>{s(e.Value)}).catch(e=>{r(e)})})}getSubtypes(){return new Promise((e,t)=>{this.cw.runRequest("Pll/SubType/GetList",{}).then(t=>{e(t.Value)}).catch(e=>{t(e)})})}getFees(){return new Promise((e,t)=>{this.cw.runRequest("Pll/FeeSetup/All",{}).then(t=>{e(t.Value)}).catch(e=>{t(e)})})}searchFees(e){return new Promise((t,r)=>{0==b.intersectionBy(b.keysIn(e),["AccountCode","FeeCode","FeeDesc","FeeSetupId","FeeTypeId"]).length&&r(new s(4,"At least one of the attributes (AccountCode, FeeCode, FeeDesc, FeeSetupId, FeeTypeId) must be defined.")),this.cw.runRequest("Pll/FeeSetup/Search",e).then(e=>{t(e.Value)}).catch(e=>{r(e)})})}getExpirations(){return new Promise((e,t)=>{this.cw.runRequest("Pll/ExpirationType/GetList",{}).then(t=>{e(t.Value)}).catch(e=>{t(e)})})}addExpiration(e){return new Promise((t,r)=>{b.has(e,"OrgId")&&b.has(e,"ExpirationTypeDesc")||r(new s(5,"OrgId and ExpirationTypeDesc must both be defined.")),this.cw.runRequest("Pll/ExpirationType/Add",e).then(e=>{t(e.Value)}).catch(e=>{r(e)})})}getDeposits(){return new Promise((e,t)=>{this.cw.runRequest("Pll/Deposit/All",{}).then(t=>{e(t.Value)}).catch(e=>{t(e)})})}searchDeposits(e){return new Promise((t,r)=>{0==b.intersectionBy(b.keysIn(e),["AccountCode","DepositCode","DepositDesc","DepositId","DepositTypeId"]).length&&r(new s(4,"At least one of the attributes (AccountCode, DepositCode, DepositDesc, DepositId, DepositTypeId) must be defined.")),this.cw.runRequest("Pll/Deposit/Search",e).then(e=>{t(e.Value)}).catch(e=>{r(e)})})}getDisciplines(){return new Promise((e,t)=>{this.cw.runRequest("Pll/Discipline/All",{}).then(t=>{e(t.Value)}).catch(e=>{t(e)})})}addDepartment(e,t,s){return new Promise((r,n)=>{var i=b.merge({DepartmentCode:e,DepartmentName:t},s);this.cw.runRequest("Pll/Department/Add",i).then(e=>{r(e.Value)}).catch(e=>{n(e)})})}getDepartments(){return new Promise((e,t)=>{this.cw.runRequest("Pll/Department/GetList",{}).then(t=>{e(t.Value)}).catch(e=>{t(e)})})}addDivision(e,t,s){return new Promise((r,n)=>{var i=b.merge({DepartmentId:e,DivisionName:t},s);this.cw.runRequest("Pll/Division/Add",i).then(e=>{r(e.Value)}).catch(e=>{n(e)})})}getDivisions(){return new Promise((e,t)=>{this.cw.runRequest("Pll/Division/GetList",{}).then(t=>{e(t.Value)}).catch(e=>{t(e)})})}addHoliday(e,t,s){return new Promise((r,n)=>{var i={HolidayDate:e,HolidayDesc:t};void 0!==s&&b.set(i,"HalfDayFlag",s),this.cw.runRequest("Pll/Holiday/Add",i).then(e=>{r(e.Value)}).catch(e=>{n(e)})})}deleteHoliday(e){return new Promise((t,s)=>{this.cw.runRequest("Pll/Holiday/Delete",{HolidayId:e}).then(e=>{t(e.Value)}).catch(e=>{s(e)})})}getHolidays(){return new Promise((e,t)=>{this.cw.runRequest("Pll/Holiday/GetList",{}).then(t=>{e(t.Value)}).catch(e=>{t(e)})})}addInspectionTimeBlock(e,t,s,r){return new Promise((n,i)=>{var a={LabelText:e,StartTime:t,EndTime:s};void 0!==r&&b.set(a,"InspTimeBlocksDetails",r),this.cw.runRequest("Pll/InspectionTimeBlock/Add",a).then(e=>{n(e.Value)}).catch(e=>{i(e)})})}getInspectionTimeBlocks(){return new Promise((e,t)=>{this.cw.runRequest("Pll/InspectionTimeBlock/GetList",{}).then(t=>{e(t.Value)}).catch(e=>{t(e)})})}getNotificationCases(){return new Promise((e,t)=>{this.cw.runRequest("Pll/NotificationCase/GetNotificationCaseList",{}).then(t=>{e(t.Value)}).catch(e=>{t(e)})})}getNotificationTypes(){return new Promise((e,t)=>{this.cw.runRequest("Pll/NotificationType/GetNotificationTypeList",{}).then(t=>{e(t.Value)}).catch(e=>{t(e)})})}addNumberingGroup(e){return new Promise((t,s)=>{this.cw.runRequest("Pll/NumberingGroup/Add",e).then(e=>{t(e.Value)}).catch(e=>{s(e)})})}updateNumberingGroup(e,t){return new Promise((s,r)=>{var n=b.merge({NumberingGroupId:e},t);this.cw.runRequest("Pll/NumberingGroup/Update",n).then(e=>{s(e.Value)}).catch(e=>{r(e)})})}getNumberingGroups(){return new Promise((e,t)=>{this.cw.runRequest("Pll/NumberingGroup/GetList",{}).then(t=>{e(t.Value)}).catch(e=>{t(e)})})}addPerson(e,t){return new Promise((s,r)=>{var n=b.merge(t,{Name:e});this.cw.runRequest("Pll/People/Add",n).then(e=>{s(e.Value)}).catch(e=>{r(e)})})}getPeople(){return new Promise((e,t)=>{this.cw.runRequest("Pll/People/GetList",{}).then(t=>{e(t.Value)}).catch(e=>{t(e)})})}addPeopleRole(e,t){return new Promise((s,r)=>{var n=b.merge(t,{RoleCode:e});this.cw.runRequest("Pll/People/Add",n).then(e=>{s(e.Value)}).catch(e=>{r(e)})})}getPeopleRoles(){return new Promise((e,t)=>{this.cw.runRequest("Pll/PeopleRole/GetList",{}).then(t=>{e(t.Value)}).catch(e=>{t(e)})})}addTaskResultDetail(e){return new Promise((t,s)=>{this.cw.runRequest("Pll/TaskResultDetail/Add",e).then(e=>{t(e.Value)}).catch(e=>{s(e)})})}updateTaskResultDetail(e,t){return new Promise((s,r)=>{var n=b.merge(t,{ResultDetailId:e});this.cw.runRequest("Pll/TaskResultDetail/Add",n).then(e=>{s(e.Value)}).catch(e=>{r(e)})})}getTaskResultDetails(){return new Promise((e,t)=>{this.cw.runRequest("Pll/TaskResultDetail/GetList",{}).then(t=>{e(t.Value)}).catch(e=>{t(e)})})}addTaskResultFeeInsert(e){return new Promise((t,s)=>{this.cw.runRequest("Pll/TaskResultFeeInsert/Add",e).then(e=>{t(e.Value)}).catch(e=>{s(e)})})}deleteTaskResultFeeInsert(e){return new Promise((t,s)=>{this.cw.runRequest("Pll/TaskResultFeeInsert/Delete",{TaskResultFeeInsertId:e}).then(e=>{t(e.Value)}).catch(e=>{s(e)})})}deleteTaskResultFeeInsertByTaskId(e){return new Promise((t,s)=>{this.cw.runRequest("Pll/TaskResultFeeInsert/DeleteByTaskId",{TaskId:e}).then(e=>{t(e.Value)}).catch(e=>{s(e)})})}updateTaskResultFeeInsert(e,t,s,r){return new Promise((n,i)=>{var a={TaskResultFeeInsertId:e,TaskId:t,TaskResultId:s};void 0!==r&&b.set(a,"FeeSetupId",r),this.cw.runRequest("Pll/TaskResultFeeInsert/Update",a).then(e=>{n(e.Value)}).catch(e=>{i(e)})})}getTaskResultFeeInsert(){return new Promise((e,t)=>{this.cw.runRequest("Pll/TaskResultFeeInsert/GetList",{}).then(t=>{e(t.Value)}).catch(e=>{t(e)})})}}const f=require("lodash");class E{constructor(e){this.cw=void 0,this.data=void 0,this.workflow=void 0,this.financial=void 0,this.comment=void 0,this.admin=void 0,this.cw=e,this.data=new k(e),this.workflow=new D(e),this.financial=new A(e),this.comment=new p(e,"CaObject"),this.admin=new O(e)}create(e,t,s){return new Promise((r,n)=>{var i=f.merge({CaseTypeId:e,SubTypeId:t},s);this.cw.runRequest("Pll/Case/Create",i).then(e=>{r(e.Value)}).catch(e=>{n(e)})})}createChild(e,t,s){return new Promise((r,n)=>{var i=f.merge({BusCaseId:e,ParentCaObjectId:t},s);this.cw.runRequest("Pll/Case/CreateChild",i).then(e=>{r(e.Value)}).catch(e=>{n(e)})})}createFromRequest(e,t,s,r){return new Promise((n,i)=>{var a=f.merge({CaseTypeId:e,SubTypeId:t,ServiceRequestId:s},r);this.cw.runRequest("Pll/CaseObject/CreateCaseFromServiceRequest",a).then(e=>{n(e.Value)}).catch(e=>{i(e)})})}update(e,t){return new Promise((s,r)=>{var n=f.merge({CaObjectId:e},t);this.cw.runRequest("Pll/CaseObject/Update",n).then(e=>{s(e.Value)}).catch(e=>{r(e)})})}getByIds(e){return new Promise((t,s)=>{this.cw.runRequest("Pll/CaseObject/ByIds",{CaObjectIds:e}).then(e=>{t(e.Value)}).catch(e=>{s(e)})})}search(e){return new Promise((t,s)=>{this.cw.runRequest("Pll/CaseObject/Search",e).then(e=>{t(e.Value)}).catch(e=>{s(e)})})}move(e,t,r,n,i){return new Promise((a,u)=>{f.has(n,"WKID")||f.has(n,"WKT")||u(new s(1,"You must provide either the WKID or WKT for the x/y coordinates.",{projection:n}));var o={CaObjectId:e,X:t,Y:r};void 0!==i&&f.set(o,"Z",i);var c=f.merge(o,n);this.cw.runRequest("Pll/CaseObject/Move",c).then(e=>{a(e.Value)}).catch(e=>{u(e)})})}delete(e){return new Promise((t,s)=>{this.cw.runRequest("Pll/CaseObject/DeleteCase",{CaObjectId:e}).then(e=>{t(e.Value)}).catch(e=>{s(e)})})}}const F=require("https"),W=require("querystring"),G=require("lodash");module.exports=class{constructor(e,t,s){this.base_url=void 0,this.Token=void 0,this.login=void 0,this.password=void 0,this.gisToken=void 0,this.gisTokenUrl=void 0,this.settings=void 0,this.error=void 0,this.general=void 0,this.search=void 0,this.activity_link=void 0,this.message_queue=void 0,this.gis=void 0,this.request=void 0,this.inspection=void 0,this.workorder=void 0,this.case=void 0,this.extensions=void 0,this.features=void 0,this.potential_loads=void 0,this.base_url="cityworksonline",this.extensions={UnknownExtension:0,CwAnalytics:1,WebHooks:2,PLLPublicApp:3,ActivityUpdate:4,SingleSignOn:5},this.features={UnknownFeature:0,ViewInspections:1,EditInspections:2,ViewServiceRequest:3,EditServiceRequest:4,ViewWorkOrder:5,EditWorkOrder:6,EquipmentCheckOut:7,OfficeField:8,Respond:9,Eurl:10,PaverInterface:11,Contracts:12,Storeroom:13,PLL:14,Cw4XL:15,TableEditor:16,CCTVInterface:17,MobileAndroid:18,MobileiOS:19,PerformanceBudgeting:20,Insights:21,RespondCase:22,RespondInspection:23,RespondServiceRequest:24,RespondTaskManager:25,RespondWorkOrder:26,Workload:27,OpX:28,TrimbleUnityMobile:29,TrimbleVegetationManager:30},this.settings={path:"cityworks",secure:!0,expires:null,default_domain:null},this.potential_loads=["general","activity_link","message_queue","gis","search","request","case","case_financial"],void 0!==e&&this.configure(e,t,s)}configure(e,t,s){if(this.base_url=void 0!==e?e:"cityworksonline",this.settings={path:"cityworks",secure:!0,expires:null,default_domain:null},void 0!==t&&G.forEach(t,(e,t)=>{void 0!==this.settings[t]&&(this.settings[t]=e)}),void 0===s)this.general=new n(this),this.activity_link=new a(this),this.message_queue=new c(this),this.request=new y(this),this.inspection=new T(this),this.workorder=new q(this),this.case=new E(this),this.search=new d(this);else{let e=this;G.forEach(this.potential_loads,function(t){switch(t){case"general":e.general=new n(e);break;case"activity_link":e.activity_link=new a(e);break;case"message_queue":e.message_queue=new c(e);break;case"gis":e.gis=new u(e);break;case"search":e.search=new d(e);break;case"request":e.request=new y(e);break;case"case":e.case=new E(e);break;case"inspection":e.inspection=new T(e);break;case"workorder":e.workorder=new q(e)}})}}runRequest(e,t){return new Promise((r,n)=>{let i={};i.data=JSON.stringify(t),void 0!==this.Token&&""!=this.Token&&"General/Authentication/CityworksOnlineAuthenticate"!=e&&"General/Authentication/Authenticate"!=e&&(i.token=this.Token);let a={hostname:this.base_url,port:443,path:"/"+this.settings.path+"/services/"+e,method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded","Content-Length":Buffer.byteLength(W.stringify(i))},timeout:1e7},u=F.request(a,e=>{let t="";e.on("error",function(e){console.log(e,"Caught on error"),n(new s(13,"Unknown error.",e))}),e.on("data",function(e){t+=e}),e.on("end",function(){try{if(null==(JSON.stringify(t)+"[test string]").match(/\<h2\>Object\ moved\ to/)){var e=JSON.parse(t);if(void 0===e)n(new s(10,"No response received from Cityworks API."));else if(void 0!==e&&void 0!==e.Value)switch(e.Status){case 1:n(new s(1,"Error",e));break;case 2:n(new s(2,"Unauthorized",e));break;case 3:n(new s(3,"InvalidCredentials",e));break;default:r(e)}else n(new s(4,"Unknown error.",{options:a,postedData:i,api_returned_string:e}))}else n(new s(5,"Error parsing JSON. Cityworks returned HTML.",{response:t}))}catch(e){e instanceof SyntaxError?(console.log("try/catch error on JSON"),n(new s(6,"Error parsing JSON.",{error:e}))):(console.log("try/catch error on JSON - but not an instance of SyntaxError"),n(new s(7,"Error parsing JSON.")))}})});u.write(W.stringify(i)),u.end()})}authenticate(e,t){return new Promise((s,r)=>{let n="General/Authentication/Authenticate";"cityworksonline"==this.base_url&&(n="General/Authentication/CityworksOnlineAuthenticate"),this.runRequest(n,{LoginName:e,Password:t}).then(r=>{this.login=e,this.password=t,this.Token=r.Value.Token,s(!0)}).catch(e=>{r(e)})})}authenticateWithGISToken(e,t,s,r){return this.login=e,this.gisToken=t,this.gisTokenUrl=s,void 0!==r&&(r=12096e5),new Promise((e,t)=>{this.runRequest("General/Authentication/AuthenticateGisToken",{LoginName:this.login,GisToken:this.gisToken,GisTokenUrl:this.gisTokenUrl,Expires:r}).then(t=>{void 0!==t.Status&&t.Status>0||(void 0!==t.Value&&void 0!==t.Value.Token?(this.Token=t.Value.Token,e(!0)):e(!1))}).catch(e=>{throw e})})}validateToken(e,t){return new Promise((s,r)=>{this.runRequest("General/Authentication/Validate",{Token:e}).then(r=>{r.Status>0?s(!1):(t&&(this.Token=e),s(r.Value))}).catch(e=>{throw e})})}setToken(e){return""!=e&&null!=e&&(this.Token=e,!0)}getToken(){return""!=this.Token&&null!=this.Token&&this.Token}revokeToken(e){return new Promise((t,s)=>{this.runRequest("General/Token/RevokeUser",{RevokeDate:e}).then(e=>{t(!(void 0!==e.Status&&e.Status>0))}).catch(e=>{throw e})})}getLocalizationSettings(){return new Promise((e,t)=>{this.runRequest("General/Localization/LocalizationSettings",{}).then(t=>{e(t.Value)})})}getTimezoneOptions(){return new Promise((e,t)=>{this.runRequest("General/Localization/TimeZones",{}).then(t=>{e(t.Value)})})}getCurrentLocation(){return new Promise((e,t)=>{this.runRequest("General/AppData/CurrentLocation",{}).then(t=>{e(t.Value)})})}licensedApiCheck(e,t){return new Promise((s,r)=>{this.runRequest("General/AppData/SelectedEntities",{Area:e,Service:t}).then(e=>{s(e.Value)})})}licensedExtensionCheck(e){return new Promise((t,r)=>{void 0===this.extensions[e]&&r(new s(4,"Extension provided does not exist or is mispelled.",{provided:e,available:this.extensions})),this.runRequest("General/Authorization/LicensedExtensionCheck",{Extension:this.extensions[e]}).then(e=>{t(e.Value)})})}licensedExtensionsCheck(e){return new Promise((t,r)=>{var n={Extensions:[]};G.forEach(e,e=>{void 0===this.extensions[e]?r(new s(5,"Extension provided does not exist or is mispelled.",{provided:e,available:this.extensions})):n.Extensions.push(this.extensions[e])}),this.runRequest("General/Authorization/LicensedExtensionsCheck",n).then(e=>{let n={},i=G.invert(this.extensions);G.forEach(e,(e,t)=>{void 0===i[e]?r(new s(6,"Extension index provided does not exist or isn't configured properly.",{provided_num_returned:e,available:this.extensions})):n[i[e]]=t}),t(n)})})}licensedFeatureCheck(e){return new Promise((t,r)=>{void 0===this.features[e]&&r(new s(7,"Feature provided does not exist or is mispelled.",{provided:e,available:this.features})),this.runRequest("General/Authorization/LicensedFeatureCheck",{Feature:this.features[e]}).then(e=>{t(e.Value)})})}licensedFeaturesCheck(e){return new Promise((t,r)=>{var n={Features:[]};G.forEach(e,e=>{void 0===this.features[e]?r(new s(8,"Feature provided does not exist or is mispelled.",{provided:e,available:this.features})):n.Features.push(this.features[e])}),this.runRequest("General/Authorization/LicensedFeaturesCheck",n).then(e=>{let n={},i=G.invert(this.features);G.forEach(e.Value,(e,t)=>{void 0===i[e]?r(new s(9,"Feature index provided does not exist or isn't configured properly.",{provided:e,available:i})):n[i[e]]=t}),t(n)})})}licensedServicesCheck(e){return new Promise((t,s)=>{this.runRequest("General/Authorization/LicensedServicesCheck",{Services:e}).then(e=>{t(e.Value)})})}cityworksOnlineSites(e,t){return new Promise((s,r)=>{this.runRequest("General/Authentication/CityworksOnlineSites",{LoginName:void 0!==e?e:this.login,Password:void 0!==t?t:this.password}).then(e=>{s(e.Value)})})}domains(){return new Promise((e,t)=>{this.runRequest("General/Authentication/Domains",{}).then(t=>{e(t.Value)})})}user(e){return new Promise((t,s)=>{this.runRequest("General/Authentication/User",{LoginName:void 0!==e?e:this.login}).then(e=>{t(e.Value)})})}version(){return new Promise((e,t)=>{this.runRequest("General/Authentication/Version",{}).then(t=>{e(t.Value)})})}};
|
|
2
|
-
//# sourceMappingURL=index.modern.js.map
|