open-index/open-npm huggingface dataset:
npm package: @loop-kit/dock
Description: Graphite-powered docking facet, recognizers, and React view bindings.
Latest version: 0.1.0

# @loop-kit/dock

Reference docking implementation built on Graphite runtime idioms.

## Concepts

- Intent model nodes: `dock.root`, `dock.group`, `dock.tab`, `dock.panel`.
- Ordered relations:
  - `dock.tabs` (`group -> tabs`)
  - `dock.childGroups` (`root/group -> child groups`)
- Dock validator (`validateDock`) normalizes inconsistent intent into:
  - normalized logical groups/tabs
  - layout IR
  - preview state (from overlay intent)
  - diagnostics (invalid active tabs, cycles, invalid splits)
- Drag recognizer (`dock.dragTab`) writes semantic preview overlay patches during move and commits durable move/split patches on pointer up.
- Geometry and hit-test data stay ephemeral in `DockLayoutCache`, not in intent.

## How To Use

```tsx
import { GraphiteRuntime, asScopeId } from '@loop-kit/graphite-core';
import { GraphiteProvider } from '@loop-kit/graphite-react';
import { DockView, registerDockFacet } from '@loop-kit/dock';

const runtime = new GraphiteRuntime({ enableHistory: true });
registerDockFacet(runtime);

export function DockApp() {
    return (
        <GraphiteProvider runtime={runtime} scopeId={asScopeId('dock')}>
            <DockView />
        </GraphiteProvider>
    );
}
```

## How Dock Demonstrates Graphite

- `IntentStore` stores only semantic dock structure.
- `OverlayLayer` previews drag targets without durable writes.
- `Validators` produce a stable `StateView` for rendering and diagnostics.
- `InteractionRuntime` + arena manages recognizer capture/conflict.
- `History` boundaries are used for docking commits so undo/redo works.

## Add A New Facet/System

1. Add schema constants and patch builders in `src/facet/`.
2. Extend validator output (`DockStateSlice`) and diagnostics.
3. Update `layoutCache` + recognizers for new gesture semantics.
4. Keep transient behavior in overlay patches and finalize with intent commits.

## Commands

- `moon run dock:typecheck`
- `moon run dock:test`
- `moon run dock:build`
npm package: @loop-kit/graphite-core
Description: Graphite runtime kernel: graph store, queries, validation, interaction runtime.
Latest version: 0.1.0
Deprecated: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

# @loop-kit/graphite-core

Graphite runtime kernel for intent graphs, overlay previews, validation, interaction, history, and effects.

## Concepts

- `IntentStore`: durable graph with schema-light node/edge/prop data.
- `OverlayLayer`: per-scope ephemeral patch stack for previews; easy to clear.
- `Patch` and `Commit`: invertible low-level ops applied atomically with version bumps.
- `QueryEngine`: dependency-captured reactive queries with touched-key invalidation.
- `Validators` and `StateView`: deterministic intent snapshot transforms into derived slices + diagnostics.
- `InteractionRuntime`: recognizer arena, capture, hit-testing, and ephemeral session state.
- Optional `History`, `EventLog`, `EffectRunner`, and instrumentation (`GraphiteMetrics`).

## How To Use

```ts
import { GraphiteRuntime, asNodeId, asScopeId } from '@loop-kit/graphite-core';

const runtime = new GraphiteRuntime({
    enableHistory: true,
    enableEventLog: true,
    validateMode: 'lazy',
});

runtime.registerValidator('my.facet', (snapshot) => ({
    slice: { nodes: snapshot.listNodeIds() },
    diagnostics: [],
}));

const scope = runtime.getScope(asScopeId('main'));
scope.commitIntentPatch({
    ops: [{ kind: 'setProp', nodeId: asNodeId('n1'), key: 'label', value: 'Node 1' }],
});
```

## How Dock Demonstrates It

`@loop-kit/dock` uses:

- `IntentStore` for dock root/group/tab nodes.
- `OverlayLayer` for drag/drop preview intent.
- `Validator` -> `StateView` for normalized dock tree, layout IR, and diagnostics.
- `InteractionRuntime` + recognizer arena for drag gestures.
- `History` boundaries for undo/redo on docking commits.

## Add A New Facet/System

1. Define schema constants and patch builders in a separate package/module.
2. Implement a validator `(snapshot) => { slice, diagnostics }`.
3. Register it with `runtime.registerValidator('facet.name', validator)`.
4. Optionally register actions/effects that commit patches with explicit `meta.origin`.

## Commands

- `moon run graphite-core:typecheck`
- `moon run graphite-core:test`
- `moon run graphite-core:bench`
- `moon run graphite-core:build`
npm package: @loop-kit/graphite-react
Description: React bindings for Graphite runtime scopes, queries, and interaction input.
Latest version: 0.1.0
Deprecated: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

# @loop-kit/graphite-react

React projection layer for Graphite runtime scopes, queries, state slices, and recognizers.

## Concepts

- `GraphiteProvider`: injects runtime + scope context.
- `useQuery`: subscribes to `QueryEngine` and reruns only on touched deps.
- `useStateSlice`: reads validator-derived `StateView` slices.
- `useDispatch`: dispatches actions, commits intent patches, and manages overlay patches.
- `useRecognizer` + `InputBoundary`: modular high-frequency gesture routing into `InteractionRuntime`.

## How To Use

```tsx
import { GraphiteRuntime, asScopeId } from '@loop-kit/graphite-core';
import { GraphiteProvider, InputBoundary, useStateSlice } from '@loop-kit/graphite-react';

const runtime = new GraphiteRuntime();
const scopeId = asScopeId('main');

function View() {
    const dock = useStateSlice('dock');
    return <pre>{JSON.stringify(dock, null, 2)}</pre>;
}

export function App() {
    return (
        <GraphiteProvider runtime={runtime} scopeId={scopeId}>
            <InputBoundary>
                <View />
            </InputBoundary>
        </GraphiteProvider>
    );
}
```

## How Dock Demonstrates It

`@loop-kit/dock` uses these bindings directly:

- `DockView` renders from `useStateSlice(DOCK_FACET)`.
- `InputBoundary` streams pointer/key events to drag recognizers.
- `useRecognizer(createDragTabRecognizer())` registers docking interaction logic.

## Add A New Facet/System

1. Register your validator on the runtime.
2. Read the facet with `useStateSlice('facet.name')` or `useQuery(...)`.
3. Wire interaction commands through `useDispatch`.
4. Keep durable changes in commits; keep transient previews in overlay patches.

## Commands

- `moon run graphite-react:typecheck`
- `moon run graphite-react:build`
npm package: @loop-kit/graphite-systems
Description: Reusable Graphite facets, actions, and system-level policies.
Latest version: 0.1.0
Deprecated: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

# @loop-kit/graphite-systems

Reusable facet modules and action registry for Graphite runtime hosts.

## Concepts

- `ActionRegistry`: register/invoke action IDs with `when` predicates and `run` handlers.
- Facets are plain modules with:
  - schema constants
  - helper queries
  - patch builders
  - validators (`slice + diagnostics`)
  - optional policy helpers
- Included facet modules:
  - `editing` with `edit.delete` (trait-routed).
  - `docking` skeleton (shared constants + helpers used by dock package).

## How To Use

```ts
import { ActionRegistry, editingFacet } from '@loop-kit/graphite-systems';

const actions = new ActionRegistry();
editingFacet.registerEditingActions(actions);
```

## How Dock Demonstrates It

`@loop-kit/dock` consumes Graphite idioms end-to-end and can share schema/policy conventions with system facets. The docking skeleton in this package intentionally stays lightweight while full behavior lives in the dock package.

## Add A New Facet/System

1. Create a new folder under `src/facets/<name>/`.
2. Add `schema.ts`, `queries.ts`, `patchBuilders.ts`, and `validate.ts`.
3. Export the facet from `src/facets/index.ts`.
4. Register actions in `ActionRegistry` if keyboard/palette dispatch is needed.

## Commands

- `moon run graphite-systems:typecheck`
- `moon run graphite-systems:build`
npm package: @loop-kit/loop-cli
Description: Loop command line interface.
Latest version: 0.1.1

# @loop-kit/loop-cli

CLI presentation layer for `@loop-kit/loop-kernel`.

## Commands (v0)

- `loop init`
- `loop doctor`
- `loop fix`
- `loop graph`
- `loop new app|pkg <name>`
- `loop add|update|diff <component-ref>`
- `loop extract <path> --as <component-id>`
- `loop lane list|add|auth`
- `loop toolchain status|sync`

Global option:

- `--cwd <path>` to run against another workspace root

## Package Tasks

- `pnpm build`
- `pnpm typecheck`
- `pnpm test`
npm package: @loop-kit/loop-contracts
Description: Shared contracts and schemas for loop kernel and CLI.
Latest version: 0.1.0

# @loop-kit/loop-contracts

Shared loop wire contracts and schemas.

## Includes

- `loop.json` workspace schema
- `loop.component.json` and `loop.module.json` schemas
- Patch Plan IR and operation schemas
- Provider wire request/response schemas
- Ref parsing contracts (`local:`, `file:`, `git:`, `http(s):`, `loop://`, `npm:`)
- Result/diagnostic envelopes and lockfile schemas

## Usage

```ts
import { LoopWorkspaceConfigSchema, parseLoopRef } from '@loop-kit/loop-contracts';

const config = LoopWorkspaceConfigSchema.parse(rawConfig);
const ref = parseLoopRef('local:ui-button');
```

## Package Tasks

- `pnpm build`
- `pnpm typecheck`
- `pnpm test`
npm package: @loop-kit/loop-kernel
Description: Loop kernel runtime and patch engine.
Latest version: 0.1.0

# @loop-kit/loop-kernel

Library-first loop kernel runtime.

## Design

- No CLI I/O assumptions (no prompts, no terminal formatting, no `process.exit`)
- Structured results (`Result`, diagnostics, patch plans, graph model)
- Provider host for lane/patch/toolchain capabilities
- Deterministic patch executor with dry-run diff support
- Loop patch IR stays independent but leaves adapter seams for future Graphite integration

## Built-in v0 Capabilities

- Lanes: `local`, `file`, `git` stub, `http` stub
- Commands/services: init, doctor/fix, graph, new app/pkg, add/update/diff/extract, lane, toolchain
- Toolchain adapter: TypeScript

## Usage

```ts
import { createKernel } from '@loop-kit/loop-kernel';

const kernel = createKernel({ workspaceRoot: process.cwd() });
const doctor = await kernel.doctor();
if (doctor.ok) {
    console.log(doctor.value.diagnostics);
}
```

## Package Tasks

- `pnpm build`
- `pnpm typecheck`
- `pnpm test`
npm package: @loop/scandium
Description: > Easily deploy any Node.js web server to AWS Lambda.
Latest version: 1.0.0-next.1

# Scandium

> Easily deploy any Node.js web server to AWS Lambda.

Scandium can deploy your Express, Koa or similar app to lambda, without any modifications to your code. Combined with AWS API Gateway you can have your current API running serverless in no time 😎

## Installation

```sh
npm install --global scandium
```

## Usage

To create a new Lambda function, use the `scandium create` command. This will package your application and upload it to AWS Lambda, as well as configure an API Gateway in front of your function.

```sh
scandium create --name=my-awesome-api --deploy-to=prod
```

You should now be presented with a url where you can access your api.

> Now serving live requests at: https://xxxxxxxxxx.execute-api.us-west-2.amazonaws.com/prod

Whenever you make changes to your app, you can upload a new version of it by using the `scandium update` command. This will package your application again, and upload it as a new version to the specified Lambda function. It will also update the configuration of the API Gateway to point at the new function.

```sh
scandium update --name=my-awesome-api --deploy-to=prod
```

## Tutorials

- [Deploying a Next.js app to AWS Lambda](https://medium.com/@LinusU/deploying-a-next-js-app-to-aws-lambda-4dcdd233f876)

## API Gateway

By default, Scandium will set up an API Gateway that simply forwards all requests to the Lambda function. If you want to utilise the benefits of API Gateway fully, you can provide a Swagger file describing your API endpoints. Pass the `--swagger=my-api-definition.yml` to either the `create` or `update` command and Scandium will configure the API Gateway for you.

## `prepare`-scripts

Scandium has support for `prepare` scripts, if the script is present in the `package.json` it will make sure that the script is being run with full `devDependencies` installed. The final package being uploaded to Lambda will still only contain the production `dependencies`.
npm package: @loop8id/auth-express
Description: Express middleware for Loop8ID / L8P8 OpenID Connect authentication
Latest version: 1.0.3

# @loop8id/auth-express

Express middleware for [Loop8ID](https://auth.l8p8.com) OpenID Connect authentication.

---

## Installation

```bash
npm install @loop8id/auth-express @loop8id/auth-node-js
```

---

## Quick Start

```ts
import express from 'express';
import { authRouter, requireAuth, optionalAuth } from '@loop8id/auth-express';

const AUTH = {
  clientId:      process.env.L8P8_CLIENT_ID!,
  sessionSecret: process.env.SESSION_SECRET!,   // min 32 chars
  redirectUri:   'http://localhost:3000/auth/callback',
};

const app = express();

// ── Mount auth routes ──────────────────────────────────────────────────────
// GET /auth/login    → builds PKCE redirect
// GET /auth/callback → exchanges code, sets session cookie
// GET /auth/logout   → clears session, redirects to OIDC end_session
app.use(authRouter(AUTH));

// ── Protected page route ───────────────────────────────────────────────────
app.get('/dashboard', requireAuth(AUTH), (req, res) => {
  res.json({ user: req.user });
});

// ── Protected API route (401 JSON, no redirect) ────────────────────────────
app.get('/api/me', requireAuth({ ...AUTH, apiMode: true }), (req, res) => {
  res.json({ user: req.user, token: req.tokenSet?.accessToken });
});

// ── Public route with optional auth ───────────────────────────────────────
app.get('/', optionalAuth(AUTH), (req, res) => {
  res.json({ isAuthenticated: req.isAuthenticated(), user: req.user ?? null });
});

app.listen(3000);
```

---

## Options

All `@loop8id/auth-node-js` options, plus:

| Option | Default | Description |
|---|---|---|
| `loginPath` | `/auth/login` | Login route path |
| `callbackPath` | `/auth/callback` | Callback route path |
| `logoutPath` | `/auth/logout` | Logout route path |
| `afterLoginPath` | `/` | Redirect after login (if no `returnTo` stored) |
| `afterLogoutPath` | _(OIDC end_session)_ | Redirect after logout |
| `apiMode` | `false` | Return 401 JSON instead of redirecting |

---

## Request Properties

After `requireAuth` or `optionalAuth`, the following are available on `req`:

```ts
req.user            // UserClaims | undefined
req.tokenSet        // TokenSet | undefined
req.isAuthenticated() // boolean
```

---

## TypeScript — Register .env

```env
L8P8_CLIENT_ID=your-client-id
SESSION_SECRET=at-least-32-random-characters
```

---

## License

MIT © Loop8ID
npm package: @loopauth/next
Description: > The LoopAuth Next.js SDK written in TypeScript.
Author: TY
Latest version: 0.7.3

# LoopAuth Next.js SDK

> The LoopAuth Next.js SDK written in TypeScript.

## Installation

### Using npm

```bash
npm install @loopauth/next
```

### Using yarn

```bash
yarn add @loopauth/next
```

### Using pnpm

```bash
pnpm add @loopauth/next
```

## Get sample

A sample project can be found at [Next.js Sample](https://github.com/betaly/loopauth-js/tree/master/examples/next-app)

Check out the source code and try it with ease.

```bash
yarn && yarn dev
```
npm package: @loopback/apiconnect
Description: An extension for IBM API Connect
Author: IBM Corp. and LoopBack contributors
Latest version: 0.14.11

# @loopback/apiconnect

This module extends LoopBack with the ability to integrate with
[IBM API Connect](https://www.ibm.com/cloud/api-connect). It comes with an
`ApiConnectComponent` that adds an `OASEnhencer` extension to contribute
`x-ibm-configuration` to the OpenAPI spec generated by LoopBack applications.

## Stability: ⚠️Experimental⚠️

> Experimental packages provide early access to advanced or experimental
> functionality to get community feedback. Such modules are published to npm
> using `0.x.y` versions. Their APIs and functionality may be subject to
> breaking changes in future releases.

## Installation

```sh
npm i @loopback/apiconnect --save
```

## Usage

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

Start by importing the component class:

```ts
import {ApiConnectComponent} from '@loopback/apiconnect';
```

In the constructor, add the component to your application:

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

The component requires a configuration for API Connect extension for OpenAPI
spec. The `targetUrl` tells API Connect gateway where the REST APIs are served.

```ts
const apiConnectOptions: ApiConnectSpecOptions = {
  targetUrl: 'http://localhost:3000/test-service',
};
app
  .configure(ApiConnectBindings.API_CONNECT_SPEC_ENHANCER)
  .to(apiConnectOptions);
```

## 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/booter-lb3app
Description: A booter component for LoopBack 3 applications to expose their REST API via LoopBack 4
Author: IBM Corp. and LoopBack contributors
Latest version: 7.0.11

# @loopback/booter-lb3app

Boot a LoopBack 3 application and expose its REST API via LoopBack 4.

## Overview

The `@loopback/booter-lb3app` package provides a way for LoopBack 3 developers
to boot their LoopBack 3 application, convert the application's Swagger spec
into OpenAPI v3, and then mount the application, including its spec, onto a
target LoopBack 4 application.

## Installation

```sh
npm install --save @loopback/booter-lb3app
```

## Basic use

Import the component at the top of your `src/application.ts` file.

```ts
import {Lb3AppBooterComponent} from '@loopback/booter-lb3app';
```

Register the component in Application's constructor:

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

By default, the LoopBack 3 models and datasources will be bond to the
application with naming conventions as:

- binding key for datasources: `lb3-datasources.{ds name}`
- binding key for models: `lb3-models.{model name}`

## 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/cli
Description: Yeoman generator for LoopBack 4
Author: IBM Corp. and LoopBack contributors
Latest version: 7.0.12

# @loopback/cli

This module contains the official CLI for LoopBack 4.

## Installation

Run the following command to install the CLI.

```
$ npm install -g @loopback/cli
```

## Basic Use

Run `lb4 --commands` or `lb4 -l` to list all available commands:

```
$ lb4 -l
```

Use the option `--help` to learn more about any specific command:

```
$ lb4 model --help
```

Run `lb4` or `lb4 app` to scaffold a new LoopBack 4 project.

```
$ lb4 app
? Project name: my-awesome-app
(etc.)
```

Use `lb4 --version` (or `lb4 -v`) to print out version information to include in
bug reports, for example:

```
$ lb4 -v
@loopback/cli version: 1.8.1

@loopback/* dependencies:
  - @loopback/authentication: ^1.0.14
  - @loopback/boot: ^1.0.14
  - @loopback/build: ^1.3.1
  - @loopback/context: ^1.6.0
  - @loopback/core: ^1.1.7
  - (etc.)
```

See [CLI reference](https://loopback.io/doc/en/lb4/Command-line-interface.html)
for a detailed documentation.

## 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/context-explorer
Description: Visualize context hierarchy, bindings, configurations, and dependencies
Author: IBM Corp. and LoopBack contributors
Latest version: 0.12.11

# @loopback/context-explorer

This module contains a component adding a Context Explorer to LoopBack
applications.

## Stability: ⚠️Experimental⚠️

> Experimental packages provide early access to advanced or experimental
> functionality to get community feedback. Such modules are published to npm
> using `0.x.y` versions. Their APIs and functionality may be subject to
> breaking changes in future releases.

## Installation

```sh
npm install --save @loopback/context-explorer
```

## Basic use

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

Start by importing the component class:

```ts
import {ContextExplorerComponent} from '@loopback/context-explorer';
```

In the constructor, add the component to your application:

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

By default, API Explorer is mounted at `/context-explorer`. This path can be
customized via ContextExplorer configuration as follows:

```ts
this.configure(ContextExplorerBindings.COMPONENT).to({
  path: '/context-ui',
});
```

## Endpoints

The following endpoints are added by the component.

1. `/context-explorer/inspect`: Fetch a JSON document for the context hierarchy.

   The following query parameters are supported:
   - includeParent: include parent contexts (default: `true`)
   - includeInjections: include injections (default: `true`)
   - includeGraph: include a graph in [graphviz](https://www.graphviz.org/) dot
     format (default: `true`)

2. `/context-explorer/graph`: Render the LoopBack application as a SVG diagram.

   The following query parameters are supported:
   - includeParent: include parent contexts (default: `true`)
   - includeInjections: include injections (default: `true`)
   - format: `dot` or `svg` (default: `svg`)

3. `/context-explorer`: Display the graph using
   [d3-graphviz](https://github.com/magjac/d3-graphviz).

## Sample graph

![graph.svg](sample-graph.svg)

## 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/core
Description: Define and implement core constructs such as Application and Component
Author: IBM Corp. and LoopBack contributors
Latest version: 7.0.10

# @loopback/core

LoopBack makes it easy to build modern applications that require complex
integrations.

## Overview

- Fast, small, powerful, extensible core
- Generate real APIs with a single command
- Define your data and endpoints with OpenAPI
- No maintenance of generated code

## Installation

```shell
$ npm install --save @loopback/core
```

## Basic Use

`@loopback/core` provides the foundation for your LoopBack app, but unlike
previous versions, it no longer contains the implementation for listening
servers.

For a typical example of how to create a REST server with your application, see
the
[@loopback/rest package.](https://github.com/loopbackio/loopback-next/tree/master/packages/rest)

## Advanced Use

Since `@loopback/core` is decoupled from the listening server implementation,
LoopBack applications are now able to work with any component that provides this
functionality.

```ts
// index.ts
import {Application} from '@loopback/core';
import {RestComponent} from '@loopback/rest';
import {GrpcComponent} from '@loopback/grpc';

const app = new Application({
  rest: {
    port: 3000,
  },
  grpc: {
    port: 3001,
  },
});
app.component(RestComponent); // REST Server
app.component(GrpcComponent)(
  // GRPC Server

  async function start() {
    // Let's retrieve the bound instances of our servers.
    const rest = await app.getServer<RestServer>('RestServer');
    const grpc = await app.getServer<GrpcServer>('GrpcServer');

    // Define all sorts of bindings here to pass configuration or data
    // between your server instances, define controllers and datasources for them,
    // etc...
    await app.start(); // This automatically spins up all your servers, too!
    console.log(`REST server running on port: ${rest.getSync('rest.port')}`);
    console.log(`GRPC server running on port: ${grpc.getSync('grpc.port')}`);
  },
)();
```

In the above example, having a GRPC server mounted on your Application could
enable communication with other GRPC-enabled microservices, allowing things like
dynamic configuration updates.

## 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/dist-util
Description: Select dist directory based on Node.js major version.
Author: IBM
Latest version: 0.4.0

# @loopback/dist-util

**This package is no longer actively maintained.**

Please upgrade your project to use a single compilation target, for example by
changing your `build` script in `package.json` as follows:

```json
{
  "scripts": {
    "build": "lb-tsc es2017 --outDir dist"
  }
}
```

## Overview

Utilities to work with `dist` folders used by different Node.js versions.

| version | directory       |
| ------- | --------------- |
| 6.x LTS | _not supported_ |
| 8.x LTS | `dist8`         |
| 9.x     | `dist8`         |
| 10.x    | `dist10`        |
| newer   | `dist10`        |

## Installation

Run the following command to install this package:

```
$ npm install @loopback/dist-util
```

## Basic Use

Configure your TypeScript build to produce two distribution versions:

- `dist8` compiled for `es2017` target
- `dist10` compiled for `es2018` target

Put the following line to your main `index.js` file:

```js
module.exports = require('@loopback/dist-util').loadDist(__dirname);
// calls `require(__dirname + '/dist8')` or `require(__dirname + '/dist10')`
```

It is also possible to obtain the name of the correct `dist` directory without
loading the dist files:

```js
const dist = require('@loopback/dist-util').getDist();
console.log(dist);
// prints `dist8` or `dist10`
```

## Contributions

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

## Contributors

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

## License

MIT
npm package: @loopback/docs
Description: Documentation files rendered at [https://loopback.io](https://loopback.io)
Author: IBM Corp. and LoopBack contributors
Latest version: 8.0.12

# LoopBack 4 documentation

This package contains documentation for LoopBack 4. It's published to npm as
[@loopback/docs](https://www.npmjs.com/package/@loopback/docs).

## Documentation site

The `site` directory contains pages for documentation published at
[loopback.io](http://loopback.io/doc/en/lb4/index.html).

The content is organized along four quadrants as explained in
[How is our documentation organized](./site/index.md#how-is-our-documentation-organized).

To contribute, please check out
[Contributing to LoopBack documentation](https://loopback.io/doc/en/contrib/doc-contrib.html)
and [Developing Documentation](./site/DEVELOPING.md#documentation).

## API references

The API docs are generated by running `npm run tsdocs` at the root directory of
[loopback-next](https://github.com/loopbackio/loopback-next). The task is run as
part of the release process. Official
[API references](https://loopback.io/doc/en/lb4/apidocs.index.html) is served
from [loopback.io](https://www.loopback.io) web site.
npm package: @loopback/example-access-control-migration
Description: Tutorial example on how to migrate the access control example with LoopBack 4.
Author: IBM Corp. and LoopBack contributors
Latest version: 8.0.12

# @loopback/example-access-control-migration

This example is migrated from
[loopback-example-access-control](https://github.com/loopbackio/loopback-example-access-control),
and uses the authentication and authorization system in LoopBack 4 to implement
the access control.

## Overview

This tutorial demonstrates how to implement a RBAC(Role Based Access Control)
system and provides 5 endpoints to test different role's permissions. The
tutorial of building it from a dummy application documented in
[auth-example-migration-tutorial](https://loopback.io/doc/en/lb4/migration-auth-access-control-example.html)

## 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
```

## Try it out

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

```sh
  $ npm start

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

Then try different roles' permissions by following the
[try it out section](https://github.com/loopbackio/loopback-next/blob/auth-migration/docs/site/migration/auth/migration-auth-access-control-example.md#try-it-out)

### 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-express-composition
Description: LoopBack 4 REST API on Express
Author: IBM Corp. and LoopBack contributors
Latest version: 8.0.11

# @loopback/example-express-composition

This is an example of how to mount LoopBack 4 REST API on a simple
[Express](https://expressjs.com) application.

## 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

Once you're ready to start, you can begin by visiting the
[tutorial](http://loopback.io/doc/en/lb4/express-with-lb4-rest-tutorial.html)
page.

## Try it out

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

### Generate the example using CLI

1. Run the `lb4 example` command to select and clone the `express-composition`
   repository:

   ```sh
   lb4 example express-composition
   ```

2. Jump into the directory and then install the required dependencies:

   ```sh
   cd loopback4-example-express-composition
   ```

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.

## Tests

Run `npm test` from the root folder.

## License

MIT
npm package: @loopback/example-file-transfer
Description: Example application for file upload/download with LoopBack 4
Author: IBM Corp. and LoopBack contributors
Latest version: 7.0.11

# @loopback/example-file-transfer

An example application to demonstrate file uploads and downloads for LoopBack 4

## Summary

This application exposes `POST /files` endpoint that accepts
`multipart/form-data` based file uploads. The uploaded files can be listed using
`GET /files` and individual files can be downloaded using
`GET /files/<filename>`.

## Key artifacts

- [FileUploadController](src/controllers/file-upload.controller.ts)
  - Expose `POST /files` endpoint to allow file uploads

- [FileUploadService - an Express middleware from multer](src/services/file-upload.service.ts)
  - A service provider that returns a configured `multer` request handler

    The file upload is configured with `multer` options in
    [src/application.ts](src/application.ts) as follows:

    ```ts
    // Configure file upload with multer options
    const multerOptions: multer.Options = {
      storage: multer.diskStorage({
        // Upload files to `.sandbox`
        destination: path.join(__dirname, '../.sandbox'),
        // Use the original file name as is
        filename: (req, file, cb) => {
          cb(null, file.originalname);
        },
      }),
    };
    this.configure(FILE_UPLOAD_SERVICE).to(multerOptions);
    ```

- [FileDownloadController](src/controllers/file-download.controller.ts)
  - Expose `GET /files` endpoint to list uploaded files
  - Expose `GET /files/{filename}` endpoint to download a file

## Use

Start the app:

```sh
npm start
```

The application will start on port `3000`. Open http://localhost:3000 in your
browser. You can try to upload a few files using the web UI or API explorer.

![upload-download](upload-download.png)

By default, the uploaded files will be stored in `.sandbox` folder under the
application root directory. The directory can be configured via
`fileStorageDirectory` of application config.

## 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-graphql
Description: GraphQL Example Application
Author: IBM Corp. and LoopBack contributors
Latest version: 0.13.1

# @loopback/example-graphql

An example application to demonstrate GraphQL integration for LoopBack 4 using
[@loopback/graphql](https://github.com/loopbackio/loopback-next/tree/graphql/extensions/graphql).

## Try it out

```sh
npm start
```

You should see the following messages:

```sh
Server is running at http://[::1]:3000
Try http://[::1]:3000/graphql
```

Open http://127.0.0.1:3000/graphql in your browser to play with the GraphiQL.

![graphql-demo](graphql-demo.png)

1. Copy the query to the right panel:

```graphql
query GetRecipe1 {
  recipe(recipeId: "1") {
    title
    description
    ratings
    creationDate
    ratingsCount(minRate: 2)
    averageRating
    ingredients
    numberInCollection
  }
}
```

2. Click on the run icon:

```json
{
  "data": {
    "recipe": {
      "title": "Recipe 1",
      "description": "Desc 1",
      "ratings": [0, 3, 1],
      "creationDate": "2018-04-11T00:00:00.000Z",
      "ratingsCount": 1,
      "averageRating": 1.3333333333333333,
      "ingredients": ["one", "two", "three"],
      "numberInCollection": 1
    }
  }
}
```

## 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-greeting-app
Description: An example greeting application for LoopBack 4
Author: IBM Corp. and LoopBack contributors
Latest version: 8.0.11

# @loopback/example-greeting-app

This application is built on top of
[`@loopback/example-greeter-extension`](https://github.com/loopbackio/loopback-next/tree/master/examples/greeter-extension).

## Compose the application

1. Add REST API
   - GreetingController - providing endpoints over `GreetingService`

2. Add caching
   - CachingService - implementing cache operations, such as set,get, delete,
     and sweep
   - CachingInterceptor - intercepting http requests to apply caching
   - CacheObserver - watching and sweeping cache in the background

![greeting-app](./greeting-app.png)

## Contributions

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

## Try out

Run `npm start`:

The service is running at http://127.0.0.1:3000/greet/world.

Open your browser to try the REST APIs. You can replace `world` with other
names.

The following `curl` command sets `Accept-Language` header to `zh` to receive
the greeting in Chinese.

```sh
curl -H 'Accept-Language: zh' http://127.0.0.1:3000/greet/Ray
```

```json
{
  "timestamp": "2019-05-29T22:48:03.040Z",
  "language": "zh",
  "greeting": "Ray，你好！"
}
```

## 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-hello-world
Description: A simple hello-world Application using LoopBack 4
Author: IBM Corp. and LoopBack contributors
Latest version: 8.0.11

# @loopback/example-hello-world

A simple hello-world application using LoopBack 4!

## Summary

This project shows how to write the simplest LoopBack 4 application possible.
Check out
[src/application.ts](https://github.com/loopbackio/loopback-next/blob/master/examples/hello-world/src/application.ts)
to learn how we configured our application to always respond with "Hello
World!".

## Prerequisites

Before we can begin, you'll need to make sure you have some things installed:

- [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)
- [npm](https://www.npmjs.com/)
- [REST](https://en.wikipedia.org/wiki/Representational_state_transfer)

## Installation

1.  Install the new loopback CLI toolkit.

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

2.  Download the "hello-world" application.

```sh
lb4 example hello-world
```

3.  Switch to the directory.

```sh
cd loopback4-example-hello-world
```

## Use

Start the app:

```sh
npm start
```

The application will start on port `3000`. Use your favourite browser or REST
client to access any path with a GET request, and watch it return
`Hello world!`.

## 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-metrics-prometheus
Description: An example to illustrate metrics provided by @loopback/metrics and Prometheus
Author: IBM Corp. and LoopBack contributors
Latest version: 0.15.11

# @loopback/example-metrics-prometheus

This project contains an example to illustrate metrics provided by
[`@loopback/metrics`](https://github.com/loopbackio/loopback-next/blob/master/extensions/metrics)
and [Prometheus](https://prometheus.io/).

## Use

```sh
npm start
```

To run full demo:

```sh
npm run demo
```

Now let's generate some traffic:

http://127.0.0.1:3000/greet/world?count=50

The metrics is reported at http://127.0.0.1:3000/metrics.

Open http://localhost:9090 for the Prometheus Web UI.

![Prometheus Demo](prometheus-demo.png)

## 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-references-many
Description: Example of the references many relation in LoopBack 4.
Author: IBM Corp. and LoopBack contributors
Latest version: 9.0.11

# @loopback/example-references-many

## Try it out

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

    ```sh
    lb4 example references-many
    ```

2.  Switch to the directory.

    ```sh
    cd loopback4-example-references-many
    ```

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.

### 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-rest-crud
Description: An example showing how to use @loopback/rest-crud to define default repository and controller classes
Author: IBM Corp. and LoopBack contributors
Latest version: 7.0.11

# @loopback/example-rest-crud

This is a basic example demonstrating how to use the default CRUD REST
repository and controller with a single model class and datasource.

## Overview

The
[Todo example](https://github.com/loopbackio/loopback-next/tree/master/examples/todo)
can be simplified to use the default repository and controller classes provided
by `@loopback/rest-crud`. With this package, there's no longer a need to define
a repository or controller class for a model.

Given a `Todo` model and `db` datasource, create
`src/model-endpoints/todo.rest-config.ts` and add the following configuration to
it:

```ts
import {ModelCrudRestApiConfig} from '@loopback/rest-crud';
import {Todo} from '../models';

module.exports = <ModelCrudRestApiConfig>{
  model: Todo,
  pattern: 'CrudRest',
  dataSource: 'db',
  basePath: '/todos',
};
```

The `pattern` `CrudRest` means it will use the default CRUD REST repository and
controller classes. The `dataSource` should correspond to the datasource you
want to use with this model. Finally, the `basePath` should refer to the base
path the controller will use.

Add the following import to `src/application.ts`:

```ts
import {CrudRestComponent} from '@loopback/rest-crud';
```

And the following component to the application constructor:

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

And there you go! Now the application should behave almost the same as the Todo
example (with the exception of the geocoder service).

You can run the application by running the following from the root directory:

```
$ npm start

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

## 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-rpc-server
Description: An example RPC server and application to demonstrate the creation of your own custom server
Author: IBM Corp. and LoopBack contributors
Latest version: 8.0.10

# @loopback/example-rpc-server

An example RPC server and application to demonstrate the creation of your own
custom server.

[![powered-by-loopback]](http://loopback.io/)

## Usage

1.  Install the new loopback CLI toolkit.

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

2.  Download the "rpc-server" application.

```sh
lb4 example rpc-server
```

3.  Switch to the directory.

```sh
cd loopback-example-rpc-server
```

4.  Start the app!

```sh
npm start
```

Next, use your favorite REST client to send RPC payloads to the server (hosted
on port 3000).

## Request Format

The request body should contain a controller name, method name and input object.
Example:

```json
{
  "controller": "GreetController",
  "method": "basicHello",
  "input": {
    "name": "Janet"
  }
}
```

The router will determine which controller and method will service your request
based on the given names in the payload.

## 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-soap-calculator
Description: A tutorial demonstrating integration SOAP webservice with LoopBack 4
Author: IBM Corp. and LoopBack contributors
Latest version: 8.0.11

# @loopback/example-soap-calculator

Integrating a Calculator SOAP web service with LoopBack 4.

## Overview

This example project shows how to integrate a SOAP web service with LoopBack 4
and expose its methods through the REST API server. Acceptance and Integration
tests are provided.

Before each step, you will be presented an image containing the artifacts that
you will be creating in blue.

![soap-calculator-overview](https://loopback.io/pages/en/lb4/imgs/loopback-example-soap-calculator_figure1.png)

## Setup

You'll need to make sure you have some things installed:

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

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

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

## Start the Tutorial

Follow the following steps to start building your application:

### Steps

1. [SOAP web service overview](https://loopback.io/doc/en/lb4/soap-calculator-tutorial-web-service-overview.html)
2. [Scaffold the application](https://loopback.io/doc/en/lb4/soap-calculator-tutorial-scaffolding.html)
3. [Add a data source](https://loopback.io/doc/en/lb4/soap-calculator-tutorial-add-datasource.html)
4. [Add a service proxy](https://loopback.io/doc/en/lb4/soap-calculator-tutorial-add-service.html)
5. [Add a controller](https://loopback.io/doc/en/lb4/soap-calculator-tutorial-add-controller.html)
6. [Run and test the application](https://loopback.io/doc/en/lb4/soap-calculator-tutorial-run-and-test.html)

## Try it out

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

### Generate the example using CLI

1. Run the `lb4 example` command to select and clone the soap-calculator
   repository:

```sh
lb4 example soap-calculator
```

2. Jump into the directory and then install the required dependencies:

```sh
cd loopback4-example-soap-calculator
```

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.

## License

MIT