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

Rc #2429

Merged
merged 32 commits into from
Sep 17, 2023
Merged

Rc #2429

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
c38adf0
refactor: move toJSON method to operationMapper.ts
Romakita Jul 29, 2023
701c801
feat(json-mapper): create JsonMapperCompiler
Romakita Aug 4, 2023
edd843d
feat(core): add method on core level
Romakita Aug 9, 2023
5d7c35b
feat(json-mapper): support all features on serialize method
Romakita Aug 10, 2023
63a86b6
fix(schema): deprecate Ignore decorator
Romakita Aug 10, 2023
edb7624
fix(core): update coverage
Romakita Aug 11, 2023
d7d5c22
fix(json-schema): fix null value no nested object and fix null date m…
Romakita Aug 11, 2023
43bc5c0
Github CI build: __run_2 v7.35.0-beta.1 [ci skip]
semantic-release-bot Aug 11, 2023
e3768c0
fix(json-schema): remove console in code
Romakita Aug 18, 2023
dda69c8
fix(json-schema): fix mongoose usecases
Romakita Aug 20, 2023
f847be7
Github CI build: __run_2 v7.35.0-beta.2 [ci skip]
semantic-release-bot Aug 20, 2023
059de4a
fix(json-schema): fix mongoose usecases
Romakita Aug 20, 2023
23ba931
Github CI build: __run_2 v7.35.0-beta.3 [ci skip]
semantic-release-bot Aug 31, 2023
b99caf0
chore: clean code
Romakita Sep 6, 2023
a6322b7
chore: rollback typescript version on workspace (support TS v5 are ma…
Romakita Sep 6, 2023
c8f4b21
chore: rollback typescript version on workspace (support TS v5 are ma…
Romakita Sep 6, 2023
17a9354
fix(json-mapper): fix serialize compilation method
Romakita Sep 6, 2023
095e774
feat(json-mapper): implement deserialize compilation method
Romakita Sep 6, 2023
40bfbe1
Github CI build: __run_2 v7.35.0-beta.4 [ci skip]
semantic-release-bot Sep 6, 2023
6d9af54
Merge remote-tracking branch 'origin/production' into beta
Romakita Sep 6, 2023
3a0de5e
fix(di): fix @Inject when the decorator is used to inject many providers
Romakita Sep 6, 2023
75ca962
Github CI build: __run_2 v7.35.0-rc.1 [ci skip]
semantic-release-bot Sep 7, 2023
4548ab4
Merge remote-tracking branch 'origin/production' into rc
Romakita Sep 12, 2023
88f1828
Github CI build: __run_2 v7.36.0-rc.1 [ci skip]
semantic-release-bot Sep 12, 2023
c50c0dc
fix(prisma): update readme
Romakita Sep 12, 2023
056afd9
fix(json-mapper): fix additionalProperties regression on property dec…
Romakita Sep 12, 2023
89c58f0
Github CI build: __run_2 v7.36.0-rc.2 [ci skip]
semantic-release-bot Sep 12, 2023
4d4133f
fix(json-mapper): fix onSerialize/onDeserialize option
Romakita Sep 13, 2023
e9811c5
Github CI build: __run_2 v7.36.0-rc.3 [ci skip]
semantic-release-bot Sep 13, 2023
bb42a30
fix(json-mapper): fix deserialize method when the input is an Array o…
Romakita Sep 13, 2023
64a1701
Github CI build: __run_2 v7.36.0-rc.4 [ci skip]
semantic-release-bot Sep 13, 2023
314237a
fix(json-mapper): fix potential reference issue on serialize method
Romakita Sep 14, 2023
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: 5 additions & 1 deletion docs/docs/json-mapper.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,11 @@ It means, if you missed decorating one or more properties on your model, these p

:::

## Ignore properties
## Ignore properties (deprecated)

::: warn deprecated
This decorator is deprecated. Use @@Groups@@ decorator instead of.
:::

### Usage

Expand Down
2 changes: 1 addition & 1 deletion docs/getting-started/snippets/base/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,6 @@
"supertest": "6.0.0",
"ts-node": "9.0.0",
"tslint": "6.1.3",
"typescript": "5.0.4"
"typescript": "4.9.5"
}
}
3 changes: 2 additions & 1 deletion docs/tutorials/prisma-client.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,10 @@ npm i @tsed/prisma @prisma/client
Or use Ts.ED CLI if you starting a new project:

```
npm install -g
npm install -g
tsed init .
```

Then select `Database` > `Prisma`. The CLI will generate the project with prisma schema configuration.

## Configuration
Expand Down
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"packages/third-parties/*",
"docs"
],
"version": "7.35.1",
"version": "7.36.0-rc.4",
"command": {
"bootstrap": {
"npmClientArgs": [
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@tsed/root",
"version": "7.35.1",
"version": "7.36.0-rc.4",
"description": "A TypeScript Framework on top of Express",
"private": true,
"author": "Romain Lenzotti",
Expand Down Expand Up @@ -169,7 +169,7 @@
"ts-loader": "^9.4.2",
"ts-node": "10.8.1",
"tslib": "2.5.0",
"typescript": "5.0.4",
"typescript": "4.9.5",
"webpack": "^5.75.0",
"webpack-cli": "^5.0.1",
"webpack-dev-server": "^4.11.1",
Expand Down
8 changes: 4 additions & 4 deletions packages/core/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ module.exports = {
...require("@tsed/jest-config"),
coverageThreshold: {
global: {
statements: 98.85,
branches: 94.4,
functions: 95.63,
lines: 98.85
statements: 98.99,
branches: 94.93,
functions: 95.81,
lines: 98.99
}
}
};
6 changes: 3 additions & 3 deletions packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@tsed/core",
"version": "7.35.1",
"version": "7.36.0-rc.4",
"description": "Core module for Ts.ED Framework",
"private": false,
"source": "./src/index.ts",
Expand Down Expand Up @@ -29,8 +29,8 @@
"tslib": "2.5.0"
},
"devDependencies": {
"@tsed/eslint": "7.35.1",
"@tsed/typescript": "7.35.1",
"@tsed/eslint": "7.36.0-rc.4",
"@tsed/typescript": "7.36.0-rc.4",
"eslint": "^8.12.0"
},
"peerDependencies": {}
Expand Down
3 changes: 3 additions & 0 deletions packages/core/src/domain/Hooks.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
export class Hooks {
#listeners: Record<string, Function[]> = {};

has(event: string) {
return !!this.#listeners[event];
}
/**
* Listen a hook event
* @param event
Expand Down
4 changes: 4 additions & 0 deletions packages/core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export * from "./interfaces/DecoratorParameters";
export * from "./interfaces/MetadataTypes";
export * from "./interfaces/ValueOf";
export * from "./utils/catchError";
export * from "./utils/getRandomId";
export * from "./utils/proxyDelegation";
export * from "./utils/uniq";
export * from "./utils/decorators/decorateMethodsOf";
Expand All @@ -48,6 +49,7 @@ export * from "./utils/objects/getClassOrSymbol";
export * from "./utils/objects/getConstructorArgNames";
export * from "./utils/objects/getEnumerableKeys";
export * from "./utils/objects/getValue";
export * from "./utils/objects/hasJsonMethod";
export * from "./utils/objects/isArray";
export * from "./utils/objects/isArrowFn";
export * from "./utils/objects/isBoolean";
Expand All @@ -59,6 +61,8 @@ export * from "./utils/objects/isEmpty";
export * from "./utils/objects/isEnumerable";
export * from "./utils/objects/isFunction";
export * from "./utils/objects/isInheritedFrom";
export * from "./utils/objects/isMomentObject";
export * from "./utils/objects/isMongooseObject";
export * from "./utils/objects/isNil";
export * from "./utils/objects/isNumber";
export * from "./utils/objects/isObject";
Expand Down
7 changes: 7 additions & 0 deletions packages/core/src/utils/getRandomId.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import {getRandomId} from "./getRandomId";

describe("getRandomId", () => {
it("should return random id", () => {
expect(getRandomId()).not.toEqual(getRandomId());
});
});
3 changes: 3 additions & 0 deletions packages/core/src/utils/getRandomId.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export function getRandomId() {
return `e${Math.random().toString(36).substring(7)}`;
}
16 changes: 16 additions & 0 deletions packages/core/src/utils/objects/descriptorOf.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import {isMethodDescriptor} from "./descriptorOf";

describe("isMethodDescriptor()", () => {
it("should return true", () => {
class Test {
test() {}
}
expect(isMethodDescriptor(Test, "test")).toBeTruthy();
});
it("should return false", () => {
class Test {
test: string;
}
expect(isMethodDescriptor(Test, "test")).toBeFalsy();
});
});
11 changes: 11 additions & 0 deletions packages/core/src/utils/objects/hasJsonMethod.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import {hasJsonMethod} from "./hasJsonMethod";

describe("hasJsonMethod", () => {
it("should return true if object has toJSON method", () => {
expect(hasJsonMethod({toJSON: () => {}})).toEqual(true);
});

it("should return false if object hasn't toJSON method", () => {
expect(hasJsonMethod({})).toEqual(false);
});
});
3 changes: 3 additions & 0 deletions packages/core/src/utils/objects/hasJsonMethod.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export function hasJsonMethod(obj: any) {
return obj && typeof obj.toJSON === "function";
}
12 changes: 12 additions & 0 deletions packages/core/src/utils/objects/isBuffer.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import {isBuffer} from "./isBuffer";

describe("isBuffer", () => {
it("should return true", () => {
expect(isBuffer(Buffer.from(""))).toBeTruthy();
expect(isBuffer(Buffer)).toBeTruthy();
});
it("should return false", () => {
expect(isBuffer({})).toBeFalsy();
expect(isBuffer(undefined)).toBeFalsy();
});
});
7 changes: 1 addition & 6 deletions packages/core/src/utils/objects/isBuffer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,5 @@
* @returns {boolean}
*/
export function isBuffer(target: any): target is Buffer {
// istanbul ignore else
if (typeof Buffer !== "undefined") {
return target === Buffer || target instanceof Buffer;
}
// istanbul ignore next
return false;
return !!(target && (target === Buffer || target instanceof Buffer));
}
16 changes: 16 additions & 0 deletions packages/core/src/utils/objects/isMomentObject.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import {isMomentObject} from "./isMomentObject";

describe("isMomentObject", () => {
it("should return true if object is moment object", () => {
expect(
isMomentObject({
_isAMomentObject: true
})
).toEqual(true);
});

it("should return false if object is not moment object", () => {
expect(isMomentObject({})).toEqual(false);
expect(isMomentObject(null)).toEqual(false);
});
});
3 changes: 3 additions & 0 deletions packages/core/src/utils/objects/isMomentObject.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export function isMomentObject(obj: any) {
return !!(obj && obj?._isAMomentObject);
}
22 changes: 22 additions & 0 deletions packages/core/src/utils/objects/isMongooseObject.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import {isMongooseObject} from "./isMongooseObject";

describe("isMongooseObject", () => {
it("should return true if object is mongoose object", () => {
expect(
isMongooseObject({
toJSON: () => {},
$isMongooseModelPrototype: true
})
).toEqual(true);
expect(isMongooseObject({_bsontype: true})).toEqual(true);
});
it("should return false if object is not mongoose object", () => {
expect(
isMongooseObject({
toJSON: () => {}
})
).toEqual(false);
expect(isMongooseObject({})).toEqual(false);
expect(isMongooseObject(null)).toEqual(false);
});
});
9 changes: 9 additions & 0 deletions packages/core/src/utils/objects/isMongooseObject.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import {hasJsonMethod} from "./hasJsonMethod";

export function isObjectID(obj: any) {
return obj && obj._bsontype;
}

export function isMongooseObject(obj: any) {
return !!((hasJsonMethod(obj) && obj.$isMongooseModelPrototype) || isObjectID(obj));
}
18 changes: 18 additions & 0 deletions packages/core/src/utils/objects/toStringConstrutor.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import {toStringConstructor} from "./toStringConstructor";

describe("toStringConstructor", () => {
it("should return the constructor signature (empty)", () => {
class Test {}

expect(toStringConstructor(Test)).toBe("constructor()");
});
it("should return the constructor signature", () => {
class Test {
constructor(test: string) {
console.log("test");
}
}

expect(toStringConstructor(Test)).toBe("constructor(test)");
});
});
14 changes: 7 additions & 7 deletions packages/di/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@tsed/di",
"version": "7.35.1",
"version": "7.36.0-rc.4",
"description": "DI module for Ts.ED Framework",
"private": false,
"source": "./src/index.ts",
Expand Down Expand Up @@ -28,17 +28,17 @@
"tslib": "2.5.0"
},
"devDependencies": {
"@tsed/core": "7.35.1",
"@tsed/eslint": "7.35.1",
"@tsed/core": "7.36.0-rc.4",
"@tsed/eslint": "7.36.0-rc.4",
"@tsed/logger": ">=6.2.2",
"@tsed/schema": "7.35.1",
"@tsed/typescript": "7.35.1",
"@tsed/schema": "7.36.0-rc.4",
"@tsed/typescript": "7.36.0-rc.4",
"eslint": "^8.12.0"
},
"peerDependencies": {
"@tsed/core": "^7.35.1",
"@tsed/core": "^7.36.0-rc.4",
"@tsed/logger": ">=6.2.2",
"@tsed/schema": "^7.35.1"
"@tsed/schema": "^7.36.0-rc.4"
},
"peerDependenciesMeta": {
"@tsed/core": {
Expand Down
6 changes: 3 additions & 3 deletions packages/engines/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@tsed/engines",
"version": "7.35.1",
"version": "7.36.0-rc.4",
"description": "Template engines library. Provide an API to adding custom engines from decorators.",
"source": "./src/index.ts",
"main": "./lib/cjs/index.js",
Expand All @@ -27,8 +27,8 @@
"tslib": "2.5.0"
},
"devDependencies": {
"@tsed/eslint": "7.35.1",
"@tsed/typescript": "7.35.1",
"@tsed/eslint": "7.36.0-rc.4",
"@tsed/typescript": "7.36.0-rc.4",
"@types/fs-extra": "^9.0.13",
"@types/semver": "^7.3.9",
"arc-templates": "^0.5.3",
Expand Down
18 changes: 9 additions & 9 deletions packages/graphql/apollo/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@tsed/apollo",
"version": "7.35.1",
"version": "7.36.0-rc.4",
"description": "Apollo package for Ts.ED framework",
"source": "./src/index.ts",
"main": "./lib/cjs/index.js",
Expand All @@ -25,12 +25,12 @@
},
"private": false,
"devDependencies": {
"@tsed/common": "7.35.1",
"@tsed/core": "7.35.1",
"@tsed/di": "7.35.1",
"@tsed/eslint": "7.35.1",
"@tsed/common": "7.36.0-rc.4",
"@tsed/core": "7.36.0-rc.4",
"@tsed/di": "7.36.0-rc.4",
"@tsed/eslint": "7.36.0-rc.4",
"@tsed/logger": ">=6.2.2",
"@tsed/typescript": "7.35.1",
"@tsed/typescript": "7.36.0-rc.4",
"@types/graphql": "14.5.0",
"apollo-datasource": "^3.2.0",
"apollo-datasource-rest": "^3.3.0",
Expand All @@ -42,9 +42,9 @@
"graphql": "15.7.2"
},
"peerDependencies": {
"@tsed/common": "^7.35.1",
"@tsed/core": "^7.35.1",
"@tsed/di": "^7.35.1",
"@tsed/common": "^7.36.0-rc.4",
"@tsed/core": "^7.36.0-rc.4",
"@tsed/di": "^7.36.0-rc.4",
"@tsed/logger": ">=6.2.2",
"apollo-datasource": ">=3.0.0",
"apollo-datasource-rest": ">=3.0.0",
Expand Down
12 changes: 6 additions & 6 deletions packages/graphql/typegraphql/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@tsed/typegraphql",
"version": "7.35.1",
"version": "7.36.0-rc.4",
"description": "TypeGraphQL package for Ts.ED framework, based on Apollo-server-core and Type-graphql",
"private": false,
"source": "./src/index.ts",
Expand All @@ -24,14 +24,14 @@
"lint:fix": "eslint '**/*.{ts,js}' --fix"
},
"dependencies": {
"@tsed/apollo": "7.35.1",
"@tsed/apollo": "7.36.0-rc.4",
"tslib": "2.5.0"
},
"devDependencies": {
"@tsed/common": "7.35.1",
"@tsed/core": "7.35.1",
"@tsed/eslint": "7.35.1",
"@tsed/typescript": "7.35.1",
"@tsed/common": "7.36.0-rc.4",
"@tsed/core": "7.36.0-rc.4",
"@tsed/eslint": "7.36.0-rc.4",
"@tsed/typescript": "7.36.0-rc.4",
"@types/graphql": "^14.5.0",
"class-validator": "~0.14.0",
"eslint": "^8.12.0",
Expand Down
Loading
Loading