@@ -20,12 +20,11 @@ export type {
2020}
2121`
2222
23- const methodsTemplate = ( { camelName, upperName, className, type } : ServiceGeneratorContext ) =>
24- ` const ${ camelName } ServiceMethods = ['find', 'get', 'create', 'update', 'patch', 'remove'] as const
23+ const methodsTemplate = ( { camelName, upperName, className, type } : ServiceGeneratorContext ) => `
24+ const ${ camelName } ServiceMethods = ['find', 'get', 'create', 'update', 'patch', 'remove'] as const
2525type ${ upperName } ClientService = Pick<${ className } ${
26- type !== 'custom' ? `<Params<${ upperName } Query>>` : ''
27- } , typeof ${ camelName } ServiceMethods[number]>
28- `
26+ type !== 'custom' ? `<Params<${ upperName } Query>>` : ''
27+ } , typeof ${ camelName } ServiceMethods[number]>`
2928
3029const declarationTemplate = ( { path, upperName } : ServiceGeneratorContext ) =>
3130 ` '${ path } ': ${ upperName } ClientService`
@@ -41,24 +40,18 @@ const toClientFile = toFile<ServiceGeneratorContext>(({ lib }) => [lib, 'client'
4140
4241export const generate = async ( ctx : ServiceGeneratorContext ) =>
4342 generator ( ctx )
44- . then (
45- injectSource (
46- registrationTemplate ,
47- before ( 'return client' ) ,
48- toFile < ServiceGeneratorContext > ( ( { lib } ) => [ lib , 'client' ] )
49- )
50- )
43+ . then ( injectSource ( registrationTemplate , before ( 'return client' ) , toClientFile ) )
5144 . then (
5245 when (
5346 ( ctx ) => ctx . language === 'js' ,
54- injectSource ( methodsTemplate , before ( '\nexport const createClient ') , toClientFile )
47+ injectSource ( methodsTemplate , after ( 'import authenticationClient ') , toClientFile )
5548 )
5649 )
5750 . then (
5851 when (
5952 ( ctx ) => ctx . language === 'ts' ,
60- injectSource ( methodsTemplate , before ( '\nexport interface ServiceTypes' ) , toClientFile ) ,
6153 injectSource ( importTemplate , after ( "from '@feathersjs/feathers'" ) , toClientFile ) ,
54+ injectSource ( methodsTemplate , before ( '\nexport interface ServiceTypes' ) , toClientFile ) ,
6255 injectSource ( declarationTemplate , after ( 'export interface ServiceTypes' ) , toClientFile )
6356 )
6457 )
0 commit comments