cityworks 0.0.36 → 0.0.38

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 (47) hide show
  1. package/README.md +4 -2
  2. package/dist/cityworks.d.ts +1 -1
  3. package/dist/index.d.ts +1 -1
  4. package/dist/index.js +1 -1
  5. package/dist/index.js.map +1 -1
  6. package/dist/index.m.js +1 -1
  7. package/dist/index.m.js.map +1 -1
  8. package/dist/index.modern.mjs +1 -1
  9. package/dist/index.modern.mjs.map +1 -1
  10. package/dist/index.umd.js +1 -1
  11. package/dist/index.umd.js.map +1 -1
  12. package/package.json +2 -1
  13. package/index.js +0 -1
  14. package/src/activity_link.ts +0 -241
  15. package/src/case.ts +0 -282
  16. package/src/case_admin.ts +0 -883
  17. package/src/case_assets.ts +0 -129
  18. package/src/case_data.ts +0 -446
  19. package/src/case_financial.ts +0 -848
  20. package/src/case_workflow.ts +0 -462
  21. package/src/cityworks.ts +0 -719
  22. package/src/comments.ts +0 -167
  23. package/src/costs.ts +0 -289
  24. package/src/error.ts +0 -56
  25. package/src/event_layer.ts +0 -231
  26. package/src/general.ts +0 -143
  27. package/src/gis.ts +0 -242
  28. package/src/index.ts +0 -1
  29. package/src/inspection.ts +0 -851
  30. package/src/inspection_admin.ts +0 -45
  31. package/src/message_queue.ts +0 -243
  32. package/src/request.ts +0 -823
  33. package/src/request_admin.ts +0 -35
  34. package/src/search.ts +0 -339
  35. package/src/workorder.ts +0 -838
  36. package/src/workorder_admin.ts +0 -248
  37. package/test/01.cityworksTest.js +0 -80
  38. package/test/02.activitylinkTest.js +0 -58
  39. package/test/03.generalTest.js +0 -87
  40. package/test/04.requestTest.js +0 -293
  41. package/test/05.caseTest.js +0 -110
  42. package/test/06.caseFinancialTest.js +0 -172
  43. package/test/07.searchTest.js +0 -191
  44. package/test/08.workOrderTest.js +0 -48
  45. package/test/09.caseAssetsTest.js +0 -72
  46. package/test/09.inspectionTest.js +0 -28
  47. package/tsconfig.json +0 -68
@@ -1,293 +0,0 @@
1
- 'use strict';
2
- require('dotenv').config();
3
- var expect = require('chai').expect;
4
- var assert = require('chai').assert;
5
- var Cityworks = require('../dist/index.js');
6
- var cw4 = new Cityworks(process.env.domain, {path: process.env.path});
7
- const _ = require('lodash')
8
-
9
- before(function(done) {
10
- this.timeout(20000000);
11
- cw4.authenticate(process.env.login, process.env.password).then(resp => {
12
- done();
13
- }).catch(e => {
14
- console.log(e, 'unexpected error')
15
- done();
16
- });
17
- });
18
-
19
- describe('[Request (construct)] function test', () => {
20
- it('should be a defined object', (done) => {
21
- assert.isObject(cw4.request, 'Request is an object');
22
- done();
23
- });
24
- it('should have an admin property which is a defined object', (done) => {
25
- assert.isObject(cw4.request.admin, 'Admin is an object');
26
- done();
27
- });
28
- it('should have an comment property which is a defined object', (done) => {
29
- assert.isObject(cw4.request.comment, 'Comment is an object');
30
- done();
31
- });
32
- });
33
-
34
- describe('[Request::getProblemNodes] function test', () => {
35
- it('should return a list of problem nodes for a known domain', (done) => {
36
- cw4.request.getProblemNodes(1).then(resp => {
37
- assert.property(resp[0], 'Cancel');
38
- done();
39
- }).catch(e => {
40
- console.log(e);
41
- });
42
- });
43
- it('should return a list of problem nodes with view only priviledges', (done) => {
44
- cw4.request.getProblemNodes(1, true).then(resp => {
45
- assert.property(resp[0], 'Cancel');
46
- done();
47
- }).catch(e => {
48
- console.log(e);
49
- });
50
- });
51
- it('should return a list of problem nodes including cancelled nodes', (done) => {
52
- let result = false;
53
- cw4.request.getProblemNodes(1, false, null, true).then(resp => {
54
- if(resp.length==0) {
55
- result = true;
56
- } else {
57
- for (let i = 0; i < resp.length; i++) {
58
- if(resp[i].Cancel==true) {
59
- result = true;
60
- break;
61
- }
62
- }
63
- }
64
- assert.isTrue(result);
65
- done();
66
- }).catch(e => {
67
- console.log(e);
68
- });
69
- });
70
- it('should return a list of problem nodes code and description delimited by [pipe]', (done) => {
71
- let delimiter = ' | ';
72
- let delimiter_test = false;
73
- cw4.request.getProblemNodes(1, true, {DisplayTextMode:'CD', DisplayTextDelimeter:delimiter}).then(resp => {
74
- if(resp.length==0) {
75
- delimiter_test = true;
76
- } else {
77
- for (let i = 0; i < resp.length; i++) {
78
- let names = _.split(resp[i].NodeName, delimiter);
79
- if(names[1]==resp[i].Description) {
80
- delimiter_test = true;
81
- break;
82
- }
83
- }
84
- }
85
- assert.isTrue(delimiter_test);
86
- done();
87
- }).catch(e => {
88
- console.log(e);
89
- });
90
- });
91
- it('should return the description as the name if D is set and description is not empty', (done) => {
92
- let description_as_name_test = false;
93
- cw4.request.getProblemNodes(1, true, {DisplayTextMode:'D'}).then(resp => {
94
- if(resp.length==0) {
95
- description_as_name_test = true;
96
- } else {
97
- for (let i = 0; i < resp.length; i++) {
98
- if(resp[i].NodeName==resp[i].Description && !_.isEmpty(resp[i].Description)) {
99
- description_as_name_test = true;
100
- break;
101
- }
102
- }
103
- }
104
- assert.isTrue(description_as_name_test);
105
- done();
106
- }).catch(e => {
107
- console.log(e);
108
- });
109
- });
110
- });
111
-
112
- describe('[Request::getProblems] function test', () => {
113
- it('should return a list of problems', (done) => {
114
- cw4.request.getProblems().then(resp => {
115
- assert.isArray(resp);
116
- done();
117
- }).catch(e => {
118
- console.log(e);
119
- });
120
- });
121
- });
122
-
123
- describe('[Request::create] function test', () => {
124
- it('should return a new request', (done) => {
125
- cw4.request.create({ProblemSid: 309}).then(resp => {
126
- assert.equal(resp.ProblemSid, 309);
127
- done();
128
- }).catch(e => {
129
- console.log(e);
130
- });
131
- });
132
- });
133
-
134
- describe('[Request::update] function test', () => {
135
- it('should return the updated request', (done) => {
136
- cw4.request.update({RequestId: 1520672, Address: '1520 MARKET ST'}).then(resp => {
137
- assert.equal(resp.ProbAddress, '1520 MARKET ST');
138
- done();
139
- }).catch(e => {
140
- console.log(e);
141
- });
142
- });
143
- });
144
-
145
- describe('[Request::delete] function test', () => {
146
- it('should return a list of the deleted request ID(s)', (done) => {
147
- cw4.request.delete([1520677]).then(resp => { // TODO: Make this pull REQ, _then_ delete
148
- console.log(resp);
149
- done();
150
- }).catch(e => {
151
- console.log(e);
152
- });
153
- });
154
- });
155
-
156
- describe('[Request::cancel] function test', () => {
157
- it('should return the updated request(s)', (done) => {
158
- var ID = 1520676;
159
- cw4.request.cancel([ID]).then(resp => { // TODO: Make this pull REQ, _then_ delete
160
- expect(_.some(resp, { RequestId: ID })).to.be.true;
161
- done();
162
- }).catch(e => {
163
- console.log(e);
164
- });
165
- });
166
- });
167
-
168
- describe('[Request::uncancel] function test', () => {
169
- it('should return the updated request(s)', (done) => {
170
- var ID = 1520676;
171
- cw4.request.uncancel([ID]).then(resp => { // TODO: Make this pull REQ, _then_ delete
172
- expect(_.some(resp, { RequestId: ID })).to.be.true;
173
- done();
174
- }).catch(e => {
175
- console.log(e);
176
- });
177
- });
178
- });
179
-
180
- describe('[Request::close] function test', () => {
181
- it('should return the closed request(s)', (done) => {
182
- var ID = 1520675;
183
- cw4.request.close([ID]).then(resp => { // TODO: Make this pull REQ, _then_ delete
184
- expect(_.some(resp, { RequestId: ID })).to.be.true;
185
- done();
186
- }).catch(e => {
187
- console.log(e);
188
- });
189
- });
190
- });
191
-
192
- describe('[Request::reopen] function test', () => {
193
- it('should return the reopened request(s)', (done) => {
194
- var ID = 1520675;
195
- cw4.request.reopen([ID]).then(resp => { // TODO: Make this pull REQ, _then_ delete
196
- expect(_.some(resp, { RequestId: ID })).to.be.true;
197
- done();
198
- }).catch(e => {
199
- console.log(e);
200
- });
201
- });
202
- });
203
-
204
- describe('[Request::comment.add] function test', () => {
205
- it('should return the reopened request(s)', (done) => {
206
- var ID = 1520675;
207
- var comment = 'New comment on ' + Date().toString() + '.';
208
- cw4.request.comment.add(ID, comment).then(resp => {
209
- assert.equal(resp.Comments, comment);
210
- done();
211
- }).catch(e => {
212
- console.log(e);
213
- });
214
- });
215
- });
216
-
217
- describe('[Request::comment.update] function test', () => {
218
- it('should return the reopened request(s)', (done) => {
219
- var ID = 1636877;
220
- var comment = 'Updated this comment on ' + Date().toString() + '.';
221
- cw4.request.comment.update(ID, comment).then(resp => {
222
- assert.equal(resp.Comments, comment);
223
- done();
224
- }).catch(e => {
225
- console.log(e);
226
- });
227
- });
228
- });
229
-
230
- describe('[Request::comment.get] function test', () => {
231
- it('should return the comments for the request', (done) => {
232
- var ID = 1520675;
233
- cw4.request.comment.get([ID]).then(resp => {
234
- console.log(resp[ID]);
235
- assert.isArray(resp);
236
- done();
237
- }).catch(e => {
238
- console.log(e);
239
- });
240
- });
241
- });
242
-
243
-
244
- describe('[Request::comment.getPredefined] function test', () => {
245
- it('should return the comments for the activity type', (done) => {
246
- cw4.request.comment.getPredefined(738).then(resp => {
247
- assert.isArray(resp);
248
- done();
249
- }).catch(e => {
250
- console.log(e);
251
- });
252
- });
253
- });
254
-
255
- // describe('[Request::comment.getForActivityList] function test', () => {
256
- // it('should return the comments for the activity type', (done) => {
257
- // cw4.request.comment.getForActivityList().then(resp => {
258
- // console.log(resp);
259
- // // assert.isArray(resp);
260
- // done();
261
- // }).catch(e => {
262
- // console.log(e);
263
- // });
264
- // });
265
- // });
266
-
267
- describe('[Request::changeProblem] function test', () => {
268
-
269
- });
270
-
271
- describe('[Request::changeCustomFieldCategory] function test', () => {
272
-
273
- });
274
-
275
- describe('[Request::getAuditLog] function test', () => {
276
-
277
- });
278
-
279
- describe('[Request::getById] function test', () => {
280
-
281
- });
282
-
283
- describe('[Request::getByIds] function test', () => {
284
-
285
- });
286
-
287
- describe('[Request::getCustomFields] function test', () => {
288
-
289
- });
290
-
291
- describe('[Request::createSearchDefinition] function test', () => {
292
-
293
- });
@@ -1,110 +0,0 @@
1
- 'use strict';
2
- require('dotenv').config();
3
- var expect = require('chai').expect;
4
- var assert = require('chai').assert;
5
- var Cityworks = require('../dist/index.js');
6
- var cw5 = new Cityworks(process.env.domain, {path: process.env.path});
7
- const _ = require('lodash')
8
-
9
- before(function(done) {
10
- this.timeout(20000000);
11
- cw5.authenticate(process.env.login, process.env.password).then(r => {
12
- done();
13
- }).catch(e => {
14
- console.log(e, 'unexpected error')
15
- done();
16
- });
17
- });
18
-
19
- describe('[Case (construct)] function test', () => {
20
- it('should be a defined object', (done) => {
21
- assert.isObject(cw5.case, 'Case is an object');
22
- done();
23
- });
24
- it('should have an financial property which is a defined object', (done) => {
25
- assert.isObject(cw5.case.financial, 'Financial is an object');
26
- done();
27
- });
28
- it('should have an data property which is a defined object', (done) => {
29
- assert.isObject(cw5.case.data, 'Financial is an object');
30
- done();
31
- });
32
- it('should have an workflow property which is a defined object', (done) => {
33
- assert.isObject(cw5.case.workflow, 'Financial is an object');
34
- done();
35
- });
36
- it('should have an comment property which is a defined object', (done) => {
37
- assert.isObject(cw5.case.comment, 'Financial is an object');
38
- done();
39
- });
40
- it('should have an admin property which is a defined object', (done) => {
41
- assert.isObject(cw5.case.admin, 'Financial is an object');
42
- done();
43
- });
44
- });
45
-
46
- describe('[Case::create] function test', () => {
47
- it('should resolve an object describing the new case', (done) => {
48
- cw5.case.create(51, 93).then(r => {
49
- assert.isObject(r);
50
- done();
51
- });
52
- });
53
- it('should resolve null if case type/subtype do not exist', (done) => {
54
- cw5.case.create(999999, 99999999).then(r => {
55
- assert.isNull(r);
56
- done();
57
- }).catch(e => {
58
- console.log(e, 'unexpected error')
59
- done();
60
- });
61
- });
62
- });
63
-
64
- describe('[Case::createChild] function test', () => {
65
- it('should resolve an object describing the new case', (done) => {
66
- });
67
- });
68
-
69
- describe('[Case::createFromRequest] function test', () => {
70
- it('should resolve an object describing the new case', (done) => {
71
- });
72
- });
73
-
74
- describe('[Case::update] function test', () => {
75
- it('should resolve an object describing the updated case', (done) => {
76
- });
77
- });
78
-
79
- describe('[Case::getByIds] function test', () => {
80
- it('should resolve a collection of case objects', (done) => {
81
- });
82
- });
83
-
84
- describe('[Case::search] function test', () => {
85
- it('should resolve a collection of case objects meeting the search criteria', (done) => {
86
- });
87
- });
88
-
89
- describe('[Case::move] function test', () => {
90
- it('should resolve an object describing the moved case', (done) => {
91
- });
92
- });
93
-
94
- describe('[Case::delete] function test', () => {
95
- it('should resolve a 1 (success) or 0 (failure)', (done) => {
96
- cw5.case.delete(44069).then(rez => {
97
- expect(rez).to.satisfy(function (deletionSwitch) {
98
- if (deletionSwitch===1 || deletionSwitch===0) {
99
- return true;
100
- } else {
101
- return false;
102
- }
103
- });
104
- done();
105
- }).catch(e => {
106
- console.log(e, 'unexpected error')
107
- done();
108
- });
109
- });
110
- });
@@ -1,172 +0,0 @@
1
- 'use strict';
2
- require('dotenv').config();
3
- var expect = require('chai').expect;
4
- var assert = require('chai').assert;
5
- var Cityworks = require('../dist/index.js');
6
- var cw6 = new Cityworks(process.env.domain, {path: process.env.path});
7
- const _ = require('lodash')
8
-
9
- before(function(done) {
10
- this.timeout(20000000);
11
- cw6.authenticate(process.env.login, process.env.password).then(resp => {
12
- done();
13
- }).catch(e => {
14
- console.log(e, 'unexpected error')
15
- done();
16
- });
17
- });
18
-
19
- describe('[CaseFinancial (construct)] function test', () => {
20
- it('should be a defined object', (done) => {
21
- assert.isObject(cw6.case.financial, 'Request is an object');
22
- done();
23
- });
24
- });
25
-
26
- describe('[CaseFinancial::getFees] function test', () => {
27
- it('should resolve a collection of case fees', (done) => {
28
- cw6.case.financial.getFees(16086).then(r => { // TODO: find case, then get fees
29
- assert.isArray(r);
30
- done();
31
- });
32
- });
33
- });
34
-
35
- describe('[CaseFinancial::addFee] function test', () => {
36
- it('should resolve a fee object', (done) => {
37
- cw6.case.financial.addFee(16085, 183, {AutoRecalculate: 'Y', Amount: 9}).then(r => { // TODO: find case, then get fees
38
- assert.isNumber(r.CaFeeId);
39
- done();
40
- });
41
- });
42
- });
43
-
44
- describe('[CaseFinancial::addDefaultFees] function test', () => {
45
- it('should resolve a ', (done) => {
46
- cw6.case.financial.addDefaultFees(42337, 152).then(r => { // TODO: find case, then get fees
47
- assert.isArray(r);
48
- done();
49
- }).catch(e => {
50
- console.log(e, e)
51
- })
52
- });
53
- });
54
-
55
- describe('[CaseFinancial::updateFee] function test', () => {
56
- it('should resolve a fee object with the updated amount', (done) => {
57
- var newAmount = ((Math.random()*100)*8).toFixed(2);
58
- cw6.case.financial.updateFee(18480, {Amount: newAmount}).then(r => { // TODO: find case, then get fees
59
- assert.equal(r.Amount, newAmount);
60
- done();
61
- });
62
- });
63
- });
64
-
65
- describe('[CaseFinancial::getAllFeeTemplates] function test', () => {
66
- it('should resolve a collection of all fee templates', (done) => {
67
- cw6.case.financial.getAllFeeTemplates().then(r => {
68
- assert.isArray(r);
69
- done();
70
- });
71
- });
72
- });
73
-
74
- describe('[CaseFinancial::searchFeeTemplates] function test', () => {
75
- it('should resolve a collection of case fees with interest in the name', (done) => {
76
- cw6.case.financial.searchFeeTemplates({FeeDesc: 'interest'}).then(r => {
77
- assert.isArray(r);
78
- done();
79
- }).catch(e => {
80
- console.log(e, 'e')
81
- })
82
- });
83
- });
84
-
85
- describe('[CaseFinancial::searchCaseInstruments] function test', () => {
86
- it('should resolve a collection of case instruments with MO in the state code', (done) => {
87
- cw6.case.financial.searchCaseInstruments({StateCode: 'MO'}).then(r => {
88
- assert.isArray(r);
89
- done();
90
- }).catch(e => {
91
- console.log(e, 'e')
92
- })
93
- });
94
- });
95
-
96
- describe('[CaseFinancial::getInstrumentList] function test', () => {
97
- it('should resolve a collection of instruments', (done) => {
98
- cw6.case.financial.getInstrumentList().then(r => {
99
- expect(r).to.satisfy(function (iLA) {
100
- if (iLA===null || _.isArray(iLA)) {
101
- return true;
102
- } else {
103
- return false;
104
- }
105
- });
106
- done();
107
- }).catch(e => {
108
- console.log(e, 'e')
109
- })
110
- });
111
- });
112
-
113
-
114
- describe('[CaseFinancial::addCaseInstrumentRelease] function test', () => {
115
- it('should resolve an object with the new case instrument releases\' info');
116
- });
117
-
118
- describe('[CaseFinancial::deleteCaseInstrumentRelease] function test', () => {
119
- it('should resolve an object with the deleted case instrument releases\' info');
120
- });
121
-
122
- describe('[CaseFinancial::searchCaseInstrumentReleases] function test', () => {
123
- it('should resolve a collection of case instrument releases which meet the search critera', (done) => {
124
- cw6.case.financial.searchCaseInstrumentReleases({PercentReleased: '100'}).then(r => {
125
- assert.isArray(r);
126
- done();
127
- }).catch(e => {
128
- console.log(e, 'e')
129
- })
130
- });
131
- });
132
-
133
- describe('[CaseFinancial::fees] function test', () => {
134
- it('should resolve a collection of all fees configured', (done) => {
135
- cw6.case.financial.fees().then(r => {
136
- assert.isArray(r);
137
- done();
138
- }).catch(e => {
139
- console.log(e, 'e')
140
- })
141
- });
142
- });
143
-
144
- describe('[CaseFinancial::searchAvailableFees] function test', () => {
145
- it('should resolve an array of fee IDs which meet the specified search criteria', (done) => {
146
- cw6.case.financial.searchAvailableFees({FeeCode: 'F-'}).then(r => {
147
- assert.isArray(r);
148
- done();
149
- }).catch(e => {
150
- console.log(e, 'e')
151
- })
152
- });
153
- });
154
-
155
- describe('[CaseFinancial::getTenderTypes] function test', () => {
156
- it('should resolve a collection of all tender types configured', (done) => {
157
- cw6.case.financial.getTenderTypes().then(r => {
158
- assert.isArray(r);
159
- done();
160
- }).catch(e => {
161
- console.log(e, 'e')
162
- })
163
- });
164
- });
165
-
166
- describe('[CaseFinancial::addTenderType] function test', () => {
167
- it('should resolve an object with the new tender type\'s info');
168
- });
169
-
170
- describe('[CaseFinancial::updateTenderType] function test', () => {
171
- it('should resolve an object with the details of the updated tender type');
172
- });