open-index/open-npm huggingface dataset:
npm package: @loopback/example-socketio
Description: This is an example for spinning up socket server.
Author: IBM Corp. and LoopBack contributors
Latest version: 0.11.11

# @loopback/example-socketio

This example gives a basic implementation of socketio with loopback 4.

This shows how to get base setup done.

Also how to manage different namespaces which are configured and registered as
controllers.

This application is generated using
[LoopBack 4 CLI](https://loopback.io/doc/en/lb4/Command-line-interface.html)
with the
[initial project layout](https://loopback.io/doc/en/lb4/Loopback-application-layout.html).

## Install dependencies

By default, dependencies were installed when this application was generated.
Whenever dependencies in `package.json` are changed, run the following command:

```sh
npm install
```

To only install resolved dependencies in `package-lock.json`:

```sh
npm ci
```

## Run the application

```sh
npm start
```

You can also run `node .` to skip the build step.

Open http://127.0.0.1:3000 in your browser.

## Rebuild the project

To incrementally build the project:

```
npm run build
```

To force a full build by cleaning up cached artifacts:

```
npm run clean
npm run build
```

## Fix code style and formatting issues

If `eslint` and `prettier` are enabled for this project, you can use the
following commands to check code style and formatting issues.

```sh
npm run lint
```

To automatically fix such issues:

```sh
npm run lint:fix
```

## Other useful commands

- `npm run migrate`: Migrate database schemas for models
- `npm run openapi-spec`: Generate OpenAPI spec into a file
- `npm run docker:build`: Build a Docker image for this application
- `npm run docker:run`: Run this application inside a Docker container

## Tests

```sh
npm test
```

## What's next

Please check out [LoopBack 4 documentation](https://loopback.io/doc/en/lb4/) to
understand how you can continue to add features to this application.

[![LoopBack](<https://github.com/loopbackio/loopback-next/raw/master/docs/site/imgs/branding/Powered-by-LoopBack-Badge-(blue)-@2x.png>)](http://loopback.io/)
npm package: @loopback/example-todo
Description: Tutorial example on how to build an application with LoopBack 4
Author: IBM Corp. and LoopBack contributors
Latest version: 9.0.11

# @loopback/example-todo

This is the basic tutorial for getting started with Loopback 4!

## Overview

This tutorial demonstrates how to create a basic API for a todo list using
LoopBack 4. You will experience how you can create REST APIs with just
[5 steps](#steps).

![todo-tutorial-overview](https://loopback.io/pages/en/lb4/imgs/todo-overview.png)

## Setup

First, you'll need to install a supported version of Node:

- [Node.js](https://nodejs.org/en/) at v10 or greater

Additionally, this tutorial assumes that you are comfortable with certain
technologies, languages and concepts.

- JavaScript (ES6)
- [REST](http://www.restapitutorial.com/lessons/whatisrest.html)

Lastly, you'll need to install the LoopBack 4 CLI toolkit:

```sh
npm i -g @loopback/cli
```

## Tutorial

To follow this tutorial, begin with the
[Create your app scaffolding](http://loopback.io/doc/en/lb4/todo-tutorial-scaffolding.html)
section.

### Steps

1.  [Create your app scaffolding](http://loopback.io/doc/en/lb4/todo-tutorial-scaffolding.html)
2.  [Add your Todo model](http://loopback.io/doc/en/lb4/todo-tutorial-model.html)
3.  [Add a datasource](http://loopback.io/doc/en/lb4/todo-tutorial-datasource.html)
4.  [Add a repository](http://loopback.io/doc/en/lb4/todo-tutorial-repository.html)
5.  [Add a controller](http://loopback.io/doc/en/lb4/todo-tutorial-controller.html)
6.  [Putting it all together](http://loopback.io/doc/en/lb4/todo-tutorial-putting-it-together.html)
7.  Bonus:
    [Integrate with a geo-coding service](http://loopback.io/doc/en/lb4/todo-tutorial-geocoding-service.html)

## Try it out

If you'd like to see the final results of this tutorial as an example
application, follow these steps:

1.  Run the `lb4 example` command to select and clone the todo repository:

    ```sh
    lb4 example todo
    ```

2.  Switch to the directory.

    ```sh
    cd loopback4-example-todo
    ```

3.  Finally, start the application!

    ```sh
    $ npm start

    Server is running at http://127.0.0.1:3000
    ```

Feel free to look around in the application's code to get a feel for how it
works. If you're interested in learning how to build it step-by-step, then
continue with this tutorial!

### Need help?

Check out our
[Slack](https://join.slack.com/t/loopbackio/shared_invite/zt-8lbow73r-SKAKz61Vdao~_rGf91pcsw)
and ask for help with this tutorial.

### Bugs/Feedback

Open an issue in [loopback-next](https://github.com/loopbackio/loopback-next)
and we'll take a look.

## Contributions

- [Guidelines](https://github.com/loopbackio/loopback-next/blob/master/docs/CONTRIBUTING.md)
- [Join the team](https://github.com/loopbackio/loopback-next/issues/110)

## Tests

Run `npm test` from the root folder.

## Contributors

See
[all contributors](https://github.com/loopbackio/loopback-next/graphs/contributors).

## License

MIT
npm package: @loopback/example-todo-jwt
Description: A modified Todo tutorial how to build an application with JWT authentication and LoopBack 4
Author: IBM Corp. and LoopBack contributors
Latest version: 7.0.12

# @loopback/example-todo-jwt

This is a modified LoopBack 4
[Todo application](https://github.com/loopbackio/loopback-next/tree/master/examples/todo)
with JWT authentication, using the `@loopback/authentication-jwt` extension.

## Overview

This tutorial demonstrates how to add JWT authentication to the
[Todo application](https://github.com/loopbackio/loopback-next/tree/master/examples/todo).

## Usage

Start the application by running npm start and go to
http://localhost:3000/explorer. You’ll see the 3 new endpoints under
`UserController` together with the other endpoints under `TodoController`.

![API Explorer screenshot](https://loopback.io/pages/en/lb4/imgs/auth-tutorial-apiexplorer.png)

1. Sign up using the/signup API

   Since we don’t have any users created, click on `POST /signup`. For the
   requestBody, the minimum you need is `email` and `password`. i.e.

   ```json
   {
     "email": "testuser2@abc.com",
     "password": "testuser2"
   }
   ```

2. Log in using thePOST /users/login API

   After calling /users/login , the response body will look something like:

   ```json
   {
     "token": "aaaaaaaaa.aaaaaaaaaaaaaaaaa"
   }
   ```

   Copy the token. Go to the top of the API Explorer, click the “Authorize”
   button.

   ![API Explorer with Authorize Button](https://loopback.io/pages/en/lb4/imgs/auth-tutorial-auth-button.png)

   Paste the token that you previously copied to the “Value” field and then
   click Authorize.

   ![authorize dialog](https://loopback.io/pages/en/lb4/imgs/auth-tutorial-jwt-token.png)

   In the future API calls, this token will be added to the `Authorization`
   header .

3. Get all todos using `GET /todos` API You should be able to call this API
   successfully.

## Contributions

- [Guidelines](https://github.com/loopbackio/loopback-next/blob/master/docs/CONTRIBUTING.md)
- [Join the team](https://github.com/loopbackio/loopback-next/issues/110)

## Tests

Run `npm test` from the root folder.

## Contributors

See
[all contributors](https://github.com/loopbackio/loopback-next/graphs/contributors).

## License

MIT

[![LoopBack](<https://github.com/loopbackio/loopback-next/raw/master/docs/site/imgs/branding/Powered-by-LoopBack-Badge-(blue)-@2x.png>)](http://loopback.io/)
npm package: @loopback/example-todo-list
Description: Continuation of the todo example using relations in LoopBack 4.
Author: IBM Corp. and LoopBack contributors
Latest version: 9.0.11

# @loopback/example-todo-list

This is an extended tutorial that builds on top of `@loopback/example-todo`.

## Overview

This tutorial demonstrates how to create a set of APIs for models that are
related to one another.

![todo-tutorial-overview](https://loopback.io/pages/en/lb4/imgs/todo-list-overview.png)

## Setup

If you're following from the tutorial in `@loopback/example-todo`, you can jump
straight to our first step:
[Add TodoList model](http://loopback.io/doc/en/lb4/todo-list-tutorial-model.html)

If not, you'll need to make sure you have a couple of things installed before we
get started:

- [Node.js](https://nodejs.org/en/) at v10 or greater

Next, you'll need to install the LoopBack 4 CLI toolkit:

```sh
npm i -g @loopback/cli
```

We recommend that you start with the
[todo tutorial](http://loopback.io/doc/en/lb4/todo-tutorial.html) if you're not
familiar with LoopBack4, but if you are and don't want to start from scratch
again, you can use the LoopBack 4 CLI tool to catch up to where this tutorial
will continue from:

```sh
lb4 example todo
```

It should be noted that this tutorial does not assume the
[optional geo-coding step](https://loopback.io/doc/en/lb4/todo-tutorial-geocoding-service.html)
has been completed. Whether the step has been completed or not, the content and
the steps listed in this tutorial remain the same.

## Tutorial

Once you're ready to start the tutorial, let's begin by
[adding a TodoList model](http://loopback.io/doc/en/lb4/todo-list-tutorial-model.html)

### Steps

1.  [Add TodoList Model](http://loopback.io/doc/en/lb4/todo-list-tutorial-model.html)
2.  [Add TodoList Repository](http://loopback.io/doc/en/lb4/todo-list-tutorial-repository.html)
3.  [Add TodoList and TodoList's Todo Controller](http://loopback.io/doc/en/lb4/todo-list-tutorial-controller.html)

## Try it out

If you'd like to see the final results of this tutorial as an example
application, follow these steps:

1.  Run the `lb4 example` command to select and clone the todo repository:

    ```sh
    lb4 example todo-list
    ```

2.  Switch to the directory.

    ```sh
    cd loopback4-example-todo-list
    ```

3.  Finally, start the application!

    ```sh
    $ npm start

    Server is running at http://127.0.0.1:3000
    ```

Feel free to look around in the application's code to get a feel for how it
works. If you're interested in how it's been built or why we do things a certain
way, then continue on with this tutorial!

### Bugs/Feedback

Open an issue in [loopback-next](https://github.com/loopbackio/loopback-next)
and we'll take a look!

## Contributions

- [Guidelines](https://github.com/loopbackio/loopback-next/blob/master/docs/CONTRIBUTING.md)
- [Join the team](https://github.com/loopbackio/loopback-next/issues/110)

## Tests

Run `npm test` from the root folder.

## Contributors

See
[all contributors](https://github.com/loopbackio/loopback-next/graphs/contributors).

## License

MIT
npm package: @loopback/example-webpack
Description: An example to bundle @loopback/core using webpack
Author: IBM Corp. and LoopBack contributors
Latest version: 0.13.11

# @loopback/example-webpack

This example illustrates how to bundle `@loopback/core` using
[webpack](https://webpack.js.org/) to allow LoopBack's Dependency Injection to
run inside a browser.

## Webpack configurations

We add `webpack.config.js` to define two configurations for Node.js and Web.

## Use

Use one of the following commands to build `dist/bundle-web.js` to package this
example application into a JavaScript file for browsers.

```sh
npm run build:webpack-web
```

```sh
npx webpack --config-name web
```

Now `dist/bundle-web.js` can be used for HTML pages, for example:

```html
<!doctype html>
<html>
  <head>
    <title>LoopBack 4 Core Modules WebPack Demo</title>
    <script src="dist/bundle-web.js" charset="utf-8"></script>
  </head>
  <body>
    <div id="greetings"></div>

    <script>
      async function greet() {
        const element = document.getElementById('greetings');

        // Exported TypeScript functions/classes/types/constants are now
        // available under `LoopBack` namespace
        const greetings = await LoopBack.main();

        const list = greetings.map(g => `<li>${g}</li>`);
        element.innerHTML = `
  <h1>Hello from LoopBack</h1>
  <p/>
  <ul>
    ${list.join('\n')}
  </ul>`;
        return greetings;
      }

      greet().catch(err => alert(err));
    </script>
  </body>
</html>
```

Open `index.html` in a browser, you'll see LoopBack is now running inside the
browser as client-side JavaScript:

```
Hello from LoopBack:
[2020-09-14T07:54:09.220Z] (en) Hello, Jane!
[2020-09-14T07:54:09.227Z] Hello, John!
[2020-09-14T07:54:09.230Z] (zh) 你好，John！
[2020-09-14T07:54:09.231Z] (en) Hello, Jane!
```

## CDN

Once the package is published to npm, we can use `unpkg` as the CDN using one of
the following flavors:

```html
<script src="https://unpkg.com/@loopback/example-webpack" crossorigin></script>
<script
  src="https://unpkg.com/@loopback/example-webpack@0.1.0"
  crossorigin
></script>
<script
  src="https://unpkg.com/@loopback/example-webpack@0.1.0/dist/bundle-web.js"
  crossorigin
></script>
```

## Contributions

- [Guidelines](https://github.com/loopbackio/loopback-next/blob/master/docs/CONTRIBUTING.md)
- [Join the team](https://github.com/loopbackio/loopback-next/issues/110)

## Tests

Run `npm test` from the root folder.

## Contributors

See
[all contributors](https://github.com/loopbackio/loopback-next/graphs/contributors).

## License

MIT
npm package: @loopback/extension-health
Description: An extension exposes health check related endpoints with LoopBack 4
Author: IBM Corp.
Latest version: 0.4.13

# @loopback/extension-health

This module contains a component to report health status using
[@cloudnative/health](https://github.com/CloudNativeJS/cloud-health).

## Installation

```sh
npm install --save @loopback/extension-health
```

## Basic use

{% include note.html content="*this.configure()* must be called before *this.component()* to take effect. This is a [known limitation](https://github.com/strongloop/loopback-next/issues/4289#issuecomment-564617263)." %}

The component should be loaded in the constructor of your custom Application
class.

Start by importing the component class:

```ts
import {HealthComponent} from '@loopback/extension-health';
```

In the constructor, add the component to your application:

```ts
this.component(HealthComponent);
```

By default, three routes are exposed at:

- `/health` - overall health status
- `/live` - liveness status
- `/ready` - readiness status

The paths can be customized via Health configuration as follows:

```ts
this.configure(HealthBindings.COMPONENT).to({
  healthPath: '/health',
  livePath: '/live',
  readyPath: '/ready',
});
```

http://localhost:3000/health returns health in JSON format, such as:

```json
{
  "status": "UP",
  "checks": [
    {"name": "readiness", "state": "UP", "data": {"reason": ""}},
    {"name": "liveness", "state": "UP", "data": {"reason": ""}}
  ]
}
```

## Add custom `live` and `ready` checks

The health component allows extra
[`live` and `ready` checks](https://github.com/CloudNativeJS/cloud-health#readiness-vs-liveness)
to be added.

```ts
import {LiveCheck, ReadyCheck, HealthTags} from '@loopback/extension-health';

const myLiveCheck: LiveCheck = () => {
  return Promise.resolve();
};
app.bind('health.MyLiveCheck').to(myLiveCheck).tag(HealthTags.LIVE_CHECK);

// Define a provider to check the liveness of a datasource
class DBLiveCheckProvider implements Provider<LiveCheck> {
  constructor(@inject('datasources.db') private ds: DataSource) {}

  value() {
    return () => this.ds.ping();
  }
}

app
  .bind('health.MyDBCheck')
  .toProvider(DBLiveCheckProvider)
  .tag(HealthTags.LIVE_CHECK);

const myReadyCheck: ReadyCheck = () => {
  return Promise.resolve();
};
app.bind('health.MyReadyCheck').to(myReadyCheck).tag(HealthTags.READY_CHECK);
```

## Contributions

- [Guidelines](https://github.com/strongloop/loopback-next/blob/master/docs/CONTRIBUTING.md)
- [Join the team](https://github.com/strongloop/loopback-next/issues/110)

## Tests

Run `npm test` from the root folder.

## Contributors

See
[all contributors](https://github.com/strongloop/loopback-next/graphs/contributors).

## License

MIT
npm package: @loopback/filter
Description: Utility typings and filters for LoopBack filters.
Author: IBM Corp. and LoopBack contributors
Latest version: 6.0.10

# @loopback/filter

A set of utility typings and filter builders to aid in constructing LoopBack
filters using the
[builder pattern](https://en.wikipedia.org/wiki/Builder_pattern).

## Overview

This lightweight module provides strongly-typed typings and filter builders to
intuitively construct LoopBack filters to be used against querying a LoopBack
filter-compatible server over the network or within the server itself.

## Installation

{% include note.html content="Already installed `@loopback/repository`? Import from there instead. This package is meant for standalone use without `@loopback/repository`." %}

```sh
npm install --save @loopback/filter
```

## Basic use

### WhereBuilder

The `WhereBuilder` is a builder specifically meant to construct the `where`
portion of the filter.

```ts
import {WhereBuilder} from '@loopback/filter';

const whereBuilder = new WhereBuilder();
const where = whereBuilder
  .between('price', 99, 299)
  .and({brand: 'LoopBack'}, {discount: {lt: 20}})
  .or({instock: true})
  .build();
```

### FilterBuilder

The `FilterBuilder` is a builder to construct the filter as a whole.

```ts
import {FilterBuilder} from '@loopback/filter';

const filterBuilder = new FilterBuilder();
const filter = filterBuilder
  .fields('id', 'a', 'b')
  .limit(10)
  .offset(0)
  .order(['a ASC', 'b DESC'])
  .where({id: 1})
  .build();
```

`FilterBuilder.where()` also accepts an instance of `WhereBuilder`.

```ts
const filterBuilder = new FilterBuilder();
const filter = filterBuilder
  // ...
  .where(where)
  .build();
```

## Advanced use

### Strong typings

The `FilterBuilder` and `WhereBuilder` accept a model or any string-based key
objects' typing for strong typings:

```ts
/**
 * Everything was imported from `@loopback/repository` as `@loopback/filter`
 * is re-exported in that package.
 **/
import {
  FilterBuilder,
  model,
  property,
  WhereBuilder,
} from '@loopback/repository';

@model()
class Todo extends Entity {
  @property({id: true})
  id: number;

  @property()
  title: string;

  @property()
  description: string;

  @property()
  priority: number;
}

const whereBuilder = new WhereBuilder<Todo>();
const where = whereBuilder.between('priority', 1, 3).build();

const filterBuilder = new FilterBuilder<Todo>();
const filter = filterBuilder
  .fields('id', 'title')
  .order(['title DESC'])
  .where(where)
  .build();
```

## API docs

See the API docs for
[FilterBuilder](https://loopback.io/doc/en/lb4/apidocs.filter.filterbuilder.html)
and
[WhereBuilder](https://loopback.io/doc/en/lb4/apidocs.filter.wherebuilder.html)
for more details on the full API.

## Contributions

- [Guidelines](https://github.com/loopbackio/loopback-next/blob/master/docs/CONTRIBUTING.md)
- [Join the team](https://github.com/loopbackio/loopback-next/issues/110)

## Tests

Run `npm test` from the root folder.

## Contributors

See
[all contributors](https://github.com/loopbackio/loopback-next/graphs/contributors).

## License

MIT
npm package: @loopback/http-server
Description: A wrapper for creating HTTP/HTTPS servers
Author: IBM Corp. and LoopBack contributors
Latest version: 7.0.10

# @loopback/http-server

This package implements the HTTP / HTTPS server endpoint for LoopBack 4 apps.

## Overview

This is an internal package used by LoopBack 4 for creating HTTP / HTTPS server.

## Installation

To use this package, you'll need to install `@loopback/http-server`.

```sh
npm i @loopback/http-server
```

## Usage

`@loopback/http-server` should be instantiated with a request handler function,
and an HTTP / HTTPS options object.

```js
const httpServer = new HttpServer(
  (req, res) => {
    res.end('Hello world');
  },
  {port: 3000, host: ''},
);
```

Instance methods of `HttpServer`.

| Method    | Description       |
| --------- | ----------------- |
| `start()` | Starts the server |
| `stop()`  | Stops the server  |

Instance properties of `HttpServer`.

| Property   | Description            |
| ---------- | ---------------------- |
| `address`  | Address details        |
| `host`     | host of the server     |
| `port`     | port of the server     |
| `protocol` | protocol of the server |
| `url`      | url the server         |

## Contributions

- [Guidelines](https://github.com/loopbackio/loopback-next/wiki/Contributing#guidelines)
- [Join the team](https://github.com/loopbackio/loopback-next/issues/110)

## Tests

Run `npm test` from the root folder.

## Contributors

See
[all contributors](https://github.com/loopbackio/loopback-next/graphs/contributors).

## License

MIT
npm package: @loopback/mock-oauth2-provider
Description: An internal application to mock the OAuth2 authorization flow login with a social app like facebook, google etc
Author: IBM Corp. and LoopBack contributors
Latest version: 0.10.10

This package provides an app which mocks the OAuth2 authorization flow login
with a social app like facebook, google, etc

- Endpoints :
  - `/oauth/dialog` - opens the oauth2 flow, redirects to login page
  - `/login` - loads the login page
  - `/login_submit` - submit username , password
  - `/oauth/token` - returns a token in exchange for a valid authorization code
  - `/verify` - verifies token

With the above endpoints, this mock can be used for tests to attain below oauth2
stages

- stage 1 : Authorization code grant - Get access code
  - [1] invoke oauth2 dialog end point `/oauth/dialog` with callback url
  - [2] redirects to mock auth server login page `/login`
  - [3] successful login with mock server redirects to callback url with access
    code
- stage 2 : Authentication - Exchange access code for access token
  - [4] invoke with access code, `/oauth/token` to get access token
  - [5] auth server returns access token, `/verify` can be used to verify access
    token and get user profile

```
+---------------+                               +--------------+
|               | <---------[1]-------------    | Application  |
| Mock          | Application sends request     |  ^           |
| Authorization | to auth server,payload:       |  |           |
| Server        | {'client_id':,                |  |           |
| (mock-oauth2- |     'callback_url': app url } |  Stage 1     |
| social-app.ts)|                               |  |           |
|               |----+ auth server redirects    |  |           |
|               |    | browser to login page,   |  |           |
|               |  [2] client_id and            |  |           |
|               |    | callback_url are         |  |           |
|               |<---+ passed as hidden params  |  |           |
|               |                               |  |           |
|               |                               |  v           |
|               | -------[3]------------->      | ***          |
|               | login success, auth server    |  ^           |
|               | redirects browser to callback |  |           |
|               | url with access_code          |  |           |
|               |                               |  |           |
|               | <-------------[4]---------    |  |           |
|               |  Application requests access  |  Stage 2     |
|               |  token with access_code       |  |           |
|               |                               |  |           |
|               | ---------------[5]--------->  |  v           |
+---------------+       returns access token    +--------------+

```
npm package: @loopback/model-api-builder
Description: Types and helpers for packages contributing Model API builders.
Author: IBM Corp. and LoopBack contributors
Latest version: 7.0.11

# @loopback/model-api-builder

Types and helpers for packages contributing Model API builders.

## Overview

The `@loopback/model-api-builder` package provides a contract for extensions
that contribute builders for repositories and controllers. Users provide both
the model class and an extension. The extension is then used to build their
repository and controller based on the model class.

## Installation

```sh
npm install --save @loopback/model-api-builder
```

## Basic use

An extension that contributes the repository and controller builders can be made
by implementing `ModelApiBuilder`:

```ts
import {
  asModelApiBuilder,
  ModelApiBuilder,
  ModelApiConfig,
} from '@loopback/model-api-builder';

@injectable(asModelApiBuilder)
export class SampleApiBuilder implements ModelApiBuilder {
  readonly pattern: string = 'Sample';

  build(
    application: ApplicationWithRepositories,
    modelClass: typeof Model & {prototype: Model},
    config: ModelApiConfig,
  ): Promise<void> {
    // define repository setup here
    // ...
    // define controller setup here
    // ...
  }
}
```

## Contributions

- [Guidelines](https://github.com/loopbackio/loopback-next/blob/master/docs/CONTRIBUTING.md)
- [Join the team](https://github.com/loopbackio/loopback-next/issues/110)

## Contributors

See
[all contributors](https://github.com/loopbackio/loopback-next/graphs/contributors).

## License

MIT
npm package: @loopback/monorepo
Description: A set of scripts to maintain a lerna monorepo
Author: IBM Corp. and LoopBack contributors
Latest version: 0.6.0

# @loopback/monorepo

This module contains a set of common scripts to maintain a
[lerna](https://github.com/lerna/lerna) monorepo.

- `script-util`: common utility functions for `lerna`
- `check-package-locks`: check if `package-lock.json` files has local packages.
- `rebuild-package-locks`: rebuild `package-lock.json` files for all packages or
  packages matching given scopes.
- `run-lerna`: run `lerna` command with `LERNA_ROOT_PATH` environment variable
  set to the root path of the monorepo
- `config-lerna-scopes`: return a list of scope names for conventional commits.
- `update-package-deps`: update package dependencies to match versions of local
  packages.
- `update-package-json`: update `package.json` files for all packages based on
  metadata from the root `package.json` for the monorepo
- `update-ts-project-refs`: update `tsconfig.json` with TypeScript project
  references based on the dependency graph.

## Basic use

To use `@loopback/monorepo` for your lerna monorepo, run the following command
to add `@loopback/monorepo` as a dev dependency to the root project.

```sh
npm i @loopback/monorepo --save-dev
```

The following commands are exposed by `@loopback/monorepo`.

- `lb-run-lerna`: run `lerna` command with `LERNA_ROOT_PATH` environment
  variable set to the root path of the monorepo

- `lb-check-package-locks`: check if `package-lock.json` files has local
  packages.

- `lb-rebuild-package-locks`: rebuild `package-lock.json` files for all packages
  or packages matching given scopes.

- `lb-update-package-deps`: update package dependencies to match versions of
  local packages.

- `lb-update-package-json`: update `package.json` files for all packages based
  on metadata from the root `package.json` for the monorepo.

- `lb-update-ts-project-refs`: update `tsconfig.json` with TypeScript project
  references based on the dependency graph.

These commands can be invoked using `npx`:

```sh
npx lb-update-ts-project-refs
npx lb-rebuild-package-locks
```

The `--dry-run` option can be used to preview changes without applying them.

```sh
npx lb-update-ts-project-refs --dry-run
```

To access such scripts programmatically:

```js
const {
  checkPackageLocks,
  configLernaScopes,
  runLerna,
  updatePackageDeps,
  updatePackageJson,
  updateTsProjectRefs,
  getPackages,
  loadLernaRepo,
  runMain,
} = require('@loopback/monorepo');
```

## Contributions

- [Guidelines](https://github.com/loopbackio/loopback-next/blob/master/docs/CONTRIBUTING.md)
- [Join the team](https://github.com/loopbackio/loopback-next/issues/110)

## Tests

run `npm test` from the root folder.

## Contributors

See
[all contributors](https://github.com/loopbackio/loopback-next/graphs/contributors).

## License

MIT
npm package: @loopback/openapi-spec
Description: TypeScript type definitions for OpenAPI Spec/Swagger documents.
Author: IBM
Latest version: 0.3.0

## DEPRECATION NOTICE

This package has been deprecated in favor of OpenAPI Spec version 3.0.0, we are no longer maintaining it.

# @loopback/openapi-spec

TypeScript type definitions for OpenAPI Spec/Swagger documents.

## Overview

TypeScript definitions describing the schema of OpenAPI/Swagger documents,
including LoopBack-specific extensions.

## Installation

```
$ npm install --save @loopback/openapi-spec
```

## Basic use

Use `OpenApiSpec` type in your function accepting a Swagger/OpenAPI document:

```ts
import {OpenApiSpec} from '@loopback/openapi-spec';

export function validateSpec(spec: OpenApiSpec) {
  // ...
}
```

IDEs like Visual Studio Code will offer auto-completion for spec properties
when constructing a spec argument value.

## Related resources

See https://www.openapis.org/ and [version 2.0](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md)
of OpenAPI Specification.

## Contributions

IBM/StrongLoop is an active supporter of open source and welcomes contributions to our projects as well as those of the Node.js community in general. For more information on how to contribute please refer to the [Contribution Guide](https://loopback.io/doc/en/contrib/index.html).

# Tests

run `npm test` from the root folder.

# Contributors

See [all contributors](https://github.com/strongloop/loopback-next/graphs/contributors).

# License

MIT
npm package: @loopback/openapi-spec-builder
Description: Make it easy to create OpenAPI (Swagger) specification documents in your tests using the builder pattern.
Author: IBM Corp. and LoopBack contributors
Latest version: 8.0.10

# @loopback/openapi-spec-builder

Make it easy to create OpenAPI specification documents in your tests using the
builder pattern.

## Overview

Creating a full OpenAPI spec document in automated tests is rather cumbersome,
long JSON-like objects pollute the test test code and make it difficult for
readers to distinguish between what's important in the test and what's just
shared OpenAPI boilerplate.

OpenApiSpecBuilder utilizes
[Test Data Builder pattern](http://www.natpryce.com/articles/000714.html) to
provide a TypeScript/JavaScript API allowing users to create full OpenAPI Spec
documents in few lines of code.

## Installation

```sh
npm install --save-dev @loopback/openapi-spec-builder
```

_This package is typically used in tests, save it to `devDependencies` via
`--save-dev`._

## Basic use

```ts
import {
  anOpenApiSpec,
  OpenApiSpecBuilder,
} from '@loopback/openapi-spec-builder';

const spec = anOpenApiSpec()
  .withOperationReturningString('get', '/hello', 'greet')
  .build();

// which is equivalent to the following longer form
const spec = new OpenApiSpecBuilder()
  .withOperation('get', '/hello', {
    'x-operation-name': 'greet',
    responses: {
      '200': {
        description: 'The string result.',
        content: {
          'text/plain': {
            schema: {
              type: 'string',
            },
          },
        },
      },
    },
  })
  .build();

// the spec
const spec = {
  openapi: '3.0.0',
  info: {title: 'LoopBack Application', version: '1.0.0'},
  servers: [
    {
      url: '/',
    },
  ],
  paths: {
    '/hello': {
      get: {
        'x-operation-name': 'greet',
        responses: {
          '200': {
            description: 'The string result.',
            content: {
              'text/plain': {
                schema: {
                  type: 'string',
                },
              },
            },
          },
        },
      },
    },
  },
};
```

## Related resources

See <https://www.openapis.org/> and
[version 3.0.0](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md)
of OpenAPI Specification.

## Contributions

- [Guidelines](https://github.com/loopbackio/loopback-next/blob/master/docs/CONTRIBUTING.md)
- [Join the team](https://github.com/loopbackio/loopback-next/issues/110)

## Tests

Run `npm test` from the root folder.

## Contributors

See
[all contributors](https://github.com/loopbackio/loopback-next/graphs/contributors).

## License

MIT
npm package: @loopback/openapi-v2
Description: Processes openapi v2 related metadata
Author: IBM
Latest version: 0.3.0

## DEPRECATION NOTICE

This package has been deprecated in favor of OpenAPI Spec version 3.0.0, we are no longer maintaining it.

@loopback/openapi-v2

This package contains:

- Decorators that describe LoopBack artifacts as OpenAPI v2 (Swagger) metadata.
- Utilities that transfer LoopBack metadata to OpenAPI v2 (Swagger) swagger specifications. 

## Overview

The package has functions described above for LoopBack controller classes.
Decorators apply REST api mapping metadata to controller classes and their members. And utilities that inspect controller classes to build OpenAPI v2 (Swagger) specifications from REST api mapping metadata.

Functions for more artifacts will be added when we need.

## Installation

```
$ npm install --save @loopback/openapi-v2
```

## Basic use

Currently this package only has spec generator for controllers.
It generates swagger `paths` and `basePath` specs for a given decorated controller class.

Here is an example of calling function `getControllerSpec` to generate the swagger spec:

```js
import {api, getControllerSpec} from '@loopback/openapi-v2';

@api(somePathSpec)
class MyController {
    greet() {
        return 'Hello world!';
    }
}

const myControllerSpec = getControllerSpec(MyController);
```

then the `myControllerSpec` will be:
```js
{
    swagger: '2.0',
    basePath: '/',
    info: { title: 'LoopBack Application', version: '1.0.0' },
    paths: { 
        '/greet': { 
            get: {
                responses:  { 
                    '200': { 
                        description: 'The string result.', 
                        schema: { type: 'string' } 
                    } 
                },
                'x-operation-name': 'greet' 
            }
        } 
    } 
}
```

For details of how to apply controller decorators, please check http://loopback.io/doc/en/lb4/Decorators.html#route-decorators

## Related resources

See https://www.openapis.org/ and [version 2.0](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md)
of OpenAPI Specification.

## Contributions

IBM/StrongLoop is an active supporter of open source and welcomes contributions to our projects as well as those of the Node.js community in general. For more information on how to contribute please refer to the [Contribution Guide](https://loopback.io/doc/en/contrib/index.html).

# Tests

run `npm test` from the root folder.

# Contributors

See [all contributors](https://github.com/strongloop/loopback-next/graphs/contributors).

# License

MIT
npm package: @loopback/openapi-v3
Description: Decorators that annotate LoopBack artifacts with OpenAPI v3 metadata and utilities that transform LoopBack metadata to OpenAPI v3 specifications
Author: IBM Corp. and LoopBack contributors
Latest version: 11.0.11

# @loopback/openapi-v3

This package contains:

- Decorators that describe LoopBack artifacts as OpenAPI 3.0.0 metadata.
- Utilities that transfer LoopBack metadata to OpenAPI 3.0.0 specifications.

## Overview

The package has functions described above for LoopBack controller classes.
Decorators apply REST api mapping metadata to controller classes and their
members. And utilities that inspect controller classes to build OpenAPI 3.0.0
specifications from REST API mapping metadata.

Functions for more artifacts will be added when we need.

## Installation

```sh
npm install --save @loopback/openapi-v3
```

## Basic use

Currently this package only has spec generator for controllers. It generates
OpenAPI specifications for a given decorated controller class, including
`paths`, `components.schemas`, and `servers`.

Here is an example of calling function `getControllerSpec` to generate the
OpenAPI spec:

```ts
import {get, getControllerSpec} from '@loopback/openapi-v3';

class MyController {
  @get('/greet')
  greet() {
    return 'Hello world!';
  }
}

const myControllerSpec = getControllerSpec(MyController);
```

then the `myControllerSpec` will be:

```ts
{
  paths: {
    '/greet': {
      get: {
        'x-operation-name': 'greet'
      }
    }
  },
}
```

For details of how to apply controller decorators, please check
<http://loopback.io/doc/en/lb4/Decorators.html#route-decorators>

## Related resources

See <https://www.openapis.org/> and
[version 3.0.0](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md)
of OpenAPI Specification.

## Contributions

- [Guidelines](https://github.com/loopbackio/loopback-next/blob/master/docs/CONTRIBUTING.md)
- [Join the team](https://github.com/loopbackio/loopback-next/issues/110)

## Tests

Run `npm test` from the root folder.

## Contributors

See
[all contributors](https://github.com/loopbackio/loopback-next/graphs/contributors).

## License

MIT
npm package: @loopback/openapi-v3-types
Description: [DEPRECATED] TypeScript type definitions for OpenAPI Specifications.
Author: IBM Corp.
Latest version: 1.2.1

# @loopback/openapi-v3-types

TypeScript type definitions for OpenAPI Spec/Swagger documents.

## Overview

TypeScript definitions describing the schema of OpenAPI/Swagger documents,
including LoopBack-specific extensions.

**This package is deprecated, use
[openapi3-ts](https://www.npmjs.com/package/openapi3-ts) or
[@loopback/openapi-v3](https://www.npmjs.com/package/@loopback/openapi-v3)
instead.**

## Installation

```sh
npm install --save @loopback/openapi-v3-types
```

## Basic use

Use `OpenApiSpec` type in your function accepting an OpenAPI document:

```ts
import {OpenApiSpec} from '@loopback/openapi-v3-types';

export function validateSpec(spec: OpenApiSpec) {
  // ...
}
```

IDEs like Visual Studio Code will offer auto-completion for spec properties when
constructing a spec argument value.

## Related resources

See <https://www.openapis.org/> and
[version 3.0.0](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md)
of OpenAPI Specification. For the types missing in this package, they are
exported from <https://www.npmjs.com/package/openapi3-ts>

## Contributions

- [Guidelines](https://github.com/strongloop/loopback-next/blob/master/docs/CONTRIBUTING.md)
- [Join the team](https://github.com/strongloop/loopback-next/issues/110)

## Tests

Run `npm test` from the root folder.

## Contributors

See
[all contributors](https://github.com/strongloop/loopback-next/graphs/contributors).

## License

MIT
npm package: @loopback/repository-json-schema
Description: Converts TS classes into JSON Schemas using TypeScript's reflection API
Author: IBM Corp. and LoopBack contributors
Latest version: 9.0.11

# @loopback/repository-json-schema

Convert a TypeScript class/model to a JSON Schema for users, leveraging
LoopBack4's decorators, metadata, and reflection system.

## Overview

This package provides modules to easily convert LoopBack4 models that have been
decorated with `@model` and `@property` to a matching JSON Schema Definition.

## Installation

```shell
$ npm install --save @loopback/repository-json-schema
```

## Basic use

```ts
import {getJsonSchema} from '@loopback/repository-json-schema';
import {model, property} from '@loopback/repository';

@model()
class MyModel {
  @property()
  name: string;
}

const jsonSchema = getJsonSchema(MyModel);
```

The value of `jsonSchema` will be:

```json
{
  "title": "MyModel",
  "properties": {
    "name": {
      "type": "string"
    }
  }
}
```

## Contributions

- [Guidelines](https://github.com/loopbackio/loopback-next/blob/master/docs/CONTRIBUTING.md)
- [Join the team](https://github.com/loopbackio/loopback-next/issues/110)

## Tests

Run `npm test` from the root folder.

## Contributors

See
[all contributors](https://github.com/loopbackio/loopback-next/graphs/contributors).

## License

MIT
npm package: @loopback/rest
Description: Expose controllers as REST endpoints and route REST API requests to controller methods
Author: IBM Corp. and LoopBack contributors
Latest version: 15.0.11

# @loopback/rest

The REST API package for
[loopback-next](https://github.com/loopbackio/loopback-next).

## Overview

This component provides a REST server for your application instances, complete
with:

- new custom routing engine (special thanks to @bajtos)!
- tools for defining your application routes
- OpenAPI 3.0 spec (`openapi.json`/`openapi.yaml`) generation using
  `@loopback/openapi-v3`
- a default sequence implementation to manage the request and response lifecycle

**NOTE: Starting from 6.0.0, we have introduced a middleware-based sequence,
which is used as the default one for newly generated LoopBack applications using
`lb4` command from `@loopback/cli`.**

## Installation

To use this package, you'll need to install `@loopback/rest`.

```sh
npm i @loopback/rest
```

## Basic Use

Here's a basic "Hello World" application using `@loopback/rest`:

```ts
import {RestApplication, RestServer} from '@loopback/rest';

const app = new RestApplication();
app.handler(({request, response}, sequence) => {
  sequence.send(response, 'hello world');
});

(async function start() {
  await app.start();

  const server = await app.getServer(RestServer);
  const port = await server.get('rest.port');
  console.log(`Server is running at http://127.0.0.1:${port}`);
})();
```

## Configuration

See https://loopback.io/doc/en/lb4/Server.html#configuration.

## Contributions

- [Guidelines](https://github.com/loopbackio/loopback-next/blob/master/docs/CONTRIBUTING.md)
- [Join the team](https://github.com/loopbackio/loopback-next/issues/110)

## Tests

Run `npm test` from the root folder.

## Contributors

See
[all contributors](https://github.com/loopbackio/loopback-next/graphs/contributors).

## License

MIT
npm package: @loopback/security
Description: A LoopBack component for security support.
Author: IBM Corp. and LoopBack contributors
Latest version: 0.12.11

# @loopback/security

Common types/interfaces for LoopBack 4 security including authentication and
authorization.

## Installation

```shell
npm install --save @loopback/security
```

## Overview

- Subject
  - It's the "who" for security
  - contains a set of Principles, a set of Credentials, and a set of Permissions
- Principle
  - Represent a user, an application, or a device
- Credential
  - Security attributes used to authenticate the subject. Such credentials
    include passwords, Kerberos tickets, and public key certificates.
- Permission
  - It's the `what` for security.

![Overview](security-overview-diagram.png)

## Basic use

## Contributions

- [Guidelines](https://github.com/loopbackio/loopback-next/blob/master/docs/CONTRIBUTING.md)
- [Join the team](https://github.com/loopbackio/loopback-next/issues/110)

## Tests

run `npm test` from the root folder.

## Contributors

See
[all contributors](https://github.com/loopbackio/loopback-next/graphs/contributors).

## License

MIT
npm package: @loopback/service-proxy
Description: A common set of interfaces for interacting with service oriented backends such as REST APIs, SOAP Web Services, and gRPC microservices
Author: IBM Corp. and LoopBack contributors
Latest version: 8.0.10

# @loopback/service-proxy

This module provides a common set of interfaces for interacting with service
oriented backends such as REST APIs, SOAP Web Services, and gRPC microservices.

## Installation

```
$ npm install @loopback/service-proxy
```

## Basic use

See https://loopback.io/doc/en/lb4/Calling-other-APIs-and-web-services.html

## Contributions

- [Guidelines](https://github.com/loopbackio/loopback-next/blob/master/docs/CONTRIBUTING.md)
- [Join the team](https://github.com/loopbackio/loopback-next/issues/110)

## Tests

run 'npm test' from the root folder.

## Contributors

See
[all contributors](https://github.com/loopbackio/loopback-next/graphs/contributors).

## License

MIT
npm package: @loopback/service-proxy-proxy
Description: Service integration for LoopBack 4
Author: IBM
Latest version: 0.4.0

# @loopback/service-proxy

This module provides a common set of interfaces for interacting with service
oriented backends such as REST APIs, SOAP Web Services, and gRPC microservices.

## Installation

```
$ npm install @loopback/service-proxy
```

## Basic use

See https://loopback.io/doc/en/lb4/Calling-other-APIs-and-web-services.html

## Contributions

- [Guidelines](https://github.com/strongloop/loopback-next/wiki/Contributing##guidelines)
- [Join the team](https://github.com/strongloop/loopback-next/issues/110)

## Tests

run 'npm test' from the root folder.

## Contributors

See [all contributors](https://github.com/strongloop/loopback-next/graphs/contributors).

## License

MIT
npm package: @loopback/socketio
Description: LoopBack's WebSocket server based on socket.io
Author: IBM Corp. and LoopBack contributors
Latest version: 0.9.11

# @loopback/socketio

Stability: :warning: Experimental :warning:

This module uses [socket.io](http://socket.io) to expose controllers as
WebSocket friendly endpoints.

## Use Cases

1. A real time application would like to use WebSocket friendly APIs to manage
   subscriptions, participants (rooms) and message exchanges.

2. Make it easy for API developers to expose WebSocket friendly APIs without
   learning a lot of low level concepts.

3. Use it as a step stone to explore messaging oriented API paradigms and
   programming models, such as pub/sub, eventing, streaming, and reactive.

## High Level Design

The package will provide the following key constructs:

- SocketIoServer: A new server type that listens on incoming WebSocket
  connections and dispatches messages to controllers that subscribe to the
  namespace. Each server is attached to an http/https endpoint.

- SocketIo controller: A controller class that is decorated with SocketIo
  related metadata, including:
  - Map to a namespace
  - Connect/disconnect events
  - Subscribe/consume messages
  - Publish/produce messages

- SocketIo middleware or sequence
  - Allow common logic to intercept/process WebSocket messages

## Basic Use

1. Create a SocketIoServer
2. Define a controller to handle socket.io events/messages
3. Register the controller
4. Discover socket.io controllers and mount them to the SocketIoServer
   namespaces.

## Sample application

[socket.io](https://github.com/loopbackio/loopback-next/tree/master/examples/socketio)

## Installation

```sh
npm install --save @loopback/socketio
```

## Contributions

- [Guidelines](https://github.com/loopbackio/loopback-next/blob/master/docs/CONTRIBUTING.md)
- [Join the team](https://github.com/loopbackio/loopback-next/issues/110)

## Tests

Run `npm test` from the root folder.

## Contributors

See
[all contributors](https://github.com/loopbackio/loopback-next/graphs/contributors).

## License

MIT
npm package: @loopback/tsdocs
Description: A package to generate api docs using Microsoft api-extractor and api-documenter
Author: IBM Corp. and LoopBack contributors
Latest version: 7.0.10

# @loopback/tsdocs

This module provides [API docs](https://github.com/Microsoft/tsdoc) generation
for `@loopback/*` packages.

It's built on top of https://api-extractor.com/:

- https://github.com/Microsoft/web-build-tools/tree/master/apps/api-extractor
- https://github.com/Microsoft/web-build-tools/tree/master/apps/api-documenter

## Basic Use

### Build api reports and doc models

```sh
npm run extract-apidocs -- --report
```

The command above will traverse all TypeScript packages in the monorepo and run
`api-extractor` to generate api reports and doc models into
`loopback-next/docs/apidocs`:

- `reports`: api reports
- `reports-temp`: temporary api reports
- `models`: doc models

### Generate api docs as markdown files

```sh
npm run document-apidocs
```

It runs `api-documenter` to generate markdown files into
`loopback-next/docs/site/apidocs`.

### Update api docs for Jekyll site

```sh
npm run update-apidocs
```

It adds Jekyll metadata to markdown files in `loopback-next/docs/site/apidocs`
and generates `loopback-next/docs/site/apidocs/index.md` as the index page.

To run all steps together:

```sh
npm run build:tsdocs
```

## Installation

```sh
npm install --save @loopback/tsdocs
```

## Contributions

- [Guidelines](https://github.com/loopbackio/loopback-next/blob/master/docs/CONTRIBUTING.md)
- [Join the team](https://github.com/loopbackio/loopback-next/issues/110)

## Tests

Run `npm test` from the root folder.

## Contributors

See
[all contributors](https://github.com/loopbackio/loopback-next/graphs/contributors).

## License

MIT