decord/source/modules/rpc/server/commands/providers.tsx

359 lines
13 KiB
TypeScript
Raw Normal View History

2026-08-24 06:08:38 +00:00
// Module ID: 13923
// Function ID: 13924
2026-07-20 16:05:17 +00:00
// Name: AM_HARMONY_PRD_APPLICATION_ID
2026-08-24 06:08:38 +00:00
// Dependencies: [5, 5226, 4281, 676, 4485, 505, 8792, 8794, 5102, 8789, 709, 1231, 9818, 5228, 2]
2026-07-23 10:11:24 +00:00
2026-08-24 06:08:38 +00:00
// Module 13923 (AM_HARMONY_PRD_APPLICATION_ID)
import createRpcJoiSchemaObjectDefault from "createRpcJoiSchemaObject" /* 8792 */;
import importDefaultResult from "asyncGeneratorStep" /* 5 */;
import closure_5 from "set" /* 5226 */;
import RPC_SCOPE_CONFIG from "RPC_SCOPE_CONFIG" /* 4281 */;
import ME from "ME" /* 676 */;
import items3 from "items3" /* 4485 */;
import sum from "sum" /* 505 */;
import set from "set" /* 2 */;
2026-07-20 16:05:17 +00:00
2026-07-23 10:11:24 +00:00
const require = arg1;
2026-07-29 08:29:29 +00:00
let c4 = importDefaultResult;
2026-07-23 10:11:24 +00:00
({ RPC_AUTHENTICATED_SCOPE, RPC_SCOPE_CONFIG } = RPC_SCOPE_CONFIG);
2026-08-24 06:08:38 +00:00
({ AnalyticsLocations: closure_6, ComponentActions: error, PlatformTypes: closure_8 } = ME);
2026-07-23 10:11:24 +00:00
({ AM_HARMONY_PRD_APPLICATION_ID, AM_HARMONY_STG_APPLICATION_ID } = items3);
2026-07-29 08:29:29 +00:00
({ RPCCommands, RPCErrors: c9 } = sum);
2026-07-20 16:05:17 +00:00
const items = [AM_HARMONY_PRD_APPLICATION_ID, AM_HARMONY_STG_APPLICATION_ID];
2026-07-23 10:11:24 +00:00
let set = new Set(items);
obj = { [RPCCommands.GET_PROVIDER_ACCESS_TOKEN]: obj };
2026-07-20 16:05:17 +00:00
obj = {
scope: { [RPC_SCOPE_CONFIG.ANY]: items1 },
validation(string) {
2026-08-24 06:08:38 +00:00
let obj = createRpcJoiSchemaObjectDefault(string);
2026-07-29 08:29:29 +00:00
obj = { provider: null, connection_redirect: null };
2026-07-20 16:05:17 +00:00
const requiredResult = obj.required();
2026-07-29 08:29:29 +00:00
obj[0] = string.string().required();
obj[1] = string.string();
2026-07-20 16:05:17 +00:00
return requiredResult.keys(obj);
},
handler(arg0) {
({ socket, args } = arg0);
const provider = args.provider;
2026-07-29 08:29:29 +00:00
let _require = provider;
2026-07-23 10:11:24 +00:00
const connection_redirect = args.connection_redirect;
2026-08-24 06:08:38 +00:00
dependencyMap = undefined;
let obj = _require(8794);
2026-07-20 16:05:17 +00:00
const result = obj.validatePostMessageTransport(socket.transport);
2026-08-24 06:08:38 +00:00
obj1 = _require(8794);
2026-07-20 16:05:17 +00:00
const validateApplicationResult = obj1.validateApplication(socket.application);
2026-08-24 06:08:38 +00:00
const value = connection_redirect(5102).get(provider);
2026-07-29 08:29:29 +00:00
dependencyMap = value;
2026-07-20 16:05:17 +00:00
if (null == value) {
2026-07-29 08:29:29 +00:00
obj = { errorCode: null };
obj[0] = constants2.INVALID_PROVIDER;
2026-07-20 16:05:17 +00:00
const _HermesInternal = HermesInternal;
2026-08-24 06:08:38 +00:00
let tmp4Result = tmp4(8789);
2026-07-29 08:29:29 +00:00
tmp4Result = new tmp4Result(obj, "Platform not found for provider \"" + provider + "\"");
throw tmp4Result;
2026-07-20 16:05:17 +00:00
} else if (provider !== constants.AMAZON_MUSIC) {
2026-07-29 08:29:29 +00:00
obj = { errorCode: null };
obj[0] = constants2.UNAUTHORIZED_FOR_APPLICATION;
2026-08-24 06:08:38 +00:00
const tmp22 = new tmp4(8789)(obj, "Command not available for this application");
2026-07-29 08:29:29 +00:00
throw tmp22;
2026-07-20 16:05:17 +00:00
} else if (set.has(validateApplicationResult)) {
2026-07-29 08:29:29 +00:00
_require = undefined;
_require = importDefaultResult((arg0, arg1) => {
2026-08-24 06:08:38 +00:00
closure_0 = arg0;
closure_1 = arg1;
c6 = 0;
c7 = 0;
c5 = 0;
2026-07-29 08:29:29 +00:00
return (function*(arg0, arg1) {
if (c7 === 2) {
c7 = 3;
HermesBuiltin.throwTypeError();
} else if (tmp6 === 3) {
if (arg0 === 1) {
throw arg1;
} else if (arg0 === 2) {
let obj = { value: null, done: true };
obj[0] = arg1;
return obj;
} else {
2026-08-24 06:08:38 +00:00
return { value: "HermesInternal", done: null };
2026-07-29 08:29:29 +00:00
}
} else {
try {
c7 = 2;
if (0 === c6) {
if (arg0 === 1) {
c7 = 3;
throw arg1;
} else if (arg0 === 2) {
c7 = 3;
obj = { value: null, done: true };
obj[0] = arg1;
return obj;
} else {
let handleConnectionsUpdate = tmp3;
2026-08-24 06:08:38 +00:00
closure_2 = tmp7;
2026-07-29 08:29:29 +00:00
closure_2 = undefined;
2026-08-24 06:08:38 +00:00
const account = closure_2_5.getAccount(null, callback);
2026-07-29 08:29:29 +00:00
if (null == account) {
handleConnectionsUpdate = function handleConnectionsUpdate(accounts) {
if (null != closure_2) {
accounts = accounts.accounts;
if (accounts == null) {
accounts = [];
}
const found = accounts.find((type) => type.type === type.type);
if (null != found) {
const obj = { access_token: null };
obj[0] = found.access_token;
callback(obj);
2026-08-24 06:08:38 +00:00
callback2(closure_2_2[10]).unsubscribe("USER_CONNECTIONS_UPDATE", handleConnectionsUpdate);
const ComponentDispatch = callback(closure_2_2[11]).ComponentDispatch;
2026-07-29 08:29:29 +00:00
ComponentDispatch.unsubscribe(constants.CONNECTIONS_CALLBACK_ERROR, handleConnectionsCallbackError);
2026-08-24 06:08:38 +00:00
const obj2 = callback2(closure_2_2[10]);
2026-07-29 08:29:29 +00:00
}
}
};
function handleConnectionsCallbackError() {
2026-08-24 06:08:38 +00:00
let tmp = callback2(closure_2_2[9]);
tmp = new tmp({ errorCode: closure_2_9.OAUTH2_ERROR }, "OAuth2 setup for \"" + callback + "\" failed");
2026-07-29 08:29:29 +00:00
callback2(tmp);
2026-08-24 06:08:38 +00:00
callback2(closure_2_2[10]).unsubscribe("USER_CONNECTIONS_UPDATE", handleConnectionsUpdate);
const ComponentDispatch = callback(closure_2_2[11]).ComponentDispatch;
2026-07-29 08:29:29 +00:00
ComponentDispatch.unsubscribe(constants.CONNECTIONS_CALLBACK_ERROR, handleConnectionsCallbackError);
}
const subscription = connection_redirect(709).subscribe("USER_CONNECTIONS_UPDATE", handleConnectionsUpdate);
let ComponentDispatch = callback(1231).ComponentDispatch;
2026-08-24 06:08:38 +00:00
const subscription1 = ComponentDispatch.subscribe(closure_2_7.CONNECTIONS_CALLBACK_ERROR, handleConnectionsCallbackError);
obj1 = { platformType: null, location: null, successRedirect: null };
obj1[0] = closure_1_2.type;
obj1[1] = closure_2_6.ACTIVITY_RPC;
2026-07-29 08:29:29 +00:00
obj1[2] = callback2;
2026-08-24 06:08:38 +00:00
connection_redirect(9818)(obj1);
2026-07-29 08:29:29 +00:00
const obj6 = connection_redirect(709);
} else {
2026-08-24 06:08:38 +00:00
c5 = 1;
let obj3 = connection_redirect(5228);
2026-07-29 08:29:29 +00:00
c6 = 2;
c7 = 1;
let obj2 = { value: null, done: false };
2026-08-24 06:08:38 +00:00
obj2[0] = obj3.refreshAccessToken(closure_1_2.type, account.id);
2026-07-29 08:29:29 +00:00
return obj2;
}
}
} else {
if (1 === tmp7) {
c5 = 0;
callback2(handleConnectionsCallbackError);
} else if (arg0 === 1) {
c7 = 3;
throw arg1;
} else if (arg0 === 2) {
c5 = 0;
c7 = 3;
obj3 = { value: null, done: true };
obj3[0] = arg1;
return obj3;
} else {
closure_2 = arg1;
if (null != closure_2) {
obj = { access_token: null };
obj[0] = closure_2;
callback(obj);
c5 = 0;
}
}
const obj4 = { errorCode: null };
2026-08-24 06:08:38 +00:00
obj4[0] = closure_2_9.OAUTH2_ERROR;
const tmp21 = new connection_redirect(8789)(obj4, "Refreshing access token did not return a new access token");
throw tmp21;
2026-07-29 08:29:29 +00:00
}
c7 = 3;
2026-08-24 06:08:38 +00:00
} catch (tmp44) {
handleConnectionsCallbackError = tmp44;
2026-07-29 08:29:29 +00:00
if (tmp4 === c5) {
c7 = tmp2;
2026-08-24 06:08:38 +00:00
throw tmp44;
2026-07-29 08:29:29 +00:00
} else {
c6 = tmp;
}
}
}
})();
});
const promise = new Promise(function() {
const self = this;
const apply = closure_0.apply;
if (typeof apply === "unknown") {
let applyArgumentsResult = HermesBuiltin.applyArguments(self);
} else {
applyArgumentsResult = apply(self, arguments);
}
return applyArgumentsResult;
});
2026-07-20 16:05:17 +00:00
return promise;
} else {
2026-07-29 08:29:29 +00:00
obj1 = { errorCode: null };
obj1[0] = constants2.UNAUTHORIZED_FOR_APPLICATION;
2026-08-24 06:08:38 +00:00
const tmp10 = new tmp4(8789)(obj1, "Command not available for this application");
2026-07-29 08:29:29 +00:00
throw tmp10;
2026-07-20 16:05:17 +00:00
}
2026-08-24 06:08:38 +00:00
let obj3 = connection_redirect(5102);
2026-07-20 16:05:17 +00:00
}
};
2026-07-23 10:11:24 +00:00
items1 = [RPC_AUTHENTICATED_SCOPE];
2026-07-29 08:29:29 +00:00
obj = {
scope: { [RPC_SCOPE_CONFIG.ANY]: items2 },
validation(string) {
2026-08-24 06:08:38 +00:00
let obj = createRpcJoiSchemaObjectDefault(string);
2026-07-29 08:29:29 +00:00
obj = { provider: null };
const requiredResult = obj.required();
obj[0] = string.string().required();
return requiredResult.keys(obj);
},
handler: null
2026-07-23 10:11:24 +00:00
};
2026-07-29 08:29:29 +00:00
items2 = [RPC_AUTHENTICATED_SCOPE];
let closure_3 = importDefaultResult((arg0) => {
2026-08-24 06:08:38 +00:00
closure_0 = arg0;
c3 = 0;
c4 = 0;
2026-07-29 08:29:29 +00:00
const iter = (function*(arg0) {
if (id === 2) {
id = 3;
HermesBuiltin.throwTypeError();
} else if (tmp4 === 3) {
if (arg0 === 1) {
throw arg1;
} else if (arg0 === 2) {
let obj = { value: null, done: true };
obj[0] = arg1;
return obj;
} else {
2026-08-24 06:08:38 +00:00
return { value: "HermesInternal", done: null };
2026-07-29 08:29:29 +00:00
}
} else {
try {
id = 2;
if (0 === type) {
if (arg0 === 1) {
id = 3;
throw arg1;
} else if (arg0 === 2) {
id = 3;
obj = { value: null, done: true };
obj[0] = arg1;
return obj;
} else {
2026-08-24 06:08:38 +00:00
dependencyMap = tmp5;
2026-07-29 08:29:29 +00:00
let provider = tmp2;
let socket;
provider = undefined;
socket = socket.socket;
provider = socket.args.provider;
dependencyMap = undefined;
type = undefined;
id = undefined;
let account;
type = 1;
id = 1;
2026-08-12 06:57:52 +00:00
return { value: "ct", done: true };
2026-07-29 08:29:29 +00:00
}
} else if (1 === tmp5) {
if (arg0 === 1) {
id = 3;
throw arg1;
} else if (arg0 === 2) {
id = 3;
2026-08-24 06:08:38 +00:00
obj1 = { value: null, done: true };
2026-07-29 08:29:29 +00:00
obj1[0] = arg1;
return obj1;
} else {
2026-08-24 06:08:38 +00:00
const result = socket(8794).validatePostMessageTransport(socket.transport);
const obj14 = socket(8794);
dependencyMap = socket(8794).validateApplication(socket.application);
const obj15 = socket(8794);
type = provider(5102).get(provider);
2026-07-29 08:29:29 +00:00
if (null == type) {
const obj2 = { errorCode: null };
obj2[0] = closure_9.INVALID_PROVIDER;
const _HermesInternal = HermesInternal;
2026-08-24 06:08:38 +00:00
let tmp59 = provider(8789);
2026-07-29 08:29:29 +00:00
tmp59 = new tmp59(obj2, "Platform not found for provider \"" + provider + "\"");
throw tmp59;
} else if (provider !== constants.AMAZON_MUSIC) {
const obj3 = { errorCode: null };
obj3[0] = closure_9.UNAUTHORIZED_FOR_APPLICATION;
2026-08-24 06:08:38 +00:00
const tmp53 = new provider(8789)(obj3, "Command not available for this application");
2026-07-29 08:29:29 +00:00
throw tmp53;
} else if (set.has(dependencyMap)) {
id = account.getAccount(null, provider);
if (null == id) {
const obj4 = { errorCode: null };
obj4[0] = closure_9.NO_CONNECTION_FOUND;
2026-08-24 06:08:38 +00:00
const tmp44 = new provider(8789)(obj4, "No connection found");
2026-07-29 08:29:29 +00:00
throw tmp44;
} else {
2026-08-24 06:08:38 +00:00
let obj5 = provider(5228);
2026-07-29 08:29:29 +00:00
type = 2;
id = 1;
obj5 = { value: null, done: false };
obj5[0] = obj5.refreshAccessToken(type.type, id.id);
return obj5;
}
} else {
const obj6 = { errorCode: null };
obj6[0] = closure_9.UNAUTHORIZED_FOR_APPLICATION;
2026-08-24 06:08:38 +00:00
const tmp24 = new provider(8789)(obj6, "Command not available for this application");
2026-07-29 08:29:29 +00:00
throw tmp24;
}
2026-08-24 06:08:38 +00:00
const obj16 = provider(5102);
2026-07-29 08:29:29 +00:00
}
} else if (arg0 === 1) {
id = 3;
throw arg1;
} else if (arg0 === 2) {
id = 3;
const obj7 = { value: null, done: true };
obj7[0] = arg1;
return obj7;
} else {
account = arg1;
if (null == account) {
const obj8 = { errorCode: null };
obj8[0] = closure_9.OAUTH2_ERROR;
2026-08-24 06:08:38 +00:00
const tmp15 = new provider(8789)(obj8, "Refreshing access token did not return a new access token");
2026-07-29 08:29:29 +00:00
throw tmp15;
} else {
obj = { access_token: null };
obj[0] = account;
id = 3;
const obj9 = { value: null, done: true };
obj9[0] = obj;
return obj9;
}
}
} catch (tmp69) {
id = tmp;
throw tmp69;
}
}
})();
iter.next();
return iter;
});
obj[2] = function() {
const self = this;
const apply = closure_3.apply;
if (typeof apply === "unknown") {
let applyArgumentsResult = HermesBuiltin.applyArguments(self);
} else {
applyArgumentsResult = apply(self, arguments);
}
return applyArgumentsResult;
2026-07-20 16:05:17 +00:00
};
obj[RPCCommands.MAYBE_GET_PROVIDER_ACCESS_TOKEN] = obj;
2026-07-23 10:11:24 +00:00
let result = set.fileFinishedImporting("modules/rpc/server/commands/providers.tsx");
2026-07-20 16:05:17 +00:00
export default obj;