cityworks 1.0.4 → 1.0.6
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/dist/activity_link.d.ts +5 -0
- package/dist/attachments.d.ts +17 -1
- package/dist/case_data.d.ts +4 -2
- 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.mjs +1 -1
- package/dist/index.modern.mjs.map +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/dist/activity_link.js +0 -219
- package/dist/briefcase.js +0 -327
- package/dist/case.d.ts +0 -114
- package/dist/case_admin.js +0 -821
- package/dist/case_assets.js +0 -129
- package/dist/case_data.js +0 -416
- package/dist/case_financial.js +0 -848
- package/dist/case_workflow.js +0 -455
- package/dist/cityworks.d.ts +0 -224
- package/dist/comments.js +0 -126
- package/dist/error.js +0 -30
- package/dist/event_layer.d.ts +0 -97
- package/dist/event_layer.js +0 -207
- package/dist/general.js +0 -212
- package/dist/gis.js +0 -250
- package/dist/index.cjs +0 -2
- package/dist/index.cjs.map +0 -1
- package/dist/index.modern.js +0 -2
- package/dist/index.modern.js.map +0 -1
- package/dist/inspection.js +0 -933
- package/dist/inspection_admin.js +0 -43
- package/dist/inspection_costs.js +0 -200
- package/dist/message_queue.js +0 -248
- package/dist/query.js +0 -242
- package/dist/request.js +0 -899
- package/dist/request_admin.js +0 -32
- package/dist/request_costs.js +0 -113
- package/dist/search.js +0 -371
- package/dist/workorder.js +0 -951
- package/dist/workorder_admin.js +0 -248
- package/dist/workorder_costs.js +0 -274
package/dist/comments.js
DELETED
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Comments = void 0;
|
|
4
|
-
var error_1 = require("./error");
|
|
5
|
-
var reversible_map_1 = require("reversible-map");
|
|
6
|
-
var _ = require('lodash');
|
|
7
|
-
/**
|
|
8
|
-
* A plugin that contains "comments" methods
|
|
9
|
-
*/
|
|
10
|
-
var Comments = /** @class */ (function () {
|
|
11
|
-
/**
|
|
12
|
-
* @hidden
|
|
13
|
-
*/
|
|
14
|
-
function Comments(cw, activityType) {
|
|
15
|
-
this.cw = cw;
|
|
16
|
-
this.activityTypes = new reversible_map_1.default();
|
|
17
|
-
this.activityTypes.set("Unknown", 0);
|
|
18
|
-
this.activityTypes.set("Request", 1);
|
|
19
|
-
this.activityTypes.set("WorkOrder", 2);
|
|
20
|
-
this.activityTypes.set("CaTask", 3);
|
|
21
|
-
this.activityTypes.set("CaObject", 4);
|
|
22
|
-
this.activityTypes.set("CaCorrection", 5);
|
|
23
|
-
this.activityTypes.set("Project", 6);
|
|
24
|
-
this.activityTypes.set("Contract", 7);
|
|
25
|
-
if (!this.activityTypes.has(activityType)) {
|
|
26
|
-
throw new error_1.CWError(1, 'Comment activity type not found.', { 'provided': activityType, 'options': this.activityTypes });
|
|
27
|
-
}
|
|
28
|
-
this.currentActivityType = activityType;
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* Add a comment - for adding a comment to an object when the object is already known. Always call comment.add from request, case, workorder, or inspection.
|
|
32
|
-
*
|
|
33
|
-
* @param {number} sid - The SID of the activity to which the comment should be attached
|
|
34
|
-
* @param {string} comment - The text for the comment
|
|
35
|
-
* @return {Object} Returns a Promise which represents a CommentRecord object
|
|
36
|
-
*/
|
|
37
|
-
Comments.prototype.add = function (sid, comment) {
|
|
38
|
-
var _this = this;
|
|
39
|
-
return new Promise(function (resolve, reject) {
|
|
40
|
-
var data = {
|
|
41
|
-
ActivityType: _this.activityTypes.get(_this.currentActivityType),
|
|
42
|
-
ActivitySid: sid,
|
|
43
|
-
Comments: comment
|
|
44
|
-
};
|
|
45
|
-
_this.cw.runRequest('Ams/Comment/Add', data).then(function (response) {
|
|
46
|
-
resolve(response.Value);
|
|
47
|
-
}).catch(function (e) {
|
|
48
|
-
reject(e);
|
|
49
|
-
});
|
|
50
|
-
});
|
|
51
|
-
};
|
|
52
|
-
/**
|
|
53
|
-
* Update a comment
|
|
54
|
-
*
|
|
55
|
-
* @param {number} id - The ID of the comment which should be updated
|
|
56
|
-
* @param {string} comment - The new text for the updated comment
|
|
57
|
-
* @return {Object} Returns a Promise which represents a CommentRecord object
|
|
58
|
-
*/
|
|
59
|
-
Comments.prototype.update = function (id, comment) {
|
|
60
|
-
var _this = this;
|
|
61
|
-
return new Promise(function (resolve, reject) {
|
|
62
|
-
var data = {
|
|
63
|
-
ActivityType: _this.activityTypes.get(_this.currentActivityType),
|
|
64
|
-
CommentId: id,
|
|
65
|
-
Comments: comment
|
|
66
|
-
};
|
|
67
|
-
_this.cw.runRequest('Ams/Comment/Update', data).then(function (response) {
|
|
68
|
-
resolve(response.Value);
|
|
69
|
-
}).catch(function (e) {
|
|
70
|
-
reject(e);
|
|
71
|
-
});
|
|
72
|
-
});
|
|
73
|
-
};
|
|
74
|
-
/**
|
|
75
|
-
* Get comments for activity items
|
|
76
|
-
*
|
|
77
|
-
* @param {Array<number>} sids - The options SIDs to get comments for.
|
|
78
|
-
* @return {Object} Returns Promise object that represents a collection of available comments
|
|
79
|
-
*/
|
|
80
|
-
Comments.prototype.get = function (sids) {
|
|
81
|
-
var _this = this;
|
|
82
|
-
return new Promise(function (resolve, reject) {
|
|
83
|
-
if (typeof (sids) != 'undefined' && sids != null) {
|
|
84
|
-
var data = {
|
|
85
|
-
ActivitySids: sids,
|
|
86
|
-
ActivityType: _this.activityTypes.get(_this.currentActivityType),
|
|
87
|
-
};
|
|
88
|
-
_this.cw.runRequest('Ams/Comment/ByActivitySids', data).then(function (response) {
|
|
89
|
-
if (sids.length == 1) {
|
|
90
|
-
resolve(response.Value[sids[0]]);
|
|
91
|
-
}
|
|
92
|
-
else {
|
|
93
|
-
resolve(response.Value);
|
|
94
|
-
}
|
|
95
|
-
});
|
|
96
|
-
}
|
|
97
|
-
});
|
|
98
|
-
};
|
|
99
|
-
/**
|
|
100
|
-
* Get pre-defined comments for activityTypes
|
|
101
|
-
*
|
|
102
|
-
* @param {number} problemSid - The ProblemSid if currentActivityType is (Service) Request
|
|
103
|
-
* @param {string} [category] - Only applies to WorkOrder and ServiceRequest category comments.
|
|
104
|
-
* @return {Object} Returns Promise object that represents a collection of available comment templates.
|
|
105
|
-
*/
|
|
106
|
-
Comments.prototype.getPredefined = function (problemSid, category) {
|
|
107
|
-
var _this = this;
|
|
108
|
-
return new Promise(function (resolve, reject) {
|
|
109
|
-
var data = {};
|
|
110
|
-
if (_this.currentActivityType == 'Request') {
|
|
111
|
-
_.set(data, 'ProblemSid', problemSid);
|
|
112
|
-
}
|
|
113
|
-
if (typeof (category) != 'undefined' && (_this.currentActivityType == 'Request' || _this.currentActivityType == 'WorkOrder')) {
|
|
114
|
-
_.set(data, 'Category', category);
|
|
115
|
-
}
|
|
116
|
-
_.set(data, 'ActivityType', _this.activityTypes.get(_this.currentActivityType));
|
|
117
|
-
_this.cw.runRequest('Ams/Comment/PredefinedComments', data).then(function (response) {
|
|
118
|
-
resolve(response.Value);
|
|
119
|
-
}).catch(function (e) {
|
|
120
|
-
reject(e);
|
|
121
|
-
});
|
|
122
|
-
});
|
|
123
|
-
};
|
|
124
|
-
return Comments;
|
|
125
|
-
}());
|
|
126
|
-
exports.Comments = Comments;
|
package/dist/error.js
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CWError = void 0;
|
|
4
|
-
var _ = require('lodash');
|
|
5
|
-
/**
|
|
6
|
-
* CWError implements a custom error class for this codebase with additional information
|
|
7
|
-
*
|
|
8
|
-
*/
|
|
9
|
-
var CWError = /** @class */ (function () {
|
|
10
|
-
/**
|
|
11
|
-
* CWError implements a custom error class for this codebase with additional information
|
|
12
|
-
*
|
|
13
|
-
* @param {number} code - Number for the thrown error (Efforts were made to make these unique when thrown throughout the codebase)
|
|
14
|
-
* @param {string} message - The error message
|
|
15
|
-
* @param {Object} info - Object stuffed with any other information one wishes to include in the thrown error
|
|
16
|
-
* @return {Object} Returns instance of CWError object
|
|
17
|
-
*/
|
|
18
|
-
function CWError(code, message, info) {
|
|
19
|
-
this.name = "Cityworks Exception";
|
|
20
|
-
this.code = code;
|
|
21
|
-
this.message = message;
|
|
22
|
-
if (typeof (info) !== 'undefined') {
|
|
23
|
-
if (_.has(info, 'Message'))
|
|
24
|
-
this.message = _.get(info, 'Message');
|
|
25
|
-
this.info = JSON.stringify(info);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
return CWError;
|
|
29
|
-
}());
|
|
30
|
-
exports.CWError = CWError;
|
package/dist/event_layer.d.ts
DELETED
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* A plugin that contains "event layer" methods for a Cityworks install
|
|
3
|
-
*/
|
|
4
|
-
export declare class EventLayer {
|
|
5
|
-
/**
|
|
6
|
-
* @hidden
|
|
7
|
-
*/
|
|
8
|
-
cw: any;
|
|
9
|
-
/**
|
|
10
|
-
* @hidden
|
|
11
|
-
*/
|
|
12
|
-
constructor(cw: any);
|
|
13
|
-
/**
|
|
14
|
-
* Update (enable/disable) an event layer
|
|
15
|
-
*
|
|
16
|
-
* @param {string} eventLayerId - which event layer to update
|
|
17
|
-
* @param {boolean} enabled - true to enable, false to disable
|
|
18
|
-
* @return {Object} Returns Promise object which represents a xxxxx indicating xxxxxxx
|
|
19
|
-
*/
|
|
20
|
-
update(eventLayerId: number, enabled: boolean): Promise<unknown>;
|
|
21
|
-
/**
|
|
22
|
-
* Enable an event layer
|
|
23
|
-
*
|
|
24
|
-
* @param {string} eventLayerId - which event layer to update
|
|
25
|
-
* @return {Object} Returns Promise object which represents a xxxxx indicating xxxxxxx
|
|
26
|
-
*/
|
|
27
|
-
enable(eventLayerId: number): Promise<unknown>;
|
|
28
|
-
/**
|
|
29
|
-
* Disable an event layer
|
|
30
|
-
*
|
|
31
|
-
* @param {string} eventLayerId - which event layer to update
|
|
32
|
-
* @return {Object} Returns Promise object which represents a xxxxx indicating xxxxxxx
|
|
33
|
-
*/
|
|
34
|
-
disable(eventLayerId: number): Promise<unknown>;
|
|
35
|
-
/**
|
|
36
|
-
* ??
|
|
37
|
-
*
|
|
38
|
-
* @param {Array<number>} createBySids -
|
|
39
|
-
* @param {Array<string>} queryTypes -
|
|
40
|
-
* @return {Object} Returns Promise object which represents a xxxxx indicating xxxxxxx
|
|
41
|
-
*/
|
|
42
|
-
createByID(createBySids: Array<number>, queryTypes: Array<number>): Promise<unknown>;
|
|
43
|
-
/**
|
|
44
|
-
* Save user preferences
|
|
45
|
-
*
|
|
46
|
-
* @param {string} element - "VisibleQeIds"
|
|
47
|
-
* @param {string} category - "qe-map"
|
|
48
|
-
* @param {Object} defaultValue - {all: [3]}
|
|
49
|
-
* @return {Object} Returns Promise object which represents a xxxxx indicating xxxxxxx
|
|
50
|
-
*/
|
|
51
|
-
updatePreferences(element: number, category: boolean, defaultValue: Object): Promise<unknown>;
|
|
52
|
-
/**
|
|
53
|
-
* Get all event layers
|
|
54
|
-
*
|
|
55
|
-
* @return {Object} Returns Promise object which represents a xxxxx indicating xxxxxxx
|
|
56
|
-
*/
|
|
57
|
-
all(): Promise<unknown>;
|
|
58
|
-
/**
|
|
59
|
-
* Get all EUrl Query Types
|
|
60
|
-
*
|
|
61
|
-
* @return {Object} Returns Promise object which represents a xxxxx indicating xxxxxxx
|
|
62
|
-
*/
|
|
63
|
-
queryTypes(): Promise<unknown>;
|
|
64
|
-
/**
|
|
65
|
-
* Get Preferences for User
|
|
66
|
-
*
|
|
67
|
-
* @return {Object} Returns Promise object which represents a xxxxx indicating xxxxxxx
|
|
68
|
-
*/
|
|
69
|
-
preferences(): Promise<unknown>;
|
|
70
|
-
/**
|
|
71
|
-
* Get Styles for event layers
|
|
72
|
-
*
|
|
73
|
-
* @return {Object} Returns Promise object which represents a xxxxx indicating xxxxxxx
|
|
74
|
-
*/
|
|
75
|
-
styles(): Promise<unknown>;
|
|
76
|
-
/**
|
|
77
|
-
* Get all event layers
|
|
78
|
-
*
|
|
79
|
-
* @param {boolean} includeDisabled - Defaults to false
|
|
80
|
-
* @return {Object} Returns Promise object which represents a xxxxx indicating xxxxxxx
|
|
81
|
-
*/
|
|
82
|
-
getAllEventLayers(includeDisabled?: boolean): Promise<unknown>;
|
|
83
|
-
/**
|
|
84
|
-
* Filter event layers by provided search definitions
|
|
85
|
-
*
|
|
86
|
-
* @param {Array<number>} searchIds - Defaults to false
|
|
87
|
-
* @param {Array<number>} eventLayerIds - Defaults to false
|
|
88
|
-
* @return {Object} Returns Promise object which represents a xxxxx indicating xxxxxxx
|
|
89
|
-
*/
|
|
90
|
-
filterEventLayersBySearches(searchIds: Array<number>, eventLayerIds: Array<number>): Promise<unknown>;
|
|
91
|
-
/**
|
|
92
|
-
* eventLayer GIS endpoint, this may need to be a promise as well...
|
|
93
|
-
*
|
|
94
|
-
* @return {string} Returns string that is absolute URL for event layer GIS endpoint
|
|
95
|
-
*/
|
|
96
|
-
getGISEndpoint(eventLayerId: any): string;
|
|
97
|
-
}
|
package/dist/event_layer.js
DELETED
|
@@ -1,207 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.EventLayer = void 0;
|
|
4
|
-
var _ = require('lodash');
|
|
5
|
-
/**
|
|
6
|
-
* A plugin that contains "event layer" methods for a Cityworks install
|
|
7
|
-
*/
|
|
8
|
-
var EventLayer = /** @class */ (function () {
|
|
9
|
-
/**
|
|
10
|
-
* @hidden
|
|
11
|
-
*/
|
|
12
|
-
function EventLayer(cw) {
|
|
13
|
-
this.cw = cw;
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* Update (enable/disable) an event layer
|
|
17
|
-
*
|
|
18
|
-
* @param {string} eventLayerId - which event layer to update
|
|
19
|
-
* @param {boolean} enabled - true to enable, false to disable
|
|
20
|
-
* @return {Object} Returns Promise object which represents a xxxxx indicating xxxxxxx
|
|
21
|
-
*/
|
|
22
|
-
EventLayer.prototype.update = function (eventLayerId, enabled) {
|
|
23
|
-
var _this = this;
|
|
24
|
-
return new Promise(function (resolve, reject) {
|
|
25
|
-
var data = { "EventLayerId": eventLayerId, "Enabled": enabled };
|
|
26
|
-
_this.cw.runRequest('Ams/EventLayer/Update', data).then(function (r) {
|
|
27
|
-
// console.log(r, 'response')
|
|
28
|
-
resolve(r.Value);
|
|
29
|
-
}).catch(function (e) {
|
|
30
|
-
reject(e);
|
|
31
|
-
});
|
|
32
|
-
});
|
|
33
|
-
};
|
|
34
|
-
/**
|
|
35
|
-
* Enable an event layer
|
|
36
|
-
*
|
|
37
|
-
* @param {string} eventLayerId - which event layer to update
|
|
38
|
-
* @return {Object} Returns Promise object which represents a xxxxx indicating xxxxxxx
|
|
39
|
-
*/
|
|
40
|
-
EventLayer.prototype.enable = function (eventLayerId) {
|
|
41
|
-
return this.update(eventLayerId, true);
|
|
42
|
-
};
|
|
43
|
-
/**
|
|
44
|
-
* Disable an event layer
|
|
45
|
-
*
|
|
46
|
-
* @param {string} eventLayerId - which event layer to update
|
|
47
|
-
* @return {Object} Returns Promise object which represents a xxxxx indicating xxxxxxx
|
|
48
|
-
*/
|
|
49
|
-
EventLayer.prototype.disable = function (eventLayerId) {
|
|
50
|
-
return this.update(eventLayerId, false);
|
|
51
|
-
};
|
|
52
|
-
/**
|
|
53
|
-
* ??
|
|
54
|
-
*
|
|
55
|
-
* @param {Array<number>} createBySids -
|
|
56
|
-
* @param {Array<string>} queryTypes -
|
|
57
|
-
* @return {Object} Returns Promise object which represents a xxxxx indicating xxxxxxx
|
|
58
|
-
*/
|
|
59
|
-
EventLayer.prototype.createByID = function (createBySids, queryTypes) {
|
|
60
|
-
var _this = this;
|
|
61
|
-
return new Promise(function (resolve, reject) {
|
|
62
|
-
var data = { "CreateBySids": createBySids, "QueryTypes": queryTypes };
|
|
63
|
-
_this.cw.runRequest('Ams/EurlQuery/IdNames', data).then(function (r) {
|
|
64
|
-
// console.log(r, 'response')
|
|
65
|
-
resolve(r.Value);
|
|
66
|
-
}).catch(function (e) {
|
|
67
|
-
reject(e);
|
|
68
|
-
});
|
|
69
|
-
});
|
|
70
|
-
};
|
|
71
|
-
/**
|
|
72
|
-
* Save user preferences
|
|
73
|
-
*
|
|
74
|
-
* @param {string} element - "VisibleQeIds"
|
|
75
|
-
* @param {string} category - "qe-map"
|
|
76
|
-
* @param {Object} defaultValue - {all: [3]}
|
|
77
|
-
* @return {Object} Returns Promise object which represents a xxxxx indicating xxxxxxx
|
|
78
|
-
*/
|
|
79
|
-
EventLayer.prototype.updatePreferences = function (element, category, defaultValue) {
|
|
80
|
-
var _this = this;
|
|
81
|
-
return new Promise(function (resolve, reject) {
|
|
82
|
-
var data = { "Element": element, "Category": category, "DefaultValue": defaultValue };
|
|
83
|
-
_this.cw.runRequest('Ams/Preferences/UserSave', data).then(function (r) {
|
|
84
|
-
// console.log(r, 'response')
|
|
85
|
-
resolve(r.Value);
|
|
86
|
-
}).catch(function (e) {
|
|
87
|
-
reject(e);
|
|
88
|
-
});
|
|
89
|
-
});
|
|
90
|
-
};
|
|
91
|
-
/**
|
|
92
|
-
* Get all event layers
|
|
93
|
-
*
|
|
94
|
-
* @return {Object} Returns Promise object which represents a xxxxx indicating xxxxxxx
|
|
95
|
-
*/
|
|
96
|
-
EventLayer.prototype.all = function () {
|
|
97
|
-
var _this = this;
|
|
98
|
-
return new Promise(function (resolve, reject) {
|
|
99
|
-
var data = {};
|
|
100
|
-
_this.cw.runRequest('Ams/EventLayer/All', data).then(function (r) {
|
|
101
|
-
// console.log(r, 'response')
|
|
102
|
-
resolve(r.Value);
|
|
103
|
-
}).catch(function (e) {
|
|
104
|
-
reject(e);
|
|
105
|
-
});
|
|
106
|
-
});
|
|
107
|
-
};
|
|
108
|
-
/**
|
|
109
|
-
* Get all EUrl Query Types
|
|
110
|
-
*
|
|
111
|
-
* @return {Object} Returns Promise object which represents a xxxxx indicating xxxxxxx
|
|
112
|
-
*/
|
|
113
|
-
EventLayer.prototype.queryTypes = function () {
|
|
114
|
-
var _this = this;
|
|
115
|
-
return new Promise(function (resolve, reject) {
|
|
116
|
-
var data = {};
|
|
117
|
-
_this.cw.runRequest('General/EurlQuery/QueryTypes', data).then(function (r) {
|
|
118
|
-
// console.log(r, 'response')
|
|
119
|
-
resolve(r.Value);
|
|
120
|
-
}).catch(function (e) {
|
|
121
|
-
reject(e);
|
|
122
|
-
});
|
|
123
|
-
});
|
|
124
|
-
};
|
|
125
|
-
/**
|
|
126
|
-
* Get Preferences for User
|
|
127
|
-
*
|
|
128
|
-
* @return {Object} Returns Promise object which represents a xxxxx indicating xxxxxxx
|
|
129
|
-
*/
|
|
130
|
-
EventLayer.prototype.preferences = function () {
|
|
131
|
-
var _this = this;
|
|
132
|
-
return new Promise(function (resolve, reject) {
|
|
133
|
-
var data = {};
|
|
134
|
-
_this.cw.runRequest('Ams/Preferences/User', data).then(function (r) {
|
|
135
|
-
// console.log(r, 'response')
|
|
136
|
-
resolve(r.Value);
|
|
137
|
-
}).catch(function (e) {
|
|
138
|
-
reject(e);
|
|
139
|
-
});
|
|
140
|
-
});
|
|
141
|
-
};
|
|
142
|
-
/**
|
|
143
|
-
* Get Styles for event layers
|
|
144
|
-
*
|
|
145
|
-
* @return {Object} Returns Promise object which represents a xxxxx indicating xxxxxxx
|
|
146
|
-
*/
|
|
147
|
-
EventLayer.prototype.styles = function () {
|
|
148
|
-
var _this = this;
|
|
149
|
-
return new Promise(function (resolve, reject) {
|
|
150
|
-
var data = {};
|
|
151
|
-
_this.cw.runRequest('Ams/EventLayer/Styles', data).then(function (r) {
|
|
152
|
-
// console.log(r, 'response')
|
|
153
|
-
resolve(r.Value);
|
|
154
|
-
}).catch(function (e) {
|
|
155
|
-
reject(e);
|
|
156
|
-
});
|
|
157
|
-
});
|
|
158
|
-
};
|
|
159
|
-
/**
|
|
160
|
-
* Get all event layers
|
|
161
|
-
*
|
|
162
|
-
* @param {boolean} includeDisabled - Defaults to false
|
|
163
|
-
* @return {Object} Returns Promise object which represents a xxxxx indicating xxxxxxx
|
|
164
|
-
*/
|
|
165
|
-
EventLayer.prototype.getAllEventLayers = function (includeDisabled) {
|
|
166
|
-
var _this = this;
|
|
167
|
-
if (includeDisabled === void 0) { includeDisabled = false; }
|
|
168
|
-
return new Promise(function (resolve, reject) {
|
|
169
|
-
var data = { "IncludeDisabled": includeDisabled };
|
|
170
|
-
_this.cw.runRequest('Ams/EventLayer/All', data).then(function (r) {
|
|
171
|
-
// console.log(r, 'response')
|
|
172
|
-
resolve(r.Value);
|
|
173
|
-
}).catch(function (e) {
|
|
174
|
-
reject(e);
|
|
175
|
-
});
|
|
176
|
-
});
|
|
177
|
-
};
|
|
178
|
-
/**
|
|
179
|
-
* Filter event layers by provided search definitions
|
|
180
|
-
*
|
|
181
|
-
* @param {Array<number>} searchIds - Defaults to false
|
|
182
|
-
* @param {Array<number>} eventLayerIds - Defaults to false
|
|
183
|
-
* @return {Object} Returns Promise object which represents a xxxxx indicating xxxxxxx
|
|
184
|
-
*/
|
|
185
|
-
EventLayer.prototype.filterEventLayersBySearches = function (searchIds, eventLayerIds) {
|
|
186
|
-
var _this = this;
|
|
187
|
-
return new Promise(function (resolve, reject) {
|
|
188
|
-
var data = { "SearchIds": searchIds, "EventLayerIds": eventLayerIds };
|
|
189
|
-
_this.cw.runRequest('Ams/EventLayer/Filters', data).then(function (r) {
|
|
190
|
-
// console.log(r, 'response')
|
|
191
|
-
resolve(r.Value);
|
|
192
|
-
}).catch(function (e) {
|
|
193
|
-
reject(e);
|
|
194
|
-
});
|
|
195
|
-
});
|
|
196
|
-
};
|
|
197
|
-
/**
|
|
198
|
-
* eventLayer GIS endpoint, this may need to be a promise as well...
|
|
199
|
-
*
|
|
200
|
-
* @return {string} Returns string that is absolute URL for event layer GIS endpoint
|
|
201
|
-
*/
|
|
202
|
-
EventLayer.prototype.getGISEndpoint = function (eventLayerId) {
|
|
203
|
-
return this.cw.base_url + '/' + this.cw.settings.path + '/eventlayer/1/' + eventLayerId + '/rest/services/cw/FeatureServer/{#}?f=json'; // 1 for SR, 2 for WorkOrders, 3 for Inspections, 5 for PLL Cases
|
|
204
|
-
};
|
|
205
|
-
return EventLayer;
|
|
206
|
-
}());
|
|
207
|
-
exports.EventLayer = EventLayer;
|
package/dist/general.js
DELETED
|
@@ -1,212 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.General = void 0;
|
|
4
|
-
var error_1 = require("./error");
|
|
5
|
-
var _ = require('lodash');
|
|
6
|
-
/**
|
|
7
|
-
* A plugin that contains "general" methods for a Cityworks install
|
|
8
|
-
*/
|
|
9
|
-
var General = /** @class */ (function () {
|
|
10
|
-
/**
|
|
11
|
-
* @hidden
|
|
12
|
-
*/
|
|
13
|
-
function General(cw) {
|
|
14
|
-
this.cw = cw;
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* Get notifications for currently authenticated user
|
|
18
|
-
*
|
|
19
|
-
* @return {Object} Returns Promise object that represents a collection of available notifications
|
|
20
|
-
*/
|
|
21
|
-
General.prototype.notifications = function () {
|
|
22
|
-
var _this = this;
|
|
23
|
-
return new Promise(function (resolve, reject) {
|
|
24
|
-
_this.cw.runRequest('General/ActivityNotification/User', {}).then(function (response) {
|
|
25
|
-
resolve(response.Value);
|
|
26
|
-
}).catch(function (e) {
|
|
27
|
-
reject(e);
|
|
28
|
-
});
|
|
29
|
-
});
|
|
30
|
-
};
|
|
31
|
-
/**
|
|
32
|
-
* Find out if the current user is watching a particular activity (case, task, null [as a string])
|
|
33
|
-
*
|
|
34
|
-
* @param {string} activityType - which activity type the following ID will be for.
|
|
35
|
-
* @param {number} activityId - activity Case or CaseTask (task instance) ID to check
|
|
36
|
-
* @return {Object} Returns Promise object that represents a boolean indicating the currently authenticated user is watching the provided activity
|
|
37
|
-
*/
|
|
38
|
-
General.prototype.amIWatching = function (activityType, activityId) {
|
|
39
|
-
var _this = this;
|
|
40
|
-
return new Promise(function (resolve, reject) {
|
|
41
|
-
var aType = { 'null': 0, 'case': 1, 'task': 2 };
|
|
42
|
-
if (typeof (aType[activityType]) == 'undefined') {
|
|
43
|
-
// reject with error
|
|
44
|
-
reject(new error_1.CWError(1, "Activity type provided does not exist.", { provided: activityType, potential_activities: aType }));
|
|
45
|
-
}
|
|
46
|
-
else {
|
|
47
|
-
var data = { "ActivityType": aType[activityType], "ActivityId": activityId };
|
|
48
|
-
_this.cw.runRequest('General/ActivityNotification/UserWatching', data).then(function (r) {
|
|
49
|
-
// console.log(r, 'response')
|
|
50
|
-
resolve(r.Value);
|
|
51
|
-
}).catch(function (e) {
|
|
52
|
-
reject(e);
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
});
|
|
56
|
-
};
|
|
57
|
-
/**
|
|
58
|
-
* Get CwMetatData by Type and CwSid
|
|
59
|
-
*
|
|
60
|
-
* @param {Array<number>} Ids
|
|
61
|
-
* @param {string} TableName - INSPECTION, REQUEST, WORKORDER require View permission on the activities
|
|
62
|
-
* @return {Object} Returns Promise object that represents a
|
|
63
|
-
*/
|
|
64
|
-
General.prototype.getActivityMetadataByIds = function (ids, table) {
|
|
65
|
-
var _this = this;
|
|
66
|
-
return new Promise(function (resolve, reject) {
|
|
67
|
-
var tables = ["INSPECTION", "REQUEST", "WORKORDER"];
|
|
68
|
-
if (_.indexOf(tables, table) == -1) {
|
|
69
|
-
reject(new error_1.CWError(2, 'TableName provided does not exist or is mispelled.', { 'provided': table, 'available': tables }));
|
|
70
|
-
}
|
|
71
|
-
var data = {
|
|
72
|
-
"Ids": ids,
|
|
73
|
-
"TableName": table
|
|
74
|
-
};
|
|
75
|
-
_this.cw.runRequest('General/CwMetaData/ByTableNameSids', data).then(function (r) {
|
|
76
|
-
console.log(r);
|
|
77
|
-
resolve(r.Value);
|
|
78
|
-
}).catch(function (e) {
|
|
79
|
-
reject(e);
|
|
80
|
-
});
|
|
81
|
-
});
|
|
82
|
-
};
|
|
83
|
-
/**
|
|
84
|
-
* Get recent history for authenticated user
|
|
85
|
-
*
|
|
86
|
-
* @return {Object} Returns Promise object that represents a collection of RecentActivity objects
|
|
87
|
-
*/
|
|
88
|
-
General.prototype.getHistory = function () {
|
|
89
|
-
var _this = this;
|
|
90
|
-
return new Promise(function (resolve, reject) {
|
|
91
|
-
var data = {};
|
|
92
|
-
_this.cw.runRequest('Ams/Search/RecentActivity', data).then(function (r) {
|
|
93
|
-
console.log(r);
|
|
94
|
-
resolve(r.Value);
|
|
95
|
-
}).catch(function (e) {
|
|
96
|
-
reject(e);
|
|
97
|
-
});
|
|
98
|
-
});
|
|
99
|
-
};
|
|
100
|
-
/**
|
|
101
|
-
* Get cost summary for WorkOrder entities
|
|
102
|
-
*
|
|
103
|
-
* @param {Array<number>} ObjectIds
|
|
104
|
-
* @return {Object} Returns Promise object that represents a
|
|
105
|
-
*/
|
|
106
|
-
General.prototype.getWOEntityCostSummary = function (object_ids) {
|
|
107
|
-
var _this = this;
|
|
108
|
-
return new Promise(function (resolve, reject) {
|
|
109
|
-
var data = {
|
|
110
|
-
"ObjectIds": object_ids
|
|
111
|
-
};
|
|
112
|
-
_this.cw.runRequest('General/CostSummary/WorkOrderEntity', data).then(function (r) {
|
|
113
|
-
console.log(r);
|
|
114
|
-
resolve(r.Value);
|
|
115
|
-
}).catch(function (e) {
|
|
116
|
-
reject(e);
|
|
117
|
-
});
|
|
118
|
-
});
|
|
119
|
-
};
|
|
120
|
-
/**
|
|
121
|
-
* Get cost summary for WorkOrder entities selected through a search definition
|
|
122
|
-
*
|
|
123
|
-
* @param {number} SearchId - Search Definition Id
|
|
124
|
-
* @return {Object} Returns Promise object that represents a
|
|
125
|
-
*/
|
|
126
|
-
General.prototype.searchWOEntityCostSummary = function (search_id) {
|
|
127
|
-
var _this = this;
|
|
128
|
-
return new Promise(function (resolve, reject) {
|
|
129
|
-
var data = {
|
|
130
|
-
"SearchId": search_id
|
|
131
|
-
};
|
|
132
|
-
_this.cw.runRequest('General/CostSummary/WorkOrderEntitySearch', data).then(function (r) {
|
|
133
|
-
console.log(r);
|
|
134
|
-
resolve(r.Value);
|
|
135
|
-
}).catch(function (e) {
|
|
136
|
-
reject(e);
|
|
137
|
-
});
|
|
138
|
-
});
|
|
139
|
-
};
|
|
140
|
-
/**
|
|
141
|
-
* Get Holidays
|
|
142
|
-
*
|
|
143
|
-
* @param {Date} startDate - Date to search for Holidays, including this date.
|
|
144
|
-
* @param {Date} [endDate] - If not specified, Holidays _on_ startDate are returned. If specified, Holidays on startDate up to, but not including endDate are returned.
|
|
145
|
-
* @return {Object} Returns Promise object that represents a list of the holiday(s) found
|
|
146
|
-
*/
|
|
147
|
-
General.prototype.getHolidays = function (startDate, endDate) {
|
|
148
|
-
var _this = this;
|
|
149
|
-
return new Promise(function (resolve, reject) {
|
|
150
|
-
var data = {};
|
|
151
|
-
var api_path = 'General/Holidays/All';
|
|
152
|
-
if (typeof (endDate) == 'undefined') {
|
|
153
|
-
_.set(data, "Date", startDate);
|
|
154
|
-
var api_path = 'General/Holidays/ByDate';
|
|
155
|
-
}
|
|
156
|
-
else {
|
|
157
|
-
_.set(data, "StartDate", startDate);
|
|
158
|
-
_.set(data, "EndDate", endDate);
|
|
159
|
-
}
|
|
160
|
-
_this.cw.runRequest(api_path, data).then(function (r) {
|
|
161
|
-
console.log(r);
|
|
162
|
-
resolve(r.Value);
|
|
163
|
-
}).catch(function (e) {
|
|
164
|
-
reject(e);
|
|
165
|
-
});
|
|
166
|
-
});
|
|
167
|
-
};
|
|
168
|
-
/**
|
|
169
|
-
* Add Holidays
|
|
170
|
-
*
|
|
171
|
-
* @param {Date} holiday - The holiday's date
|
|
172
|
-
* @param {string} description - The holiday's name/description
|
|
173
|
-
* @return {Object} Returns Promise object that represents a
|
|
174
|
-
*/
|
|
175
|
-
General.prototype.addHolidays = function (holiday, description) {
|
|
176
|
-
var _this = this;
|
|
177
|
-
return new Promise(function (resolve, reject) {
|
|
178
|
-
var data = {
|
|
179
|
-
"Holiday": holiday,
|
|
180
|
-
"Description": description
|
|
181
|
-
};
|
|
182
|
-
_this.cw.runRequest('General/Holidays/Add', data).then(function (r) {
|
|
183
|
-
console.log(r);
|
|
184
|
-
resolve(r.Value);
|
|
185
|
-
}).catch(function (e) {
|
|
186
|
-
reject(e);
|
|
187
|
-
});
|
|
188
|
-
});
|
|
189
|
-
};
|
|
190
|
-
/**
|
|
191
|
-
* Delete Holidays
|
|
192
|
-
*
|
|
193
|
-
* @param {Array<Date>} holidays - List of datetimes which should have holidays deleted
|
|
194
|
-
* @return {Object} Returns Promise object that represents a
|
|
195
|
-
*/
|
|
196
|
-
General.prototype.deleteHolidays = function (holidays) {
|
|
197
|
-
var _this = this;
|
|
198
|
-
return new Promise(function (resolve, reject) {
|
|
199
|
-
var data = {
|
|
200
|
-
"Holidays": holidays
|
|
201
|
-
};
|
|
202
|
-
_this.cw.runRequest('General/Holidays/Delete', data).then(function (r) {
|
|
203
|
-
console.log(r);
|
|
204
|
-
resolve(r.Value);
|
|
205
|
-
}).catch(function (e) {
|
|
206
|
-
reject(e);
|
|
207
|
-
});
|
|
208
|
-
});
|
|
209
|
-
};
|
|
210
|
-
return General;
|
|
211
|
-
}());
|
|
212
|
-
exports.General = General;
|