cityworks 0.0.28 → 0.0.32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/README.md +19 -19
- package/dist/activity_link.d.ts +6 -3
- package/dist/error.d.ts +7 -4
- package/dist/gis.d.ts +13 -0
- 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.js +1 -1
- package/dist/index.modern.js.map +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/index.umd.js.map +1 -1
- package/dist/inspection.d.ts +1 -1
- package/dist/inspection_admin.d.ts +15 -0
- package/dist/request_admin.d.ts +8 -0
- package/dist/search.d.ts +7 -7
- package/dist/workorder_admin.d.ts +101 -0
- package/package.json +3 -2
- package/src/activity_link.ts +17 -3
- package/src/case.ts +2 -2
- package/src/case_admin.ts +4 -4
- package/src/case_data.ts +4 -4
- package/src/case_financial.ts +8 -8
- package/src/case_workflow.ts +2 -2
- package/src/cityworks.ts +29 -17
- package/src/comments.ts +9 -1
- package/src/error.ts +11 -3
- package/src/event_layer.ts +219 -28
- package/src/general.ts +3 -1
- package/src/gis.ts +88 -53
- package/src/inspection.ts +1 -1
- package/src/inspection_admin.ts +28 -0
- package/src/message_queue.ts +10 -0
- package/src/request.ts +1 -1
- package/src/request_admin.ts +18 -0
- package/src/search.ts +16 -14
- package/src/workorder.ts +2 -2
- package/src/workorder_admin.ts +231 -0
- package/test/01.cityworksTest.js +12 -12
- package/test/03.generalTest.js +87 -0
- package/test/04.requestTest.js +8 -0
- package/test/05.caseTest.js +86 -5
- package/test/06.caseFinancialTest.js +95 -6
- package/test/07.searchTest.js +191 -0
- package/test/08.workOrderTest.js +48 -0
- package/test/{07.search.js → 09.inspectionTest.js} +4 -11
package/src/event_layer.ts
CHANGED
|
@@ -1,40 +1,231 @@
|
|
|
1
|
+
import { CWError } from './error'
|
|
2
|
+
const _ = require('lodash')
|
|
1
3
|
|
|
4
|
+
/**
|
|
5
|
+
* A plugin that contains "event layer" methods for a Cityworks install
|
|
6
|
+
*/
|
|
7
|
+
export class EventLayer {
|
|
8
|
+
/**
|
|
9
|
+
* @hidden
|
|
10
|
+
*/
|
|
11
|
+
cw: any
|
|
2
12
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
13
|
+
/**
|
|
14
|
+
* @hidden
|
|
15
|
+
*/
|
|
16
|
+
constructor(cw) {
|
|
17
|
+
this.cw = cw
|
|
18
|
+
}
|
|
6
19
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
20
|
+
/**
|
|
21
|
+
* Update (enable/disable) an event layer
|
|
22
|
+
*
|
|
23
|
+
* @param {string} eventLayerId - which event layer to update
|
|
24
|
+
* @param {boolean} enabled - true to enable, false to disable
|
|
25
|
+
* @return {Object} Returns Promise object which represents a xxxxx indicating xxxxxxx
|
|
26
|
+
*/
|
|
27
|
+
update(eventLayerId: number, enabled: boolean) {
|
|
28
|
+
return new Promise((resolve, reject) => {
|
|
29
|
+
let data = {"EventLayerId": eventLayerId, "Enabled": enabled}
|
|
30
|
+
this.cw.runRequest('Ams/EventLayer/Update', data).then(r => {
|
|
31
|
+
// console.log(r, 'response')
|
|
32
|
+
resolve(r.Value)
|
|
33
|
+
}).catch(e => {
|
|
34
|
+
reject(e)
|
|
35
|
+
})
|
|
36
|
+
})
|
|
37
|
+
}
|
|
10
38
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
39
|
+
/**
|
|
40
|
+
* Enable an event layer
|
|
41
|
+
*
|
|
42
|
+
* @param {string} eventLayerId - which event layer to update
|
|
43
|
+
* @return {Object} Returns Promise object which represents a xxxxx indicating xxxxxxx
|
|
44
|
+
*/
|
|
45
|
+
enable(eventLayerId: number) {
|
|
46
|
+
return this.update(eventLayerId, true);
|
|
47
|
+
}
|
|
15
48
|
|
|
16
|
-
|
|
17
|
-
|
|
49
|
+
/**
|
|
50
|
+
* Disable an event layer
|
|
51
|
+
*
|
|
52
|
+
* @param {string} eventLayerId - which event layer to update
|
|
53
|
+
* @return {Object} Returns Promise object which represents a xxxxx indicating xxxxxxx
|
|
54
|
+
*/
|
|
55
|
+
disable(eventLayerId: number) {
|
|
56
|
+
return this.update(eventLayerId, false);
|
|
57
|
+
}
|
|
18
58
|
|
|
19
|
-
|
|
20
|
-
|
|
59
|
+
/**
|
|
60
|
+
* ??
|
|
61
|
+
*
|
|
62
|
+
* @param {Array<number>} createBySids -
|
|
63
|
+
* @param {Array<string>} queryTypes -
|
|
64
|
+
* @return {Object} Returns Promise object which represents a xxxxx indicating xxxxxxx
|
|
65
|
+
*/
|
|
66
|
+
createByID(createBySids: Array<number>, queryTypes: Array<number>) {
|
|
67
|
+
return new Promise((resolve, reject) => {
|
|
68
|
+
let data = {"CreateBySids": createBySids, "QueryTypes": queryTypes}
|
|
69
|
+
this.cw.runRequest('Ams/EurlQuery/IdNames', data).then(r => {
|
|
70
|
+
// console.log(r, 'response')
|
|
71
|
+
resolve(r.Value)
|
|
72
|
+
}).catch(e => {
|
|
73
|
+
reject(e)
|
|
74
|
+
})
|
|
75
|
+
})
|
|
76
|
+
}
|
|
21
77
|
|
|
22
|
-
|
|
23
|
-
|
|
78
|
+
/**
|
|
79
|
+
* Save user preferences
|
|
80
|
+
*
|
|
81
|
+
* @param {string} element - "VisibleQeIds"
|
|
82
|
+
* @param {string} category - "qe-map"
|
|
83
|
+
* @param {Object} defaultValue - {all: [3]}
|
|
84
|
+
* @return {Object} Returns Promise object which represents a xxxxx indicating xxxxxxx
|
|
85
|
+
*/
|
|
86
|
+
updatePreferences(element: number, category: boolean, defaultValue: Object) {
|
|
87
|
+
return new Promise((resolve, reject) => {
|
|
88
|
+
let data = {"Element": element, "Category": category, "DefaultValue": defaultValue}
|
|
89
|
+
this.cw.runRequest('Ams/Preferences/UserSave', data).then(r => {
|
|
90
|
+
// console.log(r, 'response')
|
|
91
|
+
resolve(r.Value)
|
|
92
|
+
}).catch(e => {
|
|
93
|
+
reject(e)
|
|
94
|
+
})
|
|
95
|
+
})
|
|
96
|
+
}
|
|
24
97
|
|
|
25
|
-
|
|
26
|
-
|
|
98
|
+
/**
|
|
99
|
+
* Get all event layers
|
|
100
|
+
*
|
|
101
|
+
* @return {Object} Returns Promise object which represents a xxxxx indicating xxxxxxx
|
|
102
|
+
*/
|
|
103
|
+
all() {
|
|
104
|
+
return new Promise((resolve, reject) => {
|
|
105
|
+
let data = {}
|
|
106
|
+
this.cw.runRequest('Ams/EventLayer/All', data).then(r => {
|
|
107
|
+
// console.log(r, 'response')
|
|
108
|
+
resolve(r.Value)
|
|
109
|
+
}).catch(e => {
|
|
110
|
+
reject(e)
|
|
111
|
+
})
|
|
112
|
+
})
|
|
113
|
+
}
|
|
27
114
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
115
|
+
/**
|
|
116
|
+
* Get all EUrl Query Types
|
|
117
|
+
*
|
|
118
|
+
* @return {Object} Returns Promise object which represents a xxxxx indicating xxxxxxx
|
|
119
|
+
*/
|
|
120
|
+
queryTypes() {
|
|
121
|
+
return new Promise((resolve, reject) => {
|
|
122
|
+
let data = {}
|
|
123
|
+
this.cw.runRequest('General/EurlQuery/QueryTypes', data).then(r => {
|
|
124
|
+
// console.log(r, 'response')
|
|
125
|
+
resolve(r.Value)
|
|
126
|
+
}).catch(e => {
|
|
127
|
+
reject(e)
|
|
128
|
+
})
|
|
129
|
+
})
|
|
130
|
+
}
|
|
31
131
|
|
|
32
|
-
|
|
33
|
-
|
|
132
|
+
/**
|
|
133
|
+
* Get Preferences for User
|
|
134
|
+
*
|
|
135
|
+
* @return {Object} Returns Promise object which represents a xxxxx indicating xxxxxxx
|
|
136
|
+
*/
|
|
137
|
+
preferences() {
|
|
138
|
+
return new Promise((resolve, reject) => {
|
|
139
|
+
let data = {}
|
|
140
|
+
this.cw.runRequest('Ams/Preferences/User', data).then(r => {
|
|
141
|
+
// console.log(r, 'response')
|
|
142
|
+
resolve(r.Value)
|
|
143
|
+
}).catch(e => {
|
|
144
|
+
reject(e)
|
|
145
|
+
})
|
|
146
|
+
})
|
|
147
|
+
}
|
|
34
148
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
149
|
+
/**
|
|
150
|
+
* Get Styles for event layers
|
|
151
|
+
*
|
|
152
|
+
* @return {Object} Returns Promise object which represents a xxxxx indicating xxxxxxx
|
|
153
|
+
*/
|
|
154
|
+
styles() {
|
|
155
|
+
return new Promise((resolve, reject) => {
|
|
156
|
+
let data = {}
|
|
157
|
+
this.cw.runRequest('Ams/EventLayer/Styles', data).then(r => {
|
|
158
|
+
// console.log(r, 'response')
|
|
159
|
+
resolve(r.Value)
|
|
160
|
+
}).catch(e => {
|
|
161
|
+
reject(e)
|
|
162
|
+
})
|
|
163
|
+
})
|
|
164
|
+
}
|
|
38
165
|
|
|
39
|
-
|
|
40
|
-
|
|
166
|
+
/**
|
|
167
|
+
* ??
|
|
168
|
+
*
|
|
169
|
+
* @param {Array<string>} preferenceNames - ["VisibleQeIds"]
|
|
170
|
+
* @param {Array<string>} categories - ["qe-map"]
|
|
171
|
+
* @return {Object} Returns Promise object which represents a xxxxx indicating xxxxxxx
|
|
172
|
+
*/
|
|
173
|
+
xxxxxx(preferenceNames: Array<string>, categories: Array<string>) {
|
|
174
|
+
return new Promise((resolve, reject) => {
|
|
175
|
+
let data = {"PreferenceNames": preferenceNames, "Categories": categories}
|
|
176
|
+
this.cw.runRequest('Ams/Preferences/User', data).then(r => {
|
|
177
|
+
// console.log(r, 'response')
|
|
178
|
+
resolve(r.Value)
|
|
179
|
+
}).catch(e => {
|
|
180
|
+
reject(e);
|
|
181
|
+
})
|
|
182
|
+
})
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* Get all event layers
|
|
187
|
+
*
|
|
188
|
+
* @param {boolean} includeDisabled - Defaults to false
|
|
189
|
+
* @return {Object} Returns Promise object which represents a xxxxx indicating xxxxxxx
|
|
190
|
+
*/
|
|
191
|
+
getAllEventLayers(includeDisabled: boolean = false) {
|
|
192
|
+
return new Promise((resolve, reject) => {
|
|
193
|
+
let data = {"IncludeDisabled": includeDisabled}
|
|
194
|
+
this.cw.runRequest('Ams/EventLayer/All', data).then(r => {
|
|
195
|
+
// console.log(r, 'response')
|
|
196
|
+
resolve(r.Value)
|
|
197
|
+
}).catch(e => {
|
|
198
|
+
reject(e)
|
|
199
|
+
})
|
|
200
|
+
})
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
/**
|
|
204
|
+
* Filter event layers by provided search definitions
|
|
205
|
+
*
|
|
206
|
+
* @param {Array<number>} searchIds - Defaults to false
|
|
207
|
+
* @param {Array<number>} eventLayerIds - Defaults to false
|
|
208
|
+
* @return {Object} Returns Promise object which represents a xxxxx indicating xxxxxxx
|
|
209
|
+
*/
|
|
210
|
+
filterEventLayersBySearches(searchIds: Array<number>, eventLayerIds: Array<number>) {
|
|
211
|
+
return new Promise((resolve, reject) => {
|
|
212
|
+
let data = {"SearchIds": searchIds, "EventLayerIds": eventLayerIds}
|
|
213
|
+
this.cw.runRequest('Ams/EventLayer/Filters', data).then(r => {
|
|
214
|
+
// console.log(r, 'response')
|
|
215
|
+
resolve(r.Value)
|
|
216
|
+
}).catch(e => {
|
|
217
|
+
reject(e)
|
|
218
|
+
})
|
|
219
|
+
})
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
/**
|
|
223
|
+
* eventLayer GIS endpoint, this may need to be a promise as well...
|
|
224
|
+
*
|
|
225
|
+
* @return {string} Returns string that is absolute URL for event layer GIS endpoint
|
|
226
|
+
*/
|
|
227
|
+
getGISEndpoint(eventLayerId) {
|
|
228
|
+
return this.cw.base_url + '/' + this.cw.settings.path + '/eventlayer/1/' + eventLayerId + '/rest/services/cw/FeatureServer/{#}?f=json'; // 1 for SR, 2 for WorkOrders, 3 for Inspections, 5 for PLL Cases
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
}
|
package/src/general.ts
CHANGED
|
@@ -26,6 +26,8 @@ export class General {
|
|
|
26
26
|
return new Promise((resolve, reject) => {
|
|
27
27
|
this.cw.runRequest('General/ActivityNotification/User', {}).then((response: any) => {
|
|
28
28
|
resolve(response.Value)
|
|
29
|
+
}).catch(e => {
|
|
30
|
+
reject(e)
|
|
29
31
|
})
|
|
30
32
|
})
|
|
31
33
|
}
|
|
@@ -50,7 +52,7 @@ export class General {
|
|
|
50
52
|
// console.log(r, 'response')
|
|
51
53
|
resolve(r.Value)
|
|
52
54
|
}).catch(e => {
|
|
53
|
-
reject(
|
|
55
|
+
reject(e)
|
|
54
56
|
})
|
|
55
57
|
}
|
|
56
58
|
})
|
package/src/gis.ts
CHANGED
|
@@ -5,13 +5,13 @@ export class Gis {
|
|
|
5
5
|
/**
|
|
6
6
|
* @hidden
|
|
7
7
|
*/
|
|
8
|
-
cw: any
|
|
8
|
+
cw: any
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* @hidden
|
|
12
12
|
*/
|
|
13
13
|
constructor(cw) {
|
|
14
|
-
this.cw = cw
|
|
14
|
+
this.cw = cw
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
/**
|
|
@@ -25,27 +25,29 @@ export class Gis {
|
|
|
25
25
|
*/
|
|
26
26
|
getConfig(whichType, whichId, getGisData: boolean = true, context: Array<string> = []) {
|
|
27
27
|
return new Promise((resolve, reject) => {
|
|
28
|
-
let path = 'Gis/MapService/Domain'
|
|
29
|
-
whichType = whichType.toLowerCase()
|
|
28
|
+
let path = 'Gis/MapService/Domain'
|
|
29
|
+
whichType = whichType.toLowerCase()
|
|
30
30
|
let data: {DomainId?: any, GroupId?: any, MapServiceId?: any, UserId?: any, GetGisData: boolean, Security: Array<string>}
|
|
31
31
|
switch(whichType) {
|
|
32
32
|
case 'domain':
|
|
33
33
|
data = {DomainId:whichId, GetGisData: getGisData, Security: context}
|
|
34
|
-
break
|
|
34
|
+
break
|
|
35
35
|
case 'group':
|
|
36
36
|
data = {GroupId:whichId, GetGisData: getGisData, Security: context}
|
|
37
|
-
break
|
|
37
|
+
break
|
|
38
38
|
case 'mapservice':
|
|
39
39
|
data = {MapServiceId:whichId, GetGisData: getGisData, Security: context}
|
|
40
|
-
break
|
|
40
|
+
break
|
|
41
41
|
case 'user':
|
|
42
42
|
data = {UserId:whichId, GetGisData: getGisData, Security: context}
|
|
43
|
-
break
|
|
43
|
+
break
|
|
44
44
|
}
|
|
45
45
|
this.cw.runRequest(path, {}).then((response: any) => {
|
|
46
|
-
resolve(response.Value)
|
|
47
|
-
})
|
|
48
|
-
|
|
46
|
+
resolve(response.Value)
|
|
47
|
+
}).catch(e => {
|
|
48
|
+
reject(e)
|
|
49
|
+
})
|
|
50
|
+
})
|
|
49
51
|
}
|
|
50
52
|
|
|
51
53
|
/**
|
|
@@ -56,14 +58,16 @@ export class Gis {
|
|
|
56
58
|
*/
|
|
57
59
|
domain(domainId, getGisData: boolean = true) {
|
|
58
60
|
return new Promise((resolve, reject) => {
|
|
59
|
-
let path = 'Gis/MapService/Domain'
|
|
61
|
+
let path = 'Gis/MapService/Domain'
|
|
60
62
|
let data = {
|
|
61
63
|
DomainId: domainId
|
|
62
64
|
}
|
|
63
65
|
this.cw.runRequest(path, {}).then((response: any) => {
|
|
64
|
-
resolve(response.Value)
|
|
65
|
-
})
|
|
66
|
-
|
|
66
|
+
resolve(response.Value)
|
|
67
|
+
}).catch(e => {
|
|
68
|
+
reject(e)
|
|
69
|
+
})
|
|
70
|
+
})
|
|
67
71
|
}
|
|
68
72
|
|
|
69
73
|
/**
|
|
@@ -74,14 +78,16 @@ export class Gis {
|
|
|
74
78
|
*/
|
|
75
79
|
downloadMobile(cacheId, getGisData: boolean = true) {
|
|
76
80
|
return new Promise((resolve, reject) => {
|
|
77
|
-
let path = 'Gis/MapService/DownloadMobileMapCache'
|
|
81
|
+
let path = 'Gis/MapService/DownloadMobileMapCache'
|
|
78
82
|
let data = {
|
|
79
83
|
MobileMapCacheId: cacheId
|
|
80
84
|
}
|
|
81
85
|
this.cw.runRequest(path, {}).then((response: any) => {
|
|
82
|
-
resolve(response.Value)
|
|
83
|
-
})
|
|
84
|
-
|
|
86
|
+
resolve(response.Value)
|
|
87
|
+
}).catch(e => {
|
|
88
|
+
reject(e)
|
|
89
|
+
})
|
|
90
|
+
})
|
|
85
91
|
}
|
|
86
92
|
|
|
87
93
|
/**
|
|
@@ -91,12 +97,14 @@ export class Gis {
|
|
|
91
97
|
*/
|
|
92
98
|
initialExtent() {
|
|
93
99
|
return new Promise((resolve, reject) => {
|
|
94
|
-
let path = 'Gis/MapService/InitialExtent'
|
|
100
|
+
let path = 'Gis/MapService/InitialExtent'
|
|
95
101
|
let data = {};
|
|
96
102
|
this.cw.runRequest(path, {}).then((response: any) => {
|
|
97
|
-
resolve(response.Value)
|
|
98
|
-
})
|
|
99
|
-
|
|
103
|
+
resolve(response.Value)
|
|
104
|
+
}).catch(e => {
|
|
105
|
+
reject(e)
|
|
106
|
+
})
|
|
107
|
+
})
|
|
100
108
|
}
|
|
101
109
|
|
|
102
110
|
/**
|
|
@@ -108,15 +116,17 @@ export class Gis {
|
|
|
108
116
|
*/
|
|
109
117
|
request(requestId, getGisData: boolean = true) {
|
|
110
118
|
return new Promise((resolve, reject) => {
|
|
111
|
-
let path = 'Gis/MapService/ServiceRequestConfiguration'
|
|
119
|
+
let path = 'Gis/MapService/ServiceRequestConfiguration'
|
|
112
120
|
let data = {
|
|
113
121
|
RequestId: requestId,
|
|
114
122
|
GetGisData: getGisData
|
|
115
123
|
}
|
|
116
124
|
this.cw.runRequest(path, {}).then((response: any) => {
|
|
117
|
-
resolve(response.Value)
|
|
118
|
-
})
|
|
119
|
-
|
|
125
|
+
resolve(response.Value)
|
|
126
|
+
}).catch(e => {
|
|
127
|
+
reject(e)
|
|
128
|
+
})
|
|
129
|
+
})
|
|
120
130
|
}
|
|
121
131
|
|
|
122
132
|
/**
|
|
@@ -128,15 +138,17 @@ export class Gis {
|
|
|
128
138
|
*/
|
|
129
139
|
inspection(inspectionId, getGisData: boolean = true) {
|
|
130
140
|
return new Promise((resolve, reject) => {
|
|
131
|
-
let path = 'Gis/MapService/InspectionConfiguration'
|
|
141
|
+
let path = 'Gis/MapService/InspectionConfiguration'
|
|
132
142
|
let data = {
|
|
133
143
|
InspectionId: inspectionId,
|
|
134
144
|
GetGisData: getGisData
|
|
135
145
|
}
|
|
136
146
|
this.cw.runRequest(path, {}).then((response: any) => {
|
|
137
|
-
resolve(response.Value)
|
|
138
|
-
})
|
|
139
|
-
|
|
147
|
+
resolve(response.Value)
|
|
148
|
+
}).catch(e => {
|
|
149
|
+
reject(e)
|
|
150
|
+
})
|
|
151
|
+
})
|
|
140
152
|
}
|
|
141
153
|
|
|
142
154
|
/**
|
|
@@ -148,15 +160,17 @@ export class Gis {
|
|
|
148
160
|
*/
|
|
149
161
|
workOrder(workOrderSid, getGisData: boolean = true) {
|
|
150
162
|
return new Promise((resolve, reject) => {
|
|
151
|
-
let path = 'Gis/MapService/WorkOrderConfiguration'
|
|
163
|
+
let path = 'Gis/MapService/WorkOrderConfiguration'
|
|
152
164
|
let data = {
|
|
153
165
|
WorkOrderSid: workOrderSid,
|
|
154
166
|
GetGisData: getGisData
|
|
155
167
|
}
|
|
156
168
|
this.cw.runRequest(path, {}).then((response: any) => {
|
|
157
|
-
resolve(response.Value)
|
|
158
|
-
})
|
|
159
|
-
|
|
169
|
+
resolve(response.Value)
|
|
170
|
+
}).catch(e => {
|
|
171
|
+
reject(e)
|
|
172
|
+
})
|
|
173
|
+
})
|
|
160
174
|
}
|
|
161
175
|
|
|
162
176
|
/**
|
|
@@ -170,7 +184,7 @@ export class Gis {
|
|
|
170
184
|
*/
|
|
171
185
|
user(context: Array<string> = [], allDomains: boolean = true, allGroups: boolean = true, getGisData: boolean = true) {
|
|
172
186
|
return new Promise((resolve, reject) => {
|
|
173
|
-
let path = 'Gis/MapService/User'
|
|
187
|
+
let path = 'Gis/MapService/User'
|
|
174
188
|
let data = {
|
|
175
189
|
AllDomains: allDomains,
|
|
176
190
|
AllGroups: allGroups,
|
|
@@ -178,23 +192,11 @@ export class Gis {
|
|
|
178
192
|
Security: context
|
|
179
193
|
}
|
|
180
194
|
this.cw.runRequest(path, {}).then((response: any) => {
|
|
181
|
-
resolve(response.Value)
|
|
182
|
-
})
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
/**
|
|
188
|
-
* Get currently selected entities from the Cityworks install's session for your user
|
|
189
|
-
* @return {Object} Returns Promise object that represents an Object with the currently-selected entities
|
|
190
|
-
*/
|
|
191
|
-
selectedEntities() {
|
|
192
|
-
return new Promise((resolve, reject) => {
|
|
193
|
-
let path = 'General/AppData/SelectedEntities';
|
|
194
|
-
this.cw.runRequest(path, {}).then((response: any) => {
|
|
195
|
-
resolve(response.Value);
|
|
196
|
-
});
|
|
197
|
-
});
|
|
195
|
+
resolve(response.Value)
|
|
196
|
+
}).catch(e => {
|
|
197
|
+
reject(e)
|
|
198
|
+
})
|
|
199
|
+
})
|
|
198
200
|
}
|
|
199
201
|
|
|
200
202
|
/**
|
|
@@ -204,4 +206,37 @@ export class Gis {
|
|
|
204
206
|
* @return {Object} Returns Promise object that represents an object describing the provided Geocoder service configuration
|
|
205
207
|
*/
|
|
206
208
|
// Gis/GeoCode/GeocodeServer
|
|
209
|
+
|
|
210
|
+
/**
|
|
211
|
+
* Get currently selected entities from the Cityworks install's session for your user
|
|
212
|
+
* @return {Object} Returns Promise object that represents an Object with the currently-selected entities
|
|
213
|
+
*/
|
|
214
|
+
selectedEntities() {
|
|
215
|
+
return new Promise((resolve, reject) => {
|
|
216
|
+
let path = 'General/AppData/SelectedEntities'
|
|
217
|
+
this.cw.runRequest(path, {}).then((response: any) => {
|
|
218
|
+
resolve(response.Value)
|
|
219
|
+
}).catch(e => {
|
|
220
|
+
reject(e)
|
|
221
|
+
})
|
|
222
|
+
})
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
/**
|
|
226
|
+
* Get attributes available for provided entity
|
|
227
|
+
*
|
|
228
|
+
* @param {string} entityType - The entity type to describe
|
|
229
|
+
* @return {Object} Returns Promise object that represents a collection of attribute description objects
|
|
230
|
+
*/
|
|
231
|
+
getEntityAttributes(entityType:string) {
|
|
232
|
+
return new Promise((resolve, reject) => {
|
|
233
|
+
let data = {EntityType: entityType}
|
|
234
|
+
let path = 'AMS/Entity/Attributes'
|
|
235
|
+
this.cw.runRequest(path, data).then((response: any) => {
|
|
236
|
+
resolve(response.Value)
|
|
237
|
+
}).catch(e => {
|
|
238
|
+
reject(e)
|
|
239
|
+
})
|
|
240
|
+
})
|
|
241
|
+
}
|
|
207
242
|
}
|
package/src/inspection.ts
CHANGED
|
@@ -644,7 +644,7 @@ export class Inspection {
|
|
|
644
644
|
* @param {Array<string>} [entityTypes] - The Entity Type(s) to return potential inspections for
|
|
645
645
|
* @param {boolean} [canCreate] - If true, only return templates the user can create, ignored if false or null, default is true
|
|
646
646
|
* @param {Object} [options] - An object which can include: [IncludeInactive]: boolean, MaximumDateModified: Date, MinimumDateModified: Date, TemplateIds: Array<number>
|
|
647
|
-
* @return {Object} Returns Promise that represents a collection of all
|
|
647
|
+
* @return {Object} Returns Promise that represents a collection of all Inspections matching the provided parameters
|
|
648
648
|
*/
|
|
649
649
|
getTemplates(entityTypes?: Array<string>, canCreate?: boolean, options?: {IncludeInactive?: boolean, MaximumDateModified?: Date, MinimumDateModified?: Date, TemplateIds?: Array<number>}) {
|
|
650
650
|
return new Promise((resolve, reject) => {
|
package/src/inspection_admin.ts
CHANGED
|
@@ -14,4 +14,32 @@ export class InspectionAdmin {
|
|
|
14
14
|
this.cw = cw
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
+
/**
|
|
18
|
+
* Get inspection templates
|
|
19
|
+
*
|
|
20
|
+
* @category Inspection Templates
|
|
21
|
+
* @param {Array<string>} [entityTypes] - The Entity Type(s) to return potential inspections for
|
|
22
|
+
* @param {boolean} [canCreate] - If true, only return templates the user can create, ignored if false or null, default is true
|
|
23
|
+
* @param {Object} [options] - An object which can include: [IncludeInactive]: boolean, MaximumDateModified: Date, MinimumDateModified: Date, TemplateIds: Array<number>
|
|
24
|
+
* @return {Object} Returns Promise that represents a collection of all Inspections matching the provided parameters
|
|
25
|
+
*/
|
|
26
|
+
getTemplates(entityTypes?: Array<string>, canCreate?: boolean, options?: {IncludeInactive?: boolean, MaximumDateModified?: Date, MinimumDateModified?: Date, TemplateIds?: Array<number>}) {
|
|
27
|
+
return new Promise((resolve, reject) => {
|
|
28
|
+
var data: {EntityTypes?: Array<string>, CanCreate?: boolean, IncludeInactive?: boolean, MaximumDateModified?: Date, MinimumDateModified?: Date, TemplateIds?: Array<number>} = {}
|
|
29
|
+
if(typeof(entityTypes)!=='undefined') {
|
|
30
|
+
data.EntityTypes = entityTypes
|
|
31
|
+
}
|
|
32
|
+
data.CanCreate = typeof(canCreate)!=='undefined' ? canCreate : true
|
|
33
|
+
if(typeof(options)==='object') {
|
|
34
|
+
_.forIn(options, (v, k) => {
|
|
35
|
+
data[k] = v
|
|
36
|
+
})
|
|
37
|
+
}
|
|
38
|
+
this.cw.runRequest('Ams/InspectionTemplate/Templates', data).then(r => {
|
|
39
|
+
resolve(r.Value)
|
|
40
|
+
}).catch(e => {
|
|
41
|
+
reject(e)
|
|
42
|
+
})
|
|
43
|
+
})
|
|
44
|
+
}
|
|
17
45
|
}
|
package/src/message_queue.ts
CHANGED
|
@@ -53,6 +53,8 @@ export class MessageQueue {
|
|
|
53
53
|
let path = 'General/WebHookEvent/ProcessMessages'
|
|
54
54
|
this.cw.runRequest(path, data).then((response: any) => {
|
|
55
55
|
// TODO
|
|
56
|
+
}).catch(e => {
|
|
57
|
+
reject(e)
|
|
56
58
|
})
|
|
57
59
|
})
|
|
58
60
|
}
|
|
@@ -78,6 +80,8 @@ export class MessageQueue {
|
|
|
78
80
|
let path = 'General/MessageQueue/ByIds'
|
|
79
81
|
this.cw.runRequest(path, data).then((response: any) => {
|
|
80
82
|
// TODO
|
|
83
|
+
}).catch(e => {
|
|
84
|
+
reject(e)
|
|
81
85
|
})
|
|
82
86
|
})
|
|
83
87
|
}
|
|
@@ -103,6 +107,8 @@ export class MessageQueue {
|
|
|
103
107
|
let path = 'General/MessageQueue/Delete'
|
|
104
108
|
this.cw.runRequest(path, data).then((response: any) => {
|
|
105
109
|
// TODO
|
|
110
|
+
}).catch(e => {
|
|
111
|
+
reject(e)
|
|
106
112
|
})
|
|
107
113
|
})
|
|
108
114
|
}
|
|
@@ -117,6 +123,8 @@ export class MessageQueue {
|
|
|
117
123
|
let path = 'General/MessageQueue/Preferences'
|
|
118
124
|
this.cw.runRequest(path, data).then((response: any) => {
|
|
119
125
|
// TODO
|
|
126
|
+
}).catch(e => {
|
|
127
|
+
reject(e)
|
|
120
128
|
})
|
|
121
129
|
})
|
|
122
130
|
}
|
|
@@ -148,6 +156,8 @@ export class MessageQueue {
|
|
|
148
156
|
response.Value = []
|
|
149
157
|
}
|
|
150
158
|
resolve(response.Value)
|
|
159
|
+
}).catch(e => {
|
|
160
|
+
reject(e)
|
|
151
161
|
})
|
|
152
162
|
})
|
|
153
163
|
}
|
package/src/request.ts
CHANGED
package/src/request_admin.ts
CHANGED
|
@@ -14,4 +14,22 @@ export class RequestAdmin {
|
|
|
14
14
|
this.cw = cw
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
+
/**
|
|
18
|
+
* Get service request templates
|
|
19
|
+
*
|
|
20
|
+
* @category Requests Admin
|
|
21
|
+
* @param {Object} searchData - search data
|
|
22
|
+
* @return {Object} Returns Promise that represents a collection of all Service Request Templates
|
|
23
|
+
*/
|
|
24
|
+
getTemplates(searchData: Object) {
|
|
25
|
+
return new Promise((resolve, reject) => {
|
|
26
|
+
var data = searchData
|
|
27
|
+
this.cw.runRequest('Ams/ServiceRequestTemplate/Templates', data).then(r => {
|
|
28
|
+
resolve(r.Value)
|
|
29
|
+
}).catch(e => {
|
|
30
|
+
reject(e)
|
|
31
|
+
})
|
|
32
|
+
})
|
|
33
|
+
}
|
|
34
|
+
|
|
17
35
|
}
|