@singularsystems/neo-core 1.0.0-beta.3 → 1.0.0-beta.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.
@@ -38,6 +38,7 @@ export default abstract class OidcAuthService<TUser extends OidcUser = OidcUser>
38
38
  endSignInSilent(): Promise<any>;
39
39
  private onUserLoaded;
40
40
  protected afterUserLoaded(): Promise<void> | void;
41
+ private completeAfterUserLoaded;
41
42
  protected createUser(user: IOidcUser): OidcUser;
42
43
  private onUserUnloaded;
43
44
  private setUser;
@@ -37,11 +37,14 @@ var OidcAuthService = /** @class */ (function () {
37
37
  case 0: return [4 /*yield*/, this.userManager.getUser()];
38
38
  case 1:
39
39
  user = _a.sent();
40
- if (user) {
41
- // Get user does not raise the onUserLoaded event, so we call it manually.
42
- this.onUserLoaded(user);
43
- }
44
- return [2 /*return*/, this.user];
40
+ if (!user) return [3 /*break*/, 3];
41
+ // Get user does not raise the onUserLoaded event, so we call it manually.
42
+ this.onUserLoaded(user);
43
+ return [4 /*yield*/, this.completeAfterUserLoaded()];
44
+ case 2:
45
+ _a.sent();
46
+ _a.label = 3;
47
+ case 3: return [2 /*return*/, this.user];
45
48
  }
46
49
  });
47
50
  });
@@ -102,24 +105,21 @@ var OidcAuthService = /** @class */ (function () {
102
105
  loginErrorHandler = Misc.Globals.appService.get(NeoTypes.Security.LoginErrorHandler);
103
106
  if (!(!stateKey || window.localStorage.getItem("oidc." + stateKey) === null)) return [3 /*break*/, 1];
104
107
  loginErrorHandler.onMissingLoginState();
105
- return [3 /*break*/, 6];
108
+ return [3 /*break*/, 5];
106
109
  case 1:
107
- _a.trys.push([1, 5, , 6]);
110
+ _a.trys.push([1, 4, , 5]);
108
111
  return [4 /*yield*/, this.endSignIn()];
109
112
  case 2:
110
113
  redirectPath = _a.sent();
111
- if (!this.afterUserLoadedPromise) return [3 /*break*/, 4];
112
- return [4 /*yield*/, this.afterUserLoadedPromise];
114
+ return [4 /*yield*/, this.completeAfterUserLoaded()];
113
115
  case 3:
114
116
  _a.sent();
115
- this.afterUserLoadedPromise = undefined;
116
- _a.label = 4;
117
- case 4: return [2 /*return*/, new SignInResult(true, redirectPath)];
118
- case 5:
117
+ return [2 /*return*/, new SignInResult(true, redirectPath)];
118
+ case 4:
119
119
  e_2 = _a.sent();
120
120
  loginErrorHandler.onException(e_2);
121
- return [3 /*break*/, 6];
122
- case 6: return [2 /*return*/, new SignInResult(false, "")];
121
+ return [3 /*break*/, 5];
122
+ case 5: return [2 /*return*/, new SignInResult(false, "")];
123
123
  }
124
124
  });
125
125
  });
@@ -133,6 +133,22 @@ var OidcAuthService = /** @class */ (function () {
133
133
  };
134
134
  OidcAuthService.prototype.afterUserLoaded = function () {
135
135
  };
136
+ OidcAuthService.prototype.completeAfterUserLoaded = function () {
137
+ return __awaiter(this, void 0, void 0, function () {
138
+ return __generator(this, function (_a) {
139
+ switch (_a.label) {
140
+ case 0:
141
+ if (!this.afterUserLoadedPromise) return [3 /*break*/, 2];
142
+ return [4 /*yield*/, this.afterUserLoadedPromise];
143
+ case 1:
144
+ _a.sent();
145
+ this.afterUserLoadedPromise = undefined;
146
+ _a.label = 2;
147
+ case 2: return [2 /*return*/];
148
+ }
149
+ });
150
+ });
151
+ };
136
152
  OidcAuthService.prototype.createUser = function (user) {
137
153
  return new OidcUser(user);
138
154
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@singularsystems/neo-core",
3
- "version": "1.0.0-beta.3",
3
+ "version": "1.0.0-beta.4",
4
4
  "description": "Core functionality for the Neo client library",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",