@things-factory/shell 6.2.34 → 6.2.42

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@things-factory/shell",
3
- "version": "6.2.34",
3
+ "version": "6.2.42",
4
4
  "description": "Core module for framework",
5
5
  "bin": {
6
6
  "things-factory": "bin/things-factory",
@@ -61,6 +61,7 @@
61
61
  "@operato/utils": "^1.0.1",
62
62
  "@things-factory/ejs-remote": "^6.2.33",
63
63
  "@things-factory/env": "^6.2.33",
64
+ "@things-factory/operato-license-checker": "^4.0.4",
64
65
  "@things-factory/styles": "^6.2.33",
65
66
  "@things-factory/utils": "^6.2.33",
66
67
  "@webcomponents/webcomponentsjs": "^2.6.0",
@@ -132,5 +133,5 @@
132
133
  "pg": "^8.7.3",
133
134
  "sqlite3": "^5.0.8"
134
135
  },
135
- "gitHead": "c1bf972f4b3b088638923bbf62badb572e1e6401"
136
+ "gitHead": "cc76b5c3dea6a88d4381e914eeaaff9e102e672d"
136
137
  }
@@ -1,5 +1,6 @@
1
1
  import Router from 'koa-router'
2
2
 
3
+ import { getLicenseInfo } from '@things-factory/operato-license-checker'
3
4
  import { domainMiddleware } from '../middlewares/domain-middleware'
4
5
 
5
6
  var crawler = require('npm-license-crawler')
@@ -24,7 +25,12 @@ globalPublicRouter.get('/dependencies', async (context, next) => {
24
25
  await context.render('dependencies-view-graphviz', { model: dependencyGraph })
25
26
  })
26
27
 
27
- globalPublicRouter.get('/licenses', (context, next) => {
28
+ globalPublicRouter.get('/license-info', (context, next) => {
29
+ context.type = 'application/json'
30
+ context.body = getLicenseInfo()
31
+ })
32
+
33
+ globalPublicRouter.get('/opensource-licenses', (context, next) => {
28
34
  return new Promise(function (resolve, reject) {
29
35
  var options = {
30
36
  start: ['.'],
@@ -36,7 +42,7 @@ globalPublicRouter.get('/licenses', (context, next) => {
36
42
 
37
43
  crawler.dumpLicenses(options, function (error, res) {
38
44
  if (error) {
39
- console.error('get:/licenses', error)
45
+ console.error('get:/opensource-licenses', error)
40
46
  reject(error)
41
47
  } else {
42
48
  context.type = 'application/json'
@@ -26,6 +26,7 @@ import http from 'http'
26
26
  import koaWebpack from '@hatiolab/koa-webpack'
27
27
  import cors from '@koa/cors'
28
28
  import { config, loader, logger, orderedModuleNames } from '@things-factory/env'
29
+ import { initLicense, checkValidity } from '@things-factory/operato-license-checker'
29
30
 
30
31
  import { GraphqlLocalClient } from './graphql-local-client'
31
32
  import { databaseInitializer } from './initializers/database'
@@ -93,6 +94,8 @@ interface ICustomAppContext {
93
94
  ssoMiddlewares: any[]
94
95
  }
95
96
 
97
+ initLicense(config.get('licenseKey'))
98
+
96
99
  /* bootstrap */
97
100
  const bootstrap = async () => {
98
101
  await databaseInitializer()
@@ -259,6 +262,8 @@ const bootstrap = async () => {
259
262
  process.emit('bootstrap-module-domain-public-route' as any, app, domainPublicRouter)
260
263
  process.emit('bootstrap-module-domain-private-route' as any, app, domainPrivateRouter)
261
264
 
265
+ app.use(checkValidity) /* Check the license after most of the context has been built */
266
+
262
267
  app
263
268
  .use(globalPublicRouter.routes())
264
269
  .use(globalPublicRouter.allowedMethods())
package/server/server.ts CHANGED
@@ -25,6 +25,7 @@ import http from 'http'
25
25
 
26
26
  import cors from '@koa/cors'
27
27
  import { config, loader, logger, orderedModuleNames } from '@things-factory/env'
28
+ import { initLicense, checkValidity } from '@things-factory/operato-license-checker'
28
29
 
29
30
  import { GraphqlLocalClient } from './graphql-local-client'
30
31
  import { databaseInitializer } from './initializers/database'
@@ -68,6 +69,8 @@ const fileUploadOption = {
68
69
  maxFiles: fileUpload.maxFiles || 10
69
70
  }
70
71
 
72
+ initLicense(config.get('licenseKey'))
73
+
71
74
  /* bootstrap */
72
75
  const bootstrap = async () => {
73
76
  await databaseInitializer()
@@ -219,6 +222,8 @@ const bootstrap = async () => {
219
222
  process.emit('bootstrap-module-domain-public-route' as any, app, domainPublicRouter)
220
223
  process.emit('bootstrap-module-domain-private-route' as any, app, domainPrivateRouter)
221
224
 
225
+ app.use(checkValidity) /* Check the license after most of the context has been built */
226
+
222
227
  app
223
228
  .use(globalPublicRouter.routes())
224
229
  .use(globalPublicRouter.allowedMethods())