138 lines
6.3 KiB
TypeScript
138 lines
6.3 KiB
TypeScript
/* Metro module 13049; source: modules/rpc/server/commands/subscriptions.tsx; dependencies: [5, 661, 8076, 13050, 683, 13051, 2] */
|
|
function _fun99657(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#99657, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13239:6, offset: 0x021d05b1, size: 201 bytes, params: 8, frame: 20
|
|
var object2;
|
|
const env0_0 = require;
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
const env0_3 = importDefault(5) /* metro dependency 5 */;
|
|
const constantsModule = require(661) /* metro dependency 661: Constants */;
|
|
const env0_4 = constantsModule.AnalyticEvents;
|
|
const RPCCommands = constantsModule.RPCCommands;
|
|
const env0_5 = constantsModule.RPCErrors;
|
|
object2 = {};
|
|
const SUBSCRIBE = RPCCommands.SUBSCRIBE;
|
|
object2[SUBSCRIBE] = {handler: function({server, socket, evt, args}) {
|
|
return args(_fun99659)();
|
|
}};
|
|
const UNSUBSCRIBE = RPCCommands.UNSUBSCRIBE;
|
|
object2[UNSUBSCRIBE] = {handler: handler_99664};
|
|
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/rpc/server/commands/subscriptions.tsx');
|
|
exports.default = object2;
|
|
}
|
|
|
|
function handler_99658({server, socket, evt, args}) { // fn#99658, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13239:191, offset: 0x021d067a, size: 72 bytes, params: 2, frame: 11
|
|
return args(_fun99660)();
|
|
}
|
|
|
|
function handler_99664({server, socket, evt, args}) { // fn#99664, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13239:1125, offset: 0x021d0a1e, size: 156 bytes, params: 2, frame: 16
|
|
var value;
|
|
var defaultImport;
|
|
if (server.events[evt] == null) {
|
|
defaultImport = importDefault(8076) /* metro dependency 8076: RPCError */;
|
|
({}).errorCode = RPCErrors.INVALID_EVENT;
|
|
value = 'Invalid event: ' + evt;
|
|
value = new defaultImport();
|
|
throw value;
|
|
}
|
|
server.removeSubscription(socket, evt, args);
|
|
return {evt: evt};
|
|
}
|
|
|
|
function* _fun99660() { // fn#99660, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13239:230, offset: 0x021d06cd, size: 682 bytes, params: 1, frame: 25
|
|
var environment;
|
|
var object2;
|
|
var value7;
|
|
var track;
|
|
var RPC_SUBSCRIPTION_REQUESTED;
|
|
var value9;
|
|
var validate;
|
|
var value11;
|
|
var handler;
|
|
var Promise;
|
|
var promise;
|
|
var value14;
|
|
var value15;
|
|
if (false) {
|
|
return undefined;
|
|
}
|
|
var env0_0;
|
|
var env0_1;
|
|
value = environment.__proto__;
|
|
const property = require.events[dependencyMap];
|
|
if (property == null) {
|
|
value14 = environment.__proto__.__proto__;
|
|
value15 = env2_1(env2_2[2]);
|
|
value = 'Invalid event: ' + dependencyMap;
|
|
value = new value15({errorCode: env2_5.INVALID_EVENT}, value);
|
|
throw value;
|
|
}
|
|
const value5 = env2_1(env2_2[3])(importDefault.authorization.scopes, property.scope);
|
|
let binding = env2_1;
|
|
const binding2 = env2_2;
|
|
if (value5) {
|
|
value7 = binding(binding2[4]);
|
|
track = value7.track;
|
|
RPC_SUBSCRIPTION_REQUESTED = env2_4.RPC_SUBSCRIPTION_REQUESTED;
|
|
object2 = {};
|
|
object2.event = dependencyMap;
|
|
object2.scope = typeof property.scope === 'object' ? global.JSON.stringify(property.scope) : property.scope;
|
|
object2.application_id = importDefault.application.id;
|
|
object2.socket_scope = importDefault.authorization.scopes.toString();
|
|
Reflect.apply(track, value7, [RPC_SUBSCRIPTION_REQUESTED, object2]);
|
|
if (property.validation == null) {
|
|
handler = property.handler;
|
|
binding = env1_3;
|
|
env0_0 = Reflect.apply(handler, property, [{args: binding, socket: importDefault}]);
|
|
env0_1 = env2_0(env2_2[5]).getInitialSubscriptionPayload(importDefault, dependencyMap, binding);
|
|
Promise = global.Promise;
|
|
value = Object.create(Promise.prototype, {constructor: {value: Promise}});
|
|
promise = new Promise(function(a0) {
|
|
global.setImmediate(_fun99662);
|
|
a0({evt: dependencyMap});
|
|
});
|
|
return promise instanceof Object ? promise : value;
|
|
}
|
|
yield require.getJoi();
|
|
value9 = undefined;
|
|
if (false) {
|
|
return value9;
|
|
}
|
|
validate = value9.validate;
|
|
binding = env1_3;
|
|
value11 = property.validation(value9);
|
|
object2 = {convert: false};
|
|
if (Reflect.apply(validate, value9, [binding, value11, object2]).error != null) {
|
|
value = env2_1(env2_2[2]);
|
|
value = new value({errorCode: env2_5.INVALID_PAYLOAD}, 'Invalid subscription parameters provided');
|
|
throw value;
|
|
}
|
|
handler = property.handler;
|
|
binding = env1_3;
|
|
env0_0 = Reflect.apply(handler, property, [{args: binding, socket: importDefault}]);
|
|
env0_1 = env2_0(env2_2[5]).getInitialSubscriptionPayload(importDefault, dependencyMap, binding);
|
|
Promise = global.Promise;
|
|
value = Object.create(Promise.prototype, {constructor: {value: Promise}});
|
|
promise = new Promise(_fun99661);
|
|
return promise instanceof Object ? promise : value;
|
|
}
|
|
value = binding(binding2[2]);
|
|
const INVALID_PERMISSIONS = env2_5.INVALID_PERMISSIONS;
|
|
value = new value({errorCode: INVALID_PERMISSIONS}, 'Not authenticated or invalid scope');
|
|
throw value;
|
|
}
|
|
|
|
function _fun99661(a0) { // fn#99661, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13239:971, offset: 0x021d0977, size: 48 bytes, params: 2, frame: 11
|
|
global.setImmediate(_fun99662);
|
|
a0({evt: dependencyMap});
|
|
}
|
|
|
|
function _fun99662() { // fn#99662, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13239:989, offset: 0x021d09a7, size: 87 bytes, params: 1, frame: 19
|
|
require.addSubscription(importDefault, dependencyMap, env3_3, env1_0);
|
|
if (env1_1 != null) {
|
|
require.dispatchToSubscriptions(dependencyMap, function(a0) {
|
|
return a0.socket.id === importDefault.id;
|
|
}, env1_1);
|
|
}
|
|
}
|
|
|