Skip to content

Commit

Permalink
fix(common): remove export schema decorator from @tsed/common
Browse files Browse the repository at this point in the history
BREAKING CHANGE: AcceptMime, All, Delete, Get, Head, Location, Options, Patch, Post, Put, Redirect, View must be imported from `@tsed/schema`.
  • Loading branch information
Romakita committed Oct 2, 2024
1 parent 67ef878 commit b8143f5
Show file tree
Hide file tree
Showing 231 changed files with 334 additions and 363 deletions.
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
2 changes: 1 addition & 1 deletion packages/graphql/typegraphql/test/app/Server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ 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";
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
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
10 changes: 6 additions & 4 deletions packages/orm/mongoose/test/ref-array.integration.spec.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import {faker} from "@faker-js/faker";
import {BodyParams, Controller, Get, Inject, PlatformTest, Post, QueryParams} from "@tsed/common";
import {BodyParams, PlatformTest, QueryParams} from "@tsed/common";
import {Controller, Inject} from "@tsed/di";
import {deserialize, serialize} from "@tsed/json-mapper";
import {PlatformExpress} from "@tsed/platform-express";
import {Get, Post} from "@tsed/schema";
import {TestContainersMongo} from "@tsed/testcontainers-mongo";
import SuperTest from "supertest";

import {MongooseModel} from "..";
import {MongooseModel} from "../src/index.js";
import {TestProfile2, TestUser} from "./helpers/models/User.js";
import {Server} from "./helpers/Server.js";

Expand Down Expand Up @@ -114,12 +116,12 @@ describe("Mongoose", () => {
expect(result).toBeInstanceOf(TestUser);
expect(typeof result._id).toBe("string");
expect(result.alwaysIgnored).toBe("hello ignore");
expect(Date.parse(result.created)).not.toBeNaN();
expect(Date.parse(result.created as unknown as string)).not.toBeNaN();
expect(result.email).toBe(currentUser.email);
expect(result.password).toBe(currentUser.password);
expect(result.post).toBe("hello post");
expect(result.pre).toBe("hello pre");
expect(Date.parse(result.updated)).not.toBeNaN();
expect(Date.parse(result.updated as unknown as string)).not.toBeNaN();
});

it("should transform mongoose instance to object", async () => {
Expand Down
Loading

0 comments on commit b8143f5

Please sign in to comment.