jinaga-server 2.1.0 → 2.1.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.
package/README.md
CHANGED
|
@@ -112,4 +112,15 @@ npm test
|
|
|
112
112
|
npm run debug
|
|
113
113
|
```
|
|
114
114
|
- Use Postman to "post" facts to http://localhost:8080/jinaga/write or to "post" specifications to http://localhost:8080/jinaga/read .
|
|
115
|
-
- The debugger will break when it reaches a breakpoint.
|
|
115
|
+
- The debugger will break when it reaches a breakpoint.
|
|
116
|
+
|
|
117
|
+
## Release
|
|
118
|
+
|
|
119
|
+
To release a new version of Jinaga server, bump the version number, create a new release
|
|
120
|
+
from the generated tag, and let GitHub Actions do the rest.
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
npm version patch
|
|
124
|
+
git push --follow-tags
|
|
125
|
+
gh release create v$(node -p "require('./package.json').version") --generate-notes --verify-tag
|
|
126
|
+
```
|
package/dist/jinaga-server.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { Handler, Request } from "express";
|
|
2
|
-
import { AuthorizationRules, Jinaga } from "jinaga";
|
|
2
|
+
import { AuthorizationRules, Jinaga, Model } from "jinaga";
|
|
3
3
|
export declare type JinagaServerConfig = {
|
|
4
4
|
pgStore?: string;
|
|
5
5
|
pgKeystore?: string;
|
|
6
6
|
httpEndpoint?: string;
|
|
7
|
+
model?: Model;
|
|
7
8
|
authorization?: (a: AuthorizationRules) => AuthorizationRules;
|
|
8
9
|
httpTimeoutSeconds?: number;
|
|
9
10
|
};
|
package/dist/jinaga-server.js
CHANGED
|
@@ -30,7 +30,7 @@ class JinagaServer {
|
|
|
30
30
|
const source = new jinaga_1.ObservableSourceImpl(store);
|
|
31
31
|
const fork = createFork(config, store, syncStatusNotifier);
|
|
32
32
|
const keystore = createKeystore(config);
|
|
33
|
-
const authorizationRules = config.authorization ? config.authorization(new jinaga_1.AuthorizationRules()) : null;
|
|
33
|
+
const authorizationRules = config.authorization ? config.authorization(new jinaga_1.AuthorizationRules(config.model)) : null;
|
|
34
34
|
const authorization = createAuthorization(authorizationRules, store, keystore);
|
|
35
35
|
const feedCache = new memory_feed_cache_1.MemoryFeedCache();
|
|
36
36
|
const router = new router_1.HttpRouter(authorization, feedCache);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jinaga-server.js","sourceRoot":"","sources":["../src/jinaga-server.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,
|
|
1
|
+
{"version":3,"file":"jinaga-server.js","sourceRoot":"","sources":["../src/jinaga-server.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,mCAqBgB;AAEhB,kFAA8E;AAC9E,oFAAgF;AAChF,mFAA+E;AAC/E,gDAAsD;AACtD,0CAAwD;AAExD,kEAA6D;AAC7D,oEAAgE;AAChE,8DAA0D;AAmB1D,MAAM,mBAAmB,GAAG;IACxB,QAAQ,EAAE,QAAQ;IAClB,EAAE,EAAE,OAAO;CACd,CAAC;AAEF,MAAa,YAAY;IACrB,MAAM,CAAC,MAAM,CAAC,MAA0B;QACpC,MAAM,kBAAkB,GAAG,IAAI,2BAAkB,EAAE,CAAC;QACpD,MAAM,KAAK,GAAG,WAAW,CAAC,MAAM,CAAC,CAAC;QAClC,MAAM,MAAM,GAAG,IAAI,6BAAoB,CAAC,KAAK,CAAC,CAAC;QAC/C,MAAM,IAAI,GAAG,UAAU,CAAC,MAAM,EAAE,KAAK,EAAE,kBAAkB,CAAC,CAAC;QAC3D,MAAM,QAAQ,GAAG,cAAc,CAAC,MAAM,CAAC,CAAC;QACxC,MAAM,kBAAkB,GAAG,MAAM,CAAC,aAAa,CAAC,CAAC,CAAC,MAAM,CAAC,aAAa,CAAC,IAAI,2BAAkB,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;QACpH,MAAM,aAAa,GAAG,mBAAmB,CAAC,kBAAkB,EAAE,KAAK,EAAE,QAAQ,CAA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|
|
|
1
1
|
{
|
|
2
2
|
"name": "jinaga-server",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.1",
|
|
4
4
|
"description": "Application-agnostic back end for web applications",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
45
|
"express": "^4.18.1",
|
|
46
|
-
"jinaga": "^5.1.
|
|
46
|
+
"jinaga": "^5.1.1",
|
|
47
47
|
"node-forge": "^1.3.1",
|
|
48
48
|
"passport": "^0.6.0",
|
|
49
49
|
"pg": "^8.7.1"
|
package/src/jinaga-server.ts
CHANGED
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
HttpNetwork,
|
|
10
10
|
Jinaga,
|
|
11
11
|
MemoryStore,
|
|
12
|
+
Model,
|
|
12
13
|
Network,
|
|
13
14
|
NetworkNoOp,
|
|
14
15
|
ObservableSource,
|
|
@@ -36,6 +37,7 @@ export type JinagaServerConfig = {
|
|
|
36
37
|
pgStore?: string,
|
|
37
38
|
pgKeystore?: string,
|
|
38
39
|
httpEndpoint?: string,
|
|
40
|
+
model?: Model,
|
|
39
41
|
authorization?: (a: AuthorizationRules) => AuthorizationRules,
|
|
40
42
|
httpTimeoutSeconds?: number
|
|
41
43
|
};
|
|
@@ -59,7 +61,7 @@ export class JinagaServer {
|
|
|
59
61
|
const source = new ObservableSourceImpl(store);
|
|
60
62
|
const fork = createFork(config, store, syncStatusNotifier);
|
|
61
63
|
const keystore = createKeystore(config);
|
|
62
|
-
const authorizationRules = config.authorization ? config.authorization(new AuthorizationRules()) : null;
|
|
64
|
+
const authorizationRules = config.authorization ? config.authorization(new AuthorizationRules(config.model)) : null;
|
|
63
65
|
const authorization = createAuthorization(authorizationRules, store, keystore);
|
|
64
66
|
const feedCache = new MemoryFeedCache();
|
|
65
67
|
const router = new HttpRouter(authorization, feedCache);
|
|
@@ -160,7 +160,7 @@ function givenStorage() {
|
|
|
160
160
|
function givenAuthorizationWithStorage(storage: MemoryStore) {
|
|
161
161
|
const keystore = new MemoryKeystore();
|
|
162
162
|
keystore.getOrCreateUserFact(givenMockUserIdentity());
|
|
163
|
-
const authorizationRules = new AuthorizationRules()
|
|
163
|
+
const authorizationRules = new AuthorizationRules(undefined)
|
|
164
164
|
.any('Hashtag')
|
|
165
165
|
.no('Jinaga.User')
|
|
166
166
|
.type('Tweet', j.for(tweetSender))
|