@gaganref/confect-server 10.3.1-fork.26 → 10.3.1-fork.28

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.
Files changed (70) hide show
  1. package/dist/ActionCall.d.ts +30 -0
  2. package/dist/ActionCall.d.ts.map +1 -0
  3. package/dist/ActionCall.js +41 -0
  4. package/dist/ActionCall.js.map +1 -0
  5. package/dist/ActionRunner.js +2 -2
  6. package/dist/AiGatewayDecisionClient.js +1 -1
  7. package/dist/AiGatewayLanguageClient.js +1 -1
  8. package/dist/Auth.js +1 -1
  9. package/dist/Callback.js +3 -3
  10. package/dist/ConvexConfigProvider.js +2 -2
  11. package/dist/ConvexFunctionDefinitions.js +2 -2
  12. package/dist/ConvexLogger.js +1 -1
  13. package/dist/CronJobs.js +6 -6
  14. package/dist/DatabaseSchema.js +2 -2
  15. package/dist/DatabaseWriter.js +3 -3
  16. package/dist/ExecutionMetadata.js +1 -1
  17. package/dist/FunctionImpl.js +2 -2
  18. package/dist/FunctionRegistryItem.js +1 -1
  19. package/dist/GroupImpl.js +5 -5
  20. package/dist/Handler.d.ts +7 -3
  21. package/dist/Handler.d.ts.map +1 -1
  22. package/dist/Handler.js.map +1 -1
  23. package/dist/HttpRouter.js +2 -2
  24. package/dist/MiddlewareImpl.js +1 -1
  25. package/dist/MutationRunner.js +2 -2
  26. package/dist/MutationTransactionContext.js +2 -2
  27. package/dist/QueryInitializer.js +2 -2
  28. package/dist/QueryRunner.js +2 -2
  29. package/dist/QueryStream.d.ts +32 -0
  30. package/dist/QueryStream.d.ts.map +1 -1
  31. package/dist/QueryStream.js +40 -4
  32. package/dist/QueryStream.js.map +1 -1
  33. package/dist/QueryStreamCursor.js +1 -1
  34. package/dist/QueryStreamIndexPrefix.js +1 -1
  35. package/dist/QueryStreamIndexRange.js +2 -2
  36. package/dist/QueryStreamKey.js +1 -1
  37. package/dist/QueryStreamKeyBounds.js +2 -2
  38. package/dist/QueryStreamKeyLayout.js +2 -2
  39. package/dist/QueryStreamKeyValues.js +1 -1
  40. package/dist/QueryStreamPagination.js +1 -1
  41. package/dist/QueryStreamReadBudget.js +2 -2
  42. package/dist/QueryTransactionContext.js +2 -2
  43. package/dist/RegisteredConvexFunction.js +19 -19
  44. package/dist/RegisteredConvexFunction.js.map +1 -1
  45. package/dist/RegisteredFunction.d.ts.map +1 -1
  46. package/dist/RegisteredFunction.js +55 -13
  47. package/dist/RegisteredFunction.js.map +1 -1
  48. package/dist/RegisteredNodeFunction.js +1 -1
  49. package/dist/RegistryItems.js +1 -1
  50. package/dist/RequestMetadata.js +1 -1
  51. package/dist/Scheduler.js +2 -2
  52. package/dist/Storage.js +1 -1
  53. package/dist/StorageActionWriter.js +1 -1
  54. package/dist/StorageReader.js +1 -1
  55. package/dist/StorageWriter.js +1 -1
  56. package/dist/TransactionMetadata.js +1 -1
  57. package/dist/VectorSearch.js +1 -1
  58. package/dist/index.d.ts +1 -0
  59. package/dist/index.d.ts.map +1 -1
  60. package/dist/index.js +10 -9
  61. package/dist/internal/AiGatewayDecisionClient.js +1 -1
  62. package/dist/internal/AiGatewayLanguageClient.js +1 -1
  63. package/dist/internal/AiGatewayServiceToken.js +1 -1
  64. package/dist/internal/DocumentPatch.js +1 -1
  65. package/package.json +2 -2
  66. package/src/ActionCall.ts +82 -0
  67. package/src/Handler.ts +20 -5
  68. package/src/QueryStream.ts +83 -0
  69. package/src/RegisteredFunction.ts +54 -1
  70. package/src/index.ts +1 -0
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,uBAAuB,MAAM,8BAA8B,CAAC;AACxE,OAAO,KAAK,sBAAsB,MAAM,6BAA6B,CAAC;AACtE,OAAO,KAAK,uBAAuB,MAAM,8BAA8B,CAAC;AACxE,OAAO,KAAK,sBAAsB,MAAM,6BAA6B,CAAC;AACtE,OAAO,KAAK,SAAS,MAAM,gBAAgB,CAAC;AAC5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AAM,4BAA4B,CAAC;AACpE,OAAO,KAAK,wBAAwB,MAAM,+BAA+B,CAAC;AAC1E,OAAO,KAAK,kBAAkB,MAAM,yBAAyB,CAAC;AAC9D,OAAO,KAAK,mBAAmB,MAAM,0BAA0B,CAAC;AAChE,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAC;AAC1C,OAAO,KAAK,aAAa,MAAM,oBAAoB,CAAC;AACpD,OAAO,KAAK,kBAAkB,MAAM,yBAAyB,CAAC;AAC9D,OAAO,KAAK,eAAe,MAAM,sBAAsB,CAAC;AACxD,OAAO,KAAK,SAAS,MAAM,gBAAgB,CAAC;AAC5C,OAAO,KAAK,OAAO,MAAM,cAAc,CAAC;AACxC,OAAO,KAAK,mBAAmB,MAAM,0BAA0B,CAAC;AAChE,OAAO,KAAK,aAAa,MAAM,oBAAoB,CAAC;AACpD,OAAO,KAAK,aAAa,MAAM,oBAAoB,CAAC;AACpD,OAAO,KAAK,KAAK,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,SAAS,MAAM,gBAAgB,CAAC;AAC5C,OAAO,KAAK,mBAAmB,MAAM,0BAA0B,CAAC;AAChE,OAAO,KAAK,YAAY,MAAM,mBAAmB,CAAC"}
package/dist/index.js CHANGED
@@ -1,5 +1,14 @@
1
1
  import { ActionCtx_exports } from "./ActionCtx.js";
2
2
  import { ActionRunner_exports } from "./ActionRunner.js";
3
+ import { Registry_exports } from "./Registry.js";
4
+ import { MiddlewareRegistryItem_exports } from "./MiddlewareRegistryItem.js";
5
+ import { MiddlewareImpl_exports } from "./MiddlewareImpl.js";
6
+ import { MutationTransactionContext_exports } from "./MutationTransactionContext.js";
7
+ import { MutationRunner_exports } from "./MutationRunner.js";
8
+ import { QueryTransactionContext_exports } from "./QueryTransactionContext.js";
9
+ import { QueryRunner_exports } from "./QueryRunner.js";
10
+ import { Scheduler_exports } from "./Scheduler.js";
11
+ import { ActionCall_exports } from "./ActionCall.js";
3
12
  import { AiGatewayDecisionClient_exports } from "./AiGatewayDecisionClient.js";
4
13
  import { AiGatewayDecisionModel_exports } from "./AiGatewayDecisionModel.js";
5
14
  import { AiGatewayLanguageClient_exports } from "./AiGatewayLanguageClient.js";
@@ -8,8 +17,6 @@ import { Auth_exports } from "./Auth.js";
8
17
  import { BlobNotFoundError_exports } from "./BlobNotFoundError.js";
9
18
  import { Callback_exports } from "./Callback.js";
10
19
  import { ConvexConfigProvider_exports } from "./ConvexConfigProvider.js";
11
- import { Registry_exports } from "./Registry.js";
12
- import { MiddlewareRegistryItem_exports } from "./MiddlewareRegistryItem.js";
13
20
  import { FunctionRegistryItem_exports } from "./FunctionRegistryItem.js";
14
21
  import { DatabaseSchema_exports } from "./DatabaseSchema.js";
15
22
  import { Document_exports } from "./Document.js";
@@ -31,13 +38,8 @@ import { ExecutionMetadata_exports } from "./ExecutionMetadata.js";
31
38
  import { RequestMetadata_exports } from "./RequestMetadata.js";
32
39
  import { TransactionMetadata_exports } from "./TransactionMetadata.js";
33
40
  import { MutationCtx_exports } from "./MutationCtx.js";
34
- import { MutationTransactionContext_exports } from "./MutationTransactionContext.js";
35
- import { MutationRunner_exports } from "./MutationRunner.js";
36
41
  import { QueryCtx_exports } from "./QueryCtx.js";
37
- import { QueryTransactionContext_exports } from "./QueryTransactionContext.js";
38
- import { QueryRunner_exports } from "./QueryRunner.js";
39
42
  import { ConvexLogger_exports } from "./ConvexLogger.js";
40
- import { Scheduler_exports } from "./Scheduler.js";
41
43
  import { StorageActionWriter_exports } from "./StorageActionWriter.js";
42
44
  import { StorageReader_exports } from "./StorageReader.js";
43
45
  import { StorageWriter_exports } from "./StorageWriter.js";
@@ -55,8 +57,7 @@ import { RegistryItems_exports } from "./RegistryItems.js";
55
57
  import { GroupImpl_exports } from "./GroupImpl.js";
56
58
  import { Handler_exports } from "./Handler.js";
57
59
  import { HttpRouter_exports } from "./HttpRouter.js";
58
- import { MiddlewareImpl_exports } from "./MiddlewareImpl.js";
59
60
  import { OfficialComponent_exports } from "./OfficialComponent.js";
60
61
  import { RegisteredFunctions_exports } from "./RegisteredFunctions.js";
61
62
  import { TableInfo_exports } from "./TableInfo.js";
62
- export { ActionCtx_exports as ActionCtx, ActionRunner_exports as ActionRunner, AiGatewayDecisionClient_exports as AiGatewayDecisionClient, AiGatewayDecisionModel_exports as AiGatewayDecisionModel, AiGatewayLanguageClient_exports as AiGatewayLanguageClient, AiGatewayLanguageModel_exports as AiGatewayLanguageModel, Auth_exports as Auth, BlobNotFoundError_exports as BlobNotFoundError, Callback_exports as Callback, ConvexConfigProvider_exports as ConvexConfigProvider, ConvexFunctionDefinitions_exports as ConvexFunctionDefinitions, ConvexLogger_exports as ConvexLogger, CronJob_exports as CronJob, CronJobs_exports as CronJobs, DataModel_exports as DataModel, DatabaseReader_exports as DatabaseReader, DatabaseSchema_exports as DatabaseSchema, DatabaseWriter_exports as DatabaseWriter, Document_exports as Document, ExecutionMetadata_exports as ExecutionMetadata, FunctionImpl_exports as FunctionImpl, FunctionRegistryItem_exports as FunctionRegistryItem, GroupImpl_exports as GroupImpl, Handler_exports as Handler, HttpRouter_exports as HttpRouter, MiddlewareImpl_exports as MiddlewareImpl, MiddlewareRegistryItem_exports as MiddlewareRegistryItem, MutationCtx_exports as MutationCtx, MutationRunner_exports as MutationRunner, MutationTransactionContext_exports as MutationTransactionContext, OfficialComponent_exports as OfficialComponent, OrderedQuery_exports as OrderedQuery, QueryCtx_exports as QueryCtx, QueryInitializer_exports as QueryInitializer, QueryRunner_exports as QueryRunner, QueryStream_exports as QueryStream, QueryStreamCursor_exports as QueryStreamCursor, QueryStreamIndexRange_exports as QueryStreamIndexRange, QueryStreamKeyBounds_exports as QueryStreamKeyBounds, QueryStreamKeyLabels_exports as QueryStreamKeyLabels, QueryStreamKeyLayout_exports as QueryStreamKeyLayout, QueryStreamKeyValues_exports as QueryStreamKeyValues, QueryStreamOrderDirection_exports as QueryStreamOrderDirection, QueryStreamReadBudget_exports as QueryStreamReadBudget, QueryTransactionContext_exports as QueryTransactionContext, RegisteredConvexFunction_exports as RegisteredConvexFunction, RegisteredFunction_exports as RegisteredFunction, RegisteredFunctions_exports as RegisteredFunctions, Registry_exports as Registry, RegistryItems_exports as RegistryItems, RequestMetadata_exports as RequestMetadata, ResolvedMiddleware_exports as ResolvedMiddleware, Scheduler_exports as Scheduler, Storage_exports as Storage, StorageActionWriter_exports as StorageActionWriter, StorageReader_exports as StorageReader, StorageWriter_exports as StorageWriter, Table_exports as Table, TableInfo_exports as TableInfo, TransactionMetadata_exports as TransactionMetadata, VectorSearch_exports as VectorSearch };
63
+ export { ActionCall_exports as ActionCall, ActionCtx_exports as ActionCtx, ActionRunner_exports as ActionRunner, AiGatewayDecisionClient_exports as AiGatewayDecisionClient, AiGatewayDecisionModel_exports as AiGatewayDecisionModel, AiGatewayLanguageClient_exports as AiGatewayLanguageClient, AiGatewayLanguageModel_exports as AiGatewayLanguageModel, Auth_exports as Auth, BlobNotFoundError_exports as BlobNotFoundError, Callback_exports as Callback, ConvexConfigProvider_exports as ConvexConfigProvider, ConvexFunctionDefinitions_exports as ConvexFunctionDefinitions, ConvexLogger_exports as ConvexLogger, CronJob_exports as CronJob, CronJobs_exports as CronJobs, DataModel_exports as DataModel, DatabaseReader_exports as DatabaseReader, DatabaseSchema_exports as DatabaseSchema, DatabaseWriter_exports as DatabaseWriter, Document_exports as Document, ExecutionMetadata_exports as ExecutionMetadata, FunctionImpl_exports as FunctionImpl, FunctionRegistryItem_exports as FunctionRegistryItem, GroupImpl_exports as GroupImpl, Handler_exports as Handler, HttpRouter_exports as HttpRouter, MiddlewareImpl_exports as MiddlewareImpl, MiddlewareRegistryItem_exports as MiddlewareRegistryItem, MutationCtx_exports as MutationCtx, MutationRunner_exports as MutationRunner, MutationTransactionContext_exports as MutationTransactionContext, OfficialComponent_exports as OfficialComponent, OrderedQuery_exports as OrderedQuery, QueryCtx_exports as QueryCtx, QueryInitializer_exports as QueryInitializer, QueryRunner_exports as QueryRunner, QueryStream_exports as QueryStream, QueryStreamCursor_exports as QueryStreamCursor, QueryStreamIndexRange_exports as QueryStreamIndexRange, QueryStreamKeyBounds_exports as QueryStreamKeyBounds, QueryStreamKeyLabels_exports as QueryStreamKeyLabels, QueryStreamKeyLayout_exports as QueryStreamKeyLayout, QueryStreamKeyValues_exports as QueryStreamKeyValues, QueryStreamOrderDirection_exports as QueryStreamOrderDirection, QueryStreamReadBudget_exports as QueryStreamReadBudget, QueryTransactionContext_exports as QueryTransactionContext, RegisteredConvexFunction_exports as RegisteredConvexFunction, RegisteredFunction_exports as RegisteredFunction, RegisteredFunctions_exports as RegisteredFunctions, Registry_exports as Registry, RegistryItems_exports as RegistryItems, RequestMetadata_exports as RequestMetadata, ResolvedMiddleware_exports as ResolvedMiddleware, Scheduler_exports as Scheduler, Storage_exports as Storage, StorageActionWriter_exports as StorageActionWriter, StorageReader_exports as StorageReader, StorageWriter_exports as StorageWriter, Table_exports as Table, TableInfo_exports as TableInfo, TransactionMetadata_exports as TransactionMetadata, VectorSearch_exports as VectorSearch };
@@ -1,7 +1,7 @@
1
1
  import { AiGatewayServiceToken, transformClientRequest } from "./AiGatewayServiceToken.js";
2
2
  import { AI_GATEWAY_API_URL } from "./constants.js";
3
- import * as Layer from "effect/Layer";
4
3
  import * as Effect from "effect/Effect";
4
+ import * as Layer from "effect/Layer";
5
5
  import * as OpenRouterClient from "@effect/ai-openrouter/OpenRouterClient";
6
6
  //#region src/internal/AiGatewayDecisionClient.ts
7
7
  const make = Effect.gen(function* () {
@@ -1,7 +1,7 @@
1
1
  import { AiGatewayServiceToken, transformClientRequest } from "./AiGatewayServiceToken.js";
2
2
  import { AI_GATEWAY_API_URL } from "./constants.js";
3
- import * as Layer from "effect/Layer";
4
3
  import * as Effect from "effect/Effect";
4
+ import * as Layer from "effect/Layer";
5
5
  import * as OpenAiClient from "@effect/ai-openai-compat/OpenAiClient";
6
6
  //#region src/internal/AiGatewayLanguageClient.ts
7
7
  const make = Effect.gen(function* () {
@@ -1,6 +1,6 @@
1
1
  import * as Context from "effect/Context";
2
- import * as Layer from "effect/Layer";
3
2
  import * as Effect from "effect/Effect";
3
+ import * as Layer from "effect/Layer";
4
4
  import { getServiceToken } from "convex/server";
5
5
  import * as Schema from "effect/Schema";
6
6
  import * as HttpClient from "effect/http/HttpClient";
@@ -1,8 +1,8 @@
1
1
  import * as Effect from "effect/Effect";
2
+ import * as Record from "effect/Record";
2
3
  import * as Schema from "effect/Schema";
3
4
  import { pipe } from "effect/Function";
4
5
  import * as SchemaAST from "effect/SchemaAST";
5
- import * as Record from "effect/Record";
6
6
  //#region src/internal/DocumentPatch.ts
7
7
  const patchEncoders = /* @__PURE__ */ new WeakMap();
8
8
  /**
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@gaganref/confect-server",
3
- "version": "10.3.1-fork.26",
3
+ "version": "10.3.1-fork.28",
4
4
  "dependencies": {
5
5
  "@effect/ai-openai-compat": "4.0.4",
6
6
  "@effect/ai-openrouter": "4.0.4"
7
7
  },
8
8
  "peerDependencies": {
9
- "@confect/core": "npm:@gaganref/confect-core@10.3.1-fork.26",
9
+ "@confect/core": "npm:@gaganref/confect-core@10.3.1-fork.28",
10
10
  "@effect/platform-node": "^4.0.0",
11
11
  "convex": "^1.45.0",
12
12
  "effect": "^4.0.4"
@@ -0,0 +1,82 @@
1
+ import * as ActionCall from "@confect/core/ActionCall";
2
+ import * as Ref from "@confect/core/Ref";
3
+ import type { FunctionReference } from "convex/server";
4
+ import * as Context from "effect/Context";
5
+ import * as Data from "effect/Data";
6
+ import * as Effect from "effect/Effect";
7
+ import * as ActionCtx from "./ActionCtx.js";
8
+ import * as ActionRunner from "./ActionRunner.js";
9
+ import type * as DatabaseSchema from "./DatabaseSchema.js";
10
+ import type * as DataModel from "./DataModel.js";
11
+ import type * as Handler from "./Handler.js";
12
+ import * as MiddlewareImpl from "./MiddlewareImpl.js";
13
+ import * as MutationRunner from "./MutationRunner.js";
14
+ import * as QueryRunner from "./QueryRunner.js";
15
+ import * as Scheduler from "./Scheduler.js";
16
+
17
+ export class ActionCallAlreadyUsed extends Data.TaggedError(
18
+ "ActionCallAlreadyUsed",
19
+ )<{}> {}
20
+ export class ActionCallNotUsed extends Data.TaggedError(
21
+ "ActionCallNotUsed",
22
+ )<{}> {}
23
+ export class MissingFunctionType extends Data.TaggedError(
24
+ "MissingFunctionType",
25
+ )<{}> {}
26
+ export class NestedActionNotAllowed extends Data.TaggedError(
27
+ "NestedActionNotAllowed",
28
+ )<{}> {}
29
+
30
+ export class SchedulingNotAllowed extends Data.TaggedError(
31
+ "SchedulingNotAllowed",
32
+ )<{}> {}
33
+
34
+ export const layer = <S extends DatabaseSchema.AnyWithProps>(schema: S) =>
35
+ MiddlewareImpl.make(schema, ActionCall.Middleware, (effect) =>
36
+ Effect.gen(function* () {
37
+ const ctx = yield* ActionCtx.ActionCtx<
38
+ DataModel.ToConvex<DataModel.FromSchema<S>>,
39
+ DatabaseSchema.Scope<S>
40
+ >();
41
+ let claimed = false;
42
+ const call: ActionCall.Call = <
43
+ Target extends Ref.AnyQuery | Ref.AnyMutation,
44
+ >(
45
+ ref: Target,
46
+ ...args: Ref.OptionalArgs<NoInfer<Target>>
47
+ ) =>
48
+ Effect.suspend(() => {
49
+ if (claimed) return Effect.die(new ActionCallAlreadyUsed());
50
+ claimed = true;
51
+ if (ref.functionType !== "query" && ref.functionType !== "mutation")
52
+ return Effect.die(new MissingFunctionType());
53
+ return Ref.runWithCodec(
54
+ ref,
55
+ (args[0] ?? {}) as Ref.Args<Target>,
56
+ (native, encoded) =>
57
+ ref.functionType === "query"
58
+ ? ctx.runQuery(
59
+ native as FunctionReference<"query">,
60
+ encoded as never,
61
+ )
62
+ : ctx.runMutation(
63
+ native as FunctionReference<"mutation">,
64
+ encoded as never,
65
+ ),
66
+ );
67
+ });
68
+ return yield* effect.pipe(
69
+ Effect.provideService(ActionCall.ActionCall, call),
70
+ Effect.updateContext(
71
+ (context: Context.Context<Handler.ActionServices<S>>) =>
72
+ Context.omit(
73
+ QueryRunner.QueryRunner,
74
+ MutationRunner.MutationRunner,
75
+ ActionRunner.ActionRunner,
76
+ ActionCtx.ActionCtx(),
77
+ Scheduler.Scheduler,
78
+ )(context),
79
+ ),
80
+ );
81
+ }),
82
+ );
package/src/Handler.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import type { ActionCall } from "@confect/core/ActionCall";
1
2
  import type { FunctionSpec, RuntimeAndFunctionType } from "@confect/core";
2
3
  import type * as FunctionProvenance from "@confect/core/FunctionProvenance";
3
4
  import type * as NodeServices from "@effect/platform-node/NodeServices";
@@ -114,9 +115,7 @@ export type MutationServices<
114
115
  /**
115
116
  * Shared by both action runtimes.
116
117
  */
117
- export type ActionServices<
118
- DatabaseSchema_ extends DatabaseSchema.AnyWithProps,
119
- > =
118
+ type RawActionServices<DatabaseSchema_ extends DatabaseSchema.AnyWithProps> =
120
119
  | Scheduler.ForScope<DatabaseSchema.Scope<DatabaseSchema_>>
121
120
  | (DatabaseSchema_["target"]["kind"] extends "component" ? never : Auth.Auth)
122
121
  | StorageReader.ForScope<DatabaseSchema.Scope<DatabaseSchema_>>
@@ -134,6 +133,22 @@ export type ActionServices<
134
133
  DatabaseSchema.Scope<DatabaseSchema_>
135
134
  >;
136
135
 
136
+ export type ActionServices<S extends DatabaseSchema.AnyWithProps, R = never> = [
137
+ Extract<R, ActionCall>,
138
+ ] extends [never]
139
+ ? RawActionServices<S>
140
+ : Exclude<
141
+ RawActionServices<S>,
142
+ | Scheduler.ForScope<DatabaseSchema.Scope<S>>
143
+ | QueryRunner.QueryRunner
144
+ | MutationRunner.MutationRunner
145
+ | ActionRunner.ActionRunner
146
+ | ActionCtx.ActionCtx<
147
+ DataModel.ToConvex<DataModel.FromSchema<S>>,
148
+ DatabaseSchema.Scope<S>
149
+ >
150
+ >;
151
+
137
152
  export type ConfectProvenanceQuery<
138
153
  DatabaseSchema_ extends DatabaseSchema.AnyWithProps,
139
154
  FunctionSpec_ extends
@@ -153,7 +168,7 @@ export type ConvexRuntimeAction<
153
168
  FunctionSpec_ extends
154
169
  FunctionSpec.AnyWithPropsWithFunctionType<RuntimeAndFunctionType.AnyAction>,
155
170
  R = never,
156
- > = Base<FunctionSpec_, ActionServices<DatabaseSchema_> | R>;
171
+ > = Base<FunctionSpec_, ActionServices<DatabaseSchema_, R> | R>;
157
172
 
158
173
  export type NodeRuntimeAction<
159
174
  DatabaseSchema_ extends DatabaseSchema.AnyWithProps,
@@ -162,7 +177,7 @@ export type NodeRuntimeAction<
162
177
  R = never,
163
178
  > = Base<
164
179
  FunctionSpec_,
165
- ActionServices<DatabaseSchema_> | NodeServices.NodeServices | R
180
+ ActionServices<DatabaseSchema_, R> | NodeServices.NodeServices | R
166
181
  >;
167
182
 
168
183
  type Base<FunctionSpec_ extends FunctionSpec.AnyWithProps, R> = (
@@ -441,6 +441,89 @@ export const empty =
441
441
  return make(orderDirection);
442
442
  };
443
443
 
444
+ /**
445
+ * A deferred stream's resolved direction or layout differs from its
446
+ * declaration. The check runs on consumption, before the resolved source is
447
+ * pulled.
448
+ *
449
+ * @experimental
450
+ */
451
+ export class DeferredStreamMismatchError extends Data.TaggedError(
452
+ "DeferredStreamMismatchError",
453
+ )<{
454
+ readonly expectedOrderDirection: QueryStreamOrderDirection.QueryStreamOrderDirection;
455
+ readonly actualOrderDirection: QueryStreamOrderDirection.QueryStreamOrderDirection;
456
+ readonly expectedKeyLayout: QueryStreamKeyLayout.QueryStreamKeyLayout;
457
+ readonly actualKeyLayout: QueryStreamKeyLayout.QueryStreamKeyLayout;
458
+ }> {}
459
+
460
+ /**
461
+ * Defer an effect that checks access or constructs a query stream until it is
462
+ * pulled. Supply its layout and direction without reading documents. This lets
463
+ * `flatMap` build and narrow an inner stream before running its checks.
464
+ *
465
+ * The effect runs afresh on each consumption, seek, or reversal. Failures and
466
+ * service requirements are preserved. Its stream must match the declared layout
467
+ * and direction, or consumption dies with `DeferredStreamMismatchError`.
468
+ *
469
+ * @experimental
470
+ */
471
+ export const defer = <
472
+ Doc,
473
+ KeyLabels extends QueryStreamKeyLabels.QueryStreamKeyLabels,
474
+ OrderDirection extends QueryStreamOrderDirection.QueryStreamOrderDirection,
475
+ E = never,
476
+ R = never,
477
+ E2 = never,
478
+ R2 = never,
479
+ >(
480
+ options: {
481
+ readonly keyLayout: QueryStreamKeyLayout.QueryStreamKeyLayout<KeyLabels>;
482
+ readonly orderDirection: OrderDirection;
483
+ },
484
+ make: Effect.Effect<
485
+ QueryStream<Doc, KeyLabels, NoInfer<OrderDirection>, E, R>,
486
+ E2,
487
+ R2
488
+ >,
489
+ ): QueryStream<Doc, KeyLabels, OrderDirection, E | E2, R | R2> => {
490
+ const checked = Effect.map(make, (stream) => {
491
+ if (
492
+ stream.orderDirection !== options.orderDirection ||
493
+ !QueryStreamKeyLayout.Equivalence(stream.keyLayout, options.keyLayout)
494
+ ) {
495
+ throw new DeferredStreamMismatchError({
496
+ expectedOrderDirection: options.orderDirection,
497
+ actualOrderDirection: stream.orderDirection,
498
+ expectedKeyLayout: options.keyLayout,
499
+ actualKeyLayout: stream.keyLayout,
500
+ });
501
+ }
502
+ return stream;
503
+ });
504
+ return new QueryStream(
505
+ options.orderDirection,
506
+ options.keyLayout,
507
+ Stream.unwrap(Effect.map(checked, (stream) => stream.annotated)),
508
+ undefined,
509
+ (bounds) =>
510
+ defer(
511
+ options,
512
+ Effect.map(checked, (stream) => narrowByParsedBounds(stream, bounds)),
513
+ ),
514
+ () =>
515
+ defer(
516
+ {
517
+ ...options,
518
+ orderDirection: QueryStreamOrderDirection.flip(
519
+ options.orderDirection,
520
+ ),
521
+ },
522
+ Effect.map(checked, reverse),
523
+ ),
524
+ );
525
+ };
526
+
444
527
  // -----------------------------------------------------------------------------
445
528
  // Constructors
446
529
  // -----------------------------------------------------------------------------
@@ -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";
@@ -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
+ };
package/src/index.ts CHANGED
@@ -1,3 +1,4 @@
1
+ export * as ActionCall from "./ActionCall.js";
1
2
  export * as AiGatewayDecisionClient from "./AiGatewayDecisionClient.js";
2
3
  export * as AiGatewayDecisionModel from "./AiGatewayDecisionModel.js";
3
4
  export * as AiGatewayLanguageClient from "./AiGatewayLanguageClient.js";