kitcn 0.15.12 → 0.15.13

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.
@@ -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" | "count";
66
+ action: "create" | "update" | "findOne" | "findMany" | "updateMany" | "delete" | "deleteMany" | "consumeOne" | "count";
67
67
  model: string;
68
68
  schema: BetterAuthDBSchema;
69
69
  options: BetterAuthOptions;
@@ -988,7 +988,8 @@ const httpAdapter = (ctx, { authFunctions, debugLogs, schema }) => {
988
988
  },
989
989
  update: async (data) => {
990
990
  if (!("runMutation" in ctx)) throw new Error("ctx is not a mutation ctx");
991
- if (data.where?.length && data.where.every((w) => (w.operator === "eq" || w.operator === void 0) && w.connector !== "OR")) {
991
+ if (!data.where?.length) return null;
992
+ if (data.where.every((w) => (w.operator === "eq" || w.operator === void 0) && w.connector !== "OR")) {
992
993
  const countResult = await handlePagination(async ({ paginationOpts }) => await ctx.runQuery(authFunctions.findMany, {
993
994
  model: data.model,
994
995
  paginationOpts,
@@ -1161,7 +1162,8 @@ const dbAdapter = (ctx, getAuthOptions, { authFunctions, debugLogs, schema }) =>
1161
1162
  }, schema, betterAuthSchema);
1162
1163
  },
1163
1164
  update: async (data) => {
1164
- if (data.where?.length && data.where.every((w) => (w.operator === "eq" || w.operator === void 0) && w.connector !== "OR")) {
1165
+ if (!data.where?.length) return null;
1166
+ if (data.where.every((w) => (w.operator === "eq" || w.operator === void 0) && w.connector !== "OR")) {
1165
1167
  const countResult = await handlePagination(async ({ paginationOpts }) => await findManyHandler(ctx, {
1166
1168
  model: data.model,
1167
1169
  paginationOpts,
@@ -9,17 +9,27 @@ import { t as createCallerFactory } from "../../caller-factory-NEfgD5E0.js";
9
9
  */
10
10
  const TRAILING_COLON_RE = /:$/;
11
11
  const requestCanHaveBody = (method) => method !== "GET" && method !== "HEAD" && method !== "OPTIONS";
12
+ const stripHopByHopHeaders = (headers) => {
13
+ headers.delete("connection");
14
+ headers.delete("content-length");
15
+ headers.delete("transfer-encoding");
16
+ };
12
17
  const handler = async (request, siteUrl) => {
13
18
  const requestUrl = new URL(request.url);
14
19
  const nextUrl = `${siteUrl}${requestUrl.pathname}${requestUrl.search}`;
15
20
  const headers = new Headers(request.headers);
21
+ stripHopByHopHeaders(headers);
16
22
  headers.set("accept-encoding", "application/json");
17
23
  headers.set("host", new URL(siteUrl).host);
18
24
  headers.set("x-forwarded-host", requestUrl.host);
19
25
  headers.set("x-forwarded-proto", requestUrl.protocol.replace(TRAILING_COLON_RE, ""));
20
26
  headers.set("x-better-auth-forwarded-host", requestUrl.host);
21
27
  headers.set("x-better-auth-forwarded-proto", requestUrl.protocol.replace(TRAILING_COLON_RE, ""));
22
- const body = requestCanHaveBody(request.method) ? await request.arrayBuffer() : void 0;
28
+ let body;
29
+ if (requestCanHaveBody(request.method)) {
30
+ const bufferedBody = await request.arrayBuffer();
31
+ if (bufferedBody.byteLength > 0) body = bufferedBody;
32
+ }
23
33
  return fetch(nextUrl, {
24
34
  body,
25
35
  headers,
@@ -62,8 +72,7 @@ function convexBetterAuth(opts) {
62
72
  auth: jwtCacheEnabled ? {
63
73
  getToken: (siteUrl, headers, getTokenOpts) => {
64
74
  const mutableHeaders = new Headers(headers);
65
- mutableHeaders.delete("content-length");
66
- mutableHeaders.delete("transfer-encoding");
75
+ stripHopByHopHeaders(mutableHeaders);
67
76
  mutableHeaders.set("accept-encoding", "identity");
68
77
  return getToken(siteUrl, mutableHeaders, {
69
78
  basePath: auth.basePath,
@@ -8,6 +8,12 @@ import React from "react";
8
8
  const fallbackCache = (fn) => fn;
9
9
  const cache = React.cache ?? fallbackCache;
10
10
  const TRAILING_COLON_RE = /:$/;
11
+ const requestCanHaveBody = (method) => method !== "GET" && method !== "HEAD" && method !== "OPTIONS";
12
+ const stripHopByHopHeaders = (headers) => {
13
+ headers.delete("connection");
14
+ headers.delete("content-length");
15
+ headers.delete("transfer-encoding");
16
+ };
11
17
  function setupClient(options) {
12
18
  const client = new ConvexHttpClient(options.convexUrl);
13
19
  if (options.token !== void 0) client.setAuth(options.token);
@@ -49,20 +55,25 @@ const cloneAuthHandlerResponse = (response) => {
49
55
  statusText: response.statusText
50
56
  });
51
57
  };
52
- const handler = (request, opts) => {
58
+ const handler = async (request, opts) => {
53
59
  const requestUrl = new URL(request.url);
54
60
  const nextUrl = `${opts.convexSiteUrl}${requestUrl.pathname}${requestUrl.search}`;
55
61
  const headers = new Headers(request.headers);
56
62
  const proto = requestUrl.protocol.replace(TRAILING_COLON_RE, "");
63
+ stripHopByHopHeaders(headers);
57
64
  headers.set("accept-encoding", "application/json");
58
65
  headers.set("host", new URL(opts.convexSiteUrl).host);
59
66
  headers.set("x-forwarded-host", requestUrl.host);
60
67
  headers.set("x-forwarded-proto", proto);
61
68
  headers.set("x-better-auth-forwarded-host", requestUrl.host);
62
69
  headers.set("x-better-auth-forwarded-proto", proto);
70
+ let body;
71
+ if (requestCanHaveBody(request.method)) {
72
+ const bufferedBody = await request.arrayBuffer();
73
+ if (bufferedBody.byteLength > 0) body = bufferedBody;
74
+ }
63
75
  return fetch(nextUrl, {
64
- body: request.method !== "GET" && request.method !== "HEAD" ? request.body : void 0,
65
- duplex: "half",
76
+ body,
66
77
  headers,
67
78
  method: request.method,
68
79
  redirect: "manual"
@@ -73,8 +84,7 @@ const convexBetterAuthReactStart = (opts) => {
73
84
  const cachedGetToken = cache(async (opts) => {
74
85
  const headers = getRequestHeaders();
75
86
  const mutableHeaders = new Headers(headers);
76
- mutableHeaders.delete("content-length");
77
- mutableHeaders.delete("transfer-encoding");
87
+ stripHopByHopHeaders(mutableHeaders);
78
88
  mutableHeaders.set("accept-encoding", "identity");
79
89
  return getToken(siteUrl, mutableHeaders, opts);
80
90
  });
@@ -6235,7 +6235,8 @@ 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
6237
  const SUPPORTED_CONVEX_VERSION = "1.38.0";
6238
- const SUPPORTED_BETTER_AUTH_VERSION = "1.6.9";
6238
+ const SUPPORTED_BETTER_AUTH_VERSION = "1.6.15";
6239
+ const SUPPORTED_BETTER_AUTH_MIN_VERSION = "1.6.11";
6239
6240
  const SUPPORTED_HONO_VERSION = "4.12.9";
6240
6241
  const SUPPORTED_OPENTELEMETRY_API_VERSION = "1.9.0";
6241
6242
  const SUPPORTED_TANSTACK_REACT_QUERY_VERSION = "5.95.2";
@@ -6248,6 +6249,11 @@ function getMinimumVersionRange(version) {
6248
6249
  if (!match) throw new Error(`Unsupported exact version "${version}". Expected x.y.z format.`);
6249
6250
  return `>=${match[1]}.${match[2]}`;
6250
6251
  }
6252
+ function getMinorVersionPeerRange(minimumVersion, supportedVersion) {
6253
+ const match = EXACT_VERSION_RE.exec(supportedVersion);
6254
+ if (!match) throw new Error(`Unsupported exact version "${supportedVersion}". Expected x.y.z format.`);
6255
+ return `>=${minimumVersion} <${match[1]}.${Number(match[2]) + 1}.0`;
6256
+ }
6251
6257
  function getPackageNameFromInstallSpec(spec) {
6252
6258
  const normalized = spec.trim();
6253
6259
  if (normalized.length === 0) throw new Error("Install spec must be non-empty.");
@@ -6302,7 +6308,10 @@ const SUPPORTED_DEPENDENCY_VERSIONS = {
6302
6308
  range: `^${SUPPORTED_CONVEX_VERSION}`,
6303
6309
  minimum: getMinimumVersionRange(SUPPORTED_CONVEX_VERSION)
6304
6310
  },
6305
- betterAuth: { exact: SUPPORTED_BETTER_AUTH_VERSION },
6311
+ betterAuth: {
6312
+ exact: SUPPORTED_BETTER_AUTH_VERSION,
6313
+ peer: getMinorVersionPeerRange(SUPPORTED_BETTER_AUTH_MIN_VERSION, SUPPORTED_BETTER_AUTH_VERSION)
6314
+ },
6306
6315
  hono: { exact: SUPPORTED_HONO_VERSION },
6307
6316
  opentelemetryApi: { exact: SUPPORTED_OPENTELEMETRY_API_VERSION },
6308
6317
  tanstackReactQuery: { exact: SUPPORTED_TANSTACK_REACT_QUERY_VERSION },
@@ -10234,7 +10243,7 @@ const AUTH_ENV_FIELDS = [
10234
10243
  schema: "z.string().optional()"
10235
10244
  }
10236
10245
  ];
10237
- const BETTER_AUTH_EXPO_INSTALL_SPEC = "@better-auth/expo@1.6.9";
10246
+ const BETTER_AUTH_EXPO_INSTALL_SPEC = "@better-auth/expo@1.6.15";
10238
10247
  const EXPO_SECURE_STORE_INSTALL_SPEC = "expo-secure-store@~55.0.8";
10239
10248
  const EXPO_NETWORK_INSTALL_SPEC = "expo-network@~55.0.8";
10240
10249
  const AUTH_FILES = [
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-DqIPJnse.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-D5P0hNYD.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";
@@ -790,7 +790,7 @@ async function startLocalSiteProxy(options) {
790
790
  const targetUrl = new URL(request.url ?? "/", options.targetOrigin);
791
791
  const headers = new Headers();
792
792
  for (const [key, value] of Object.entries(request.headers)) {
793
- if (value === void 0 || key === "host" || key === "connection" || key === "content-length") continue;
793
+ if (value === void 0 || key === "host" || key === "connection" || key === "content-length" || key === "transfer-encoding") continue;
794
794
  if (Array.isArray(value)) {
795
795
  for (const entry of value) headers.append(key, entry);
796
796
  continue;
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-DqIPJnse.mjs";
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";
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.12",
3
+ "version": "0.15.13",
4
4
  "description": "kitcn - React Query integration and CLI tools for Convex",
5
5
  "keywords": [
6
6
  "convex",
@@ -92,7 +92,7 @@
92
92
  "@tanstack/react-query": ">=5",
93
93
  "@tanstack/react-start": ">=1",
94
94
  "@tanstack/solid-query": ">=5",
95
- "better-auth": "1.6.9",
95
+ "better-auth": ">=1.6.11 <1.7.0",
96
96
  "convex": ">=1.38",
97
97
  "hono": "4.12.9",
98
98
  "next": ">=14",