@fluojs/graphql 1.1.0 → 2.0.0

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/service.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import type { Container } from '@fluojs/di';
2
- import { type HttpApplicationAdapter } from '@fluojs/http';
2
+ import { type HttpApplicationAdapter, type Middleware, type MiddlewareContext, type Next } from '@fluojs/http';
3
3
  import type { ApplicationLogger, CompiledModule, OnApplicationBootstrap, OnApplicationShutdown } from '@fluojs/runtime';
4
4
  import type { GraphqlModuleOptions } from './types.js';
5
5
  /**
@@ -12,23 +12,26 @@ export declare class GraphqlEndpointController {
12
12
  /**
13
13
  * Boots the GraphQL runtime, middleware, and subscription transports for the active adapter.
14
14
  */
15
- export declare class GraphqlLifecycleService implements OnApplicationBootstrap, OnApplicationShutdown {
15
+ export declare class GraphqlLifecycleService implements Middleware, OnApplicationBootstrap, OnApplicationShutdown {
16
16
  private readonly runtimeContainer;
17
17
  private readonly compiledModules;
18
18
  private readonly logger;
19
19
  private readonly adapter;
20
20
  private readonly options;
21
+ private allowedCrossRealmGraphqlObjects;
21
22
  private graphQLErrorConstructor;
22
- private middlewareRegistered;
23
23
  private readonly operationContainers;
24
24
  private readonly requestContexts;
25
+ private readonly failedWebsocketOperationContainers;
26
+ private readonly websocketContainerDisposals;
27
+ private websocketContainersAttemptedInCurrentCleanup;
25
28
  private readonly websocketOperationContainers;
26
29
  private websocketTransport;
27
30
  private executeGraphqlOperation;
28
31
  private releaseGraphqlInstanceOfPatch;
29
32
  private subscribeGraphqlOperation;
30
33
  private yoga;
31
- private readonly middleware;
34
+ handle(context: MiddlewareContext, next: Next): Promise<void>;
32
35
  constructor(runtimeContainer: Container, compiledModules: readonly CompiledModule[], logger: ApplicationLogger, adapter: HttpApplicationAdapter, options: GraphqlModuleOptions);
33
36
  onApplicationBootstrap(): Promise<void>;
34
37
  onApplicationShutdown(): Promise<void>;
@@ -39,8 +42,6 @@ export declare class GraphqlLifecycleService implements OnApplicationBootstrap,
39
42
  private resolveSchema;
40
43
  private createCodeFirstSchema;
41
44
  private discoverResolverDescriptors;
42
- private registerMiddleware;
43
- private unregisterMiddleware;
44
45
  private buildGraphqlContext;
45
46
  private registerWebSocketTransport;
46
47
  private unregisterWebSocketTransport;
@@ -49,8 +50,10 @@ export declare class GraphqlLifecycleService implements OnApplicationBootstrap,
49
50
  private createWebSocketOperationLimitError;
50
51
  private getOrCreateWebSocketOperationContainer;
51
52
  private disposeWebSocketOperationContainer;
53
+ private disposeWebSocketContainerOnce;
52
54
  private disposeAllWebSocketOperationContainers;
53
55
  private getOrCreateOperationContainer;
54
56
  private disposeOperationContainer;
57
+ private disposeAllOperationContainers;
55
58
  }
56
59
  //# sourceMappingURL=service.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../src/service.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,EAA0C,KAAK,sBAAsB,EAA4D,MAAM,cAAc,CAAC;AAC7J,OAAO,KAAK,EAAE,iBAAiB,EAAE,cAAc,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AA0BxH,OAAO,KAAK,EAEV,oBAAoB,EAGrB,MAAM,YAAY,CAAC;AA2EpB;;GAEG;AACH,qBACa,yBAAyB;IAEpC,SAAS,IAAI,SAAS;IAKtB,UAAU,IAAI,SAAS;CAGxB;AA4JD;;GAEG;AACH,qBACa,uBAAwB,YAAW,sBAAsB,EAAE,qBAAqB;IA0DzF,OAAO,CAAC,QAAQ,CAAC,gBAAgB;IACjC,OAAO,CAAC,QAAQ,CAAC,eAAe;IAChC,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,OAAO;IA7D1B,OAAO,CAAC,uBAAuB,CAAsC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4ChD,gBAAgB,EAAE,SAAS,EAC3B,eAAe,EAAE,SAAS,cAAc,EAAE,EAC1C,MAAM,EAAE,iBAAiB,EACzB,OAAO,EAAE,sBAAsB,EAC/B,OAAO,EAAE,oBAAoB;IAG1C,sBAAsB,IAAI,OAAO,CAAC,IAAI,CAAC;IA6CvC,qBAAqB,IAAI,OAAO,CAAC,IAAI,CAAC;YAI9B,wBAAwB;IA+BtC,OAAO,CAAC,sBAAsB;IAI9B,OAAO,CAAC,2BAA2B;IAInC,OAAO,CAAC,sBAAsB;IAe9B,OAAO,CAAC,aAAa;IASrB,OAAO,CAAC,qBAAqB;IAI7B,OAAO,CAAC,2BAA2B;IAInC,OAAO,CAAC,mBAAmB;YAyBb,0BAA0B;YAkC1B,4BAA4B;IAiC1C,OAAO,CAAC,2BAA2B;YAIrB,wBAAwB;IAmDtC,OAAO,CAAC,kCAAkC;IAwB1C,OAAO,CAAC,sCAAsC;YAchC,kCAAkC;YAiBlC,6BAA6B;YAuC7B,sCAAsC;IA+BpD,OAAO,CAAC,6BAA6B;YAYvB,yBAAyB;YAiBzB,6BAA6B;CAe5C"}
package/dist/service.js CHANGED
@@ -4,21 +4,36 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
4
4
  function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
5
5
  function _setFunctionName(e, t, n) { "symbol" == typeof t && (t = (t = t.description) ? "[" + t + "]" : ""); try { Object.defineProperty(e, "name", { configurable: !0, value: n ? n + " " + t : t }); } catch (e) {} return e; }
6
6
  function _checkInRHS(e) { if (Object(e) !== e) throw TypeError("right-hand side of 'in' should be an object, got " + (null !== e ? typeof e : "null")); return e; }
7
+ import { createRequire } from 'node:module';
7
8
  import { Inject } from '@fluojs/core';
8
9
  import { Controller, Get, Post } from '@fluojs/http';
9
10
  import { APPLICATION_LOGGER, COMPILED_MODULES, HTTP_APPLICATION_ADAPTER, RUNTIME_CONTAINER } from '@fluojs/runtime/internal';
10
11
  import { discoverResolverDescriptors } from './discovery.js';
11
12
  import { createGraphqlValidationPlugin, resolveGraphqlRequestLimits } from './guardrails.js';
13
+ import { installGraphqlInstanceOfPatch } from './instance-of-patch.js';
12
14
  import { GRAPHQL_INTERNAL_MODULE_OPTIONS_TOKEN } from './internal-tokens.js';
13
15
  import { createCodeFirstSchema, resolveSchema } from './schema/schema.js';
14
16
  import { isGraphqlPath, toFetchRequest, writeFetchResponse } from './transport/transport.js';
15
17
  import { GRAPHQL_OPERATION_CONTAINER } from './types.js';
16
18
  const GRAPHQL_CONTEXT_OVERRIDE = Symbol('fluo.graphql.context.override');
19
+ const runtimeRequire = createRequire(import.meta.url);
17
20
  const DEFAULT_GRAPHQL_WEBSOCKET_LIMITS = {
18
21
  maxConnections: 100,
19
22
  maxOperationsPerConnection: 25,
20
23
  maxPayloadBytes: 64 * 1024
21
24
  };
25
+ function collectCleanupError(errors, error) {
26
+ if (error instanceof AggregateError) {
27
+ for (const nested of error.errors) {
28
+ collectCleanupError(errors, nested);
29
+ }
30
+ return;
31
+ }
32
+ if (errors.includes(error)) {
33
+ return;
34
+ }
35
+ errors.push(error);
36
+ }
22
37
  function buildFrameworkRequestFromFetchRequest(request) {
23
38
  const requestUrl = new URL(request.url);
24
39
  return {
@@ -33,14 +48,10 @@ function buildFrameworkRequestFromFetchRequest(request) {
33
48
  url: requestUrl.pathname + requestUrl.search
34
49
  };
35
50
  }
36
- let graphqlInstanceOfPatchRefCount = 0;
37
- let restoreGraphqlInstanceOfPatch;
38
- const allowedCrossRealmGraphqlObjects = new WeakSet();
39
-
51
+ let _GraphqlEndpointContr;
40
52
  /**
41
53
  * Declares the HTTP endpoints that receive GraphQL GET and POST requests.
42
54
  */
43
- let _GraphqlEndpointContr;
44
55
  class GraphqlEndpointController {
45
56
  static {
46
57
  ({
@@ -62,23 +73,7 @@ class GraphqlEndpointController {
62
73
  }
63
74
  }
64
75
  export { _GraphqlEndpointContr as GraphqlEndpointController };
65
- function getCrossRealmGraphqlTag(value, constructor) {
66
- const prototypeTag = constructor.prototype?.[Symbol.toStringTag];
67
- const className = typeof prototypeTag === 'string' ? prototypeTag : constructor.name;
68
- if (typeof className !== 'string' || !className.startsWith('GraphQL')) {
69
- return undefined;
70
- }
71
- if (typeof value !== 'object' || value === null) {
72
- return undefined;
73
- }
74
- const valueTag = value[Symbol.toStringTag];
75
- if (typeof valueTag === 'string') {
76
- return valueTag === className ? className : undefined;
77
- }
78
- const valueClassName = value.constructor?.name;
79
- return valueClassName === className ? className : undefined;
80
- }
81
- function markAllowedCrossRealmGraphqlObjects(value, visited = new WeakSet()) {
76
+ function markAllowedCrossRealmGraphqlObjects(value, allowedObjects, visited = new WeakSet()) {
82
77
  if (typeof value !== 'object' || value === null) {
83
78
  return;
84
79
  }
@@ -89,69 +84,24 @@ function markAllowedCrossRealmGraphqlObjects(value, visited = new WeakSet()) {
89
84
  const tag = value[Symbol.toStringTag];
90
85
  const constructorName = value.constructor?.name;
91
86
  if (typeof tag === 'string' && tag.startsWith('GraphQL') || typeof constructorName === 'string' && constructorName.startsWith('GraphQL')) {
92
- allowedCrossRealmGraphqlObjects.add(value);
87
+ allowedObjects.add(value);
93
88
  }
94
89
  if (Array.isArray(value)) {
95
90
  for (const item of value) {
96
- markAllowedCrossRealmGraphqlObjects(item, visited);
91
+ markAllowedCrossRealmGraphqlObjects(item, allowedObjects, visited);
97
92
  }
98
93
  return;
99
94
  }
100
95
  for (const nestedValue of Object.values(value)) {
101
- markAllowedCrossRealmGraphqlObjects(nestedValue, visited);
96
+ markAllowedCrossRealmGraphqlObjects(nestedValue, allowedObjects, visited);
102
97
  }
103
98
  }
104
- function isAllowedCrossRealmGraphqlObject(value, constructor) {
105
- if (typeof value !== 'object' || value === null) {
106
- return false;
107
- }
108
- return allowedCrossRealmGraphqlObjects.has(value) && getCrossRealmGraphqlTag(value, constructor) !== undefined;
109
- }
110
- function installGraphqlInstanceOfPatch(instanceOfModule) {
111
- if (restoreGraphqlInstanceOfPatch) {
112
- graphqlInstanceOfPatchRefCount += 1;
113
- return releaseGraphqlInstanceOfPatch;
114
- }
115
- const patchedFrom = instanceOfModule.instanceOf;
116
- const patchedInstanceOf = (value, constructor) => {
117
- try {
118
- if (patchedFrom(value, constructor)) {
119
- return true;
120
- }
121
- } catch (error) {
122
- if (isAllowedCrossRealmGraphqlObject(value, constructor)) {
123
- return true;
124
- }
125
- throw error;
126
- }
127
- return isAllowedCrossRealmGraphqlObject(value, constructor);
128
- };
129
- instanceOfModule.instanceOf = patchedInstanceOf;
130
- graphqlInstanceOfPatchRefCount = 1;
131
- restoreGraphqlInstanceOfPatch = () => {
132
- if (instanceOfModule.instanceOf !== patchedInstanceOf) {
133
- return;
134
- }
135
- instanceOfModule.instanceOf = patchedFrom;
136
- };
137
- return releaseGraphqlInstanceOfPatch;
138
- }
139
- function releaseGraphqlInstanceOfPatch() {
140
- if (graphqlInstanceOfPatchRefCount === 0) {
141
- return;
142
- }
143
- graphqlInstanceOfPatchRefCount -= 1;
144
- if (graphqlInstanceOfPatchRefCount > 0) {
145
- return;
146
- }
147
- restoreGraphqlInstanceOfPatch?.();
148
- restoreGraphqlInstanceOfPatch = undefined;
149
- }
150
99
  async function loadGraphqlDeps() {
151
100
  const graphqlSpecifier = 'graphql';
152
101
  const yogaSpecifier = 'graphql-yoga';
153
102
  const instanceOfSpecifier = 'graphql/jsutils/instanceOf.js';
154
- const [graphqlMod, yogaMod, instanceOfModule] = await Promise.all([import(/* @vite-ignore */graphqlSpecifier), import(/* @vite-ignore */yogaSpecifier), import(/* @vite-ignore */instanceOfSpecifier)]);
103
+ const [graphqlMod, yogaMod] = await Promise.all([import(/* @vite-ignore */graphqlSpecifier), import(/* @vite-ignore */yogaSpecifier)]);
104
+ const instanceOfModule = runtimeRequire(instanceOfSpecifier);
155
105
  return {
156
106
  GraphQLError: graphqlMod.GraphQLError,
157
107
  GraphQLBoolean: graphqlMod.GraphQLBoolean,
@@ -181,59 +131,60 @@ class GraphqlLifecycleService {
181
131
  static {
182
132
  [_GraphqlLifecycleServ, _initClass2] = _applyDecs(this, [Inject(RUNTIME_CONTAINER, COMPILED_MODULES, APPLICATION_LOGGER, HTTP_APPLICATION_ADAPTER, GRAPHQL_INTERNAL_MODULE_OPTIONS_TOKEN)], []).c;
183
133
  }
134
+ allowedCrossRealmGraphqlObjects;
184
135
  graphQLErrorConstructor;
185
- middlewareRegistered = false;
186
- operationContainers = new WeakMap();
136
+ operationContainers = new Map();
187
137
  requestContexts = new WeakMap();
138
+ failedWebsocketOperationContainers = new Map();
139
+ websocketContainerDisposals = new Map();
140
+ websocketContainersAttemptedInCurrentCleanup;
188
141
  websocketOperationContainers = new Map();
189
142
  websocketTransport;
190
143
  executeGraphqlOperation;
191
144
  releaseGraphqlInstanceOfPatch;
192
145
  subscribeGraphqlOperation;
193
146
  yoga;
194
- middleware = {
195
- handle: async (context, next) => {
196
- if (!isGraphqlPath(context.request.path)) {
197
- await next();
198
- return;
147
+ async handle(context, next) {
148
+ if (!isGraphqlPath(context.request.path)) {
149
+ await next();
150
+ return;
151
+ }
152
+ const yoga = this.yoga;
153
+ if (!yoga) {
154
+ this.logger.error('GraphQL middleware was invoked before GraphQL Yoga initialization.', undefined, 'GraphqlLifecycleService');
155
+ context.response.setStatus(500);
156
+ await context.response.send({
157
+ errors: [{
158
+ message: 'GraphQL server not initialized.'
159
+ }]
160
+ });
161
+ return;
162
+ }
163
+ try {
164
+ const fetchRequest = toFetchRequest(context.request);
165
+ this.requestContexts.set(fetchRequest, {
166
+ principal: context.requestContext.principal,
167
+ request: context.request
168
+ });
169
+ try {
170
+ const fetchResponse = await yoga.fetch(fetchRequest);
171
+ await writeFetchResponse(fetchResponse, context.response);
172
+ } finally {
173
+ this.requestContexts.delete(fetchRequest);
174
+ await this.disposeOperationContainer(fetchRequest);
199
175
  }
200
- const yoga = this.yoga;
201
- if (!yoga) {
202
- this.logger.error('GraphQL middleware was invoked before GraphQL Yoga initialization.', undefined, 'GraphqlLifecycleService');
176
+ } catch (error) {
177
+ this.logger.error('Failed to process GraphQL request.', error, 'GraphqlLifecycleService');
178
+ if (!context.response.committed) {
203
179
  context.response.setStatus(500);
204
180
  await context.response.send({
205
181
  errors: [{
206
- message: 'GraphQL server not initialized.'
182
+ message: 'Internal server error.'
207
183
  }]
208
184
  });
209
- return;
210
- }
211
- try {
212
- const fetchRequest = toFetchRequest(context.request);
213
- this.requestContexts.set(fetchRequest, {
214
- principal: context.requestContext.principal,
215
- request: context.request
216
- });
217
- try {
218
- const fetchResponse = await yoga.fetch(fetchRequest);
219
- await writeFetchResponse(fetchResponse, context.response);
220
- } finally {
221
- this.requestContexts.delete(fetchRequest);
222
- await this.disposeOperationContainer(fetchRequest);
223
- }
224
- } catch (error) {
225
- this.logger.error('Failed to process GraphQL request.', error, 'GraphqlLifecycleService');
226
- if (!context.response.committed) {
227
- context.response.setStatus(500);
228
- await context.response.send({
229
- errors: [{
230
- message: 'Internal server error.'
231
- }]
232
- });
233
- }
234
185
  }
235
186
  }
236
- };
187
+ }
237
188
  constructor(runtimeContainer, compiledModules, logger, adapter, options) {
238
189
  this.runtimeContainer = runtimeContainer;
239
190
  this.compiledModules = compiledModules;
@@ -242,7 +193,7 @@ class GraphqlLifecycleService {
242
193
  this.options = options;
243
194
  }
244
195
  async onApplicationBootstrap() {
245
- if (this.middlewareRegistered) {
196
+ if (this.yoga) {
246
197
  return;
247
198
  }
248
199
  try {
@@ -266,8 +217,6 @@ class GraphqlLifecycleService {
266
217
  schema
267
218
  });
268
219
  await this.registerWebSocketTransport();
269
- this.registerMiddleware();
270
- this.middlewareRegistered = true;
271
220
  } catch (error) {
272
221
  try {
273
222
  await this.resetGraphqlRuntimeState();
@@ -281,13 +230,28 @@ class GraphqlLifecycleService {
281
230
  await this.resetGraphqlRuntimeState();
282
231
  }
283
232
  async resetGraphqlRuntimeState() {
284
- await this.unregisterWebSocketTransport();
285
- this.unregisterMiddleware();
286
- this.middlewareRegistered = false;
233
+ const cleanupErrors = [];
234
+ this.websocketContainersAttemptedInCurrentCleanup = new Set();
235
+ try {
236
+ await this.unregisterWebSocketTransport();
237
+ } catch (error) {
238
+ collectCleanupError(cleanupErrors, error);
239
+ } finally {
240
+ this.websocketContainersAttemptedInCurrentCleanup = undefined;
241
+ }
242
+ try {
243
+ await this.disposeAllOperationContainers();
244
+ } catch (error) {
245
+ collectCleanupError(cleanupErrors, error);
246
+ }
247
+ if (cleanupErrors.length > 0) {
248
+ throw new AggregateError(cleanupErrors, 'Failed to clean up GraphQL runtime resources.');
249
+ }
287
250
  this.executeGraphqlOperation = undefined;
288
251
  this.graphQLErrorConstructor = undefined;
289
252
  this.releaseGraphqlInstanceOfPatch?.();
290
253
  this.releaseGraphqlInstanceOfPatch = undefined;
254
+ this.allowedCrossRealmGraphqlObjects = undefined;
291
255
  this.subscribeGraphqlOperation = undefined;
292
256
  this.yoga = undefined;
293
257
  }
@@ -309,43 +273,18 @@ class GraphqlLifecycleService {
309
273
  };
310
274
  }
311
275
  resolveSchema(deps) {
312
- this.releaseGraphqlInstanceOfPatch ??= installGraphqlInstanceOfPatch(deps.instanceOfModule);
313
- return resolveSchema(deps, this.options.schema, () => this.createCodeFirstSchema(deps), markAllowedCrossRealmGraphqlObjects);
276
+ const allowedObjects = this.allowedCrossRealmGraphqlObjects ?? new WeakSet();
277
+ this.allowedCrossRealmGraphqlObjects = allowedObjects;
278
+ this.releaseGraphqlInstanceOfPatch ??= installGraphqlInstanceOfPatch(deps.instanceOfModule, allowedObjects);
279
+ const markAllowedObject = value => markAllowedCrossRealmGraphqlObjects(value, allowedObjects);
280
+ return resolveSchema(deps, this.options.schema, () => this.createCodeFirstSchema(deps, markAllowedObject), markAllowedObject);
314
281
  }
315
- createCodeFirstSchema(deps) {
316
- return createCodeFirstSchema(deps, this.runtimeContainer, this.discoverResolverDescriptors(), markAllowedCrossRealmGraphqlObjects);
282
+ createCodeFirstSchema(deps, markAllowedObject) {
283
+ return createCodeFirstSchema(deps, this.runtimeContainer, this.discoverResolverDescriptors(), markAllowedObject);
317
284
  }
318
285
  discoverResolverDescriptors() {
319
286
  return discoverResolverDescriptors(this.compiledModules, this.options);
320
287
  }
321
- registerMiddleware() {
322
- for (const compiledModule of this.compiledModules) {
323
- if (!compiledModule.providerTokens.has(_GraphqlLifecycleServ)) {
324
- continue;
325
- }
326
- const middleware = compiledModule.definition.middleware ?? [];
327
- if (!middleware.includes(this.middleware)) {
328
- compiledModule.definition.middleware = [...middleware, this.middleware];
329
- continue;
330
- }
331
- compiledModule.definition.middleware = [...middleware];
332
- }
333
- }
334
- unregisterMiddleware() {
335
- for (const compiledModule of this.compiledModules) {
336
- if (!compiledModule.providerTokens.has(_GraphqlLifecycleServ)) {
337
- continue;
338
- }
339
- const middleware = compiledModule.definition.middleware ?? [];
340
- const remaining = [];
341
- for (const entry of middleware) {
342
- if (entry !== this.middleware) {
343
- remaining.push(entry);
344
- }
345
- }
346
- compiledModule.definition.middleware = remaining;
347
- }
348
- }
349
288
  buildGraphqlContext(request, requestContextOverride, operationContainerOverride) {
350
289
  const storedContext = this.requestContexts.get(request);
351
290
  const requestContext = {
@@ -383,7 +322,9 @@ class GraphqlLifecycleService {
383
322
  },
384
323
  keepAliveMs: this.options.subscriptions?.websocket?.keepAliveMs,
385
324
  limits: this.resolveWebSocketLimits(),
386
- onComplete: (socketKey, operationId) => this.disposeWebSocketOperationContainer(socketKey, operationId),
325
+ onComplete: async (socketKey, operationId) => {
326
+ await this.disposeWebSocketOperationContainer(socketKey, operationId);
327
+ },
387
328
  onDisconnect: socketKey => this.disposeAllWebSocketOperationContainers(socketKey),
388
329
  onSubscribe: request => this.handleWebSocketSubscribe(request),
389
330
  subscribe: args => {
@@ -395,16 +336,28 @@ class GraphqlLifecycleService {
395
336
  });
396
337
  }
397
338
  async unregisterWebSocketTransport() {
339
+ const cleanupErrors = [];
398
340
  if (this.websocketTransport) {
399
341
  try {
400
342
  await this.websocketTransport.dispose();
401
343
  } catch (error) {
402
344
  this.logger.error('Failed to dispose GraphQL websocket transport.', error, 'GraphqlLifecycleService');
345
+ collectCleanupError(cleanupErrors, error);
346
+ }
347
+ if (cleanupErrors.length === 0) {
348
+ this.websocketTransport = undefined;
349
+ }
350
+ }
351
+ const socketKeys = new Set([...this.websocketOperationContainers.keys(), ...this.failedWebsocketOperationContainers.keys()]);
352
+ for (const socketKey of socketKeys) {
353
+ try {
354
+ await this.disposeAllWebSocketOperationContainers(socketKey);
355
+ } catch (error) {
356
+ collectCleanupError(cleanupErrors, error);
403
357
  }
404
358
  }
405
- this.websocketTransport = undefined;
406
- for (const socketKey of this.websocketOperationContainers.keys()) {
407
- await this.disposeAllWebSocketOperationContainers(socketKey);
359
+ if (cleanupErrors.length > 0) {
360
+ throw new AggregateError(cleanupErrors, 'Failed to dispose GraphQL websocket resources.');
408
361
  }
409
362
  }
410
363
  isWebSocketTransportEnabled() {
@@ -421,12 +374,12 @@ class GraphqlLifecycleService {
421
374
  }
422
375
  const fetchRequest = toFetchRequest(request.request);
423
376
  const operationContainer = this.getOrCreateWebSocketOperationContainer(request.socket, request.operationId);
424
- const graphqlContext = this.buildGraphqlContext(fetchRequest, {
425
- connectionParams: request.connectionParams,
426
- request: request.request,
427
- socket: request.socket
428
- }, operationContainer);
429
377
  try {
378
+ const graphqlContext = this.buildGraphqlContext(fetchRequest, {
379
+ connectionParams: request.connectionParams,
380
+ request: request.request,
381
+ socket: request.socket
382
+ }, operationContainer);
430
383
  const {
431
384
  contextFactory,
432
385
  parse,
@@ -490,25 +443,55 @@ class GraphqlLifecycleService {
490
443
  if (socketContainers && socketContainers.size === 0) {
491
444
  this.websocketOperationContainers.delete(socketKey);
492
445
  }
493
- try {
494
- await operationContainer.dispose();
495
- } catch (error) {
496
- this.logger.error('Failed to dispose GraphQL websocket operation container.', error, 'GraphqlLifecycleService');
446
+ return await this.disposeWebSocketContainerOnce(socketKey, operationContainer);
447
+ }
448
+ async disposeWebSocketContainerOnce(socketKey, operationContainer) {
449
+ const inFlight = this.websocketContainerDisposals.get(operationContainer);
450
+ if (inFlight) {
451
+ return await inFlight;
497
452
  }
453
+ const attempted = this.websocketContainersAttemptedInCurrentCleanup;
454
+ if (attempted?.has(operationContainer)) {
455
+ return undefined;
456
+ }
457
+ attempted?.add(operationContainer);
458
+ const disposal = operationContainer.dispose().then(() => {
459
+ this.failedWebsocketOperationContainers.get(socketKey)?.delete(operationContainer);
460
+ return undefined;
461
+ }, error => {
462
+ const failedContainers = this.failedWebsocketOperationContainers.get(socketKey) ?? new Set();
463
+ failedContainers.add(operationContainer);
464
+ this.failedWebsocketOperationContainers.set(socketKey, failedContainers);
465
+ this.logger.error('Failed to dispose GraphQL websocket operation container.', error, 'GraphqlLifecycleService');
466
+ return error;
467
+ }).finally(() => {
468
+ this.websocketContainerDisposals.delete(operationContainer);
469
+ });
470
+ this.websocketContainerDisposals.set(operationContainer, disposal);
471
+ return await disposal;
498
472
  }
499
473
  async disposeAllWebSocketOperationContainers(socketKey) {
500
- const socketContainers = this.websocketOperationContainers.get(socketKey);
501
- if (!socketContainers) {
502
- return;
474
+ const cleanupErrors = [];
475
+ const failedContainers = this.failedWebsocketOperationContainers.get(socketKey);
476
+ for (const operationContainer of [...(failedContainers ?? [])]) {
477
+ const cleanupError = await this.disposeWebSocketContainerOnce(socketKey, operationContainer);
478
+ if (cleanupError !== undefined) {
479
+ collectCleanupError(cleanupErrors, cleanupError);
480
+ }
503
481
  }
504
- this.websocketOperationContainers.delete(socketKey);
505
- for (const operationContainer of socketContainers.values()) {
506
- try {
507
- await operationContainer.dispose();
508
- } catch (error) {
509
- this.logger.error('Failed to dispose GraphQL websocket operation container.', error, 'GraphqlLifecycleService');
482
+ if (failedContainers?.size === 0) {
483
+ this.failedWebsocketOperationContainers.delete(socketKey);
484
+ }
485
+ const socketContainers = this.websocketOperationContainers.get(socketKey);
486
+ for (const operationId of [...(socketContainers?.keys() ?? [])]) {
487
+ const cleanupError = await this.disposeWebSocketOperationContainer(socketKey, operationId);
488
+ if (cleanupError !== undefined) {
489
+ collectCleanupError(cleanupErrors, cleanupError);
510
490
  }
511
491
  }
492
+ if (cleanupErrors.length > 0) {
493
+ throw new AggregateError(cleanupErrors, 'Failed to dispose GraphQL websocket operation containers.');
494
+ }
512
495
  }
513
496
  getOrCreateOperationContainer(request) {
514
497
  const existing = this.operationContainers.get(request);
@@ -524,11 +507,24 @@ class GraphqlLifecycleService {
524
507
  if (!operationContainer) {
525
508
  return;
526
509
  }
527
- this.operationContainers.delete(request);
528
510
  try {
529
511
  await operationContainer.dispose();
530
512
  } catch (error) {
531
513
  this.logger.error('Failed to dispose GraphQL operation container.', error, 'GraphqlLifecycleService');
514
+ return error;
515
+ }
516
+ this.operationContainers.delete(request);
517
+ }
518
+ async disposeAllOperationContainers() {
519
+ const cleanupErrors = [];
520
+ for (const request of [...this.operationContainers.keys()]) {
521
+ const cleanupError = await this.disposeOperationContainer(request);
522
+ if (cleanupError !== undefined) {
523
+ collectCleanupError(cleanupErrors, cleanupError);
524
+ }
525
+ }
526
+ if (cleanupErrors.length > 0) {
527
+ throw new AggregateError(cleanupErrors, 'Failed to dispose GraphQL operation containers.');
532
528
  }
533
529
  }
534
530
  static {
@@ -1 +1 @@
1
- {"version":3,"file":"transport.d.ts","sourceRoot":"","sources":["../../src/transport/transport.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,iBAAiB,EAA2B,MAAM,cAAc,CAAC;AAEjG;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEnD;AA6ED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAUjE;AAgGD;;;;;;GAMG;AACH,wBAAsB,kBAAkB,CAAC,aAAa,EAAE,QAAQ,EAAE,iBAAiB,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC,CA+BrH"}
1
+ {"version":3,"file":"transport.d.ts","sourceRoot":"","sources":["../../src/transport/transport.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,iBAAiB,EAA2B,MAAM,cAAc,CAAC;AAEjG;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEnD;AA6ED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAUjE;AAmGD;;;;;;GAMG;AACH,wBAAsB,kBAAkB,CAAC,aAAa,EAAE,QAAQ,EAAE,iBAAiB,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC,CA+BrH"}
@@ -150,7 +150,7 @@ async function writeFetchResponseStream(body, stream) {
150
150
  }
151
151
  }
152
152
  } catch (error) {
153
- await cancelUnreadBody();
153
+ await cancelUnreadBody().then(() => undefined, () => undefined);
154
154
  throw error;
155
155
  } finally {
156
156
  removeCloseListener?.();
package/dist/types.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { MetadataPropertyKey, Token } from '@fluojs/core';
1
+ import type { ForwardRefToken, InjectionToken, MaybePromise, MetadataPropertyKey, OptionalInjectToken, Token } from '@fluojs/core';
2
2
  import type { Container } from '@fluojs/di';
3
3
  import type { FrameworkRequest, Principal } from '@fluojs/http';
4
4
  import type { GraphQLObjectType, GraphQLSchema, GraphQLUnionType } from 'graphql';
@@ -105,7 +105,7 @@ export type ResolverHandlerType = 'query' | 'mutation' | 'subscription' | 'field
105
105
  /**
106
106
  * Explicit source kinds that can be bound to object field-resolver parameters.
107
107
  */
108
- export type FieldResolverParameterKind = 'parent' | 'context';
108
+ export type FieldResolverParameterKind = 'parent' | 'context' | 'input';
109
109
  /**
110
110
  * Describes one positional parameter binding for an object field resolver.
111
111
  */
@@ -233,4 +233,27 @@ export interface GraphqlModuleOptions {
233
233
  plugins?: unknown[];
234
234
  subscriptions?: GraphqlSubscriptionsOptions;
235
235
  }
236
+ type GraphqlAsyncFactoryDependencies<TTokens extends readonly InjectionToken[]> = {
237
+ -readonly [Index in keyof TTokens]: TTokens[Index] extends OptionalInjectToken<infer TDependency> ? TDependency | undefined : TTokens[Index] extends ForwardRefToken<infer TDependency> ? TDependency : TTokens[Index] extends Token<infer TDependency> ? TDependency : never;
238
+ };
239
+ /**
240
+ * Configures GraphQL registration through explicitly injected application dependencies.
241
+ *
242
+ * Only `inject` and `useFactory` are supported. NestJS-style `imports`, `useClass`,
243
+ * `useExisting`, and implicit provider discovery are intentionally unavailable.
244
+ *
245
+ * @typeParam TTokens Tuple of injection tokens whose resolved values are passed
246
+ * to `useFactory` in the same order. Optional tokens resolve as `T | undefined`.
247
+ */
248
+ export interface GraphqlAsyncModuleOptions<TTokens extends readonly InjectionToken[] = readonly InjectionToken[]> {
249
+ /**
250
+ * Application-graph tokens whose resolved values are passed to `useFactory` in order.
251
+ */
252
+ inject?: TTokens;
253
+ /**
254
+ * Resolves the GraphQL module options from the explicitly injected dependency values.
255
+ */
256
+ useFactory: (...dependencies: GraphqlAsyncFactoryDependencies<TTokens>) => MaybePromise<GraphqlModuleOptions>;
257
+ }
258
+ export {};
236
259
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAC/D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,KAAK,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAChE,OAAO,KAAK,EAAE,iBAAiB,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAElF;;;;;GAKG;AACH,eAAO,MAAM,2BAA2B,eAAiD,CAAC;AAE1F;;;;;GAKG;A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AC,KAAK,CAAC,SAAS,eAAe,CAAC,MAAM,WAAW,CAAC,GACvD,WAAW,GACX,OAAO,CAAC,KAAK,CAAC,SAAS,KAAK,CAAC,MAAM,WAAW,CAAC,GAC7C,WAAW,GACX,KAAK;CACd,CAAC;AAEF;;;;;;;;GAQG;AACH,MAAM,WAAW,yBAAyB,CACxC,OAAO,SAAS,SAAS,cAAc,EAAE,GAAG,SAAS,cAAc,EAAE;IAErE;;OAEG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;OAEG;IACH,UAAU,EAAE,CACV,GAAG,YAAY,EAAE,+BAA+B,CAAC,OAAO,CAAC,KACtD,YAAY,CAAC,oBAAoB,CAAC,CAAC;CACzC"}
package/dist/types.js CHANGED
@@ -137,4 +137,14 @@ export function isGraphqlListTypeRef(value) {
137
137
  * @remarks
138
138
  * Keep README examples for end-to-end module wiring. Source hover docs here are
139
139
  * meant to clarify how each option shapes the per-request execution pipeline.
140
+ */
141
+
142
+ /**
143
+ * Configures GraphQL registration through explicitly injected application dependencies.
144
+ *
145
+ * Only `inject` and `useFactory` are supported. NestJS-style `imports`, `useClass`,
146
+ * `useExisting`, and implicit provider discovery are intentionally unavailable.
147
+ *
148
+ * @typeParam TTokens Tuple of injection tokens whose resolved values are passed
149
+ * to `useFactory` in the same order. Optional tokens resolve as `T | undefined`.
140
150
  */