cityworks 0.0.52 → 1.0.1

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 (45) hide show
  1. package/README.md +13 -1
  2. package/dist/activity_link.js +219 -0
  3. package/dist/attachments.d.ts +59 -0
  4. package/dist/briefcase.d.ts +22 -1
  5. package/dist/briefcase.js +327 -0
  6. package/dist/case_admin.d.ts +0 -22
  7. package/dist/case_admin.js +821 -0
  8. package/dist/case_assets.js +129 -0
  9. package/dist/case_data.js +416 -0
  10. package/dist/case_financial.js +848 -0
  11. package/dist/case_workflow.js +455 -0
  12. package/dist/comments.js +126 -0
  13. package/dist/error.js +30 -0
  14. package/dist/event_layer.d.ts +97 -0
  15. package/dist/event_layer.js +207 -0
  16. package/dist/general.d.ts +23 -0
  17. package/dist/general.js +212 -0
  18. package/dist/gis.js +250 -0
  19. package/dist/index.d.ts +10 -8
  20. package/dist/index.js +1 -1
  21. package/dist/index.js.map +1 -1
  22. package/dist/index.m.js +1 -1
  23. package/dist/index.m.js.map +1 -1
  24. package/dist/index.modern.mjs +1 -1
  25. package/dist/index.modern.mjs.map +1 -1
  26. package/dist/index.umd.js +1 -1
  27. package/dist/index.umd.js.map +1 -1
  28. package/dist/inspection.d.ts +17 -1
  29. package/dist/inspection.js +933 -0
  30. package/dist/inspection_admin.js +43 -0
  31. package/dist/inspection_costs.js +200 -0
  32. package/dist/message_queue.js +248 -0
  33. package/dist/query.d.ts +108 -0
  34. package/dist/query.js +242 -0
  35. package/dist/request.d.ts +5 -1
  36. package/dist/request.js +899 -0
  37. package/dist/request_admin.js +32 -0
  38. package/dist/request_costs.js +113 -0
  39. package/dist/search.d.ts +12 -1
  40. package/dist/search.js +371 -0
  41. package/dist/workorder.d.ts +4 -0
  42. package/dist/workorder.js +951 -0
  43. package/dist/workorder_admin.js +248 -0
  44. package/dist/workorder_costs.js +274 -0
  45. package/package.json +7 -2
package/dist/gis.js ADDED
@@ -0,0 +1,250 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Gis = void 0;
4
+ var _ = require('lodash');
5
+ var Gis = /** @class */ (function () {
6
+ /**
7
+ * @hidden
8
+ */
9
+ function Gis(cw) {
10
+ this.cw = cw;
11
+ }
12
+ /**
13
+ * Get gis service configuration for user, group, domain, or service id
14
+ *
15
+ * @param {string} [whichType] - domain, group, mapservice, or user
16
+ * @param {number} [whichId] - domain, group, mapservice, or user Id
17
+ * @param {number} [getGisData] - If true, check for feature server JSON data, default is true
18
+ * @param {Array<string>} [context] Filter returned list by specific context, i.e. Office, Field, Mobile, Public, etc. Default is all.
19
+ * @return {Object} Returns Promise object that represents an Object with the desired GIS service definitions
20
+ */
21
+ Gis.prototype.getConfig = function (whichType, whichId, getGisData, context) {
22
+ var _this = this;
23
+ if (getGisData === void 0) { getGisData = true; }
24
+ if (context === void 0) { context = []; }
25
+ return new Promise(function (resolve, reject) {
26
+ var path = 'Gis/MapService/Domain';
27
+ whichType = whichType.toLowerCase();
28
+ var data;
29
+ switch (whichType) {
30
+ case 'domain':
31
+ data = { DomainId: whichId, GetGisData: getGisData, Security: context };
32
+ break;
33
+ case 'group':
34
+ data = { GroupId: whichId, GetGisData: getGisData, Security: context };
35
+ break;
36
+ case 'mapservice':
37
+ data = { MapServiceId: whichId, GetGisData: getGisData, Security: context };
38
+ break;
39
+ case 'user':
40
+ data = { UserId: whichId, GetGisData: getGisData, Security: context };
41
+ break;
42
+ }
43
+ _this.cw.runRequest(path, {}).then(function (response) {
44
+ resolve(response.Value);
45
+ }).catch(function (e) {
46
+ reject(e);
47
+ });
48
+ });
49
+ };
50
+ /**
51
+ * Get domain gis services
52
+ *
53
+ * @param {number} domainId - The mobile map cache Id to download
54
+ * @return {Object} Returns Promise object that represents an Object with the domain's default GIS services
55
+ */
56
+ Gis.prototype.domain = function (domainId, getGisData) {
57
+ var _this = this;
58
+ if (getGisData === void 0) { getGisData = true; }
59
+ return new Promise(function (resolve, reject) {
60
+ var path = 'Gis/MapService/Domain';
61
+ var data = {
62
+ DomainId: domainId
63
+ };
64
+ _this.cw.runRequest(path, {}).then(function (response) {
65
+ resolve(response.Value);
66
+ }).catch(function (e) {
67
+ reject(e);
68
+ });
69
+ });
70
+ };
71
+ /**
72
+ * Download mobile map cache
73
+ *
74
+ * @param {number} cacheId - The mobile map cache Id to download
75
+ * @return {Object} Returns Promise object that represents a streaming download (?)
76
+ */
77
+ Gis.prototype.downloadMobile = function (cacheId, getGisData) {
78
+ var _this = this;
79
+ if (getGisData === void 0) { getGisData = true; }
80
+ return new Promise(function (resolve, reject) {
81
+ var path = 'Gis/MapService/DownloadMobileMapCache';
82
+ var data = {
83
+ MobileMapCacheId: cacheId
84
+ };
85
+ _this.cw.runRequest(path, {}).then(function (response) {
86
+ resolve(response.Value);
87
+ }).catch(function (e) {
88
+ reject(e);
89
+ });
90
+ });
91
+ };
92
+ /**
93
+ * Get initial extent for user
94
+ *
95
+ * @return {Object} Returns Promise object that represents ... (?)
96
+ */
97
+ Gis.prototype.initialExtent = function () {
98
+ var _this = this;
99
+ return new Promise(function (resolve, reject) {
100
+ var path = 'Gis/MapService/InitialExtent';
101
+ var data = {};
102
+ _this.cw.runRequest(path, {}).then(function (response) {
103
+ resolve(response.Value);
104
+ }).catch(function (e) {
105
+ reject(e);
106
+ });
107
+ });
108
+ };
109
+ /**
110
+ * Get service request gis services
111
+ *
112
+ * @param {number} requestId - The WorkOrder to check against.
113
+ * @param {boolean} getGisData - If true, check for feature server JSON data, default is true.
114
+ * @return {Object} Returns Promise object that represents an Object with the specified request's entit(y|ies)
115
+ */
116
+ Gis.prototype.request = function (requestId, getGisData) {
117
+ var _this = this;
118
+ if (getGisData === void 0) { getGisData = true; }
119
+ return new Promise(function (resolve, reject) {
120
+ var path = 'Gis/MapService/ServiceRequestConfiguration';
121
+ var data = {
122
+ RequestId: requestId,
123
+ GetGisData: getGisData
124
+ };
125
+ _this.cw.runRequest(path, {}).then(function (response) {
126
+ resolve(response.Value);
127
+ }).catch(function (e) {
128
+ reject(e);
129
+ });
130
+ });
131
+ };
132
+ /**
133
+ * Get inspection gis services
134
+ *
135
+ * @param {number} inspectionId - The WorkOrder to check against.
136
+ * @param {boolean} getGisData - If true, check for feature server JSON data, default is true.
137
+ * @return {Object} Returns Promise object that represents an Object with the specified inspection's entity
138
+ */
139
+ Gis.prototype.inspection = function (inspectionId, getGisData) {
140
+ var _this = this;
141
+ if (getGisData === void 0) { getGisData = true; }
142
+ return new Promise(function (resolve, reject) {
143
+ var path = 'Gis/MapService/InspectionConfiguration';
144
+ var data = {
145
+ InspectionId: inspectionId,
146
+ GetGisData: getGisData
147
+ };
148
+ _this.cw.runRequest(path, {}).then(function (response) {
149
+ resolve(response.Value);
150
+ }).catch(function (e) {
151
+ reject(e);
152
+ });
153
+ });
154
+ };
155
+ /**
156
+ * Get workorder gis services
157
+ *
158
+ * @param {number} workOrderSid - The WorkOrder to check against.
159
+ * @param {boolean} getGisData - If true, check for feature server JSON data, default is true.
160
+ * @return {Object} Returns Promise object that represents an Object with the specified WorkOrder's entit(y|ies)
161
+ */
162
+ Gis.prototype.workOrder = function (workOrderSid, getGisData) {
163
+ var _this = this;
164
+ if (getGisData === void 0) { getGisData = true; }
165
+ return new Promise(function (resolve, reject) {
166
+ var path = 'Gis/MapService/WorkOrderConfiguration';
167
+ var data = {
168
+ WorkOrderSid: workOrderSid,
169
+ GetGisData: getGisData
170
+ };
171
+ _this.cw.runRequest(path, {}).then(function (response) {
172
+ resolve(response.Value);
173
+ }).catch(function (e) {
174
+ reject(e);
175
+ });
176
+ });
177
+ };
178
+ /**
179
+ * Get service request gis services
180
+ *
181
+ * @param {Array<string>} [context] Filter returned list by specific context, i.e. Office, Field, Mobile, Public, etc. Default is all.
182
+ * @param {boolean} [allDomains] services assigned to any domain the user belongs to, default is true
183
+ * @param {boolean} [allGroups] services assigned to any groups the user belongs to regardless of domain, default is true
184
+ * @param {boolean} [getGisData] If true, check for feature server JSON data, default is true
185
+ * @return {Object} Returns Promise object that represents an Object with the user's GIS services
186
+ */
187
+ Gis.prototype.user = function (context, allDomains, allGroups, getGisData) {
188
+ var _this = this;
189
+ if (context === void 0) { context = []; }
190
+ if (allDomains === void 0) { allDomains = true; }
191
+ if (allGroups === void 0) { allGroups = true; }
192
+ if (getGisData === void 0) { getGisData = true; }
193
+ return new Promise(function (resolve, reject) {
194
+ var path = 'Gis/MapService/User';
195
+ var data = {
196
+ AllDomains: allDomains,
197
+ AllGroups: allGroups,
198
+ GetGisData: getGisData,
199
+ Security: context
200
+ };
201
+ _this.cw.runRequest(path, {}).then(function (response) {
202
+ resolve(response.Value);
203
+ }).catch(function (e) {
204
+ reject(e);
205
+ });
206
+ });
207
+ };
208
+ /**
209
+ * Get Geocode server info by ServerId
210
+ *
211
+ * @param {number} ServiceId
212
+ * @return {Object} Returns Promise object that represents an object describing the provided Geocoder service configuration
213
+ */
214
+ // Gis/GeoCode/GeocodeServer
215
+ /**
216
+ * Get currently selected entities from the Cityworks install's session for your user
217
+ * @return {Object} Returns Promise object that represents an Object with the currently-selected entities
218
+ */
219
+ Gis.prototype.selectedEntities = function () {
220
+ var _this = this;
221
+ return new Promise(function (resolve, reject) {
222
+ var path = 'General/AppData/SelectedEntities';
223
+ _this.cw.runRequest(path, {}).then(function (response) {
224
+ resolve(response.Value);
225
+ }).catch(function (e) {
226
+ reject(e);
227
+ });
228
+ });
229
+ };
230
+ /**
231
+ * Get attributes available for provided entity
232
+ *
233
+ * @param {string} entityType - The entity type to describe
234
+ * @return {Object} Returns Promise object that represents a collection of attribute description objects
235
+ */
236
+ Gis.prototype.getEntityAttributes = function (entityType) {
237
+ var _this = this;
238
+ return new Promise(function (resolve, reject) {
239
+ var data = { EntityType: entityType };
240
+ var path = 'AMS/Entity/Attributes';
241
+ _this.cw.runRequest(path, data).then(function (response) {
242
+ resolve(response.Value);
243
+ }).catch(function (e) {
244
+ reject(e);
245
+ });
246
+ });
247
+ };
248
+ return Gis;
249
+ }());
250
+ exports.Gis = Gis;
package/dist/index.d.ts CHANGED
@@ -3,6 +3,7 @@ import { ActivityLinks } from './activity_link';
3
3
  import { Gis } from './gis';
4
4
  import { MessageQueue } from './message_queue';
5
5
  import { Search } from './search';
6
+ import { Query } from './query';
6
7
  import { Request } from './request';
7
8
  import { Inspection } from './inspection';
8
9
  import { WorkOrder } from './workorder';
@@ -47,8 +48,8 @@ declare class Cityworks implements Citywork {
47
48
  private potential_loads;
48
49
  /**
49
50
  * 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.
51
+ * @param {string} [base_url] - The base url of your Cityworks instance
52
+ * @param {object} [settings] - The settings for your Cityworks site. Full list: {path: (defaults to "cityworks"), secure: defaults to true, expires: defaults to NULL, does not expire, default_domain: defaults to NULL, uses default user domain, version: defaults to 23, for 15.x set to 15}
52
53
  * @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
  */
54
55
  constructor(base_url?: string, settings?: Object, load?: Array<string>);
@@ -66,14 +67,14 @@ declare class Cityworks implements Citywork {
66
67
  *
67
68
  * 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
  *
69
- * `cityworks.runRequest(path, data)`
70
+ * `cityworks.runRequest(service_path, post_data)`
70
71
  *
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
72
+ * @param {string} service_path - The path to the particular endpoint
73
+ * @param {any} post_data - The data object to be sent to the Cityworks API
74
+ * @param {string} post_file - The path of the file to send to the Cityworks API
74
75
  * @return {Object} Returns Promise object that represents the json object returned from the Cityworks API
75
76
  */
76
- runRequest(path: any, data?: any, file?: any): Promise<unknown>;
77
+ runRequest(service_path: string, post_data?: any, post_file?: string): Promise<unknown>;
77
78
  /**
78
79
  * Authenticate with the Cityworks API and store an access token for use. Stores the token on cityworks.Token.
79
80
  * @param {string} login - User's login name
@@ -214,9 +215,10 @@ declare const general: General;
214
215
  declare const activity_link: ActivityLinks;
215
216
  declare const message_queue: MessageQueue;
216
217
  declare const search: Search;
218
+ declare const query: Query;
217
219
  declare const gis: Gis;
218
220
  declare const request: Request;
219
221
  declare const inspection: Inspection;
220
222
  declare const workorder: WorkOrder;
221
223
  declare const briefcase: Briefcase;
222
- export { cw as Cityworks, general, activity_link, message_queue, search, gis, request, inspection, workorder, briefcase };
224
+ export { cw as Cityworks, general, activity_link, message_queue, search, query, gis, request, inspection, workorder, briefcase };