@lvce-editor/auth-worker 3.8.0 → 3.9.0

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.
@@ -96,7 +96,6 @@ const walkValue = (value, transferrables, isTransferrable) => {
96
96
  for (const property of Object.values(value)) {
97
97
  walkValue(property, transferrables, isTransferrable);
98
98
  }
99
- return;
100
99
  }
101
100
  };
102
101
  const getTransferrables = value => {
@@ -250,7 +249,14 @@ class IpcError extends VError {
250
249
  const cause = new Error(message);
251
250
  // @ts-ignore
252
251
  cause.code = code;
253
- cause.stack = stack;
252
+ if (stack) {
253
+ Object.defineProperty(cause, 'stack', {
254
+ configurable: true,
255
+ enumerable: false,
256
+ value: stack,
257
+ writable: true
258
+ });
259
+ }
254
260
  super(cause, betterMessage);
255
261
  } else {
256
262
  super(betterMessage);
@@ -3035,13 +3041,14 @@ const hasAuthorizationCode = value => {
3035
3041
  const getElectronAuthorizationCode = async uid => {
3036
3042
  return invoke$3('OAuthServer.getCode', String(uid));
3037
3043
  };
3038
- const waitForElectronBackendLogin = async (backendUrl, uid, redirectUri, codeVerifier, timeoutMs = 30_000, pollIntervalMs = 1000, getAuthorizationCode = getElectronAuthorizationCode, exchangeAuthorizationCode = exchangeElectronAuthorizationCode) => {
3044
+ const waitForElectronBackendLogin = async (backendUrl, uid, redirectUri, codeVerifier, timeoutMs = 30_000, pollIntervalMs = 1000, getAuthorizationCode = getElectronAuthorizationCode, exchangeAuthorizationCode = exchangeElectronAuthorizationCode, getUserName = getOidcUserName) => {
3039
3045
  const deadline = Date.now() + timeoutMs;
3040
3046
  while (Date.now() < deadline) {
3041
3047
  const authorizationCode = await getAuthorizationCode(uid);
3042
3048
  if (hasAuthorizationCode(authorizationCode)) {
3043
3049
  const tokenResponse = await exchangeAuthorizationCode(backendUrl, authorizationCode, redirectUri, codeVerifier);
3044
3050
  const authAccessTokenExpiresAt = getAccessTokenExpiresAt(tokenResponse.expiresIn);
3051
+ const userName = await getUserName(backendUrl, tokenResponse.accessToken);
3045
3052
  return {
3046
3053
  authAccessToken: tokenResponse.accessToken,
3047
3054
  ...(authAccessTokenExpiresAt && {
@@ -3049,6 +3056,7 @@ const waitForElectronBackendLogin = async (backendUrl, uid, redirectUri, codeVer
3049
3056
  }),
3050
3057
  authErrorMessage: '',
3051
3058
  authRefreshToken: tokenResponse.refreshToken,
3059
+ userName,
3052
3060
  userState: tokenResponse.accessToken ? 'loggedIn' : 'loggedOut'
3053
3061
  };
3054
3062
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/auth-worker",
3
- "version": "3.8.0",
3
+ "version": "3.9.0",
4
4
  "description": "Auth Worker",
5
5
  "repository": {
6
6
  "type": "git",