Skip to content

Commit eb9d226

Browse files
ianmacartneyConvex, Inc.
authored andcommitted
Ian/use convex json schema (#42792)
- reference the schema format so it's harder to make mistakes in the future - update codegen to exercise the ComponentApi path GitOrigin-RevId: 77e9c931326751d4498174b03bf0939b160c0f14
1 parent d91db7a commit eb9d226

File tree

16 files changed

+21
-299
lines changed

16 files changed

+21
-299
lines changed

npm-packages/private-demos/actions/convex.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
2+
"$schema": "../../convex/schemas/convex.schema.json",
23
"node": {
34
"externalPackages": ["*"]
45
},
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
{
2+
"$schema": "../../convex/schemas/convex.schema.json",
23
"generateCommonJSApi": true
34
}
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
2+
"$schema": "../../convex/schemas/convex.schema.json",
23
"codegen": {
3-
"useComponentApiImports": true,
4+
"legacyComponentApi": false,
45
"legacyJavaScriptFileType": false
56
}
67
}

npm-packages/private-demos/components-api-import-ts/convex/_generated/api.ts

Lines changed: 2 additions & 114 deletions
Original file line numberDiff line numberDiff line change
@@ -48,118 +48,6 @@ export const internal: FilterApi<
4848
> = anyApi as any;
4949

5050
export const components = componentsGeneric() as unknown as {
51-
waitlist: {
52-
actionDemo: {
53-
demo: FunctionReference<"action", "internal", any, any>;
54-
};
55-
index: {
56-
fileDownloadUrl: FunctionReference<
57-
"query",
58-
"internal",
59-
{ id: string },
60-
string
61-
>;
62-
fileUploadUrl: FunctionReference<"mutation", "internal", {}, string>;
63-
getMessageCount: FunctionReference<"query", "internal", {}, number>;
64-
latestWrite: FunctionReference<"query", "internal", {}, string>;
65-
listFiles: FunctionReference<"query", "internal", any, any>;
66-
readFromFile: FunctionReference<
67-
"action",
68-
"internal",
69-
{ id: string },
70-
string
71-
>;
72-
repeatMessage: FunctionReference<
73-
"action",
74-
"internal",
75-
{ message: string; n: number },
76-
string
77-
>;
78-
sayGoodbyeFromQuery: FunctionReference<"query", "internal", {}, string>;
79-
sayHelloFromMutation: FunctionReference<
80-
"mutation",
81-
"internal",
82-
{},
83-
string
84-
>;
85-
scheduleMessage: FunctionReference<"mutation", "internal", {}, any>;
86-
scheduleSend: FunctionReference<"mutation", "internal", {}, any>;
87-
sendMessage: FunctionReference<"mutation", "internal", {}, any>;
88-
storeInFile: FunctionReference<
89-
"action",
90-
"internal",
91-
{ message: string },
92-
string
93-
>;
94-
writeSuccessfully: FunctionReference<
95-
"mutation",
96-
"internal",
97-
{ text: string },
98-
any
99-
>;
100-
writeThenFail: FunctionReference<
101-
"mutation",
102-
"internal",
103-
{ text: string },
104-
any
105-
>;
106-
};
107-
};
108-
waitlist2: {
109-
actionDemo: {
110-
demo: FunctionReference<"action", "internal", any, any>;
111-
};
112-
index: {
113-
fileDownloadUrl: FunctionReference<
114-
"query",
115-
"internal",
116-
{ id: string },
117-
string
118-
>;
119-
fileUploadUrl: FunctionReference<"mutation", "internal", {}, string>;
120-
getMessageCount: FunctionReference<"query", "internal", {}, number>;
121-
latestWrite: FunctionReference<"query", "internal", {}, string>;
122-
listFiles: FunctionReference<"query", "internal", any, any>;
123-
readFromFile: FunctionReference<
124-
"action",
125-
"internal",
126-
{ id: string },
127-
string
128-
>;
129-
repeatMessage: FunctionReference<
130-
"action",
131-
"internal",
132-
{ message: string; n: number },
133-
string
134-
>;
135-
sayGoodbyeFromQuery: FunctionReference<"query", "internal", {}, string>;
136-
sayHelloFromMutation: FunctionReference<
137-
"mutation",
138-
"internal",
139-
{},
140-
string
141-
>;
142-
scheduleMessage: FunctionReference<"mutation", "internal", {}, any>;
143-
scheduleSend: FunctionReference<"mutation", "internal", {}, any>;
144-
sendMessage: FunctionReference<"mutation", "internal", {}, any>;
145-
storeInFile: FunctionReference<
146-
"action",
147-
"internal",
148-
{ message: string },
149-
string
150-
>;
151-
writeSuccessfully: FunctionReference<
152-
"mutation",
153-
"internal",
154-
{ text: string },
155-
any
156-
>;
157-
writeThenFail: FunctionReference<
158-
"mutation",
159-
"internal",
160-
{ text: string },
161-
any
162-
>;
163-
};
164-
};
51+
waitlist: import("../../examples/waitlist@name-with-dashes/_generated/component.js").ComponentApi<"waitlist">;
52+
waitlist2: import("../../examples/waitlist@name-with-dashes/_generated/component.js").ComponentApi<"waitlist2">;
16553
};

npm-packages/private-demos/components-api-import-ts/examples/waitlist@name-with-dashes/_generated/api.ts

Lines changed: 1 addition & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -50,38 +50,5 @@ export const internal: FilterApi<
5050
> = anyApi as any;
5151

5252
export const components = componentsGeneric() as unknown as {
53-
ratelimiter: {
54-
index: {
55-
checkRateLimit: FunctionReference<
56-
"query",
57-
"internal",
58-
{
59-
count?: number;
60-
key?: string;
61-
name: string;
62-
reserve?: boolean;
63-
throws?: boolean;
64-
},
65-
{ ok: boolean; retryAt?: number; ts?: number; value?: number }
66-
>;
67-
rateLimit: FunctionReference<
68-
"mutation",
69-
"internal",
70-
{
71-
count?: number;
72-
key?: string;
73-
name: string;
74-
reserve?: boolean;
75-
throws?: boolean;
76-
},
77-
{ ok: boolean; retryAt?: number }
78-
>;
79-
resetRateLimit: FunctionReference<
80-
"mutation",
81-
"internal",
82-
{ key?: string; name: string },
83-
any
84-
>;
85-
};
86-
};
53+
ratelimiter: import("@convex-dev/ratelimiter/_generated/component.js").ComponentApi<"ratelimiter">;
8754
};
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
2+
"$schema": "../../convex/schemas/convex.schema.json",
23
"codegen": {
3-
"legacyJavaScriptFileType": true,
4-
"useComponentApiImports": true
4+
"legacyComponentApi": false,
5+
"legacyJavaScriptFileType": true
56
}
67
}

npm-packages/private-demos/components-api-import/convex/_generated/api.d.ts

Lines changed: 2 additions & 114 deletions
Original file line numberDiff line numberDiff line change
@@ -47,118 +47,6 @@ export declare const internal: FilterApi<
4747
>;
4848

4949
export declare const components: {
50-
waitlist: {
51-
actionDemo: {
52-
demo: FunctionReference<"action", "internal", any, any>;
53-
};
54-
index: {
55-
fileDownloadUrl: FunctionReference<
56-
"query",
57-
"internal",
58-
{ id: string },
59-
string
60-
>;
61-
fileUploadUrl: FunctionReference<"mutation", "internal", {}, string>;
62-
getMessageCount: FunctionReference<"query", "internal", {}, number>;
63-
latestWrite: FunctionReference<"query", "internal", {}, string>;
64-
listFiles: FunctionReference<"query", "internal", any, any>;
65-
readFromFile: FunctionReference<
66-
"action",
67-
"internal",
68-
{ id: string },
69-
string
70-
>;
71-
repeatMessage: FunctionReference<
72-
"action",
73-
"internal",
74-
{ message: string; n: number },
75-
string
76-
>;
77-
sayGoodbyeFromQuery: FunctionReference<"query", "internal", {}, string>;
78-
sayHelloFromMutation: FunctionReference<
79-
"mutation",
80-
"internal",
81-
{},
82-
string
83-
>;
84-
scheduleMessage: FunctionReference<"mutation", "internal", {}, any>;
85-
scheduleSend: FunctionReference<"mutation", "internal", {}, any>;
86-
sendMessage: FunctionReference<"mutation", "internal", {}, any>;
87-
storeInFile: FunctionReference<
88-
"action",
89-
"internal",
90-
{ message: string },
91-
string
92-
>;
93-
writeSuccessfully: FunctionReference<
94-
"mutation",
95-
"internal",
96-
{ text: string },
97-
any
98-
>;
99-
writeThenFail: FunctionReference<
100-
"mutation",
101-
"internal",
102-
{ text: string },
103-
any
104-
>;
105-
};
106-
};
107-
waitlist2: {
108-
actionDemo: {
109-
demo: FunctionReference<"action", "internal", any, any>;
110-
};
111-
index: {
112-
fileDownloadUrl: FunctionReference<
113-
"query",
114-
"internal",
115-
{ id: string },
116-
string
117-
>;
118-
fileUploadUrl: FunctionReference<"mutation", "internal", {}, string>;
119-
getMessageCount: FunctionReference<"query", "internal", {}, number>;
120-
latestWrite: FunctionReference<"query", "internal", {}, string>;
121-
listFiles: FunctionReference<"query", "internal", any, any>;
122-
readFromFile: FunctionReference<
123-
"action",
124-
"internal",
125-
{ id: string },
126-
string
127-
>;
128-
repeatMessage: FunctionReference<
129-
"action",
130-
"internal",
131-
{ message: string; n: number },
132-
string
133-
>;
134-
sayGoodbyeFromQuery: FunctionReference<"query", "internal", {}, string>;
135-
sayHelloFromMutation: FunctionReference<
136-
"mutation",
137-
"internal",
138-
{},
139-
string
140-
>;
141-
scheduleMessage: FunctionReference<"mutation", "internal", {}, any>;
142-
scheduleSend: FunctionReference<"mutation", "internal", {}, any>;
143-
sendMessage: FunctionReference<"mutation", "internal", {}, any>;
144-
storeInFile: FunctionReference<
145-
"action",
146-
"internal",
147-
{ message: string },
148-
string
149-
>;
150-
writeSuccessfully: FunctionReference<
151-
"mutation",
152-
"internal",
153-
{ text: string },
154-
any
155-
>;
156-
writeThenFail: FunctionReference<
157-
"mutation",
158-
"internal",
159-
{ text: string },
160-
any
161-
>;
162-
};
163-
};
50+
waitlist: import("../../examples/waitlist@name-with-dashes/_generated/component.js").ComponentApi<"waitlist">;
51+
waitlist2: import("../../examples/waitlist@name-with-dashes/_generated/component.js").ComponentApi<"waitlist2">;
16452
};

npm-packages/private-demos/components-api-import/examples/waitlist@name-with-dashes/_generated/api.ts

Lines changed: 1 addition & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -50,38 +50,5 @@ export const internal: FilterApi<
5050
> = anyApi as any;
5151

5252
export const components = componentsGeneric() as unknown as {
53-
ratelimiter: {
54-
index: {
55-
checkRateLimit: FunctionReference<
56-
"query",
57-
"internal",
58-
{
59-
count?: number;
60-
key?: string;
61-
name: string;
62-
reserve?: boolean;
63-
throws?: boolean;
64-
},
65-
{ ok: boolean; retryAt?: number; ts?: number; value?: number }
66-
>;
67-
rateLimit: FunctionReference<
68-
"mutation",
69-
"internal",
70-
{
71-
count?: number;
72-
key?: string;
73-
name: string;
74-
reserve?: boolean;
75-
throws?: boolean;
76-
},
77-
{ ok: boolean; retryAt?: number }
78-
>;
79-
resetRateLimit: FunctionReference<
80-
"mutation",
81-
"internal",
82-
{ key?: string; name: string },
83-
any
84-
>;
85-
};
86-
};
53+
ratelimiter: import("@convex-dev/ratelimiter/_generated/component.js").ComponentApi<"ratelimiter">;
8754
};

npm-packages/private-demos/components-legacy-ts/convex.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
2+
"$schema": "../../convex/schemas/convex.schema.json",
23
"codegen": {
34
"legacyComponentApi": true,
45
"legacyJavaScriptFileType": false

npm-packages/private-demos/components-legacy/convex.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
2+
"$schema": "../../convex/schemas/convex.schema.json",
23
"codegen": {
34
"legacyJavaScriptFileType": true,
45
"legacyComponentApi": true

0 commit comments

Comments
 (0)