cityworks 0.0.36 → 0.0.38

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.
Files changed (47) hide show
  1. package/README.md +4 -2
  2. package/dist/cityworks.d.ts +1 -1
  3. package/dist/index.d.ts +1 -1
  4. package/dist/index.js +1 -1
  5. package/dist/index.js.map +1 -1
  6. package/dist/index.m.js +1 -1
  7. package/dist/index.m.js.map +1 -1
  8. package/dist/index.modern.mjs +1 -1
  9. package/dist/index.modern.mjs.map +1 -1
  10. package/dist/index.umd.js +1 -1
  11. package/dist/index.umd.js.map +1 -1
  12. package/package.json +2 -1
  13. package/index.js +0 -1
  14. package/src/activity_link.ts +0 -241
  15. package/src/case.ts +0 -282
  16. package/src/case_admin.ts +0 -883
  17. package/src/case_assets.ts +0 -129
  18. package/src/case_data.ts +0 -446
  19. package/src/case_financial.ts +0 -848
  20. package/src/case_workflow.ts +0 -462
  21. package/src/cityworks.ts +0 -719
  22. package/src/comments.ts +0 -167
  23. package/src/costs.ts +0 -289
  24. package/src/error.ts +0 -56
  25. package/src/event_layer.ts +0 -231
  26. package/src/general.ts +0 -143
  27. package/src/gis.ts +0 -242
  28. package/src/index.ts +0 -1
  29. package/src/inspection.ts +0 -851
  30. package/src/inspection_admin.ts +0 -45
  31. package/src/message_queue.ts +0 -243
  32. package/src/request.ts +0 -823
  33. package/src/request_admin.ts +0 -35
  34. package/src/search.ts +0 -339
  35. package/src/workorder.ts +0 -838
  36. package/src/workorder_admin.ts +0 -248
  37. package/test/01.cityworksTest.js +0 -80
  38. package/test/02.activitylinkTest.js +0 -58
  39. package/test/03.generalTest.js +0 -87
  40. package/test/04.requestTest.js +0 -293
  41. package/test/05.caseTest.js +0 -110
  42. package/test/06.caseFinancialTest.js +0 -172
  43. package/test/07.searchTest.js +0 -191
  44. package/test/08.workOrderTest.js +0 -48
  45. package/test/09.caseAssetsTest.js +0 -72
  46. package/test/09.inspectionTest.js +0 -28
  47. package/tsconfig.json +0 -68
@@ -1,462 +0,0 @@
1
- import { CWError } from './error'
2
- const _ = require('lodash')
3
- import { Comments } from './comments'
4
-
5
- export class CaseWorkflow {
6
- /**
7
- * @hidden
8
- */
9
- cw: any
10
-
11
- /**
12
- * Task sub-methods
13
- */
14
- task: Object
15
-
16
- /**
17
- * @hidden
18
- */
19
- constructor(cw) {
20
- this.cw = cw
21
- this.task = {
22
- comment: new Comments(cw, 'CaTask')
23
- }
24
- }
25
-
26
- /**
27
- * Adds a task to the case specified by the CaObectId.
28
- *
29
- * @category Tasks
30
- * @param {number} caObjectId - The Case Object to attach the task to
31
- * @param {number} taskId - The task ID to add to the case workflow
32
- * @param {number} startPoint - The start point in the workflow for the task
33
- * @param {number} endPoint - The end point in the workflow for the task
34
- * @param {Object} [options] - Options for the Task. See /{subdirectory}/apidocs/#/service-info/Pll/CaseTask
35
- * @return {Object} Returns Promise that represents an object describing CaTaskItemBase.
36
- */
37
- addTask(caObjectId: number, taskId: number, startPoint: number, endPoint: number, options?: Object) {
38
- return new Promise((resolve, reject) => {
39
- var data = {
40
- CaObjectId: caObjectId,
41
- TaskId: taskId,
42
- StartPoint: startPoint,
43
- EndPoint: endPoint
44
- }
45
- if(typeof(options)!='undefined') {
46
- data = _.merge(data, options)
47
- }
48
- this.cw.runRequest('Pll/CaseTask/Add', data).then(r => {
49
- resolve(r.Value)
50
- }).catch(e => {
51
- reject(e)
52
- })
53
- })
54
- }
55
-
56
- /**
57
- * Add Task Result
58
- *
59
- * @category Task Results
60
- * @param {number} caObjectId - The Case Object to attach the task to
61
- * @param {number} caTaskId - The Case task ID to add the result to
62
- * @param {number} resultCode - The result Code
63
- * @param {number} resultID - The result ID
64
- * @param {number} resultSetID - The result set ID
65
- * @param {Object} [options] - Options for the Task. See /{subdirectory}/apidocs/#/service-info/Pll/CaseTaskResults
66
- * @return {Object} Returns Promise that represents an object describing CaTaskResultsItem.
67
- */
68
- addTaskResult(caObjectId: number, caTaskId: number, resultCode: number, resultID: number, resultSetID: number, options?: Object) {
69
- return new Promise((resolve, reject) => {
70
- var data = {
71
- CaObjectId: caObjectId,
72
- CaTaskId: caTaskId,
73
- ResultCode: resultCode,
74
- ResultID: resultID,
75
- ResultSetID: resultSetID
76
- }
77
- if(typeof(options)!='undefined') {
78
- data = _.merge(data, options)
79
- }
80
- this.cw.runRequest('Pll/CaseTaskResults/Add', data).then(r => {
81
- resolve(r.Value)
82
- }).catch(e => {
83
- reject(e)
84
- })
85
- })
86
- }
87
-
88
- /**
89
- * Add Task Comment
90
- *
91
- * @category Comments
92
- * @param {number} caTaskId - The Case task ID of the task to add the comment to
93
- * @param {string} comment - The comment text
94
- * @return {Object} Returns Promise that represents an object describing CaTaskCommentsItemBase.
95
- */
96
- addTaskComment(caTaskId: number, comment: string) {
97
- return new Promise((resolve, reject) => {
98
- var data = {
99
- CaTaskId: caTaskId,
100
- CommentText: comment
101
- }
102
- this.cw.runRequest('Pll/CaseTaskComments/Add', data).then(r => {
103
- resolve(r.Value)
104
- }).catch(e => {
105
- reject(e)
106
- })
107
- })
108
- }
109
-
110
- /**
111
- * Get tasks by CaObjectId
112
- *
113
- * @category Tasks
114
- * @param {number} caObjectId - The Case Object to get the attached tasks
115
- * @param {boolean} checkRelatedItems - Wherther to check related items. Defaults to false.
116
- * @return {Object} Returns Promise that represents a collection of the CaTaskItemBases.
117
- */
118
- getTasksByCaseId(caObjectId: number, checkRelatedItems: boolean = false) {
119
- return new Promise((resolve, reject) => {
120
- var data = {
121
- CaObjectId: caObjectId,
122
- CheckRelatedItems: checkRelatedItems
123
- }
124
- this.cw.runRequest('Pll/CaseTask/ByCaObjectId', data).then(r => {
125
- resolve(r.Value)
126
- }).catch(e => {
127
- reject(e)
128
- })
129
- })
130
- }
131
-
132
- /**
133
- * Get tasks by TaskIds
134
- *
135
- * @category Tasks
136
- * @param {Array<number>} caTaskIds - The IDs of the tasks to retrieve
137
- * @param {boolean} checkRelatedItems - Wherther to check related items. Defaults to false.
138
- * @return {Object} Returns Promise that represents a collection of the CaTaskItemBases.
139
- */
140
- getTasksById(caTaskIds: Array<number>, checkRelatedItems: boolean = false) {
141
- return new Promise((resolve, reject) => {
142
- var data = {
143
- CaTaskIds: caTaskIds,
144
- CheckRelatedItems: checkRelatedItems
145
- }
146
- this.cw.runRequest('Pll/CaseTask/ByIds', data).then(r => {
147
- resolve(r.Value)
148
- }).catch(e => {
149
- reject(e)
150
- })
151
- })
152
- }
153
-
154
- /**
155
- * Get CaTaskResultsItem by CaTaskIds
156
- *
157
- * @category Task Results
158
- * @param {Array<number>} caTaskIds - The IDs of the tasks for which to retrieve results
159
- * @return {Object} Returns Promise that represents a collection of CaTaskResultsItems.
160
- */
161
- getResultsByTaskId(caTaskIds: Array<number>) {
162
- return new Promise((resolve, reject) => {
163
- var data = {
164
- CaTaskIds: caTaskIds
165
- }
166
- this.cw.runRequest('Pll/CaseTaskResults/ByCaTaskIds', data).then(r => {
167
- resolve(r.Value)
168
- }).catch(e => {
169
- reject(e)
170
- })
171
- })
172
- }
173
-
174
- /**
175
- * Search for CaseTaskComments by CaTaskId
176
- *
177
- * @category Comments
178
- * @param {number} caTaskId - The task ID for which to retrieve attached comments
179
- * @return {Object} Returns Promise that represents a collection of CommentRecords.
180
- */
181
- getCommentsForTask(caTaskId: number) {
182
- return new Promise((resolve, reject) => {
183
- var data = {
184
- caTaskId: caTaskId
185
- }
186
- this.cw.runRequest('Pll/CaseTaskComments/ByCaTaskId', data).then(r => {
187
- resolve(r.Value)
188
- }).catch(e => {
189
- reject(e)
190
- })
191
- })
192
- }
193
-
194
- /**
195
- * Search for CaseTaskComments by CaTaskId
196
- *
197
- * @category Comments
198
- * @param {Array<number>} caTaskIds - The task IDs for which to retrieve attached comments
199
- * @return {Object} Returns Promise that represents a collection of CaTaskCommentsItemBase.
200
- */
201
- getCommentsForTasks(caTaskIds: Array<number>) {
202
- return new Promise((resolve, reject) => {
203
- var data = {
204
- caTaskIds: caTaskIds
205
- }
206
- this.cw.runRequest('Pll/CaseTaskComments/ByCaTaskIds', data).then(r => {
207
- resolve(r.Value)
208
- }).catch(e => {
209
- reject(e)
210
- })
211
- })
212
- }
213
-
214
- /**
215
- * Updates a task
216
- *
217
- * @category Tasks
218
- * @param {number} caTaskId - The Case Object to attach the task to
219
- * @param {Object} [options] - Options for Task. See /{subdirectory}/apidocs/#/service-info/Pll/CaseTask
220
- * @return {Object} Returns Promise that represents an object describing CaTaskItemBase.
221
- */
222
- updateTask(caTaskId: number, options?: Object) {
223
- return new Promise((resolve, reject) => {
224
- var data = {
225
- CaTaskId: caTaskId
226
- }
227
- if(typeof(options)!='undefined') {
228
- data = _.merge(data, options)
229
- }
230
- this.cw.runRequest('Pll/CaseTask/Update', data).then(r => {
231
- resolve(r.Value)
232
- }).catch(e => {
233
- reject(e)
234
- })
235
- })
236
- }
237
-
238
- /**
239
- * Update Task Comment
240
- *
241
- * @category Comments
242
- * @param {number} caTaskCommentId - The Case task ID of the task to add the comment to
243
- * @param {string} comment - The comment text
244
- * @param {number} commentId - Probably unnecessary?
245
- * @return {Object} Returns Promise that represents an object describing CaTaskCommentsItemBase.
246
- */
247
- updateTaskComment(caTaskCommentId: number, comment: string, commentId?: number) {
248
- return new Promise((resolve, reject) => {
249
- var data = {
250
- CaTaskCommentId: caTaskCommentId,
251
- CommentText: comment
252
- }
253
- if(typeof(commentId)!='undefined') {
254
- _.set(data, 'CommentId', commentId)
255
- }
256
- this.cw.runRequest('Pll/CaseTaskComments/Update', data).then(r => {
257
- resolve(r.Value)
258
- }).catch(e => {
259
- reject(e)
260
- })
261
- })
262
- }
263
-
264
- /**
265
- * Updates a task
266
- *
267
- * @category Tasks
268
- * @param {number} caTaskId - The Case Object to attach the task to
269
- * @param {string} resultCode - The result code to set for the specified Task
270
- * @param {Object} [options] - Options for Task. Specify either or both TaskCompletedBy & TaskCompleteDate. See /{subdirectory}/apidocs/#/service-info/Pll/CaseTask
271
- * @return {Object} Returns Promise that represents an object describing CaTaskItemBase.
272
- */
273
- setTaskResult(caTaskId: number, resultCode: string, options?: Object) {
274
- return new Promise((resolve, reject) => {
275
- var data = {
276
- CaTaskId: caTaskId
277
- }
278
- if(_.intersectionBy(_.keysIn(options), ['TaskCompleteDate', 'TaskCompletedBy']).length==0) {
279
- reject(new CWError(2, 'At least one of the attributes (TaskCompletedBy, TaskCompleteDate) must be defined.'))
280
- }
281
- if(typeof(options)!='undefined') {
282
- data = _.merge(data, options)
283
- }
284
- this.cw.runRequest('Pll/CaseTask/SetResult', data).then(r => {
285
- resolve(r.Value)
286
- }).catch(e => {
287
- reject(e)
288
- })
289
- })
290
- }
291
-
292
- /**
293
- * Deletes a task by TaskID
294
- *
295
- * @category Tasks
296
- * @param {number} caTaskId - The caTaskId for the task which should be deleted
297
- * @return {Object} Returns Promise that represents an object describing CaTaskItemBase.
298
- */
299
- deleteTask(caTaskId: number) {
300
- return new Promise((resolve, reject) => {
301
- var data = {
302
- CaTaskId: caTaskId
303
- }
304
- this.cw.runRequest('Pll/CaseTask/Delete', data).then(r => {
305
- resolve(r.Value)
306
- }).catch(e => {
307
- reject(e)
308
- })
309
- })
310
- }
311
-
312
- /**
313
- * Deletes a task by TaskID
314
- *
315
- * @category Tasks
316
- * @param {number} caTaskId - The caTaskId for the task which should be deleted
317
- * @return {Object} Returns Promise that represents the number of the CaObjectID
318
- */
319
- deleteTasksOnCase(caObjectId: number) {
320
- return new Promise((resolve, reject) => {
321
- var data = {
322
- CaObjectId: caObjectId
323
- }
324
- this.cw.runRequest('Pll/CaseTask/DeleteByCaObjectId', data).then(r => {
325
- resolve(r.Value)
326
- }).catch(e => {
327
- reject(e)
328
- })
329
- })
330
- }
331
-
332
- /**
333
- * Deletes tasks by TaskID
334
- *
335
- * @category Comments
336
- * @param {Array<number>} caTaskCommentIds - The comments to delete
337
- * @return {Object} Returns Promise that represents a dictionary of comment IDs.
338
- */
339
- deleteTaskComments(caTaskCommentIds: Array<number>) {
340
- return new Promise((resolve, reject) => {
341
- var data = {
342
- CaTaskCommentIds: caTaskCommentIds
343
- }
344
- this.cw.runRequest('Pll/CaseTaskComments/Delete', data).then(r => {
345
- resolve(r.Value)
346
- }).catch(e => {
347
- reject(e)
348
- })
349
- })
350
- }
351
-
352
- /**
353
- * Search for Case Tasks. Include one or more of the search fields. A logical 'and' operation is applied to muliple search fields
354
- *
355
- * @category Tasks
356
- * @param {Object} filters - The parameters to search by. (ResponsibleUserId, TaskAvailable, TaskComplete, TaskType)
357
- * @return {Object} Returns Promise that represents a collection of resulting CaTaskIDs
358
- */
359
- searchForTasks(filters?: Object) {
360
- return new Promise((resolve, reject) => {
361
- if(_.intersectionBy(_.keysIn(filters), ['ResponsibleUserId', 'TaskAvailable', 'TaskComplete', 'TaskType']).length==0) {
362
- reject(new CWError(1, 'At least one of the attributes (ResponsibleUserId, TaskAvailable, TaskComplete, TaskType) must be defined.'))
363
- }
364
- var data = filters
365
- this.cw.runRequest('Pll/CaseTask/Search', data).then(r => {
366
- resolve(r.Value)
367
- }).catch(e => {
368
- reject(e)
369
- })
370
- })
371
- }
372
-
373
- /**
374
- * Search for CaseTaskResults Objects. Include one or more of the search fields. A logical 'and' operation is applied to muliple search fields
375
- *
376
- * @category Task Results
377
- * @param {Object} filters - The parameters to search by. See: /{subdirectory}/apidocs/#/service-info/Pll/CaseTaskResults
378
- * @return {Object} Returns Promise that represents a collection of resulting CaTaskResultsItem
379
- */
380
- searchForTaskResults(filters?: Object) {
381
- return new Promise((resolve, reject) => {
382
- var data = filters
383
- this.cw.runRequest('Pll/CaseTaskResults/Search', data).then(r => {
384
- resolve(r.Value)
385
- }).catch(e => {
386
- reject(e)
387
- })
388
- })
389
- }
390
-
391
- /**
392
- * Adds a task to the case specified by the CaObectId.
393
- *
394
- * @category Task Attachments
395
- * @param {number} caTaskId - The Task ID to attach the document to
396
- * @param {number} caObjectId - The Case Object ID
397
- * @param {string} docName - The file name as it should display in the system
398
- * @param {string} locationType - The location of the file...leave blank
399
- * @param {any} file - The binary string for the file
400
- * @return {Object} Returns Promise that represents an object describing added Attachment
401
- */
402
- addTaskAttachment(caTaskId: number, caObjectId: number, docName: number, file: any, locationType?: string) {
403
- return new Promise((resolve, reject) => {
404
- var data = {
405
- CaObjectId: caObjectId,
406
- CaTaskId: caTaskId,
407
- DocName: docName
408
- }
409
- if(typeof(locationType)!='undefined') {
410
- _.set(data, 'LocationType', locationType)
411
- }
412
- this.cw.runRequest('Pll/CaseRelDocs/AddTaskRelDoc', data, file).then(r => {
413
- resolve(r.Value)
414
- }).catch(e => {
415
- reject(e)
416
- })
417
- })
418
- }
419
-
420
- /**
421
- * Gets each Document Attached to the specified Task
422
- *
423
- * @category Task Attachments
424
- * @param {number} caTaskId - The Task ID to attach the document to
425
- * @return {Object} Returns Promise that represents a collection of objects describing each Attachment on the provided task
426
- */
427
- getTaskAttachments(caTaskId: number) {
428
- return new Promise((resolve, reject) => {
429
- var data = {
430
- CaTaskId: caTaskId
431
- }
432
- this.cw.runRequest('Pll/CaseRelDocs/ByCaTaskId', data).then(r => {
433
- resolve(r.Value)
434
- }).catch(e => {
435
- reject(e)
436
- })
437
- })
438
- }
439
-
440
- /**
441
- * Deletes a task attachment by caRelDocId (Related Case Document ID). Same as RelDocs delete for case.
442
- *
443
- * @category Task Attachments
444
- * @param {number} caRelDocId - The caRelDocId for the related document which should be deleted
445
- * @return {Object} Returns Promise that represents the an object describing the deleted document.
446
- */
447
- deleteTaskAttachment(caRelDocId: number) {
448
- return new Promise((resolve, reject) => {
449
- var data = {
450
- CaRelDocId: caRelDocId
451
- }
452
- this.cw.runRequest('PLL/CaseRelDocs/Delete', data).then(r => {
453
- resolve(r.Value)
454
- }).catch(e => {
455
- reject(e)
456
- })
457
- })
458
- }
459
- }
460
-
461
-
462
-