@sinch/functions-runtime 0.6.2 → 0.6.3

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/dist/index.d.ts CHANGED
@@ -5851,6 +5851,10 @@ export declare class TunnelClient {
5851
5851
  private webhookConfig;
5852
5852
  private welcomeResolver;
5853
5853
  private streams;
5854
+ /** Set by disconnect(). A reconnect after it would repoint the webhooks cleanup restored. */
5855
+ private shuttingDown;
5856
+ /** The in-flight configureWebhooks(), so disconnect() can wait for it before restoring. */
5857
+ private configuring;
5854
5858
  constructor(localPort?: number);
5855
5859
  /** Sends one JSON message up the tunnel channel, if it is still connected. */
5856
5860
  private sendMessage;
@@ -5861,7 +5865,8 @@ export declare class TunnelClient {
5861
5865
  /**
5862
5866
  * Build a full tunnel URL with optional sub-path and tunnel query param.
5863
5867
  * e.g. buildTunnelUrl('/webhook/conversation') →
5864
- * https://tunnel.fn.sinch.com/ingress/webhook/conversation?tunnel=01KKT...
5868
+ * https://tunnel.fn.sinch.io/ingress/webhook/conversation?tunnel=01KKT...
5869
+ * See ./url.ts for why the welcome URL's own query string is dropped.
5865
5870
  */
5866
5871
  private buildTunnelUrl;
5867
5872
  private handleWelcomeMessage;
@@ -5874,11 +5879,21 @@ export declare class TunnelClient {
5874
5879
  */
5875
5880
  private configureWebhooks;
5876
5881
  /**
5877
- * Cleanup webhooks on disconnect
5882
+ * Restore every webhook the tunnel repointed. Run in parallel: this happens during
5883
+ * shutdown, under a timeout, and the two restores are independent.
5884
+ * The v1 application callback is still not restored (it was never saved).
5878
5885
  */
5879
5886
  private cleanupWebhooks;
5880
5887
  private configureVoiceWebhooks;
5881
5888
  private scheduleReconnect;
5889
+ /**
5890
+ * Stop the tunnel and restore every webhook it repointed.
5891
+ *
5892
+ * Order matters (#102 review): stop reconnects and close the socket first, so no new
5893
+ * welcome can start another configure; then wait for any configure already in flight, so
5894
+ * a PATCH that lands late (Ctrl+C between its GET and its PATCH) cannot overwrite the
5895
+ * restore; only then restore.
5896
+ */
5882
5897
  disconnect(): Promise<void>;
5883
5898
  getTunnelUrl(): string | null;
5884
5899
  getIsConnected(): boolean;
package/dist/index.js CHANGED
@@ -137,7 +137,7 @@ import {
137
137
  validateVoiceV1Request,
138
138
  verifyVoiceWebhook,
139
139
  voiceRelay
140
- } from "./chunk-W3R4GR3E.js";
140
+ } from "./chunk-H2JZGXXT.js";
141
141
  export {
142
142
  AGENT_HEADER_TOKEN,
143
143
  AGENT_STREAM_PATH,
package/dist/voice/v2.js CHANGED
@@ -40,7 +40,7 @@ import {
40
40
  toWebhookRequest,
41
41
  tool,
42
42
  voiceRelay
43
- } from "../chunk-W3R4GR3E.js";
43
+ } from "../chunk-H2JZGXXT.js";
44
44
  export {
45
45
  Client,
46
46
  CommandBuilder,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sinch/functions-runtime",
3
- "version": "0.6.2",
3
+ "version": "0.6.3",
4
4
  "description": "Node.js SDK and local development runtime for Sinch Functions: voice, messaging and HTTP serverless functions",
5
5
  "type": "module",
6
6
  "exports": {