jinaga-server 1.0.0 → 1.1.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.
- package/README.md +103 -0
- package/dist/authentication/authentication-device.d.ts +3 -1
- package/dist/authentication/authentication-device.js +3 -0
- package/dist/authentication/authentication-device.js.map +1 -1
- package/dist/authentication/authentication-impl.d.ts +3 -2
- package/dist/authentication/authentication-impl.js +3 -0
- package/dist/authentication/authentication-impl.js.map +1 -1
- package/dist/authentication/authentication-session.d.ts +4 -2
- package/dist/authentication/authentication-session.js +7 -2
- package/dist/authentication/authentication-session.js.map +1 -1
- package/dist/authentication.d.ts +5 -4
- package/dist/authentication.js +3 -0
- package/dist/authentication.js.map +1 -1
- package/dist/authorization/authorization-keystore.d.ts +5 -3
- package/dist/authorization/authorization-keystore.js +12 -9
- package/dist/authorization/authorization-keystore.js.map +1 -1
- package/dist/http/feed-cache.d.ts +5 -0
- package/dist/http/feed-cache.js +3 -0
- package/dist/http/feed-cache.js.map +1 -0
- package/dist/http/node-http.js +4 -1
- package/dist/http/node-http.js.map +1 -1
- package/dist/http/router.d.ts +5 -1
- package/dist/http/router.js +157 -24
- package/dist/http/router.js.map +1 -1
- package/dist/jinaga-server.js +6 -4
- package/dist/jinaga-server.js.map +1 -1
- package/dist/memory/memory-feed-cache.d.ts +7 -0
- package/dist/memory/memory-feed-cache.js +17 -0
- package/dist/memory/memory-feed-cache.js.map +1 -0
- package/dist/postgres/postgres-store.d.ts +5 -2
- package/dist/postgres/postgres-store.js +53 -28
- package/dist/postgres/postgres-store.js.map +1 -1
- package/dist/postgres/specification-result-sql.d.ts +11 -4
- package/dist/postgres/specification-result-sql.js +302 -5
- package/dist/postgres/specification-result-sql.js.map +1 -1
- package/dist/postgres/specification-sql.d.ts +14 -3
- package/dist/postgres/specification-sql.js +233 -100
- package/dist/postgres/specification-sql.js.map +1 -1
- package/package.json +2 -2
- package/src/authentication/authentication-device.ts +6 -0
- package/src/authentication/authentication-impl.ts +6 -3
- package/src/authentication/authentication-session.ts +11 -3
- package/src/authentication.ts +18 -5
- package/src/authorization/authorization-keystore.ts +14 -8
- package/src/http/feed-cache.ts +6 -0
- package/src/http/node-http.ts +5 -2
- package/src/http/router.ts +179 -31
- package/src/jinaga-server.ts +11 -9
- package/src/memory/memory-feed-cache.ts +15 -0
- package/src/postgres/postgres-store.ts +59 -31
- package/src/postgres/specification-result-sql.ts +450 -10
- package/src/postgres/specification-sql.ts +335 -115
- package/test/authorization/authorizationSpec.ts +11 -2
- package/test/postgres/postgresSpec.ts +31 -25
- package/test/postgres/postgresSpecificationSpec.ts +40 -68
- package/dist/postgres/query-description-builder.d.ts +0 -13
- package/dist/postgres/query-description-builder.js +0 -104
- package/dist/postgres/query-description-builder.js.map +0 -1
- package/dist/postgres/query-description.d.ts +0 -71
- package/dist/postgres/query-description.js +0 -256
- package/dist/postgres/query-description.js.map +0 -1
- package/src/postgres/query-description-builder.ts +0 -116
- package/src/postgres/query-description.ts +0 -385
package/README.md
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
# Jinaga Server
|
|
2
|
+
|
|
3
|
+
Application-agnostic back end for web applications.
|
|
4
|
+
|
|
5
|
+
Run a Jinaga server in Node to create your own custom Jinaga Replicator.
|
|
6
|
+
Serve up or point a Jinaga client at this server to expose the data to the user.
|
|
7
|
+
Updates from the application are automatically sent to the server.
|
|
8
|
+
Changes needed in the application are automatically fetched from the server.
|
|
9
|
+
|
|
10
|
+
## Install
|
|
11
|
+
|
|
12
|
+
Install Jinaga Server from the NPM package.
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
npm i jinaga-server
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
See [jinaga.com](https://jinaga.com) for details on how to use this package.
|
|
19
|
+
|
|
20
|
+
## Running a Database in a Docker Container
|
|
21
|
+
|
|
22
|
+
The Jinaga server stores its data in a PostgreSQL database.
|
|
23
|
+
The easiest way to get a database up and running is to start a Docker container.
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
docker run --name jinaga-postgres -p5432:5432 -e POSTGRES_PASSWORD=secretpw -e APP_USERNAME=appuser -e APP_PASSWORD=apppw -e APP_DATABASE=appdb jinaga/jinaga-postgres-fact-keystore
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Installing a Database
|
|
30
|
+
|
|
31
|
+
If you are running Postgres yourself, you can create a Jinaga database on your server.
|
|
32
|
+
The setup script is written for Linux.
|
|
33
|
+
To run the script, make sure you have the `psql` command [installed](https://www.postgresql.org/download/).
|
|
34
|
+
To check, run:
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
psql --version
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
If you don't have `psql` installed, install it:
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
|
|
44
|
+
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
|
|
45
|
+
sudo apt-get update
|
|
46
|
+
sudo apt-get install postgresql-client
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Then run the setup script.
|
|
50
|
+
To create a new database, you will need to know the following information about your PostgreSQL installation:
|
|
51
|
+
|
|
52
|
+
- Host name
|
|
53
|
+
- Port (probably 5432)
|
|
54
|
+
- Admin user name (probably postgres)
|
|
55
|
+
- Admin database name (also probably postgres)
|
|
56
|
+
- Admin password
|
|
57
|
+
|
|
58
|
+
Then you will need to decide on the following:
|
|
59
|
+
|
|
60
|
+
- Application user name
|
|
61
|
+
- Application database name
|
|
62
|
+
- Application password
|
|
63
|
+
|
|
64
|
+
Once you have those values, set some environment variables and run the script:
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
export JINAGA_POSTGRES_HOST="localhost"
|
|
68
|
+
export JINAGA_POSTGRES_PORT="5432"
|
|
69
|
+
export JINAGA_POSTGRES_ADMIN_USER="postgres"
|
|
70
|
+
export JINAGA_POSTGRES_ADMIN_DATABASE="postgres"
|
|
71
|
+
export JINAGA_POSTGRES_ADMIN_PASSWORD="$ecr3t"
|
|
72
|
+
export JINAGA_POSTGRES_APP_USER="appuser"
|
|
73
|
+
export JINAGA_POSTGRES_APP_DATABASE="appdb"
|
|
74
|
+
export JINAGA_POSTGRES_APP_PASSWORD="apppw"
|
|
75
|
+
|
|
76
|
+
./setup.sh
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
Or if you are running from the installed package, run the script from `node_modules`:
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
./node_modules/jinaga-server/setup.sh
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## Migrating from version 2
|
|
86
|
+
|
|
87
|
+
If you are already running a Jinaga database, whether in a container or on your own PostgreSQL server, you will need to upgrade to get it to work with version 3.
|
|
88
|
+
The Jinaga server version 2 used a less efficient database schema.
|
|
89
|
+
Run the setup script as described above to upgrade the database schema.
|
|
90
|
+
|
|
91
|
+
Your data is moved to a new Postgres schema called `legacy`.
|
|
92
|
+
It is not modified during the process.
|
|
93
|
+
Nevertheless, it would be wise to back up your database before running this operation.
|
|
94
|
+
|
|
95
|
+
## Build
|
|
96
|
+
|
|
97
|
+
To build Jinaga server, you will need Node 16.
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
npm ci
|
|
101
|
+
npm run build
|
|
102
|
+
npm test
|
|
103
|
+
```
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { Channel, FactEnvelope, FactRecord, FactReference, Fork, LoginResponse, Observable, Query, Specification, UserIdentity } from "jinaga";
|
|
1
|
+
import { Channel, FactEnvelope, FactRecord, FactReference, Feed, Fork, LoginResponse, Observable, Query, Specification, UserIdentity } from "jinaga";
|
|
2
|
+
import { FactFeed } from "jinaga/dist/storage";
|
|
2
3
|
import { Keystore } from "../keystore";
|
|
3
4
|
import { Authentication } from "./authentication";
|
|
4
5
|
export declare class AuthenticationDevice implements Authentication {
|
|
@@ -13,6 +14,7 @@ export declare class AuthenticationDevice implements Authentication {
|
|
|
13
14
|
save(envelopes: FactEnvelope[]): Promise<FactEnvelope[]>;
|
|
14
15
|
query(start: FactReference, query: Query): Promise<FactReference[][]>;
|
|
15
16
|
read(start: FactReference[], specification: Specification): Promise<any[]>;
|
|
17
|
+
feed(feed: Feed, bookmark: string): Promise<FactFeed>;
|
|
16
18
|
whichExist(references: FactReference[]): Promise<FactReference[]>;
|
|
17
19
|
load(references: FactReference[]): Promise<FactRecord[]>;
|
|
18
20
|
addChannel(fact: FactReference, query: Query): Channel;
|
|
@@ -44,6 +44,9 @@ class AuthenticationDevice {
|
|
|
44
44
|
read(start, specification) {
|
|
45
45
|
return this.inner.read(start, specification);
|
|
46
46
|
}
|
|
47
|
+
feed(feed, bookmark) {
|
|
48
|
+
return this.inner.feed(feed, bookmark);
|
|
49
|
+
}
|
|
47
50
|
whichExist(references) {
|
|
48
51
|
throw new Error("whichExist method not implemented on AuthenticationDevice.");
|
|
49
52
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authentication-device.js","sourceRoot":"","sources":["../../src/authentication/authentication-device.ts"],"names":[],"mappings":";;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"authentication-device.js","sourceRoot":"","sources":["../../src/authentication/authentication-device.ts"],"names":[],"mappings":";;;;;;;;;;;;AAkBA,MAAa,oBAAoB;IAC7B,YACY,KAAW,EACX,QAAkB,EAClB,mBAAiC;QAFjC,UAAK,GAAL,KAAK,CAAM;QACX,aAAQ,GAAR,QAAQ,CAAU;QAClB,wBAAmB,GAAnB,mBAAmB,CAAc;IAC1C,CAAC;IAEE,KAAK;;YACP,MAAM,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;YACzB,MAAM,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC;QAChC,CAAC;KAAA;IAEK,KAAK;;YACP,MAAM,IAAI,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}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { Channel, FactEnvelope, FactRecord, FactReference, Fork, Observable, Query, Specification, WebClient } from "jinaga";
|
|
1
|
+
import { Channel, FactEnvelope, FactRecord, FactReference, Feed, Fork, Observable, Query, Specification, WebClient } from "jinaga";
|
|
2
|
+
import { FactFeed } from "jinaga/dist/storage";
|
|
2
3
|
import { Authentication } from "./authentication";
|
|
3
4
|
export declare class Principal {
|
|
4
5
|
}
|
|
5
6
|
export declare class AuthenticationImpl implements Authentication {
|
|
6
7
|
private inner;
|
|
7
8
|
private client;
|
|
8
|
-
private principal;
|
|
9
9
|
constructor(inner: Fork, client: WebClient);
|
|
10
10
|
close(): Promise<void>;
|
|
11
11
|
login(): Promise<import("jinaga").LoginResponse>;
|
|
@@ -13,6 +13,7 @@ export declare class AuthenticationImpl implements Authentication {
|
|
|
13
13
|
save(envelopes: FactEnvelope[]): Promise<FactEnvelope[]>;
|
|
14
14
|
query(start: FactReference, query: Query): Promise<import("jinaga").FactPath[]>;
|
|
15
15
|
read(start: FactReference[], specification: Specification): Promise<any[]>;
|
|
16
|
+
feed(feed: Feed, bookmark: string): Promise<FactFeed>;
|
|
16
17
|
whichExist(references: FactReference[]): Promise<FactReference[]>;
|
|
17
18
|
load(references: FactReference[]): Promise<FactRecord[]>;
|
|
18
19
|
from(fact: FactReference, query: Query): Observable;
|
|
@@ -41,6 +41,9 @@ class AuthenticationImpl {
|
|
|
41
41
|
read(start, specification) {
|
|
42
42
|
return this.inner.read(start, specification);
|
|
43
43
|
}
|
|
44
|
+
feed(feed, bookmark) {
|
|
45
|
+
return this.inner.feed(feed, bookmark);
|
|
46
|
+
}
|
|
44
47
|
whichExist(references) {
|
|
45
48
|
throw new Error("whichExist method not implemented on AuthenticationImpl.");
|
|
46
49
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authentication-impl.js","sourceRoot":"","sources":["../../src/authentication/authentication-impl.ts"],"names":[],"mappings":";;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"authentication-impl.js","sourceRoot":"","sources":["../../src/authentication/authentication-impl.ts"],"names":[],"mappings":";;;;;;;;;;;;AAKA,MAAa,SAAS;CAErB;AAFD,8BAEC;AAED,MAAa,kBAAkB;IAC3B,YAAoB,KAAW,EAAU,MAAiB;QAAtC,UAAK,GAAL,KAAK,CAAM;QAAU,WAAM,GAAN,MAAM,CAAW;IAC1D,CAAC;IAEK,KAAK;;YACP,MAAM,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;QAC7B,CAAC;KAAA;IAED,KAAK;QACD,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;IAC/B,CAAC;IAED,KAAK;QACD,MAAM,IAAI,KAAK,CAAC,kCAAkC,CAAC,CAAC;IACxD,CAAC;IAEK,IAAI,CAAC,SAAyB;;YAChC,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;YAC/C,OAAO,KAAK,CAAC;QACjB,CAAC;KAAA;IAED,KAAK,CAAC,KAAoB,EAAE,KAAY;QACpC,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;IAC1C,CAAC;IAED,IAAI,CAAC,KAAsB,EAAE,aAA4B;QACrD,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,EAAE,aAAa,CAAC,CAAC;IACjD,CAAC;IAED,IAAI,CAAC,IAAU,EAAE,QAAgB;QAC7B,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;IAC3C,CAAC;IAED,UAAU,CAAC,UAA2B;QAClC,MAAM,IAAI,KAAK,CAAC,0DAA0D,CAAC,CAAC;IAChF,CAAC;IAED,IAAI,CAAC,UAA2B;QAC5B,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IACvC,CAAC;IAED,IAAI,CAAC,IAAmB,EAAE,KAAY;QAClC,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IACxC,CAAC;IAED,UAAU,CAAC,IAAmB,EAAE,KAAY;QACxC,OAAO,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAC9C,CAAC;IAED,aAAa,CAAC,OAAgB;QAC1B,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;IACtC,CAAC;CACJ;AApDD,gDAoDC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { AuthorizationRules, Channel, FactEnvelope, FactRecord, FactReference, Feed, LoginResponse, Observable, Query, Specification, UserIdentity } from "jinaga";
|
|
1
|
+
import { AuthorizationRules, Channel, FactEnvelope, FactRecord, FactReference, Feed, LoginResponse, Observable, ObservableSource, Query, Specification, UserIdentity } from "jinaga";
|
|
2
|
+
import { FactFeed } from "jinaga/dist/storage";
|
|
2
3
|
import { Keystore } from "../keystore";
|
|
3
4
|
import { Authentication } from "./authentication";
|
|
4
5
|
export declare class AuthenticationSession implements Authentication {
|
|
@@ -8,7 +9,7 @@ export declare class AuthenticationSession implements Authentication {
|
|
|
8
9
|
private displayName;
|
|
9
10
|
private localDeviceIdentity;
|
|
10
11
|
private authorizationEngine;
|
|
11
|
-
constructor(inner:
|
|
12
|
+
constructor(inner: ObservableSource, keystore: Keystore, authorizationRules: AuthorizationRules | null, userIdentity: UserIdentity, displayName: string, localDeviceIdentity: UserIdentity);
|
|
12
13
|
close(): Promise<void>;
|
|
13
14
|
login(): Promise<LoginResponse>;
|
|
14
15
|
local(): Promise<FactRecord>;
|
|
@@ -16,6 +17,7 @@ export declare class AuthenticationSession implements Authentication {
|
|
|
16
17
|
save(envelopes: FactEnvelope[]): Promise<FactEnvelope[]>;
|
|
17
18
|
query(start: FactReference, query: Query): Promise<FactReference[][]>;
|
|
18
19
|
read(start: FactReference[], specification: Specification): Promise<any[]>;
|
|
20
|
+
feed(feed: Feed, bookmark: string): Promise<FactFeed>;
|
|
19
21
|
whichExist(references: FactReference[]): Promise<FactReference[]>;
|
|
20
22
|
load(references: FactReference[]): Promise<FactRecord[]>;
|
|
21
23
|
addChannel(fact: FactReference, query: Query): Channel;
|
|
@@ -58,7 +58,9 @@ class AuthenticationSession {
|
|
|
58
58
|
return __awaiter(this, void 0, void 0, function* () {
|
|
59
59
|
const userFact = yield this.keystore.getUserFact(this.userIdentity);
|
|
60
60
|
const facts = envelopes.map(envelope => envelope.fact);
|
|
61
|
-
const authorizedFacts =
|
|
61
|
+
const authorizedFacts = this.authorizationEngine
|
|
62
|
+
? yield this.authorizationEngine.authorizeFacts(facts, userFact)
|
|
63
|
+
: facts;
|
|
62
64
|
const signedFacts = yield this.keystore.signFacts(this.userIdentity, authorizedFacts);
|
|
63
65
|
return yield this.inner.save(signedFacts);
|
|
64
66
|
});
|
|
@@ -69,6 +71,9 @@ class AuthenticationSession {
|
|
|
69
71
|
read(start, specification) {
|
|
70
72
|
return this.inner.read(start, specification);
|
|
71
73
|
}
|
|
74
|
+
feed(feed, bookmark) {
|
|
75
|
+
return this.inner.feed(feed, bookmark);
|
|
76
|
+
}
|
|
72
77
|
whichExist(references) {
|
|
73
78
|
throw new Error("WhichExist method not implemented on AuthenticationSession.");
|
|
74
79
|
}
|
|
@@ -76,7 +81,7 @@ class AuthenticationSession {
|
|
|
76
81
|
return this.inner.load(references);
|
|
77
82
|
}
|
|
78
83
|
addChannel(fact, query) {
|
|
79
|
-
return
|
|
84
|
+
return new jinaga_1.Channel(() => __awaiter(this, void 0, void 0, function* () { }));
|
|
80
85
|
}
|
|
81
86
|
removeChannel(channel) {
|
|
82
87
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authentication-session.js","sourceRoot":"","sources":["../../src/authentication/authentication-session.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"authentication-session.js","sourceRoot":"","sources":["../../src/authentication/authentication-session.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,mCAcgB;AAMhB,MAAa,qBAAqB;IAG9B,YACY,KAAuB,EACvB,QAAkB,EAC1B,kBAA6C,EACrC,YAA0B,EAC1B,WAAmB,EACnB,mBAAiC;QALjC,UAAK,GAAL,KAAK,CAAkB;QACvB,aAAQ,GAAR,QAAQ,CAAU;QAElB,iBAAY,GAAZ,YAAY,CAAc;QAC1B,gBAAW,GAAX,WAAW,CAAQ;QACnB,wBAAmB,GAAnB,mBAAmB,CAAc;QAEzC,IAAI,CAAC,mBAAmB,GAAG,kBAAkB;YACzC,IAAI,4BAAmB,CAAC,kBAAkB,EAAE,KAAK,CAAC,CAAC;IAC3D,CAAC;IAEK,KAAK;;YACP,MAAM,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;YACzB,MAAM,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC;QAChC,CAAC;KAAA;IAEK,KAAK;;YACP,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,mBAAmB,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;YAC5E,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,IAAI,CAAC,YAAY,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC;YACjF,MAAM,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;YACnC,OAAO;gBACH,QAAQ;gBACR,OAAO,EAAE;oBACL,WAAW,EAAE,IAAI,CAAC,WAAW;iBAChC;aACJ,CAAC;QACN,CAAC;KAAA;IAEK,KAAK;;YACP,MAAM,UAAU,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,qBAAqB,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC;YACvF,MAAM,UAAU,GAAiB;gBAC7B,IAAI,EAAE,UAAU;gBAChB,UA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AC,CAAC;IAC3C,CAAC;IAED,UAAU,CAAC,UAA2B;QAClC,MAAM,IAAI,KAAK,CAAC,6DAA6D,CAAC,CAAC;IACnF,CAAC;IAED,IAAI,CAAC,UAA2B;QAC5B,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IACvC,CAAC;IAED,UAAU,CAAC,IAAmB,EAAE,KAAY;QACxC,OAAO,IAAI,gBAAO,CAAC,GAAS,EAAE,gDAAE,CAAC,CAAA,CAAC,CAAC;IACvC,CAAC;IAED,aAAa,CAAC,OAAgB;IAC9B,CAAC;CACJ;AAlFD,sDAkFC"}
|
package/dist/authentication.d.ts
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
import { FactEnvelope, FactRecord, FactReference, Feed, Observable, Query, Specification, WebClient } from "jinaga";
|
|
1
|
+
import { FactEnvelope, FactRecord, FactReference, Feed, Observable, ObservableSource, Query, Specification, WebClient } from "jinaga";
|
|
2
|
+
import { FactFeed } from "jinaga/dist/storage";
|
|
2
3
|
export declare class Principal {
|
|
3
4
|
}
|
|
4
|
-
export declare class Authentication implements
|
|
5
|
+
export declare class Authentication implements ObservableSource {
|
|
5
6
|
private inner;
|
|
6
7
|
private client;
|
|
7
|
-
|
|
8
|
-
constructor(inner: Feed, client: WebClient);
|
|
8
|
+
constructor(inner: ObservableSource, client: WebClient);
|
|
9
9
|
close(): Promise<void>;
|
|
10
10
|
login(): Promise<import("jinaga").LoginResponse>;
|
|
11
11
|
save(envelopes: FactEnvelope[]): Promise<FactEnvelope[]>;
|
|
12
12
|
query(start: FactReference, query: Query): Promise<import("jinaga").FactPath[]>;
|
|
13
13
|
read(start: FactReference[], specification: Specification): Promise<any[]>;
|
|
14
|
+
feed(feed: Feed, bookmark: string): Promise<FactFeed>;
|
|
14
15
|
whichExist(references: FactReference[]): Promise<FactReference[]>;
|
|
15
16
|
load(references: FactReference[]): Promise<FactRecord[]>;
|
|
16
17
|
from(fact: FactReference, query: Query): Observable;
|
package/dist/authentication.js
CHANGED
|
@@ -38,6 +38,9 @@ class Authentication {
|
|
|
38
38
|
read(start, specification) {
|
|
39
39
|
return this.inner.read(start, specification);
|
|
40
40
|
}
|
|
41
|
+
feed(feed, bookmark) {
|
|
42
|
+
return this.inner.feed(feed, bookmark);
|
|
43
|
+
}
|
|
41
44
|
whichExist(references) {
|
|
42
45
|
throw new Error("whichExist method not implemented on Authentication.");
|
|
43
46
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authentication.js","sourceRoot":"","sources":["../src/authentication.ts"],"names":[],"mappings":";;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"authentication.js","sourceRoot":"","sources":["../src/authentication.ts"],"names":[],"mappings":";;;;;;;;;;;;AAaA,MAAa,SAAS;CAErB;AAFD,8BAEC;AAED,MAAa,cAAc;IACvB,YAAoB,KAAuB,EAAU,MAAiB;QAAlD,UAAK,GAAL,KAAK,CAAkB;QAAU,WAAM,GAAN,MAAM,CAAW;IACtE,CAAC;IAEK,KAAK;;YACP,MAAM,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;QAC7B,CAAC;KAAA;IAED,KAAK;QACD,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;IAC/B,CAAC;IAEK,IAAI,CAAC,SAAyB;;YAChC,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;YAC/C,OAAO,KAAK,CAAC;QACjB,CAAC;KAAA;IAED,KAAK,CAAC,KAAoB,EAAE,KAAY;QACpC,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;IAC1C,CAAC;IAED,IAAI,CAAC,KAAsB,EAAE,aAA4B;QACrD,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,EAAE,aAAa,CAAC,CAAC;IACjD,CAAC;IAED,IAAI,CAAC,IAAU,EAAE,QAAgB;QAC7B,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;IAC3C,CAAC;IAED,UAAU,CAAC,UAA2B;QAClC,MAAM,IAAI,KAAK,CAAC,sDAAsD,CAAC,CAAC;IAC5E,CAAC;IAED,IAAI,CAAC,UAA2B;QAC5B,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IACvC,CAAC;IAED,IAAI,CAAC,IAAmB,EAAE,KAAY;QAClC,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IACxC,CAAC;CACJ;AAxCD,wCAwCC"}
|
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
import { Authorization, AuthorizationRules, FactRecord, FactReference, Feed, Query, Specification, UserIdentity } from "jinaga";
|
|
1
|
+
import { Authorization, AuthorizationRules, FactRecord, FactReference, Feed, ObservableSource, Query, Specification, UserIdentity } from "jinaga";
|
|
2
|
+
import { FactFeed } from "jinaga/dist/storage";
|
|
2
3
|
import { Keystore } from "../keystore";
|
|
3
4
|
export declare class AuthorizationKeystore implements Authorization {
|
|
4
|
-
private
|
|
5
|
+
private observableSource;
|
|
5
6
|
private keystore;
|
|
6
7
|
private authorizationEngine;
|
|
7
|
-
constructor(
|
|
8
|
+
constructor(observableSource: ObservableSource, keystore: Keystore, authorizationRules: AuthorizationRules | null);
|
|
8
9
|
getOrCreateUserFact(userIdentity: UserIdentity): Promise<FactRecord>;
|
|
9
10
|
query(userIdentity: UserIdentity, start: FactReference, query: Query): Promise<import("jinaga").FactPath[]>;
|
|
10
11
|
read(userIdentity: UserIdentity, start: FactReference[], specification: Specification): Promise<any[]>;
|
|
12
|
+
feed(userIdentity: UserIdentity, feed: Feed, bookmark: string): Promise<FactFeed>;
|
|
11
13
|
load(userIdentity: UserIdentity, references: FactReference[]): Promise<FactRecord[]>;
|
|
12
14
|
save(userIdentity: UserIdentity, facts: FactRecord[]): Promise<FactRecord[]>;
|
|
13
15
|
}
|
|
@@ -12,11 +12,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.AuthorizationKeystore = void 0;
|
|
13
13
|
const jinaga_1 = require("jinaga");
|
|
14
14
|
class AuthorizationKeystore {
|
|
15
|
-
constructor(
|
|
16
|
-
this.
|
|
15
|
+
constructor(observableSource, keystore, authorizationRules) {
|
|
16
|
+
this.observableSource = observableSource;
|
|
17
17
|
this.keystore = keystore;
|
|
18
18
|
this.authorizationEngine = authorizationRules &&
|
|
19
|
-
new jinaga_1.AuthorizationEngine(authorizationRules,
|
|
19
|
+
new jinaga_1.AuthorizationEngine(authorizationRules, observableSource);
|
|
20
20
|
}
|
|
21
21
|
getOrCreateUserFact(userIdentity) {
|
|
22
22
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -27,23 +27,26 @@ class AuthorizationKeystore {
|
|
|
27
27
|
signatures: []
|
|
28
28
|
}
|
|
29
29
|
];
|
|
30
|
-
yield this.
|
|
30
|
+
yield this.observableSource.save(envelopes);
|
|
31
31
|
return userFact;
|
|
32
32
|
});
|
|
33
33
|
}
|
|
34
34
|
query(userIdentity, start, query) {
|
|
35
|
-
return this.
|
|
35
|
+
return this.observableSource.query(start, query);
|
|
36
36
|
}
|
|
37
37
|
read(userIdentity, start, specification) {
|
|
38
|
-
return this.
|
|
38
|
+
return this.observableSource.read(start, specification);
|
|
39
|
+
}
|
|
40
|
+
feed(userIdentity, feed, bookmark) {
|
|
41
|
+
return this.observableSource.feed(feed, bookmark);
|
|
39
42
|
}
|
|
40
43
|
load(userIdentity, references) {
|
|
41
|
-
return this.
|
|
44
|
+
return this.observableSource.load(references);
|
|
42
45
|
}
|
|
43
46
|
save(userIdentity, facts) {
|
|
44
47
|
return __awaiter(this, void 0, void 0, function* () {
|
|
45
48
|
if (!this.authorizationEngine) {
|
|
46
|
-
const envelopes = yield this.
|
|
49
|
+
const envelopes = yield this.observableSource.save(facts.map(fact => ({
|
|
47
50
|
fact,
|
|
48
51
|
signatures: []
|
|
49
52
|
})));
|
|
@@ -52,7 +55,7 @@ class AuthorizationKeystore {
|
|
|
52
55
|
const userFact = yield this.keystore.getUserFact(userIdentity);
|
|
53
56
|
const authorizedFacts = yield this.authorizationEngine.authorizeFacts(facts, userFact);
|
|
54
57
|
const signedFacts = yield this.keystore.signFacts(userIdentity, authorizedFacts);
|
|
55
|
-
const envelopes = yield this.
|
|
58
|
+
const envelopes = yield this.observableSource.save(signedFacts);
|
|
56
59
|
return envelopes.map(envelope => envelope.fact);
|
|
57
60
|
});
|
|
58
61
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authorization-keystore.js","sourceRoot":"","sources":["../../src/authorization/authorization-keystore.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"authorization-keystore.js","sourceRoot":"","sources":["../../src/authorization/authorization-keystore.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,mCAYgB;AAKhB,MAAa,qBAAqB;IAG9B,YACY,gBAAkC,EAClC,QAAkB,EAC1B,kBAA6C;QAFrC,qBAAgB,GAAhB,gBAAgB,CAAkB;QAClC,aAAQ,GAAR,QAAQ,CAAU;QAG1B,IAAI,CAAC,mBAAmB,GAAG,kBAAkB;YACzC,IAAI,4BAAmB,CAAC,kBAAkB,EAAE,gBAAgB,CAAC,CAAC;IACtE,CAAC;IAEK,mBAAmB,CAAC,YAA0B;;YAChD,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,mBAAmB,CAAC,YAAY,CAAC,CAAC;YACvE,MAAM,SAAS,GAAG;gBACA;oBACV,IAAI,EAAE,QAAQ;oBACd,UAAU,EAAE,EAAE;iBACjB;aACJ,CAAC;YACF,MAAM,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;YAC5C,OAAO,QAAQ,CAAC;QACpB,CAAC;KAAA;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,MAAM,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;YAChE,OAAO,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QACpD,CAAC;KAAA;CACJ;AAvDD,sDAuDC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"feed-cache.js","sourceRoot":"","sources":["../../src/http/feed-cache.ts"],"names":[],"mappings":""}
|
package/dist/http/node-http.js
CHANGED
|
@@ -84,7 +84,7 @@ class NodeHttpConnection {
|
|
|
84
84
|
if (res.statusCode === 403) {
|
|
85
85
|
reject(response);
|
|
86
86
|
}
|
|
87
|
-
else if (res.statusCode >= 400) {
|
|
87
|
+
else if (!res.statusCode || res.statusCode >= 400) {
|
|
88
88
|
resolve({
|
|
89
89
|
result: "retry",
|
|
90
90
|
error: response
|
|
@@ -120,6 +120,9 @@ class NodeHttpConnection {
|
|
|
120
120
|
}
|
|
121
121
|
exports.NodeHttpConnection = NodeHttpConnection;
|
|
122
122
|
function isJsonResult(contentType) {
|
|
123
|
+
if (!contentType) {
|
|
124
|
+
return false;
|
|
125
|
+
}
|
|
123
126
|
const json = contentType.split(";").indexOf("application/json");
|
|
124
127
|
return json >= 0;
|
|
125
128
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node-http.js","sourceRoot":"","sources":["../../src/http/node-http.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2CAA6B;AAC7B,6CAA+B;AAE/B,yCAA2B;AAE3B,MAAa,kBAAkB;IAC3B,YACY,GAAW;QAAX,QAAG,GAAH,GAAG,CAAQ;IACvB,CAAC;IAED,GAAG,CAAC,IAAY;QACZ,OAAO,IAAI,OAAO,CAAK,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACvC,MAAM,EAAE,QAAQ,EAAE,GAAG,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC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BACN,MAAM,CAAC,CAAC,CAAC,CAAC;yBACb;qBACJ;yBACI;wBACD,MAAM,CAAC,QAAQ,CAAC,CAAC;qBACpB;gBACL,CAAC,CAAC,CAAC;YACP,CAAC,CAAC,CAAC;YAEH,GAAG,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,CAAC,EAAE;gBAClB,OAAO,CAAC;oBACJ,MAAM,EAAE,SAAS;oBACjB,KAAK,EAAE,GAAG,CAAC,OAAO;iBACrB,CAAC,CAAC;YACP,CAAC,CAAC,CAAC;YAEH,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC;YAChC,GAAG,CAAC,GAAG,EAAE,CAAC;QACd,CAAC,CAAC,CAAC;IACP,CAAC;CACJ;AA/FD,gDA+FC;AAED,SAAS,YAAY,CAAC,WAA+B;IACjD,IAAI,CAAC,WAAW,EAAE;QACd,OAAO,KAAK,CAAC;KAChB;IACD,MAAM,IAAI,GAAG,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,kBAAkB,CAAC,CAAC;IAChE,OAAO,IAAI,IAAI,CAAC,CAAC;AACrB,CAAC"}
|
package/dist/http/router.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Handler } from "express";
|
|
2
2
|
import { Authorization, ProfileMessage } from "jinaga";
|
|
3
|
+
import { FeedCache } from "./feed-cache";
|
|
3
4
|
export interface RequestUser {
|
|
4
5
|
provider: string;
|
|
5
6
|
id: string;
|
|
@@ -7,14 +8,17 @@ export interface RequestUser {
|
|
|
7
8
|
}
|
|
8
9
|
export declare class HttpRouter {
|
|
9
10
|
private authorization;
|
|
11
|
+
private feedCache;
|
|
10
12
|
handler: Handler;
|
|
11
|
-
constructor(authorization: Authorization);
|
|
13
|
+
constructor(authorization: Authorization, feedCache: FeedCache);
|
|
12
14
|
private login;
|
|
13
15
|
private query;
|
|
14
16
|
private load;
|
|
15
17
|
private save;
|
|
16
18
|
private read;
|
|
17
19
|
private write;
|
|
20
|
+
private feeds;
|
|
18
21
|
private feed;
|
|
19
22
|
private getKnownFacts;
|
|
23
|
+
private selectStart;
|
|
20
24
|
}
|