decord/source/modules/oauth2/AuthorizedAppsActionCreators.tsx

179 lines
5.6 KiB
TypeScript
Raw Normal View History

2026-08-24 06:08:38 +00:00
// Module ID: 7185
// Function ID: 7186
2026-07-29 08:29:29 +00:00
// Name: tokensToAppTokensMap
2026-08-24 06:08:38 +00:00
// Dependencies: [5, 5294, 676, 4263, 709, 530, 2]
2026-07-20 16:05:17 +00:00
2026-08-24 06:08:38 +00:00
// Module 7185 (tokensToAppTokensMap)
import dispatcherDefault from "dispatcher" /* 709 */;
import closure_3 from "asyncGeneratorStep" /* 5 */;
import closure_4 from "recomputeFromAppTokens" /* 5294 */;
import { FetchState } from "recomputeFromAppTokens" /* 5294 */;
import { Endpoints } from "ME" /* 676 */;
2026-07-23 10:11:24 +00:00
const require = arg1;
2026-07-20 16:05:17 +00:00
function tokensToAppTokensMap(arg0, arr) {
let mapped;
2026-07-29 08:29:29 +00:00
if (arr != null) {
2026-07-20 16:05:17 +00:00
mapped = arr.map((arg0) => {
const items = [arg0, null];
return items;
});
}
2026-07-29 08:29:29 +00:00
if (mapped == null) {
2026-07-20 16:05:17 +00:00
mapped = [];
}
const fromEntriesResult = Object.fromEntries(mapped);
2026-07-29 08:29:29 +00:00
const iter = arg0[Symbol.iterator]();
const nextResult = iter.next();
while (iter !== undefined) {
fromEntriesResult[nextResult.application.id] = nextResult;
continue;
2026-07-20 16:05:17 +00:00
}
return fromEntriesResult;
}
function fetchAuthorizedApps() {
2026-07-29 08:29:29 +00:00
const self = this;
const apply = _fetchAuthorizedApps.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
}
2026-07-29 08:29:29 +00:00
function _fetchAuthorizedApps() {
const self = this;
const tmp = callback((arg0) => {
2026-08-24 06:08:38 +00:00
closure_0 = arg0;
c2 = 0;
c1 = 0;
2026-07-29 08:29:29 +00:00
return (function*(arg0) {
if (c1 === 2) {
c1 = 3;
HermesBuiltin.throwTypeError();
} else if (tmp3 === 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 {
c1 = 2;
if (0 === table) {
if (arg0 === 1) {
c1 = 3;
throw arg1;
} else if (arg0 === 2) {
c1 = 3;
obj = { value: null, done: true };
obj[0] = arg1;
return obj;
} else {
const HTTP = callback(table[5]).HTTP;
2026-08-24 06:08:38 +00:00
obj1 = { url: null, oldFormErrors: true, rejectWithError: true, query: null };
obj1[0] = closure_1_6.OAUTH2_TOKENS;
2026-07-29 08:29:29 +00:00
const obj2 = { application_ids: null };
obj2[0] = callback;
obj1[3] = obj2;
const value = HTTP.get(obj1);
table = 1;
c1 = 1;
const obj3 = { value: null, done: false };
obj3[0] = value.then((body) => {
let obj = v3(709);
2026-08-24 06:08:38 +00:00
obj = { type: "USER_AUTHORIZED_APPS_UPDATE", isFullFetch: null == closure_0, tokens: closure_1_8(body.body, closure_0) };
2026-07-29 08:29:29 +00:00
return obj.dispatch(obj);
}, () => {
let request = v3(709);
if (null == closure_0) {
request = { type: "full" };
} else {
request = { type: "partial", applicationIds: null };
request[1] = tmp;
}
return request.dispatch({ type: "USER_AUTHORIZED_APPS_REQUEST_FAILED", request });
});
return obj3;
}
} else if (arg0 === 1) {
c1 = 3;
throw arg1;
} else if (arg0 === 2) {
c1 = 3;
obj = { value: null, done: true };
obj[0] = arg1;
return obj;
} else {
c1 = 3;
2026-08-24 06:08:38 +00:00
return { value: "HermesInternal", done: null };
2026-07-29 08:29:29 +00:00
}
} catch (tmp5) {
c1 = tmp;
throw tmp5;
}
}
})();
2026-07-20 16:05:17 +00:00
});
2026-08-24 06:08:38 +00:00
closure_10 = tmp;
2026-07-29 08:29:29 +00:00
const apply = tmp.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
}
2026-07-23 10:11:24 +00:00
let obj = {
2026-07-31 08:44:05 +00:00
predicate(arg0) {
return store.getFetchStateForApplication(arg0) !== FetchState.FETCHING;
2026-07-23 10:11:24 +00:00
},
onQueued(applicationIds) {
2026-08-24 06:08:38 +00:00
let request = dispatcherDefault;
2026-07-23 10:11:24 +00:00
request = { type: "partial", applicationIds };
return request.dispatch({ type: "USER_AUTHORIZED_APPS_REQUEST", request });
},
onCancelled(applicationIds) {
2026-08-24 06:08:38 +00:00
let obj = dispatcherDefault;
2026-07-23 10:11:24 +00:00
obj = { type: "USER_AUTHORIZED_APPS_REQUEST_CANCELLED", applicationIds };
return obj.dispatch(obj);
}
};
2026-07-29 08:29:29 +00:00
const batchInvocationManager = new require("start").BatchInvocationManager(fetchAuthorizedApps, obj);
2026-07-23 10:11:24 +00:00
obj = {
2026-07-20 16:05:17 +00:00
fetch(arg0) {
if (store.getFetchState() !== FetchState.FETCHING) {
if (null != arg0) {
2026-07-29 08:29:29 +00:00
batchInvocationManager.queue(arg0).catch((arg0) => {
if (!(arg0 instanceof callback(table[3]).BatchInvocationManagerResetError)) {
throw arg0;
}
});
const queueResult = batchInvocationManager.queue(arg0);
2026-07-20 16:05:17 +00:00
} else {
batchInvocationManager.reset();
2026-08-24 06:08:38 +00:00
let obj = dispatcherDefault;
2026-07-29 08:29:29 +00:00
obj = { type: "USER_AUTHORIZED_APPS_REQUEST", request: null };
obj[1] = { type: "full" };
2026-07-23 10:11:24 +00:00
obj.dispatch(obj);
2026-07-20 16:05:17 +00:00
fetchAuthorizedApps();
}
}
},
delete(arg0) {
2026-07-23 10:11:24 +00:00
const self = this;
2026-07-29 08:29:29 +00:00
const HTTP = self(530).HTTP;
2026-07-23 10:11:24 +00:00
const obj = { url: Endpoints.OAUTH2_TOKEN(arg0), oldFormErrors: true, rejectWithError: true };
2026-07-29 08:29:29 +00:00
HTTP.del({ url: Endpoints.OAUTH2_TOKEN(arg0), oldFormErrors: true, rejectWithError: true }).then(() => {
2026-07-20 16:05:17 +00:00
const response = self.fetch();
});
}
};
2026-08-24 06:08:38 +00:00
const result = require("set").fileFinishedImporting("modules/oauth2/AuthorizedAppsActionCreators.tsx");
2026-07-23 10:11:24 +00:00
export default obj;