@gaganref/confect-server 10.3.1-fork.3 → 10.3.1-fork.31
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 +131 -23
- package/dist/QueryStream.d.ts.map +1 -1
- package/dist/QueryStream.js +142 -40
- 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 +406 -76
- 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
package/src/QueryStreamCursor.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import * as Array from "effect/Array";
|
|
2
2
|
import * as Effect from "effect/Effect";
|
|
3
|
-
import * as QueryStreamKey from "./QueryStreamKey";
|
|
3
|
+
import * as QueryStreamKey from "./QueryStreamKey.js";
|
|
4
4
|
import * as SchemaIssue from "effect/SchemaIssue";
|
|
5
5
|
import * as Match from "effect/Match";
|
|
6
6
|
import * as Schema from "effect/Schema";
|
|
7
7
|
import * as SchemaGetter from "effect/SchemaGetter";
|
|
8
|
-
import * as QueryStreamKeyLayout from "./QueryStreamKeyLayout";
|
|
9
|
-
import * as QueryStreamKeyValues from "./QueryStreamKeyValues";
|
|
8
|
+
import * as QueryStreamKeyLayout from "./QueryStreamKeyLayout.js";
|
|
9
|
+
import * as QueryStreamKeyValues from "./QueryStreamKeyValues.js";
|
|
10
10
|
|
|
11
11
|
// Serialized labels are a cursor boundary representation. They include every
|
|
12
12
|
// runtime position but do not preserve implicitness.
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as Array from "effect/Array";
|
|
2
2
|
import * as Data from "effect/Data";
|
|
3
3
|
import * as Result from "effect/Result";
|
|
4
|
-
import type * as QueryStreamKey from "./QueryStreamKey";
|
|
5
|
-
import type * as QueryStreamKeyValues from "./QueryStreamKeyValues";
|
|
4
|
+
import type * as QueryStreamKey from "./QueryStreamKey.js";
|
|
5
|
+
import type * as QueryStreamKeyValues from "./QueryStreamKeyValues.js";
|
|
6
6
|
|
|
7
7
|
const TypeId = "~@confect/server/QueryStreamIndexPrefix";
|
|
8
8
|
|
|
@@ -11,10 +11,10 @@ import * as Match from "effect/Match";
|
|
|
11
11
|
import * as Option from "effect/Option";
|
|
12
12
|
import * as Result from "effect/Result";
|
|
13
13
|
import type * as Types from "effect/Types";
|
|
14
|
-
import * as QueryStreamIndexPrefix from "./QueryStreamIndexPrefix";
|
|
15
|
-
import * as QueryStreamKeyBounds from "./QueryStreamKeyBounds";
|
|
16
|
-
import * as QueryStreamKeyValues from "./QueryStreamKeyValues";
|
|
17
|
-
import type * as QueryStreamOrderDirection from "./QueryStreamOrderDirection";
|
|
14
|
+
import * as QueryStreamIndexPrefix from "./QueryStreamIndexPrefix.js";
|
|
15
|
+
import * as QueryStreamKeyBounds from "./QueryStreamKeyBounds.js";
|
|
16
|
+
import * as QueryStreamKeyValues from "./QueryStreamKeyValues.js";
|
|
17
|
+
import type * as QueryStreamOrderDirection from "./QueryStreamOrderDirection.js";
|
|
18
18
|
|
|
19
19
|
type Head<FieldPaths extends ReadonlyArray<string>> =
|
|
20
20
|
FieldPaths extends readonly [infer H extends string, ...ReadonlyArray<string>]
|
package/src/QueryStreamKey.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as Data from "effect/Data";
|
|
2
2
|
import * as Predicate from "effect/Predicate";
|
|
3
3
|
import * as Result from "effect/Result";
|
|
4
|
-
import * as QueryStreamKeyLayout from "./QueryStreamKeyLayout";
|
|
5
|
-
import type * as QueryStreamKeyValues from "./QueryStreamKeyValues";
|
|
4
|
+
import * as QueryStreamKeyLayout from "./QueryStreamKeyLayout.js";
|
|
5
|
+
import type * as QueryStreamKeyValues from "./QueryStreamKeyValues.js";
|
|
6
6
|
|
|
7
7
|
const TypeId = "~@confect/server/QueryStreamKey";
|
|
8
8
|
|
|
@@ -3,9 +3,9 @@ import * as Data from "effect/Data";
|
|
|
3
3
|
import * as Option from "effect/Option";
|
|
4
4
|
import * as Order from "effect/Order";
|
|
5
5
|
import * as Result from "effect/Result";
|
|
6
|
-
import * as QueryStreamKey from "./QueryStreamKey";
|
|
7
|
-
import * as QueryStreamKeyLayout from "./QueryStreamKeyLayout";
|
|
8
|
-
import * as QueryStreamKeyValues from "./QueryStreamKeyValues";
|
|
6
|
+
import * as QueryStreamKey from "./QueryStreamKey.js";
|
|
7
|
+
import * as QueryStreamKeyLayout from "./QueryStreamKeyLayout.js";
|
|
8
|
+
import * as QueryStreamKeyValues from "./QueryStreamKeyValues.js";
|
|
9
9
|
|
|
10
10
|
// A bound's key may be a *prefix* of the full key: bounding by `["a"]` means
|
|
11
11
|
// bounding by the whole family of keys that start with `"a"`. To compare
|
|
@@ -6,7 +6,7 @@ import * as Option from "effect/Option";
|
|
|
6
6
|
import * as Result from "effect/Result";
|
|
7
7
|
import type * as Types from "effect/Types";
|
|
8
8
|
|
|
9
|
-
import * as QueryStreamKeyLabels from "./QueryStreamKeyLabels";
|
|
9
|
+
import * as QueryStreamKeyLabels from "./QueryStreamKeyLabels.js";
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* One runtime position of a stream key. Explicit IDs and their aliases are
|
|
@@ -12,7 +12,7 @@ import * as Result from "effect/Result";
|
|
|
12
12
|
import * as Schema from "effect/Schema";
|
|
13
13
|
import * as SchemaGetter from "effect/SchemaGetter";
|
|
14
14
|
import * as SchemaIssue from "effect/SchemaIssue";
|
|
15
|
-
import type * as QueryStreamOrderDirection from "./QueryStreamOrderDirection";
|
|
15
|
+
import type * as QueryStreamOrderDirection from "./QueryStreamOrderDirection.js";
|
|
16
16
|
|
|
17
17
|
const UNDEFINED_SENTINEL = { $undefined: true } as const;
|
|
18
18
|
const KeyValue = Schema.Json.pipe(
|
|
@@ -4,8 +4,8 @@ import * as Match from "effect/Match";
|
|
|
4
4
|
import * as Option from "effect/Option";
|
|
5
5
|
import * as Result from "effect/Result";
|
|
6
6
|
import * as Schema from "effect/Schema";
|
|
7
|
-
import type * as QueryStreamKey from "./QueryStreamKey";
|
|
8
|
-
import * as QueryStreamKeyValues from "./QueryStreamKeyValues";
|
|
7
|
+
import type * as QueryStreamKey from "./QueryStreamKey.js";
|
|
8
|
+
import * as QueryStreamKeyValues from "./QueryStreamKeyValues.js";
|
|
9
9
|
|
|
10
10
|
const PageSize = Schema.Natural.pipe(
|
|
11
11
|
Schema.brand("~@confect/server/QueryStreamPagination/PageSize"),
|
|
@@ -22,8 +22,9 @@ export interface QueryStreamReadBudget {
|
|
|
22
22
|
readonly getReadCounts: Effect.Effect<ReadCounts>;
|
|
23
23
|
/**
|
|
24
24
|
* Returns a stream that records reads against this budget and stops
|
|
25
|
-
* requesting further batches once exhausted
|
|
26
|
-
*
|
|
25
|
+
* requesting further batches once exhausted, except for one limit-boundary
|
|
26
|
+
* lookahead to detect completion. Apply directly to the document source
|
|
27
|
+
* before buffering, filtering, or combining its output.
|
|
27
28
|
*/
|
|
28
29
|
readonly accountFor: (
|
|
29
30
|
encodedDocuments: Stream.Stream<unknown>,
|
|
@@ -133,10 +134,22 @@ export const make = Effect.fnUntraced(function* (
|
|
|
133
134
|
SynchronizedRef.modifyEffect(stateRef, (state) =>
|
|
134
135
|
Effect.gen(function* () {
|
|
135
136
|
if (isExhausted(state, limits)) {
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
137
|
+
const canProbeEnd =
|
|
138
|
+
State.$is("Active")(state) &&
|
|
139
|
+
!Option.exists(
|
|
140
|
+
limits.maximumRowsRead,
|
|
141
|
+
(limit) => state.rowsRead > limit,
|
|
142
|
+
) &&
|
|
143
|
+
!Option.exists(
|
|
144
|
+
limits.maximumBytesRead,
|
|
145
|
+
(limit) => state.bytesRead > limit,
|
|
146
|
+
);
|
|
147
|
+
// Iterators expose completion only through a pull. Count a
|
|
148
|
+
// lookahead row, but never publish it beyond either limit.
|
|
149
|
+
const counts = canProbeEnd
|
|
150
|
+
? record(state, yield* pull)
|
|
151
|
+
: readCounts(state);
|
|
152
|
+
return Tuple.make(Option.none(), State.Stopped(counts));
|
|
140
153
|
}
|
|
141
154
|
const documents = yield* pull;
|
|
142
155
|
return Tuple.make(
|
|
@@ -24,27 +24,27 @@ import * as Layer from "effect/Layer";
|
|
|
24
24
|
import * as Match from "effect/Match";
|
|
25
25
|
import * as Schema from "effect/Schema";
|
|
26
26
|
import * as EffectScheduler from "effect/Scheduler";
|
|
27
|
-
import * as Auth from "./Auth";
|
|
28
|
-
import * as ConvexConfigProvider from "./ConvexConfigProvider";
|
|
29
|
-
import * as DatabaseReader from "./DatabaseReader";
|
|
30
|
-
import type * as DatabaseSchema from "./DatabaseSchema";
|
|
31
|
-
import * as DatabaseWriter from "./DatabaseWriter";
|
|
32
|
-
import type * as DataModel from "./DataModel";
|
|
33
|
-
import * as ExecutionMetadata from "./ExecutionMetadata";
|
|
34
|
-
import * as RequestMetadata from "./RequestMetadata";
|
|
35
|
-
import * as TransactionMetadata from "./TransactionMetadata";
|
|
36
|
-
import * as MutationCtx from "./MutationCtx";
|
|
37
|
-
import * as MutationRunner from "./MutationRunner";
|
|
38
|
-
import * as MutationTransactionContext from "./MutationTransactionContext";
|
|
39
|
-
import * as QueryCtx from "./QueryCtx";
|
|
40
|
-
import * as QueryRunner from "./QueryRunner";
|
|
41
|
-
import * as QueryTransactionContext from "./QueryTransactionContext";
|
|
42
|
-
import * as RegisteredFunction from "./RegisteredFunction";
|
|
43
|
-
import type * as FunctionRegistryItem from "./FunctionRegistryItem";
|
|
44
|
-
import type * as ResolvedMiddleware from "./ResolvedMiddleware";
|
|
45
|
-
import * as Scheduler from "./Scheduler";
|
|
46
|
-
import { StorageWriter } from "./StorageWriter";
|
|
47
|
-
import type * as Handler from "./Handler";
|
|
27
|
+
import * as Auth from "./Auth.js";
|
|
28
|
+
import * as ConvexConfigProvider from "./ConvexConfigProvider.js";
|
|
29
|
+
import * as DatabaseReader from "./DatabaseReader.js";
|
|
30
|
+
import type * as DatabaseSchema from "./DatabaseSchema.js";
|
|
31
|
+
import * as DatabaseWriter from "./DatabaseWriter.js";
|
|
32
|
+
import type * as DataModel from "./DataModel.js";
|
|
33
|
+
import * as ExecutionMetadata from "./ExecutionMetadata.js";
|
|
34
|
+
import * as RequestMetadata from "./RequestMetadata.js";
|
|
35
|
+
import * as TransactionMetadata from "./TransactionMetadata.js";
|
|
36
|
+
import * as MutationCtx from "./MutationCtx.js";
|
|
37
|
+
import * as MutationRunner from "./MutationRunner.js";
|
|
38
|
+
import * as MutationTransactionContext from "./MutationTransactionContext.js";
|
|
39
|
+
import * as QueryCtx from "./QueryCtx.js";
|
|
40
|
+
import * as QueryRunner from "./QueryRunner.js";
|
|
41
|
+
import * as QueryTransactionContext from "./QueryTransactionContext.js";
|
|
42
|
+
import * as RegisteredFunction from "./RegisteredFunction.js";
|
|
43
|
+
import type * as FunctionRegistryItem from "./FunctionRegistryItem.js";
|
|
44
|
+
import type * as ResolvedMiddleware from "./ResolvedMiddleware.js";
|
|
45
|
+
import * as Scheduler from "./Scheduler.js";
|
|
46
|
+
import { StorageWriter } from "./StorageWriter.js";
|
|
47
|
+
import type * as Handler from "./Handler.js";
|
|
48
48
|
|
|
49
49
|
export type Definition = Data.TaggedEnum<{
|
|
50
50
|
PublicQuery: ReturnType<typeof queryFunction>;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import * as ActionCallSpec from "@confect/core/ActionCall";
|
|
2
|
+
import * as ActionCall from "./ActionCall.js";
|
|
1
3
|
import type { FunctionSpec, RuntimeAndFunctionType } from "@confect/core";
|
|
2
4
|
import * as IdScope from "@confect/core/IdScope";
|
|
3
5
|
import type * as FunctionProvenance from "@confect/core/FunctionProvenance";
|
|
@@ -25,24 +27,24 @@ import * as Result from "effect/Result";
|
|
|
25
27
|
import * as Layer from "effect/Layer";
|
|
26
28
|
import * as Schema from "effect/Schema";
|
|
27
29
|
import type * as EffectScheduler from "effect/Scheduler";
|
|
28
|
-
import * as ActionCtx from "./ActionCtx";
|
|
29
|
-
import * as ActionRunner from "./ActionRunner";
|
|
30
|
-
import * as Auth from "./Auth";
|
|
31
|
-
import * as ConvexLogger from "./ConvexLogger";
|
|
32
|
-
import type * as DatabaseSchema from "./DatabaseSchema";
|
|
33
|
-
import type * as DataModel from "./DataModel";
|
|
34
|
-
import * as ExecutionMetadata from "./ExecutionMetadata";
|
|
35
|
-
import * as RequestMetadata from "./RequestMetadata";
|
|
36
|
-
import * as MutationRunner from "./MutationRunner";
|
|
37
|
-
import * as QueryRunner from "./QueryRunner";
|
|
38
|
-
import type * as ResolvedMiddleware from "./ResolvedMiddleware";
|
|
39
|
-
import * as Scheduler from "./Scheduler";
|
|
40
|
-
import * as Storage from "./Storage";
|
|
41
|
-
import * as StorageActionWriter from "./StorageActionWriter";
|
|
42
|
-
import type * as StorageReader from "./StorageReader";
|
|
43
|
-
import * as StorageWriter from "./StorageWriter";
|
|
44
|
-
import * as VectorSearch from "./VectorSearch";
|
|
45
|
-
import type * as Handler from "./Handler";
|
|
30
|
+
import * as ActionCtx from "./ActionCtx.js";
|
|
31
|
+
import * as ActionRunner from "./ActionRunner.js";
|
|
32
|
+
import * as Auth from "./Auth.js";
|
|
33
|
+
import * as ConvexLogger from "./ConvexLogger.js";
|
|
34
|
+
import type * as DatabaseSchema from "./DatabaseSchema.js";
|
|
35
|
+
import type * as DataModel from "./DataModel.js";
|
|
36
|
+
import * as ExecutionMetadata from "./ExecutionMetadata.js";
|
|
37
|
+
import * as RequestMetadata from "./RequestMetadata.js";
|
|
38
|
+
import * as MutationRunner from "./MutationRunner.js";
|
|
39
|
+
import * as QueryRunner from "./QueryRunner.js";
|
|
40
|
+
import type * as ResolvedMiddleware from "./ResolvedMiddleware.js";
|
|
41
|
+
import * as Scheduler from "./Scheduler.js";
|
|
42
|
+
import * as Storage from "./Storage.js";
|
|
43
|
+
import * as StorageActionWriter from "./StorageActionWriter.js";
|
|
44
|
+
import type * as StorageReader from "./StorageReader.js";
|
|
45
|
+
import * as StorageWriter from "./StorageWriter.js";
|
|
46
|
+
import * as VectorSearch from "./VectorSearch.js";
|
|
47
|
+
import type * as Handler from "./Handler.js";
|
|
46
48
|
|
|
47
49
|
export type Any =
|
|
48
50
|
| RegisteredQuery<FunctionVisibility, DefaultFunctionArgs, any>
|
|
@@ -299,6 +301,12 @@ export const actionFunctionBase = <
|
|
|
299
301
|
Schema.decodeUnknownEffect(args),
|
|
300
302
|
Effect.catchTag("SchemaError", Effect.die),
|
|
301
303
|
);
|
|
304
|
+
const restricted = resolvedMiddlewares.some(
|
|
305
|
+
({ middlewareSpec }) =>
|
|
306
|
+
middlewareSpec.key === ActionCallSpec.Middleware.key,
|
|
307
|
+
)
|
|
308
|
+
? restrict(ctx)
|
|
309
|
+
: undefined;
|
|
302
310
|
// oxlint-disable-next-line effecttsgo/any-unknown-in-error-context -- Middleware errors are intentionally erased here and validated by runHandlerPromise against the combined error schema below.
|
|
303
311
|
const decodedReturns = yield* applyMiddleware(
|
|
304
312
|
handler(decodedArgs),
|
|
@@ -309,7 +317,8 @@ export const actionFunctionBase = <
|
|
|
309
317
|
functionVisibility,
|
|
310
318
|
args: decodedArgs,
|
|
311
319
|
},
|
|
312
|
-
).pipe(Effect.provide(createLayer(ctx)));
|
|
320
|
+
).pipe(Effect.provide(createLayer(restricted?.ctx ?? ctx)));
|
|
321
|
+
if (restricted !== undefined) yield* restricted.check;
|
|
313
322
|
return yield* pipe(
|
|
314
323
|
decodedReturns,
|
|
315
324
|
Schema.encodeEffect(returns),
|
|
@@ -389,3 +398,47 @@ export const storageLayer = <Scope extends IdScope.IdScope>(
|
|
|
389
398
|
Storage.layer(reader) as Layer.Layer<
|
|
390
399
|
Storage.Storage | StorageReader.ForScope<Scope>
|
|
391
400
|
>;
|
|
401
|
+
|
|
402
|
+
/**
|
|
403
|
+
* Shares one dispatch budget across the entire middleware chain.
|
|
404
|
+
*/
|
|
405
|
+
const restrict = <Model extends GenericDataModel>(
|
|
406
|
+
ctx: GenericActionCtx<Model>,
|
|
407
|
+
) => {
|
|
408
|
+
let dispatched = false;
|
|
409
|
+
const claim = () => {
|
|
410
|
+
if (dispatched) throw new ActionCall.ActionCallAlreadyUsed();
|
|
411
|
+
dispatched = true;
|
|
412
|
+
};
|
|
413
|
+
const restricted: GenericActionCtx<Model> = {
|
|
414
|
+
...ctx,
|
|
415
|
+
scheduler: {
|
|
416
|
+
runAfter: () => {
|
|
417
|
+
throw new ActionCall.SchedulingNotAllowed();
|
|
418
|
+
},
|
|
419
|
+
runAt: () => {
|
|
420
|
+
throw new ActionCall.SchedulingNotAllowed();
|
|
421
|
+
},
|
|
422
|
+
cancel: () => {
|
|
423
|
+
throw new ActionCall.SchedulingNotAllowed();
|
|
424
|
+
},
|
|
425
|
+
},
|
|
426
|
+
runQuery: (...args) => {
|
|
427
|
+
claim();
|
|
428
|
+
return ctx.runQuery(...args);
|
|
429
|
+
},
|
|
430
|
+
runMutation: (...args) => {
|
|
431
|
+
claim();
|
|
432
|
+
return ctx.runMutation(...args);
|
|
433
|
+
},
|
|
434
|
+
runAction: () => {
|
|
435
|
+
throw new ActionCall.NestedActionNotAllowed();
|
|
436
|
+
},
|
|
437
|
+
};
|
|
438
|
+
return {
|
|
439
|
+
ctx: restricted,
|
|
440
|
+
check: Effect.suspend(() =>
|
|
441
|
+
dispatched ? Effect.void : Effect.die(new ActionCall.ActionCallNotUsed()),
|
|
442
|
+
),
|
|
443
|
+
};
|
|
444
|
+
};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import * as ConvexFunctionDefinitions from "./ConvexFunctionDefinitions";
|
|
1
|
+
import * as ConvexFunctionDefinitions from "./ConvexFunctionDefinitions.js";
|
|
2
2
|
import type * as FunctionSpec from "@confect/core/FunctionSpec";
|
|
3
3
|
import type * as GroupSpec from "@confect/core/GroupSpec";
|
|
4
4
|
import type * as Spec from "@confect/core/Spec";
|
|
5
5
|
import type { Layer, Types } from "effect";
|
|
6
|
-
import type * as DatabaseSchema from "./DatabaseSchema";
|
|
7
|
-
import type * as GroupImpl from "./GroupImpl";
|
|
8
|
-
import type * as RegisteredFunction from "./RegisteredFunction";
|
|
6
|
+
import type * as DatabaseSchema from "./DatabaseSchema.js";
|
|
7
|
+
import type * as GroupImpl from "./GroupImpl.js";
|
|
8
|
+
import type * as RegisteredFunction from "./RegisteredFunction.js";
|
|
9
9
|
|
|
10
10
|
export type RegisteredFunctions<Spec_ extends Spec.AnyWithProps> =
|
|
11
11
|
Types.Simplify<RegisteredFunctionsHelper<Spec.Groups<Spec_>>>;
|
|
@@ -9,15 +9,15 @@ import type { Effect } from "effect";
|
|
|
9
9
|
import type { Schema } from "effect";
|
|
10
10
|
import * as Layer from "effect/Layer";
|
|
11
11
|
import * as Match from "effect/Match";
|
|
12
|
-
import type * as DatabaseSchema from "./DatabaseSchema";
|
|
13
|
-
import * as RegisteredFunction from "./RegisteredFunction";
|
|
14
|
-
import * as FunctionRegistryItem from "./FunctionRegistryItem";
|
|
15
|
-
import * as ResolvedMiddleware from "./ResolvedMiddleware";
|
|
16
|
-
import * as GroupRegistry from "./GroupRegistry";
|
|
12
|
+
import type * as DatabaseSchema from "./DatabaseSchema.js";
|
|
13
|
+
import * as RegisteredFunction from "./RegisteredFunction.js";
|
|
14
|
+
import * as FunctionRegistryItem from "./FunctionRegistryItem.js";
|
|
15
|
+
import * as ResolvedMiddleware from "./ResolvedMiddleware.js";
|
|
16
|
+
import * as GroupRegistry from "./GroupRegistry.js";
|
|
17
17
|
import type * as GroupSpec from "@confect/core/GroupSpec";
|
|
18
|
-
import type * as GroupImpl from "./GroupImpl";
|
|
19
|
-
import type * as RegisteredFunctions from "./RegisteredFunctions";
|
|
20
|
-
import { mapLeaves } from "./internal/utils";
|
|
18
|
+
import type * as GroupImpl from "./GroupImpl.js";
|
|
19
|
+
import type * as RegisteredFunctions from "./RegisteredFunctions.js";
|
|
20
|
+
import { mapLeaves } from "./internal/utils.js";
|
|
21
21
|
|
|
22
22
|
export const buildForGroup = <Group extends GroupSpec.AnyWithProps>(
|
|
23
23
|
databaseSchema: DatabaseSchema.AnyWithProps,
|
package/src/Registry.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as Context from "effect/Context";
|
|
2
2
|
import * as Ref from "effect/Ref";
|
|
3
|
-
import type { RegistryItems } from "./RegistryItems";
|
|
3
|
+
import type { RegistryItems } from "./RegistryItems.js";
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Effect `Context.Reference` shared by everything that touches a group's
|
package/src/RegistryItems.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as Array from "effect/Array";
|
|
2
2
|
import { pipe } from "effect/Function";
|
|
3
3
|
import * as Record from "effect/Record";
|
|
4
|
-
import * as FunctionRegistryItem from "./FunctionRegistryItem";
|
|
5
|
-
import * as MiddlewareRegistryItem from "./MiddlewareRegistryItem";
|
|
4
|
+
import * as FunctionRegistryItem from "./FunctionRegistryItem.js";
|
|
5
|
+
import * as MiddlewareRegistryItem from "./MiddlewareRegistryItem.js";
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Runtime tree that mirrors a `Spec`'s group structure. Values remain unknown
|
|
@@ -38,3 +38,34 @@ export const middlewareKeys = (items: RegistryItems): ReadonlyArray<string> =>
|
|
|
38
38
|
Array.filter(MiddlewareRegistryItem.isMiddlewareRegistryItem),
|
|
39
39
|
Array.map((item) => item.middlewareSpec.key),
|
|
40
40
|
);
|
|
41
|
+
|
|
42
|
+
export interface MissingMiddleware {
|
|
43
|
+
readonly functionName: string;
|
|
44
|
+
readonly middlewareKey: string;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export const missingRequired = (
|
|
48
|
+
items: RegistryItems,
|
|
49
|
+
required: ReadonlyArray<{ readonly key: string }>,
|
|
50
|
+
groupPath = "",
|
|
51
|
+
): ReadonlyArray<MissingMiddleware> =>
|
|
52
|
+
Object.entries(items)
|
|
53
|
+
.sort(([left], [right]) => left.localeCompare(right))
|
|
54
|
+
.flatMap(([functionName, value]) =>
|
|
55
|
+
FunctionRegistryItem.isFunctionRegistryItem(value)
|
|
56
|
+
? required.flatMap(({ key }) =>
|
|
57
|
+
value._tag === "Confect" &&
|
|
58
|
+
value.middlewareAttachments.some(({ spec }) => spec.key === key)
|
|
59
|
+
? []
|
|
60
|
+
: [
|
|
61
|
+
{
|
|
62
|
+
functionName:
|
|
63
|
+
groupPath === ""
|
|
64
|
+
? functionName
|
|
65
|
+
: `${groupPath}.${functionName}`,
|
|
66
|
+
middlewareKey: key,
|
|
67
|
+
},
|
|
68
|
+
],
|
|
69
|
+
)
|
|
70
|
+
: [],
|
|
71
|
+
);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as MiddlewareAttachment from "@confect/core/MiddlewareAttachment";
|
|
2
2
|
import type * as MiddlewareSpec from "@confect/core/MiddlewareSpec";
|
|
3
3
|
import * as Result from "effect/Result";
|
|
4
|
-
import type * as FunctionRegistryItem from "./FunctionRegistryItem";
|
|
5
|
-
import type * as MiddlewareRegistryItem from "./MiddlewareRegistryItem";
|
|
4
|
+
import type * as FunctionRegistryItem from "./FunctionRegistryItem.js";
|
|
5
|
+
import type * as MiddlewareRegistryItem from "./MiddlewareRegistryItem.js";
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* A middleware spec paired with its implementation for one function's type—the
|
package/src/Storage.ts
CHANGED
|
@@ -3,9 +3,9 @@ import type { GenericId } from "convex/values";
|
|
|
3
3
|
import * as Context from "effect/Context";
|
|
4
4
|
import * as Effect from "effect/Effect";
|
|
5
5
|
import * as Layer from "effect/Layer";
|
|
6
|
-
import { StorageActionWriter } from "./StorageActionWriter";
|
|
7
|
-
import { StorageReader } from "./StorageReader";
|
|
8
|
-
import { StorageWriter } from "./StorageWriter";
|
|
6
|
+
import { StorageActionWriter } from "./StorageActionWriter.js";
|
|
7
|
+
import { StorageReader } from "./StorageReader.js";
|
|
8
|
+
import { StorageWriter } from "./StorageWriter.js";
|
|
9
9
|
|
|
10
10
|
const make = Effect.gen(function* () {
|
|
11
11
|
const reader = yield* StorageReader;
|
|
@@ -6,7 +6,7 @@ import { flow } from "effect/Function";
|
|
|
6
6
|
import * as Effect from "effect/Effect";
|
|
7
7
|
import * as Layer from "effect/Layer";
|
|
8
8
|
import * as Option from "effect/Option";
|
|
9
|
-
import { BlobNotFoundError } from "./BlobNotFoundError";
|
|
9
|
+
import { BlobNotFoundError } from "./BlobNotFoundError.js";
|
|
10
10
|
import type * as ScopedId from "@confect/core/GenericId";
|
|
11
11
|
|
|
12
12
|
export type Service<Scope extends IdScope.IdScope = IdScope.App> = {
|
package/src/StorageReader.ts
CHANGED
|
@@ -7,7 +7,7 @@ import * as Effect from "effect/Effect";
|
|
|
7
7
|
import * as Layer from "effect/Layer";
|
|
8
8
|
import * as Option from "effect/Option";
|
|
9
9
|
import * as Schema from "effect/Schema";
|
|
10
|
-
import { BlobNotFoundError } from "./BlobNotFoundError";
|
|
10
|
+
import { BlobNotFoundError } from "./BlobNotFoundError.js";
|
|
11
11
|
import type * as ScopedId from "@confect/core/GenericId";
|
|
12
12
|
|
|
13
13
|
export type Service<Scope extends IdScope.IdScope = IdScope.App> = {
|
package/src/StorageWriter.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { pipe } from "effect/Function";
|
|
|
6
6
|
import * as Effect from "effect/Effect";
|
|
7
7
|
import * as Layer from "effect/Layer";
|
|
8
8
|
import * as Schema from "effect/Schema";
|
|
9
|
-
import { BlobNotFoundError } from "./BlobNotFoundError";
|
|
9
|
+
import { BlobNotFoundError } from "./BlobNotFoundError.js";
|
|
10
10
|
import type * as ScopedId from "@confect/core/GenericId";
|
|
11
11
|
|
|
12
12
|
export type Service<Scope extends IdScope.IdScope = IdScope.App> = {
|
package/src/TableInfo.ts
CHANGED
|
@@ -12,8 +12,8 @@ import type {
|
|
|
12
12
|
import type { GenericValidator } from "convex/values";
|
|
13
13
|
import type { Schema, Types } from "effect";
|
|
14
14
|
import type { WithSystemFields } from "@confect/core/SystemFields";
|
|
15
|
-
import type * as Document_ from "./Document";
|
|
16
|
-
import type * as Table from "./Table";
|
|
15
|
+
import type * as Document_ from "./Document.js";
|
|
16
|
+
import type * as Table from "./Table.js";
|
|
17
17
|
|
|
18
18
|
export declare const TypeId: "~@confect/server/TableInfo";
|
|
19
19
|
export type TypeId = typeof TypeId;
|
package/src/VectorSearch.ts
CHANGED
|
@@ -8,7 +8,7 @@ import type {
|
|
|
8
8
|
import * as Context from "effect/Context";
|
|
9
9
|
import * as Effect from "effect/Effect";
|
|
10
10
|
import * as Layer from "effect/Layer";
|
|
11
|
-
import type * as DataModel from "./DataModel";
|
|
11
|
+
import type * as DataModel from "./DataModel.js";
|
|
12
12
|
|
|
13
13
|
type ConvexVectorSearch<DataModel_ extends DataModel.AnyWithProps> =
|
|
14
14
|
GenericActionCtx<DataModel.ToConvex<DataModel_>>["vectorSearch"];
|