decord/source/modules/applications/ApplicationActionCreators.tsx

427 lines
13 KiB
TypeScript
Raw Normal View History

2026-08-24 06:08:38 +00:00
// Module ID: 7178
// Function ID: 7179
2026-07-20 16:05:17 +00:00
// Name: fetchApplication
2026-08-24 06:08:38 +00:00
// Dependencies: [5, 7179, 4483, 4482, 676, 709, 530, 589, 2]
2026-07-20 16:05:17 +00:00
// Exports: useApplicationWithLoggedOutContext
2026-08-24 06:08:38 +00:00
// Module 7178 (fetchApplication)
import closure_3 from "asyncGeneratorStep" /* 5 */;
import closure_4 from "set" /* 7179 */;
import closure_5 from "createExecutable" /* 4483 */;
import importDefaultResult from "addApplication" /* 4482 */;
import ME from "ME" /* 676 */;
import initialize from "initialize" /* 589 */;
2026-07-23 10:11:24 +00:00
const require = arg1;
2026-07-20 16:05:17 +00:00
function fetchApplication() {
2026-07-29 08:29:29 +00:00
const self = this;
const apply = _fetchApplication.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 _fetchApplication() {
const self = this;
const tmp = callback((arg0) => {
2026-08-24 06:08:38 +00:00
closure_0 = arg0;
closure_1 = arg1;
closure_2 = arg2;
c7 = 0;
c8 = 0;
c6 = 0;
2026-07-29 08:29:29 +00:00
const iter = (function*(arg0) {
if (c8 === 2) {
c8 = 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 {
c8 = 2;
if (0 === c7) {
if (arg0 === 1) {
c8 = 3;
throw arg1;
} else if (arg0 === 2) {
c8 = 3;
obj = { value: null, done: true };
obj[0] = arg1;
return obj;
} else {
2026-08-24 06:08:38 +00:00
closure_4 = tmp3;
closure_3 = tmp7;
2026-07-29 08:29:29 +00:00
let flag;
2026-08-24 06:08:38 +00:00
dependencyMap = undefined;
2026-07-29 08:29:29 +00:00
if (flag === undefined) {
flag = false;
}
2026-08-24 06:08:38 +00:00
closure_3 = undefined;
2026-07-29 08:29:29 +00:00
c7 = 1;
c8 = 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 === tmp7) {
if (arg0 === 1) {
c8 = 3;
throw arg1;
} else if (arg0 === 2) {
c8 = 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 {
const obj2 = { type: "APPLICATION_FETCH", applicationId: null };
obj2[1] = callback;
flag(709).dispatch(obj2);
2026-08-24 06:08:38 +00:00
c6 = 1;
2026-07-29 08:29:29 +00:00
const HTTP = callback(530).HTTP;
const obj3 = { url: null, query: null, oldFormErrors: true, signal: null, rejectWithError: null };
obj3[0] = c7.APPLICATION_PUBLIC(callback);
let obj4 = { with_guild: null };
obj4[0] = flag;
obj3[1] = obj4;
obj3[3] = dependencyMap;
const obj11 = flag(709);
obj3[4] = callback(530).rejectWithMigratedError();
c7 = 3;
c8 = 1;
const obj5 = { value: null, done: false };
obj5[0] = HTTP.get(obj3);
return obj5;
}
} else if (2 === tmp7) {
c6 = 0;
2026-08-24 06:08:38 +00:00
closure_4 = closure_5;
2026-07-29 08:29:29 +00:00
obj4 = flag(709);
const obj6 = { type: "APPLICATION_FETCH_FAIL", applicationId: null };
obj6[1] = callback;
obj4.dispatch(obj6);
2026-08-24 06:08:38 +00:00
throw closure_4;
2026-07-29 08:29:29 +00:00
} else if (arg0 === 1) {
c8 = 3;
throw arg1;
} else if (arg0 === 2) {
c6 = 0;
c8 = 3;
const obj7 = { value: null, done: true };
obj7[0] = arg1;
return obj7;
} else {
2026-08-24 06:08:38 +00:00
closure_3 = arg1;
2026-07-29 08:29:29 +00:00
obj = flag(709);
const obj8 = { type: "APPLICATION_FETCH_SUCCESS", application: null, isHydrated: true };
2026-08-24 06:08:38 +00:00
obj8[1] = closure_3.body;
2026-07-29 08:29:29 +00:00
obj.dispatch(obj8);
c6 = 0;
c8 = 3;
const obj9 = { value: null, done: true };
2026-08-24 06:08:38 +00:00
obj9[0] = closure_3.body;
2026-07-29 08:29:29 +00:00
return obj9;
}
} catch (tmp26) {
2026-08-24 06:08:38 +00:00
closure_5 = tmp26;
2026-07-29 08:29:29 +00:00
if (tmp4 === c6) {
c8 = tmp2;
throw tmp26;
} else {
c7 = tmp;
}
}
}
})();
iter.next();
return iter;
});
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-08-24 06:08:38 +00:00
({ Endpoints: error, NOOP: closure_8 } = ME);
2026-07-20 16:05:17 +00:00
let obj = {
createApplication(arg0) {
2026-08-24 06:08:38 +00:00
({ name: require, guildId: importDefault, type: dependencyMap, teamId: closure_3 } = arg0);
2026-07-29 08:29:29 +00:00
return callback(function*() {
2026-08-24 06:08:38 +00:00
closure_1 = tmp2;
2026-08-04 21:03:28 +00:00
let body = tmp5;
2026-08-24 06:08:38 +00:00
const HTTP = closure_1_0(530).HTTP;
obj1 = { url: null, body: null, rejectWithError: null };
obj1[0] = closure_1_7.APPLICATIONS;
2026-08-04 21:03:28 +00:00
const obj2 = { name: null, type: null, guild_id: null, team_id: null };
2026-08-24 06:08:38 +00:00
obj2[0] = closure_1_0;
2026-08-04 21:03:28 +00:00
obj2[1] = dependencyMap;
2026-08-24 06:08:38 +00:00
obj2[2] = closure_1_1;
2026-08-04 21:03:28 +00:00
obj2[3] = c3;
obj1[1] = obj2;
2026-08-24 06:08:38 +00:00
obj1[2] = closure_1_0(530).rejectWithMigratedError();
2026-08-04 21:03:28 +00:00
yield HTTP.post(obj1);
body = arg1.body;
let tmp8 = null != closure_1;
if (tmp8) {
tmp8 = null != dependencyMap;
}
if (tmp8) {
2026-08-24 06:08:38 +00:00
const obj = closure_1_1(709);
2026-08-04 21:03:28 +00:00
const obj5 = { type: "APPLICATION_FETCH_SUCCESS", application: null };
obj5[1] = body;
obj.dispatch(obj5);
2026-07-20 16:05:17 +00:00
}
2026-08-24 06:08:38 +00:00
return closure_1_0;
2026-07-20 16:05:17 +00:00
})();
},
2026-07-29 08:29:29 +00:00
getApplicationsForGuild(closure_0, arg1) {
2026-07-20 16:05:17 +00:00
let obj = arg1;
if (arg1 === undefined) {
obj = {};
}
2026-07-23 10:11:24 +00:00
const includeTeam = obj.includeTeam;
2026-08-24 06:08:38 +00:00
closure_2 = Object.assign(obj, Object.create(null));
2026-07-29 08:29:29 +00:00
return callback(function*() {
2026-08-24 06:08:38 +00:00
closure_1 = tmp2;
2026-08-04 21:03:28 +00:00
let body = tmp5;
2026-08-24 06:08:38 +00:00
const HTTP = closure_1_0(530).HTTP;
obj1 = { url: null, query: null, rejectWithError: null };
obj1[0] = closure_1_7.GUILD_APPLICATIONS(closure_1_0);
2026-08-04 21:03:28 +00:00
const obj2 = {};
const merged = Object.assign(dependencyMap);
2026-08-24 06:08:38 +00:00
obj2.include_team = closure_1_1;
2026-08-04 21:03:28 +00:00
obj1[1] = obj2;
2026-08-24 06:08:38 +00:00
obj1[2] = closure_1_0(530).rejectWithMigratedError();
2026-08-04 21:03:28 +00:00
yield HTTP.get(obj1);
body = arg1.body;
2026-08-24 06:08:38 +00:00
const obj = closure_1_1(709);
2026-08-04 21:03:28 +00:00
const obj5 = { type: "APPLICATIONS_FETCH_SUCCESS", applications: null };
obj5[1] = body;
obj.dispatch(obj5);
return body;
2026-07-20 16:05:17 +00:00
})();
},
transferApplication(arg0) {
2026-07-23 10:11:24 +00:00
({ applicationId: require, teamId: importDefault } = arg0);
2026-07-29 08:29:29 +00:00
return callback(function*() {
2026-08-24 06:08:38 +00:00
closure_1 = tmp2;
2026-08-04 21:03:28 +00:00
let body = tmp5;
2026-08-24 06:08:38 +00:00
const HTTP = closure_1_0(530).HTTP;
obj1 = { url: null, body: null, rejectWithError: null };
obj1[0] = closure_1_7.APPLICATION_OWNER_TRANSFER(closure_1_0);
2026-08-04 21:03:28 +00:00
const obj2 = { team_id: null };
2026-08-24 06:08:38 +00:00
obj2[0] = closure_1_1;
2026-08-04 21:03:28 +00:00
obj1[1] = obj2;
2026-08-24 06:08:38 +00:00
obj1[2] = closure_1_0(530).rejectWithMigratedError();
2026-08-04 21:03:28 +00:00
yield HTTP.post(obj1);
body = arg1.body;
2026-08-24 06:08:38 +00:00
const obj = closure_1_1(709);
2026-08-04 21:03:28 +00:00
const obj5 = { type: "APPLICATION_FETCH_SUCCESS", application: null };
obj5[1] = body;
obj.dispatch(obj5);
return body;
2026-07-20 16:05:17 +00:00
})();
},
fetchApplications(arg0) {
2026-08-24 06:08:38 +00:00
closure_0 = arg0;
2026-07-29 08:29:29 +00:00
let flag = arg1;
2026-07-20 16:05:17 +00:00
if (arg1 === undefined) {
flag = true;
}
2026-07-29 08:29:29 +00:00
return callback(function*() {
2026-08-24 06:08:38 +00:00
if (c5 === 2) {
c5 = 3;
2026-07-29 08:29:29 +00:00
HermesBuiltin.throwTypeError();
} else if (tmp7 === 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 {
2026-08-24 06:08:38 +00:00
c5 = 2;
2026-07-29 08:29:29 +00:00
if (0 === c4) {
if (arg0 === 1) {
2026-08-24 06:08:38 +00:00
c5 = 3;
2026-07-29 08:29:29 +00:00
throw arg1;
} else if (arg0 === 2) {
2026-08-24 06:08:38 +00:00
c5 = 3;
2026-07-29 08:29:29 +00:00
obj = { value: null, done: true };
obj[0] = arg1;
return obj;
} else {
2026-08-24 06:08:38 +00:00
closure_1 = tmp3;
2026-07-29 08:29:29 +00:00
let found = tmp5;
closure_1 = undefined;
let body;
2026-08-24 06:08:38 +00:00
c3 = undefined;
2026-07-29 08:29:29 +00:00
c4 = undefined;
2026-08-24 06:08:38 +00:00
found = closure_1_0;
let arr = closure_1_0;
if (!closure_1_1) {
2026-07-29 08:29:29 +00:00
found = arr2.filter((id) => {
const tmp = null != application.getApplication(id) && application.isHydrated(id);
let tmp2 = !tmp;
if (!tmp) {
tmp2 = !obj.isFetchingApplication(id);
}
if (tmp2) {
tmp2 = !obj.didFetchingApplicationFail(id);
}
if (tmp2) {
tmp2 = id.length > 0;
}
return tmp2;
});
arr = found;
}
if (arr.length > 0) {
2026-08-24 06:08:38 +00:00
let obj3 = closure_1_1(closure_1_2[5]);
obj1 = { type: "APPLICATIONS_FETCH", applicationIds: null };
2026-07-29 08:29:29 +00:00
obj1[1] = arr;
obj3.dispatch(obj1);
c3 = 1;
2026-08-24 06:08:38 +00:00
const HTTP = closure_1_0(closure_1_2[6]).HTTP;
2026-07-29 08:29:29 +00:00
const obj2 = { url: null, query: null, oldFormErrors: true, rejectWithError: null };
2026-08-24 06:08:38 +00:00
obj2[0] = closure_1_7.APPLICATIONS_PUBLIC;
2026-07-29 08:29:29 +00:00
const _URLSearchParams = URLSearchParams;
const str = new URLSearchParams(arr.map((arg0) => {
const items = ["application_ids", arg0];
return items;
}));
obj2[1] = str.toString();
2026-08-24 06:08:38 +00:00
obj2[3] = closure_1_0(closure_1_2[6]).rejectWithMigratedError();
2026-07-29 08:29:29 +00:00
c4 = 2;
2026-08-24 06:08:38 +00:00
c5 = 1;
2026-07-29 08:29:29 +00:00
obj3 = { value: null, done: false };
obj3[0] = HTTP.get(obj2);
return obj3;
} else {
2026-08-24 06:08:38 +00:00
c5 = 3;
2026-07-29 08:29:29 +00:00
}
2026-08-24 06:08:38 +00:00
arr2 = closure_1_0;
2026-07-29 08:29:29 +00:00
}
} else if (1 === tmp8) {
c3 = 0;
2026-08-24 06:08:38 +00:00
const status = body;
2026-07-29 08:29:29 +00:00
if (429 !== status.status) {
2026-08-24 06:08:38 +00:00
obj1 = closure_1_1(closure_1_2[5]);
2026-07-29 08:29:29 +00:00
const obj4 = { type: "APPLICATIONS_FETCH_FAIL", applicationIds: null };
obj4[1] = found;
obj1.dispatch(obj4);
}
throw status;
} else if (arg0 === 1) {
2026-08-24 06:08:38 +00:00
c5 = 3;
2026-07-29 08:29:29 +00:00
throw arg1;
} else if (arg0 !== 2) {
closure_1 = arg1;
c3 = 0;
body = closure_1.body;
const _Set = Set;
const set = new Set(body.map((id) => id.id));
c3 = set;
c4 = found.filter((arg0) => !set.has(arg0));
const obj5 = { type: "APPLICATIONS_FETCH_SUCCESS", applications: null, unknownApplicationIds: null, isHydrated: true };
obj5[1] = closure_1.body;
obj5[2] = c4;
2026-08-24 06:08:38 +00:00
closure_1_1(closure_1_2[5]).dispatch(obj5);
const obj11 = closure_1_1(closure_1_2[5]);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
c3 = 0;
2026-08-24 06:08:38 +00:00
c5 = 3;
2026-07-29 08:29:29 +00:00
obj = { value: null, done: true };
obj[0] = arg1;
return obj;
} catch (tmp32) {
body = tmp32;
if (tmp4 === c3) {
2026-08-24 06:08:38 +00:00
c5 = tmp2;
2026-07-29 08:29:29 +00:00
throw tmp32;
} else {
c4 = tmp;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
}
2026-07-20 16:05:17 +00:00
}
})();
},
fetchApplication
};
obj = {
2026-07-23 10:11:24 +00:00
getQueryId: ME.QueryIds.APPLICATIONS,
2026-07-29 08:29:29 +00:00
get(id) {
2026-07-20 16:05:17 +00:00
let tmp = null;
2026-07-29 08:29:29 +00:00
if (null != id) {
2026-07-20 16:05:17 +00:00
tmp = null;
2026-07-29 08:29:29 +00:00
if (importDefaultResult.isHydrated(id)) {
let application = obj.getApplication(id);
if (application == null) {
application = null;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
tmp = application;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
obj = importDefaultResult;
2026-07-20 16:05:17 +00:00
}
return tmp;
},
load(arg0) {
if (null != arg0) {
let nextPromise = fetchApplication(arg0, false).then(closure_8);
const promise = fetchApplication(arg0, false);
} else {
nextPromise = Promise.resolve();
}
return nextPromise;
},
2026-07-29 08:29:29 +00:00
getIsLoading(id) {
let result = null != id;
2026-07-20 16:05:17 +00:00
if (result) {
2026-07-29 08:29:29 +00:00
result = importDefaultResult.isFetchingApplication(id);
2026-07-20 16:05:17 +00:00
}
return result;
}
};
2026-07-23 10:11:24 +00:00
const fetchStore = initialize.createFetchStore(importDefaultResult, obj);
2026-08-24 06:08:38 +00:00
let result = require("set").fileFinishedImporting("modules/applications/ApplicationActionCreators.tsx");
2026-07-20 16:05:17 +00:00
export default obj;
export { fetchApplication };
export const useApplication = fetchStore;
export const useApplicationWithLoggedOutContext = function useApplicationWithLoggedOutContext(arg0) {
2026-07-23 10:11:24 +00:00
const _require = arg0;
2026-07-29 08:29:29 +00:00
const tmp = fetchStore(arg0);
const data = tmp.data;
2026-08-24 06:08:38 +00:00
error = tmp.error;
const obj = {
app: _require(589).useStateFromStores(items, () => {
if (null == data) {
const application = closure_1_4.getApplication(closure_0);
if (null != application) {
return closure_1_5.createFromServer(application);
}
2026-07-20 16:05:17 +00:00
}
2026-08-24 06:08:38 +00:00
return data;
}, items1),
isLoading: tmp.isLoading,
error
};
items = [closure_4];
items1 = [arg0, data];
2026-07-20 16:05:17 +00:00
return obj;
};