@inversifyjs/apollo-core 0.2.0 → 0.3.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/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # @inversifyjs/apollo-core
2
2
 
3
+ ## 0.3.0
4
+
5
+ ### Minor Changes
6
+
7
+ - Updated `apolloServerPluginsServiceIdentifier` to be a plugin array service identifier
8
+ - Added `apolloServerGraphqlServiceIdentifier`
9
+ - Added `httpServerServiceIdentifier`
10
+
3
11
  ## 0.2.0
4
12
 
5
13
  ### Minor Changes
@@ -0,0 +1,4 @@
1
+ import { type GraphQLSchema } from 'graphql';
2
+ import { type ServiceIdentifier } from 'inversify';
3
+ export declare const apolloServerGraphqlServiceIdentifier: ServiceIdentifier<GraphQLSchema>;
4
+ //# sourceMappingURL=apolloServerGraphqlServiceIdentifier.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"apolloServerGraphqlServiceIdentifier.d.ts","sourceRoot":"","sources":["../../../../src/apollo/models/apolloServerGraphqlServiceIdentifier.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,SAAS,CAAC;AAC7C,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAEnD,eAAO,MAAM,oCAAoC,EAAE,iBAAiB,CAAC,aAAa,CACtB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export const apolloServerGraphqlServiceIdentifier = Symbol.for('@inversifyjs/apollo-core/ApolloServerGraphql');
2
+ //# sourceMappingURL=apolloServerGraphqlServiceIdentifier.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"apolloServerGraphqlServiceIdentifier.js","sourceRoot":"","sources":["../../../../src/apollo/models/apolloServerGraphqlServiceIdentifier.ts"],"names":[],"mappings":"AAGA,MAAM,CAAC,MAAM,oCAAoC,GAC/C,MAAM,CAAC,GAAG,CAAC,8CAA8C,CAAC,CAAC"}
@@ -1,4 +1,4 @@
1
1
  import { type ApolloServerPlugin } from '@apollo/server';
2
2
  import { type ServiceIdentifier } from 'inversify';
3
- export declare const apolloServerPluginsServiceIdentifier: ServiceIdentifier<ApolloServerPlugin<any>[] | undefined>;
3
+ export declare const apolloServerPluginsServiceIdentifier: ServiceIdentifier<ApolloServerPlugin<any>[]>;
4
4
  //# sourceMappingURL=apolloServerPluginsServiceIdentifier.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"apolloServerPluginsServiceIdentifier.d.ts","sourceRoot":"","sources":["../../../../src/apollo/models/apolloServerPluginsServiceIdentifier.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAEnD,eAAO,MAAM,oCAAoC,EAAE,iBAAiB,CAElE,kBAAkB,CAAC,GAAG,CAAC,EAAE,GAAG,SAAS,CACuB,CAAC"}
1
+ {"version":3,"file":"apolloServerPluginsServiceIdentifier.d.ts","sourceRoot":"","sources":["../../../../src/apollo/models/apolloServerPluginsServiceIdentifier.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAEnD,eAAO,MAAM,oCAAoC,EAAE,iBAAiB,CAElE,kBAAkB,CAAC,GAAG,CAAC,EAAE,CACmC,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type http from 'node:http';
2
+ import { type ServiceIdentifier } from 'inversify';
3
+ export declare const httpServerServiceIdentifier: ServiceIdentifier<http.Server>;
4
+ //# sourceMappingURL=httpServerServiceIdentifier.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"httpServerServiceIdentifier.d.ts","sourceRoot":"","sources":["../../../../src/apollo/models/httpServerServiceIdentifier.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAElC,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAEnD,eAAO,MAAM,2BAA2B,EAAE,iBAAiB,CAAC,IAAI,CAAC,MAAM,CACpB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export const httpServerServiceIdentifier = Symbol.for('@inversifyjs/apollo-core/HttpServer');
2
+ //# sourceMappingURL=httpServerServiceIdentifier.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"httpServerServiceIdentifier.js","sourceRoot":"","sources":["../../../../src/apollo/models/httpServerServiceIdentifier.ts"],"names":[],"mappings":"AAIA,MAAM,CAAC,MAAM,2BAA2B,GACtC,MAAM,CAAC,GAAG,CAAC,qCAAqC,CAAC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"ApolloServerContainerModule.d.ts","sourceRoot":"","sources":["../../../../src/apollo/modules/ApolloServerContainerModule.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,KAAK,0BAA0B,EAAE,MAAM,WAAW,CAAC;AAO7E,qBAAa,2BAA4B,SAAQ,eAAe;gBAE5D,IAAI,CAAC,EACD,CAAC,CAAC,OAAO,EAAE,0BAA0B,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,GAC/D,SAAS;CAgChB"}
1
+ {"version":3,"file":"ApolloServerContainerModule.d.ts","sourceRoot":"","sources":["../../../../src/apollo/modules/ApolloServerContainerModule.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,eAAe,EAAE,KAAK,0BAA0B,EAAE,MAAM,WAAW,CAAC;AAQ7E,qBAAa,2BAA4B,SAAQ,eAAe;gBAE5D,IAAI,CAAC,EACD,CAAC,CAAC,OAAO,EAAE,0BAA0B,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,GAC/D,SAAS;CA2ChB"}
@@ -1,5 +1,7 @@
1
1
  import { ApolloServer } from '@apollo/server';
2
+ import { makeExecutableSchema } from '@graphql-tools/schema';
2
3
  import { ContainerModule } from 'inversify';
4
+ import { apolloServerGraphqlServiceIdentifier } from '../models/apolloServerGraphqlServiceIdentifier.js';
3
5
  import { apolloServerPluginsServiceIdentifier } from '../models/apolloServerPluginsServiceIdentifier.js';
4
6
  import { apolloServerResolversServiceIdentifier } from '../models/apolloServerResolversServiceIdentifier.js';
5
7
  import { apolloServerServiceIdentifier } from '../models/apolloServerServiceIdentifier.js';
@@ -7,22 +9,30 @@ import { apolloServerTypeDefsServiceIdentifier } from '../models/apolloServerTyp
7
9
  export class ApolloServerContainerModule extends ContainerModule {
8
10
  constructor(load) {
9
11
  super((options) => {
10
- options.bind(apolloServerServiceIdentifier).toResolvedValue(async (plugins, resolvers, typeDefs) => {
12
+ options
13
+ .bind(apolloServerGraphqlServiceIdentifier)
14
+ .toResolvedValue((resolvers, typeDefs) => makeExecutableSchema({ resolvers, typeDefs }), [
15
+ apolloServerResolversServiceIdentifier,
16
+ apolloServerTypeDefsServiceIdentifier,
17
+ ])
18
+ .inSingletonScope();
19
+ options
20
+ .bind(apolloServerServiceIdentifier)
21
+ .toResolvedValue(async (plugins, schema) => {
11
22
  const apolloServer = new ApolloServer({
12
- plugins: plugins ?? [],
13
- resolvers,
14
- typeDefs,
23
+ plugins: plugins.flat(),
24
+ schema,
15
25
  });
16
26
  await apolloServer.start();
17
27
  return apolloServer;
18
28
  }, [
19
29
  {
20
- optional: true,
30
+ isMultiple: true,
21
31
  serviceIdentifier: apolloServerPluginsServiceIdentifier,
22
32
  },
23
- apolloServerResolversServiceIdentifier,
24
- apolloServerTypeDefsServiceIdentifier,
25
- ]);
33
+ apolloServerGraphqlServiceIdentifier,
34
+ ])
35
+ .inSingletonScope();
26
36
  return load?.(options);
27
37
  });
28
38
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ApolloServerContainerModule.js","sourceRoot":"","sources":["../../../../src/apollo/modules/ApolloServerContainerModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAA2B,MAAM,gBAAgB,CAAC;AAEvE,OAAO,EAAE,eAAe,EAAmC,MAAM,WAAW,CAAC;AAE7E,OAAO,EAAE,oCAAoC,EAAE,MAAM,mDAAmD,CAAC;AACzG,OAAO,EAAE,sCAAsC,EAAE,MAAM,qDAAqD,CAAC;AAC7G,OAAO,EAAE,6BAA6B,EAAE,MAAM,4CAA4C,CAAC;AAC3F,OAAO,EAAE,qCAAqC,EAAE,MAAM,oDAAoD,CAAC;AAE3G,MAAM,OAAO,2BAA4B,SAAQ,eAAe;IAC9D,YACE,IAEa;QAEb,KAAK,CAAC,CAAC,OAAmC,EAAwB,EAAE;YAClE,OAAO,CAAC,IAAI,CAAC,6BAA6B,CAAC,CAAC,eAAe,CACzD,KAAK,EACH,OAAyC,EACzC,SAAqB,EACrB,QAAoB,EACG,EAAE;gBACzB,MAAM,YAAY,GAAiB,IAAI,YAAY,CAAC;oBAClD,OAAO,EAAE,OAAO,IAAI,EAAE;oBACtB,SAAS;oBACT,QAAQ;iBACT,CAAC,CAAC;gBAEH,MAAM,YAAY,CAAC,KAAK,EAAE,CAAC;gBAE3B,OAAO,YAAY,CAAC;YACtB,CAAC,EACD;gBACE;oBACE,QAAQ,EAAE,IAAI;oBACd,iBAAiB,EAAE,oCAAoC;iBACxD;gBACD,sCAAsC;gBACtC,qCAAqC;aACtC,CACF,CAAC;YAEF,OAAO,IAAI,EAAE,CAAC,OAAO,CAAC,CAAC;QACzB,CAAC,CAAC,CAAC;IACL,CAAC;CACF"}
1
+ {"version":3,"file":"ApolloServerContainerModule.js","sourceRoot":"","sources":["../../../../src/apollo/modules/ApolloServerContainerModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAA2B,MAAM,gBAAgB,CAAC;AACvE,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAG7D,OAAO,EAAE,eAAe,EAAmC,MAAM,WAAW,CAAC;AAE7E,OAAO,EAAE,oCAAoC,EAAE,MAAM,mDAAmD,CAAC;AACzG,OAAO,EAAE,oCAAoC,EAAE,MAAM,mDAAmD,CAAC;AACzG,OAAO,EAAE,sCAAsC,EAAE,MAAM,qDAAqD,CAAC;AAC7G,OAAO,EAAE,6BAA6B,EAAE,MAAM,4CAA4C,CAAC;AAC3F,OAAO,EAAE,qCAAqC,EAAE,MAAM,oDAAoD,CAAC;AAE3G,MAAM,OAAO,2BAA4B,SAAQ,eAAe;IAC9D,YACE,IAEa;QAEb,KAAK,CAAC,CAAC,OAAmC,EAAwB,EAAE;YAClE,OAAO;iBACJ,IAAI,CAAC,oCAAoC,CAAC;iBAC1C,eAAe,CACd,CAAC,SAAqB,EAAE,QAAoB,EAAiB,EAAE,CAC7D,oBAAoB,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC,EAC/C;gBACE,sCAAsC;gBACtC,qCAAqC;aACtC,CACF;iBACA,gBAAgB,EAAE,CAAC;YACtB,OAAO;iBACJ,IAAI,CAAC,6BAA6B,CAAC;iBACnC,eAAe,CACd,KAAK,EACH,OAA+B,EAC/B,MAAqB,EACE,EAAE;gBACzB,MAAM,YAAY,GAAiB,IAAI,YAAY,CAAC;oBAClD,OAAO,EAAE,OAAO,CAAC,IAAI,EAAE;oBACvB,MAAM;iBACP,CAAC,CAAC;gBAEH,MAAM,YAAY,CAAC,KAAK,EAAE,CAAC;gBAE3B,OAAO,YAAY,CAAC;YACtB,CAAC,EACD;gBACE;oBACE,UAAU,EAAE,IAAI;oBAChB,iBAAiB,EAAE,oCAAoC;iBACxD;gBACD,oCAAoC;aACrC,CACF;iBACA,gBAAgB,EAAE,CAAC;YAEtB,OAAO,IAAI,EAAE,CAAC,OAAO,CAAC,CAAC;QACzB,CAAC,CAAC,CAAC;IACL,CAAC;CACF"}
@@ -1,7 +1,9 @@
1
1
  export { ApolloServerController } from './apollo/controllers/ApolloServerController.js';
2
+ export { apolloServerGraphqlServiceIdentifier } from './apollo/models/apolloServerGraphqlServiceIdentifier.js';
2
3
  export { apolloServerPluginsServiceIdentifier } from './apollo/models/apolloServerPluginsServiceIdentifier.js';
3
4
  export { apolloServerResolversServiceIdentifier } from './apollo/models/apolloServerResolversServiceIdentifier.js';
4
5
  export { apolloServerTypeDefsServiceIdentifier } from './apollo/models/apolloServerTypeDefsServiceIdentifier.js';
5
6
  export { apolloServerServiceIdentifier } from './apollo/models/apolloServerServiceIdentifier.js';
7
+ export { httpServerServiceIdentifier } from './apollo/models/httpServerServiceIdentifier.js';
6
8
  export { ApolloServerContainerModule } from './apollo/modules/ApolloServerContainerModule.js';
7
9
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,gDAAgD,CAAC;AACxF,OAAO,EAAE,oCAAoC,EAAE,MAAM,yDAAyD,CAAC;AAC/G,OAAO,EAAE,sCAAsC,EAAE,MAAM,2DAA2D,CAAC;AACnH,OAAO,EAAE,qCAAqC,EAAE,MAAM,0DAA0D,CAAC;AACjH,OAAO,EAAE,6BAA6B,EAAE,MAAM,kDAAkD,CAAC;AACjG,OAAO,EAAE,2BAA2B,EAAE,MAAM,iDAAiD,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,gDAAgD,CAAC;AACxF,OAAO,EAAE,oCAAoC,EAAE,MAAM,yDAAyD,CAAC;AAC/G,OAAO,EAAE,oCAAoC,EAAE,MAAM,yDAAyD,CAAC;AAC/G,OAAO,EAAE,sCAAsC,EAAE,MAAM,2DAA2D,CAAC;AACnH,OAAO,EAAE,qCAAqC,EAAE,MAAM,0DAA0D,CAAC;AACjH,OAAO,EAAE,6BAA6B,EAAE,MAAM,kDAAkD,CAAC;AACjG,OAAO,EAAE,2BAA2B,EAAE,MAAM,gDAAgD,CAAC;AAC7F,OAAO,EAAE,2BAA2B,EAAE,MAAM,iDAAiD,CAAC"}
package/lib/esm/index.js CHANGED
@@ -1,7 +1,9 @@
1
1
  export { ApolloServerController } from './apollo/controllers/ApolloServerController.js';
2
+ export { apolloServerGraphqlServiceIdentifier } from './apollo/models/apolloServerGraphqlServiceIdentifier.js';
2
3
  export { apolloServerPluginsServiceIdentifier } from './apollo/models/apolloServerPluginsServiceIdentifier.js';
3
4
  export { apolloServerResolversServiceIdentifier } from './apollo/models/apolloServerResolversServiceIdentifier.js';
4
5
  export { apolloServerTypeDefsServiceIdentifier } from './apollo/models/apolloServerTypeDefsServiceIdentifier.js';
5
6
  export { apolloServerServiceIdentifier } from './apollo/models/apolloServerServiceIdentifier.js';
7
+ export { httpServerServiceIdentifier } from './apollo/models/httpServerServiceIdentifier.js';
6
8
  export { ApolloServerContainerModule } from './apollo/modules/ApolloServerContainerModule.js';
7
9
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,gDAAgD,CAAC;AACxF,OAAO,EAAE,oCAAoC,EAAE,MAAM,yDAAyD,CAAC;AAC/G,OAAO,EAAE,sCAAsC,EAAE,MAAM,2DAA2D,CAAC;AACnH,OAAO,EAAE,qCAAqC,EAAE,MAAM,0DAA0D,CAAC;AACjH,OAAO,EAAE,6BAA6B,EAAE,MAAM,kDAAkD,CAAC;AACjG,OAAO,EAAE,2BAA2B,EAAE,MAAM,iDAAiD,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,gDAAgD,CAAC;AACxF,OAAO,EAAE,oCAAoC,EAAE,MAAM,yDAAyD,CAAC;AAC/G,OAAO,EAAE,oCAAoC,EAAE,MAAM,yDAAyD,CAAC;AAC/G,OAAO,EAAE,sCAAsC,EAAE,MAAM,2DAA2D,CAAC;AACnH,OAAO,EAAE,qCAAqC,EAAE,MAAM,0DAA0D,CAAC;AACjH,OAAO,EAAE,6BAA6B,EAAE,MAAM,kDAAkD,CAAC;AACjG,OAAO,EAAE,2BAA2B,EAAE,MAAM,gDAAgD,CAAC;AAC7F,OAAO,EAAE,2BAA2B,EAAE,MAAM,iDAAiD,CAAC"}
package/package.json CHANGED
@@ -4,12 +4,15 @@
4
4
  "url": "https://github.com/inversify/graphql/issues"
5
5
  },
6
6
  "description": "InversifyJs GraphQL Apollo core package",
7
- "dependencies": {},
7
+ "dependencies": {
8
+ "@graphql-tools/schema": "^10.0.30"
9
+ },
8
10
  "devDependencies": {
9
11
  "@graphql-tools/utils": "10.11.0",
10
12
  "@types/node": "24.10.4",
11
13
  "@vitest/coverage-v8": "4.0.16",
12
14
  "eslint": "9.39.2",
15
+ "graphql": "16.12.0",
13
16
  "prettier": "3.7.4",
14
17
  "rimraf": "6.1.2",
15
18
  "tslib": "2.8.1",
@@ -47,7 +50,7 @@
47
50
  "url": "git+https://github.com/inversify/graphql.git"
48
51
  },
49
52
  "type": "module",
50
- "version": "0.2.0",
53
+ "version": "0.3.0",
51
54
  "scripts": {
52
55
  "build": "tsc",
53
56
  "build:clean": "rimraf lib",