diff --git a/extensions/authentication-passport/src/index.ts b/extensions/authentication-passport/src/index.ts index d48135c7fba9..a8f81164e94c 100644 --- a/extensions/authentication-passport/src/index.ts +++ b/extensions/authentication-passport/src/index.ts @@ -3,4 +3,22 @@ // This file is licensed under the MIT License. // License text available at https://opensource.org/licenses/MIT +/** + * An adapter to plug in passport based strategies to the authentication system + * in {@link @loopback/authentication# | @loopback/authentication @3.x }. + * + * @remarks + * {@link @loopback/authentication# | @loopback/authentication @3.x } allows + * users to register authentication strategies that implement the interface + * `AuthenticationStrategy`. + * + * Since AuthenticationStrategy describes a strategy with different contracts + * than the passport Strategy, and we'd like to support the existing 500+ + * community passport strategies, an adapter class is created in this package to + * convert a passport strategy to the one that LoopBack 4 authentication system + * wants. + * + * @packageDocumentation + */ + export * from './strategy-adapter'; diff --git a/extensions/health/src/index.ts b/extensions/health/src/index.ts index e5ec7d547c10..1ebc9be30ce2 100644 --- a/extensions/health/src/index.ts +++ b/extensions/health/src/index.ts @@ -3,6 +3,13 @@ // This file is licensed under the MIT License. // License text available at https://opensource.org/licenses/MIT +/** + * A component to report health status using + * {@link https://github.com/CloudNativeJS/cloud-health | @cloudnative/health }. + * + * @packageDocumentation + */ + export * from './health.component'; export * from './keys'; export * from './types'; diff --git a/extensions/logging/src/decorators/index.ts b/extensions/logging/src/decorators/index.ts index 61992178bdf2..9e2934715887 100644 --- a/extensions/logging/src/decorators/index.ts +++ b/extensions/logging/src/decorators/index.ts @@ -3,4 +3,11 @@ // This file is licensed under the MIT License. // License text available at https://opensource.org/licenses/MIT +/** + * This module contains a component provides logging facilities based on Winston + * and Fluentd. + * + * @packageDocumentation + */ + export * from './logging.decorator'; diff --git a/extensions/logging/src/index.ts b/extensions/logging/src/index.ts index f619551c2239..0987a89fa325 100644 --- a/extensions/logging/src/index.ts +++ b/extensions/logging/src/index.ts @@ -3,6 +3,12 @@ // This file is licensed under the MIT License. // License text available at https://opensource.org/licenses/MIT +/** + * A component provides logging facilities based on + * {@link https://github.com/winstonjs/winston | Winston} and + * {@link https://github.com/fluent/fluent-logger-node | Fluentd}. + */ + export * from './decorators'; export * from './keys'; export * from './logging.component'; diff --git a/extensions/metrics/src/index.ts b/extensions/metrics/src/index.ts index 6eb8e3e1c197..b43da30b9e10 100644 --- a/extensions/metrics/src/index.ts +++ b/extensions/metrics/src/index.ts @@ -3,6 +3,13 @@ // This file is licensed under the MIT License. // License text available at https://opensource.org/licenses/MIT +/** + * A component that reports metrics of Node.js, the LoopBack framework, and your + * application to Prometheus. + * + * @packageDocumentation + */ + export * from 'prom-client'; export * from './keys'; export * from './metrics.component'; diff --git a/packages/authentication/src/index.ts b/packages/authentication/src/index.ts index ccb3a4f27f84..8d07db8625dd 100644 --- a/packages/authentication/src/index.ts +++ b/packages/authentication/src/index.ts @@ -3,6 +3,23 @@ // This file is licensed under the MIT License. // License text available at https://opensource.org/licenses/MIT +/** + * A LoopBack 4 component for authentication support. + * + * @remarks + * The core logic for the authentication layer in LoopBack 4. + * + * It contains: + * + * - A decorator to express an authentication requirement on controller methods + * - A provider to access method-level authentication metadata + * - An action in the REST sequence to enforce authentication + * - An extension point to discover all authentication strategies and handle + * the delegation + * + * @packageDocumentation + */ + export * from './authentication.component'; export * from './decorators'; export * from './keys'; diff --git a/packages/authorization/src/index.ts b/packages/authorization/src/index.ts index 7c1bead268cd..4daad538f0ee 100644 --- a/packages/authorization/src/index.ts +++ b/packages/authorization/src/index.ts @@ -3,6 +3,17 @@ // This file is licensed under the MIT License. // License text available at https://opensource.org/licenses/MIT +/** + * A LoopBack 4 component for authorization support (Role based, Permission + * based, Vote based) + * + * @remarks + * To read on key building blocks read through + * {@link https://loopback.io/doc/en/lb4/Loopback-component-authorization.html |LoopBack authorization docs} + * + * @packageDocumentation + */ + export * from './authorization-component'; export * from './authorize-interceptor'; export * from './decorators/authorize'; diff --git a/packages/boot/src/index.ts b/packages/boot/src/index.ts index f0a332267e96..39789f3f85fb 100644 --- a/packages/boot/src/index.ts +++ b/packages/boot/src/index.ts @@ -3,9 +3,33 @@ // This file is licensed under the MIT License. // License text available at https://opensource.org/licenses/MIT +/** + * A convention based project Bootstrapper and Booters for LoopBack + * Applications. + * + * @remarks + * A Booter is a class that can be bound to an Application and is called to + * perform a task before the Application is started. A Booter may have multiple + * phases to complete its task. The task for a convention based Booter is to + * discover and bind Artifacts (Controllers, Repositories, Models, etc.). + * + * An example task of a Booter may be to discover and bind all artifacts of a + * given type. + * + * A Bootstrapper is needed to manage the Booters and execute them. This is + * provided in this package. For ease of use, everything needed is packages + * using a BootMixin. This Mixin will add convenience methods such as `boot` and + * `booter`, as well as properties needed for Bootstrapper such as + * `projectRoot`. The Mixin also adds the `BootComponent` to your `Application` + * which binds the `Bootstrapper` and default `Booters` made available by this + * package. + * + * @packageDocumentation + */ + +export * from './boot.component'; export * from './booters'; export * from './bootstrapper'; -export * from './boot.component'; export * from './keys'; export * from './mixins'; export * from './types'; diff --git a/packages/booter-lb3app/src/index.ts b/packages/booter-lb3app/src/index.ts index 7df95b7b55b8..ad15c4e9e7e8 100644 --- a/packages/booter-lb3app/src/index.ts +++ b/packages/booter-lb3app/src/index.ts @@ -3,4 +3,16 @@ // This file is licensed under the MIT License. // License text available at https://opensource.org/licenses/MIT +/** + * Boot a LoopBack 3 application and expose its REST API via LoopBack 4. + * + * @remarks + * This 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. + * + * @pakageDocumentation + */ + export * from './lb3app.booter.component'; diff --git a/packages/context/src/index.ts b/packages/context/src/index.ts index 06ba0fdfd745..c447dacd66d8 100644 --- a/packages/context/src/index.ts +++ b/packages/context/src/index.ts @@ -3,6 +3,33 @@ // This file is licensed under the MIT License. // License text available at https://opensource.org/licenses/MIT +/** + * Facilities to manage artifacts and their dependencies using {@link Context} + * in your Node.js applications. It can be used independent of the LoopBack + * framework. + * + * @remarks + * This package exposes TypeScript/JavaScript APIs and decorators to register + * artifacts, declare dependencies, and resolve artifacts by keys. The + * {@link Context} also serves as an IoC container to support dependency + * injection. + * Context and Binding are the two core concepts. A context is a registry of + * bindings and each binding represents a resolvable artifact by the key. + * + * - Bindings can be fulfilled by a constant, a factory function, a class, or a + * provider. + * - Bindings can be grouped by tags and searched by tags. + * - Binding scopes can be used to control how a resolved binding value is + * shared. + * - Bindings can be resolved synchronously or asynchronously. + * - Provide {@link inject | @inject} and other variants of decorators to + * express dependencies. + * - Support Constructor, property, and method injections. + * - Allow contexts to form a hierarchy to share or override bindings. + * + * @pakageDocumentation + */ + export * from '@loopback/metadata'; export * from './binding'; export * from './binding-config'; @@ -22,9 +49,9 @@ export * from './interception-proxy'; export * from './interceptor'; export * from './interceptor-chain'; export * from './invocation'; +export * from './json-types'; export * from './keys'; export * from './provider'; export * from './resolution-session'; export * from './resolver'; export * from './value-promise'; -export * from './json-types'; diff --git a/packages/core/src/index.ts b/packages/core/src/index.ts index 7f8745375cad..d1fcdffab028 100644 --- a/packages/core/src/index.ts +++ b/packages/core/src/index.ts @@ -3,9 +3,18 @@ // This file is licensed under the MIT License. // License text available at https://opensource.org/licenses/MIT +/** + * The foundation of a LoopBack app. + * + * @remarks + * For a typical example of how to create a REST server with your application, + * see the {@link @loopback/rest#} package. + * + * @packageDocumentation + */ + // Re-export public Core API coming from dependencies export * from '@loopback/context'; - // Export APIs export * from './application'; export * from './component'; diff --git a/packages/http-caching-proxy/src/index.ts b/packages/http-caching-proxy/src/index.ts index bf21f3642d0d..ee5a67329f0f 100644 --- a/packages/http-caching-proxy/src/index.ts +++ b/packages/http-caching-proxy/src/index.ts @@ -3,4 +3,36 @@ // This file is licensed under the MIT License. // License text available at https://opensource.org/licenses/MIT +/** + * A caching HTTP proxy for integration tests. + * + * @remarks + * **NOT SUITABLE FOR PRODUCTION USE!** + * + * Testing applications connecting to backend REST/SOAP services can be + * difficult: The backend service may be slow, apply rate limiting, etc. + * Integration tests become too slow in such case, which makes test-first + * development impractical. + * + * This can be addressed by setting up a snapshot-based mock server or using a + * caching HTTP client, but both of these solutions come with severe + * disadvantages: + * + * - When using a snapshot-based mock server, we must ensure that snapshots are + * up-to-date with the actual backend implementation. + * - Caching at HTTP-client side requires non-trivial changes of the application + * code. + * + * A filesystem-backed caching HTTP proxy offers a neat solution that combines + * caching and snapshots: + * + * - The first request is forwarded to the actual backend and the response is + * stored as a snapshot. + * - Subsequent requests are served by the proxy using the cached snaphost. + * - Snapshot older than a configured time are discarded and the first next + * request will fetch the real response from the backend. + * + * @packageDocumentation + */ + export * from './http-caching-proxy'; diff --git a/packages/http-server/src/index.ts b/packages/http-server/src/index.ts index 3a7cdcf1a118..8d2edce27bcc 100644 --- a/packages/http-server/src/index.ts +++ b/packages/http-server/src/index.ts @@ -3,4 +3,13 @@ // This file is licensed under the MIT License. // License text available at https://opensource.org/licenses/MIT +/** + * HTTP / HTTPS server endpoints for LoopBack 4 apps. + * + * @remarks + * A package used by LoopBack 4 for creating HTTP / HTTPS server. + * + * @packageDocumentation + */ + export * from './http-server'; diff --git a/packages/metadata/src/index.ts b/packages/metadata/src/index.ts index 0871e0bcc6c3..5b67d06d862a 100644 --- a/packages/metadata/src/index.ts +++ b/packages/metadata/src/index.ts @@ -3,7 +3,26 @@ // This file is licensed under the MIT License. // License text available at https://opensource.org/licenses/MIT -export * from './types'; -export * from './reflect'; +/** + * A package with utilities to help developers implement + * {@link https://www.typescriptlang.org/docs/handbook/decorators.html |TypeScript decorators}, + * define/merge metadata, and inspect metadata. + * + * @remarks + * Utilities: + * + * - Reflector: Wrapper of + * {@link https://github.com/rbuckton/reflect-metadata | reflect-metadata}. + * - Decorator factories: A set of factories for class/method/property/parameter + * decorators to apply metadata to a given class and its static or instance + * members. + * - MetadataInspector: High level APIs to inspect a class and/or its members to + * get metadata applied by decorators. + * + * @packageDocumentation + */ + export * from './decorator-factory'; export * from './inspector'; +export * from './reflect'; +export * from './types'; diff --git a/packages/model-api-builder/src/index.ts b/packages/model-api-builder/src/index.ts index 384842b00a6c..1b57961e4fb0 100644 --- a/packages/model-api-builder/src/index.ts +++ b/packages/model-api-builder/src/index.ts @@ -3,5 +3,17 @@ // This file is licensed under the MIT License. // License text available at https://opensource.org/licenses/MIT +/** + * A packge with types and helpers for packages contributing Model API builders. + * + * @remarks + * 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. + * + * @packageDocumentation + */ + export * from './model-api-builder'; export * from './model-api-config'; diff --git a/packages/openapi-spec-builder/src/index.ts b/packages/openapi-spec-builder/src/index.ts index 433844262815..cc59b6c7ab85 100644 --- a/packages/openapi-spec-builder/src/index.ts +++ b/packages/openapi-spec-builder/src/index.ts @@ -3,4 +3,22 @@ // This file is licensed under the MIT License. // License text available at https://opensource.org/licenses/MIT +/** + * A package to simplify creating OpenAPI specification documents in your tests + * using the builder pattern. + * + * @remarks + * 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 + * {@link http://www.natpryce.com/articles/000714.html | Test Data Builder pattern} + * to provide a TypeScript/JavaScript API allowing users to create full OpenAPI + * Specification 3 documents in few lines of code. + * + * @packageDocumentation + */ + export * from './openapi-spec-builder'; diff --git a/packages/openapi-v3/src/index.ts b/packages/openapi-v3/src/index.ts index 78990d608742..cdac7f1c4aed 100644 --- a/packages/openapi-v3/src/index.ts +++ b/packages/openapi-v3/src/index.ts @@ -3,6 +3,21 @@ // This file is licensed under the MIT License. // License text available at https://opensource.org/licenses/MIT +/** + * Decorators that describe LoopBack artifacts as OpenAPI 3.0.0 metadata and + * utilities that transfer LoopBack metadata to OpenAPI 3.0.0 specifications. + * + * @remarks + * 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 needed. + * + * @packageDocumentation + */ + export * from '@loopback/repository-json-schema'; export * from './controller-spec'; export * from './decorators'; diff --git a/packages/repository-json-schema/src/index.ts b/packages/repository-json-schema/src/index.ts index 33c8e060dbbc..2f940c6be176 100644 --- a/packages/repository-json-schema/src/index.ts +++ b/packages/repository-json-schema/src/index.ts @@ -3,11 +3,21 @@ // This file is licensed under the MIT License. // License text available at https://opensource.org/licenses/MIT +/** + * Convert a TypeScript class/model to a JSON Schema for users, leveraging + * LoopBack4's decorators, metadata, and reflection system. + * + * @remarks + * Modules to easily convert LoopBack4 models that have been decorated with + * `@model` and `@property` to a matching JSON Schema Definition. + * + * @packageDocumentation + */ + +export {Model} from '@loopback/repository'; export * from './build-schema'; -export * from './keys'; export * from './filter-json-schema'; - -import {JSONSchema6 as JsonSchema} from 'json-schema'; +export * from './keys'; export {JsonSchema}; -export {Model} from '@loopback/repository'; +import {JSONSchema6 as JsonSchema} from 'json-schema'; diff --git a/packages/repository-tests/src/index.ts b/packages/repository-tests/src/index.ts index d42191835d57..c9c352769d65 100644 --- a/packages/repository-tests/src/index.ts +++ b/packages/repository-tests/src/index.ts @@ -3,6 +3,18 @@ // This file is licensed under the MIT License. // License text available at https://opensource.org/licenses/MIT +/** + * A test suite verifying functionality of `@loopback/repository` in a connector + * -independent way. + * + * @remarks + * Test-suite factories to define standardized test suite capable of testing any + * combination of a Repository class and a corresponding connector, for example + * DefaultCrudRepository with connectors like memory, MySQL and MongoDB. + * + * @packageDocumentation + */ + export * from './crud-test-suite'; export * from './types.repository-tests'; diff --git a/packages/repository/src/index.ts b/packages/repository/src/index.ts index 665e24185804..edfdef9f18ae 100644 --- a/packages/repository/src/index.ts +++ b/packages/repository/src/index.ts @@ -3,6 +3,21 @@ // This file is licensed under the MIT License. // License text available at https://opensource.org/licenses/MIT +/** + * A common set of interfaces for interacting with databases. + * + * @remarks + * *NOTE:* This module is experimental and evolving. It is likely going to be + * refactored and decomposed into multiple modules as we refine the story based + * on the legacy loopback-datasource-juggler and connector modules from LoopBack + * 3.x. + * + * This module provides data access facilities to various databases and services + * as well as the constructs for modeling and accessing those data. + * + * @packageDocumentation + */ + export * from './common-types'; export * from './connectors'; export * from './datasource'; diff --git a/packages/rest-crud/src/index.ts b/packages/rest-crud/src/index.ts index 33130144140d..dc9318c2f8c5 100644 --- a/packages/rest-crud/src/index.ts +++ b/packages/rest-crud/src/index.ts @@ -3,6 +3,16 @@ // This file is licensed under the MIT License. // License text available at https://opensource.org/licenses/MIT +/** + * REST API controller implementing default CRUD semantics. + * + * @remarks + * Allows LoopBack 4 applications to quickly expose models via REST API without + * having to implement custom controller or repository classes. + * + * @packageDocumentation + */ + export * from './crud-rest.api-builder'; export * from './crud-rest.component'; export * from './crud-rest.controller'; diff --git a/packages/rest-explorer/src/index.ts b/packages/rest-explorer/src/index.ts index 471009ee66eb..299a6a9a9ae0 100644 --- a/packages/rest-explorer/src/index.ts +++ b/packages/rest-explorer/src/index.ts @@ -3,6 +3,17 @@ // This file is licensed under the MIT License. // License text available at https://opensource.org/licenses/MIT -export * from './rest-explorer.types'; -export * from './rest-explorer.keys'; +/** + * A LoopBack 4 component for adding a self-hosted REST API Explorer. + * + * @remarks + * The component should be loaded in the constructor of your custom Application + * class. Applications scaffolded by recent versions of our lb4 CLI tool have + * the self-hosted REST API Explorer pre-configured out of the box. + * + * @packageDocumentation + */ + export * from './rest-explorer.component'; +export * from './rest-explorer.keys'; +export * from './rest-explorer.types'; diff --git a/packages/rest/src/index.ts b/packages/rest/src/index.ts index 9dbec83df4eb..86ffe5f15b57 100644 --- a/packages/rest/src/index.ts +++ b/packages/rest/src/index.ts @@ -3,6 +3,23 @@ // This file is licensed under the MIT License. // License text available at https://opensource.org/licenses/MIT +/** + * The REST API package for loopback-next. + * + * @remarks + * A REST server for LoopBack 4 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 + * + * + * @packageDocumentation + */ + export * from '@loopback/openapi-v3'; export * from './body-parsers'; export * from './http-handler'; diff --git a/packages/security/src/index.ts b/packages/security/src/index.ts index 0a1fb67dd696..359c3fc7b231 100644 --- a/packages/security/src/index.ts +++ b/packages/security/src/index.ts @@ -3,5 +3,25 @@ // This file is licensed under the MIT License. // License text available at https://opensource.org/licenses/MIT +/** + * Common types/interfaces for LoopBack 4 security including authentication and + * authorization. + * + * @remarks + * - 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. + * + * @packageDocumentation + */ + export * from './keys'; export * from './types'; diff --git a/packages/service-proxy/src/index.ts b/packages/service-proxy/src/index.ts index b3208b41d50c..0585ea298f82 100644 --- a/packages/service-proxy/src/index.ts +++ b/packages/service-proxy/src/index.ts @@ -3,6 +3,13 @@ // This file is licensed under the MIT License. // License text available at https://opensource.org/licenses/MIT -export * from './legacy-juggler-bridge'; +/** + * A common set of interfaces for interacting with service oriented backends + * such as REST APIs, SOAP Web Services, and gRPC microservices. + * + * @packageDocumentation + */ + export * from './decorators/service.decorator'; +export * from './legacy-juggler-bridge'; export * from './mixins'; diff --git a/packages/testlab/src/index.ts b/packages/testlab/src/index.ts index 7a7e1bf489f2..402861b8465b 100644 --- a/packages/testlab/src/index.ts +++ b/packages/testlab/src/index.ts @@ -3,6 +3,27 @@ // This file is licensed under the MIT License. // License text available at https://opensource.org/licenses/MIT +/** + * A collection of test utilities we use to write LoopBack tests. + * + * @remarks + * Test utilities to help write LoopBack 4 tests: + * + * - `expect` - behavior-driven development (BDD) style assertions + * - `sinon` + * - test spies: functions recording arguments and other information for all + * of their calls + * - stubs: functions (spies) with pre-programmed behavior + * - mocks: fake methods (like spies) with pre-programmed behavior + * (like stubs) as well as pre-programmed expectations + * - Helpers for creating `supertest` clients for LoopBack applications + * - HTTP request/response stubs for writing tests without a listening HTTP + * server + * - Swagger/OpenAPI spec validation + * + * @packageDocumentation + */ + export * from './client'; export * from './expect'; export * from './http-error-logger'; diff --git a/packages/tsdocs/src/helper.ts b/packages/tsdocs/src/helper.ts index c149a7c1394c..9d1d1dde604f 100644 --- a/packages/tsdocs/src/helper.ts +++ b/packages/tsdocs/src/helper.ts @@ -11,7 +11,7 @@ const Project = require('@lerna/project'); /** * TypeScript definition for - * {@link https://github.com/lerna/lerna/blob/master/core/package/index.js | Lerna Package) + * {@link https://github.com/lerna/lerna/blob/master/core/package/index.js | Lerna Package} */ export interface LernaPackage { /** diff --git a/packages/tsdocs/src/index.ts b/packages/tsdocs/src/index.ts index 877956258786..03a4f218f656 100644 --- a/packages/tsdocs/src/index.ts +++ b/packages/tsdocs/src/index.ts @@ -4,19 +4,19 @@ // License text available at https://opensource.org/licenses/MIT /** - * @packageDocumentation - * * The `@loopback/tsdocs` package is an internal module to generate * {@link https://github.com/Microsoft/tsdoc | tsdoc} based API docs * for `@loopback/*` packages within * {@link https://github.com/strongloop/loopback-next | loopback-next} monorepo * managed by {@link https://github.com/lerna/lerna | Lerna}. * + * @remarks * It's built on top of {@link https://api-extractor.com | Microsoft API Extractor}: * * - {@link https://github.com/Microsoft/web-build-tools/tree/master/apps/api-extractor | api-extractor} * - {@link https://github.com/Microsoft/web-build-tools/tree/master/apps/api-documenter | api-documenter} * + * @packageDocumentation */ export * from './helper'; export * from './monorepo-api-extractor';