File tree 1 file changed +4
-3
lines changed 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -39,6 +39,7 @@ export type ElasticApiParserOptsT = {
39
39
| '1_0'
40
40
| '0_90' ,
41
41
prefix ?: string ,
42
+ elasticApiFilesPath ?: string ,
42
43
} ;
43
44
44
45
export type ElasticParamConfigT = {
@@ -63,26 +64,26 @@ export type ElasticCaSettingsT = {
63
64
urls ?: ElasticCaSettingsUrlT [ ] ,
64
65
} ;
65
66
66
- export const elasticApiFilesPath = './node_modules/elasticsearch/src/lib/apis/' ;
67
-
68
67
export default class ElasticApiParser {
69
68
cachedEnums : {
70
69
[ fieldName : string ] : { [ valsStringified : string ] : GraphQLEnumType } ,
71
70
} ;
72
71
version: string ;
73
72
prefix: string ;
73
+ elasticApiFilesPath: string ;
74
74
75
75
constructor ( opts : ElasticApiParserOptsT = { } ) {
76
76
// derived from installed package `elasticsearch`
77
77
// from ../../node_modules/elasticsearch/src/lib/apis/VERSION.js
78
78
this . version = opts . version || '5_0' ;
79
79
this . prefix = opts . prefix || 'Elastic' ;
80
+ this . elasticApiFilesPath = opts . elasticApiFilesPath || './node_modules/elasticsearch/src/lib/apis/' ;
80
81
this . cachedEnums = { } ;
81
82
}
82
83
83
84
run ( ) {
84
85
this . cachedEnums = { } ;
85
- const apiFilePath = path . resolve ( elasticApiFilesPath , `${ this . version } .js` ) ;
86
+ const apiFilePath = path . resolve ( this . elasticApiFilesPath , `${ this . version } .js` ) ;
86
87
const source = this . loadApiFile ( apiFilePath ) ;
87
88
return this . parseSource ( source ) ;
88
89
}
You can’t perform that action at this time.
0 commit comments