@ngrok/ngrok 0.4.1 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/flake.nix CHANGED
@@ -93,7 +93,7 @@
93
93
  OPENSSL_LIB_DIR = "${pkgs.openssl.out}/lib";
94
94
  OPENSSL_INCLUDE_DIR = "${pkgs.openssl.dev}/include";
95
95
  shellHook = ''
96
- export PATH="$PATH:node_modules/.bin:`pwd`/node_modules/.bin"
96
+ export PATH="$PATH:$(git rev-parse --show-toplevel)/node_modules/.bin:$(git rev-parse --show-toplevel)/examples/node_modules/.bin"
97
97
  '';
98
98
  buildInputs = with pkgs; [
99
99
  toolchain
package/index.d.ts CHANGED
@@ -207,6 +207,18 @@ export class NgrokSessionBuilder {
207
207
  * NGROK_AUTHTOKEN environment variable.
208
208
  */
209
209
  authtokenFromEnv(): this
210
+ /**
211
+ * Add client type and version information for a client application.
212
+ *
213
+ * This is a way for applications and library consumers of this crate
214
+ * identify themselves.
215
+ *
216
+ * This will add a new entry to the `User-Agent` field in the "most significant"
217
+ * (first) position. Comments must follow [RFC 7230] or a connection error may occur.
218
+ *
219
+ * [RFC 7230]: https://datatracker.ietf.org/doc/html/rfc7230#section-3.2.6
220
+ */
221
+ clientInfo(clientType: string, version: string, comments?: string | undefined | null): this
210
222
  /**
211
223
  * Configures how often the session will send heartbeat messages to the ngrok
212
224
  * service to check session liveness.
@@ -552,4 +564,4 @@ export function listen(server: import("net").Server, tunnel?: NgrokTunnel): Ngro
552
564
  * Register a console.log callback for ngrok INFO logging.
553
565
  * Optionally set the logging level to one of ERROR, WARN, INFO, DEBUG, or TRACE.
554
566
  */
555
- export function consoleLog(level?: String);
567
+ export function consoleLog(level?: String): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ngrok/ngrok",
3
- "version": "0.4.1",
3
+ "version": "0.5.1",
4
4
  "main": "index.js",
5
5
  "types": "index.d.ts",
6
6
  "napi": {
@@ -53,20 +53,20 @@
53
53
  },
54
54
  "packageManager": "yarn@3.3.1",
55
55
  "description": "The ngrok agent in library form, suitable for integrating directly into your NodeJS application.",
56
- "repository": "https://github.com/ngrok/ngrok-js",
56
+ "repository": "https://github.com/ngrok/ngrok-nodejs",
57
57
  "optionalDependencies": {
58
- "@ngrok/ngrok-win32-x64-msvc": "0.4.1",
59
- "@ngrok/ngrok-darwin-x64": "0.4.1",
60
- "@ngrok/ngrok-linux-x64-gnu": "0.4.1",
61
- "@ngrok/ngrok-darwin-arm64": "0.4.1",
62
- "@ngrok/ngrok-android-arm64": "0.4.1",
63
- "@ngrok/ngrok-linux-arm64-gnu": "0.4.1",
64
- "@ngrok/ngrok-linux-arm64-musl": "0.4.1",
65
- "@ngrok/ngrok-linux-arm-gnueabihf": "0.4.1",
66
- "@ngrok/ngrok-linux-x64-musl": "0.4.1",
67
- "@ngrok/ngrok-freebsd-x64": "0.4.1",
68
- "@ngrok/ngrok-win32-ia32-msvc": "0.4.1",
69
- "@ngrok/ngrok-android-arm-eabi": "0.4.1",
70
- "@ngrok/ngrok-darwin-universal": "0.4.1"
58
+ "@ngrok/ngrok-win32-x64-msvc": "0.5.1",
59
+ "@ngrok/ngrok-darwin-x64": "0.5.1",
60
+ "@ngrok/ngrok-linux-x64-gnu": "0.5.1",
61
+ "@ngrok/ngrok-darwin-arm64": "0.5.1",
62
+ "@ngrok/ngrok-android-arm64": "0.5.1",
63
+ "@ngrok/ngrok-linux-arm64-gnu": "0.5.1",
64
+ "@ngrok/ngrok-linux-arm64-musl": "0.5.1",
65
+ "@ngrok/ngrok-linux-arm-gnueabihf": "0.5.1",
66
+ "@ngrok/ngrok-linux-x64-musl": "0.5.1",
67
+ "@ngrok/ngrok-freebsd-x64": "0.5.1",
68
+ "@ngrok/ngrok-win32-ia32-msvc": "0.5.1",
69
+ "@ngrok/ngrok-android-arm-eabi": "0.5.1",
70
+ "@ngrok/ngrok-darwin-universal": "0.5.1"
71
71
  }
72
72
  }
package/src/session.rs CHANGED
@@ -44,7 +44,7 @@ use crate::{
44
44
  },
45
45
  };
46
46
 
47
- const CLIENT_TYPE: &str = "library/official/nodejs";
47
+ const CLIENT_TYPE: &str = "ngrok-nodejs";
48
48
  const VERSION: &str = env!("CARGO_PKG_VERSION");
49
49
 
50
50
  // appease clippy
@@ -84,9 +84,11 @@ impl NgrokSessionBuilder {
84
84
  #[napi(constructor)]
85
85
  pub fn new() -> Self {
86
86
  NgrokSessionBuilder {
87
- raw_builder: Arc::new(SyncMutex::new(
88
- Session::builder().child_client(CLIENT_TYPE, VERSION),
89
- )),
87
+ raw_builder: Arc::new(SyncMutex::new(Session::builder().client_info(
88
+ CLIENT_TYPE,
89
+ VERSION,
90
+ None::<String>,
91
+ ))),
90
92
  ..Default::default()
91
93
  }
92
94
  }
@@ -118,6 +120,27 @@ impl NgrokSessionBuilder {
118
120
  self
119
121
  }
120
122
 
123
+ /// Add client type and version information for a client application.
124
+ ///
125
+ /// This is a way for applications and library consumers of this crate
126
+ /// identify themselves.
127
+ ///
128
+ /// This will add a new entry to the `User-Agent` field in the "most significant"
129
+ /// (first) position. Comments must follow [RFC 7230] or a connection error may occur.
130
+ ///
131
+ /// [RFC 7230]: https://datatracker.ietf.org/doc/html/rfc7230#section-3.2.6
132
+ #[napi]
133
+ pub fn client_info(
134
+ &mut self,
135
+ client_type: String,
136
+ version: String,
137
+ comments: Option<String>,
138
+ ) -> &Self {
139
+ let mut builder = self.raw_builder.lock();
140
+ *builder = builder.clone().client_info(client_type, version, comments);
141
+ self
142
+ }
143
+
121
144
  /// Configures how often the session will send heartbeat messages to the ngrok
122
145
  /// service to check session liveness.
123
146
  ///
package/trailer.d.ts CHANGED
@@ -12,4 +12,4 @@ export function listen(server: import("net").Server, tunnel?: NgrokTunnel): Ngro
12
12
  * Register a console.log callback for ngrok INFO logging.
13
13
  * Optionally set the logging level to one of ERROR, WARN, INFO, DEBUG, or TRACE.
14
14
  */
15
- export function consoleLog(level?: String);
15
+ export function consoleLog(level?: String): void;