|
1 | 1 | {
|
2 |
| - "Convex Imports": { |
3 |
| - "prefix": "convex:imports", |
4 |
| - "body": [ |
5 |
| - "import { v } from \"convex/values\";", |
6 |
| - "import { api, internal } from \"./_generated/api\";", |
7 |
| - "import { Doc, Id } from \"./_generated/dataModel\";", |
8 |
| - "import {", |
9 |
| - " action,", |
10 |
| - " internalAction,", |
11 |
| - " internalMutation,", |
12 |
| - " internalQuery,", |
13 |
| - " mutation,", |
14 |
| - " query,", |
15 |
| - "} from \"./_generated/server\";" |
16 |
| - ], |
17 |
| - "scope": "javascript,typescript", |
18 |
| - "isFileTemplate": true, |
19 |
| - }, |
| 2 | + "Convex Imports": { |
| 3 | + "prefix": "convex:imports", |
| 4 | + "body": [ |
| 5 | + "import { v } from \"convex/values\";", |
| 6 | + "import { api, internal } from \"./_generated/api\";", |
| 7 | + "import { Doc, Id } from \"./_generated/dataModel\";", |
| 8 | + "import {", |
| 9 | + " action,", |
| 10 | + " internalAction,", |
| 11 | + " internalMutation,", |
| 12 | + " internalQuery,", |
| 13 | + " mutation,", |
| 14 | + " query,", |
| 15 | + "} from \"./_generated/server\";", |
| 16 | + ], |
| 17 | + "scope": "javascript,typescript", |
| 18 | + "isFileTemplate": true, |
| 19 | + }, |
20 | 20 |
|
21 |
| - "Convex Query": { |
22 |
| - "prefix": "convex:query", |
23 |
| - "body": [ |
24 |
| - "export const $1 = query({", |
25 |
| - " args: {$2},", |
26 |
| - " handler: async (ctx, args) => {", |
27 |
| - " $0", |
28 |
| - " },", |
29 |
| - "});", |
30 |
| - ], |
31 |
| - "scope": "javascript,typescript", |
32 |
| - }, |
| 21 | + "Convex Query": { |
| 22 | + "prefix": "convex:query", |
| 23 | + "body": [ |
| 24 | + "export const $1 = query({", |
| 25 | + " args: {$2},", |
| 26 | + " handler: async (ctx, args) => {", |
| 27 | + " $0", |
| 28 | + " },", |
| 29 | + "});", |
| 30 | + ], |
| 31 | + "scope": "javascript,typescript", |
| 32 | + }, |
33 | 33 |
|
34 |
| - "Convex Internal Query": { |
35 |
| - "prefix": "convex:internalQuery", |
36 |
| - "body": [ |
37 |
| - "export const $1 = internalQuery({", |
38 |
| - " args: {$2},", |
39 |
| - " handler: async (ctx, args) => {", |
40 |
| - " $0", |
41 |
| - " },", |
42 |
| - "});", |
43 |
| - ], |
44 |
| - "scope": "javascript,typescript", |
45 |
| - }, |
| 34 | + "Convex Internal Query": { |
| 35 | + "prefix": "convex:internalQuery", |
| 36 | + "body": [ |
| 37 | + "export const $1 = internalQuery({", |
| 38 | + " args: {$2},", |
| 39 | + " handler: async (ctx, args) => {", |
| 40 | + " $0", |
| 41 | + " },", |
| 42 | + "});", |
| 43 | + ], |
| 44 | + "scope": "javascript,typescript", |
| 45 | + }, |
46 | 46 |
|
47 |
| - "Convex Mutation": { |
48 |
| - "prefix": "convex:mutation", |
49 |
| - "body": [ |
50 |
| - "export const $1 = mutation({", |
51 |
| - " args: {$2},", |
52 |
| - " handler: async (ctx, args) => {", |
53 |
| - " $0", |
54 |
| - " },", |
55 |
| - "});", |
56 |
| - ], |
57 |
| - "scope": "javascript,typescript", |
58 |
| - }, |
| 47 | + "Convex Mutation": { |
| 48 | + "prefix": "convex:mutation", |
| 49 | + "body": [ |
| 50 | + "export const $1 = mutation({", |
| 51 | + " args: {$2},", |
| 52 | + " handler: async (ctx, args) => {", |
| 53 | + " $0", |
| 54 | + " },", |
| 55 | + "});", |
| 56 | + ], |
| 57 | + "scope": "javascript,typescript", |
| 58 | + }, |
59 | 59 |
|
60 |
| - "Convex Internal Mutation": { |
61 |
| - "prefix": "convex:internalMutation", |
62 |
| - "body": [ |
63 |
| - "export const $1 = internalMutation({", |
64 |
| - " args: {$2},", |
65 |
| - " handler: async (ctx, args) => {", |
66 |
| - " $0", |
67 |
| - " },", |
68 |
| - "});", |
69 |
| - ], |
70 |
| - "scope": "javascript,typescript", |
71 |
| - }, |
| 60 | + "Convex Internal Mutation": { |
| 61 | + "prefix": "convex:internalMutation", |
| 62 | + "body": [ |
| 63 | + "export const $1 = internalMutation({", |
| 64 | + " args: {$2},", |
| 65 | + " handler: async (ctx, args) => {", |
| 66 | + " $0", |
| 67 | + " },", |
| 68 | + "});", |
| 69 | + ], |
| 70 | + "scope": "javascript,typescript", |
| 71 | + }, |
72 | 72 |
|
73 |
| - "Convex Action": { |
74 |
| - "prefix": "convex:action", |
75 |
| - "body": [ |
76 |
| - "export const $1 = action({", |
77 |
| - " args: {$2},", |
78 |
| - " handler: async (ctx, args) => {", |
79 |
| - " $0", |
80 |
| - " },", |
81 |
| - "});", |
82 |
| - ], |
83 |
| - "scope": "javascript,typescript", |
84 |
| - }, |
| 73 | + "Convex Action": { |
| 74 | + "prefix": "convex:action", |
| 75 | + "body": [ |
| 76 | + "export const $1 = action({", |
| 77 | + " args: {$2},", |
| 78 | + " handler: async (ctx, args) => {", |
| 79 | + " $0", |
| 80 | + " },", |
| 81 | + "});", |
| 82 | + ], |
| 83 | + "scope": "javascript,typescript", |
| 84 | + }, |
85 | 85 |
|
86 |
| - "Convex Internal Action": { |
87 |
| - "prefix": "convex:internalAction", |
88 |
| - "body": [ |
89 |
| - "export const $1 = internalAction({", |
90 |
| - " args: {$2},", |
91 |
| - " handler: async (ctx, args) => {", |
92 |
| - " $0", |
93 |
| - " },", |
94 |
| - "});", |
95 |
| - ], |
96 |
| - "scope": "javascript,typescript", |
97 |
| - }, |
| 86 | + "Convex Internal Action": { |
| 87 | + "prefix": "convex:internalAction", |
| 88 | + "body": [ |
| 89 | + "export const $1 = internalAction({", |
| 90 | + " args: {$2},", |
| 91 | + " handler: async (ctx, args) => {", |
| 92 | + " $0", |
| 93 | + " },", |
| 94 | + "});", |
| 95 | + ], |
| 96 | + "scope": "javascript,typescript", |
| 97 | + }, |
98 | 98 |
|
99 |
| - "Convex Crons": { |
100 |
| - "prefix": "convex:crons", |
101 |
| - "body": [ |
102 |
| - "import { cronJobs } from \"convex/server\";", |
103 |
| - "import { internal } from \"./_generated/api\";", |
104 |
| - "import { internalMutation } from \"./_generated/server\";", |
105 |
| - "import { v } from \"convex/values\";", |
106 |
| - "", |
107 |
| - "const crons = cronJobs();", |
108 |
| - "", |
109 |
| - "export const $1 = internalMutation({", |
110 |
| - " args: {},", |
111 |
| - " handler: async (ctx, args) => {", |
112 |
| - " $0", |
113 |
| - " },", |
114 |
| - "});", |
115 |
| - "", |
116 |
| - "crons.interval(", |
117 |
| - " \"$1\",", |
118 |
| - " { seconds: $2 },", |
119 |
| - " internal.crons.$1,", |
120 |
| - ");", |
121 |
| - "", |
122 |
| - "", |
123 |
| - "export default crons;", |
124 |
| - ], |
125 |
| - "scope": "javascript,typescript", |
126 |
| - }, |
| 99 | + "Convex Crons": { |
| 100 | + "prefix": "convex:crons", |
| 101 | + "body": [ |
| 102 | + "import { cronJobs } from \"convex/server\";", |
| 103 | + "import { internal } from \"./_generated/api\";", |
| 104 | + "import { internalMutation } from \"./_generated/server\";", |
| 105 | + "import { v } from \"convex/values\";", |
| 106 | + "", |
| 107 | + "const crons = cronJobs();", |
| 108 | + "", |
| 109 | + "export const $1 = internalMutation({", |
| 110 | + " args: {},", |
| 111 | + " handler: async (ctx, args) => {", |
| 112 | + " $0", |
| 113 | + " },", |
| 114 | + "});", |
| 115 | + "", |
| 116 | + "crons.interval(", |
| 117 | + " \"$1\",", |
| 118 | + " { seconds: $2 },", |
| 119 | + " internal.crons.$1,", |
| 120 | + ");", |
| 121 | + "", |
| 122 | + "", |
| 123 | + "export default crons;", |
| 124 | + ], |
| 125 | + "scope": "javascript,typescript", |
| 126 | + }, |
127 | 127 |
|
128 |
| - "Convex Schema": { |
129 |
| - "prefix": "convex:schema", |
130 |
| - "body": [ |
131 |
| - "import { defineTable, defineSchema } from \"convex/server\";", |
132 |
| - "import { v } from \"convex/values\";", |
133 |
| - "", |
134 |
| - "export default defineSchema({", |
135 |
| - " $1: defineTable({", |
136 |
| - " $0", |
137 |
| - " }),", |
138 |
| - "});", |
139 |
| - ], |
140 |
| - "scope": "javascript,typescript", |
141 |
| - }, |
| 128 | + "Convex Schema": { |
| 129 | + "prefix": "convex:schema", |
| 130 | + "body": [ |
| 131 | + "import { defineTable, defineSchema } from \"convex/server\";", |
| 132 | + "import { v } from \"convex/values\";", |
| 133 | + "", |
| 134 | + "export default defineSchema({", |
| 135 | + " $1: defineTable({", |
| 136 | + " $0", |
| 137 | + " }),", |
| 138 | + "});", |
| 139 | + ], |
| 140 | + "scope": "javascript,typescript", |
| 141 | + }, |
142 | 142 |
|
143 |
| - "Convex HTTP": { |
144 |
| - "prefix": "convex:http", |
145 |
| - "body": [ |
146 |
| - "import { httpRouter } from \"convex/server\";", |
147 |
| - "import { httpAction } from \"./_generated/server\";", |
148 |
| - "", |
149 |
| - "const http = httpRouter();", |
150 |
| - "", |
151 |
| - "http.route({", |
152 |
| - " path: \"/echo\",", |
153 |
| - " method: \"GET\",", |
154 |
| - " handler: httpAction(async (ctx, request) => {", |
155 |
| - " const t = await request.text();", |
156 |
| - " return new Response(\"Received: \" + t);", |
157 |
| - " }),", |
158 |
| - "});", |
159 |
| - "", |
160 |
| - "// Convex expects the router to be the default export of `convex/http.js`.", |
161 |
| - "export default http;", |
162 |
| - ], |
163 |
| - "scope": "javascript,typescript", |
164 |
| - }, |
| 143 | + "Convex HTTP": { |
| 144 | + "prefix": "convex:http", |
| 145 | + "body": [ |
| 146 | + "import { httpRouter } from \"convex/server\";", |
| 147 | + "import { httpAction } from \"./_generated/server\";", |
| 148 | + "", |
| 149 | + "const http = httpRouter();", |
| 150 | + "", |
| 151 | + "http.route({", |
| 152 | + " path: \"/echo\",", |
| 153 | + " method: \"GET\",", |
| 154 | + " handler: httpAction(async (ctx, request) => {", |
| 155 | + " const t = await request.text();", |
| 156 | + " return new Response(\"Received: \" + t);", |
| 157 | + " }),", |
| 158 | + "});", |
| 159 | + "", |
| 160 | + "// Convex expects the router to be the default export of `convex/http.js`.", |
| 161 | + "export default http;", |
| 162 | + ], |
| 163 | + "scope": "javascript,typescript", |
| 164 | + }, |
165 | 165 |
|
166 |
| - |
167 |
| - "Convex Test": { |
168 |
| - "prefix": "convex:test", |
169 |
| - "body": [ |
170 |
| - "import { convexTest } from \"convex-test\";", |
171 |
| - "import { v } from \"convex/values\";", |
172 |
| - "import { expect, test } from \"vitest\";", |
173 |
| - "import { api, internal } from \"./_generated/api\";", |
174 |
| - "import { Doc, Id } from \"./_generated/dataModel\";", |
175 |
| - "import {", |
176 |
| - " action,", |
177 |
| - " internalAction,", |
178 |
| - " internalMutation,", |
179 |
| - " internalQuery,", |
180 |
| - " mutation,", |
181 |
| - " query,", |
182 |
| - "} from \"./_generated/server\";", |
183 |
| - "import schema from \"./schema\";", |
184 |
| - "", |
185 |
| - "test(\"$1\", async () => {", |
186 |
| - " const t = convexTest(schema);", |
187 |
| - " $0", |
188 |
| - "});", |
189 |
| - ], |
190 |
| - "scope": "javascript,typescript", |
191 |
| - } |
| 166 | + "Convex Test": { |
| 167 | + "prefix": "convex:test", |
| 168 | + "body": [ |
| 169 | + "import { convexTest } from \"convex-test\";", |
| 170 | + "import { v } from \"convex/values\";", |
| 171 | + "import { expect, test } from \"vitest\";", |
| 172 | + "import { api, internal } from \"./_generated/api\";", |
| 173 | + "import { Doc, Id } from \"./_generated/dataModel\";", |
| 174 | + "import {", |
| 175 | + " action,", |
| 176 | + " internalAction,", |
| 177 | + " internalMutation,", |
| 178 | + " internalQuery,", |
| 179 | + " mutation,", |
| 180 | + " query,", |
| 181 | + "} from \"./_generated/server\";", |
| 182 | + "import schema from \"./schema\";", |
| 183 | + "", |
| 184 | + "test(\"$1\", async () => {", |
| 185 | + " const t = convexTest(schema);", |
| 186 | + " $0", |
| 187 | + "});", |
| 188 | + ], |
| 189 | + "scope": "javascript,typescript", |
| 190 | + }, |
192 | 191 | }
|
0 commit comments