supabase-edge-function-continuous-stream 1.0.0 → 1.0.2

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/README.md CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  Continuous WebSocket streaming for Supabase edge functions. Keeps a persistent connection alive across cold starts, supports warmup/context loading, and streams AI responses with automatic retry and worker TTL rotation.
4
4
 
5
+ This is intended to be used with [@huy9k/supabase-edge-function-helpers](https://jsr.io/@huy9k/supabase-edge-function-helpers).
6
+
5
7
  ## Install
6
8
 
7
9
  ```bash
@@ -10,10 +12,10 @@ npm install supabase-edge-function-continuous-stream
10
12
 
11
13
  ## Entries
12
14
 
13
- | Import | React required? | Use for |
14
- |---|---|---|
15
- | `supabase-edge-function-continuous-stream` | No | `connectEdgeSocket`, `createStandardAiMessageHandler`, types |
16
- | `supabase-edge-function-continuous-stream/react` | Yes | `createUseEdgeStream` hook factory |
15
+ | Import | React required? | Use for |
16
+ | ------------------------------------------------ | --------------- | ------------------------------------------------------------ |
17
+ | `supabase-edge-function-continuous-stream` | No | `connectEdgeSocket`, `createStandardAiMessageHandler`, types |
18
+ | `supabase-edge-function-continuous-stream/react` | Yes | `createUseEdgeStream` hook factory |
17
19
 
18
20
  ## React usage
19
21
 
@@ -96,13 +96,13 @@ async function connectEdgeSocket(deps) {
96
96
  setIsConnected(false);
97
97
  isWarmupReadyRef.current = false;
98
98
  const willRetry = !isExplicitDisconnectRef.current && retryCountRef.current < MAX_RETRIES;
99
- if (!willRetry) {
99
+ if (isExplicitDisconnectRef.current) {
100
+ settleWarmupWaiters();
101
+ } else if (!willRetry) {
100
102
  settleWarmupWaiters(new Error("WebSocket closed"));
101
103
  }
102
104
  if (isExplicitDisconnectRef.current) {
103
- rejectConnection(
104
- new Error("WebSocket closed by server or aborted")
105
- );
105
+ rejectConnection(new Error("WebSocket closed by server or aborted"));
106
106
  } else if (retryCountRef.current < MAX_RETRIES) {
107
107
  retryCountRef.current++;
108
108
  const delay = INITIAL_RETRY_DELAY_MS * Math.pow(2, retryCountRef.current - 1);
package/dist/index.cjs CHANGED
@@ -129,13 +129,13 @@ async function connectEdgeSocket(deps) {
129
129
  setIsConnected(false);
130
130
  isWarmupReadyRef.current = false;
131
131
  const willRetry = !isExplicitDisconnectRef.current && retryCountRef.current < MAX_RETRIES;
132
- if (!willRetry) {
132
+ if (isExplicitDisconnectRef.current) {
133
+ settleWarmupWaiters();
134
+ } else if (!willRetry) {
133
135
  settleWarmupWaiters(new Error("WebSocket closed"));
134
136
  }
135
137
  if (isExplicitDisconnectRef.current) {
136
- rejectConnection(
137
- new Error("WebSocket closed by server or aborted")
138
- );
138
+ rejectConnection(new Error("WebSocket closed by server or aborted"));
139
139
  } else if (retryCountRef.current < MAX_RETRIES) {
140
140
  retryCountRef.current++;
141
141
  const delay = INITIAL_RETRY_DELAY_MS * Math.pow(2, retryCountRef.current - 1);
package/dist/index.js CHANGED
@@ -5,7 +5,7 @@ import {
5
5
  connectEdgeSocket,
6
6
  createStandardAiMessageHandler,
7
7
  createUseEdgeStream
8
- } from "./chunk-GP2SEFBH.js";
8
+ } from "./chunk-MXZ44KEV.js";
9
9
 
10
10
  // src/workerLimits.ts
11
11
  var DEFAULT_EDGE_WORKER_LIMITS = {
package/dist/react.cjs CHANGED
@@ -125,13 +125,13 @@ async function connectEdgeSocket(deps) {
125
125
  setIsConnected(false);
126
126
  isWarmupReadyRef.current = false;
127
127
  const willRetry = !isExplicitDisconnectRef.current && retryCountRef.current < MAX_RETRIES;
128
- if (!willRetry) {
128
+ if (isExplicitDisconnectRef.current) {
129
+ settleWarmupWaiters();
130
+ } else if (!willRetry) {
129
131
  settleWarmupWaiters(new Error("WebSocket closed"));
130
132
  }
131
133
  if (isExplicitDisconnectRef.current) {
132
- rejectConnection(
133
- new Error("WebSocket closed by server or aborted")
134
- );
134
+ rejectConnection(new Error("WebSocket closed by server or aborted"));
135
135
  } else if (retryCountRef.current < MAX_RETRIES) {
136
136
  retryCountRef.current++;
137
137
  const delay = INITIAL_RETRY_DELAY_MS * Math.pow(2, retryCountRef.current - 1);
package/dist/react.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  createUseEdgeStream
3
- } from "./chunk-GP2SEFBH.js";
3
+ } from "./chunk-MXZ44KEV.js";
4
4
  export {
5
5
  createUseEdgeStream
6
6
  };
package/package.json CHANGED
@@ -1,8 +1,15 @@
1
1
  {
2
2
  "name": "supabase-edge-function-continuous-stream",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "Continuous WebSocket streaming for Supabase edge functions",
5
5
  "license": "MIT",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/huy9k/supabase-edge-function-continuous-stream.git"
9
+ },
10
+ "publishConfig": {
11
+ "access": "public"
12
+ },
6
13
  "type": "module",
7
14
  "exports": {
8
15
  ".": {