@manyos/smileconnect-api 1.28.0

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 (141) hide show
  1. package/.github/workflows/nodejs.yml +26 -0
  2. package/CHANGELOG.md +75 -0
  3. package/Dockerfile +21 -0
  4. package/README.md +1 -0
  5. package/app.js +316 -0
  6. package/conf/clients.json +2491 -0
  7. package/conf/mapping.json +1048 -0
  8. package/conf/scripts/p1.js +11 -0
  9. package/conf/scripts/p2.js +1 -0
  10. package/conf/scripts/p3.js +1 -0
  11. package/conf/scripts/p4.js +2 -0
  12. package/conf/scripts/script1.js +2 -0
  13. package/conf/scripts/script2.js +2 -0
  14. package/conf/scripts/script3.js +2 -0
  15. package/controller/cmdbobjectController.js +291 -0
  16. package/controller/eventLogController.js +78 -0
  17. package/controller/orgdataController.js +440 -0
  18. package/controller/relatedObjectsController.js +194 -0
  19. package/controller/scriptController.js +213 -0
  20. package/controller/taskController.js +368 -0
  21. package/controller/templateController.js +97 -0
  22. package/controller/ticketCIRelationController.js +522 -0
  23. package/controller/ticketController.js +329 -0
  24. package/controller/ticketWorkLogController.js +195 -0
  25. package/docs/.gitattributes +48 -0
  26. package/docs/404.html +13 -0
  27. package/docs/CNAME +1 -0
  28. package/docs/Gemfile +7 -0
  29. package/docs/Gemfile.lock +249 -0
  30. package/docs/_config.yml +257 -0
  31. package/docs/_data/SocialNetworks.yml +92 -0
  32. package/docs/_data/ui-text.yml +494 -0
  33. package/docs/_includes/disqus.html +17 -0
  34. package/docs/_includes/ext-css.html +7 -0
  35. package/docs/_includes/ext-js.html +7 -0
  36. package/docs/_includes/fb-comment.html +14 -0
  37. package/docs/_includes/footer-minimal.html +16 -0
  38. package/docs/_includes/footer-scripts.html +32 -0
  39. package/docs/_includes/footer.html +51 -0
  40. package/docs/_includes/google_analytics.html +14 -0
  41. package/docs/_includes/gtag.html +11 -0
  42. package/docs/_includes/gtm_body.html +6 -0
  43. package/docs/_includes/gtm_head.html +9 -0
  44. package/docs/_includes/head.html +131 -0
  45. package/docs/_includes/header.html +76 -0
  46. package/docs/_includes/just_comments.html +4 -0
  47. package/docs/_includes/matomo.html +17 -0
  48. package/docs/_includes/nav.html +57 -0
  49. package/docs/_includes/social-share.html +42 -0
  50. package/docs/_includes/staticman-comment.html +22 -0
  51. package/docs/_includes/staticman-comments.html +81 -0
  52. package/docs/_layouts/base.html +35 -0
  53. package/docs/_layouts/default.html +9 -0
  54. package/docs/_layouts/minimal.html +26 -0
  55. package/docs/_layouts/page.html +26 -0
  56. package/docs/_layouts/post.html +82 -0
  57. package/docs/_posts/2015-02-28-test-markdown.md +77 -0
  58. package/docs/aboutme.md +18 -0
  59. package/docs/css/bootstrap-social.css +147 -0
  60. package/docs/css/bootstrap-theme.css +476 -0
  61. package/docs/css/bootstrap-theme.css.map +1 -0
  62. package/docs/css/bootstrap-theme.min.css +5 -0
  63. package/docs/css/bootstrap.css +6566 -0
  64. package/docs/css/bootstrap.css.map +1 -0
  65. package/docs/css/bootstrap.min.css +5 -0
  66. package/docs/css/main-minimal.css +13 -0
  67. package/docs/css/main.css +788 -0
  68. package/docs/css/normalize.css +427 -0
  69. package/docs/css/pygment_highlights.css +61 -0
  70. package/docs/css/staticman.css +180 -0
  71. package/docs/eventlog/events.md +65 -0
  72. package/docs/feed.xml +24 -0
  73. package/docs/general/architecture.md +10 -0
  74. package/docs/general/config.md +192 -0
  75. package/docs/general/field-management.md +119 -0
  76. package/docs/general/release-notes.md +9 -0
  77. package/docs/getting-started.md +19 -0
  78. package/docs/howto/cmdbobjects.md +339 -0
  79. package/docs/howto/incident-worklogs.md +186 -0
  80. package/docs/howto/incidents.md +244 -0
  81. package/docs/howto/sample-config.md +518 -0
  82. package/docs/howto/token.md +71 -0
  83. package/docs/howto/worklog-attachment.md +113 -0
  84. package/docs/img/404-southpark.jpg +0 -0
  85. package/docs/img/architecture.jpeg +0 -0
  86. package/docs/img/attachment-upload.png +0 -0
  87. package/docs/img/avatar-icon.png +0 -0
  88. package/docs/img/bgimage.png +0 -0
  89. package/docs/img/gb-isapi.jpg +0 -0
  90. package/docs/img/install-steps.gif +0 -0
  91. package/docs/img/workflow.png +0 -0
  92. package/docs/index.md +41 -0
  93. package/docs/installation.md +123 -0
  94. package/docs/js/bootstrap.js +2306 -0
  95. package/docs/js/bootstrap.min.js +7 -0
  96. package/docs/js/jquery-1.11.2.min.js +4 -0
  97. package/docs/js/main.js +140 -0
  98. package/docs/js/staticman.js +54 -0
  99. package/docs/openapi.json +15097 -0
  100. package/docs/postinstall.md +169 -0
  101. package/docs/preinstall.md +19 -0
  102. package/docs/spec/index.html +24 -0
  103. package/docs/staticman.yml +110 -0
  104. package/docs/tags.html +34 -0
  105. package/docs/workflow.md +127 -0
  106. package/nodemon.json +3 -0
  107. package/package.json +46 -0
  108. package/routes/appConfigRoutes.js +352 -0
  109. package/routes/ciRelationRoutes.js +38 -0
  110. package/routes/cmdbObjectRoutes.js +154 -0
  111. package/routes/organisationRoutes.js +121 -0
  112. package/routes/peopleRelationRoutes.js +38 -0
  113. package/routes/personRoutes.js +131 -0
  114. package/routes/supportgroupRoutes.js +122 -0
  115. package/routes/taskRoutes.js +306 -0
  116. package/routes/templateRoutes.js +67 -0
  117. package/routes/ticketRoutes.js +181 -0
  118. package/routes/ticketWorkLogRoutes.js +185 -0
  119. package/screwdriver.yaml +52 -0
  120. package/test/appTest.js +3 -0
  121. package/test/changeTest.js +541 -0
  122. package/test/cmdbobjectTest.js +167 -0
  123. package/test/files/logo.png +0 -0
  124. package/test/incidentTest.js +539 -0
  125. package/test/orgdataTest.js +156 -0
  126. package/test/problemTest.js +512 -0
  127. package/test/templateTest.js +80 -0
  128. package/test/testUtils.js +21 -0
  129. package/test/workorderTest.js +544 -0
  130. package/util/arquery.js +416 -0
  131. package/util/auth.js +37 -0
  132. package/util/cache.service.js +52 -0
  133. package/util/config.js +361 -0
  134. package/util/constants.js +73 -0
  135. package/util/mappingUtil.js +96 -0
  136. package/util/paramHelper.js +43 -0
  137. package/util/relationUtil.js +63 -0
  138. package/util/responsehandler.js +92 -0
  139. package/util/schemas/clientConfigSchema.js +180 -0
  140. package/util/schemas/fieldMappingSchema.js +211 -0
  141. package/util/searchUtil.js +148 -0
@@ -0,0 +1,167 @@
1
+ const assert = require('chai').assert;
2
+ let chai = require('chai');
3
+ let chaiHttp = require('chai-http');
4
+ let should = chai.should();
5
+ let server = require('../app');
6
+ const TestUtils = require('./testUtils')
7
+ require('dotenv').config();
8
+
9
+ //Integrations Tests here
10
+
11
+ chai.use(chaiHttp);
12
+
13
+ describe('Integration Tests - CMDBObject', function () {
14
+
15
+ let authUser = {'id':process.env.TEST_ID, 'secret':process.env.TEST_SECRET};
16
+
17
+ before((done) => {
18
+
19
+ // Authenticate the user to get a token
20
+ TestUtils.authenticateUser(authUser, server)
21
+ .then((accessToken) => {
22
+ // Keep the token on the user so we can use it in the tests
23
+ authUser.access_token = accessToken;
24
+ return done();
25
+ })
26
+ .catch((err) => done(err));
27
+ });
28
+
29
+ describe('GET CMDBObjects', function () {
30
+ it ('it should get all cmdbobjects', function (done) {
31
+ this.timeout(300000);
32
+ chai.request(server)
33
+ .get('/v1/cmdbobjects')
34
+ .set('Authorization', 'Bearer ' + authUser.access_token)
35
+ .end(function(err, res) {
36
+ res.should.have.status(200);
37
+ res.body.data.should.be.a('array');
38
+ res.body.data.length.should.be.above(0);
39
+ done();
40
+ })
41
+ })
42
+
43
+ it ('it should get all cmdbobjects by category', function (done) {
44
+ this.timeout(30000);
45
+ chai.request(server)
46
+ .get('/v1/cmdbobjects?category=Hardware')
47
+ .set('Authorization', 'Bearer ' + authUser.access_token)
48
+ .end(function(err, res) {
49
+ res.should.have.status(200);
50
+ res.body.data.should.be.a('array');
51
+ res.body.data.length.should.be.above(0);
52
+ done();
53
+ })
54
+ })
55
+
56
+ it ('it should get cmdbobjects by ids', function (done) {
57
+ this.timeout(5000);
58
+ chai.request(server)
59
+ .get('/v1/cmdbobjects?ciIds=OI-a2c843b3e3d14eeaa74dcefd4fdcf808, OI-94001f3f08b7415685fe72ec17f98f84')
60
+ .set('Authorization', 'Bearer ' + authUser.access_token)
61
+ .end(function(err, res) {
62
+ res.should.have.status(200);
63
+ res.body.data.should.be.a('array');
64
+ res.body.data.length.should.be.equal(2);
65
+ done();
66
+ })
67
+ })
68
+
69
+ it ('it should get cmdbobjects by category and ids', function (done) {
70
+ this.timeout(5000);
71
+ chai.request(server)
72
+ .get('/v1/cmdbobjects?category=Hardware&ciIds=OI-a2c843b3e3d14eeaa74dcefd4fdcf808, OI-94001f3f08b7415685fe72ec17f98f84')
73
+ .set('Authorization', 'Bearer ' + authUser.access_token)
74
+ .end(function(err, res) {
75
+ res.should.have.status(200);
76
+ res.body.data.should.be.a('array');
77
+ res.body.data.length.should.be.equal(2);
78
+ done();
79
+ })
80
+ })
81
+
82
+ it ('it should get a spezific cmdbobject by id', function (done) {
83
+ this.timeout(5000);
84
+ chai.request(server)
85
+ .get('/v1/cmdbobjects/OI-a2c843b3e3d14eeaa74dcefd4fdcf808')
86
+ .set('Authorization', 'Bearer ' + authUser.access_token)
87
+ .end(function(err, res) {
88
+ res.should.have.status(200);
89
+ res.body.data.should.be.an('object');
90
+ res.body.data.should.have.property('name');
91
+ res.body.data.should.have.property('id');
92
+ res.body.data.should.have.property('assetlifecycleStatus');
93
+ done();
94
+ })
95
+ })
96
+
97
+ it ('it should get a spezific cmdbobject by id with included objects', function (done) {
98
+ this.timeout(50000);
99
+ chai.request(server)
100
+ .get('/v1/cmdbobjects/OI-a2c843b3e3d14eeaa74dcefd4fdcf808?includeObjects=true')
101
+ .set('Authorization', 'Bearer ' + authUser.access_token)
102
+ .end(function(err, res) {
103
+ res.should.have.status(200);
104
+ res.body.data.should.be.an('object');
105
+ res.body.data.should.have.property('name');
106
+ res.body.data.should.have.property('id');
107
+ res.body.data.should.have.property('assetlifecycleStatus');
108
+
109
+ res.body.included.should.be.an('object');
110
+ res.body.included.should.have.property('persons');
111
+ res.body.included.persons.should.be.an('array');
112
+ res.body.included.persons.length.should.be.above(0);
113
+
114
+ res.body.included.should.have.property('organisations');
115
+ res.body.included.organisations.should.be.an('array');
116
+ res.body.included.organisations.length.should.be.above(0);
117
+
118
+ res.body.included.should.have.property('supportgroups');
119
+ res.body.included.supportgroups.should.be.an('array');
120
+ res.body.included.supportgroups.length.should.be.above(0);
121
+ done();
122
+ })
123
+ })
124
+
125
+ it ('it should search for cmdbobjects with included objects', function (done) {
126
+ this.timeout(50000);
127
+ chai.request(server)
128
+ .post('/v1/cmdbobjects/search?includeObjects=true')
129
+ .set('Authorization', 'Bearer ' + authUser.access_token)
130
+ .send({
131
+ "searchString":"'id'LIKE\"OI-a2c843b3e3d14eeaa74dcefd4fdcf808\"",
132
+ "getRelations":true
133
+ })
134
+ .end(function(err, res) {
135
+ res.should.have.status(200);
136
+ res.body.data.should.be.an('array');
137
+
138
+ res.body.included.should.be.an('object');
139
+ res.body.included.should.have.property('persons');
140
+ res.body.included.persons.should.be.an('array');
141
+ res.body.included.persons.length.should.be.above(0);
142
+
143
+ res.body.included.should.have.property('organisations');
144
+ res.body.included.organisations.should.be.an('array');
145
+ res.body.included.organisations.length.should.be.above(0);
146
+
147
+ res.body.included.should.have.property('supportgroups');
148
+ res.body.included.supportgroups.should.be.an('array');
149
+ res.body.included.supportgroups.length.should.be.above(0);
150
+ done();
151
+ })
152
+ })
153
+
154
+ /*it ('it should find cmdbobjects by name', function (done) {
155
+ this.timeout(5000);
156
+ chai.request(server)
157
+ .get('/v1/cmdbobjects/findByName?name=Hallo')
158
+ .set('Authorization', 'Bearer ' + authUser.access_token)
159
+ .end(function(err, res) {
160
+ res.should.have.status(200);
161
+ res.body.data.should.be.a('array');
162
+ res.body.data.length.should.be.above(0);
163
+ done();
164
+ })
165
+ })*/
166
+ })
167
+ })
Binary file