acebase-server 1.6.0 → 1.6.1

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": "acebase-server",
3
- "version": "1.6.0",
3
+ "version": "1.6.1",
4
4
  "description": "AceBase realtime database server (webserver endpoint to allow remote connections)",
5
5
  "main": "./src/index.js",
6
6
  "private": false,
@@ -44,8 +44,8 @@
44
44
  "author": "Ewout Stortenbeker <me@appy.one> (http://appy.one)",
45
45
  "license": "MIT",
46
46
  "dependencies": {
47
- "acebase": "^1.11.0",
48
- "acebase-core": "^1.10.0",
47
+ "acebase": "^1.11.1",
48
+ "acebase-core": "^1.10.1",
49
49
  "express": "^4.17.1",
50
50
  "socket.io": "^2.4.1"
51
51
  },
@@ -518,6 +518,7 @@ class AceBaseServer extends EventEmitter {
518
518
  res.header('Access-Control-Allow-Origin', options.allowOrigin !== '*' ? options.allowOrigin : (req.headers.origin || '*'));
519
519
  res.header('Access-Control-Allow-Methods', corsOptions.methods);
520
520
  res.header('Access-Control-Allow-Headers', corsOptions.allowedHeaders);
521
+ res.header('Access-Control-Expose-Headers', 'Date, AceBase-Context'); // Prevent browsers from stripping these headers from the response for programmatic access in cross-origin requests
521
522
  if (req.method === 'OPTIONS') {
522
523
  res.status(200).end();
523
524
  }
package/src/start.js CHANGED
@@ -21,6 +21,12 @@ const options = { host, port, path };
21
21
  if (clusterPort > 0) {
22
22
  options.cluster = { enabled: true, port: clusterPort };
23
23
  }
24
+ if (+getVariable('TXLOG', 0) === 1) {
25
+ options.transactions = {
26
+ log: true,
27
+ maxAge: +getVariable('TXDAYS', 30)
28
+ };
29
+ }
24
30
  const server = new AceBaseServer(dbname, options);
25
31
  server.once("ready", () => {
26
32
  server.debug.log(`AceBase server running`);
@@ -10,7 +10,8 @@ function connect(dbname, username, password) {
10
10
  let createNew = connection.db === null || connection.dbname !== dbname;
11
11
  if (createNew) {
12
12
  connection.db && connection.db.disconnect();
13
- connection.db = new AceBaseClient({ dbname, host: location.hostname, port: location.port, https: location.protocol === 'https:', autoConnect: true });
13
+ let host = location.hostname, port = location.port, https = location.protocol === 'https:', autoConnect = true;
14
+ connection.db = new AceBaseClient({ dbname, host, port, https, autoConnect });
14
15
  }
15
16
  return connection.db.ready()
16
17
  .then(() => {