decord/source/modules/saved_messages/SavedMessagesActions.tsx

237 lines
7.3 KiB
TypeScript
Raw Normal View History

2026-08-24 06:08:38 +00:00
// Module ID: 10913
// Function ID: 10914
2026-07-20 16:05:17 +00:00
// Name: _upsertSavedMessage
2026-08-24 06:08:38 +00:00
// Dependencies: [5, 10889, 676, 530, 8528, 709, 4808, 2]
2026-07-31 08:44:05 +00:00
// Exports: deleteSavedMessage, fetchAndUpdateSavedMessages, upsertSavedMessage
2026-07-20 16:05:17 +00:00
2026-08-24 06:08:38 +00:00
// Module 10913 (_upsertSavedMessage)
import closure_3 from "asyncGeneratorStep" /* 5 */;
import closure_4 from "getTimeSafe" /* 10889 */;
import { Endpoints } from "ME" /* 676 */;
2026-07-22 07:54:56 +00:00
2026-07-23 10:11:24 +00:00
const require = arg1;
2026-07-20 16:05:17 +00:00
function _upsertSavedMessage() {
2026-07-29 08:29:29 +00:00
const self = this;
const tmp = callback((arg0) => {
2026-08-24 06:08:38 +00:00
closure_0 = arg0;
c3 = 0;
c4 = 0;
2026-07-29 08:29:29 +00:00
return (function*(arg0) {
2026-08-14 17:33:39 +00:00
const table = tmp2;
2026-08-24 06:08:38 +00:00
closure_1 = tmp5;
const HTTP = lib(closure_1_2[3]).HTTP;
obj1 = { url: null, body: null, rejectWithError: null };
obj1[0] = closure_1_5.PUT_SAVED_MESSAGE(lib.channelId, lib.messageId);
2026-08-14 17:33:39 +00:00
({ dueAt: obj8[0], source: obj8[1] } = lib);
obj1[1] = { due_at: null, source: null };
2026-08-24 06:08:38 +00:00
obj1[2] = lib(closure_1_2[3]).rejectWithMigratedError();
2026-08-14 17:33:39 +00:00
lib = yield HTTP.put(obj1);
const obj = lib(table[4]);
return obj.savedMessageCreateObjectToClient(lib.body);
2026-07-29 08:29:29 +00:00
})();
});
2026-08-24 06:08:38 +00:00
closure_6 = 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
}
function _deleteSavedMessage() {
2026-07-29 08:29:29 +00:00
const self = this;
const tmp = callback((arg0) => {
2026-08-24 06:08:38 +00:00
closure_0 = arg0;
c2 = 0;
c1 = 0;
2026-08-14 17:33:39 +00:00
return (function*(arg0) {
const HTTP = lib(530).HTTP;
2026-08-24 06:08:38 +00:00
obj1 = { url: null, rejectWithError: null };
obj1[0] = closure_1_5.DELETE_SAVED_MESSAGE(lib.channelId, lib.messageId);
2026-08-14 17:33:39 +00:00
obj1[1] = lib(530).rejectWithMigratedError();
yield HTTP.del(obj1);
return true;
2026-07-29 08:29:29 +00:00
})();
});
2026-08-24 06:08:38 +00:00
closure_7 = 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
}
function _fetchAndUpdateSavedMessages() {
2026-07-29 08:29:29 +00:00
const self = this;
const tmp = callback(function*() {
2026-08-14 17:33:39 +00:00
if (isStale === 2) {
isStale = 3;
2026-07-29 08:29:29 +00:00
HermesBuiltin.throwTypeError();
2026-08-14 17:33:39 +00:00
} else if (tmp6 === 3) {
2026-07-29 08:29:29 +00:00
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-14 17:33:39 +00:00
isStale = 2;
if (0 === c3) {
2026-07-29 08:29:29 +00:00
if (arg0 === 1) {
2026-08-14 17:33:39 +00:00
isStale = 3;
2026-07-29 08:29:29 +00:00
throw arg1;
} else if (arg0 === 2) {
2026-08-14 17:33:39 +00:00
isStale = 3;
2026-07-29 08:29:29 +00:00
obj = { value: null, done: true };
obj[0] = arg1;
return obj;
} else {
2026-08-14 17:33:39 +00:00
let callback = tmp3;
let body = tmp7;
body = undefined;
2026-07-29 08:29:29 +00:00
callback = undefined;
2026-08-14 17:33:39 +00:00
if (isStale.getIsStale()) {
2026-08-24 06:08:38 +00:00
dependencyMap = 1;
const HTTP = closure_1_0(530).HTTP;
obj1 = { url: null, rejectWithError: null };
obj1[0] = closure_1_5.GET_SAVED_MESSAGES;
let obj10 = closure_1_0(530);
2026-08-14 17:33:39 +00:00
obj1[1] = obj10.rejectWithMigratedError();
c3 = 4;
isStale = 1;
const obj2 = { value: null, done: false };
2026-07-29 08:29:29 +00:00
obj2[0] = HTTP.get(obj1);
return obj2;
} else {
2026-08-14 17:33:39 +00:00
isStale = 3;
2026-07-29 08:29:29 +00:00
const obj3 = { value: null, done: true };
obj3[0] = Promise.resolve();
return obj3;
}
}
2026-08-14 17:33:39 +00:00
} else if (1 === tmp7) {
dependencyMap = 0;
let obj5 = callback(709);
const obj4 = { type: "SAVED_MESSAGES_UPDATE", savedMessages: null };
obj4[1] = [];
c3 = 2;
isStale = 1;
obj5 = { value: null, done: false };
obj5[0] = obj5.dispatch(obj4);
return obj5;
} else if (2 === tmp7) {
2026-08-11 06:20:06 +00:00
if (arg0 === 1) {
2026-08-14 17:33:39 +00:00
isStale = 3;
2026-08-11 06:20:06 +00:00
throw arg1;
} else if (arg0 === 2) {
2026-08-14 17:33:39 +00:00
isStale = 3;
const obj6 = { value: null, done: true };
obj6[0] = arg1;
return obj6;
2026-07-29 08:29:29 +00:00
} else {
2026-08-14 17:33:39 +00:00
isStale = 3;
const obj7 = { value: null, done: true };
obj7[0] = undefined;
return obj7;
2026-08-11 06:20:06 +00:00
}
2026-08-14 17:33:39 +00:00
} else if (3 === tmp7) {
if (arg0 === 1) {
isStale = 3;
2026-08-11 06:20:06 +00:00
throw arg1;
} else if (arg0 === 2) {
2026-08-14 17:33:39 +00:00
isStale = 3;
const obj8 = { value: null, done: true };
obj8[0] = arg1;
return obj8;
} else {
isStale = 3;
2026-08-24 06:08:38 +00:00
return { value: "HermesInternal", done: null };
2026-07-29 08:29:29 +00:00
}
2026-08-14 17:33:39 +00:00
} else if (arg0 === 1) {
isStale = 3;
throw arg1;
} else if (arg0 === 2) {
dependencyMap = 0;
isStale = 3;
const obj9 = { value: null, done: true };
obj9[0] = arg1;
return obj9;
} else {
body = arg1;
dependencyMap = 0;
const results = body.body.results;
callback = results.map((message) => {
let messageRecord = null;
if (null != message.message) {
2026-08-24 06:08:38 +00:00
let obj = callback(4808);
2026-08-14 17:33:39 +00:00
messageRecord = obj.createMessageRecord(message.message);
}
2026-08-24 06:08:38 +00:00
obj = { message: messageRecord, saveData: callback(8528).savedMessageDataToClient(message.save_data) };
2026-08-14 17:33:39 +00:00
return obj;
});
obj10 = { type: "SAVED_MESSAGES_UPDATE", savedMessages: null };
obj10[1] = callback;
2026-07-29 08:29:29 +00:00
c3 = 3;
2026-08-14 17:33:39 +00:00
isStale = 1;
obj = { value: null, done: false };
obj[0] = callback(709).dispatch(obj10);
return obj;
}
} catch (tmp15) {
if (tmp4 === dependencyMap) {
isStale = tmp2;
throw tmp15;
} else {
c3 = tmp;
2026-07-29 08:29:29 +00:00
}
}
}
});
2026-08-24 06:08:38 +00:00
closure_8 = 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
const result = require("set").fileFinishedImporting("modules/saved_messages/SavedMessagesActions.tsx");
2026-07-20 16:05:17 +00:00
export const upsertSavedMessage = function upsertSavedMessage() {
2026-07-29 08:29:29 +00:00
const self = this;
const apply = _upsertSavedMessage.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
export const deleteSavedMessage = function deleteSavedMessage(closure_2) {
const self = this;
const apply = _deleteSavedMessage.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
};
export const fetchAndUpdateSavedMessages = function fetchAndUpdateSavedMessages() {
2026-07-29 08:29:29 +00:00
const self = this;
const apply = _fetchAndUpdateSavedMessages.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
};