Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(common): remove export schema decorator from @tsed/common #2846

Merged
merged 1 commit into from
Oct 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions docs/docs/snippets/middlewares/accept-mime-usage.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import {Get} from "@tsed/schema";
import {Controller} from "@tsed/di";
import {AcceptMime} from "@tsed/common";
import {AcceptMime, Get} from "@tsed/schema";

@Controller("/mypath")
export class MyCtrl {
@Get("/")
@AcceptMime("application/json")
public getResource() {}
public getResource() {
}
}
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"types": "./lib/types/index.d.ts",
"browser": "./lib/browser/core.umd.min.js",
"import": "./lib/esm/index.js",
"default": "./lib/cjs/index.js"
"default": "./lib/esm/index.js"
}
},
"scripts": {
Expand Down
1 change: 0 additions & 1 deletion packages/core/tsconfig.spec.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@
],
"exclude": [
"node_modules",
"test",
"lib",
"benchmark",
"coverage"
Expand Down
2 changes: 1 addition & 1 deletion packages/di/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"types": "./lib/types/index.d.ts",
"browser": "./lib/browser/di.umd.min.js",
"import": "./lib/esm/index.js",
"default": "./lib/cjs/index.js"
"default": "./lib/esm/index.js"
}
},
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion packages/di/src/common/decorators/inject.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {catchAsyncError, catchError} from "@tsed/core";
import {catchAsyncError} from "@tsed/core";

import {DITest} from "../../node/index.js";
import {registerProvider} from "../registries/ProviderRegistry.js";
Expand Down
1 change: 0 additions & 1 deletion packages/di/tsconfig.spec.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@
],
"exclude": [
"node_modules",
"test",
"lib",
"benchmark",
"coverage"
Expand Down
2 changes: 1 addition & 1 deletion packages/engines/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
".": {
"types": "./lib/types/index.d.ts",
"import": "./lib/esm/index.js",
"default": "./lib/cjs/index.js"
"default": "./lib/esm/index.js"
}
},
"scripts": {
Expand Down
1 change: 0 additions & 1 deletion packages/engines/tsconfig.spec.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@
],
"exclude": [
"node_modules",
"test",
"lib",
"benchmark",
"coverage"
Expand Down
2 changes: 1 addition & 1 deletion packages/graphql/apollo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
".": {
"types": "./lib/types/index.d.ts",
"import": "./lib/esm/index.js",
"default": "./lib/cjs/index.js"
"default": "./lib/esm/index.js"
}
},
"scripts": {
Expand Down
1 change: 0 additions & 1 deletion packages/graphql/apollo/tsconfig.spec.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@
],
"exclude": [
"node_modules",
"test",
"lib",
"benchmark",
"coverage"
Expand Down
2 changes: 1 addition & 1 deletion packages/graphql/graphql-ws/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
".": {
"types": "./lib/types/index.d.ts",
"import": "./lib/esm/index.js",
"default": "./lib/cjs/index.js"
"default": "./lib/esm/index.js"
}
},
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion packages/graphql/typegraphql/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
".": {
"types": "./lib/types/index.d.ts",
"import": "./lib/esm/index.js",
"default": "./lib/cjs/index.js"
"default": "./lib/esm/index.js"
}
},
"scripts": {
Expand Down
7 changes: 4 additions & 3 deletions packages/graphql/typegraphql/test/app/Server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import "./graphql/index.js";
import "./protocols/GraphQLProtocol.js";
import "./services/RecipeService.js";
import "./services/UsersRepository.js";
import "@tsed/platform-log-request";

import * as fs from "node:fs";
import {join} from "node:path";
Expand All @@ -15,13 +16,14 @@ import {Configuration, Constant, Inject, PlatformApplication, PlatformContext} f
import {buildContext} from "graphql-passport";
import {resolve} from "path";

import {HelloController} from "./controllers/HelloController";
import {HelloController} from "./controllers/HelloController.js";
import {User} from "./graphql/auth/User.js";
import {AuthResolver} from "./graphql/index.js";
import {pubSub} from "./graphql/pubsub/pubsub.js";

const rootDir = import.meta.dirname; // automatically replaced by import.meta.dirname on build
const rootCert = join(rootDir, "../..");

@Configuration({
rootDir,
port: 8001,
Expand All @@ -31,8 +33,7 @@ const rootCert = join(rootDir, "../..");
cert: fs.readFileSync(join(rootCert, "selfsigned.crt"))
},
logger: {
level: "info",
logRequest: true
level: "info"
},
mount: {
"/rest": [HelloController]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {Controller, Get} from "@tsed/common";
import {Controller} from "@tsed/di";
import {Get} from "@tsed/schema";

@Controller("/")
export class HelloController {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {PassportContext} from "graphql-passport";
import {Arg, Ctx, Mutation, Query, Resolver} from "type-graphql";

import {User} from "./User";
import {User} from "./User.js";

export interface GQLContext extends PassportContext<User, {email: string; password: string}> {}

Expand Down
12 changes: 6 additions & 6 deletions packages/graphql/typegraphql/test/app/graphql/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export * from "./auth/AuthResolver";
export * from "./auth/User";
export * from "./datasources/MyDataSource";
export * from "./recipes/Recipe";
export * from "./recipes/RecipeNotFoundError";
export * from "./recipes/RecipeResolver";
export * from "./auth/AuthResolver.js";
export * from "./auth/User.js";
export * from "./datasources/MyDataSource.js";
export * from "./recipes/Recipe.js";
export * from "./recipes/RecipeNotFoundError.js";
export * from "./recipes/RecipeResolver.js";
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {createPubSub} from "@graphql-yoga/subscription";
import {registerProvider} from "@tsed/common";

import {RecipeNotification} from "../recipes/Recipe";
import {RecipeNotification} from "../recipes/Recipe.js";

export const pubSub = createPubSub<{
NOTIFICATIONS: [RecipeNotification];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ import {Inject} from "@tsed/di";
import {Arg, Mutation, Query, Root, Subscription} from "type-graphql";

import {ResolverController} from "../../../../src/index.js";
import {RecipeService} from "../../services/RecipeService";
import {RecipeService} from "../../services/RecipeService.js";
import {PubSubProvider} from "../pubsub/pubsub.js";
import {Recipe, RecipeNotification} from "./Recipe";
import {RecipeNotFoundError} from "./RecipeNotFoundError";
import {Recipe, RecipeNotification} from "./Recipe.js";
import {RecipeNotFoundError} from "./RecipeNotFoundError.js";

@ResolverController((_of) => Recipe)
export class RecipeResolver {
Expand Down
2 changes: 1 addition & 1 deletion packages/graphql/typegraphql/test/app/index.express.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {$log} from "@tsed/common";
import {PlatformExpress} from "@tsed/platform-express";

import {Server} from "./Server";
import {Server} from "./Server.js";

if (process.env.NODE_ENV !== "test") {
async function bootstrap() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {Unauthorized} from "@tsed/exceptions";
import {Arg, OnVerify, Protocol} from "@tsed/passport";
import {GraphQLLocalStrategy} from "graphql-passport";

import {UsersRepository} from "../services/UsersRepository";
import {UsersRepository} from "../services/UsersRepository.js";

@Protocol<any>({
name: "graphql-local",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {Service} from "@tsed/common";

import {Recipe} from "../graphql/recipes/Recipe";
import {Recipe} from "../graphql/recipes/Recipe.js";

@Service()
export class RecipeService {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {Adapter, InjectAdapter} from "@tsed/adapters";
import {Injectable} from "@tsed/di";
import {deserialize} from "@tsed/json-mapper";

import {User} from "../graphql/auth/User";
import {User} from "../graphql/auth/User.js";

@Injectable()
export class UsersRepository {
Expand Down
6 changes: 3 additions & 3 deletions packages/graphql/typegraphql/test/typegraphql.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import "@tsed/graphql-ws";
import {ApolloService} from "@tsed/apollo";
import {PlatformTest, runInContext} from "@tsed/common";
import {PlatformExpress} from "@tsed/platform-express";
import gql from "graphql-tag";
import {gql} from "graphql-tag";

import {Server} from "./app/Server.js";

Expand Down Expand Up @@ -41,7 +41,7 @@ describe("TypeGraphQL", () => {
const server = PlatformTest.get<ApolloService>(ApolloService);

const response = await runInContext($ctx, () => {
return server.get().executeOperation({
return server.get()!.executeOperation({
query: GET_RECIPES,
variables: {}
});
Expand Down Expand Up @@ -69,7 +69,7 @@ describe("TypeGraphQL", () => {
const server = PlatformTest.get<ApolloService>(ApolloService);

const response = await runInContext($ctx, () => {
return server.get().executeOperation({
return server.get()!.executeOperation({
query: ADD_RECIPE,
variables: {
title: "title",
Expand Down
7 changes: 6 additions & 1 deletion packages/graphql/typegraphql/tsconfig.spec.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,12 @@
],
"@tsed/platform-koa": [
"../../platform/platform-koa/src/index.ts"
],
"@tsed/adapters": [
"../../orm/adapters/src/index.ts"
],
"@tsed/passport": [
"../../security/passport/src/index.ts"
]
},
"types": [
Expand All @@ -83,7 +89,6 @@
],
"exclude": [
"node_modules",
"test",
"lib",
"benchmark",
"coverage"
Expand Down
2 changes: 1 addition & 1 deletion packages/orm/adapters-redis/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
".": {
"types": "./lib/types/index.d.ts",
"import": "./lib/esm/index.js",
"default": "./lib/cjs/index.js"
"default": "./lib/esm/index.js"
}
},
"scripts": {
Expand Down
1 change: 0 additions & 1 deletion packages/orm/adapters-redis/tsconfig.spec.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@
],
"exclude": [
"node_modules",
"test",
"lib",
"benchmark",
"coverage"
Expand Down
2 changes: 1 addition & 1 deletion packages/orm/adapters/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
".": {
"types": "./lib/types/index.d.ts",
"import": "./lib/esm/index.js",
"default": "./lib/cjs/index.js"
"default": "./lib/esm/index.js"
}
},
"scripts": {
Expand Down
1 change: 0 additions & 1 deletion packages/orm/adapters/tsconfig.spec.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@
],
"exclude": [
"node_modules",
"test",
"lib",
"benchmark",
"coverage"
Expand Down
2 changes: 1 addition & 1 deletion packages/orm/ioredis/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
".": {
"types": "./lib/types/index.d.ts",
"import": "./lib/esm/index.js",
"default": "./lib/cjs/index.js"
"default": "./lib/esm/index.js"
}
},
"scripts": {
Expand Down
1 change: 0 additions & 1 deletion packages/orm/ioredis/tsconfig.spec.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@
],
"exclude": [
"node_modules",
"test",
"lib",
"benchmark",
"coverage"
Expand Down
2 changes: 1 addition & 1 deletion packages/orm/mikro-orm/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
".": {
"types": "./lib/types/index.d.ts",
"import": "./lib/esm/index.js",
"default": "./lib/cjs/index.js"
"default": "./lib/esm/index.js"
}
},
"scripts": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {Post} from "@tsed/common";
import {Controller, DITest} from "@tsed/di";
import {Post} from "@tsed/schema";
import {afterEach, beforeEach} from "vitest";

import {TransactionalInterceptor} from "../interceptors/TransactionalInterceptor.js";
Expand Down
4 changes: 2 additions & 2 deletions packages/orm/mikro-orm/test/helpers/Server.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import "@tsed/platform-express";
import "@tsed/platform-log-request";
import "./services/ManagedEventSubscriber.js";

import {PlatformApplication} from "@tsed/common";
Expand All @@ -16,8 +17,7 @@ const rootDir = import.meta.dirname; // automatically replaced by import.meta.di
httpsPort: false,
disableComponentScan: true,
logger: {
level: "info",
logRequest: true
level: "info"
}
})
export class Server {
Expand Down
1 change: 0 additions & 1 deletion packages/orm/mikro-orm/tsconfig.spec.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@
],
"exclude": [
"node_modules",
"test",
"lib",
"benchmark",
"coverage"
Expand Down
2 changes: 1 addition & 1 deletion packages/orm/mongoose/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
".": {
"types": "./lib/types/index.d.ts",
"import": "./lib/esm/index.js",
"default": "./lib/cjs/index.js"
"default": "./lib/esm/index.js"
}
},
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion packages/orm/mongoose/test/circularRef.integration.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {Inject} from "@tsed/di";
import {getJsonSchema} from "@tsed/schema";
import {TestContainersMongo} from "@tsed/testcontainers-mongo";

import {MongooseModel} from "..";
import {MongooseModel} from "../src/index.js";
import {TestContract} from "./helpers/models/Contract.js";
import {TestCustomer} from "./helpers/models/Customer.js";
import {SelfUser} from "./helpers/models/User.js";
Expand Down
2 changes: 1 addition & 1 deletion packages/orm/mongoose/test/enums.integration.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {CollectionOf, Default, Description, Enum, enums, getJsonSchema, MaxLength, MinLength, Required} from "@tsed/schema";
import {TestContainersMongo} from "@tsed/testcontainers-mongo";

import {Model} from "..";
import {Model} from "../src/index.js";

export enum ComponentStatuses {
UNDER_MAINTENANCE = "UNDER_MAINTENANCE",
Expand Down
Loading
Loading