@live-change/server 0.8.51 → 0.8.53

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/lib/Services.js CHANGED
@@ -189,6 +189,9 @@ class Services {
189
189
  return app.startService(defn, startOptions)
190
190
  }))
191
191
  this.services = await this.servicesPromise
192
+ for(const service of this.services) {
193
+ setTimeout(() => service.afterStart(startOptions), 0)
194
+ }
192
195
  }
193
196
 
194
197
  async getServicesObject() {
package/lib/TestServer.js CHANGED
@@ -6,13 +6,15 @@ import App from '@live-change/framework'
6
6
  const app = App.app()
7
7
 
8
8
  import { hashCode, encodeNumber, uidGenerator } from '@live-change/uid'
9
+ import Dao from "@live-change/dao"
9
10
  import setupApiServer from './setupApiServer.js'
10
11
  import setupApiSockJs from './setupApiSockJs.js'
11
12
  import setupApiWs from './setupApiWs.js'
12
13
  import setupDbServer from './setupDbServer.js'
13
14
  import createLoopbackDao from './createLoopbackDao.js'
14
15
  import SsrServer from './SsrServer.js'
15
- import fs from "fs";
16
+ import fs from "fs"
17
+ import os from "os"
16
18
 
17
19
  class TestServer {
18
20
  constructor(config) {
@@ -21,18 +23,21 @@ class TestServer {
21
23
 
22
24
  async start() {
23
25
  this.expressApp = express()
26
+ this.expressApp.get('/test', (req, res) => {
27
+ res.end('Hello World!')
28
+ })
24
29
 
25
- const manifest = (dev || argv.spa)
30
+ const manifest = (this.config.dev || argv.spa)
26
31
  ? null
27
32
  : JSON.parse(fs.readFileSync((path.resolve(ssrRoot, 'dist/client/.vite/ssr-manifest.json'))))
28
33
 
29
34
  app.instanceId = encodeNumber(hashCode(
30
- `app${process.pid}${require("os").hostname()} ${process.cwd()}/${process.argv.join(' ')}`))
35
+ `app${process.pid}${os.hostname()} ${process.cwd()}/${process.argv.join(' ')}`))
31
36
  app.uidGenerator = uidGenerator(app.instanceId, 1, '[]')
32
- this.dbServer = await setupDbServer({ dbBackend: 'mem' })
33
- const loopbackDao = await createLoopbackDao('local', () => this.dbServer.createDao('local'))
34
- app.dao = loopbackDao
35
37
  app.databaseName = 'test'
38
+ app.dao = new Dao('app', {})
39
+
40
+ this.dbServer = await setupDbServer({ dbBackend: 'mem' })
36
41
 
37
42
  await app.dao.request(['database', 'createDatabase'], app.databaseName, { }).catch(err => 'exists')
38
43
 
@@ -43,14 +48,13 @@ class TestServer {
43
48
  }, this.dbServer)
44
49
 
45
50
  this.ssrServer = new SsrServer(this.expressApp, this.manifest, {
46
- dev: this.dev,
51
+ dev: this.config.dev,
47
52
  root: this.config.ssrRoot,
48
53
  daoFactory: async (credentials, ip) => {
49
54
  return await this.createDao(credentials, ip)
50
55
  },
51
56
  ...this.config
52
57
  })
53
-
54
58
  await this.ssrServer.start()
55
59
 
56
60
  this.expressServer = http.createServer(this.expressApp)
@@ -60,10 +64,11 @@ class TestServer {
60
64
  this.sockJsServer = await setupApiSockJs(this.expressServer, this.apiServer)
61
65
 
62
66
  await new Promise((resolve, reject) => {
63
- this.httpServer = this.expressServer.listen(this.config.port || 0, () => {
67
+ this.httpServer = this.expressServer.listen(this.config.port || 0, this.config.host || '127.0.0.1', () => {
64
68
  this.port = this.expressServer.address().port
65
69
  this.url = `http://localhost:${this.expressServer.address().port}`
66
70
  process.env.SSR_PORT = this.port
71
+ console.log("test ssr server listening at", this.expressServer.address().address, this.port)
67
72
  resolve()
68
73
  })
69
74
  })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@live-change/server",
3
- "version": "0.8.51",
3
+ "version": "0.8.53",
4
4
  "description": "Live Change Framework - server",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -22,12 +22,12 @@
22
22
  "type": "module",
23
23
  "homepage": "https://github.com/live-change/live-change-stack",
24
24
  "dependencies": {
25
- "@live-change/dao": "^0.8.51",
26
- "@live-change/dao-sockjs": "^0.8.51",
27
- "@live-change/db-server": "^0.8.51",
28
- "@live-change/framework": "^0.8.51",
25
+ "@live-change/dao": "^0.8.53",
26
+ "@live-change/dao-sockjs": "^0.8.53",
27
+ "@live-change/db-server": "^0.8.53",
28
+ "@live-change/framework": "^0.8.53",
29
29
  "@live-change/sockjs": "0.4.1",
30
- "@live-change/uid": "^0.8.51",
30
+ "@live-change/uid": "^0.8.53",
31
31
  "dotenv": "^16.4.4",
32
32
  "express": "^4.18.2",
33
33
  "express-static-gzip": "2.1.7",
@@ -39,5 +39,5 @@
39
39
  "websocket": "^1.0.34",
40
40
  "yargs": "^17.7.2"
41
41
  },
42
- "gitHead": "ba8da813894eeb717223aa8d5e364649e4ac0347"
42
+ "gitHead": "39422adadd1863fa396fc4e875936e09428d6cf1"
43
43
  }