2026-10-13 12:43:34 +00:00
|
|
|
// Module ID: 15111
|
|
|
|
|
// Function ID: 15112
|
2026-09-10 05:38:07 +00:00
|
|
|
// Name: RPCServer
|
2026-10-13 12:43:34 +00:00
|
|
|
// Dependencies: [5, 5639, 1085, 12, 10946, 10936, 15054, 1265, 38, 15053, 11250, 1102, 2]
|
2026-07-20 16:05:17 +00:00
|
|
|
|
2026-10-13 12:43:34 +00:00
|
|
|
// Module 15111 (RPCServer)
|
2026-09-10 05:38:07 +00:00
|
|
|
import _modDef12 from "module_12" /* 12 */;
|
2026-10-09 10:00:15 +00:00
|
|
|
import AnalyticsUtilsDefault from "AnalyticsUtils" /* 1265 */;
|
2026-10-10 08:08:14 +00:00
|
|
|
import Constants2 from "Constants" /* 5639 */;
|
|
|
|
|
import RPCErrorDefault from "RPCError" /* 10936 */;
|
|
|
|
|
import transformUserDefault from "transformUser" /* 10946 */;
|
2026-10-13 12:43:34 +00:00
|
|
|
import RpcCommandInterception from "RpcCommandInterception" /* 11250 */;
|
|
|
|
|
import validateScopeDefault from "validateScope" /* 15054 */;
|
2026-10-03 08:58:59 +00:00
|
|
|
import _asyncToGenerator from "_asyncToGenerator" /* 5 */;
|
|
|
|
|
import Constants from "Constants" /* 1085 */;
|
|
|
|
|
import size from "module_2" /* 2 */;
|
2026-07-23 10:11:24 +00:00
|
|
|
|
2026-10-08 09:57:35 +00:00
|
|
|
let c5, command, dependencyMap, importDefault;
|
2026-10-03 08:58:59 +00:00
|
|
|
|
|
|
|
|
let c9;
|
|
|
|
|
let hasOwnProperty;
|
|
|
|
|
let metroImportAll;
|
|
|
|
|
let metroImportDefault;
|
|
|
|
|
let metroRequire;
|
|
|
|
|
const TransportTypes = Constants2.TransportTypes;
|
|
|
|
|
({ AnalyticEvents: hasOwnProperty, RPCCloseCodes: metroRequire, RPCCommands: metroImportDefault, RPCErrors: metroImportAll, RPCEvents: c9 } = Constants);
|
2026-07-29 08:29:29 +00:00
|
|
|
const RPC_STORE_WAIT = "RPC_STORE_WAIT";
|
2026-10-03 08:58:59 +00:00
|
|
|
const unpackModuleId = [];
|
2026-09-10 05:38:07 +00:00
|
|
|
let result = size.fileFinishedImporting("modules/rpc/RPCServer.tsx");
|
2026-07-29 08:29:29 +00:00
|
|
|
class RPCServer {
|
2026-10-03 08:58:59 +00:00
|
|
|
constructor(getJoi) {
|
|
|
|
|
const merged = Object.assign({ getCurrentUser: null, onConnect: null, onDisconnect: null, events: null, commands: null, sockets: null, subscriptions: null, isSubscribedListeners: null });
|
2026-09-10 05:38:07 +00:00
|
|
|
merged[0] = function getCurrentUser() {
|
2026-07-29 08:29:29 +00:00
|
|
|
return null;
|
|
|
|
|
};
|
2026-09-10 05:38:07 +00:00
|
|
|
merged[1] = function onConnect() {
|
2026-07-20 16:05:17 +00:00
|
|
|
|
2026-07-29 08:29:29 +00:00
|
|
|
};
|
2026-09-10 05:38:07 +00:00
|
|
|
merged[2] = function onDisconnect() {
|
2026-07-20 16:05:17 +00:00
|
|
|
|
2026-07-29 08:29:29 +00:00
|
|
|
};
|
2026-09-10 05:38:07 +00:00
|
|
|
merged[3] = {};
|
|
|
|
|
merged[4] = {};
|
2026-10-03 08:58:59 +00:00
|
|
|
merged[5] = new Set();
|
2026-09-10 05:38:07 +00:00
|
|
|
merged[6] = [];
|
2026-10-03 08:58:59 +00:00
|
|
|
new Set();
|
|
|
|
|
merged[7] = new Set();
|
|
|
|
|
merged.getJoi = getJoi;
|
|
|
|
|
new Set();
|
2026-09-10 05:38:07 +00:00
|
|
|
return merged;
|
2026-07-20 16:05:17 +00:00
|
|
|
}
|
2026-10-03 08:58:59 +00:00
|
|
|
registerTransport(item10013) {
|
|
|
|
|
const self = this;
|
|
|
|
|
item10013.on("connect", (arg0) => self.handleConnect(arg0));
|
|
|
|
|
item10013.on("request", (arg0, arg1) => self.handleRequest(arg0, arg1));
|
|
|
|
|
item10013.on("disconnect", (arg0, arg1) => self.handleDisconnect(arg0, arg1));
|
2026-07-29 08:29:29 +00:00
|
|
|
}
|
2026-10-03 08:58:59 +00:00
|
|
|
handleConnect(v) {
|
|
|
|
|
let obj2;
|
|
|
|
|
const self = this;
|
|
|
|
|
const sockets = this.sockets;
|
|
|
|
|
sockets.add(v);
|
|
|
|
|
this.onConnect(v);
|
|
|
|
|
const obj = { v: v.version, config: obj2 };
|
|
|
|
|
obj2 = { cdn_host: window.GLOBAL_ENV.CDN_HOST, api_endpoint: window.GLOBAL_ENV.API_ENDPOINT, environment: "production" };
|
|
|
|
|
if (v.transport === TransportTypes.IPC) {
|
|
|
|
|
const currentUser = self.getCurrentUser();
|
|
|
|
|
if (null == currentUser) {
|
|
|
|
|
v.close(metroRequire.CLOSE_NORMAL, "User logged out");
|
|
|
|
|
} else {
|
|
|
|
|
obj.user = transformUserDefault(currentUser);
|
2026-07-29 08:29:29 +00:00
|
|
|
}
|
2026-07-20 16:05:17 +00:00
|
|
|
}
|
2026-10-03 08:58:59 +00:00
|
|
|
self.dispatch(v, null, metroImportDefault.DISPATCH, constants5.READY, obj);
|
|
|
|
|
}
|
|
|
|
|
handleDisconnect(abortController, arg1) {
|
|
|
|
|
abortController = abortController.abortController;
|
|
|
|
|
abortController.abort("DISCONNECTED");
|
|
|
|
|
this.removeSubscriptions(abortController);
|
|
|
|
|
const sockets = this.sockets;
|
|
|
|
|
sockets.delete(abortController);
|
|
|
|
|
this.onDisconnect(abortController, arg1);
|
|
|
|
|
}
|
|
|
|
|
handleRequest(socket, arg1) {
|
2026-10-13 12:43:34 +00:00
|
|
|
const f120196 = (result) => {
|
2026-10-03 08:58:59 +00:00
|
|
|
let closure_0 = self(function*(arg0, value) {
|
|
|
|
|
let closure_1;
|
|
|
|
|
closure_0 = arg0;
|
|
|
|
|
if (c5 === 2) {
|
|
|
|
|
c5 = 3;
|
|
|
|
|
throw new TypeError("Generator functions may not be called on executing generators");
|
|
|
|
|
} else if (tmp3 === 3) {
|
|
|
|
|
if (arg0 === 1) {
|
|
|
|
|
throw value;
|
|
|
|
|
} else if (arg0 === 2) {
|
|
|
|
|
const obj2 = { value, done: true };
|
|
|
|
|
return obj2;
|
2026-07-29 08:29:29 +00:00
|
|
|
} else {
|
2026-10-12 06:59:38 +00:00
|
|
|
return { value: "IconComponent", done: null };
|
2026-07-20 16:05:17 +00:00
|
|
|
}
|
2026-07-29 08:29:29 +00:00
|
|
|
} else {
|
2026-10-03 08:58:59 +00:00
|
|
|
try {
|
|
|
|
|
let tmp;
|
|
|
|
|
c5 = 2;
|
|
|
|
|
if (0 === c4) {
|
|
|
|
|
if (arg0 === 1) {
|
2026-09-10 05:38:07 +00:00
|
|
|
c5 = 3;
|
2026-10-03 08:58:59 +00:00
|
|
|
throw value;
|
|
|
|
|
} else if (arg0 === 2) {
|
|
|
|
|
c5 = 3;
|
|
|
|
|
const obj3 = { value, done: true };
|
|
|
|
|
return obj3;
|
2026-09-10 05:38:07 +00:00
|
|
|
} else {
|
2026-10-03 08:58:59 +00:00
|
|
|
let closure_3 = tmp4;
|
|
|
|
|
tmp = undefined;
|
|
|
|
|
if (null != closure_0.validation) {
|
|
|
|
|
c4 = 1;
|
|
|
|
|
c5 = 1;
|
|
|
|
|
const obj4 = { value: closure_0.getJoi(), done: false };
|
|
|
|
|
return obj4;
|
|
|
|
|
} else {
|
|
|
|
|
tmp26(closure_0);
|
|
|
|
|
}
|
2026-09-10 05:38:07 +00:00
|
|
|
}
|
2026-10-03 08:58:59 +00:00
|
|
|
} else if (arg0 === 1) {
|
2026-09-10 05:38:07 +00:00
|
|
|
c5 = 3;
|
|
|
|
|
throw value;
|
|
|
|
|
} else if (arg0 === 2) {
|
|
|
|
|
c5 = 3;
|
2026-10-03 08:58:59 +00:00
|
|
|
let obj = { value, done: true };
|
|
|
|
|
return obj;
|
2026-09-10 05:38:07 +00:00
|
|
|
} else {
|
2026-10-03 08:58:59 +00:00
|
|
|
tmp = value;
|
|
|
|
|
socket(closure_3_2[8])(null != closure_0.validation, "command.validation must not be null");
|
|
|
|
|
args = args.args;
|
|
|
|
|
tmp.validate(args, closure_0.validation(tmp), { convert: false }, function(message) {
|
|
|
|
|
if (null == message) {
|
|
|
|
|
closure_1_0(closure_0);
|
|
|
|
|
} else {
|
|
|
|
|
self = this;
|
|
|
|
|
const self2 = this;
|
|
|
|
|
const obj = { errorCode: constants.INVALID_PAYLOAD };
|
|
|
|
|
const tmp6 = new socket(closure_4_2[5])(obj, message.message);
|
|
|
|
|
closure_1_1(tmp6);
|
|
|
|
|
}
|
|
|
|
|
});
|
2026-07-20 16:05:17 +00:00
|
|
|
}
|
2026-07-29 08:29:29 +00:00
|
|
|
c5 = 3;
|
2026-10-12 06:59:38 +00:00
|
|
|
return { value: "IconComponent", done: null };
|
2026-10-03 08:58:59 +00:00
|
|
|
} catch (tmp8) {
|
|
|
|
|
c5 = 3;
|
|
|
|
|
throw tmp8;
|
2026-07-20 16:05:17 +00:00
|
|
|
}
|
|
|
|
|
}
|
2026-10-03 08:58:59 +00:00
|
|
|
});
|
|
|
|
|
const promise = new Promise(function() {
|
|
|
|
|
return closure_0(...arguments);
|
|
|
|
|
});
|
|
|
|
|
return promise;
|
2026-10-08 09:57:35 +00:00
|
|
|
};
|
|
|
|
|
let closure_2 = arg1;
|
|
|
|
|
let self = this;
|
|
|
|
|
let promise = new Promise(function(fn) {
|
|
|
|
|
let scope;
|
|
|
|
|
let str2;
|
|
|
|
|
if (null != closure_2.nonce) {
|
|
|
|
|
if ("" !== closure_2.nonce) {
|
|
|
|
|
const cmd = tmp.cmd;
|
|
|
|
|
if (null == self.commands[cmd]) {
|
|
|
|
|
const _HermesInternal = HermesInternal;
|
|
|
|
|
const self3 = this;
|
|
|
|
|
const self4 = this;
|
|
|
|
|
const obj2 = { errorCode: metroImportAll.INVALID_COMMAND };
|
|
|
|
|
const tmp15 = RPCErrorDefault;
|
|
|
|
|
const tmp152 = new tmp15(obj2, "Invalid command: " + closure_2.cmd);
|
|
|
|
|
throw tmp152;
|
|
|
|
|
} else if (validateScopeDefault(socket.authorization.scopes, self.commands[cmd].scope)) {
|
|
|
|
|
const obj3 = { command: cmd, scope, application_id: socket.application.id, socket_scope: str2.toString() };
|
|
|
|
|
const track = AnalyticsUtilsDefault.track;
|
|
|
|
|
const RPC_COMMAND_SENT = hasOwnProperty.RPC_COMMAND_SENT;
|
|
|
|
|
AnalyticsUtilsDefault;
|
|
|
|
|
if (typeof self.commands[cmd].scope === "object") {
|
|
|
|
|
const _JSON = JSON;
|
|
|
|
|
scope = JSON.stringify(tmp23.scope);
|
|
|
|
|
} else {
|
|
|
|
|
scope = tmp23.scope;
|
|
|
|
|
}
|
|
|
|
|
const _Array = Array;
|
|
|
|
|
str2 = Array.from(socket.authorization.scopes);
|
|
|
|
|
track(RPC_COMMAND_SENT, obj3);
|
|
|
|
|
fn(self.commands[cmd]);
|
|
|
|
|
} else {
|
|
|
|
|
self = this;
|
|
|
|
|
const self2 = this;
|
|
|
|
|
const obj = { errorCode: metroImportAll.INVALID_PERMISSIONS };
|
|
|
|
|
const tmp4 = new RPCErrorDefault(obj, "Not authenticated or invalid scope");
|
|
|
|
|
throw tmp4;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
const obj4 = { errorCode: metroImportAll.INVALID_PAYLOAD };
|
|
|
|
|
const tmp21 = new RPCErrorDefault(obj4, "Payload requires a nonce");
|
|
|
|
|
throw tmp21;
|
|
|
|
|
});
|
2026-10-13 12:43:34 +00:00
|
|
|
const then = promise.then(f120196).then;
|
|
|
|
|
promise.then(f120196);
|
2026-10-08 09:57:35 +00:00
|
|
|
let closure_0 = self((command) => {
|
|
|
|
|
let closure_1;
|
|
|
|
|
let c3 = 0;
|
|
|
|
|
let c4 = 0;
|
|
|
|
|
return (function*(arg0) {
|
|
|
|
|
let validateAccessResult;
|
|
|
|
|
args = tmp;
|
|
|
|
|
const obj8 = command(closure_2_2[9]);
|
|
|
|
|
const isBotScopeOnlyResult = obj8.isBotScopeOnly(args, command.scope);
|
|
|
|
|
const botScopeOnly = isBotScopeOnlyResult;
|
|
|
|
|
const validateAccess = command.validateAccess;
|
|
|
|
|
const tmp18 = args;
|
|
|
|
|
if (validateAccess != null) {
|
|
|
|
|
const obj4 = { socket: tmp18, args, botScopeOnly: isBotScopeOnlyResult };
|
|
|
|
|
args = args.args ?? {};
|
|
|
|
|
validateAccessResult = validateAccess(obj4);
|
|
|
|
|
}
|
|
|
|
|
yield validateAccessResult;
|
|
|
|
|
return { command, botScopeOnly };
|
|
|
|
|
})();
|
|
|
|
|
});
|
|
|
|
|
const nextPromise1 = then(function() {
|
|
|
|
|
return closure_0(...arguments);
|
2026-07-29 08:29:29 +00:00
|
|
|
});
|
2026-10-08 09:57:35 +00:00
|
|
|
const nextPromise2 = nextPromise1.then((command) => {
|
2026-10-03 08:58:59 +00:00
|
|
|
let args;
|
|
|
|
|
let args1;
|
2026-10-08 09:57:35 +00:00
|
|
|
command = command.command;
|
|
|
|
|
const botScopeOnly = command.botScopeOnly;
|
2026-10-03 08:58:59 +00:00
|
|
|
if (socket.source.type === TransportTypes.POST_MESSAGE) {
|
|
|
|
|
const obj = { cmd: closure_2.cmd, iframeId: socket.source.iframeId, args };
|
|
|
|
|
args = closure_2.args;
|
|
|
|
|
const interceptRpcCommand = RpcCommandInterception.interceptRpcCommand;
|
|
|
|
|
RpcCommandInterception;
|
|
|
|
|
if (args == null) {
|
|
|
|
|
args = {};
|
|
|
|
|
}
|
|
|
|
|
const interceptRpcCommandResult = interceptRpcCommand(obj);
|
|
|
|
|
if (null != interceptRpcCommandResult) {
|
|
|
|
|
return interceptRpcCommandResult.result;
|
|
|
|
|
}
|
2026-08-24 06:08:38 +00:00
|
|
|
}
|
2026-10-03 08:58:59 +00:00
|
|
|
const obj2 = {
|
|
|
|
|
socket,
|
|
|
|
|
server: self,
|
|
|
|
|
cmd: closure_2.cmd,
|
|
|
|
|
evt: closure_2.evt,
|
|
|
|
|
nonce: closure_2.nonce,
|
|
|
|
|
args: args1,
|
2026-10-08 09:57:35 +00:00
|
|
|
botScopeOnly,
|
2026-10-03 08:58:59 +00:00
|
|
|
isSocketConnected() {
|
|
|
|
|
sockets = sockets.sockets;
|
|
|
|
|
return sockets.has(socket);
|
|
|
|
|
},
|
|
|
|
|
signal: socket.abortController.signal
|
|
|
|
|
};
|
|
|
|
|
args1 = closure_2.args;
|
2026-10-08 09:57:35 +00:00
|
|
|
const handler = command.handler;
|
2026-10-03 08:58:59 +00:00
|
|
|
if (args1 == null) {
|
|
|
|
|
args1 = {};
|
2026-08-24 06:08:38 +00:00
|
|
|
}
|
2026-10-03 08:58:59 +00:00
|
|
|
return handler(obj2);
|
|
|
|
|
});
|
2026-10-08 09:57:35 +00:00
|
|
|
const nextPromise3 = nextPromise2.then((result) => self.dispatch(socket, closure_2.nonce, closure_2.cmd, null, result));
|
|
|
|
|
nextPromise3.catch((error) => self.error(socket, closure_2.nonce, closure_2.cmd, error.code, error.message));
|
2026-07-29 08:29:29 +00:00
|
|
|
}
|
2026-10-03 08:58:59 +00:00
|
|
|
setCommandHandler(arg0, arg1) {
|
|
|
|
|
this.commands[arg0] = arg1;
|
2026-07-29 08:29:29 +00:00
|
|
|
}
|
2026-10-03 08:58:59 +00:00
|
|
|
setEventHandler(arg0, arg1) {
|
|
|
|
|
this.events[arg0] = arg1;
|
2026-07-29 08:29:29 +00:00
|
|
|
}
|
2026-10-03 08:58:59 +00:00
|
|
|
dispatch(send) {
|
|
|
|
|
let tmp = arg1;
|
|
|
|
|
if (arg1 === undefined) {
|
|
|
|
|
tmp = null;
|
|
|
|
|
}
|
|
|
|
|
let DISPATCH = arg2;
|
|
|
|
|
if (arg2 === undefined) {
|
|
|
|
|
DISPATCH = metroImportDefault.DISPATCH;
|
|
|
|
|
}
|
|
|
|
|
let tmp3 = arg3;
|
|
|
|
|
if (arg3 === undefined) {
|
|
|
|
|
tmp3 = null;
|
|
|
|
|
}
|
|
|
|
|
let tmp4 = arg4;
|
|
|
|
|
if (arg4 === undefined) {
|
|
|
|
|
tmp4 = null;
|
|
|
|
|
}
|
|
|
|
|
send.send({ cmd: DISPATCH, data: tmp4, evt: tmp3, nonce: tmp });
|
2026-07-29 08:29:29 +00:00
|
|
|
}
|
2026-10-03 08:58:59 +00:00
|
|
|
error(arg0) {
|
|
|
|
|
let tmp = arg1;
|
|
|
|
|
if (arg1 === undefined) {
|
|
|
|
|
tmp = null;
|
|
|
|
|
}
|
|
|
|
|
let DISPATCH = arg2;
|
|
|
|
|
if (arg2 === undefined) {
|
|
|
|
|
DISPATCH = metroImportDefault.DISPATCH;
|
|
|
|
|
}
|
|
|
|
|
let UNKNOWN_ERROR = arg3;
|
|
|
|
|
if (arg3 === undefined) {
|
|
|
|
|
UNKNOWN_ERROR = metroImportAll.UNKNOWN_ERROR;
|
|
|
|
|
}
|
|
|
|
|
let str = arg4;
|
|
|
|
|
if (arg4 === undefined) {
|
|
|
|
|
str = "Unknown Error";
|
|
|
|
|
}
|
|
|
|
|
const obj = AnalyticsUtilsDefault;
|
|
|
|
|
obj.track(hasOwnProperty.RPC_SERVER_ERROR_CAUGHT, { command: DISPATCH, code: UNKNOWN_ERROR, message: str });
|
|
|
|
|
const obj2 = { code: UNKNOWN_ERROR, message: str };
|
|
|
|
|
this.dispatch(arg0, tmp, DISPATCH, constants5.ERROR, obj2);
|
2026-07-29 08:29:29 +00:00
|
|
|
}
|
2026-10-03 08:58:59 +00:00
|
|
|
listenIsSubscribed(arg0) {
|
|
|
|
|
const self = this;
|
|
|
|
|
let closure_0 = arg0;
|
|
|
|
|
let isSubscribedListeners = this.isSubscribedListeners;
|
|
|
|
|
isSubscribedListeners.add(arg0);
|
|
|
|
|
return () => {
|
|
|
|
|
const isSubscribedListeners = self.isSubscribedListeners;
|
|
|
|
|
isSubscribedListeners.delete(closure_0);
|
|
|
|
|
};
|
2026-07-29 08:29:29 +00:00
|
|
|
}
|
2026-10-03 08:58:59 +00:00
|
|
|
dispatchIsSubscribedUpdate() {
|
|
|
|
|
const prop = this.isSubscribedListeners;
|
|
|
|
|
const item = prop.forEach((fn) => fn());
|
2026-07-29 08:29:29 +00:00
|
|
|
}
|
2026-10-03 08:58:59 +00:00
|
|
|
isSubscribed(arg0, arg1) {
|
|
|
|
|
let closure_0 = arg0;
|
|
|
|
|
let closure_1 = arg1;
|
|
|
|
|
const subscriptions = this.subscriptions;
|
|
|
|
|
return undefined !== subscriptions.find((socket) => socket.socket.application.id === closure_0 && socket.evt === closure_1);
|
2026-07-29 08:29:29 +00:00
|
|
|
}
|
2026-10-03 08:58:59 +00:00
|
|
|
isChildSubscribed(arg0, arg1) {
|
|
|
|
|
let closure_0 = arg0;
|
|
|
|
|
let closure_1 = arg1;
|
|
|
|
|
let tmp = null != arg0;
|
2026-07-29 08:29:29 +00:00
|
|
|
if (tmp) {
|
2026-10-03 08:58:59 +00:00
|
|
|
const self = this;
|
|
|
|
|
const subscriptions = this.subscriptions;
|
|
|
|
|
tmp = undefined !== subscriptions.find((socket) => socket.socket.application.parentId === closure_0 && socket.evt === closure_1);
|
2026-07-20 16:05:17 +00:00
|
|
|
}
|
2026-07-29 08:29:29 +00:00
|
|
|
return tmp;
|
2026-10-03 08:58:59 +00:00
|
|
|
}
|
|
|
|
|
getSubscription(socket, evt, c3) {
|
|
|
|
|
let closure_0 = socket;
|
|
|
|
|
let closure_1 = evt;
|
|
|
|
|
let closure_2 = c3;
|
2026-07-29 08:29:29 +00:00
|
|
|
const subscriptions = this.subscriptions;
|
2026-10-03 08:58:59 +00:00
|
|
|
return subscriptions.find((socket) => {
|
|
|
|
|
let isEqualResult = socket.socket === socket && socket.evt === evt;
|
|
|
|
|
if (isEqualResult) {
|
|
|
|
|
const obj = _modDef12;
|
|
|
|
|
isEqualResult = obj.isEqual(socket.args, closure_2);
|
2026-07-20 16:05:17 +00:00
|
|
|
}
|
2026-10-03 08:58:59 +00:00
|
|
|
return isEqualResult;
|
2026-07-29 08:29:29 +00:00
|
|
|
});
|
|
|
|
|
}
|
2026-10-03 08:58:59 +00:00
|
|
|
addSubscription(socket, evt, c3, arg3) {
|
|
|
|
|
let tmpResult;
|
|
|
|
|
let tmp = arg3;
|
|
|
|
|
if (arg3 === undefined) {
|
|
|
|
|
tmp = null;
|
2026-07-20 16:05:17 +00:00
|
|
|
}
|
2026-10-03 08:58:59 +00:00
|
|
|
const self = this;
|
|
|
|
|
const sockets = this.sockets;
|
|
|
|
|
if (sockets.has(socket)) {
|
|
|
|
|
const dispatch = self.dispatch;
|
|
|
|
|
const bindResult = dispatch.bind(self, socket, null, metroImportDefault.DISPATCH, evt);
|
|
|
|
|
if (null == self.getSubscription(socket, evt, c3)) {
|
|
|
|
|
const subscriptions = self.subscriptions;
|
|
|
|
|
const obj = { update: tmp, dispatch: bindResult, prevState: tmpResult, socket, evt, args: c3 };
|
|
|
|
|
tmpResult = null;
|
|
|
|
|
const push = subscriptions.push;
|
|
|
|
|
if (tmp) {
|
|
|
|
|
const obj2 = { prevState: null, dispatch: bindResult };
|
|
|
|
|
tmpResult = tmp(obj2);
|
|
|
|
|
}
|
|
|
|
|
push(obj);
|
|
|
|
|
const result = self.dispatchIsSubscribedUpdate();
|
|
|
|
|
}
|
2026-07-20 16:05:17 +00:00
|
|
|
}
|
2026-07-29 08:29:29 +00:00
|
|
|
}
|
2026-10-03 08:58:59 +00:00
|
|
|
removeSubscription(arg0, arg1, arg2) {
|
|
|
|
|
let closure_1;
|
|
|
|
|
let closure_2;
|
|
|
|
|
let closure_0 = arg0;
|
|
|
|
|
importDefault = arg1;
|
|
|
|
|
dependencyMap = arg2;
|
|
|
|
|
let obj = _modDef12;
|
|
|
|
|
obj.remove(this.subscriptions, (socket) => {
|
|
|
|
|
let isEqualResult = socket.socket === closure_0 && socket.evt === closure_1;
|
|
|
|
|
if (isEqualResult) {
|
|
|
|
|
const obj = _modDef12;
|
|
|
|
|
isEqualResult = obj.isEqual(socket.args, closure_2);
|
2026-09-17 08:17:09 +00:00
|
|
|
}
|
2026-10-03 08:58:59 +00:00
|
|
|
return isEqualResult;
|
|
|
|
|
});
|
|
|
|
|
const result = this.dispatchIsSubscribedUpdate();
|
2026-07-29 08:29:29 +00:00
|
|
|
}
|
2026-10-03 08:58:59 +00:00
|
|
|
removeSubscriptions(abortController) {
|
|
|
|
|
let closure_0 = abortController;
|
|
|
|
|
const obj = _modDef12;
|
|
|
|
|
obj.remove(this.subscriptions, (socket) => socket.socket === closure_0);
|
|
|
|
|
const result = this.dispatchIsSubscribedUpdate();
|
2026-07-29 08:29:29 +00:00
|
|
|
}
|
2026-10-03 08:58:59 +00:00
|
|
|
dispatchToSubscriptions(RELATIONSHIP_UPDATE, targetsFrame, arg2, combined) {
|
|
|
|
|
const self = this;
|
|
|
|
|
let closure_1 = RELATIONSHIP_UPDATE;
|
|
|
|
|
let closure_2 = targetsFrame;
|
|
|
|
|
let closure_0 = arg2;
|
|
|
|
|
let tmp = null != combined && "" !== combined;
|
|
|
|
|
if (tmp) {
|
|
|
|
|
let flag = closure_11.includes(combined);
|
|
|
|
|
if (!flag) {
|
|
|
|
|
closure_11.unshift(combined);
|
|
|
|
|
closure_11.splice(50);
|
|
|
|
|
flag = false;
|
|
|
|
|
}
|
|
|
|
|
tmp = flag;
|
2026-07-29 08:29:29 +00:00
|
|
|
}
|
2026-10-03 08:58:59 +00:00
|
|
|
if (!tmp) {
|
|
|
|
|
const subscriptions = this.subscriptions;
|
|
|
|
|
const item = subscriptions.forEach((evt) => {
|
|
|
|
|
if (evt.evt === RELATIONSHIP_UPDATE) {
|
|
|
|
|
if (typeof targetsFrame !== "function") {
|
|
|
|
|
if (typeof targetsFrame !== "object") {
|
|
|
|
|
let tmp5Result = closure_0;
|
|
|
|
|
if (typeof closure_0 === "function") {
|
|
|
|
|
tmp5Result = tmp5(evt);
|
|
|
|
|
}
|
|
|
|
|
self.dispatch(evt.socket, null, metroImportDefault.DISPATCH, evt.evt, tmp5Result);
|
|
|
|
|
} else {
|
|
|
|
|
let args = evt.args;
|
|
|
|
|
if (args == null) {
|
|
|
|
|
args = {};
|
|
|
|
|
}
|
|
|
|
|
const isEqual = _modDef12.isEqual;
|
|
|
|
|
_modDef12;
|
|
|
|
|
const _Object = Object;
|
|
|
|
|
_modDef12;
|
2026-07-20 16:05:17 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2026-10-03 08:58:59 +00:00
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
updateSubscriptions() {
|
|
|
|
|
const subscriptions = this.subscriptions;
|
|
|
|
|
const item = subscriptions.forEach((update) => {
|
|
|
|
|
if (update.update) {
|
|
|
|
|
update.prevState = update.update(update);
|
2026-07-20 16:05:17 +00:00
|
|
|
}
|
2026-07-29 08:29:29 +00:00
|
|
|
});
|
|
|
|
|
}
|
2026-10-03 08:58:59 +00:00
|
|
|
storeWait(socket, fn, timeout) {
|
|
|
|
|
let self = this;
|
|
|
|
|
importDefault = socket;
|
|
|
|
|
dependencyMap = fn;
|
|
|
|
|
let closure_3 = timeout;
|
|
|
|
|
let tmp = fn();
|
|
|
|
|
if (!tmp) {
|
|
|
|
|
if (0 !== timeout) {
|
|
|
|
|
let obj = _modDef12;
|
|
|
|
|
const uniqueId = obj.uniqueId();
|
|
|
|
|
function removeSubscription() {
|
2026-07-29 08:29:29 +00:00
|
|
|
|
2026-10-03 08:58:59 +00:00
|
|
|
}
|
|
|
|
|
self = this;
|
|
|
|
|
let self2 = this;
|
|
|
|
|
const promise = new Promise((arg0, socket) => {
|
|
|
|
|
let closure_2;
|
|
|
|
|
let closure_0 = arg0;
|
|
|
|
|
timeout = setTimeout(function() {
|
|
|
|
|
if (typeof removeSubscription === "function") {
|
|
|
|
|
const obj = { uniqueId };
|
|
|
|
|
self.removeSubscription(socket, closure_1_10, obj);
|
|
|
|
|
const _Error = Error;
|
|
|
|
|
self = this;
|
|
|
|
|
const self2 = this;
|
|
|
|
|
const error = new Error("timeout");
|
|
|
|
|
socket(error);
|
|
|
|
|
} else {
|
|
|
|
|
throw new TypeError("Trying to call a non-function");
|
|
|
|
|
}
|
2026-10-08 09:57:35 +00:00
|
|
|
}, closure_3 * socket(timeout[11]).Millis.SECOND);
|
2026-10-03 08:58:59 +00:00
|
|
|
let obj = { uniqueId };
|
|
|
|
|
self.addSubscription(socket, RPC_STORE_WAIT, obj, () => {
|
|
|
|
|
const tmp = fn();
|
|
|
|
|
if (tmp) {
|
|
|
|
|
const _clearTimeout = clearTimeout;
|
|
|
|
|
clearTimeout(fn);
|
|
|
|
|
closure_0(tmp);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
return promise.then((result) => {
|
2026-09-10 05:38:07 +00:00
|
|
|
if (typeof removeSubscription === "function") {
|
|
|
|
|
const obj = { uniqueId };
|
2026-10-03 08:58:59 +00:00
|
|
|
self.removeSubscription(socket, RPC_STORE_WAIT, obj);
|
|
|
|
|
return result;
|
2026-09-10 05:38:07 +00:00
|
|
|
} else {
|
|
|
|
|
throw new TypeError("Trying to call a non-function");
|
2026-07-29 08:29:29 +00:00
|
|
|
}
|
|
|
|
|
});
|
2026-10-03 08:58:59 +00:00
|
|
|
}
|
2026-07-29 08:29:29 +00:00
|
|
|
}
|
2026-10-03 08:58:59 +00:00
|
|
|
return Promise.resolve(tmp);
|
2026-07-29 08:29:29 +00:00
|
|
|
}
|
2026-10-03 08:58:59 +00:00
|
|
|
}
|
|
|
|
|
const prototype = RPCServer.prototype;
|
2026-07-20 16:05:17 +00:00
|
|
|
|
2026-07-29 08:29:29 +00:00
|
|
|
export default RPCServer;
|