@tsed/cli-plugin-typegraphql 6.6.3 → 7.0.0-alpha.2

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.
@@ -1,10 +1,6 @@
1
- import { type InitCmdContext, RootRendererService } from "@tsed/cli";
2
- import { ProjectPackageJson } from "@tsed/cli-core";
3
- export declare class TypeGraphqlInitHook {
4
- protected packageJson: ProjectPackageJson;
5
- protected rootRenderer: RootRendererService;
6
- onExec(ctx: InitCmdContext): {
7
- title: string;
8
- task: () => import("rxjs").Observable<unknown>;
9
- }[];
1
+ import { type CliCommandHooks, type InitCmdContext, ProjectClient, type RenderDataContext } from "@tsed/cli";
2
+ import { type Task } from "@tsed/cli-core";
3
+ export declare class TypeGraphqlInitHook implements CliCommandHooks {
4
+ $alterInitSubTasks(tasks: Task[], data: InitCmdContext): Promise<Task[]>;
5
+ $alterProjectFiles(project: ProjectClient, data: RenderDataContext): ProjectClient;
10
6
  }
@@ -1,4 +1,4 @@
1
+ import "./templates/index.js";
1
2
  import { TypeGraphqlModule } from "./TypeGraphqlModule.js";
2
3
  export * from "./hooks/TypeGraphqlInitHook.js";
3
- export * from "./utils/templateDir.js";
4
4
  export default TypeGraphqlModule;
@@ -0,0 +1,2 @@
1
+ declare const _default: import("@tsed/cli").DefineTemplateOptions;
2
+ export default _default;
@@ -0,0 +1,4 @@
1
+ import "./datasource.template.js";
2
+ import "./resolver.template.js";
3
+ import "./model.template.js";
4
+ import "./service.template.js";
@@ -0,0 +1,2 @@
1
+ declare const _default: import("@tsed/cli").DefineTemplateOptions;
2
+ export default _default;
@@ -0,0 +1,2 @@
1
+ declare const _default: import("@tsed/cli").DefineTemplateOptions;
2
+ export default _default;
@@ -0,0 +1,2 @@
1
+ declare const _default: import("@tsed/cli").DefineTemplateOptions;
2
+ export default _default;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tsed/cli-plugin-typegraphql",
3
3
  "description": "Ts.ED CLI plugin. Add TypeGraphql support.",
4
- "version": "6.6.3",
4
+ "version": "7.0.0-alpha.2",
5
5
  "type": "module",
6
6
  "main": "./lib/esm/index.js",
7
7
  "source": "./src/index.ts",
@@ -29,9 +29,9 @@
29
29
  "tslib": "2.7.0"
30
30
  },
31
31
  "devDependencies": {
32
- "@tsed/cli": "6.6.3",
33
- "@tsed/cli-core": "6.6.3",
34
- "@tsed/typescript": "6.6.3",
32
+ "@tsed/cli": "7.0.0-alpha.2",
33
+ "@tsed/cli-core": "7.0.0-alpha.2",
34
+ "@tsed/typescript": "7.0.0-alpha.2",
35
35
  "cross-env": "7.0.3",
36
36
  "typescript": "5.6.2",
37
37
  "vitest": "3.2.4"
@@ -46,5 +46,8 @@
46
46
  },
47
47
  "homepage": "https://github.com/tsedio/tsed-cli/tree/master/packages/cli-plugin-typegraphql",
48
48
  "author": "Romain Lenzotti",
49
- "license": "MIT"
49
+ "license": "MIT",
50
+ "publishConfig": {
51
+ "tag": "alpha"
52
+ }
50
53
  }
@@ -1,2 +0,0 @@
1
- import { getTemplateDirectory } from "@tsed/cli-core";
2
- export const TEMPLATE_DIR = getTemplateDirectory(import.meta.dirname);
@@ -1 +0,0 @@
1
- export declare const TEMPLATE_DIR: string;
@@ -1,18 +0,0 @@
1
- import {DataSourceService} from "@tsed/typegraphql";
2
- import {RESTDataSource} from "apollo-datasource-rest";
3
-
4
- @DataSourceService()
5
- export class MyDataSource extends RESTDataSource {
6
- constructor() {
7
- super();
8
- this.baseURL = "http://localhost:8001";
9
- }
10
-
11
- willSendRequest(request: any) {
12
- request.headers.set("Authorization", this.context.token);
13
- }
14
-
15
- getMyData(id: string) {
16
- return this.get(`/rest/calendars/${id}`);
17
- }
18
- }
@@ -1 +0,0 @@
1
- export * from "./MyDataSource.js";
@@ -1,3 +0,0 @@
1
- export * from "./recipes/Recipe.js";
2
- export * from "./recipes/RecipeNotFoundError.js";
3
- export * from "./recipes/RecipeResolver.js";
@@ -1,27 +0,0 @@
1
- import {Field, ID, ObjectType} from "type-graphql";
2
-
3
- @ObjectType({description: "Object representing cooking recipe"})
4
- export class Recipe {
5
- @Field((type) => ID)
6
- id: string;
7
-
8
- @Field()
9
- title: string;
10
-
11
- @Field({nullable: true})
12
- description?: string;
13
-
14
- @Field()
15
- creationDate: Date;
16
-
17
- @Field((type) => [String])
18
- ingredients: string[];
19
-
20
- constructor(options: Partial<Recipe> = {}) {
21
- options.id && (this.id = options.id);
22
- options.title && (this.title = options.title);
23
- options.description && (this.description = options.description);
24
- options.creationDate && (this.creationDate = options.creationDate);
25
- options.ingredients && (this.ingredients = options.ingredients);
26
- }
27
- }
@@ -1,7 +0,0 @@
1
- import {NotFound} from "@tsed/exceptions";
2
-
3
- export class RecipeNotFoundError extends NotFound {
4
- constructor(private id: string) {
5
- super("Recipe not found");
6
- }
7
- }
@@ -1,26 +0,0 @@
1
- import {ResolverService} from "@tsed/typegraphql";
2
- import {Arg, Query} from "type-graphql";
3
- import {RecipeService} from "../../services/RecipeService.js";
4
- import {Recipe} from "./Recipe.js";
5
- import {RecipeNotFoundError} from "./RecipeNotFoundError.js";
6
-
7
- @ResolverService(Recipe)
8
- export class RecipeResolver {
9
- constructor(private recipeService: RecipeService) {}
10
-
11
- @Query((returns) => Recipe)
12
- async recipe(@Arg("id") id: string) {
13
- const recipe = await this.recipeService.findById(id);
14
-
15
- if (recipe === undefined) {
16
- throw new RecipeNotFoundError(id);
17
- }
18
-
19
- return recipe;
20
- }
21
-
22
- @Query((returns) => [Recipe], {description: "Get all the recipes from around the world "})
23
- recipes(): Promise<Recipe[]> {
24
- return this.recipeService.findAll({});
25
- }
26
- }
@@ -1,13 +0,0 @@
1
- import {Injectable} from "@tsed/di";
2
- import {Recipe} from "../resolvers.js";
3
-
4
- @Injectable()
5
- export class RecipeService {
6
- findById(id: string) {
7
- return new Recipe({id})
8
- }
9
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
10
- findAll(query: any) {
11
- return []
12
- }
13
- }