cityworks 0.0.21 → 0.0.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +73 -0
- package/dist/case_workflow.d.ts +154 -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/package.json +1 -1
- package/src/case_workflow.ts +377 -0
package/package.json
CHANGED
package/src/case_workflow.ts
CHANGED
|
@@ -14,4 +14,381 @@ export class CaseWorkflow {
|
|
|
14
14
|
this.cw = cw
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
+
/**
|
|
18
|
+
* Add Case Data Group
|
|
19
|
+
*
|
|
20
|
+
* @category Data Groups
|
|
21
|
+
* @param {number} caObjectId - The Case Object to attach the data group to.
|
|
22
|
+
* @param {number} caseDataGroupId - CaseDataGroupId as defined in CaseDataGroup admin.
|
|
23
|
+
* @param {string} groupCode - The Group Code.
|
|
24
|
+
* @param {Object} [options] - Options for CaseDataGroup including GroupDesc, GroupSum, and SumFlag
|
|
25
|
+
* @return {Object} Returns Promise that represents an object describing CaDataGroupItemBase.
|
|
26
|
+
*/
|
|
27
|
+
addGroup(caObjectId: number, caseDataGroupId: number, groupCode: string, options?: {GroupDesc?: string, GroupSum?: number, SumFlag?: string}) {
|
|
28
|
+
return new Promise((resolve, reject) => {
|
|
29
|
+
var data = {
|
|
30
|
+
CaObjectId: caObjectId,
|
|
31
|
+
CaseDataGroupId: caseDataGroupId,
|
|
32
|
+
GroupCode: groupCode
|
|
33
|
+
}
|
|
34
|
+
if(typeof(options)!='undefined') {
|
|
35
|
+
data = _.merge(data, options)
|
|
36
|
+
}
|
|
37
|
+
this.cw.runRequest('Pll/CaseDataGroup/Add', data).then(r => {
|
|
38
|
+
resolve(r.Value)
|
|
39
|
+
}).catch(e => {
|
|
40
|
+
reject(e)
|
|
41
|
+
})
|
|
42
|
+
})
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Add Default Case Data Groups
|
|
47
|
+
*
|
|
48
|
+
* @category Data Groups
|
|
49
|
+
* @param {number} caObjectId - The Case Object to attach the data group to.
|
|
50
|
+
* @param {number} busCaseId - The business case ID
|
|
51
|
+
* @return {Object} Returns Promise that represents a collection of the default CaDataGroupItemBases.
|
|
52
|
+
*/
|
|
53
|
+
addDefaultGroups(caObjectId: number, busCaseId: number) {
|
|
54
|
+
return new Promise((resolve, reject) => {
|
|
55
|
+
var data = {
|
|
56
|
+
CaObjectId: caObjectId,
|
|
57
|
+
BusCaseId: busCaseId
|
|
58
|
+
}
|
|
59
|
+
this.cw.runRequest('Pll/CaseDataGroup/AddDefault', data).then(r => {
|
|
60
|
+
resolve(r.Value)
|
|
61
|
+
}).catch(e => {
|
|
62
|
+
reject(e)
|
|
63
|
+
})
|
|
64
|
+
})
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Adds a data detail entry to the case data group specified by the CaDataGroupId. The CaDataGroupId is associated to a case.
|
|
69
|
+
*
|
|
70
|
+
* @category Data Groups
|
|
71
|
+
* @param {number} caseDataDetailId - The Data Detail template ID
|
|
72
|
+
* @param {number} caDataGroupId - The Case Instance Data Group ID
|
|
73
|
+
* @param {string} columnSequence - The column sequence
|
|
74
|
+
* @param {string} detailCode - The detail Code
|
|
75
|
+
* @param {number} detailSequence - The detail order number
|
|
76
|
+
* @param {Object} [options] - Other options for CaseDataDetail. See WIPAdd here: /{subdirectory}/apidocs/#/service-info/Pll/CaseDataDetail
|
|
77
|
+
* @return {Object} Returns Promise that represents an object describing CaDataDetailItemBase.
|
|
78
|
+
*/
|
|
79
|
+
wipAddDetail(caseDataDetailId: number, caDataGroupId: number, columnSequence: string, detailCode: string, detailSequence: number, options?: Object) {
|
|
80
|
+
return new Promise((resolve, reject) => {
|
|
81
|
+
var data_init = {
|
|
82
|
+
CaseDataDetailId: caseDataDetailId,
|
|
83
|
+
CaDataGroupId: caDataGroupId,
|
|
84
|
+
ColumnSequence: columnSequence,
|
|
85
|
+
DetailCode: detailCode,
|
|
86
|
+
DetailSequence: detailSequence
|
|
87
|
+
}
|
|
88
|
+
var data = _.merge(data_init, options)
|
|
89
|
+
this.cw.runRequest('Pll/CaseDataGroup/Add', data).then(r => {
|
|
90
|
+
resolve(r.Value)
|
|
91
|
+
}).catch(e => {
|
|
92
|
+
reject(e)
|
|
93
|
+
})
|
|
94
|
+
})
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Add Default Case Data Groups
|
|
99
|
+
*
|
|
100
|
+
* @category Data Groups
|
|
101
|
+
* @param {number} caObjectId - The Case Object to get the attached data groups.
|
|
102
|
+
* @return {Object} Returns Promise that represents a collection of the CaDataGroupItemBases.
|
|
103
|
+
*/
|
|
104
|
+
getGroupsByCaseId(caObjectId: number) {
|
|
105
|
+
return new Promise((resolve, reject) => {
|
|
106
|
+
var data = {
|
|
107
|
+
CaObjectId: caObjectId
|
|
108
|
+
}
|
|
109
|
+
this.cw.runRequest('Pll/CaseDataGroup/ByCaObjectId', data).then(r => {
|
|
110
|
+
resolve(r.Value)
|
|
111
|
+
}).catch(e => {
|
|
112
|
+
reject(e)
|
|
113
|
+
})
|
|
114
|
+
})
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Delete Case Data Groups by Case Object ID.
|
|
119
|
+
*
|
|
120
|
+
* @category Data Groups
|
|
121
|
+
* @param {number} caObjectId - The Case Object to attach the data group to.
|
|
122
|
+
* @return {Object} Returns Promise that represents a number that is the CaObjectId (?)
|
|
123
|
+
*/
|
|
124
|
+
deleteGroupsByCaseId(caObjectId: number) {
|
|
125
|
+
return new Promise((resolve, reject) => {
|
|
126
|
+
var data = {
|
|
127
|
+
CaObjectId: caObjectId
|
|
128
|
+
}
|
|
129
|
+
this.cw.runRequest('Pll/CaseDataGroup/DeleteByCaObjectId', data).then(r => {
|
|
130
|
+
resolve(r.Value)
|
|
131
|
+
}).catch(e => {
|
|
132
|
+
reject(e)
|
|
133
|
+
})
|
|
134
|
+
})
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Search for Case Data Groups. Include one or more of the search fields. A logical 'and' operation is applied to muliple search fields
|
|
139
|
+
*
|
|
140
|
+
* @category Data Groups
|
|
141
|
+
* @param {Object} filters - The parameters to search by. (CaDataGroupId, CaseDataGroupId, GroupCode, GroupDesc, GroupSum, SumFlag)
|
|
142
|
+
* @return {Object} Returns Promise that represents a number that is the CaObjectId (?)
|
|
143
|
+
*/
|
|
144
|
+
searchForGroups(filters?: Object) {
|
|
145
|
+
return new Promise((resolve, reject) => {
|
|
146
|
+
if(_.intersectionBy(filters, ['CaDataGroupId', 'CaseDataGroupId', 'GroupCode', 'GroupDesc', 'GroupSum', 'SumFlag']).length==0) {
|
|
147
|
+
reject(new CWError(2, 'At least one of the attributes (CaDataGroupId, CaseDataGroupId, GroupCode, GroupDesc, GroupSum, SumFlag) must be defined.'))
|
|
148
|
+
}
|
|
149
|
+
var data = filters
|
|
150
|
+
this.cw.runRequest('Pll/CaseDataGroup/Search', data).then(r => {
|
|
151
|
+
resolve(r.Value)
|
|
152
|
+
}).catch(e => {
|
|
153
|
+
reject(e)
|
|
154
|
+
})
|
|
155
|
+
})
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* Get Case Data Groups by Case ObjectId
|
|
160
|
+
*
|
|
161
|
+
* @category Data Groups
|
|
162
|
+
* @param {string} entityType - The entity type to check
|
|
163
|
+
* @param {string} entityUid - The specific entityUID to check
|
|
164
|
+
* @param {Object} options - The other options for checkGIS. Either CaObjectId or CaseDataGroupId is required.
|
|
165
|
+
* @return {Object} Returns Promise that represents a collection of the default CaDataGroupItemBases.
|
|
166
|
+
*/
|
|
167
|
+
checkGIS(entityType: string, entityUid: string, options: {CaObjectId?:number, CaseDataGroupId?: number, CaseDataDetailId?: number}) {
|
|
168
|
+
return new Promise((resolve, reject) => {
|
|
169
|
+
var data = {
|
|
170
|
+
EntityType: entityType,
|
|
171
|
+
EntityUid: entityUid
|
|
172
|
+
}
|
|
173
|
+
if(_.has(options, 'CaObjectId')) {
|
|
174
|
+
_.set(data, 'CaObjectId', _.get(options, 'CaObjectId'))
|
|
175
|
+
} else if(_.has(options, 'CaseDataGroupId')) {
|
|
176
|
+
_.set(data, 'CaseDataGroupId', _.get(options, 'CaseDataGroupId'))
|
|
177
|
+
} else {
|
|
178
|
+
reject(new CWError(1, 'Either CaObjectId or CaseDataGroupId is required.', {'provided': options}))
|
|
179
|
+
}
|
|
180
|
+
if(_.has(options, 'CaseDataDetailId')) {
|
|
181
|
+
_.set(data, 'CaseDataDetailId', _.get(options, 'CaseDataDetailId'))
|
|
182
|
+
}
|
|
183
|
+
this.cw.runRequest('Pll/CaseDataGroup/CheckGISChanges', data).then(r => {
|
|
184
|
+
resolve(r.Value)
|
|
185
|
+
}).catch(e => {
|
|
186
|
+
reject(e)
|
|
187
|
+
})
|
|
188
|
+
})
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
/**
|
|
192
|
+
* Update data groups on a case based on asset value mappings.
|
|
193
|
+
*
|
|
194
|
+
* @category Data Groups
|
|
195
|
+
* @param {number} caObjectId - The case to update
|
|
196
|
+
* @param {string} entityType - The entity type to check
|
|
197
|
+
* @param {string} entityUid - The specific entityUID to check
|
|
198
|
+
* @param {number} [caDataGroupId] - The specific data group ID to limit updates to
|
|
199
|
+
* @return {Object} Returns Promise that represents a collection of the default CaDataGroupItemBases.
|
|
200
|
+
*/
|
|
201
|
+
updateGroupsFromAsset(caObjectId: number, entityType: string, entityUid: string, caDataGroupId?: number) {
|
|
202
|
+
return new Promise((resolve, reject) => {
|
|
203
|
+
var data = {
|
|
204
|
+
CaObjectId: caObjectId,
|
|
205
|
+
EntityType: entityType,
|
|
206
|
+
EntityUid: entityUid
|
|
207
|
+
}
|
|
208
|
+
if(typeof(caDataGroupId)!='undefined') {
|
|
209
|
+
_.set(data, 'CaDataGroupId', caDataGroupId)
|
|
210
|
+
}
|
|
211
|
+
this.cw.runRequest('Pll/CaseDataGroup/UpdateFromAsset', data).then(r => {
|
|
212
|
+
resolve(r.Value)
|
|
213
|
+
}).catch(e => {
|
|
214
|
+
reject(e)
|
|
215
|
+
})
|
|
216
|
+
})
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
/**
|
|
220
|
+
* Attach Case Data Detail
|
|
221
|
+
*
|
|
222
|
+
* @category Data Details
|
|
223
|
+
* @param {number} caDataGroupId - The Case Data Group ID to attach the data detail to.
|
|
224
|
+
* @param {number} caseDataDetailId - caseDataDetailId to attach.
|
|
225
|
+
* @param {Object} [options] - Options
|
|
226
|
+
* @return {Object} Returns Promise that represents an object describing CaDataGroupItemBase.
|
|
227
|
+
*/
|
|
228
|
+
addDetail(caDataGroupId: number, caseDataDetailId: number, options?: Object) {
|
|
229
|
+
return new Promise((resolve, reject) => {
|
|
230
|
+
var data = {
|
|
231
|
+
CaDataGroupId: caDataGroupId,
|
|
232
|
+
CaseDataDetailId: caseDataDetailId
|
|
233
|
+
}
|
|
234
|
+
if(typeof(options)!='undefined') {
|
|
235
|
+
data = _.merge(data, options)
|
|
236
|
+
}
|
|
237
|
+
this.cw.runRequest('Pll/CaseDataDetail/Add', data).then(r => {
|
|
238
|
+
resolve(r.Value)
|
|
239
|
+
}).catch(e => {
|
|
240
|
+
reject(e)
|
|
241
|
+
})
|
|
242
|
+
})
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
/**
|
|
246
|
+
* Update Case Data Detail
|
|
247
|
+
*
|
|
248
|
+
* @category Data Details
|
|
249
|
+
* @param {number} caDataDetailId - The Case Data Group ID to attach the data detail to.
|
|
250
|
+
* @param {Object} [options] - Options
|
|
251
|
+
* @return {Object} Returns Promise that represents an object describing CaDataGroupItemBase.
|
|
252
|
+
*/
|
|
253
|
+
updateDetail(caDataDetailId: number, options?: Object) {
|
|
254
|
+
return new Promise((resolve, reject) => {
|
|
255
|
+
var data = {
|
|
256
|
+
CaDataDetailId: caDataDetailId
|
|
257
|
+
}
|
|
258
|
+
if(typeof(options)!='undefined') {
|
|
259
|
+
data = _.merge(data, options)
|
|
260
|
+
}
|
|
261
|
+
this.cw.runRequest('Pll/CaseDataDetail/Update', data).then(r => {
|
|
262
|
+
resolve(r.Value)
|
|
263
|
+
}).catch(e => {
|
|
264
|
+
reject(e)
|
|
265
|
+
})
|
|
266
|
+
})
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
/**
|
|
270
|
+
* Lock Case Data Detail
|
|
271
|
+
*
|
|
272
|
+
* @category Data Details
|
|
273
|
+
* @param {number} caDataDetailId - The Case Data Group ID to lock
|
|
274
|
+
* @return {Object} Returns Promise which represents an object describing the CaDataDetailItem.
|
|
275
|
+
*/
|
|
276
|
+
lockDetail(caDataDetailId: number) {
|
|
277
|
+
return new Promise((resolve, reject) => {
|
|
278
|
+
var data = {
|
|
279
|
+
CaDataDetailId: caDataDetailId,
|
|
280
|
+
Lock: true
|
|
281
|
+
}
|
|
282
|
+
this.cw.runRequest('Pll/CaseDataDetail/UpdateLock', data).then(r => {
|
|
283
|
+
resolve(r.Value)
|
|
284
|
+
}).catch(e => {
|
|
285
|
+
reject(e)
|
|
286
|
+
})
|
|
287
|
+
})
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
/**
|
|
291
|
+
* Unlock Case Data Detail
|
|
292
|
+
*
|
|
293
|
+
* @category Data Details
|
|
294
|
+
* @param {number} caDataDetailId - The Case Data Group ID to unlock
|
|
295
|
+
* @return {Object} Returns Promise which represents an object describing the CaDataDetailItem.
|
|
296
|
+
*/
|
|
297
|
+
unlockDetail(caDataDetailId: number) {
|
|
298
|
+
return new Promise((resolve, reject) => {
|
|
299
|
+
var data = {
|
|
300
|
+
CaDataDetailId: caDataDetailId,
|
|
301
|
+
Lock: false
|
|
302
|
+
}
|
|
303
|
+
this.cw.runRequest('Pll/CaseDataDetail/UpdateLock', data).then(r => {
|
|
304
|
+
resolve(r.Value)
|
|
305
|
+
}).catch(e => {
|
|
306
|
+
reject(e)
|
|
307
|
+
})
|
|
308
|
+
})
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
/**
|
|
312
|
+
* Adds a list of possible values to the data detail entry specified by the CaDataDetailId.
|
|
313
|
+
*
|
|
314
|
+
* @category Data List Values
|
|
315
|
+
* @param {number} caDataDetailId - The Case Object to attach the data group to.
|
|
316
|
+
* @param {string} listValue - The Group Code.
|
|
317
|
+
* @return {Object} Returns Promise that represents an object describing CaDataListValuesItemBase.
|
|
318
|
+
*/
|
|
319
|
+
addListValue(caDataDetailId: number, listValue: string) {
|
|
320
|
+
return new Promise((resolve, reject) => {
|
|
321
|
+
var data = {
|
|
322
|
+
CaDataDetailId: caDataDetailId,
|
|
323
|
+
ListValue: listValue
|
|
324
|
+
}
|
|
325
|
+
this.cw.runRequest('Pll/CaseDataListValues/Add', data).then(r => {
|
|
326
|
+
resolve(r.Value)
|
|
327
|
+
}).catch(e => {
|
|
328
|
+
reject(e)
|
|
329
|
+
})
|
|
330
|
+
})
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
/**
|
|
334
|
+
* Delete by Id (Ca Data List Id)
|
|
335
|
+
*
|
|
336
|
+
* @category Data List Values
|
|
337
|
+
* @param {number} CaDataListId - The Case Data List ID
|
|
338
|
+
* @return {Object} Returns Promise that represents an object describing CaDataListValuesItemBase.
|
|
339
|
+
*/
|
|
340
|
+
deleteListValue(caDataDetailId: number) {
|
|
341
|
+
return new Promise((resolve, reject) => {
|
|
342
|
+
var data = {
|
|
343
|
+
CaDataDetailId: caDataDetailId
|
|
344
|
+
}
|
|
345
|
+
this.cw.runRequest('Pll/CaseDataListValues/Delete', data).then(r => {
|
|
346
|
+
resolve(r.Value)
|
|
347
|
+
}).catch(e => {
|
|
348
|
+
reject(e)
|
|
349
|
+
})
|
|
350
|
+
})
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
/**
|
|
354
|
+
* Search for List Value IDs. Include one or more of the search fields. A logical 'and' operation is applied to muliple search fields
|
|
355
|
+
*
|
|
356
|
+
* @category Data List Values
|
|
357
|
+
* @param {Object} filters - The parameters to search by. (CaDataDetailId, CaDataListId, ListValue)
|
|
358
|
+
* @return {Object} Returns Promise that represents an Array of resulting CaDataListIds
|
|
359
|
+
*/
|
|
360
|
+
searchForListValueIds(filters?: Object) {
|
|
361
|
+
return new Promise((resolve, reject) => {
|
|
362
|
+
if(_.intersectionBy(filters, ['CaDataDetailId', 'CaDataListId', 'ListValue']).length==0) {
|
|
363
|
+
reject(new CWError(3, 'At least one of the attributes (CaDataDetailId, CaDataListId, ListValue) must be defined.'))
|
|
364
|
+
}
|
|
365
|
+
var data = filters
|
|
366
|
+
this.cw.runRequest('Pll/CaseDataGroup/Search', data).then(r => {
|
|
367
|
+
resolve(r.Value)
|
|
368
|
+
}).catch(e => {
|
|
369
|
+
reject(e)
|
|
370
|
+
})
|
|
371
|
+
})
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
/**
|
|
375
|
+
* Search for List Value Objects. Include one or more of the search fields. A logical 'and' operation is applied to muliple search fields
|
|
376
|
+
*
|
|
377
|
+
* @category Data List Values
|
|
378
|
+
* @param {Object} filters - The parameters to search by. (CaDataDetailId, CaDataListId, ListValue)
|
|
379
|
+
* @return {Object} Returns Promise that represents a collection of resulting CaDataListValuesItemBase objects
|
|
380
|
+
*/
|
|
381
|
+
searchForListValueObjects(filters?: Object) {
|
|
382
|
+
return new Promise((resolve, reject) => {
|
|
383
|
+
if(_.intersectionBy(filters, ['CaDataDetailId', 'CaDataListId', 'ListValue']).length==0) {
|
|
384
|
+
reject(new CWError(3, 'At least one of the attributes (CaDataDetailId, CaDataListId, ListValue) must be defined.'))
|
|
385
|
+
}
|
|
386
|
+
var data = filters
|
|
387
|
+
this.cw.runRequest('Pll/CaseDataGroup/SearchObject', data).then(r => {
|
|
388
|
+
resolve(r.Value)
|
|
389
|
+
}).catch(e => {
|
|
390
|
+
reject(e)
|
|
391
|
+
})
|
|
392
|
+
})
|
|
393
|
+
}
|
|
17
394
|
}
|