Commit c0330c0 1 parent d207972 commit c0330c0 Copy full SHA for c0330c0
File tree 4 files changed +88
-55
lines changed
4 files changed +88
-55
lines changed Original file line number Diff line number Diff line change 1
1
import './handler'
2
- import './middlewares/auth'
3
2
import './services/users'
3
+ import './services/mails'
4
4
import './wizard'
5
+
6
+ // import fs from 'node:fs'
7
+ // import { logger } from '../src/internal/logger'
8
+ // import { wizard } from './wizard'
9
+
10
+ // const result = await wizard.api.call(
11
+ // 'users@0.1.1#create',
12
+ // {
13
+ // name: 'alice',
14
+ // },
15
+ // {
16
+ // stream: [fs.createReadStream('.env'), fs.createReadStream('tsconfig.json')],
17
+ // }
18
+ // )
19
+
20
+ // logger.log(result)
Load Diff This file was deleted.
Original file line number Diff line number Diff line change
1
+ import { unwrap } from '@sirutils/core'
2
+
3
+ import { parsePlainTextFile } from '../../src/utils/parsers'
4
+ import { wizard } from '../wizard'
5
+
6
+ const mailsService = await wizard . api . service ( {
7
+ name : 'mails' ,
8
+ version : '0.1.1' ,
9
+ description : 'mails api' ,
10
+
11
+ actions : {
12
+ test : wizard . api . createAction (
13
+ {
14
+ body : {
15
+ name : 'string' ,
16
+ } ,
17
+ queries : {
18
+ id : 'string' ,
19
+ } ,
20
+ rest : true ,
21
+ stream : true ,
22
+ multipart : true ,
23
+ } ,
24
+ async ctx => {
25
+ if ( ctx . streams ) {
26
+ for ( const [ stream , options ] of ctx . streams ) {
27
+ // biome-ignore lint/style/noNonNullAssertion: <explanation>
28
+ ctx . logger . info ( unwrap ( await parsePlainTextFile ( stream ! ) ) , options )
29
+ }
30
+ }
31
+
32
+ return 'as' as const
33
+ }
34
+ ) ,
35
+ } ,
36
+
37
+ created : ctx => {
38
+ ctx . logger . info ( 'hi' )
39
+
40
+ return true
41
+ } ,
42
+ } )
43
+
44
+ declare global {
45
+ // biome-ignore lint/style/noNamespace: <explanation>
46
+ namespace Sirutils {
47
+ interface WizardServices {
48
+ 'mails@0.1.1' : typeof mailsService
49
+ }
50
+ }
51
+ }
Original file line number Diff line number Diff line change @@ -2,30 +2,42 @@ import { wizard } from '../wizard'
2
2
3
3
const usersService = await wizard . api . service ( {
4
4
name : 'users' ,
5
- version : '0.0 .1' ,
5
+ version : '0.1 .1' ,
6
6
description : 'users api' ,
7
7
8
8
actions : {
9
- get : wizard . api . createAction (
9
+ create : wizard . api . createAction (
10
10
{
11
- rest : 'GET /' ,
12
- middlewares : [ 'auth' ] ,
11
+ body : {
12
+ name : 'string' ,
13
+ } ,
14
+ rest : true ,
15
+ stream : true ,
16
+ multipart : true ,
13
17
} ,
14
18
ctx => {
15
- //biome-ignore lint/suspicious/noConsole: <explanation>
16
- console . log ( ctx . share ?. user )
19
+ if ( ctx . streams ) {
20
+ // biome-ignore lint/suspicious/noConsole: <explanation>
21
+ console . log ( ctx . streams )
22
+ }
17
23
18
- return JSON . stringify ( ctx . share ?. user )
24
+ return 'sa' as const
19
25
}
20
26
) ,
21
27
} ,
28
+
29
+ created : ctx => {
30
+ ctx . logger . info ( 'hi' )
31
+
32
+ return true
33
+ } ,
22
34
} )
23
35
24
36
declare global {
25
37
// biome-ignore lint/style/noNamespace: <explanation>
26
38
namespace Sirutils {
27
39
interface WizardServices {
28
- 'users@0.0 .1' : typeof usersService
40
+ 'users@0.1 .1' : typeof usersService
29
41
}
30
42
}
31
43
}
You can’t perform that action at this time.
0 commit comments