File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -39,6 +39,7 @@ export type ElasticApiParserOptsT = {
3939 | '1_0'
4040 | '0_90' ,
4141 prefix ?: string ,
42+ elasticApiFilesPath ?: string ,
4243} ;
4344
4445export type ElasticParamConfigT = {
@@ -63,26 +64,26 @@ export type ElasticCaSettingsT = {
6364 urls ?: ElasticCaSettingsUrlT [ ] ,
6465} ;
6566
66- export const elasticApiFilesPath = './node_modules/elasticsearch/src/lib/apis/' ;
67-
6867export default class ElasticApiParser {
6968 cachedEnums : {
7069 [ fieldName : string ] : { [ valsStringified : string ] : GraphQLEnumType } ,
7170 } ;
7271 version: string ;
7372 prefix: string ;
73+ elasticApiFilesPath: string ;
7474
7575 constructor ( opts : ElasticApiParserOptsT = { } ) {
7676 // derived from installed package `elasticsearch`
7777 // from ../../node_modules/elasticsearch/src/lib/apis/VERSION.js
7878 this . version = opts . version || '5_0' ;
7979 this . prefix = opts . prefix || 'Elastic' ;
80+ this . elasticApiFilesPath = opts . elasticApiFilesPath || './node_modules/elasticsearch/src/lib/apis/' ;
8081 this . cachedEnums = { } ;
8182 }
8283
8384 run ( ) {
8485 this . cachedEnums = { } ;
85- const apiFilePath = path . resolve ( elasticApiFilesPath , `${ this . version } .js` ) ;
86+ const apiFilePath = path . resolve ( this . elasticApiFilesPath , `${ this . version } .js` ) ;
8687 const source = this . loadApiFile ( apiFilePath ) ;
8788 return this . parseSource ( source ) ;
8889 }
You can’t perform that action at this time.
0 commit comments