jinaga-server 1.1.3 → 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 (89) 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 -5
  39. package/dist/postgres/specification-result-sql.js +139 -112
  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 +396 -0
  50. package/docs/sql/example.sql +49 -0
  51. package/docs/sql/first-path.gv +9 -0
  52. package/docs/sql/first-path.png +0 -0
  53. package/docs/sql/model.gv +20 -0
  54. package/docs/sql/model.png +0 -0
  55. package/integration-test/jinaga-test/Dockerfile +2 -2
  56. package/integration-test/jinaga-test/jinaga.test.js +3 -3
  57. package/integration-test/jinaga-test/package-lock.json +745 -3484
  58. package/integration-test/jinaga-test/package.json +2 -0
  59. package/integration-test/run.sh +3 -3
  60. package/package.json +5 -6
  61. package/replicator/index.ts +31 -0
  62. package/replicator/package-lock.json +855 -0
  63. package/replicator/package.json +27 -0
  64. package/replicator/tsconfig.json +15 -0
  65. package/src/authentication/authentication-device.ts +11 -1
  66. package/src/authentication/authentication-impl.ts +9 -2
  67. package/src/authentication/authentication-noop.ts +65 -0
  68. package/src/authentication/authentication-session.ts +11 -1
  69. package/src/authentication.ts +12 -2
  70. package/src/authorization/authorization-keystore.ts +12 -7
  71. package/src/debug.ts +30 -0
  72. package/src/http/router.ts +2 -2
  73. package/src/jinaga-server.ts +18 -8
  74. package/src/memory/memory-keystore.ts +0 -6
  75. package/src/postgres/connection.ts +2 -1
  76. package/src/postgres/maps.ts +8 -0
  77. package/src/postgres/postgres-keystore.ts +2 -8
  78. package/src/postgres/postgres-store.ts +37 -30
  79. package/src/postgres/specification-result-sql.ts +200 -145
  80. package/src/postgres/specification-sql.ts +1 -1
  81. package/src/postgres/sql.ts +23 -12
  82. package/src/util/maps.ts +0 -0
  83. package/test/postgres/postgresReadSpec.ts +292 -0
  84. package/test/postgres/postgresSpec.ts +31 -31
  85. package/test/postgres/postgresSpecificationSpec.ts +1 -1
  86. package/tsconfig.json +1 -0
  87. package/tsconfig.test.json +26 -0
  88. package/docs/specification.txt +0 -41
  89. package/interactive/index.js +0 -56
@@ -1,56 +0,0 @@
1
- const { SpecificationParser } = require("../dist/specification/specification-parser");
2
- const { dehydrateFact } = require("../dist/fact/hydrate");
3
- const { PostgresStore } = require("../dist/postgres/postgres-store")
4
- const fs = require("fs");
5
-
6
- var user = {"publicKey":"-----BEGIN RSA PUBLIC KEY-----\nMIGJAoGBAIBsKomutukULWw2zoTW2ECMrM8VmD2xvfpl3R4qh1whzuXV+A4EfRKMb/UAjEfw\n5nBmWvcObGyYUgygKrlNeOhf3MnDj706rej6ln9cKGL++ZNsJgJsogaAtmkPihWVGi908fdP\nLQrWTF5be0b/ZP258Zs3CTpcRTpTvhzS5TC1AgMBAAE=\n-----END RSA PUBLIC KEY-----\n","type":"Jinaga.User"};
7
-
8
- async function run() {
9
- try {
10
- var postgresStore = new PostgresStore("postgresql://dev:devpw@localhost:5432/improvingu");
11
- try {
12
- var input = fs.readFileSync(0, 'utf-8');
13
- const parser = new SpecificationParser(input);
14
- parser.skipWhitespace();
15
- const userRecord = dehydrateFact(user)[0];
16
- const knownFacts = {
17
- me: {
18
- fact: userRecord,
19
- reference: {
20
- type: userRecord.type,
21
- hash: userRecord.hash
22
- }
23
- }
24
- };
25
- var declaration = parser.parseDeclaration(knownFacts);
26
- var specification = parser.parseSpecification();
27
-
28
- // Select starting facts that match the inputs
29
- const start = specification.given.map(input => {
30
- const fact = declaration[input.name];
31
- if (!fact) {
32
- throw new Error(`No fact named ${input.name} was declared`);
33
- }
34
- return fact.reference;
35
- });
36
-
37
- const args = process.argv.slice(2);
38
- const produceResults = args.includes("--results");
39
- if (produceResults) {
40
- const results = await postgresStore.resultsFromSpecification(start, specification);
41
- console.log(JSON.stringify(results, null, 2));
42
- }
43
- else {
44
- const streams = await postgresStore.streamsFromSpecification(start, [], 3, specification);
45
- console.log(JSON.stringify(streams, null, 2));
46
- }
47
- }
48
- finally {
49
- postgresStore.close();
50
- }
51
- } catch (e) {
52
- console.error(e);
53
- }
54
- }
55
-
56
- run();