@tsed/typegraphql 7.79.3 → 7.80.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.
@@ -0,0 +1,16 @@
1
+ import { Configuration, InjectorService } from "@tsed/di";
2
+ import { TypeGraphQLSettings } from "./interfaces/interfaces.js";
3
+ import { TypeGraphQLService } from "./services/TypeGraphQLService.js";
4
+ /**
5
+ * @ignore
6
+ */
7
+ export declare class TypeGraphQLModule {
8
+ protected service: TypeGraphQLService;
9
+ protected injector: InjectorService;
10
+ protected configuration: Configuration;
11
+ get settings(): {
12
+ [key: string]: TypeGraphQLSettings;
13
+ } | undefined;
14
+ $onRoutesInit(): Promise<any> | void;
15
+ $afterListen(): Promise<any> | void;
16
+ }
@@ -0,0 +1 @@
1
+ export declare const RESOLVERS_PROVIDERS = "graphql:resolvers";
@@ -0,0 +1,16 @@
1
+ import { ClassType } from "type-graphql";
2
+ import { AbstractClassOptions, ClassTypeResolver } from "type-graphql/dist/decorators/types";
3
+ export interface ResolverControllerOptions extends AbstractClassOptions {
4
+ id?: string;
5
+ }
6
+ export declare function ResolverController(path?: string): ClassDecorator;
7
+ export declare function ResolverController(options: ResolverControllerOptions): ClassDecorator;
8
+ export declare function ResolverController(typeFunc: ClassTypeResolver, options?: ResolverControllerOptions): ClassDecorator;
9
+ export declare function ResolverController(objectType: ClassType, options?: ResolverControllerOptions): ClassDecorator;
10
+ /**
11
+ * @deprecated Use ResolverController instead
12
+ */
13
+ export declare function ResolverService(): ClassDecorator;
14
+ export declare function ResolverService(options: AbstractClassOptions): ClassDecorator;
15
+ export declare function ResolverService(typeFunc: ClassTypeResolver, options?: AbstractClassOptions): ClassDecorator;
16
+ export declare function ResolverService(objectType: ClassType, options?: AbstractClassOptions): ClassDecorator;
@@ -0,0 +1 @@
1
+ export { DataSource, DataSourceService } from "@tsed/apollo";
@@ -0,0 +1,11 @@
1
+ /**
2
+ * @file Automatically generated by @tsed/barrels.
3
+ */
4
+ export * from "./constants/constants.js";
5
+ export * from "./decorators/resolver.js";
6
+ export * from "./exports.js";
7
+ export * from "./interfaces/interfaces.js";
8
+ export * from "./interfaces/TypeGraphQLSettings.js";
9
+ export * from "./middlewares/ContextMiddleware.js";
10
+ export * from "./services/TypeGraphQLService.js";
11
+ export * from "./TypeGraphQLModule.js";
@@ -0,0 +1,6 @@
1
+ import { ApolloConfig, ApolloSettings } from "@tsed/apollo";
2
+ import { BuildSchemaOptions } from "type-graphql";
3
+ export interface TypeGraphQLSettings extends ApolloSettings {
4
+ buildSchemaOptions?: Partial<BuildSchemaOptions>;
5
+ serverConfig?: ApolloConfig;
6
+ }
@@ -0,0 +1,14 @@
1
+ import { TypeGraphQLSettings } from "./TypeGraphQLSettings.js";
2
+ declare global {
3
+ namespace TsED {
4
+ interface Configuration {
5
+ graphql: {
6
+ [key: string]: TypeGraphQLSettings;
7
+ };
8
+ typegraphql: {
9
+ [key: string]: TypeGraphQLSettings;
10
+ };
11
+ }
12
+ }
13
+ }
14
+ export * from "./TypeGraphQLSettings.js";
@@ -0,0 +1,7 @@
1
+ import { PlatformContext } from "@tsed/common";
2
+ import { MiddlewareFn } from "type-graphql";
3
+ export declare const ContextMiddleware: MiddlewareFn<{
4
+ req: {
5
+ $ctx: PlatformContext;
6
+ };
7
+ }>;
@@ -0,0 +1,36 @@
1
+ import { ApolloService } from "@tsed/apollo";
2
+ import { Type } from "@tsed/core";
3
+ import { InjectorService } from "@tsed/di";
4
+ import { Logger } from "@tsed/logger";
5
+ import { ApolloServerBase } from "apollo-server-core";
6
+ import { GraphQLSchema } from "graphql";
7
+ import { BuildSchemaOptions } from "type-graphql";
8
+ import { TypeGraphQLSettings } from "../interfaces/interfaces.js";
9
+ export declare class TypeGraphQLService {
10
+ protected injector: InjectorService;
11
+ protected apolloService: ApolloService;
12
+ protected logger: Logger;
13
+ /**
14
+ * Get an instance of ApolloServer from his id
15
+ * @returns ApolloServer
16
+ */
17
+ get(id?: string): ApolloServerBase | undefined;
18
+ /**
19
+ *
20
+ * @param {string} id
21
+ * @returns {boolean}
22
+ */
23
+ has(id?: string): boolean;
24
+ createServer(id: string, settings: TypeGraphQLSettings): Promise<ApolloServerBase<any>>;
25
+ /**
26
+ * Create a new type-graphql Schema and bind it with Ts.ED injector.
27
+ * @param buildSchemaOptions
28
+ */
29
+ createSchema(buildSchemaOptions: BuildSchemaOptions): Promise<GraphQLSchema>;
30
+ /**
31
+ * Get an instance of GraphQL schema from his id
32
+ * @returns GraphQLSchema
33
+ */
34
+ getSchema(id?: string): GraphQLSchema | undefined;
35
+ protected getResolvers(id: string, resolvers: Type<any>[]): Type<any>[];
36
+ }
package/package.json CHANGED
@@ -1,41 +1,45 @@
1
1
  {
2
2
  "name": "@tsed/typegraphql",
3
- "version": "7.79.3",
4
3
  "description": "TypeGraphQL package for Ts.ED framework, based on Apollo-server-core and Type-graphql",
4
+ "type": "commonjs",
5
+ "version": "7.80.0",
5
6
  "source": "./src/index.ts",
6
7
  "main": "./lib/cjs/index.js",
7
8
  "module": "./lib/esm/index.js",
8
9
  "typings": "./lib/types/index.d.ts",
9
10
  "exports": {
10
- "types": "./lib/types/index.d.ts",
11
- "import": "./lib/esm/index.js",
12
- "require": "./lib/cjs/index.js",
13
- "default": "./lib/esm/index.js"
11
+ ".": {
12
+ "types": "./lib/types/index.d.ts",
13
+ "import": "./lib/esm/index.js",
14
+ "default": "./lib/cjs/index.js"
15
+ }
14
16
  },
15
17
  "scripts": {
16
18
  "build": "yarn barrels && yarn build:ts",
17
19
  "barrels": "barrels",
18
20
  "start:express": "ts-node test/app/index.express.ts",
19
21
  "start:koa": "ts-node test/app/index.koa.ts",
20
- "test": "jest && jest-coverage-thresholds-bumper",
21
- "build:ts": "tsc --build tsconfig.json && tsc --build tsconfig.esm.json"
22
+ "test": "vitest run",
23
+ "build:ts": "tsc --build tsconfig.json",
24
+ "test:ci": "vitest run --coverage.thresholds.autoUpdate=true"
22
25
  },
23
26
  "dependencies": {
24
- "@tsed/apollo": "7.79.3",
27
+ "@tsed/apollo": "7.80.0",
25
28
  "tslib": "2.6.1"
26
29
  },
27
30
  "devDependencies": {
28
- "@tsed/barrels": "7.79.3",
29
- "@tsed/common": "7.79.3",
30
- "@tsed/core": "7.79.3",
31
- "@tsed/typescript": "7.79.3",
31
+ "@tsed/barrels": "7.80.0",
32
+ "@tsed/common": "7.80.0",
33
+ "@tsed/core": "7.80.0",
34
+ "@tsed/typescript": "7.80.0",
32
35
  "@types/graphql": "^14.5.0",
33
36
  "class-validator": "~0.14.1",
34
37
  "cross-env": "^7.0.3",
35
38
  "eslint": "^8.57.0",
36
39
  "graphql-passport": "0.6.8",
37
- "jest": "^29.7.0",
38
- "type-graphql": "^1.1.1"
40
+ "type-graphql": "^1.1.1",
41
+ "typescript": "4.9.5",
42
+ "vitest": "2.0.4"
39
43
  },
40
44
  "peerDependencies": {
41
45
  "apollo-datasource": ">=3.0.0",
@@ -0,0 +1,21 @@
1
+ // @ts-ignore
2
+ import {presets} from "@tsed/vitest/presets";
3
+ import {defineConfig} from "vitest/config";
4
+
5
+ export default defineConfig(
6
+ {
7
+ ...presets,
8
+ test: {
9
+ ...presets.test,
10
+ coverage: {
11
+ ...presets.test.coverage,
12
+ thresholds: {
13
+ statements: 0,
14
+ branches: 0,
15
+ functions: 0,
16
+ lines: 0
17
+ }
18
+ }
19
+ }
20
+ }
21
+ );
package/jest.config.js DELETED
@@ -1,20 +0,0 @@
1
- // For a detailed explanation regarding each configuration property, visit:
2
- // https://jestjs.io/docs/en/configuration.html
3
- const config = require("@tsed/jest-config");
4
-
5
- module.exports = {
6
- ...config,
7
- roots: ["<rootDir>/src", "<rootDir>/test"],
8
- moduleNameMapper: {
9
- ...config.moduleNameMapper,
10
- "@tsed/typegraphql": "<rootDir>/src/index.ts"
11
- },
12
- coverageThreshold: {
13
- global: {
14
- statements: 94.65,
15
- branches: 64.1,
16
- functions: 94.73,
17
- lines: 94.65
18
- }
19
- }
20
- };
@@ -1,3 +0,0 @@
1
- {
2
- "type": "commonjs"
3
- }
@@ -1,3 +0,0 @@
1
- {
2
- "type": "module"
3
- }
package/tsconfig.esm.json DELETED
@@ -1,39 +0,0 @@
1
- {
2
- "extends": "@tsed/typescript/tsconfig.node.json",
3
- "compilerOptions": {
4
- "baseUrl": ".",
5
- "module": "ES2020",
6
- "rootDir": "src",
7
- "outDir": "./lib/esm",
8
- "declaration": true,
9
- "declarationDir": "./lib/types",
10
- "composite": true,
11
- "noEmit": false
12
- },
13
- "include": ["src", "src/**/*.json"],
14
- "exclude": [
15
- "node_modules",
16
- "test",
17
- "lib",
18
- "benchmark",
19
- "coverage",
20
- "spec",
21
- "**/*.benchmark.ts",
22
- "**/*.spec.ts",
23
- "keys",
24
- "jest.config.js",
25
- "**/__mock__/**",
26
- "webpack.config.js"
27
- ],
28
- "references": [
29
- {
30
- "path": "../../platform/common"
31
- },
32
- {
33
- "path": "../../core"
34
- },
35
- {
36
- "path": "../apollo"
37
- }
38
- ]
39
- }