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 🙏

© 2024 – Pkg Stats / Ryan Hefner

autorest-typescript

v6.0.0-beta.16

Published

[Autorest](https://github.com/Azure/autorest/blob/master/docs/readme.md) is a suite of tools to automatically generate SDKs for cloud services. This project provides an autorest extension that generates SDKs in TypeScript.

Downloads

8

Readme

TypeScript Plugin for Autorest

Autorest is a suite of tools to automatically generate SDKs for cloud services. This project provides an autorest extension that generates SDKs in TypeScript.

Note: This project, @autorest/typescript is the latest version of the TS/JS SDK generator and is currently in preview. The earlier stable version of the SDK generator @microsoft.azure/autorest.typescript is available in the v4x branch of the Azure/autorest.typescript repository.

Auto-generate your package in TypeScript using Autorest

It is easy to generate an SDK once you have a swagger specification file.

  • You will need first to install Autorest
npm install -g autorest
  • You can then generate the SDK as follows:
autorest --typescript <path to the swagger file>
  • You will likely need to specify extra flags to control the behavior of the generation, and these flags are listed in the next section.

Options

In addition to the list of Autorest flags, you can further control the behavior of the typescript generator with the following flags:

| Flag | Description | | ------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | --use-core-v2 | Uses azure core v2 and it is enabled by default. Please set it to false if you need to regenerate a package that uses core-http and you do not want to do the migration to core v2 in that regeneration. For differences between v1 and v2, please refer to https://github.com/Azure/azure-sdk-for-js/blob/master/sdk/core/README.md | | --hide-client | Hides the client class from docs. This is typically useful when the you will write a convenience layer on top of the generated client | | --ignore-nullable-on-optional | If an optional property is also marked as nullable, it will be treated as just optional | | --generate-metadata | Generates meta files such as readme, license, package.json, etc. Typically, you need to specify this flag in your first generation only | | --tracing-info | Controls specification of meta info attached to requests for tracing purposes | | --disable-async-iterators | Does not generate async iterators needed for paging operations | | --allow-insecure-connection | Allow generated clients to make requests to HTTP endpoints |

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.microsoft.com.

When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

Autorest Typescript Plugin Configuration

version: 3.6.6
use-extension:
  "@autorest/modelerfour": "4.21.4"

modelerfour:
  # this runs a pre-namer step to clean up names
  prenamer: true
  # this will flatten modelers marked with 'x-ms-client-flatten'
  flatten-models: true
  # this will flatten parameters marked with 'x-ms-client-flatten'
  flatten-payloads: true
  # this will make the content-type parameter always specified
  always-create-content-type-parameter: true
  # enables parameter grouping via x-ms-parameter-grouping
  group-parameters: true
  # Enable older inconsistent behavior that an enum with a single value would become a constant by default.
  seal-single-value-enum-by-default: true

typescript-scope/emitter:
  input-artifact: typescript-files

output-artifact: typescript-files
pipeline:
  typescript: # <- name of plugin
    input: modelerfour/identity
    output-artifact: typescript-files

  typescript/emitter:
    input: typescript
    scope: typescript-scope/emitter
use-extension:
  "@autorest/testmodeler": "1.0.4"

try-require:
    - ./readme.test.md
    - ./readme.tests.md

testmodeler:
  split-parents-value: false

include-x-ms-examples-original-file: true
modelerfour:
  include-x-ms-examples-original-file: true

pipeline:
  test-modeler:
    input: modelerfour/identity
    # scope : output-scope
  test-modeler/identity:
    input: test-modeler
  typescript:
    input: test-modeler/identity
    output-artifact: typescript-files

  typescript/emitter:
    input: typescript
    scope: typescript-scope/emitter

REST Client Generator overrides

modelerfour:
  # this runs a pre-namer step to clean up names
  prenamer: true
  flatten-models: false
  flatten-payloads: false
  always-create-content-type-parameter: true
  group-parameters: false

Help

help-content:
  typescript: # type: Help as defined in autorest-core/help.ts
    activationScope: typescript
    categoryFriendlyName: Typescript Generator
    settings:
      - key: azure-arm
        description: Generate management plane flavor. Setting up the required flags for arm libraries
      - key: license-header
        description: "text to include as a header comment in generated files (magic strings: MICROSOFT_MIT, MICROSOFT_APACHE, MICROSOFT_MIT_NO_VERSION, MICROSOFT_APACHE_NO_VERSION, MICROSOFT_MIT_NO_CODEGEN)"
        type: string
      - key: add-credentials
        description: include a credential property and constructor parameter supporting different authentication behaviors
      - key: credential-scopes
        type: string | string[]
        description: Specify the scopes over which the credential functions. When generating management plane we default the scope to 'https://management.azure.com/.default'
      - key: package-name
        type: string
        description: The name of your package. This is the name your package will be published under.
      - key: source-code-folder-path
        type: string
        description: Where to output the generated code inside the output-folder. Defaults to src.
      - key: generate-metadata
        description: Whether to generate extra metadata in your package. For instance, generates a README file, license file etc if set to true.
      - key: disable-async-iterators
        description: Whether to generate pageable methods as AsyncIterators. Defaults to true.

Language Specific Requirements: TypeScript

For TypeScript projects, simply import autorest-extension-base which implements the AutoRest extension protocol and offers a simple API to register plugins. See index.ts.