Skip to content

Commit

Permalink
refactor: import metadata-related APIs from @loopback/core
Browse files Browse the repository at this point in the history
Remove references to `@loopback/metadata`, rework code and docs
to import from `@loopback/core` instead.

Signed-off-by: Miroslav Bajtoš <[email protected]>
  • Loading branch information
bajtos committed Jun 9, 2020
1 parent 4d6bff9 commit d39d007
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 10 deletions.
2 changes: 1 addition & 1 deletion docs/site/Creating-decorators.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ source: loopback-next
file: packages/metadata/README.md
sidebar: lb4_sidebar
permalink: /doc/en/lb4/Creating-decorators.html
summary: A tutorial to use `@loopback/metadata` module to create new decorators
summary: A tutorial to use `@loopback/core` module to create new decorators
---
2 changes: 1 addition & 1 deletion docs/site/tutorials/core/10-advanced-recipes.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ You can create your own
[decorator](https://loopback.io/doc/en/lb4/Decorators.html):

1. Create a new decorator from scratch by using `DecoratorFactory` from
`@loopback/metadata`. See an example in
`@loopback/core`. See an example in
[custom-inject-decorator.ts](https://github.com/strongloop/loopback-next/blob/master/examples/context/src/custom-inject-decorator.ts)

2. Create a sugar decorator for an existing decorator.
Expand Down
11 changes: 7 additions & 4 deletions docs/site/tutorials/core/2-architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,16 @@ LoopBack 4 core is an open source TypeScript platform for Node.js, specializing
in building large scale applications with great flexibility, composability, and
extensibility.

The following key modules are used by the LoopBack framework to offer API and
Microservice capabilities. They can be used independently as a base platform to
build large scale applications in TypeScript and Node.js.
The module [@loopback/core](https://www.npmjs.com/package/@loopback/core) is
used by the LoopBack framework to offer API and Microservice capabilities.

It builds on top of the following lower-level modules:

- [@loopback/metadata](https://www.npmjs.com/package/@loopback/metadata)
- [@loopback/context](https://www.npmjs.com/package/@loopback/context)
- [@loopback/core](https://www.npmjs.com/package/@loopback/core)

Any of these three modules can be used independently as a base platform to build
large scale applications in TypeScript and Node.js.

## Design goals

Expand Down
4 changes: 2 additions & 2 deletions examples/log-extension/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -169,15 +169,15 @@ extension to add extra processing accordingly.

For this extension, the decorator marks which controller methods should be
logged (and optionally at which level they should be logged). We leverage
`@loopback/metadata` module to implement the decorator and inspection function.
`@loopback/core` module to implement the decorator and inspection function.

```ts
import {LOG_LEVEL, EXAMPLE_LOG_BINDINGS} from '../keys';
import {
Constructor,
MethodDecoratorFactory,
MetadataInspector,
} from '@loopback/context';
} from '@loopback/core';
import {LevelMetadata} from '../types';

/**
Expand Down
4 changes: 2 additions & 2 deletions examples/log-extension/src/keys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// License text available at https://opensource.org/licenses/MIT

import {BindingKey} from '@loopback/core';
import {TimerFn, LogFn, LogWriterFn} from './types';
import {LogFn, LogWriterFn, TimerFn} from './types';

/**
* Binding keys used by this component.
Expand All @@ -19,7 +19,7 @@ export namespace EXAMPLE_LOG_BINDINGS {
}

/**
* The key used to store log-related via @loopback/metadata and reflection.
* The key used to store log-related metadata via decorators and reflection.
*/
export const EXAMPLE_LOG_METADATA_KEY = 'example.log.metadata';

Expand Down

0 comments on commit d39d007

Please sign in to comment.