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/query.js
DELETED
|
@@ -1,242 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Query = void 0;
|
|
4
|
-
var _ = require('lodash');
|
|
5
|
-
var Query = /** @class */ (function () {
|
|
6
|
-
/**
|
|
7
|
-
* @hidden
|
|
8
|
-
*/
|
|
9
|
-
function Query(cw) {
|
|
10
|
-
this.cw = cw;
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* Build a query using query language syntax or by specifying a saved query ID
|
|
14
|
-
*
|
|
15
|
-
* @category Query
|
|
16
|
-
* @param {number} query - Query to run (specify syntax or queryID)
|
|
17
|
-
* @param {Object} options - Other options. See: /{subdirectory}/apidocs/#/service-info/General/Query
|
|
18
|
-
* @param {number} [domainId] - The domain ID of the domain to search, defaut is authenticated user's current domain
|
|
19
|
-
* @return {Object} Returns Promise object that represents a list of Objects
|
|
20
|
-
*/
|
|
21
|
-
Query.prototype.build = function (query, options, domainId) {
|
|
22
|
-
var _this = this;
|
|
23
|
-
if (options === void 0) { options = {}; }
|
|
24
|
-
return new Promise(function (resolve, reject) {
|
|
25
|
-
var data = {};
|
|
26
|
-
if (isNaN(+query)) {
|
|
27
|
-
_.set(data, "QueryValue", query);
|
|
28
|
-
}
|
|
29
|
-
else if (!isNaN(+query)) {
|
|
30
|
-
_.set(data, "QueryId", query);
|
|
31
|
-
}
|
|
32
|
-
else {
|
|
33
|
-
// throw error
|
|
34
|
-
}
|
|
35
|
-
data = _.merge(data, options);
|
|
36
|
-
if (typeof (domainId) !== 'undefined') {
|
|
37
|
-
_.set(data, "DomainId", domainId);
|
|
38
|
-
}
|
|
39
|
-
_this.cw.runRequest('General/Query/Builder', data).then(function (r) {
|
|
40
|
-
resolve(r.Value);
|
|
41
|
-
}).catch(function (e) {
|
|
42
|
-
reject(e);
|
|
43
|
-
});
|
|
44
|
-
});
|
|
45
|
-
};
|
|
46
|
-
/**
|
|
47
|
-
* Get available query types
|
|
48
|
-
*
|
|
49
|
-
* @category Query
|
|
50
|
-
* @return {Object} Returns Promise object that represents a list of Objects
|
|
51
|
-
*/
|
|
52
|
-
Query.prototype.getTypes = function () {
|
|
53
|
-
var _this = this;
|
|
54
|
-
return new Promise(function (resolve, reject) {
|
|
55
|
-
_this.cw.runRequest('General/Query/QueryTypes', {}).then(function (r) {
|
|
56
|
-
resolve(r.Value);
|
|
57
|
-
}).catch(function (e) {
|
|
58
|
-
reject(e);
|
|
59
|
-
});
|
|
60
|
-
});
|
|
61
|
-
};
|
|
62
|
-
/**
|
|
63
|
-
* Get info about query types
|
|
64
|
-
*
|
|
65
|
-
* @category Query
|
|
66
|
-
* @param {boolean} includeDefaultSchemasInclude - Include schemas (Work Order, Service Request, etc), default is true.
|
|
67
|
-
* @param {boolean} includeGisSchemas - Include gis schemas, ddefault is true.
|
|
68
|
-
* @param {number} [domainId] - The domain ID of the domain to search, defaut is authenticated user's current domain
|
|
69
|
-
* @return {Object} Returns Promise object that represents a list of Objects
|
|
70
|
-
*/
|
|
71
|
-
Query.prototype.getTypesInfo = function (includeDefaultSchemasInclude, includeGisSchemas, domainId) {
|
|
72
|
-
var _this = this;
|
|
73
|
-
if (includeDefaultSchemasInclude === void 0) { includeDefaultSchemasInclude = true; }
|
|
74
|
-
if (includeGisSchemas === void 0) { includeGisSchemas = true; }
|
|
75
|
-
return new Promise(function (resolve, reject) {
|
|
76
|
-
var data = {
|
|
77
|
-
"IncludeDefaultSchemasInclude": includeDefaultSchemasInclude,
|
|
78
|
-
"IncludeGisSchemas": includeGisSchemas
|
|
79
|
-
};
|
|
80
|
-
if (typeof (domainId) !== 'undefined') {
|
|
81
|
-
_.set(data, "DomainId", domainId);
|
|
82
|
-
}
|
|
83
|
-
_this.cw.runRequest('General/Query/QueryTypeInformation', data).then(function (r) {
|
|
84
|
-
resolve(r.Value);
|
|
85
|
-
}).catch(function (e) {
|
|
86
|
-
reject(e);
|
|
87
|
-
});
|
|
88
|
-
});
|
|
89
|
-
};
|
|
90
|
-
/**
|
|
91
|
-
* Validate a query string
|
|
92
|
-
*
|
|
93
|
-
* @category Query
|
|
94
|
-
* @param {string} query - The query to validate
|
|
95
|
-
* @param {DynamicVariableMap} variables - Required if the query includes variables
|
|
96
|
-
* @param {number} [domainId] - The domain ID of the domain to search, defaut is authenticated user's current domain
|
|
97
|
-
* @return {Object} Returns Promise object that represents a list of Objects
|
|
98
|
-
*/
|
|
99
|
-
Query.prototype.validateQuery = function (query, variables, domainId) {
|
|
100
|
-
var _this = this;
|
|
101
|
-
return new Promise(function (resolve, reject) {
|
|
102
|
-
var data = {
|
|
103
|
-
"Query": query,
|
|
104
|
-
"Variables": variables
|
|
105
|
-
};
|
|
106
|
-
if (typeof (domainId) !== 'undefined') {
|
|
107
|
-
_.set(data, "DomainId", domainId);
|
|
108
|
-
}
|
|
109
|
-
_this.cw.runRequest('General/Query/ValidateQuery', data).then(function (r) {
|
|
110
|
-
resolve(r.Value);
|
|
111
|
-
}).catch(function (e) {
|
|
112
|
-
reject(e);
|
|
113
|
-
});
|
|
114
|
-
});
|
|
115
|
-
};
|
|
116
|
-
/**
|
|
117
|
-
* Validate a query response definition
|
|
118
|
-
*
|
|
119
|
-
* @category Query
|
|
120
|
-
* @param {string} queryType - The query to validate
|
|
121
|
-
* @param {DynamicResponseDefinition} responseDefinition - Required if the query includes variables
|
|
122
|
-
* @param {number} [domainId] - The domain ID of the domain to search, defaut is authenticated user's current domain
|
|
123
|
-
* @return {Object} Returns Promise object that represents a list of Objects
|
|
124
|
-
*/
|
|
125
|
-
Query.prototype.validateResponseDefinition = function (queryType, responseDefinition, domainId) {
|
|
126
|
-
var _this = this;
|
|
127
|
-
// TODO: Confirm that the queryType is present in the getTypes() request
|
|
128
|
-
return new Promise(function (resolve, reject) {
|
|
129
|
-
var data = {
|
|
130
|
-
"QueryType": queryType,
|
|
131
|
-
"ResponseDefinition": responseDefinition
|
|
132
|
-
};
|
|
133
|
-
if (typeof (domainId) !== 'undefined') {
|
|
134
|
-
_.set(data, "DomainId", domainId);
|
|
135
|
-
}
|
|
136
|
-
_this.cw.runRequest('General/Query/ValidateResponseDefinition', data).then(function (r) {
|
|
137
|
-
resolve(r.Value);
|
|
138
|
-
}).catch(function (e) {
|
|
139
|
-
reject(e);
|
|
140
|
-
});
|
|
141
|
-
});
|
|
142
|
-
};
|
|
143
|
-
/**
|
|
144
|
-
* Get schema for specified query type
|
|
145
|
-
*
|
|
146
|
-
* @category Query
|
|
147
|
-
* @param {string} queryType - Specify Query Type
|
|
148
|
-
* @param {number} [domainId] - The domain ID of the domain to search, defaut is authenticated user's current domain. Used to determine query field configuration for the schema fields.
|
|
149
|
-
* @return {Object} Returns Promise object that represents a list of Objects
|
|
150
|
-
*/
|
|
151
|
-
Query.prototype.getSchema = function (queryType, domainId) {
|
|
152
|
-
var _this = this;
|
|
153
|
-
return new Promise(function (resolve, reject) {
|
|
154
|
-
var data = {
|
|
155
|
-
"QueryType": queryType
|
|
156
|
-
};
|
|
157
|
-
if (typeof (domainId) !== 'undefined') {
|
|
158
|
-
_.set(data, "DomainId", domainId);
|
|
159
|
-
}
|
|
160
|
-
_this.cw.runRequest('General/Query/QuerySchema', data).then(function (r) {
|
|
161
|
-
resolve(r.Value);
|
|
162
|
-
}).catch(function (e) {
|
|
163
|
-
reject(e);
|
|
164
|
-
});
|
|
165
|
-
});
|
|
166
|
-
};
|
|
167
|
-
/**
|
|
168
|
-
* Run a query using query language syntax
|
|
169
|
-
*
|
|
170
|
-
* @category Query
|
|
171
|
-
* @param {number} query - Query syntax string or saved query ID to run. If you want to append addt'l query items to a saved query, add QueryValue in the options
|
|
172
|
-
* @param {Object} options - Other options. See: /{subdirectory}/apidocs/#/service-info/General/Query
|
|
173
|
-
* @return {Object} Returns Promise object that represents a list of Objects
|
|
174
|
-
*/
|
|
175
|
-
Query.prototype.run = function (query, options) {
|
|
176
|
-
var _this = this;
|
|
177
|
-
if (options === void 0) { options = {}; }
|
|
178
|
-
return new Promise(function (resolve, reject) {
|
|
179
|
-
var data = {};
|
|
180
|
-
var api_path = 'General/Query/Query';
|
|
181
|
-
if (isNaN(+query)) {
|
|
182
|
-
_.set(data, "QueryValue", query);
|
|
183
|
-
if (typeof (options.QueryValue) !== 'undefined') {
|
|
184
|
-
_.unset(options, 'QueryValue');
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
else if (!isNaN(+query)) {
|
|
188
|
-
_.set(data, "QueryId", query);
|
|
189
|
-
var api_path = 'General/Query/RunById';
|
|
190
|
-
}
|
|
191
|
-
else {
|
|
192
|
-
// throw error
|
|
193
|
-
}
|
|
194
|
-
data = _.merge(data, options);
|
|
195
|
-
_this.cw.runRequest(api_path, data).then(function (r) {
|
|
196
|
-
resolve(r.Value);
|
|
197
|
-
}).catch(function (e) {
|
|
198
|
-
reject(e);
|
|
199
|
-
});
|
|
200
|
-
});
|
|
201
|
-
};
|
|
202
|
-
/**
|
|
203
|
-
* Get a list of the saved queries the current user can access.
|
|
204
|
-
*
|
|
205
|
-
* @category Query
|
|
206
|
-
* @param {Array<string>} queryTypes - Get the saved queries for a particular type, default is all types
|
|
207
|
-
* @param {boolean} createdOnly - Get only queries created by the current user, default is get all queries current user can access
|
|
208
|
-
* @param {boolean} includeQuery - Restrict GIS searches to specified entity types
|
|
209
|
-
* @param {boolean} [visibleToMobile] - Filter visibility to mobile. Default ignore visibility to mobile.
|
|
210
|
-
* @param {number} [domainId] - The domain ID of the domain to search, defaut is authenticated user's current domain
|
|
211
|
-
* @return {Object} Returns Promise object that represents a collection of SavedQueries
|
|
212
|
-
*/
|
|
213
|
-
Query.prototype.getSaved = function (queryTypes, createdOnly, includeQuery, visibleToMobile, domainId) {
|
|
214
|
-
var _this = this;
|
|
215
|
-
if (queryTypes === void 0) { queryTypes = []; }
|
|
216
|
-
if (createdOnly === void 0) { createdOnly = false; }
|
|
217
|
-
if (includeQuery === void 0) { includeQuery = true; }
|
|
218
|
-
return new Promise(function (resolve, reject) {
|
|
219
|
-
// TODO: Check QueryTypeInformation and compare
|
|
220
|
-
var data = {
|
|
221
|
-
"CreatedOnly": createdOnly,
|
|
222
|
-
"IncludeQuery": includeQuery
|
|
223
|
-
};
|
|
224
|
-
if (queryTypes.length == 1) {
|
|
225
|
-
_.set(data, "QueryType", queryTypes.pop());
|
|
226
|
-
}
|
|
227
|
-
else if (queryTypes.length > 1) {
|
|
228
|
-
_.set(data, "QueryTypes", queryTypes);
|
|
229
|
-
}
|
|
230
|
-
if (typeof (domainId) !== 'undefined') {
|
|
231
|
-
_.set(data, "DomainId", domainId);
|
|
232
|
-
}
|
|
233
|
-
_this.cw.runRequest('General/Query/SavedQueries', data).then(function (r) {
|
|
234
|
-
resolve(r.Value);
|
|
235
|
-
}).catch(function (e) {
|
|
236
|
-
reject(e);
|
|
237
|
-
});
|
|
238
|
-
});
|
|
239
|
-
};
|
|
240
|
-
return Query;
|
|
241
|
-
}());
|
|
242
|
-
exports.Query = Query;
|