@@ -74,8 +74,86 @@ if (!fs.existsSync(dist)) {
7474 fs . mkdirSync ( dist )
7575}
7676
77+ type ObjectMeta = {
78+ name : string ;
79+ fields : ObjectFieldMeta [ ] ;
80+ }
81+
82+ type ObjectFieldMeta = {
83+ name : string ;
84+ type : string ;
85+ description : TranslationList
86+ }
87+
88+ const types : ObjectMeta [ ] = [ {
89+ name : 'Dimensions' ,
90+ fields : [ {
91+ name : 'L' ,
92+ type : 'number|null' ,
93+ description : {
94+ 'en-GB' : 'Length' ,
95+ 'es-ES' : 'Longitud' ,
96+ 'ru-RU' : 'Длина' ,
97+ } ,
98+ } , {
99+ name : 'W' ,
100+ type : 'number|null' ,
101+ description : {
102+ 'en-GB' : 'Width' ,
103+ 'es-ES' : 'Anchura' ,
104+ 'ru-RU' : 'Ширина' ,
105+ } ,
106+ } , {
107+ name : 'H' ,
108+ type : 'number|null' ,
109+ description : {
110+ 'en-GB' : 'Height' ,
111+ 'es-ES' : 'Altura' ,
112+ 'ru-RU' : 'Высота' ,
113+ } ,
114+ } ] ,
115+ } , {
116+ name : 'Money' ,
117+ fields : [ {
118+ name : 'amount' ,
119+ type : 'number' ,
120+ description : {
121+ 'en-GB' : 'Amount' ,
122+ 'es-ES' : 'Cantidad' ,
123+ 'ru-RU' : 'Количество' ,
124+ } ,
125+ } , {
126+ name : 'currency' ,
127+ type : 'string' ,
128+ description : {
129+ 'en-GB' : 'Currency code' ,
130+ 'es-ES' : 'Código de moneda' ,
131+ 'ru-RU' : 'Символьный код валюты' ,
132+ } ,
133+ } ] ,
134+ } , {
135+ name : 'Weight' ,
136+ fields : [ {
137+ name : 'value' ,
138+ type : 'number' ,
139+ description : {
140+ 'en-GB' : 'Weight value' ,
141+ 'es-ES' : 'Valor del peso' ,
142+ 'ru-RU' : 'Значение веса' ,
143+ } ,
144+ } , {
145+ name : 'unit' ,
146+ type : '\'grams\'|\'kilograms\'|\'tons\'' ,
147+ description : {
148+ 'en-GB' : 'Weight unit' ,
149+ 'es-ES' : 'Unidad de peso' ,
150+ 'ru-RU' : 'Единица измерения' ,
151+ } ,
152+ } ] ,
153+ } ]
154+
77155fs . writeFileSync ( join ( dist , 'meta.json' ) , JSON . stringify ( {
78- types : keysOf ( order . typesDescription ) . reduce ( ( meta , name ) => {
156+ types : [ ... keysOf ( order . typesDescription ) . reduce ( ( meta , name ) => {
79157 const types = order . types [ name ]
80158 const descriptions = order . typesDescription [ name ]
81159
@@ -89,7 +167,7 @@ fs.writeFileSync(join(dist, 'meta.json'), JSON.stringify({
89167 } )
90168
91169 return meta
92- } , [ ] as Array < { name : string ; fields : Array < { name : string ; type : string ; } > } > ) ,
170+ } , [ ] as Array < { name : string ; fields : ObjectFieldMeta [ ] ; } > ) , ... types ] ,
93171 actions : keysOf ( actions ) . reduce ( ( meta , scope ) => {
94172 meta [ scope ] = keysOf ( actions [ scope ] ) . map ( name => ( {
95173 name,
0 commit comments