acebase-server 1.19.0 → 1.19.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.
Files changed (57) hide show
  1. package/.eslintrc.json +49 -49
  2. package/.github/workflows/publish.yml +125 -0
  3. package/Dockerfile +26 -26
  4. package/LICENSE +21 -21
  5. package/bin/acebase-server.js +8 -8
  6. package/create-package-files.sh +25 -0
  7. package/dist/cjs/routes/data-exists.js +2 -2
  8. package/dist/cjs/routes/data-export.js +2 -2
  9. package/dist/cjs/routes/data-get.js +2 -2
  10. package/dist/cjs/routes/data-reflect.js +2 -2
  11. package/dist/cjs/routes/docs.js +1 -1
  12. package/dist/cjs/routes/meta-info.js +1 -1
  13. package/dist/esm/routes/data-exists.js +1 -2
  14. package/dist/esm/routes/data-export.js +1 -2
  15. package/dist/esm/routes/data-get.js +1 -1
  16. package/dist/esm/routes/data-reflect.js +1 -2
  17. package/dist/esm/routes/docs.js +1 -1
  18. package/dist/esm/routes/meta-info.js +1 -1
  19. package/package.json +4 -5
  20. package/release_notes.md +4 -0
  21. package/src/routes/auth-change-password.yaml +73 -73
  22. package/src/routes/auth-delete.yaml +77 -77
  23. package/src/routes/auth-forgot-password.yaml +49 -49
  24. package/src/routes/auth-reset-password.yaml +53 -53
  25. package/src/routes/auth-signin.yaml +129 -129
  26. package/src/routes/auth-signout.yaml +46 -46
  27. package/src/routes/auth-signup.yaml +135 -135
  28. package/src/routes/auth-state.yaml +28 -28
  29. package/src/routes/auth-update.yaml +151 -151
  30. package/src/routes/auth-verify-email.yaml +52 -52
  31. package/src/routes/data-exists.yaml +44 -44
  32. package/src/routes/data-export.yaml +63 -63
  33. package/src/routes/data-import.yaml +74 -74
  34. package/src/routes/data-index-create.yaml +105 -105
  35. package/src/routes/data-index-delete.yaml +51 -51
  36. package/src/routes/data-index-list.yaml +84 -84
  37. package/src/routes/data-query.yaml +165 -165
  38. package/src/routes/data-reflect.yaml +124 -124
  39. package/src/routes/data-schema-get.yaml +53 -53
  40. package/src/routes/data-schema-set.yaml +64 -64
  41. package/src/routes/data-schema-test.yaml +66 -66
  42. package/src/routes/data-schemas-list.yaml +41 -41
  43. package/src/routes/data-set.yaml +77 -77
  44. package/src/routes/data-sync-changes.yaml +66 -66
  45. package/src/routes/data-sync-mutations.yaml +66 -66
  46. package/src/routes/data-transaction-finish.yaml +82 -82
  47. package/src/routes/data-transaction-start.yaml +58 -58
  48. package/src/routes/data-update.yaml +77 -77
  49. package/src/routes/meta-info.yaml +40 -40
  50. package/src/routes/meta-ping.yaml +22 -22
  51. package/src/routes/meta-stats.yaml +40 -40
  52. package/src/routes/oauth2-init.yaml +62 -62
  53. package/src/routes/oauth2-refresh.yaml +64 -64
  54. package/src/routes/oauth2-signin.yaml +65 -65
  55. package/webmanager/acebase-client-browser.min.js +12 -12
  56. package/webmanager/index.html +271 -271
  57. package/webmanager/index.js +437 -437
package/.eslintrc.json CHANGED
@@ -1,49 +1,49 @@
1
- {
2
- "env": {
3
- "browser": true,
4
- "es2021": true,
5
- "node": true
6
- },
7
- "extends": [
8
- "plugin:@typescript-eslint/recommended"
9
- ],
10
- "parser": "@typescript-eslint/parser",
11
- "parserOptions": {
12
- "ecmaVersion": "latest",
13
- "sourceType": "module"
14
- },
15
- "plugins": [
16
- "@typescript-eslint"
17
- ],
18
- "rules": {
19
- "indent": [ "error", 4, { "SwitchCase": 1, "VariableDeclarator": 1, "MemberExpression": 1, "CallExpression": { "arguments": 1 } }],
20
- "quotes": ["error", "single", { "avoidEscape": false, "allowTemplateLiterals": true }],
21
- "semi": ["error", "always"],
22
- "@typescript-eslint/no-explicit-any": [
23
- "off", // "error" if we want to enforce usage of `unknown` instead
24
- {
25
- "ignoreRestArgs": false,
26
- "fixToUnknown": true
27
- }
28
- ],
29
- "comma-dangle": "off",
30
- "@typescript-eslint/comma-dangle": ["error", {
31
- "arrays": "always-multiline",
32
- "objects": "always-multiline",
33
- "imports": "always-multiline",
34
- "exports": "always-multiline",
35
- "enums": "always-multiline",
36
- "functions": "only-multiline"
37
- }],
38
- "no-trailing-spaces": "error",
39
- "eol-last": "error",
40
- "curly": "error"
41
- },
42
- "overrides": [{
43
- "files": "*.js",
44
- "rules": {
45
- "@typescript-eslint/no-var-requires": "off"
46
- }
47
- }],
48
- "ignorePatterns": ["dist/**/*.*", "webmanager/*.min.js"]
49
- }
1
+ {
2
+ "env": {
3
+ "browser": true,
4
+ "es2021": true,
5
+ "node": true
6
+ },
7
+ "extends": [
8
+ "plugin:@typescript-eslint/recommended"
9
+ ],
10
+ "parser": "@typescript-eslint/parser",
11
+ "parserOptions": {
12
+ "ecmaVersion": "latest",
13
+ "sourceType": "module"
14
+ },
15
+ "plugins": [
16
+ "@typescript-eslint"
17
+ ],
18
+ "rules": {
19
+ "indent": [ "error", 4, { "SwitchCase": 1, "VariableDeclarator": 1, "MemberExpression": 1, "CallExpression": { "arguments": 1 } }],
20
+ "quotes": ["error", "single", { "avoidEscape": false, "allowTemplateLiterals": true }],
21
+ "semi": ["error", "always"],
22
+ "@typescript-eslint/no-explicit-any": [
23
+ "off", // "error" if we want to enforce usage of `unknown` instead
24
+ {
25
+ "ignoreRestArgs": false,
26
+ "fixToUnknown": true
27
+ }
28
+ ],
29
+ "comma-dangle": "off",
30
+ "@typescript-eslint/comma-dangle": ["error", {
31
+ "arrays": "always-multiline",
32
+ "objects": "always-multiline",
33
+ "imports": "always-multiline",
34
+ "exports": "always-multiline",
35
+ "enums": "always-multiline",
36
+ "functions": "only-multiline"
37
+ }],
38
+ "no-trailing-spaces": "error",
39
+ "eol-last": "error",
40
+ "curly": "error"
41
+ },
42
+ "overrides": [{
43
+ "files": "*.js",
44
+ "rules": {
45
+ "@typescript-eslint/no-var-requires": "off"
46
+ }
47
+ }],
48
+ "ignorePatterns": ["dist/**/*.*", "webmanager/*.min.js"]
49
+ }
@@ -0,0 +1,125 @@
1
+ name: Publish Release
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - 'v[0-9]+.[0-9]+.[0-9]+'
7
+ - 'v[0-9]+.[0-9]+.[0-9]+-rc.[0-9]+'
8
+
9
+ jobs:
10
+ publish:
11
+ runs-on: ubuntu-latest
12
+ permissions:
13
+ contents: write # needed to create GitHub releases
14
+ id-token: write # needed for npm provenance attestation
15
+
16
+ steps:
17
+ - name: Checkout
18
+ uses: actions/checkout@v4
19
+ with:
20
+ fetch-depth: 0 # full history needed for release notes
21
+
22
+ - name: Setup Node.js
23
+ uses: actions/setup-node@v4
24
+ with:
25
+ node-version: '24'
26
+
27
+ - name: Extract version from tag
28
+ id: version
29
+ run: |
30
+ echo "VERSION=${GITHUB_REF_NAME#v}" >> "$GITHUB_OUTPUT"
31
+ if [[ "${GITHUB_REF_NAME}" == *"-rc."* ]]; then
32
+ echo "IS_RC=true" >> "$GITHUB_OUTPUT"
33
+ else
34
+ echo "IS_RC=false" >> "$GITHUB_OUTPUT"
35
+ fi
36
+
37
+ - name: Set version in package.json
38
+ run: npm version ${{ steps.version.outputs.VERSION }} --no-git-tag-version
39
+
40
+ - name: Commit version bump
41
+ run: |
42
+ git config user.name "github-actions[bot]"
43
+ git config user.email "github-actions[bot]@users.noreply.github.com"
44
+
45
+ # Find which branch tip matches the tagged commit.
46
+ TAGGED_COMMIT=$(git rev-parse "$GITHUB_REF_NAME")
47
+ TARGET_BRANCH=$(git for-each-ref --format='%(refname:short)' refs/remotes/origin \
48
+ --points-at "$TAGGED_COMMIT" | sed 's|^origin/||' | grep -v '^HEAD$' | head -1)
49
+
50
+ if [ -z "$TARGET_BRANCH" ]; then
51
+ echo "::error::Tag $GITHUB_REF_NAME is not at the tip of any branch. Create tags only at the latest commit of a branch."
52
+ exit 1
53
+ fi
54
+
55
+ echo "Pushing version bump to branch: $TARGET_BRANCH"
56
+ git add package.json package-lock.json
57
+ git commit -m "chore: release ${{ github.ref_name }} [skip ci]"
58
+ git push origin HEAD:"$TARGET_BRANCH"
59
+
60
+ - name: Resolve file dependencies to npm versions
61
+ # Replaces any "file:..." dependency entries with the latest published
62
+ # npm version. This is needed because acebase-core is referenced as a
63
+ # local path during development but must be a real semver range in the
64
+ # published package.
65
+ run: |
66
+ node - <<'EOF'
67
+ const fs = require('fs');
68
+ const { execSync } = require('child_process');
69
+ const pkg = JSON.parse(fs.readFileSync('package.json', 'utf8'));
70
+ const toInstall = [];
71
+ for (const section of ['dependencies', 'devDependencies', 'peerDependencies', 'optionalDependencies']) {
72
+ if (!pkg[section]) continue;
73
+ for (const [name, version] of Object.entries(pkg[section])) {
74
+ if (version.startsWith('file:')) {
75
+ console.log(`Queuing ${name} for npm install`);
76
+ toInstall.push(name + '@latest');
77
+ }
78
+ }
79
+ }
80
+ if (toInstall.length > 0) {
81
+ execSync(`npm install ${toInstall.join(' ')}`, { stdio: 'inherit' });
82
+ }
83
+ EOF
84
+
85
+ - name: Install dependencies
86
+ run: npm install
87
+
88
+ - name: Build
89
+ run: npm run build
90
+
91
+ - name: Generate release notes
92
+ id: notes
93
+ run: |
94
+ CURRENT_TAG="${GITHUB_REF_NAME}"
95
+ PREVIOUS_TAG=$(git tag --sort=-version:refname | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+$' | grep -v "^${CURRENT_TAG}$" | head -1)
96
+
97
+ if [ -n "$PREVIOUS_TAG" ]; then
98
+ echo "Generating notes from ${PREVIOUS_TAG} to ${CURRENT_TAG}"
99
+ NOTES=$(git log "${PREVIOUS_TAG}..${CURRENT_TAG}" --pretty=format:"- %s (%h)" --no-merges)
100
+ else
101
+ echo "No previous tag found, using all commits"
102
+ NOTES=$(git log --pretty=format:"- %s (%h)" --no-merges)
103
+ fi
104
+
105
+ # Write to a file to avoid quoting/escaping issues
106
+ printf '%s\n' "$NOTES" > release_notes.md
107
+ cat release_notes.md
108
+
109
+ - name: Create GitHub release
110
+ env:
111
+ GH_TOKEN: ${{ github.token }}
112
+ run: |
113
+ gh release create "$GITHUB_REF_NAME" \
114
+ --title "$GITHUB_REF_NAME" \
115
+ --notes-file release_notes.md \
116
+ ${{ steps.version.outputs.IS_RC == 'true' && '--prerelease' || '' }}
117
+
118
+ - name: Publish to npm
119
+ run: |
120
+ if [[ "${{ steps.version.outputs.IS_RC }}" == "true" ]]; then
121
+ echo "RC tag detected — running npm publish --dry-run"
122
+ npm publish --access public --dry-run
123
+ else
124
+ npm publish --access public
125
+ fi
package/Dockerfile CHANGED
@@ -1,26 +1,26 @@
1
- # experimenting running in docker container.
2
- # WARNING: running 1 instance is currently supported per db, running multiple will corrupt your data!
3
- # To build a docker image, execute:
4
- # docker build -t acebase-server .
5
- # To run:
6
- # docker volume create acebase-server-data
7
- # docker run --name MyAceBaseServer1 -p 3000:3000 -p 4000:4000 -v acebase-server-data:/default.acebase acebase-server
8
-
9
- FROM node:10-alpine
10
- WORKDIR /app
11
- COPY package.json .
12
- RUN npm install
13
- COPY src ./src
14
-
15
- # Initialize build arguments passed to docker build --build-arg DBNAME=data ...
16
- ARG DBNAME="data"
17
- ARG PORT=3000
18
- ARG CLUSTER_PORT=4000
19
- ARG HOST="0.0.0.0"
20
- ARG DBPATH="."
21
-
22
- # Set defaults for runtime environment variables, can be overriden by: docker run --env DBNAME=mydb ...
23
- ENV DBNAME=${DBNAME} HOST=${HOST} PORT=${PORT} CLUSTER_PORT=${CLUSTER_PORT} DBPATH=${DBPATH}
24
-
25
- # Start server without arguments, environment variables will be used
26
- CMD ["node", "src/start.js"]
1
+ # experimenting running in docker container.
2
+ # WARNING: running 1 instance is currently supported per db, running multiple will corrupt your data!
3
+ # To build a docker image, execute:
4
+ # docker build -t acebase-server .
5
+ # To run:
6
+ # docker volume create acebase-server-data
7
+ # docker run --name MyAceBaseServer1 -p 3000:3000 -p 4000:4000 -v acebase-server-data:/default.acebase acebase-server
8
+
9
+ FROM node:10-alpine
10
+ WORKDIR /app
11
+ COPY package.json .
12
+ RUN npm install
13
+ COPY src ./src
14
+
15
+ # Initialize build arguments passed to docker build --build-arg DBNAME=data ...
16
+ ARG DBNAME="data"
17
+ ARG PORT=3000
18
+ ARG CLUSTER_PORT=4000
19
+ ARG HOST="0.0.0.0"
20
+ ARG DBPATH="."
21
+
22
+ # Set defaults for runtime environment variables, can be overriden by: docker run --env DBNAME=mydb ...
23
+ ENV DBNAME=${DBNAME} HOST=${HOST} PORT=${PORT} CLUSTER_PORT=${CLUSTER_PORT} DBPATH=${DBPATH}
24
+
25
+ # Start server without arguments, environment variables will be used
26
+ CMD ["node", "src/start.js"]
package/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2018 Ewout Stortenbeker (me@appy.one)
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2018 Ewout Stortenbeker (me@appy.one)
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -1,8 +1,8 @@
1
- #!/usr/bin/env node
2
-
3
- if (process.argv[2] === 'start') {
4
- require('../dist/cjs/start');
5
- }
6
- else {
7
- console.log(`[acebase-server CLI] unknown instruction. Did you mean "npx acebase-server start"?`);
8
- }
1
+ #!/usr/bin/env node
2
+
3
+ if (process.argv[2] === 'start') {
4
+ require('../dist/cjs/start');
5
+ }
6
+ else {
7
+ console.log(`[acebase-server CLI] unknown instruction. Did you mean "npx acebase-server start"?`);
8
+ }
@@ -0,0 +1,25 @@
1
+ #!/bin/bash
2
+
3
+ # Create CommonJS package.json
4
+ cat >dist/cjs/package.json <<!JSON
5
+ {
6
+ "type": "commonjs"
7
+ }
8
+ !JSON
9
+
10
+ # Write typings to support Node16 module resolution
11
+ cat >dist/cjs/index.d.ts <<!TYPESCRIPT
12
+ export * from '../types/index.js';
13
+ !TYPESCRIPT
14
+
15
+ # Create ESM package.json
16
+ cat >dist/esm/package.json <<!JSON
17
+ {
18
+ "type": "module"
19
+ }
20
+ !JSON
21
+
22
+ # Write typings to support Node16 module resolution
23
+ cat >dist/esm/index.d.ts <<!TYPESCRIPT
24
+ export * from '../types/index.js';
25
+ !TYPESCRIPT
@@ -13,6 +13,7 @@ exports.addRoute = void 0;
13
13
  const error_1 = require("../shared/error");
14
14
  const addRoute = (env) => {
15
15
  env.router.get(`/exists/${env.db.name}/*`, (req, res) => __awaiter(void 0, void 0, void 0, function* () {
16
+ var _a, _b;
16
17
  // Exists query
17
18
  const path = req.path.slice(env.db.name.length + 9);
18
19
  const access = yield env.rules.isOperationAllowed(req.user, path, 'exists', { context: req.context });
@@ -24,8 +25,7 @@ const addRoute = (env) => {
24
25
  res.send({ exists });
25
26
  }
26
27
  catch (err) {
27
- res.statusCode = 500;
28
- res.send(err);
28
+ res.status(500).send(`${(_b = (_a = err === null || err === void 0 ? void 0 : err.stack) !== null && _a !== void 0 ? _a : err === null || err === void 0 ? void 0 : err.message) !== null && _b !== void 0 ? _b : err}`);
29
29
  }
30
30
  }));
31
31
  };
@@ -13,6 +13,7 @@ exports.addRoute = void 0;
13
13
  const error_1 = require("../shared/error");
14
14
  const addRoute = (env) => {
15
15
  env.router.get(`/export/${env.db.name}/*`, (req, res) => __awaiter(void 0, void 0, void 0, function* () {
16
+ var _a, _b;
16
17
  // Export API
17
18
  const path = req.path.slice(env.db.name.length + 9);
18
19
  const access = yield env.rules.isOperationAllowed(req.user, path, 'export', { context: req.context });
@@ -35,8 +36,7 @@ const addRoute = (env) => {
35
36
  catch (err) {
36
37
  env.debug.error(`Error exporting data for path "/${path}": `, err);
37
38
  if (!res.headersSent) {
38
- res.statusCode = 500;
39
- res.send(err);
39
+ res.status(500).send(`${(_b = (_a = err === null || err === void 0 ? void 0 : err.stack) !== null && _a !== void 0 ? _a : err === null || err === void 0 ? void 0 : err.message) !== null && _b !== void 0 ? _b : err}`);
40
40
  }
41
41
  }
42
42
  finally {
@@ -14,7 +14,7 @@ const acebase_core_1 = require("acebase-core");
14
14
  const error_1 = require("../shared/error");
15
15
  const addRoute = (env) => {
16
16
  env.router.get(`/data/${env.db.name}/*`, (req, res) => __awaiter(void 0, void 0, void 0, function* () {
17
- var _a;
17
+ var _a, _b, _c;
18
18
  // Request data
19
19
  const path = req.path.slice(env.db.name.length + 7);
20
20
  // Pre-check read access
@@ -63,7 +63,7 @@ const addRoute = (env) => {
63
63
  });
64
64
  }
65
65
  catch (err) {
66
- res.status(500).send(err);
66
+ res.status(500).send(`${(_c = (_b = err === null || err === void 0 ? void 0 : err.stack) !== null && _b !== void 0 ? _b : err === null || err === void 0 ? void 0 : err.message) !== null && _c !== void 0 ? _c : err}`);
67
67
  }
68
68
  }));
69
69
  };
@@ -15,6 +15,7 @@ const error_1 = require("../shared/error");
15
15
  const admin_1 = require("../shared/admin");
16
16
  const addRoute = (env) => {
17
17
  env.router.get(`/reflect/${env.db.name}/*`, (req, res) => __awaiter(void 0, void 0, void 0, function* () {
18
+ var _a, _b;
18
19
  // Reflection API
19
20
  const path = req.path.slice(env.db.name.length + 10);
20
21
  const access = yield env.rules.isOperationAllowed(req.user, path, 'reflect', { context: req.context, type: req.query.type });
@@ -88,8 +89,7 @@ const addRoute = (env) => {
88
89
  res.send(result);
89
90
  }
90
91
  catch (err) {
91
- res.statusCode = 500;
92
- res.send(err);
92
+ res.status(500).send(`${(_b = (_a = err === null || err === void 0 ? void 0 : err.stack) !== null && _a !== void 0 ? _a : err === null || err === void 0 ? void 0 : err.message) !== null && _b !== void 0 ? _b : err}`);
93
93
  }
94
94
  }));
95
95
  };
@@ -19,7 +19,7 @@ const addRoute = (env) => {
19
19
  info: {
20
20
  title: 'AceBase Server',
21
21
  description: 'AceBase Server API endpoint documentation and test environment. This documentation is available on the server because it is running in development mode. To disable this, set your NODE_ENV environment variable to production. Many endpoints require you to authenticate using Bearer authentication. Use the _/auth/{dbname}/signin_ endpoint to obtain an access token, then click the _Authorize_ button and paste your token into the input field. For more information about AceBase, see GitHub',
22
- version: '1.19.0',
22
+ version: '1.19.1',
23
23
  contact: {
24
24
  name: 'AceBase API Support',
25
25
  email: 'me@appy.one',
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.addRoute = void 0;
4
4
  const admin_1 = require("../shared/admin");
5
5
  const os = require("os");
6
- const SERVER_VERSION = '1.19.0'; // Loaded from package.json by npm scripts
6
+ const SERVER_VERSION = '1.19.1'; // Loaded from package.json by npm scripts
7
7
  const addRoute = (env) => {
8
8
  // Add info endpoint
9
9
  env.router.get(`/info/${env.db.name}`, (req, res) => {
@@ -12,8 +12,7 @@ export const addRoute = (env) => {
12
12
  res.send({ exists });
13
13
  }
14
14
  catch (err) {
15
- res.statusCode = 500;
16
- res.send(err);
15
+ res.status(500).send(`${err?.stack ?? err?.message ?? err}`);
17
16
  }
18
17
  });
19
18
  };
@@ -23,8 +23,7 @@ export const addRoute = (env) => {
23
23
  catch (err) {
24
24
  env.debug.error(`Error exporting data for path "/${path}": `, err);
25
25
  if (!res.headersSent) {
26
- res.statusCode = 500;
27
- res.send(err);
26
+ res.status(500).send(`${err?.stack ?? err?.message ?? err}`);
28
27
  }
29
28
  }
30
29
  finally {
@@ -50,7 +50,7 @@ export const addRoute = (env) => {
50
50
  });
51
51
  }
52
52
  catch (err) {
53
- res.status(500).send(err);
53
+ res.status(500).send(`${err?.stack ?? err?.message ?? err}`);
54
54
  }
55
55
  });
56
56
  };
@@ -76,8 +76,7 @@ export const addRoute = (env) => {
76
76
  res.send(result);
77
77
  }
78
78
  catch (err) {
79
- res.statusCode = 500;
80
- res.send(err);
79
+ res.status(500).send(`${err?.stack ?? err?.message ?? err}`);
81
80
  }
82
81
  });
83
82
  };
@@ -14,7 +14,7 @@ export const addRoute = (env) => {
14
14
  info: {
15
15
  title: 'AceBase Server',
16
16
  description: 'AceBase Server API endpoint documentation and test environment. This documentation is available on the server because it is running in development mode. To disable this, set your NODE_ENV environment variable to production. Many endpoints require you to authenticate using Bearer authentication. Use the _/auth/{dbname}/signin_ endpoint to obtain an access token, then click the _Authorize_ button and paste your token into the input field. For more information about AceBase, see GitHub',
17
- version: '1.19.0',
17
+ version: '1.19.1',
18
18
  contact: {
19
19
  name: 'AceBase API Support',
20
20
  email: 'me@appy.one',
@@ -1,6 +1,6 @@
1
1
  import { isAdmin } from '../shared/admin.js';
2
2
  import * as os from 'os';
3
- const SERVER_VERSION = '1.19.0'; // Loaded from package.json by npm scripts
3
+ const SERVER_VERSION = '1.19.1'; // Loaded from package.json by npm scripts
4
4
  export const addRoute = (env) => {
5
5
  // Add info endpoint
6
6
  env.router.get(`/info/${env.db.name}`, (req, res) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "acebase-server",
3
- "version": "1.19.0",
3
+ "version": "1.19.1",
4
4
  "description": "AceBase realtime database server (webserver endpoint to allow remote connections)",
5
5
  "main": "./dist/cjs/index.js",
6
6
  "module": "./dist/esm/index.js",
@@ -22,13 +22,12 @@
22
22
  "test": "set NODE_ENV=development && npm run start",
23
23
  "lint": "eslint .",
24
24
  "lint:fix": "eslint . --fix",
25
- "build": "npm run build:clean && npm run build:esm && npm run build:cjs && npm run build:packages && echo Done!",
25
+ "build": "npm run build:clean && npm run build:esm && npm run build:cjs && npm run build:packages && npm run build:vars && echo Done!",
26
26
  "build:clean": "rm -fr dist/*",
27
27
  "build:esm": "tsc -p tsconfig.json && npx tsc-esm-fix ---target='dist/esm'",
28
28
  "build:cjs": "tsc -p tsconfig-cjs.json",
29
- "build:packages": "bash ./create-package-files",
30
- "preversion": "npm run build",
31
- "version": "node ./build-vars.js"
29
+ "build:packages": "bash ./create-package-files.sh",
30
+ "build:vars": "node ./build-vars.js"
32
31
  },
33
32
  "keywords": [
34
33
  "database",
@@ -0,0 +1,4 @@
1
+ - Add github publish workflow to npm (5a97437)
2
+ - rename script file (651ec0f)
3
+ - Fix tsc errors (7d88d1b)
4
+ - Fix "TypeError: Converting circular structure to JSON" in error response if `err` is an object with circular structure (9b3bdf5)