File tree Expand file tree Collapse file tree 6 files changed +106
-0
lines changed
packages/spin-trigger-redis Expand file tree Collapse file tree 6 files changed +106
-0
lines changed Original file line number Diff line number Diff line change 1+ {
2+ "name" : " @spinframework/spin-trigger-redis" ,
3+ "version" : " 1.0.0" ,
4+ "description" : " " ,
5+ "main" : " dist/index.js" ,
6+ "types" : " dist/index.d.ts" ,
7+ "type" : " module" ,
8+ "scripts" : {
9+ "build" : " tsc"
10+ },
11+ "keywords" : [],
12+ "author" : " " ,
13+ "license" : " Apache-2.0" ,
14+ "devDependencies" : {
15+ "typescript" : " ^5.7.3"
16+ },
17+ "config" : {
18+ "wasiDep" : {
19+ "witDeps" : [
20+ {
21+ "witPath" : " ./wit" ,
22+ "package" : " fermyon:spin" ,
23+ "world" : " spin-trigger-redis"
24+ }
25+ ]
26+ }
27+ }
28+ }
Original file line number Diff line number Diff line change 1+ /**
2+ * Abstract class for handling Redis messages.
3+ */
4+ export abstract class RedisHandler {
5+ /**
6+ * Handles a Redis message.
7+ * @param msg - The message data as a Uint8Array.
8+ * @returns A Promise that resolves when the message has been handled.
9+ */
10+ abstract handleMessage ( msg : Uint8Array ) : Promise < void > ;
11+ }
Original file line number Diff line number Diff line change 1+ {
2+ "compilerOptions" : {
3+ "target" : " ES2020" ,
4+ "module" : " ES2020" ,
5+ "lib" : [
6+ " ES2020" ,
7+ " WebWorker"
8+ ],
9+ "moduleResolution" : " node" ,
10+ "declaration" : true ,
11+ "outDir" : " dist" ,
12+ "strict" : true ,
13+ "esModuleInterop" : true ,
14+ },
15+ "exclude" : [
16+ " node_modules" ,
17+ " dist"
18+ ]
19+ }
Original file line number Diff line number Diff line change 1+ interface redis-types {
2+ // General purpose error.
3+ enum error {
4+ success ,
5+ error ,
6+ }
7+
8+ /// The message payload.
9+ type payload = list <u8 >;
10+
11+ /// A parameter type for the general-purpose `execute` function.
12+ variant redis-parameter {
13+ int64 (s64 ),
14+ binary (payload )
15+ }
16+
17+ /// A return type for the general-purpose `execute` function.
18+ variant redis-result {
19+ nil ,
20+ status (string ),
21+ int64 (s64 ),
22+ binary (payload )
23+ }
24+ }
Original file line number Diff line number Diff line change 1+ package fermyon : spin ;
2+
3+ interface inbound-redis {
4+ use redis-types . {payload , error };
5+
6+ // The entrypoint for a Redis handler.
7+ handle-message : func (message : payload ) -> result <_ , error >;
8+ }
9+
10+ world spin-trigger-redis {
11+ export inbound-redis ;
12+ }
You can’t perform that action at this time.
0 commit comments