@tsed/typegraphql 7.79.4 → 7.80.1
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/lib/types-esm/TypeGraphQLModule.d.ts +16 -0
- package/lib/types-esm/constants/constants.d.ts +1 -0
- package/lib/types-esm/decorators/resolver.d.ts +16 -0
- package/lib/types-esm/exports.d.ts +1 -0
- package/lib/types-esm/index.d.ts +11 -0
- package/lib/types-esm/interfaces/TypeGraphQLSettings.d.ts +6 -0
- package/lib/types-esm/interfaces/interfaces.d.ts +14 -0
- package/lib/types-esm/middlewares/ContextMiddleware.d.ts +7 -0
- package/lib/types-esm/services/TypeGraphQLService.d.ts +36 -0
- package/package.json +18 -14
- package/vitest.config.mts +21 -0
- package/jest.config.js +0 -20
- package/lib/cjs/package.json +0 -3
- package/lib/esm/package.json +0 -3
- package/tsconfig.esm.json +0 -39
|
@@ -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,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,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.4",
|
|
4
3
|
"description": "TypeGraphQL package for Ts.ED framework, based on Apollo-server-core and Type-graphql",
|
|
4
|
+
"type": "commonjs",
|
|
5
|
+
"version": "7.80.1",
|
|
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
|
-
"
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
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": "
|
|
21
|
-
"build:ts": "tsc --build tsconfig.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.
|
|
27
|
+
"@tsed/apollo": "7.80.1",
|
|
25
28
|
"tslib": "2.6.1"
|
|
26
29
|
},
|
|
27
30
|
"devDependencies": {
|
|
28
|
-
"@tsed/barrels": "7.
|
|
29
|
-
"@tsed/common": "7.
|
|
30
|
-
"@tsed/core": "7.
|
|
31
|
-
"@tsed/typescript": "7.
|
|
31
|
+
"@tsed/barrels": "7.80.1",
|
|
32
|
+
"@tsed/common": "7.80.1",
|
|
33
|
+
"@tsed/core": "7.80.1",
|
|
34
|
+
"@tsed/typescript": "7.80.1",
|
|
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
|
-
"
|
|
38
|
-
"
|
|
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
|
-
};
|
package/lib/cjs/package.json
DELETED
package/lib/esm/package.json
DELETED
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
|
-
}
|