Package Exports
- applesauce-factory
- applesauce-factory/blueprints
- applesauce-factory/blueprints/__tests__/comment.test
- applesauce-factory/blueprints/__tests__/follow-sets.test
- applesauce-factory/blueprints/__tests__/note.test
- applesauce-factory/blueprints/__tests__/picture-post.test
- applesauce-factory/blueprints/__tests__/reaction.test
- applesauce-factory/blueprints/__tests__/reply.test
- applesauce-factory/blueprints/__tests__/share.test
- applesauce-factory/blueprints/channels
- applesauce-factory/blueprints/comment
- applesauce-factory/blueprints/delete
- applesauce-factory/blueprints/file-metadata
- applesauce-factory/blueprints/follow-sets
- 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/reaction
- applesauce-factory/blueprints/reply
- applesauce-factory/blueprints/share
- applesauce-factory/event-factory
- applesauce-factory/helpers
- applesauce-factory/helpers/__tests__/comment.test
- applesauce-factory/helpers/__tests__/common-tags.test
- applesauce-factory/helpers/__tests__/pointer.test
- applesauce-factory/helpers/__tests__/quote.test
- applesauce-factory/helpers/__tests__/tags.test
- applesauce-factory/helpers/comment
- applesauce-factory/helpers/common-tags
- applesauce-factory/helpers/content
- applesauce-factory/helpers/file-metadata
- applesauce-factory/helpers/groups
- applesauce-factory/helpers/index
- applesauce-factory/helpers/pointer
- applesauce-factory/helpers/quote
- applesauce-factory/helpers/tag
- applesauce-factory/operations
- applesauce-factory/operations/event
- applesauce-factory/operations/event/__tests__/common.test
- applesauce-factory/operations/event/__tests__/content.test
- applesauce-factory/operations/event/__tests__/groups.test
- applesauce-factory/operations/event/__tests__/hashtags.test
- applesauce-factory/operations/event/__tests__/list.test
- applesauce-factory/operations/event/__tests__/note.test
- applesauce-factory/operations/event/channels
- applesauce-factory/operations/event/client
- applesauce-factory/operations/event/comment
- applesauce-factory/operations/event/common
- applesauce-factory/operations/event/content
- applesauce-factory/operations/event/delete
- applesauce-factory/operations/event/emojis
- applesauce-factory/operations/event/file-metadata
- applesauce-factory/operations/event/groups
- applesauce-factory/operations/event/hashtags
- applesauce-factory/operations/event/index
- applesauce-factory/operations/event/list
- applesauce-factory/operations/event/live-stream
- applesauce-factory/operations/event/media-attachment
- applesauce-factory/operations/event/note
- applesauce-factory/operations/event/picture-post
- applesauce-factory/operations/event/profile
- applesauce-factory/operations/event/quote
- applesauce-factory/operations/event/reaction
- applesauce-factory/operations/event/share
- applesauce-factory/operations/event/tags
- applesauce-factory/operations/event/zap
- applesauce-factory/operations/tag
- applesauce-factory/operations/tag/__tests__/common.test
- applesauce-factory/operations/tag/__tests__/groups.test
- applesauce-factory/operations/tag/__tests__/mailboxes.test
- applesauce-factory/operations/tag/__tests__/relay.test
- applesauce-factory/operations/tag/blossom
- applesauce-factory/operations/tag/bookmarks
- applesauce-factory/operations/tag/common
- applesauce-factory/operations/tag/groups
- applesauce-factory/operations/tag/index
- applesauce-factory/operations/tag/mailboxes
- applesauce-factory/operations/tag/relay
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"],
],
}