From 027a315a0406fd2f3f8aa803cbf99335e7c667b5 Mon Sep 17 00:00:00 2001 From: kenneth Date: Sat, 8 Nov 2025 18:03:32 +0000 Subject: [PATCH] style: apply biome formatting to config and generated files - Convert spaces to tabs in tsconfig files - Format CLI commands and prompts - Update generated Convex files - Format betterauth adapter and schema Co-authored-by: Ona --- apps/cli/commands/generate/apikey.ts | 9 +- apps/cli/prompts.ts | 11 +- apps/cli/test-example.md | 83 ++++++++++++ apps/cli/tsconfig.json | 46 +++---- apps/file-proxy/tsconfig.json | 48 +++---- packages/auth/hasher.ts | 12 +- packages/auth/package.json | 18 +-- packages/auth/tsconfig.json | 48 +++---- packages/convex/betterauth/adapter.ts | 22 ++-- packages/convex/betterauth/auth.ts | 6 +- packages/convex/betterauth/convex.config.ts | 6 +- packages/convex/betterauth/schema.ts | 124 +++++++++--------- packages/convex/convex/_generated/api.d.ts | 22 ++-- packages/convex/convex/_generated/api.js | 6 +- .../convex/convex/_generated/dataModel.d.ts | 13 +- packages/convex/convex/_generated/server.d.ts | 46 +++---- packages/convex/convex/_generated/server.js | 30 ++--- packages/convex/tsconfig.json | 44 +++---- 18 files changed, 341 insertions(+), 253 deletions(-) create mode 100644 apps/cli/test-example.md diff --git a/apps/cli/commands/generate/apikey.ts b/apps/cli/commands/generate/apikey.ts index 90d0306..d8d48a2 100644 --- a/apps/cli/commands/generate/apikey.ts +++ b/apps/cli/commands/generate/apikey.ts @@ -1,11 +1,7 @@ import { generateApiKey, newPrefix } from "@drexa/auth" import chalk from "chalk" import { Command } from "commander" -import { - promptNumber, - promptOptionalDate, - promptText, -} from "../../prompts.ts" +import { promptNumber, promptOptionalDate, promptText } from "../../prompts.ts" export const apikeyCommand = new Command("apikey") .description("Generate a new API key") @@ -53,7 +49,8 @@ export const apikeyCommand = new Command("apikey") console.log(chalk.green(` ${result.unhashedKey}\n`)) console.log(chalk.gray("─".repeat(60))) console.log( - chalk.bold("\nHashed Key ") + chalk.dim("(store this in your database):"), + chalk.bold("\nHashed Key ") + + chalk.dim("(store this in your database):"), ) console.log(chalk.dim(` ${result.hashedKey}\n`)) console.log(chalk.bold("Description:")) diff --git a/apps/cli/prompts.ts b/apps/cli/prompts.ts index 674875e..28ccee6 100644 --- a/apps/cli/prompts.ts +++ b/apps/cli/prompts.ts @@ -29,7 +29,9 @@ export async function promptNumber( ): Promise { const rl = createReadlineInterface() try { - const defaultStr = defaultValue ? chalk.dim(` (default: ${defaultValue})`) : "" + const defaultStr = defaultValue + ? chalk.dim(` (default: ${defaultValue})`) + : "" const input = await rl.question(chalk.cyan(`${message}${defaultStr} `)) if ((!input || input.trim() === "") && defaultValue !== undefined) { @@ -59,7 +61,8 @@ export async function promptOptionalDate( const rl = createReadlineInterface() try { const input = await rl.question( - chalk.cyan(`${message} `) + chalk.dim("(optional, format: YYYY-MM-DD) "), + chalk.cyan(`${message} `) + + chalk.dim("(optional, format: YYYY-MM-DD) "), ) if (!input || input.trim() === "") { @@ -68,7 +71,9 @@ export async function promptOptionalDate( const date = new Date(input.trim()) if (Number.isNaN(date.getTime())) { - console.error(chalk.red("✗ Invalid date format. Please use YYYY-MM-DD")) + console.error( + chalk.red("✗ Invalid date format. Please use YYYY-MM-DD"), + ) process.exit(1) } diff --git a/apps/cli/test-example.md b/apps/cli/test-example.md new file mode 100644 index 0000000..7758170 --- /dev/null +++ b/apps/cli/test-example.md @@ -0,0 +1,83 @@ +# Testing the CLI + +To test the API key generation interactively, run: + +```bash +bun drexa generate apikey +``` + +## Example Session + +The CLI now uses **chalk** for beautiful colored output! + +``` +$ bun drexa generate apikey + +🔑 Generate API Key + +Enter API key prefix (e.g., 'proxy', 'admin'): testkey +Enter key byte length: (default: 32) +Enter description: Test API Key for development +Enter expiration date (optional, format: YYYY-MM-DD): + +⏳ Generating API key... + +✓ API Key Generated Successfully! + +──────────────────────────────────────────────────────────── + +⚠️ IMPORTANT: Save the unhashed key now. It won't be shown again! + +Unhashed Key (save this): + sk-testkey-AbCdEfGhIjKlMnOpQrStUvWxYz0123456789 + +──────────────────────────────────────────────────────────── + +Hashed Key (store this in your database): + $argon2id$v=19$m=4,t=3,p=1$... + +Description: + Test API Key for development + +Expires At: + Never + +──────────────────────────────────────────────────────────── +``` + +### Color Scheme +- **Prompts**: Cyan text with dimmed hints +- **Success messages**: Green with checkmark +- **Warnings**: Yellow with warning icon +- **Errors**: Red with X mark +- **Important data**: Green (unhashed key), dimmed (hashed key) +- **Separators**: Gray lines + +## Testing with Invalid Input + +### Invalid prefix (contains dash) +```bash +$ bun drexa generate apikey +Enter API key prefix (e.g., 'proxy', 'admin'): test-key +✗ Invalid prefix: cannot contain "-" character. Please use alphanumeric characters only. +``` + +### Invalid key byte length +```bash +$ bun drexa generate apikey +Enter API key prefix (e.g., 'proxy', 'admin'): testkey +Enter key byte length: (default: 32) -5 +✗ Please enter a valid positive number +``` + +### Invalid date format +```bash +$ bun drexa generate apikey +Enter API key prefix (e.g., 'proxy', 'admin'): testkey +Enter key byte length: (default: 32) +Enter description: Test +Enter expiration date (optional, format: YYYY-MM-DD): invalid-date +✗ Invalid date format. Please use YYYY-MM-DD +``` + +All error messages are displayed in red for better visibility. diff --git a/apps/cli/tsconfig.json b/apps/cli/tsconfig.json index d4467c8..8f60976 100644 --- a/apps/cli/tsconfig.json +++ b/apps/cli/tsconfig.json @@ -1,28 +1,28 @@ { - "compilerOptions": { - // Environment setup & latest features - "lib": ["ESNext"], - "target": "ESNext", - "module": "Preserve", - "moduleDetection": "force", - "allowJs": true, + "compilerOptions": { + // Environment setup & latest features + "lib": ["ESNext"], + "target": "ESNext", + "module": "Preserve", + "moduleDetection": "force", + "allowJs": true, - // Bundler mode - "moduleResolution": "bundler", - "allowImportingTsExtensions": true, - "verbatimModuleSyntax": true, - "noEmit": true, + // Bundler mode + "moduleResolution": "bundler", + "allowImportingTsExtensions": true, + "verbatimModuleSyntax": true, + "noEmit": true, - // Best practices - "strict": true, - "skipLibCheck": true, - "noFallthroughCasesInSwitch": true, - "noUncheckedIndexedAccess": true, - "noImplicitOverride": true, + // Best practices + "strict": true, + "skipLibCheck": true, + "noFallthroughCasesInSwitch": true, + "noUncheckedIndexedAccess": true, + "noImplicitOverride": true, - // Some stricter flags (disabled by default) - "noUnusedLocals": false, - "noUnusedParameters": false, - "noPropertyAccessFromIndexSignature": false - } + // Some stricter flags (disabled by default) + "noUnusedLocals": false, + "noUnusedParameters": false, + "noPropertyAccessFromIndexSignature": false + } } diff --git a/apps/file-proxy/tsconfig.json b/apps/file-proxy/tsconfig.json index bfa0fea..146fe4e 100644 --- a/apps/file-proxy/tsconfig.json +++ b/apps/file-proxy/tsconfig.json @@ -1,29 +1,29 @@ { - "compilerOptions": { - // Environment setup & latest features - "lib": ["ESNext"], - "target": "ESNext", - "module": "Preserve", - "moduleDetection": "force", - "jsx": "react-jsx", - "allowJs": true, + "compilerOptions": { + // Environment setup & latest features + "lib": ["ESNext"], + "target": "ESNext", + "module": "Preserve", + "moduleDetection": "force", + "jsx": "react-jsx", + "allowJs": true, - // Bundler mode - "moduleResolution": "bundler", - "allowImportingTsExtensions": true, - "verbatimModuleSyntax": true, - "noEmit": true, + // Bundler mode + "moduleResolution": "bundler", + "allowImportingTsExtensions": true, + "verbatimModuleSyntax": true, + "noEmit": true, - // Best practices - "strict": true, - "skipLibCheck": true, - "noFallthroughCasesInSwitch": true, - "noUncheckedIndexedAccess": true, - "noImplicitOverride": true, + // Best practices + "strict": true, + "skipLibCheck": true, + "noFallthroughCasesInSwitch": true, + "noUncheckedIndexedAccess": true, + "noImplicitOverride": true, - // Some stricter flags (disabled by default) - "noUnusedLocals": false, - "noUnusedParameters": false, - "noPropertyAccessFromIndexSignature": false - } + // Some stricter flags (disabled by default) + "noUnusedLocals": false, + "noUnusedParameters": false, + "noPropertyAccessFromIndexSignature": false + } } diff --git a/packages/auth/hasher.ts b/packages/auth/hasher.ts index a4845e3..d6f7723 100644 --- a/packages/auth/hasher.ts +++ b/packages/auth/hasher.ts @@ -62,10 +62,14 @@ export class WebCryptoSha256Hasher implements PassswordHasher { } return btoa(binary).replace(/[+/=]/g, (char) => { switch (char) { - case "+": return "-" - case "/": return "_" - case "=": return "" - default: return char + case "+": + return "-" + case "/": + return "_" + case "=": + return "" + default: + return char } }) } diff --git a/packages/auth/package.json b/packages/auth/package.json index 2146dc0..20cd24f 100644 --- a/packages/auth/package.json +++ b/packages/auth/package.json @@ -1,11 +1,11 @@ { - "name": "@drexa/auth", - "module": "index.ts", - "type": "module", - "devDependencies": { - "@types/bun": "latest" - }, - "peerDependencies": { - "typescript": "^5" - } + "name": "@drexa/auth", + "module": "index.ts", + "type": "module", + "devDependencies": { + "@types/bun": "latest" + }, + "peerDependencies": { + "typescript": "^5" + } } diff --git a/packages/auth/tsconfig.json b/packages/auth/tsconfig.json index bfa0fea..146fe4e 100644 --- a/packages/auth/tsconfig.json +++ b/packages/auth/tsconfig.json @@ -1,29 +1,29 @@ { - "compilerOptions": { - // Environment setup & latest features - "lib": ["ESNext"], - "target": "ESNext", - "module": "Preserve", - "moduleDetection": "force", - "jsx": "react-jsx", - "allowJs": true, + "compilerOptions": { + // Environment setup & latest features + "lib": ["ESNext"], + "target": "ESNext", + "module": "Preserve", + "moduleDetection": "force", + "jsx": "react-jsx", + "allowJs": true, - // Bundler mode - "moduleResolution": "bundler", - "allowImportingTsExtensions": true, - "verbatimModuleSyntax": true, - "noEmit": true, + // Bundler mode + "moduleResolution": "bundler", + "allowImportingTsExtensions": true, + "verbatimModuleSyntax": true, + "noEmit": true, - // Best practices - "strict": true, - "skipLibCheck": true, - "noFallthroughCasesInSwitch": true, - "noUncheckedIndexedAccess": true, - "noImplicitOverride": true, + // Best practices + "strict": true, + "skipLibCheck": true, + "noFallthroughCasesInSwitch": true, + "noUncheckedIndexedAccess": true, + "noImplicitOverride": true, - // Some stricter flags (disabled by default) - "noUnusedLocals": false, - "noUnusedParameters": false, - "noPropertyAccessFromIndexSignature": false - } + // Some stricter flags (disabled by default) + "noUnusedLocals": false, + "noUnusedParameters": false, + "noPropertyAccessFromIndexSignature": false + } } diff --git a/packages/convex/betterauth/adapter.ts b/packages/convex/betterauth/adapter.ts index 0cade88..bf37402 100644 --- a/packages/convex/betterauth/adapter.ts +++ b/packages/convex/betterauth/adapter.ts @@ -1,13 +1,13 @@ -import { createApi } from "@convex-dev/better-auth"; -import schema from "./schema"; -import { createAuth } from "../auth"; +import { createApi } from "@convex-dev/better-auth" +import { createAuth } from "../auth" +import schema from "./schema" export const { - create, - findOne, - findMany, - updateOne, - updateMany, - deleteOne, - deleteMany, -} = createApi(schema, createAuth); \ No newline at end of file + create, + findOne, + findMany, + updateOne, + updateMany, + deleteOne, + deleteMany, +} = createApi(schema, createAuth) diff --git a/packages/convex/betterauth/auth.ts b/packages/convex/betterauth/auth.ts index 8a610a7..efb94eb 100644 --- a/packages/convex/betterauth/auth.ts +++ b/packages/convex/betterauth/auth.ts @@ -1,5 +1,5 @@ -import { createAuth } from '../auth' -import { getStaticAuth } from '@convex-dev/better-auth' +import { getStaticAuth } from "@convex-dev/better-auth" +import { createAuth } from "../auth" // Export a static instance for Better Auth schema generation -export const auth = getStaticAuth(createAuth) \ No newline at end of file +export const auth = getStaticAuth(createAuth) diff --git a/packages/convex/betterauth/convex.config.ts b/packages/convex/betterauth/convex.config.ts index 0b28bff..230e311 100644 --- a/packages/convex/betterauth/convex.config.ts +++ b/packages/convex/betterauth/convex.config.ts @@ -1,5 +1,5 @@ -import { defineComponent } from "convex/server"; +import { defineComponent } from "convex/server" -const component = defineComponent("betterAuth"); +const component = defineComponent("betterAuth") -export default component; \ No newline at end of file +export default component diff --git a/packages/convex/betterauth/schema.ts b/packages/convex/betterauth/schema.ts index 167d19f..be46bf4 100644 --- a/packages/convex/betterauth/schema.ts +++ b/packages/convex/betterauth/schema.ts @@ -2,69 +2,69 @@ // To regenerate the schema, run: // `npx @better-auth/cli generate --output undefined -y` -import { defineSchema, defineTable } from "convex/server"; -import { v } from "convex/values"; +import { defineSchema, defineTable } from "convex/server" +import { v } from "convex/values" export const tables = { - user: defineTable({ - name: v.string(), - email: v.string(), - emailVerified: v.boolean(), - image: v.optional(v.union(v.null(), v.string())), - createdAt: v.number(), - updatedAt: v.number(), - userId: v.optional(v.union(v.null(), v.string())), - }) - .index("email_name", ["email","name"]) - .index("name", ["name"]) - .index("userId", ["userId"]), - session: defineTable({ - expiresAt: v.number(), - token: v.string(), - createdAt: v.number(), - updatedAt: v.number(), - ipAddress: v.optional(v.union(v.null(), v.string())), - userAgent: v.optional(v.union(v.null(), v.string())), - userId: v.string(), - }) - .index("expiresAt", ["expiresAt"]) - .index("expiresAt_userId", ["expiresAt","userId"]) - .index("token", ["token"]) - .index("userId", ["userId"]), - account: defineTable({ - accountId: v.string(), - providerId: v.string(), - userId: v.string(), - accessToken: v.optional(v.union(v.null(), v.string())), - refreshToken: v.optional(v.union(v.null(), v.string())), - idToken: v.optional(v.union(v.null(), v.string())), - accessTokenExpiresAt: v.optional(v.union(v.null(), v.number())), - refreshTokenExpiresAt: v.optional(v.union(v.null(), v.number())), - scope: v.optional(v.union(v.null(), v.string())), - password: v.optional(v.union(v.null(), v.string())), - createdAt: v.number(), - updatedAt: v.number(), - }) - .index("accountId", ["accountId"]) - .index("accountId_providerId", ["accountId","providerId"]) - .index("providerId_userId", ["providerId","userId"]) - .index("userId", ["userId"]), - verification: defineTable({ - identifier: v.string(), - value: v.string(), - expiresAt: v.number(), - createdAt: v.number(), - updatedAt: v.number(), - }) - .index("expiresAt", ["expiresAt"]) - .index("identifier", ["identifier"]), - jwks: defineTable({ - publicKey: v.string(), - privateKey: v.string(), - createdAt: v.number(), - }), -}; + user: defineTable({ + name: v.string(), + email: v.string(), + emailVerified: v.boolean(), + image: v.optional(v.union(v.null(), v.string())), + createdAt: v.number(), + updatedAt: v.number(), + userId: v.optional(v.union(v.null(), v.string())), + }) + .index("email_name", ["email", "name"]) + .index("name", ["name"]) + .index("userId", ["userId"]), + session: defineTable({ + expiresAt: v.number(), + token: v.string(), + createdAt: v.number(), + updatedAt: v.number(), + ipAddress: v.optional(v.union(v.null(), v.string())), + userAgent: v.optional(v.union(v.null(), v.string())), + userId: v.string(), + }) + .index("expiresAt", ["expiresAt"]) + .index("expiresAt_userId", ["expiresAt", "userId"]) + .index("token", ["token"]) + .index("userId", ["userId"]), + account: defineTable({ + accountId: v.string(), + providerId: v.string(), + userId: v.string(), + accessToken: v.optional(v.union(v.null(), v.string())), + refreshToken: v.optional(v.union(v.null(), v.string())), + idToken: v.optional(v.union(v.null(), v.string())), + accessTokenExpiresAt: v.optional(v.union(v.null(), v.number())), + refreshTokenExpiresAt: v.optional(v.union(v.null(), v.number())), + scope: v.optional(v.union(v.null(), v.string())), + password: v.optional(v.union(v.null(), v.string())), + createdAt: v.number(), + updatedAt: v.number(), + }) + .index("accountId", ["accountId"]) + .index("accountId_providerId", ["accountId", "providerId"]) + .index("providerId_userId", ["providerId", "userId"]) + .index("userId", ["userId"]), + verification: defineTable({ + identifier: v.string(), + value: v.string(), + expiresAt: v.number(), + createdAt: v.number(), + updatedAt: v.number(), + }) + .index("expiresAt", ["expiresAt"]) + .index("identifier", ["identifier"]), + jwks: defineTable({ + publicKey: v.string(), + privateKey: v.string(), + createdAt: v.number(), + }), +} -const schema = defineSchema(tables); +const schema = defineSchema(tables) -export default schema; +export default schema diff --git a/packages/convex/convex/_generated/api.d.ts b/packages/convex/convex/_generated/api.d.ts index 7d71a01..97036e3 100644 --- a/packages/convex/convex/_generated/api.d.ts +++ b/packages/convex/convex/_generated/api.d.ts @@ -9,10 +9,10 @@ */ import type { - ApiFromModules, - FilterApi, - FunctionReference, -} from "convex/server"; + ApiFromModules, + FilterApi, + FunctionReference, +} from "convex/server" /** * A utility for referencing Convex functions in your app's API. @@ -22,12 +22,12 @@ import type { * const myFunctionReference = api.myModule.myFunction; * ``` */ -declare const fullApi: ApiFromModules<{}>; +declare const fullApi: ApiFromModules<{}> export declare const api: FilterApi< - typeof fullApi, - FunctionReference ->; + typeof fullApi, + FunctionReference +> export declare const internal: FilterApi< - typeof fullApi, - FunctionReference ->; + typeof fullApi, + FunctionReference +> diff --git a/packages/convex/convex/_generated/api.js b/packages/convex/convex/_generated/api.js index 3f9c482..b58228e 100644 --- a/packages/convex/convex/_generated/api.js +++ b/packages/convex/convex/_generated/api.js @@ -8,7 +8,7 @@ * @module */ -import { anyApi } from "convex/server"; +import { anyApi } from "convex/server" /** * A utility for referencing Convex functions in your app's API. @@ -18,5 +18,5 @@ import { anyApi } from "convex/server"; * const myFunctionReference = api.myModule.myFunction; * ``` */ -export const api = anyApi; -export const internal = anyApi; +export const api = anyApi +export const internal = anyApi diff --git a/packages/convex/convex/_generated/dataModel.d.ts b/packages/convex/convex/_generated/dataModel.d.ts index fb12533..c00e2fb 100644 --- a/packages/convex/convex/_generated/dataModel.d.ts +++ b/packages/convex/convex/_generated/dataModel.d.ts @@ -8,8 +8,8 @@ * @module */ -import { AnyDataModel } from "convex/server"; -import type { GenericId } from "convex/values"; +import { AnyDataModel } from "convex/server" +import type { GenericId } from "convex/values" /** * No `schema.ts` file found! @@ -25,12 +25,12 @@ import type { GenericId } from "convex/values"; /** * The names of all of your Convex tables. */ -export type TableNames = string; +export type TableNames = string /** * The type of a document stored in Convex. */ -export type Doc = any; +export type Doc = any /** * An identifier for a document in Convex. @@ -43,8 +43,7 @@ export type Doc = any; * IDs are just strings at runtime, but this type can be used to distinguish them from other * strings when type checking. */ -export type Id = - GenericId; +export type Id = GenericId /** * A type describing your Convex data model. @@ -55,4 +54,4 @@ export type Id = * This type is used to parameterize methods like `queryGeneric` and * `mutationGeneric` to make them type-safe. */ -export type DataModel = AnyDataModel; +export type DataModel = AnyDataModel diff --git a/packages/convex/convex/_generated/server.d.ts b/packages/convex/convex/_generated/server.d.ts index 7f337a4..afbb95f 100644 --- a/packages/convex/convex/_generated/server.d.ts +++ b/packages/convex/convex/_generated/server.d.ts @@ -9,17 +9,17 @@ */ import { - ActionBuilder, - HttpActionBuilder, - MutationBuilder, - QueryBuilder, - GenericActionCtx, - GenericMutationCtx, - GenericQueryCtx, - GenericDatabaseReader, - GenericDatabaseWriter, -} from "convex/server"; -import type { DataModel } from "./dataModel.js"; + ActionBuilder, + HttpActionBuilder, + MutationBuilder, + QueryBuilder, + GenericActionCtx, + GenericMutationCtx, + GenericQueryCtx, + GenericDatabaseReader, + GenericDatabaseWriter, +} from "convex/server" +import type { DataModel } from "./dataModel.js" /** * Define a query in this Convex app's public API. @@ -29,7 +29,7 @@ import type { DataModel } from "./dataModel.js"; * @param func - The query function. It receives a {@link QueryCtx} as its first argument. * @returns The wrapped query. Include this as an `export` to name it and make it accessible. */ -export declare const query: QueryBuilder; +export declare const query: QueryBuilder /** * Define a query that is only accessible from other Convex functions (but not from the client). @@ -39,7 +39,7 @@ export declare const query: QueryBuilder; * @param func - The query function. It receives a {@link QueryCtx} as its first argument. * @returns The wrapped query. Include this as an `export` to name it and make it accessible. */ -export declare const internalQuery: QueryBuilder; +export declare const internalQuery: QueryBuilder /** * Define a mutation in this Convex app's public API. @@ -49,7 +49,7 @@ export declare const internalQuery: QueryBuilder; * @param func - The mutation function. It receives a {@link MutationCtx} as its first argument. * @returns The wrapped mutation. Include this as an `export` to name it and make it accessible. */ -export declare const mutation: MutationBuilder; +export declare const mutation: MutationBuilder /** * Define a mutation that is only accessible from other Convex functions (but not from the client). @@ -59,7 +59,7 @@ export declare const mutation: MutationBuilder; * @param func - The mutation function. It receives a {@link MutationCtx} as its first argument. * @returns The wrapped mutation. Include this as an `export` to name it and make it accessible. */ -export declare const internalMutation: MutationBuilder; +export declare const internalMutation: MutationBuilder /** * Define an action in this Convex app's public API. @@ -72,7 +72,7 @@ export declare const internalMutation: MutationBuilder; * @param func - The action. It receives an {@link ActionCtx} as its first argument. * @returns The wrapped action. Include this as an `export` to name it and make it accessible. */ -export declare const action: ActionBuilder; +export declare const action: ActionBuilder /** * Define an action that is only accessible from other Convex functions (but not from the client). @@ -80,7 +80,7 @@ export declare const action: ActionBuilder; * @param func - The function. It receives an {@link ActionCtx} as its first argument. * @returns The wrapped function. Include this as an `export` to name it and make it accessible. */ -export declare const internalAction: ActionBuilder; +export declare const internalAction: ActionBuilder /** * Define an HTTP action. @@ -92,7 +92,7 @@ export declare const internalAction: ActionBuilder; * @param func - The function. It receives an {@link ActionCtx} as its first argument. * @returns The wrapped function. Import this function from `convex/http.js` and route it to hook it up. */ -export declare const httpAction: HttpActionBuilder; +export declare const httpAction: HttpActionBuilder /** * A set of services for use within Convex query functions. @@ -103,7 +103,7 @@ export declare const httpAction: HttpActionBuilder; * This differs from the {@link MutationCtx} because all of the services are * read-only. */ -export type QueryCtx = GenericQueryCtx; +export type QueryCtx = GenericQueryCtx /** * A set of services for use within Convex mutation functions. @@ -111,7 +111,7 @@ export type QueryCtx = GenericQueryCtx; * The mutation context is passed as the first argument to any Convex mutation * function run on the server. */ -export type MutationCtx = GenericMutationCtx; +export type MutationCtx = GenericMutationCtx /** * A set of services for use within Convex action functions. @@ -119,7 +119,7 @@ export type MutationCtx = GenericMutationCtx; * The action context is passed as the first argument to any Convex action * function run on the server. */ -export type ActionCtx = GenericActionCtx; +export type ActionCtx = GenericActionCtx /** * An interface to read from the database within Convex query functions. @@ -128,7 +128,7 @@ export type ActionCtx = GenericActionCtx; * document by its {@link Id}, or {@link DatabaseReader.query}, which starts * building a query. */ -export type DatabaseReader = GenericDatabaseReader; +export type DatabaseReader = GenericDatabaseReader /** * An interface to read from and write to the database within Convex mutation @@ -139,4 +139,4 @@ export type DatabaseReader = GenericDatabaseReader; * your data in an inconsistent state. See [the Convex Guide](https://docs.convex.dev/understanding/convex-fundamentals/functions#atomicity-and-optimistic-concurrency-control) * for the guarantees Convex provides your functions. */ -export type DatabaseWriter = GenericDatabaseWriter; +export type DatabaseWriter = GenericDatabaseWriter diff --git a/packages/convex/convex/_generated/server.js b/packages/convex/convex/_generated/server.js index 566d485..46138bc 100644 --- a/packages/convex/convex/_generated/server.js +++ b/packages/convex/convex/_generated/server.js @@ -9,14 +9,14 @@ */ import { - actionGeneric, - httpActionGeneric, - queryGeneric, - mutationGeneric, - internalActionGeneric, - internalMutationGeneric, - internalQueryGeneric, -} from "convex/server"; + actionGeneric, + httpActionGeneric, + internalActionGeneric, + internalMutationGeneric, + internalQueryGeneric, + mutationGeneric, + queryGeneric, +} from "convex/server" /** * Define a query in this Convex app's public API. @@ -26,7 +26,7 @@ import { * @param func - The query function. It receives a {@link QueryCtx} as its first argument. * @returns The wrapped query. Include this as an `export` to name it and make it accessible. */ -export const query = queryGeneric; +export const query = queryGeneric /** * Define a query that is only accessible from other Convex functions (but not from the client). @@ -36,7 +36,7 @@ export const query = queryGeneric; * @param func - The query function. It receives a {@link QueryCtx} as its first argument. * @returns The wrapped query. Include this as an `export` to name it and make it accessible. */ -export const internalQuery = internalQueryGeneric; +export const internalQuery = internalQueryGeneric /** * Define a mutation in this Convex app's public API. @@ -46,7 +46,7 @@ export const internalQuery = internalQueryGeneric; * @param func - The mutation function. It receives a {@link MutationCtx} as its first argument. * @returns The wrapped mutation. Include this as an `export` to name it and make it accessible. */ -export const mutation = mutationGeneric; +export const mutation = mutationGeneric /** * Define a mutation that is only accessible from other Convex functions (but not from the client). @@ -56,7 +56,7 @@ export const mutation = mutationGeneric; * @param func - The mutation function. It receives a {@link MutationCtx} as its first argument. * @returns The wrapped mutation. Include this as an `export` to name it and make it accessible. */ -export const internalMutation = internalMutationGeneric; +export const internalMutation = internalMutationGeneric /** * Define an action in this Convex app's public API. @@ -69,7 +69,7 @@ export const internalMutation = internalMutationGeneric; * @param func - The action. It receives an {@link ActionCtx} as its first argument. * @returns The wrapped action. Include this as an `export` to name it and make it accessible. */ -export const action = actionGeneric; +export const action = actionGeneric /** * Define an action that is only accessible from other Convex functions (but not from the client). @@ -77,7 +77,7 @@ export const action = actionGeneric; * @param func - The function. It receives an {@link ActionCtx} as its first argument. * @returns The wrapped function. Include this as an `export` to name it and make it accessible. */ -export const internalAction = internalActionGeneric; +export const internalAction = internalActionGeneric /** * Define a Convex HTTP action. @@ -86,4 +86,4 @@ export const internalAction = internalActionGeneric; * as its second. * @returns The wrapped endpoint function. Route a URL path to this function in `convex/http.js`. */ -export const httpAction = httpActionGeneric; +export const httpAction = httpActionGeneric diff --git a/packages/convex/tsconfig.json b/packages/convex/tsconfig.json index 7374127..a84f928 100644 --- a/packages/convex/tsconfig.json +++ b/packages/convex/tsconfig.json @@ -1,25 +1,25 @@ { - /* This TypeScript project config describes the environment that - * Convex functions run in and is used to typecheck them. - * You can modify it, but some settings are required to use Convex. - */ - "compilerOptions": { - /* These settings are not required by Convex and can be modified. */ - "allowJs": true, - "strict": true, - "moduleResolution": "Bundler", - "jsx": "react-jsx", - "skipLibCheck": true, - "allowSyntheticDefaultImports": true, + /* This TypeScript project config describes the environment that + * Convex functions run in and is used to typecheck them. + * You can modify it, but some settings are required to use Convex. + */ + "compilerOptions": { + /* These settings are not required by Convex and can be modified. */ + "allowJs": true, + "strict": true, + "moduleResolution": "Bundler", + "jsx": "react-jsx", + "skipLibCheck": true, + "allowSyntheticDefaultImports": true, - /* These compiler options are required by Convex */ - "target": "ESNext", - "lib": ["ES2021", "dom"], - "forceConsistentCasingInFileNames": true, - "module": "ESNext", - "isolatedModules": true, - "noEmit": true - }, - "include": ["./**/*"], - "exclude": ["./_generated"] + /* These compiler options are required by Convex */ + "target": "ESNext", + "lib": ["ES2021", "dom"], + "forceConsistentCasingInFileNames": true, + "module": "ESNext", + "isolatedModules": true, + "noEmit": true + }, + "include": ["./**/*"], + "exclude": ["./_generated"] }