jinaga-server 3.1.0 → 3.1.2
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/README.md +2 -0
- package/dist/http/line-reader.d.ts +2 -0
- package/dist/http/line-reader.js +68 -0
- package/dist/http/line-reader.js.map +1 -0
- package/dist/http/router.d.ts +4 -1
- package/dist/http/router.js +122 -15
- package/dist/http/router.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/jinaga-server.d.ts +1 -0
- package/dist/jinaga-server.js +1 -1
- package/dist/jinaga-server.js.map +1 -1
- package/dist/memory/memory-keystore.js +5 -8
- package/dist/memory/memory-keystore.js.map +1 -1
- package/dist/postgres/postgres-keystore.js +5 -32
- package/dist/postgres/postgres-keystore.js.map +1 -1
- package/http/sans-auth/Feeds options.http +1 -0
- package/http/sans-auth/Save graph.http +6 -0
- package/http/sans-auth/Save json.http +13 -0
- package/http/with-auth/Create post with auth.http +24 -0
- package/http/with-auth/Define authorization rules.http +25 -0
- package/http/with-auth/Define distribution rules.http +30 -0
- package/http/with-auth/Feed sites.http +3 -0
- package/http/with-auth/Feeds options.http +1 -0
- package/http/with-auth/Feeds sites.http +32 -0
- package/http/with-auth/Get posts with auth.http +32 -0
- package/http/with-auth/Load titles.http +21 -0
- package/integration-test/jinaga-test/Dockerfile +1 -1
- package/integration-test/jinaga-test/package-lock.json +6 -5
- package/integration-test/jinaga-test/package.json +1 -1
- package/package.json +3 -5
- package/replicator/index.ts +0 -2
- package/replicator/package-lock.json +29 -75
- package/replicator/package.json +2 -4
- package/src/http/line-reader.ts +69 -0
- package/src/http/router.ts +152 -20
- package/src/index.ts +1 -0
- package/src/jinaga-server.ts +2 -1
- package/src/memory/memory-keystore.ts +7 -10
- package/src/postgres/postgres-keystore.ts +6 -38
- package/dist/http/serializer.d.ts +0 -11
- package/dist/http/serializer.js +0 -68
- package/dist/http/serializer.js.map +0 -1
- package/src/http/serializer.ts +0 -81
- package/test/http/serializerSpec.ts +0 -140
|
@@ -1,140 +0,0 @@
|
|
|
1
|
-
import { GraphSerializer } from "../../src/http/serializer";
|
|
2
|
-
|
|
3
|
-
describe("GraphSerializer", () => {
|
|
4
|
-
it("should write an empty graph", () => {
|
|
5
|
-
let output = "";
|
|
6
|
-
const serializer = new GraphSerializer(chunk => {
|
|
7
|
-
output += chunk;
|
|
8
|
-
});
|
|
9
|
-
|
|
10
|
-
serializer.serialize([]);
|
|
11
|
-
|
|
12
|
-
expect(output).toBe("");
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
it("should write a graph with one fact without signatures", () => {
|
|
16
|
-
let output = "";
|
|
17
|
-
const serializer = new GraphSerializer(chunk => {
|
|
18
|
-
output += chunk;
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
serializer.serialize([{
|
|
22
|
-
fact: {
|
|
23
|
-
type: "MyApp.Root",
|
|
24
|
-
hash: "roothash",
|
|
25
|
-
fields: {
|
|
26
|
-
identifier: "root"
|
|
27
|
-
},
|
|
28
|
-
predecessors: {}
|
|
29
|
-
},
|
|
30
|
-
signatures: []
|
|
31
|
-
}]);
|
|
32
|
-
|
|
33
|
-
expect(output).toBe("\"MyApp.Root\"\n{}\n{\"identifier\":\"root\"}\n\n");
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
it("should write a graph with two facts without signatures", () => {
|
|
37
|
-
let output = "";
|
|
38
|
-
const serializer = new GraphSerializer(chunk => {
|
|
39
|
-
output += chunk;
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
serializer.serialize([{
|
|
43
|
-
fact: {
|
|
44
|
-
type: "MyApp.Root",
|
|
45
|
-
hash: "roothash",
|
|
46
|
-
fields: {},
|
|
47
|
-
predecessors: {}
|
|
48
|
-
},
|
|
49
|
-
signatures: []
|
|
50
|
-
}, {
|
|
51
|
-
fact: {
|
|
52
|
-
type: "MyApp.Child",
|
|
53
|
-
hash: "childhash",
|
|
54
|
-
fields: {},
|
|
55
|
-
predecessors: {
|
|
56
|
-
root: {
|
|
57
|
-
type: "MyApp.Root",
|
|
58
|
-
hash: "roothash"
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
},
|
|
62
|
-
signatures: []
|
|
63
|
-
}]);
|
|
64
|
-
|
|
65
|
-
expect(output).toBe("\"MyApp.Root\"\n{}\n{}\n\n\"MyApp.Child\"\n{\"root\":0}\n{}\n\n");
|
|
66
|
-
});
|
|
67
|
-
|
|
68
|
-
it("should not repeat a fact", () => {
|
|
69
|
-
let output = "";
|
|
70
|
-
const serializer = new GraphSerializer(chunk => {
|
|
71
|
-
output += chunk;
|
|
72
|
-
});
|
|
73
|
-
|
|
74
|
-
serializer.serialize([{
|
|
75
|
-
fact: {
|
|
76
|
-
type: "MyApp.Root",
|
|
77
|
-
hash: "roothash",
|
|
78
|
-
fields: {},
|
|
79
|
-
predecessors: {}
|
|
80
|
-
},
|
|
81
|
-
signatures: []
|
|
82
|
-
}, {
|
|
83
|
-
fact: {
|
|
84
|
-
type: "MyApp.Root",
|
|
85
|
-
hash: "roothash",
|
|
86
|
-
fields: {},
|
|
87
|
-
predecessors: {}
|
|
88
|
-
},
|
|
89
|
-
signatures: []
|
|
90
|
-
}]);
|
|
91
|
-
|
|
92
|
-
expect(output).toBe("\"MyApp.Root\"\n{}\n{}\n\n");
|
|
93
|
-
});
|
|
94
|
-
|
|
95
|
-
it("should write a graph with two facts with signatures", () => {
|
|
96
|
-
let output = "";
|
|
97
|
-
const serializer = new GraphSerializer(chunk => {
|
|
98
|
-
output += chunk;
|
|
99
|
-
});
|
|
100
|
-
|
|
101
|
-
serializer.serialize([{
|
|
102
|
-
fact: {
|
|
103
|
-
type: "MyApp.Root",
|
|
104
|
-
hash: "roothash",
|
|
105
|
-
fields: {},
|
|
106
|
-
predecessors: {}
|
|
107
|
-
},
|
|
108
|
-
signatures: [{
|
|
109
|
-
publicKey: "public",
|
|
110
|
-
signature: "signature"
|
|
111
|
-
}]
|
|
112
|
-
}, {
|
|
113
|
-
fact: {
|
|
114
|
-
type: "MyApp.Child",
|
|
115
|
-
hash: "childhash",
|
|
116
|
-
fields: {},
|
|
117
|
-
predecessors: {
|
|
118
|
-
root: {
|
|
119
|
-
type: "MyApp.Root",
|
|
120
|
-
hash: "roothash"
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
},
|
|
124
|
-
signatures: [{
|
|
125
|
-
publicKey: "public",
|
|
126
|
-
signature: "signature1"
|
|
127
|
-
}, {
|
|
128
|
-
publicKey: "public2",
|
|
129
|
-
signature: "signature2"
|
|
130
|
-
}]
|
|
131
|
-
}]);
|
|
132
|
-
|
|
133
|
-
expect(output).toBe(
|
|
134
|
-
"PK0\n\"public\"\n\n" +
|
|
135
|
-
"\"MyApp.Root\"\n{}\n{}\nPK0\n\"signature\"\n\n" +
|
|
136
|
-
"PK1\n\"public2\"\n\n" +
|
|
137
|
-
"\"MyApp.Child\"\n{\"root\":0}\n{}\nPK0\n\"signature1\"\nPK1\n\"signature2\"\n\n"
|
|
138
|
-
);
|
|
139
|
-
});
|
|
140
|
-
});
|