@nmshd/app-runtime 2.0.0-alpha.1 → 2.0.0-alpha.4

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
@@ -7,7 +7,7 @@ The App-Runtime extends the Runtime with App-specific functionality.
7
7
 
8
8
  ## Documentation
9
9
 
10
- The documentation for this project is currently under construction.
10
+ You can find the documentation for Enmeshed on [enmeshed.eu](https://enmeshed.eu).
11
11
 
12
12
  ## Feedback
13
13
 
@@ -17,7 +17,7 @@ Share your feedback with the Enmeshed team by contributing to the [discussions](
17
17
 
18
18
  ## Contribute
19
19
 
20
- Currently contribution to this project is not possible. This will change soon.
20
+ Contribution to this project is highly apprecicated. Head over to our [contribution guide](https://github.com/nmshd/.github/blob/main/CONTRIBUTING.md) to learn more.
21
21
 
22
22
  ## License
23
23
 
@@ -8,11 +8,11 @@ const crypto_1 = require("@nmshd/crypto");
8
8
  const runtime_1 = require("@nmshd/runtime");
9
9
  const transport_1 = require("@nmshd/transport");
10
10
  exports.buildInformation = {
11
- version: "2.0.0-alpha.1",
12
- build: "10",
13
- date: "2022-06-01T20:24:29+00:00",
14
- commit: "a154d97b354e9610ad6d3f6fbe8db88e865393eb",
15
- dependencies: {"@js-soft/docdb-access-loki":"^1.0.2","@js-soft/native-abstractions":"^1.1.0","@nmshd/runtime":"2.0.0-alpha.13","lodash":"^4.17.21"},
11
+ version: "2.0.0-alpha.4",
12
+ build: "15",
13
+ date: "2022-07-08T14:31:59+00:00",
14
+ commit: "a4a1e9a8cd68361b953654dbd49ba3b35245cb45",
15
+ dependencies: {"@js-soft/docdb-access-loki":"^1.0.3","@js-soft/native-abstractions":"^1.1.0","@nmshd/runtime":"2.0.0-alpha.28","lodash":"^4.17.21"},
16
16
  libraries: {
17
17
  serval: ts_serval_1.buildInformation,
18
18
  crypto: crypto_1.buildInformation,
@@ -1,5 +1,5 @@
1
- import { DataEvent, MailDVO, RequestMailDVO } from "@nmshd/runtime";
2
- export declare class MailReceivedEvent extends DataEvent<MailDVO | RequestMailDVO> {
1
+ import { DataEvent, MailDVO } from "@nmshd/runtime";
2
+ export declare class MailReceivedEvent extends DataEvent<MailDVO> {
3
3
  static readonly namespace: string;
4
- constructor(address: string, message: MailDVO | RequestMailDVO);
4
+ constructor(address: string, message: MailDVO);
5
5
  }
@@ -1 +1 @@
1
- {"version":3,"file":"MailReceivedEvent.js","sourceRoot":"","sources":["../../src/events/MailReceivedEvent.ts"],"names":[],"mappings":";;;AAAA,4CAAmE;AAEnE,MAAa,iBAAkB,SAAQ,mBAAmC;IAGtE,YAAmB,OAAe,EAAE,OAAiC;QACjE,KAAK,CAAC,iBAAiB,CAAC,SAAS,EAAE,OAAO,EAAE,OAAO,CAAC,CAAA;IACxD,CAAC;;AALL,8CAMC;AAL0B,2BAAS,GAAW,kBAAkB,CAAA"}
1
+ {"version":3,"file":"MailReceivedEvent.js","sourceRoot":"","sources":["../../src/events/MailReceivedEvent.ts"],"names":[],"mappings":";;;AAAA,4CAAmD;AAEnD,MAAa,iBAAkB,SAAQ,mBAAkB;IAGrD,YAAmB,OAAe,EAAE,OAAgB;QAChD,KAAK,CAAC,iBAAiB,CAAC,SAAS,EAAE,OAAO,EAAE,OAAO,CAAC,CAAA;IACxD,CAAC;;AALL,8CAMC;AAL0B,2BAAS,GAAW,kBAAkB,CAAA"}
@@ -1,8 +1,8 @@
1
- import { DataEvent, MessageDVO, RequestDVO, RequestMailDVO } from "@nmshd/runtime";
1
+ import { DataEvent, LocalRequestDVO, RequestMessageDVO } from "@nmshd/runtime";
2
2
  export declare class RequestReceivedEvent extends DataEvent<{
3
- request: RequestDVO;
4
- message: MessageDVO | RequestMailDVO;
3
+ request: LocalRequestDVO;
4
+ message: RequestMessageDVO;
5
5
  }> {
6
6
  static readonly namespace: string;
7
- constructor(address: string, request: RequestDVO, message: MessageDVO | RequestMailDVO);
7
+ constructor(address: string, request: LocalRequestDVO, message: RequestMessageDVO);
8
8
  }
@@ -1 +1 @@
1
- {"version":3,"file":"RequestReceivedEvent.js","sourceRoot":"","sources":["../../src/events/RequestReceivedEvent.ts"],"names":[],"mappings":";;;AAAA,4CAAkF;AAElF,MAAa,oBAAqB,SAAQ,mBAGxC;IAGE,YAAmB,OAAe,EAAE,OAAmB,EAAE,OAAoC;QACzF,KAAK,CAAC,oBAAoB,CAAC,SAAS,EAAE,OAAO,EAAE;YAC3C,OAAO;YACP,OAAO;SACV,CAAC,CAAA;IACN,CAAC;;AAXL,oDAYC;AAR0B,8BAAS,GAAW,qBAAqB,CAAA"}
1
+ {"version":3,"file":"RequestReceivedEvent.js","sourceRoot":"","sources":["../../src/events/RequestReceivedEvent.ts"],"names":[],"mappings":";;;AAAA,4CAA8E;AAE9E,MAAa,oBAAqB,SAAQ,mBAGxC;IAGE,YAAmB,OAAe,EAAE,OAAwB,EAAE,OAA0B;QACpF,KAAK,CAAC,oBAAoB,CAAC,SAAS,EAAE,OAAO,EAAE;YAC3C,OAAO;YACP,OAAO;SACV,CAAC,CAAA;IACN,CAAC;;AAXL,oDAYC;AAR0B,8BAAS,GAAW,qBAAqB,CAAA"}
@@ -1,9 +1,9 @@
1
1
  import { Result } from "@js-soft/ts-utils";
2
- import { IdentityDVO, MailDVO, MessageDVO, RelationshipChangeDTO, RelationshipTemplateDTO, RequestMailDVO, TokenDTO } from "@nmshd/runtime";
2
+ import { IdentityDVO, MailDVO, MessageDVO, RelationshipChangeDTO, RelationshipTemplateDTO, RequestMessageDVO, TokenDTO } from "@nmshd/runtime";
3
3
  import { LocalAccountDTO } from "../../multiAccount";
4
4
  import { UserfriendlyApplicationError } from "../../UserfriendlyApplicationError";
5
5
  export interface IUIBridge {
6
- showMessage(account: LocalAccountDTO, relationship: IdentityDVO, message: MessageDVO | MailDVO | RequestMailDVO): Promise<Result<void>>;
6
+ showMessage(account: LocalAccountDTO, relationship: IdentityDVO, message: MessageDVO | MailDVO | RequestMessageDVO): Promise<Result<void>>;
7
7
  showRelationship(account: LocalAccountDTO, relationship: IdentityDVO): Promise<Result<void>>;
8
8
  showRelationshipChange(account: LocalAccountDTO, relationship: IdentityDVO, change: RelationshipChangeDTO): Promise<Result<void>>;
9
9
  showRelationshipTemplate(account: LocalAccountDTO, relationshipTemplate: RelationshipTemplateDTO): Promise<Result<void>>;
@@ -24,12 +24,8 @@ class MessageReceivedModule extends AppRuntimeModule_1.AppRuntimeModule {
24
24
  }
25
25
  const messageDVO = await session.expander.expandMessageDTO(message);
26
26
  switch (messageDVO.type) {
27
- case "RequestMailDVO":
28
- const requestMail = messageDVO;
29
- this.runtime.eventBus.publish(new events_1.MailReceivedEvent(event.eventTargetAddress, requestMail));
30
- for (const requestDVO of requestMail.requests) {
31
- this.runtime.eventBus.publish(new events_1.RequestReceivedEvent(event.eventTargetAddress, requestDVO, messageDVO));
32
- }
27
+ case "RequestMessageDVO":
28
+ this.runtime.eventBus.publish(new events_1.RequestReceivedEvent(event.eventTargetAddress, messageDVO.request, messageDVO));
33
29
  break;
34
30
  case "MailDVO":
35
31
  const mail = messageDVO;
@@ -1 +1 @@
1
- {"version":3,"file":"MessageReceivedModule.js","sourceRoot":"","sources":["../../../src/modules/runtimeEvents/MessageReceivedModule.ts"],"names":[],"mappings":";;;AAAA,4CAA8E;AAC9E,2DAAuD;AACvD,yCAAsE;AACtE,0DAAqF;AAIrF,MAAa,0BAA2B,SAAQ,iCAAe;CAAG;AAAlE,gEAAkE;AAElE,MAAa,qBAAsB,SAAQ,mCAA6C;IAC7E,KAAK,CAAC,IAAI;QACb,qBAAqB;IACzB,CAAC;IAEM,KAAK;QACR,IAAI,CAAC,gBAAgB,CAAC,8BAAoB,EAAE,IAAI,CAAC,qBAAqB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAA;IACtF,CAAC;IAEO,KAAK,CAAC,qBAAqB,CAAC,KAA2B;QAC3D,MAAM,OAAO,GAAG,KAAK,CAAC,IAAI,CAAA;QAC1B,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,o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mshd/crypto");
558
558
  const runtime_1 = __webpack_require__(/*! @nmshd/runtime */ "@nmshd/runtime");
559
559
  const transport_1 = __webpack_require__(/*! @nmshd/transport */ "@nmshd/transport");
560
560
  exports.buildInformation = {
561
- version: "2.0.0-alpha.1",
562
- build: "10",
563
- date: "2022-06-01T20:24:29+00:00",
564
- commit: "a154d97b354e9610ad6d3f6fbe8db88e865393eb",
565
- dependencies: {"@js-soft/docdb-access-loki":"^1.0.2","@js-soft/native-abstractions":"^1.1.0","@nmshd/runtime":"2.0.0-alpha.13","lodash":"^4.17.21"},
561
+ version: "2.0.0-alpha.4",
562
+ build: "15",
563
+ date: "2022-07-08T14:31:59+00:00",
564
+ commit: "a4a1e9a8cd68361b953654dbd49ba3b35245cb45",
565
+ dependencies: {"@js-soft/docdb-access-loki":"^1.0.3","@js-soft/native-abstractions":"^1.1.0","@nmshd/runtime":"2.0.0-alpha.28","lodash":"^4.17.21"},
566
566
  libraries: {
567
567
  serval: ts_serval_1.buildInformation,
568
568
  crypto: crypto_1.buildInformation,
@@ -1674,12 +1674,8 @@ class MessageReceivedModule extends AppRuntimeModule_1.AppRuntimeModule {
1674
1674
  }
1675
1675
  const messageDVO = await session.expander.expandMessageDTO(message);
1676
1676
  switch (messageDVO.type) {
1677
- case "RequestMailDVO":
1678
- const requestMail = messageDVO;
1679
- this.runtime.eventBus.publish(new events_1.MailReceivedEvent(event.eventTargetAddress, requestMail));
1680
- for (const requestDVO of requestMail.requests) {
1681
- this.runtime.eventBus.publish(new events_1.RequestReceivedEvent(event.eventTargetAddress, requestDVO, messageDVO));
1682
- }
1677
+ case "RequestMessageDVO":
1678
+ this.runtime.eventBus.publish(new events_1.RequestReceivedEvent(event.eventTargetAddress, messageDVO.request, messageDVO));
1683
1679
  break;
1684
1680
  case "MailDVO":
1685
1681
  const mail = messageDVO;
@@ -2404,17 +2400,31 @@ const LokiJsCollectionProvider_1 = __webpack_require__(/*! ./LokiJsCollectionPro
2404
2400
  class LokiJsConnection {
2405
2401
  folder;
2406
2402
  databaseFactory;
2403
+ lokiJsOptions;
2407
2404
  providers;
2408
2405
  static defaultDatabaseFactory = {
2409
2406
  create: (filename, options) => {
2410
2407
  return new lokijs_1.default(filename, options);
2411
2408
  }
2412
2409
  };
2413
- constructor(folder, databaseFactory = LokiJsConnection.defaultDatabaseFactory) {
2410
+ constructor(folder, databaseFactory = LokiJsConnection.defaultDatabaseFactory, lokiJsOptions = {}) {
2414
2411
  this.folder = folder;
2415
2412
  this.databaseFactory = databaseFactory;
2413
+ this.lokiJsOptions = lokiJsOptions;
2416
2414
  this.providers = new Map();
2417
2415
  }
2416
+ static fileSystem(folder, lokiJsOptions) {
2417
+ return new LokiJsConnection(folder, this.defaultDatabaseFactory, { ...lokiJsOptions, persistenceMethod: "fs" });
2418
+ }
2419
+ static localStorage(lokiJsOptions) {
2420
+ return new LokiJsConnection("", this.defaultDatabaseFactory, {
2421
+ ...lokiJsOptions,
2422
+ persistenceMethod: "localStorage"
2423
+ });
2424
+ }
2425
+ static inMemory(lokiJsOptions) {
2426
+ return new LokiJsConnection("", this.defaultDatabaseFactory, { ...lokiJsOptions, persistenceMethod: "memory" });
2427
+ }
2418
2428
  onCollectionClosed(name) {
2419
2429
  this.providers.delete(name);
2420
2430
  }
@@ -2426,6 +2436,7 @@ class LokiJsConnection {
2426
2436
  const that = this;
2427
2437
  return await new Promise((resolve) => {
2428
2438
  const db = this.databaseFactory.create(`${this.folder}/${name}.db`, {
2439
+ ...this.lokiJsOptions,
2429
2440
  autoload: true,
2430
2441
  autosave: true,
2431
2442
  autosaveInterval: 5000,
@@ -2534,6 +2545,19 @@ exports.LokiJsMap = LokiJsMap;
2534
2545
 
2535
2546
  /***/ }),
2536
2547
 
2548
+ /***/ "./node_modules/@js-soft/docdb-access-loki/dist/LokiJsOptions.js":
2549
+ /*!***********************************************************************!*\
2550
+ !*** ./node_modules/@js-soft/docdb-access-loki/dist/LokiJsOptions.js ***!
2551
+ \***********************************************************************/
2552
+ /***/ ((__unused_webpack_module, exports) => {
2553
+
2554
+ "use strict";
2555
+
2556
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
2557
+ //# sourceMappingURL=LokiJsOptions.js.map
2558
+
2559
+ /***/ }),
2560
+
2537
2561
  /***/ "./node_modules/@js-soft/docdb-access-loki/dist/index.js":
2538
2562
  /*!***************************************************************!*\
2539
2563
  !*** ./node_modules/@js-soft/docdb-access-loki/dist/index.js ***!
@@ -2544,7 +2568,11 @@ exports.LokiJsMap = LokiJsMap;
2544
2568
 
2545
2569
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
2546
2570
  if (k2 === undefined) k2 = k;
2547
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
2571
+ var desc = Object.getOwnPropertyDescriptor(m, k);
2572
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
2573
+ desc = { enumerable: true, get: function() { return m[k]; } };
2574
+ }
2575
+ Object.defineProperty(o, k2, desc);
2548
2576
  }) : (function(o, m, k, k2) {
2549
2577
  if (k2 === undefined) k2 = k;
2550
2578
  o[k2] = m[k];
@@ -2558,6 +2586,7 @@ __exportStar(__webpack_require__(/*! ./LokiJsCollection */ "./node_modules/@js-s
2558
2586
  __exportStar(__webpack_require__(/*! ./LokiJsCollectionProvider */ "./node_modules/@js-soft/docdb-access-loki/dist/LokiJsCollectionProvider.js"), exports);
2559
2587
  __exportStar(__webpack_require__(/*! ./LokiJsConnection */ "./node_modules/@js-soft/docdb-access-loki/dist/LokiJsConnection.js"), exports);
2560
2588
  __exportStar(__webpack_require__(/*! ./LokiJsMap */ "./node_modules/@js-soft/docdb-access-loki/dist/LokiJsMap.js"), exports);
2589
+ __exportStar(__webpack_require__(/*! ./LokiJsOptions */ "./node_modules/@js-soft/docdb-access-loki/dist/LokiJsOptions.js"), exports);
2561
2590
  //# sourceMappingURL=index.js.map
2562
2591
 
2563
2592
  /***/ }),