@nwire/apollo 0.12.1 → 0.13.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -39,7 +39,7 @@ const submitAnswer = defineAction({
39
39
  });
40
40
 
41
41
  const runtime = new Runtime();
42
- runtime.registerHandler(submitAnswer.handler!);
42
+ runtime.registerHandler(submitAnswer);
43
43
 
44
44
  const typeDefs = gql`
45
45
  input SubmitAnswerInput {
@@ -44,7 +44,7 @@
44
44
  * one-liner that says "this GraphQL field is implemented by this Nwire
45
45
  * action" — same migration story Express got.
46
46
  */
47
- import type { ActionDefinition, ForgeDispatcher } from "@nwire/forge";
47
+ import type { ActionDefinition, ActionRunner } from "@nwire/forge";
48
48
  import { type MessageEnvelope } from "@nwire/envelope";
49
49
  import type { ApolloServerOptions, BaseContext } from "@apollo/server";
50
50
  import type { GraphQLFormattedError } from "graphql";
@@ -55,7 +55,7 @@ import type { GraphQLFormattedError } from "graphql";
55
55
  */
56
56
  export interface NwireApolloContext extends BaseContext {
57
57
  /** The Nwire app to dispatch actions through. */
58
- readonly dispatcher: ForgeDispatcher;
58
+ readonly dispatcher: ActionRunner;
59
59
  /**
60
60
  * The fresh envelope seeded for this GraphQL request. Resolvers can
61
61
  * dispatch through `runtime` and the envelope will be derived as a
@@ -91,7 +91,7 @@ export interface ActionResolverOptions<TContext extends BaseContext = NwireApoll
91
91
  * this if your context names it differently or pulls it from a DI
92
92
  * container.
93
93
  */
94
- readonly resolveDispatcher?: (context: TContext) => ForgeDispatcher;
94
+ readonly resolveDispatcher?: (context: TContext) => ActionRunner;
95
95
  }
96
96
  /**
97
97
  * Wrap a Nwire `ActionDefinition` as a GraphQL field resolver.
@@ -141,7 +141,7 @@ export declare function actionResolver<TContext extends NwireApolloContext = Nwi
141
141
  * type usable in any integration without a forced cast.
142
142
  */
143
143
  export interface NwireApolloContextOptions<TArgs = unknown> {
144
- readonly dispatcher: ForgeDispatcher;
144
+ readonly dispatcher: ActionRunner;
145
145
  /**
146
146
  * Build a request-scoped envelope. The integration arg (`req`, headers,
147
147
  * etc.) is available so caller can read auth headers. Defaults to a
@@ -176,7 +176,7 @@ export declare function nwireApolloContext<TArgs = unknown>(options: NwireApollo
176
176
  * `startStandaloneServer` / `expressMiddleware` as appropriate.
177
177
  */
178
178
  export interface MountNwireOptions<TArgs = unknown> {
179
- readonly dispatcher: ForgeDispatcher;
179
+ readonly dispatcher: ActionRunner;
180
180
  readonly extractEnvelope?: (args: TArgs) => MessageEnvelope;
181
181
  readonly extractUser?: (args: TArgs) => unknown;
182
182
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nwire/apollo",
3
- "version": "0.12.1",
3
+ "version": "0.13.1",
4
4
  "description": "Nwire — Apollo Server (v4) interop adapter. actionResolver(action) plugs a Nwire ActionDefinition into a GraphQL schema as a field resolver; nwireApolloContext({ runtime }) adds runtime.dispatch + envelope to Apollo's per-request context; mountNwireOnApollo() registers Nwire-aware error mapping (defineError -> extensions.code). Opt-in, peer dep, ~60 LOC of real code.",
5
5
  "keywords": [
6
6
  "adapter",
@@ -28,8 +28,8 @@
28
28
  "access": "public"
29
29
  },
30
30
  "dependencies": {
31
- "@nwire/envelope": "0.12.1",
32
- "@nwire/forge": "0.12.1"
31
+ "@nwire/envelope": "0.13.1",
32
+ "@nwire/forge": "0.13.1"
33
33
  },
34
34
  "devDependencies": {
35
35
  "@apollo/server": "^4.11.0",