Skip to content

Commit f6f45c5

Browse files
thomasballingerConvex, Inc.
authored andcommitted
TypeScript codegen (#42662)
Support for coden using .ts file extensions - components now always generate .ts files in their _generated/ directories - new `legacyJavaScriptFileType` property in convex.json (defaults to true) can be set to false to generate .ts files in `convex/_generated/*` - rename `useComponentApiImports` to `legacyComponentApi` in convex.json (defaults to true) - updated codegen for .d.ts and .js files, some unused imports have been removed and inline component interfaces are now sorted within a file GitOrigin-RevId: d5217ade9c737bfaa7b028c852270ad867d2436a
1 parent 02c85be commit f6f45c5

File tree

379 files changed

+10629
-4119
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

379 files changed

+10629
-4119
lines changed

demo/convex/_generated/server.d.ts

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
import {
1212
ActionBuilder,
13-
AnyComponents,
1413
HttpActionBuilder,
1514
MutationBuilder,
1615
QueryBuilder,
@@ -19,15 +18,9 @@ import {
1918
GenericQueryCtx,
2019
GenericDatabaseReader,
2120
GenericDatabaseWriter,
22-
FunctionReference,
2321
} from "convex/server";
2422
import type { DataModel } from "./dataModel.js";
2523

26-
type GenericCtx =
27-
| GenericActionCtx<DataModel>
28-
| GenericMutationCtx<DataModel>
29-
| GenericQueryCtx<DataModel>;
30-
3124
/**
3225
* Define a query in this Convex app's public API.
3326
*
@@ -92,11 +85,12 @@ export declare const internalAction: ActionBuilder<DataModel, "internal">;
9285
/**
9386
* Define an HTTP action.
9487
*
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`.
88+
* The wrapped function will be used to respond to HTTP requests received
89+
* by a Convex deployment if the requests matches the path and method where
90+
* this action is routed. Be sure to route your httpAction in `convex/http.js`.
9891
*
99-
* @param func - The function. It receives an {@link ActionCtx} as its first argument.
92+
* @param func - The function. It receives an {@link ActionCtx} as its first argument
93+
* and a Fetch API `Request` object as its second.
10094
* @returns The wrapped function. Import this function from `convex/http.js` and route it to hook it up.
10195
*/
10296
export declare const httpAction: HttpActionBuilder;

demo/convex/_generated/server.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ import {
1616
internalActionGeneric,
1717
internalMutationGeneric,
1818
internalQueryGeneric,
19-
componentsGeneric,
2019
} from "convex/server";
2120

2221
/**
@@ -81,10 +80,14 @@ export const action = actionGeneric;
8180
export const internalAction = internalActionGeneric;
8281

8382
/**
84-
* Define a Convex HTTP action.
83+
* Define an HTTP action.
8584
*
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`.
85+
* The wrapped function will be used to respond to HTTP requests received
86+
* by a Convex deployment if the requests matches the path and method where
87+
* this action is routed. Be sure to route your httpAction in `convex/http.js`.
88+
*
89+
* @param func - The function. It receives an {@link ActionCtx} as its first argument
90+
* and a Fetch API `Request` object as its second.
91+
* @returns The wrapped function. Import this function from `convex/http.js` and route it to hook it up.
8992
*/
9093
export const httpAction = httpActionGeneric;

npm-packages/@convex-dev/codemod/test/explicit-ids/sample-convex-project/convex/_generated/server.d.ts

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
import {
1212
ActionBuilder,
13-
AnyComponents,
1413
HttpActionBuilder,
1514
MutationBuilder,
1615
QueryBuilder,
@@ -19,15 +18,9 @@ import {
1918
GenericQueryCtx,
2019
GenericDatabaseReader,
2120
GenericDatabaseWriter,
22-
FunctionReference,
2321
} from "convex/server";
2422
import type { DataModel } from "./dataModel.js";
2523

26-
type GenericCtx =
27-
| GenericActionCtx<DataModel>
28-
| GenericMutationCtx<DataModel>
29-
| GenericQueryCtx<DataModel>;
30-
3124
/**
3225
* Define a query in this Convex app's public API.
3326
*
@@ -92,11 +85,12 @@ export declare const internalAction: ActionBuilder<DataModel, "internal">;
9285
/**
9386
* Define an HTTP action.
9487
*
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`.
88+
* The wrapped function will be used to respond to HTTP requests received
89+
* by a Convex deployment if the requests matches the path and method where
90+
* this action is routed. Be sure to route your httpAction in `convex/http.js`.
9891
*
99-
* @param func - The function. It receives an {@link ActionCtx} as its first argument.
92+
* @param func - The function. It receives an {@link ActionCtx} as its first argument
93+
* and a Fetch API `Request` object as its second.
10094
* @returns The wrapped function. Import this function from `convex/http.js` and route it to hook it up.
10195
*/
10296
export declare const httpAction: HttpActionBuilder;

npm-packages/@convex-dev/codemod/test/explicit-ids/sample-convex-project/convex/_generated/server.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ import {
1616
internalActionGeneric,
1717
internalMutationGeneric,
1818
internalQueryGeneric,
19-
componentsGeneric,
2019
} from "convex/server";
2120

2221
/**
@@ -81,10 +80,14 @@ export const action = actionGeneric;
8180
export const internalAction = internalActionGeneric;
8281

8382
/**
84-
* Define a Convex HTTP action.
83+
* Define an HTTP action.
8584
*
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`.
85+
* The wrapped function will be used to respond to HTTP requests received
86+
* by a Convex deployment if the requests matches the path and method where
87+
* this action is routed. Be sure to route your httpAction in `convex/http.js`.
88+
*
89+
* @param func - The function. It receives an {@link ActionCtx} as its first argument
90+
* and a Fetch API `Request` object as its second.
91+
* @returns The wrapped function. Import this function from `convex/http.js` and route it to hook it up.
8992
*/
9093
export const httpAction = httpActionGeneric;

npm-packages/@convex-dev/react-query/convex/_generated/server.d.ts

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
import {
1212
ActionBuilder,
13-
AnyComponents,
1413
HttpActionBuilder,
1514
MutationBuilder,
1615
QueryBuilder,
@@ -19,15 +18,9 @@ import {
1918
GenericQueryCtx,
2019
GenericDatabaseReader,
2120
GenericDatabaseWriter,
22-
FunctionReference,
2321
} from "convex/server";
2422
import type { DataModel } from "./dataModel.js";
2523

26-
type GenericCtx =
27-
| GenericActionCtx<DataModel>
28-
| GenericMutationCtx<DataModel>
29-
| GenericQueryCtx<DataModel>;
30-
3124
/**
3225
* Define a query in this Convex app's public API.
3326
*
@@ -92,11 +85,12 @@ export declare const internalAction: ActionBuilder<DataModel, "internal">;
9285
/**
9386
* Define an HTTP action.
9487
*
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`.
88+
* The wrapped function will be used to respond to HTTP requests received
89+
* by a Convex deployment if the requests matches the path and method where
90+
* this action is routed. Be sure to route your httpAction in `convex/http.js`.
9891
*
99-
* @param func - The function. It receives an {@link ActionCtx} as its first argument.
92+
* @param func - The function. It receives an {@link ActionCtx} as its first argument
93+
* and a Fetch API `Request` object as its second.
10094
* @returns The wrapped function. Import this function from `convex/http.js` and route it to hook it up.
10195
*/
10296
export declare const httpAction: HttpActionBuilder;

npm-packages/@convex-dev/react-query/convex/_generated/server.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ import {
1616
internalActionGeneric,
1717
internalMutationGeneric,
1818
internalQueryGeneric,
19-
componentsGeneric,
2019
} from "convex/server";
2120

2221
/**
@@ -81,10 +80,14 @@ export const action = actionGeneric;
8180
export const internalAction = internalActionGeneric;
8281

8382
/**
84-
* Define a Convex HTTP action.
83+
* Define an HTTP action.
8584
*
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`.
85+
* The wrapped function will be used to respond to HTTP requests received
86+
* by a Convex deployment if the requests matches the path and method where
87+
* this action is routed. Be sure to route your httpAction in `convex/http.js`.
88+
*
89+
* @param func - The function. It receives an {@link ActionCtx} as its first argument
90+
* and a Fetch API `Request` object as its second.
91+
* @returns The wrapped function. Import this function from `convex/http.js` and route it to hook it up.
8992
*/
9093
export const httpAction = httpActionGeneric;

npm-packages/common/config/rush/pnpm-lock.yaml

Lines changed: 155 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)