kitcn 0.14.3 → 0.15.1
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/aggregate/index.d.ts +1 -1
- package/dist/auth/start/index.d.ts +27 -1
- package/dist/auth/start/index.js +27 -1
- package/dist/{backend-core-cwf87w_T.mjs → backend-core-B091CyHN.mjs} +23 -7
- package/dist/cli.mjs +1 -1
- package/dist/orm/index.d.ts +1 -1
- package/dist/watcher.mjs +1 -1
- package/dist/{where-clause-compiler-TMppDl9g.d.ts → where-clause-compiler-DcEhkJ12.d.ts} +59 -59
- package/package.json +2 -2
- package/skills/kitcn/references/setup/server.md +12 -10
- package/skills/kitcn/references/setup/start.md +34 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as ConvexNumberBuilderInitial, E as ConvexIdBuilderInitial, N as ConvexCustomBuilderInitial, dn as ConvexTableWithColumns, tr as ConvexTextBuilderInitial } from "../where-clause-compiler-
|
|
1
|
+
import { C as ConvexNumberBuilderInitial, E as ConvexIdBuilderInitial, N as ConvexCustomBuilderInitial, dn as ConvexTableWithColumns, tr as ConvexTextBuilderInitial } from "../where-clause-compiler-DcEhkJ12.js";
|
|
2
2
|
import * as convex_values0 from "convex/values";
|
|
3
3
|
import { GenericId, Infer, Value } from "convex/values";
|
|
4
4
|
import { DocumentByName, GenericDataModel, GenericDatabaseReader, GenericDatabaseWriter, TableNamesInDataModel } from "convex/server";
|
|
@@ -2,10 +2,36 @@ import { t as GetTokenOptions } from "../../token-B9Bjcqug.js";
|
|
|
2
2
|
import { FunctionReference, FunctionReturnType, OptionalRestArgs } from "convex/server";
|
|
3
3
|
|
|
4
4
|
//#region src/auth-start/index.d.ts
|
|
5
|
+
type MaybePromise<T> = Promise<T> | T;
|
|
6
|
+
type StartLoaderAuthClient = {
|
|
7
|
+
clearAuth: () => void;
|
|
8
|
+
setAuth: (fetchToken: () => Promise<string | null>) => void;
|
|
9
|
+
};
|
|
10
|
+
type StartLoaderServerHttpClient = {
|
|
11
|
+
clearAuth?: () => void;
|
|
12
|
+
setAuth: (token: string) => void;
|
|
13
|
+
};
|
|
14
|
+
type StartLoaderConvexQueryClient = {
|
|
15
|
+
convexClient: StartLoaderAuthClient;
|
|
16
|
+
serverHttpClient?: StartLoaderServerHttpClient;
|
|
17
|
+
};
|
|
18
|
+
type StartLoaderAuthTarget = StartLoaderAuthClient | StartLoaderConvexQueryClient;
|
|
19
|
+
type SyncConvexAuthForStartLoaderOptions = {
|
|
20
|
+
convex: StartLoaderAuthTarget;
|
|
21
|
+
getToken: () => MaybePromise<null | string | undefined>;
|
|
22
|
+
};
|
|
23
|
+
type StartLoaderAuthState = {
|
|
24
|
+
isAuthenticated: boolean;
|
|
25
|
+
token: null | string;
|
|
26
|
+
};
|
|
5
27
|
type ConvexBetterAuthReactStartOptions = Omit<GetTokenOptions, 'forceRefresh'> & {
|
|
6
28
|
convexSiteUrl: string;
|
|
7
29
|
convexUrl: string;
|
|
8
30
|
};
|
|
31
|
+
declare const syncConvexAuthForStartLoader: ({
|
|
32
|
+
convex,
|
|
33
|
+
getToken
|
|
34
|
+
}: SyncConvexAuthForStartLoaderOptions) => Promise<StartLoaderAuthState>;
|
|
9
35
|
declare const convexBetterAuthReactStart: (opts: ConvexBetterAuthReactStartOptions) => {
|
|
10
36
|
getToken: () => Promise<string | undefined>;
|
|
11
37
|
handler: (request: Request) => Promise<Response>;
|
|
@@ -14,4 +40,4 @@ declare const convexBetterAuthReactStart: (opts: ConvexBetterAuthReactStartOptio
|
|
|
14
40
|
fetchAuthAction: <Action extends FunctionReference<"action">>(action: Action, ...args: OptionalRestArgs<Action>) => Promise<FunctionReturnType<Action>>;
|
|
15
41
|
};
|
|
16
42
|
//#endregion
|
|
17
|
-
export { convexBetterAuthReactStart };
|
|
43
|
+
export { MaybePromise, StartLoaderAuthClient, StartLoaderAuthState, StartLoaderAuthTarget, StartLoaderConvexQueryClient, StartLoaderServerHttpClient, SyncConvexAuthForStartLoaderOptions, convexBetterAuthReactStart, syncConvexAuthForStartLoader };
|
package/dist/auth/start/index.js
CHANGED
|
@@ -8,6 +8,32 @@ const fallbackCache = (fn) => fn;
|
|
|
8
8
|
const cache = React.cache ?? fallbackCache;
|
|
9
9
|
const TANSTACK_REACT_START_SERVER = "@tanstack/react-start/server";
|
|
10
10
|
const TRAILING_COLON_RE = /:$/;
|
|
11
|
+
const startLoaderAuthTokens = /* @__PURE__ */ new WeakMap();
|
|
12
|
+
const isStartLoaderConvexQueryClient = (target) => "convexClient" in target;
|
|
13
|
+
const syncConvexAuthForStartLoader = async ({ convex, getToken }) => {
|
|
14
|
+
const authClient = isStartLoaderConvexQueryClient(convex) ? convex.convexClient : convex;
|
|
15
|
+
const serverHttpClient = isStartLoaderConvexQueryClient(convex) ? convex.serverHttpClient : void 0;
|
|
16
|
+
const token = await getToken() ?? null;
|
|
17
|
+
if (startLoaderAuthTokens.get(convex) === token) return {
|
|
18
|
+
isAuthenticated: token !== null,
|
|
19
|
+
token
|
|
20
|
+
};
|
|
21
|
+
startLoaderAuthTokens.set(convex, token);
|
|
22
|
+
if (token === null) {
|
|
23
|
+
authClient.clearAuth();
|
|
24
|
+
serverHttpClient?.clearAuth?.();
|
|
25
|
+
return {
|
|
26
|
+
isAuthenticated: false,
|
|
27
|
+
token
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
authClient.setAuth(async () => token);
|
|
31
|
+
serverHttpClient?.setAuth(token);
|
|
32
|
+
return {
|
|
33
|
+
isAuthenticated: true,
|
|
34
|
+
token
|
|
35
|
+
};
|
|
36
|
+
};
|
|
11
37
|
function setupClient(options) {
|
|
12
38
|
const client = new ConvexHttpClient(options.convexUrl);
|
|
13
39
|
if (options.token !== void 0) client.setAuth(options.token);
|
|
@@ -124,4 +150,4 @@ const convexBetterAuthReactStart = (opts) => {
|
|
|
124
150
|
};
|
|
125
151
|
|
|
126
152
|
//#endregion
|
|
127
|
-
export { convexBetterAuthReactStart };
|
|
153
|
+
export { convexBetterAuthReactStart, syncConvexAuthForStartLoader };
|
|
@@ -5966,7 +5966,16 @@ const syncEnv = pushEnv;
|
|
|
5966
5966
|
|
|
5967
5967
|
//#endregion
|
|
5968
5968
|
//#region src/cli/package-manager.ts
|
|
5969
|
-
function
|
|
5969
|
+
function detectPackageManagerFromUserAgent(env = process.env) {
|
|
5970
|
+
const userAgent = env.npm_config_user_agent?.trim().toLowerCase();
|
|
5971
|
+
if (!userAgent) return null;
|
|
5972
|
+
if (userAgent.startsWith("bun/")) return "bun";
|
|
5973
|
+
if (userAgent.startsWith("pnpm/")) return "pnpm";
|
|
5974
|
+
if (userAgent.startsWith("yarn/")) return "yarn";
|
|
5975
|
+
if (userAgent.startsWith("npm/")) return "npm";
|
|
5976
|
+
return null;
|
|
5977
|
+
}
|
|
5978
|
+
function detectPackageManager(projectDir, env = process.env) {
|
|
5970
5979
|
let current = resolve(projectDir);
|
|
5971
5980
|
while (true) {
|
|
5972
5981
|
const packageJsonPath = join(current, "package.json");
|
|
@@ -5987,7 +5996,7 @@ function detectPackageManager(projectDir) {
|
|
|
5987
5996
|
if (parent === current) break;
|
|
5988
5997
|
current = parent;
|
|
5989
5998
|
}
|
|
5990
|
-
return "bun";
|
|
5999
|
+
return detectPackageManagerFromUserAgent(env) ?? "bun";
|
|
5991
6000
|
}
|
|
5992
6001
|
function resolveDependencyInstallCommand(packageManager, packageSpecs) {
|
|
5993
6002
|
return {
|
|
@@ -6224,7 +6233,7 @@ const EXACT_VERSION_RE = /^(\d+)\.(\d+)\.\d+$/;
|
|
|
6224
6233
|
const VERSION_IN_SPEC_RE = /(\d+)\.(\d+)(?:\.\d+)?/;
|
|
6225
6234
|
const PLAIN_VERSION_SPEC_RE = /^[\^~]?v?\d+\.\d+(?:\.\d+)?$/;
|
|
6226
6235
|
const UPPER_BOUND_RE = /(?:^|\s)<={0,1}\s*v?(\d+)\.(\d+)(?:\.\d+)?/g;
|
|
6227
|
-
const SUPPORTED_CONVEX_VERSION = "1.
|
|
6236
|
+
const SUPPORTED_CONVEX_VERSION = "1.38.0";
|
|
6228
6237
|
const SUPPORTED_BETTER_AUTH_VERSION = "1.6.9";
|
|
6229
6238
|
const SUPPORTED_HONO_VERSION = "4.12.9";
|
|
6230
6239
|
const SUPPORTED_OPENTELEMETRY_API_VERSION = "1.9.0";
|
|
@@ -10669,8 +10678,7 @@ const authRegistryItem = defineInternalRegistryItem({
|
|
|
10669
10678
|
//#endregion
|
|
10670
10679
|
//#region src/cli/registry/items/ratelimit/ratelimit-plugin.template.ts
|
|
10671
10680
|
const FUNCTIONS_DIR_IMPORT_PLACEHOLDER$4 = "__KITCN_FUNCTIONS_DIR__";
|
|
10672
|
-
const RATELIMIT_PLUGIN_TEMPLATE = `import {
|
|
10673
|
-
import { MINUTE, Ratelimit, RatelimitPlugin } from "kitcn/ratelimit";
|
|
10681
|
+
const RATELIMIT_PLUGIN_TEMPLATE = `import { MINUTE, Ratelimit, RatelimitPlugin } from "kitcn/ratelimit";
|
|
10674
10682
|
import type { MutationCtx } from "${FUNCTIONS_DIR_IMPORT_PLACEHOLDER$4}/generated/server";
|
|
10675
10683
|
|
|
10676
10684
|
const fixed = (rate: number) => Ratelimit.fixedWindow(rate, MINUTE);
|
|
@@ -10711,6 +10719,15 @@ export function getUserTier(user: RatelimitUser | null): RatelimitTier {
|
|
|
10711
10719
|
return "free";
|
|
10712
10720
|
}
|
|
10713
10721
|
|
|
10722
|
+
async function getRequestSignals(ctx: RatelimitCtx) {
|
|
10723
|
+
const { ip, userAgent } = await ctx.meta.getRequestMetadata();
|
|
10724
|
+
|
|
10725
|
+
return {
|
|
10726
|
+
...(ip ? { ip } : {}),
|
|
10727
|
+
...(userAgent ? { userAgent } : {}),
|
|
10728
|
+
};
|
|
10729
|
+
}
|
|
10730
|
+
|
|
10714
10731
|
export const ratelimit = RatelimitPlugin.configure({
|
|
10715
10732
|
buckets: ratelimitBuckets,
|
|
10716
10733
|
getBucket: ({ meta }: { meta: RatelimitMeta }) => meta.ratelimit ?? "default",
|
|
@@ -10718,7 +10735,7 @@ export const ratelimit = RatelimitPlugin.configure({
|
|
|
10718
10735
|
getIdentifier: ({ user }: { user: RatelimitUser | null }) =>
|
|
10719
10736
|
user?.id ?? "anonymous",
|
|
10720
10737
|
getTier: getUserTier,
|
|
10721
|
-
getSignals: ({ ctx }: { ctx: RatelimitCtx }) =>
|
|
10738
|
+
getSignals: ({ ctx }: { ctx: RatelimitCtx }) => getRequestSignals(ctx),
|
|
10722
10739
|
prefix: ({ bucket, tier }) => \`ratelimit:\${bucket}:\${tier}\`,
|
|
10723
10740
|
failureMode: "closed",
|
|
10724
10741
|
enableProtection: true,
|
|
@@ -15153,7 +15170,6 @@ async function runInitCommandFlow(params) {
|
|
|
15153
15170
|
realConcavePath: params.realConcavePath
|
|
15154
15171
|
});
|
|
15155
15172
|
}
|
|
15156
|
-
if (existingProjectContext?.framework === "expo") throw new Error("Expo adoption is not supported yet. Start with `kitcn init -t expo --yes`.");
|
|
15157
15173
|
if (!existingProjectContext) throw new Error("Could not detect a supported app scaffold. Use `kitcn init -t <next|expo|start|vite>` for a fresh app.");
|
|
15158
15174
|
return runScaffoldCommandFlow({
|
|
15159
15175
|
allowCodegenBootstrapFallback: !params.initArgs.json,
|
package/dist/cli.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { $ as promptForScaffoldTemplateSelection, A as resolveCodegenTrimSegments, At as highlighter, B as runConfiguredCodegen, C as isEntryPoint, Ct as formatDependencyInstallCommand, D as parseInitCommandArgs, E as parseBackendRunJson, Et as stripConvexCommandNoise, F as resolveRunDeps, G as runMigrationFlow, H as runDevSchemaBackfillIfNeeded, I as runAfterScaffoldScript, J as withWorkingDirectory, K as trackProcess, L as runAggregateBackfillFlow, M as resolveDocTopic, N as resolveInitProjectDir, O as readPackageVersions, P as resolveMigrationConfig, Q as promptForPluginSelection, R as runAggregatePruneFlow, S as isConvexDevPreRunConflictFlag, St as detectPackageManager, T as parseArgs, Tt as serializeEnvValue, U as runInitCommandFlow, V as runConvexInitIfNeeded, W as runMigrationCreate, X as collectPluginScaffoldTemplates, Y as createSpinner, Z as filterScaffoldTemplatePathMap, _ as formatInfoOutput, _t as applyPlanningDependencyInstall, a as cleanup, at as getPluginCatalogEntry, b as getDevAggregateBackfillStatePath, bt as resolveSupportedDependencyWarnings, c as createCommandEnv, ct as buildPluginInstallPlan, d as extractBackfillCliOptions, dt as collectInstalledPluginKeys, et as resolveAddTemplateDefaults, f as extractConcaveRunTargetArgs, ft as getPluginLockfilePath, g as formatDocsOutput, gt as applyDependencyHintsInstall, h as extractResetCliOptions, ht as resolveSchemaInstalledPlugins, i as buildInitializationPlan, it as resolveTemplatesByIdOrThrow, j as resolveConfiguredBackend, k as resolveBackfillConfig, kt as logger, l as ensureConvexGitignoreEntry, lt as resolvePluginScaffoldRoots, m as extractMigrationDownOptions, mt as readPluginLockfile, n as applyPluginInstallPlanFiles, nt as resolvePresetScaffoldTemplates, o as createBackendAdapter, ot as getSupportedPluginKeys, p as extractMigrationCliOptions, pt as getSchemaFilePath, q as withLocalCodegenEnv, r as assertNoRemovedDevPreRunFlag, rt as resolveTemplateSelectionSource, s as createBackendCommandEnv, st as isSupportedPluginKey, t as applyDependencyInstallPlan, tt as resolvePluginPreset, u as extractBackendRunTargetArgs, ut as assertSchemaFileExists, v as getAggregateBackfillDeploymentKey, vt as applyPluginDependencyInstall, w as isInitialized, wt as resolveAuthEnvState, x as hasRemoteConvexDeploymentEnv, xt as resolveProjectScaffoldContext, y as getConvexDeploymentCommandEnv, yt as inspectPluginDependencyInstall, z as runBackendFunction } from "./backend-core-
|
|
2
|
+
import { $ as promptForScaffoldTemplateSelection, A as resolveCodegenTrimSegments, At as highlighter, B as runConfiguredCodegen, C as isEntryPoint, Ct as formatDependencyInstallCommand, D as parseInitCommandArgs, E as parseBackendRunJson, Et as stripConvexCommandNoise, F as resolveRunDeps, G as runMigrationFlow, H as runDevSchemaBackfillIfNeeded, I as runAfterScaffoldScript, J as withWorkingDirectory, K as trackProcess, L as runAggregateBackfillFlow, M as resolveDocTopic, N as resolveInitProjectDir, O as readPackageVersions, P as resolveMigrationConfig, Q as promptForPluginSelection, R as runAggregatePruneFlow, S as isConvexDevPreRunConflictFlag, St as detectPackageManager, T as parseArgs, Tt as serializeEnvValue, U as runInitCommandFlow, V as runConvexInitIfNeeded, W as runMigrationCreate, X as collectPluginScaffoldTemplates, Y as createSpinner, Z as filterScaffoldTemplatePathMap, _ as formatInfoOutput, _t as applyPlanningDependencyInstall, a as cleanup, at as getPluginCatalogEntry, b as getDevAggregateBackfillStatePath, bt as resolveSupportedDependencyWarnings, c as createCommandEnv, ct as buildPluginInstallPlan, d as extractBackfillCliOptions, dt as collectInstalledPluginKeys, et as resolveAddTemplateDefaults, f as extractConcaveRunTargetArgs, ft as getPluginLockfilePath, g as formatDocsOutput, gt as applyDependencyHintsInstall, h as extractResetCliOptions, ht as resolveSchemaInstalledPlugins, i as buildInitializationPlan, it as resolveTemplatesByIdOrThrow, j as resolveConfiguredBackend, k as resolveBackfillConfig, kt as logger, l as ensureConvexGitignoreEntry, lt as resolvePluginScaffoldRoots, m as extractMigrationDownOptions, mt as readPluginLockfile, n as applyPluginInstallPlanFiles, nt as resolvePresetScaffoldTemplates, o as createBackendAdapter, ot as getSupportedPluginKeys, p as extractMigrationCliOptions, pt as getSchemaFilePath, q as withLocalCodegenEnv, r as assertNoRemovedDevPreRunFlag, rt as resolveTemplateSelectionSource, s as createBackendCommandEnv, st as isSupportedPluginKey, t as applyDependencyInstallPlan, tt as resolvePluginPreset, u as extractBackendRunTargetArgs, ut as assertSchemaFileExists, v as getAggregateBackfillDeploymentKey, vt as applyPluginDependencyInstall, w as isInitialized, wt as resolveAuthEnvState, x as hasRemoteConvexDeploymentEnv, xt as resolveProjectScaffoldContext, y as getConvexDeploymentCommandEnv, yt as inspectPluginDependencyInstall, z as runBackendFunction } from "./backend-core-B091CyHN.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/orm/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as GenericOrmCtx$1, $n as unique, $r as endsWith, $t as ManyConfig, A as ConvexDateMode, An as ConvexRankIndexBuilder, Ar as ReturningResult, At as MigrationManifestEntry, B as ConvexBytesBuilderInitial, Bn as rankIndex, Br as OrmSchemaRelations, Bt as defineMigration, C as ConvexNumberBuilderInitial, Ci as ColumnBuilderWithTableName, Cn as RlsRole, Cr as MutationReturning, Ct as MigrationStatusArgs, D as id, Di as IsPrimaryKey, Dn as ConvexAggregateIndexBuilderOn, Dr as PaginatedResult, Dt as MigrationDoc, E as ConvexIdBuilderInitial, Ei as HasDefault, En as ConvexAggregateIndexBuilder, Er as OrderDirection, Et as MigrationDirection, F as custom, Fn as ConvexVectorIndexBuilder, Fr as unsetToken, Ft as MigrationStateMap, G as ConvexBigIntBuilder, Gn as ConvexCheckConfig, Gr as ExpressionVisitor, Gt as OrmReader$1, H as ConvexBooleanBuilder, Hn as uniqueIndex, Hr as TableName, Ht as detectMigrationDrift, I as json, In as ConvexVectorIndexBuilderOn, Ir as Brand, It as MigrationStep, J as CountBackfillChunkArgs, Jn as ConvexUniqueConstraintBuilder, Jr as LogicalExpression, Jt as RlsMode, K as ConvexBigIntBuilderInitial, Kn as ConvexForeignKeyBuilder, Kr as FieldReference, Kt as OrmWriter$1, L as objectOf, Ln as ConvexVectorIndexConfig, Lr as Columns, Lt as MigrationTableName, M as ConvexCustomBuilder, Mn as ConvexSearchIndexBuilder, Mr as UpdateSet, Mt as MigrationPlan, N as ConvexCustomBuilderInitial, Nn as ConvexSearchIndexBuilderOn, Nr as VectorQueryConfig, Nt as MigrationRunStatus, O as ConvexDateBuilder, Oi as IsUnique, On as ConvexIndexBuilder, Or as PredicateWhereIndexConfig, Ot as MigrationDocContext, P as arrayOf, Pn as ConvexSearchIndexConfig, Pr as VectorSearchProvider, Pt as MigrationSet, Q as GenericOrm$1, Qn as foreignKey, Qr as contains, Qt as ExtractTablesWithRelations, R as unionOf, Rn as aggregateIndex, Rr as OrmSchemaExtensionTables, Rt as MigrationWriteMode, S as ConvexNumberBuilder, Si as ColumnBuilderTypeConfig, Sn as rlsPolicy, Sr as MutationResult, St as MigrationRunChunkArgs, T as ConvexIdBuilder, Ti as DrizzleEntity, Tn as rlsRole, Tr as OrderByClause, Tt as MigrationDefinition, U as ConvexBooleanBuilderInitial, Un as vectorIndex, Ur as SystemFields, Ut as DatabaseWithMutations, V as bytes, Vn as searchIndex, Vr as OrmSchemaTriggers, Vt as defineMigrationSet, W as boolean, Wn as ConvexCheckBuilder, Wr as BinaryExpression, Wt as DatabaseWithQuery, X as CountBackfillStatusArgs, Xn as ConvexUniqueConstraintConfig, Xr as and, Xt as extractRelationsConfig, Y as CountBackfillKickoffArgs, Yn as ConvexUniqueConstraintBuilderOn, Yr as UnaryExpression, Yt as EdgeMetadata, Z as CreateOrmOptions, Zn as check, Zr as between, Zt as ExtractTablesFromSchema, _ as ConvexTimestampMode, _i as startsWith, _n as deletion, _r as MutationExecuteConfig, _t as OrmTriggerContext, a as requireSchemaRelations, ai as inArray, an as TablesRelationalConfig, ar as AggregateResult, at as OrmWriterCtx, b as ConvexTextEnumBuilderInitial, bi as ColumnBuilderBaseConfig, bn as RlsPolicyConfig, br as MutationPaginateConfig, bt as MigrationCancelArgs, c as TableConfigResult, ci as isNull, cn as ConvexDeletionBuilder, cr as CountConfig, ct as ScheduledMutationBatchArgs, d as OrmNotFoundError, di as lte, dn as ConvexTableWithColumns, dr as FilterOperators, dt as scheduledDeleteFactory, ei as eq, en as OneConfig, er as ConvexTextBuilder, et as OrmApiResult, f as ConvexVectorBuilder, fi as ne, fn as DiscriminatorBuilderConfig, fr as GetColumnData, ft as SchemaExtension, g as ConvexTimestampBuilderInitial, gi as or, gn as convexTable, gr as InsertValue, gt as OrmTriggerChange, h as ConvexTimestampBuilder, hi as notInArray, hn as TableConfig, hr as InferSelectModel, ht as OrmTableTriggers, i as getSchemaTriggers, ii as ilike, in as TableRelationalConfig, ir as AggregateFieldValue, it as OrmReaderCtx, j as date, jn as ConvexRankIndexBuilderOn, jr as ReturningSelection, jt as MigrationMigrateOne, k as ConvexDateBuilderInitial, ki as NotNull, kn as ConvexIndexBuilderOn, kr as ReturningAll, kt as MigrationDriftIssue, l as getTableColumns, li as like, ln as ConvexDeletionConfig, lr as CountResult, lt as scheduledMutationBatchFactory, m as vector, mi as notBetween, mn as OrmLifecycleOperation, mr as InferModelFromColumns, mt as OrmBeforeResult, n as defineSchema, ni as gt, nn as RelationsBuilderColumnBase, nr as text, nt as OrmClientWithApi$1, o as asc, oi as isFieldReference, on as defineRelations, or as BuildQueryResult, ot as ResolveOrmSchema, p as ConvexVectorBuilderInitial, pi as not, pn as OrmLifecycleChange, pr as InferInsertModel, pt as defineSchemaExtension, q as bigint, qn as ConvexForeignKeyConfig, qr as FilterExpression, qt as RlsContext, r as getSchemaRelations, ri as gte, rn as RelationsBuilderColumnConfig, rr as AggregateConfig, rt as OrmFunctions, s as desc, si as isNotNull, sn as defineRelationsPart, sr as BuildRelationResult, st as createOrm, t as WhereClauseResult, ti as fieldRef, tn as RelationsBuilder, tr as ConvexTextBuilderInitial, tt as OrmClientBase$1, u as getTableConfig, ui as lt, un as ConvexTable, ur as DBQueryConfig, ut as ScheduledDeleteArgs, v as timestamp, vi as AnyColumn, vn as discriminator, vr as MutationExecuteResult, vt as OrmTriggers, w as integer, wi as ColumnDataType, wn as RlsRoleConfig, wr as MutationRunMode, wt as MigrationAppliedState, x as textEnum, xi as ColumnBuilderRuntimeConfig, xn as RlsPolicyToOption, xr as MutationPaginatedResult, xt as MigrationRunArgs, y as ConvexTextEnumBuilder, yi as ColumnBuilder, yn as RlsPolicy, yr as MutationExecutionMode, yt as defineTriggers, z as ConvexBytesBuilder, zn as index, zr as OrmSchemaExtensions, zt as buildMigrationPlan } from "../where-clause-compiler-
|
|
1
|
+
import { $ as GenericOrmCtx$1, $n as unique, $r as endsWith, $t as ManyConfig, A as ConvexDateMode, An as ConvexRankIndexBuilder, Ar as ReturningResult, At as MigrationManifestEntry, B as ConvexBytesBuilderInitial, Bn as rankIndex, Br as OrmSchemaRelations, Bt as defineMigration, C as ConvexNumberBuilderInitial, Ci as ColumnBuilderWithTableName, Cn as RlsRole, Cr as MutationReturning, Ct as MigrationStatusArgs, D as id, Di as IsPrimaryKey, Dn as ConvexAggregateIndexBuilderOn, Dr as PaginatedResult, Dt as MigrationDoc, E as ConvexIdBuilderInitial, Ei as HasDefault, En as ConvexAggregateIndexBuilder, Er as OrderDirection, Et as MigrationDirection, F as custom, Fn as ConvexVectorIndexBuilder, Fr as unsetToken, Ft as MigrationStateMap, G as ConvexBigIntBuilder, Gn as ConvexCheckConfig, Gr as ExpressionVisitor, Gt as OrmReader$1, H as ConvexBooleanBuilder, Hn as uniqueIndex, Hr as TableName, Ht as detectMigrationDrift, I as json, In as ConvexVectorIndexBuilderOn, Ir as Brand, It as MigrationStep, J as CountBackfillChunkArgs, Jn as ConvexUniqueConstraintBuilder, Jr as LogicalExpression, Jt as RlsMode, K as ConvexBigIntBuilderInitial, Kn as ConvexForeignKeyBuilder, Kr as FieldReference, Kt as OrmWriter$1, L as objectOf, Ln as ConvexVectorIndexConfig, Lr as Columns, Lt as MigrationTableName, M as ConvexCustomBuilder, Mn as ConvexSearchIndexBuilder, Mr as UpdateSet, Mt as MigrationPlan, N as ConvexCustomBuilderInitial, Nn as ConvexSearchIndexBuilderOn, Nr as VectorQueryConfig, Nt as MigrationRunStatus, O as ConvexDateBuilder, Oi as IsUnique, On as ConvexIndexBuilder, Or as PredicateWhereIndexConfig, Ot as MigrationDocContext, P as arrayOf, Pn as ConvexSearchIndexConfig, Pr as VectorSearchProvider, Pt as MigrationSet, Q as GenericOrm$1, Qn as foreignKey, Qr as contains, Qt as ExtractTablesWithRelations, R as unionOf, Rn as aggregateIndex, Rr as OrmSchemaExtensionTables, Rt as MigrationWriteMode, S as ConvexNumberBuilder, Si as ColumnBuilderTypeConfig, Sn as rlsPolicy, Sr as MutationResult, St as MigrationRunChunkArgs, T as ConvexIdBuilder, Ti as DrizzleEntity, Tn as rlsRole, Tr as OrderByClause, Tt as MigrationDefinition, U as ConvexBooleanBuilderInitial, Un as vectorIndex, Ur as SystemFields, Ut as DatabaseWithMutations, V as bytes, Vn as searchIndex, Vr as OrmSchemaTriggers, Vt as defineMigrationSet, W as boolean, Wn as ConvexCheckBuilder, Wr as BinaryExpression, Wt as DatabaseWithQuery, X as CountBackfillStatusArgs, Xn as ConvexUniqueConstraintConfig, Xr as and, Xt as extractRelationsConfig, Y as CountBackfillKickoffArgs, Yn as ConvexUniqueConstraintBuilderOn, Yr as UnaryExpression, Yt as EdgeMetadata, Z as CreateOrmOptions, Zn as check, Zr as between, Zt as ExtractTablesFromSchema, _ as ConvexTimestampMode, _i as startsWith, _n as deletion, _r as MutationExecuteConfig, _t as OrmTriggerContext, a as requireSchemaRelations, ai as inArray, an as TablesRelationalConfig, ar as AggregateResult, at as OrmWriterCtx, b as ConvexTextEnumBuilderInitial, bi as ColumnBuilderBaseConfig, bn as RlsPolicyConfig, br as MutationPaginateConfig, bt as MigrationCancelArgs, c as TableConfigResult, ci as isNull, cn as ConvexDeletionBuilder, cr as CountConfig, ct as ScheduledMutationBatchArgs, d as OrmNotFoundError, di as lte, dn as ConvexTableWithColumns, dr as FilterOperators, dt as scheduledDeleteFactory, ei as eq, en as OneConfig, er as ConvexTextBuilder, et as OrmApiResult, f as ConvexVectorBuilder, fi as ne, fn as DiscriminatorBuilderConfig, fr as GetColumnData, ft as SchemaExtension, g as ConvexTimestampBuilderInitial, gi as or, gn as convexTable, gr as InsertValue, gt as OrmTriggerChange, h as ConvexTimestampBuilder, hi as notInArray, hn as TableConfig, hr as InferSelectModel, ht as OrmTableTriggers, i as getSchemaTriggers, ii as ilike, in as TableRelationalConfig, ir as AggregateFieldValue, it as OrmReaderCtx, j as date, jn as ConvexRankIndexBuilderOn, jr as ReturningSelection, jt as MigrationMigrateOne, k as ConvexDateBuilderInitial, ki as NotNull, kn as ConvexIndexBuilderOn, kr as ReturningAll, kt as MigrationDriftIssue, l as getTableColumns, li as like, ln as ConvexDeletionConfig, lr as CountResult, lt as scheduledMutationBatchFactory, m as vector, mi as notBetween, mn as OrmLifecycleOperation, mr as InferModelFromColumns, mt as OrmBeforeResult, n as defineSchema, ni as gt, nn as RelationsBuilderColumnBase, nr as text, nt as OrmClientWithApi$1, o as asc, oi as isFieldReference, on as defineRelations, or as BuildQueryResult, ot as ResolveOrmSchema, p as ConvexVectorBuilderInitial, pi as not, pn as OrmLifecycleChange, pr as InferInsertModel, pt as defineSchemaExtension, q as bigint, qn as ConvexForeignKeyConfig, qr as FilterExpression, qt as RlsContext, r as getSchemaRelations, ri as gte, rn as RelationsBuilderColumnConfig, rr as AggregateConfig, rt as OrmFunctions, s as desc, si as isNotNull, sn as defineRelationsPart, sr as BuildRelationResult, st as createOrm, t as WhereClauseResult, ti as fieldRef, tn as RelationsBuilder, tr as ConvexTextBuilderInitial, tt as OrmClientBase$1, u as getTableConfig, ui as lt, un as ConvexTable, ur as DBQueryConfig, ut as ScheduledDeleteArgs, v as timestamp, vi as AnyColumn, vn as discriminator, vr as MutationExecuteResult, vt as OrmTriggers, w as integer, wi as ColumnDataType, wn as RlsRoleConfig, wr as MutationRunMode, wt as MigrationAppliedState, x as textEnum, xi as ColumnBuilderRuntimeConfig, xn as RlsPolicyToOption, xr as MutationPaginatedResult, xt as MigrationRunArgs, y as ConvexTextEnumBuilder, yi as ColumnBuilder, yn as RlsPolicy, yr as MutationExecutionMode, yt as defineTriggers, z as ConvexBytesBuilder, zn as index, zr as OrmSchemaExtensions, zt as buildMigrationPlan } from "../where-clause-compiler-DcEhkJ12.js";
|
|
2
2
|
import { i as pretendRequired, n as deprecated, r as pretend } from "../validators-BhsByJeg.js";
|
|
3
3
|
import { a as QueryCtxWithPreferredOrmQueryTable, i as QueryCtxWithOrmQueryTable, n as LookupByIdResultByCtx, o as getByIdWithOrmQueryFallback, r as QueryCtxWithOptionalOrmQueryTable, t as DocByCtx } from "../query-context-CNo9ffvI.js";
|
|
4
4
|
import { DefineSchemaOptions, GenericDatabaseReader, GenericDatabaseWriter, GenericSchema, SchemaDefinition } from "convex/server";
|
package/dist/watcher.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { Dt as generateMeta, F as resolveRunDeps, Ot as getConvexConfig, j as resolveConfiguredBackend, kt as logger, q as withLocalCodegenEnv } from "./backend-core-
|
|
2
|
+
import { Dt as generateMeta, F as resolveRunDeps, Ot as getConvexConfig, j as resolveConfiguredBackend, kt as logger, q as withLocalCodegenEnv } from "./backend-core-B091CyHN.mjs";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import { fileURLToPath } from "node:url";
|
|
5
5
|
|
|
@@ -3717,7 +3717,7 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
|
|
|
3717
3717
|
readonly aggregate_bucket: ConvexTableWithColumns<{
|
|
3718
3718
|
name: "aggregate_bucket";
|
|
3719
3719
|
columns: {
|
|
3720
|
-
|
|
3720
|
+
count: ConvexNumberBuilderInitial<""> & {
|
|
3721
3721
|
_: {
|
|
3722
3722
|
notNull: true;
|
|
3723
3723
|
};
|
|
@@ -3727,10 +3727,10 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
|
|
|
3727
3727
|
};
|
|
3728
3728
|
} & {
|
|
3729
3729
|
_: {
|
|
3730
|
-
fieldName: "
|
|
3730
|
+
fieldName: "count";
|
|
3731
3731
|
};
|
|
3732
3732
|
};
|
|
3733
|
-
|
|
3733
|
+
updatedAt: ConvexNumberBuilderInitial<""> & {
|
|
3734
3734
|
_: {
|
|
3735
3735
|
notNull: true;
|
|
3736
3736
|
};
|
|
@@ -3740,10 +3740,10 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
|
|
|
3740
3740
|
};
|
|
3741
3741
|
} & {
|
|
3742
3742
|
_: {
|
|
3743
|
-
fieldName: "
|
|
3743
|
+
fieldName: "updatedAt";
|
|
3744
3744
|
};
|
|
3745
3745
|
};
|
|
3746
|
-
|
|
3746
|
+
tableKey: ConvexTextBuilderInitial<""> & {
|
|
3747
3747
|
_: {
|
|
3748
3748
|
notNull: true;
|
|
3749
3749
|
};
|
|
@@ -3753,10 +3753,10 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
|
|
|
3753
3753
|
};
|
|
3754
3754
|
} & {
|
|
3755
3755
|
_: {
|
|
3756
|
-
fieldName: "
|
|
3756
|
+
fieldName: "tableKey";
|
|
3757
3757
|
};
|
|
3758
3758
|
};
|
|
3759
|
-
|
|
3759
|
+
indexName: ConvexTextBuilderInitial<""> & {
|
|
3760
3760
|
_: {
|
|
3761
3761
|
notNull: true;
|
|
3762
3762
|
};
|
|
@@ -3766,14 +3766,10 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
|
|
|
3766
3766
|
};
|
|
3767
3767
|
} & {
|
|
3768
3768
|
_: {
|
|
3769
|
-
fieldName: "
|
|
3769
|
+
fieldName: "indexName";
|
|
3770
3770
|
};
|
|
3771
3771
|
};
|
|
3772
|
-
|
|
3773
|
-
_: {
|
|
3774
|
-
$type: convex_values0.Value[];
|
|
3775
|
-
};
|
|
3776
|
-
} & {
|
|
3772
|
+
keyHash: ConvexTextBuilderInitial<""> & {
|
|
3777
3773
|
_: {
|
|
3778
3774
|
notNull: true;
|
|
3779
3775
|
};
|
|
@@ -3783,10 +3779,14 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
|
|
|
3783
3779
|
};
|
|
3784
3780
|
} & {
|
|
3785
3781
|
_: {
|
|
3786
|
-
fieldName: "
|
|
3782
|
+
fieldName: "keyHash";
|
|
3787
3783
|
};
|
|
3788
3784
|
};
|
|
3789
|
-
|
|
3785
|
+
keyParts: ConvexCustomBuilderInitial<"", convex_values0.VArray<any[], convex_values0.VId<any, any> | convex_values0.VString<any, any> | convex_values0.VFloat64<any, any> | convex_values0.VInt64<any, any> | convex_values0.VBoolean<any, any> | convex_values0.VNull<any, any> | convex_values0.VAny<any, any, string> | convex_values0.VLiteral<any, any> | convex_values0.VBytes<any, any> | convex_values0.VObject<any, Record<string, convex_values0.Validator<any, convex_values0.OptionalProperty, any>>, any, any> | convex_values0.VArray<any, convex_values0.Validator<any, "required", any>, any> | convex_values0.VRecord<any, convex_values0.Validator<string, "required", any>, convex_values0.Validator<any, "required", any>, any, any> | convex_values0.VUnion<any, convex_values0.Validator<any, "required", any>[], any, any>, "required">> & {
|
|
3786
|
+
_: {
|
|
3787
|
+
$type: convex_values0.Value[];
|
|
3788
|
+
};
|
|
3789
|
+
} & {
|
|
3790
3790
|
_: {
|
|
3791
3791
|
notNull: true;
|
|
3792
3792
|
};
|
|
@@ -3796,7 +3796,7 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
|
|
|
3796
3796
|
};
|
|
3797
3797
|
} & {
|
|
3798
3798
|
_: {
|
|
3799
|
-
fieldName: "
|
|
3799
|
+
fieldName: "keyParts";
|
|
3800
3800
|
};
|
|
3801
3801
|
};
|
|
3802
3802
|
sumValues: (NotNull<$Type<ConvexCustomBuilderInitial<"", convex_values0.VRecord<Record<string, any>, convex_values0.VString<string, "required">, convex_values0.VId<any, any> | convex_values0.VString<any, any> | convex_values0.VFloat64<any, any> | convex_values0.VInt64<any, any> | convex_values0.VBoolean<any, any> | convex_values0.VNull<any, any> | convex_values0.VAny<any, any, string> | convex_values0.VLiteral<any, any> | convex_values0.VBytes<any, any> | convex_values0.VObject<any, Record<string, convex_values0.Validator<any, convex_values0.OptionalProperty, any>>, any, any> | convex_values0.VArray<any, convex_values0.Validator<any, "required", any>, any> | convex_values0.VRecord<any, convex_values0.Validator<string, "required", any>, convex_values0.Validator<any, "required", any>, any, any> | convex_values0.VUnion<any, convex_values0.Validator<any, "required", any>[], any, any>, "required", string>>, Record<string, number>>> | NotNull<$Type<ConvexCustomBuilderInitial<"", convex_values0.VId<any, any> | convex_values0.VString<any, any> | convex_values0.VFloat64<any, any> | convex_values0.VInt64<any, any> | convex_values0.VBoolean<any, any> | convex_values0.VNull<any, any> | convex_values0.VAny<any, any, string> | convex_values0.VLiteral<any, any> | convex_values0.VBytes<any, any> | convex_values0.VObject<any, Record<string, convex_values0.Validator<any, convex_values0.OptionalProperty, any>>, any, any> | convex_values0.VArray<any, convex_values0.Validator<any, "required", any>, any> | convex_values0.VRecord<any, convex_values0.Validator<string, "required", any>, convex_values0.Validator<any, "required", any>, any, any> | convex_values0.VUnion<any, convex_values0.Validator<any, "required", any>[], any, any>>, Record<string, number>>>) & {
|
|
@@ -3839,7 +3839,7 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
|
|
|
3839
3839
|
fieldName: "kind";
|
|
3840
3840
|
};
|
|
3841
3841
|
};
|
|
3842
|
-
|
|
3842
|
+
updatedAt: ConvexNumberBuilderInitial<""> & {
|
|
3843
3843
|
_: {
|
|
3844
3844
|
notNull: true;
|
|
3845
3845
|
};
|
|
@@ -3849,10 +3849,10 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
|
|
|
3849
3849
|
};
|
|
3850
3850
|
} & {
|
|
3851
3851
|
_: {
|
|
3852
|
-
fieldName: "
|
|
3852
|
+
fieldName: "updatedAt";
|
|
3853
3853
|
};
|
|
3854
3854
|
};
|
|
3855
|
-
|
|
3855
|
+
tableKey: ConvexTextBuilderInitial<""> & {
|
|
3856
3856
|
_: {
|
|
3857
3857
|
notNull: true;
|
|
3858
3858
|
};
|
|
@@ -3862,10 +3862,10 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
|
|
|
3862
3862
|
};
|
|
3863
3863
|
} & {
|
|
3864
3864
|
_: {
|
|
3865
|
-
fieldName: "
|
|
3865
|
+
fieldName: "tableKey";
|
|
3866
3866
|
};
|
|
3867
3867
|
};
|
|
3868
|
-
|
|
3868
|
+
indexName: ConvexTextBuilderInitial<""> & {
|
|
3869
3869
|
_: {
|
|
3870
3870
|
notNull: true;
|
|
3871
3871
|
};
|
|
@@ -3875,7 +3875,7 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
|
|
|
3875
3875
|
};
|
|
3876
3876
|
} & {
|
|
3877
3877
|
_: {
|
|
3878
|
-
fieldName: "
|
|
3878
|
+
fieldName: "indexName";
|
|
3879
3879
|
};
|
|
3880
3880
|
};
|
|
3881
3881
|
keyHash: ConvexTextBuilderInitial<""> & {
|
|
@@ -4009,7 +4009,7 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
|
|
|
4009
4009
|
fieldName: "value";
|
|
4010
4010
|
};
|
|
4011
4011
|
};
|
|
4012
|
-
|
|
4012
|
+
count: ConvexNumberBuilderInitial<""> & {
|
|
4013
4013
|
_: {
|
|
4014
4014
|
notNull: true;
|
|
4015
4015
|
};
|
|
@@ -4019,10 +4019,10 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
|
|
|
4019
4019
|
};
|
|
4020
4020
|
} & {
|
|
4021
4021
|
_: {
|
|
4022
|
-
fieldName: "
|
|
4022
|
+
fieldName: "count";
|
|
4023
4023
|
};
|
|
4024
4024
|
};
|
|
4025
|
-
|
|
4025
|
+
updatedAt: ConvexNumberBuilderInitial<""> & {
|
|
4026
4026
|
_: {
|
|
4027
4027
|
notNull: true;
|
|
4028
4028
|
};
|
|
@@ -4032,10 +4032,10 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
|
|
|
4032
4032
|
};
|
|
4033
4033
|
} & {
|
|
4034
4034
|
_: {
|
|
4035
|
-
fieldName: "
|
|
4035
|
+
fieldName: "updatedAt";
|
|
4036
4036
|
};
|
|
4037
4037
|
};
|
|
4038
|
-
|
|
4038
|
+
tableKey: ConvexTextBuilderInitial<""> & {
|
|
4039
4039
|
_: {
|
|
4040
4040
|
notNull: true;
|
|
4041
4041
|
};
|
|
@@ -4045,10 +4045,10 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
|
|
|
4045
4045
|
};
|
|
4046
4046
|
} & {
|
|
4047
4047
|
_: {
|
|
4048
|
-
fieldName: "
|
|
4048
|
+
fieldName: "tableKey";
|
|
4049
4049
|
};
|
|
4050
4050
|
};
|
|
4051
|
-
|
|
4051
|
+
indexName: ConvexTextBuilderInitial<""> & {
|
|
4052
4052
|
_: {
|
|
4053
4053
|
notNull: true;
|
|
4054
4054
|
};
|
|
@@ -4058,10 +4058,10 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
|
|
|
4058
4058
|
};
|
|
4059
4059
|
} & {
|
|
4060
4060
|
_: {
|
|
4061
|
-
fieldName: "
|
|
4061
|
+
fieldName: "indexName";
|
|
4062
4062
|
};
|
|
4063
4063
|
};
|
|
4064
|
-
|
|
4064
|
+
keyHash: ConvexTextBuilderInitial<""> & {
|
|
4065
4065
|
_: {
|
|
4066
4066
|
notNull: true;
|
|
4067
4067
|
};
|
|
@@ -4071,7 +4071,7 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
|
|
|
4071
4071
|
};
|
|
4072
4072
|
} & {
|
|
4073
4073
|
_: {
|
|
4074
|
-
fieldName: "
|
|
4074
|
+
fieldName: "keyHash";
|
|
4075
4075
|
};
|
|
4076
4076
|
};
|
|
4077
4077
|
fieldName: ConvexTextBuilderInitial<""> & {
|
|
@@ -4279,6 +4279,19 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
|
|
|
4279
4279
|
fieldName: "cursor";
|
|
4280
4280
|
};
|
|
4281
4281
|
};
|
|
4282
|
+
updatedAt: ConvexNumberBuilderInitial<""> & {
|
|
4283
|
+
_: {
|
|
4284
|
+
notNull: true;
|
|
4285
|
+
};
|
|
4286
|
+
} & {
|
|
4287
|
+
_: {
|
|
4288
|
+
tableName: "aggregate_state";
|
|
4289
|
+
};
|
|
4290
|
+
} & {
|
|
4291
|
+
_: {
|
|
4292
|
+
fieldName: "updatedAt";
|
|
4293
|
+
};
|
|
4294
|
+
};
|
|
4282
4295
|
tableKey: ConvexTextBuilderInitial<""> & {
|
|
4283
4296
|
_: {
|
|
4284
4297
|
notNull: true;
|
|
@@ -4357,19 +4370,6 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
|
|
|
4357
4370
|
fieldName: "startedAt";
|
|
4358
4371
|
};
|
|
4359
4372
|
};
|
|
4360
|
-
updatedAt: ConvexNumberBuilderInitial<""> & {
|
|
4361
|
-
_: {
|
|
4362
|
-
notNull: true;
|
|
4363
|
-
};
|
|
4364
|
-
} & {
|
|
4365
|
-
_: {
|
|
4366
|
-
tableName: "aggregate_state";
|
|
4367
|
-
};
|
|
4368
|
-
} & {
|
|
4369
|
-
_: {
|
|
4370
|
-
fieldName: "updatedAt";
|
|
4371
|
-
};
|
|
4372
|
-
};
|
|
4373
4373
|
completedAt: ConvexNumberBuilderInitial<""> & {
|
|
4374
4374
|
_: {
|
|
4375
4375
|
tableName: "aggregate_state";
|
|
@@ -4429,7 +4429,7 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
|
|
|
4429
4429
|
fieldName: "direction";
|
|
4430
4430
|
};
|
|
4431
4431
|
};
|
|
4432
|
-
|
|
4432
|
+
updatedAt: ConvexNumberBuilderInitial<""> & {
|
|
4433
4433
|
_: {
|
|
4434
4434
|
notNull: true;
|
|
4435
4435
|
};
|
|
@@ -4439,29 +4439,29 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
|
|
|
4439
4439
|
};
|
|
4440
4440
|
} & {
|
|
4441
4441
|
_: {
|
|
4442
|
-
fieldName: "
|
|
4442
|
+
fieldName: "updatedAt";
|
|
4443
4443
|
};
|
|
4444
4444
|
};
|
|
4445
|
-
|
|
4445
|
+
processed: ConvexNumberBuilderInitial<""> & {
|
|
4446
4446
|
_: {
|
|
4447
|
-
|
|
4447
|
+
notNull: true;
|
|
4448
4448
|
};
|
|
4449
4449
|
} & {
|
|
4450
4450
|
_: {
|
|
4451
|
-
|
|
4451
|
+
tableName: "migration_state";
|
|
4452
4452
|
};
|
|
4453
|
-
}
|
|
4454
|
-
updatedAt: ConvexNumberBuilderInitial<""> & {
|
|
4453
|
+
} & {
|
|
4455
4454
|
_: {
|
|
4456
|
-
|
|
4455
|
+
fieldName: "processed";
|
|
4457
4456
|
};
|
|
4458
|
-
}
|
|
4457
|
+
};
|
|
4458
|
+
startedAt: ConvexNumberBuilderInitial<""> & {
|
|
4459
4459
|
_: {
|
|
4460
4460
|
tableName: "migration_state";
|
|
4461
4461
|
};
|
|
4462
4462
|
} & {
|
|
4463
4463
|
_: {
|
|
4464
|
-
fieldName: "
|
|
4464
|
+
fieldName: "startedAt";
|
|
4465
4465
|
};
|
|
4466
4466
|
};
|
|
4467
4467
|
completedAt: ConvexNumberBuilderInitial<""> & {
|
|
@@ -4578,7 +4578,7 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
|
|
|
4578
4578
|
fieldName: "direction";
|
|
4579
4579
|
};
|
|
4580
4580
|
};
|
|
4581
|
-
|
|
4581
|
+
updatedAt: ConvexNumberBuilderInitial<""> & {
|
|
4582
4582
|
_: {
|
|
4583
4583
|
notNull: true;
|
|
4584
4584
|
};
|
|
@@ -4588,10 +4588,10 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
|
|
|
4588
4588
|
};
|
|
4589
4589
|
} & {
|
|
4590
4590
|
_: {
|
|
4591
|
-
fieldName: "
|
|
4591
|
+
fieldName: "updatedAt";
|
|
4592
4592
|
};
|
|
4593
4593
|
};
|
|
4594
|
-
|
|
4594
|
+
startedAt: ConvexNumberBuilderInitial<""> & {
|
|
4595
4595
|
_: {
|
|
4596
4596
|
notNull: true;
|
|
4597
4597
|
};
|
|
@@ -4601,7 +4601,7 @@ declare const BUILTIN_SCHEMA_EXTENSIONS: readonly [SchemaExtension<{
|
|
|
4601
4601
|
};
|
|
4602
4602
|
} & {
|
|
4603
4603
|
_: {
|
|
4604
|
-
fieldName: "
|
|
4604
|
+
fieldName: "startedAt";
|
|
4605
4605
|
};
|
|
4606
4606
|
};
|
|
4607
4607
|
completedAt: ConvexNumberBuilderInitial<""> & {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "kitcn",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.15.1",
|
|
4
4
|
"description": "kitcn - React Query integration and CLI tools for Convex",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"convex",
|
|
@@ -90,7 +90,7 @@
|
|
|
90
90
|
"@tanstack/react-query": ">=5",
|
|
91
91
|
"@tanstack/solid-query": ">=5",
|
|
92
92
|
"better-auth": "1.6.9",
|
|
93
|
-
"convex": ">=1.
|
|
93
|
+
"convex": ">=1.38",
|
|
94
94
|
"hono": "4.12.9",
|
|
95
95
|
"next": ">=14",
|
|
96
96
|
"react": ">=18",
|
|
@@ -370,10 +370,8 @@ Create `convex/lib/plugins/ratelimit/plugin.ts` and call `ratelimit.middleware()
|
|
|
370
370
|
Use `RatelimitPlugin` from `kitcn/ratelimit`:
|
|
371
371
|
|
|
372
372
|
```ts
|
|
373
|
-
import { getSessionNetworkSignals } from "kitcn/auth";
|
|
374
373
|
import { MINUTE, Ratelimit, RatelimitPlugin } from "kitcn/ratelimit";
|
|
375
374
|
import type { MutationCtx } from "../../../functions/generated/server";
|
|
376
|
-
import type { Select } from "../../../shared/api";
|
|
377
375
|
|
|
378
376
|
const fixed = (rate: number) => Ratelimit.fixedWindow(rate, MINUTE);
|
|
379
377
|
|
|
@@ -392,7 +390,6 @@ type RatelimitUser = {
|
|
|
392
390
|
id: string;
|
|
393
391
|
isAdmin?: boolean;
|
|
394
392
|
plan?: "premium" | "team" | null;
|
|
395
|
-
session?: Select<"session"> | null;
|
|
396
393
|
};
|
|
397
394
|
|
|
398
395
|
type RatelimitCtx = MutationCtx & {
|
|
@@ -409,6 +406,15 @@ export function getUserTier(user: RatelimitUser | null): RatelimitTier {
|
|
|
409
406
|
return "free";
|
|
410
407
|
}
|
|
411
408
|
|
|
409
|
+
async function getRequestSignals(ctx: RatelimitCtx) {
|
|
410
|
+
const { ip, userAgent } = await ctx.meta.getRequestMetadata();
|
|
411
|
+
|
|
412
|
+
return {
|
|
413
|
+
...(ip ? { ip } : {}),
|
|
414
|
+
...(userAgent ? { userAgent } : {}),
|
|
415
|
+
};
|
|
416
|
+
}
|
|
417
|
+
|
|
412
418
|
export const ratelimit = RatelimitPlugin.configure({
|
|
413
419
|
buckets: ratelimitBuckets,
|
|
414
420
|
getBucket: ({ meta }: { meta: RatelimitMeta }) => meta.ratelimit ?? "default",
|
|
@@ -416,13 +422,7 @@ export const ratelimit = RatelimitPlugin.configure({
|
|
|
416
422
|
getIdentifier: ({ user }: { user: RatelimitUser | null }) =>
|
|
417
423
|
user?.id ?? "anonymous",
|
|
418
424
|
getTier: getUserTier,
|
|
419
|
-
getSignals: ({
|
|
420
|
-
ctx,
|
|
421
|
-
user,
|
|
422
|
-
}: {
|
|
423
|
-
ctx: RatelimitCtx;
|
|
424
|
-
user: RatelimitUser | null;
|
|
425
|
-
}) => getSessionNetworkSignals(ctx, user?.session ?? null),
|
|
425
|
+
getSignals: ({ ctx }: { ctx: RatelimitCtx }) => getRequestSignals(ctx),
|
|
426
426
|
prefix: ({ bucket, tier }) => `ratelimit:${bucket}:${tier}`,
|
|
427
427
|
failureMode: "closed",
|
|
428
428
|
enableProtection: true,
|
|
@@ -430,6 +430,8 @@ export const ratelimit = RatelimitPlugin.configure({
|
|
|
430
430
|
});
|
|
431
431
|
```
|
|
432
432
|
|
|
433
|
+
Use `ctx.meta.getRequestMetadata()` on Convex 1.38.0+ for IP/user-agent signals in mutation rate limits. Convex also exposes this metadata in actions; route action-side enforcement through a mutation when database-backed ratelimit state is required.
|
|
434
|
+
|
|
433
435
|
### 9.5 Scheduling gate
|
|
434
436
|
|
|
435
437
|
Create `convex/functions/crons.ts` with `cronJobs()` and use `caller.schedule.now/after/at` in mutations/actions for delayed procedure jobs (`ctx.scheduler.*` only for raw `internal.*` functions).
|
|
@@ -48,6 +48,40 @@ export const {
|
|
|
48
48
|
});
|
|
49
49
|
```
|
|
50
50
|
|
|
51
|
+
For client-side route loaders that fetch protected Convex queries through the
|
|
52
|
+
router `queryClient`, prime the shared Convex client in the root `beforeLoad`
|
|
53
|
+
before child loaders run:
|
|
54
|
+
|
|
55
|
+
```tsx
|
|
56
|
+
import type { QueryClient } from "@tanstack/react-query";
|
|
57
|
+
import { createRootRouteWithContext } from "@tanstack/react-router";
|
|
58
|
+
import { createServerFn } from "@tanstack/react-start";
|
|
59
|
+
import { syncConvexAuthForStartLoader } from "kitcn/auth/start";
|
|
60
|
+
import type { ConvexQueryClient } from "kitcn/react";
|
|
61
|
+
|
|
62
|
+
import { getToken } from "@/lib/convex/auth-server";
|
|
63
|
+
|
|
64
|
+
const getLoaderToken = createServerFn({ method: "GET" }).handler(async () => {
|
|
65
|
+
return await getToken();
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
export const Route = createRootRouteWithContext<{
|
|
69
|
+
convexQueryClient: ConvexQueryClient;
|
|
70
|
+
queryClient: QueryClient;
|
|
71
|
+
}>()({
|
|
72
|
+
beforeLoad: async ({ context }) => {
|
|
73
|
+
return await syncConvexAuthForStartLoader({
|
|
74
|
+
convex: context.convexQueryClient,
|
|
75
|
+
getToken: getLoaderToken,
|
|
76
|
+
});
|
|
77
|
+
},
|
|
78
|
+
});
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
Use `runServerCall` or `fetchAuthQuery` for server-side loaders. Use
|
|
82
|
+
`syncConvexAuthForStartLoader` only for client/router loaders that execute
|
|
83
|
+
shared `ConvexQueryClient` queries before `ConvexAuthProvider` mounts.
|
|
84
|
+
|
|
51
85
|
### 8.B.2 Auth API endpoint
|
|
52
86
|
|
|
53
87
|
**Create:** `src/routes/api/auth/$.ts`
|