@@ -4,7 +4,7 @@ const {TypeCreator, symbols, utils} = require('type-creator');
4
4
5
5
6
6
const tc = new TypeCreator ( ) ;
7
- const { set, setType} = tc . getTypeUtils ( ) ;
7
+ const { set, setType, setTypeMap } = tc . getTypeUtils ( ) ;
8
8
const { ts, go, java} = tc . getLangSymbols ( ) ;
9
9
const cmn = tc . getCommonSymbols ( ) ;
10
10
const { defs} = tc . getDefaults ( ) ;
@@ -15,133 +15,261 @@ const v = tc.registerSymbols({
15
15
} ) ;
16
16
17
17
18
- const ent = tc . registerEntities ( 'default' , {
18
+ const custom = {
19
19
20
- Inner : {
21
- Zoom : set ( [ ts . Interface ] , { } )
22
- } ,
20
+ int : setTypeMap ( {
21
+ golang : 'int8' ,
22
+ java : 'int' ,
23
+ typescript : 'number'
24
+ } ) ,
23
25
24
- foo : {
25
-
26
- // x: ()=> ent.foo.GET.miasmic,
26
+ string : setTypeMap ( {
27
+ golang : 'string' ,
28
+ java : 'String' ,
29
+ typescript : 'string'
30
+ } ) ,
31
+
32
+ bool : setTypeMap ( {
33
+ golang : 'bool' ,
34
+ java : 'boolean' ,
35
+ typescript : 'boolean'
36
+ } )
37
+
38
+ } ;
39
+
40
+
41
+ const ent = tc . registerEntities ( 'default' , {
42
+
43
+ foo : set ( go . Entity , {
27
44
28
45
PUT : {
29
46
30
- basic : set ( [ ] , {
31
-
32
- DogPigRoop : set ( [ ts . Interface ] , {
33
- dog : defs . String ,
34
- pig : defs . Boolean ,
35
- // roop: [{}],
36
- roop : [ defs . Object ] ,
37
- stoop : [ defs . Boolean ]
38
- } ) ,
47
+ basic : set ( ts . Interface , {
39
48
40
- v : set ( [ ts . Interface ] , {
41
- zoom : setType ( {
42
- link : 'DogPigRoop'
43
- } ) ,
44
- // boom: setArray(inline, [defaultString]),
45
- // toom: setArray(inline, [
46
- // []
47
- // ]),
48
- // faz: setArray(literal,[
49
- // 'Entities.Inner.Zoom', 'Froom', 'Star'
50
- // ]),
51
- path : '/foo' ,
52
- } ) ,
53
-
54
- req : set ( [ go . Struct , ts . Interface ] , {
49
+ req : set ( go . File , {
55
50
headers : {
56
- ' x_requested_by' : 'foo'
51
+ x_requested_by : custom . string
57
52
} ,
58
- body : set ( [ ] , {
59
- // foo: 'string',
60
- // bar:'number',
61
- // zoom: 'boolean'
53
+ body : {
62
54
foo : defs . String ,
63
55
bar : defs . Int ,
64
56
zoom : defs . Boolean
65
- } )
57
+ }
66
58
} ) ,
67
- res : set ( [ go . Struct ] , {
68
- headers : { }
59
+ res : set ( go . File , {
60
+ headers : {
61
+ }
69
62
} )
70
63
} ) ,
71
64
72
- tragic : set ( [ ts . Interface ] , {
73
- path : '/foo' ,
74
- req : set ( [ go . Struct ] , {
65
+ tragic : set ( ts . Interface , {
66
+
67
+ req : set ( go . File , {
75
68
headers : {
76
- ' x_requested_by' : 'foo'
69
+ x_requested_by : custom . string
77
70
} ,
78
- body : set ( [ ] , {
79
- foo : ' string'
80
- } )
71
+ body : {
72
+ foo : custom . string
73
+ }
81
74
} ) ,
82
- res : set ( [ go . Struct ] , {
83
- headers : { }
75
+ res : set ( go . File , {
76
+ headers : {
77
+
78
+ }
84
79
} )
85
80
} )
86
81
} ,
87
82
88
83
GET : {
89
- miasmic : set ( [ ts . Interface ] , {
90
- path : '/foo' ,
91
- req : set ( [ go . Struct ] , {
84
+ miasmic : set ( ts . Interface , {
85
+
86
+ req : set ( go . File , {
92
87
headers : {
93
- ' x_requested_by' : 'foo'
88
+ x_requested_by : custom . string
94
89
} ,
95
- body : set ( [ ] , {
96
- foo : ' string' ,
97
- } )
90
+ body : {
91
+ foo : custom . string
92
+ }
98
93
} ) ,
99
- res : set ( [ go . Struct ] , {
100
- headers : { }
94
+ res : set ( go . File , {
95
+ headers : {
96
+ }
101
97
} )
102
98
} )
103
99
}
104
- } ,
100
+ } ) ,
105
101
106
-
107
- bar : {
102
+ bar : set ( go . Entity , {
108
103
PUT : {
109
- basic : set ( [ ts . Interface ] , {
110
-
111
- [ cmn . Optional ] : [ 'path' ] ,
112
-
113
- path : '/foo' ,
114
- req : set ( [ go . Struct ] , {
115
- headers : { } ,
116
- body : { }
104
+ basic : set ( ts . Interface , {
105
+ req : set ( go . File , {
106
+ headers : {
107
+
108
+ } ,
109
+ body : {
110
+ mip : defs . String ,
111
+ mop : defs . Int ,
112
+ map : defs . Boolean
113
+ }
117
114
} ) ,
118
- res : set ( [ go . Struct ] , {
119
- headers : { }
115
+ res : set ( go . File , {
116
+ headers : {
117
+ }
120
118
} )
121
119
} )
122
120
} ,
123
121
124
122
GET : {
125
- basic : set ( [ ts . Interface ] , {
126
-
127
- path : '/foo' ,
128
- req : set ( [ go . Struct ] , {
129
-
130
- headers : { } ,
131
- body : { }
123
+ basic : set ( ts . Interface , {
124
+ req : set ( go . File , {
125
+ headers : {
132
126
127
+ } ,
128
+ body : {
129
+ tip : defs . String ,
130
+ top : defs . Int ,
131
+ tap : defs . Boolean
132
+ }
133
133
} ) ,
134
- res : set ( [ go . Struct ] , {
135
-
136
- headers : { }
134
+ res : set ( go . File , {
135
+ headers : {
137
136
137
+ }
138
138
} )
139
139
} )
140
-
141
140
}
142
- }
141
+ } ) ,
143
142
144
143
} ) ;
145
144
145
+ //
146
+ // const ent = tc.registerEntities('default', {
147
+ //
148
+ // Inner: {
149
+ // Zoom: set([ts.Interface], {})
150
+ // },
151
+ //
152
+ // foo: {
153
+ //
154
+ // // x: ()=> ent.foo.GET.miasmic,
155
+ //
156
+ // PUT: {
157
+ //
158
+ // basic: set([go.File],{
159
+ //
160
+ // DogPigRoop: set([ts.Interface], {
161
+ // dog: defs.String,
162
+ // pig: defs.Boolean,
163
+ // // roop: [{}],
164
+ // roop: [defs.Object],
165
+ // stoop: [defs.Boolean]
166
+ // }),
167
+ //
168
+ // v: set([ts.Interface], {
169
+ // zoom: setType({
170
+ // link: 'DogPigRoop'
171
+ // }),
172
+ // // boom: setArray(inline, [defs.String]),
173
+ // // toom: setArray(inline, [
174
+ // // []
175
+ // // ]),
176
+ // // faz: setArray(literal,[
177
+ // // 'Entities.Inner.Zoom', 'Froom', 'Star'
178
+ // // ]),
179
+ // path: '/foo',
180
+ // }),
181
+ //
182
+ // req: set([go.Struct, ts.Interface], {
183
+ // headers: {
184
+ // 'x_requested_by': 'foo'
185
+ // },
186
+ // body: set([],{
187
+ // // foo: 'string',
188
+ // // bar:'number',
189
+ // // zoom: 'boolean'
190
+ // foo: defs.String,
191
+ // bar: defs.Int,
192
+ // zoom: defs.Boolean
193
+ // })
194
+ // }),
195
+ // res: set([go.Struct], {
196
+ // headers: {}
197
+ // })
198
+ // }),
199
+ //
200
+ // tragic: set([ts.Interface,go.File], {
201
+ // path: '/foo',
202
+ // req: set([go.Struct], {
203
+ // headers: {
204
+ // 'x_requested_by': 'foo'
205
+ // },
206
+ // body: set([],{
207
+ // foo: 'string'
208
+ // })
209
+ // }),
210
+ // res: set([go.Struct], {
211
+ // headers: {}
212
+ // })
213
+ // })
214
+ // },
215
+ //
216
+ // GET: {
217
+ // miasmic: set([ts.Interface, go.File], {
218
+ // path: '/foo',
219
+ // req: set([go.Struct], {
220
+ // headers: {
221
+ // 'x_requested_by': 'foo'
222
+ // },
223
+ // body: set([],{
224
+ // foo: 'string',
225
+ // })
226
+ // }),
227
+ // res: set([go.Struct], {
228
+ // headers: {}
229
+ // })
230
+ // })
231
+ // }
232
+ // },
233
+ //
234
+ //
235
+ // bar: {
236
+ // PUT: {
237
+ // basic: set([ts.Interface, go.File], {
238
+ //
239
+ // [cmn.Optional]: ['path'],
240
+ //
241
+ // path: '/foo',
242
+ // req: set([go.Struct], {
243
+ // headers: {},
244
+ // body: {}
245
+ // }),
246
+ // res: set([go.Struct], {
247
+ // headers: {}
248
+ // })
249
+ // })
250
+ // },
251
+ //
252
+ // GET: {
253
+ // basic: set([ts.Interface, go.File], {
254
+ //
255
+ // path: '/foo',
256
+ // req: set([go.Struct], {
257
+ //
258
+ // headers: {},
259
+ // body: {}
260
+ //
261
+ // }),
262
+ // res: set([go.Struct], {
263
+ //
264
+ // headers: {}
265
+ //
266
+ // })
267
+ // })
268
+ //
269
+ // }
270
+ // }
271
+ //
272
+ // });
273
+
146
274
147
275
exports . tc = tc ;
0 commit comments