@inversifyjs/apollo-core 0.2.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.
Files changed (34) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/README.md +3 -0
  3. package/lib/esm/apollo/controllers/ApolloServerController.d.ts +5 -0
  4. package/lib/esm/apollo/controllers/ApolloServerController.d.ts.map +1 -0
  5. package/lib/esm/apollo/controllers/ApolloServerController.js +3 -0
  6. package/lib/esm/apollo/controllers/ApolloServerController.js.map +1 -0
  7. package/lib/esm/apollo/models/apolloServerPluginsServiceIdentifier.d.ts +4 -0
  8. package/lib/esm/apollo/models/apolloServerPluginsServiceIdentifier.d.ts.map +1 -0
  9. package/lib/esm/apollo/models/apolloServerPluginsServiceIdentifier.js +2 -0
  10. package/lib/esm/apollo/models/apolloServerPluginsServiceIdentifier.js.map +1 -0
  11. package/lib/esm/apollo/models/apolloServerResolversServiceIdentifier.d.ts +4 -0
  12. package/lib/esm/apollo/models/apolloServerResolversServiceIdentifier.d.ts.map +1 -0
  13. package/lib/esm/apollo/models/apolloServerResolversServiceIdentifier.js +2 -0
  14. package/lib/esm/apollo/models/apolloServerResolversServiceIdentifier.js.map +1 -0
  15. package/lib/esm/apollo/models/apolloServerServiceIdentifier.d.ts +4 -0
  16. package/lib/esm/apollo/models/apolloServerServiceIdentifier.d.ts.map +1 -0
  17. package/lib/esm/apollo/models/apolloServerServiceIdentifier.js +2 -0
  18. package/lib/esm/apollo/models/apolloServerServiceIdentifier.js.map +1 -0
  19. package/lib/esm/apollo/models/apolloServerTypeDefsServiceIdentifier.d.ts +4 -0
  20. package/lib/esm/apollo/models/apolloServerTypeDefsServiceIdentifier.d.ts.map +1 -0
  21. package/lib/esm/apollo/models/apolloServerTypeDefsServiceIdentifier.js +2 -0
  22. package/lib/esm/apollo/models/apolloServerTypeDefsServiceIdentifier.js.map +1 -0
  23. package/lib/esm/apollo/modules/ApolloServerContainerModule.d.ts +5 -0
  24. package/lib/esm/apollo/modules/ApolloServerContainerModule.d.ts.map +1 -0
  25. package/lib/esm/apollo/modules/ApolloServerContainerModule.js +30 -0
  26. package/lib/esm/apollo/modules/ApolloServerContainerModule.js.map +1 -0
  27. package/lib/esm/apollo/modules/ApolloServerContainerModule.spec.d.ts +2 -0
  28. package/lib/esm/apollo/modules/ApolloServerContainerModule.spec.d.ts.map +1 -0
  29. package/lib/esm/index.d.ts +7 -0
  30. package/lib/esm/index.d.ts.map +1 -0
  31. package/lib/esm/index.js +7 -0
  32. package/lib/esm/index.js.map +1 -0
  33. package/package.json +63 -0
  34. package/tsconfig.esm.json +10 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,8 @@
1
+ # @inversifyjs/apollo-core
2
+
3
+ ## 0.2.0
4
+
5
+ ### Minor Changes
6
+
7
+ - Added `ApolloServerContainerModule`
8
+ - Added `ApolloServerController`
package/README.md ADDED
@@ -0,0 +1,3 @@
1
+ # @inversifyjs/apollo-core
2
+
3
+ Inversify GraphQL Apollo core modules.
@@ -0,0 +1,5 @@
1
+ import { BaseContext } from '@apollo/server';
2
+ export declare abstract class ApolloServerController<TContext extends BaseContext = BaseContext, TContextArgs extends unknown[] = any[]> {
3
+ protected abstract _getContext(...args: TContextArgs): Promise<TContext>;
4
+ }
5
+ //# sourceMappingURL=ApolloServerController.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ApolloServerController.d.ts","sourceRoot":"","sources":["../../../../src/apollo/controllers/ApolloServerController.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,8BAAsB,sBAAsB,CAC1C,QAAQ,SAAS,WAAW,GAAG,WAAW,EAE1C,YAAY,SAAS,OAAO,EAAE,GAAG,GAAG,EAAE;IAEtC,SAAS,CAAC,QAAQ,CAAC,WAAW,CAAC,GAAG,IAAI,EAAE,YAAY,GAAG,OAAO,CAAC,QAAQ,CAAC;CACzE"}
@@ -0,0 +1,3 @@
1
+ export class ApolloServerController {
2
+ }
3
+ //# sourceMappingURL=ApolloServerController.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ApolloServerController.js","sourceRoot":"","sources":["../../../../src/apollo/controllers/ApolloServerController.ts"],"names":[],"mappings":"AAEA,MAAM,OAAgB,sBAAsB;CAM3C"}
@@ -0,0 +1,4 @@
1
+ import { type ApolloServerPlugin } from '@apollo/server';
2
+ import { type ServiceIdentifier } from 'inversify';
3
+ export declare const apolloServerPluginsServiceIdentifier: ServiceIdentifier<ApolloServerPlugin<any>[] | undefined>;
4
+ //# sourceMappingURL=apolloServerPluginsServiceIdentifier.d.ts.map
@@ -0,0 +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"}
@@ -0,0 +1,2 @@
1
+ export const apolloServerPluginsServiceIdentifier = Symbol.for('@inversifyjs/apollo-core/ApolloServerPlugins');
2
+ //# sourceMappingURL=apolloServerPluginsServiceIdentifier.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"apolloServerPluginsServiceIdentifier.js","sourceRoot":"","sources":["../../../../src/apollo/models/apolloServerPluginsServiceIdentifier.ts"],"names":[],"mappings":"AAGA,MAAM,CAAC,MAAM,oCAAoC,GAG7C,MAAM,CAAC,GAAG,CAAC,8CAA8C,CAAC,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { type IResolvers } from '@graphql-tools/utils';
2
+ import { type ServiceIdentifier } from 'inversify';
3
+ export declare const apolloServerResolversServiceIdentifier: ServiceIdentifier<IResolvers>;
4
+ //# sourceMappingURL=apolloServerResolversServiceIdentifier.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"apolloServerResolversServiceIdentifier.d.ts","sourceRoot":"","sources":["../../../../src/apollo/models/apolloServerResolversServiceIdentifier.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAEnD,eAAO,MAAM,sCAAsC,EAAE,iBAAiB,CAAC,UAAU,CACnB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export const apolloServerResolversServiceIdentifier = Symbol.for('@inversifyjs/apollo-core/ApolloServerResolvers');
2
+ //# sourceMappingURL=apolloServerResolversServiceIdentifier.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"apolloServerResolversServiceIdentifier.js","sourceRoot":"","sources":["../../../../src/apollo/models/apolloServerResolversServiceIdentifier.ts"],"names":[],"mappings":"AAGA,MAAM,CAAC,MAAM,sCAAsC,GACjD,MAAM,CAAC,GAAG,CAAC,gDAAgD,CAAC,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { type ApolloServer } from '@apollo/server';
2
+ import { type ServiceIdentifier } from 'inversify';
3
+ export declare const apolloServerServiceIdentifier: ServiceIdentifier<ApolloServer>;
4
+ //# sourceMappingURL=apolloServerServiceIdentifier.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"apolloServerServiceIdentifier.d.ts","sourceRoot":"","sources":["../../../../src/apollo/models/apolloServerServiceIdentifier.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAEnD,eAAO,MAAM,6BAA6B,EAAE,iBAAiB,CAAC,YAAY,CACrB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export const apolloServerServiceIdentifier = Symbol.for('@inversifyjs/apollo-core/apolloServer');
2
+ //# sourceMappingURL=apolloServerServiceIdentifier.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"apolloServerServiceIdentifier.js","sourceRoot":"","sources":["../../../../src/apollo/models/apolloServerServiceIdentifier.ts"],"names":[],"mappings":"AAGA,MAAM,CAAC,MAAM,6BAA6B,GACxC,MAAM,CAAC,GAAG,CAAC,uCAAuC,CAAC,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { type TypeSource } from '@graphql-tools/utils';
2
+ import { type ServiceIdentifier } from 'inversify';
3
+ export declare const apolloServerTypeDefsServiceIdentifier: ServiceIdentifier<TypeSource>;
4
+ //# sourceMappingURL=apolloServerTypeDefsServiceIdentifier.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"apolloServerTypeDefsServiceIdentifier.d.ts","sourceRoot":"","sources":["../../../../src/apollo/models/apolloServerTypeDefsServiceIdentifier.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAEnD,eAAO,MAAM,qCAAqC,EAAE,iBAAiB,CAAC,UAAU,CACnB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export const apolloServerTypeDefsServiceIdentifier = Symbol.for('@inversifyjs/apollo-core/ApolloServerTypeDefs');
2
+ //# sourceMappingURL=apolloServerTypeDefsServiceIdentifier.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"apolloServerTypeDefsServiceIdentifier.js","sourceRoot":"","sources":["../../../../src/apollo/models/apolloServerTypeDefsServiceIdentifier.ts"],"names":[],"mappings":"AAGA,MAAM,CAAC,MAAM,qCAAqC,GAChD,MAAM,CAAC,GAAG,CAAC,+CAA+C,CAAC,CAAC"}
@@ -0,0 +1,5 @@
1
+ import { ContainerModule, type ContainerModuleLoadOptions } from 'inversify';
2
+ export declare class ApolloServerContainerModule extends ContainerModule {
3
+ constructor(load?: ((options: ContainerModuleLoadOptions) => void | Promise<void>) | undefined);
4
+ }
5
+ //# sourceMappingURL=ApolloServerContainerModule.d.ts.map
@@ -0,0 +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"}
@@ -0,0 +1,30 @@
1
+ import { ApolloServer } from '@apollo/server';
2
+ import { ContainerModule } from 'inversify';
3
+ import { apolloServerPluginsServiceIdentifier } from '../models/apolloServerPluginsServiceIdentifier.js';
4
+ import { apolloServerResolversServiceIdentifier } from '../models/apolloServerResolversServiceIdentifier.js';
5
+ import { apolloServerServiceIdentifier } from '../models/apolloServerServiceIdentifier.js';
6
+ import { apolloServerTypeDefsServiceIdentifier } from '../models/apolloServerTypeDefsServiceIdentifier.js';
7
+ export class ApolloServerContainerModule extends ContainerModule {
8
+ constructor(load) {
9
+ super((options) => {
10
+ options.bind(apolloServerServiceIdentifier).toResolvedValue(async (plugins, resolvers, typeDefs) => {
11
+ const apolloServer = new ApolloServer({
12
+ plugins: plugins ?? [],
13
+ resolvers,
14
+ typeDefs,
15
+ });
16
+ await apolloServer.start();
17
+ return apolloServer;
18
+ }, [
19
+ {
20
+ optional: true,
21
+ serviceIdentifier: apolloServerPluginsServiceIdentifier,
22
+ },
23
+ apolloServerResolversServiceIdentifier,
24
+ apolloServerTypeDefsServiceIdentifier,
25
+ ]);
26
+ return load?.(options);
27
+ });
28
+ }
29
+ }
30
+ //# sourceMappingURL=ApolloServerContainerModule.js.map
@@ -0,0 +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"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=ApolloServerContainerModule.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ApolloServerContainerModule.spec.d.ts","sourceRoot":"","sources":["../../../../src/apollo/modules/ApolloServerContainerModule.spec.ts"],"names":[],"mappings":""}
@@ -0,0 +1,7 @@
1
+ export { ApolloServerController } from './apollo/controllers/ApolloServerController.js';
2
+ export { apolloServerPluginsServiceIdentifier } from './apollo/models/apolloServerPluginsServiceIdentifier.js';
3
+ export { apolloServerResolversServiceIdentifier } from './apollo/models/apolloServerResolversServiceIdentifier.js';
4
+ export { apolloServerTypeDefsServiceIdentifier } from './apollo/models/apolloServerTypeDefsServiceIdentifier.js';
5
+ export { apolloServerServiceIdentifier } from './apollo/models/apolloServerServiceIdentifier.js';
6
+ export { ApolloServerContainerModule } from './apollo/modules/ApolloServerContainerModule.js';
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +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"}
@@ -0,0 +1,7 @@
1
+ export { ApolloServerController } from './apollo/controllers/ApolloServerController.js';
2
+ export { apolloServerPluginsServiceIdentifier } from './apollo/models/apolloServerPluginsServiceIdentifier.js';
3
+ export { apolloServerResolversServiceIdentifier } from './apollo/models/apolloServerResolversServiceIdentifier.js';
4
+ export { apolloServerTypeDefsServiceIdentifier } from './apollo/models/apolloServerTypeDefsServiceIdentifier.js';
5
+ export { apolloServerServiceIdentifier } from './apollo/models/apolloServerServiceIdentifier.js';
6
+ export { ApolloServerContainerModule } from './apollo/modules/ApolloServerContainerModule.js';
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +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"}
package/package.json ADDED
@@ -0,0 +1,63 @@
1
+ {
2
+ "author": "Roberto Pintos López",
3
+ "bugs": {
4
+ "url": "https://github.com/inversify/graphql/issues"
5
+ },
6
+ "description": "InversifyJs GraphQL Apollo core package",
7
+ "dependencies": {},
8
+ "devDependencies": {
9
+ "@graphql-tools/utils": "10.11.0",
10
+ "@types/node": "24.10.4",
11
+ "@vitest/coverage-v8": "4.0.16",
12
+ "eslint": "9.39.2",
13
+ "prettier": "3.7.4",
14
+ "rimraf": "6.1.2",
15
+ "tslib": "2.8.1",
16
+ "typescript": "5.9.3",
17
+ "vitest": "4.0.16"
18
+ },
19
+ "homepage": "https://inversify.io/framework/",
20
+ "keywords": [
21
+ "apollo",
22
+ "inversify",
23
+ "graphql",
24
+ "http",
25
+ "node",
26
+ "typescript"
27
+ ],
28
+ "devEngines": {
29
+ "node": "^24.10.0",
30
+ "pnpm": "^10.13.1"
31
+ },
32
+ "license": "MIT",
33
+ "module": "lib/esm/index.js",
34
+ "exports": {
35
+ ".": "./lib/esm/index.js"
36
+ },
37
+ "name": "@inversifyjs/apollo-core",
38
+ "peerDependencies": {
39
+ "@apollo/server": "^5.2.0",
40
+ "inversify": "^7.10.8"
41
+ },
42
+ "publishConfig": {
43
+ "access": "public"
44
+ },
45
+ "repository": {
46
+ "type": "git",
47
+ "url": "git+https://github.com/inversify/graphql.git"
48
+ },
49
+ "type": "module",
50
+ "version": "0.2.0",
51
+ "scripts": {
52
+ "build": "tsc",
53
+ "build:clean": "rimraf lib",
54
+ "format": "prettier --write ./src",
55
+ "lint": "eslint ./src",
56
+ "prebuild": "pnpm run build:clean",
57
+ "test": "vitest run",
58
+ "test:integration": "pnpm run test --project Integration",
59
+ "test:coverage": "pnpm run test:unit --coverage",
60
+ "test:uncommitted": "pnpm run test --changed=HEAD",
61
+ "test:unit": "pnpm run test --project Unit"
62
+ }
63
+ }
@@ -0,0 +1,10 @@
1
+ {
2
+ "$schema": "http://json.schemastore.org/tsconfig",
3
+ "extends": "@inversifyjs/foundation-typescript-config/tsconfig.base.esm.json",
4
+ "compilerOptions": {
5
+ "outDir": "./lib/esm",
6
+ "rootDir": "./src",
7
+ "tsBuildInfoFile": "tsconfig.tsbuildinfo"
8
+ },
9
+ "include": ["src"]
10
+ }