Skip to content

Commit 02d03f0

Browse files
committed
ores/auto-commit => 'set'
1 parent 7ed3ef8 commit 02d03f0

File tree

2 files changed

+227
-88
lines changed

2 files changed

+227
-88
lines changed

tc.conf.js

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,36 @@
11
'use strict';
22

3+
const path = require('path');
34
const {generators} = require('type-creator');
45

5-
const folder = '/home/oleg/codes/oresoftware/types-depot/builds';
6-
76
exports.default = {
87

9-
buildFolder: folder,
8+
buildFolder: path.resolve(__dirname, 'builds'),
109

1110
tasks: [
1211

1312
{
1413
lang: 'typescript',
1514
gen: generators.typescript,
16-
output: {folder: 'typescript', file: 'types.ts'}
15+
output: {folder: 'typescript', file: 'types.ts'},
16+
},
17+
18+
{
19+
lang: 'golang',
20+
gen: generators.golang,
21+
output: {folder: 'golang', file: 'golang.go'},
22+
options: {
23+
packageName:'golang'
24+
}
1725
},
1826

1927
{
2028
lang: 'java',
2129
gen: generators.java,
22-
output: {folder: 'java', file: 'Entities.java'}
30+
output: {folder: 'java', file: 'Entities.java'},
31+
options:{
32+
jar: true
33+
}
2334
}
2435

2536
// java8: {

tc.input.js

Lines changed: 211 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const {TypeCreator, symbols, utils} = require('type-creator');
44

55

66
const tc = new TypeCreator();
7-
const {set, setType} = tc.getTypeUtils();
7+
const {set, setType, setTypeMap} = tc.getTypeUtils();
88
const {ts, go, java} = tc.getLangSymbols();
99
const cmn = tc.getCommonSymbols();
1010
const {defs} = tc.getDefaults();
@@ -15,133 +15,261 @@ const v = tc.registerSymbols({
1515
});
1616

1717

18-
const ent = tc.registerEntities('default', {
18+
const custom = {
1919

20-
Inner: {
21-
Zoom: set([ts.Interface], {})
22-
},
20+
int: setTypeMap({
21+
golang: 'int8',
22+
java: 'int',
23+
typescript: 'number'
24+
}),
2325

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,{
2744

2845
PUT: {
2946

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, {
3948

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,{
5550
headers: {
56-
'x_requested_by': 'foo'
51+
x_requested_by: custom.string
5752
},
58-
body: set([],{
59-
// foo: 'string',
60-
// bar:'number',
61-
// zoom: 'boolean'
53+
body: {
6254
foo: defs.String,
6355
bar: defs.Int,
6456
zoom: defs.Boolean
65-
})
57+
}
6658
}),
67-
res: set([go.Struct], {
68-
headers: {}
59+
res: set(go.File,{
60+
headers: {
61+
}
6962
})
7063
}),
7164

72-
tragic: set([ts.Interface], {
73-
path: '/foo',
74-
req: set([go.Struct], {
65+
tragic: set(ts.Interface,{
66+
67+
req: set(go.File,{
7568
headers: {
76-
'x_requested_by': 'foo'
69+
x_requested_by: custom.string
7770
},
78-
body: set([],{
79-
foo: 'string'
80-
})
71+
body: {
72+
foo: custom.string
73+
}
8174
}),
82-
res: set([go.Struct], {
83-
headers: {}
75+
res: set(go.File,{
76+
headers: {
77+
78+
}
8479
})
8580
})
8681
},
8782

8883
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,{
9287
headers: {
93-
'x_requested_by': 'foo'
88+
x_requested_by: custom.string
9489
},
95-
body: set([],{
96-
foo: 'string',
97-
})
90+
body: {
91+
foo: custom.string
92+
}
9893
}),
99-
res: set([go.Struct], {
100-
headers: {}
94+
res: set(go.File,{
95+
headers: {
96+
}
10197
})
10298
})
10399
}
104-
},
100+
}),
105101

106-
107-
bar: {
102+
bar: set(go.Entity,{
108103
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+
}
117114
}),
118-
res: set([go.Struct], {
119-
headers: {}
115+
res: set(go.File,{
116+
headers: {
117+
}
120118
})
121119
})
122120
},
123121

124122
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: {
132126

127+
},
128+
body: {
129+
tip: defs.String,
130+
top: defs.Int,
131+
tap: defs.Boolean
132+
}
133133
}),
134-
res: set([go.Struct], {
135-
136-
headers: {}
134+
res: set(go.File,{
135+
headers: {
137136

137+
}
138138
})
139139
})
140-
141140
}
142-
}
141+
}),
143142

144143
});
145144

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+
146274

147275
exports.tc = tc;

0 commit comments

Comments
 (0)