Package Exports
- applesauce-factory
- applesauce-factory/blueprints
- applesauce-factory/blueprints/channels
- applesauce-factory/blueprints/comment
- applesauce-factory/blueprints/comment.test
- applesauce-factory/blueprints/delete
- applesauce-factory/blueprints/file-metadata
- applesauce-factory/blueprints/groups
- applesauce-factory/blueprints/index
- applesauce-factory/blueprints/live-stream
- applesauce-factory/blueprints/note
- applesauce-factory/blueprints/note.test
- applesauce-factory/blueprints/picture-post
- applesauce-factory/blueprints/picture-post.test
- applesauce-factory/blueprints/reaction
- applesauce-factory/blueprints/reaction.test
- applesauce-factory/blueprints/reply
- applesauce-factory/blueprints/reply.test
- applesauce-factory/blueprints/share
- applesauce-factory/blueprints/share.test
- applesauce-factory/event-factory
- applesauce-factory/helpers
- applesauce-factory/helpers/comment
- applesauce-factory/helpers/comment.test
- applesauce-factory/helpers/common-tags
- applesauce-factory/helpers/common-tags.test
- applesauce-factory/helpers/content
- applesauce-factory/helpers/file-metadata
- applesauce-factory/helpers/groups
- applesauce-factory/helpers/index
- applesauce-factory/helpers/pointer
- applesauce-factory/helpers/pointer.test
- applesauce-factory/helpers/quote
- applesauce-factory/helpers/quote.test
- applesauce-factory/helpers/reaction
- applesauce-factory/helpers/tag
- applesauce-factory/operations
- applesauce-factory/operations/channels
- applesauce-factory/operations/client
- applesauce-factory/operations/comment
- applesauce-factory/operations/common
- applesauce-factory/operations/common.test
- applesauce-factory/operations/content
- applesauce-factory/operations/content.test
- applesauce-factory/operations/delete
- applesauce-factory/operations/emojis
- applesauce-factory/operations/file-metadata
- applesauce-factory/operations/groups
- applesauce-factory/operations/groups.test
- applesauce-factory/operations/hashtags
- applesauce-factory/operations/hashtags.test
- applesauce-factory/operations/index
- applesauce-factory/operations/list/blossom
- applesauce-factory/operations/list/common
- applesauce-factory/operations/list/common.test
- applesauce-factory/operations/list/groups
- applesauce-factory/operations/list/groups.test
- applesauce-factory/operations/list/index
- applesauce-factory/operations/list/list
- applesauce-factory/operations/list/list.test
- applesauce-factory/operations/list/mailboxes
- applesauce-factory/operations/list/mailboxes.test
- applesauce-factory/operations/list/relay
- applesauce-factory/operations/list/relay.test
- applesauce-factory/operations/live-stream
- applesauce-factory/operations/media-attachment
- applesauce-factory/operations/note
- applesauce-factory/operations/picture-post
- applesauce-factory/operations/quote
- applesauce-factory/operations/share
- applesauce-factory/operations/tags
- applesauce-factory/operations/zap
Readme
applesauce-factory
applesauce event factory is a package for easily creating or modifying nostr events
Creating a short text note
import { EventFactory } from "applesauce-factory";
import { NoteBlueprint } from "applesauce-factory/blueprints";
const factory = new EventFactory({
// config options,
// see https://hzrd149.github.io/applesauce/typedoc/types/applesauce_factory.EventFactoryContext.html
});
const unsignedEvent = await factory.create(
NoteBlueprint,
"hello nostr:npub180cvv07tjdrrgpa0j7j7tmnyl2yr6yr7l8j4s3evf6u64th6gkwsyjh6w6 #introductions",
);
console.log(unsignedEvent);
{
kind: 1,
content: "hello nostr:npub180cvv07tjdrrgpa0j7j7tmnyl2yr6yr7l8j4s3evf6u64th6gkwsyjh6w6 #introductions",
created_at: 0,
tags: [['p', '3bf0c63fcb93463407af97a5e5ee64fa883d107ef9e558472c4eb9aaaefa459d'], ['t', 'introductions']]
}Creating a comment
import { EventFactory } from "applesauce-factory";
import { CommentBlueprint } from "applesauce-factory/blueprints";
const originalEvent = {id: 'caa65d8b3b11d887da7188f3fe75c33d7be80d3df8c46f241a275b9075888674', kind: 30023, ...}
const factory = new EventFactory();
const unsignedEvent = await factory.create(
CommentBlueprint,
"great article",
);
console.log(unsignedEvent);
{
kind: 1111,
content: "great article",
tags: [
["A", "30023:3bf0c63fcb93463407af97a5e5ee64fa883d107ef9e558472c4eb9aaaefa459d:ad84e3b3"],
[
"E",
"caa65d8b3b11d887da7188f3fe75c33d7be80d3df8c46f241a275b9075888674",
"",
"3bf0c63fcb93463407af97a5e5ee64fa883d107ef9e558472c4eb9aaaefa459d",
],
["K", "30023"],
["a", "30023:3bf0c63fcb93463407af97a5e5ee64fa883d107ef9e558472c4eb9aaaefa459d:ad84e3b3"],
[
"e",
"caa65d8b3b11d887da7188f3fe75c33d7be80d3df8c46f241a275b9075888674",
"",
"3bf0c63fcb93463407af97a5e5ee64fa883d107ef9e558472c4eb9aaaefa459d",
],
["k", "30023"],
["p", "3bf0c63fcb93463407af97a5e5ee64fa883d107ef9e558472c4eb9aaaefa459d"],
],
}