profoundjs-swagger-stats 1.1.4 → 2.0.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 (87) hide show
  1. package/CHANGELOG.md +64 -0
  2. package/dashboards/prometheus/swagger-stats dashboard v3.json +1269 -0
  3. package/examples/authtest/authtest.js +5 -10
  4. package/examples/fastify/fasifytest.js +24 -5
  5. package/examples/hapijstest/hapijstest.js +17 -2
  6. package/examples/restify/restifytest.js +16 -1
  7. package/examples/spectest/spectest.js +7 -9
  8. package/examples/testapp/petstore.json +1699 -0
  9. package/examples/testapp/testapp.js +6 -62
  10. package/lib/sws-api-swagger.yaml +1 -1
  11. package/lib/swsAPIStats.js +6 -1
  12. package/lib/swsAuth.js +140 -0
  13. package/lib/swsElasticEmitter.js +103 -45
  14. package/lib/swsHapi.js +29 -34
  15. package/lib/swsInterface.js +40 -189
  16. package/lib/swsProcessor.js +1 -1
  17. package/lib/swsReqResStats.js +1 -1
  18. package/lib/swsUtil.js +7 -21
  19. package/lib/swssettings.js +8 -2
  20. package/package.json +90 -91
  21. package/schema/elasticsearch/api_index_template.json +1 -1
  22. package/schema/elasticsearch/api_index_template_7x.json +185 -0
  23. package/scripts/elasticsearch/elastic7/docker-compose.yml +6 -17
  24. package/scripts/elasticsearch/elastic8/docker-compose.yml +34 -0
  25. package/ux/css/app.dc22c4da.css +7 -0
  26. package/ux/css/chunk-vendors.a6da6d7a.css +10 -0
  27. package/ux/fonts/KFOkCnqEu92Fr1MmgVxIIzQ.4aa2e698.woff +0 -0
  28. package/ux/fonts/KFOlCnqEu92Fr1MmEU9fBBc-.40bcb2b8.woff +0 -0
  29. package/ux/fonts/KFOlCnqEu92Fr1MmSU5fBBc-.ea60988b.woff +0 -0
  30. package/ux/fonts/KFOlCnqEu92Fr1MmWUlfBBc-.0774a8b7.woff +0 -0
  31. package/ux/fonts/KFOlCnqEu92Fr1MmYUtfBBc-.bcb7c7e2.woff +0 -0
  32. package/ux/fonts/KFOmCnqEu92Fr1Mu4mxM.d3907d0c.woff +0 -0
  33. package/ux/fonts/fa-brands-400.1a575a41.woff +0 -0
  34. package/ux/fonts/fa-brands-400.ed311c7a.woff2 +0 -0
  35. package/ux/fonts/fa-regular-400.b91d376b.woff2 +0 -0
  36. package/ux/fonts/fa-regular-400.d1d7e3b4.woff +0 -0
  37. package/ux/fonts/fa-solid-900.d745348d.woff +0 -0
  38. package/ux/fonts/fa-solid-900.d824df7e.woff2 +0 -0
  39. package/ux/fonts/flUhRq6tzZclQEJ-Vdg-IuiaDsNa.3e1afe59.woff +0 -0
  40. package/ux/fonts/flUhRq6tzZclQEJ-Vdg-IuiaDsNcIhQ8tQ.a4160421.woff2 +0 -0
  41. package/ux/index.html +1 -1
  42. package/ux/js/app.d095d0d6.js +1 -0
  43. package/ux/js/chunk-2d0b90b4.afe783bc.js +8 -0
  44. package/ux/js/chunk-2d0daf1e.a05fda31.js +11 -0
  45. package/ux/js/chunk-461883cd.a2aa4876.js +82 -0
  46. package/ux/js/chunk-vendors.4f167dc9.js +39 -0
  47. package/ux/logo.png +0 -0
  48. package/.editorconfig +0 -21
  49. package/.travis.yml +0 -23
  50. package/dashboards/prometheus/swagger-stats dashboard.json +0 -1118
  51. package/dist/css/sws.min.css +0 -18
  52. package/dist/fonts/FontAwesome.otf +0 -0
  53. package/dist/fonts/fontawesome-webfont.eot +0 -0
  54. package/dist/fonts/fontawesome-webfont.svg +0 -2671
  55. package/dist/fonts/fontawesome-webfont.ttf +0 -0
  56. package/dist/fonts/fontawesome-webfont.woff +0 -0
  57. package/dist/fonts/fontawesome-webfont.woff2 +0 -0
  58. package/dist/fonts/glyphicons-halflings-regular.eot +0 -0
  59. package/dist/fonts/glyphicons-halflings-regular.svg +0 -288
  60. package/dist/fonts/glyphicons-halflings-regular.ttf +0 -0
  61. package/dist/fonts/glyphicons-halflings-regular.woff +0 -0
  62. package/dist/fonts/glyphicons-halflings-regular.woff2 +0 -0
  63. package/dist/images/favicon.png +0 -0
  64. package/dist/js/sws.min.js +0 -1
  65. package/gulpfile.js +0 -103
  66. package/karma.conf.js +0 -153
  67. package/ux/css/app.71245b0e.css +0 -7
  68. package/ux/css/chunk-vendors.809c52d1.css +0 -10
  69. package/ux/fonts/KFOkCnqEu92Fr1MmgVxIIzQ.5cb7edfc.woff +0 -0
  70. package/ux/fonts/KFOlCnqEu92Fr1MmEU9fBBc-.87284894.woff +0 -0
  71. package/ux/fonts/KFOlCnqEu92Fr1MmSU5fBBc-.b00849e0.woff +0 -0
  72. package/ux/fonts/KFOlCnqEu92Fr1MmWUlfBBc-.adcde98f.woff +0 -0
  73. package/ux/fonts/KFOlCnqEu92Fr1MmYUtfBBc-.bb1e4dc6.woff +0 -0
  74. package/ux/fonts/KFOmCnqEu92Fr1Mu4mxM.60fa3c06.woff +0 -0
  75. package/ux/fonts/fa-brands-400.c5e0f14f.woff +0 -0
  76. package/ux/fonts/fa-brands-400.cccc9d29.woff2 +0 -0
  77. package/ux/fonts/fa-regular-400.c4f508e7.woff +0 -0
  78. package/ux/fonts/fa-regular-400.f5f2566b.woff2 +0 -0
  79. package/ux/fonts/fa-solid-900.333bae20.woff +0 -0
  80. package/ux/fonts/fa-solid-900.44d537ab.woff2 +0 -0
  81. package/ux/fonts/flUhRq6tzZclQEJ-Vdg-IuiaDsNa.29b882f0.woff +0 -0
  82. package/ux/fonts/flUhRq6tzZclQEJ-Vdg-IuiaDsNcIhQ8tQ.0509ab09.woff2 +0 -0
  83. package/ux/js/app.0159ef6a.js +0 -1
  84. package/ux/js/chunk-2d0b90b4.92f1ea49.js +0 -8
  85. package/ux/js/chunk-461883cd.442efb25.js +0 -76
  86. package/ux/js/chunk-vendors.31d3ce30.js +0 -33
  87. /package/ux/js/{chunk-2d0de2f2.553bf976.js → chunk-2d0de2f2.2848649c.js} +0 -0
package/gulpfile.js DELETED
@@ -1,103 +0,0 @@
1
- var gulp = require('gulp'),
2
- gp_concat = require('gulp-concat'),
3
- gp_rename = require('gulp-rename'),
4
- gp_uglify = require('gulp-uglify');
5
- gp_minify = require('gulp-minify');
6
- // gp_sourcemaps = require('gulp-sourcemaps');
7
- cssBase64 = require('gulp-css-base64');
8
- cleanCSS = require('gulp-clean-css');
9
- concatCSS = require('gulp-concat-css');
10
- var del = require('del');
11
-
12
- var jsFiles = [
13
- "./node_modules/jquery/dist/jquery.min.js",
14
- "./node_modules/bootstrap/dist/js/bootstrap.min.js",
15
- "./ui/plugins/datatables/datatables.min.js",
16
- "./node_modules/chart.js/dist/Chart.bundle.min.js",
17
- "./node_modules/moment/min/moment.min.js",
18
- "./ui/plugins/highlightjs/highlight.pack.js",
19
- "./ui/plugins/peity/jquery.peity.min.js",
20
- //"./ui/plugins/d3/d3.min.js",
21
- //"./ui/plugins/cubism/cubism.v1.js",
22
- "./node_modules/chosen-js/chosen.jquery.js",
23
- "./ui/swsLayout.js",
24
- "./ui/swsTable.js",
25
- "./ui/swsuiWidget.js",
26
- "./ui/swsuiChart.js",
27
- "./ui/swsApiOpSel.js",
28
- "./ui/sws.js"
29
- ];
30
-
31
- var cssFiles = [
32
- "./node_modules/bootstrap/dist/css/bootstrap.min.css",
33
- "./node_modules/font-awesome/css/font-awesome.min.css",
34
- "./ui/plugins/datatables/datatables.min.css",
35
- "./ui/plugins/highlightjs/github.css",
36
- "./node_modules/chosen-js/b64-chosen.css",
37
- "./ui/css/sws.css"
38
- ];
39
-
40
- var cssFilesBase64 = [
41
- "./node_modules/chosen-js/chosen.css"
42
- ];
43
-
44
- var fontFiles = [
45
- "./node_modules/bootstrap/dist/fonts/*.*",
46
- "./node_modules/font-awesome/fonts/*.*"
47
- ];
48
-
49
- var images = [
50
- "./ui/favicon.png"
51
- ];
52
-
53
-
54
- gulp.task("clean", function () {
55
- return del(['dist', 'ux']);
56
- });
57
-
58
- gulp.task("copyUX", function () {
59
- return gulp.src('./node_modules/swagger-stats-ux/dist/**/*')
60
- .pipe(gulp.dest('ux/'))
61
- });
62
-
63
- gulp.task('js-build', function(){
64
- return gulp.src(jsFiles)
65
- // .pipe(gp_sourcemaps.init())
66
- .pipe(gp_concat('sws.js'))
67
- .pipe(gp_uglify())
68
- .pipe(gp_rename('sws.min.js'))
69
- // .pipe(gp_sourcemaps.write('../maps'))
70
- .pipe(gulp.dest('dist/js/'));
71
- });
72
-
73
- gulp.task('css-base64', function(){
74
- return gulp.src(cssFilesBase64)
75
- .pipe(cssBase64())
76
- .pipe(gp_rename({prefix: "b64-"}))
77
- .pipe(gulp.dest(function(file) {
78
- return file.base;
79
- }));
80
- });
81
-
82
- //gulp.task('css-build', ['css-base64'], function(){
83
- gulp.task('css-build', gulp.series('css-base64', function(){
84
- return gulp.src(cssFiles)
85
- // .pipe(gp_sourcemaps.init())
86
- .pipe(concatCSS('sws.min.css', {rebaseUrls: false}))
87
- .pipe(cleanCSS())
88
- // .pipe(gp_sourcemaps.write('../maps'))
89
- .pipe(gulp.dest('dist/css/'));
90
- }));
91
-
92
- gulp.task('fonts', function() {
93
- return gulp.src(fontFiles)
94
- .pipe(gulp.dest('dist/fonts/'));
95
- });
96
-
97
- gulp.task('images', function() {
98
- return gulp.src(images)
99
- .pipe(gulp.dest('dist/images'));
100
- });
101
-
102
- //gulp.task('default', ['fonts','css-build','js-build'], function(){});
103
- gulp.task('default', gulp.series('clean', 'fonts', 'images', 'css-build', 'js-build', 'copyUX'));
package/karma.conf.js DELETED
@@ -1,153 +0,0 @@
1
- 'use strict';
2
-
3
- var fs = require('fs');
4
- var path = require('path');
5
- var express = require('express');
6
- var supertest = require('supertest');
7
- var debug = require('debug')('sws:karma');
8
-
9
- var appConfig = require('./test/karma.config');
10
-
11
- // Including swagger-stats module directly
12
- //var swStats = require('./lib/index');
13
-
14
- //process.env.DEBUG = "sws:*";
15
- process.env.SWS_AUTHTEST_MAXAGE = 60;
16
- process.env.SWS_SPECTEST_URL = './examples/authtest/petstore.yaml';
17
-
18
- var swsTestApp = require('./examples/authtest/authtest');
19
- var api = supertest('http://localhost:3050');
20
-
21
- /*
22
- api.get('/mockapi/v1/success')
23
- .set('x-sws-res','{"code":"200","message":"TEST","delay":"0","payloadsize":"0"}')
24
- .expect(200).end(function (err, res) {if (err) debug('Req error: ' + err); });
25
- api.get('/mockapi/v1/redirect')
26
- .set('x-sws-res','{"code":"302","message":"TEST","delay":"0","payloadsize":"0"}')
27
- .expect(302).end(function (err, res) {if (err) debug('Req error: ' + err); });
28
- api.get('/mockapi/v1/client_error')
29
- .set('x-sws-res','{"code":"404","message":"TEST","delay":"0","payloadsize":"0"}')
30
- .expect(404).end(function (err, res) {if (err) debug('Req error: ' + err); });
31
- api.get('/mockapi/v1/server_error')
32
- .set('x-sws-res','{"code":"500","message":"TEST","delay":"0","payloadsize":"0"}')
33
- .expect(500).end(function (err, res) {if (err) debug('Req error: ' + err); });
34
- */
35
-
36
- api.get('/v2/pet/findByTags')
37
- .set('x-sws-res','{"code":"200","message":"TEST","delay":"0","payloadsize":"0"}')
38
- .expect(200).end(function (err, res) {if (err) debug('Req error: ' + err); });
39
- api.get('/v2/pet/findByTags')
40
- .set('x-sws-res','{"code":"302","message":"TEST","delay":"0","payloadsize":"0"}')
41
- .expect(302).end(function (err, res) {if (err) debug('Req error: ' + err); });
42
- api.get('/v2/pet/findByTags')
43
- .set('x-sws-res','{"code":"404","message":"TEST","delay":"0","payloadsize":"0"}')
44
- .expect(404).end(function (err, res) {if (err) debug('Req error: ' + err); });
45
- api.get('/v2/pet/findByTags')
46
- .set('x-sws-res','{"code":"500","message":"TEST","delay":"0","payloadsize":"0"}')
47
- .expect(500).end(function (err, res) {if (err) debug('Req error: ' + err); });
48
-
49
- /*
50
- api.get('/api/v1/redirect').expect(302).end(function (err, res) {if (err) debug('Req error: ' + err); });
51
- api.get('/api/v1/client_error').expect(404).end(function (err, res) {if (err) debug('Req error: ' + err); });
52
- api.get('/api/v1/server_error').expect(500).end(function (err, res) {if (err) debug('Req error: ' + err); });
53
- */
54
-
55
- module.exports = function(config) {
56
- config.set({
57
-
58
- // base path that will be used to resolve all patterns (eg. files, exclude)
59
- basePath: '',
60
-
61
-
62
- // frameworks to use
63
- // available frameworks: https://npmjs.org/browse/keyword/karma-adapter
64
- frameworks: ['mocha', 'chai', 'fixture'],
65
-
66
- // list of files / patterns to load in the browser
67
- files: [
68
- 'node_modules/jquery/dist/jquery.min.js',
69
- 'node_modules/bootstrap/dist/js/bootstrap.min.js',
70
- 'node_modules/chart.js/dist/Chart.bundle.min.js',
71
- 'node_modules/moment/min/moment.min.js',
72
- 'node_modules/chosen-js/chosen.jquery.js',
73
- 'ui/plugins/datatables/datatables.min.js',
74
- 'ui/plugins/highlightjs/highlight.pack.js',
75
- 'ui/plugins/peity/jquery.peity.min.js',
76
- 'ui/swsLayout.js',
77
- 'ui/swsTable.js',
78
- 'ui/swsuiWidget.js',
79
- 'ui/swsuiChart.js',
80
- 'ui/swsApiOpSel.js',
81
- 'ui/sws.js',
82
- './test/ui/*.js',
83
- './test/ui/*.html'
84
- ],
85
-
86
-
87
- // list of files to exclude
88
- exclude: [
89
- ],
90
-
91
- // preprocess matching files before serving them to the browser
92
- // available preprocessors:
93
- // https://npmjs.org/browse/keyword/karma-preprocessor
94
- preprocessors: appConfig.karma.preprocessors,
95
-
96
-
97
- // test results reporter to use
98
- // possible values: 'dots', 'progress'
99
- // available reporters: https://npmjs.org/browse/keyword/karma-reporter
100
- reporters: appConfig.karma.reporters,
101
-
102
- coverageReporter: {
103
- dir : 'coverage/',
104
- reporters: [
105
- { type: 'lcov' },
106
- { type: 'text' },
107
- { type: 'json' }
108
- ]
109
- },
110
-
111
- // web server port
112
- port: 9876,
113
-
114
- urlRoot: '/swagger-stats',
115
-
116
- proxies: {
117
- '/swagger-stats/stats': 'http://localhost:3050/swagger-stats/stats',
118
- '/swagger-stats/dist': 'http://localhost:3050/swagger-stats/dist',
119
- '/swagger-stats/logout': 'http://localhost:3050/swagger-stats/logout'
120
- },
121
-
122
- // enable / disable colors in the output (reporters and logs)
123
- colors: true,
124
-
125
- // level of logging
126
- // possible values: config.LOG_DISABLE || config.LOG_ERROR ||
127
- // config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
128
- logLevel: config.LOG_INFO,
129
-
130
-
131
- // enable / disable watching file and executing tests
132
- // whenever any file changes
133
- autoWatch: appConfig.karma.autoWatch,
134
-
135
-
136
- // start these browsers
137
- // available browser launchers:
138
- // https://npmjs.org/browse/keyword/karma-launcher
139
- browsers: appConfig.karma.browsers,
140
-
141
-
142
- browserConsoleLogOptions: {
143
- level: 'log',
144
- terminal: false
145
- },
146
-
147
- browserNoActivityTimeout: 60000,
148
-
149
- // Continuous Integration mode
150
- // if true, Karma captures browsers, runs the tests and exits
151
- singleRun: appConfig.karma.singleRun
152
- });
153
- };