jinaga-server 1.1.4 → 2.0.0

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 (84) hide show
  1. package/README.md +12 -0
  2. package/dist/authentication/authentication-device.d.ts +3 -2
  3. package/dist/authentication/authentication-device.js +6 -0
  4. package/dist/authentication/authentication-device.js.map +1 -1
  5. package/dist/authentication/authentication-impl.d.ts +3 -2
  6. package/dist/authentication/authentication-impl.js +6 -0
  7. package/dist/authentication/authentication-impl.js.map +1 -1
  8. package/dist/authentication/authentication-noop.d.ts +20 -0
  9. package/dist/authentication/authentication-noop.js +52 -0
  10. package/dist/authentication/authentication-noop.js.map +1 -0
  11. package/dist/authentication/authentication-session.d.ts +3 -2
  12. package/dist/authentication/authentication-session.js +6 -0
  13. package/dist/authentication/authentication-session.js.map +1 -1
  14. package/dist/authentication.d.ts +3 -2
  15. package/dist/authentication.js +6 -0
  16. package/dist/authentication.js.map +1 -1
  17. package/dist/authorization/authorization-keystore.d.ts +3 -4
  18. package/dist/authorization/authorization-keystore.js +9 -4
  19. package/dist/authorization/authorization-keystore.js.map +1 -1
  20. package/dist/debug.d.ts +1 -0
  21. package/dist/debug.js +30 -0
  22. package/dist/debug.js.map +1 -0
  23. package/dist/http/router.js.map +1 -1
  24. package/dist/jinaga-server.js +15 -7
  25. package/dist/jinaga-server.js.map +1 -1
  26. package/dist/memory/memory-keystore.js +0 -6
  27. package/dist/memory/memory-keystore.js.map +1 -1
  28. package/dist/postgres/connection.js +1 -0
  29. package/dist/postgres/connection.js.map +1 -1
  30. package/dist/postgres/maps.d.ts +7 -6
  31. package/dist/postgres/maps.js +9 -1
  32. package/dist/postgres/maps.js.map +1 -1
  33. package/dist/postgres/postgres-keystore.js +0 -6
  34. package/dist/postgres/postgres-keystore.js.map +1 -1
  35. package/dist/postgres/postgres-store.d.ts +1 -2
  36. package/dist/postgres/postgres-store.js +29 -24
  37. package/dist/postgres/postgres-store.js.map +1 -1
  38. package/dist/postgres/specification-result-sql.d.ts +4 -4
  39. package/dist/postgres/specification-result-sql.js +34 -24
  40. package/dist/postgres/specification-result-sql.js.map +1 -1
  41. package/dist/postgres/specification-sql.js.map +1 -1
  42. package/dist/postgres/sql.d.ts +1 -1
  43. package/dist/postgres/sql.js +15 -7
  44. package/dist/postgres/sql.js.map +1 -1
  45. package/dist/util/maps.d.ts +0 -0
  46. package/dist/util/maps.js +2 -0
  47. package/dist/util/maps.js.map +1 -0
  48. package/docs/sql/SQL Generator (projection).png +0 -0
  49. package/docs/sql/SQLFromSpecification.md +2 -0
  50. package/integration-test/jinaga-test/Dockerfile +2 -2
  51. package/integration-test/jinaga-test/jinaga.test.js +3 -3
  52. package/integration-test/jinaga-test/package-lock.json +745 -3484
  53. package/integration-test/jinaga-test/package.json +2 -0
  54. package/integration-test/run.sh +3 -3
  55. package/package.json +5 -6
  56. package/replicator/index.ts +31 -0
  57. package/replicator/package-lock.json +855 -0
  58. package/replicator/package.json +27 -0
  59. package/replicator/tsconfig.json +15 -0
  60. package/src/authentication/authentication-device.ts +11 -1
  61. package/src/authentication/authentication-impl.ts +9 -2
  62. package/src/authentication/authentication-noop.ts +65 -0
  63. package/src/authentication/authentication-session.ts +11 -1
  64. package/src/authentication.ts +12 -2
  65. package/src/authorization/authorization-keystore.ts +12 -7
  66. package/src/debug.ts +30 -0
  67. package/src/http/router.ts +2 -2
  68. package/src/jinaga-server.ts +18 -8
  69. package/src/memory/memory-keystore.ts +0 -6
  70. package/src/postgres/connection.ts +2 -1
  71. package/src/postgres/maps.ts +8 -0
  72. package/src/postgres/postgres-keystore.ts +2 -8
  73. package/src/postgres/postgres-store.ts +37 -30
  74. package/src/postgres/specification-result-sql.ts +56 -45
  75. package/src/postgres/specification-sql.ts +1 -1
  76. package/src/postgres/sql.ts +23 -12
  77. package/src/util/maps.ts +0 -0
  78. package/test/postgres/postgresReadSpec.ts +4 -1
  79. package/test/postgres/postgresSpec.ts +31 -31
  80. package/test/postgres/postgresSpecificationSpec.ts +1 -1
  81. package/tsconfig.json +1 -0
  82. package/tsconfig.test.json +26 -0
  83. package/docs/specification.txt +0 -41
  84. package/interactive/index.js +0 -56
@@ -13,9 +13,11 @@
13
13
  "author": "Michael L Perry",
14
14
  "license": "MIT",
15
15
  "dependencies": {
16
+ "@stablelib/base64": "^1.0.1",
16
17
  "express": "^4.17.2",
17
18
  "jest": "^28.1.0",
18
19
  "jest-compact-reporter": "^1.2.9",
20
+ "jinaga": "^5.0.0",
19
21
  "node-forge": "^1.3.0",
20
22
  "passport": "^0.5.2",
21
23
  "pg": "^8.7.1",
@@ -3,9 +3,9 @@ set -e
3
3
 
4
4
  docker build -t jinaga-postgres-fact-keystore ./postgres
5
5
 
6
- mkdir -p ./jinaga-test/jinaga
7
- cp -R ../dist ./jinaga-test/jinaga/dist
8
- cp ../package.json ./jinaga-test/jinaga/package.json
6
+ mkdir -p ./jinaga-test/jinaga-server
7
+ cp -R ../dist ./jinaga-test/jinaga-server/dist
8
+ cp ../package.json ./jinaga-test/jinaga-server/package.json
9
9
  docker build -t jinaga-test ./jinaga-test
10
10
 
11
11
  cleanup() {
package/package.json CHANGED
@@ -1,18 +1,17 @@
1
1
  {
2
2
  "name": "jinaga-server",
3
- "version": "1.1.4",
3
+ "version": "2.0.0",
4
4
  "description": "Application-agnostic back end for web applications",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "scripts": {
8
8
  "clean": "rimraf dist/ && rimraf integration-test/jinaga-test/jinaga/ && rimraf integration-test/jinaga-test/node_modules/",
9
9
  "build": "tsc",
10
- "test": "jest",
10
+ "test": "tsc --noEmit --project tsconfig.test.json && jest",
11
11
  "test:watch": "jest --watch",
12
+ "debug": "node ./dist/debug.js",
12
13
  "prepublishOnly": "npm run clean && npm run build && npm run test",
13
- "integration": "npm run build && cd ./integration-test && ./run.sh",
14
- "interactive": "nodemon -w docs/specification.txt -x \"cat docs/specification.txt | node interactive\"",
15
- "interactive:results": "nodemon -w docs/specification.txt -x \"cat docs/specification.txt | node interactive --results\""
14
+ "integration": "npm run build && cd ./integration-test && ./run.sh"
16
15
  },
17
16
  "repository": {
18
17
  "type": "git",
@@ -43,7 +42,7 @@
43
42
  },
44
43
  "dependencies": {
45
44
  "express": "^4.18.1",
46
- "jinaga": "^4.1.0",
45
+ "jinaga": "^5.0.1",
47
46
  "node-forge": "^1.3.1",
48
47
  "passport": "^0.6.0",
49
48
  "pg": "^8.7.1"
@@ -0,0 +1,31 @@
1
+ import cors = require("cors");
2
+ import express = require("express");
3
+ import * as http from "http";
4
+ import { JinagaServer } from "../src";
5
+ import process = require("process");
6
+
7
+ process.on('SIGINT', () => {
8
+ console.log("\n\nStopping replicator\n");
9
+ process.exit(0);
10
+ });
11
+
12
+ const app = express();
13
+ const server = http.createServer(app);
14
+
15
+ app.set('port', process.env.PORT || 8080);
16
+ app.use(express.json());
17
+ app.use(express.text());
18
+ app.use(cors());
19
+
20
+ const pgConnection = process.env.JINAGA_POSTGRESQL ||
21
+ 'postgresql://dev:devpw@localhost:5432/replicator';
22
+ const { handler } = JinagaServer.create({
23
+ pgStore: pgConnection
24
+ });
25
+
26
+ app.use('/jinaga', handler);
27
+
28
+ server.listen(app.get('port'), () => {
29
+ console.log(` Replicator is running at http://localhost:${app.get('port')} in ${app.get('env')} mode`);
30
+ console.log(' Press CTRL-C to stop\n');
31
+ });