kitcn 0.15.13 → 0.15.15

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.
@@ -5,11 +5,12 @@ import { ReactNode } from "react";
5
5
  import * as react_jsx_runtime0 from "react/jsx-runtime";
6
6
  import { AuthConfig } from "convex/server";
7
7
  import * as better_auth0 from "better-auth";
8
- import { BetterAuthClientPlugin, Session, User } from "better-auth";
8
+ import { Session, User } from "better-auth";
9
9
  import * as better_auth_api0 from "better-auth/api";
10
10
  import * as better_auth_plugins_oidc_provider0 from "better-auth/plugins/oidc-provider";
11
11
  import * as jose from "jose";
12
12
  import { BetterAuthOptions } from "better-auth/minimal";
13
+ import { BetterAuthClientPlugin } from "better-auth/client";
13
14
  import { createAuthClient } from "better-auth/react";
14
15
 
15
16
  //#region src/auth/internal/convex-plugin.d.ts
@@ -294,8 +295,11 @@ declare const convexClient: () => {
294
295
  };
295
296
  //#endregion
296
297
  //#region src/auth-client/types.d.ts
298
+ type OpaqueClientPlugin = Omit<BetterAuthClientPlugin, '$InferServerPlugin'> & {
299
+ $InferServerPlugin?: never;
300
+ };
297
301
  type ConvexClient = ReturnType<typeof convexClient>;
298
- type CrossDomainClient = BetterAuthClientPlugin & {
302
+ type CrossDomainClient = OpaqueClientPlugin & {
299
303
  id: 'cross-domain';
300
304
  getActions: (...args: never[]) => {
301
305
  crossDomain: {
@@ -307,8 +311,8 @@ type CrossDomainClient = BetterAuthClientPlugin & {
307
311
  notifySessionSignal: () => void;
308
312
  };
309
313
  };
310
- type PluginsWithCrossDomain = (CrossDomainClient | ConvexClient | BetterAuthClientPlugin)[];
311
- type PluginsWithoutCrossDomain = (ConvexClient | BetterAuthClientPlugin)[];
314
+ type PluginsWithCrossDomain = (CrossDomainClient | ConvexClient | OpaqueClientPlugin)[];
315
+ type PluginsWithoutCrossDomain = (ConvexClient | OpaqueClientPlugin)[];
312
316
  type AuthSessionState = {
313
317
  data: unknown;
314
318
  error?: unknown;
@@ -346,7 +350,7 @@ type ConvexAuthProviderClient = {
346
350
  updateSession?: (...args: never[]) => unknown;
347
351
  useSession: () => AuthSessionState;
348
352
  } & Record<string, unknown>;
349
- type AuthClientWithPlugins<Plugins extends PluginsWithCrossDomain | PluginsWithoutCrossDomain> = ReturnType<typeof createAuthClient<{
353
+ type AuthClientWithPlugins<Plugins extends BetterAuthClientPlugin[]> = ReturnType<typeof createAuthClient<{
350
354
  plugins: Plugins;
351
355
  }>>;
352
356
  type AuthClient = AuthClientWithPlugins<PluginsWithCrossDomain> | AuthClientWithPlugins<PluginsWithoutCrossDomain>;
@@ -63,7 +63,7 @@ declare const adapterConfig: {
63
63
  data: any;
64
64
  fieldAttributes: better_auth0.DBFieldAttribute;
65
65
  field: string;
66
- action: "create" | "update" | "findOne" | "findMany" | "updateMany" | "delete" | "deleteMany" | "consumeOne" | "count";
66
+ action: "create" | "update" | "findOne" | "findMany" | "updateMany" | "delete" | "deleteMany" | "consumeOne" | "incrementOne" | "count";
67
67
  model: string;
68
68
  schema: BetterAuthDBSchema;
69
69
  options: BetterAuthOptions;
@@ -6234,8 +6234,9 @@ const EXACT_VERSION_RE = /^(\d+)\.(\d+)\.\d+$/;
6234
6234
  const VERSION_IN_SPEC_RE = /(\d+)\.(\d+)(?:\.\d+)?/;
6235
6235
  const PLAIN_VERSION_SPEC_RE = /^[\^~]?v?\d+\.\d+(?:\.\d+)?$/;
6236
6236
  const UPPER_BOUND_RE = /(?:^|\s)<={0,1}\s*v?(\d+)\.(\d+)(?:\.\d+)?/g;
6237
+ const SUPPORTED_CONCAVE_CLI_VERSION = "0.0.1-alpha.14";
6237
6238
  const SUPPORTED_CONVEX_VERSION = "1.38.0";
6238
- const SUPPORTED_BETTER_AUTH_VERSION = "1.6.15";
6239
+ const SUPPORTED_BETTER_AUTH_VERSION = "1.6.18";
6239
6240
  const SUPPORTED_BETTER_AUTH_MIN_VERSION = "1.6.11";
6240
6241
  const SUPPORTED_HONO_VERSION = "4.12.9";
6241
6242
  const SUPPORTED_OPENTELEMETRY_API_VERSION = "1.9.0";
@@ -6312,6 +6313,7 @@ const SUPPORTED_DEPENDENCY_VERSIONS = {
6312
6313
  exact: SUPPORTED_BETTER_AUTH_VERSION,
6313
6314
  peer: getMinorVersionPeerRange(SUPPORTED_BETTER_AUTH_MIN_VERSION, SUPPORTED_BETTER_AUTH_VERSION)
6314
6315
  },
6316
+ concaveCli: { exact: SUPPORTED_CONCAVE_CLI_VERSION },
6315
6317
  hono: { exact: SUPPORTED_HONO_VERSION },
6316
6318
  opentelemetryApi: { exact: SUPPORTED_OPENTELEMETRY_API_VERSION },
6317
6319
  tanstackReactQuery: { exact: SUPPORTED_TANSTACK_REACT_QUERY_VERSION },
@@ -10243,7 +10245,7 @@ const AUTH_ENV_FIELDS = [
10243
10245
  schema: "z.string().optional()"
10244
10246
  }
10245
10247
  ];
10246
- const BETTER_AUTH_EXPO_INSTALL_SPEC = "@better-auth/expo@1.6.15";
10248
+ const BETTER_AUTH_EXPO_INSTALL_SPEC = "@better-auth/expo@1.6.18";
10247
10249
  const EXPO_SECURE_STORE_INSTALL_SPEC = "expo-secure-store@~55.0.8";
10248
10250
  const EXPO_NETWORK_INSTALL_SPEC = "expo-network@~55.0.8";
10249
10251
  const AUTH_FILES = [
@@ -12710,7 +12712,7 @@ const INIT_EXPO_PACKAGE_JSON_DEPENDENCIES = {
12710
12712
  const INIT_EXPO_PACKAGE_JSON_DEV_DEPENDENCIES = { "@types/bun": "latest" };
12711
12713
  const getInitExpoPackageJsonDevDependencies = (options) => ({
12712
12714
  ...INIT_EXPO_PACKAGE_JSON_DEV_DEPENDENCIES,
12713
- ...options.backend === "concave" ? { "@concavejs/cli": "latest" } : {}
12715
+ ...options.backend === "concave" ? { "@concavejs/cli": SUPPORTED_DEPENDENCY_VERSIONS.concaveCli.exact } : {}
12714
12716
  });
12715
12717
  function renderInitExpoPackageJsonTemplate(source, options = {}) {
12716
12718
  const existing = source ? JSON.parse(source) : {};
@@ -12989,7 +12991,7 @@ const INIT_NEXT_PACKAGE_JSON_DEPENDENCIES = {
12989
12991
  const INIT_NEXT_PACKAGE_JSON_DEV_DEPENDENCIES = { "@types/bun": "latest" };
12990
12992
  const getInitNextPackageJsonDevDependencies = (options) => ({
12991
12993
  ...INIT_NEXT_PACKAGE_JSON_DEV_DEPENDENCIES,
12992
- ...options.backend === "concave" ? { "@concavejs/cli": "latest" } : {}
12994
+ ...options.backend === "concave" ? { "@concavejs/cli": SUPPORTED_DEPENDENCY_VERSIONS.concaveCli.exact } : {}
12993
12995
  });
12994
12996
  function renderInitNextPackageJsonTemplate(source, options = {}) {
12995
12997
  const existing = source ? JSON.parse(source) : {};
@@ -13201,7 +13203,7 @@ const INIT_REACT_PACKAGE_JSON_DEPENDENCIES = {
13201
13203
  const INIT_REACT_PACKAGE_JSON_DEV_DEPENDENCIES = { "@types/bun": "latest" };
13202
13204
  const getInitReactPackageJsonDevDependencies = (options) => ({
13203
13205
  ...INIT_REACT_PACKAGE_JSON_DEV_DEPENDENCIES,
13204
- ...options.backend === "concave" ? { "@concavejs/cli": "latest" } : {}
13206
+ ...options.backend === "concave" ? { "@concavejs/cli": SUPPORTED_DEPENDENCY_VERSIONS.concaveCli.exact } : {}
13205
13207
  });
13206
13208
  function renderInitReactPackageJsonTemplate(source, options = {}) {
13207
13209
  const existing = source ? JSON.parse(source) : {};
@@ -15856,9 +15858,16 @@ function resolveCodegenTrimSegments(config) {
15856
15858
  function resolveConfiguredBackend(params) {
15857
15859
  return params.backendArg ?? params.config?.backend ?? "convex";
15858
15860
  }
15861
+ function findConcavePkgPath() {
15862
+ for (const searchPath of require.resolve.paths("@concavejs/cli") ?? []) {
15863
+ const candidate = join(searchPath, "@concavejs", "cli", "package.json");
15864
+ if (fs.existsSync(candidate)) return candidate;
15865
+ }
15866
+ throw new Error("Cannot find module '@concavejs/cli'.");
15867
+ }
15859
15868
  function resolveInstalledConcaveCliPath() {
15860
15869
  try {
15861
- const concavePkgPath = require.resolve("@concavejs/cli/package.json");
15870
+ const concavePkgPath = findConcavePkgPath();
15862
15871
  const concavePkg = JSON.parse(fs.readFileSync(concavePkgPath, "utf8"));
15863
15872
  const binRelative = typeof concavePkg.bin === "string" ? concavePkg.bin : concavePkg.bin?.concave;
15864
15873
  if (!binRelative) throw new Error("Missing concave binary entry.");
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-D5P0hNYD.mjs";
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-qvNnNFFS.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.js CHANGED
@@ -3145,6 +3145,23 @@ const requiresMetricBackfill = (existingMetricDefinitionHash, targetMetricDefini
3145
3145
  };
3146
3146
  return hasMissing(targetStorage.sumFields, existingStorage.sumFields) || hasMissing(targetStorage.nonNullCountFields, existingStorage.nonNullCountFields) || hasMissing(targetStorage.extremaFields, existingStorage.extremaFields);
3147
3147
  };
3148
+ const listDistinctIndexTuples = async (db, tableName, indexName, fields) => {
3149
+ const tuples = [];
3150
+ let current = await db.query(tableName).withIndex(indexName).first();
3151
+ while (current) {
3152
+ const row = current;
3153
+ const tuple = {};
3154
+ for (const field of fields) tuple[field] = row[field];
3155
+ tuples.push(tuple);
3156
+ current = null;
3157
+ for (let depth = fields.length - 1; depth >= 0 && !current; depth -= 1) current = await db.query(tableName).withIndex(indexName, (q) => {
3158
+ let range = q;
3159
+ for (let i = 0; i < depth; i += 1) range = range.eq(fields[i], tuple[fields[i]]);
3160
+ return range.gt(fields[depth], tuple[fields[depth]]);
3161
+ }).first();
3162
+ }
3163
+ return tuples;
3164
+ };
3148
3165
  function createCountBackfillHandlers(schema, getChunkRef) {
3149
3166
  const serializeKey = (kind, tableName, indexName) => `${kind}\u0000${tableName}\u0000${indexName}`;
3150
3167
  const pruneRemovedState = async (ctx, args, targets) => {
@@ -3152,9 +3169,13 @@ function createCountBackfillHandlers(schema, getChunkRef) {
3152
3169
  const states = await ctx.db.query(AGGREGATE_STATE_TABLE).collect();
3153
3170
  const stateByKey = new Map(states.map((state) => [serializeKey(state.kind === AGGREGATE_STATE_KIND_RANK ? "rank" : "metric", state.tableKey, state.indexName), state]));
3154
3171
  const [bucketRows, memberRows, extremaRows] = await Promise.all([
3155
- ctx.db.query(AGGREGATE_BUCKET_TABLE).collect(),
3156
- ctx.db.query(AGGREGATE_MEMBER_TABLE).collect(),
3157
- ctx.db.query(AGGREGATE_EXTREMA_TABLE).collect()
3172
+ listDistinctIndexTuples(ctx.db, AGGREGATE_BUCKET_TABLE, "by_table_index", ["tableKey", "indexName"]),
3173
+ listDistinctIndexTuples(ctx.db, AGGREGATE_MEMBER_TABLE, "by_kind_table_index", [
3174
+ "kind",
3175
+ "tableKey",
3176
+ "indexName"
3177
+ ]),
3178
+ listDistinctIndexTuples(ctx.db, AGGREGATE_EXTREMA_TABLE, "by_table_index", ["tableKey", "indexName"])
3158
3179
  ]);
3159
3180
  const existingKeys = /* @__PURE__ */ new Set();
3160
3181
  for (const state of states) existingKeys.add(serializeKey(state.kind === AGGREGATE_STATE_KIND_RANK ? "rank" : "metric", state.tableKey, state.indexName));
@@ -4,9 +4,10 @@ import { JSX, ParentProps } from "solid-js";
4
4
  import { DefaultError, QueryCache, QueryClient, QueryFilters, QueryFunction, QueryFunctionContext, QueryKey, SkipToken, SolidMutationOptions, SolidQueryOptions } from "@tanstack/solid-query";
5
5
  import { AuthTokenFetcher, ConvexClient, ConvexHttpClient } from "convex/browser";
6
6
  import { z } from "zod";
7
- import * as better_auth0 from "better-auth";
8
- import { BetterAuthClientPlugin, Session, User } from "better-auth";
7
+ import { BetterAuthClientPlugin } from "better-auth/client";
9
8
  import { createAuthClient } from "better-auth/solid";
9
+ import * as better_auth0 from "better-auth";
10
+ import { Session, User } from "better-auth";
10
11
  import * as better_auth_api0 from "better-auth/api";
11
12
  import * as better_auth_plugins_oidc_provider0 from "better-auth/plugins/oidc-provider";
12
13
  import * as jose from "jose";
@@ -1186,8 +1187,11 @@ declare const convexClient: () => {
1186
1187
  };
1187
1188
  //#endregion
1188
1189
  //#region src/solid/types.d.ts
1190
+ type OpaqueClientPlugin = Omit<BetterAuthClientPlugin, '$InferServerPlugin'> & {
1191
+ $InferServerPlugin?: never;
1192
+ };
1189
1193
  type ConvexClient$1 = ReturnType<typeof convexClient>;
1190
- type CrossDomainClient = BetterAuthClientPlugin & {
1194
+ type CrossDomainClient = OpaqueClientPlugin & {
1191
1195
  id: 'cross-domain';
1192
1196
  getActions: (...args: never[]) => {
1193
1197
  crossDomain: {
@@ -1199,8 +1203,8 @@ type CrossDomainClient = BetterAuthClientPlugin & {
1199
1203
  notifySessionSignal: () => void;
1200
1204
  };
1201
1205
  };
1202
- type PluginsWithCrossDomain = (CrossDomainClient | ConvexClient$1 | BetterAuthClientPlugin)[];
1203
- type PluginsWithoutCrossDomain = (ConvexClient$1 | BetterAuthClientPlugin)[];
1206
+ type PluginsWithCrossDomain = (CrossDomainClient | ConvexClient$1 | OpaqueClientPlugin)[];
1207
+ type PluginsWithoutCrossDomain = (ConvexClient$1 | OpaqueClientPlugin)[];
1204
1208
  type SolidAuthSessionState = {
1205
1209
  data: unknown;
1206
1210
  error?: unknown;
@@ -1232,7 +1236,7 @@ type SolidAuthProviderClient = {
1232
1236
  updateSession?: (...args: never[]) => unknown;
1233
1237
  useSession: () => () => SolidAuthSessionState;
1234
1238
  } & Record<string, unknown>;
1235
- type AuthClientWithPlugins<Plugins extends PluginsWithCrossDomain | PluginsWithoutCrossDomain> = ReturnType<typeof createAuthClient<{
1239
+ type AuthClientWithPlugins<Plugins extends BetterAuthClientPlugin[]> = ReturnType<typeof createAuthClient<{
1236
1240
  plugins: Plugins;
1237
1241
  }>>;
1238
1242
  type SolidAuthClient = AuthClientWithPlugins<PluginsWithCrossDomain> | AuthClientWithPlugins<PluginsWithoutCrossDomain>;
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-D5P0hNYD.mjs";
2
+ import { Dt as generateMeta, F as resolveRunDeps, Ot as getConvexConfig, j as resolveConfiguredBackend, kt as logger, q as withLocalCodegenEnv } from "./backend-core-qvNnNFFS.mjs";
3
3
  import path from "node:path";
4
4
  import { fileURLToPath } from "node:url";
5
5
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kitcn",
3
- "version": "0.15.13",
3
+ "version": "0.15.15",
4
4
  "description": "kitcn - React Query integration and CLI tools for Convex",
5
5
  "keywords": [
6
6
  "convex",