kitcn 0.33.0 → 0.33.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/CHANGELOG.md +7 -0
- package/dist/aggregate/index.d.ts +1 -1
- package/dist/auth/generated/index.d.ts +1 -1
- package/dist/auth/index.d.ts +20 -20
- package/dist/auth/nextjs/index.d.ts +2 -2
- package/dist/auth/start/server/index.d.ts +2 -2
- package/dist/{builder-Cyd5nCxZ.js → builder-DDYTlmTB.js} +12 -3
- package/dist/caller-factory-C3pcbzo0.d.ts +140 -0
- package/dist/crpc/index.d.ts +3 -2
- package/dist/{generated-contract-disabled-PdNGvNYP.d.ts → generated-contract-disabled-B_EaHGCP.d.ts} +42 -42
- package/dist/{http-types-BhhPZtwa.d.ts → http-types-8FBr10yl.d.ts} +3 -79
- package/dist/{middleware-BBS7oLtT.d.ts → middleware-D2hKJuSZ.d.ts} +1 -1
- package/dist/{middleware-D61Nm-iB.js → middleware-LvZov-hA.js} +1 -1
- package/dist/orm/index.d.ts +1 -1
- package/dist/orm/migrations/index.d.ts +1 -1
- package/dist/plugins/index.d.ts +1 -1
- package/dist/plugins/index.js +1 -1
- package/dist/{procedure-caller-DgMiD0-a.js → procedure-caller-DgGF_hA8.js} +1 -1
- package/dist/{procedure-name-DPYyLiVS.d.ts → procedure-name-kn-awLk1.d.ts} +12 -142
- package/dist/ratelimit/index.d.ts +2 -2
- package/dist/ratelimit/index.js +2 -2
- package/dist/react/index.d.ts +5 -6
- package/dist/react/index.js +20 -66
- package/dist/rsc/index.d.ts +4 -3
- package/dist/server/index.d.ts +5 -4
- package/dist/server/index.js +2 -2
- package/dist/solid/index.d.ts +5 -6
- package/dist/solid/index.js +20 -66
- package/dist/transformer-BEkxlnss.d.ts +78 -0
- package/dist/{types-BXpu7xIU.d.ts → types-Cl0utsTL.d.ts} +4 -3
- package/dist/{where-clause-compiler-DrV6lQg0.d.ts → where-clause-compiler-CoPVAVDO.d.ts} +135 -135
- package/package.json +1 -1
- package/skills/kitcn/SKILL.md +2 -1
- package/skills/kitcn/references/features/auth-admin.md +1 -0
- package/skills/kitcn/references/features/react.md +4 -5
- /package/dist/{context-utils-Cbv4r0AA.d.ts → context-utils-ax351iFc.d.ts} +0 -0
- /package/dist/{token-tlbNKQS0.d.ts → token-CZpDQUHd.d.ts} +0 -0
- /package/dist/{types-Bkeicpo6.d.ts → types-CzGsrLrY.d.ts} +0 -0
|
@@ -1,86 +1,10 @@
|
|
|
1
1
|
import { o as Simplify } from "./types-Bqi_ivSd.js";
|
|
2
|
-
import {
|
|
2
|
+
import { t as CombinedDataTransformer } from "./transformer-BEkxlnss.js";
|
|
3
|
+
import { g as UnsetMarker, t as AnyMiddleware } from "./types-CzGsrLrY.js";
|
|
3
4
|
import { GenericActionCtx, GenericDataModel, HttpRouter } from "convex/server";
|
|
4
5
|
import { z } from "zod";
|
|
5
6
|
import { Context, Hono } from "hono";
|
|
6
7
|
|
|
7
|
-
//#region src/crpc/transformer.d.ts
|
|
8
|
-
/**
|
|
9
|
-
* Generic transformer contract (mirrors tRPC shape).
|
|
10
|
-
*/
|
|
11
|
-
interface DataTransformer {
|
|
12
|
-
deserialize(object: any): any;
|
|
13
|
-
serialize(object: any): any;
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* Separate input/output transformers.
|
|
17
|
-
*/
|
|
18
|
-
interface CombinedDataTransformer {
|
|
19
|
-
input: DataTransformer;
|
|
20
|
-
output: DataTransformer;
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* Transformer config accepted by cRPC.
|
|
24
|
-
*/
|
|
25
|
-
type DataTransformerOptions = CombinedDataTransformer | DataTransformer;
|
|
26
|
-
/**
|
|
27
|
-
* Extensible tagged wire codec.
|
|
28
|
-
*/
|
|
29
|
-
interface WireCodec {
|
|
30
|
-
decode(value: unknown): unknown;
|
|
31
|
-
encode(value: unknown): unknown;
|
|
32
|
-
isType(value: unknown): boolean;
|
|
33
|
-
/**
|
|
34
|
-
* Declares that `isType` only ever claims a value where
|
|
35
|
-
* `typeof value === 'object' && value !== null` - never a primitive, a
|
|
36
|
-
* function, `null` or `undefined`.
|
|
37
|
-
*
|
|
38
|
-
* Lets `serialize` skip codec dispatch on primitives, which are the majority
|
|
39
|
-
* of visited nodes. It is opt-in because an arbitrary predicate cannot be
|
|
40
|
-
* classified by sampling values: a codec that claims, say, one specific
|
|
41
|
-
* number would be misread as object-only and silently lose its encoding.
|
|
42
|
-
* Codecs that leave it unset keep full dispatch.
|
|
43
|
-
*/
|
|
44
|
-
readonly objectsOnly?: boolean;
|
|
45
|
-
readonly tag: `$${string}`;
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* Date wire tag (Convex-style reserved key).
|
|
49
|
-
*/
|
|
50
|
-
declare const DATE_CODEC_TAG = "$date";
|
|
51
|
-
/**
|
|
52
|
-
* Built-in Date codec.
|
|
53
|
-
*/
|
|
54
|
-
declare const dateWireCodec: WireCodec;
|
|
55
|
-
/**
|
|
56
|
-
* Build a recursive tagged transformer from codecs.
|
|
57
|
-
*/
|
|
58
|
-
declare const createTaggedTransformer: (codecs: readonly WireCodec[]) => DataTransformer;
|
|
59
|
-
/**
|
|
60
|
-
* Default cRPC transformer (Date-enabled).
|
|
61
|
-
*/
|
|
62
|
-
declare const defaultCRPCTransformer: DataTransformer;
|
|
63
|
-
/**
|
|
64
|
-
* Normalize transformer config to split input/output shape.
|
|
65
|
-
* User transformers are additive and always composed with default Date handling.
|
|
66
|
-
*
|
|
67
|
-
* Idempotent: passing a transformer this function already resolved returns it
|
|
68
|
-
* unchanged.
|
|
69
|
-
*/
|
|
70
|
-
declare const getTransformer: (transformer?: DataTransformerOptions) => CombinedDataTransformer;
|
|
71
|
-
/**
|
|
72
|
-
* Encode request payloads (input direction).
|
|
73
|
-
*/
|
|
74
|
-
declare const encodeWire: (value: unknown, transformer?: DataTransformerOptions) => unknown;
|
|
75
|
-
/**
|
|
76
|
-
* Decode response payloads (output direction).
|
|
77
|
-
*/
|
|
78
|
-
declare const decodeWire: (value: unknown, transformer?: DataTransformerOptions) => unknown;
|
|
79
|
-
/**
|
|
80
|
-
* Exposed identity transformer for advanced composition.
|
|
81
|
-
*/
|
|
82
|
-
declare const identityTransformer: CombinedDataTransformer;
|
|
83
|
-
//#endregion
|
|
84
8
|
//#region src/server/http-types.d.ts
|
|
85
9
|
type ProcedureMeta = object;
|
|
86
10
|
type HttpMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
|
|
@@ -335,4 +259,4 @@ declare class HttpClientError extends Error {
|
|
|
335
259
|
/** Type guard for HttpClientError */
|
|
336
260
|
declare const isHttpClientError: (error: unknown) => error is HttpClientError;
|
|
337
261
|
//#endregion
|
|
338
|
-
export { HttpProcedureBuilderDef as A,
|
|
262
|
+
export { HttpProcedureBuilderDef as A, extractRouteMap as C, HttpHandlerOpts as D, HttpActionHandler as E, InferHttpInput$1 as M, ProcedureMeta as N, HttpMethod as O, createHttpRouterFactory as S, HttpActionConstructor as T, CRPCHttpRouter as _, HttpErrorCode as a, HttpRouterWithHono as b, HttpQueryKey as c, HttpRouteMap as d, InferHttpInput as f, isHttpClientError as g, buildHttpQueryPrefixKey as h, HttpClientFromRouter as i, HttpRouteDefinition as j, HttpProcedure as k, HttpQueryPrefixKey as l, buildHttpQueryKey as m, HttpClient as n, HttpMutationKey as o, InferHttpOutput as p, HttpClientError as r, HttpProcedureCall as s, HTTP_DEFAULT_STALE_TIME as t, HttpRouteInfo as u, HttpRouterDef as v, CRPCHonoHandler as w, createHttpRouter as x, HttpRouterRecord as y };
|
package/dist/orm/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { $n as TableName, $t as OrmLifecycleChange, An as ConvexCheckBuilder, At as UpdateSet, Bn as ConvexTextBuilder, Br as IsPrimaryKey, Bt as RelationsBuilderColumnBase, C as MigrationStep, Cn as ConvexVectorIndexConfig, Cr as not, Ct as OrderByClause, D as defineMigration, Dn as searchIndex, Dr as startsWith, Dt as ReturningAll, E as buildMigrationPlan, En as rankIndex, Er as or, Et as PredicateWhereIndexConfig, Fn as ConvexUniqueConstraintBuilderOn, Fr as ColumnBuilderTypeConfig, Ft as ExtractTablesFromSchema, Gn as Columns, Gt as TablesRelationalConfig, H as RlsMode, Hn as text, Hr as NotNull, In as ConvexUniqueConstraintConfig, Ir as ColumnBuilderWithTableName, It as ExtractTablesWithRelations, Jn as OrmSchemaExtensionTables, Jt as ConvexDeletionBuilder, Kt as defineRelations, Ln as check, Lr as ColumnDataType, Lt as ManyConfig, M as DatabaseWithQuery, Mn as ConvexForeignKeyBuilder, Mr as ColumnBuilder, Mt as VectorSearchProvider, N as OrmReader$1, Nn as ConvexForeignKeyConfig, Nr as ColumnBuilderBaseConfig, Nt as unsetToken, O as defineMigrationSet, On as uniqueIndex, Ot as ReturningResult, P as OrmWriter$1, Pn as ConvexUniqueConstraintBuilder, Pr as ColumnBuilderRuntimeConfig, Qn as OrmSchemaTriggers, Qt as DiscriminatorBuilderConfig, Rn as foreignKey, Rr as DrizzleEntity, Rt as OneConfig, S as MigrationStateMap, Sn as ConvexVectorIndexBuilderOn, Sr as ne, St as MutationRunMode, T as MigrationWriteMode, Tn as index, Tr as notInArray, Tt as PaginatedResult, U as EdgeMetadata, V as RlsContext, Vn as ConvexTextBuilderInitial, Vr as IsUnique, Vt as RelationsBuilderColumnConfig, W as extractRelationsConfig, Wn as Brand, Wt as TableRelationalConfig, Xn as OrmSchemaExtensions, Xt as ConvexTable, Yt as ConvexDeletionConfig, Zn as OrmSchemaRelations, Zt as ConvexTableWithColumns, _ as MigrationManifestEntry, _n as ConvexRankIndexBuilderOn, _r as isNotNull, _t as MutationExecutionMode, an as RlsPolicy, ar as UnaryExpression, at as BuildRelationResult, b as MigrationRunStatus, bn as ConvexSearchIndexConfig, br as lt, bt as MutationResult, cn as rlsPolicy, cr as contains, ct as DBQueryConfig, d as MigrationAppliedState, dn as rlsRole, dr as fieldRef, dt as InferInsertModel, en as OrmLifecycleOperation, er as BinaryExpression, f as MigrationDefinition, fn as ConvexAggregateIndexBuilder, fr as gt, ft as InferModelFromColumns, g as MigrationDriftIssue, gn as ConvexRankIndexBuilder, gr as isFieldReference, gt as MutationExecuteResult, h as MigrationDocContext, hn as ConvexIndexBuilderOn, hr as inArray, ht as MutationExecuteConfig, i as OrmMigrationCapability, in as discriminator, ir as LogicalExpression, it as BuildQueryResult, j as DatabaseWithMutations, jn as ConvexCheckConfig, jr as AnyColumn, jt as VectorQueryConfig, k as detectMigrationDrift, kn as vectorIndex, kr as SystemFields, kt as ReturningSelection, ln as RlsRole, lr as endsWith, lt as FilterOperators, m as MigrationDoc, mn as ConvexIndexBuilder, mr as ilike, mt as InsertValue, n as OrmCapabilities, nn as convexTable, nr as FieldReference, nt as AggregateFieldValue, on as RlsPolicyConfig, or as and, ot as CountConfig, p as MigrationDirection, pn as ConvexAggregateIndexBuilderOn, pr as gte, pt as InferSelectModel, qt as defineRelationsPart, r as OrmCapability, rn as deletion, rr as FilterExpression, rt as AggregateResult, sn as RlsPolicyToOption, sr as between, st as CountResult, t as OrmAggregateCapability, tn as TableConfig, tr as ExpressionVisitor, tt as AggregateConfig, un as RlsRoleConfig, ur as eq, ut as GetColumnData, v as MigrationMigrateOne, vn as ConvexSearchIndexBuilder, vr as isNull, vt as MutationPaginateConfig, w as MigrationTableName, wn as aggregateIndex, wr as notBetween, wt as OrderDirection, x as MigrationSet, xn as ConvexVectorIndexBuilder, xr as lte, xt as MutationReturning, y as MigrationPlan, yn as ConvexSearchIndexBuilderOn, yr as like, yt as MutationPaginatedResult, zn as unique, zr as HasDefault, zt as RelationsBuilder } from "../capabilities-Bxzoofl4.js";
|
|
2
|
-
import { $ as OrmClientWithApi$1, A as ConvexDateMode, B as ConvexBytesBuilderInitial, C as ConvexNumberBuilderInitial, D as id, E as ConvexIdBuilderInitial, F as custom, G as ConvexBigIntBuilder, H as ConvexBooleanBuilder, I as json, J as CreateOrmOptions, K as ConvexBigIntBuilderInitial, L as objectOf, M as ConvexCustomBuilder, N as ConvexCustomBuilderInitial, O as ConvexDateBuilder, P as arrayOf, Q as OrmClientBase$1, R as unionOf, S as ConvexNumberBuilder, St as defineTriggers, T as ConvexIdBuilder, U as ConvexBooleanBuilderInitial, V as bytes, W as boolean, X as GenericOrmCtx$1, Y as GenericOrm$1, Z as OrmApiResult, _ as ConvexTimestampMode, _t as OrmBeforeResult, a as requireSchemaRelations, at as ScheduledMutationBatchArgs, b as ConvexTextEnumBuilderInitial, bt as OrmTriggerContext, c as TableConfigResult, ct as scheduledDeleteFactory, d as OrmNotFoundError, et as OrmFunctions, f as ConvexVectorBuilder, g as ConvexTimestampBuilderInitial, gt as defineSchemaExtension, h as ConvexTimestampBuilder, ht as SchemaExtension, i as getSchemaTriggers, it as createOrm, j as date, k as ConvexDateBuilderInitial, l as getTableColumns, m as vector, n as defineSchema, nt as OrmWriterCtx, o as asc, ot as scheduledMutationBatchFactory, p as ConvexVectorBuilderInitial, q as bigint, r as getSchemaRelations, rt as ResolveOrmSchema, s as desc, st as ScheduledDeleteArgs, t as WhereClauseResult, tt as OrmReaderCtx, u as getTableConfig, v as timestamp, vt as OrmTableTriggers, w as integer, x as textEnum, xt as OrmTriggers, y as ConvexTextEnumBuilder, yt as OrmTriggerChange, z as ConvexBytesBuilder } from "../where-clause-compiler-
|
|
2
|
+
import { $ as OrmClientWithApi$1, A as ConvexDateMode, B as ConvexBytesBuilderInitial, C as ConvexNumberBuilderInitial, D as id, E as ConvexIdBuilderInitial, F as custom, G as ConvexBigIntBuilder, H as ConvexBooleanBuilder, I as json, J as CreateOrmOptions, K as ConvexBigIntBuilderInitial, L as objectOf, M as ConvexCustomBuilder, N as ConvexCustomBuilderInitial, O as ConvexDateBuilder, P as arrayOf, Q as OrmClientBase$1, R as unionOf, S as ConvexNumberBuilder, St as defineTriggers, T as ConvexIdBuilder, U as ConvexBooleanBuilderInitial, V as bytes, W as boolean, X as GenericOrmCtx$1, Y as GenericOrm$1, Z as OrmApiResult, _ as ConvexTimestampMode, _t as OrmBeforeResult, a as requireSchemaRelations, at as ScheduledMutationBatchArgs, b as ConvexTextEnumBuilderInitial, bt as OrmTriggerContext, c as TableConfigResult, ct as scheduledDeleteFactory, d as OrmNotFoundError, et as OrmFunctions, f as ConvexVectorBuilder, g as ConvexTimestampBuilderInitial, gt as defineSchemaExtension, h as ConvexTimestampBuilder, ht as SchemaExtension, i as getSchemaTriggers, it as createOrm, j as date, k as ConvexDateBuilderInitial, l as getTableColumns, m as vector, n as defineSchema, nt as OrmWriterCtx, o as asc, ot as scheduledMutationBatchFactory, p as ConvexVectorBuilderInitial, q as bigint, r as getSchemaRelations, rt as ResolveOrmSchema, s as desc, st as ScheduledDeleteArgs, t as WhereClauseResult, tt as OrmReaderCtx, u as getTableConfig, v as timestamp, vt as OrmTableTriggers, w as integer, x as textEnum, xt as OrmTriggers, y as ConvexTextEnumBuilder, yt as OrmTriggerChange, z as ConvexBytesBuilder } from "../where-clause-compiler-CoPVAVDO.js";
|
|
3
3
|
import { i as pretendRequired, n as deprecated, r as pretend } from "../validators-0I-Ik1EN.js";
|
|
4
4
|
import { a as QueryCtxWithPreferredOrmQueryTable, i as QueryCtxWithOrmQueryTable, n as LookupByIdResultByCtx, o as getByIdWithOrmQueryFallback, r as QueryCtxWithOptionalOrmQueryTable, t as DocByCtx } from "../query-context-BkNjkDCk.js";
|
|
5
5
|
import { DefineSchemaOptions, GenericDatabaseReader, GenericDatabaseWriter, GenericSchema, SchemaDefinition } from "convex/server";
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { C as MigrationStep, D as defineMigration, E as buildMigrationPlan, O as defineMigrationSet, S as MigrationStateMap, T as MigrationWriteMode, _ as MigrationManifestEntry, a as MAX_STATUS_RUN_LIMIT, b as MigrationRunStatus, c as MigrationRunChunkArgs, d as MigrationAppliedState, f as MigrationDefinition, g as MigrationDriftIssue, h as MigrationDocContext, k as detectMigrationDrift, l as MigrationStatusArgs, m as MigrationDoc, o as MigrationCancelArgs, p as MigrationDirection, s as MigrationRunArgs, u as createMigrationHandlers, v as MigrationMigrateOne, w as MigrationTableName, x as MigrationSet, y as MigrationPlan } from "../../capabilities-Bxzoofl4.js";
|
|
2
|
-
import { Ct as migrationCapability, dt as MIGRATION_STORAGE_TABLE_NAMES, ft as injectMigrationStorageTables, lt as MIGRATION_RUN_TABLE, mt as migrationStorageTables, pt as migrationExtension, ut as MIGRATION_STATE_TABLE } from "../../where-clause-compiler-
|
|
2
|
+
import { Ct as migrationCapability, dt as MIGRATION_STORAGE_TABLE_NAMES, ft as injectMigrationStorageTables, lt as MIGRATION_RUN_TABLE, mt as migrationStorageTables, pt as migrationExtension, ut as MIGRATION_STATE_TABLE } from "../../where-clause-compiler-CoPVAVDO.js";
|
|
3
3
|
export { MAX_STATUS_RUN_LIMIT, MIGRATION_RUN_TABLE, MIGRATION_STATE_TABLE, MIGRATION_STORAGE_TABLE_NAMES, type MigrationAppliedState, type MigrationCancelArgs, type MigrationDefinition, type MigrationDirection, type MigrationDoc, type MigrationDocContext, type MigrationDriftIssue, type MigrationManifestEntry, type MigrationMigrateOne, type MigrationPlan, type MigrationRunArgs, type MigrationRunChunkArgs, type MigrationRunStatus, type MigrationSet, type MigrationStateMap, type MigrationStatusArgs, type MigrationStep, type MigrationTableName, type MigrationWriteMode, buildMigrationPlan, createMigrationHandlers, defineMigration, defineMigrationSet, detectMigrationDrift, injectMigrationStorageTables, migrationCapability, migrationExtension, migrationStorageTables };
|
package/dist/plugins/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as PluginConfigureResolver, i as PluginConfigureInput, n as PluginApiScope, o as definePlugin, r as PluginConfigureContext, s as resolvePluginOptions, t as Plugin } from "../middleware-
|
|
1
|
+
import { a as PluginConfigureResolver, i as PluginConfigureInput, n as PluginApiScope, o as definePlugin, r as PluginConfigureContext, s as resolvePluginOptions, t as Plugin } from "../middleware-D2hKJuSZ.js";
|
|
2
2
|
export { type Plugin, type PluginApiScope, type PluginConfigureContext, type PluginConfigureInput, type PluginConfigureResolver, definePlugin, resolvePluginOptions };
|
package/dist/plugins/index.js
CHANGED
|
@@ -1,22 +1,14 @@
|
|
|
1
1
|
import { t as VRequired } from "./validators-0I-Ik1EN.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { l as EmptyObject, u as Expand } from "./caller-factory-C3pcbzo0.js";
|
|
3
|
+
import { d as getTransformer, i as DataTransformerOptions } from "./transformer-BEkxlnss.js";
|
|
4
|
+
import { g as UnsetMarker, i as IntersectIfDefined, o as MiddlewareBuilder, p as Overwrite$1, s as MiddlewareFunction, t as AnyMiddleware } from "./types-CzGsrLrY.js";
|
|
5
|
+
import { A as HttpProcedureBuilderDef, D as HttpHandlerOpts, N as ProcedureMeta, O as HttpMethod, _ as CRPCHttpRouter, f as InferHttpInput, k as HttpProcedure, p as InferHttpOutput, y as HttpRouterRecord } from "./http-types-8FBr10yl.js";
|
|
4
6
|
import { ConvexError, GenericId, GenericValidator, ObjectType, OptionalProperty, PropertyValidators, VAny, VArray, VBoolean, VBytes, VFloat64, VId, VInt64, VLiteral, VNull, VObject, VOptional, VRecord, VString, VUnion, Validator, Value as Value$1 } from "convex/values";
|
|
5
7
|
import { ActionBuilder, ArgsArrayToObject, DefaultFunctionArgs, FunctionReference, FunctionReturnType, FunctionVisibility, GenericActionCtx, GenericDataModel, GenericMutationCtx, GenericQueryCtx, MutationBuilder, QueryBuilder, RegisteredAction, RegisteredMutation, RegisteredQuery, TableNamesInDataModel } from "convex/server";
|
|
6
8
|
import * as z$1 from "zod";
|
|
7
9
|
import * as z$2 from "zod/v4";
|
|
8
10
|
import * as zCore from "zod/v4/core";
|
|
9
11
|
|
|
10
|
-
//#region src/internal/upstream/index.d.ts
|
|
11
|
-
type EmptyObject = Record<string, never>;
|
|
12
|
-
/**
|
|
13
|
-
* Hack! This type causes TypeScript to simplify how it renders object types.
|
|
14
|
-
*
|
|
15
|
-
* It is functionally the identity for object types, but in practice it can
|
|
16
|
-
* simplify expressions like `A & B`.
|
|
17
|
-
*/
|
|
18
|
-
type Expand<ObjectType extends Record<any, any>> = ObjectType extends Record<any, any> ? { [Key in keyof ObjectType]: ObjectType[Key] } : never;
|
|
19
|
-
//#endregion
|
|
20
12
|
//#region src/internal/upstream/server/customFunctions.d.ts
|
|
21
13
|
/**
|
|
22
14
|
* A customization of a query, mutation, or action.
|
|
@@ -653,13 +645,15 @@ declare function createHttpProcedureBuilder<TCtx, TMeta extends ProcedureMeta>(c
|
|
|
653
645
|
*/
|
|
654
646
|
declare const paginatedSchemaForTypes: z$1.ZodObject<{
|
|
655
647
|
cursor: z$1.ZodUnion<readonly [z$1.ZodString, z$1.ZodNull]>;
|
|
648
|
+
endCursor: z$1.ZodOptional<z$1.ZodUnion<readonly [z$1.ZodString, z$1.ZodNull]>>;
|
|
656
649
|
limit: z$1.ZodNumber;
|
|
657
650
|
}, z$1.core.$strip>;
|
|
658
651
|
/** Paginated schema type - both cursor and limit are required after .paginated() */
|
|
659
652
|
type PaginatedInputSchema = typeof paginatedSchemaForTypes;
|
|
660
|
-
/** Paginated schema type for external callers
|
|
653
|
+
/** Paginated schema type for external callers before defaults are applied. */
|
|
661
654
|
declare const paginatedSchemaForClientTypes: z$1.ZodObject<{
|
|
662
655
|
cursor: z$1.ZodOptional<z$1.ZodUnion<readonly [z$1.ZodString, z$1.ZodNull]>>;
|
|
656
|
+
endCursor: z$1.ZodOptional<z$1.ZodUnion<readonly [z$1.ZodString, z$1.ZodNull]>>;
|
|
663
657
|
limit: z$1.ZodOptional<z$1.ZodNumber>;
|
|
664
658
|
}, z$1.core.$strip>;
|
|
665
659
|
type PaginatedClientInputSchema = typeof paginatedSchemaForClientTypes;
|
|
@@ -811,8 +805,8 @@ declare class QueryProcedureBuilder<TBaseCtx, TContext, TContextOverrides extend
|
|
|
811
805
|
/**
|
|
812
806
|
* Add pagination input (chainable before .query())
|
|
813
807
|
*
|
|
814
|
-
* Creates flat { cursor, limit } input like tRPC and auto-wraps
|
|
815
|
-
* User accesses
|
|
808
|
+
* Creates flat { cursor, endCursor, limit } input like tRPC and auto-wraps
|
|
809
|
+
* output. User accesses the pagination fields directly from args.
|
|
816
810
|
*
|
|
817
811
|
* @param opts.limit - Default/max items per page
|
|
818
812
|
* @param opts.item - Zod schema for each item in the page array
|
|
@@ -824,6 +818,8 @@ declare class QueryProcedureBuilder<TBaseCtx, TContext, TContextOverrides extend
|
|
|
824
818
|
continueCursor: z$1.ZodUnion<[z$1.ZodString, z$1.ZodNull]>;
|
|
825
819
|
isDone: z$1.ZodBoolean;
|
|
826
820
|
page: z$1.ZodArray<TItem>;
|
|
821
|
+
pageStatus: z$1.ZodOptional<z$1.ZodUnion<[z$1.ZodLiteral<'SplitRecommended'>, z$1.ZodLiteral<'SplitRequired'>, z$1.ZodNull]>>;
|
|
822
|
+
splitCursor: z$1.ZodOptional<z$1.ZodUnion<[z$1.ZodString, z$1.ZodNull]>>;
|
|
827
823
|
}>, TMeta>;
|
|
828
824
|
/** Define output schema */
|
|
829
825
|
output<TNewOutput extends z$1.ZodTypeAny>(schema: TNewOutput): QueryProcedureBuilder<TBaseCtx, TContext, TContextOverrides, TInput, TClientInput, TNewOutput, TMeta>;
|
|
@@ -1005,132 +1001,6 @@ declare function createApiLeaf<TType extends ApiFunctionType, TExport, TMeta ext
|
|
|
1005
1001
|
};
|
|
1006
1002
|
declare function createGeneratedFunctionReference<TType extends ApiFunctionType, TVisibility extends GeneratedFunctionVisibility, TExport>(name: string): GeneratedFunctionRefFromExport<TType, TVisibility, TExport>;
|
|
1007
1003
|
//#endregion
|
|
1008
|
-
//#region src/server/caller.d.ts
|
|
1009
|
-
/** Metadata for a single function */
|
|
1010
|
-
type FnMeta = {
|
|
1011
|
-
type?: 'query' | 'mutation' | 'action';
|
|
1012
|
-
[key: string]: unknown;
|
|
1013
|
-
};
|
|
1014
|
-
/** Metadata for all functions in a module */
|
|
1015
|
-
type ModuleMeta = Record<string, FnMeta>;
|
|
1016
|
-
/** Metadata for all modules - from generated `@convex/api` */
|
|
1017
|
-
type CallerMeta = Record<string, ModuleMeta>;
|
|
1018
|
-
/** Options for individual caller function calls */
|
|
1019
|
-
type CallerOpts = {
|
|
1020
|
-
/** Skip query silently when unauthenticated (returns null instead of throwing) */skipUnauth?: boolean;
|
|
1021
|
-
};
|
|
1022
|
-
type CallerReturn<T, Opts extends CallerOpts | undefined> = Opts extends {
|
|
1023
|
-
skipUnauth: true;
|
|
1024
|
-
} ? T | null : T;
|
|
1025
|
-
type FetchFn<T extends 'query' | 'mutation' | 'action'> = <Fn extends FunctionReference<T>>(fn: Fn, args: Fn['_args'], opts?: CallerOpts) => Promise<FunctionReturnType<Fn> | null>;
|
|
1026
|
-
type CreateCallerOptions = {
|
|
1027
|
-
fetchQuery: FetchFn<'query'>;
|
|
1028
|
-
fetchMutation: FetchFn<'mutation'>;
|
|
1029
|
-
fetchAction: FetchFn<'action'>;
|
|
1030
|
-
meta: CallerMeta;
|
|
1031
|
-
transformer?: DataTransformerOptions;
|
|
1032
|
-
};
|
|
1033
|
-
type ServerCallerFn<TApi, K extends keyof TApi> = TApi[K] extends FunctionReference<infer T, 'public'> ? T extends 'query' | 'mutation' | 'action' ? keyof TApi[K]['_args'] extends never ? <Opts extends CallerOpts | undefined = undefined>(args?: EmptyObject, opts?: Opts) => Promise<CallerReturn<FunctionReturnType<TApi[K]>, Opts>> : EmptyObject extends TApi[K]['_args'] ? <Opts extends CallerOpts | undefined = undefined>(args?: TApi[K]['_args'], opts?: Opts) => Promise<CallerReturn<FunctionReturnType<TApi[K]>, Opts>> : <Opts extends CallerOpts | undefined = undefined>(args: TApi[K]['_args'], opts?: Opts) => Promise<CallerReturn<FunctionReturnType<TApi[K]>, Opts>> : never : ServerCaller<TApi[K]>;
|
|
1034
|
-
type ServerCaller<TApi> = { [K in keyof TApi as K extends string ? K extends `_${string}` ? never : K extends 'http' ? never : K : K]: ServerCallerFn<TApi, K> };
|
|
1035
|
-
/**
|
|
1036
|
-
* Create a server caller for direct data fetching without React Query.
|
|
1037
|
-
*
|
|
1038
|
-
* This is detached from React Query cache - data is NOT available in client components.
|
|
1039
|
-
* Use for server-only data that doesn't need to be shared with the client.
|
|
1040
|
-
*
|
|
1041
|
-
* @example
|
|
1042
|
-
* ```tsx
|
|
1043
|
-
* // src/lib/convex/rsc.tsx
|
|
1044
|
-
* export const caller = createServerCaller(api, {
|
|
1045
|
-
* fetchQuery: fetchAuthQuery,
|
|
1046
|
-
* fetchMutation: fetchAuthMutation,
|
|
1047
|
-
* });
|
|
1048
|
-
*
|
|
1049
|
-
* // app/page.tsx (RSC)
|
|
1050
|
-
* const posts = await caller.posts.list();
|
|
1051
|
-
* return <div>{posts?.length} posts</div>;
|
|
1052
|
-
* ```
|
|
1053
|
-
*/
|
|
1054
|
-
declare function createServerCaller<TApi extends Record<string, unknown>>(api: TApi, opts: CreateCallerOptions): ServerCaller<TApi>;
|
|
1055
|
-
//#endregion
|
|
1056
|
-
//#region src/server/lazy-caller.d.ts
|
|
1057
|
-
type CallerContext<TApi> = {
|
|
1058
|
-
caller: ServerCaller<TApi>;
|
|
1059
|
-
token: string | undefined;
|
|
1060
|
-
isAuthenticated: boolean;
|
|
1061
|
-
};
|
|
1062
|
-
/**
|
|
1063
|
-
* Lazy caller with auth helper methods.
|
|
1064
|
-
* Context is created on first procedure invocation, not at definition time.
|
|
1065
|
-
*/
|
|
1066
|
-
type LazyCaller<TApi> = ServerCaller<TApi> & {
|
|
1067
|
-
/** Check if user is authenticated */isAuth: () => Promise<boolean>; /** Check if user is unauthenticated */
|
|
1068
|
-
isUnauth: () => Promise<boolean>; /** Get the auth token (for RSC prefetching) */
|
|
1069
|
-
getToken: () => Promise<string | undefined>;
|
|
1070
|
-
};
|
|
1071
|
-
/**
|
|
1072
|
-
* Create a lazy caller that creates context on each procedure invocation.
|
|
1073
|
-
* Matches tRPC's `appRouter.createCaller(createTRPCContext)` pattern.
|
|
1074
|
-
*
|
|
1075
|
-
* @example
|
|
1076
|
-
* ```ts
|
|
1077
|
-
* // server.ts
|
|
1078
|
-
* const { createContext, createCaller } = createCallerFactory({...});
|
|
1079
|
-
*
|
|
1080
|
-
* // rsc.tsx
|
|
1081
|
-
* const createRSCContext = cache(async () => {
|
|
1082
|
-
* const heads = await headers();
|
|
1083
|
-
* return createContext({ headers: heads });
|
|
1084
|
-
* });
|
|
1085
|
-
* export const caller = createCaller(createRSCContext);
|
|
1086
|
-
*
|
|
1087
|
-
* // app/page.tsx - single call! Context created lazily
|
|
1088
|
-
* const posts = await caller.posts.list();
|
|
1089
|
-
* ```
|
|
1090
|
-
*/
|
|
1091
|
-
declare function createLazyCaller<TApi extends Record<string, unknown>>(api: TApi, createContext: () => Promise<CallerContext<TApi>>): LazyCaller<TApi>;
|
|
1092
|
-
//#endregion
|
|
1093
|
-
//#region src/server/caller-factory.d.ts
|
|
1094
|
-
type TokenResult = {
|
|
1095
|
-
token?: string;
|
|
1096
|
-
isFresh?: boolean;
|
|
1097
|
-
};
|
|
1098
|
-
type GetTokenFn = (siteUrl: string, headers: Headers, opts?: unknown) => Promise<TokenResult>;
|
|
1099
|
-
/** Auth options for server-side calls. */
|
|
1100
|
-
type AuthOptions = {
|
|
1101
|
-
/** Function to extract auth token from request headers. */getToken: GetTokenFn;
|
|
1102
|
-
/**
|
|
1103
|
-
* Custom function to detect UNAUTHORIZED errors.
|
|
1104
|
-
* Set this to resolve those errors to `null` instead of throwing.
|
|
1105
|
-
*
|
|
1106
|
-
* Refreshing an expired cached token and retrying does not require this:
|
|
1107
|
-
* that always falls back to `defaultIsUnauthorized`.
|
|
1108
|
-
*/
|
|
1109
|
-
isUnauthorized?: (error: unknown) => boolean;
|
|
1110
|
-
};
|
|
1111
|
-
type CreateCallerFactoryOptions<TApi> = {
|
|
1112
|
-
/** Your Convex API object. */api: TApi; /** Convex site URL (must end in `.convex.site`). */
|
|
1113
|
-
convexSiteUrl: string;
|
|
1114
|
-
/**
|
|
1115
|
-
* Convex deployment URL (must end in `.convex.cloud`).
|
|
1116
|
-
* Defaults to `convexSiteUrl` with the domain swapped.
|
|
1117
|
-
*/
|
|
1118
|
-
convexUrl?: string; /** Auth options. Pass to enable authenticated calls with JWT caching. */
|
|
1119
|
-
auth?: AuthOptions; /** Optional wire transformer for request/response payloads (always composed with Date). */
|
|
1120
|
-
transformer?: DataTransformerOptions;
|
|
1121
|
-
};
|
|
1122
|
-
type ConvexContext<TApi> = {
|
|
1123
|
-
token: string | undefined;
|
|
1124
|
-
isAuthenticated: boolean;
|
|
1125
|
-
caller: ServerCaller<TApi>;
|
|
1126
|
-
};
|
|
1127
|
-
declare function createCallerFactory<TApi extends Record<string, unknown>>(opts: CreateCallerFactoryOptions<TApi>): {
|
|
1128
|
-
createCaller: (ctxFn: () => Promise<ConvexContext<TApi>>) => LazyCaller<TApi>;
|
|
1129
|
-
createContext: (reqOpts: {
|
|
1130
|
-
headers: Headers;
|
|
1131
|
-
}) => Promise<ConvexContext<TApi>>;
|
|
1132
|
-
};
|
|
1133
|
-
//#endregion
|
|
1134
1004
|
//#region src/server/env.d.ts
|
|
1135
1005
|
type RuntimeEnv = Record<string, string | undefined>;
|
|
1136
1006
|
type CreateEnvOptions<TSchema extends z$1.ZodObject<z$1.ZodRawShape>> = {
|
|
@@ -1409,4 +1279,4 @@ type ProcedureNameLookup = Record<string, ProcedureNameEntry[]>;
|
|
|
1409
1279
|
declare function registerProcedureNameLookup(lookup: ProcedureNameLookup, functionsDirHint: string): void;
|
|
1410
1280
|
declare function inferProcedureNameFromCallsite(): string | undefined;
|
|
1411
1281
|
//#endregion
|
|
1412
|
-
export {
|
|
1282
|
+
export { createHttpProcedureBuilder as $, CRPCError as A, RuntimeEnv as B, createProcedureHandlerFactory as C, WithHttpRouter as D, typedProcedureResolver as E, getCRPCErrorFromUnknown as F, ActionProcedureBuilder as G, createApiLeaf as H, getHTTPStatusCodeFromError as I, ProcedureBuilder as J, CRPCFunctionTypeHint as K, isCRPCError as L, CRPCErrorData as M, CRPC_ERROR_CODES_BY_KEY as N, inferApiInputs as O, CRPC_ERROR_CODE_TO_HTTP as P, HttpProcedureBuilder as Q, toCRPCError as R, createProcedureCallerFactory as S, getGeneratedFunctionReference as T, createGeneratedFunctionReference as U, createEnv as V, getGeneratedValue as W, createMiddlewareFactory as X, QueryProcedureBuilder as Y, initCRPC as Z, ProcedureSchedulableCallerFromRegistry as _, zodOutputToConvex as _t, CreateProcedureCallerFactoryOptions as a, CustomBuilder as at, createGenericCallerFactory as b, zodToConvexFields as bt, GeneratedRegistryCallerFactory as c, ZodFromValidatorBase as ct, GeneratedRegistryHandlerForContext as d, convexToZodFields as dt, extractPathParams as et, ProcedureActionCallerFromRegistry as f, withSystemFields as ft, ProcedureFromFunctionReference as g, zid as gt, ProcedureDefinition as h, zCustomQuery as ht, registerProcedureNameLookup as i, ConvexValidatorFromZodOutput as it, CRPCErrorCode as j, inferApiOutputs as k, GeneratedRegistryCallerForContext as l, ZodValidatorFromConvex as lt, ProcedureCallerFromRegistry as m, zCustomMutation as mt, ProcedureNameLookup as n, matchPathParams as nt, GeneratedProcedureRegistry as o, ZCustomCtx as ot, ProcedureCaller as p, zCustomAction as pt, MutationProcedureBuilder as q, inferProcedureNameFromCallsite as r, ConvexValidatorFromZod as rt, GeneratedProcedureRegistryEntry as s, Zid as st, ProcedureNameEntry as t, handleHttpError as tt, GeneratedRegistryHandlerFactory as u, convexToZod as ut, ProcedureScheduleCallerFromRegistry as v, zodOutputToConvexFields as vt, defineProcedure as w, createGenericHandlerFactory as x, createGeneratedRegistryRuntime as y, zodToConvex as yt, CreateEnvOptions as z };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { o as MiddlewareBuilder } from "../types-
|
|
2
|
-
import { t as Plugin } from "../middleware-
|
|
1
|
+
import { o as MiddlewareBuilder } from "../types-CzGsrLrY.js";
|
|
2
|
+
import { t as Plugin } from "../middleware-D2hKJuSZ.js";
|
|
3
3
|
import * as convex_server0 from "convex/server";
|
|
4
4
|
|
|
5
5
|
//#region src/ratelimit/duration.d.ts
|
package/dist/ratelimit/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { u as requireMutationCtx } from "../api-entry-Buvjl9hn.js";
|
|
2
|
-
import { _ as CRPCError } from "../builder-
|
|
3
|
-
import { t as definePlugin } from "../middleware-
|
|
2
|
+
import { _ as CRPCError } from "../builder-DDYTlmTB.js";
|
|
3
|
+
import { t as definePlugin } from "../middleware-LvZov-hA.js";
|
|
4
4
|
import { v } from "convex/values";
|
|
5
5
|
import { mutationGeneric, queryGeneric } from "convex/server";
|
|
6
6
|
|
package/dist/react/index.d.ts
CHANGED
|
@@ -487,8 +487,8 @@ type ConvexQueryHookOptions = {
|
|
|
487
487
|
/** Skip query silently when unauthenticated (default: false, calls onQueryUnauthorized) */skipUnauth?: boolean; /** Set to false to fetch once without subscribing (default: true) */
|
|
488
488
|
subscribe?: boolean;
|
|
489
489
|
};
|
|
490
|
-
/** Extract
|
|
491
|
-
type InfiniteQueryInput<TInput> = Omit<TInput, 'cursor' | 'limit'>;
|
|
490
|
+
/** Extract user args without hook-owned pagination transport fields */
|
|
491
|
+
type InfiniteQueryInput<TInput> = Omit<TInput, 'cursor' | 'endCursor' | 'limit'>;
|
|
492
492
|
/** Extract item type from PaginationResult<T> */
|
|
493
493
|
type ExtractPaginatedItem<TOutput> = TOutput extends {
|
|
494
494
|
page: (infer T)[];
|
|
@@ -946,7 +946,7 @@ declare const getConvexQueryClientSingleton: ({
|
|
|
946
946
|
* Pagination state persisted in queryClient.
|
|
947
947
|
* Enables scroll restoration when navigating back to a paginated list.
|
|
948
948
|
*
|
|
949
|
-
* Uses flat { cursor, limit } structure like tRPC.
|
|
949
|
+
* Uses flat { cursor, endCursor, limit } structure like tRPC.
|
|
950
950
|
*/
|
|
951
951
|
type PaginationState = {
|
|
952
952
|
id: number;
|
|
@@ -955,13 +955,12 @@ type PaginationState = {
|
|
|
955
955
|
queries: Record<number, {
|
|
956
956
|
/** Flat pagination args - tRPC style */args: Record<string, unknown> & {
|
|
957
957
|
cursor: string | null;
|
|
958
|
+
endCursor?: string | null;
|
|
958
959
|
limit?: number; /** Internal pagination ID for subscription management */
|
|
959
960
|
__paginationId?: number;
|
|
960
961
|
};
|
|
961
|
-
endCursor?: string | null;
|
|
962
962
|
}>;
|
|
963
|
-
version: number;
|
|
964
|
-
autoRecoveryAttempted?: string;
|
|
963
|
+
version: number;
|
|
965
964
|
};
|
|
966
965
|
type PaginationStatus = 'CanLoadMore' | 'Exhausted' | 'LoadingFirstPage' | 'LoadingMore';
|
|
967
966
|
/** Fields we override or omit from TanStack Query's UseQueryResult */
|
package/dist/react/index.js
CHANGED
|
@@ -2432,6 +2432,12 @@ const getConvexQueryClientSingleton = ({ authStore, convex, queryClient, symbolK
|
|
|
2432
2432
|
//#endregion
|
|
2433
2433
|
//#region src/internal/pagination.ts
|
|
2434
2434
|
const shouldSplitPaginationPage = (page, initialNumItems) => Boolean(page.splitCursor) && (page.pageStatus === "SplitRecommended" || page.pageStatus === "SplitRequired" || initialNumItems !== void 0 && page.page.length > initialNumItems * 2);
|
|
2435
|
+
const isInvalidPaginationCursor = (error) => {
|
|
2436
|
+
if (error instanceof Error && error.message.includes("InvalidCursor")) return true;
|
|
2437
|
+
if (!error || typeof error !== "object" || !("data" in error)) return false;
|
|
2438
|
+
const data = error.data;
|
|
2439
|
+
return Boolean(data && typeof data === "object" && "isConvexSystemError" in data && data.isConvexSystemError === true && "paginationError" in data && data.paginationError === "InvalidCursor");
|
|
2440
|
+
};
|
|
2435
2441
|
|
|
2436
2442
|
//#endregion
|
|
2437
2443
|
//#region src/react/use-infinite-query.ts
|
|
@@ -2439,76 +2445,22 @@ const shouldSplitPaginationPage = (page, initialNumItems) => Boolean(page.splitC
|
|
|
2439
2445
|
const PAGINATION_KEY_PREFIX = "__pagination__";
|
|
2440
2446
|
let paginationIdCounter = 0;
|
|
2441
2447
|
const createPaginationId = () => ++paginationIdCounter;
|
|
2442
|
-
/** Build a unique key for recovery attempt detection */
|
|
2443
|
-
const buildRecoveryKey = (pageKeys, page0Cursor, page0UpdatedAt) => JSON.stringify({
|
|
2444
|
-
pageKeys,
|
|
2445
|
-
page0Cursor,
|
|
2446
|
-
page0UpdatedAt
|
|
2447
|
-
});
|
|
2448
2448
|
/**
|
|
2449
2449
|
* Hook for auto-recovering from stale cursors after WebSocket reconnection.
|
|
2450
2450
|
*
|
|
2451
2451
|
* When Convex WebSocket reconnects, page 0 (cursor: null) resubscribes and
|
|
2452
2452
|
* gets fresh data. However, pages 1+ may have stale cursors that fail.
|
|
2453
2453
|
*
|
|
2454
|
-
* This hook
|
|
2455
|
-
* enough items to cover the lost pages, preserving the user's scroll position.
|
|
2454
|
+
* This hook discards the invalid cursor chain and restarts from page one.
|
|
2456
2455
|
*/
|
|
2457
|
-
const useStaleCursorRecovery = ({
|
|
2456
|
+
const useStaleCursorRecovery = ({ combined, resetPagination }) => {
|
|
2458
2457
|
useEffect(() => {
|
|
2459
2458
|
if (!combined.isFetchNextPageError) return;
|
|
2460
|
-
|
|
2461
|
-
const page0Data = page0Result?.data;
|
|
2462
|
-
const page0UpdatedAt = page0Result?.dataUpdatedAt ?? 0;
|
|
2463
|
-
const hasPage0Data = page0Data !== void 0 && !page0Result?.isError;
|
|
2464
|
-
const hasSubsequentErrors = combined._rawResults.slice(1).some((q) => q?.isError && !q?.isFetching);
|
|
2465
|
-
if (!hasPage0Data || !hasSubsequentErrors || !page0Data?.continueCursor) return;
|
|
2466
|
-
const recoveryKey = buildRecoveryKey(state.pageKeys, page0Data.continueCursor, page0UpdatedAt);
|
|
2467
|
-
if (state.autoRecoveryAttempted === recoveryKey) return;
|
|
2468
|
-
const erroredPageKeys = state.pageKeys.filter((_, i) => i > 0 && combined._rawResults[i]?.isError);
|
|
2469
|
-
const itemsToRecover = erroredPageKeys.reduce((sum, key) => {
|
|
2470
|
-
return sum + (state.queries[key]?.args?.limit ?? limit ?? 20);
|
|
2471
|
-
}, 0);
|
|
2472
|
-
console.warn("[Pagination] Auto-recovering from stale cursors", {
|
|
2473
|
-
erroredPages: erroredPageKeys.length,
|
|
2474
|
-
itemsToRecover
|
|
2475
|
-
});
|
|
2476
|
-
setState((prev) => ({
|
|
2477
|
-
...prev,
|
|
2478
|
-
id: prev.id,
|
|
2479
|
-
nextPageKey: 2,
|
|
2480
|
-
pageKeys: [prev.pageKeys[0], 1],
|
|
2481
|
-
queries: {
|
|
2482
|
-
[prev.pageKeys[0]]: prev.queries[prev.pageKeys[0]],
|
|
2483
|
-
1: { args: {
|
|
2484
|
-
...argsObject,
|
|
2485
|
-
cursor: page0Data.continueCursor,
|
|
2486
|
-
limit: Math.min(itemsToRecover + (limit ?? 20), 500),
|
|
2487
|
-
__paginationId: prev.id
|
|
2488
|
-
} }
|
|
2489
|
-
},
|
|
2490
|
-
version: prev.version + 1,
|
|
2491
|
-
autoRecoveryAttempted: recoveryKey
|
|
2492
|
-
}));
|
|
2459
|
+
if (combined._rawResults.slice(1).some((result) => result?.isError && !result.isFetching && isInvalidPaginationCursor(result.error))) resetPagination();
|
|
2493
2460
|
}, [
|
|
2494
2461
|
combined.isFetchNextPageError,
|
|
2495
2462
|
combined._rawResults,
|
|
2496
|
-
|
|
2497
|
-
state.queries,
|
|
2498
|
-
state.autoRecoveryAttempted,
|
|
2499
|
-
argsObject,
|
|
2500
|
-
limit,
|
|
2501
|
-
setState
|
|
2502
|
-
]);
|
|
2503
|
-
useEffect(() => {
|
|
2504
|
-
if ((combined.status === "CanLoadMore" || combined.status === "Exhausted") && state.autoRecoveryAttempted) setState((prev) => ({
|
|
2505
|
-
...prev,
|
|
2506
|
-
autoRecoveryAttempted: void 0
|
|
2507
|
-
}));
|
|
2508
|
-
}, [
|
|
2509
|
-
combined.status,
|
|
2510
|
-
state.autoRecoveryAttempted,
|
|
2511
|
-
setState
|
|
2463
|
+
resetPagination
|
|
2512
2464
|
]);
|
|
2513
2465
|
};
|
|
2514
2466
|
/**
|
|
@@ -2706,7 +2658,7 @@ const useInfiniteQueryInternal = (query, args, options) => {
|
|
|
2706
2658
|
error: results.find((r) => r.isError)?.error ?? null,
|
|
2707
2659
|
isError: results.some((r) => r.isError),
|
|
2708
2660
|
isFetching,
|
|
2709
|
-
isFetchNextPageError: results.
|
|
2661
|
+
isFetchNextPageError: results.slice(1).some((result) => result.isError),
|
|
2710
2662
|
isPlaceholderData,
|
|
2711
2663
|
isRefetching: isFetching && allItems.length > 0 && !isPlaceholderData,
|
|
2712
2664
|
_rawResults: results
|
|
@@ -2714,11 +2666,8 @@ const useInfiniteQueryInternal = (query, args, options) => {
|
|
|
2714
2666
|
}, [placeholderData])
|
|
2715
2667
|
});
|
|
2716
2668
|
useStaleCursorRecovery({
|
|
2717
|
-
argsObject,
|
|
2718
2669
|
combined,
|
|
2719
|
-
|
|
2720
|
-
setState,
|
|
2721
|
-
state
|
|
2670
|
+
resetPagination: useCallback(() => setState(createInitialState()), [createInitialState, setState])
|
|
2722
2671
|
});
|
|
2723
2672
|
useEffect(() => {
|
|
2724
2673
|
for (let i = 0; i < combined._rawResults.length; i++) {
|
|
@@ -2727,15 +2676,17 @@ const useInfiniteQueryInternal = (query, args, options) => {
|
|
|
2727
2676
|
const page = pageQuery.data;
|
|
2728
2677
|
const pageKey = state.pageKeys[i];
|
|
2729
2678
|
const pageState = state.queries[pageKey];
|
|
2730
|
-
if (shouldSplitPaginationPage(page, limit) && pageState &&
|
|
2679
|
+
if (shouldSplitPaginationPage(page, limit) && pageState && pageState.args.endCursor !== page.splitCursor) {
|
|
2731
2680
|
setState((prev) => {
|
|
2732
2681
|
const currentPageState = prev.queries[pageKey];
|
|
2733
|
-
if (!currentPageState || currentPageState.endCursor) return prev;
|
|
2682
|
+
if (!currentPageState || currentPageState.args.endCursor === page.splitCursor) return prev;
|
|
2734
2683
|
const newKey = prev.nextPageKey;
|
|
2735
2684
|
const splitCursor = page.splitCursor;
|
|
2685
|
+
const endCursor = currentPageState.args.endCursor ?? page.continueCursor;
|
|
2736
2686
|
const splitPageArgs = {
|
|
2737
2687
|
...argsObject,
|
|
2738
2688
|
cursor: splitCursor,
|
|
2689
|
+
endCursor,
|
|
2739
2690
|
limit: currentPageState.args.limit,
|
|
2740
2691
|
__paginationId: prev.id
|
|
2741
2692
|
};
|
|
@@ -2750,7 +2701,10 @@ const useInfiniteQueryInternal = (query, args, options) => {
|
|
|
2750
2701
|
...prev.queries,
|
|
2751
2702
|
[pageKey]: {
|
|
2752
2703
|
...currentPageState,
|
|
2753
|
-
|
|
2704
|
+
args: {
|
|
2705
|
+
...currentPageState.args,
|
|
2706
|
+
endCursor: splitCursor
|
|
2707
|
+
}
|
|
2754
2708
|
},
|
|
2755
2709
|
[newKey]: { args: splitPageArgs }
|
|
2756
2710
|
}
|
package/dist/rsc/index.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { n as DeepPartial, o as Simplify, r as DistributiveOmit } from "../types-Bqi_ivSd.js";
|
|
2
|
-
import {
|
|
3
|
-
import { g as UnsetMarker } from "../types-
|
|
4
|
-
import {
|
|
2
|
+
import { i as DataTransformerOptions } from "../transformer-BEkxlnss.js";
|
|
3
|
+
import { g as UnsetMarker } from "../types-CzGsrLrY.js";
|
|
4
|
+
import { _ as CRPCHttpRouter, c as HttpQueryKey, k as HttpProcedure, o as HttpMutationKey, y as HttpRouterRecord } from "../http-types-8FBr10yl.js";
|
|
5
|
+
import { A as HttpInputArgs, C as ReservedMutationOptions$1, S as ReservedInfiniteQueryOptions, T as StaticQueryOptsParam, _ as IsPaginated, b as PaginatedFnMeta, c as ConvexMutationKey, d as ConvexQueryMeta, f as EmptyObject, g as InfiniteQueryInput, l as ConvexQueryHookOptions, m as FUNC_REF_SYMBOL, o as ConvexActionKey, p as ExtractPaginatedItem, s as ConvexInfiniteQueryMeta, u as ConvexQueryKey, w as ReservedQueryOptions$1, y as MutationVariables } from "../types-Cl0utsTL.js";
|
|
5
6
|
import { FunctionArgs, FunctionReference, FunctionReturnType } from "convex/server";
|
|
6
7
|
import { z } from "zod";
|
|
7
8
|
import { DefaultError, QueryFilters, SkipToken, UseMutationOptions, UseQueryOptions } from "@tanstack/react-query";
|
package/dist/server/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { A as
|
|
3
|
-
import { a as MergeZodObjects, c as MiddlewareMarker, d as MiddlewareProcedureType, f as MiddlewareResult, g as UnsetMarker, h as Simplify, i as IntersectIfDefined, l as MiddlewareNext, m as ResolveIfSet, n as AnyMiddlewareBuilder, o as MiddlewareBuilder, p as Overwrite, r as GetRawInputFn, s as MiddlewareFunction, t as AnyMiddleware, u as MiddlewareProcedureInfo } from "../types-
|
|
4
|
-
import {
|
|
1
|
+
import { a as CallerMeta, c as createServerCaller, i as createLazyCaller, n as createCallerFactory, o as CallerOpts, r as LazyCaller, s as ServerCaller, t as ConvexContext } from "../caller-factory-C3pcbzo0.js";
|
|
2
|
+
import { $ as createHttpProcedureBuilder, A as CRPCError, B as RuntimeEnv, C as createProcedureHandlerFactory, D as WithHttpRouter, E as typedProcedureResolver, F as getCRPCErrorFromUnknown, G as ActionProcedureBuilder, H as createApiLeaf, I as getHTTPStatusCodeFromError, J as ProcedureBuilder, K as CRPCFunctionTypeHint, L as isCRPCError, M as CRPCErrorData, N as CRPC_ERROR_CODES_BY_KEY, O as inferApiInputs, P as CRPC_ERROR_CODE_TO_HTTP, Q as HttpProcedureBuilder, R as toCRPCError, S as createProcedureCallerFactory, T as getGeneratedFunctionReference, U as createGeneratedFunctionReference, V as createEnv, W as getGeneratedValue, X as createMiddlewareFactory, Y as QueryProcedureBuilder, Z as initCRPC, _ as ProcedureSchedulableCallerFromRegistry, _t as zodOutputToConvex, a as CreateProcedureCallerFactoryOptions, at as CustomBuilder, b as createGenericCallerFactory, bt as zodToConvexFields, c as GeneratedRegistryCallerFactory, ct as ZodFromValidatorBase, d as GeneratedRegistryHandlerForContext, dt as convexToZodFields, et as extractPathParams, f as ProcedureActionCallerFromRegistry, ft as withSystemFields, g as ProcedureFromFunctionReference, gt as zid, h as ProcedureDefinition, ht as zCustomQuery, i as registerProcedureNameLookup, it as ConvexValidatorFromZodOutput, j as CRPCErrorCode, k as inferApiOutputs, l as GeneratedRegistryCallerForContext, lt as ZodValidatorFromConvex, m as ProcedureCallerFromRegistry, mt as zCustomMutation, n as ProcedureNameLookup, nt as matchPathParams, o as GeneratedProcedureRegistry, ot as ZCustomCtx, p as ProcedureCaller, pt as zCustomAction, q as MutationProcedureBuilder, r as inferProcedureNameFromCallsite, rt as ConvexValidatorFromZod, s as GeneratedProcedureRegistryEntry, st as Zid, t as ProcedureNameEntry, tt as handleHttpError, u as GeneratedRegistryHandlerFactory, ut as convexToZod, v as ProcedureScheduleCallerFromRegistry, vt as zodOutputToConvexFields, w as defineProcedure, x as createGenericHandlerFactory, y as createGeneratedRegistryRuntime, yt as zodToConvex, z as CreateEnvOptions } from "../procedure-name-kn-awLk1.js";
|
|
3
|
+
import { a as MergeZodObjects, c as MiddlewareMarker, d as MiddlewareProcedureType, f as MiddlewareResult, g as UnsetMarker, h as Simplify, i as IntersectIfDefined, l as MiddlewareNext, m as ResolveIfSet, n as AnyMiddlewareBuilder, o as MiddlewareBuilder, p as Overwrite, r as GetRawInputFn, s as MiddlewareFunction, t as AnyMiddleware, u as MiddlewareProcedureInfo } from "../types-CzGsrLrY.js";
|
|
4
|
+
import { A as HttpProcedureBuilderDef, C as extractRouteMap, D as HttpHandlerOpts, E as HttpActionHandler, M as InferHttpInput, N as ProcedureMeta, O as HttpMethod, S as createHttpRouterFactory, T as HttpActionConstructor, _ as CRPCHttpRouter, b as HttpRouterWithHono, j as HttpRouteDefinition, k as HttpProcedure, v as HttpRouterDef, w as CRPCHonoHandler, x as createHttpRouter, y as HttpRouterRecord } from "../http-types-8FBr10yl.js";
|
|
5
|
+
import { a as isMutationCtx, c as isSchedulerCtx, d as requireQueryCtx, f as requireRunMutationCtx, i as isActionCtx, l as requireActionCtx, n as RunMutationCtx, o as isQueryCtx, p as requireSchedulerCtx, r as SchedulerCtx, s as isRunMutationCtx, t as GenericCtx, u as requireMutationCtx } from "../context-utils-ax351iFc.js";
|
|
5
6
|
export { ActionProcedureBuilder, AnyMiddleware, AnyMiddlewareBuilder, CRPCError, CRPCErrorCode, CRPCErrorData, CRPCFunctionTypeHint, CRPCHonoHandler, CRPCHttpRouter, CRPC_ERROR_CODES_BY_KEY, CRPC_ERROR_CODE_TO_HTTP, CallerMeta, CallerOpts, ConvexContext, ConvexValidatorFromZod, ConvexValidatorFromZodOutput, CreateEnvOptions, CreateProcedureCallerFactoryOptions, CustomBuilder, GeneratedProcedureRegistry, GeneratedProcedureRegistryEntry, GeneratedRegistryCallerFactory, GeneratedRegistryCallerForContext, GeneratedRegistryHandlerFactory, GeneratedRegistryHandlerForContext, GenericCtx, GetRawInputFn, HttpActionConstructor, HttpActionHandler, HttpHandlerOpts, HttpMethod, HttpProcedure, HttpProcedureBuilder, HttpProcedureBuilderDef, HttpRouteDefinition, HttpRouterDef, HttpRouterRecord, HttpRouterWithHono, InferHttpInput, IntersectIfDefined, LazyCaller, MergeZodObjects, MiddlewareBuilder, MiddlewareFunction, MiddlewareMarker, MiddlewareNext, MiddlewareProcedureInfo, MiddlewareProcedureType, MiddlewareResult, MutationProcedureBuilder, Overwrite, ProcedureActionCallerFromRegistry, ProcedureBuilder, ProcedureCaller, ProcedureCallerFromRegistry, ProcedureDefinition, ProcedureFromFunctionReference, ProcedureMeta, ProcedureNameEntry, ProcedureNameLookup, ProcedureSchedulableCallerFromRegistry, ProcedureScheduleCallerFromRegistry, QueryProcedureBuilder, ResolveIfSet, RunMutationCtx, RuntimeEnv, SchedulerCtx, ServerCaller, Simplify, UnsetMarker, WithHttpRouter, ZCustomCtx, Zid, ZodFromValidatorBase, ZodValidatorFromConvex, convexToZod, convexToZodFields, createApiLeaf, createCallerFactory, createEnv, createGeneratedFunctionReference, createGeneratedRegistryRuntime, createGenericCallerFactory, createGenericHandlerFactory, createHttpProcedureBuilder, createHttpRouter, createHttpRouterFactory, createLazyCaller, createMiddlewareFactory, createProcedureCallerFactory, createProcedureHandlerFactory, createServerCaller, defineProcedure, extractPathParams, extractRouteMap, getCRPCErrorFromUnknown, getGeneratedFunctionReference, getGeneratedValue, getHTTPStatusCodeFromError, handleHttpError, inferApiInputs, inferApiOutputs, inferProcedureNameFromCallsite, initCRPC, isActionCtx, isCRPCError, isMutationCtx, isQueryCtx, isRunMutationCtx, isSchedulerCtx, matchPathParams, registerProcedureNameLookup, requireActionCtx, requireMutationCtx, requireQueryCtx, requireRunMutationCtx, requireSchedulerCtx, toCRPCError, typedProcedureResolver, withSystemFields, zCustomAction, zCustomMutation, zCustomQuery, zid, zodOutputToConvex, zodOutputToConvexFields, zodToConvex, zodToConvexFields };
|