jinaga-server 2.0.1 → 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.
Files changed (38) hide show
  1. package/README.md +12 -1
  2. package/dist/authentication/authentication-device.d.ts +3 -16
  3. package/dist/authentication/authentication-device.js +3 -40
  4. package/dist/authentication/authentication-device.js.map +1 -1
  5. package/dist/authentication/authentication-session.d.ts +3 -15
  6. package/dist/authentication/authentication-session.js +2 -37
  7. package/dist/authentication/authentication-session.js.map +1 -1
  8. package/dist/authorization/authorization-keystore.d.ts +2 -2
  9. package/dist/authorization/authorization-keystore.js.map +1 -1
  10. package/dist/jinaga-server.d.ts +2 -1
  11. package/dist/jinaga-server.js +38 -20
  12. package/dist/jinaga-server.js.map +1 -1
  13. package/dist/postgres/postgres-store.d.ts +2 -0
  14. package/dist/postgres/postgres-store.js +6 -0
  15. package/dist/postgres/postgres-store.js.map +1 -1
  16. package/package.json +2 -2
  17. package/src/authentication/authentication-device.ts +3 -65
  18. package/src/authentication/authentication-session.ts +4 -66
  19. package/src/authorization/authorization-keystore.ts +2 -2
  20. package/src/jinaga-server.ts +47 -22
  21. package/src/postgres/postgres-store.ts +8 -0
  22. package/test/authorization/authorizationSpec.ts +3 -5
  23. package/dist/authentication/authentication-impl.d.ts +0 -23
  24. package/dist/authentication/authentication-impl.js +0 -70
  25. package/dist/authentication/authentication-impl.js.map +0 -1
  26. package/dist/authentication/authentication-noop.d.ts +0 -20
  27. package/dist/authentication/authentication-noop.js +0 -52
  28. package/dist/authentication/authentication-noop.js.map +0 -1
  29. package/dist/authentication/authentication.d.ts +0 -5
  30. package/dist/authentication/authentication.js +0 -3
  31. package/dist/authentication/authentication.js.map +0 -1
  32. package/dist/authentication.d.ts +0 -19
  33. package/dist/authentication.js +0 -61
  34. package/dist/authentication.js.map +0 -1
  35. package/src/authentication/authentication-impl.ts +0 -69
  36. package/src/authentication/authentication-noop.ts +0 -65
  37. package/src/authentication/authentication.ts +0 -6
  38. package/src/authentication.ts +0 -68
@@ -1,35 +1,13 @@
1
- import {
2
- Channel,
3
- FactEnvelope,
4
- FactFeed,
5
- FactRecord,
6
- FactReference,
7
- Feed,
8
- Fork,
9
- LoginResponse,
10
- Observable,
11
- ProjectedResult,
12
- Query,
13
- Specification,
14
- SpecificationListener,
15
- UserIdentity,
16
- } from "jinaga";
1
+ import { Authentication, FactEnvelope, FactRecord, LoginResponse, UserIdentity } from "jinaga";
17
2
 
18
3
  import { Keystore } from "../keystore";
19
- import { Authentication } from "./authentication";
20
4
 
21
5
  export class AuthenticationDevice implements Authentication {
22
6
  constructor(
23
- private inner: Fork,
24
7
  private keystore: Keystore,
25
8
  private localDeviceIdentity: UserIdentity
26
9
  ) {}
27
10
 
28
- async close(): Promise<void> {
29
- await this.inner.close();
30
- await this.keystore.close();
31
- }
32
-
33
11
  async login(): Promise<LoginResponse> {
34
12
  throw new Error('No logged in user.');
35
13
  }
@@ -38,47 +16,7 @@ export class AuthenticationDevice implements Authentication {
38
16
  return await this.keystore.getOrCreateDeviceFact(this.localDeviceIdentity);
39
17
  }
40
18
 
41
- from(fact: FactReference, query: Query): Observable {
42
- return this.inner.from(fact, query);
43
- }
44
-
45
- addSpecificationListener(specification: Specification, onResult: (results: ProjectedResult[]) => Promise<void>): SpecificationListener {
46
- return this.inner.addSpecificationListener(specification, onResult);
47
- }
48
-
49
- removeSpecificationListener(listener: SpecificationListener): void {
50
- this.inner.removeSpecificationListener(listener);
51
- }
52
-
53
- save(envelopes: FactEnvelope[]): Promise<FactEnvelope[]> {
54
- return this.inner.save(envelopes);
55
- }
56
-
57
- query(start: FactReference, query: Query): Promise<FactReference[][]> {
58
- return this.inner.query(start, query);
59
- }
60
-
61
- read(start: FactReference[], specification: Specification): Promise<any[]> {
62
- return this.inner.read(start, specification);
63
- }
64
-
65
- feed(feed: Feed, bookmark: string): Promise<FactFeed> {
66
- return this.inner.feed(feed, bookmark);
67
- }
68
-
69
- whichExist(references: FactReference[]): Promise<FactReference[]> {
70
- throw new Error("whichExist method not implemented on AuthenticationDevice.");
71
- }
72
-
73
- load(references: FactReference[]): Promise<FactRecord[]> {
74
- return this.inner.load(references);
75
- }
76
-
77
- addChannel(fact: FactReference, query: Query): Channel {
78
- return this.inner.addChannel(fact, query);
79
- }
80
-
81
- removeChannel(channel: Channel): void {
82
- return this.inner.removeChannel(channel);
19
+ authorize(envelopes: FactEnvelope[]): Promise<FactEnvelope[]> {
20
+ throw new Error('No logged in user.');
83
21
  }
84
22
  }
@@ -1,30 +1,12 @@
1
- import {
2
- AuthorizationEngine,
3
- AuthorizationRules,
4
- Channel,
5
- FactEnvelope,
6
- FactFeed,
7
- FactRecord,
8
- FactReference,
9
- Feed,
10
- LoginResponse,
11
- Observable,
12
- ObservableSource,
13
- ProjectedResult,
14
- Query,
15
- Specification,
16
- SpecificationListener,
17
- UserIdentity,
18
- } from "jinaga";
1
+ import { Authentication, AuthorizationEngine, AuthorizationRules, FactEnvelope, FactRecord, LoginResponse, Storage, UserIdentity } from "jinaga";
19
2
 
20
3
  import { Keystore } from "../keystore";
21
- import { Authentication } from "./authentication";
22
4
 
23
5
  export class AuthenticationSession implements Authentication {
24
6
  private authorizationEngine: AuthorizationEngine | null;
25
7
 
26
8
  constructor(
27
- private inner: ObservableSource,
9
+ private inner: Storage,
28
10
  private keystore: Keystore,
29
11
  authorizationRules: AuthorizationRules | null,
30
12
  private userIdentity: UserIdentity,
@@ -34,11 +16,6 @@ export class AuthenticationSession implements Authentication {
34
16
  this.authorizationEngine = authorizationRules &&
35
17
  new AuthorizationEngine(authorizationRules, inner);
36
18
  }
37
-
38
- async close(): Promise<void> {
39
- await this.inner.close();
40
- await this.keystore.close();
41
- }
42
19
 
43
20
  async login(): Promise<LoginResponse> {
44
21
  const userFact = await this.keystore.getOrCreateUserFact(this.userIdentity);
@@ -62,52 +39,13 @@ export class AuthenticationSession implements Authentication {
62
39
  return deviceFact;
63
40
  }
64
41
 
65
- from(fact: FactReference, query: Query): Observable {
66
- return this.inner.from(fact, query);
67
- }
68
-
69
- addSpecificationListener(specification: Specification, onResult: (results: ProjectedResult[]) => Promise<void>): SpecificationListener {
70
- return this.inner.addSpecificationListener(specification, onResult);
71
- }
72
-
73
- removeSpecificationListener(listener: SpecificationListener): void {
74
- this.inner.removeSpecificationListener(listener);
75
- }
76
-
77
- async save(envelopes: FactEnvelope[]): Promise<FactEnvelope[]> {
42
+ async authorize(envelopes: FactEnvelope[]): Promise<FactEnvelope[]> {
78
43
  const userFact = await this.keystore.getUserFact(this.userIdentity);
79
44
  const facts = envelopes.map(envelope => envelope.fact);
80
45
  const authorizedFacts = this.authorizationEngine
81
46
  ? await this.authorizationEngine.authorizeFacts(facts, userFact)
82
47
  : facts;
83
48
  const signedFacts = await this.keystore.signFacts(this.userIdentity, authorizedFacts);
84
- return await this.inner.save(signedFacts);
85
- }
86
-
87
- query(start: FactReference, query: Query): Promise<FactReference[][]> {
88
- return this.inner.query(start, query);
89
- }
90
-
91
- read(start: FactReference[], specification: Specification): Promise<any[]> {
92
- return this.inner.read(start, specification);
93
- }
94
-
95
- feed(feed: Feed, bookmark: string): Promise<FactFeed> {
96
- return this.inner.feed(feed, bookmark);
97
- }
98
-
99
- whichExist(references: FactReference[]): Promise<FactReference[]> {
100
- throw new Error("WhichExist method not implemented on AuthenticationSession.");
101
- }
102
-
103
- load(references: FactReference[]): Promise<FactRecord[]> {
104
- return this.inner.load(references);
105
- }
106
-
107
- addChannel(fact: FactReference, query: Query): Channel {
108
- return new Channel(async () => {});
109
- }
110
-
111
- removeChannel(channel: Channel): void {
49
+ return signedFacts;
112
50
  }
113
51
  }
@@ -7,9 +7,9 @@ import {
7
7
  FactRecord,
8
8
  FactReference,
9
9
  Feed,
10
- ObservableSource,
11
10
  Query,
12
11
  Specification,
12
+ Storage,
13
13
  UserIdentity
14
14
  } from "jinaga";
15
15
 
@@ -19,7 +19,7 @@ export class AuthorizationKeystore implements Authorization {
19
19
  private authorizationEngine: AuthorizationEngine | null;
20
20
 
21
21
  constructor(
22
- private observableSource: ObservableSource,
22
+ private observableSource: Storage,
23
23
  private keystore: Keystore,
24
24
  authorizationRules: AuthorizationRules | null) {
25
25
 
@@ -1,12 +1,17 @@
1
1
  import { Handler, Request } from "express";
2
2
  import {
3
+ AuthenticationNoOp,
3
4
  Authorization,
4
5
  AuthorizationNoOp,
5
6
  AuthorizationRules,
6
- Cache,
7
+ FactManager,
7
8
  Fork,
9
+ HttpNetwork,
8
10
  Jinaga,
9
11
  MemoryStore,
12
+ Model,
13
+ Network,
14
+ NetworkNoOp,
10
15
  ObservableSource,
11
16
  ObservableSourceImpl,
12
17
  PassThroughFork,
@@ -14,11 +19,10 @@ import {
14
19
  SyncStatusNotifier,
15
20
  TransientFork,
16
21
  UserIdentity,
17
- WebClient,
22
+ WebClient
18
23
  } from "jinaga";
19
24
 
20
25
  import { AuthenticationDevice } from "./authentication/authentication-device";
21
- import { AuthenticationNoOp } from "./authentication/authentication-noop";
22
26
  import { AuthenticationSession } from "./authentication/authentication-session";
23
27
  import { AuthorizationKeystore } from "./authorization/authorization-keystore";
24
28
  import { NodeHttpConnection } from "./http/node-http";
@@ -33,6 +37,7 @@ export type JinagaServerConfig = {
33
37
  pgStore?: string,
34
38
  pgKeystore?: string,
35
39
  httpEndpoint?: string,
40
+ model?: Model,
36
41
  authorization?: (a: AuthorizationRules) => AuthorizationRules,
37
42
  httpTimeoutSeconds?: number
38
43
  };
@@ -54,14 +59,16 @@ export class JinagaServer {
54
59
  const syncStatusNotifier = new SyncStatusNotifier();
55
60
  const store = createStore(config);
56
61
  const source = new ObservableSourceImpl(store);
57
- const fork = createFork(config, source, syncStatusNotifier);
62
+ const fork = createFork(config, store, syncStatusNotifier);
58
63
  const keystore = createKeystore(config);
59
- const authorizationRules = config.authorization ? config.authorization(new AuthorizationRules()) : null;
60
- const authorization = createAuthorization(authorizationRules, fork, keystore);
64
+ const authorizationRules = config.authorization ? config.authorization(new AuthorizationRules(config.model)) : null;
65
+ const authorization = createAuthorization(authorizationRules, store, keystore);
61
66
  const feedCache = new MemoryFeedCache();
62
67
  const router = new HttpRouter(authorization, feedCache);
63
- const authentication = createAuthentication(keystore, fork);
64
- const j: Jinaga = new Jinaga(authentication, syncStatusNotifier);
68
+ const authentication = createAuthentication(keystore);
69
+ const network = createNetwork(config);
70
+ const factManager = new FactManager(authentication, fork, source, store, network);
71
+ const j: Jinaga = new Jinaga(factManager, syncStatusNotifier);
65
72
 
66
73
  async function close() {
67
74
  if (keystore) {
@@ -73,7 +80,7 @@ export class JinagaServer {
73
80
  handler: router.handler,
74
81
  j,
75
82
  withSession: (req, callback) => {
76
- return withSession(source, keystore, authorizationRules, req, callback);
83
+ return withSession(store, keystore, authorizationRules, req, callback);
77
84
  },
78
85
  close
79
86
  }
@@ -83,26 +90,25 @@ export class JinagaServer {
83
90
  function createStore(config: JinagaServerConfig): Storage {
84
91
  if (config.pgStore) {
85
92
  const store = new PostgresStore(config.pgStore);
86
- const cache = new Cache(store);
87
- return cache;
93
+ return store;
88
94
  }
89
95
  else {
90
96
  return new MemoryStore();
91
97
  }
92
98
  }
93
99
 
94
- function createFork(config: JinagaServerConfig, feed: ObservableSource, syncStatusNotifier: SyncStatusNotifier): Fork {
100
+ function createFork(config: JinagaServerConfig, store: Storage, syncStatusNotifier: SyncStatusNotifier): Fork {
95
101
  if (config.httpEndpoint) {
96
102
  const httpConnection = new NodeHttpConnection(config.httpEndpoint);
97
103
  const httpTimeoutSeconds = config.httpTimeoutSeconds || 5;
98
104
  const webClient = new WebClient(httpConnection, syncStatusNotifier, {
99
105
  timeoutSeconds: httpTimeoutSeconds
100
106
  });
101
- const fork = new TransientFork(feed, webClient);
107
+ const fork = new TransientFork(store, webClient);
102
108
  return fork;
103
109
  }
104
110
  else {
105
- return new PassThroughFork(feed);
111
+ return new PassThroughFork(store);
106
112
  }
107
113
  }
108
114
 
@@ -110,28 +116,47 @@ function createKeystore(config: JinagaServerConfig) {
110
116
  return config.pgKeystore ? new PostgresKeystore(config.pgKeystore) : null;
111
117
  }
112
118
 
113
- function createAuthorization(authorizationRules: AuthorizationRules | null, feed: ObservableSource, keystore: Keystore | null): Authorization {
119
+ function createAuthorization(authorizationRules: AuthorizationRules | null, store: Storage, keystore: Keystore | null): Authorization {
114
120
  if (keystore) {
115
- const authorization = new AuthorizationKeystore(feed, keystore, authorizationRules);
121
+ const authorization = new AuthorizationKeystore(store, keystore, authorizationRules);
116
122
  return authorization;
117
123
  }
118
124
  else {
119
- return new AuthorizationNoOp(feed);
125
+ return new AuthorizationNoOp(store);
120
126
  }
121
127
  }
122
128
 
123
- function createAuthentication(keystore: PostgresKeystore | null, fork: Fork) {
124
- return keystore ? new AuthenticationDevice(fork, keystore, localDeviceIdentity) : new AuthenticationNoOp(fork);
129
+ function createAuthentication(keystore: PostgresKeystore | null) {
130
+ return keystore ? new AuthenticationDevice(keystore, localDeviceIdentity) : new AuthenticationNoOp();
125
131
  }
126
132
 
127
- async function withSession(feed: ObservableSource, keystore: Keystore | null, authorizationRules: AuthorizationRules | null, req: Request, callback: ((j: Jinaga) => Promise<void>)) {
133
+ function createNetwork(config: JinagaServerConfig): Network {
134
+ if (config.httpEndpoint) {
135
+ const httpConnection = new NodeHttpConnection(config.httpEndpoint);
136
+ const httpTimeoutSeconds = config.httpTimeoutSeconds || 5;
137
+ const syncStatusNotifier = new SyncStatusNotifier();
138
+ const webClient = new WebClient(httpConnection, syncStatusNotifier, {
139
+ timeoutSeconds: httpTimeoutSeconds
140
+ });
141
+ return new HttpNetwork(webClient);
142
+ }
143
+ else {
144
+ return new NetworkNoOp();
145
+ }
146
+ }
147
+
148
+ async function withSession(store: Storage, keystore: Keystore | null, authorizationRules: AuthorizationRules | null, req: Request, callback: ((j: Jinaga) => Promise<void>)) {
128
149
  const user = <RequestUser>req.user;
129
150
  const userIdentity: UserIdentity = {
130
151
  provider: user.provider,
131
152
  id: user.id
132
153
  }
133
- const authentication = keystore ? new AuthenticationSession(feed, keystore, authorizationRules, userIdentity, user.profile.displayName, localDeviceIdentity) : new AuthenticationNoOp(feed);
154
+ const authentication = keystore ? new AuthenticationSession(store, keystore, authorizationRules, userIdentity, user.profile.displayName, localDeviceIdentity) : new AuthenticationNoOp();
134
155
  const syncStatusNotifier = new SyncStatusNotifier();
135
- const j = new Jinaga(authentication, syncStatusNotifier);
156
+ const fork = new PassThroughFork(store);
157
+ const observableSource = new ObservableSource(store);
158
+ const network = new NetworkNoOp();
159
+ const factManager = new FactManager(authentication, fork, observableSource, store, network);
160
+ const j = new Jinaga(factManager, syncStatusNotifier);
136
161
  await callback(j);
137
162
  }
@@ -468,6 +468,14 @@ export class PostgresStore implements Storage {
468
468
  }
469
469
  return factTypes;
470
470
  }
471
+
472
+ loadBookmark(feed: string): Promise<string> {
473
+ throw new Error("Method not implemented.");
474
+ }
475
+
476
+ saveBookmark(feed: string, bookmark: string): Promise<void> {
477
+ throw new Error("Method not implemented.");
478
+ }
471
479
  }
472
480
 
473
481
  async function executeQueryTree(sqlQueryTree: SqlQueryTree, connection: PoolClient): Promise<ResultSetTree> {
@@ -5,8 +5,7 @@ import {
5
5
  FactRecord,
6
6
  hydrate,
7
7
  Jinaga as j,
8
- MemoryStore,
9
- ObservableSourceImpl,
8
+ MemoryStore
10
9
  } from "jinaga";
11
10
 
12
11
  import { AuthorizationKeystore } from "../../src/authorization/authorization-keystore";
@@ -161,15 +160,14 @@ function givenStorage() {
161
160
  function givenAuthorizationWithStorage(storage: MemoryStore) {
162
161
  const keystore = new MemoryKeystore();
163
162
  keystore.getOrCreateUserFact(givenMockUserIdentity());
164
- const feed = new ObservableSourceImpl(storage);
165
- const authorizationRules = new AuthorizationRules()
163
+ const authorizationRules = new AuthorizationRules(undefined)
166
164
  .any('Hashtag')
167
165
  .no('Jinaga.User')
168
166
  .type('Tweet', j.for(tweetSender))
169
167
  .type('Like', j.for(likeUser))
170
168
  .type('Delete', j.for(deleteSender))
171
169
  ;
172
- return new AuthorizationKeystore(feed, keystore, authorizationRules);
170
+ return new AuthorizationKeystore(storage, keystore, authorizationRules);
173
171
  }
174
172
 
175
173
  function givenOtherUser() {
@@ -1,23 +0,0 @@
1
- import { Channel, FactEnvelope, FactFeed, FactRecord, FactReference, Feed, Fork, Observable, ProjectedResult, Query, Specification, SpecificationListener, WebClient } from "jinaga";
2
- import { Authentication } from "./authentication";
3
- export declare class Principal {
4
- }
5
- export declare class AuthenticationImpl implements Authentication {
6
- private inner;
7
- private client;
8
- constructor(inner: Fork, client: WebClient);
9
- close(): Promise<void>;
10
- login(): Promise<import("jinaga").LoginResponse>;
11
- local(): Promise<FactRecord>;
12
- save(envelopes: FactEnvelope[]): Promise<FactEnvelope[]>;
13
- query(start: FactReference, query: Query): Promise<import("jinaga").FactPath[]>;
14
- read(start: FactReference[], specification: Specification): Promise<any[]>;
15
- feed(feed: Feed, bookmark: string): Promise<FactFeed>;
16
- whichExist(references: FactReference[]): Promise<FactReference[]>;
17
- load(references: FactReference[]): Promise<FactRecord[]>;
18
- from(fact: FactReference, query: Query): Observable;
19
- addSpecificationListener(specification: Specification, onResult: (results: ProjectedResult[]) => Promise<void>): SpecificationListener;
20
- removeSpecificationListener(listener: SpecificationListener): void;
21
- addChannel(fact: FactReference, query: Query): Channel;
22
- removeChannel(channel: Channel): void;
23
- }
@@ -1,70 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.AuthenticationImpl = exports.Principal = void 0;
13
- class Principal {
14
- }
15
- exports.Principal = Principal;
16
- class AuthenticationImpl {
17
- constructor(inner, client) {
18
- this.inner = inner;
19
- this.client = client;
20
- }
21
- close() {
22
- return __awaiter(this, void 0, void 0, function* () {
23
- yield this.inner.close();
24
- });
25
- }
26
- login() {
27
- return this.client.login();
28
- }
29
- local() {
30
- throw new Error('Local device has no persistence.');
31
- }
32
- save(envelopes) {
33
- return __awaiter(this, void 0, void 0, function* () {
34
- const saved = yield this.inner.save(envelopes);
35
- return saved;
36
- });
37
- }
38
- query(start, query) {
39
- return this.inner.query(start, query);
40
- }
41
- read(start, specification) {
42
- return this.inner.read(start, specification);
43
- }
44
- feed(feed, bookmark) {
45
- return this.inner.feed(feed, bookmark);
46
- }
47
- whichExist(references) {
48
- throw new Error("whichExist method not implemented on AuthenticationImpl.");
49
- }
50
- load(references) {
51
- return this.inner.load(references);
52
- }
53
- from(fact, query) {
54
- return this.inner.from(fact, query);
55
- }
56
- addSpecificationListener(specification, onResult) {
57
- return this.inner.addSpecificationListener(specification, onResult);
58
- }
59
- removeSpecificationListener(listener) {
60
- this.inner.removeSpecificationListener(listener);
61
- }
62
- addChannel(fact, query) {
63
- return this.inner.addChannel(fact, query);
64
- }
65
- removeChannel(channel) {
66
- this.inner.removeChannel(channel);
67
- }
68
- }
69
- exports.AuthenticationImpl = AuthenticationImpl;
70
- //# sourceMappingURL=authentication-impl.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"authentication-impl.js","sourceRoot":"","sources":["../../src/authentication/authentication-impl.ts"],"names":[],"mappings":";;;;;;;;;;;;AAIA,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,wBAAwB,CAAC,aAA4B,EAAE,QAAuD;QAC1G,OAAO,IAAI,CAAC,KAAK,CAAC,wBAAwB,CAAC,aAAa,EAAE,QAAQ,CAAC,CAAC;IACxE,CAAC;IAED,2BAA2B,CAAC,QAA+B;QACvD,IAAI,CAAC,KAAK,CAAC,2BAA2B,CAAC,QAAQ,CAAC,CAAC;IACrD,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;AA5DD,gDA4DC"}
@@ -1,20 +0,0 @@
1
- import { Channel, FactEnvelope, FactFeed, FactPath, FactRecord, FactReference, Feed, LoginResponse, Observable, ObservableSource, ProjectedResult, Query, Specification, SpecificationListener } from "jinaga";
2
- import { Authentication } from "./authentication";
3
- export declare class AuthenticationNoOp implements Authentication {
4
- private inner;
5
- constructor(inner: ObservableSource);
6
- login(): Promise<LoginResponse>;
7
- local(): Promise<FactRecord>;
8
- addChannel(fact: FactReference, query: Query): Channel;
9
- removeChannel(channel: Channel): void;
10
- from(fact: FactReference, query: Query): Observable;
11
- addSpecificationListener(specification: Specification, onResult: (results: ProjectedResult[]) => Promise<void>): SpecificationListener;
12
- removeSpecificationListener(listener: SpecificationListener): void;
13
- close(): Promise<void>;
14
- save(envelopes: FactEnvelope[]): Promise<FactEnvelope[]>;
15
- query(start: FactReference, query: Query): Promise<FactPath[]>;
16
- read(start: FactReference[], specification: Specification): Promise<ProjectedResult[]>;
17
- feed(feed: Feed, bookmark: string): Promise<FactFeed>;
18
- whichExist(references: FactReference[]): Promise<FactReference[]>;
19
- load(references: FactReference[]): Promise<FactRecord[]>;
20
- }
@@ -1,52 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.AuthenticationNoOp = void 0;
4
- class AuthenticationNoOp {
5
- constructor(inner) {
6
- this.inner = inner;
7
- }
8
- login() {
9
- throw new Error("No keystore is configured.");
10
- }
11
- local() {
12
- throw new Error("No keystore is configured.");
13
- }
14
- addChannel(fact, query) {
15
- throw new Error("No keystore is configured.");
16
- }
17
- removeChannel(channel) {
18
- throw new Error("No keystore is configured.");
19
- }
20
- from(fact, query) {
21
- return this.inner.from(fact, query);
22
- }
23
- addSpecificationListener(specification, onResult) {
24
- return this.inner.addSpecificationListener(specification, onResult);
25
- }
26
- removeSpecificationListener(listener) {
27
- return this.inner.removeSpecificationListener(listener);
28
- }
29
- close() {
30
- return this.inner.close();
31
- }
32
- save(envelopes) {
33
- return this.inner.save(envelopes);
34
- }
35
- query(start, query) {
36
- return this.inner.query(start, query);
37
- }
38
- read(start, specification) {
39
- return this.inner.read(start, specification);
40
- }
41
- feed(feed, bookmark) {
42
- return this.inner.feed(feed, bookmark);
43
- }
44
- whichExist(references) {
45
- return this.inner.whichExist(references);
46
- }
47
- load(references) {
48
- return this.inner.load(references);
49
- }
50
- }
51
- exports.AuthenticationNoOp = AuthenticationNoOp;
52
- //# sourceMappingURL=authentication-noop.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"authentication-noop.js","sourceRoot":"","sources":["../../src/authentication/authentication-noop.ts"],"names":[],"mappings":";;;AAGA,MAAa,kBAAkB;IAE3B,YACY,KAAuB;QAAvB,UAAK,GAAL,KAAK,CAAkB;IAC/B,CAAC;IAEL,KAAK;QACD,MAAM,IAAI,KAAK,CAAC,4BAA4B,CAAC,CAAC;IAClD,CAAC;IAED,KAAK;QACD,MAAM,IAAI,KAAK,CAAC,4BAA4B,CAAC,CAAC;IAClD,CAAC;IAED,UAAU,CAAC,IAAmB,EAAE,KAAY;QACxC,MAAM,IAAI,KAAK,CAAC,4BAA4B,CAAC,CAAC;IAClD,CAAC;IAED,aAAa,CAAC,OAAgB;QAC1B,MAAM,IAAI,KAAK,CAAC,4BAA4B,CAAC,CAAC;IAClD,CAAC;IAED,IAAI,CAAC,IAAmB,EAAE,KAAY;QAClC,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IACxC,CAAC;IAED,wBAAwB,CAAC,aAA4B,EAAE,QAAuD;QAC1G,OAAO,IAAI,CAAC,KAAK,CAAC,wBAAwB,CAAC,aAAa,EAAE,QAAQ,CAAC,CAAC;IACxE,CAAC;IAED,2BAA2B,CAAC,QAA+B;QACvD,OAAO,IAAI,CAAC,KAAK,CAAC,2BAA2B,CAAC,QAAQ,CAAC,CAAC;IAC5D,CAAC;IAED,KAAK;QACD,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;IAC9B,CAAC;IAED,IAAI,CAAC,SAAyB;QAC1B,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IACtC,CAAC;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,OAAO,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;IAC7C,CAAC;IAED,IAAI,CAAC,UAA2B;QAC5B,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IACvC,CAAC;CACJ;AA7DD,gDA6DC"}
@@ -1,5 +0,0 @@
1
- import { FactRecord, Fork, LoginResponse } from "jinaga";
2
- export interface Authentication extends Fork {
3
- login(): Promise<LoginResponse>;
4
- local(): Promise<FactRecord>;
5
- }
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=authentication.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"authentication.js","sourceRoot":"","sources":["../../src/authentication/authentication.ts"],"names":[],"mappings":""}
@@ -1,19 +0,0 @@
1
- import { FactEnvelope, FactFeed, FactRecord, FactReference, Feed, Observable, ObservableSource, ProjectedResult, Query, Specification, SpecificationListener, WebClient } from "jinaga";
2
- export declare class Principal {
3
- }
4
- export declare class Authentication implements ObservableSource {
5
- private inner;
6
- private client;
7
- constructor(inner: ObservableSource, client: WebClient);
8
- close(): Promise<void>;
9
- login(): Promise<import("jinaga").LoginResponse>;
10
- save(envelopes: FactEnvelope[]): Promise<FactEnvelope[]>;
11
- query(start: FactReference, query: Query): Promise<import("jinaga").FactPath[]>;
12
- read(start: FactReference[], specification: Specification): Promise<any[]>;
13
- feed(feed: Feed, bookmark: string): Promise<FactFeed>;
14
- whichExist(references: FactReference[]): Promise<FactReference[]>;
15
- load(references: FactReference[]): Promise<FactRecord[]>;
16
- from(fact: FactReference, query: Query): Observable;
17
- addSpecificationListener(specification: Specification, onResult: (results: ProjectedResult[]) => Promise<void>): SpecificationListener;
18
- removeSpecificationListener(listener: SpecificationListener): void;
19
- }