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.
Files changed (47) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +19 -19
  3. package/dist/activity_link.d.ts +6 -3
  4. package/dist/error.d.ts +7 -4
  5. package/dist/gis.d.ts +13 -0
  6. package/dist/index.js +1 -1
  7. package/dist/index.js.map +1 -1
  8. package/dist/index.m.js +1 -1
  9. package/dist/index.m.js.map +1 -1
  10. package/dist/index.modern.js +1 -1
  11. package/dist/index.modern.js.map +1 -1
  12. package/dist/index.umd.js +1 -1
  13. package/dist/index.umd.js.map +1 -1
  14. package/dist/inspection.d.ts +1 -1
  15. package/dist/inspection_admin.d.ts +15 -0
  16. package/dist/request_admin.d.ts +8 -0
  17. package/dist/search.d.ts +7 -7
  18. package/dist/workorder_admin.d.ts +101 -0
  19. package/package.json +3 -2
  20. package/src/activity_link.ts +17 -3
  21. package/src/case.ts +2 -2
  22. package/src/case_admin.ts +4 -4
  23. package/src/case_data.ts +4 -4
  24. package/src/case_financial.ts +8 -8
  25. package/src/case_workflow.ts +2 -2
  26. package/src/cityworks.ts +29 -17
  27. package/src/comments.ts +9 -1
  28. package/src/error.ts +11 -3
  29. package/src/event_layer.ts +219 -28
  30. package/src/general.ts +3 -1
  31. package/src/gis.ts +88 -53
  32. package/src/inspection.ts +1 -1
  33. package/src/inspection_admin.ts +28 -0
  34. package/src/message_queue.ts +10 -0
  35. package/src/request.ts +1 -1
  36. package/src/request_admin.ts +18 -0
  37. package/src/search.ts +16 -14
  38. package/src/workorder.ts +2 -2
  39. package/src/workorder_admin.ts +231 -0
  40. package/test/01.cityworksTest.js +12 -12
  41. package/test/03.generalTest.js +87 -0
  42. package/test/04.requestTest.js +8 -0
  43. package/test/05.caseTest.js +86 -5
  44. package/test/06.caseFinancialTest.js +95 -6
  45. package/test/07.searchTest.js +191 -0
  46. package/test/08.workOrderTest.js +48 -0
  47. package/test/{07.search.js → 09.inspectionTest.js} +4 -11
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2021 Walker <3987+walker@users.noreply.github.com>
3
+ Copyright (c) 2021 Walker Hamilton <3987+walker@users.noreply.github.com>
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -4,17 +4,17 @@ This API wrapper for Cityworks follows the Cityworks release schedule as closely
4
4
 
5
5
  Require the class:
6
6
 
7
- var cityworks = require('cityworks');
7
+ const Cityworks = require('cityworks');
8
8
 
9
- Configure the instance that is then available:
9
+ Instantiate the Class for the instance of Cityworks available given a domain:
10
10
 
11
- cityworks.configure('my.cityworks.domain')
11
+ let cw = new Cityworks(CW_DOMAIN)
12
12
 
13
13
  ## Authentication
14
14
 
15
15
  Authenticate with the Cityworks install:
16
16
 
17
- cityworks.authenticate('myuser', 'mypassword').then(resp => {
17
+ cw.authenticate('myuser', 'mypassword').then(resp => {
18
18
 
19
19
  }).catch(error => {
20
20
  console.log(error.message);
@@ -33,16 +33,16 @@ Provide a saved token instead of the standard u/p auth:
33
33
 
34
34
  Access the primary AMS ([Inspection](https://walker.github.io/cityworks/classes/inspection.Inspection.html), [WorkOrder](https://walker.github.io/cityworks/classes/workorder.WorkOrder.html), & [{Service} Request](https://walker.github.io/cityworks/classes/request.Request.html)) & [PLL](https://walker.github.io/cityworks/classes/case.Case.html) object libraries like so:
35
35
 
36
- cityworks.inspection.methodHere().then(resp => {
36
+ cw.inspection.methodHere().then(resp => {
37
37
 
38
38
  })
39
- cityworks.workorder.methodHere().then(resp => {
39
+ cw.workorder.methodHere().then(resp => {
40
40
 
41
41
  })
42
- cityworks.request.methodHere().then(resp => {
42
+ cw.request.methodHere().then(resp => {
43
43
 
44
44
  })
45
- cityworks.case.methodHere().then(resp => {
45
+ cw.case.methodHere().then(resp => {
46
46
 
47
47
  })
48
48
 
@@ -50,25 +50,25 @@ Some of the methods are general or top-level, and so, are accessed separately ar
50
50
 
51
51
  [General methods](https://walker.github.io/cityworks/classes/general.General.html) including authentication:
52
52
 
53
- cityworks.general.methodHere().then(resp => {
53
+ cw.general.methodHere().then(resp => {
54
54
 
55
55
  })
56
56
 
57
57
  [Message queue](https://walker.github.io/cityworks/classes/message_queue.MessageQueue.html) methods for examining, processing, and troubleshooting webhooks and activity events:
58
58
 
59
- cityworks.message_queue.methodHere().then(resp => {
59
+ cw.message_queue.methodHere().then(resp => {
60
60
 
61
61
  })
62
62
 
63
63
  [Activity link](https://walker.github.io/cityworks/classes/activity_link.ActivityLinks.html) for linking one node/object to another:
64
64
 
65
- cityworks.activity_link.methodHere().then(resp => {
65
+ cw.activity_link.methodHere().then(resp => {
66
66
 
67
67
  })
68
68
 
69
69
  [Mapping and GIS methods](https://walker.github.io/cityworks/classes/gis.Gis.html) not specific to a single object type:
70
70
 
71
- cityworks.gis.methodHere().then(resp => {
71
+ cw.gis.methodHere().then(resp => {
72
72
 
73
73
  })
74
74
 
@@ -84,25 +84,25 @@ For the sake of organizing some of the other methods needed by the primary and s
84
84
 
85
85
  For [PLL case financial actions](https://walker.github.io/cityworks/classes/case_financial.CaseFinancial.html):
86
86
 
87
- cityworks.case.financial.methodHere().then(resp => {
87
+ cw.case.financial.methodHere().then(resp => {
88
88
 
89
89
  })
90
90
 
91
91
  For [PLL case data details & data groups](https://walker.github.io/cityworks/classes/case_data.CaseData.html):
92
92
 
93
- cityworks.case.data.methodHere().then(resp => {
93
+ cw.case.data.methodHere().then(resp => {
94
94
 
95
95
  })
96
96
 
97
97
  For PLL case [workflow and task actions](https://walker.github.io/cityworks/classes/case_workflow.CaseWorkflow.html):
98
98
 
99
- cityworks.case.workflow.methodHere().then(resp => {
99
+ cw.case.workflow.methodHere().then(resp => {
100
100
 
101
101
  })
102
102
 
103
103
  For [PLL administration actions](https://walker.github.io/cityworks/classes/case_admin.CaseAdmin.html):
104
104
 
105
- cityworks.case.admin.methodHere().then(resp => {
105
+ cw.case.admin.methodHere().then(resp => {
106
106
 
107
107
  })
108
108
 
@@ -110,14 +110,14 @@ For [PLL administration actions](https://walker.github.io/cityworks/classes/case
110
110
 
111
111
  For any object in Cityworks which can be commented on, use the [Comments class](https://walker.github.io/cityworks/classes/case_admin.CaseAdmin.html) via the class the comment is to be made on:
112
112
 
113
- cityworks.case.comment.add(CaObjectIdGoesHere, "Comment goes here").then(resp => {
113
+ cw.case.comment.add(CaObjectIdGoesHere, "Comment goes here").then(resp => {
114
114
 
115
115
  })
116
116
 
117
- cityworks.workorder.comment.add(WorkOrderSIDGoesHere, "Comment goes here").then(resp => {
117
+ cw.workorder.comment.add(WorkOrderSIDGoesHere, "Comment goes here").then(resp => {
118
118
 
119
119
  })
120
120
 
121
- cityworks.request.comment.add(RequestIDGoesHere, "Comment goes here").then(resp => {
121
+ cw.request.comment.add(RequestIDGoesHere, "Comment goes here").then(resp => {
122
122
 
123
123
  })
@@ -1,11 +1,15 @@
1
1
  import ReversibleMap from 'reversible-map';
2
- interface ActivityLink {
2
+ /**
3
+ * ActivityLink interface for ActivityLinks
4
+ *
5
+ */
6
+ export interface ActivityLink {
3
7
  linkTypes: ReversibleMap<string, number>;
4
8
  activityTypes: ReversibleMap<string, number>;
5
9
  cw: any;
6
10
  }
7
11
  /**
8
- * ActivityLinks implements the activity link functions
12
+ * ActivityLinks implements the activity link functions via using the ActivityLink interface
9
13
  *
10
14
  */
11
15
  export declare class ActivityLinks implements ActivityLink {
@@ -104,4 +108,3 @@ export declare class ActivityLinks implements ActivityLink {
104
108
  */
105
109
  remove(source_type: string, source_sid: number, destination_type: string, destination_sid: number, link_type?: string): Promise<unknown>;
106
110
  }
107
- export {};
package/dist/error.d.ts CHANGED
@@ -1,4 +1,10 @@
1
- interface CWErrorInt {
1
+ /**
2
+ * CWErrorInt interface definition for implementation by CWError
3
+ *
4
+ * `{name: string, code: number, message: string, info?: string}`
5
+ *
6
+ */
7
+ export interface CWErrorInt {
2
8
  name: string;
3
9
  code: number;
4
10
  message: string;
@@ -7,8 +13,6 @@ interface CWErrorInt {
7
13
  /**
8
14
  * CWError implements a custom error class for this codebase with additional information
9
15
  *
10
- * `{name: string, code:number, info: object}`
11
- *
12
16
  */
13
17
  export declare class CWError implements CWErrorInt {
14
18
  /**
@@ -37,4 +41,3 @@ export declare class CWError implements CWErrorInt {
37
41
  */
38
42
  constructor(code: number, message: string, info?: object);
39
43
  }
40
- export {};
package/dist/gis.d.ts CHANGED
@@ -71,9 +71,22 @@ export declare class Gis {
71
71
  * @return {Object} Returns Promise object that represents an Object with the user's GIS services
72
72
  */
73
73
  user(context?: Array<string>, allDomains?: boolean, allGroups?: boolean, getGisData?: boolean): Promise<unknown>;
74
+ /**
75
+ * Get Geocode server info by ServerId
76
+ *
77
+ * @param {number} ServiceId
78
+ * @return {Object} Returns Promise object that represents an object describing the provided Geocoder service configuration
79
+ */
74
80
  /**
75
81
  * Get currently selected entities from the Cityworks install's session for your user
76
82
  * @return {Object} Returns Promise object that represents an Object with the currently-selected entities
77
83
  */
78
84
  selectedEntities(): Promise<unknown>;
85
+ /**
86
+ * Get attributes available for provided entity
87
+ *
88
+ * @param {string} entityType - The entity type to describe
89
+ * @return {Object} Returns Promise object that represents a collection of attribute description objects
90
+ */
91
+ getEntityAttributes(entityType: string): Promise<unknown>;
79
92
  }