├── .prettierrc
├── src
├── vite-env.d.ts
├── main.tsx
├── hooks
│ ├── useTypingIndicator.ts
│ ├── useLatestValue.ts
│ ├── useStableQuery.ts
│ ├── useSingleFlight.ts
│ └── usePresence.ts
├── fakeConvexClient
│ ├── fakeConvexClient.d.ts
│ └── fakeConvexClient.js
├── components
│ ├── RelationshipExample.tsx
│ ├── HonoExample.tsx
│ ├── Counter.tsx
│ ├── ZodFunctionsExample.tsx
│ ├── Facepile.tsx
│ ├── SessionsExample.tsx
│ ├── Counter.injection.test.tsx
│ ├── Counter.mock.test.tsx
│ └── CacheExample.tsx
├── App.tsx
└── index.css
├── .cursor
└── worktrees.json
├── packages
└── convex-helpers
│ ├── .npmignore
│ ├── server
│ ├── _generated
│ │ └── _ignore.ts
│ ├── setup.test.ts
│ ├── filter.test.ts
│ ├── compare.ts
│ ├── cors.test.http.ts
│ ├── triggers.test.ts
│ ├── sessions.ts
│ ├── table.test.ts
│ ├── crud.ts
│ └── filter.ts
│ ├── react
│ ├── cache.ts
│ ├── cache
│ │ └── provider.tsx
│ └── sessions.test.ts
│ ├── vitest.config.mts
│ ├── cli
│ ├── index.ts
│ ├── tsApiSpec.test.ts
│ ├── openApiSpec.test.ts
│ └── utils.ts
│ ├── standardSchema.ts
│ ├── browser.ts
│ ├── index.test.ts
│ ├── generate-exports.mjs
│ ├── validators.test.ts
│ ├── browser.test.ts
│ ├── testing.ts
│ ├── standardSchema.test.ts
│ ├── CHANGELOG.md
│ ├── index.ts
│ └── package.json
├── AGENTS.md
├── convex.sh
├── index.html
├── .github
└── workflows
│ ├── PULL_REQUEST_TEMPLATE.md
│ ├── cla.yml
│ └── test.yml
├── vite.config.mts
├── convex
├── vitest.config.mts
├── _generated
│ ├── api.js
│ ├── dataModel.d.ts
│ ├── api.d.ts
│ ├── server.js
│ └── server.d.ts
├── http.ts
├── tsconfig.json
├── zodFunctionsExample.ts
├── example.test.ts
├── schema.ts
├── testingFunctions.ts
├── streamsExample.ts
├── migrationsExample.ts
├── counter.ts
├── rlsExample.ts
├── README.md
├── presence.ts
├── retriesExample.ts
└── triggersExample.ts
├── tsconfig.json
├── renovate.json
├── publish.sh
├── .gitignore
├── Justfile
├── eslint.config.mjs
├── package.json
├── backendHarness.js
├── CONTRIBUTING.md
├── scripts
└── check_cla.py
└── .vscode
└── convex.code-snippets
/.prettierrc:
--------------------------------------------------------------------------------
1 | {
2 | "arrowParens": "always"
3 | }
4 |
--------------------------------------------------------------------------------
/src/vite-env.d.ts:
--------------------------------------------------------------------------------
1 | ///
19 | Value fetching from {siteUrl}/: {value} 20 |
21 |17 | {"Here's the counter:"} {counter} 18 |
19 | 20 |Result: {noArgsResult ?? "Loading..."}
26 |Result: {noArgsResultEmptyArgs ?? "Loading..."}
30 |35 | One day after:{" "} 36 | {stringToDate.decode(withArgsResult.oneDayAfter).toLocaleString()} 37 |
38 | )} 39 |{JSON.stringify(roomData)}
70 |= Q extends OrderedQuery? T : never; 147 | 148 | /** 149 | * Applies a filter to a database query, just like `.filter((q) => ...)` but 150 | * supporting arbitrary JavaScript/TypeScript. 151 | * Performance is roughly the same as `.filter((q) => ...)`. If you want better 152 | * performance, use an index to narrow down the results before filtering. 153 | * 154 | * Examples: 155 | * 156 | * // Full table scan, filtered to short messages. 157 | * return await filter( 158 | * ctx.db.query("messages"), 159 | * async (message) => message.body.length < 10, 160 | * ).collect(); 161 | * 162 | * // Short messages by author, paginated. 163 | * return await filter( 164 | * ctx.db.query("messages").withIndex("by_author", q=>q.eq("author", args.author)), 165 | * async (message) => message.body.length < 10, 166 | * ).paginate(args.paginationOpts); 167 | * 168 | * // Same behavior as above: Short messages by author, paginated. 169 | * // Note the filter can wrap any part of the query pipeline, and it is applied 170 | * // at the end. This is how RowLevelSecurity works. 171 | * const shortMessages = await filter( 172 | * ctx.db.query("messages"), 173 | * async (message) => message.body.length < 10, 174 | * ); 175 | * return await shortMessages 176 | * .withIndex("by_author", q=>q.eq("author", args.author)) 177 | * .paginate(args.paginationOpts); 178 | * 179 | * // Also works with `order()`, `take()`, `unique()`, and `first()`. 180 | * return await filter( 181 | * ctx.db.query("messages").order("desc"), 182 | * async (message) => message.body.length < 10, 183 | * ).first(); 184 | * 185 | * @param query The query to filter. 186 | * @param predicate Async function to run on each document before it is yielded 187 | * from the query pipeline. 188 | * @returns A new query with the filter applied. 189 | */ 190 | export function filter >( 191 | query: Q, 192 | predicate: Predicate>, 193 | ): Q { 194 | return new QueryWithFilter >( 195 | query as unknown as OrderedQuery >, 196 | predicate, 197 | ) as any as Q; 198 | } 199 | --------------------------------------------------------------------------------