runlify 0.0.582 → 0.0.583

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.
@@ -5,9 +5,9 @@ var types_1 = require("../../../../../types");
5
5
  var utils_1 = require("../../../../../utils");
6
6
  var environmentIndexTmpl = function (options) {
7
7
  if (options === void 0) { options = types_1.defaultBootstrapEntityOptions; }
8
- return "import {exitHook} from './utils/exitHook';\nimport log from './log';\nimport {createContext} from './adm/services/context';\nimport express, {RequestHandler} from 'express';\nimport cors from 'cors';\nimport passport from 'passport';\nimport {json, raw} from 'body-parser';\nimport restRouter from './rest/restRouter';\nimport helmet from 'helmet';\nimport {initAdmPassport} from './adm/config/passport';".concat(options.usersEnabled ? "\nimport {initAppPassport} from './app/config/passport';\nimport appAuthRouter from './app/authRouter';\nimport getAppServer from './app/getAppServer';" : '', "\nimport admAuthRouter from './adm/authRouter';\nimport {graphqlUploadExpress} from 'graphql-upload';\nimport defaultContainer from './adm/services/defaultContainer';\nimport healthRouter from './rest/healthRouter';\nimport expressPlayground from 'graphql-playground-middleware-express';\nimport getAdmServer from './adm/getAdmServer';\nimport getMetricsHandler from './rest/getMetricsHandler';\n").concat(options.skipWarningThisIsGenerated
8
+ return "import log from './log';\nimport {createContext} from './adm/services/context';\nimport express from 'express';\nimport defaultContainer from './adm/services/defaultContainer';\nimport initEndpoints from './initEndpoints';\n".concat(options.skipWarningThisIsGenerated
9
9
  ? ''
10
- : "\n// ".concat(utils_1.generatedWarning, "\n"), "\nexitHook(() => createContext().then(ctx => ctx.close()));\n\nconst app = express();\n").concat(options.usersEnabled ? "\ninitAppPassport();" : '', "\ninitAdmPassport();\n\nconst production = process.env.NODE_ENV === 'production';\nlog.info(`production: ${production}`);\n\napp.use(cors());\napp.use(raw({limit: '50mb'}) as RequestHandler);\napp.use(json({limit: '1mb'}) as RequestHandler);\napp.use(\n helmet(\n {\n contentSecurityPolicy: production ? undefined : false,\n crossOriginEmbedderPolicy: production ? undefined : false,\n },\n ) as RequestHandler,\n);\napp.use(passport.initialize() as RequestHandler);\n").concat(options.usersEnabled ? "\napp.use('/app/rest', appAuthRouter);" : '', "\napp.use('/adm/rest', admAuthRouter);\n\napp.use('/rest', restRouter);\n\napp.use('/health', healthRouter);\n\nconst start = async () => {\n const ctx = await createContext(defaultContainer);\n\n app.get('/metrics', getMetricsHandler(ctx));\n\n app.use('/app/graph', passport.authenticate('appJwt', {session: false}));\n app.use('/app/graph', graphqlUploadExpress({maxFiles: 10, maxFileSize: 50 * 1024 * 1024}) as RequestHandler);\n").concat(options.usersEnabled ? "\n const appServer = getAppServer();\n await appServer.start();\n appServer.applyMiddleware({app, path: '/app/graph'});\n" : '', "\n const admServer = getAdmServer();\n\n const admGraphPath = '/adm/graph';\n app.use(admGraphPath, passport.authenticate('admJwt', {session: false}));\n app.use(admGraphPath, graphqlUploadExpress({maxFiles: 10, maxFileSize: 50 * 1024 * 1024}) as RequestHandler);\n await admServer.start();\n admServer.applyMiddleware({app, path: admGraphPath});\n\n ctx.service('stats').updateGauges();\n\n const port = 3000;\n const graphEndpoint = `http://localhost:${port}${admServer.graphqlPath}`;\n\n if (!production) {\n app.get(\n '/playground',\n expressPlayground({\n endpoint: graphEndpoint,\n }),\n );\n\n log.info(`\uD83D\uDE80 GraphQL playground at http://localhost:${port}/playground`);\n }\n\n app.listen({port}, () => {\n log.info(`\uD83D\uDE80 Server ready at ${graphEndpoint}`);\n });\n};\n\nstart().catch(error => {\n // eslint-disable-next-line no-console\n console.error(error);\n\n throw error;\n});\n");
10
+ : "\n// ".concat(utils_1.generatedWarning, "\n"), "\nconst app = express();\n\nconst start = async () => {\n const ctx = await createContext(defaultContainer);\n const port = 3000;\n\n const production = process.env.NODE_ENV === 'production';\n log.info(`production: ${production}`);\n\n const endpoints = await initEndpoints(app, ctx, port, production);\n\n app.listen({port}, () => {\n log.info('\n' + endpoints.map(e => `\uD83D\uDE80 Server ready at ${e}`).join('\n'));\n });\n};\n\nstart().catch(error => {\n // eslint-disable-next-line no-console\n console.error(error);\n\n throw error;\n});\n");
11
11
  };
12
12
  exports.environmentIndexTmpl = environmentIndexTmpl;
13
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi8uLi9zcmMvcHJvamVjdHNHZW5lcmF0aW9uL2dlbmVyYXRvcnMvZmlsZVRlbXBsYXRlcy9iYWNrL2Vudmlyb25tZW50L3NyYy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFBQSw4Q0FHNkI7QUFDN0IsOENBQXVEO0FBRWhELElBQU0sb0JBQW9CLEdBQUcsVUFDbEMsT0FBK0Q7SUFBL0Qsd0JBQUEsRUFBQSxVQUFrQyxxQ0FBNkI7SUFDNUQsT0FBQSw4WkFTbUQsT0FBTyxDQUFDLFlBQVksQ0FBQyxDQUFDLENBQUMseUpBR2hDLENBQUMsQ0FBQyxDQUFDLEVBQUUseVpBU2xELE9BQU8sQ0FBQywwQkFBMEI7UUFDaEMsQ0FBQyxDQUFDLEVBQUU7UUFDSixDQUFDLENBQUMsZUFDRCx3QkFBZ0IsT0FDcEIsb0dBS0MsT0FBTyxDQUFDLFlBQVksQ0FBQyxDQUFDLENBQUMsc0JBQ04sQ0FBQyxDQUFDLENBQUMsRUFBRSxtZkFrQnRCLE9BQU8sQ0FBQyxZQUFZLENBQUMsQ0FBQyxDQUFDLHdDQUNZLENBQUMsQ0FBQyxDQUFDLEVBQUUsa2NBY3hDLE9BQU8sQ0FBQyxZQUFZLENBQUMsQ0FBQyxDQUFDLDhIQUl4QixDQUFDLENBQUMsQ0FBQyxFQUFFLG04QkFvQ0w7QUF4R0ksQ0F3R0osQ0FBQTtBQTFHWSxRQUFBLG9CQUFvQix3QkEwR2hDIn0=
13
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi8uLi9zcmMvcHJvamVjdHNHZW5lcmF0aW9uL2dlbmVyYXRvcnMvZmlsZVRlbXBsYXRlcy9iYWNrL2Vudmlyb25tZW50L3NyYy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFBQSw4Q0FHNkI7QUFDN0IsOENBQXVEO0FBRWhELElBQU0sb0JBQW9CLEdBQUcsVUFDbEMsT0FBK0Q7SUFBL0Qsd0JBQUEsRUFBQSxVQUFrQyxxQ0FBNkI7SUFDNUQsT0FBQSwwT0FNSCxPQUFPLENBQUMsMEJBQTBCO1FBQ2hDLENBQUMsQ0FBQyxFQUFFO1FBQ0osQ0FBQyxDQUFDLGVBQ0Qsd0JBQWdCLE9BQ3BCLHNqQkF3QkE7QUFsQ0ksQ0FrQ0osQ0FBQTtBQXBDWSxRQUFBLG9CQUFvQix3QkFvQ2hDIn0=
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "runlify",
3
- "version": "0.0.582",
3
+ "version": "0.0.583",
4
4
  "description": "runlify CLI",
5
5
  "private": false,
6
6
  "main": "build/index.js",