Commit 12099b8 1 parent d207972 commit 12099b8 Copy full SHA for 12099b8
File tree 1 file changed +51
-0
lines changed
packages/wizard/test/services
1 file changed +51
-0
lines changed 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
+ }
You can’t perform that action at this time.
0 commit comments