@convex-dev/persistent-text-streaming 0.2.3 → 0.3.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.
Files changed (108) hide show
  1. package/README.md +37 -35
  2. package/dist/{commonjs/client → client}/index.d.ts +4 -4
  3. package/dist/client/index.d.ts.map +1 -0
  4. package/dist/{esm/client → client}/index.js +1 -0
  5. package/dist/client/index.js.map +1 -0
  6. package/dist/component/_generated/api.d.ts +36 -0
  7. package/dist/component/_generated/api.d.ts.map +1 -0
  8. package/{src → dist}/component/_generated/api.js +11 -3
  9. package/dist/component/_generated/api.js.map +1 -0
  10. package/dist/component/_generated/component.d.ts +44 -0
  11. package/dist/component/_generated/component.d.ts.map +1 -0
  12. package/dist/component/_generated/component.js +11 -0
  13. package/dist/component/_generated/component.js.map +1 -0
  14. package/dist/component/_generated/dataModel.d.ts +46 -0
  15. package/dist/component/_generated/dataModel.d.ts.map +1 -0
  16. package/dist/component/_generated/dataModel.js +11 -0
  17. package/dist/component/_generated/dataModel.js.map +1 -0
  18. package/{src → dist}/component/_generated/server.d.ts +10 -38
  19. package/dist/component/_generated/server.d.ts.map +1 -0
  20. package/dist/{commonjs/component → component}/_generated/server.js +9 -5
  21. package/dist/component/_generated/server.js.map +1 -0
  22. package/dist/component/convex.config.d.ts.map +1 -0
  23. package/dist/component/convex.config.js.map +1 -0
  24. package/dist/component/crons.d.ts.map +1 -0
  25. package/dist/{commonjs/component → component}/crons.js +1 -1
  26. package/dist/component/crons.js.map +1 -0
  27. package/dist/component/lib.d.ts.map +1 -0
  28. package/dist/{commonjs/component → component}/lib.js +2 -2
  29. package/dist/component/lib.js.map +1 -0
  30. package/dist/{commonjs/component → component}/schema.d.ts +1 -1
  31. package/dist/component/schema.d.ts.map +1 -0
  32. package/dist/component/schema.js.map +1 -0
  33. package/dist/{commonjs/react → react}/index.d.ts +2 -2
  34. package/dist/react/index.d.ts.map +1 -0
  35. package/dist/{commonjs/react → react}/index.js +10 -5
  36. package/dist/react/index.js.map +1 -0
  37. package/package.json +64 -54
  38. package/src/client/index.ts +16 -13
  39. package/src/component/_generated/api.ts +52 -0
  40. package/src/component/_generated/component.ts +63 -0
  41. package/src/component/_generated/server.ts +161 -0
  42. package/src/component/crons.ts +2 -2
  43. package/src/component/lib.ts +4 -4
  44. package/src/component/schema.ts +2 -2
  45. package/src/react/index.ts +17 -13
  46. package/src/test.ts +18 -0
  47. package/dist/commonjs/client/index.d.ts.map +0 -1
  48. package/dist/commonjs/client/index.js +0 -146
  49. package/dist/commonjs/client/index.js.map +0 -1
  50. package/dist/commonjs/component/_generated/api.d.ts +0 -12
  51. package/dist/commonjs/component/_generated/api.d.ts.map +0 -1
  52. package/dist/commonjs/component/_generated/api.js +0 -22
  53. package/dist/commonjs/component/_generated/api.js.map +0 -1
  54. package/dist/commonjs/component/_generated/server.d.ts +0 -64
  55. package/dist/commonjs/component/_generated/server.d.ts.map +0 -1
  56. package/dist/commonjs/component/_generated/server.js.map +0 -1
  57. package/dist/commonjs/component/convex.config.d.ts.map +0 -1
  58. package/dist/commonjs/component/convex.config.js.map +0 -1
  59. package/dist/commonjs/component/crons.d.ts.map +0 -1
  60. package/dist/commonjs/component/crons.js.map +0 -1
  61. package/dist/commonjs/component/lib.d.ts.map +0 -1
  62. package/dist/commonjs/component/lib.js.map +0 -1
  63. package/dist/commonjs/component/schema.d.ts.map +0 -1
  64. package/dist/commonjs/component/schema.js.map +0 -1
  65. package/dist/commonjs/package.json +0 -3
  66. package/dist/commonjs/react/index.d.ts.map +0 -1
  67. package/dist/commonjs/react/index.js.map +0 -1
  68. package/dist/esm/client/index.d.ts +0 -89
  69. package/dist/esm/client/index.d.ts.map +0 -1
  70. package/dist/esm/client/index.js.map +0 -1
  71. package/dist/esm/component/_generated/api.d.ts +0 -12
  72. package/dist/esm/component/_generated/api.d.ts.map +0 -1
  73. package/dist/esm/component/_generated/api.js +0 -22
  74. package/dist/esm/component/_generated/api.js.map +0 -1
  75. package/dist/esm/component/_generated/server.d.ts +0 -64
  76. package/dist/esm/component/_generated/server.d.ts.map +0 -1
  77. package/dist/esm/component/_generated/server.js +0 -74
  78. package/dist/esm/component/_generated/server.js.map +0 -1
  79. package/dist/esm/component/convex.config.d.ts +0 -3
  80. package/dist/esm/component/convex.config.d.ts.map +0 -1
  81. package/dist/esm/component/convex.config.js +0 -3
  82. package/dist/esm/component/convex.config.js.map +0 -1
  83. package/dist/esm/component/crons.d.ts +0 -3
  84. package/dist/esm/component/crons.d.ts.map +0 -1
  85. package/dist/esm/component/crons.js +0 -7
  86. package/dist/esm/component/crons.js.map +0 -1
  87. package/dist/esm/component/lib.d.ts +0 -21
  88. package/dist/esm/component/lib.d.ts.map +0 -1
  89. package/dist/esm/component/lib.js +0 -134
  90. package/dist/esm/component/lib.js.map +0 -1
  91. package/dist/esm/component/schema.d.ts +0 -23
  92. package/dist/esm/component/schema.d.ts.map +0 -1
  93. package/dist/esm/component/schema.js +0 -13
  94. package/dist/esm/component/schema.js.map +0 -1
  95. package/dist/esm/package.json +0 -3
  96. package/dist/esm/react/index.d.ts +0 -26
  97. package/dist/esm/react/index.d.ts.map +0 -1
  98. package/dist/esm/react/index.js +0 -136
  99. package/dist/esm/react/index.js.map +0 -1
  100. package/react/package.json +0 -5
  101. package/src/component/_generated/api.d.ts +0 -81
  102. package/src/component/_generated/server.js +0 -90
  103. /package/dist/{commonjs/component → component}/convex.config.d.ts +0 -0
  104. /package/dist/{commonjs/component → component}/convex.config.js +0 -0
  105. /package/dist/{commonjs/component → component}/crons.d.ts +0 -0
  106. /package/dist/{commonjs/component → component}/lib.d.ts +0 -0
  107. /package/dist/{commonjs/component → component}/schema.js +0 -0
  108. /package/src/component/_generated/{dataModel.d.ts → dataModel.ts} +0 -0
@@ -1,64 +0,0 @@
1
- /**
2
- * Define a query in this Convex app's public API.
3
- *
4
- * This function will be allowed to read your Convex database and will be accessible from the client.
5
- *
6
- * @param func - The query function. It receives a {@link QueryCtx} as its first argument.
7
- * @returns The wrapped query. Include this as an `export` to name it and make it accessible.
8
- */
9
- export const query: import("convex/server").QueryBuilder<any, "public">;
10
- /**
11
- * Define a query that is only accessible from other Convex functions (but not from the client).
12
- *
13
- * This function will be allowed to read from your Convex database. It will not be accessible from the client.
14
- *
15
- * @param func - The query function. It receives a {@link QueryCtx} as its first argument.
16
- * @returns The wrapped query. Include this as an `export` to name it and make it accessible.
17
- */
18
- export const internalQuery: import("convex/server").QueryBuilder<any, "internal">;
19
- /**
20
- * Define a mutation in this Convex app's public API.
21
- *
22
- * This function will be allowed to modify your Convex database and will be accessible from the client.
23
- *
24
- * @param func - The mutation function. It receives a {@link MutationCtx} as its first argument.
25
- * @returns The wrapped mutation. Include this as an `export` to name it and make it accessible.
26
- */
27
- export const mutation: import("convex/server").MutationBuilder<any, "public">;
28
- /**
29
- * Define a mutation that is only accessible from other Convex functions (but not from the client).
30
- *
31
- * This function will be allowed to modify your Convex database. It will not be accessible from the client.
32
- *
33
- * @param func - The mutation function. It receives a {@link MutationCtx} as its first argument.
34
- * @returns The wrapped mutation. Include this as an `export` to name it and make it accessible.
35
- */
36
- export const internalMutation: import("convex/server").MutationBuilder<any, "internal">;
37
- /**
38
- * Define an action in this Convex app's public API.
39
- *
40
- * An action is a function which can execute any JavaScript code, including non-deterministic
41
- * code and code with side-effects, like calling third-party services.
42
- * They can be run in Convex's JavaScript environment or in Node.js using the "use node" directive.
43
- * They can interact with the database indirectly by calling queries and mutations using the {@link ActionCtx}.
44
- *
45
- * @param func - The action. It receives an {@link ActionCtx} as its first argument.
46
- * @returns The wrapped action. Include this as an `export` to name it and make it accessible.
47
- */
48
- export const action: import("convex/server").ActionBuilder<any, "public">;
49
- /**
50
- * Define an action that is only accessible from other Convex functions (but not from the client).
51
- *
52
- * @param func - The function. It receives an {@link ActionCtx} as its first argument.
53
- * @returns The wrapped function. Include this as an `export` to name it and make it accessible.
54
- */
55
- export const internalAction: import("convex/server").ActionBuilder<any, "internal">;
56
- /**
57
- * Define a Convex HTTP action.
58
- *
59
- * @param func - The function. It receives an {@link ActionCtx} as its first argument, and a `Request` object
60
- * as its second.
61
- * @returns The wrapped endpoint function. Route a URL path to this function in `convex/http.js`.
62
- */
63
- export const httpAction: (func: (ctx: import("convex/server").GenericActionCtx<import("convex/server").GenericDataModel>, request: Request) => Promise<Response>) => import("convex/server").PublicHttpAction;
64
- //# sourceMappingURL=server.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../../../src/component/_generated/server.js"],"names":[],"mappings":"AAqBA;;;;;;;GAOG;AACH,wEAAkC;AAElC;;;;;;;GAOG;AACH,kFAAkD;AAElD;;;;;;;GAOG;AACH,8EAAwC;AAExC;;;;;;;GAOG;AACH,wFAAwD;AAExD;;;;;;;;;;GAUG;AACH,0EAAoC;AAEpC;;;;;GAKG;AACH,oFAAoD;AAEpD;;;;;;GAMG;AACH,8MAA4C"}
@@ -1,74 +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
- import { actionGeneric, httpActionGeneric, queryGeneric, mutationGeneric, internalActionGeneric, internalMutationGeneric, internalQueryGeneric, componentsGeneric, } from "convex/server";
11
- /**
12
- * Define a query in this Convex app's public API.
13
- *
14
- * This function will be allowed to read your Convex database and will be accessible from the client.
15
- *
16
- * @param func - The query function. It receives a {@link QueryCtx} as its first argument.
17
- * @returns The wrapped query. Include this as an `export` to name it and make it accessible.
18
- */
19
- export const query = queryGeneric;
20
- /**
21
- * Define a query that is only accessible from other Convex functions (but not from the client).
22
- *
23
- * This function will be allowed to read from your Convex database. It will not be accessible from the client.
24
- *
25
- * @param func - The query function. It receives a {@link QueryCtx} as its first argument.
26
- * @returns The wrapped query. Include this as an `export` to name it and make it accessible.
27
- */
28
- export const internalQuery = internalQueryGeneric;
29
- /**
30
- * Define a mutation in this Convex app's public API.
31
- *
32
- * This function will be allowed to modify your Convex database and will be accessible from the client.
33
- *
34
- * @param func - The mutation function. It receives a {@link MutationCtx} as its first argument.
35
- * @returns The wrapped mutation. Include this as an `export` to name it and make it accessible.
36
- */
37
- export const mutation = mutationGeneric;
38
- /**
39
- * Define a mutation that is only accessible from other Convex functions (but not from the client).
40
- *
41
- * This function will be allowed to modify your Convex database. It will not be accessible from the client.
42
- *
43
- * @param func - The mutation function. It receives a {@link MutationCtx} as its first argument.
44
- * @returns The wrapped mutation. Include this as an `export` to name it and make it accessible.
45
- */
46
- export const internalMutation = internalMutationGeneric;
47
- /**
48
- * Define an action in this Convex app's public API.
49
- *
50
- * An action is a function which can execute any JavaScript code, including non-deterministic
51
- * code and code with side-effects, like calling third-party services.
52
- * They can be run in Convex's JavaScript environment or in Node.js using the "use node" directive.
53
- * They can interact with the database indirectly by calling queries and mutations using the {@link ActionCtx}.
54
- *
55
- * @param func - The action. It receives an {@link ActionCtx} as its first argument.
56
- * @returns The wrapped action. Include this as an `export` to name it and make it accessible.
57
- */
58
- export const action = actionGeneric;
59
- /**
60
- * Define an action that is only accessible from other Convex functions (but not from the client).
61
- *
62
- * @param func - The function. It receives an {@link ActionCtx} as its first argument.
63
- * @returns The wrapped function. Include this as an `export` to name it and make it accessible.
64
- */
65
- export const internalAction = internalActionGeneric;
66
- /**
67
- * Define a Convex HTTP action.
68
- *
69
- * @param func - The function. It receives an {@link ActionCtx} as its first argument, and a `Request` object
70
- * as its second.
71
- * @returns The wrapped endpoint function. Route a URL path to this function in `convex/http.js`.
72
- */
73
- export const httpAction = httpActionGeneric;
74
- //# sourceMappingURL=server.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"server.js","sourceRoot":"","sources":["../../../../src/component/_generated/server.js"],"names":[],"mappings":"AAAA,oBAAoB;AACpB;;;;;;;GAOG;AAEH,OAAO,EACL,aAAa,EACb,iBAAiB,EACjB,YAAY,EACZ,eAAe,EACf,qBAAqB,EACrB,uBAAuB,EACvB,oBAAoB,EACpB,iBAAiB,GAClB,MAAM,eAAe,CAAC;AAEvB;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,YAAY,CAAC;AAElC;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,oBAAoB,CAAC;AAElD;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,eAAe,CAAC;AAExC;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,uBAAuB,CAAC;AAExD;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,aAAa,CAAC;AAEpC;;;;;GAKG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,qBAAqB,CAAC;AAEpD;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,iBAAiB,CAAC"}
@@ -1,3 +0,0 @@
1
- declare const _default: import("convex/server").ComponentDefinition<any>;
2
- export default _default;
3
- //# sourceMappingURL=convex.config.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"convex.config.d.ts","sourceRoot":"","sources":["../../../src/component/convex.config.ts"],"names":[],"mappings":";AAEA,wBAA0D"}
@@ -1,3 +0,0 @@
1
- import { defineComponent } from "convex/server";
2
- export default defineComponent("persistentTextStreaming");
3
- //# sourceMappingURL=convex.config.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"convex.config.js","sourceRoot":"","sources":["../../../src/component/convex.config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAEhD,eAAe,eAAe,CAAC,yBAAyB,CAAC,CAAC"}
@@ -1,3 +0,0 @@
1
- declare const crons: import("convex/server").Crons;
2
- export default crons;
3
- //# sourceMappingURL=crons.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"crons.d.ts","sourceRoot":"","sources":["../../../src/component/crons.ts"],"names":[],"mappings":"AAGA,QAAA,MAAM,KAAK,+BAAa,CAAC;AASzB,eAAe,KAAK,CAAC"}
@@ -1,7 +0,0 @@
1
- import { cronJobs } from "convex/server";
2
- import { internal } from "./_generated/api";
3
- const crons = cronJobs();
4
- // Run every minute
5
- crons.interval("cleanup expired streams", { minutes: 1 }, internal.lib.cleanupExpiredStreams);
6
- export default crons;
7
- //# sourceMappingURL=crons.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"crons.js","sourceRoot":"","sources":["../../../src/component/crons.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5C,MAAM,KAAK,GAAG,QAAQ,EAAE,CAAC;AAEzB,mBAAmB;AACnB,KAAK,CAAC,QAAQ,CACZ,yBAAyB,EACzB,EAAE,OAAO,EAAE,CAAC,EAAE,EACd,QAAQ,CAAC,GAAG,CAAC,qBAAqB,CACnC,CAAC;AAEF,eAAe,KAAK,CAAC"}
@@ -1,21 +0,0 @@
1
- export declare const createStream: import("convex/server").RegisteredMutation<"public", {}, Promise<import("convex/values").GenericId<"streams">>>;
2
- export declare const addChunk: import("convex/server").RegisteredMutation<"public", {
3
- streamId: import("convex/values").GenericId<"streams">;
4
- text: string;
5
- final: boolean;
6
- }, Promise<void>>;
7
- export declare const setStreamStatus: import("convex/server").RegisteredMutation<"public", {
8
- status: "pending" | "streaming" | "done" | "error" | "timeout";
9
- streamId: import("convex/values").GenericId<"streams">;
10
- }, Promise<void>>;
11
- export declare const getStreamStatus: import("convex/server").RegisteredQuery<"public", {
12
- streamId: import("convex/values").GenericId<"streams">;
13
- }, Promise<"pending" | "streaming" | "done" | "error" | "timeout">>;
14
- export declare const getStreamText: import("convex/server").RegisteredQuery<"public", {
15
- streamId: import("convex/values").GenericId<"streams">;
16
- }, Promise<{
17
- text: string;
18
- status: "pending" | "streaming" | "done" | "error" | "timeout";
19
- }>>;
20
- export declare const cleanupExpiredStreams: import("convex/server").RegisteredMutation<"internal", {}, Promise<void>>;
21
- //# sourceMappingURL=lib.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"lib.d.ts","sourceRoot":"","sources":["../../../src/component/lib.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,YAAY,iHAQvB,CAAC;AAKH,eAAO,MAAM,QAAQ;;;;iBA4BnB,CAAC;AAIH,eAAO,MAAM,eAAe;;;iBA2B1B,CAAC;AAGH,eAAO,MAAM,eAAe;;mEAS1B,CAAC;AAIH,eAAO,MAAM,aAAa;;;;;GA0BxB,CAAC;AAOH,eAAO,MAAM,qBAAqB,2EAsBhC,CAAC"}
@@ -1,134 +0,0 @@
1
- import { v } from "convex/values";
2
- import { internalMutation, mutation, query } from "./_generated/server";
3
- import { streamStatusValidator } from "./schema";
4
- // Create a new stream with zero chunks.
5
- export const createStream = mutation({
6
- args: {},
7
- handler: async (ctx) => {
8
- const streamId = await ctx.db.insert("streams", {
9
- status: "pending",
10
- });
11
- return streamId;
12
- },
13
- });
14
- // Add a chunk to a stream.
15
- // If final is true, set the stream to done.
16
- // Can only be done on streams which are pending or streaming.
17
- export const addChunk = mutation({
18
- args: {
19
- streamId: v.id("streams"),
20
- text: v.string(),
21
- final: v.boolean(),
22
- },
23
- handler: async (ctx, args) => {
24
- const stream = await ctx.db.get(args.streamId);
25
- if (!stream) {
26
- throw new Error("Stream not found");
27
- }
28
- if (stream.status === "pending") {
29
- await ctx.db.patch(args.streamId, {
30
- status: "streaming",
31
- });
32
- }
33
- else if (stream.status !== "streaming") {
34
- throw new Error("Stream is not streaming; did it timeout?");
35
- }
36
- await ctx.db.insert("chunks", {
37
- streamId: args.streamId,
38
- text: args.text,
39
- });
40
- if (args.final) {
41
- await ctx.db.patch(args.streamId, {
42
- status: "done",
43
- });
44
- }
45
- },
46
- });
47
- // Set the status of a stream.
48
- // Can only be done on streams which are pending or streaming.
49
- export const setStreamStatus = mutation({
50
- args: {
51
- streamId: v.id("streams"),
52
- status: v.union(v.literal("pending"), v.literal("streaming"), v.literal("done"), v.literal("error"), v.literal("timeout")),
53
- },
54
- handler: async (ctx, args) => {
55
- const stream = await ctx.db.get(args.streamId);
56
- if (!stream) {
57
- throw new Error("Stream not found");
58
- }
59
- if (stream.status !== "pending" && stream.status !== "streaming") {
60
- console.log("Stream is already finalized; ignoring status change", stream);
61
- return;
62
- }
63
- await ctx.db.patch(args.streamId, {
64
- status: args.status,
65
- });
66
- },
67
- });
68
- // Get the status of a stream.
69
- export const getStreamStatus = query({
70
- args: {
71
- streamId: v.id("streams"),
72
- },
73
- returns: streamStatusValidator,
74
- handler: async (ctx, args) => {
75
- const stream = await ctx.db.get(args.streamId);
76
- return stream?.status ?? "error";
77
- },
78
- });
79
- // Get the full text of a stream.
80
- // Involves concatenating all the chunks.
81
- export const getStreamText = query({
82
- args: {
83
- streamId: v.id("streams"),
84
- },
85
- returns: v.object({
86
- text: v.string(),
87
- status: streamStatusValidator,
88
- }),
89
- handler: async (ctx, args) => {
90
- const stream = await ctx.db.get(args.streamId);
91
- if (!stream) {
92
- throw new Error("Stream not found");
93
- }
94
- let text = "";
95
- if (stream.status !== "pending") {
96
- const chunks = await ctx.db
97
- .query("chunks")
98
- .withIndex("byStream", (q) => q.eq("streamId", args.streamId))
99
- .collect();
100
- text = chunks.map((chunk) => chunk.text).join("");
101
- }
102
- return {
103
- text,
104
- status: stream.status,
105
- };
106
- },
107
- });
108
- const EXPIRATION_TIME = 20 * 60 * 1000; // 20 minutes in milliseconds
109
- const BATCH_SIZE = 100;
110
- // If the last chunk of a stream was added more than 20 minutes ago,
111
- // set the stream to timeout. The action feeding it has to be dead.
112
- export const cleanupExpiredStreams = internalMutation({
113
- args: {},
114
- handler: async (ctx) => {
115
- const now = Date.now();
116
- const pendingStreams = await ctx.db
117
- .query("streams")
118
- .withIndex("byStatus", (q) => q.eq("status", "pending"))
119
- .take(BATCH_SIZE);
120
- const streamingStreams = await ctx.db
121
- .query("streams")
122
- .withIndex("byStatus", (q) => q.eq("status", "streaming"))
123
- .take(BATCH_SIZE);
124
- for (const stream of [...pendingStreams, ...streamingStreams]) {
125
- if (now - stream._creationTime > EXPIRATION_TIME) {
126
- console.log("Cleaning up expired stream", stream._id);
127
- await ctx.db.patch(stream._id, {
128
- status: "timeout",
129
- });
130
- }
131
- }
132
- },
133
- });
134
- //# sourceMappingURL=lib.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"lib.js","sourceRoot":"","sources":["../../../src/component/lib.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAClC,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AACxE,OAAO,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAEjD,wCAAwC;AACxC,MAAM,CAAC,MAAM,YAAY,GAAG,QAAQ,CAAC;IACnC,IAAI,EAAE,EAAE;IACR,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,EAAE;QACrB,MAAM,QAAQ,GAAG,MAAM,GAAG,CAAC,EAAE,CAAC,MAAM,CAAC,SAAS,EAAE;YAC9C,MAAM,EAAE,SAAS;SAClB,CAAC,CAAC;QACH,OAAO,QAAQ,CAAC;IAClB,CAAC;CACF,CAAC,CAAC;AAEH,2BAA2B;AAC3B,4CAA4C;AAC5C,8DAA8D;AAC9D,MAAM,CAAC,MAAM,QAAQ,GAAG,QAAQ,CAAC;IAC/B,IAAI,EAAE;QACJ,QAAQ,EAAE,CAAC,CAAC,EAAE,CAAC,SAAS,CAAC;QACzB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;QAChB,KAAK,EAAE,CAAC,CAAC,OAAO,EAAE;KACnB;IACD,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE;QAC3B,MAAM,MAAM,GAAG,MAAM,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAC/C,IAAI,CA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M,gBAAgB,GAAG,MAAM,GAAG,CAAC,EAAE;aAClC,KAAK,CAAC,SAAS,CAAC;aAChB,SAAS,CAAC,UAAU,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;aACzD,IAAI,CAAC,UAAU,CAAC,CAAC;QAEpB,KAAK,MAAM,MAAM,IAAI,CAAC,GAAG,cAAc,EAAE,GAAG,gBAAgB,CAAC,EAAE;YAC7D,IAAI,GAAG,GAAG,MAAM,CAAC,aAAa,GAAG,eAAe,EAAE;gBAChD,OAAO,CAAC,GAAG,CAAC,4BAA4B,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC;gBACtD,MAAM,GAAG,CAAC,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,EAAE;oBAC7B,MAAM,EAAE,SAAS;iBAClB,CAAC,CAAC;aACJ;SACF;IACH,CAAC;CACF,CAAC,CAAC"}
@@ -1,23 +0,0 @@
1
- import { Infer } from "convex/values";
2
- export declare const streamStatusValidator: import("convex/values").VUnion<"pending" | "streaming" | "done" | "error" | "timeout", [import("convex/values").VLiteral<"pending", "required">, import("convex/values").VLiteral<"streaming", "required">, import("convex/values").VLiteral<"done", "required">, import("convex/values").VLiteral<"error", "required">, import("convex/values").VLiteral<"timeout", "required">], "required", never>;
3
- export type StreamStatus = Infer<typeof streamStatusValidator>;
4
- declare const _default: import("convex/server").SchemaDefinition<{
5
- streams: import("convex/server").TableDefinition<import("convex/values").VObject<{
6
- status: "pending" | "streaming" | "done" | "error" | "timeout";
7
- }, {
8
- status: import("convex/values").VUnion<"pending" | "streaming" | "done" | "error" | "timeout", [import("convex/values").VLiteral<"pending", "required">, import("convex/values").VLiteral<"streaming", "required">, import("convex/values").VLiteral<"done", "required">, import("convex/values").VLiteral<"error", "required">, import("convex/values").VLiteral<"timeout", "required">], "required", never>;
9
- }, "required", "status">, {
10
- byStatus: ["status", "_creationTime"];
11
- }, {}, {}>;
12
- chunks: import("convex/server").TableDefinition<import("convex/values").VObject<{
13
- streamId: import("convex/values").GenericId<"streams">;
14
- text: string;
15
- }, {
16
- streamId: import("convex/values").VId<import("convex/values").GenericId<"streams">, "required">;
17
- text: import("convex/values").VString<string, "required">;
18
- }, "required", "streamId" | "text">, {
19
- byStream: ["streamId", "_creationTime"];
20
- }, {}, {}>;
21
- }, true>;
22
- export default _default;
23
- //# sourceMappingURL=schema.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../src/component/schema.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAK,MAAM,eAAe,CAAC;AAEzC,eAAO,MAAM,qBAAqB,uYAMjC,CAAC;AACF,MAAM,MAAM,YAAY,GAAG,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;;;;;;;;;;;;;;;;;;;AAE/D,wBAQG"}
@@ -1,13 +0,0 @@
1
- import { defineSchema, defineTable } from "convex/server";
2
- import { v } from "convex/values";
3
- export const streamStatusValidator = v.union(v.literal("pending"), v.literal("streaming"), v.literal("done"), v.literal("error"), v.literal("timeout"));
4
- export default defineSchema({
5
- streams: defineTable({
6
- status: streamStatusValidator,
7
- }).index("byStatus", ["status"]),
8
- chunks: defineTable({
9
- streamId: v.id("streams"),
10
- text: v.string(),
11
- }).index("byStream", ["streamId"]),
12
- });
13
- //# sourceMappingURL=schema.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../src/component/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC1D,OAAO,EAAS,CAAC,EAAE,MAAM,eAAe,CAAC;AAEzC,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAC1C,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,EACpB,CAAC,CAAC,OAAO,CAAC,WAAW,CAAC,EACtB,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,EACjB,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,EAClB,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,CACrB,CAAC;AAGF,eAAe,YAAY,CAAC;IAC1B,OAAO,EAAE,WAAW,CAAC;QACnB,MAAM,EAAE,qBAAqB;KAC9B,CAAC,CAAC,KAAK,CAAC,UAAU,EAAE,CAAC,QAAQ,CAAC,CAAC;IAChC,MAAM,EAAE,WAAW,CAAC;QAClB,QAAQ,EAAE,CAAC,CAAC,EAAE,CAAC,SAAS,CAAC;QACzB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;KACjB,CAAC,CAAC,KAAK,CAAC,UAAU,EAAE,CAAC,UAAU,CAAC,CAAC;CACnC,CAAC,CAAC"}
@@ -1,3 +0,0 @@
1
- {
2
- "type": "module"
3
- }
@@ -1,26 +0,0 @@
1
- import { StreamBody, StreamId } from "../client";
2
- import { FunctionReference } from "convex/server";
3
- /**
4
- * React hook for persistent text streaming.
5
- *
6
- * @param getPersistentBody - A query function reference that returns the body
7
- * of a stream using the component's `getStreamBody` method.
8
- * @param streamUrl - The URL of the http action that will kick off the stream
9
- * generation and stream the result back to the client using the component's
10
- * `stream` method.
11
- * @param driven - Whether this particular session is driving the stream. Set this
12
- * to true if this is the client session that first created the stream using the
13
- * component's `createStream` method. If you're simply reloading an existing
14
- * stream, set this to false.
15
- * @param streamId - The ID of the stream. If this is not provided, the return
16
- * value will be an empty string for the stream body and the status will be
17
- * `pending`.
18
- * @returns The body and status of the stream.
19
- */
20
- export declare function useStream(getPersistentBody: FunctionReference<"query", "public", {
21
- streamId: string;
22
- }, StreamBody>, streamUrl: URL, driven: boolean, streamId: StreamId | undefined, opts?: {
23
- authToken?: string | null;
24
- headers?: Record<string, string>;
25
- }): StreamBody;
26
- //# sourceMappingURL=index.d.ts.map
@@ -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;AAMlD;;;;;;;;;;;;;;;;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"}
@@ -1,136 +0,0 @@
1
- "use client";
2
- import { useQuery } from "convex/react";
3
- import { useEffect, useMemo, useRef, useState } from "react";
4
- if (typeof window === "undefined") {
5
- throw new Error("this is frontend code, but it's running somewhere else!");
6
- }
7
- /**
8
- * React hook for persistent text streaming.
9
- *
10
- * @param getPersistentBody - A query function reference that returns the body
11
- * of a stream using the component's `getStreamBody` method.
12
- * @param streamUrl - The URL of the http action that will kick off the stream
13
- * generation and stream the result back to the client using the component's
14
- * `stream` method.
15
- * @param driven - Whether this particular session is driving the stream. Set this
16
- * to true if this is the client session that first created the stream using the
17
- * component's `createStream` method. If you're simply reloading an existing
18
- * stream, set this to false.
19
- * @param streamId - The ID of the stream. If this is not provided, the return
20
- * value will be an empty string for the stream body and the status will be
21
- * `pending`.
22
- * @returns The body and status of the stream.
23
- */
24
- export function useStream(getPersistentBody, streamUrl, driven, streamId, opts) {
25
- const [streamEnded, setStreamEnded] = useState(null);
26
- // Used to prevent strict mode from causing multiple streams to be started.
27
- const streamStarted = useRef(false);
28
- const usePersistence = useMemo(() => {
29
- // Something is wrong with the stream, so we need to use the database value.
30
- if (streamEnded === false) {
31
- return true;
32
- }
33
- // If we're not driving the stream, we must use the database value.
34
- if (!driven) {
35
- return true;
36
- }
37
- // Otherwise, we'll try to drive the stream and use the HTTP response.
38
- return false;
39
- }, [driven, streamId, streamEnded]);
40
- // console.log("usePersistence", usePersistence);
41
- const persistentBody = useQuery(getPersistentBody, usePersistence && streamId ? { streamId } : "skip");
42
- const [streamBody, setStreamBody] = useState("");
43
- useEffect(() => {
44
- if (driven && streamId && !streamStarted.current) {
45
- // Kick off HTTP action.
46
- void (async () => {
47
- const success = await startStreaming(streamUrl, streamId, (text) => {
48
- setStreamBody((prev) => prev + text);
49
- }, {
50
- ...opts?.headers,
51
- ...(opts?.authToken
52
- ? { Authorization: `Bearer ${opts.authToken}` }
53
- : {}),
54
- });
55
- setStreamEnded(success);
56
- })();
57
- // If we get remounted, we don't want to start a new stream.
58
- return () => {
59
- streamStarted.current = true;
60
- };
61
- }
62
- }, [driven, streamId, setStreamEnded, streamStarted]);
63
- const body = useMemo(() => {
64
- // console.log(
65
- // "body info p vs. s",
66
- // persistentBody?.text?.length ?? 0,
67
- // streamBody.length
68
- //);
69
- if (persistentBody) {
70
- return persistentBody;
71
- }
72
- let status;
73
- if (streamEnded === null) {
74
- status = streamBody.length > 0 ? "streaming" : "pending";
75
- }
76
- else {
77
- status = streamEnded ? "done" : "error";
78
- }
79
- return {
80
- text: streamBody,
81
- status: status,
82
- };
83
- }, [persistentBody, streamBody, streamEnded]);
84
- return body;
85
- }
86
- /**
87
- * Internal helper for starting a stream.
88
- *
89
- * @param url - The URL of the http action that will kick off the stream
90
- * generation and stream the result back to the client using the component's
91
- * `stream` method.
92
- * @param streamId - The ID of the stream.
93
- * @param onUpdate - A function that updates the stream body.
94
- * @returns A promise that resolves to a boolean indicating whether the stream
95
- * was started successfully. It can fail if the http action is not found, or
96
- * CORS fails, or an exception is raised, or the stream is already running
97
- * or finished, etc.
98
- */
99
- async function startStreaming(url, streamId, onUpdate, headers) {
100
- const response = await fetch(url, {
101
- method: "POST",
102
- body: JSON.stringify({
103
- streamId: streamId,
104
- }),
105
- headers: { "Content-Type": "application/json", ...headers },
106
- });
107
- // Adapted from https://developer.mozilla.org/en-US/docs/Web/API/Streams_API/Using_readable_streams
108
- if (response.status === 205) {
109
- console.error("Stream already finished", response);
110
- return false;
111
- }
112
- if (!response.ok) {
113
- console.error("Failed to reach streaming endpoint", response);
114
- return false;
115
- }
116
- if (!response.body) {
117
- console.error("No body in response", response);
118
- return false;
119
- }
120
- const reader = response.body.getReader();
121
- while (true) {
122
- try {
123
- const { done, value } = await reader.read();
124
- if (done) {
125
- onUpdate(new TextDecoder().decode(value));
126
- return true;
127
- }
128
- onUpdate(new TextDecoder().decode(value));
129
- }
130
- catch (e) {
131
- console.error("Error reading stream", e);
132
- return false;
133
- }
134
- }
135
- }
136
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/react/index.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAIb,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAExC,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAG7D,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE;IACjC,MAAM,IAAI,KAAK,CAAC,yDAAyD,CAAC,CAAC;CAC5E;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,SAAS,CACvB,iBAKC,EACD,SAAc,EACd,MAAe,EACf,QAA8B,EAC9B,IAKC;IAED,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,QAAQ,CAAC,IAAsB,CAAC,CAAC;IAEvE,2EAA2E;IAC3E,MAAM,aAAa,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;IAEpC,MAAM,cAAc,GAAG,OAAO,CAAC,GAAG,EAAE;QAClC,4EAA4E;QAC5E,IAAI,WAAW,KAAK,KAAK,EAAE;YACzB,OAAO,IAAI,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