miolo 0.0.48 → 0.0.49

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.
@@ -44,22 +44,31 @@ module.exports = {
44
44
  sameSite: process.env.NODE_ENV != 'development' ? null : 'strict'
45
45
  }
46
46
  },
47
- database: {
48
- dialect: 'postgres',
49
- host: 'localhost',
50
- port: 5432,
51
- database: 'miolo',
52
- user: 'postgres',
53
- password: 'postgres',
54
- max: 5,
55
- // Maximum number of connection in pool
56
- min: 0,
57
- // Minimum number of connection in pool
58
- idleTimeoutMillis: 10000 // The maximum time, in milliseconds, that a connection can be idle before being released. Use with combination of evict for proper working, for more details read https://github.com/coopernurse/node-pool/issues/178#issuecomment-327110870,
59
- },
47
+ db: {
48
+ connection: {
49
+ database: {
50
+ dialect: 'postgres',
51
+ host: 'localhost',
52
+ port: 5432,
53
+ database: 'miolo',
54
+ user: 'postgres',
55
+ password: 'postgres',
56
+ max: 5,
57
+ // Maximum number of connection in pool
58
+ min: 0,
59
+ // Minimum number of connection in pool
60
+ idleTimeoutMillis: 10000 // The maximum time, in milliseconds, that a connection can be idle before being released. Use with combination of evict for proper working, for more details read https://github.com/coopernurse/node-pool/issues/178#issuecomment-327110870,
61
+ },
62
+
63
+ options: {
64
+ log: 'silly' // will be updated on the fly with miolo logger
65
+ }
66
+ },
60
67
 
68
+ tables: []
69
+ },
61
70
  routes: {
62
- body_field: undefined,
71
+ bodyField: undefined,
63
72
  getUserId: ctx => {
64
73
  try {
65
74
  var from_pport = ctx.state.user.id;
package/lib/index.js CHANGED
@@ -27,12 +27,6 @@ Object.defineProperty(exports, "getLogger", {
27
27
  return _logger.init_logger;
28
28
  }
29
29
  });
30
- Object.defineProperty(exports, "getModel", {
31
- enumerable: true,
32
- get: function get() {
33
- return _calustraRouter.getModel;
34
- }
35
- });
36
30
  Object.defineProperty(exports, "miolo", {
37
31
  enumerable: true,
38
32
  get: function get() {
@@ -29,13 +29,11 @@ function miolo(sconfig, render, callback) {
29
29
  var config = (0, _config.init_config)(sconfig);
30
30
  var emailer = (0, _emailer.init_emailer)(config.mail.options, config.mail.defaults);
31
31
  var logger = (0, _logger.init_logger)(config.log, emailer);
32
- var db_options = {
33
- log: logger
34
- };
32
+ config.db.connection.options.log = logger;
35
33
  var app = new _koa.default();
36
34
 
37
35
  // attach to app calustra's db methods
38
- (0, _calustraRouter.useCalustraDbContext)(app, config.database, db_options);
36
+ (0, _calustraRouter.useCalustraDbContext)(app, config.db);
39
37
 
40
38
  // attach to app some custom miolo methods
41
39
  app.context.miolo = {
@@ -91,7 +89,7 @@ function miolo(sconfig, render, callback) {
91
89
 
92
90
  // Routes to /crud
93
91
  if (config !== null && config !== void 0 && config.routes) {
94
- (0, _calustraRouter.useCalustraRouter)(app, config.database, _objectSpread(_objectSpread({}, db_options), config.routes));
92
+ (0, _calustraRouter.useCalustraRouter)(app, config.db, config.routes);
95
93
  }
96
94
  // Socket.io
97
95
  // const io= init_socket(logger)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "miolo",
3
- "version": "0.0.48",
3
+ "version": "0.0.49",
4
4
  "description": "miolo",
5
5
  "main": "lib/index.js",
6
6
  "author": "Afialapis <info@afialapis.com>",
@@ -14,7 +14,7 @@
14
14
  "assign-deep": "^1.0.1",
15
15
  "babel-plugin-module-resolver": "^4.1.0",
16
16
  "basic-auth": "^2.0.1",
17
- "calustra-router": "0.1.5",
17
+ "calustra-router": "0.2.1",
18
18
  "cron": "^1.8.2",
19
19
  "diskspace": "^2.0.0",
20
20
  "eslint": "^8.9.0",
@@ -46,19 +46,27 @@ module.exports= {
46
46
  sameSite: process.env.NODE_ENV != 'development' ? null : 'strict',
47
47
  }
48
48
  },
49
- database: {
50
- dialect: 'postgres',
51
- host: 'localhost',
52
- port: 5432,
53
- database: 'miolo',
54
- user: 'postgres',
55
- password: 'postgres',
56
- max: 5, // Maximum number of connection in pool
57
- min: 0, // Minimum number of connection in pool
58
- idleTimeoutMillis: 10000, // The maximum time, in milliseconds, that a connection can be idle before being released. Use with combination of evict for proper working, for more details read https://github.com/coopernurse/node-pool/issues/178#issuecomment-327110870,
49
+ db: {
50
+ connection: {
51
+ database: {
52
+ dialect: 'postgres',
53
+ host: 'localhost',
54
+ port: 5432,
55
+ database: 'miolo',
56
+ user: 'postgres',
57
+ password: 'postgres',
58
+ max: 5, // Maximum number of connection in pool
59
+ min: 0, // Minimum number of connection in pool
60
+ idleTimeoutMillis: 10000, // The maximum time, in milliseconds, that a connection can be idle before being released. Use with combination of evict for proper working, for more details read https://github.com/coopernurse/node-pool/issues/178#issuecomment-327110870,
61
+ },
62
+ options: {
63
+ log: 'silly' // will be updated on the fly with miolo logger
64
+ }
65
+ },
66
+ tables: []
59
67
  },
60
68
  routes: {
61
- body_field: undefined,
69
+ bodyField: undefined,
62
70
 
63
71
  getUserId: (ctx) => {
64
72
  try {
package/src/index.js CHANGED
@@ -2,13 +2,12 @@ import {miolo} from './server'
2
2
  import { init_emailer as getEmailer} from './emailer'
3
3
  import { init_cacher as getCacher} from './cacher'
4
4
  import { init_logger as getLogger } from './logger'
5
- import { getConnection, getModel } from 'calustra-router'
5
+ import { getConnection } from 'calustra-router'
6
6
 
7
7
  export {
8
8
  miolo,
9
9
  getEmailer,
10
10
  getCacher,
11
11
  getLogger,
12
- getConnection,
13
- getModel
12
+ getConnection
14
13
  }
@@ -20,19 +20,20 @@ import { init_route_catch_js_error} from './routes/catch_js_error'
20
20
  import { init_route_html_render} from './routes/html_render'
21
21
 
22
22
  function miolo(sconfig, render, callback) {
23
+
23
24
 
24
25
  // Init some pieces
25
26
  const config = init_config(sconfig)
26
27
  const emailer = init_emailer(config.mail.options, config.mail.defaults)
27
28
  const logger = init_logger(config.log, emailer)
28
29
 
29
- const db_options= {log: logger}
30
-
30
+ config.db.connection.options.log= logger
31
+
31
32
  const app = new Koa()
32
33
 
33
34
 
34
35
  // attach to app calustra's db methods
35
- useCalustraDbContext(app, config.database, db_options)
36
+ useCalustraDbContext(app, config.db)
36
37
 
37
38
  // attach to app some custom miolo methods
38
39
  app.context.miolo = {
@@ -84,10 +85,7 @@ function miolo(sconfig, render, callback) {
84
85
 
85
86
  // Routes to /crud
86
87
  if (config?.routes) {
87
- useCalustraRouter(app, config.database, {
88
- ...db_options,
89
- ...config.routes
90
- })
88
+ useCalustraRouter(app, config.db, config.routes)
91
89
 
92
90
  }
93
91
  // Socket.io