@fileverse/api 0.0.19 → 0.0.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/index.js.map +1 -1
- package/dist/cloudflare.js +12 -18
- package/dist/cloudflare.js.map +1 -1
- package/dist/commands/index.js.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/worker.js.map +1 -1
- package/package.json +1 -1
package/dist/cloudflare.js
CHANGED
|
@@ -3038,44 +3038,38 @@ var init_eventProcessor = __esm({
|
|
|
3038
3038
|
if (!file2) throw new Error(`File ${fileId} not found`);
|
|
3039
3039
|
if (file2.isDeleted === 1) {
|
|
3040
3040
|
logger.info(`File ${fileId} is deleted, skipping create submit`);
|
|
3041
|
-
return;
|
|
3041
|
+
return null;
|
|
3042
3042
|
}
|
|
3043
3043
|
console.log("Submitting new file op");
|
|
3044
3044
|
const result = await handleNewFileOp(fileId);
|
|
3045
3045
|
console.log("New file op submitted");
|
|
3046
|
-
await EventsModel.setEventPendingOp(event._id, result.userOpHash, {
|
|
3047
|
-
metadata: result.metadata
|
|
3048
|
-
});
|
|
3049
3046
|
logger.info(`File ${file2.ddocId} create op submitted (hash: ${result.userOpHash})`);
|
|
3050
|
-
|
|
3047
|
+
return { userOpHash: result.userOpHash, pendingPayload: { metadata: result.metadata } };
|
|
3051
3048
|
}
|
|
3052
3049
|
case "update": {
|
|
3053
3050
|
const file2 = await FilesModel.findByIdExcludingDeleted(fileId);
|
|
3054
|
-
if (!file2) return;
|
|
3055
|
-
if (file2.localVersion <= file2.onchainVersion) return;
|
|
3051
|
+
if (!file2) return null;
|
|
3052
|
+
if (file2.localVersion <= file2.onchainVersion) return null;
|
|
3056
3053
|
const result = await submitUpdateFileOp(fileId);
|
|
3057
|
-
await EventsModel.setEventPendingOp(event._id, result.userOpHash, {
|
|
3058
|
-
metadata: result.metadata,
|
|
3059
|
-
localVersion: file2.localVersion
|
|
3060
|
-
});
|
|
3061
3054
|
logger.info(`File ${file2.ddocId} update op submitted (hash: ${result.userOpHash})`);
|
|
3062
|
-
|
|
3055
|
+
return {
|
|
3056
|
+
userOpHash: result.userOpHash,
|
|
3057
|
+
pendingPayload: { metadata: result.metadata, localVersion: file2.localVersion }
|
|
3058
|
+
};
|
|
3063
3059
|
}
|
|
3064
3060
|
case "delete": {
|
|
3065
3061
|
const file2 = await FilesModel.findByIdIncludingDeleted(fileId);
|
|
3066
|
-
if (!file2) return;
|
|
3062
|
+
if (!file2) return null;
|
|
3067
3063
|
if (file2.isDeleted === 1 && file2.syncStatus === "synced") {
|
|
3068
3064
|
logger.info(`File ${fileId} deletion already synced, skipping`);
|
|
3069
|
-
return;
|
|
3065
|
+
return null;
|
|
3070
3066
|
}
|
|
3071
3067
|
if (file2.onChainFileId === null || file2.onChainFileId === void 0) {
|
|
3072
|
-
|
|
3073
|
-
return;
|
|
3068
|
+
return { noOp: true, fileId, portalAddress: file2.portalAddress };
|
|
3074
3069
|
}
|
|
3075
3070
|
const result = await submitDeleteFileOp(fileId);
|
|
3076
|
-
await EventsModel.setEventPendingOp(event._id, result.userOpHash, {});
|
|
3077
3071
|
logger.info(`File ${file2.ddocId} delete op submitted (hash: ${result.userOpHash})`);
|
|
3078
|
-
|
|
3072
|
+
return { userOpHash: result.userOpHash, pendingPayload: {} };
|
|
3079
3073
|
}
|
|
3080
3074
|
default:
|
|
3081
3075
|
throw new Error(`Unknown event type: ${type}`);
|