@@ -9,85 +9,61 @@ import {
9
9
UpdatePersonaBundleSchema ,
10
10
XFetchRequestSchema
11
11
} from "@shared/schema/ipc" ;
12
+ import type { inferRouterInputs , inferRouterOutputs } from "@trpc/server" ;
12
13
import { initTRPC } from "@trpc/server" ;
14
+ import test from "node:test" ;
13
15
import { z } from "zod" ;
14
16
15
- const t = initTRPC . create ( ) ;
17
+ const t = initTRPC . create ( { isServer : true } ) ;
16
18
17
- // TODO: sqlite inputs should be declared as a schema
18
19
const sqliteRouter = t . router ( {
19
- run : t . procedure . input ( SQLiteRunSchema ) . mutation ( ( { input } ) => {
20
- // Implement your logic here
21
- } ) ,
22
- all : t . procedure . input ( SQLiteAllSchema ) . query ( ( { input } ) => {
23
- // Implement your logic here
24
- } ) ,
25
- get : t . procedure . input ( SQLiteGetSchema ) . query ( ( { input } ) => {
26
- // Implement your logic here
27
- } ) ,
28
- runAsTransaction : t . procedure . input ( SQLiteRunAsTransactionSchema ) . mutation ( ( { input } ) => {
29
- // Implement your logic here
30
- } )
20
+ run : t . procedure . input ( SQLiteRunSchema ) . mutation ( ( { input } ) => { } ) ,
21
+ all : t . procedure . input ( SQLiteAllSchema ) . query ( ( { input } ) => { } ) ,
22
+ get : t . procedure . input ( SQLiteGetSchema ) . query ( ( { input } ) => { } ) ,
23
+ runAsTransaction : t . procedure . input ( SQLiteRunAsTransactionSchema ) . mutation ( ( { input } ) => { } )
31
24
} ) ;
32
25
33
26
const cardsRouter = t . router ( {
34
- create : t . procedure . input ( CreateCardBundleSchema ) . mutation ( ( { input } ) => {
35
- // Implement your logic here
36
- } ) ,
37
- read : t . procedure . input ( z . number ( ) ) . query ( ( { input } ) => {
38
- // Implement your logic here
39
- } ) ,
40
- update : t . procedure . input ( UpdateCardBundleSchema ) . mutation ( ( { input } ) => {
41
- // Implement your logic here
42
- } ) ,
43
- del : t . procedure . input ( z . number ( ) ) . mutation ( ( { input } ) => {
44
- // Implement your logic here
45
- } ) ,
46
- export_ : t . procedure . input ( z . number ( ) ) . mutation ( ( { input } ) => {
47
- // Implement your logic here
48
- } ) ,
49
- import_ : t . procedure . input ( z . string ( ) ) . mutation ( ( { input } ) => {
50
- // Implement your logic here
51
- } )
27
+ create : t . procedure . input ( CreateCardBundleSchema ) . mutation ( ( { input } ) => { } ) ,
28
+ read : t . procedure . input ( z . number ( ) ) . query ( ( { input } ) => { } ) ,
29
+ update : t . procedure . input ( UpdateCardBundleSchema ) . mutation ( ( { input } ) => { } ) ,
30
+ del : t . procedure . input ( z . number ( ) ) . mutation ( ( { input } ) => { } ) ,
31
+ export_ : t . procedure . input ( z . number ( ) ) . mutation ( ( { input } ) => { } ) ,
32
+ import_ : t . procedure . input ( z . string ( ) ) . mutation ( ( { input } ) => { } )
52
33
} ) ;
53
34
54
35
const personasRouter = t . router ( {
55
- create : t . procedure . input ( CreatePersonaBundleSchema ) . mutation ( ( { input } ) => {
56
- // Implement your logic here
57
- } ) ,
58
- read : t . procedure . input ( z . number ( ) ) . query ( ( { input } ) => {
59
- // Implement your logic here
60
- } ) ,
61
- update : t . procedure . input ( UpdatePersonaBundleSchema ) . mutation ( ( { input } ) => {
62
- // Implement your logic here
63
- } ) ,
64
- del : t . procedure . input ( z . number ( ) ) . mutation ( ( { input } ) => {
65
- // Implement your logic here
66
- } )
36
+ create : t . procedure . input ( CreatePersonaBundleSchema ) . mutation ( ( { input } ) => { } ) ,
37
+ read : t . procedure . input ( z . number ( ) ) . query ( ( { input } ) => { } ) ,
38
+ update : t . procedure . input ( UpdatePersonaBundleSchema ) . mutation ( ( { input } ) => { } ) ,
39
+ del : t . procedure . input ( z . number ( ) ) . mutation ( ( { input } ) => { } )
67
40
} ) ;
68
41
69
42
const xfetchRouter = t . router ( {
70
- post : t . procedure . input ( XFetchRequestSchema ) . mutation ( ( { input } ) => {
71
- // Implement your logic here
72
- } ) ,
73
- get : t . procedure . input ( XFetchRequestSchema ) . query ( ( { input } ) => {
74
- // Implement your logic here
75
- } ) ,
76
- abort : t . procedure . input ( z . string ( ) ) . mutation ( ( { input } ) => {
77
- // Implement your logic here
78
- } )
43
+ post : t . procedure . input ( XFetchRequestSchema ) . mutation ( ( { input } ) => { } ) ,
44
+ get : t . procedure . input ( XFetchRequestSchema ) . query ( ( { input } ) => { } ) ,
45
+ abort : t . procedure . input ( z . string ( ) ) . mutation ( ( { input } ) => { } )
79
46
} ) ;
80
47
81
48
const utilsRouter = t . router ( {
82
- openURL : t . procedure . input ( z . string ( ) ) . mutation ( ( { input } ) => {
83
- // Implement your logic here
84
- } )
49
+ openURL : t . procedure . input ( z . string ( ) ) . mutation ( ( { input } ) => { } )
85
50
} ) ;
86
51
87
52
export const router = t . router ( {
88
- sqlite : sqliteRouter ,
89
- cards : cardsRouter ,
90
- personas : personasRouter ,
91
- xfetch : xfetchRouter ,
92
- utils : utilsRouter
53
+ // sqlite: sqliteRouter,
54
+ // cards: cardsRouter,
55
+ // personas: personasRouter,
56
+ // xfetch: xfetchRouter,
57
+ // utils: utilsRouter
58
+ test : t . procedure . query ( ( ) => {
59
+ return { kind : "ok" , data : "Hello World!" } ;
60
+ } ) ,
61
+ test2 : t . procedure . query ( ( ) => {
62
+ return "Hello World!" ;
63
+ } ) ,
64
+ test3 : t . procedure . query ( ( ) => {
65
+ return Math . random ( ) % 2 === 0 ? { kind : "ok" , data : "Hello World!" } : { kind : "error" , data : "Hello World!" } ;
66
+ } )
93
67
} ) ;
68
+
69
+ export type AppRouter = typeof router ;
0 commit comments