kitcn 0.12.19 → 0.12.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{api-entry-BMCQSsCw.js → api-entry-BUAh_K4k.js} +4 -1
- package/dist/auth/index.js +1 -1
- package/dist/auth/nextjs/index.js +8 -5
- package/dist/{backend-core-C0uwGXLx.mjs → backend-core-Bgl7-xmL.mjs} +17 -3
- package/dist/cli.mjs +1 -1
- package/dist/ratelimit/index.js +1 -1
- package/dist/server/index.js +1 -1
- package/dist/watcher.mjs +1 -1
- package/package.json +1 -1
- package/skills/convex/SKILL.md +4 -2
- package/skills/convex/references/setup/start.md +4 -0
|
@@ -15,7 +15,10 @@ const requireMutationCtx = (ctx) => {
|
|
|
15
15
|
return ctx;
|
|
16
16
|
};
|
|
17
17
|
const requireActionCtx = (ctx) => {
|
|
18
|
-
if (!isActionCtx(ctx))
|
|
18
|
+
if (!isActionCtx(ctx)) {
|
|
19
|
+
if (isSchedulerCtx(ctx)) throw new Error("Action context required. This ctx can schedule work but cannot call action procedures directly. Use requireSchedulerCtx(ctx) with caller.schedule.*.");
|
|
20
|
+
throw new Error("Action context required");
|
|
21
|
+
}
|
|
19
22
|
return ctx;
|
|
20
23
|
};
|
|
21
24
|
const requireRunMutationCtx = (ctx) => {
|
package/dist/auth/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { r as partial, s as asyncMap } from "../validators-B7oIJCAp.js";
|
|
2
2
|
import { i as defineAuth, n as createDisabledAuthRuntime, r as getGeneratedAuthDisabledReason, t as DEFAULT_AUTH_DEFINITION_PATH } from "../generated-contract-disabled-Cih4eITO.js";
|
|
3
|
-
import { n as createGeneratedFunctionReference, o as isQueryCtx, s as isRunMutationCtx } from "../api-entry-
|
|
3
|
+
import { n as createGeneratedFunctionReference, o as isQueryCtx, s as isRunMutationCtx } from "../api-entry-BUAh_K4k.js";
|
|
4
4
|
import { n as customCtx, r as customMutation } from "../customFunctions-C0voKmtx.js";
|
|
5
5
|
import { a as mergedStream, l as unsetToken, o as stream, t as getByIdWithOrmQueryFallback, v as eq } from "../query-context-B8o6-8kC.js";
|
|
6
6
|
import { v } from "convex/values";
|
|
@@ -8,13 +8,16 @@ import { getToken } from "@convex-dev/better-auth/utils";
|
|
|
8
8
|
* Next.js + Better Auth wrapper for Convex caller factory.
|
|
9
9
|
* Uses @convex-dev/better-auth for token management.
|
|
10
10
|
*/
|
|
11
|
-
const handler = (request, siteUrl) => {
|
|
11
|
+
const handler = async (request, siteUrl) => {
|
|
12
12
|
const requestUrl = new URL(request.url);
|
|
13
13
|
const nextUrl = `${siteUrl}${requestUrl.pathname}${requestUrl.search}`;
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
const headers = new Headers(request.headers);
|
|
15
|
+
headers.set("accept-encoding", "application/json");
|
|
16
|
+
headers.set("host", new URL(siteUrl).host);
|
|
17
|
+
const body = request.method !== "GET" && request.method !== "HEAD" ? await request.arrayBuffer() : void 0;
|
|
18
|
+
return fetch(nextUrl, {
|
|
19
|
+
body,
|
|
20
|
+
headers,
|
|
18
21
|
method: request.method,
|
|
19
22
|
redirect: "manual"
|
|
20
23
|
});
|
|
@@ -14360,12 +14360,26 @@ async function runConvexInitIfNeeded(params) {
|
|
|
14360
14360
|
stdout: "",
|
|
14361
14361
|
stderr: ""
|
|
14362
14362
|
};
|
|
14363
|
-
const
|
|
14364
|
-
const
|
|
14363
|
+
const shouldUseLocalDevPreflight = getAggregateBackfillDeploymentKey(params.targetArgs ?? [], process.cwd(), params.env) === "local";
|
|
14364
|
+
const agentModeOverride = params.yes && shouldUseLocalDevPreflight ? "anonymous" : params.env?.CONVEX_AGENT_MODE;
|
|
14365
|
+
const commandArgs = shouldUseLocalDevPreflight ? [
|
|
14366
|
+
...params.backendAdapter.argsPrefix,
|
|
14367
|
+
"dev",
|
|
14368
|
+
"--local",
|
|
14369
|
+
"--once",
|
|
14370
|
+
"--skip-push",
|
|
14371
|
+
"--local-force-upgrade",
|
|
14372
|
+
"--typecheck",
|
|
14373
|
+
"disable",
|
|
14374
|
+
"--codegen",
|
|
14375
|
+
"disable",
|
|
14376
|
+
...params.targetArgs ?? []
|
|
14377
|
+
] : [
|
|
14365
14378
|
...params.backendAdapter.argsPrefix,
|
|
14366
14379
|
"init",
|
|
14367
14380
|
...params.targetArgs ?? []
|
|
14368
|
-
]
|
|
14381
|
+
];
|
|
14382
|
+
const result = normalizeConvexCommandResult(await params.execaFn(params.backendAdapter.command, commandArgs, {
|
|
14369
14383
|
cwd: process.cwd(),
|
|
14370
14384
|
env: createBackendCommandEnv({
|
|
14371
14385
|
...params.env,
|
package/dist/cli.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { $ as resolveAddTemplateDefaults, A as resolveConfiguredBackend, B as runConvexInitIfNeeded, C as isInitialized, D as readPackageVersions, E as parseInitCommandArgs, Et as highlighter, F as runAfterScaffoldScript, G as trackProcess, H as runInitCommandFlow, I as runAggregateBackfillFlow, J as createSpinner, K as withLocalCodegenEnv, L as runAggregatePruneFlow, M as resolveInitProjectDir, N as resolveMigrationConfig, O as resolveBackfillConfig, P as resolveRunDeps, Q as promptForScaffoldTemplateSelection, R as runBackendFunction, S as isEntryPoint, St as stripConvexCommandNoise, T as parseBackendRunJson, Tt as logger, U as runMigrationCreate, V as runDevSchemaBackfillIfNeeded, W as runMigrationFlow, X as filterScaffoldTemplatePathMap, Y as collectPluginScaffoldTemplates, Z as promptForPluginSelection, _ as formatInfoOutput, _t as applyPluginDependencyInstall, a as cleanup, at as getSupportedPluginKeys, b as hasRemoteConvexDeploymentEnv, bt as resolveAuthEnvState, c as createCommandEnv, ct as resolvePluginScaffoldRoots, d as extractBackfillCliOptions, dt as getPluginLockfilePath, et as resolvePluginPreset, f as extractConcaveRunTargetArgs, ft as getSchemaFilePath, g as formatDocsOutput, gt as applyPlanningDependencyInstall, h as extractResetCliOptions, ht as applyDependencyHintsInstall, i as buildInitializationPlan, it as getPluginCatalogEntry, j as resolveDocTopic, k as resolveCodegenTrimSegments, l as ensureConvexGitignoreEntry, lt as assertSchemaFileExists, m as extractMigrationDownOptions, mt as resolveSchemaInstalledPlugins, n as applyPluginInstallPlanFiles, nt as resolveTemplateSelectionSource, o as createBackendAdapter, ot as isSupportedPluginKey, p as extractMigrationCliOptions, pt as readPluginLockfile, q as withWorkingDirectory, r as assertNoRemovedDevPreRunFlag, rt as resolveTemplatesByIdOrThrow, s as createBackendCommandEnv, st as buildPluginInstallPlan, t as applyDependencyInstallPlan, tt as resolvePresetScaffoldTemplates, u as extractBackendRunTargetArgs, ut as collectInstalledPluginKeys, v as getAggregateBackfillDeploymentKey, vt as inspectPluginDependencyInstall, w as parseArgs, x as isConvexDevPreRunConflictFlag, xt as serializeEnvValue, y as getDevAggregateBackfillStatePath, yt as resolveProjectScaffoldContext, z as runConfiguredCodegen } from "./backend-core-
|
|
2
|
+
import { $ as resolveAddTemplateDefaults, A as resolveConfiguredBackend, B as runConvexInitIfNeeded, C as isInitialized, D as readPackageVersions, E as parseInitCommandArgs, Et as highlighter, F as runAfterScaffoldScript, G as trackProcess, H as runInitCommandFlow, I as runAggregateBackfillFlow, J as createSpinner, K as withLocalCodegenEnv, L as runAggregatePruneFlow, M as resolveInitProjectDir, N as resolveMigrationConfig, O as resolveBackfillConfig, P as resolveRunDeps, Q as promptForScaffoldTemplateSelection, R as runBackendFunction, S as isEntryPoint, St as stripConvexCommandNoise, T as parseBackendRunJson, Tt as logger, U as runMigrationCreate, V as runDevSchemaBackfillIfNeeded, W as runMigrationFlow, X as filterScaffoldTemplatePathMap, Y as collectPluginScaffoldTemplates, Z as promptForPluginSelection, _ as formatInfoOutput, _t as applyPluginDependencyInstall, a as cleanup, at as getSupportedPluginKeys, b as hasRemoteConvexDeploymentEnv, bt as resolveAuthEnvState, c as createCommandEnv, ct as resolvePluginScaffoldRoots, d as extractBackfillCliOptions, dt as getPluginLockfilePath, et as resolvePluginPreset, f as extractConcaveRunTargetArgs, ft as getSchemaFilePath, g as formatDocsOutput, gt as applyPlanningDependencyInstall, h as extractResetCliOptions, ht as applyDependencyHintsInstall, i as buildInitializationPlan, it as getPluginCatalogEntry, j as resolveDocTopic, k as resolveCodegenTrimSegments, l as ensureConvexGitignoreEntry, lt as assertSchemaFileExists, m as extractMigrationDownOptions, mt as resolveSchemaInstalledPlugins, n as applyPluginInstallPlanFiles, nt as resolveTemplateSelectionSource, o as createBackendAdapter, ot as isSupportedPluginKey, p as extractMigrationCliOptions, pt as readPluginLockfile, q as withWorkingDirectory, r as assertNoRemovedDevPreRunFlag, rt as resolveTemplatesByIdOrThrow, s as createBackendCommandEnv, st as buildPluginInstallPlan, t as applyDependencyInstallPlan, tt as resolvePresetScaffoldTemplates, u as extractBackendRunTargetArgs, ut as collectInstalledPluginKeys, v as getAggregateBackfillDeploymentKey, vt as inspectPluginDependencyInstall, w as parseArgs, x as isConvexDevPreRunConflictFlag, xt as serializeEnvValue, y as getDevAggregateBackfillStatePath, yt as resolveProjectScaffoldContext, z as runConfiguredCodegen } from "./backend-core-Bgl7-xmL.mjs";
|
|
3
3
|
import fs, { existsSync, readFileSync } from "node:fs";
|
|
4
4
|
import path, { delimiter, dirname, join, relative, resolve } from "node:path";
|
|
5
5
|
import { fileURLToPath } from "node:url";
|
package/dist/ratelimit/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { u as requireMutationCtx } from "../api-entry-
|
|
1
|
+
import { u as requireMutationCtx } from "../api-entry-BUAh_K4k.js";
|
|
2
2
|
import { _ as CRPCError } from "../builder-Cb6gloDB.js";
|
|
3
3
|
import { t as definePlugin } from "../middleware-DkIhQXwg.js";
|
|
4
4
|
import { v } from "convex/values";
|
package/dist/server/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as isMutationCtx, c as isSchedulerCtx, d as requireQueryCtx, f as requireRunMutationCtx, i as isActionCtx, l as requireActionCtx, n as createGeneratedFunctionReference, o as isQueryCtx, p as requireSchedulerCtx, r as getGeneratedValue, s as isRunMutationCtx, t as createApiLeaf, u as requireMutationCtx } from "../api-entry-
|
|
1
|
+
import { a as isMutationCtx, c as isSchedulerCtx, d as requireQueryCtx, f as requireRunMutationCtx, i as isActionCtx, l as requireActionCtx, n as createGeneratedFunctionReference, o as isQueryCtx, p as requireSchedulerCtx, r as getGeneratedValue, s as isRunMutationCtx, t as createApiLeaf, u as requireMutationCtx } from "../api-entry-BUAh_K4k.js";
|
|
2
2
|
import { n as createLazyCaller, r as createServerCaller, t as createCallerFactory } from "../caller-factory-cTXNvYdz.js";
|
|
3
3
|
import { A as zid, C as toCRPCError, D as zCustomAction, E as withSystemFields, M as zodOutputToConvexFields, N as zodToConvex, O as zCustomMutation, P as zodToConvexFields, S as isCRPCError, T as convexToZodFields, _ as CRPCError, a as createMiddlewareFactory, b as getCRPCErrorFromUnknown, c as registerProcedureNameLookup, d as createHttpRouterFactory, f as extractRouteMap, g as matchPathParams, h as handleHttpError, i as QueryProcedureBuilder, j as zodOutputToConvex, k as zCustomQuery, l as HttpRouterWithHono, m as extractPathParams, n as MutationProcedureBuilder, o as initCRPC, p as createHttpProcedureBuilder, r as ProcedureBuilder, s as inferProcedureNameFromCallsite, t as ActionProcedureBuilder, u as createHttpRouter, v as CRPC_ERROR_CODES_BY_KEY, w as convexToZod, x as getHTTPStatusCodeFromError, y as CRPC_ERROR_CODE_TO_HTTP } from "../builder-Cb6gloDB.js";
|
|
4
4
|
import { a as createProcedureHandlerFactory, c as typedProcedureResolver, i as createProcedureCallerFactory, l as createEnv, n as createGenericCallerFactory, o as defineProcedure, r as createGenericHandlerFactory, s as getGeneratedFunctionReference, t as createGeneratedRegistryRuntime } from "../procedure-caller-AjLfkHyF.js";
|
package/dist/watcher.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { A as resolveConfiguredBackend, Ct as generateMeta, K as withLocalCodegenEnv, P as resolveRunDeps, Tt as logger, wt as getConvexConfig } from "./backend-core-
|
|
2
|
+
import { A as resolveConfiguredBackend, Ct as generateMeta, K as withLocalCodegenEnv, P as resolveRunDeps, Tt as logger, wt as getConvexConfig } from "./backend-core-Bgl7-xmL.mjs";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import { fileURLToPath } from "node:url";
|
|
5
5
|
|
package/package.json
CHANGED
package/skills/convex/SKILL.md
CHANGED
|
@@ -54,7 +54,7 @@ Only remember these non-parity deltas:
|
|
|
54
54
|
19. On the kitcn auth client path, use `createAuthMutations(authClient)` wrappers so logout unsubscribes auth queries before sign out. Raw Convex preset keeps a smaller plain `authClient`.
|
|
55
55
|
20. **NEVER** use `ctx.runQuery`/`ctx.runMutation`/`ctx.runAction` directly for module-to-module calls. Use `create<Module>Handler(ctx)` or `create<Module>Caller(ctx)` from `convex/functions/generated/<module>.runtime` instead.
|
|
56
56
|
21. **`create<Module>Handler(ctx)`** — default choice for queries/mutations. Bypasses input validation, middleware, output validation → zero overhead. Query/mutation ctx only. Import from `./generated/<module>.runtime`.
|
|
57
|
-
22. **`create<Module>Caller(ctx)`** — use in actions and HTTP routes (where handler is unavailable). Goes through validation + middleware. Root caller exposes query+mutation procedures. In `ActionCtx`, action procedures are under `caller.actions.*`; scheduling is under `caller.schedule.now|after|at` with `caller.schedule.cancel(id)`.
|
|
57
|
+
22. **`create<Module>Caller(ctx)`** — use in actions and HTTP routes (where handler is unavailable). Goes through validation + middleware. Root caller exposes query+mutation procedures. In `ActionCtx`, action procedures are under `caller.actions.*`; scheduling is under `caller.schedule.now|after|at` with `caller.schedule.cancel(id)`. Use `requireActionCtx(ctx)` only when the callback truly runs in `ActionCtx` and you need `caller.actions.*`. If the callback can run from `MutationCtx | ActionCtx` or generic scheduler-capable context, keep the seam honest: use `requireSchedulerCtx(ctx)` and `caller.schedule.*` instead of pretending the path is action-only. Import from `./generated/<module>.runtime`. Each caller/handler eagerly loads every procedure in its module (no lazy loading) — split large modules to keep bundles lean.
|
|
58
58
|
23. API types (`Api`, `ApiInputs`, `ApiOutputs`, `Select`, `Insert`, `TableName`) import from `@convex/api` — no manual `inferApiInputs<typeof api>`.
|
|
59
59
|
24. HTTP router must export as `httpRouter` (not `appRouter`) for codegen.
|
|
60
60
|
25. Server wiring imports come from `convex/functions/generated/` directory: `getAuth`, `defineAuth` from `generated/auth`; `initCRPC`, `QueryCtx`, `MutationCtx`, `OrmCtx` from `generated/server`; `create<Module>Caller`, `create<Module>Handler` from `generated/<module>.runtime`. No manual `convex/lib/orm.ts`.
|
|
@@ -350,7 +350,9 @@ Key client defaults/deltas:
|
|
|
350
350
|
5. For pagination, use `useInfiniteQuery` from `kitcn/react`.
|
|
351
351
|
6. Prefer typed `queryKey(...)` helpers for cache read/write/fetch ops instead of manual keys.
|
|
352
352
|
7. For kitcn auth flows, prefer `createAuthMutations(...)` wrappers (not raw auth client calls) to avoid logout race errors. Raw Convex preset keeps the plain auth client path.
|
|
353
|
-
8.
|
|
353
|
+
8. For mutation toasts, prefer `error.data?.message` over `error.message`; `data.message` is the clean `CRPCError` payload.
|
|
354
|
+
9. Prefer one global `QueryClient` mutation `onError` toast with `mutation.meta.errorMessage` / `skipErrorToast` rather than copy-pasting `onError` in every component.
|
|
355
|
+
10. Full client/RSC depth lives in `references/features/react.md`.
|
|
354
356
|
|
|
355
357
|
### 8) RSC Patterns (Next.js)
|
|
356
358
|
|
|
@@ -3,6 +3,10 @@
|
|
|
3
3
|
CLI-first flow: scaffold the app, run `kitcn add auth --yes`, then treat the
|
|
4
4
|
files below as the generated reference output. They are not a separate manual
|
|
5
5
|
install path.
|
|
6
|
+
|
|
7
|
+
After changing plugins or auth fields in `<functionsDir>/auth.ts`, refresh
|
|
8
|
+
auth-owned schema blocks with `bunx kitcn add auth --schema --yes`. Keep
|
|
9
|
+
`bunx kitcn dev` running as the local Convex + codegen loop.
|
|
6
10
|
### 8.B.1 Auth client + auth server helpers
|
|
7
11
|
|
|
8
12
|
**Create:** `src/lib/convex/auth-client.ts`
|