@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
package/README.md CHANGED
@@ -4,29 +4,30 @@
4
4
 
5
5
  <!-- START: Include on https://convex.dev/components -->
6
6
 
7
- This Convex component enables persistent text streaming. It provides a React hook
8
- for streaming text from HTTP actions while simultaneously storing the data in the
9
- database. This persistence allows the text to be accessed after the stream ends
10
- or by other users.
7
+ This Convex component enables persistent text streaming. It provides a React
8
+ hook for streaming text from HTTP actions while simultaneously storing the data
9
+ in the database. This persistence allows the text to be accessed after the
10
+ stream ends or by other users.
11
11
 
12
- The most common use case is for AI chat applications. The example app (found in the
13
- `example` directory) is a just such a simple chat app that demonstrates use of the
14
- component.
12
+ The most common use case is for AI chat applications. The example app (found in
13
+ the `example` directory) is a just such a simple chat app that demonstrates use
14
+ of the component.
15
15
 
16
- Here's what you'll end up with! The left browser window is streaming the chat body to the client,
17
- and the right browser window is subscribed to the chat body via a database query. The
18
- message is only updated in the database on sentence boundaries, whereas the HTTP
19
- stream sends tokens as they come:
16
+ Here's what you'll end up with! The left browser window is streaming the chat
17
+ body to the client, and the right browser window is subscribed to the chat body
18
+ via a database query. The message is only updated in the database on sentence
19
+ boundaries, whereas the HTTP stream sends tokens as they come:
20
20
 
21
21
  ![example-animation](./anim.gif)
22
22
 
23
23
  ## Pre-requisite: Convex
24
24
 
25
- You'll need an existing Convex project to use the component.
26
- Convex is a hosted backend platform, including a database, serverless functions,
27
- and a ton more you can learn about [here](https://docs.convex.dev/get-started).
25
+ You'll need an existing Convex project to use the component. Convex is a hosted
26
+ backend platform, including a database, serverless functions, and a ton more you
27
+ can learn about [here](https://docs.convex.dev/get-started).
28
28
 
29
- Run `npm create convex` or follow any of the [quickstarts](https://docs.convex.dev/home) to set one up.
29
+ Run `npm create convex` or follow any of the
30
+ [quickstarts](https://docs.convex.dev/home) to set one up.
30
31
 
31
32
  ## Installation
32
33
 
@@ -44,7 +45,7 @@ npm install @convex-dev/persistent-text-streaming
44
45
  ```ts
45
46
  // convex/convex.config.ts
46
47
  import { defineApp } from "convex/server";
47
- import persistentTextStreaming from "@convex-dev/persistent-text-streaming/convex.config";
48
+ import persistentTextStreaming from "@convex-dev/persistent-text-streaming/convex.config.js";
48
49
 
49
50
  const app = defineApp();
50
51
  app.use(persistentTextStreaming);
@@ -59,7 +60,7 @@ In `convex/chat.ts`:
59
60
 
60
61
  ```ts
61
62
  const persistentTextStreaming = new PersistentTextStreaming(
62
- components.persistentTextStreaming
63
+ components.persistentTextStreaming,
63
64
  );
64
65
 
65
66
  // Create a stream using the component and store the id in the database with
@@ -87,7 +88,7 @@ export const getChatBody = query({
87
88
  handler: async (ctx, args) => {
88
89
  return await persistentTextStreaming.getStreamBody(
89
90
  ctx,
90
- args.streamId as StreamId
91
+ args.streamId as StreamId,
91
92
  );
92
93
  },
93
94
  });
@@ -95,7 +96,7 @@ export const getChatBody = query({
95
96
  // Create an HTTP action that generates chunks of the chat body
96
97
  // and uses the component to stream them to the client and save them to the database.
97
98
  export const streamChat = httpAction(async (ctx, request) => {
98
- const body = (await request.json()) as {streamId: string};
99
+ const body = (await request.json()) as { streamId: string };
99
100
  const generateChat = async (ctx, request, streamId, chunkAppender) => {
100
101
  await chunkAppender("Hi there!");
101
102
  await chunkAppender("How are you?");
@@ -106,7 +107,7 @@ export const streamChat = httpAction(async (ctx, request) => {
106
107
  ctx,
107
108
  request,
108
109
  body.streamId as StreamId,
109
- generateChat
110
+ generateChat,
110
111
  );
111
112
 
112
113
  // Set CORS headers appropriately.
@@ -126,8 +127,8 @@ http.route({
126
127
  });
127
128
  ```
128
129
 
129
- Finally, in your app, you can now create chats and them subscribe to them
130
- via stream and/or database query as optimal:
130
+ Finally, in your app, you can now create chats and them subscribe to them via
131
+ stream and/or database query as optimal:
131
132
 
132
133
  ```ts
133
134
  // chat-input.tsx, maybe?
@@ -149,7 +150,7 @@ const { text, status } = useStream(
149
150
  api.chat.getChatBody, // The query to call for the full stream body
150
151
  new URL(`${convexSiteUrl}/chat-stream`), // The HTTP endpoint for streaming
151
152
  driven, // True if this browser session created this chat and should generate the stream
152
- chat.streamId as StreamId // The streamId from the chat database record
153
+ chat.streamId as StreamId, // The streamId from the chat database record
153
154
  );
154
155
  ```
155
156
 
@@ -162,28 +163,29 @@ let's examine each approach in isolation.
162
163
  - **HTTP streaming only**: If your app _only_ uses HTTP streaming, then the
163
164
  original browser that made the request will have a great, high-performance
164
165
  streaming experience. But if that HTTP connection is lost, if the browser
165
- window is reloaded, if other users want to view the same chat, or this
166
- users wants to revisit the conversation later, it won't be possible. The
166
+ window is reloaded, if other users want to view the same chat, or this users
167
+ wants to revisit the conversation later, it won't be possible. The
167
168
  conversation is only ephemeral because it was never stored on the server.
168
169
 
169
170
  - **Database Persistence Only**: If your app _only_ uses database persistence,
170
171
  it's true that the conversation will be available for as long as you want.
171
172
  Additionally, Convex's subscriptions will ensure the chat message is updated
172
- as new text chunks are generated. However, there are a few downsides: one,
173
- the entire chat body needs to be resent every time it is changed, which is a
174
- lot redundant bandwidth to push into the database and over the websockets to
175
- all connected clients. Two, you'll need to make a difficult tradeoff between
173
+ as new text chunks are generated. However, there are a few downsides: one, the
174
+ entire chat body needs to be resent every time it is changed, which is a lot
175
+ redundant bandwidth to push into the database and over the websockets to all
176
+ connected clients. Two, you'll need to make a difficult tradeoff between
176
177
  interactivity and efficiency. If you write every single small chunk to the
177
- database, this will get quite slow and expensive. But if you batch up the chunks
178
- into, say, paragraphs, then the user experience will feel laggy.
178
+ database, this will get quite slow and expensive. But if you batch up the
179
+ chunks into, say, paragraphs, then the user experience will feel laggy.
179
180
 
180
- This component combines the best of both worlds. The original browser that
181
- makes the request will still have a great, high-performance streaming experience.
182
- But the chat body is also stored in the database, so it can be accessed by the
181
+ This component combines the best of both worlds. The original browser that makes
182
+ the request will still have a great, high-performance streaming experience. But
183
+ the chat body is also stored in the database, so it can be accessed by the
183
184
  client even after the stream has finished, or by other users, etc.
184
185
 
185
186
  ## Background
186
187
 
187
- This component is largely based on the Stack post [AI Chat with HTTP Streaming](https://stack.convex.dev/ai-chat-with-http-streaming).
188
+ This component is largely based on the Stack post
189
+ [AI Chat with HTTP Streaming](https://stack.convex.dev/ai-chat-with-http-streaming).
188
190
 
189
191
  <!-- END: Include on https://convex.dev/components -->
@@ -1,7 +1,7 @@
1
- import { Expand, FunctionReference, GenericActionCtx, GenericDataModel, GenericMutationCtx, GenericQueryCtx } from "convex/server";
2
- import { GenericId } from "convex/values";
3
- import { api } from "../component/_generated/api";
4
- import { StreamStatus } from "../component/schema";
1
+ import type { Expand, FunctionReference, GenericActionCtx, GenericDataModel, GenericMutationCtx, GenericQueryCtx } from "convex/server";
2
+ import { type GenericId } from "convex/values";
3
+ import { api } from "../component/_generated/api.js";
4
+ import type { StreamStatus } from "../component/schema.js";
5
5
  export type StreamId = string & {
6
6
  __isStreamId: true;
7
7
  };
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,MAAM,EACN,iBAAiB,EACjB,gBAAgB,EAChB,gBAAgB,EAChB,kBAAkB,EAClB,eAAe,EAChB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAK,KAAK,SAAS,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,EAAE,GAAG,EAAE,MAAM,gCAAgC,CAAC;AACrD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAE3D,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG;IAAE,YAAY,EAAE,IAAI,CAAA;CAAE,CAAC;AACvD,eAAO,MAAM,iBAAiB,qDAAa,CAAC;AAC5C,MAAM,MAAM,UAAU,GAAG;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,YAAY,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;AAC5D,MAAM,MAAM,YAAY,CAAC,CAAC,SAAS,gBAAgB,CAAC,gBAAgB,CAAC,IAAI,CACvE,GAAG,EAAE,CAAC,EACN,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,QAAQ,EAClB,aAAa,EAAE,aAAa,KACzB,OAAO,CAAC,IAAI,CAAC,CAAC;AAQ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AAM,MAAM,CAAC,GAAG,IAAI,MAAM,CAAC;KAC9B,GAAG,IAAI,MAAM,GAAG,GAAG,GAAG,CAAC,GAAG,CAAC,SAAS,iBAAiB,CACpD,MAAM,KAAK,EACX,QAAQ,EACR,MAAM,KAAK,EACX,MAAM,WAAW,EACjB,MAAM,cAAc,CACrB,GACG,iBAAiB,CACf,KAAK,EACL,UAAU,EACV,SAAS,CAAC,KAAK,CAAC,EAChB,SAAS,CAAC,WAAW,CAAC,EACtB,cAAc,CACf,GACD,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;CACrB,CAAC,CAAC"}
@@ -1,4 +1,5 @@
1
1
  import { v } from "convex/values";
2
+ import { api } from "../component/_generated/api.js";
2
3
  export const StreamIdValidator = v.string();
3
4
  // TODO -- make more flexible. # of bytes, etc?
4
5
  const hasDelimeter = (text) => {
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,CAAC,EAAkB,MAAM,eAAe,CAAC;AAClD,OAAO,EAAE,GAAG,EAAE,MAAM,gCAAgC,CAAC;AAIrD,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC;AAc5C,+CAA+C;AAC/C,MAAM,YAAY,GAAG,CAAC,IAAY,EAAE,EAAE;IACpC,OAAO,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;AACxE,CAAC,CAAC;AAEF,2EAA2E;AAC3E,MAAM,OAAO,uBAAuB;IAEzB;IACA;IAFT,YACS,SAA6B,EAC7B,OAAgB;QADhB,cAAS,GAAT,SAAS,CAAoB;QAC7B,YAAO,GAAP,OAAO,CAAS;IACtB,CAAC;IAEJ;;;;;;;;;;;;;;;;OAgBG;IAEH,KAAK,CAAC,YAAY,CAAC,G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,CAAC,QAAQ,CAAC,CAAC;IAChC,CAAC;IAED,gDAAgD;IACxC,KAAK,CAAC,QAAQ,CACpB,GAAmB,EACnB,QAAkB,EAClB,IAAY,EACZ,KAAc;QAEd,MAAM,GAAG,CAAC,WAAW,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,QAAQ,EAAE;YACjD,QAAQ;YACR,IAAI;YACJ,KAAK;SACN,CAAC,CAAC;IACL,CAAC;IAED,iDAAiD;IACzC,KAAK,CAAC,eAAe,CAC3B,GAAmB,EACnB,QAAkB,EAClB,MAAoB;QAEpB,MAAM,GAAG,CAAC,WAAW,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,eAAe,EAAE;YACxD,QAAQ;YACR,MAAM;SACP,CAAC,CAAC;IACL,CAAC;CACF"}
@@ -0,0 +1,36 @@
1
+ /**
2
+ * Generated `api` utility.
3
+ *
4
+ * THIS CODE IS AUTOMATICALLY GENERATED.
5
+ *
6
+ * To regenerate, run `npx convex dev`.
7
+ * @module
8
+ */
9
+ import type * as crons from "../crons.js";
10
+ import type * as lib from "../lib.js";
11
+ import type { ApiFromModules, FilterApi, FunctionReference } from "convex/server";
12
+ declare const fullApi: ApiFromModules<{
13
+ crons: typeof crons;
14
+ lib: typeof lib;
15
+ }>;
16
+ /**
17
+ * A utility for referencing Convex functions in your app's public API.
18
+ *
19
+ * Usage:
20
+ * ```js
21
+ * const myFunctionReference = api.myModule.myFunction;
22
+ * ```
23
+ */
24
+ export declare const api: FilterApi<typeof fullApi, FunctionReference<any, "public">>;
25
+ /**
26
+ * A utility for referencing Convex functions in your app's internal API.
27
+ *
28
+ * Usage:
29
+ * ```js
30
+ * const myFunctionReference = internal.myModule.myFunction;
31
+ * ```
32
+ */
33
+ export declare const internal: FilterApi<typeof fullApi, FunctionReference<any, "internal">>;
34
+ export declare const components: {};
35
+ export {};
36
+ //# sourceMappingURL=api.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../../src/component/_generated/api.ts"],"names":[],"mappings":"AACA;;;;;;;GAOG;AAEH,OAAO,KAAK,KAAK,KAAK,MAAM,aAAa,CAAC;AAC1C,OAAO,KAAK,KAAK,GAAG,MAAM,WAAW,CAAC;AAEtC,OAAO,KAAK,EACV,cAAc,EACd,SAAS,EACT,iBAAiB,EAClB,MAAM,eAAe,CAAC;AAGvB,QAAA,MAAM,OAAO,EAAE,cAAc,CAAC;IAC5B,KAAK,EAAE,OAAO,KAAK,CAAC;IACpB,GAAG,EAAE,OAAO,GAAG,CAAC;CACjB,CAAiB,CAAC;AAEnB;;;;;;;GAOG;AACH,eAAO,MAAM,GAAG,EAAE,SAAS,CACzB,OAAO,OAAO,EACd,iBAAiB,CAAC,GAAG,EAAE,QAAQ,CAAC,CACjB,CAAC;AAElB;;;;;;;GAOG;AACH,eAAO,MAAM,QAAQ,EAAE,SAAS,CAC9B,OAAO,OAAO,EACd,iBAAiB,CAAC,GAAG,EAAE,UAAU,CAAC,CACnB,CAAC;AAElB,eAAO,MAAM,UAAU,EAAqC,EAAE,CAAC"}
@@ -7,11 +7,10 @@
7
7
  * To regenerate, run `npx convex dev`.
8
8
  * @module
9
9
  */
10
-
11
10
  import { anyApi, componentsGeneric } from "convex/server";
12
-
11
+ const fullApi = anyApi;
13
12
  /**
14
- * A utility for referencing Convex functions in your app's API.
13
+ * A utility for referencing Convex functions in your app's public API.
15
14
  *
16
15
  * Usage:
17
16
  * ```js
@@ -19,5 +18,14 @@ import { anyApi, componentsGeneric } from "convex/server";
19
18
  * ```
20
19
  */
21
20
  export const api = anyApi;
21
+ /**
22
+ * A utility for referencing Convex functions in your app's internal API.
23
+ *
24
+ * Usage:
25
+ * ```js
26
+ * const myFunctionReference = internal.myModule.myFunction;
27
+ * ```
28
+ */
22
29
  export const internal = anyApi;
23
30
  export const components = componentsGeneric();
31
+ //# sourceMappingURL=api.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api.js","sourceRoot":"","sources":["../../../src/component/_generated/api.ts"],"names":[],"mappings":"AAAA,oBAAoB;AACpB;;;;;;;GAOG;AAUH,OAAO,EAAE,MAAM,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAE1D,MAAM,OAAO,GAGR,MAAa,CAAC;AAEnB;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,GAAG,GAGZ,MAAa,CAAC;AAElB;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,QAAQ,GAGjB,MAAa,CAAC;AAElB,MAAM,CAAC,MAAM,UAAU,GAAG,iBAAiB,EAAmB,CAAC"}
@@ -0,0 +1,44 @@
1
+ /**
2
+ * Generated `ComponentApi` utility.
3
+ *
4
+ * THIS CODE IS AUTOMATICALLY GENERATED.
5
+ *
6
+ * To regenerate, run `npx convex dev`.
7
+ * @module
8
+ */
9
+ import type { FunctionReference } from "convex/server";
10
+ /**
11
+ * A utility for referencing a Convex component's exposed API.
12
+ *
13
+ * Useful when expecting a parameter like `components.myComponent`.
14
+ * Usage:
15
+ * ```ts
16
+ * async function myFunction(ctx: QueryCtx, component: ComponentApi) {
17
+ * return ctx.runQuery(component.someFile.someQuery, { ...args });
18
+ * }
19
+ * ```
20
+ */
21
+ export type ComponentApi<Name extends string | undefined = string | undefined> = {
22
+ lib: {
23
+ addChunk: FunctionReference<"mutation", "internal", {
24
+ final: boolean;
25
+ streamId: string;
26
+ text: string;
27
+ }, any, Name>;
28
+ createStream: FunctionReference<"mutation", "internal", {}, any, Name>;
29
+ getStreamStatus: FunctionReference<"query", "internal", {
30
+ streamId: string;
31
+ }, "pending" | "streaming" | "done" | "error" | "timeout", Name>;
32
+ getStreamText: FunctionReference<"query", "internal", {
33
+ streamId: string;
34
+ }, {
35
+ status: "pending" | "streaming" | "done" | "error" | "timeout";
36
+ text: string;
37
+ }, Name>;
38
+ setStreamStatus: FunctionReference<"mutation", "internal", {
39
+ status: "pending" | "streaming" | "done" | "error" | "timeout";
40
+ streamId: string;
41
+ }, any, Name>;
42
+ };
43
+ };
44
+ //# sourceMappingURL=component.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../../../src/component/_generated/component.ts"],"names":[],"mappings":"AACA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAEvD;;;;;;;;;;GAUG;AACH,MAAM,MAAM,YAAY,CAAC,IAAI,SAAS,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,IAC3E;IACE,GAAG,EAAE;QACH,QAAQ,EAAE,iBAAiB,CACzB,UAAU,EACV,UAAU,EACV;YAAE,KAAK,EAAE,OAAO,CAAC;YAAC,QAAQ,EAAE,MAAM,CAAC;YAAC,IAAI,EAAE,MAAM,CAAA;SAAE,EAClD,GAAG,EACH,IAAI,CACL,CAAC;QACF,YAAY,EAAE,iBAAiB,CAAC,UAAU,EAAE,UAAU,EAAE,EAAE,EAAE,GAAG,EAAE,IAAI,CAAC,CAAC;QACvE,eAAe,EAAE,iBAAiB,CAChC,OAAO,EACP,UAAU,EACV;YAAE,QAAQ,EAAE,MAAM,CAAA;SAAE,EACpB,SAAS,GAAG,WAAW,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,EACtD,IAAI,CACL,CAAC;QACF,aAAa,EAAE,iBAAiB,CAC9B,OAAO,EACP,UAAU,EACV;YAAE,QAAQ,EAAE,MAAM,CAAA;SAAE,EACpB;YACE,MAAM,EAAE,SAAS,GAAG,WAAW,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC;YAC/D,IAAI,EAAE,MAAM,CAAC;SACd,EACD,IAAI,CACL,CAAC;QACF,eAAe,EAAE,iBAAiB,CAChC,UAAU,EACV,UAAU,EACV;YACE,MAAM,EAAE,SAAS,GAAG,WAAW,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC;YAC/D,QAAQ,EAAE,MAAM,CAAC;SAClB,EACD,GAAG,EACH,IAAI,CACL,CAAC;KACH,CAAC;CACH,CAAC"}
@@ -0,0 +1,11 @@
1
+ /* eslint-disable */
2
+ /**
3
+ * Generated `ComponentApi` utility.
4
+ *
5
+ * THIS CODE IS AUTOMATICALLY GENERATED.
6
+ *
7
+ * To regenerate, run `npx convex dev`.
8
+ * @module
9
+ */
10
+ export {};
11
+ //# sourceMappingURL=component.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"component.js","sourceRoot":"","sources":["../../../src/component/_generated/component.ts"],"names":[],"mappings":"AAAA,oBAAoB;AACpB;;;;;;;GAOG"}
@@ -0,0 +1,46 @@
1
+ /**
2
+ * Generated data model types.
3
+ *
4
+ * THIS CODE IS AUTOMATICALLY GENERATED.
5
+ *
6
+ * To regenerate, run `npx convex dev`.
7
+ * @module
8
+ */
9
+ import type { DataModelFromSchemaDefinition, DocumentByName, TableNamesInDataModel, SystemTableNames } from "convex/server";
10
+ import type { GenericId } from "convex/values";
11
+ import schema from "../schema.js";
12
+ /**
13
+ * The names of all of your Convex tables.
14
+ */
15
+ export type TableNames = TableNamesInDataModel<DataModel>;
16
+ /**
17
+ * The type of a document stored in Convex.
18
+ *
19
+ * @typeParam TableName - A string literal type of the table name (like "users").
20
+ */
21
+ export type Doc<TableName extends TableNames> = DocumentByName<DataModel, TableName>;
22
+ /**
23
+ * An identifier for a document in Convex.
24
+ *
25
+ * Convex documents are uniquely identified by their `Id`, which is accessible
26
+ * on the `_id` field. To learn more, see [Document IDs](https://docs.convex.dev/using/document-ids).
27
+ *
28
+ * Documents can be loaded using `db.get(id)` in query and mutation functions.
29
+ *
30
+ * IDs are just strings at runtime, but this type can be used to distinguish them from other
31
+ * strings when type checking.
32
+ *
33
+ * @typeParam TableName - A string literal type of the table name (like "users").
34
+ */
35
+ export type Id<TableName extends TableNames | SystemTableNames> = GenericId<TableName>;
36
+ /**
37
+ * A type describing your Convex data model.
38
+ *
39
+ * This type includes information about what tables you have, the type of
40
+ * documents stored in those tables, and the indexes defined on them.
41
+ *
42
+ * This type is used to parameterize methods like `queryGeneric` and
43
+ * `mutationGeneric` to make them type-safe.
44
+ */
45
+ export type DataModel = DataModelFromSchemaDefinition<typeof schema>;
46
+ //# sourceMappingURL=dataModel.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dataModel.d.ts","sourceRoot":"","sources":["../../../src/component/_generated/dataModel.ts"],"names":[],"mappings":"AACA;;;;;;;GAOG;AAEH,OAAO,KAAK,EACV,6BAA6B,EAC7B,cAAc,EACd,qBAAqB,EACrB,gBAAgB,EACjB,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,MAAM,MAAM,cAAc,CAAC;AAElC;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,qBAAqB,CAAC,SAAS,CAAC,CAAC;AAE1D;;;;GAIG;AACH,MAAM,MAAM,GAAG,CAAC,SAAS,SAAS,UAAU,IAAI,cAAc,CAC5D,SAAS,EACT,SAAS,CACV,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,EAAE,CAAC,SAAS,SAAS,UAAU,GAAG,gBAAgB,IAC5D,SAAS,CAAC,SAAS,CAAC,CAAC;AAEvB;;;;;;;;GAQG;AACH,MAAM,MAAM,SAAS,GAAG,6BAA6B,CAAC,OAAO,MAAM,CAAC,CAAC"}
@@ -0,0 +1,11 @@
1
+ /* eslint-disable */
2
+ /**
3
+ * Generated data model types.
4
+ *
5
+ * THIS CODE IS AUTOMATICALLY GENERATED.
6
+ *
7
+ * To regenerate, run `npx convex dev`.
8
+ * @module
9
+ */
10
+ import schema from "../schema.js";
11
+ //# sourceMappingURL=dataModel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dataModel.js","sourceRoot":"","sources":["../../../src/component/_generated/dataModel.ts"],"names":[],"mappings":"AAAA,oBAAoB;AACpB;;;;;;;GAOG;AASH,OAAO,MAAM,MAAM,cAAc,CAAC"}
@@ -1,4 +1,3 @@
1
- /* eslint-disable */
2
1
  /**
3
2
  * Generated utilities for implementing server-side Convex query and mutation functions.
4
3
  *
@@ -7,27 +6,8 @@
7
6
  * To regenerate, run `npx convex dev`.
8
7
  * @module
9
8
  */
10
-
11
- import {
12
- ActionBuilder,
13
- AnyComponents,
14
- HttpActionBuilder,
15
- MutationBuilder,
16
- QueryBuilder,
17
- GenericActionCtx,
18
- GenericMutationCtx,
19
- GenericQueryCtx,
20
- GenericDatabaseReader,
21
- GenericDatabaseWriter,
22
- FunctionReference,
23
- } from "convex/server";
9
+ import type { ActionBuilder, HttpActionBuilder, MutationBuilder, QueryBuilder, GenericActionCtx, GenericMutationCtx, GenericQueryCtx, GenericDatabaseReader, GenericDatabaseWriter } from "convex/server";
24
10
  import type { DataModel } from "./dataModel.js";
25
-
26
- type GenericCtx =
27
- | GenericActionCtx<DataModel>
28
- | GenericMutationCtx<DataModel>
29
- | GenericQueryCtx<DataModel>;
30
-
31
11
  /**
32
12
  * Define a query in this Convex app's public API.
33
13
  *
@@ -37,7 +17,6 @@ type GenericCtx =
37
17
  * @returns The wrapped query. Include this as an `export` to name it and make it accessible.
38
18
  */
39
19
  export declare const query: QueryBuilder<DataModel, "public">;
40
-
41
20
  /**
42
21
  * Define a query that is only accessible from other Convex functions (but not from the client).
43
22
  *
@@ -47,7 +26,6 @@ export declare const query: QueryBuilder<DataModel, "public">;
47
26
  * @returns The wrapped query. Include this as an `export` to name it and make it accessible.
48
27
  */
49
28
  export declare const internalQuery: QueryBuilder<DataModel, "internal">;
50
-
51
29
  /**
52
30
  * Define a mutation in this Convex app's public API.
53
31
  *
@@ -57,7 +35,6 @@ export declare const internalQuery: QueryBuilder<DataModel, "internal">;
57
35
  * @returns The wrapped mutation. Include this as an `export` to name it and make it accessible.
58
36
  */
59
37
  export declare const mutation: MutationBuilder<DataModel, "public">;
60
-
61
38
  /**
62
39
  * Define a mutation that is only accessible from other Convex functions (but not from the client).
63
40
  *
@@ -67,7 +44,6 @@ export declare const mutation: MutationBuilder<DataModel, "public">;
67
44
  * @returns The wrapped mutation. Include this as an `export` to name it and make it accessible.
68
45
  */
69
46
  export declare const internalMutation: MutationBuilder<DataModel, "internal">;
70
-
71
47
  /**
72
48
  * Define an action in this Convex app's public API.
73
49
  *
@@ -80,7 +56,6 @@ export declare const internalMutation: MutationBuilder<DataModel, "internal">;
80
56
  * @returns The wrapped action. Include this as an `export` to name it and make it accessible.
81
57
  */
82
58
  export declare const action: ActionBuilder<DataModel, "public">;
83
-
84
59
  /**
85
60
  * Define an action that is only accessible from other Convex functions (but not from the client).
86
61
  *
@@ -88,38 +63,36 @@ export declare const action: ActionBuilder<DataModel, "public">;
88
63
  * @returns The wrapped function. Include this as an `export` to name it and make it accessible.
89
64
  */
90
65
  export declare const internalAction: ActionBuilder<DataModel, "internal">;
91
-
92
66
  /**
93
67
  * Define an HTTP action.
94
68
  *
95
- * This function will be used to respond to HTTP requests received by a Convex
96
- * deployment if the requests matches the path and method where this action
97
- * is routed. Be sure to route your action in `convex/http.js`.
69
+ * The wrapped function will be used to respond to HTTP requests received
70
+ * by a Convex deployment if the requests matches the path and method where
71
+ * this action is routed. Be sure to route your httpAction in `convex/http.js`.
98
72
  *
99
- * @param func - The function. It receives an {@link ActionCtx} as its first argument.
73
+ * @param func - The function. It receives an {@link ActionCtx} as its first argument
74
+ * and a Fetch API `Request` object as its second.
100
75
  * @returns The wrapped function. Import this function from `convex/http.js` and route it to hook it up.
101
76
  */
102
77
  export declare const httpAction: HttpActionBuilder;
103
-
104
78
  /**
105
79
  * A set of services for use within Convex query functions.
106
80
  *
107
81
  * The query context is passed as the first argument to any Convex query
108
82
  * function run on the server.
109
83
  *
110
- * This differs from the {@link MutationCtx} because all of the services are
111
- * read-only.
84
+ * If you're using code generation, use the `QueryCtx` type in `convex/_generated/server.d.ts` instead.
112
85
  */
113
86
  export type QueryCtx = GenericQueryCtx<DataModel>;
114
-
115
87
  /**
116
88
  * A set of services for use within Convex mutation functions.
117
89
  *
118
90
  * The mutation context is passed as the first argument to any Convex mutation
119
91
  * function run on the server.
92
+ *
93
+ * If you're using code generation, use the `MutationCtx` type in `convex/_generated/server.d.ts` instead.
120
94
  */
121
95
  export type MutationCtx = GenericMutationCtx<DataModel>;
122
-
123
96
  /**
124
97
  * A set of services for use within Convex action functions.
125
98
  *
@@ -127,7 +100,6 @@ export type MutationCtx = GenericMutationCtx<DataModel>;
127
100
  * function run on the server.
128
101
  */
129
102
  export type ActionCtx = GenericActionCtx<DataModel>;
130
-
131
103
  /**
132
104
  * An interface to read from the database within Convex query functions.
133
105
  *
@@ -136,7 +108,6 @@ export type ActionCtx = GenericActionCtx<DataModel>;
136
108
  * building a query.
137
109
  */
138
110
  export type DatabaseReader = GenericDatabaseReader<DataModel>;
139
-
140
111
  /**
141
112
  * An interface to read from and write to the database within Convex mutation
142
113
  * functions.
@@ -147,3 +118,4 @@ export type DatabaseReader = GenericDatabaseReader<DataModel>;
147
118
  * for the guarantees Convex provides your functions.
148
119
  */
149
120
  export type DatabaseWriter = GenericDatabaseWriter<DataModel>;
121
+ //# sourceMappingURL=server.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../../src/component/_generated/server.ts"],"names":[],"mappings":"AACA;;;;;;;GAOG;AAEH,OAAO,KAAK,EACV,aAAa,EACb,iBAAiB,EACjB,eAAe,EACf,YAAY,EACZ,gBAAgB,EAChB,kBAAkB,EAClB,eAAe,EACf,qBAAqB,EACrB,qBAAqB,EACtB,MAAM,eAAe,CAAC;AAUvB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAEhD;;;;;;;GAOG;AACH,eAAO,MAAM,KAAK,EAAE,YAAY,CAAC,SAAS,EAAE,QAAQ,CAAgB,CAAC;AAErE;;;;;;;GAOG;AACH,eAAO,MAAM,aAAa,EAAE,YAAY,CAAC,SAAS,EAAE,UAAU,CACxC,CAAC;AAEvB;;;;;;;GAOG;AACH,eAAO,MAAM,QAAQ,EAAE,eAAe,CAAC,SAAS,EAAE,QAAQ,CAAmB,CAAC;AAE9E;;;;;;;GAOG;AACH,eAAO,MAAM,gBAAgB,EAAE,eAAe,CAAC,SAAS,EAAE,UAAU,CAC3C,CAAC;AAE1B;;;;;;;;;;GAUG;AACH,eAAO,MAAM,MAAM,EAAE,aAAa,CAAC,SAAS,EAAE,QAAQ,CAAiB,CAAC;AAExE;;;;;GAKG;AACH,eAAO,MAAM,cAAc,EAAE,aAAa,CAAC,SAAS,EAAE,UAAU,CACzC,CAAC;AAExB;;;;;;;;;;GAUG;AACH,eAAO,MAAM,UAAU,EAAE,iBAAqC,CAAC;AAO/D;;;;;;;GAOG;AACH,MAAM,MAAM,QAAQ,GAAG,eAAe,CAAC,SAAS,CAAC,CAAC;AAElD;;;;;;;GAOG;AACH,MAAM,MAAM,WAAW,GAAG,kBAAkB,CAAC,SAAS,CAAC,CAAC;AAExD;;;;;GAKG;AACH,MAAM,MAAM,SAAS,GAAG,gBAAgB,CAAC,SAAS,CAAC,CAAC;AAEpD;;;;;;GAMG;AACH,MAAM,MAAM,cAAc,GAAG,qBAAqB,CAAC,SAAS,CAAC,CAAC;AAE9D;;;;;;;;GAQG;AACH,MAAM,MAAM,cAAc,GAAG,qBAAqB,CAAC,SAAS,CAAC,CAAC"}
@@ -7,7 +7,7 @@
7
7
  * To regenerate, run `npx convex dev`.
8
8
  * @module
9
9
  */
10
- import { actionGeneric, httpActionGeneric, queryGeneric, mutationGeneric, internalActionGeneric, internalMutationGeneric, internalQueryGeneric, componentsGeneric, } from "convex/server";
10
+ import { actionGeneric, httpActionGeneric, queryGeneric, mutationGeneric, internalActionGeneric, internalMutationGeneric, internalQueryGeneric, } from "convex/server";
11
11
  /**
12
12
  * Define a query in this Convex app's public API.
13
13
  *
@@ -64,11 +64,15 @@ export const action = actionGeneric;
64
64
  */
65
65
  export const internalAction = internalActionGeneric;
66
66
  /**
67
- * Define a Convex HTTP action.
67
+ * Define an HTTP action.
68
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`.
69
+ * The wrapped function will be used to respond to HTTP requests received
70
+ * by a Convex deployment if the requests matches the path and method where
71
+ * this action is routed. Be sure to route your httpAction in `convex/http.js`.
72
+ *
73
+ * @param func - The function. It receives an {@link ActionCtx} as its first argument
74
+ * and a Fetch API `Request` object as its second.
75
+ * @returns The wrapped function. Import this function from `convex/http.js` and route it to hook it up.
72
76
  */
73
77
  export const httpAction = httpActionGeneric;
74
78
  //# sourceMappingURL=server.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server.js","sourceRoot":"","sources":["../../../src/component/_generated/server.ts"],"names":[],"mappings":"AAAA,oBAAoB;AACpB;;;;;;;GAOG;AAaH,OAAO,EACL,aAAa,EACb,iBAAiB,EACjB,YAAY,EACZ,eAAe,EACf,qBAAqB,EACrB,uBAAuB,EACvB,oBAAoB,GACrB,MAAM,eAAe,CAAC;AAGvB;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,KAAK,GAAsC,YAAY,CAAC;AAErE;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,aAAa,GACxB,oBAAoB,CAAC;AAEvB;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAyC,eAAe,CAAC;AAE9E;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAC3B,uBAAuB,CAAC;AAE1B;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,MAAM,GAAuC,aAAa,CAAC;AAExE;;;;;GAKG;AACH,MAAM,CAAC,MAAM,cAAc,GACzB,qBAAqB,CAAC;AAExB;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,UAAU,GAAsB,iBAAiB,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"convex.config.d.ts","sourceRoot":"","sources":["../../src/component/convex.config.ts"],"names":[],"mappings":";AAEA,wBAA0D"}
@@ -0,0 +1 @@
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"}
@@ -0,0 +1 @@
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,5 +1,5 @@
1
1
  import { cronJobs } from "convex/server";
2
- import { internal } from "./_generated/api";
2
+ import { internal } from "./_generated/api.js";
3
3
  const crons = cronJobs();
4
4
  // Run every minute
5
5
  crons.interval("cleanup expired streams", { minutes: 1 }, internal.lib.cleanupExpiredStreams);
@@ -0,0 +1 @@
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,qBAAqB,CAAC;AAE/C,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"}
@@ -0,0 +1 @@
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,6 +1,6 @@
1
1
  import { v } from "convex/values";
2
- import { internalMutation, mutation, query } from "./_generated/server";
3
- import { streamStatusValidator } from "./schema";
2
+ import { internalMutation, mutation, query } from "./_generated/server.js";
3
+ import { streamStatusValidator } from "./schema.js";
4
4
  // Create a new stream with zero chunks.
5
5
  export const createStream = mutation({
6
6
  args: {},
@@ -0,0 +1 @@
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,wBAAwB,CAAC;AAC3E,OAAO,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAEpD,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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AC,CAAC,EAAE,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC;aACvD,IAAI,CAAC,UAAU,CAAC,CAAC;QACpB,MAAM,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,CAAC;YAC9D,IAAI,GAAG,GAAG,MAAM,CAAC,aAAa,GAAG,eAAe,EAAE,CAAC;gBACjD,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;YACL,CAAC;QACH,CAAC;IACH,CAAC;CACF,CAAC,CAAC"}
@@ -1,4 +1,4 @@
1
- import { Infer } from "convex/values";
1
+ import { type Infer } from "convex/values";
2
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
3
  export type StreamStatus = Infer<typeof streamStatusValidator>;
4
4
  declare const _default: import("convex/server").SchemaDefinition<{
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/component/schema.ts"],"names":[],"mappings":"AACA,OAAO,EAAK,KAAK,KAAK,EAAE,MAAM,eAAe,CAAC;AAE9C,eAAO,MAAM,qBAAqB,uYAMjC,CAAC;AACF,MAAM,MAAM,YAAY,GAAG,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;;;;;;;;;;;;;;;;;;;AAE/D,wBAQG"}