package raisfast:plugin-wit; interface types { record post-input { title: string, content: string, slug: option, excerpt: option, category-id: option, tag-ids: option>, status: option, cover-image: option, } record post-output { id: string, title: string, slug: string, content: string, excerpt: option, status: string, created-by: string, updated-by: option, category-id: option, view-count: s64, created-at: string, updated-at: string, published-at: option, } record comment-input { content: string, nickname: option, email: option, parent-id: option, } record content-event { content-type: string, data: string, id: option, } } interface host-api { use types.{post-output}; log: func(level: string, msg: string); get-config: func(key: string) -> option; http-get: func(url: string) -> option; http-post: func(url: string, body: string) -> option; get-data: func(key: string) -> option; set-data: func(key: string, value: string) -> bool; get-post: func(slug: string) -> option; db-query: func(sql: string, params: option) -> string; db-execute: func(sql: string, params: option) -> string; db-begin: func() -> string; db-commit: func() -> string; db-rollback: func() -> string; vfs-read: func(path: string) -> option; vfs-write: func(path: string, content: string) -> bool; vfs-delete: func(path: string) -> bool; vfs-exists: func(path: string) -> bool; vfs-list: func(path: string) -> option; vfs-stat: func(path: string) -> option; emit-event: func(event-type: string, data: string) -> string; } interface plugin-hooks { use types.{post-input, post-output, comment-input, content-event}; on-post-creating: func(input: post-input) -> option; on-post-updating: func(input: post-input) -> option; on-comment-creating: func(input: comment-input) -> option; on-content-creating: func(input: content-event) -> option; on-content-updating: func(input: content-event) -> option; render-markdown: func(input: string) -> option; filter-html: func(input: string) -> option; on-post-created: func(output: post-output); on-post-updated: func(output: post-output); on-post-deleted: func(id: string); on-comment-created: func(input: comment-input); on-content-created: func(input: content-event); on-content-updated: func(input: content-event); on-content-deleted: func(content-type: string, id: string); on-login: func(user-id: string); on-cron-tick: func(payload: option); } world plugin-world { import host-api; export plugin-hooks; }