[njs] Types: moved all TS type descriptions to ts/ in the repo root.

Dmitry Volyntsev xeioex at nginx.com
Thu Oct 29 13:00:03 UTC 2020


details:   https://hg.nginx.org/njs/rev/1ddcc8b77dab
branches:  
changeset: 1550:1ddcc8b77dab
user:      Jakub Jirutka <jakub at jirutka.cz>
date:      Mon Oct 19 23:51:54 2020 +0200
description:
Types: moved all TS type descriptions to ts/ in the repo root.

diffstat:

 auto/make                          |    7 +-
 nginx/ts/ngx_http_js_module.d.ts   |  367 ----------------------
 nginx/ts/ngx_stream_js_module.d.ts |  148 ---------
 src/ts/crypto.d.ts                 |   76 ----
 src/ts/fs.d.ts                     |  384 -----------------------
 src/ts/njs_core.d.ts               |  608 -------------------------------------
 src/ts/njs_shell.d.ts              |    9 -
 src/ts/querystring.d.ts            |  101 ------
 ts/ngx_http_js_module.d.ts         |  367 ++++++++++++++++++++++
 ts/ngx_stream_js_module.d.ts       |  148 +++++++++
 ts/njs_core.d.ts                   |  608 +++++++++++++++++++++++++++++++++++++
 ts/njs_modules/crypto.d.ts         |   76 ++++
 ts/njs_modules/fs.d.ts             |  384 +++++++++++++++++++++++
 ts/njs_modules/querystring.d.ts    |  101 ++++++
 ts/njs_shell.d.ts                  |    9 +
 15 files changed, 1697 insertions(+), 1696 deletions(-)

diffs (truncated from 3460 to 1000 lines):

diff -r 3e0684a2e793 -r 1ddcc8b77dab auto/make
--- a/auto/make	Thu Oct 22 22:45:00 2020 +0200
+++ b/auto/make	Mon Oct 19 23:51:54 2020 +0200
@@ -234,10 +234,11 @@ benchmark: $NJS_BUILD_DIR/njs_auto_confi
 
 	$NJS_BUILD_DIR/njs_benchmark
 
+.PHONY: ts
 ts:
-	mkdir -p $NJS_BUILD_DIR/ts
-	cp nginx/ts/*.ts $NJS_BUILD_DIR/ts/
-	cp src/ts/*.ts $NJS_BUILD_DIR/ts/
+	mkdir -p $NJS_BUILD_DIR/ts/njs_modules
+	cp ts/*.d.ts $NJS_BUILD_DIR/ts/
+	cp ts/njs_modules/* $NJS_BUILD_DIR/ts/njs_modules/
 
 ts_test: ts
 	tsc ./test/ts/test.ts
diff -r 3e0684a2e793 -r 1ddcc8b77dab nginx/ts/ngx_http_js_module.d.ts
--- a/nginx/ts/ngx_http_js_module.d.ts	Thu Oct 22 22:45:00 2020 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,367 +0,0 @@
-/// <reference path="njs_core.d.ts" />
-
-interface NginxHTTPArgs {
-    readonly [prop: string]: NjsByteString;
-}
-
-interface NginxHeadersIn {
-    // common request headers
-    readonly 'Accept'?: NjsByteString;
-    readonly 'Accept-Charset'?: NjsByteString;
-    readonly 'Accept-Encoding'?: NjsByteString;
-    readonly 'Accept-Language'?: NjsByteString;
-    readonly 'Authorization'?: NjsByteString;
-    readonly 'Cache-Control'?: NjsByteString;
-    readonly 'Connection'?: NjsByteString;
-    readonly 'Content-Length'?: NjsByteString;
-    readonly 'Content-Type'?: NjsByteString;
-    readonly 'Cookie'?: NjsByteString;
-    readonly 'Date'?: NjsByteString;
-    readonly 'Expect'?: NjsByteString;
-    readonly 'Forwarded'?: NjsByteString;
-    readonly 'From'?: NjsByteString;
-    readonly 'Host'?: NjsByteString;
-    readonly 'If-Match'?: NjsByteString;
-    readonly 'If-Modified-Since'?: NjsByteString;
-    readonly 'If-None-Match'?: NjsByteString;
-    readonly 'If-Range'?: NjsByteString;
-    readonly 'If-Unmodified-Since'?: NjsByteString;
-    readonly 'Max-Forwards'?: NjsByteString;
-    readonly 'Origin'?: NjsByteString;
-    readonly 'Pragma'?: NjsByteString;
-    readonly 'Proxy-Authorization'?: NjsByteString;
-    readonly 'Range'?: NjsByteString;
-    readonly 'Referer'?: NjsByteString;
-    readonly 'TE'?: NjsByteString;
-    readonly 'User-Agent'?: NjsByteString;
-    readonly 'Upgrade'?: NjsByteString;
-    readonly 'Via'?: NjsByteString;
-    readonly 'Warning'?: NjsByteString;
-    readonly 'X-Forwarded-For'?: NjsByteString;
-
-    readonly [prop: string]: NjsByteString;
-}
-
-interface NginxHeadersOut {
-    // common response headers
-    'Age'?: NjsStringLike;
-    'Allow'?: NjsStringLike;
-    'Alt-Svc'?: NjsStringLike;
-    'Cache-Control'?: NjsStringLike;
-    'Connection'?: NjsStringLike;
-    'Content-Disposition'?: NjsStringLike;
-    'Content-Encoding'?: NjsStringLike;
-    'Content-Language'?: NjsStringLike;
-    'Content-Length'?: NjsStringLike;
-    'Content-Location'?: NjsStringLike;
-    'Content-Range'?: NjsStringLike;
-    'Content-Type'?: NjsStringLike;
-    'Date'?: NjsStringLike;
-    'ETag'?: NjsStringLike;
-    'Expires'?: NjsStringLike;
-    'Last-Modified'?: NjsStringLike;
-    'Link'?: NjsStringLike;
-    'Location'?: NjsStringLike;
-    'Pragma'?: NjsStringLike;
-    'Proxy-Authenticate'?: NjsStringLike;
-    'Retry-After'?: NjsStringLike;
-    'Server'?: NjsStringLike;
-    'Trailer'?: NjsStringLike;
-    'Transfer-Encoding'?: NjsStringLike;
-    'Upgrade'?: NjsStringLike;
-    'Vary'?: NjsStringLike;
-    'Via'?: NjsStringLike;
-    'Warning'?: NjsStringLike;
-    'WWW-Authenticate'?: NjsStringLike;
-
-    'Set-Cookie'?: NjsStringLike[];
-
-    [prop: string]: NjsStringLike | NjsStringLike[];
-}
-
-interface NginxVariables {
-    readonly 'ancient_browser'?: NjsByteString;
-    readonly 'arg_'?: NjsByteString;
-    readonly 'args'?: NjsByteString;
-    readonly 'binary_remote_addr'?: NjsByteString;
-    readonly 'body_bytes_sent'?: NjsByteString;
-    readonly 'bytes_received'?: NjsByteString;
-    readonly 'bytes_sent'?: NjsByteString;
-    readonly 'connection'?: NjsByteString;
-    readonly 'connection_requests'?: NjsByteString;
-    readonly 'connections_active'?: NjsByteString;
-    readonly 'connections_reading'?: NjsByteString;
-    readonly 'connections_waiting'?: NjsByteString;
-    readonly 'connections_writing'?: NjsByteString;
-    readonly 'content_length'?: NjsByteString;
-    readonly 'content_type'?: NjsByteString;
-    readonly 'cookie_'?: NjsByteString;
-    readonly 'date_gmt'?: NjsByteString;
-    readonly 'date_local'?: NjsByteString;
-    readonly 'document_root'?: NjsByteString;
-    readonly 'document_uri'?: NjsByteString;
-    readonly 'fastcgi_path_info'?: NjsByteString;
-    readonly 'fastcgi_script_name'?: NjsByteString;
-    readonly 'geoip_area_code'?: NjsByteString;
-    readonly 'geoip_city'?: NjsByteString;
-    readonly 'geoip_city_continent_code'?: NjsByteString;
-    readonly 'geoip_city_country_code'?: NjsByteString;
-    readonly 'geoip_city_country_code3'?: NjsByteString;
-    readonly 'geoip_city_country_name'?: NjsByteString;
-    readonly 'geoip_country_code'?: NjsByteString;
-    readonly 'geoip_country_code3'?: NjsByteString;
-    readonly 'geoip_country_name'?: NjsByteString;
-    readonly 'geoip_dma_code'?: NjsByteString;
-    readonly 'geoip_latitude'?: NjsByteString;
-    readonly 'geoip_longitude'?: NjsByteString;
-    readonly 'geoip_org'?: NjsByteString;
-    readonly 'geoip_postal_code'?: NjsByteString;
-    readonly 'geoip_region'?: NjsByteString;
-    readonly 'geoip_region_name'?: NjsByteString;
-    readonly 'gzip_ratio'?: NjsByteString;
-    readonly 'host'?: NjsByteString;
-    readonly 'hostname'?: NjsByteString;
-    readonly 'http2'?: NjsByteString;
-    readonly 'http_'?: NjsByteString;
-    readonly 'https'?: NjsByteString;
-    readonly 'invalid_referer'?: NjsByteString;
-    readonly 'is_args'?: NjsByteString;
-    readonly 'jwt_claim_'?: NjsByteString;
-    readonly 'jwt_header_'?: NjsByteString;
-    readonly 'limit_conn_status'?: NjsByteString;
-    readonly 'limit_rate'?: NjsByteString;
-    readonly 'limit_req_status'?: NjsByteString;
-    readonly 'memcached_key'?: NjsByteString;
-    readonly 'modern_browser'?: NjsByteString;
-    readonly 'msec'?: NjsByteString;
-    readonly 'msie'?: NjsByteString;
-    readonly 'nginx_version'?: NjsByteString;
-    readonly 'pid'?: NjsByteString;
-    readonly 'pipe'?: NjsByteString;
-    readonly 'protocol'?: NjsByteString;
-    readonly 'proxy_add_x_forwarded_for'?: NjsByteString;
-    readonly 'proxy_host'?: NjsByteString;
-    readonly 'proxy_port'?: NjsByteString;
-    readonly 'proxy_protocol_addr'?: NjsByteString;
-    readonly 'proxy_protocol_port'?: NjsByteString;
-    readonly 'proxy_protocol_server_addr'?: NjsByteString;
-    readonly 'proxy_protocol_server_port'?: NjsByteString;
-    readonly 'query_string'?: NjsByteString;
-    readonly 'realip_remote_addr'?: NjsByteString;
-    readonly 'realip_remote_port'?: NjsByteString;
-    readonly 'realpath_root'?: NjsByteString;
-    readonly 'remote_addr'?: NjsByteString;
-    readonly 'remote_port'?: NjsByteString;
-    readonly 'remote_user'?: NjsByteString;
-    readonly 'request'?: NjsByteString;
-    readonly 'request_body'?: NjsByteString;
-    readonly 'request_body_file'?: NjsByteString;
-    readonly 'request_completion'?: NjsByteString;
-    readonly 'request_filename'?: NjsByteString;
-    readonly 'request_id'?: NjsByteString;
-    readonly 'request_length'?: NjsByteString;
-    readonly 'request_method'?: NjsByteString;
-    readonly 'request_time'?: NjsByteString;
-    readonly 'request_uri'?: NjsByteString;
-    readonly 'scheme'?: NjsByteString;
-    readonly 'secure_link'?: NjsByteString;
-    readonly 'secure_link_expires'?: NjsByteString;
-    readonly 'sent_http_'?: NjsByteString;
-    readonly 'sent_trailer_'?: NjsByteString;
-    readonly 'server_addr'?: NjsByteString;
-    readonly 'server_name'?: NjsByteString;
-    readonly 'server_port'?: NjsByteString;
-    readonly 'server_protocol'?: NjsByteString;
-    readonly 'session_log_binary_id'?: NjsByteString;
-    readonly 'session_log_id'?: NjsByteString;
-    readonly 'session_time'?: NjsByteString;
-    readonly 'slice_range'?: NjsByteString;
-    readonly 'spdy'?: NjsByteString;
-    readonly 'spdy_request_priority'?: NjsByteString;
-    readonly 'ssl_cipher'?: NjsByteString;
-    readonly 'ssl_ciphers'?: NjsByteString;
-    readonly 'ssl_client_cert'?: NjsByteString;
-    readonly 'ssl_client_escaped_cert'?: NjsByteString;
-    readonly 'ssl_client_fingerprint'?: NjsByteString;
-    readonly 'ssl_client_i_dn'?: NjsByteString;
-    readonly 'ssl_client_i_dn_legacy'?: NjsByteString;
-    readonly 'ssl_client_raw_cert'?: NjsByteString;
-    readonly 'ssl_client_s_dn'?: NjsByteString;
-    readonly 'ssl_client_s_dn_legacy'?: NjsByteString;
-    readonly 'ssl_client_serial'?: NjsByteString;
-    readonly 'ssl_client_v_end'?: NjsByteString;
-    readonly 'ssl_client_v_remain'?: NjsByteString;
-    readonly 'ssl_client_v_start'?: NjsByteString;
-    readonly 'ssl_client_verify'?: NjsByteString;
-    readonly 'ssl_curves'?: NjsByteString;
-    readonly 'ssl_early_data'?: NjsByteString;
-    readonly 'ssl_preread_alpn_protocols'?: NjsByteString;
-    readonly 'ssl_preread_protocol'?: NjsByteString;
-    readonly 'ssl_preread_server_name'?: NjsByteString;
-    readonly 'ssl_protocol'?: NjsByteString;
-    readonly 'ssl_server_name'?: NjsByteString;
-    readonly 'ssl_session_id'?: NjsByteString;
-    readonly 'ssl_session_reused'?: NjsByteString;
-    readonly 'status'?: NjsByteString;
-    readonly 'tcpinfo_rtt'?: NjsByteString;
-    readonly 'tcpinfo_rttvar'?: NjsByteString;
-    readonly 'tcpinfo_snd_cwnd'?: NjsByteString;
-    readonly 'tcpinfo_rcv_space'?: NjsByteString;
-    readonly 'time_iso8601'?: NjsByteString;
-    readonly 'time_local'?: NjsByteString;
-    readonly 'uid_got'?: NjsByteString;
-    readonly 'uid_reset'?: NjsByteString;
-    readonly 'uid_set'?: NjsByteString;
-    readonly 'upstream_addr'?: NjsByteString;
-    readonly 'upstream_bytes_received'?: NjsByteString;
-    readonly 'upstream_bytes_sent'?: NjsByteString;
-    readonly 'upstream_cache_status'?: NjsByteString;
-    readonly 'upstream_connect_time'?: NjsByteString;
-    readonly 'upstream_cookie_'?: NjsByteString;
-    readonly 'upstream_first_byte_time'?: NjsByteString;
-    readonly 'upstream_header_time'?: NjsByteString;
-    readonly 'upstream_http_'?: NjsByteString;
-    readonly 'upstream_queue_time'?: NjsByteString;
-    readonly 'upstream_response_length'?: NjsByteString;
-    readonly 'upstream_response_time'?: NjsByteString;
-    readonly 'upstream_session_time'?: NjsByteString;
-    readonly 'upstream_status'?: NjsByteString;
-    readonly 'upstream_trailer_'?: NjsByteString;
-    readonly 'uri'?: NjsByteString;
-
-    [prop: string]: NjsStringLike;
-}
-
-interface NginxSubrequestOptions {
-    /**
-     * Arguments string, by default an empty string is used.
-     */
-    args?: NjsStringLike,
-    /**
-     * Request body, by default the request body of the parent request object is used.
-     */
-    body?: NjsStringLike,
-    /**
-     * HTTP method, by default the GET method is used.
-     */
-    method?: "GET" | "POST" | "OPTIONS" | "HEAD" | "PROPFIND" | "PUT"
-        | "MKCOL" | "DELETE" | "COPY" | "MOVE" | "PROPPATCH"
-        | "LOCK" | "PATCH" | "TRACE",
-    /**
-     * if true, the created subrequest is a detached subrequest.
-     * Responses to detached subrequests are ignored.
-     */
-    detached?: boolean
-}
-
-interface NginxHTTPRequest {
-    /**
-     * Request arguments object.
-     */
-    readonly args: NginxHTTPArgs;
-    /**
-     * Writes a string to the error log on the error level of logging.
-     * @param message Message to log.
-     */
-    error(message: NjsStringLike): void;
-    /**
-     * Finishes sending a response to the client.
-     */
-    finish(): void;
-    /**
-     * Incoming headers object.
-     */
-    readonly headersIn: NginxHeadersIn;
-    /**
-     * Outgoing headers object.
-     */
-    readonly headersOut: NginxHeadersOut;
-    /**
-     * HTTP protocol version.
-     */
-    readonly httpVersion: NjsByteString;
-    /**
-     * Performs an internal redirect to the specified uri.
-     * If the uri starts with the “@” prefix, it is considered a named location.
-     * The actual redirect happens after the handler execution is completed.
-     * @param uri Location to redirect to.
-     */
-    internalRedirect(uri: NjsStringLike): void;
-    /**
-     * Writes a string to the error log on the info level of logging.
-     * @param message Message to log.
-     */
-    log(message: NjsStringLike): void;
-    /**
-     * HTTP method.
-     */
-    readonly method: NjsByteString;
-    /**
-     * Parent for subrequest object.
-     */
-    readonly parent?: NginxHTTPRequest;
-    /**
-     * Client address.
-     */
-    readonly remoteAddress: NjsByteString;
-    /**
-     * Client request body if it has not been written to a temporary file.
-     * To ensure that the client request body is in memory, its size should be
-     * limited by client_max_body_size, and a sufficient buffer size should be set
-     * using client_body_buffer_size. The property is available only in the js_content directive.
-     */
-    readonly requestBody?: NjsByteString;
-    /**
-     * Subrequest response body. The size of response body is limited by
-     * the subrequest_output_buffer_size directive.
-     */
-    readonly responseBody?: NjsByteString;
-    /**
-     * Sends the entire response with the specified status to the client.
-     * It is possible to specify either a redirect URL (for codes 301, 302, 303, 307, and 308)
-     * or the response body text (for other codes) as the second argument.
-     * @param status Respose status code.
-     * @param body Respose body.
-     */
-    return(status: number, body?: NjsStringLike): void;
-    /**
-     * Sends the HTTP headers to the client.
-     */
-    send(part: NjsStringLike): void;
-    /**
-     * Sends the HTTP headers to the client.
-     */
-    sendHeader(): void;
-    /**
-     * Respose status code.
-     */
-    status: number;
-    /**
-     * Creates a subrequest with the given uri and options.
-     * A subrequest shares its input headers with the client request.
-     * To send headers different from original headers to a proxied server,
-     * the proxy_set_header directive can be used. To send a completely new
-     * set of headers to a proxied server, the proxy_pass_request_headers directive can be used.
-     * @param uri Subrequest location.
-     * @param options Subrequest options.
-     * @param callback Completion callback.
-     */
-    subrequest(uri: NjsStringLike, options?: NginxSubrequestOptions | string): Promise<NginxHTTPRequest>;
-    subrequest(uri: NjsStringLike, options: NginxSubrequestOptions | string,
-               callback:(reply:NginxHTTPRequest) => void): void;
-    subrequest(uri: NjsStringLike, callback:(reply:NginxHTTPRequest) => void): void;
-    subrequest(uri: NjsStringLike, options: NginxSubrequestOptions & { detached: true }): void;
-    /**
-     * Current URI in request, normalized.
-     */
-    readonly uri: NjsByteString;
-    /**
-     * nginx variables object.
-     */
-    readonly variables: NginxVariables;
-    /**
-     * Writes a string to the error log on the warn level of logging.
-     * @param message Message to log.
-     */
-    warn(message: NjsStringLike): void;
-}
diff -r 3e0684a2e793 -r 1ddcc8b77dab nginx/ts/ngx_stream_js_module.d.ts
--- a/nginx/ts/ngx_stream_js_module.d.ts	Thu Oct 22 22:45:00 2020 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,148 +0,0 @@
-/// <reference path="njs_core.d.ts" />
-
-interface NginxStreamVariables {
-    readonly 'binary_remote_addr'?: NjsByteString;
-    readonly 'bytes_received'?: NjsByteString;
-    readonly 'bytes_sent'?: NjsByteString;
-    readonly 'connection'?: NjsByteString;
-    readonly 'geoip_area_code'?: NjsByteString;
-    readonly 'geoip_city'?: NjsByteString;
-    readonly 'geoip_city_continent_code'?: NjsByteString;
-    readonly 'geoip_city_country_code'?: NjsByteString;
-    readonly 'geoip_city_country_code3'?: NjsByteString;
-    readonly 'geoip_city_country_name'?: NjsByteString;
-    readonly 'geoip_country_code'?: NjsByteString;
-    readonly 'geoip_country_code3'?: NjsByteString;
-    readonly 'geoip_country_name'?: NjsByteString;
-    readonly 'geoip_dma_code'?: NjsByteString;
-    readonly 'geoip_latitude'?: NjsByteString;
-    readonly 'geoip_longitude'?: NjsByteString;
-    readonly 'geoip_org'?: NjsByteString;
-    readonly 'geoip_postal_code'?: NjsByteString;
-    readonly 'geoip_region'?: NjsByteString;
-    readonly 'geoip_region_name'?: NjsByteString;
-    readonly 'hostname'?: NjsByteString;
-    readonly 'limit_conn_status'?: NjsByteString;
-    readonly 'msec'?: NjsByteString;
-    readonly 'nginx_version'?: NjsByteString;
-    readonly 'pid'?: NjsByteString;
-    readonly 'proxy_add_x_forwarded_for'?: NjsByteString;
-    readonly 'proxy_host'?: NjsByteString;
-    readonly 'proxy_port'?: NjsByteString;
-    readonly 'proxy_protocol_addr'?: NjsByteString;
-    readonly 'proxy_protocol_port'?: NjsByteString;
-    readonly 'proxy_protocol_server_addr'?: NjsByteString;
-    readonly 'proxy_protocol_server_port'?: NjsByteString;
-    readonly 'realip_remote_addr'?: NjsByteString;
-    readonly 'realip_remote_port'?: NjsByteString;
-    readonly 'remote_addr'?: NjsByteString;
-    readonly 'remote_port'?: NjsByteString;
-    readonly 'server_addr'?: NjsByteString;
-    readonly 'server_port'?: NjsByteString;
-    readonly 'ssl_cipher'?: NjsByteString;
-    readonly 'ssl_ciphers'?: NjsByteString;
-    readonly 'ssl_client_cert'?: NjsByteString;
-    readonly 'ssl_client_escaped_cert'?: NjsByteString;
-    readonly 'ssl_client_fingerprint'?: NjsByteString;
-    readonly 'ssl_client_i_dn'?: NjsByteString;
-    readonly 'ssl_client_raw_cert'?: NjsByteString;
-    readonly 'ssl_client_s_dn'?: NjsByteString;
-    readonly 'ssl_client_s_dn_legacy'?: NjsByteString;
-    readonly 'ssl_client_serial'?: NjsByteString;
-    readonly 'ssl_client_v_end'?: NjsByteString;
-    readonly 'ssl_client_v_remain'?: NjsByteString;
-    readonly 'ssl_client_v_start'?: NjsByteString;
-    readonly 'ssl_client_verify'?: NjsByteString;
-    readonly 'ssl_curves'?: NjsByteString;
-    readonly 'ssl_early_data'?: NjsByteString;
-    readonly 'ssl_preread_alpn_protocols'?: NjsByteString;
-    readonly 'ssl_preread_protocol'?: NjsByteString;
-    readonly 'ssl_preread_server_name'?: NjsByteString;
-    readonly 'ssl_protocol'?: NjsByteString;
-    readonly 'ssl_server_name'?: NjsByteString;
-    readonly 'ssl_session_id'?: NjsByteString;
-    readonly 'ssl_session_reused'?: NjsByteString;
-    readonly 'status'?: NjsByteString;
-    readonly 'time_iso8601'?: NjsByteString;
-    readonly 'time_local'?: NjsByteString;
-
-    [prop: string]: NjsByteString;
-}
-
-interface NginxStreamCallbackFlags {
-    /**
-     * True if data is a last buffer.
-     */
-    last: boolean
-}
-
-interface NginxStreamSendOptions {
-    /**
-     * True if data is a last buffer.
-     */
-    last?: boolean
-    /**
-     * True if the buffer should have the flush flag.
-     */
-    flush?: boolean
-}
-
-interface NginxStreamRequest {
-    /**
-     * Successfully finalizes the phase handler.
-     */
-    allow(): void;
-    /**
-     * Finalizes the phase handler and passes control to the next handler.
-     */
-    decline(): void;
-    /**
-     * Finalizes the phase handler with the access error code.
-     */
-    deny(): void;
-    /**
-     * Successfully finalizes the current phase handler
-     * or finalizes it with the specified numeric code.
-     * @param code Finalization code.
-     */
-    done(code?: number): void;
-    /**
-     * Writes a string to the error log on the error level of logging.
-     * @param message Message to log.
-     */
-    error(message: NjsStringLike): void;
-    /**
-     * Writes a string to the error log on the info level of logging.
-     * @param message Message to log.
-     */
-    log(message: NjsStringLike): void;
-    /**
-     * Unregisters the callback set by on() method.
-     */
-    off(event: "upload" | "download"): void;
-    /**
-     * Registers a callback for the specified event.
-     */
-    on(event: "upload" | "download",
-       callback:(data:NjsByteString,  flags: NginxStreamCallbackFlags) => void): void;
-    /**
-     * Client address.
-     */
-    readonly remoteAddress: NjsByteString;
-    /**
-     * Sends the data to the client.
-     * @param data Data to send.
-     * @param options Object used to override nginx buffer flags derived from
-     * an incoming data chunk buffer.
-     */
-    send(data: NjsStringLike, options?: NginxStreamSendOptions): void;
-    /**
-     * nginx variables object.
-     */
-    readonly variables: NginxStreamVariables;
-    /**
-     * Writes a string to the error log on the warn level of logging.
-     * @param message Message to log.
-     */
-    warn(message: NjsStringLike): void;
-}
diff -r 3e0684a2e793 -r 1ddcc8b77dab src/ts/crypto.d.ts
--- a/src/ts/crypto.d.ts	Thu Oct 22 22:45:00 2020 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,76 +0,0 @@
-/// <reference path="njs_core.d.ts" />
-
-declare module "crypto" {
-
-    export type Algorithm = "md5" | "sha1" | "sha256";
-
-    export type DigestEncoding = Exclude<BufferEncoding, "utf8">;
-
-    export interface Hash {
-        /**
-         * Updates the hash content with the given `data` and returns self.
-         */
-        update(data: NjsStringLike | Buffer | DataView | TypedArray): Hash;
-
-        /**
-         * Calculates the digest of all of the data passed using `hash.update()`.
-         *
-         * @example
-         *   import cr from 'crypto'
-         *   cr.createHash('sha1').update('A').update('B').digest('base64url')  // => 'BtlFlCqiamG-GMPiK_GbvKjdK10'
-         *
-         * @param encoding The encoding of the return value. If not provided, a `Buffer` object
-         *   (or a byte string before version 0.4.4) is returned.
-         * @return A calculated digest.
-         */
-        digest(): Buffer;
-        digest(encoding: DigestEncoding): string;
-    }
-
-    export interface Hmac {
-        /**
-         * Updates the HMAC content with the given `data` and returns self.
-         */
-        update(data: NjsStringLike | Buffer | DataView | TypedArray): Hmac;
-
-        /**
-         * Calculates the HMAC digest of all of the data passed using `hmac.update()`.
-         *
-         * @example
-         *   import cr from 'crypto'
-         *   cr.createHmac('sha1', 'secret.key').update('AB').digest('base64url')  // => 'Oglm93xn23_MkiaEq_e9u8zk374'
-         *
-         * @param encoding The encoding of the return value. If not provided, a `Buffer` object
-         *   (or a byte string before version 0.4.4) is returned.
-         * @return The calculated HMAC digest.
-         */
-        digest(): Buffer;
-        digest(encoding: DigestEncoding): string;
-    }
-
-    interface Crypto {
-        /**
-         * Creates and returns a `Hash` object that can be used to generate hash digests using
-         * the given `algorithm`.
-         *
-         * @param algorithm `'md5'`, `'sha1'`, or `'sha256'`
-         * @returns A `Hash` object.
-         */
-        createHash(algorithm: Algorithm): Hash;
-
-        /**
-         * Creates and returns an HMAC object that uses the given `algorithm` and secret `key`.
-         *
-         * @param algorithm `'md5'`, `'sha1'`, or `'sha256'`
-         * @param key The secret key.
-         * @returns An `HMAC` object.
-         */
-        createHmac(algorithm: Algorithm, key: NjsStringLike): Hmac;
-    }
-
-    const crypto: Crypto;
-
-    // It's exported like this because njs doesn't support named imports.
-    // TODO: Replace NjsFS with individual named exports as soon as njs supports named imports.
-    export default crypto;
-}
diff -r 3e0684a2e793 -r 1ddcc8b77dab src/ts/fs.d.ts
--- a/src/ts/fs.d.ts	Thu Oct 22 22:45:00 2020 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,384 +0,0 @@
-/// <reference path="njs_core.d.ts" />
-
-declare module "fs" {
-
-    /**
-     * File system flag that controls opening of a file.
-     *
-     * - `'a'`   - Open a file for appending. The file is created if it does not exist.
-     * - `'ax'`  - The same as `'a'` but fails if the file already exists.
-     * - `'a+'`  - Open a file for reading and appending. If the file does not exist, it will be created.
-     * - `'ax+'` - The same as `'a+'` but fails if the file already exists.
-     * - `'as'`  - Open a file for appending in synchronous mode. If the file does not exist, it will be created.
-     * - `'as+'` - Open a file for reading and appending in synchronous mode. If the file does not exist, it will be created.
-     * - `'r'`   - Open a file for reading. An exception occurs if the file does not exist.
-     * - `'r+'`  - Open a file for reading and writing. An exception occurs if the file does not exist.
-     * - `'rs+'` - Open a file for reading and writing in synchronous mode. Instructs the operating system to bypass the local file system cache.
-     * - `'w'`   - Open a file for writing. If the file does not exist, it will be created. If the file exists, it will be replaced.
-     * - `'wx'`  - The same as `'w'` but fails if the file already exists.
-     * - `'w+'`  - Open a file for reading and writing. If the file does not exist, it will be created. If the file exists, it will be replaced.
-     * - `'wx+'` - The same as `'w+'` but fails if the file already exists.
-     */
-    export type OpenMode = "a" | "ax" | "a+" | "ax+" | "as" | "as+" | "r" | "r+" | "rs+" | "w" | "wx" | "w+" | "wx+";
-
-    export type FileEncoding = BufferEncoding;
-
-    /**
-     * Valid types for path values in "fs".
-     */
-    export type PathLike = string | Buffer;
-
-    /**
-     * A representation of a directory entry - a file or a subdirectory.
-     *
-     * When `readdirSync()` is called with the `withFileTypes` option, the resulting array contains
-     * `fs.Dirent` objects.
-     */
-    export interface Dirent {
-        /**
-         * @returns `true` if the object describes a block device.
-         */
-        isBlockDevice(): boolean;
-        /**
-         * @returns `true` if the object describes a character device.
-         */
-        isCharacterDevice(): boolean;
-        /**
-         * @returns `true` if the object describes a file system directory.
-         */
-        isDirectory(): boolean;
-        /**
-         * @returns `true` if the object describes a first-in-first-out (FIFO) pipe.
-         */
-        isFIFO(): boolean;
-        /**
-         * @returns `true` if the object describes a regular file.
-         */
-        isFile(): boolean;
-        /**
-         * @returns `true` if the object describes a socket.
-         */
-        isSocket(): boolean;
-        /**
-         * @returns `true` if the object describes a symbolic link.
-         */
-        isSymbolicLink(): boolean;
-
-        /**
-         * The name of the file this object refers to.
-         */
-        name: string;
-    }
-
-    type WriteFileOptions = {
-        mode?: number;
-        flag?: OpenMode;
-    };
-
-    type Constants = {
-        /**
-         * Indicates that the file is visible to the calling process, used by default if no mode
-         * is specified.
-         */
-        F_OK: 0;
-        /**
-         * Indicates that the file can be read by the calling process.
-         */
-        R_OK: 4;
-        /**
-         * Indicates that the file can be written by the calling process.
-         */
-        W_OK: 2;
-        /**
-         * Indicates that the file can be executed by the calling process.
-         */
-        X_OK: 1;
-    };
-
-    interface Promises {
-        /**
-         * Asynchronously tests permissions for a file or directory specified in the `path`.
-         * If the check fails, an error will be returned, otherwise, the method will return undefined.
-         *
-         * @example
-         *   import fs from 'fs'
-         *   fs.promises.access('/file/path', fs.constants.R_OK | fs.constants.W_OK)
-         *     .then(() => console.log('has access'))
-         *     .catch(() => console.log('no access'))
-         *
-         * @since 0.3.9
-         * @param path A path to a file or directory.
-         * @param mode An optional integer that specifies the accessibility checks to be performed.
-         *   Defaults to `fs.constants.F_OK`.
-         */
-        access(path: PathLike, mode?: number): Promise<void>;
-
-        /**
-         * Asynchronously appends specified `data` to a file with provided `filename`.
-         * If the file does not exist, it will be created.
-         *
-         * @since 0.4.4
-         * @param path A path to a file.
-         * @param data The data to write.
-         * @param options An object optionally specifying the file mode and flag.
-         *   If `mode` is not supplied, the default of `0o666` is used.
-         *   If `flag` is not supplied, the default of `'a'` is used.
-         */
-        appendFile(path: PathLike, data: NjsStringLike | Buffer, options?: WriteFileOptions): Promise<void>;
-
-        /**
-         * Asynchronously creates a directory at the specified `path`.
-         *
-         * @since 0.4.2
-         * @param path A path to a file.
-         * @param options The file mode (or an object specifying the file mode). Defaults to `0o777`.
-         */
-        mkdir(path: PathLike, options?: { mode?: number } | number): Promise<void>;
-
-        /**
-         * Asynchronously reads the contents of a directory at the specified `path`.
-         *
-         * @since 0.4.2
-         * @param path A path to a file.
-         * @param options A string that specifies encoding or an object optionally specifying
-         *   the following keys:
-         *   - `encoding` - `'utf8'` (default) or `'buffer'` (since 0.4.4)
-         *   - `withFileTypes` - if set to `true`, the files array will contain `fs.Dirent` objects; defaults to `false`.
-         */
-        readdir(path: PathLike, options?: { encoding?: "utf8"; withFileTypes?: false; } | "utf8"): Promise<string[]>;
-        readdir(path: PathLike, options: { encoding: "buffer"; withFileTypes?: false; } | "buffer"): Promise<Buffer[]>;
-        readdir(path: PathLike, options: { encoding?: "utf8" | "buffer"; withFileTypes: true; }): Promise<Dirent[]>;
-
-        /**
-         * Asynchronously returns the contents of the file with provided `filename`.
-         * If an encoding is specified, a `string` is returned, otherwise, a `Buffer`.
-         *
-         * @param path A path to a file.
-         * @param options A string that specifies encoding or an object with the following optional keys:
-         *   - `encoding` - `'utf8'`, `'hex'`, `'base64'`, or `'base64url'` (the last three since 0.4.4).
-         *   - `flag` - file system flag, defaults to `r`.
-         */
-        readFile(path: PathLike): Promise<Buffer>;
-        readFile(path: PathLike, options?: { flag?: OpenMode; }): Promise<Buffer>;
-        readFile(path: PathLike, options: { encoding?: FileEncoding; flag?: OpenMode; } | FileEncoding): Promise<string>;
-
-        /**
-         * Asynchronously computes the canonical pathname by resolving `.`, `..` and symbolic links using
-         * `realpath(3)`.
-         *
-         * @since 0.3.9
-         * @param path A path to a file.
-         * @param options The encoding (or an object specifying the encoding), used as the encoding of the result.
-         */
-        realpath(path: PathLike, options?: { encoding?: "utf8" } | "utf8"): Promise<string>;
-        realpath(path: PathLike, options: { encoding: "buffer" } | "buffer"): Promise<Buffer>;
-
-        /**
-         * Asynchronously changes the name or location of a file from `oldPath` to `newPath`.
-         *
-         * @since 0.3.4
-         * @param oldPath A path to a file.
-         * @param newPath A path to a file.
-         */
-        rename(oldPath: PathLike, newPath: PathLike): Promise<void>;
-
-        /**
-         * Asynchronously removes a directory at the specified `path`.
-         *
-         * @since 0.4.2
-         * @param path A path to a file.
-         */
-        rmdir(path: PathLike): Promise<void>;
-
-        /**
-         * Asynchronously creates the link called `path` pointing to `target` using `symlink(2)`.
-         * Relative targets are relative to the link’s parent directory.
-         *
-         * @since 0.3.9
-         * @param target A path to an existing file.
-         * @param path A path to the new symlink.
-         */
-        symlink(target: PathLike, path: PathLike): Promise<void>;
-
-        /**
-         * Asynchronously unlinks a file by `path`.
-         *
-         * @since 0.3.9
-         * @param path A path to a file.
-         */
-        unlink(path: PathLike): Promise<void>;
-
-        /**
-         * Asynchronously writes `data` to a file with provided `filename`. If the file does not
-         * exist, it will be created, if the file exists, it will be replaced.
-         *
-         * @since 0.4.4
-         * @param path A path to a file.
-         * @param data The data to write.
-         * @param options An object optionally specifying the file mode and flag.
-         *   If `mode` is not supplied, the default of `0o666` is used.
-         *   If `flag` is not supplied, the default of `'w'` is used.
-         */
-        writeFile(path: PathLike, data: NjsStringLike | Buffer, options?: WriteFileOptions): Promise<void>;
-    }
-
-    interface NjsFS {
-        /**
-         * Promissified versions of file system methods.
-         *
-         * @since 0.3.9
-         */
-        promises: Promises
-        /**
-         * File Access Constants
-         */
-        constants: Constants
-
-        /**
-         * Synchronously tests permissions for a file or directory specified in the `path`.
-         * If the check fails, an error will be returned, otherwise, the method will return undefined.
-         *
-         * @example
-         *   try {
-         *     fs.accessSync('/file/path', fs.constants.R_OK | fs.constants.W_OK);
-         *     console.log('has access');
-         *   } catch (e) {
-         *     console.log('no access');
-         *   }
-         *
-         * @since 0.3.9
-         * @param path A path to a file or directory.
-         * @param mode An optional integer that specifies the accessibility checks to be performed.
-         *   Defaults to `fs.constants.F_OK`.
-         */
-        accessSync(path: PathLike, mode?: number): void;
-
-        /**
-         * Synchronously appends specified `data` to a file with provided `filename`.
-         * If the file does not exist, it will be created.
-         *
-         * @since 0.4.4
-         * @param path A path to a file.
-         * @param data The data to write.
-         * @param options An object optionally specifying the file mode and flag.
-         *   If `mode` is not supplied, the default of `0o666` is used.
-         *   If `flag` is not supplied, the default of `'a'` is used.
-         */
-        appendFileSync(path: PathLike, data: NjsStringLike | Buffer, options?: WriteFileOptions): void;
-
-        /**
-         * Synchronously creates a directory at the specified `path`.
-         *
-         * @since 0.4.2
-         * @param path A path to a file.
-         * @param options The file mode (or an object specifying the file mode). Defaults to `0o777`.
-         */
-        mkdirSync(path: PathLike, options?: { mode?: number } | number): void;
-
-        /**
-         * Synchronously reads the contents of a directory at the specified `path`.
-         *
-         * @since 0.4.2
-         * @param path A path to a file.
-         * @param options A string that specifies encoding or an object optionally specifying
-         *   the following keys:
-         *   - `encoding` - `'utf8'` (default) or `'buffer'` (since 0.4.4)
-         *   - `withFileTypes` - if set to `true`, the files array will contain `fs.Dirent` objects;
-         *     defaults to `false`.
-         */
-        readdirSync(path: PathLike, options?: { encoding?: "utf8"; withFileTypes?: false; } | "utf8"): string[];
-        readdirSync(path: PathLike, options: { encoding: "buffer"; withFileTypes?: false; } | "buffer"): Buffer[];
-        readdirSync(path: PathLike, options: { encoding?: "utf8" | "buffer"; withFileTypes: true; }): Dirent[];
-
-        /**
-         * Synchronously returns the contents of the file with provided `filename`.
-         * If an encoding is specified, a `string` is returned, otherwise, a `Buffer`.
-         *
-         * @example
-         *   import fs from 'fs'
-         *   var file = fs.readFileSync('/file/path.tar.gz')
-         *   var gzipped = file.slice(0,2).toString('hex') === '1f8b'; gzipped  // => true
-         *
-         * @param path A path to a file.
-         * @param options A string that specifies encoding or an object with the following optional keys:
-         *   - `encoding` - `'utf8'`, `'hex'`, `'base64'`, or `'base64url'` (the last three since 0.4.4).
-         *   - `flag` - file system flag, defaults to `r`.
-         */
-        readFileSync(path: PathLike): Buffer;
-        readFileSync(path: PathLike, options?: { flag?: OpenMode; }): Buffer;
-        readFileSync(path: PathLike, options: { encoding?: FileEncoding; flag?: OpenMode; } | FileEncoding): string;
-
-        /**
-         * Synchronously computes the canonical pathname by resolving `.`, `..` and symbolic links using
-         * `realpath(3)`.
-         *
-         * @since 0.3.9
-         * @param path A path to a file.
-         * @param options The encoding (or an object specifying the encoding), used as the encoding of the result.
-         */
-        realpathSync(path: PathLike, options?: { encoding?: "utf8" } | "utf8"): string;
-        realpathSync(path: PathLike, options: { encoding: "buffer" } | "buffer"): Buffer;
-
-        /**
-         * Synchronously changes the name or location of a file from `oldPath` to `newPath`.
-         *
-         * @example
-         *   import fs from 'fs'
-         *   var file = fs.renameSync('hello.txt', 'HelloWorld.txt')
-         *
-         * @since 0.3.4
-         * @param oldPath A path to a file.
-         * @param newPath A path to a file.
-         */
-        renameSync(oldPath: PathLike, newPath: PathLike): void;
-
-        /**
-         * Synchronously removes a directory at the specified `path`.
-         *
-         * @since 0.4.2
-         * @param path A path to a file.
-         */
-        rmdirSync(path: PathLike): void;
-
-        /**
-         * Synchronously creates the link called `path` pointing to `target` using `symlink(2)`.
-         * Relative targets are relative to the link’s parent directory.
-         *
-         * @since 0.3.9
-         * @param target A path to an existing file.
-         * @param path A path to the new symlink.
-         */
-        symlinkSync(target: PathLike, path: PathLike): void;
-
-        /**
-         * Synchronously unlinks a file by `path`.
-         *
-         * @since 0.3.9
-         * @param path A path to a file.
-         */
-        unlinkSync(path: PathLike): void;
-
-        /**
-         * Synchronously writes `data` to a file with provided `filename`. If the file does not exist,
-         * it will be created, if the file exists, it will be replaced.
-         *
-         * @example
-         *   import fs from 'fs'
-         *   fs.writeFileSync('hello.txt', 'Hello world')
-         *
-         * @since 0.4.4
-         * @param path A path to a file.
-         * @param data The data to write.
-         * @param options An object optionally specifying the file mode and flag.
-         *   If `mode` is not supplied, the default of `0o666` is used.
-         *   If `flag` is not supplied, the default of `'w'` is used.
-         */


More information about the nginx-devel mailing list