@webiny/api-graphql 0.0.0-unstable.5387e5f7c8 → 0.0.0-unstable.d0f34a8194

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.
@@ -7,16 +7,30 @@ export interface IGraphQLSchema {
7
7
  }
8
8
  /** Define custom GraphQL schema extensions. */
9
9
  export interface IGraphQLSchemaFactory {
10
+ /**
11
+ * Resolvers added here end up in a schema that is cached across requests. They must get
12
+ * request-scoped services through `addResolver({ dependencies })`, never from `this`.
13
+ */
10
14
  execute(builder: GraphQLSchemaBuilder.Interface): Promise<GraphQLSchemaBuilder.Interface>;
11
15
  /**
12
16
  * Returns what this factory's type definitions and resolver paths depend on: the same key must
13
17
  * always mean the same output. When every factory has one, the GraphQL engine runs the factories
14
18
  * only if no schema is cached under the combined key yet. Leave it out and the factories run on
15
- * every request. Use `staticSchemaKey()` for a factory whose output never changes.
19
+ * every request, but a schema with the same output is still served from the cache, with the
20
+ * resolvers of the request that first built it. Use `staticSchemaKey()` for a factory whose
21
+ * output never changes.
16
22
  */
17
23
  getSchemaKey?(): string | Promise<string>;
18
24
  }
19
- /** Define custom GraphQL schema extensions. */
25
+ /**
26
+ * Define custom GraphQL schema extensions.
27
+ *
28
+ * The built schema is cached across requests. Constructor dependencies are injected only for the
29
+ * request that builds it, so a resolver must never read them (`this.identityContext` and similar):
30
+ * every later request served from the cache would run with that request's identity, tenant and
31
+ * use cases. Declare what a resolver needs in `builder.addResolver({ dependencies })`, which
32
+ * resolves it from the current request, and register the factory with `dependencies: []`.
33
+ */
20
34
  export declare const GraphQLSchemaFactory: import("@webiny/di").Abstraction<IGraphQLSchemaFactory>;
21
35
  export declare namespace GraphQLSchemaFactory {
22
36
  type Interface = IGraphQLSchemaFactory;
@@ -1 +1 @@
1
- {"version":3,"file":"graphql/abstractions.public.js","sources":["../../src/graphql/abstractions.public.ts"],"sourcesContent":["/**\n * This file contains abstraction for use by third party developers.\n */\nimport { createAbstraction } from \"@webiny/feature/api\";\nimport type {\n Resolvers as IResolvers,\n TypeDefs as ITypeDefs,\n ResolverDecorators as IResolverDecorators\n} from \"~/types.js\";\nimport type { GraphQLSchemaBuilder } from \"~/features/GraphQLSchemaBuilder/abstractions.js\";\n\nexport interface IGraphQLSchema {\n typeDefs?: ITypeDefs;\n resolvers?: IResolvers<any>;\n resolverDecorators?: IResolverDecorators;\n}\n\n/** Define custom GraphQL schema extensions. */\nexport interface IGraphQLSchemaFactory {\n execute(builder: GraphQLSchemaBuilder.Interface): Promise<GraphQLSchemaBuilder.Interface>;\n /**\n * Returns what this factory's type definitions and resolver paths depend on: the same key must\n * always mean the same output. When every factory has one, the GraphQL engine runs the factories\n * only if no schema is cached under the combined key yet. Leave it out and the factories run on\n * every request. Use `staticSchemaKey()` for a factory whose output never changes.\n */\n getSchemaKey?(): string | Promise<string>;\n}\n\n/** Define custom GraphQL schema extensions. */\nexport const GraphQLSchemaFactory =\n createAbstraction<IGraphQLSchemaFactory>(\"GraphQLSchemaFactory\");\n\nexport namespace GraphQLSchemaFactory {\n export type Interface = IGraphQLSchemaFactory;\n export type SchemaBuilder = GraphQLSchemaBuilder.Interface;\n export type Return = Promise<GraphQLSchemaBuilder.Interface>;\n}\n"],"names":["GraphQLSchemaFactory","createAbstraction"],"mappings":";AA8BO,MAAMA,uBACTC,kBAAyC"}
1
+ {"version":3,"file":"graphql/abstractions.public.js","sources":["../../src/graphql/abstractions.public.ts"],"sourcesContent":["/**\n * This file contains abstraction for use by third party developers.\n */\nimport { createAbstraction } from \"@webiny/feature/api\";\nimport type {\n Resolvers as IResolvers,\n TypeDefs as ITypeDefs,\n ResolverDecorators as IResolverDecorators\n} from \"~/types.js\";\nimport type { GraphQLSchemaBuilder } from \"~/features/GraphQLSchemaBuilder/abstractions.js\";\n\nexport interface IGraphQLSchema {\n typeDefs?: ITypeDefs;\n resolvers?: IResolvers<any>;\n resolverDecorators?: IResolverDecorators;\n}\n\n/** Define custom GraphQL schema extensions. */\nexport interface IGraphQLSchemaFactory {\n /**\n * Resolvers added here end up in a schema that is cached across requests. They must get\n * request-scoped services through `addResolver({ dependencies })`, never from `this`.\n */\n execute(builder: GraphQLSchemaBuilder.Interface): Promise<GraphQLSchemaBuilder.Interface>;\n /**\n * Returns what this factory's type definitions and resolver paths depend on: the same key must\n * always mean the same output. When every factory has one, the GraphQL engine runs the factories\n * only if no schema is cached under the combined key yet. Leave it out and the factories run on\n * every request, but a schema with the same output is still served from the cache, with the\n * resolvers of the request that first built it. Use `staticSchemaKey()` for a factory whose\n * output never changes.\n */\n getSchemaKey?(): string | Promise<string>;\n}\n\n/**\n * Define custom GraphQL schema extensions.\n *\n * The built schema is cached across requests. Constructor dependencies are injected only for the\n * request that builds it, so a resolver must never read them (`this.identityContext` and similar):\n * every later request served from the cache would run with that request's identity, tenant and\n * use cases. Declare what a resolver needs in `builder.addResolver({ dependencies })`, which\n * resolves it from the current request, and register the factory with `dependencies: []`.\n */\nexport const GraphQLSchemaFactory =\n createAbstraction<IGraphQLSchemaFactory>(\"GraphQLSchemaFactory\");\n\nexport namespace GraphQLSchemaFactory {\n export type Interface = IGraphQLSchemaFactory;\n export type SchemaBuilder = GraphQLSchemaBuilder.Interface;\n export type Return = Promise<GraphQLSchemaBuilder.Interface>;\n}\n"],"names":["GraphQLSchemaFactory","createAbstraction"],"mappings":";AA4CO,MAAMA,uBACTC,kBAAyC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webiny/api-graphql",
3
- "version": "0.0.0-unstable.5387e5f7c8",
3
+ "version": "0.0.0-unstable.d0f34a8194",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": "./index.js",
@@ -22,19 +22,19 @@
22
22
  "@graphql-tools/resolvers-composition": "7.0.36",
23
23
  "@graphql-tools/schema": "10.1.0",
24
24
  "@graphql-tools/utils": "12.0.0",
25
- "@webiny/api": "0.0.0-unstable.5387e5f7c8",
25
+ "@webiny/api": "0.0.0-unstable.d0f34a8194",
26
26
  "@webiny/di": "2.0.0",
27
- "@webiny/error": "0.0.0-unstable.5387e5f7c8",
28
- "@webiny/event-handler-core": "0.0.0-unstable.5387e5f7c8",
29
- "@webiny/feature": "0.0.0-unstable.5387e5f7c8",
30
- "@webiny/plugins": "0.0.0-unstable.5387e5f7c8",
31
- "@webiny/utils": "0.0.0-unstable.5387e5f7c8",
27
+ "@webiny/error": "0.0.0-unstable.d0f34a8194",
28
+ "@webiny/event-handler-core": "0.0.0-unstable.d0f34a8194",
29
+ "@webiny/feature": "0.0.0-unstable.d0f34a8194",
30
+ "@webiny/plugins": "0.0.0-unstable.d0f34a8194",
31
+ "@webiny/utils": "0.0.0-unstable.d0f34a8194",
32
32
  "graphql": "16.14.2",
33
33
  "graphql-scalars": "2.0.0",
34
34
  "zod": "4.4.3"
35
35
  },
36
36
  "devDependencies": {
37
- "@webiny/build-tools": "0.0.0-unstable.5387e5f7c8",
37
+ "@webiny/build-tools": "0.0.0-unstable.d0f34a8194",
38
38
  "rimraf": "6.1.3",
39
39
  "typescript": "7.0.2",
40
40
  "vitest": "4.1.11"