@convex-dev/persistent-text-streaming 0.2.4 → 0.3.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/README.md +37 -35
- package/dist/{commonjs/client → client}/index.d.ts +12 -4
- package/dist/client/index.d.ts.map +1 -0
- package/dist/{esm/client → client}/index.js +13 -0
- package/dist/client/index.js.map +1 -0
- package/dist/component/_generated/api.d.ts +36 -0
- package/dist/component/_generated/api.d.ts.map +1 -0
- package/{src → dist}/component/_generated/api.js +11 -3
- package/dist/component/_generated/api.js.map +1 -0
- package/dist/component/_generated/component.d.ts +47 -0
- package/dist/component/_generated/component.d.ts.map +1 -0
- package/dist/component/_generated/component.js +11 -0
- package/dist/component/_generated/component.js.map +1 -0
- package/dist/component/_generated/dataModel.d.ts +46 -0
- package/dist/component/_generated/dataModel.d.ts.map +1 -0
- package/dist/component/_generated/dataModel.js +11 -0
- package/dist/component/_generated/dataModel.js.map +1 -0
- package/{src → dist}/component/_generated/server.d.ts +10 -38
- package/dist/component/_generated/server.d.ts.map +1 -0
- package/dist/{commonjs/component → component}/_generated/server.js +9 -5
- package/dist/component/_generated/server.js.map +1 -0
- package/dist/component/convex.config.d.ts.map +1 -0
- package/dist/component/convex.config.js.map +1 -0
- package/dist/component/crons.d.ts.map +1 -0
- package/dist/{commonjs/component → component}/crons.js +1 -1
- package/dist/component/crons.js.map +1 -0
- package/dist/{commonjs/component → component}/lib.d.ts +7 -0
- package/dist/component/lib.d.ts.map +1 -0
- package/dist/{commonjs/component → component}/lib.js +45 -2
- package/dist/component/lib.js.map +1 -0
- package/dist/{commonjs/component → component}/schema.d.ts +1 -1
- package/dist/component/schema.d.ts.map +1 -0
- package/dist/component/schema.js.map +1 -0
- package/dist/{commonjs/react → react}/index.d.ts +2 -2
- package/dist/react/index.d.ts.map +1 -0
- package/dist/{commonjs/react → react}/index.js +10 -2
- package/dist/react/index.js.map +1 -0
- package/package.json +68 -54
- package/src/client/index.ts +29 -13
- package/src/component/_generated/api.ts +52 -0
- package/src/component/_generated/component.ts +70 -0
- package/src/component/_generated/{dataModel.d.ts → dataModel.ts} +1 -1
- package/src/component/_generated/server.ts +156 -0
- package/src/component/crons.ts +2 -2
- package/src/component/lib.ts +51 -4
- package/src/component/schema.ts +2 -2
- package/src/react/index.ts +17 -9
- package/src/test.ts +18 -0
- package/dist/commonjs/client/index.d.ts.map +0 -1
- package/dist/commonjs/client/index.js +0 -146
- package/dist/commonjs/client/index.js.map +0 -1
- package/dist/commonjs/component/_generated/api.d.ts +0 -12
- package/dist/commonjs/component/_generated/api.d.ts.map +0 -1
- package/dist/commonjs/component/_generated/api.js +0 -22
- package/dist/commonjs/component/_generated/api.js.map +0 -1
- package/dist/commonjs/component/_generated/server.d.ts +0 -64
- package/dist/commonjs/component/_generated/server.d.ts.map +0 -1
- package/dist/commonjs/component/_generated/server.js.map +0 -1
- package/dist/commonjs/component/convex.config.d.ts.map +0 -1
- package/dist/commonjs/component/convex.config.js.map +0 -1
- package/dist/commonjs/component/crons.d.ts.map +0 -1
- package/dist/commonjs/component/crons.js.map +0 -1
- package/dist/commonjs/component/lib.d.ts.map +0 -1
- package/dist/commonjs/component/lib.js.map +0 -1
- package/dist/commonjs/component/schema.d.ts.map +0 -1
- package/dist/commonjs/component/schema.js.map +0 -1
- package/dist/commonjs/package.json +0 -3
- package/dist/commonjs/react/index.d.ts.map +0 -1
- package/dist/commonjs/react/index.js.map +0 -1
- package/dist/esm/client/index.d.ts +0 -89
- package/dist/esm/client/index.d.ts.map +0 -1
- package/dist/esm/client/index.js.map +0 -1
- package/dist/esm/component/_generated/api.d.ts +0 -12
- package/dist/esm/component/_generated/api.d.ts.map +0 -1
- package/dist/esm/component/_generated/api.js +0 -22
- package/dist/esm/component/_generated/api.js.map +0 -1
- package/dist/esm/component/_generated/server.d.ts +0 -64
- package/dist/esm/component/_generated/server.d.ts.map +0 -1
- package/dist/esm/component/_generated/server.js +0 -74
- package/dist/esm/component/_generated/server.js.map +0 -1
- package/dist/esm/component/convex.config.d.ts +0 -3
- package/dist/esm/component/convex.config.d.ts.map +0 -1
- package/dist/esm/component/convex.config.js +0 -3
- package/dist/esm/component/convex.config.js.map +0 -1
- package/dist/esm/component/crons.d.ts +0 -3
- package/dist/esm/component/crons.d.ts.map +0 -1
- package/dist/esm/component/crons.js +0 -7
- package/dist/esm/component/crons.js.map +0 -1
- package/dist/esm/component/lib.d.ts +0 -21
- package/dist/esm/component/lib.d.ts.map +0 -1
- package/dist/esm/component/lib.js +0 -134
- package/dist/esm/component/lib.js.map +0 -1
- package/dist/esm/component/schema.d.ts +0 -23
- package/dist/esm/component/schema.d.ts.map +0 -1
- package/dist/esm/component/schema.js +0 -13
- package/dist/esm/component/schema.js.map +0 -1
- package/dist/esm/package.json +0 -3
- package/dist/esm/react/index.d.ts +0 -26
- package/dist/esm/react/index.d.ts.map +0 -1
- package/dist/esm/react/index.js +0 -133
- package/dist/esm/react/index.js.map +0 -1
- package/react/package.json +0 -5
- package/src/component/_generated/api.d.ts +0 -81
- package/src/component/_generated/server.js +0 -90
- /package/dist/{commonjs/component → component}/convex.config.d.ts +0 -0
- /package/dist/{commonjs/component → component}/convex.config.js +0 -0
- /package/dist/{commonjs/component → component}/crons.d.ts +0 -0
- /package/dist/{commonjs/component → component}/schema.js +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/react/index.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAEjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAElD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,SAAS,CACvB,iBAAiB,EAAE,iBAAiB,CAClC,OAAO,EACP,QAAQ,EACR;IAAE,QAAQ,EAAE,MAAM,CAAA;CAAE,EACpB,UAAU,CACX,EACD,SAAS,EAAE,GAAG,EACd,MAAM,EAAE,OAAO,EACf,QAAQ,EAAE,QAAQ,GAAG,SAAS,EAC9B,IAAI,CAAC,EAAE;IAEL,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAE1B,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAClC,cA0EF"}
|
package/dist/esm/react/index.js
DELETED
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { useQuery } from "convex/react";
|
|
3
|
-
import { useEffect, useMemo, useRef, useState } from "react";
|
|
4
|
-
/**
|
|
5
|
-
* React hook for persistent text streaming.
|
|
6
|
-
*
|
|
7
|
-
* @param getPersistentBody - A query function reference that returns the body
|
|
8
|
-
* of a stream using the component's `getStreamBody` method.
|
|
9
|
-
* @param streamUrl - The URL of the http action that will kick off the stream
|
|
10
|
-
* generation and stream the result back to the client using the component's
|
|
11
|
-
* `stream` method.
|
|
12
|
-
* @param driven - Whether this particular session is driving the stream. Set this
|
|
13
|
-
* to true if this is the client session that first created the stream using the
|
|
14
|
-
* component's `createStream` method. If you're simply reloading an existing
|
|
15
|
-
* stream, set this to false.
|
|
16
|
-
* @param streamId - The ID of the stream. If this is not provided, the return
|
|
17
|
-
* value will be an empty string for the stream body and the status will be
|
|
18
|
-
* `pending`.
|
|
19
|
-
* @returns The body and status of the stream.
|
|
20
|
-
*/
|
|
21
|
-
export function useStream(getPersistentBody, streamUrl, driven, streamId, opts) {
|
|
22
|
-
const [streamEnded, setStreamEnded] = useState(null);
|
|
23
|
-
// Used to prevent strict mode from causing multiple streams to be started.
|
|
24
|
-
const streamStarted = useRef(false);
|
|
25
|
-
const usePersistence = useMemo(() => {
|
|
26
|
-
// Something is wrong with the stream, so we need to use the database value.
|
|
27
|
-
if (streamEnded === false) {
|
|
28
|
-
return true;
|
|
29
|
-
}
|
|
30
|
-
// If we're not driving the stream, we must use the database value.
|
|
31
|
-
if (!driven) {
|
|
32
|
-
return true;
|
|
33
|
-
}
|
|
34
|
-
// Otherwise, we'll try to drive the stream and use the HTTP response.
|
|
35
|
-
return false;
|
|
36
|
-
}, [driven, streamId, streamEnded]);
|
|
37
|
-
// console.log("usePersistence", usePersistence);
|
|
38
|
-
const persistentBody = useQuery(getPersistentBody, usePersistence && streamId ? { streamId } : "skip");
|
|
39
|
-
const [streamBody, setStreamBody] = useState("");
|
|
40
|
-
useEffect(() => {
|
|
41
|
-
if (driven && streamId && !streamStarted.current) {
|
|
42
|
-
// Kick off HTTP action.
|
|
43
|
-
void (async () => {
|
|
44
|
-
const success = await startStreaming(streamUrl, streamId, (text) => {
|
|
45
|
-
setStreamBody((prev) => prev + text);
|
|
46
|
-
}, {
|
|
47
|
-
...opts?.headers,
|
|
48
|
-
...(opts?.authToken
|
|
49
|
-
? { Authorization: `Bearer ${opts.authToken}` }
|
|
50
|
-
: {}),
|
|
51
|
-
});
|
|
52
|
-
setStreamEnded(success);
|
|
53
|
-
})();
|
|
54
|
-
// If we get remounted, we don't want to start a new stream.
|
|
55
|
-
return () => {
|
|
56
|
-
streamStarted.current = true;
|
|
57
|
-
};
|
|
58
|
-
}
|
|
59
|
-
}, [driven, streamId, setStreamEnded, streamStarted]);
|
|
60
|
-
const body = useMemo(() => {
|
|
61
|
-
// console.log(
|
|
62
|
-
// "body info p vs. s",
|
|
63
|
-
// persistentBody?.text?.length ?? 0,
|
|
64
|
-
// streamBody.length
|
|
65
|
-
//);
|
|
66
|
-
if (persistentBody) {
|
|
67
|
-
return persistentBody;
|
|
68
|
-
}
|
|
69
|
-
let status;
|
|
70
|
-
if (streamEnded === null) {
|
|
71
|
-
status = streamBody.length > 0 ? "streaming" : "pending";
|
|
72
|
-
}
|
|
73
|
-
else {
|
|
74
|
-
status = streamEnded ? "done" : "error";
|
|
75
|
-
}
|
|
76
|
-
return {
|
|
77
|
-
text: streamBody,
|
|
78
|
-
status: status,
|
|
79
|
-
};
|
|
80
|
-
}, [persistentBody, streamBody, streamEnded]);
|
|
81
|
-
return body;
|
|
82
|
-
}
|
|
83
|
-
/**
|
|
84
|
-
* Internal helper for starting a stream.
|
|
85
|
-
*
|
|
86
|
-
* @param url - The URL of the http action that will kick off the stream
|
|
87
|
-
* generation and stream the result back to the client using the component's
|
|
88
|
-
* `stream` method.
|
|
89
|
-
* @param streamId - The ID of the stream.
|
|
90
|
-
* @param onUpdate - A function that updates the stream body.
|
|
91
|
-
* @returns A promise that resolves to a boolean indicating whether the stream
|
|
92
|
-
* was started successfully. It can fail if the http action is not found, or
|
|
93
|
-
* CORS fails, or an exception is raised, or the stream is already running
|
|
94
|
-
* or finished, etc.
|
|
95
|
-
*/
|
|
96
|
-
async function startStreaming(url, streamId, onUpdate, headers) {
|
|
97
|
-
const response = await fetch(url, {
|
|
98
|
-
method: "POST",
|
|
99
|
-
body: JSON.stringify({
|
|
100
|
-
streamId: streamId,
|
|
101
|
-
}),
|
|
102
|
-
headers: { "Content-Type": "application/json", ...headers },
|
|
103
|
-
});
|
|
104
|
-
// Adapted from https://developer.mozilla.org/en-US/docs/Web/API/Streams_API/Using_readable_streams
|
|
105
|
-
if (response.status === 205) {
|
|
106
|
-
console.error("Stream already finished", response);
|
|
107
|
-
return false;
|
|
108
|
-
}
|
|
109
|
-
if (!response.ok) {
|
|
110
|
-
console.error("Failed to reach streaming endpoint", response);
|
|
111
|
-
return false;
|
|
112
|
-
}
|
|
113
|
-
if (!response.body) {
|
|
114
|
-
console.error("No body in response", response);
|
|
115
|
-
return false;
|
|
116
|
-
}
|
|
117
|
-
const reader = response.body.getReader();
|
|
118
|
-
while (true) {
|
|
119
|
-
try {
|
|
120
|
-
const { done, value } = await reader.read();
|
|
121
|
-
if (done) {
|
|
122
|
-
onUpdate(new TextDecoder().decode(value));
|
|
123
|
-
return true;
|
|
124
|
-
}
|
|
125
|
-
onUpdate(new TextDecoder().decode(value));
|
|
126
|
-
}
|
|
127
|
-
catch (e) {
|
|
128
|
-
console.error("Error reading stream", e);
|
|
129
|
-
return false;
|
|
130
|
-
}
|
|
131
|
-
}
|
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EAAE;YACV,OAAO,CAAC,KAAK,CAAC,sBAAsB,EAAE,CAAC,CAAC,CAAC;YACzC,OAAO,KAAK,CAAC;SACd;KACF;AACH,CAAC"}
|
package/react/package.json
DELETED
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
/* eslint-disable */
|
|
2
|
-
/**
|
|
3
|
-
* Generated `api` utility.
|
|
4
|
-
*
|
|
5
|
-
* THIS CODE IS AUTOMATICALLY GENERATED.
|
|
6
|
-
*
|
|
7
|
-
* To regenerate, run `npx convex dev`.
|
|
8
|
-
* @module
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
import type * as crons from "../crons.js";
|
|
12
|
-
import type * as lib from "../lib.js";
|
|
13
|
-
|
|
14
|
-
import type {
|
|
15
|
-
ApiFromModules,
|
|
16
|
-
FilterApi,
|
|
17
|
-
FunctionReference,
|
|
18
|
-
} from "convex/server";
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* A utility for referencing Convex functions in your app's API.
|
|
22
|
-
*
|
|
23
|
-
* Usage:
|
|
24
|
-
* ```js
|
|
25
|
-
* const myFunctionReference = api.myModule.myFunction;
|
|
26
|
-
* ```
|
|
27
|
-
*/
|
|
28
|
-
declare const fullApi: ApiFromModules<{
|
|
29
|
-
crons: typeof crons;
|
|
30
|
-
lib: typeof lib;
|
|
31
|
-
}>;
|
|
32
|
-
export type Mounts = {
|
|
33
|
-
lib: {
|
|
34
|
-
addChunk: FunctionReference<
|
|
35
|
-
"mutation",
|
|
36
|
-
"public",
|
|
37
|
-
{ final: boolean; streamId: string; text: string },
|
|
38
|
-
any
|
|
39
|
-
>;
|
|
40
|
-
createStream: FunctionReference<"mutation", "public", {}, any>;
|
|
41
|
-
getStreamStatus: FunctionReference<
|
|
42
|
-
"query",
|
|
43
|
-
"public",
|
|
44
|
-
{ streamId: string },
|
|
45
|
-
"pending" | "streaming" | "done" | "error" | "timeout"
|
|
46
|
-
>;
|
|
47
|
-
getStreamText: FunctionReference<
|
|
48
|
-
"query",
|
|
49
|
-
"public",
|
|
50
|
-
{ streamId: string },
|
|
51
|
-
{
|
|
52
|
-
status: "pending" | "streaming" | "done" | "error" | "timeout";
|
|
53
|
-
text: string;
|
|
54
|
-
}
|
|
55
|
-
>;
|
|
56
|
-
setStreamStatus: FunctionReference<
|
|
57
|
-
"mutation",
|
|
58
|
-
"public",
|
|
59
|
-
{
|
|
60
|
-
status: "pending" | "streaming" | "done" | "error" | "timeout";
|
|
61
|
-
streamId: string;
|
|
62
|
-
},
|
|
63
|
-
any
|
|
64
|
-
>;
|
|
65
|
-
};
|
|
66
|
-
};
|
|
67
|
-
// For now fullApiWithMounts is only fullApi which provides
|
|
68
|
-
// jump-to-definition in component client code.
|
|
69
|
-
// Use Mounts for the same type without the inference.
|
|
70
|
-
declare const fullApiWithMounts: typeof fullApi;
|
|
71
|
-
|
|
72
|
-
export declare const api: FilterApi<
|
|
73
|
-
typeof fullApiWithMounts,
|
|
74
|
-
FunctionReference<any, "public">
|
|
75
|
-
>;
|
|
76
|
-
export declare const internal: FilterApi<
|
|
77
|
-
typeof fullApiWithMounts,
|
|
78
|
-
FunctionReference<any, "internal">
|
|
79
|
-
>;
|
|
80
|
-
|
|
81
|
-
export declare const components: {};
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
/* eslint-disable */
|
|
2
|
-
/**
|
|
3
|
-
* Generated utilities for implementing server-side Convex query and mutation functions.
|
|
4
|
-
*
|
|
5
|
-
* THIS CODE IS AUTOMATICALLY GENERATED.
|
|
6
|
-
*
|
|
7
|
-
* To regenerate, run `npx convex dev`.
|
|
8
|
-
* @module
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
import {
|
|
12
|
-
actionGeneric,
|
|
13
|
-
httpActionGeneric,
|
|
14
|
-
queryGeneric,
|
|
15
|
-
mutationGeneric,
|
|
16
|
-
internalActionGeneric,
|
|
17
|
-
internalMutationGeneric,
|
|
18
|
-
internalQueryGeneric,
|
|
19
|
-
componentsGeneric,
|
|
20
|
-
} from "convex/server";
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Define a query in this Convex app's public API.
|
|
24
|
-
*
|
|
25
|
-
* This function will be allowed to read your Convex database and will be accessible from the client.
|
|
26
|
-
*
|
|
27
|
-
* @param func - The query function. It receives a {@link QueryCtx} as its first argument.
|
|
28
|
-
* @returns The wrapped query. Include this as an `export` to name it and make it accessible.
|
|
29
|
-
*/
|
|
30
|
-
export const query = queryGeneric;
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* Define a query that is only accessible from other Convex functions (but not from the client).
|
|
34
|
-
*
|
|
35
|
-
* This function will be allowed to read from your Convex database. It will not be accessible from the client.
|
|
36
|
-
*
|
|
37
|
-
* @param func - The query function. It receives a {@link QueryCtx} as its first argument.
|
|
38
|
-
* @returns The wrapped query. Include this as an `export` to name it and make it accessible.
|
|
39
|
-
*/
|
|
40
|
-
export const internalQuery = internalQueryGeneric;
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* Define a mutation in this Convex app's public API.
|
|
44
|
-
*
|
|
45
|
-
* This function will be allowed to modify your Convex database and will be accessible from the client.
|
|
46
|
-
*
|
|
47
|
-
* @param func - The mutation function. It receives a {@link MutationCtx} as its first argument.
|
|
48
|
-
* @returns The wrapped mutation. Include this as an `export` to name it and make it accessible.
|
|
49
|
-
*/
|
|
50
|
-
export const mutation = mutationGeneric;
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* Define a mutation that is only accessible from other Convex functions (but not from the client).
|
|
54
|
-
*
|
|
55
|
-
* This function will be allowed to modify your Convex database. It will not be accessible from the client.
|
|
56
|
-
*
|
|
57
|
-
* @param func - The mutation function. It receives a {@link MutationCtx} as its first argument.
|
|
58
|
-
* @returns The wrapped mutation. Include this as an `export` to name it and make it accessible.
|
|
59
|
-
*/
|
|
60
|
-
export const internalMutation = internalMutationGeneric;
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* Define an action in this Convex app's public API.
|
|
64
|
-
*
|
|
65
|
-
* An action is a function which can execute any JavaScript code, including non-deterministic
|
|
66
|
-
* code and code with side-effects, like calling third-party services.
|
|
67
|
-
* They can be run in Convex's JavaScript environment or in Node.js using the "use node" directive.
|
|
68
|
-
* They can interact with the database indirectly by calling queries and mutations using the {@link ActionCtx}.
|
|
69
|
-
*
|
|
70
|
-
* @param func - The action. It receives an {@link ActionCtx} as its first argument.
|
|
71
|
-
* @returns The wrapped action. Include this as an `export` to name it and make it accessible.
|
|
72
|
-
*/
|
|
73
|
-
export const action = actionGeneric;
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* Define an action that is only accessible from other Convex functions (but not from the client).
|
|
77
|
-
*
|
|
78
|
-
* @param func - The function. It receives an {@link ActionCtx} as its first argument.
|
|
79
|
-
* @returns The wrapped function. Include this as an `export` to name it and make it accessible.
|
|
80
|
-
*/
|
|
81
|
-
export const internalAction = internalActionGeneric;
|
|
82
|
-
|
|
83
|
-
/**
|
|
84
|
-
* Define a Convex HTTP action.
|
|
85
|
-
*
|
|
86
|
-
* @param func - The function. It receives an {@link ActionCtx} as its first argument, and a `Request` object
|
|
87
|
-
* as its second.
|
|
88
|
-
* @returns The wrapped endpoint function. Route a URL path to this function in `convex/http.js`.
|
|
89
|
-
*/
|
|
90
|
-
export const httpAction = httpActionGeneric;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|