details: https://hg.nginx.org/njs/rev/a0807bc0ec72 branches: changeset: 2133:a0807bc0ec72 user: Dmitry Volyntsev <xei...@nginx.com> date: Tue May 23 23:47:43 2023 -0700 description: Types: added TS types for ngx properties added in 25b55a064e42.
diffstat: test/ts/test.ts | 6 ++-- ts/ngx_core.d.ts | 64 +++++++++++++++++++++++++++++++++++++++++++++++++------ 2 files changed, 60 insertions(+), 10 deletions(-) diffs (98 lines): diff -r 873830a0a78f -r a0807bc0ec72 test/ts/test.ts --- a/test/ts/test.ts Tue May 23 20:58:40 2023 -0700 +++ b/test/ts/test.ts Tue May 23 23:47:43 2023 -0700 @@ -297,7 +297,7 @@ function njs_object() { } function ngx_object() { - ngx.log(ngx.INFO, 'asdf'); - ngx.log(ngx.WARN, Buffer.from('asdf')); - ngx.log(ngx.ERR, 'asdf'); + ngx.log(ngx.INFO, ngx.conf_prefix); + ngx.log(ngx.WARN, Buffer.from(ngx.error_log_path)); + ngx.log(ngx.ERR, ngx.version); } diff -r 873830a0a78f -r a0807bc0ec72 ts/ngx_core.d.ts --- a/ts/ngx_core.d.ts Tue May 23 20:58:40 2023 -0700 +++ b/ts/ngx_core.d.ts Tue May 23 23:47:43 2023 -0700 @@ -243,16 +243,38 @@ interface NgxFetchOptions { } interface NgxObject { - readonly INFO: number; - readonly WARN: number; + /** + * A string containing an optional nginx build name, corresponds to the + * --build=name argument of the configure script, by default is "" + * @since 0.8.0 + */ + readonly build: string; + /** + * A string containing the file path to current nginx configuration file + * @since 0.8.0 + */ + readonly conf_file_path: string; + /** + * A string containing the file path to directory where nginx is currently + * looking for configuration + * @since 0.7.8 + */ + readonly conf_prefix: string; + /** + * The error level constant for ngx.log() function. + * @since 0.5.1 + */ readonly ERR: number; /** - * Writes a string to the error log with the specified level - * of logging. - * @param level Log level (ngx.INFO, ngx.WARN, ngx.ERR). - * @param message Message to log. + * A string containing the file path to the current error log file + * @since 0.8.0 */ - log(level: number, message: NjsStringOrBuffer): void; + readonly error_log_path: string; + /** + * The info level constant for ngx.log() function. + * @since 0.5.1 + */ + readonly INFO: number; /** * Makes a request to fetch an URL. * Returns a Promise that resolves with the Response object. @@ -262,6 +284,34 @@ interface NgxObject { * @since 0.5.1 */ fetch(init: NjsStringOrBuffer | Request, options?: NgxFetchOptions): Promise<Response>; + /** + * Writes a string to the error log with the specified level + * of logging. + * @param level Log level (ngx.INFO, ngx.WARN, ngx.ERR). + * @param message Message to log. + */ + log(level: number, message: NjsStringOrBuffer): void; + /** + * A string containing the file path to a directory that keeps server files + * @since 0.8.0 + */ + readonly prefix: string; + /** + * A string containing nginx version, for example: "1.25.0" + * @since 0.8.0 + */ + readonly version: string; + /** + * A number containing nginx version, for example: 1025000 + * @since 0.8.0 + */ + readonly version_number: number; + /** + * The warn level constant for ngx.log() function. + * @since 0.5.1 + */ + readonly WARN: number; + } declare const ngx: NgxObject; _______________________________________________ nginx-devel mailing list nginx-devel@nginx.org https://mailman.nginx.org/mailman/listinfo/nginx-devel