@gaganref/confect-server 10.3.1-fork.3 → 10.3.1-fork.30
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/ActionCall.d.ts +30 -0
- package/dist/ActionCall.d.ts.map +1 -0
- package/dist/ActionCall.js +41 -0
- package/dist/ActionCall.js.map +1 -0
- package/dist/ActionCtx.d.ts +1 -1
- package/dist/ActionCtx.d.ts.map +1 -1
- package/dist/ActionCtx.js.map +1 -1
- package/dist/ActionRunner.js +2 -2
- package/dist/AiGatewayDecisionClient.d.ts +2 -2
- package/dist/AiGatewayDecisionClient.d.ts.map +1 -1
- package/dist/AiGatewayDecisionClient.js +1 -1
- package/dist/AiGatewayDecisionClient.js.map +1 -1
- package/dist/AiGatewayLanguageClient.d.ts +2 -2
- package/dist/AiGatewayLanguageClient.d.ts.map +1 -1
- package/dist/AiGatewayLanguageClient.js +1 -1
- package/dist/AiGatewayLanguageClient.js.map +1 -1
- package/dist/Auth.d.ts +1 -1
- package/dist/Auth.d.ts.map +1 -1
- package/dist/Auth.js +1 -1
- package/dist/Auth.js.map +1 -1
- package/dist/Callback.js +3 -3
- package/dist/ComponentCtx.d.ts +1 -1
- package/dist/ComponentCtx.d.ts.map +1 -1
- package/dist/ConvexConfigProvider.js +2 -2
- package/dist/ConvexFunctionDefinitions.d.ts +4 -4
- package/dist/ConvexFunctionDefinitions.d.ts.map +1 -1
- package/dist/ConvexFunctionDefinitions.js +2 -2
- package/dist/ConvexFunctionDefinitions.js.map +1 -1
- package/dist/ConvexLogger.js +1 -1
- package/dist/CronJobs.d.ts +1 -1
- package/dist/CronJobs.d.ts.map +1 -1
- package/dist/CronJobs.js +6 -6
- package/dist/CronJobs.js.map +1 -1
- package/dist/DataModel.d.ts +3 -3
- package/dist/DataModel.d.ts.map +1 -1
- package/dist/DataModel.js.map +1 -1
- package/dist/DatabaseReader.d.ts +4 -4
- package/dist/DatabaseReader.d.ts.map +1 -1
- package/dist/DatabaseReader.js.map +1 -1
- package/dist/DatabaseSchema.d.ts +1 -1
- package/dist/DatabaseSchema.d.ts.map +1 -1
- package/dist/DatabaseSchema.js +2 -2
- package/dist/DatabaseSchema.js.map +1 -1
- package/dist/DatabaseWriter.d.ts +41 -7
- package/dist/DatabaseWriter.d.ts.map +1 -1
- package/dist/DatabaseWriter.js +55 -8
- package/dist/DatabaseWriter.js.map +1 -1
- package/dist/Document.d.ts +4 -4
- package/dist/Document.d.ts.map +1 -1
- package/dist/Document.js.map +1 -1
- package/dist/ExecutionMetadata.js +1 -1
- package/dist/FunctionImpl.d.ts +2 -2
- package/dist/FunctionImpl.d.ts.map +1 -1
- package/dist/FunctionImpl.js +2 -2
- package/dist/FunctionImpl.js.map +1 -1
- package/dist/FunctionRegistryItem.d.ts +1 -1
- package/dist/FunctionRegistryItem.d.ts.map +1 -1
- package/dist/FunctionRegistryItem.js +1 -1
- package/dist/FunctionRegistryItem.js.map +1 -1
- package/dist/GroupImpl.d.ts +24 -5
- package/dist/GroupImpl.d.ts.map +1 -1
- package/dist/GroupImpl.js +21 -22
- package/dist/GroupImpl.js.map +1 -1
- package/dist/GroupRegistry.d.ts +2 -2
- package/dist/GroupRegistry.d.ts.map +1 -1
- package/dist/GroupRegistry.js.map +1 -1
- package/dist/Handler.d.ts +30 -26
- package/dist/Handler.d.ts.map +1 -1
- package/dist/Handler.js.map +1 -1
- package/dist/HttpRouter.d.ts +13 -13
- package/dist/HttpRouter.d.ts.map +1 -1
- package/dist/HttpRouter.js +2 -2
- package/dist/HttpRouter.js.map +1 -1
- package/dist/MiddlewareImpl.d.ts +14 -14
- package/dist/MiddlewareImpl.d.ts.map +1 -1
- package/dist/MiddlewareImpl.js +1 -1
- package/dist/MiddlewareImpl.js.map +1 -1
- package/dist/MutationCtx.d.ts +1 -1
- package/dist/MutationCtx.d.ts.map +1 -1
- package/dist/MutationCtx.js.map +1 -1
- package/dist/MutationRunner.d.ts +1 -1
- package/dist/MutationRunner.d.ts.map +1 -1
- package/dist/MutationRunner.js +2 -2
- package/dist/MutationRunner.js.map +1 -1
- package/dist/MutationTransactionContext.d.ts +2 -2
- package/dist/MutationTransactionContext.d.ts.map +1 -1
- package/dist/MutationTransactionContext.js +2 -2
- package/dist/MutationTransactionContext.js.map +1 -1
- package/dist/OfficialComponent.d.ts +50 -0
- package/dist/OfficialComponent.d.ts.map +1 -0
- package/dist/OfficialComponent.js +70 -0
- package/dist/OfficialComponent.js.map +1 -0
- package/dist/OrderedQuery.d.ts +4 -4
- package/dist/OrderedQuery.d.ts.map +1 -1
- package/dist/OrderedQuery.js.map +1 -1
- package/dist/QueryCtx.d.ts +1 -1
- package/dist/QueryCtx.d.ts.map +1 -1
- package/dist/QueryCtx.js.map +1 -1
- package/dist/QueryInitializer.d.ts +10 -10
- package/dist/QueryInitializer.d.ts.map +1 -1
- package/dist/QueryInitializer.js +2 -2
- package/dist/QueryInitializer.js.map +1 -1
- package/dist/QueryRunner.d.ts +2 -2
- package/dist/QueryRunner.d.ts.map +1 -1
- package/dist/QueryRunner.js +2 -2
- package/dist/QueryRunner.js.map +1 -1
- package/dist/QueryStream.d.ts +86 -13
- package/dist/QueryStream.d.ts.map +1 -1
- package/dist/QueryStream.js +81 -8
- package/dist/QueryStream.js.map +1 -1
- package/dist/QueryStreamCursor.d.ts +2 -2
- package/dist/QueryStreamCursor.d.ts.map +1 -1
- package/dist/QueryStreamCursor.js +1 -1
- package/dist/QueryStreamCursor.js.map +1 -1
- package/dist/QueryStreamIndexPrefix.d.ts +2 -2
- package/dist/QueryStreamIndexPrefix.d.ts.map +1 -1
- package/dist/QueryStreamIndexPrefix.js +1 -1
- package/dist/QueryStreamIndexPrefix.js.map +1 -1
- package/dist/QueryStreamIndexRange.d.ts +4 -4
- package/dist/QueryStreamIndexRange.d.ts.map +1 -1
- package/dist/QueryStreamIndexRange.js +2 -2
- package/dist/QueryStreamIndexRange.js.map +1 -1
- package/dist/QueryStreamKey.d.ts +2 -2
- package/dist/QueryStreamKey.d.ts.map +1 -1
- package/dist/QueryStreamKey.js +1 -1
- package/dist/QueryStreamKey.js.map +1 -1
- package/dist/QueryStreamKeyBounds.d.ts +3 -3
- package/dist/QueryStreamKeyBounds.d.ts.map +1 -1
- package/dist/QueryStreamKeyBounds.js +2 -2
- package/dist/QueryStreamKeyBounds.js.map +1 -1
- package/dist/QueryStreamKeyLayout.d.ts +1 -1
- package/dist/QueryStreamKeyLayout.d.ts.map +1 -1
- package/dist/QueryStreamKeyLayout.js +2 -2
- package/dist/QueryStreamKeyLayout.js.map +1 -1
- package/dist/QueryStreamKeyValues.d.ts +1 -1
- package/dist/QueryStreamKeyValues.d.ts.map +1 -1
- package/dist/QueryStreamKeyValues.js +1 -1
- package/dist/QueryStreamKeyValues.js.map +1 -1
- package/dist/QueryStreamPagination.d.ts +1 -1
- package/dist/QueryStreamPagination.d.ts.map +1 -1
- package/dist/QueryStreamPagination.js +1 -1
- package/dist/QueryStreamPagination.js.map +1 -1
- package/dist/QueryStreamReadBudget.d.ts +3 -2
- package/dist/QueryStreamReadBudget.d.ts.map +1 -1
- package/dist/QueryStreamReadBudget.js +6 -3
- package/dist/QueryStreamReadBudget.js.map +1 -1
- package/dist/QueryTransactionContext.js +2 -2
- package/dist/RegisteredConvexFunction.d.ts +20 -20
- package/dist/RegisteredConvexFunction.d.ts.map +1 -1
- package/dist/RegisteredConvexFunction.js +19 -19
- package/dist/RegisteredConvexFunction.js.map +1 -1
- package/dist/RegisteredFunction.d.ts +26 -26
- package/dist/RegisteredFunction.d.ts.map +1 -1
- package/dist/RegisteredFunction.js +55 -13
- package/dist/RegisteredFunction.js.map +1 -1
- package/dist/RegisteredFunctions.d.ts +3 -3
- package/dist/RegisteredFunctions.d.ts.map +1 -1
- package/dist/RegisteredFunctions.js.map +1 -1
- package/dist/RegisteredNodeFunction.d.ts +6 -6
- package/dist/RegisteredNodeFunction.d.ts.map +1 -1
- package/dist/RegisteredNodeFunction.js +1 -1
- package/dist/RegisteredNodeFunction.js.map +1 -1
- package/dist/Registry.d.ts +1 -1
- package/dist/Registry.d.ts.map +1 -1
- package/dist/Registry.js.map +1 -1
- package/dist/RegistryItems.d.ts +7 -0
- package/dist/RegistryItems.d.ts.map +1 -1
- package/dist/RegistryItems.js +8 -3
- package/dist/RegistryItems.js.map +1 -1
- package/dist/RequestMetadata.js +1 -1
- package/dist/ResolvedMiddleware.d.ts +2 -2
- package/dist/ResolvedMiddleware.d.ts.map +1 -1
- package/dist/ResolvedMiddleware.js.map +1 -1
- package/dist/Scheduler.js +2 -2
- package/dist/Storage.d.ts +6 -6
- package/dist/Storage.d.ts.map +1 -1
- package/dist/Storage.js +1 -1
- package/dist/Storage.js.map +1 -1
- package/dist/StorageActionWriter.d.ts +1 -1
- package/dist/StorageActionWriter.d.ts.map +1 -1
- package/dist/StorageActionWriter.js +1 -1
- package/dist/StorageActionWriter.js.map +1 -1
- package/dist/StorageReader.d.ts +1 -1
- package/dist/StorageReader.d.ts.map +1 -1
- package/dist/StorageReader.js +1 -1
- package/dist/StorageReader.js.map +1 -1
- package/dist/StorageWriter.d.ts +1 -1
- package/dist/StorageWriter.d.ts.map +1 -1
- package/dist/StorageWriter.js +1 -1
- package/dist/StorageWriter.js.map +1 -1
- package/dist/TableInfo.d.ts +2 -2
- package/dist/TableInfo.d.ts.map +1 -1
- package/dist/TableInfo.js.map +1 -1
- package/dist/TransactionMetadata.js +1 -1
- package/dist/VectorSearch.d.ts +1 -1
- package/dist/VectorSearch.d.ts.map +1 -1
- package/dist/VectorSearch.js +1 -1
- package/dist/VectorSearch.js.map +1 -1
- package/dist/index.d.ts +62 -60
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +11 -9
- package/dist/internal/AiGatewayDecisionClient.d.ts +1 -1
- package/dist/internal/AiGatewayDecisionClient.d.ts.map +1 -1
- package/dist/internal/AiGatewayDecisionClient.js +1 -1
- package/dist/internal/AiGatewayDecisionClient.js.map +1 -1
- package/dist/internal/AiGatewayLanguageClient.d.ts +1 -1
- package/dist/internal/AiGatewayLanguageClient.d.ts.map +1 -1
- package/dist/internal/AiGatewayLanguageClient.js +1 -1
- package/dist/internal/AiGatewayLanguageClient.js.map +1 -1
- package/dist/internal/AiGatewayServiceToken.js +1 -1
- package/dist/internal/DocumentPatch.d.ts +16 -0
- package/dist/internal/DocumentPatch.d.ts.map +1 -0
- package/dist/internal/DocumentPatch.js +36 -0
- package/dist/internal/DocumentPatch.js.map +1 -0
- package/dist/node.d.ts +1 -1
- package/dist/node.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/ActionCall.ts +82 -0
- package/src/ActionCtx.ts +1 -1
- package/src/AiGatewayDecisionClient.ts +3 -3
- package/src/AiGatewayLanguageClient.ts +3 -3
- package/src/Auth.ts +1 -1
- package/src/ComponentCtx.ts +1 -1
- package/src/ConvexFunctionDefinitions.ts +8 -8
- package/src/CronJobs.ts +1 -1
- package/src/DataModel.ts +3 -3
- package/src/DatabaseReader.ts +4 -4
- package/src/DatabaseSchema.ts +1 -1
- package/src/DatabaseWriter.ts +189 -31
- package/src/Document.ts +4 -4
- package/src/FunctionImpl.ts +5 -5
- package/src/FunctionRegistryItem.ts +1 -1
- package/src/GroupImpl.ts +66 -13
- package/src/GroupRegistry.ts +4 -4
- package/src/Handler.ts +43 -28
- package/src/HttpRouter.ts +17 -17
- package/src/MiddlewareImpl.ts +17 -17
- package/src/MutationCtx.ts +1 -1
- package/src/MutationRunner.ts +1 -1
- package/src/MutationTransactionContext.ts +2 -2
- package/src/OfficialComponent.ts +151 -0
- package/src/OrderedQuery.ts +4 -4
- package/src/QueryCtx.ts +1 -1
- package/src/QueryInitializer.ts +9 -9
- package/src/QueryRunner.ts +2 -2
- package/src/QueryStream.ts +212 -20
- package/src/QueryStreamCursor.ts +3 -3
- package/src/QueryStreamIndexPrefix.ts +2 -2
- package/src/QueryStreamIndexRange.ts +4 -4
- package/src/QueryStreamKey.ts +2 -2
- package/src/QueryStreamKeyBounds.ts +3 -3
- package/src/QueryStreamKeyLayout.ts +1 -1
- package/src/QueryStreamKeyValues.ts +1 -1
- package/src/QueryStreamPagination.ts +2 -2
- package/src/QueryStreamReadBudget.ts +19 -6
- package/src/RegisteredConvexFunction.ts +21 -21
- package/src/RegisteredFunction.ts +72 -19
- package/src/RegisteredFunctions.ts +4 -4
- package/src/RegisteredNodeFunction.ts +8 -8
- package/src/Registry.ts +1 -1
- package/src/RegistryItems.ts +33 -2
- package/src/ResolvedMiddleware.ts +2 -2
- package/src/Storage.ts +3 -3
- package/src/StorageActionWriter.ts +1 -1
- package/src/StorageReader.ts +1 -1
- package/src/StorageWriter.ts +1 -1
- package/src/TableInfo.ts +2 -2
- package/src/VectorSearch.ts +1 -1
- package/src/index.ts +62 -60
- package/src/internal/AiGatewayDecisionClient.ts +2 -2
- package/src/internal/AiGatewayLanguageClient.ts +2 -2
- package/src/internal/DocumentPatch.ts +87 -0
- package/src/node.ts +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"QueryInitializer.js","names":["Document.decode","OrderedQuery.make","QueryStreamIndexRange.builder","QueryStream.fromReflection","Document.documentErrorMessage"],"sources":["../src/QueryInitializer.ts"],"sourcesContent":["import type * as IdScope from \"@confect/core/IdScope\";\nimport type {\n OrderedQuery as ConvexOrderedQuery,\n QueryInitializer as ConvexQueryInitializer,\n DocumentByInfo,\n GenericTableIndexes,\n Indexes,\n IndexRange,\n IndexRangeBuilder,\n NamedIndex,\n NamedSearchIndex,\n NamedTableInfo,\n Query,\n SearchFilter,\n SearchFilterBuilder,\n SearchIndexes,\n} from \"convex/server\";\nimport type { GenericId } from \"convex/values\";\nimport { pipe } from \"effect/Function\";\nimport * as Array from \"effect/Array\";\nimport * as Effect from \"effect/Effect\";\nimport * as Option from \"effect/Option\";\nimport * as Predicate from \"effect/Predicate\";\nimport type { ReadonlyRecord } from \"effect/Record\";\nimport * as Result from \"effect/Result\";\nimport * as Schema from \"effect/Schema\";\nimport type {\n BaseDatabaseReader,\n IndexFieldTypesForEq,\n} from \"@confect/core/Types\";\nimport type * as DataModel from \"./DataModel\";\nimport type * as DatabaseSchema from \"./DatabaseSchema\";\nimport * as Document from \"./Document\";\nimport * as OrderedQuery from \"./OrderedQuery\";\nimport * as QueryStream from \"./QueryStream\";\nimport type * as QueryStreamKeyLabels from \"./QueryStreamKeyLabels\";\nimport * as QueryStreamIndexRange from \"./QueryStreamIndexRange\";\nimport type { QueryStreamOrderDirection as OrderDirection } from \"./QueryStreamOrderDirection\";\nimport type * as Table from \"./Table\";\n\ntype ConvexTableInfoFor<\n DataModel_ extends DataModel.AnyWithProps,\n TableName extends DataModel.TableNames<DataModel_>,\n> = DataModel.TableInfoWithName<DataModel_, TableName>;\n\ntype TableInfoFor<\n DataModel_ extends DataModel.AnyWithProps,\n TableName extends DataModel.TableNames<DataModel_>,\n> = DataModel.TableInfoWithName_<DataModel_, TableName>;\n\nexport interface QueryInitializer<\n DataModel_ extends DataModel.AnyWithProps,\n TableName extends DataModel.TableNames<DataModel_>,\n Doc = DataModel.DocumentWithName<DataModel_, TableName>,\n TargetKind extends DatabaseSchema.Target[\"kind\"] = \"app\",\n> {\n readonly get: {\n (\n id: DataModel.Id<DataModel_, TableName>,\n ): Effect.Effect<Doc, Document.DocumentDecodeError | GetByIdFailure>;\n <\n IndexName extends keyof Indexes<\n ConvexTableInfoFor<DataModel_, TableName>\n >,\n >(\n indexName: IndexName,\n ...indexFieldValues: IndexFieldTypesForEq<\n DataModel.ToConvex<DataModel_>,\n TableName,\n Indexes<ConvexTableInfoFor<DataModel_, TableName>>[IndexName]\n >\n ): Effect.Effect<Doc, Document.DocumentDecodeError | GetByIndexFailure>;\n };\n readonly index: {\n <\n IndexName extends keyof Indexes<\n ConvexTableInfoFor<DataModel_, TableName>\n >,\n >(\n indexName: IndexName,\n indexRange?: (\n q: IndexRangeBuilder<\n TableInfoFor<DataModel_, TableName>[\"convexDocument\"],\n NamedIndex<ConvexTableInfoFor<DataModel_, TableName>, IndexName>\n >,\n ) => IndexRange,\n order?: OrderDirection,\n ): OrderedQuery.OrderedQuery<\n TableInfoFor<DataModel_, TableName>,\n Doc,\n TargetKind\n >;\n <\n IndexName extends keyof Indexes<\n ConvexTableInfoFor<DataModel_, TableName>\n >,\n >(\n indexName: IndexName,\n order?: OrderDirection,\n ): OrderedQuery.OrderedQuery<\n TableInfoFor<DataModel_, TableName>,\n Doc,\n TargetKind\n >;\n };\n readonly search: <\n IndexName extends keyof SearchIndexes<\n ConvexTableInfoFor<DataModel_, TableName>\n >,\n >(\n indexName: IndexName,\n searchFilter: (\n q: SearchFilterBuilder<\n DocumentByInfo<ConvexTableInfoFor<DataModel_, TableName>>,\n NamedSearchIndex<ConvexTableInfoFor<DataModel_, TableName>, IndexName>\n >,\n ) => SearchFilter,\n ) => OrderedQuery.OrderedQuery<\n TableInfoFor<DataModel_, TableName>,\n Doc,\n TargetKind\n >;\n /**\n * EXPERIMENTAL—stream-first querying (see `notes/stream-based-querying.md`).\n *\n * Like `index`, but returns a {@link QueryStream.QueryStream}: a genuine\n * Effect `Stream` of documents in index order that stays mergeable and\n * paginable.\n *\n * In SQL terms: an index range scan—`SELECT * FROM table WHERE <range> ORDER\n * BY <index fields> [DESC]`; `eq` calls are the equality predicates, the\n * bound calls are the range predicates. The value is a reusable description\n * of a query: each run re-runs the index query. * The typed range builder\n * consumes `eq`-pinned fields from the index's field tuple at the type level,\n * so the stream's visible label type is exactly the fields that still vary\n * (the `ORDER BY` columns left after the equality predicates). The order\n * direction is part of the type too: omitted, it is `\"asc\"`; a literal is\n * tracked as that literal, and a value known only at runtime as the union.\n * The order parameter is either absent or a direction—never `undefined`—so\n * the type can't claim a literal the runtime default would contradict.\n */\n readonly stream: {\n <\n IndexName extends keyof Indexes<\n ConvexTableInfoFor<DataModel_, TableName>\n > &\n string,\n Range extends QueryStreamIndexRange.QueryStreamIndexRange,\n >(\n indexName: IndexName,\n indexRange: (\n q: QueryStreamIndexRange.Builder<\n TableInfoFor<DataModel_, TableName>[\"convexDocument\"],\n NamedIndex<ConvexTableInfoFor<DataModel_, TableName>, IndexName>\n >,\n ) => Range,\n ): QueryStream.QueryStream<\n Doc,\n QueryStreamKeyLabels.QueryStreamKeyLabels<\n QueryStreamIndexRange.Remaining<Range>\n >,\n \"asc\",\n Document.DocumentDecodeError,\n never\n >;\n <\n IndexName extends keyof Indexes<\n ConvexTableInfoFor<DataModel_, TableName>\n > &\n string,\n Range extends QueryStreamIndexRange.QueryStreamIndexRange,\n Direction extends OrderDirection,\n >(\n indexName: IndexName,\n indexRange: (\n q: QueryStreamIndexRange.Builder<\n TableInfoFor<DataModel_, TableName>[\"convexDocument\"],\n NamedIndex<ConvexTableInfoFor<DataModel_, TableName>, IndexName>\n >,\n ) => Range,\n order: Direction,\n ): QueryStream.QueryStream<\n Doc,\n QueryStreamKeyLabels.QueryStreamKeyLabels<\n QueryStreamIndexRange.Remaining<Range>\n >,\n Direction,\n Document.DocumentDecodeError,\n never\n >;\n <\n IndexName extends keyof Indexes<\n ConvexTableInfoFor<DataModel_, TableName>\n > &\n string,\n >(\n indexName: IndexName,\n ): QueryStream.QueryStream<\n Doc,\n QueryStreamKeyLabels.QueryStreamKeyLabels<\n NamedIndex<ConvexTableInfoFor<DataModel_, TableName>, IndexName>\n >,\n \"asc\",\n Document.DocumentDecodeError,\n never\n >;\n <\n IndexName extends keyof Indexes<\n ConvexTableInfoFor<DataModel_, TableName>\n > &\n string,\n Direction extends OrderDirection,\n >(\n indexName: IndexName,\n order: Direction,\n ): QueryStream.QueryStream<\n Doc,\n QueryStreamKeyLabels.QueryStreamKeyLabels<\n NamedIndex<ConvexTableInfoFor<DataModel_, TableName>, IndexName>\n >,\n Direction,\n Document.DocumentDecodeError,\n never\n >;\n };\n}\n\nexport function make<\n Tables extends Table.AnyWithProps,\n TableName extends Table.Name<Tables>,\n>(\n convexDatabaseReader: BaseDatabaseReader<\n DataModel.ToConvex<DataModel.FromTables<Tables>>\n >,\n table: Table.WithName<Tables, TableName> & { readonly scope: IdScope.App },\n): QueryInitializer<DataModel.FromTables<Tables>, TableName>;\nexport function make<\n Tables extends Table.AnyWithProps,\n TableName extends Table.Name<Tables>,\n>(\n convexDatabaseReader: BaseDatabaseReader<\n DataModel.ToConvex<DataModel.FromTables<Tables>>\n >,\n table: Table.WithName<Tables, TableName>,\n): QueryInitializer<\n DataModel.FromTables<Tables>,\n TableName,\n DataModel.DocumentWithName<DataModel.FromTables<Tables>, TableName>,\n Table.Scope<Table.WithName<Tables, TableName>> extends IdScope.App\n ? \"app\"\n : \"component\"\n>;\nexport function make<\n Tables extends Table.AnyWithProps,\n TableName extends Table.Name<Tables>,\n>(\n convexDatabaseReader: BaseDatabaseReader<\n DataModel.ToConvex<DataModel.FromTables<Tables>>\n >,\n table: Table.WithName<Tables, TableName>,\n): QueryInitializer<\n DataModel.FromTables<Tables>,\n TableName,\n DataModel.DocumentWithName<DataModel.FromTables<Tables>, TableName>,\n DatabaseSchema.Target[\"kind\"]\n> {\n const tableName = table.tableName;\n type DataModel_ = DataModel.FromTables<Tables>;\n type ConvexDataModel_ = DataModel.ToConvex<DataModel_>;\n type ThisQueryInitializer = QueryInitializer<\n DataModel_,\n TableName,\n DataModel.DocumentWithName<DataModel_, TableName>,\n DatabaseSchema.Target[\"kind\"]\n >;\n type QueryInitializerFunction<\n FunctionName extends keyof ThisQueryInitializer,\n > = ThisQueryInitializer[FunctionName];\n\n const getByIndex = <\n IndexName extends keyof Indexes<\n DataModel.TableInfoWithName<DataModel_, TableName>\n >,\n >(\n indexName: IndexName,\n indexFieldValues: IndexFieldTypesForEq<\n DataModel.ToConvex<DataModel_>,\n TableName,\n Indexes<DataModel.TableInfoWithName<DataModel_, TableName>>[IndexName]\n >,\n ): Effect.Effect<\n DataModel.DocumentWithName<DataModel_, TableName>,\n Document.DocumentDecodeError | GetByIndexFailure\n > => {\n const indexFieldPaths: GenericTableIndexes[keyof GenericTableIndexes] = (\n table.indexes as GenericTableIndexes\n )[indexName as keyof GenericTableIndexes]!;\n\n return pipe(\n Effect.promise(() =>\n convexDatabaseReader\n .query(tableName)\n .withIndex(indexName, (q) =>\n Array.reduce(\n indexFieldValues,\n q,\n (q_, v, i) => q_.eq(indexFieldPaths[i] as any, v as any) as any,\n ),\n )\n .unique(),\n ),\n Effect.andThen((value) =>\n Effect.fromResult(\n Result.fromNullishOr(\n value,\n () =>\n new GetByIndexFailure({\n tableName,\n indexName: indexName as string,\n indexFieldValues,\n }),\n ),\n ),\n ),\n Effect.andThen(Document.decode(table)),\n );\n };\n\n const get: QueryInitializerFunction<\"get\"> = ((\n ...args: Parameters<QueryInitializerFunction<\"get\">>\n ) => {\n if (args.length === 1) {\n const id = args[0] as GenericId<TableName>;\n\n return getById<Tables, TableName>(convexDatabaseReader, table)(id);\n } else {\n const [indexName, ...indexFieldValues] = args;\n\n return getByIndex(\n indexName as keyof Indexes<\n DataModel.TableInfoWithName<DataModel_, TableName>\n >,\n indexFieldValues,\n );\n }\n }) as QueryInitializerFunction<\"get\">;\n\n const index: QueryInitializerFunction<\"index\"> = <\n IndexName extends keyof Indexes<\n DataModel.TableInfoWithName<DataModel_, TableName>\n >,\n >(\n indexName: IndexName,\n indexRangeOrOrder?:\n | ((\n q: IndexRangeBuilder<\n DataModel.TableInfoWithName_<\n DataModel_,\n TableName\n >[\"convexDocument\"],\n NamedIndex<\n DataModel.TableInfoWithName<DataModel_, TableName>,\n IndexName\n >\n >,\n ) => IndexRange)\n | OrderDirection,\n order?: OrderDirection,\n ) => {\n const {\n applyWithIndex,\n applyOrder,\n }: {\n applyWithIndex: (\n queryInitializer: ConvexQueryInitializer<\n NamedTableInfo<ConvexDataModel_, TableName>\n >,\n ) => Query<NamedTableInfo<ConvexDataModel_, TableName>>;\n applyOrder: (\n query: Query<NamedTableInfo<ConvexDataModel_, TableName>>,\n ) => ConvexOrderedQuery<NamedTableInfo<ConvexDataModel_, TableName>>;\n } =\n indexRangeOrOrder === undefined\n ? {\n applyWithIndex: (q) => q.withIndex(indexName),\n applyOrder: (q) => q.order(\"asc\"),\n }\n : typeof indexRangeOrOrder === \"function\"\n ? order === undefined\n ? {\n applyWithIndex: (q) =>\n q.withIndex(indexName, indexRangeOrOrder),\n applyOrder: (q) => q.order(\"asc\"),\n }\n : {\n applyWithIndex: (q) =>\n q.withIndex(indexName, indexRangeOrOrder),\n applyOrder: (q) => q.order(order),\n }\n : {\n applyWithIndex: (q) => q.withIndex(indexName),\n applyOrder: (q) => q.order(indexRangeOrOrder),\n };\n\n const orderedQuery = pipe(\n convexDatabaseReader.query(tableName),\n applyWithIndex,\n applyOrder,\n );\n\n return OrderedQuery.make(orderedQuery, table);\n };\n\n const stream: QueryInitializerFunction<\"stream\"> = ((\n indexName: string,\n indexRangeOrOrder?:\n | ((\n q: QueryStreamIndexRange.Builder<any, any>,\n ) => QueryStreamIndexRange.QueryStreamIndexRange)\n | OrderDirection,\n maybeOrder?: OrderDirection,\n ) => {\n const orderDirection = Predicate.isString(indexRangeOrOrder)\n ? indexRangeOrOrder\n : (maybeOrder ?? \"asc\");\n\n // Without a range callback, the leaf scans the entire index.\n const indexRange = Predicate.isFunction(indexRangeOrOrder)\n ? indexRangeOrOrder(QueryStreamIndexRange.builder())\n : QueryStreamIndexRange.builder();\n\n // The type-level field tuple appends the `_creationTime` tiebreaker, but\n // the runtime `table.indexes` record stores only the declared fields—append it here.\n const indexFieldPaths: ReadonlyArray<string> =\n indexName === \"by_id\"\n ? [\"_id\"]\n : indexName === \"by_creation_time\"\n ? [\"_creationTime\"]\n : pipe(\n Option.fromUndefinedOr(\n (\n table.indexes as ReadonlyRecord<string, ReadonlyArray<string>>\n )[indexName],\n ),\n // An unknown index name is a defect, not an empty field list:\n // silently empty fields would make key extraction and range\n // splitting target the wrong fields.\n Option.getOrThrowWith(\n () =>\n new Error(\n `QueryInitializer.stream: table \"${tableName}\" has no index named \"${indexName}\"`,\n ),\n ),\n Array.append(\"_creationTime\"),\n );\n\n return QueryStream.fromReflection({\n reader: convexDatabaseReader as QueryStream.ReflectionReader,\n table,\n indexName,\n indexFieldPaths,\n indexRange,\n orderDirection,\n });\n }) as QueryInitializerFunction<\"stream\">;\n\n const search: QueryInitializerFunction<\"search\"> = (\n indexName,\n searchFilter,\n ) =>\n OrderedQuery.make(\n convexDatabaseReader\n .query(tableName)\n .withSearchIndex(indexName, searchFilter),\n table,\n );\n\n return {\n get,\n index,\n search,\n stream,\n };\n}\n\nexport const getById =\n <Tables extends Table.AnyWithProps, TableName extends Table.Name<Tables>>(\n convexDatabaseReader: BaseDatabaseReader<\n DataModel.ToConvex<DataModel.FromTables<Tables>>\n >,\n table: Table.WithName<Tables, TableName>,\n ) =>\n (id: GenericId<TableName>) =>\n pipe(\n Effect.promise(() => convexDatabaseReader.get(id)),\n Effect.andThen((value) =>\n Effect.fromResult(\n Result.fromNullishOr(\n value,\n () => new GetByIdFailure({ tableName: table.tableName, id }),\n ),\n ),\n ),\n Effect.andThen(Document.decode(table)),\n );\n\nexport class GetByIdFailure extends Schema.TaggedError<GetByIdFailure>()(\n \"GetByIdFailure\",\n {\n id: Schema.String,\n tableName: Schema.String,\n },\n) {\n override get message(): string {\n return Document.documentErrorMessage({\n id: this.id,\n tableName: this.tableName,\n message: \"not found\",\n });\n }\n}\n\nexport class GetByIndexFailure extends Schema.TaggedError<GetByIndexFailure>()(\n \"GetByIndexFailure\",\n {\n tableName: Schema.String,\n indexName: Schema.String,\n indexFieldValues: Schema.Array(Schema.Unknown),\n },\n) {\n override get message(): string {\n return `No documents found in table '${this.tableName}' with index '${this.indexName}' and field values '${JSON.stringify(\n this.indexFieldValues,\n (_key, value) => (typeof value === \"bigint\" ? value.toString() : value),\n )}'`;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AA4PA,SAAgB,KAId,sBAGA,OAMA;CACA,MAAM,YAAY,MAAM;CAaxB,MAAM,cAKJ,WACA,qBAQG;EACH,MAAM,kBACJ,MAAM,QACN;EAEF,OAAO,KACL,OAAO,cACL,qBACG,MAAM,SAAS,CAAC,CAChB,UAAU,YAAY,MACrB,MAAM,O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+
{"version":3,"file":"QueryInitializer.js","names":["Document.decode","OrderedQuery.make","QueryStreamIndexRange.builder","QueryStream.fromReflection","Document.documentErrorMessage"],"sources":["../src/QueryInitializer.ts"],"sourcesContent":["import type * as IdScope from \"@confect/core/IdScope\";\nimport type {\n OrderedQuery as ConvexOrderedQuery,\n QueryInitializer as ConvexQueryInitializer,\n DocumentByInfo,\n GenericTableIndexes,\n Indexes,\n IndexRange,\n IndexRangeBuilder,\n NamedIndex,\n NamedSearchIndex,\n NamedTableInfo,\n Query,\n SearchFilter,\n SearchFilterBuilder,\n SearchIndexes,\n} from \"convex/server\";\nimport type { GenericId } from \"convex/values\";\nimport { pipe } from \"effect/Function\";\nimport * as Array from \"effect/Array\";\nimport * as Effect from \"effect/Effect\";\nimport * as Option from \"effect/Option\";\nimport * as Predicate from \"effect/Predicate\";\nimport type { ReadonlyRecord } from \"effect/Record\";\nimport * as Result from \"effect/Result\";\nimport * as Schema from \"effect/Schema\";\nimport type {\n BaseDatabaseReader,\n IndexFieldTypesForEq,\n} from \"@confect/core/Types\";\nimport type * as DataModel from \"./DataModel.js\";\nimport type * as DatabaseSchema from \"./DatabaseSchema.js\";\nimport * as Document from \"./Document.js\";\nimport * as OrderedQuery from \"./OrderedQuery.js\";\nimport * as QueryStream from \"./QueryStream.js\";\nimport type * as QueryStreamKeyLabels from \"./QueryStreamKeyLabels.js\";\nimport * as QueryStreamIndexRange from \"./QueryStreamIndexRange.js\";\nimport type { QueryStreamOrderDirection as OrderDirection } from \"./QueryStreamOrderDirection.js\";\nimport type * as Table from \"./Table.js\";\n\ntype ConvexTableInfoFor<\n DataModel_ extends DataModel.AnyWithProps,\n TableName extends DataModel.TableNames<DataModel_>,\n> = DataModel.TableInfoWithName<DataModel_, TableName>;\n\ntype TableInfoFor<\n DataModel_ extends DataModel.AnyWithProps,\n TableName extends DataModel.TableNames<DataModel_>,\n> = DataModel.TableInfoWithName_<DataModel_, TableName>;\n\nexport interface QueryInitializer<\n DataModel_ extends DataModel.AnyWithProps,\n TableName extends DataModel.TableNames<DataModel_>,\n Doc = DataModel.DocumentWithName<DataModel_, TableName>,\n TargetKind extends DatabaseSchema.Target[\"kind\"] = \"app\",\n> {\n readonly get: {\n (\n id: DataModel.Id<DataModel_, TableName>,\n ): Effect.Effect<Doc, Document.DocumentDecodeError | GetByIdFailure>;\n <\n IndexName extends keyof Indexes<\n ConvexTableInfoFor<DataModel_, TableName>\n >,\n >(\n indexName: IndexName,\n ...indexFieldValues: IndexFieldTypesForEq<\n DataModel.ToConvex<DataModel_>,\n TableName,\n Indexes<ConvexTableInfoFor<DataModel_, TableName>>[IndexName]\n >\n ): Effect.Effect<Doc, Document.DocumentDecodeError | GetByIndexFailure>;\n };\n readonly index: {\n <\n IndexName extends keyof Indexes<\n ConvexTableInfoFor<DataModel_, TableName>\n >,\n >(\n indexName: IndexName,\n indexRange?: (\n q: IndexRangeBuilder<\n TableInfoFor<DataModel_, TableName>[\"convexDocument\"],\n NamedIndex<ConvexTableInfoFor<DataModel_, TableName>, IndexName>\n >,\n ) => IndexRange,\n order?: OrderDirection,\n ): OrderedQuery.OrderedQuery<\n TableInfoFor<DataModel_, TableName>,\n Doc,\n TargetKind\n >;\n <\n IndexName extends keyof Indexes<\n ConvexTableInfoFor<DataModel_, TableName>\n >,\n >(\n indexName: IndexName,\n order?: OrderDirection,\n ): OrderedQuery.OrderedQuery<\n TableInfoFor<DataModel_, TableName>,\n Doc,\n TargetKind\n >;\n };\n readonly search: <\n IndexName extends keyof SearchIndexes<\n ConvexTableInfoFor<DataModel_, TableName>\n >,\n >(\n indexName: IndexName,\n searchFilter: (\n q: SearchFilterBuilder<\n DocumentByInfo<ConvexTableInfoFor<DataModel_, TableName>>,\n NamedSearchIndex<ConvexTableInfoFor<DataModel_, TableName>, IndexName>\n >,\n ) => SearchFilter,\n ) => OrderedQuery.OrderedQuery<\n TableInfoFor<DataModel_, TableName>,\n Doc,\n TargetKind\n >;\n /**\n * EXPERIMENTAL—stream-first querying (see `notes/stream-based-querying.md`).\n *\n * Like `index`, but returns a {@link QueryStream.QueryStream}: a genuine\n * Effect `Stream` of documents in index order that stays mergeable and\n * paginable.\n *\n * In SQL terms: an index range scan—`SELECT * FROM table WHERE <range> ORDER\n * BY <index fields> [DESC]`; `eq` calls are the equality predicates, the\n * bound calls are the range predicates. The value is a reusable description\n * of a query: each run re-runs the index query. * The typed range builder\n * consumes `eq`-pinned fields from the index's field tuple at the type level,\n * so the stream's visible label type is exactly the fields that still vary\n * (the `ORDER BY` columns left after the equality predicates). The order\n * direction is part of the type too: omitted, it is `\"asc\"`; a literal is\n * tracked as that literal, and a value known only at runtime as the union.\n * The order parameter is either absent or a direction—never `undefined`—so\n * the type can't claim a literal the runtime default would contradict.\n */\n readonly stream: {\n <\n IndexName extends keyof Indexes<\n ConvexTableInfoFor<DataModel_, TableName>\n > &\n string,\n Range extends QueryStreamIndexRange.QueryStreamIndexRange,\n >(\n indexName: IndexName,\n indexRange: (\n q: QueryStreamIndexRange.Builder<\n TableInfoFor<DataModel_, TableName>[\"convexDocument\"],\n NamedIndex<ConvexTableInfoFor<DataModel_, TableName>, IndexName>\n >,\n ) => Range,\n ): QueryStream.QueryStream<\n Doc,\n QueryStreamKeyLabels.QueryStreamKeyLabels<\n QueryStreamIndexRange.Remaining<Range>\n >,\n \"asc\",\n Document.DocumentDecodeError,\n never\n >;\n <\n IndexName extends keyof Indexes<\n ConvexTableInfoFor<DataModel_, TableName>\n > &\n string,\n Range extends QueryStreamIndexRange.QueryStreamIndexRange,\n Direction extends OrderDirection,\n >(\n indexName: IndexName,\n indexRange: (\n q: QueryStreamIndexRange.Builder<\n TableInfoFor<DataModel_, TableName>[\"convexDocument\"],\n NamedIndex<ConvexTableInfoFor<DataModel_, TableName>, IndexName>\n >,\n ) => Range,\n order: Direction,\n ): QueryStream.QueryStream<\n Doc,\n QueryStreamKeyLabels.QueryStreamKeyLabels<\n QueryStreamIndexRange.Remaining<Range>\n >,\n Direction,\n Document.DocumentDecodeError,\n never\n >;\n <\n IndexName extends keyof Indexes<\n ConvexTableInfoFor<DataModel_, TableName>\n > &\n string,\n >(\n indexName: IndexName,\n ): QueryStream.QueryStream<\n Doc,\n QueryStreamKeyLabels.QueryStreamKeyLabels<\n NamedIndex<ConvexTableInfoFor<DataModel_, TableName>, IndexName>\n >,\n \"asc\",\n Document.DocumentDecodeError,\n never\n >;\n <\n IndexName extends keyof Indexes<\n ConvexTableInfoFor<DataModel_, TableName>\n > &\n string,\n Direction extends OrderDirection,\n >(\n indexName: IndexName,\n order: Direction,\n ): QueryStream.QueryStream<\n Doc,\n QueryStreamKeyLabels.QueryStreamKeyLabels<\n NamedIndex<ConvexTableInfoFor<DataModel_, TableName>, IndexName>\n >,\n Direction,\n Document.DocumentDecodeError,\n never\n >;\n };\n}\n\nexport function make<\n Tables extends Table.AnyWithProps,\n TableName extends Table.Name<Tables>,\n>(\n convexDatabaseReader: BaseDatabaseReader<\n DataModel.ToConvex<DataModel.FromTables<Tables>>\n >,\n table: Table.WithName<Tables, TableName> & { readonly scope: IdScope.App },\n): QueryInitializer<DataModel.FromTables<Tables>, TableName>;\nexport function make<\n Tables extends Table.AnyWithProps,\n TableName extends Table.Name<Tables>,\n>(\n convexDatabaseReader: BaseDatabaseReader<\n DataModel.ToConvex<DataModel.FromTables<Tables>>\n >,\n table: Table.WithName<Tables, TableName>,\n): QueryInitializer<\n DataModel.FromTables<Tables>,\n TableName,\n DataModel.DocumentWithName<DataModel.FromTables<Tables>, TableName>,\n Table.Scope<Table.WithName<Tables, TableName>> extends IdScope.App\n ? \"app\"\n : \"component\"\n>;\nexport function make<\n Tables extends Table.AnyWithProps,\n TableName extends Table.Name<Tables>,\n>(\n convexDatabaseReader: BaseDatabaseReader<\n DataModel.ToConvex<DataModel.FromTables<Tables>>\n >,\n table: Table.WithName<Tables, TableName>,\n): QueryInitializer<\n DataModel.FromTables<Tables>,\n TableName,\n DataModel.DocumentWithName<DataModel.FromTables<Tables>, TableName>,\n DatabaseSchema.Target[\"kind\"]\n> {\n const tableName = table.tableName;\n type DataModel_ = DataModel.FromTables<Tables>;\n type ConvexDataModel_ = DataModel.ToConvex<DataModel_>;\n type ThisQueryInitializer = QueryInitializer<\n DataModel_,\n TableName,\n DataModel.DocumentWithName<DataModel_, TableName>,\n DatabaseSchema.Target[\"kind\"]\n >;\n type QueryInitializerFunction<\n FunctionName extends keyof ThisQueryInitializer,\n > = ThisQueryInitializer[FunctionName];\n\n const getByIndex = <\n IndexName extends keyof Indexes<\n DataModel.TableInfoWithName<DataModel_, TableName>\n >,\n >(\n indexName: IndexName,\n indexFieldValues: IndexFieldTypesForEq<\n DataModel.ToConvex<DataModel_>,\n TableName,\n Indexes<DataModel.TableInfoWithName<DataModel_, TableName>>[IndexName]\n >,\n ): Effect.Effect<\n DataModel.DocumentWithName<DataModel_, TableName>,\n Document.DocumentDecodeError | GetByIndexFailure\n > => {\n const indexFieldPaths: GenericTableIndexes[keyof GenericTableIndexes] = (\n table.indexes as GenericTableIndexes\n )[indexName as keyof GenericTableIndexes]!;\n\n return pipe(\n Effect.promise(() =>\n convexDatabaseReader\n .query(tableName)\n .withIndex(indexName, (q) =>\n Array.reduce(\n indexFieldValues,\n q,\n (q_, v, i) => q_.eq(indexFieldPaths[i] as any, v as any) as any,\n ),\n )\n .unique(),\n ),\n Effect.andThen((value) =>\n Effect.fromResult(\n Result.fromNullishOr(\n value,\n () =>\n new GetByIndexFailure({\n tableName,\n indexName: indexName as string,\n indexFieldValues,\n }),\n ),\n ),\n ),\n Effect.andThen(Document.decode(table)),\n );\n };\n\n const get: QueryInitializerFunction<\"get\"> = ((\n ...args: Parameters<QueryInitializerFunction<\"get\">>\n ) => {\n if (args.length === 1) {\n const id = args[0] as GenericId<TableName>;\n\n return getById<Tables, TableName>(convexDatabaseReader, table)(id);\n } else {\n const [indexName, ...indexFieldValues] = args;\n\n return getByIndex(\n indexName as keyof Indexes<\n DataModel.TableInfoWithName<DataModel_, TableName>\n >,\n indexFieldValues,\n );\n }\n }) as QueryInitializerFunction<\"get\">;\n\n const index: QueryInitializerFunction<\"index\"> = <\n IndexName extends keyof Indexes<\n DataModel.TableInfoWithName<DataModel_, TableName>\n >,\n >(\n indexName: IndexName,\n indexRangeOrOrder?:\n | ((\n q: IndexRangeBuilder<\n DataModel.TableInfoWithName_<\n DataModel_,\n TableName\n >[\"convexDocument\"],\n NamedIndex<\n DataModel.TableInfoWithName<DataModel_, TableName>,\n IndexName\n >\n >,\n ) => IndexRange)\n | OrderDirection,\n order?: OrderDirection,\n ) => {\n const {\n applyWithIndex,\n applyOrder,\n }: {\n applyWithIndex: (\n queryInitializer: ConvexQueryInitializer<\n NamedTableInfo<ConvexDataModel_, TableName>\n >,\n ) => Query<NamedTableInfo<ConvexDataModel_, TableName>>;\n applyOrder: (\n query: Query<NamedTableInfo<ConvexDataModel_, TableName>>,\n ) => ConvexOrderedQuery<NamedTableInfo<ConvexDataModel_, TableName>>;\n } =\n indexRangeOrOrder === undefined\n ? {\n applyWithIndex: (q) => q.withIndex(indexName),\n applyOrder: (q) => q.order(\"asc\"),\n }\n : typeof indexRangeOrOrder === \"function\"\n ? order === undefined\n ? {\n applyWithIndex: (q) =>\n q.withIndex(indexName, indexRangeOrOrder),\n applyOrder: (q) => q.order(\"asc\"),\n }\n : {\n applyWithIndex: (q) =>\n q.withIndex(indexName, indexRangeOrOrder),\n applyOrder: (q) => q.order(order),\n }\n : {\n applyWithIndex: (q) => q.withIndex(indexName),\n applyOrder: (q) => q.order(indexRangeOrOrder),\n };\n\n const orderedQuery = pipe(\n convexDatabaseReader.query(tableName),\n applyWithIndex,\n applyOrder,\n );\n\n return OrderedQuery.make(orderedQuery, table);\n };\n\n const stream: QueryInitializerFunction<\"stream\"> = ((\n indexName: string,\n indexRangeOrOrder?:\n | ((\n q: QueryStreamIndexRange.Builder<any, any>,\n ) => QueryStreamIndexRange.QueryStreamIndexRange)\n | OrderDirection,\n maybeOrder?: OrderDirection,\n ) => {\n const orderDirection = Predicate.isString(indexRangeOrOrder)\n ? indexRangeOrOrder\n : (maybeOrder ?? \"asc\");\n\n // Without a range callback, the leaf scans the entire index.\n const indexRange = Predicate.isFunction(indexRangeOrOrder)\n ? indexRangeOrOrder(QueryStreamIndexRange.builder())\n : QueryStreamIndexRange.builder();\n\n // The type-level field tuple appends the `_creationTime` tiebreaker, but\n // the runtime `table.indexes` record stores only the declared fields—append it here.\n const indexFieldPaths: ReadonlyArray<string> =\n indexName === \"by_id\"\n ? [\"_id\"]\n : indexName === \"by_creation_time\"\n ? [\"_creationTime\"]\n : pipe(\n Option.fromUndefinedOr(\n (\n table.indexes as ReadonlyRecord<string, ReadonlyArray<string>>\n )[indexName],\n ),\n // An unknown index name is a defect, not an empty field list:\n // silently empty fields would make key extraction and range\n // splitting target the wrong fields.\n Option.getOrThrowWith(\n () =>\n new Error(\n `QueryInitializer.stream: table \"${tableName}\" has no index named \"${indexName}\"`,\n ),\n ),\n Array.append(\"_creationTime\"),\n );\n\n return QueryStream.fromReflection({\n reader: convexDatabaseReader as QueryStream.ReflectionReader,\n table,\n indexName,\n indexFieldPaths,\n indexRange,\n orderDirection,\n });\n }) as QueryInitializerFunction<\"stream\">;\n\n const search: QueryInitializerFunction<\"search\"> = (\n indexName,\n searchFilter,\n ) =>\n OrderedQuery.make(\n convexDatabaseReader\n .query(tableName)\n .withSearchIndex(indexName, searchFilter),\n table,\n );\n\n return {\n get,\n index,\n search,\n stream,\n };\n}\n\nexport const getById =\n <Tables extends Table.AnyWithProps, TableName extends Table.Name<Tables>>(\n convexDatabaseReader: BaseDatabaseReader<\n DataModel.ToConvex<DataModel.FromTables<Tables>>\n >,\n table: Table.WithName<Tables, TableName>,\n ) =>\n (id: GenericId<TableName>) =>\n pipe(\n Effect.promise(() => convexDatabaseReader.get(id)),\n Effect.andThen((value) =>\n Effect.fromResult(\n Result.fromNullishOr(\n value,\n () => new GetByIdFailure({ tableName: table.tableName, id }),\n ),\n ),\n ),\n Effect.andThen(Document.decode(table)),\n );\n\nexport class GetByIdFailure extends Schema.TaggedError<GetByIdFailure>()(\n \"GetByIdFailure\",\n {\n id: Schema.String,\n tableName: Schema.String,\n },\n) {\n override get message(): string {\n return Document.documentErrorMessage({\n id: this.id,\n tableName: this.tableName,\n message: \"not found\",\n });\n }\n}\n\nexport class GetByIndexFailure extends Schema.TaggedError<GetByIndexFailure>()(\n \"GetByIndexFailure\",\n {\n tableName: Schema.String,\n indexName: Schema.String,\n indexFieldValues: Schema.Array(Schema.Unknown),\n },\n) {\n override get message(): string {\n return `No documents found in table '${this.tableName}' with index '${this.indexName}' and field values '${JSON.stringify(\n this.indexFieldValues,\n (_key, value) => (typeof value === \"bigint\" ? value.toString() : value),\n )}'`;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AA4PA,SAAgB,KAId,sBAGA,OAMA;CACA,MAAM,YAAY,MAAM;CAaxB,MAAM,cAKJ,WACA,qBAQG;EACH,MAAM,kBACJ,MAAM,QACN;EAEF,OAAO,KACL,OAAO,cACL,qBACG,MAAM,SAAS,CAAC,CAChB,UAAU,YAAY,MACrB,MAAM,OACJ,kBACA,IACC,IAAI,GAAG,MAAM,GAAG,GAAG,gBAAgB,IAAW,CAAQ,CACzD,CACF,CAAC,CACA,OAAO,CACZ,GACA,OAAO,SAAS,UACd,OAAO,WACL,OAAO,cACL,aAEE,IAAI,kBAAkB;GACpB;GACW;GACX;EACF,CAAC,CACL,CACF,CACF,GACA,OAAO,QAAQA,OAAgB,KAAK,CAAC,CACvC;CACF;CAEA,MAAM,QACJ,GAAG,SACA;EACH,IAAI,KAAK,WAAW,GAAG;GACrB,MAAM,KAAK,KAAK;GAEhB,OAAO,QAA2B,sBAAsB,KAAK,CAAC,CAAC,EAAE;EACnE,OAAO;GACL,MAAM,CAAC,WAAW,GAAG,oBAAoB;GAEzC,OAAO,WACL,WAGA,gBACF;EACF;CACF;CAEA,MAAM,SAKJ,WACA,mBAcA,UACG;EACH,MAAM,EACJ,gBACA,eAWA,sBAAsB,KAAA,IACl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AAe;CAAE,WAAW,MAAM;CAAW;AAAG,CAAC,CAC7D,CACF,CACF,GACA,OAAO,QAAQD,OAAgB,KAAK,CAAC,CACvC;AAEJ,IAAa,iBAAb,cAAoC,OAAO,YAA4B,CAAC,CACtE,kBACA;CACE,IAAI,OAAO;CACX,WAAW,OAAO;AACpB,CACF,CAAC,CAAC;CACA,IAAa,UAAkB;EAC7B,OAAOI,qBAA8B;GACnC,IAAI,KAAK;GACT,WAAW,KAAK;GAChB,SAAS;EACX,CAAC;CACH;AACF;AAEA,IAAa,oBAAb,cAAuC,OAAO,YAA+B,CAAC,CAC5E,qBACA;CACE,WAAW,OAAO;CAClB,WAAW,OAAO;CAClB,kBAAkB,OAAO,MAAM,OAAO,OAAO;AAC/C,CACF,CAAC,CAAC;CACA,IAAa,UAAkB;EAC7B,OAAO,gCAAgC,KAAK,UAAU,gBAAgB,KAAK,UAAU,sBAAsB,KAAK,UAC9G,KAAK,mBACJ,MAAM,UAAW,OAAO,UAAU,WAAW,MAAM,SAAS,IAAI,KACnE,EAAE;CACJ;AACF"}
|
package/dist/QueryRunner.d.ts
CHANGED
|
@@ -4,8 +4,8 @@ import * as Context from "effect/Context";
|
|
|
4
4
|
import * as Effect from "effect/Effect";
|
|
5
5
|
import * as Layer from "effect/Layer";
|
|
6
6
|
import type * as Schema from "effect/Schema";
|
|
7
|
-
import * as MutationTransactionContext from "./MutationTransactionContext";
|
|
8
|
-
import * as QueryTransactionContext from "./QueryTransactionContext";
|
|
7
|
+
import * as MutationTransactionContext from "./MutationTransactionContext.js";
|
|
8
|
+
import * as QueryTransactionContext from "./QueryTransactionContext.js";
|
|
9
9
|
export type Options = MutationTransactionContext.QueryOptions;
|
|
10
10
|
export declare const QueryRunner: Context.Service<{
|
|
11
11
|
runQuery: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"QueryRunner.d.ts","sourceRoot":"","sources":["../src/QueryRunner.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,M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
import { MutationTransactionContext } from "./MutationTransactionContext.js";
|
|
3
3
|
import { QueryTransactionContext } from "./QueryTransactionContext.js";
|
|
4
|
-
import * as Context from "effect/Context";
|
|
5
|
-
import * as Layer from "effect/Layer";
|
|
6
4
|
import * as Ref from "@confect/core/Ref";
|
|
5
|
+
import * as Context from "effect/Context";
|
|
7
6
|
import * as Effect from "effect/Effect";
|
|
7
|
+
import * as Layer from "effect/Layer";
|
|
8
8
|
//#region src/QueryRunner.ts
|
|
9
9
|
var QueryRunner_exports = /* @__PURE__ */ __exportAll({
|
|
10
10
|
QueryRunner: () => QueryRunner,
|
package/dist/QueryRunner.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"QueryRunner.js","names":["MutationTransactionContext.MutationTransactionContext","QueryTransactionContext.QueryTransactionContext"],"sources":["../src/QueryRunner.ts"],"sourcesContent":["import * as Ref from \"@confect/core/Ref\";\nimport type { GenericActionCtx } from \"convex/server\";\nimport * as Context from \"effect/Context\";\nimport * as Effect from \"effect/Effect\";\nimport * as Layer from \"effect/Layer\";\nimport type * as Schema from \"effect/Schema\";\nimport * as MutationTransactionContext from \"./MutationTransactionContext\";\nimport * as QueryTransactionContext from \"./QueryTransactionContext\";\n\nexport type Options = MutationTransactionContext.QueryOptions;\n\nconst run = Effect.fn(\"QueryRunner.runQuery\")(\n <A, E, R>(effect: Effect.Effect<A, E, R>): Effect.Effect<A, E, R> => effect,\n);\n\nconst make = (nativeRunQuery: GenericActionCtx<any>[\"runQuery\"]) => {\n function runQuery<Query extends Ref.AnyQuery>(\n query: Query,\n ...args: [...Ref.OptionalArgs<Query>, options?: undefined]\n ): Effect.Effect<Ref.Returns<Query>, Ref.Error<Query> | Schema.SchemaError>;\n function runQuery<Query extends Ref.AnyQuery>(\n query: Query,\n args: Ref.Args<Query>,\n options:\n | (QueryTransactionContext.Options & {\n readonly useStaleSnapshot?: never;\n })\n | undefined,\n ): Effect.Effect<\n Ref.Returns<Query>,\n Ref.Error<Query> | Schema.SchemaError,\n QueryTransactionContext.QueryTransactionContext\n >;\n function runQuery<Query extends Ref.AnyQuery>(\n query: Query,\n args: Ref.Args<Query>,\n options: Options & { readonly useStaleSnapshot: boolean },\n ): Effect.Effect<\n Ref.Returns<Query>,\n Ref.Error<Query> | Schema.SchemaError,\n MutationTransactionContext.MutationTransactionContext\n >;\n function runQuery<Query extends Ref.AnyQuery>(\n query: Query,\n args: Ref.Args<Query>,\n options: Options | undefined,\n ): Effect.Effect<\n Ref.Returns<Query>,\n Ref.Error<Query> | Schema.SchemaError,\n | QueryTransactionContext.QueryTransactionContext\n | MutationTransactionContext.MutationTransactionContext\n >;\n function runQuery<Query extends Ref.AnyQuery>(\n query: Query,\n args?: Ref.Args<Query>,\n options?: Options,\n ): Effect.Effect<\n Ref.Returns<Query>,\n Ref.Error<Query> | Schema.SchemaError,\n | QueryTransactionContext.QueryTransactionContext\n | MutationTransactionContext.MutationTransactionContext\n > {\n return run(\n Effect.gen(function* () {\n const actualArgs = (args ?? {}) as Ref.Args<Query>;\n if (options?.useStaleSnapshot !== undefined) {\n const controls =\n yield* MutationTransactionContext.MutationTransactionContext;\n return yield* controls.runQuery(query, actualArgs, options);\n }\n if (options !== undefined) {\n const controls =\n yield* QueryTransactionContext.QueryTransactionContext;\n return yield* controls.runQuery(query, actualArgs, options);\n }\n return yield* Ref.runWithCodec(query, actualArgs, (ref, encodedArgs) =>\n nativeRunQuery(ref, encodedArgs),\n );\n }),\n );\n }\n return { runQuery };\n};\n\nexport const QueryRunner = Context.Service<ReturnType<typeof make>>(\n \"@confect/server/QueryRunner\",\n);\nexport type QueryRunner = typeof QueryRunner.Identifier;\n\nexport const layer = (runQuery: GenericActionCtx<any>[\"runQuery\"]) =>\n Layer.succeed(QueryRunner, make(runQuery));\n"],"mappings":";;;;;;;;;;;;AAWA,MAAM,MAAM,OAAO,GAAG,sBAAsB,CAAC,EACjC,WAA2D,MACvE;AAEA,MAAM,QAAQ,mBAAsD;CAqClE,SAAS,SACP,OACA,MACA,SAMA;EACA,OAAO,IACL,OAAO,IAAI,aAAa;GACtB,MAAM,aAAc,QAAQ,CAAC;GAC7B,IAAI,SAAS,qBAAqB,KAAA,GAGhC,OAAO,QAAO,OADLA,2BAAAA,CACc,SAAS,OAAO,YAAY,OAAO;GAE5D,IAAI,YAAY,KAAA,GAGd,OAAO,QAAO,OADLC,wBAAAA,CACc,SAAS,OAAO,YAAY,OAAO;GAE5D,OAAO,OAAO,IAAI,aAAa,OAAO,aAAa,KAAK,gBACtD,eAAe,KAAK,WAAW,CACjC;EACF,CAAC,CACH;CACF;CACA,OAAO,EAAE,SAAS;AACpB;AAEA,MAAa,cAAc,QAAQ,QACjC,6BACF;AAGA,MAAa,SAAS,aACpB,MAAM,QAAQ,aAAa,KAAK,QAAQ,CAAC"}
|
|
1
|
+
{"version":3,"file":"QueryRunner.js","names":["MutationTransactionContext.MutationTransactionContext","QueryTransactionContext.QueryTransactionContext"],"sources":["../src/QueryRunner.ts"],"sourcesContent":["import * as Ref from \"@confect/core/Ref\";\nimport type { GenericActionCtx } from \"convex/server\";\nimport * as Context from \"effect/Context\";\nimport * as Effect from \"effect/Effect\";\nimport * as Layer from \"effect/Layer\";\nimport type * as Schema from \"effect/Schema\";\nimport * as MutationTransactionContext from \"./MutationTransactionContext.js\";\nimport * as QueryTransactionContext from \"./QueryTransactionContext.js\";\n\nexport type Options = MutationTransactionContext.QueryOptions;\n\nconst run = Effect.fn(\"QueryRunner.runQuery\")(\n <A, E, R>(effect: Effect.Effect<A, E, R>): Effect.Effect<A, E, R> => effect,\n);\n\nconst make = (nativeRunQuery: GenericActionCtx<any>[\"runQuery\"]) => {\n function runQuery<Query extends Ref.AnyQuery>(\n query: Query,\n ...args: [...Ref.OptionalArgs<Query>, options?: undefined]\n ): Effect.Effect<Ref.Returns<Query>, Ref.Error<Query> | Schema.SchemaError>;\n function runQuery<Query extends Ref.AnyQuery>(\n query: Query,\n args: Ref.Args<Query>,\n options:\n | (QueryTransactionContext.Options & {\n readonly useStaleSnapshot?: never;\n })\n | undefined,\n ): Effect.Effect<\n Ref.Returns<Query>,\n Ref.Error<Query> | Schema.SchemaError,\n QueryTransactionContext.QueryTransactionContext\n >;\n function runQuery<Query extends Ref.AnyQuery>(\n query: Query,\n args: Ref.Args<Query>,\n options: Options & { readonly useStaleSnapshot: boolean },\n ): Effect.Effect<\n Ref.Returns<Query>,\n Ref.Error<Query> | Schema.SchemaError,\n MutationTransactionContext.MutationTransactionContext\n >;\n function runQuery<Query extends Ref.AnyQuery>(\n query: Query,\n args: Ref.Args<Query>,\n options: Options | undefined,\n ): Effect.Effect<\n Ref.Returns<Query>,\n Ref.Error<Query> | Schema.SchemaError,\n | QueryTransactionContext.QueryTransactionContext\n | MutationTransactionContext.MutationTransactionContext\n >;\n function runQuery<Query extends Ref.AnyQuery>(\n query: Query,\n args?: Ref.Args<Query>,\n options?: Options,\n ): Effect.Effect<\n Ref.Returns<Query>,\n Ref.Error<Query> | Schema.SchemaError,\n | QueryTransactionContext.QueryTransactionContext\n | MutationTransactionContext.MutationTransactionContext\n > {\n return run(\n Effect.gen(function* () {\n const actualArgs = (args ?? {}) as Ref.Args<Query>;\n if (options?.useStaleSnapshot !== undefined) {\n const controls =\n yield* MutationTransactionContext.MutationTransactionContext;\n return yield* controls.runQuery(query, actualArgs, options);\n }\n if (options !== undefined) {\n const controls =\n yield* QueryTransactionContext.QueryTransactionContext;\n return yield* controls.runQuery(query, actualArgs, options);\n }\n return yield* Ref.runWithCodec(query, actualArgs, (ref, encodedArgs) =>\n nativeRunQuery(ref, encodedArgs),\n );\n }),\n );\n }\n return { runQuery };\n};\n\nexport const QueryRunner = Context.Service<ReturnType<typeof make>>(\n \"@confect/server/QueryRunner\",\n);\nexport type QueryRunner = typeof QueryRunner.Identifier;\n\nexport const layer = (runQuery: GenericActionCtx<any>[\"runQuery\"]) =>\n Layer.succeed(QueryRunner, make(runQuery));\n"],"mappings":";;;;;;;;;;;;AAWA,MAAM,MAAM,OAAO,GAAG,sBAAsB,CAAC,EACjC,WAA2D,MACvE;AAEA,MAAM,QAAQ,mBAAsD;CAqClE,SAAS,SACP,OACA,MACA,SAMA;EACA,OAAO,IACL,OAAO,IAAI,aAAa;GACtB,MAAM,aAAc,QAAQ,CAAC;GAC7B,IAAI,SAAS,qBAAqB,KAAA,GAGhC,OAAO,QAAO,OADLA,2BAAAA,CACc,SAAS,OAAO,YAAY,OAAO;GAE5D,IAAI,YAAY,KAAA,GAGd,OAAO,QAAO,OADLC,wBAAAA,CACc,SAAS,OAAO,YAAY,OAAO;GAE5D,OAAO,OAAO,IAAI,aAAa,OAAO,aAAa,KAAK,gBACtD,eAAe,KAAK,WAAW,CACjC;EACF,CAAC,CACH;CACF;CACA,OAAO,EAAE,SAAS;AACpB;AAEA,MAAa,cAAc,QAAQ,QACjC,6BACF;AAGA,MAAa,SAAS,aACpB,MAAM,QAAQ,aAAa,KAAK,QAAQ,CAAC"}
|
package/dist/QueryStream.d.ts
CHANGED
|
@@ -39,21 +39,29 @@ import * as Option from "effect/Option";
|
|
|
39
39
|
import * as Schema from "effect/Schema";
|
|
40
40
|
import * as Stream from "effect/Stream";
|
|
41
41
|
import type * as Types from "effect/Types";
|
|
42
|
-
import * as Document from "./Document";
|
|
43
|
-
import type * as Table from "./Table";
|
|
44
|
-
import * as QueryStreamKeyLabels from "./QueryStreamKeyLabels";
|
|
45
|
-
import * as QueryStreamKeyLayout from "./QueryStreamKeyLayout";
|
|
46
|
-
import * as QueryStreamOrderDirection from "./QueryStreamOrderDirection";
|
|
47
|
-
import * as QueryStreamKeyValues from "./QueryStreamKeyValues";
|
|
48
|
-
import * as QueryStreamKeyBounds from "./QueryStreamKeyBounds";
|
|
49
|
-
import * as QueryStreamIndexRange from "./QueryStreamIndexRange";
|
|
50
|
-
import * as QueryStreamReadBudget from "./QueryStreamReadBudget";
|
|
42
|
+
import * as Document from "./Document.js";
|
|
43
|
+
import type * as Table from "./Table.js";
|
|
44
|
+
import * as QueryStreamKeyLabels from "./QueryStreamKeyLabels.js";
|
|
45
|
+
import * as QueryStreamKeyLayout from "./QueryStreamKeyLayout.js";
|
|
46
|
+
import * as QueryStreamOrderDirection from "./QueryStreamOrderDirection.js";
|
|
47
|
+
import * as QueryStreamKeyValues from "./QueryStreamKeyValues.js";
|
|
48
|
+
import * as QueryStreamKeyBounds from "./QueryStreamKeyBounds.js";
|
|
49
|
+
import * as QueryStreamIndexRange from "./QueryStreamIndexRange.js";
|
|
50
|
+
import * as QueryStreamReadBudget from "./QueryStreamReadBudget.js";
|
|
51
|
+
/**
|
|
52
|
+
* Default physical row budget for `paginate` and `collect`. Supply an explicit
|
|
53
|
+
* `maximumRowsRead` to override it. Plain Effect Stream consumers use their
|
|
54
|
+
* enclosing budget and remain unlimited when none is provided.
|
|
55
|
+
*
|
|
56
|
+
* @experimental
|
|
57
|
+
*/
|
|
58
|
+
export declare const DEFAULT_MAXIMUM_ROWS_READ = 2000;
|
|
51
59
|
declare const ReadBudgetExceededError_base: Schema.Class<ReadBudgetExceededError, Schema.TaggedStruct<"ReadBudgetExceededError", {
|
|
52
60
|
readonly rowsRead: Schema.Natural;
|
|
53
61
|
readonly bytesRead: Schema.Natural;
|
|
54
62
|
}>, import("effect/Cause").YieldableError>;
|
|
55
63
|
/**
|
|
56
|
-
* A
|
|
64
|
+
* A query stream exhausted its read budget before its consumer could finish.
|
|
57
65
|
*
|
|
58
66
|
* @experimental
|
|
59
67
|
*/
|
|
@@ -131,13 +139,13 @@ export declare class MissingReversalRecipeError extends MissingReversalRecipeErr
|
|
|
131
139
|
*
|
|
132
140
|
* @experimental
|
|
133
141
|
*/
|
|
134
|
-
export { EmptyInitialPageError, InvalidPageSizeError, } from "./QueryStreamPagination";
|
|
142
|
+
export { EmptyInitialPageError, InvalidPageSizeError, } from "./QueryStreamPagination.js";
|
|
135
143
|
/**
|
|
136
144
|
* Invalid numeric read limits.
|
|
137
145
|
*
|
|
138
146
|
* @experimental
|
|
139
147
|
*/
|
|
140
|
-
export { InvalidReadLimitError } from "./QueryStreamReadBudget";
|
|
148
|
+
export { InvalidReadLimitError } from "./QueryStreamReadBudget.js";
|
|
141
149
|
/**
|
|
142
150
|
* Runtime identifier used to distinguish query streams from plain streams.
|
|
143
151
|
*
|
|
@@ -291,6 +299,38 @@ export declare const empty: <Doc>() => {
|
|
|
291
299
|
<const KeyLabels extends QueryStreamKeyLabels.QueryStreamKeyLabels>(keyLayout: QueryStreamKeyLayout.QueryStreamKeyLayout<KeyLabels>): QueryStream<Doc, KeyLabels, "asc", never, never>;
|
|
292
300
|
<const KeyLabels extends QueryStreamKeyLabels.QueryStreamKeyLabels, OrderDirection extends QueryStreamOrderDirection.QueryStreamOrderDirection>(keyLayout: QueryStreamKeyLayout.QueryStreamKeyLayout<KeyLabels>, orderDirection: OrderDirection): QueryStream<Doc, KeyLabels, OrderDirection, never, never>;
|
|
293
301
|
};
|
|
302
|
+
declare const DeferredStreamMismatchError_base: new <A extends Record<string, any> = {}>(args: Types.VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
303
|
+
readonly _tag: "DeferredStreamMismatchError";
|
|
304
|
+
} & Readonly<A>;
|
|
305
|
+
/**
|
|
306
|
+
* A deferred stream's resolved direction or layout differs from its
|
|
307
|
+
* declaration. The check runs on consumption, before the resolved source is
|
|
308
|
+
* pulled.
|
|
309
|
+
*
|
|
310
|
+
* @experimental
|
|
311
|
+
*/
|
|
312
|
+
export declare class DeferredStreamMismatchError extends DeferredStreamMismatchError_base<{
|
|
313
|
+
readonly expectedOrderDirection: QueryStreamOrderDirection.QueryStreamOrderDirection;
|
|
314
|
+
readonly actualOrderDirection: QueryStreamOrderDirection.QueryStreamOrderDirection;
|
|
315
|
+
readonly expectedKeyLayout: QueryStreamKeyLayout.QueryStreamKeyLayout;
|
|
316
|
+
readonly actualKeyLayout: QueryStreamKeyLayout.QueryStreamKeyLayout;
|
|
317
|
+
}> {
|
|
318
|
+
}
|
|
319
|
+
/**
|
|
320
|
+
* Defer an effect that checks access or constructs a query stream until it is
|
|
321
|
+
* pulled. Supply its layout and direction without reading documents. This lets
|
|
322
|
+
* `flatMap` build and narrow an inner stream before running its checks.
|
|
323
|
+
*
|
|
324
|
+
* The effect runs afresh on each consumption, seek, or reversal. Failures and
|
|
325
|
+
* service requirements are preserved. Its stream must match the declared layout
|
|
326
|
+
* and direction, or consumption dies with `DeferredStreamMismatchError`.
|
|
327
|
+
*
|
|
328
|
+
* @experimental
|
|
329
|
+
*/
|
|
330
|
+
export declare const defer: <Doc, KeyLabels extends QueryStreamKeyLabels.QueryStreamKeyLabels, OrderDirection extends QueryStreamOrderDirection.QueryStreamOrderDirection, E = never, R = never, E2 = never, R2 = never>(options: {
|
|
331
|
+
readonly keyLayout: QueryStreamKeyLayout.QueryStreamKeyLayout<KeyLabels>;
|
|
332
|
+
readonly orderDirection: OrderDirection;
|
|
333
|
+
}, make: Effect.Effect<QueryStream<Doc, KeyLabels, NoInfer<OrderDirection>, E, R>, E2, R2>) => QueryStream<Doc, KeyLabels, OrderDirection, E | E2, R | R2>;
|
|
294
334
|
/**
|
|
295
335
|
* Database access needed to rebuild a direct index query on each run. Normally
|
|
296
336
|
* supplied by `reader.table(...).stream(...)` rather than implemented
|
|
@@ -567,6 +607,34 @@ export declare const reverse: <Doc, KeyLabels extends QueryStreamKeyLabels.Query
|
|
|
567
607
|
* @experimental
|
|
568
608
|
*/
|
|
569
609
|
export declare const narrow: ((narrowBounds: QueryStreamKeyBounds.NarrowBounds) => <Doc, KeyLabels extends QueryStreamKeyLabels.QueryStreamKeyLabels, E, R, OrderDirection extends QueryStreamOrderDirection.QueryStreamOrderDirection>(self: QueryStream<Doc, KeyLabels, OrderDirection, E, R>) => QueryStream<Doc, KeyLabels, OrderDirection, E, R>) & (<Doc, KeyLabels extends QueryStreamKeyLabels.QueryStreamKeyLabels, E, R, OrderDirection extends QueryStreamOrderDirection.QueryStreamOrderDirection>(self: QueryStream<Doc, KeyLabels, OrderDirection, E, R>, narrowBounds: QueryStreamKeyBounds.NarrowBounds) => QueryStream<Doc, KeyLabels, OrderDirection, E, R>);
|
|
610
|
+
/**
|
|
611
|
+
* Read limits for `collect`. These count underlying index reads, including
|
|
612
|
+
* filtered rows and join inputs, rather than just emitted values. At either
|
|
613
|
+
* limit, one extra row may be read to distinguish completion from an overrun;
|
|
614
|
+
* it counts toward reported reads but is never emitted. This also applies at
|
|
615
|
+
* zero, so an empty stream completes under a zero budget.
|
|
616
|
+
*
|
|
617
|
+
* @experimental
|
|
618
|
+
*/
|
|
619
|
+
export interface CollectOptions {
|
|
620
|
+
readonly maximumRowsRead?: number;
|
|
621
|
+
readonly maximumBytesRead?: number;
|
|
622
|
+
}
|
|
623
|
+
/**
|
|
624
|
+
* Collect the whole query stream or fail with `ReadBudgetExceededError` when a
|
|
625
|
+
* read budget stops it. No partial array reaches the caller. Arbitrary I/O in
|
|
626
|
+
* callbacks is not counted. Use `paginate` for data that can grow without
|
|
627
|
+
* bound.
|
|
628
|
+
*
|
|
629
|
+
* With explicit options, each run gets a fresh budget. Without options, use the
|
|
630
|
+
* enclosing budget if present, or the default row budget.
|
|
631
|
+
*
|
|
632
|
+
* @experimental
|
|
633
|
+
*/
|
|
634
|
+
export declare const collect: {
|
|
635
|
+
(options?: CollectOptions): <Doc, KeyLabels extends QueryStreamKeyLabels.QueryStreamKeyLabels, E, R>(self: QueryStream<Doc, KeyLabels, QueryStreamOrderDirection.QueryStreamOrderDirection, E, R>) => Effect.Effect<Array<Doc>, E | ReadBudgetExceededError, R>;
|
|
636
|
+
<Doc, KeyLabels extends QueryStreamKeyLabels.QueryStreamKeyLabels, E, R>(self: QueryStream<Doc, KeyLabels, QueryStreamOrderDirection.QueryStreamOrderDirection, E, R>, options?: CollectOptions): Effect.Effect<Array<Doc>, E | ReadBudgetExceededError, R>;
|
|
637
|
+
};
|
|
570
638
|
declare const NotUniqueError_base: Schema.Class<NotUniqueError, Schema.TaggedStruct<"NotUniqueError", {}>, import("effect/Cause").YieldableError>;
|
|
571
639
|
/**
|
|
572
640
|
* `unique` found at least two emitted values. Narrow the query if at most one
|
|
@@ -598,11 +666,16 @@ export declare const unique: <Doc, KeyLabels extends QueryStreamKeyLabels.QueryS
|
|
|
598
666
|
* - `endCursor`: optional inclusive boundary returned by a previous page. Pins
|
|
599
667
|
* the page to a key range regardless of how many values it holds.
|
|
600
668
|
* - `maximumRowsRead`: optional budget for physical document reads from
|
|
601
|
-
* underlying query-stream indexes, including filtered documents.
|
|
669
|
+
* underlying query-stream indexes, including filtered documents. Defaults to
|
|
670
|
+
* 2,000; an explicit limit overrides the default.
|
|
602
671
|
* - `maximumBytesRead`: optional budget charging estimated document size on every
|
|
603
672
|
* read, not Convex's exact billed bytes. The final document can take the
|
|
604
673
|
* total over the limit because its size is known only after reading it.
|
|
605
674
|
*
|
|
675
|
+
* At either read limit, including zero, one extra row may be read to
|
|
676
|
+
* distinguish completion from an overrun. It is counted but never emitted. An
|
|
677
|
+
* empty stream completes under a zero budget.
|
|
678
|
+
*
|
|
606
679
|
* With `numItems: 0`, an existing cursor is returned unchanged with an empty
|
|
607
680
|
* page and `isDone: false`; a null cursor dies with `EmptyInitialPageError`.
|
|
608
681
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"QueryStream.d.ts","sourceRoot":"","sources":["../src/QueryStream.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,OAAO,KAAK,EACV,iBAAiB,IAAI,uBAAuB,EAC5C,gBAAgB,IAAI,sBAAsB,EAC3C,MAAM,eAAe,CAAC;AAGvB,OAAO,EAAiB,KAAK,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC/D,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AACtC,OAAO,KAAK,KAAK,OAAO,MAAM,gBAAgB,CAAC;AAE/C,OAAO,KAAK,IAAI,MAAM,aAAa,CAAC;AACpC,OAAO,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AAE,CAAC,2JAkBxE,CAAC;AAMF;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,MAAM,eAAe,GAAG,uBAAuB,CAAC;AAEtD;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,MAAM,gBAAgB,CAAC,GAAG,IAAI,sBAAsB,CAAC,GAAG,CAAC,CAAC;AAEhE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACH,eAAO,MAAM,QAAQ,EAAE;IACrB,CACE,OAAO,EAAE,eAAe,GACvB,CAAC,GAAG,EAAE,SAAS,SAAS,oBAAoB,CAAC,oBAAoB,EAAE,CAAC,EAAE,CAAC,EACxE,IAAI,EAAE,WAAW,CACf,GAAG,EACH,SAAS,EACT,yBAAyB,CAAC,yBAAyB,EACnD,CAAC,EACD,CAAC,CACF,KACE,MAAM,CAAC,MAAM,CAAC,gBAAgB,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,uBAAuB,EAAE,CAAC,CAAC,CAAC;IAC1E,CAAC,GAAG,EAAE,SAAS,SAAS,oBAAoB,CAAC,oBAAoB,EAAE,CAAC,EAAE,CAAC,EACrE,IAAI,EAAE,WAAW,CACf,GAAG,EACH,SAAS,EACT,yBAAyB,CAAC,yBAAyB,EACnD,CAAC,EACD,CAAC,CACF,EACD,OAAO,EAAE,eAAe,GACvB,MAAM,CAAC,MAAM,CAAC,gBAAgB,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,uBAAuB,EAAE,CAAC,CAAC,CAAC;CAoLzE,CAAC"}
|
package/dist/QueryStream.js
CHANGED
|
@@ -11,17 +11,17 @@ import { admittedByLower, admittedByUpper, forLayout, fromParsed, intersect, int
|
|
|
11
11
|
import { apply, equalityPrefixLength, fromBounds, toBounds as toBounds$1 } from "./QueryStreamIndexRange.js";
|
|
12
12
|
import { EmptyInitialPageError, InvalidPageSizeError, Range, Start, finish, initial, parseRequest, record } from "./QueryStreamPagination.js";
|
|
13
13
|
import { InvalidReadLimitError, Limits, QueryStreamReadBudget, make as make$1 } from "./QueryStreamReadBudget.js";
|
|
14
|
+
import * as Data from "effect/Data";
|
|
14
15
|
import * as Effect from "effect/Effect";
|
|
16
|
+
import * as Predicate from "effect/Predicate";
|
|
17
|
+
import * as Array from "effect/Array";
|
|
15
18
|
import * as Schema from "effect/Schema";
|
|
16
19
|
import { dual, identity, pipe } from "effect/Function";
|
|
17
20
|
import * as Match from "effect/Match";
|
|
18
21
|
import * as Option from "effect/Option";
|
|
19
22
|
import { ConvexError } from "convex/values";
|
|
20
|
-
import * as Array from "effect/Array";
|
|
21
23
|
import * as Order from "effect/Order";
|
|
22
|
-
import * as Predicate from "effect/Predicate";
|
|
23
24
|
import * as Result from "effect/Result";
|
|
24
|
-
import * as Data from "effect/Data";
|
|
25
25
|
import * as Stream from "effect/Stream";
|
|
26
26
|
import { pipeArguments } from "effect/Pipeable";
|
|
27
27
|
import * as Chunk from "effect/Chunk";
|
|
@@ -32,6 +32,8 @@ import * as String from "effect/String";
|
|
|
32
32
|
import * as Tuple from "effect/Tuple";
|
|
33
33
|
//#region src/QueryStream.ts
|
|
34
34
|
var QueryStream_exports = /* @__PURE__ */ __exportAll({
|
|
35
|
+
DEFAULT_MAXIMUM_ROWS_READ: () => DEFAULT_MAXIMUM_ROWS_READ,
|
|
36
|
+
DeferredStreamMismatchError: () => DeferredStreamMismatchError,
|
|
35
37
|
Element: () => Element,
|
|
36
38
|
EmptyInitialPageError: () => EmptyInitialPageError,
|
|
37
39
|
IncompatibleStreamsError: () => IncompatibleStreamsError,
|
|
@@ -44,6 +46,8 @@ var QueryStream_exports = /* @__PURE__ */ __exportAll({
|
|
|
44
46
|
QueryStream: () => QueryStream,
|
|
45
47
|
ReadBudgetExceededError: () => ReadBudgetExceededError,
|
|
46
48
|
TypeId: () => TypeId,
|
|
49
|
+
collect: () => collect,
|
|
50
|
+
defer: () => defer,
|
|
47
51
|
distinct: () => distinct,
|
|
48
52
|
empty: () => empty,
|
|
49
53
|
filter: () => filter,
|
|
@@ -61,7 +65,15 @@ var QueryStream_exports = /* @__PURE__ */ __exportAll({
|
|
|
61
65
|
unique: () => unique
|
|
62
66
|
});
|
|
63
67
|
/**
|
|
64
|
-
*
|
|
68
|
+
* Default physical row budget for `paginate` and `collect`. Supply an explicit
|
|
69
|
+
* `maximumRowsRead` to override it. Plain Effect Stream consumers use their
|
|
70
|
+
* enclosing budget and remain unlimited when none is provided.
|
|
71
|
+
*
|
|
72
|
+
* @experimental
|
|
73
|
+
*/
|
|
74
|
+
const DEFAULT_MAXIMUM_ROWS_READ = 2e3;
|
|
75
|
+
/**
|
|
76
|
+
* A query stream exhausted its read budget before its consumer could finish.
|
|
65
77
|
*
|
|
66
78
|
* @experimental
|
|
67
79
|
*/
|
|
@@ -70,7 +82,7 @@ var ReadBudgetExceededError = class extends Schema.TaggedError()("ReadBudgetExce
|
|
|
70
82
|
bytesRead: Schema.Natural
|
|
71
83
|
}) {
|
|
72
84
|
get message() {
|
|
73
|
-
return "The read budget was exhausted before
|
|
85
|
+
return "The read budget was exhausted before the query stream completed; increase the budget or simplify the query";
|
|
74
86
|
}
|
|
75
87
|
};
|
|
76
88
|
/**
|
|
@@ -234,6 +246,40 @@ const empty = () => (keyLayout, orderDirection = "asc") => {
|
|
|
234
246
|
return make(orderDirection);
|
|
235
247
|
};
|
|
236
248
|
/**
|
|
249
|
+
* A deferred stream's resolved direction or layout differs from its
|
|
250
|
+
* declaration. The check runs on consumption, before the resolved source is
|
|
251
|
+
* pulled.
|
|
252
|
+
*
|
|
253
|
+
* @experimental
|
|
254
|
+
*/
|
|
255
|
+
var DeferredStreamMismatchError = class extends Data.TaggedError("DeferredStreamMismatchError") {};
|
|
256
|
+
/**
|
|
257
|
+
* Defer an effect that checks access or constructs a query stream until it is
|
|
258
|
+
* pulled. Supply its layout and direction without reading documents. This lets
|
|
259
|
+
* `flatMap` build and narrow an inner stream before running its checks.
|
|
260
|
+
*
|
|
261
|
+
* The effect runs afresh on each consumption, seek, or reversal. Failures and
|
|
262
|
+
* service requirements are preserved. Its stream must match the declared layout
|
|
263
|
+
* and direction, or consumption dies with `DeferredStreamMismatchError`.
|
|
264
|
+
*
|
|
265
|
+
* @experimental
|
|
266
|
+
*/
|
|
267
|
+
const defer = (options, make) => {
|
|
268
|
+
const checked = Effect.map(make, (stream) => {
|
|
269
|
+
if (stream.orderDirection !== options.orderDirection || !Equivalence(stream.keyLayout, options.keyLayout)) throw new DeferredStreamMismatchError({
|
|
270
|
+
expectedOrderDirection: options.orderDirection,
|
|
271
|
+
actualOrderDirection: stream.orderDirection,
|
|
272
|
+
expectedKeyLayout: options.keyLayout,
|
|
273
|
+
actualKeyLayout: stream.keyLayout
|
|
274
|
+
});
|
|
275
|
+
return stream;
|
|
276
|
+
});
|
|
277
|
+
return new QueryStream(options.orderDirection, options.keyLayout, Stream.unwrap(Effect.map(checked, (stream) => stream.annotated)), void 0, (bounds) => defer(options, Effect.map(checked, (stream) => narrowByParsedBounds(stream, bounds))), () => defer({
|
|
278
|
+
...options,
|
|
279
|
+
orderDirection: flip(options.orderDirection)
|
|
280
|
+
}, Effect.map(checked, reverse)));
|
|
281
|
+
};
|
|
282
|
+
/**
|
|
237
283
|
* Create a reusable query stream from an index-query description. Prefer
|
|
238
284
|
* `reader.table(...).stream(...)` for inferred document and ordering types.
|
|
239
285
|
*
|
|
@@ -795,6 +841,30 @@ const narrowInMemory = (self, parsedBounds) => {
|
|
|
795
841
|
return new QueryStream(self.orderDirection, self.keyLayout, pipe(self.annotated, dropOutOfRange, takeInRange), void 0, void 0, self.reverseWith === void 0 ? void 0 : () => narrowInMemory(reverse(self), parsedBounds));
|
|
796
842
|
};
|
|
797
843
|
/**
|
|
844
|
+
* Collect the whole query stream or fail with `ReadBudgetExceededError` when a
|
|
845
|
+
* read budget stops it. No partial array reaches the caller. Arbitrary I/O in
|
|
846
|
+
* callbacks is not counted. Use `paginate` for data that can grow without
|
|
847
|
+
* bound.
|
|
848
|
+
*
|
|
849
|
+
* With explicit options, each run gets a fresh budget. Without options, use the
|
|
850
|
+
* enclosing budget if present, or the default row budget.
|
|
851
|
+
*
|
|
852
|
+
* @experimental
|
|
853
|
+
*/
|
|
854
|
+
const collect = dual((args) => isQueryStream(args[0]), Effect.fn("QueryStream.collect")(function* (self, options) {
|
|
855
|
+
const makeBudget = Schema.decodeEffect(Limits)({
|
|
856
|
+
maximumRowsRead: DEFAULT_MAXIMUM_ROWS_READ,
|
|
857
|
+
...options
|
|
858
|
+
}).pipe(Effect.catchTag("SchemaError", (cause) => Effect.die(new InvalidReadLimitError({ cause }))), Effect.flatMap(make$1));
|
|
859
|
+
const budget = yield* options === void 0 ? Effect.serviceOption(QueryStreamReadBudget).pipe(Effect.flatMap(Option.match({
|
|
860
|
+
onNone: () => makeBudget,
|
|
861
|
+
onSome: Effect.succeed
|
|
862
|
+
}))) : makeBudget;
|
|
863
|
+
const rows = yield* Stream.runCollect(self.toStream()).pipe(Effect.provideService(QueryStreamReadBudget, budget));
|
|
864
|
+
if (yield* budget.isStopped) return yield* new ReadBudgetExceededError(yield* budget.getReadCounts);
|
|
865
|
+
return rows;
|
|
866
|
+
}));
|
|
867
|
+
/**
|
|
798
868
|
* `unique` found at least two emitted values. Narrow the query if at most one
|
|
799
869
|
* value was expected, or use another consumer to handle multiple results.
|
|
800
870
|
*
|
|
@@ -904,7 +974,7 @@ const paginate = dual(2, Effect.fn("QueryStream.paginate")(function* (self, opti
|
|
|
904
974
|
upper: start
|
|
905
975
|
}), identity));
|
|
906
976
|
const readBudget = yield* QueryStreamReadBudget;
|
|
907
|
-
const collected = yield* Stream.run(narrowed.annotated, Sink.fold(() => initial(), (state) => state._tag === "Reading", (state, { doc, keyValues }) => Effect.map(readBudget.
|
|
977
|
+
const collected = yield* Stream.run(narrowed.annotated, Sink.fold(() => initial(), (state) => state._tag === "Reading", (state, { doc, keyValues }) => Effect.map(readBudget.isStopped, (hitLimit) => record(request, state, doc, complete$2(keyValues), hitLimit))));
|
|
908
978
|
const stopped = yield* readBudget.isStopped;
|
|
909
979
|
const outcome = finish(request, collected, stopped);
|
|
910
980
|
if (Result.isFailure(outcome)) return yield* new ReadBudgetExceededError(yield* readBudget.getReadCounts);
|
|
@@ -936,8 +1006,11 @@ const paginate = dual(2, Effect.fn("QueryStream.paginate")(function* (self, opti
|
|
|
936
1006
|
SplitRequired: encodeSplit,
|
|
937
1007
|
SplitRecommended: encodeSplit
|
|
938
1008
|
}));
|
|
939
|
-
}, (effect, _self, options) => Effect.provideServiceEffect(effect, QueryStreamReadBudget, Schema.decodeEffect(Limits)(
|
|
1009
|
+
}, (effect, _self, options) => Effect.provideServiceEffect(effect, QueryStreamReadBudget, Schema.decodeEffect(Limits)({
|
|
1010
|
+
maximumRowsRead: DEFAULT_MAXIMUM_ROWS_READ,
|
|
1011
|
+
...options
|
|
1012
|
+
}).pipe(Effect.catchTag("SchemaError", (cause) => Effect.die(new InvalidReadLimitError({ cause }))), Effect.flatMap(make$1)))));
|
|
940
1013
|
//#endregion
|
|
941
|
-
export { Element, EmptyInitialPageError, IncompatibleStreamsError, InnerStreamLayoutMismatchError, InnerStreamOrderMismatchError, InvalidPageSizeError, InvalidReadLimitError, MissingReversalRecipeError, NotUniqueError, QueryStream, QueryStream_exports, ReadBudgetExceededError, TypeId, distinct, empty, filter, filterEffect, flatMap, fromReflection, isQueryStream, map, mapEffect, merge, narrow, paginate, renameKey, reverse, unique };
|
|
1014
|
+
export { DEFAULT_MAXIMUM_ROWS_READ, DeferredStreamMismatchError, Element, EmptyInitialPageError, IncompatibleStreamsError, InnerStreamLayoutMismatchError, InnerStreamOrderMismatchError, InvalidPageSizeError, InvalidReadLimitError, MissingReversalRecipeError, NotUniqueError, QueryStream, QueryStream_exports, ReadBudgetExceededError, TypeId, collect, defer, distinct, empty, filter, filterEffect, flatMap, fromReflection, isQueryStream, map, mapEffect, merge, narrow, paginate, renameKey, reverse, unique };
|
|
942
1015
|
|
|
943
1016
|
//# sourceMappingURL=QueryStream.js.map
|