@vibecook/truffle-native 0.4.2 → 0.4.5

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/index.d.ts CHANGED
@@ -166,6 +166,8 @@ export declare class NapiNode {
166
166
  onMessage(namespace: string, callback: (msg: NamespacedMessage) => void): void
167
167
  /** Get a `NapiFileTransfer` handle for file transfer operations. */
168
168
  fileTransfer(): NapiFileTransfer
169
+ /** Get a `NapiProxy` handle for reverse proxy operations. */
170
+ proxy(): NapiProxy
169
171
  /**
170
172
  * Get a `NapiSyncedStore` handle for synchronized state operations.
171
173
  *
@@ -199,6 +201,32 @@ export declare class NapiOfferResponder {
199
201
  reject(reason: string): Promise<void>
200
202
  }
201
203
 
204
+ /**
205
+ * Reverse proxy handle exposed to JavaScript.
206
+ *
207
+ * Obtained via `NapiNode.proxy()`. Holds an `Arc<Node>` to create
208
+ * fresh `Proxy` handles on each method call (the Rust `Proxy` borrows
209
+ * `&Node`, so we can't store it across JS boundaries).
210
+ */
211
+ export declare class NapiProxy {
212
+ /**
213
+ * Add a reverse proxy that forwards traffic from a TLS port on the mesh
214
+ * to a local target.
215
+ */
216
+ add(config: NapiProxyConfig): Promise<NapiProxyInfo>
217
+ /** Remove a reverse proxy by ID. */
218
+ remove(id: string): Promise<void>
219
+ /** List all active proxies on this node. */
220
+ list(): Promise<Array<NapiProxyInfo>>
221
+ /**
222
+ * Subscribe to proxy lifecycle events.
223
+ *
224
+ * The callback receives `NapiProxyEvent` objects whenever a proxy
225
+ * starts, stops, or encounters an error.
226
+ */
227
+ onEvent(callback: (event: NapiProxyEvent) => void): void
228
+ }
229
+
202
230
  /**
203
231
  * Synchronized store handle exposed to JavaScript.
204
232
  *
@@ -419,6 +447,53 @@ export interface NapiPingResult {
419
447
  peerAddr?: string
420
448
  }
421
449
 
450
+ /** Configuration for adding a reverse proxy, received from JavaScript. */
451
+ export interface NapiProxyConfig {
452
+ /** Unique identifier (user-chosen or auto-generated). */
453
+ id: string
454
+ /** Human-readable name for the proxy. */
455
+ name: string
456
+ /** Port on which the proxy listens on the tailnet (NAPI uses i32). */
457
+ listenPort: number
458
+ /** Target host (default: "localhost"). */
459
+ targetHost?: string
460
+ /** Target port (the local service port). */
461
+ targetPort: number
462
+ /** Target scheme: "http" or "https" (default: "http"). */
463
+ targetScheme?: string
464
+ /** Whether to announce this proxy on the mesh for discovery (default: true). */
465
+ announce?: boolean
466
+ }
467
+
468
+ /** A proxy lifecycle event delivered to JavaScript. */
469
+ export interface NapiProxyEvent {
470
+ /** Event type: "started", "stopped", "error". */
471
+ eventType: string
472
+ /** Proxy ID. */
473
+ id: string
474
+ /** Fully qualified URL (present for "started" events). */
475
+ url?: string
476
+ /** Listen port (present for "started" events). */
477
+ listenPort?: number
478
+ /** Error code (present for "error" events). */
479
+ code?: string
480
+ /** Error message (present for "error" events). */
481
+ message?: string
482
+ }
483
+
484
+ /** Information about a running or configured proxy, returned to JavaScript. */
485
+ export interface NapiProxyInfo {
486
+ id: string
487
+ name: string
488
+ listenPort: number
489
+ targetHost: string
490
+ targetPort: number
491
+ targetScheme: string
492
+ url: string
493
+ /** Status: "starting", "running", "stopped", or "error: <message>". */
494
+ status: string
495
+ }
496
+
422
497
  /** A versioned slice of data owned by a single device. */
423
498
  export interface NapiSlice {
424
499
  /**
package/index.js CHANGED
@@ -580,4 +580,5 @@ module.exports.NapiCrdtDoc = nativeBinding.NapiCrdtDoc
580
580
  module.exports.NapiFileTransfer = nativeBinding.NapiFileTransfer
581
581
  module.exports.NapiNode = nativeBinding.NapiNode
582
582
  module.exports.NapiOfferResponder = nativeBinding.NapiOfferResponder
583
+ module.exports.NapiProxy = nativeBinding.NapiProxy
583
584
  module.exports.NapiSyncedStore = nativeBinding.NapiSyncedStore
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vibecook/truffle-native",
3
- "version": "0.4.2",
3
+ "version": "0.4.5",
4
4
  "description": "Mesh networking for local-first apps, built on Tailscale (native addon)",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
Binary file
Binary file
Binary file
Binary file
Binary file