@ngrok/ngrok 1.4.0 → 1.5.0

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/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## 1.5.0
2
+ Adds `poolingEnabled` to listener builders, allowing the endpoint to pool with other endpoints with the same host/port/binding
3
+
4
+ ## 1.4.1
5
+
6
+ - Fix `traffic_policy` naming for `ngrok.forward`
7
+
1
8
  ## 1.4.0
2
9
 
3
10
  - Rename `policy` to `traffic_policy`
package/README.md CHANGED
@@ -260,6 +260,7 @@ const listener = await ngrok.forward({
260
260
  oidc_allow_domains: ["<domain>"],
261
261
  oidc_allow_emails: ["<email>"],
262
262
  oidc_scopes: ["<scope>"],
263
+ pooling_enabled: false,
263
264
  traffic_policy: "<policy_json>",
264
265
  request_header_remove: ["X-Req-Nope"],
265
266
  response_header_remove: ["X-Res-Nope"],
@@ -318,8 +319,8 @@ Pre-built binaries are provided on NPM for the following platforms:
318
319
 
319
320
  | OS | i686 | x64 | aarch64 | arm |
320
321
  | ---------- | -----|-----|---------|-----|
321
- | Windows | ✓ | ✓ | * | |
322
- | MacOS | | ✓ | ✓ | |
322
+ | Windows | ✓ | ✓ | ✓ | |
323
+ | MacOS | | ✓ | ✓ | ✓ |
323
324
  | Linux | | ✓ | ✓ | ✓ |
324
325
  | Linux musl | | ✓ | ✓ | |
325
326
  | FreeBSD | | ✓ | | |
@@ -329,7 +330,8 @@ Pre-built binaries are provided on NPM for the following platforms:
329
330
  > `ngrok-javascript`, and [ngrok-rust](https://github.com/ngrok/ngrok-rust/) which it depends on, are open source, so it may be possible to build them for other platforms.
330
331
  >
331
332
  > On Windows, ensure you have [Microsoft Visual C++ Redistributable](https://learn.microsoft.com/en-us/cpp/windows/latest-supported-vc-redist?view=msvc-170#latest-microsoft-visual-c-redistributable-version) installed.
332
- > * `Windows-aarch64` will be supported after the next release of [Ring](https://github.com/briansmith/ring/issues/1167).
333
+ >
334
+ > We currently support MacOS 10.13+.
333
335
 
334
336
  # Dependencies
335
337
 
package/index.d.ts CHANGED
@@ -324,7 +324,7 @@ export interface Config {
324
324
  /** Unused, will warn and be ignored */
325
325
  terminate_at?: string
326
326
  /** The Traffic Policy to use for this endpoint. */
327
- trafficPolicy?: string
327
+ traffic_policy?: string
328
328
  /** Whether to disable certificate verification for this listener */
329
329
  verify_upstream_tls?: boolean
330
330
  /**
@@ -385,7 +385,7 @@ export declare function authtoken(authtoken: string): Promise<void>
385
385
  *
386
386
  * @group Listener and Sessions
387
387
  */
388
- export class Listener {
388
+ export declare class Listener {
389
389
  /** The URL that this listener backs. */
390
390
  url(): string | null
391
391
  /** The protocol of the endpoint that this listener backs. */
@@ -430,7 +430,7 @@ export class Listener {
430
430
  *r"
431
431
  *r" @group Listener Builders
432
432
  */
433
- export class HttpListenerBuilder {
433
+ export declare class HttpListenerBuilder {
434
434
  /**
435
435
  * The scheme that this edge should use.
436
436
  * "HTTPS" or "HTTP", defaults to "HTTPS".
@@ -537,6 +537,8 @@ export class HttpListenerBuilder {
537
537
  * [OpenID Connect]: https://ngrok.com/docs/cloud-edge/modules/openid-connect/
538
538
  */
539
539
  oidc(issuerUrl: string, clientId: string, clientSecret: string, allowEmails?: Array<string> | undefined | null, allowDomains?: Array<string> | undefined | null, scopes?: Array<string> | undefined | null): this
540
+ /** Enable endpoint pooling for this listener. */
541
+ poolingEnabled(poolingEnabled: boolean): this
540
542
  /**
541
543
  * WebhookVerification configuration.
542
544
  * If not called, WebhookVerification is disabled.
@@ -596,7 +598,7 @@ export class HttpListenerBuilder {
596
598
  *r"
597
599
  *r" @group Listener Builders
598
600
  */
599
- export class TcpListenerBuilder {
601
+ export declare class TcpListenerBuilder {
600
602
  /** Listener-specific opaque metadata. Viewable via the API. */
601
603
  metadata(metadata: string): this
602
604
  /** Whether to disable certificate verification for this listener. */
@@ -649,13 +651,15 @@ export class TcpListenerBuilder {
649
651
  * [ngrok dashboard]: https://dashboard.ngrok.com/cloud-edge/tcp-addresses
650
652
  */
651
653
  remoteAddr(remoteAddr: string): this
654
+ /** Enable endpoint pooling for this listener. */
655
+ poolingEnabled(poolingEnabled: boolean): this
652
656
  }
653
657
  /**
654
658
  *r" An ngrok listener backing a TLS endpoint.
655
659
  *r"
656
660
  *r" @group Listener Builders
657
661
  */
658
- export class TlsListenerBuilder {
662
+ export declare class TlsListenerBuilder {
659
663
  /** Listener-specific opaque metadata. Viewable via the API. */
660
664
  metadata(metadata: string): this
661
665
  /** Whether to disable certificate verification for this listener. */
@@ -716,6 +720,8 @@ export class TlsListenerBuilder {
716
720
  * [Mutual TLS]: https://ngrok.com/docs/cloud-edge/modules/mutual-tls/
717
721
  */
718
722
  mutualTlsca(mutualTlsca: Uint8Array): this
723
+ /** Enable endpoint pooling for this listener. */
724
+ poolingEnabled(poolingEnabled: boolean): this
719
725
  /**
720
726
  * The key to use for TLS termination at the ngrok edge in PEM format.
721
727
  * See [TLS Termination] in the ngrok docs for additional details.
@@ -729,7 +735,7 @@ export class TlsListenerBuilder {
729
735
  *r"
730
736
  *r" @group Listener Builders
731
737
  */
732
- export class LabeledListenerBuilder {
738
+ export declare class LabeledListenerBuilder {
733
739
  /** Listener-specific opaque metadata. Viewable via the API. */
734
740
  metadata(metadata: string): this
735
741
  /** Whether to disable certificate verification for this listener. */
@@ -761,7 +767,7 @@ export class LabeledListenerBuilder {
761
767
  *
762
768
  * @group Listener and Sessions
763
769
  */
764
- export class SessionBuilder {
770
+ export declare class SessionBuilder {
765
771
  /** Create a new session builder */
766
772
  constructor()
767
773
  /**
@@ -922,7 +928,7 @@ export class SessionBuilder {
922
928
  *
923
929
  * @group Listener and Sessions
924
930
  */
925
- export class Session {
931
+ export declare class Session {
926
932
  /** Start building a listener backing an HTTP endpoint. */
927
933
  httpEndpoint(): HttpListenerBuilder
928
934
  /** Start building a listener backing a TCP endpoint. */
@@ -939,7 +945,7 @@ export class Session {
939
945
  close(): Promise<void>
940
946
  }
941
947
  /** Container for UpdateRequest information. */
942
- export class UpdateRequest {
948
+ export declare class UpdateRequest {
943
949
  /** The version that the agent is requested to update to. */
944
950
  version: string
945
951
  /** Whether or not updating to the same major version is sufficient. */
package/index.js CHANGED
@@ -224,14 +224,72 @@ switch (platform) {
224
224
  }
225
225
  break
226
226
  case 'arm':
227
+ if (isMusl()) {
228
+ localFileExisted = existsSync(
229
+ join(__dirname, 'ngrok.linux-arm-musleabihf.node')
230
+ )
231
+ try {
232
+ if (localFileExisted) {
233
+ nativeBinding = require('./ngrok.linux-arm-musleabihf.node')
234
+ } else {
235
+ nativeBinding = require('@ngrok/ngrok-linux-arm-musleabihf')
236
+ }
237
+ } catch (e) {
238
+ loadError = e
239
+ }
240
+ } else {
241
+ localFileExisted = existsSync(
242
+ join(__dirname, 'ngrok.linux-arm-gnueabihf.node')
243
+ )
244
+ try {
245
+ if (localFileExisted) {
246
+ nativeBinding = require('./ngrok.linux-arm-gnueabihf.node')
247
+ } else {
248
+ nativeBinding = require('@ngrok/ngrok-linux-arm-gnueabihf')
249
+ }
250
+ } catch (e) {
251
+ loadError = e
252
+ }
253
+ }
254
+ break
255
+ case 'riscv64':
256
+ if (isMusl()) {
257
+ localFileExisted = existsSync(
258
+ join(__dirname, 'ngrok.linux-riscv64-musl.node')
259
+ )
260
+ try {
261
+ if (localFileExisted) {
262
+ nativeBinding = require('./ngrok.linux-riscv64-musl.node')
263
+ } else {
264
+ nativeBinding = require('@ngrok/ngrok-linux-riscv64-musl')
265
+ }
266
+ } catch (e) {
267
+ loadError = e
268
+ }
269
+ } else {
270
+ localFileExisted = existsSync(
271
+ join(__dirname, 'ngrok.linux-riscv64-gnu.node')
272
+ )
273
+ try {
274
+ if (localFileExisted) {
275
+ nativeBinding = require('./ngrok.linux-riscv64-gnu.node')
276
+ } else {
277
+ nativeBinding = require('@ngrok/ngrok-linux-riscv64-gnu')
278
+ }
279
+ } catch (e) {
280
+ loadError = e
281
+ }
282
+ }
283
+ break
284
+ case 's390x':
227
285
  localFileExisted = existsSync(
228
- join(__dirname, 'ngrok.linux-arm-gnueabihf.node')
286
+ join(__dirname, 'ngrok.linux-s390x-gnu.node')
229
287
  )
230
288
  try {
231
289
  if (localFileExisted) {
232
- nativeBinding = require('./ngrok.linux-arm-gnueabihf.node')
290
+ nativeBinding = require('./ngrok.linux-s390x-gnu.node')
233
291
  } else {
234
- nativeBinding = require('@ngrok/ngrok-linux-arm-gnueabihf')
292
+ nativeBinding = require('@ngrok/ngrok-linux-s390x-gnu')
235
293
  }
236
294
  } catch (e) {
237
295
  loadError = e
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ngrok/ngrok",
3
- "version": "1.4.0",
3
+ "version": "1.5.0",
4
4
  "main": "index.js",
5
5
  "types": "index.d.ts",
6
6
  "files": [
@@ -20,6 +20,7 @@
20
20
  "additional": [
21
21
  "aarch64-apple-darwin",
22
22
  "aarch64-linux-android",
23
+ "aarch64-pc-windows-msvc",
23
24
  "aarch64-unknown-linux-gnu",
24
25
  "aarch64-unknown-linux-musl",
25
26
  "armv7-unknown-linux-gnueabihf",
@@ -31,18 +32,22 @@
31
32
  ]
32
33
  }
33
34
  },
34
- "unused-for-now": "aarch64-pc-windows-msvc",
35
35
  "license": "(MIT OR Apache-2.0)",
36
36
  "devDependencies": {
37
- "@napi-rs/cli": "^2.15.1",
38
- "@types/node": "^18.13.0",
39
- "ava": "^4.3.3",
40
- "axios": "^1.3.3",
41
- "axios-retry": "^3.4.0",
42
- "express": "^4.18.2",
43
- "prettier": "^2.8.7",
44
- "typedoc": "^0.24.7",
45
- "typescript": "^4.9.5"
37
+ "@babel/core": "^7.26.10",
38
+ "@babel/preset-env": "^7.26.9",
39
+ "@napi-rs/cli": "^2.18.4",
40
+ "@types/node": "^22.13.0",
41
+ "ava": "^6.2.0",
42
+ "axios": "^1.8.3",
43
+ "axios-retry": "^4.5.0",
44
+ "babel-jest": "^29.7.0",
45
+ "expect": "^29.7.0",
46
+ "express": "^4.21.2",
47
+ "jest": "^30.0.0-alpha.6",
48
+ "prettier": "^3.5.3",
49
+ "typedoc": "^0.28.0",
50
+ "typescript": "^5.8.2"
46
51
  },
47
52
  "ava": {
48
53
  "timeout": "3m"
@@ -58,7 +63,7 @@
58
63
  "docs": "mv trailer.d.ts trailer.d.hidden; mv examples .examples; npx typedoc index.d.ts --navigation.includeGroups; mv .examples examples; mv trailer.d.hidden trailer.d.ts",
59
64
  "prepublishOnly": "napi prepublish -t npm",
60
65
  "prettier": "prettier --write .",
61
- "test": "tsc --strict index.d.ts && ava",
66
+ "test": "jest",
62
67
  "universal": "napi universal",
63
68
  "version": "napi version"
64
69
  },
@@ -75,19 +80,35 @@
75
80
  "type": "git",
76
81
  "url": "https://github.com/ngrok/ngrok-javascript.git"
77
82
  },
83
+ "jest": {
84
+ "testTimeout": 30000,
85
+ "testMatch": [
86
+ "**/__test__/**/*.mjs"
87
+ ],
88
+ "testPathIgnorePatterns": [
89
+ "/__test__/retry-config.mjs$"
90
+ ],
91
+ "transform": {
92
+ "^.+\\.(mjs)$": "babel-jest"
93
+ },
94
+ "moduleNameMapper": {
95
+ "^(\\.{1,2}/.*)\\.js$": "$1"
96
+ }
97
+ },
78
98
  "optionalDependencies": {
79
- "@ngrok/ngrok-win32-x64-msvc": "1.4.0",
80
- "@ngrok/ngrok-darwin-x64": "1.4.0",
81
- "@ngrok/ngrok-linux-x64-gnu": "1.4.0",
82
- "@ngrok/ngrok-darwin-arm64": "1.4.0",
83
- "@ngrok/ngrok-android-arm64": "1.4.0",
84
- "@ngrok/ngrok-linux-arm64-gnu": "1.4.0",
85
- "@ngrok/ngrok-linux-arm64-musl": "1.4.0",
86
- "@ngrok/ngrok-linux-arm-gnueabihf": "1.4.0",
87
- "@ngrok/ngrok-linux-x64-musl": "1.4.0",
88
- "@ngrok/ngrok-freebsd-x64": "1.4.0",
89
- "@ngrok/ngrok-win32-ia32-msvc": "1.4.0",
90
- "@ngrok/ngrok-android-arm-eabi": "1.4.0",
91
- "@ngrok/ngrok-darwin-universal": "1.4.0"
99
+ "@ngrok/ngrok-win32-x64-msvc": "1.5.0",
100
+ "@ngrok/ngrok-darwin-x64": "1.5.0",
101
+ "@ngrok/ngrok-linux-x64-gnu": "1.5.0",
102
+ "@ngrok/ngrok-darwin-arm64": "1.5.0",
103
+ "@ngrok/ngrok-android-arm64": "1.5.0",
104
+ "@ngrok/ngrok-win32-arm64-msvc": "1.5.0",
105
+ "@ngrok/ngrok-linux-arm64-gnu": "1.5.0",
106
+ "@ngrok/ngrok-linux-arm64-musl": "1.5.0",
107
+ "@ngrok/ngrok-linux-arm-gnueabihf": "1.5.0",
108
+ "@ngrok/ngrok-linux-x64-musl": "1.5.0",
109
+ "@ngrok/ngrok-freebsd-x64": "1.5.0",
110
+ "@ngrok/ngrok-win32-ia32-msvc": "1.5.0",
111
+ "@ngrok/ngrok-android-arm-eabi": "1.5.0",
112
+ "@ngrok/ngrok-darwin-universal": "1.5.0"
92
113
  }
93
114
  }