cityworks 1.0.4 → 1.0.5
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/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/request_admin.js
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.RequestAdmin = void 0;
|
|
4
|
-
var _ = require('lodash');
|
|
5
|
-
var RequestAdmin = /** @class */ (function () {
|
|
6
|
-
/**
|
|
7
|
-
* @hidden
|
|
8
|
-
*/
|
|
9
|
-
function RequestAdmin(cw) {
|
|
10
|
-
this.cw = cw;
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* Get service request templates
|
|
14
|
-
*
|
|
15
|
-
* @category Requests Admin
|
|
16
|
-
* @param {Object} searchData - search data
|
|
17
|
-
* @return {Object} Returns Promise that represents a collection of all Service Request Templates
|
|
18
|
-
*/
|
|
19
|
-
RequestAdmin.prototype.getTemplates = function (searchData) {
|
|
20
|
-
var _this = this;
|
|
21
|
-
return new Promise(function (resolve, reject) {
|
|
22
|
-
var data = searchData;
|
|
23
|
-
_this.cw.runRequest('Ams/ServiceRequestTemplate/Templates', data).then(function (r) {
|
|
24
|
-
resolve(r.Value);
|
|
25
|
-
}).catch(function (e) {
|
|
26
|
-
reject(e);
|
|
27
|
-
});
|
|
28
|
-
});
|
|
29
|
-
};
|
|
30
|
-
return RequestAdmin;
|
|
31
|
-
}());
|
|
32
|
-
exports.RequestAdmin = RequestAdmin;
|
package/dist/request_costs.js
DELETED
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.RequestCosts = void 0;
|
|
4
|
-
var _ = require('lodash');
|
|
5
|
-
var RequestCosts = /** @class */ (function () {
|
|
6
|
-
/**
|
|
7
|
-
* @hidden
|
|
8
|
-
*/
|
|
9
|
-
function RequestCosts(cw) {
|
|
10
|
-
this.cw = cw;
|
|
11
|
-
this.currentActivityType = "Request";
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* Get Cost Codes
|
|
15
|
-
*
|
|
16
|
-
* @category Labor Costs
|
|
17
|
-
* @param {Array<number>} employeeSids - A list of Employee IDs for which to get the job codes.
|
|
18
|
-
* @param {boolean} commonOnly - Set to true to get the Cost Codes that are common to ALL employees in the list, otherwise get all job codes that apply to at least one employee in the list.
|
|
19
|
-
* @return {Object} Returns Promise that represents an object describing
|
|
20
|
-
*/
|
|
21
|
-
RequestCosts.prototype.getCodes = function (employeeSids, commonOnly) {
|
|
22
|
-
var _this = this;
|
|
23
|
-
if (commonOnly === void 0) { commonOnly = false; }
|
|
24
|
-
return new Promise(function (resolve, reject) {
|
|
25
|
-
var data = {
|
|
26
|
-
EmployeeSids: employeeSids,
|
|
27
|
-
CommonCodesOnly: commonOnly
|
|
28
|
-
};
|
|
29
|
-
_this.cw.runRequest('Ams/LaborCost/CostCodes', data).then(function (r) {
|
|
30
|
-
resolve(r.Value);
|
|
31
|
-
}).catch(function (e) {
|
|
32
|
-
reject(e);
|
|
33
|
-
});
|
|
34
|
-
});
|
|
35
|
-
};
|
|
36
|
-
/**
|
|
37
|
-
* Get Job Codes
|
|
38
|
-
*
|
|
39
|
-
* @category Labor Costs
|
|
40
|
-
* @return {Object} Returns Promise that represents an object describing
|
|
41
|
-
*/
|
|
42
|
-
RequestCosts.prototype.getJobCodes = function () {
|
|
43
|
-
var _this = this;
|
|
44
|
-
return new Promise(function (resolve, reject) {
|
|
45
|
-
_this.cw.runRequest('Ams/LaborCost/JobCodes').then(function (r) {
|
|
46
|
-
resolve(r.Value);
|
|
47
|
-
}).catch(function (e) {
|
|
48
|
-
reject(e);
|
|
49
|
-
});
|
|
50
|
-
});
|
|
51
|
-
};
|
|
52
|
-
/**
|
|
53
|
-
* Add Request Labor Costs
|
|
54
|
-
*
|
|
55
|
-
* @category Request Costs
|
|
56
|
-
* @param {Object} requestCosts - Array of inspection labor costings
|
|
57
|
-
* @return {Object} Returns Promise that represents an object describing
|
|
58
|
-
*/
|
|
59
|
-
RequestCosts.prototype.addLabor = function (requestCosts) {
|
|
60
|
-
var _this = this;
|
|
61
|
-
return new Promise(function (resolve, reject) {
|
|
62
|
-
var data = requestCosts;
|
|
63
|
-
// TODO: ensure each object has Hours & InspectionId
|
|
64
|
-
_this.cw.runRequest('Ams/LaborCost/AddRequestCosts', data).then(function (response) {
|
|
65
|
-
resolve(response.Value);
|
|
66
|
-
}).catch(function (e) {
|
|
67
|
-
reject(e);
|
|
68
|
-
});
|
|
69
|
-
});
|
|
70
|
-
};
|
|
71
|
-
/**
|
|
72
|
-
* Get Labor Costs for Request(s)
|
|
73
|
-
*
|
|
74
|
-
* @category Request Costs
|
|
75
|
-
* @param {Array<number>} requestIds - Array of request Ids to get costs for
|
|
76
|
-
* @return {Object} Returns Promise that represents an object describing
|
|
77
|
-
*/
|
|
78
|
-
RequestCosts.prototype.getLabor = function (requestIds) {
|
|
79
|
-
var _this = this;
|
|
80
|
-
return new Promise(function (resolve, reject) {
|
|
81
|
-
var data = {
|
|
82
|
-
RequestIds: requestIds
|
|
83
|
-
};
|
|
84
|
-
_this.cw.runRequest('Ams/LaborCost/RequestCostsByRequest', data).then(function (response) {
|
|
85
|
-
resolve(response.Value);
|
|
86
|
-
}).catch(function (e) {
|
|
87
|
-
reject(e);
|
|
88
|
-
});
|
|
89
|
-
});
|
|
90
|
-
};
|
|
91
|
-
/**
|
|
92
|
-
* Delete Request Labor Costs
|
|
93
|
-
*
|
|
94
|
-
* @category Request Costs
|
|
95
|
-
* @param {Array<number>} laborCostIds - Array of request labor cost Ids to delete
|
|
96
|
-
* @return {Object} Returns Promise that represents an object describing
|
|
97
|
-
*/
|
|
98
|
-
RequestCosts.prototype.deleteLabor = function (laborCostIds) {
|
|
99
|
-
var _this = this;
|
|
100
|
-
return new Promise(function (resolve, reject) {
|
|
101
|
-
var data = {
|
|
102
|
-
LaborCostIds: laborCostIds
|
|
103
|
-
};
|
|
104
|
-
_this.cw.runRequest('Ams/LaborCost/DeleteRequestCosts', data).then(function (response) {
|
|
105
|
-
resolve(response.Value);
|
|
106
|
-
}).catch(function (e) {
|
|
107
|
-
reject(e);
|
|
108
|
-
});
|
|
109
|
-
});
|
|
110
|
-
};
|
|
111
|
-
return RequestCosts;
|
|
112
|
-
}());
|
|
113
|
-
exports.RequestCosts = RequestCosts;
|
package/dist/search.js
DELETED
|
@@ -1,371 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Search = void 0;
|
|
4
|
-
var error_1 = require("./error");
|
|
5
|
-
var _ = require('lodash');
|
|
6
|
-
var Search = /** @class */ (function () {
|
|
7
|
-
/**
|
|
8
|
-
* @hidden
|
|
9
|
-
*/
|
|
10
|
-
function Search(cw) {
|
|
11
|
-
/**
|
|
12
|
-
* Search Types: Null, Request, WorkOrder, Inspection, Contract, Permit, GIS, PermitTask, PermitAddress, InspCommon, Case, WorkOrderEntity, StoreTransaction, Requisition, Material, WorkActivity, MaterialLeaf, WoTemplate, Unknown, Employee, MessageQueue, Analytics, TokenState, AssetCalculationResult, Equipment, CustomerAccount, InspTemplate, ProblemLeaf, AssetSplitRecord, PavementInsp, TvInspection, Projects
|
|
13
|
-
*/
|
|
14
|
-
this.searchTypes = {
|
|
15
|
-
"Null": 0,
|
|
16
|
-
"Request": 1,
|
|
17
|
-
"WorkOrder": 2,
|
|
18
|
-
"Inspection": 3,
|
|
19
|
-
"Contract": 4,
|
|
20
|
-
"Permit": 5,
|
|
21
|
-
"GIS": 6,
|
|
22
|
-
"PermitTask": 7,
|
|
23
|
-
"PermitAddress": 8,
|
|
24
|
-
"InspCommon": 9,
|
|
25
|
-
"Case": 10,
|
|
26
|
-
"WorkOrderEntity": 11,
|
|
27
|
-
"StoreTransaction": 12,
|
|
28
|
-
"Requisition": 13,
|
|
29
|
-
"Material": 14,
|
|
30
|
-
"WorkActivity": 15,
|
|
31
|
-
"MaterialLeaf": 16,
|
|
32
|
-
"WoTemplate": 17,
|
|
33
|
-
"Unknown": 18,
|
|
34
|
-
"Employee": 19,
|
|
35
|
-
"MessageQueue": 20,
|
|
36
|
-
"Analytics": 21,
|
|
37
|
-
"TokenState": 22,
|
|
38
|
-
"AssetCalculationResult": 23,
|
|
39
|
-
"Equipment": 24,
|
|
40
|
-
"CustomerAccount": 25,
|
|
41
|
-
"InspTemplate": 26,
|
|
42
|
-
"ProblemLeaf": 27,
|
|
43
|
-
"AssetSplitRecord": 28,
|
|
44
|
-
"PavementInsp": 29,
|
|
45
|
-
"TvInspection": 30,
|
|
46
|
-
"Projects": 31
|
|
47
|
-
};
|
|
48
|
-
this.cw = cw;
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* Do a "quick" search for an ID or Case Number
|
|
52
|
-
*
|
|
53
|
-
* @category Quick Search
|
|
54
|
-
* @param {string} text - text to search the system for
|
|
55
|
-
* @return {Object} Returns Promise object that represents a collection of the currently authenticated user's notifications
|
|
56
|
-
*/
|
|
57
|
-
Search.prototype.quick = function (text) {
|
|
58
|
-
var _this = this;
|
|
59
|
-
return new Promise(function (resolve, reject) {
|
|
60
|
-
var data = {
|
|
61
|
-
"QuickSearchText": text,
|
|
62
|
-
};
|
|
63
|
-
_this.cw.runRequest('General/QuickSearch/QuickSearch', data).then(function (r) {
|
|
64
|
-
resolve(r.Value);
|
|
65
|
-
}).catch(function (e) {
|
|
66
|
-
reject(e);
|
|
67
|
-
});
|
|
68
|
-
});
|
|
69
|
-
};
|
|
70
|
-
/**
|
|
71
|
-
* Execute a saved search
|
|
72
|
-
*
|
|
73
|
-
* @category Search
|
|
74
|
-
* @param {number} searchId - SearchId to execute
|
|
75
|
-
* @param {Object} options - Other options. See: /{subdirectory}/apidocs/#/service-info/Ams/Search
|
|
76
|
-
* @return {Object} Returns Promise object that represents a list of Objects
|
|
77
|
-
*/
|
|
78
|
-
Search.prototype.execute = function (searchId, options) {
|
|
79
|
-
var _this = this;
|
|
80
|
-
return new Promise(function (resolve, reject) {
|
|
81
|
-
var data = {
|
|
82
|
-
SearchId: searchId
|
|
83
|
-
};
|
|
84
|
-
data = _.merge(data, options);
|
|
85
|
-
_this.cw.runRequest('Ams/Search/Execute', data).then(function (r) {
|
|
86
|
-
resolve(r.Value);
|
|
87
|
-
}).catch(function (e) {
|
|
88
|
-
reject(e);
|
|
89
|
-
});
|
|
90
|
-
});
|
|
91
|
-
};
|
|
92
|
-
/**
|
|
93
|
-
* Get a list of the saved searches by search type and specific entity types OR employeeSid/domainId. You cannot search for saved searches by both specific entity type AND employeeSid/domainId.
|
|
94
|
-
*
|
|
95
|
-
* @category Search
|
|
96
|
-
* @param {string} searchType - Get the saved searches for a particular type
|
|
97
|
-
* @param {Array<string>} [applyToEntities] - Restrict GIS searches to specified entity types
|
|
98
|
-
* @param {number} [employeeSid] - The employee SID to retrieve the searches as
|
|
99
|
-
* @param {number} [domainId] - The domain ID of the domain to search
|
|
100
|
-
* @return {Object} Returns Promise object that represents a collection of SearchDefinitionName
|
|
101
|
-
*/
|
|
102
|
-
Search.prototype.getSaved = function (searchType, applyToEntities, employeeSid, domainId) {
|
|
103
|
-
var _this = this;
|
|
104
|
-
return new Promise(function (resolve, reject) {
|
|
105
|
-
if (!_.has(_this.searchTypes, searchType)) {
|
|
106
|
-
reject(new error_1.CWError(2, 'SearchType provided does not exist or is mispelled.', { 'provided': searchType, 'available': _this.searchTypes }));
|
|
107
|
-
}
|
|
108
|
-
else if (typeof (applyToEntities) != 'undefined' && applyToEntities != null && applyToEntities.length > 0 && (typeof (employeeSid) != 'undefined' || typeof (domainId) != 'undefined')) {
|
|
109
|
-
reject(new error_1.CWError(3, 'You cannot specify both applyToEntities AND employeeSid/domainId'));
|
|
110
|
-
}
|
|
111
|
-
var data = {};
|
|
112
|
-
var savedEndpoint = '';
|
|
113
|
-
if (typeof (employeeSid) != 'undefined' || typeof (domainId) != 'undefined') {
|
|
114
|
-
savedEndpoint = 'SavedByType';
|
|
115
|
-
if (typeof (employeeSid) != 'undefined' && employeeSid != null) {
|
|
116
|
-
_.set(data, 'EmployeeSid', employeeSid);
|
|
117
|
-
}
|
|
118
|
-
if (typeof (domainId) != 'undefined' && domainId != null) {
|
|
119
|
-
_.set(data, 'DomainId', domainId);
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
else {
|
|
123
|
-
if (searchType == 'Case') {
|
|
124
|
-
savedEndpoint = 'PllSavedSaved';
|
|
125
|
-
}
|
|
126
|
-
else {
|
|
127
|
-
savedEndpoint = searchType + 'Saved';
|
|
128
|
-
}
|
|
129
|
-
if (typeof (applyToEntities) != 'undefined' && applyToEntities != null) {
|
|
130
|
-
_.set(data, 'ApplyToEntities', applyToEntities);
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
_this.cw.runRequest('Ams/Search/' + savedEndpoint, data).then(function (r) {
|
|
134
|
-
resolve(r.Value);
|
|
135
|
-
}).catch(function (e) {
|
|
136
|
-
reject(e);
|
|
137
|
-
});
|
|
138
|
-
});
|
|
139
|
-
};
|
|
140
|
-
/**
|
|
141
|
-
* Get a list display fields for a Search Type
|
|
142
|
-
*
|
|
143
|
-
* @category Search Options
|
|
144
|
-
* @param {string} searchType - Restrict GIS searches to specified entity types
|
|
145
|
-
* @return {Object} Returns Promise object that represents a collection of SearchDisplayFields
|
|
146
|
-
*/
|
|
147
|
-
Search.prototype.displayFields = function (searchType) {
|
|
148
|
-
var _this = this;
|
|
149
|
-
return new Promise(function (resolve, reject) {
|
|
150
|
-
if (!_.has(_this.searchTypes, searchType)) {
|
|
151
|
-
reject(new error_1.CWError(1, 'SearchType provided does not exist or is mispelled.', { 'provided': searchType, 'available': _this.searchTypes }));
|
|
152
|
-
}
|
|
153
|
-
var data = {
|
|
154
|
-
searchType: _.get(_this.searchTypes, searchType)
|
|
155
|
-
};
|
|
156
|
-
_this.cw.runRequest('Ams/Search/DisplayFields', data).then(function (r) {
|
|
157
|
-
resolve(r.Value);
|
|
158
|
-
}).catch(function (e) {
|
|
159
|
-
reject(e);
|
|
160
|
-
});
|
|
161
|
-
});
|
|
162
|
-
};
|
|
163
|
-
/**
|
|
164
|
-
* Get a list search types
|
|
165
|
-
*
|
|
166
|
-
* @category Search Options
|
|
167
|
-
* @return {Object} Returns Promise object that represents a collection of SearchTypeInfo objects
|
|
168
|
-
*/
|
|
169
|
-
Search.prototype.types = function () {
|
|
170
|
-
var _this = this;
|
|
171
|
-
return new Promise(function (resolve, reject) {
|
|
172
|
-
var data = {};
|
|
173
|
-
_this.cw.runRequest('Ams/Search/Types', data).then(function (r) {
|
|
174
|
-
resolve(r.Value);
|
|
175
|
-
}).catch(function (e) {
|
|
176
|
-
reject(e);
|
|
177
|
-
});
|
|
178
|
-
});
|
|
179
|
-
};
|
|
180
|
-
/**
|
|
181
|
-
* Enable Service URLs on Saved Searches
|
|
182
|
-
*
|
|
183
|
-
* @category Search Options
|
|
184
|
-
* @param {Array<number>} searchIds - Search IDs to enable eURL on
|
|
185
|
-
* @return {Object} Returns Promise object that represents a dictionary of SearchIds and EURL booleans
|
|
186
|
-
*/
|
|
187
|
-
Search.prototype.enableServices = function (searchIds) {
|
|
188
|
-
var _this = this;
|
|
189
|
-
return new Promise(function (resolve, reject) {
|
|
190
|
-
var data = {
|
|
191
|
-
Enable: true,
|
|
192
|
-
SearchIds: searchIds
|
|
193
|
-
};
|
|
194
|
-
_this.cw.runRequest('Ams/Search/UpdateEurl', data).then(function (r) {
|
|
195
|
-
resolve(r.Value);
|
|
196
|
-
}).catch(function (e) {
|
|
197
|
-
reject(e);
|
|
198
|
-
});
|
|
199
|
-
});
|
|
200
|
-
};
|
|
201
|
-
/**
|
|
202
|
-
* Disable Service URLs on Saved Searches
|
|
203
|
-
*
|
|
204
|
-
* @category Search Options
|
|
205
|
-
* @param {Array<number>} searchIds - Search IDs to enable eURL on
|
|
206
|
-
* @return {Object} Returns Promise object that represents a dictionary of SearchIds and EURL booleans
|
|
207
|
-
*/
|
|
208
|
-
Search.prototype.disableServices = function (searchIds) {
|
|
209
|
-
var _this = this;
|
|
210
|
-
return new Promise(function (resolve, reject) {
|
|
211
|
-
var data = {
|
|
212
|
-
Enable: false,
|
|
213
|
-
SearchIds: searchIds
|
|
214
|
-
};
|
|
215
|
-
_this.cw.runRequest('Ams/Search/UpdateEurl', data).then(function (r) {
|
|
216
|
-
resolve(r.Value);
|
|
217
|
-
}).catch(function (e) {
|
|
218
|
-
reject(e);
|
|
219
|
-
});
|
|
220
|
-
});
|
|
221
|
-
};
|
|
222
|
-
/**
|
|
223
|
-
* Get a search definition
|
|
224
|
-
*
|
|
225
|
-
* @category Search Definitions
|
|
226
|
-
* @param {number} searchId - SearchId to get.
|
|
227
|
-
* @param {number} employeeSid - Enforces employee security settings on search definition if provided.
|
|
228
|
-
* @return {Object} Returns Promise object that represents a SearchDefinition object
|
|
229
|
-
*/
|
|
230
|
-
Search.prototype.getDefinition = function (searchId, employeeSid) {
|
|
231
|
-
var _this = this;
|
|
232
|
-
return new Promise(function (resolve, reject) {
|
|
233
|
-
var data = {
|
|
234
|
-
SearchId: searchId
|
|
235
|
-
};
|
|
236
|
-
if (typeof (employeeSid) != 'undefined') {
|
|
237
|
-
_.set(data, 'EmployeeSid', employeeSid);
|
|
238
|
-
}
|
|
239
|
-
_this.cw.runRequest('Ams/Search/Definition', data).then(function (r) {
|
|
240
|
-
resolve(r.Value);
|
|
241
|
-
}).catch(function (e) {
|
|
242
|
-
reject(e);
|
|
243
|
-
});
|
|
244
|
-
});
|
|
245
|
-
};
|
|
246
|
-
/**
|
|
247
|
-
* Get search definitions
|
|
248
|
-
*
|
|
249
|
-
* @category Search Definitions
|
|
250
|
-
* @param {Array<number>} searchIds - SearchIds to get.
|
|
251
|
-
* @param {number} employeeSid - Enforces employee security settings on search definition if provided.
|
|
252
|
-
* @return {Object} Returns Promise object that represents a collection of SearchDefinition objects
|
|
253
|
-
*/
|
|
254
|
-
Search.prototype.getDefinitions = function (searchIds, employeeSid) {
|
|
255
|
-
var _this = this;
|
|
256
|
-
return new Promise(function (resolve, reject) {
|
|
257
|
-
var data = {
|
|
258
|
-
SearchIds: searchIds
|
|
259
|
-
};
|
|
260
|
-
if (typeof (employeeSid) != 'undefined') {
|
|
261
|
-
_.set(data, 'EmployeeSid', employeeSid);
|
|
262
|
-
}
|
|
263
|
-
_this.cw.runRequest('Ams/Search/Definitions', data).then(function (r) {
|
|
264
|
-
resolve(r.Value);
|
|
265
|
-
}).catch(function (e) {
|
|
266
|
-
reject(e);
|
|
267
|
-
});
|
|
268
|
-
});
|
|
269
|
-
};
|
|
270
|
-
/**
|
|
271
|
-
* Get search definition names
|
|
272
|
-
*
|
|
273
|
-
* @category Search Definitions
|
|
274
|
-
* @param {Array<number>} searchIds - SearchIds to get.
|
|
275
|
-
* @return {Object} Returns Promise object that represents a collection of SearchDefinitionNames
|
|
276
|
-
*/
|
|
277
|
-
Search.prototype.getDefinitionNames = function (searchIds) {
|
|
278
|
-
var _this = this;
|
|
279
|
-
return new Promise(function (resolve, reject) {
|
|
280
|
-
var data = {
|
|
281
|
-
SearchIds: searchIds
|
|
282
|
-
};
|
|
283
|
-
_this.cw.runRequest('Ams/Search/DefinitionNames', data).then(function (r) {
|
|
284
|
-
resolve(r.Value);
|
|
285
|
-
}).catch(function (e) {
|
|
286
|
-
reject(e);
|
|
287
|
-
});
|
|
288
|
-
});
|
|
289
|
-
};
|
|
290
|
-
/**
|
|
291
|
-
* Delete search definitions
|
|
292
|
-
*
|
|
293
|
-
* @category Search Definitions
|
|
294
|
-
* @param {Array<number>} searchIds - SearchIds to get.
|
|
295
|
-
* @return {Object} Returns Promise object that represents a list (dictionary) of search IDs and deletion success boolean
|
|
296
|
-
*/
|
|
297
|
-
Search.prototype.deleteDefinitions = function (searchIds) {
|
|
298
|
-
var _this = this;
|
|
299
|
-
return new Promise(function (resolve, reject) {
|
|
300
|
-
var data = {
|
|
301
|
-
SearchIds: searchIds
|
|
302
|
-
};
|
|
303
|
-
_this.cw.runRequest('Ams/Search/DeleteDefinitions', data).then(function (r) {
|
|
304
|
-
resolve(r.Value);
|
|
305
|
-
}).catch(function (e) {
|
|
306
|
-
reject(e);
|
|
307
|
-
});
|
|
308
|
-
});
|
|
309
|
-
};
|
|
310
|
-
/**
|
|
311
|
-
* Save a search definition
|
|
312
|
-
*
|
|
313
|
-
* @category Search Definitions
|
|
314
|
-
* @param {string} searchFor - Name of type to search for from searchTypes
|
|
315
|
-
* @param {Object} options - Other options. See: /{subdirectory}/apidocs/#/service-info/Ams/Search
|
|
316
|
-
* @param {number} searchId - SearchId to update. Defaults to "0" which is "Create new saved search"
|
|
317
|
-
* @return {Object} Returns Promise object that represents a SearchDefinitionName object
|
|
318
|
-
*/
|
|
319
|
-
Search.prototype.saveDefinition = function (searchFor, options, searchId) {
|
|
320
|
-
var _this = this;
|
|
321
|
-
if (searchId === void 0) { searchId = 0; }
|
|
322
|
-
return new Promise(function (resolve, reject) {
|
|
323
|
-
if (!_.has(_this.searchTypes, searchFor)) {
|
|
324
|
-
reject(new error_1.CWError(1, 'SearchType provided does not exist or is mispelled.', { 'provided': searchFor, 'available': _this.searchTypes }));
|
|
325
|
-
}
|
|
326
|
-
var data = {
|
|
327
|
-
SearchFor: _.get(_this.searchTypes, searchFor),
|
|
328
|
-
SearchId: searchId
|
|
329
|
-
};
|
|
330
|
-
data = _.merge(data, options);
|
|
331
|
-
_this.cw.runRequest('Ams/Search/SaveDefinition', data).then(function (r) {
|
|
332
|
-
resolve(r.Value);
|
|
333
|
-
}).catch(function (e) {
|
|
334
|
-
reject(e);
|
|
335
|
-
});
|
|
336
|
-
});
|
|
337
|
-
};
|
|
338
|
-
/**
|
|
339
|
-
* Convert a search definition to a query
|
|
340
|
-
*
|
|
341
|
-
* @category Search Definitions
|
|
342
|
-
* @param {Array<number>} searchIds - searchIds to convert
|
|
343
|
-
* @param {boolean} saveQuery - Automatically save a query which converts with no errors, default is false
|
|
344
|
-
* @param {boolean} allowMultipleBooleanValues - Use all values for boolean fields even though a boolean should only have one value, default is false and will only use the first boolean value
|
|
345
|
-
* @param {boolean} allowEmptyQuery - Create default filter when no filter is found, default is false
|
|
346
|
-
* @return {Object} Returns Promise object that represents a SearchToQueryResult list
|
|
347
|
-
*/
|
|
348
|
-
Search.prototype.convertToQuery = function (searchIds, saveQuery, addEurl, allowMultipleBooleanValues, allowEmptyQuery) {
|
|
349
|
-
var _this = this;
|
|
350
|
-
if (saveQuery === void 0) { saveQuery = false; }
|
|
351
|
-
if (addEurl === void 0) { addEurl = false; }
|
|
352
|
-
if (allowMultipleBooleanValues === void 0) { allowMultipleBooleanValues = false; }
|
|
353
|
-
if (allowEmptyQuery === void 0) { allowEmptyQuery = false; }
|
|
354
|
-
return new Promise(function (resolve, reject) {
|
|
355
|
-
var data = {
|
|
356
|
-
"SearchIds": searchIds,
|
|
357
|
-
"SaveQuery": saveQuery,
|
|
358
|
-
"AddEurl": addEurl,
|
|
359
|
-
"AllowMultipleBooleanValues": allowMultipleBooleanValues,
|
|
360
|
-
"AllowEmptyQuery": allowEmptyQuery
|
|
361
|
-
};
|
|
362
|
-
_this.cw.runRequest('General/Query/SearchToQuery', data).then(function (r) {
|
|
363
|
-
resolve(r.Value);
|
|
364
|
-
}).catch(function (e) {
|
|
365
|
-
reject(e);
|
|
366
|
-
});
|
|
367
|
-
});
|
|
368
|
-
};
|
|
369
|
-
return Search;
|
|
370
|
-
}());
|
|
371
|
-
exports.Search = Search;
|