npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@leancodepl/contractsgenerator-typescript-plugin-contracts

v1.1.3

Published

Plugin for generating TypeScript types of contracts.

Readme

@leancodepl/contractsgenerator-typescript-plugin-contracts

Plugin for generating TypeScript types of contracts.

Config

  • input - configuration passed to Contracts Generator Server. All paths are relative to directory from your current CWD. Unless you are using JavaScript files - in that case you can use __dirname and path.join/path.resolve for paths relative to configuration file.

    • base - base path for your backend code source. If you provide that then all the other properties are relative to this directory.

    Then you can provide one of:

    • file
      or
    • include and exclude - single globs or arrays of globs to match specific .cs files
      or
    • project - can be multiple

    For details on these options please refer to Contracts Generator Server.

  • customTypes - dictionary of custom types configuration where keys are the name of Known Type and value is custom type name. Valid custom types include: String, Guid, Uri, Boolean, UInt8, Int8, Int16, UInt16, Int32, UInt32, Int64, UInt64, Float32, Float64, DateOnly, TimeOnly, DateTimeOffset, TimeSpan.

  • nameTransform - function (fullName: string) => string which allows you to transform full name of the DTO (like LeanCode.Core.Contracts.User.UserDetailsDTO). This is especially useful when you want to map namespaces, for e.g. when you have conflicts, want to remove parts of the namespace (LeanCode.Core.User.UserDetailsDTO instead of LeanCode.Core.Contracts.User.UserDetailsDTO).

Example

Config

module.exports = {
  generates: {
    "output.ts": {
      plugins: ["contracts"],
    },
  },
  config: {
    input: {
      base: "../../../backend/src",
      project: ["Core/Project.Core.Contracts/Project.Core.Contracts.csproj"],
      nameTransform: nameWithNamespace => nameWithNamespace.split(".").at(-1),
    },
  },
};

Output

/**
 * @attribute LeanCode.Contracts.Security.AuthorizeWhenHasAnyOfAttribute
 */
export interface Clients {
}
export namespace Clients {
    export const AdminApp = "admin_app";
    export const ClientApp = "client_app";
}
export interface KnownClaims {
}
export namespace KnownClaims {
    export const UserId = "sub";
    export const Role = "role";
}
export interface Roles {
}
export namespace Roles {
    export const User = "user";
    export const Admin = "admin";
}
export interface AddLeagueManager extends Command {
    TenantId: string;
    TenantName?: string | null;
    TenantLogoUri?: string | null;
    UserName: string;
    Password: string;
}
export namespace AddLeagueManager {
    export const ErrorCodes = {
        TenantNotFoundOrAlreadyExists: 1,
        TenantNameTooLong: 2,
        TenantLogoUriTooLong: 3,
        InvalidUserName: 4,
        InvalidPassword: 5,
        UserAlreadyExists: 6
    } as const;
    export type ErrorCodes = typeof ErrorCodes;
}