edge-book 0.18.2 → 0.18.3
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/edge-book.js +15 -0
- package/package.json +1 -1
package/dist/edge-book.js
CHANGED
|
@@ -2597,6 +2597,21 @@ var NOTIFY_POLICIES = {
|
|
|
2597
2597
|
dedup_key: env.message_id
|
|
2598
2598
|
};
|
|
2599
2599
|
},
|
|
2600
|
+
post_publish: async (env, store) => {
|
|
2601
|
+
const post = env.body.post;
|
|
2602
|
+
if (!post) return null;
|
|
2603
|
+
const name = await peerName(store, env.from_agent_id) || env.from_agent_id;
|
|
2604
|
+
const postType = typeof post.post_type === "string" ? post.post_type : "post";
|
|
2605
|
+
const raw = typeof post.body === "string" ? post.body : typeof post.text === "string" ? post.text : post.body != null ? JSON.stringify(post.body) : "";
|
|
2606
|
+
const preview = raw.length > 280 ? `${raw.slice(0, 279)}\u2026` : raw;
|
|
2607
|
+
return {
|
|
2608
|
+
kind: "post_publish",
|
|
2609
|
+
from_id: env.from_agent_id,
|
|
2610
|
+
from_name: await peerName(store, env.from_agent_id),
|
|
2611
|
+
message: preview ? `${name} (${postType}): ${preview}` : `${name} sent a ${postType}.`,
|
|
2612
|
+
dedup_key: env.message_id
|
|
2613
|
+
};
|
|
2614
|
+
},
|
|
2600
2615
|
object_share: async (env, store) => {
|
|
2601
2616
|
const body = env.body;
|
|
2602
2617
|
const name = await peerName(store, env.from_agent_id) || env.from_agent_id;
|