pub const WIT_CONTENT: &str = "package vtx:api@3.4.1;\n\ninterface sql {\n variant db-value {\n text(string),\n integer(s64),\n real(f64),\n null-val,\n }\n\n execute: func(\n statement: string,\n params: list<db-value>,\n ) -> result<u64, string>;\n\n query-json: func(\n statement: string,\n params: list<db-value>,\n ) -> result<string, string>;\n}\n\ninterface stream-io {\n resource buffer {\n size: func() -> u64;\n\n read: func(\n offset: u64,\n max-bytes: u64,\n ) -> list<u8>;\n\n write: func(\n data: list<u8>,\n ) -> u64;\n }\n\n open-file: func(\n uuid: string,\n ) -> result<buffer, string>;\n\n create-memory-buffer: func(\n data: list<u8>,\n ) -> buffer;\n}\n\ninterface auth-types {\n record user-context {\n user-id: string,\n username: string,\n groups: list<string>,\n metadata: string,\n }\n\n record current-user {\n user-id: string,\n username: string,\n groups: list<string>,\n }\n}\n\ninterface types {\n use stream-io.{buffer};\n use auth-types.{user-context};\n\n record http-request {\n method: string,\n path: string,\n query: string,\n }\n\n record http-response {\n status: u16,\n body: option<buffer>,\n }\n\n record manifest {\n id: string,\n name: string,\n version: string,\n description: string,\n entrypoint: string,\n }\n}\n\ninterface ffmpeg {\n use stream-io.{buffer};\n\n record transcode-params {\n profile: string,\n input-id: string,\n args: list<string>,\n }\n\n execute: func(\n params: transcode-params,\n ) -> result<buffer, string>;\n}\n\ninterface events {\n record event-context {\n user-id: option<string>,\n username: option<string>,\n request-id: option<string>,\n }\n\n record vtx-event {\n id: string,\n topic: string,\n source: string,\n payload: string,\n context: event-context,\n occurred-at: u64,\n }\n}\n\ninterface context {\n use auth-types.{current-user};\n\n get-current-user: func() -> option<current-user>;\n}\n\ninterface event-bus {\n publish-event: func(\n topic: string,\n payload: string,\n ) -> result<_, string>;\n}\n\nworld plugin {\n use types.{http-request, http-response, manifest};\n use auth-types.{user-context};\n use events.{vtx-event};\n\n import stream-io;\n import sql;\n import ffmpeg;\n import context;\n import event-bus;\n\n export handle: func(\n req: http-request,\n ) -> http-response;\n\n export handle-event: func(\n event: vtx-event,\n ) -> result<_, string>;\n\n export get-migrations: func() -> list<string>;\n\n export get-manifest: func() -> manifest;\n\n export get-resources: func() -> list<string>;\n\n export authenticate: func(\n headers: list<tuple<string, string>>,\n ) -> result<user-context, u16>;\n}\n";Expand description
The raw content of the WIT interface definition.