convex 1.27.5 → 1.28.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/CHANGELOG.md +24 -0
- package/README.md +5 -7
- package/dist/browser.bundle.js +25 -11
- package/dist/browser.bundle.js.map +2 -2
- package/dist/cjs/browser/sync/protocol.js.map +1 -1
- package/dist/cjs/browser/sync/remote_query_set.js +1 -1
- package/dist/cjs/browser/sync/remote_query_set.js.map +2 -2
- package/dist/cjs/browser/sync/web_socket_manager.js +11 -8
- package/dist/cjs/browser/sync/web_socket_manager.js.map +2 -2
- package/dist/cjs/cli/codegen.js +3 -2
- package/dist/cjs/cli/codegen.js.map +2 -2
- package/dist/cjs/cli/generatedApi.js.map +1 -1
- package/dist/cjs/cli/lib/codegen.js +1 -1
- package/dist/cjs/cli/lib/codegen.js.map +2 -2
- package/dist/cjs/cli/lib/components/definition/bundle.js +3 -3
- package/dist/cjs/cli/lib/components/definition/bundle.js.map +2 -2
- package/dist/cjs/cli/lib/components/definition/directoryStructure.js +2 -1
- package/dist/cjs/cli/lib/components/definition/directoryStructure.js.map +2 -2
- package/dist/cjs/cli/lib/components.js +19 -19
- package/dist/cjs/cli/lib/components.js.map +2 -2
- package/dist/cjs/cli/lib/indexes.js +92 -8
- package/dist/cjs/cli/lib/indexes.js.map +3 -3
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/values/value.js +12 -1
- package/dist/cjs/values/value.js.map +2 -2
- package/dist/cjs-types/browser/sync/protocol.d.ts +1 -1
- package/dist/cjs-types/browser/sync/protocol.d.ts.map +1 -1
- package/dist/cjs-types/browser/sync/web_socket_manager.d.ts.map +1 -1
- package/dist/cjs-types/cli/codegen.d.ts +1 -0
- package/dist/cjs-types/cli/codegen.d.ts.map +1 -1
- package/dist/cjs-types/cli/generatedApi.d.ts +127 -18
- package/dist/cjs-types/cli/generatedApi.d.ts.map +1 -1
- package/dist/cjs-types/cli/lib/codegen.d.ts +1 -0
- package/dist/cjs-types/cli/lib/codegen.d.ts.map +1 -1
- package/dist/cjs-types/cli/lib/components/definition/bundle.d.ts.map +1 -1
- package/dist/cjs-types/cli/lib/components/definition/directoryStructure.d.ts.map +1 -1
- package/dist/cjs-types/cli/lib/components.d.ts.map +1 -1
- package/dist/cjs-types/cli/lib/indexes.d.ts +20 -0
- package/dist/cjs-types/cli/lib/indexes.d.ts.map +1 -1
- package/dist/cjs-types/cli/lib/indexes.test.d.ts +2 -0
- package/dist/cjs-types/cli/lib/indexes.test.d.ts.map +1 -0
- package/dist/cjs-types/index.d.ts +1 -1
- package/dist/cjs-types/values/value.d.ts.map +1 -1
- package/dist/cli.bundle.cjs +105 -40
- package/dist/cli.bundle.cjs.map +2 -2
- package/dist/esm/browser/sync/protocol.js.map +1 -1
- package/dist/esm/browser/sync/remote_query_set.js +1 -1
- package/dist/esm/browser/sync/remote_query_set.js.map +2 -2
- package/dist/esm/browser/sync/web_socket_manager.js +11 -8
- package/dist/esm/browser/sync/web_socket_manager.js.map +2 -2
- package/dist/esm/cli/codegen.js +3 -2
- package/dist/esm/cli/codegen.js.map +2 -2
- package/dist/esm/cli/lib/codegen.js +1 -1
- package/dist/esm/cli/lib/codegen.js.map +2 -2
- package/dist/esm/cli/lib/components/definition/bundle.js +3 -3
- package/dist/esm/cli/lib/components/definition/bundle.js.map +2 -2
- package/dist/esm/cli/lib/components/definition/directoryStructure.js +2 -1
- package/dist/esm/cli/lib/components/definition/directoryStructure.js.map +2 -2
- package/dist/esm/cli/lib/components.js +15 -15
- package/dist/esm/cli/lib/components.js.map +2 -2
- package/dist/esm/cli/lib/indexes.js +88 -7
- package/dist/esm/cli/lib/indexes.js.map +3 -3
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/values/value.js +12 -1
- package/dist/esm/values/value.js.map +2 -2
- package/dist/esm-types/browser/sync/protocol.d.ts +1 -1
- package/dist/esm-types/browser/sync/protocol.d.ts.map +1 -1
- package/dist/esm-types/browser/sync/web_socket_manager.d.ts.map +1 -1
- package/dist/esm-types/cli/codegen.d.ts +1 -0
- package/dist/esm-types/cli/codegen.d.ts.map +1 -1
- package/dist/esm-types/cli/generatedApi.d.ts +127 -18
- package/dist/esm-types/cli/generatedApi.d.ts.map +1 -1
- package/dist/esm-types/cli/lib/codegen.d.ts +1 -0
- package/dist/esm-types/cli/lib/codegen.d.ts.map +1 -1
- package/dist/esm-types/cli/lib/components/definition/bundle.d.ts.map +1 -1
- package/dist/esm-types/cli/lib/components/definition/directoryStructure.d.ts.map +1 -1
- package/dist/esm-types/cli/lib/components.d.ts.map +1 -1
- package/dist/esm-types/cli/lib/indexes.d.ts +20 -0
- package/dist/esm-types/cli/lib/indexes.d.ts.map +1 -1
- package/dist/esm-types/cli/lib/indexes.test.d.ts +2 -0
- package/dist/esm-types/cli/lib/indexes.test.d.ts.map +1 -0
- package/dist/esm-types/index.d.ts +1 -1
- package/dist/esm-types/values/value.d.ts.map +1 -1
- package/dist/react.bundle.js +25 -11
- package/dist/react.bundle.js.map +2 -2
- package/package.json +2 -1
- package/schemas/convex.schema.json +71 -0
- package/src/browser/sync/client_node.test.ts +4 -2
- package/src/browser/sync/protocol.ts +1 -1
- package/src/browser/sync/remote_query_set.ts +1 -1
- package/src/browser/sync/web_socket_manager.ts +14 -9
- package/src/cli/codegen.ts +3 -0
- package/src/cli/generatedApi.ts +127 -18
- package/src/cli/lib/codegen.ts +2 -1
- package/src/cli/lib/components/definition/bundle.ts +3 -5
- package/src/cli/lib/components/definition/directoryStructure.ts +4 -1
- package/src/cli/lib/components.ts +26 -22
- package/src/cli/lib/indexes.test.ts +156 -0
- package/src/cli/lib/indexes.ts +103 -8
- package/src/index.ts +1 -1
- package/src/values/value.ts +14 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,29 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.28.0
|
|
4
|
+
|
|
5
|
+
- Deploy code path unification: all deploys now use a codepath that supports
|
|
6
|
+
components, whether or not any components are used in the project. Generating
|
|
7
|
+
the files in `convex/_generated/` now requires a deployment to be present and
|
|
8
|
+
for all environment variables used in convex/auth.config.ts to be set.
|
|
9
|
+
|
|
10
|
+
Scripts that call `npx convex codegen` are the most likely to be affected by
|
|
11
|
+
this change, and `npx convex codgen` no longer works for any projects in
|
|
12
|
+
preview deployments because preview deployments may not exist until the
|
|
13
|
+
deploy.
|
|
14
|
+
|
|
15
|
+
Committing generated code is recommended and this change makes this
|
|
16
|
+
recommendation more important.
|
|
17
|
+
|
|
18
|
+
- WebSocket sync protocol support for TransitionChunk messages: just splitting a
|
|
19
|
+
Transition (containing new query results) into multiple WebSocket messages in
|
|
20
|
+
order prevent the server from appearing non-responsive.
|
|
21
|
+
|
|
22
|
+
## 1.27.5
|
|
23
|
+
|
|
24
|
+
- Export an `AuthConfig` type to describe the object exported from
|
|
25
|
+
`convex/auth.config.ts`.
|
|
26
|
+
|
|
3
27
|
## 1.27.4
|
|
4
28
|
|
|
5
29
|
- Add a `getAuth()` method to the client which returns the current token and
|
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Convex
|
|
2
2
|
|
|
3
|
-
TypeScript
|
|
3
|
+
TypeScript backend SDK, client libraries, and CLI for Convex.
|
|
4
4
|
|
|
5
5
|
Convex is the backend application platform with everything you need to build
|
|
6
6
|
your product.
|
|
@@ -20,8 +20,8 @@ in the [Convex Discord Community](https://convex.dev/community).
|
|
|
20
20
|
|
|
21
21
|
This package includes several entry points for building apps on Convex:
|
|
22
22
|
|
|
23
|
-
- [`convex/server`](https://docs.convex.dev/api/modules/server):
|
|
24
|
-
|
|
23
|
+
- [`convex/server`](https://docs.convex.dev/api/modules/server): SDK for
|
|
24
|
+
defining a Convex backend functions, defining a database schema, etc.
|
|
25
25
|
- [`convex/react`](https://docs.convex.dev/api/modules/react): Hooks and a
|
|
26
26
|
`ConvexReactClient` for integrating Convex into React applications.
|
|
27
27
|
- [`convex/browser`](https://docs.convex.dev/api/modules/browser): A
|
|
@@ -32,10 +32,8 @@ This package includes several entry points for building apps on Convex:
|
|
|
32
32
|
React component for authenticating users with Auth0.
|
|
33
33
|
- [`convex/react-clerk`](https://docs.convex.dev/api/modules/react_clerk): A
|
|
34
34
|
React component for authenticating users with Clerk.
|
|
35
|
+
- [`convex/nextjs`](https://docs.convex.dev/api/modules/nextjs): Server-side
|
|
36
|
+
helpers for SSR, usable by Next.js and other React frameworks.
|
|
35
37
|
|
|
36
38
|
This package also includes [`convex`](https://docs.convex.dev/using/cli), the
|
|
37
39
|
command-line interface for managing Convex projects.
|
|
38
|
-
|
|
39
|
-
# Building
|
|
40
|
-
|
|
41
|
-
`npm pack` produces a public build with internal types removed.
|
package/dist/browser.bundle.js
CHANGED
|
@@ -28,7 +28,7 @@ var convex = (() => {
|
|
|
28
28
|
});
|
|
29
29
|
|
|
30
30
|
// src/index.ts
|
|
31
|
-
var version = "1.
|
|
31
|
+
var version = "1.28.1";
|
|
32
32
|
|
|
33
33
|
// src/values/base64.ts
|
|
34
34
|
var base64_exports = {};
|
|
@@ -339,8 +339,9 @@ var convex = (() => {
|
|
|
339
339
|
}
|
|
340
340
|
return out;
|
|
341
341
|
}
|
|
342
|
+
var MAX_VALUE_FOR_ERROR_LEN = 16384;
|
|
342
343
|
function stringifyValueForError(value) {
|
|
343
|
-
|
|
344
|
+
const str = JSON.stringify(value, (_key, value2) => {
|
|
344
345
|
if (value2 === void 0) {
|
|
345
346
|
return "undefined";
|
|
346
347
|
}
|
|
@@ -349,6 +350,16 @@ var convex = (() => {
|
|
|
349
350
|
}
|
|
350
351
|
return value2;
|
|
351
352
|
});
|
|
353
|
+
if (str.length > MAX_VALUE_FOR_ERROR_LEN) {
|
|
354
|
+
const rest = "[...truncated]";
|
|
355
|
+
let truncateAt = MAX_VALUE_FOR_ERROR_LEN - rest.length;
|
|
356
|
+
const codePoint = str.codePointAt(truncateAt - 1);
|
|
357
|
+
if (codePoint !== void 0 && codePoint > 65535) {
|
|
358
|
+
truncateAt -= 1;
|
|
359
|
+
}
|
|
360
|
+
return str.substring(0, truncateAt) + rest;
|
|
361
|
+
}
|
|
362
|
+
return str;
|
|
352
363
|
}
|
|
353
364
|
function convexToJsonInternal(value, originalValue, context, includeTopLevelUndefined) {
|
|
354
365
|
if (value === void 0) {
|
|
@@ -1429,7 +1440,7 @@ var convex = (() => {
|
|
|
1429
1440
|
const start = transition.startVersion;
|
|
1430
1441
|
if (this.version.querySet !== start.querySet || this.version.ts.notEquals(start.ts) || this.version.identity !== start.identity) {
|
|
1431
1442
|
throw new Error(
|
|
1432
|
-
`Invalid start version: ${start.ts.toString()}:${start.querySet}`
|
|
1443
|
+
`Invalid start version: ${start.ts.toString()}:${start.querySet}:${start.identity}, transitioning from ${this.version.ts.toString()}:${this.version.querySet}:${this.version.identity}`
|
|
1433
1444
|
);
|
|
1434
1445
|
}
|
|
1435
1446
|
for (const modification of transition.modifications) {
|
|
@@ -1656,7 +1667,7 @@ var convex = (() => {
|
|
|
1656
1667
|
this.markConnectionStateDirty();
|
|
1657
1668
|
}
|
|
1658
1669
|
assembleTransition(chunk) {
|
|
1659
|
-
if (chunk.partNumber < 0 || chunk.partNumber >= chunk.totalParts || chunk.totalParts === 0 || this.transitionChunkBuffer && (this.transitionChunkBuffer.totalParts !== chunk.totalParts || this.transitionChunkBuffer.
|
|
1670
|
+
if (chunk.partNumber < 0 || chunk.partNumber >= chunk.totalParts || chunk.totalParts === 0 || this.transitionChunkBuffer && (this.transitionChunkBuffer.totalParts !== chunk.totalParts || this.transitionChunkBuffer.transitionId !== chunk.transitionId)) {
|
|
1660
1671
|
this.transitionChunkBuffer = null;
|
|
1661
1672
|
throw new Error("Invalid TransitionChunk");
|
|
1662
1673
|
}
|
|
@@ -1664,7 +1675,7 @@ var convex = (() => {
|
|
|
1664
1675
|
this.transitionChunkBuffer = {
|
|
1665
1676
|
chunks: [],
|
|
1666
1677
|
totalParts: chunk.totalParts,
|
|
1667
|
-
|
|
1678
|
+
transitionId: chunk.transitionId
|
|
1668
1679
|
};
|
|
1669
1680
|
}
|
|
1670
1681
|
if (chunk.partNumber !== this.transitionChunkBuffer.chunks.length) {
|
|
@@ -1678,11 +1689,6 @@ var convex = (() => {
|
|
|
1678
1689
|
if (this.transitionChunkBuffer.chunks.length === chunk.totalParts) {
|
|
1679
1690
|
const fullJson = this.transitionChunkBuffer.chunks.join("");
|
|
1680
1691
|
this.transitionChunkBuffer = null;
|
|
1681
|
-
if (fullJson.length !== chunk.messageLength) {
|
|
1682
|
-
throw new Error(
|
|
1683
|
-
`Assembled Transition length mismatch: expected ${chunk.messageLength}, got ${fullJson.length}`
|
|
1684
|
-
);
|
|
1685
|
-
}
|
|
1686
1692
|
const transition = parseServerMessage(JSON.parse(fullJson));
|
|
1687
1693
|
if (transition.type !== "Transition") {
|
|
1688
1694
|
throw new Error(
|
|
@@ -1770,7 +1776,8 @@ var convex = (() => {
|
|
|
1770
1776
|
);
|
|
1771
1777
|
}
|
|
1772
1778
|
if (this.transitionChunkBuffer !== null) {
|
|
1773
|
-
|
|
1779
|
+
this.transitionChunkBuffer = null;
|
|
1780
|
+
this.logger.log(
|
|
1774
1781
|
`Received unexpected ${serverMessage.type} while buffering TransitionChunks`
|
|
1775
1782
|
);
|
|
1776
1783
|
}
|
|
@@ -1903,6 +1910,7 @@ var convex = (() => {
|
|
|
1903
1910
|
* closed socket is not accessible or used again after this method is called
|
|
1904
1911
|
*/
|
|
1905
1912
|
close() {
|
|
1913
|
+
this.transitionChunkBuffer = null;
|
|
1906
1914
|
switch (this.socket.state) {
|
|
1907
1915
|
case "disconnected":
|
|
1908
1916
|
case "terminated":
|
|
@@ -1910,6 +1918,9 @@ var convex = (() => {
|
|
|
1910
1918
|
return Promise.resolve();
|
|
1911
1919
|
case "connecting": {
|
|
1912
1920
|
const ws = this.socket.ws;
|
|
1921
|
+
ws.onmessage = (_message) => {
|
|
1922
|
+
this._logVerbose("Ignoring message received after close");
|
|
1923
|
+
};
|
|
1913
1924
|
return new Promise((r) => {
|
|
1914
1925
|
ws.onclose = () => {
|
|
1915
1926
|
this._logVerbose("Closed after connecting");
|
|
@@ -1924,6 +1935,9 @@ var convex = (() => {
|
|
|
1924
1935
|
case "ready": {
|
|
1925
1936
|
this._logVerbose("ws.close called");
|
|
1926
1937
|
const ws = this.socket.ws;
|
|
1938
|
+
ws.onmessage = (_message) => {
|
|
1939
|
+
this._logVerbose("Ignoring message received after close");
|
|
1940
|
+
};
|
|
1927
1941
|
const result = new Promise((r) => {
|
|
1928
1942
|
ws.onclose = () => {
|
|
1929
1943
|
r();
|