@nmshd/app-runtime 2.3.1 → 2.3.3

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.
@@ -28,5 +28,4 @@ export declare class AppStringProcessor {
28
28
  processTruncatedReference(truncatedReference: string, account?: LocalAccountDTO): Promise<UserfriendlyResult<void>>;
29
29
  private _handleTruncatedReference;
30
30
  private parseTokenContent;
31
- private error;
32
31
  }
@@ -21,10 +21,8 @@ class AppStringProcessor {
21
21
  return UserfriendlyResult_1.UserfriendlyResult.fail(AppRuntimeErrors_1.AppRuntimeErrors.startup.wrongURL());
22
22
  }
23
23
  async processTruncatedReference(truncatedReference, account) {
24
- if (account) {
25
- await this._handleTruncatedReference(truncatedReference, account);
26
- return UserfriendlyResult_1.UserfriendlyResult.ok(undefined);
27
- }
24
+ if (account)
25
+ return await this._handleTruncatedReference(truncatedReference, account);
28
26
  // process Files and RelationshipTemplates and ask for an account
29
27
  if (truncatedReference.startsWith(runtime_1.Base64ForIdPrefix.File) ||
30
28
  truncatedReference.startsWith(runtime_1.Base64ForIdPrefix.RelationshipTemplate)) {
@@ -37,13 +35,11 @@ class AppStringProcessor {
37
35
  this.logger.info("User cancelled account selection");
38
36
  return UserfriendlyResult_1.UserfriendlyResult.ok(undefined);
39
37
  }
40
- await this._handleTruncatedReference(truncatedReference, result.value);
41
- return UserfriendlyResult_1.UserfriendlyResult.ok(undefined);
38
+ return await this._handleTruncatedReference(truncatedReference, result.value);
42
39
  }
43
40
  const uiBridge = await this.runtime.uiBridge();
44
41
  if (!truncatedReference.startsWith(runtime_1.Base64ForIdPrefix.Token)) {
45
42
  const error = AppRuntimeErrors_1.AppRuntimeErrors.startup.wrongCode();
46
- await this.error(error);
47
43
  return UserfriendlyResult_1.UserfriendlyResult.fail(error);
48
44
  }
49
45
  const tokenResult = await this.runtime.anonymousServices.tokens.loadPeerTokenByTruncatedReference({
@@ -56,7 +52,6 @@ class AppStringProcessor {
56
52
  const tokenContent = this.parseTokenContent(tokenDTO.content);
57
53
  if (!tokenContent) {
58
54
  const error = AppRuntimeErrors_1.AppRuntimeErrors.startup.wrongCode();
59
- await this.error(error);
60
55
  return UserfriendlyResult_1.UserfriendlyResult.fail(error);
61
56
  }
62
57
  if (tokenContent instanceof transport_1.TokenContentDeviceSharedSecret) {
@@ -72,8 +67,7 @@ class AppStringProcessor {
72
67
  this.logger.info("User cancelled account selection");
73
68
  return UserfriendlyResult_1.UserfriendlyResult.ok(undefined);
74
69
  }
75
- await this._handleTruncatedReference(truncatedReference, selectedAccount);
76
- return UserfriendlyResult_1.UserfriendlyResult.ok(undefined);
70
+ return await this._handleTruncatedReference(truncatedReference, selectedAccount);
77
71
  }
78
72
  async _handleTruncatedReference(truncatedReference, account) {
79
73
  const services = await this.runtime.getServices(account.id);
@@ -81,8 +75,12 @@ class AppStringProcessor {
81
75
  const result = await services.transportServices.account.loadItemFromTruncatedReference({
82
76
  reference: truncatedReference
83
77
  });
84
- if (result.isError)
85
- return await this.error(result.error);
78
+ if (result.isError) {
79
+ if (result.error.code === "error.runtime.validation.invalidPropertyValue") {
80
+ return UserfriendlyResult_1.UserfriendlyResult.fail(new UserfriendlyApplicationError_1.UserfriendlyApplicationError("error.appStringProcessor.truncatedReferenceInvalid", "The given code does not contain a valid truncated reference."));
81
+ }
82
+ return UserfriendlyResult_1.UserfriendlyResult.fail(UserfriendlyApplicationError_1.UserfriendlyApplicationError.fromError(result.error));
83
+ }
86
84
  switch (result.value.type) {
87
85
  case "File":
88
86
  const file = await services.dataViewExpander.expandFileDTO(result.value.value);
@@ -92,12 +90,11 @@ class AppStringProcessor {
92
90
  // RelationshipTemplates are processed by the RequestModule
93
91
  break;
94
92
  case "Token":
95
- await this.error(new UserfriendlyApplicationError_1.UserfriendlyApplicationError("error.appStringProcessor.notSupportedTokenContent", "The scanned code is not supported in this context"));
96
- break;
93
+ return UserfriendlyResult_1.UserfriendlyResult.fail(new UserfriendlyApplicationError_1.UserfriendlyApplicationError("error.appStringProcessor.notSupportedTokenContent", "The scanned code is not supported in this context"));
97
94
  case "DeviceOnboardingInfo":
98
- await this.error(new UserfriendlyApplicationError_1.UserfriendlyApplicationError("error.appStringProcessor.deviceOnboardingNotAllowed", "The token contained a device onboarding info, but this is not allowed in this context."));
99
- break;
95
+ return UserfriendlyResult_1.UserfriendlyResult.fail(new UserfriendlyApplicationError_1.UserfriendlyApplicationError("error.appStringProcessor.deviceOnboardingNotAllowed", "The token contained a device onboarding info, but this is not allowed in this context."));
100
96
  }
97
+ return UserfriendlyResult_1.UserfriendlyResult.ok(undefined);
101
98
  }
102
99
  parseTokenContent(content) {
103
100
  try {
@@ -108,14 +105,6 @@ class AppStringProcessor {
108
105
  return undefined;
109
106
  }
110
107
  }
111
- async error(error) {
112
- const parsedError = error instanceof UserfriendlyApplicationError_1.UserfriendlyApplicationError //
113
- ? error
114
- : UserfriendlyApplicationError_1.UserfriendlyApplicationError.fromError(error);
115
- this.logger.error(parsedError);
116
- const uiBridge = await this.runtime.uiBridge();
117
- await uiBridge.showError(parsedError);
118
- }
119
108
  }
120
109
  exports.AppStringProcessor = AppStringProcessor;
121
110
  //# sourceMappingURL=AppStringProcessor.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"AppStringProcessor.js","sourceRoot":"","sources":["../src/AppStringProcessor.ts"],"names":[],"mappings":";;;AACA,kDAAiD;AAEjD,4CAAmF;AACnF,gDAA+E;AAC/E,yDAAqD;AAIrD,iFAA6E;AAC7E,6DAAyD;AAEzD,MAAa,kBAAkB;IAG3B,YACuB,OAUlB,EACD,aAA6B;QAXV,YAAO,GAAP,OAAO,CAUzB;QAGD,IAAI,CAAC,MAAM,GAAG,aAAa,CAAC,SAAS,CAAC,IAAI,CAAC,WAAW,CAAC,CAAA;IAC3D,CAAC;IAEM,KAAK,CAAC,UAAU,CAAC,GAAW,EAAE,OAAyB;QAC1D,GAAG,GAAG,GAAG,CAAC,IAAI,EAAE,CAAA;QAEhB,MAAM,MAAM,GAAG,GAAG,C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vB,KAAK,MAAM;gBACP,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,gBAAgB,CAAC,aAAa,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAA;gBAC9E,MAAM,QAAQ,CAAC,QAAQ,CAAC,OAAO,EAAE,IAAI,CAAC,CAAA;gBACtC,MAAK;YACT,KAAK,sBAAsB;gBACvB,2DAA2D;gBAC3D,MAAK;YACT,KAAK,OAAO;gBACR,OAAO,uCAAkB,CAAC,IAAI,CAC1B,IAAI,2DAA4B,CAC5B,mDAAmD,EACnD,mDAAmD,CACtD,CACJ,CAAA;YACL,KAAK,sBAAsB;gBACvB,OAAO,uCAAkB,CAAC,IAAI,CAC1B,IAAI,2DAA4B,CAC5B,qDAAqD,EACrD,wFAAwF,CAC3F,CACJ,CAAA;SACR;QAED,OAAO,uCAAkB,CAAC,EAAE,CAAC,SAAS,CAAC,CAAA;IAC3C,CAAC;IAEO,iBAAiB,CAAC,OAAY;QAClC,IAAI;YACA,OAAO,wBAAY,CAAC,WAAW,CAAC,OAAO,CAAC,CAAA;SAC3C;QAAC,OAAO,CAAC,EAAE;YACR,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,+BAA+B,EAAE,CAAC,CAAC,CAAA;YACpD,OAAO,SAAS,CAAA;SACnB;IACL,CAAC;CACJ;AAzJD,gDAyJC"}
@@ -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.3.1",
12
- build: "44",
13
- date: "2023-02-20T20:58:44+00:00",
14
- commit: "3be48800a392d01e312c4890e53f8673d159df2b",
15
- dependencies: {"@js-soft/docdb-access-loki":"^1.0.3","@js-soft/native-abstractions":"^1.2.1","@nmshd/runtime":"2.4.1","lodash":"^4.17.21"},
11
+ version: "2.3.3",
12
+ build: "46",
13
+ date: "2023-02-24T09:22:03+00:00",
14
+ commit: "3f3445e8dcac1837af0133972d3688d289ab6731",
15
+ dependencies: {"@js-soft/docdb-access-loki":"^1.0.3","@js-soft/native-abstractions":"^1.2.1","lodash":"^4.17.21"},
16
16
  libraries: {
17
17
  serval: ts_serval_1.buildInformation,
18
18
  crypto: crypto_1.buildInformation,
@@ -15,7 +15,11 @@ class AppLaunchModule extends AppRuntimeModule_1.AppRuntimeModule {
15
15
  this.subscribeToNativeEvent(native_abstractions_1.UrlOpenEvent, this.handleUrlOpen.bind(this));
16
16
  }
17
17
  async handleUrlOpen(event) {
18
- await this.runtime.stringProcessor.processURL(event.url);
18
+ const result = await this.runtime.stringProcessor.processURL(event.url);
19
+ if (result.isSuccess)
20
+ return;
21
+ const uiBridge = await this.runtime.uiBridge();
22
+ await uiBridge.showError(result.error);
19
23
  }
20
24
  stop() {
21
25
  this.unsubscribeFromAllEvents();
@@ -1 +1 @@
1
- {"version":3,"file":"AppLaunchModule.js","sourceRoot":"","sources":["../../../src/modules/appEvents/AppLaunchModule.ts"],"names":[],"mappings":";;;AAAA,sEAA2D;AAC3D,2DAAuD;AACvD,0DAAqF;AAIrF,MAAa,oBAAqB,SAAQ,iCAAe;CAAG;AAA5D,oDAA4D;AAE5D,MAAa,eAAgB,SAAQ,mCAAuC;IACjE,KAAK,CAAC,IAAI;QACb,qBAAqB;IACzB,CAAC;IAEM,KAAK;QACR,IAAI,CAAC,sBAAsB,CAAC,kCAAY,EAAE,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAA;IAC5E,CAAC;IAEO,KAAK,CAAC,aAAa,CAAC,KAAmB;QAC3C,MAAM,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;IAC5D,CAAC;IAEM,IAAI;QACP,IAAI,CAAC,wBAAwB,EAAE,CAAA;IACnC,CAAC;CACJ;AAhBD,0CAgBC"}
1
+ {"version":3,"file":"AppLaunchModule.js","sourceRoot":"","sources":["../../../src/modules/appEvents/AppLaunchModule.ts"],"names":[],"mappings":";;;AAAA,sEAA2D;AAC3D,2DAAuD;AACvD,0DAAqF;AAIrF,MAAa,oBAAqB,SAAQ,iCAAe;CAAG;AAA5D,oDAA4D;AAE5D,MAAa,eAAgB,SAAQ,mCAAuC;IACjE,KAAK,CAAC,IAAI;QACb,qBAAqB;IACzB,CAAC;IAEM,KAAK;QACR,IAAI,CAAC,sBAAsB,CAAC,kCAAY,EAAE,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAA;IAC5E,CAAC;IAEO,KAAK,CAAC,aAAa,CAAC,KAAmB;QAC3C,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;QACvE,IAAI,MAAM,CAAC,SAAS;YAAE,OAAM;QAE5B,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAA;QAC9C,MAAM,QAAQ,CAAC,SAAS,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;IAC1C,CAAC;IAEM,IAAI;QACP,IAAI,CAAC,wBAAwB,EAAE,CAAA;IACnC,CAAC;CACJ;AApBD,0CAoBC"}
@@ -490,10 +490,8 @@ class AppStringProcessor {
490
490
  return UserfriendlyResult_1.UserfriendlyResult.fail(AppRuntimeErrors_1.AppRuntimeErrors.startup.wrongURL());
491
491
  }
492
492
  async processTruncatedReference(truncatedReference, account) {
493
- if (account) {
494
- await this._handleTruncatedReference(truncatedReference, account);
495
- return UserfriendlyResult_1.UserfriendlyResult.ok(undefined);
496
- }
493
+ if (account)
494
+ return await this._handleTruncatedReference(truncatedReference, account);
497
495
  // process Files and RelationshipTemplates and ask for an account
498
496
  if (truncatedReference.startsWith(runtime_1.Base64ForIdPrefix.File) ||
499
497
  truncatedReference.startsWith(runtime_1.Base64ForIdPrefix.RelationshipTemplate)) {
@@ -506,13 +504,11 @@ class AppStringProcessor {
506
504
  this.logger.info("User cancelled account selection");
507
505
  return UserfriendlyResult_1.UserfriendlyResult.ok(undefined);
508
506
  }
509
- await this._handleTruncatedReference(truncatedReference, result.value);
510
- return UserfriendlyResult_1.UserfriendlyResult.ok(undefined);
507
+ return await this._handleTruncatedReference(truncatedReference, result.value);
511
508
  }
512
509
  const uiBridge = await this.runtime.uiBridge();
513
510
  if (!truncatedReference.startsWith(runtime_1.Base64ForIdPrefix.Token)) {
514
511
  const error = AppRuntimeErrors_1.AppRuntimeErrors.startup.wrongCode();
515
- await this.error(error);
516
512
  return UserfriendlyResult_1.UserfriendlyResult.fail(error);
517
513
  }
518
514
  const tokenResult = await this.runtime.anonymousServices.tokens.loadPeerTokenByTruncatedReference({
@@ -525,7 +521,6 @@ class AppStringProcessor {
525
521
  const tokenContent = this.parseTokenContent(tokenDTO.content);
526
522
  if (!tokenContent) {
527
523
  const error = AppRuntimeErrors_1.AppRuntimeErrors.startup.wrongCode();
528
- await this.error(error);
529
524
  return UserfriendlyResult_1.UserfriendlyResult.fail(error);
530
525
  }
531
526
  if (tokenContent instanceof transport_1.TokenContentDeviceSharedSecret) {
@@ -541,8 +536,7 @@ class AppStringProcessor {
541
536
  this.logger.info("User cancelled account selection");
542
537
  return UserfriendlyResult_1.UserfriendlyResult.ok(undefined);
543
538
  }
544
- await this._handleTruncatedReference(truncatedReference, selectedAccount);
545
- return UserfriendlyResult_1.UserfriendlyResult.ok(undefined);
539
+ return await this._handleTruncatedReference(truncatedReference, selectedAccount);
546
540
  }
547
541
  async _handleTruncatedReference(truncatedReference, account) {
548
542
  const services = await this.runtime.getServices(account.id);
@@ -550,8 +544,12 @@ class AppStringProcessor {
550
544
  const result = await services.transportServices.account.loadItemFromTruncatedReference({
551
545
  reference: truncatedReference
552
546
  });
553
- if (result.isError)
554
- return await this.error(result.error);
547
+ if (result.isError) {
548
+ if (result.error.code === "error.runtime.validation.invalidPropertyValue") {
549
+ return UserfriendlyResult_1.UserfriendlyResult.fail(new UserfriendlyApplicationError_1.UserfriendlyApplicationError("error.appStringProcessor.truncatedReferenceInvalid", "The given code does not contain a valid truncated reference."));
550
+ }
551
+ return UserfriendlyResult_1.UserfriendlyResult.fail(UserfriendlyApplicationError_1.UserfriendlyApplicationError.fromError(result.error));
552
+ }
555
553
  switch (result.value.type) {
556
554
  case "File":
557
555
  const file = await services.dataViewExpander.expandFileDTO(result.value.value);
@@ -561,12 +559,11 @@ class AppStringProcessor {
561
559
  // RelationshipTemplates are processed by the RequestModule
562
560
  break;
563
561
  case "Token":
564
- await this.error(new UserfriendlyApplicationError_1.UserfriendlyApplicationError("error.appStringProcessor.notSupportedTokenContent", "The scanned code is not supported in this context"));
565
- break;
562
+ return UserfriendlyResult_1.UserfriendlyResult.fail(new UserfriendlyApplicationError_1.UserfriendlyApplicationError("error.appStringProcessor.notSupportedTokenContent", "The scanned code is not supported in this context"));
566
563
  case "DeviceOnboardingInfo":
567
- await this.error(new UserfriendlyApplicationError_1.UserfriendlyApplicationError("error.appStringProcessor.deviceOnboardingNotAllowed", "The token contained a device onboarding info, but this is not allowed in this context."));
568
- break;
564
+ return UserfriendlyResult_1.UserfriendlyResult.fail(new UserfriendlyApplicationError_1.UserfriendlyApplicationError("error.appStringProcessor.deviceOnboardingNotAllowed", "The token contained a device onboarding info, but this is not allowed in this context."));
569
565
  }
566
+ return UserfriendlyResult_1.UserfriendlyResult.ok(undefined);
570
567
  }
571
568
  parseTokenContent(content) {
572
569
  try {
@@ -577,14 +574,6 @@ class AppStringProcessor {
577
574
  return undefined;
578
575
  }
579
576
  }
580
- async error(error) {
581
- const parsedError = error instanceof UserfriendlyApplicationError_1.UserfriendlyApplicationError //
582
- ? error
583
- : UserfriendlyApplicationError_1.UserfriendlyApplicationError.fromError(error);
584
- this.logger.error(parsedError);
585
- const uiBridge = await this.runtime.uiBridge();
586
- await uiBridge.showError(parsedError);
587
- }
588
577
  }
589
578
  exports.AppStringProcessor = AppStringProcessor;
590
579
  //# sourceMappingURL=AppStringProcessor.js.map
@@ -695,11 +684,11 @@ const crypto_1 = __webpack_require__(/*! @nmshd/crypto */ "@nmshd/crypto");
695
684
  const runtime_1 = __webpack_require__(/*! @nmshd/runtime */ "@nmshd/runtime");
696
685
  const transport_1 = __webpack_require__(/*! @nmshd/transport */ "@nmshd/transport");
697
686
  exports.buildInformation = {
698
- version: "2.3.1",
699
- build: "44",
700
- date: "2023-02-20T20:58:44+00:00",
701
- commit: "3be48800a392d01e312c4890e53f8673d159df2b",
702
- dependencies: {"@js-soft/docdb-access-loki":"^1.0.3","@js-soft/native-abstractions":"^1.2.1","@nmshd/runtime":"2.4.1","lodash":"^4.17.21"},
687
+ version: "2.3.3",
688
+ build: "46",
689
+ date: "2023-02-24T09:22:03+00:00",
690
+ commit: "3f3445e8dcac1837af0133972d3688d289ab6731",
691
+ dependencies: {"@js-soft/docdb-access-loki":"^1.0.3","@js-soft/native-abstractions":"^1.2.1","lodash":"^4.17.21"},
703
692
  libraries: {
704
693
  serval: ts_serval_1.buildInformation,
705
694
  crypto: crypto_1.buildInformation,
@@ -1211,7 +1200,11 @@ class AppLaunchModule extends AppRuntimeModule_1.AppRuntimeModule {
1211
1200
  this.subscribeToNativeEvent(native_abstractions_1.UrlOpenEvent, this.handleUrlOpen.bind(this));
1212
1201
  }
1213
1202
  async handleUrlOpen(event) {
1214
- await this.runtime.stringProcessor.processURL(event.url);
1203
+ const result = await this.runtime.stringProcessor.processURL(event.url);
1204
+ if (result.isSuccess)
1205
+ return;
1206
+ const uiBridge = await this.runtime.uiBridge();
1207
+ await uiBridge.showError(result.error);
1215
1208
  }
1216
1209
  stop() {
1217
1210
  this.unsubscribeFromAllEvents();