cityworks 0.0.42 → 0.0.44

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 CHANGED
@@ -6,17 +6,17 @@ Require the class:
6
6
 
7
7
  const Cityworks = require('cityworks')
8
8
 
9
- import { Cityworks } from 'cityworks'
9
+ import * as cw from 'cityworks'
10
10
 
11
11
  Instantiate the Class for the instance of Cityworks available given a domain:
12
12
 
13
- let cw = new Cityworks('cw.domain.tld', {path: 'cityworks'})
13
+ cw.Cityworks.configure('cw.domain.tld', {path: 'cityworks'})
14
14
 
15
15
  ## Authentication
16
16
 
17
17
  Authenticate with the Cityworks install:
18
18
 
19
- cw.authenticate('myuser', 'mypassword').then(resp => {
19
+ cw.Cityworks.authenticate('myuser', 'mypassword').then(resp => {
20
20
 
21
21
  }).catch(error => {
22
22
  console.log(error.message)
@@ -25,26 +25,26 @@ Authenticate with the Cityworks install:
25
25
 
26
26
  Get the currently valid token in order to store it in a session or cookie:
27
27
 
28
- cw.getToken()
28
+ cw.Cityworks.getToken()
29
29
 
30
30
  Provide a saved token instead of the standard u/p auth:
31
31
 
32
- cw.setToken('mytoken')
32
+ cw.Cityworks.setToken('mytoken')
33
33
 
34
34
  ## Main method calls
35
35
 
36
- 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:
36
+ 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.Briefcase.html) object libraries like so:
37
37
 
38
- cw.inspection.methodHere().then(resp => {
38
+ cw.Cityworks.inspection.methodHere().then(resp => {
39
39
 
40
40
  })
41
- cw.workorder.methodHere().then(resp => {
41
+ cw.Cityworks.workorder.methodHere().then(resp => {
42
42
 
43
43
  })
44
- cw.request.methodHere().then(resp => {
44
+ cw.Cityworks.request.methodHere().then(resp => {
45
45
 
46
46
  })
47
- cw.case.methodHere().then(resp => {
47
+ cw.Cityworks.briefcase.methodHere().then(resp => {
48
48
 
49
49
  })
50
50
 
@@ -52,31 +52,31 @@ Some of the methods are general or top-level, and so, are accessed separately ar
52
52
 
53
53
  [General methods](https://walker.github.io/cityworks/classes/general.General.html) including authentication:
54
54
 
55
- cw.general.methodHere().then(resp => {
55
+ cw.Cityworks.general.methodHere().then(resp => {
56
56
 
57
57
  })
58
58
 
59
59
  [Message queue](https://walker.github.io/cityworks/classes/message_queue.MessageQueue.html) methods for examining, processing, and troubleshooting webhooks and activity events:
60
60
 
61
- cw.message_queue.methodHere().then(resp => {
61
+ cw.Cityworks.message_queue.methodHere().then(resp => {
62
62
 
63
63
  })
64
64
 
65
65
  [Activity link](https://walker.github.io/cityworks/classes/activity_link.ActivityLinks.html) for linking one node/object to another:
66
66
 
67
- cw.activity_link.methodHere().then(resp => {
67
+ cw.Cityworks.activity_link.methodHere().then(resp => {
68
68
 
69
69
  })
70
70
 
71
71
  [Mapping and GIS methods](https://walker.github.io/cityworks/classes/gis.Gis.html) not specific to a single object type:
72
72
 
73
- cw.gis.methodHere().then(resp => {
73
+ cw.Cityworks.gis.methodHere().then(resp => {
74
74
 
75
75
  })
76
76
 
77
77
  [General search methods](https://walker.github.io/cityworks/classes/search.Search.html):
78
78
 
79
- cityworks.search.methodHere().then(resp => {
79
+ cw.Cityworks.search.methodHere().then(resp => {
80
80
 
81
81
  })
82
82
 
@@ -86,40 +86,40 @@ For the sake of organizing some of the other methods needed by the primary and s
86
86
 
87
87
  For [PLL case financial actions](https://walker.github.io/cityworks/classes/case_financial.CaseFinancial.html):
88
88
 
89
- cw.case.financial.methodHere().then(resp => {
89
+ cw.Cityworks.briefcase.financial.methodHere().then(resp => {
90
90
 
91
91
  })
92
92
 
93
93
  For [PLL case data details & data groups](https://walker.github.io/cityworks/classes/case_data.CaseData.html):
94
94
 
95
- cw.case.data.methodHere().then(resp => {
95
+ cw.Cityworks.briefcase.data.methodHere().then(resp => {
96
96
 
97
97
  })
98
98
 
99
99
  For PLL case [workflow and task actions](https://walker.github.io/cityworks/classes/case_workflow.CaseWorkflow.html):
100
100
 
101
- cw.case.workflow.methodHere().then(resp => {
101
+ cw.Cityworks.briefcase.workflow.methodHere().then(resp => {
102
102
 
103
103
  })
104
104
 
105
105
  For [PLL administration actions](https://walker.github.io/cityworks/classes/case_admin.CaseAdmin.html):
106
106
 
107
- cw.case.admin.methodHere().then(resp => {
107
+ cw.Cityworks.briefcase.admin.methodHere().then(resp => {
108
108
 
109
109
  })
110
110
 
111
111
  ## Commenting
112
112
 
113
- 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:
113
+ For any object in Cityworks which can be commented on, use the [Comments class](https://walker.github.io/cityworks/classes/comments.Comments.html) via the class the comment is to be made on:
114
114
 
115
- cw.case.comment.add(CaObjectIdGoesHere, "Comment goes here").then(resp => {
115
+ cw.Cityworks.briefcase.comment.add(CaObjectIdGoesHere, "Comment goes here").then(resp => {
116
116
 
117
117
  })
118
118
 
119
- cw.workorder.comment.add(WorkOrderSIDGoesHere, "Comment goes here").then(resp => {
119
+ cw.Cityworks.workorder.comment.add(WorkOrderSIDGoesHere, "Comment goes here").then(resp => {
120
120
 
121
121
  })
122
122
 
123
- cw.request.comment.add(RequestIDGoesHere, "Comment goes here").then(resp => {
123
+ cw.Cityworks.request.comment.add(RequestIDGoesHere, "Comment goes here").then(resp => {
124
124
 
125
125
  })
@@ -0,0 +1,114 @@
1
+ export declare class Briefcase {
2
+ /**
3
+ * @hidden
4
+ */
5
+ cw: any;
6
+ /**
7
+ * Data Detail methods
8
+ */
9
+ data?: Object;
10
+ /**
11
+ * Asset (Address) methods
12
+ */
13
+ asset?: Object;
14
+ /**
15
+ * Workflow & task methods
16
+ */
17
+ workflow?: Object;
18
+ /**
19
+ * Payment, Receipt, & Fee methods
20
+ */
21
+ financial?: Object;
22
+ /**
23
+ * Commenting methods
24
+ */
25
+ comment?: Object;
26
+ /**
27
+ * PLL Administration methods
28
+ */
29
+ admin?: Object;
30
+ /**
31
+ * @hidden
32
+ */
33
+ constructor(cw: any);
34
+ /**
35
+ * Create new case
36
+ *
37
+ * @category Cases
38
+ * @param {number} caseTypeId - The case Type ID
39
+ * @param {number} subTypeId - The case subType ID
40
+ * @param {Object} [options] - See /{subdirectory}/apidocs/#/data-type-info;dataType=CaObjectItemBase
41
+ * @return {Object} Returns Promise that represents an object describing the newly-created case
42
+ */
43
+ create(caseTypeId: number, subTypeId: number, options?: Object): Promise<unknown>;
44
+ /**
45
+ * Create a child case
46
+ *
47
+ * @category Cases
48
+ * @param {number} busCaseId - The case Type ID
49
+ * @param {number} parentCaObjectId - The case subType ID
50
+ * @param {Object} [options] - See /{subdirectory}/apidocs/#/data-type-info;dataType=CaObjectItemBase
51
+ * @return {Object} Returns Promise that represents an object describing the newly-created case
52
+ */
53
+ createChild(busCaseId: number, parentCaObjectId: number, options?: Object): Promise<unknown>;
54
+ /**
55
+ * Create a case from a Service Request
56
+ *
57
+ * @category Cases
58
+ * @param {number} caseTypeId - The case Type ID
59
+ * @param {number} subTypeId - The case subType ID
60
+ * @param {number} requestId - The service request ID
61
+ * @param {Object} [options] - See /{subdirectory}/apidocs/#/data-type-info;dataType=CaObjectItemBase
62
+ * @return {Object} Returns Promise that represents an object describing the newly-created case
63
+ */
64
+ createFromRequest(caseTypeId: number, subTypeId: number, requestId: number, options?: Object): Promise<unknown>;
65
+ /**
66
+ * Update a case
67
+ *
68
+ * @category Cases
69
+ * @param {number} caObjectId - The case Object ID to update
70
+ * @param {Object} [options] - See /{subdirectory}/apidocs/#/data-type-info;dataType=CaObjectItemBase
71
+ * @return {Object} Returns Promise that represents an object describing the updated case
72
+ */
73
+ update(caObjectId: number, options?: Object): Promise<unknown>;
74
+ /**
75
+ * Get cases by IDs
76
+ *
77
+ * @category Cases
78
+ * @param {Array<number>} caObjectIds - The case Object ID to update
79
+ * @return {Object} Returns Promise that represents a collection of objects describing the cases
80
+ */
81
+ getByIds(caObjectIds: Array<number>): Promise<unknown>;
82
+ /**
83
+ * Search for Cases. Include at least one of the search fields. A logical 'and' operation is applied for multiple search fields.
84
+ *
85
+ * @category Cases
86
+ * @param {Object} filters - The parameter(s) to search by
87
+ * @return {Object} Returns Promise that represents an Array of case Object IDs
88
+ */
89
+ search(filters: Object): Promise<unknown>;
90
+ /**
91
+ * Move a Case point
92
+ *
93
+ * @category Cases
94
+ * @param {string} caObjectId
95
+ * @param {number} x
96
+ * @param {number} y
97
+ * @param {Object} projection - Should include at least WKT _or_ WKID attribute. Can also include VcsWKID attribute.
98
+ * @param {number} [z] - Optional Z coordinate
99
+ * @return {Object} Returns Promise that represents an object describing the updated GISPoint
100
+ */
101
+ move(caObjectId: number, x: number, y: number, projection: {
102
+ WKID?: string;
103
+ WKT?: string;
104
+ VcsWKID?: string;
105
+ }, z?: number): Promise<unknown>;
106
+ /**
107
+ * Delete case
108
+ *
109
+ * @category Cases
110
+ * @param {number} caObjectId - The case Object ID
111
+ * @return {Object} Returns Promise that represents an object describing the deleted case
112
+ */
113
+ delete(caObjectId: number): Promise<unknown>;
114
+ }
package/dist/index.d.ts CHANGED
@@ -1,11 +1,222 @@
1
- export { Cityworks } from './cityworks';
2
- export { CWError } from './error';
3
- export { General } from './general';
4
- export { ActivityLinks } from './activity_link';
5
- export { Gis } from './gis';
6
- export { MessageQueue } from './message_queue';
7
- export { Search } from './search';
8
- export { Request } from './request';
9
- export { Inspection } from './inspection';
10
- export { WorkOrder } from './workorder';
11
- export { Case } from './case';
1
+ import { General } from './general';
2
+ import { ActivityLinks } from './activity_link';
3
+ import { Gis } from './gis';
4
+ import { MessageQueue } from './message_queue';
5
+ import { Search } from './search';
6
+ import { Request } from './request';
7
+ import { Inspection } from './inspection';
8
+ import { WorkOrder } from './workorder';
9
+ import { Briefcase } from './briefcase';
10
+ interface Citywork {
11
+ }
12
+ /**
13
+ * Core class Cityworks with most of the authentication and install capabilities functions
14
+ */
15
+ declare class Cityworks implements Citywork {
16
+ /**
17
+ * The domain of the cityworks install. Defaults to Cityworks Online
18
+ */
19
+ private base_url;
20
+ /**
21
+ * Stores the currently in use authentication token
22
+ */
23
+ private Token?;
24
+ /**
25
+ * Stores the login username
26
+ */
27
+ private login?;
28
+ /**
29
+ * Holds the login password
30
+ */
31
+ private password?;
32
+ /**
33
+ * Holds the GIS Token for GIS-based Authentication (Portal)
34
+ */
35
+ private gisToken?;
36
+ /**
37
+ * Holds the GIS Token URL for GIS-based Authentication (Portal)
38
+ */
39
+ private gisTokenUrl?;
40
+ /**
41
+ * Stores settings including path (defaults to "cityworks"), secure (defaults to true), expires (defaults to null - does not expire), default_domain
42
+ */
43
+ private settings;
44
+ error?: any;
45
+ private extensions;
46
+ private features;
47
+ private potential_loads;
48
+ /**
49
+ * Contructor for a new cityworks instance's object, allows one to optionally configure the domain and other settings right from the get-go
50
+ * @param {string} [base_url] - The first color, in hexadecimal format.
51
+ * @param {object} [settings] - The second color, in hexadecimal format.
52
+ * @param {array} [load] - allows user to choose which modules to load and make available. Full availability array: ['general', 'activity_link', 'message_queue', 'gis', 'workorder', 'inspection', 'request', 'case']
53
+ */
54
+ constructor(base_url?: string, settings?: Object, load?: Array<string>);
55
+ /**
56
+ * Configure a new cityworks instance's domain and other settings
57
+ *
58
+ * @param {string} [base_url] - The first color, in hexadecimal format.
59
+ * @param {object} [settings] - The second color, in hexadecimal format.
60
+ * @param {array} [load] - allows user to choose which modules to load and make available. Full availability array: ['general', 'activity_link', 'message_queue', 'gis', 'search', 'workorder', 'inspection', 'request', 'case']
61
+ * @return {boolean} Returns true if successful, otherwise, throws error
62
+ */
63
+ configure(base_url?: string, settings?: Object, load?: Array<string>): void;
64
+ /**
65
+ * Send a request to the Cityworks API
66
+ *
67
+ * If one ever needs to access or call an unimplemented API endpoint of a Cityworks install, one can call this method directly with the path and data payload:
68
+ *
69
+ * `cityworks.runRequest(path, data)`
70
+ *
71
+ * @param {string} path - The path to the particular endpoint
72
+ * @param {Object} data - The data object to be sent to the Cityworks API
73
+ * @param {any} file - The file to send in binary to the Cityworks API
74
+ * @return {Object} Returns Promise object that represents the json object returned from the Cityworks API
75
+ */
76
+ runRequest(path: any, data?: any, file?: any): Promise<unknown>;
77
+ /**
78
+ * Authenticate with the Cityworks API and store an access token for use. Stores the token on cityworks.Token.
79
+ * @param {string} login - User's login name
80
+ * @param {password} password - User's password
81
+ * @return {Object} Returns Promise object that represents a boolean which tells you the login succeeded (true) or failed (false).
82
+ */
83
+ authenticate(login: string, password: string): Promise<unknown>;
84
+ /**
85
+ * Authenticate a username with a GIS Token
86
+ * @param {login} - Gis user name, should match a Cityworks employee login name
87
+ * @param {string} gisToken - Gis Oauth2 access token
88
+ * @param {string} gisTokenUrl - Base url to GIS server (not the '/generateToken' endpoint)
89
+ * @param {number} [expires] - Authenticate to Cityworks for a specified number of milliseconds, defaults to 2 weeks
90
+ */
91
+ authenticateWithGISToken(login: string, gisToken: string, gisTokenUrl: string, expires?: number): Promise<unknown>;
92
+ /**
93
+ * Validate provided token
94
+ * @param {string} token - User's login name
95
+ * @param {boolean} [set] - Set a valid token as the cityworks instance's active token
96
+ * @return {Object} Returns Promise object that represents a boolean which apprises one of the token's validity and that is was set (true) or throws an error if was not valid (and not set).
97
+ */
98
+ validateToken(token: string, set?: boolean): Promise<unknown>;
99
+ /**
100
+ * Set a token you've retrieved from your storage system as the active token for the cityworks instance. Note that this doesn't check the token for validity.
101
+ * @param {token} token - The token string to set as the active token.
102
+ * @return {boolean} Returns a boolean which apprises one that the token was set (true) or not set (false).
103
+ */
104
+ setToken(token: any): boolean;
105
+ /**
106
+ * Get currently set, valid token
107
+ * @param {token} token - The token string to set as the active token.
108
+ * @return {string} Returns a string which is the currently-set token or the boolean false value if no (valid) token set
109
+ */
110
+ getToken(): string | false;
111
+ /**
112
+ * Revoke all current user's tokens or only tokens created before a particular date and time.
113
+ * @param {number} [revokeBefore] - Datetime as an Epoch integer (number), if you wish to revoke only tokens created before a particular datetime
114
+ * @return {Object} Returns Promise object that represents a boolean which apprises one of the revocation outcome's success (true) or failure (false)
115
+ */
116
+ revokeToken(revokeBefore?: number): Promise<unknown>;
117
+ /**
118
+ * Get the localization settings for current Cityworks install
119
+ * @return {Object} Returns Promise object that represents an Object which contains all the localization settings for the current Cityworks install
120
+ */
121
+ getLocalizationSettings(): Promise<unknown>;
122
+ /**
123
+ * Get the system timezone options for current Cityworks install
124
+ * @return {Object} Returns Promise object that represents an Object which contains all the timezone settings for the currentCityworks install
125
+ */
126
+ getTimezoneOptions(): Promise<unknown>;
127
+ /**
128
+ * Get the current install's location information
129
+ * @return {Object} Returns Promise object that represents an Object which contains the location information
130
+ */
131
+ getCurrentLocation(): Promise<unknown>;
132
+ /**
133
+ * Check if a particular license is available to the currently-authenticated user
134
+ * @param {string} area - Area of access
135
+ * @param {string} service - Service to access
136
+ * @return {boolean} Returns Promise object that represents a boolean which informs access is granted (true) or denied (false)
137
+ */
138
+ licensedApiCheck(area: string, service: string): Promise<unknown>;
139
+ /**
140
+ * Check if a current Cityworks install is licensed to use a particular extension
141
+ *
142
+ * Possible extensions currently include: "UnknownExtension", "CwAnalytics", "WebHooks", "PLLPublicApp", "ActivityUpdate", "SingleSignOn"
143
+ *
144
+ * @param {string} extension - Extension name
145
+ * @return {boolean} Returns Promise object that represents a boolean which informs extension is licensed (true) or not (false)
146
+ */
147
+ licensedExtensionCheck(extension: string): Promise<unknown>;
148
+ /**
149
+ * Check a whole list to see if current Cityworks install is licensed to use extensions
150
+ *
151
+ * Possible extensions currently include: "UnknownExtension", "CwAnalytics", "WebHooks", "PLLPublicApp", "ActivityUpdate", "SingleSignOn"
152
+ *
153
+ * @param {Array<string>} extension - Extension names
154
+ * @return {Object} Returns Promise object that represents a boolean which informs extension is licensed (true) or not (false)
155
+ */
156
+ licensedExtensionsCheck(extensions: Array<string>): Promise<unknown>;
157
+ /**
158
+ * Check if current user is licensed to use a feature:
159
+ *
160
+ * "UnknownFeature", "ViewInspections", "EditInspections", "ViewServiceRequest", "EditServiceRequest", "ViewWorkOrder", "EditWorkOrder", "EquipmentCheckOut", "OfficeField", "Respond", "Eurl", "PaverInterface", "Contracts", "Storeroom", "PLL", "Cw4XL", "TableEditor", "CCTVInterface", "MobileAndroid", "MobileiOS", "PerformanceBudgeting", "Insights", "RespondCase", "RespondInspection", "RespondServiceRequest", "RespondTaskManager", "RespondWorkOrder", "Workload", "OpX", "TrimbleUnityMobile", "TrimbleVegetationManager"
161
+ *
162
+ * @param {string} [feature] - Feature to check to see if ciurrently authenticated user can utilize
163
+ * @return {Object} Returns Promise object that represents a boolean which communicates license state as licensed (true) or not (false)
164
+ */
165
+ licensedFeatureCheck(feature: string): Promise<unknown>;
166
+ /**
167
+ * Check if current user is licensed to use features:
168
+ *
169
+ * "UnknownFeature", "ViewInspections", "EditInspections", "ViewServiceRequest", "EditServiceRequest", "ViewWorkOrder", "EditWorkOrder", "EquipmentCheckOut", "OfficeField", "Respond", "Eurl", "PaverInterface", "Contracts", "Storeroom", "PLL", "Cw4XL", "TableEditor", "CCTVInterface", "MobileAndroid", "MobileiOS", "PerformanceBudgeting", "Insights", "RespondCase", "RespondInspection", "RespondServiceRequest", "RespondTaskManager", "RespondWorkOrder", "Workload", "OpX", "TrimbleUnityMobile", "TrimbleVegetationManager"
170
+ *
171
+ * @param {Array<string>} [feature] - Features to check to see if currently authenticated user can utilize
172
+ * @return {Object} Returns Promise object that represents a boolean which communicates license state as licensed (true) or not (false)
173
+ */
174
+ licensedFeaturesCheck(features: Array<string>): Promise<unknown>;
175
+ /**
176
+ * Check if current user is licensed to use services. List req ServicesList of 'Area/Service', i.e.:
177
+ *
178
+ * ['AMS/Inspection','AMS/WorkOrder','PLL/Case']
179
+ *
180
+ * @param {Array<string>} [services] - Services to check to see if currently authenticated user can utilize
181
+ * @return {Object} Returns Promise object that represents a boolean which communicates license state as licensed (true) or not (false)
182
+ */
183
+ licensedServicesCheck(services: Array<string>): Promise<unknown>;
184
+ /**
185
+ * Get a list of CityworksOnline sites for this user
186
+ *
187
+ * @param {string} [login] - Login Name to use when checking. Defaults to previously-stored login name.
188
+ * @param {string} [password] - Password to use when checking. Defaults to previously-stored password.
189
+ * @return {Object} Returns Promise object that represents an array of cityworks online sites available to this user.
190
+ */
191
+ cityworksOnlineSites(login?: string, password?: string): Promise<unknown>;
192
+ /**
193
+ * Get a list of Domains (not tld, but organizations) in the currently-connected Cityworks install
194
+ *
195
+ * @return {Object} Returns Promise object that represents a collection of the configured domains.
196
+ */
197
+ domains(): Promise<unknown>;
198
+ /**
199
+ * Get a list of Domains (not tld, but organizations) in the currently-connected Cityworks install
200
+ *
201
+ * @param {string} [login] - Optional login name to get user information for. Defaults to currently-set user name used for login.
202
+ * @return {Object} Returns Promise object that represents an Object with the user information
203
+ */
204
+ user(login?: string): Promise<unknown>;
205
+ /**
206
+ * Get the software version number of the currently-connected Cityworks install
207
+ *
208
+ * @return {Object} Returns Promise object that represents a string of the version number
209
+ */
210
+ version(): Promise<unknown>;
211
+ }
212
+ declare const cw: Cityworks;
213
+ declare const general: General;
214
+ declare const activity_link: ActivityLinks;
215
+ declare const message_queue: MessageQueue;
216
+ declare const search: Search;
217
+ declare const gis: Gis;
218
+ declare const request: Request;
219
+ declare const inspection: Inspection;
220
+ declare const workorder: WorkOrder;
221
+ declare const briefcase: Briefcase;
222
+ export { cw as Cityworks, general, activity_link, message_queue, search, gis, request, inspection, workorder, briefcase };