tsed

Ts.ED is a Node.js and TypeScript framework on top of Express to write your application with TypeScript (or ES6). It provides a lot of decorators and guideline to make your code more readable and less error-prone. ⭐️ Star to support our work!

MIT License

Downloads
1.8M
Stars
2.7K
Committers
162
tsed - v6.66.0

Published by Romakita about 3 years ago

6.66.0 (2021-09-03)

Features

  • swagger: Add swagger.pathPatterns options to split documentation (6703659), closes #1508
tsed - v6.65.0

Published by Romakita about 3 years ago

6.65.0 (2021-09-03)

Features

  • koa: Add koa-qs to support extended parser mode and support deep object on qs (03e6862)
  • schema: Add deepObject style on query parameter for OS3 (a511823)

Deep object on query

With OpenAPI 3, it's possible to describe and use a deepObject style as Query params.
It means, a consumer can call your endpoint with the following url:

/users?id[role]=admin&id[firstName]=Alex

Ts.ED will determine automatically the appropriate style parameter based on the given User model.
Here is an example with a DeepQueryObject model:

class DeepQueryObject {
  @Property()
  path: string;

  @Property()
  condition: string;

  @Property()
  value: string;
}

@Path("/test")
class TestDeepObjectCtrl {
  @OperationPath("GET", "/")
  async get(@QueryParams("s") q: DeepQueryObject) {

  }
}

The url to be called will be:

/test?s[path]=title&s[condition]=eq&s[value]=tsed

And the generated swagger will be:

{
  "components": {
    "schemas": {
      "DeepQueryObject": {
        "properties": {
          "condition": {
            "type": "string"
          },
          "path": {
            "type": "string"
          },
          "value": {
            "type": "string"
          }
        },
        "type": "object"
      }
    }
  },
  "paths": {
    "/test": {
      "get": {
        "operationId": "testDeepObjectCtrlGet",
        "parameters": [
          {
            "in": "query",
            "name": "s",
            "required": false,
            "style": "deepObject",
            "schema": {
              "$ref": "#/components/schemas/DeepQueryObject"
            }
          }
        ]
      }
    }
  }
}

Ts.ED support also Generics Deep object style!

class FindQuery {
  @Property()
  tableColumnNameA?: number;

  @Property()
  tableColumnNameB?: number;
}

@Generics("T")
class PaginationQuery<T> {
  @Minimum(0)
  @Default(0)
  offset?: number;

  @Minimum(1)
  @Maximum(1000)
  @Default(50)
  limit?: number;

  @Property("T")
  where?: T;
}

@Path("/test")
class TestDeepObjectCtrl {
  @OperationPath("GET", "/")
  async get(@QueryParams() @GenericOf(FindQuery) q: PaginationQuery<FindQuery>) {}
}

/!\ Important: This feature is only available for OpenAPI 3.

tsed - v6.64.3

Published by Romakita about 3 years ago

6.64.3 (2021-09-02)

Bug Fixes

  • swagger: Lazy load swagger spec on $onReady hook (#1504) (00046b2)
tsed - v6.64.2

Published by Romakita about 3 years ago

6.64.2 (2021-09-01)

Bug Fixes

  • swagger: Add SwaggerModule.generateSpecFiles() (eb28fed)
tsed - v6.64.1

Published by Romakita about 3 years ago

6.64.1 (2021-08-27)

Bug Fixes

  • schema: Add missing export for the Partial decorator (c42e658), closes #1498
  • swagger: Fix performance issue on SwaggerModule (b2f5bd4), closes #1496
tsed - v6.64.0

Published by Romakita about 3 years ago

6.64.0 (2021-08-26)

Features

  • Add @tsed/perf package to log perf (db8d245)
tsed - v6.63.2

Published by Romakita about 3 years ago

6.63.2 (2021-08-22)

Bug Fixes

  • oidc-provider: mount oidc-provider with appropriate middleware and distinguish between express and koa (96c54b5)
tsed - v6.63.1

Published by Romakita about 3 years ago

6.63.1 (2021-08-22)

Bug Fixes

  • schema: Avoid circular ref (cb39be5)
tsed - v6.63.0

Published by Romakita about 3 years ago

6.63.0 (2021-08-22)

Features

  • terminus: Add terminus package (25eb3c1)
tsed - v6.62.4

Published by Romakita about 3 years ago

6.62.4 (2021-08-18)

Bug Fixes

  • passport: Allow boolean option to userInfoModel to disable json-mapper on session serialization/deserialization (dbd2945)
tsed - v6.62.3

Published by Romakita about 3 years ago

6.62.3 (2021-08-12)

Bug Fixes

  • schema,json-mapper: Fix Property decorator issue with Nullable (f105740), closes #1480
tsed - v6.62.2

Published by Romakita about 3 years ago

6.62.2 (2021-08-07)

Bug Fixes

  • common: Fix groups issues (eadcc8b)
tsed - v6.62.1

Published by Romakita about 3 years ago

6.62.1 (2021-08-04)

Bug Fixes

  • json-mapper: Add missing exports for AfterDeserialize/BeforeDeserialize decorators (324b533)
tsed - v6.62.0

Published by Romakita about 3 years ago

6.62.0 (2021-07-30)

Features

  • core: Fix deepMerge function when key contains a dot (98ab1bb), closes #1471
tsed - v6.61.1

Published by Romakita about 3 years ago

6.61.1 (2021-07-26)

Bug Fixes

  • schema: Revert microbundle on @tsed/schema (1bec108), closes #1473
tsed - v6.61.0

Published by Romakita about 3 years ago

6.61.0 (2021-07-26)

Features

  • schema-formio: Add new package @tsed/formio-schema to convert Ts.ED schema to a Formio schema (3b23d8c)
tsed - v6.60.2

Published by Romakita about 3 years ago

6.60.2 (2021-07-24)

Bug Fixes

  • objection: Fix model serialization (1786a05)
  • schema: Fix in: cookies to in: cookie (48225ac), closes #1469
tsed - v6.60.1

Published by Romakita over 3 years ago

6.60.1 (2021-07-20)

Bug Fixes

tsed - v6.60.0

Published by Romakita over 3 years ago

6.60.0 (2021-07-19)

Features

  • mongoose: Add decorator VersionKey to expose versioning capabilities (#1465) (92730e5)
tsed - v6.59.9

Published by Romakita over 3 years ago

6.59.9 (2021-07-17)

Bug Fixes

  • common: Fix issue on children controllers building (9f737e6)
Package Rankings
Top 1.14% on Npmjs.org
Top 6.72% on Proxy.golang.org
Badges
Extracted from project README
Build & Release PR Welcome npm version semantic-release code style: prettier github opencollective