@@ -20,16 +20,20 @@ import { keysOf } from '@/utilities'
2020
2121import * as customer from '@/common/customer/card'
2222import * as customerPhone from '@/common/customer/card-phone'
23- import * as order from '@/common/order/card'
24- import * as orderSettings from '@/common/order/card-settings'
23+ import * as orderCard from '@/common/order/card'
24+ import * as orderCardSettings from '@/common/order/card-settings'
25+ import * as orderMg from '@/common/order/mg'
26+ import * as orderMgSettings from '@/common/order/mg-settings'
2527import * as user from '@/common/user/current'
2628import * as settings from '@/common/settings'
2729
2830const schema : SchemaList = {
2931 [ customer . id ] : customer . schema ,
3032 [ customerPhone . id ] : customerPhone . schema ,
31- [ order . id ] : order . schema ,
32- [ orderSettings . id ] : orderSettings . schema ,
33+ [ orderCard . id ] : orderCard . schema ,
34+ [ orderCardSettings . id ] : orderCardSettings . schema ,
35+ [ orderMg . id ] : orderMg . schema ,
36+ [ orderMgSettings . id ] : orderMgSettings . schema ,
3337 [ user . id ] : user . schema ,
3438 [ settings . id ] : settings . schema ,
3539}
@@ -39,8 +43,10 @@ const description: {
3943} = {
4044 [ customer . id ] : customer . description ,
4145 [ customerPhone . id ] : customerPhone . description ,
42- [ order . id ] : order . description ,
43- [ orderSettings . id ] : orderSettings . description ,
46+ [ orderCard . id ] : orderCard . description ,
47+ [ orderCardSettings . id ] : orderCardSettings . description ,
48+ [ orderMg . id ] : orderMg . description ,
49+ [ orderMgSettings . id ] : orderMgSettings . description ,
4450 [ user . id ] : user . description ,
4551 [ settings . id ] : settings . description ,
4652}
@@ -50,20 +56,24 @@ const usage: {
5056} = {
5157 [ customer . id ] : customer . usage ,
5258 [ customerPhone . id ] : customerPhone . usage ,
53- [ order . id ] : order . usage ,
54- [ orderSettings . id ] : orderSettings . usage ,
59+ [ orderCard . id ] : orderCard . usage ,
60+ [ orderCardSettings . id ] : orderCardSettings . usage ,
61+ [ orderMg . id ] : orderMg . usage ,
62+ [ orderMgSettings . id ] : orderMgSettings . usage ,
5563 [ user . id ] : user . usage ,
5664 [ settings . id ] : settings . usage ,
5765}
5866
5967const actions : ActionSchemaList = {
60- [ order . id ] : order . actions ,
68+ [ orderCard . id ] : orderCard . actions ,
69+ [ orderMg . id ] : orderMg . actions ,
6170}
6271
6372const actionsDescription : {
6473 [ K in keyof ActionSchemaList ] : ObjectDescription < ActionSchemaList [ K ] > ;
6574} = {
66- [ order . id ] : order . actionsDescription ,
75+ [ orderCard . id ] : orderCard . actionsDescription ,
76+ [ orderMg . id ] : orderMg . actionsDescription ,
6777}
6878
6979const __dirname = dirname ( fileURLToPath ( import . meta. url ) )
@@ -153,21 +163,29 @@ const types: ObjectMeta[] = [{
153163} ]
154164
155165fs . writeFileSync ( join ( dist , 'meta.json' ) , JSON . stringify ( {
156- types : [ ...keysOf ( order . typesDescription ) . reduce ( ( meta , name ) => {
157- const types = order . types [ name ]
158- const descriptions = order . typesDescription [ name ]
159-
160- meta . push ( {
161- name,
162- fields : keysOf ( descriptions ) . map ( field => ( {
163- name : field ,
164- type : types [ field ] ,
165- description : descriptions [ field ] ,
166- } ) ) ,
167- } )
168-
169- return meta
170- } , [ ] as Array < { name : string ; fields : ObjectFieldMeta [ ] ; } > ) , ...types ] ,
166+ types : [
167+ ...keysOf ( {
168+ ...orderCard . typesDescription ,
169+ ...orderMg . typesDescription ,
170+ } ) . reduce ( ( meta , name ) => {
171+ const types = { ...orderCard . types , ...orderMg . types } [ name ] as Record < string , string >
172+ const descriptions = {
173+ ...orderCard . typesDescription ,
174+ ...orderMg . typesDescription ,
175+ } [ name ]
176+
177+ meta . push ( {
178+ name : name ,
179+ fields : keysOf ( descriptions ) . map ( field => ( {
180+ name : field as string ,
181+ type : types [ field as string ] ,
182+ description : descriptions [ field ] ,
183+ } ) ) ,
184+ } )
185+
186+ return meta
187+ } , [ ] as Array < { name : string ; fields : ObjectFieldMeta [ ] ; } > ) , ...types ,
188+ ] ,
171189 actions : keysOf ( actions ) . reduce ( ( meta , scope ) => {
172190 meta [ scope ] = keysOf ( actions [ scope ] ) . map ( name => ( {
173191 name,
0 commit comments