@lvce-editor/auth-worker 3.10.0 → 3.11.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.
@@ -906,6 +906,34 @@ const listen$1 = async (module, options) => {
906
906
  return ipc;
907
907
  };
908
908
 
909
+ const createSharedLazyRpc = factory => {
910
+ let rpcPromise;
911
+ const getOrCreate = () => {
912
+ if (!rpcPromise) {
913
+ rpcPromise = factory();
914
+ }
915
+ return rpcPromise;
916
+ };
917
+ return {
918
+ async dispose() {
919
+ const rpc = await getOrCreate();
920
+ await rpc.dispose();
921
+ },
922
+ async invoke(method, ...params) {
923
+ const rpc = await getOrCreate();
924
+ return rpc.invoke(method, ...params);
925
+ },
926
+ async invokeAndTransfer(method, ...params) {
927
+ const rpc = await getOrCreate();
928
+ return rpc.invokeAndTransfer(method, ...params);
929
+ },
930
+ async send(method, ...params) {
931
+ const rpc = await getOrCreate();
932
+ rpc.send(method, ...params);
933
+ }
934
+ };
935
+ };
936
+
909
937
  const create$4 = async ({
910
938
  commandMap,
911
939
  isMessagePortOpen = true,
@@ -941,34 +969,6 @@ const create$3 = async ({
941
969
  });
942
970
  };
943
971
 
944
- const createSharedLazyRpc = factory => {
945
- let rpcPromise;
946
- const getOrCreate = () => {
947
- if (!rpcPromise) {
948
- rpcPromise = factory();
949
- }
950
- return rpcPromise;
951
- };
952
- return {
953
- async dispose() {
954
- const rpc = await getOrCreate();
955
- await rpc.dispose();
956
- },
957
- async invoke(method, ...params) {
958
- const rpc = await getOrCreate();
959
- return rpc.invoke(method, ...params);
960
- },
961
- async invokeAndTransfer(method, ...params) {
962
- const rpc = await getOrCreate();
963
- return rpc.invokeAndTransfer(method, ...params);
964
- },
965
- async send(method, ...params) {
966
- const rpc = await getOrCreate();
967
- rpc.send(method, ...params);
968
- }
969
- };
970
- };
971
-
972
972
  const create$2 = async ({
973
973
  commandMap,
974
974
  isMessagePortOpen,
@@ -1070,31 +1070,27 @@ const {
1070
1070
  const Web = 1;
1071
1071
  const Electron = 2;
1072
1072
 
1073
+ const MainProcess = -5;
1073
1074
  const OpenerWorker = 4561;
1074
1075
  const RendererWorker = 1;
1075
- const SharedProcess = 1492;
1076
1076
 
1077
1077
  const {
1078
1078
  invoke: invoke$2,
1079
1079
  set: set$1
1080
- } = create(OpenerWorker);
1080
+ } = create(MainProcess);
1081
1081
 
1082
1082
  const {
1083
1083
  invoke: invoke$1,
1084
+ set
1085
+ } = create(OpenerWorker);
1086
+
1087
+ const {
1088
+ invoke,
1084
1089
  invokeAndTransfer} = create(RendererWorker);
1085
1090
  const sendMessagePortToOpenerWorker$1 = async (port, rpcId) => {
1086
1091
  const command = 'HandleMessagePort.handleMessagePort';
1087
1092
  await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToOpenerWorker', port, command, rpcId);
1088
1093
  };
1089
- const sendMessagePortToSharedProcess$1 = async port => {
1090
- const command = 'HandleElectronMessagePort.handleElectronMessagePort';
1091
- await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToSharedProcess', port, command, 0);
1092
- };
1093
-
1094
- const {
1095
- invoke,
1096
- set
1097
- } = create(SharedProcess);
1098
1094
 
1099
1095
  const sendMessagePortToAuthProcess = async port => {
1100
1096
  await invokeAndTransfer('SendMessagePortToExtensionHostWorker.sendMessagePortToSharedProcess', port, 'HandleMessagePortForAuthProcess.handleMessagePortForAuthProcess');
@@ -1107,6 +1103,17 @@ const initializeAuthProcess = async () => {
1107
1103
  set$2(rpc);
1108
1104
  };
1109
1105
 
1106
+ const sendMessagePortToMainProcess = async port => {
1107
+ await invokeAndTransfer('SendMessagePortToMainProcess.sendMessagePortToMainProcess', port, 'HandleElectronMessagePort.handleElectronMessagePort', 0);
1108
+ };
1109
+ const initializeMainProcess = async () => {
1110
+ const rpc = await create$2({
1111
+ commandMap: {},
1112
+ send: sendMessagePortToMainProcess
1113
+ });
1114
+ set$1(rpc);
1115
+ };
1116
+
1110
1117
  const sendMessagePortToOpenerWorker = async port => {
1111
1118
  await sendMessagePortToOpenerWorker$1(port, 0);
1112
1119
  };
@@ -1115,7 +1122,7 @@ const initializeOpenerWorker = async () => {
1115
1122
  commandMap: {},
1116
1123
  send: sendMessagePortToOpenerWorker
1117
1124
  });
1118
- set$1(rpc);
1125
+ set(rpc);
1119
1126
  };
1120
1127
 
1121
1128
  const millisecondsPerSecond = 1000;
@@ -1155,14 +1162,14 @@ const setAuthPlatform = value => {
1155
1162
 
1156
1163
  const authStorageId = 'lvce-editor.auth';
1157
1164
  const deleteSecret = async key => {
1158
- await invoke('SecretStorage.delete', authStorageId, key);
1165
+ await invoke$2('SecretStorage.delete', authStorageId, key);
1159
1166
  };
1160
1167
  const getSecret = async key => {
1161
- const value = await invoke('SecretStorage.get', authStorageId, key);
1168
+ const value = await invoke$2('SecretStorage.get', authStorageId, key);
1162
1169
  return typeof value === 'string' ? value : '';
1163
1170
  };
1164
1171
  const storeSecret = async (key, value) => {
1165
- await invoke('SecretStorage.store', authStorageId, key, value);
1172
+ await invoke$2('SecretStorage.store', authStorageId, key, value);
1166
1173
  };
1167
1174
 
1168
1175
  const databaseName = 'auth-worker';
@@ -2226,7 +2233,7 @@ const exchangeAuthorizationCode = async (backendUrl, clientId, code, redirectUri
2226
2233
 
2227
2234
  const getCurrentHref = async () => {
2228
2235
  try {
2229
- return await invoke$1('Layout.getHref');
2236
+ return await invoke('Layout.getHref');
2230
2237
  } catch {
2231
2238
  // ignore
2232
2239
  }
@@ -3102,7 +3109,7 @@ const getInteractiveLoginResult = async (backendUrl, platform, signingInState) =
3102
3109
  state
3103
3110
  });
3104
3111
  }
3105
- await invoke$2('Open.openUrl', loginUrl, platform, authUseRedirect);
3112
+ await invoke$1('Open.openUrl', loginUrl, platform, authUseRedirect);
3106
3113
  if (platform !== Electron && authUseRedirect) {
3107
3114
  return signingInState;
3108
3115
  }
@@ -3183,19 +3190,8 @@ const initializeRendererWorker = async () => {
3183
3190
  });
3184
3191
  };
3185
3192
 
3186
- const sendMessagePortToSharedProcess = async port => {
3187
- await sendMessagePortToSharedProcess$1(port);
3188
- };
3189
- const initializeSharedProcess = async () => {
3190
- const rpc = await create$2({
3191
- commandMap: {},
3192
- send: sendMessagePortToSharedProcess
3193
- });
3194
- set(rpc);
3195
- };
3196
-
3197
3193
  const listen = async () => {
3198
- await Promise.all([initializeRendererWorker(), initializeOpenerWorker(), initializeAuthProcess(), initializeSharedProcess()]);
3194
+ await Promise.all([initializeRendererWorker(), initializeOpenerWorker(), initializeAuthProcess(), initializeMainProcess()]);
3199
3195
  };
3200
3196
 
3201
3197
  const main = async () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/auth-worker",
3
- "version": "3.10.0",
3
+ "version": "3.11.1",
4
4
  "description": "Auth Worker",
5
5
  "repository": {
6
6
  "type": "git",