Blackbox
Cheatsheet
Ellipsis
Blackbox Project
Use a Blackbox project to build your server.
bb init Initialise a Blackbox project in the current working directory.
bb generate server Generate a Node.js project based on the OpenAPI document.
Blackbox Services
Manage Blackbox services.
bb add service -n <name> --summary \ "<service summary>" Create a Blackbox service and add it to the OpenAPI document.
bb add service -n <name> -s <parent name> \ --summary "<service summary>" Create a Blackbox sub-service and add it to the OpenAPI document.
bb list service Display a list of service paths.
bb update service -n <name> -s <parent name>\ -d <datatype> -m "<HTTP methods>" Update a service's datatype and HTTP methods (-s is optional).
bb delete service -n <name> Delete a Blackbox service from the OpenAPI document.
bb generate service Generate service classes for all service paths in the OpenAPI document.
bb generate privilege -s <service name> Generate a Typescript enumeration for all user privileges of the service.
Datatypes and Repositories
Manage datatypes, repositories and databases.
bb add datatype -n <name> Create a datatype from a local repository or by interactively adding fields if not found.
bb add datatype -n <name> -f <file name> Create a datatype from an OpenAPI schema stored in a file.
bb add repository -u <repository URL> Store a local repository of a remote OpenAPI schema.
bb add repository -f <repository file> Store a local repository of an OpenAPI schema stored in a file.
bb list datatype Display a list datatype schemas in the OpenAPI document.
bb list repository Display a list of local datatype repositories.
bb update datatype -n <name> Reload a datatype from a local repository or interactively add fields if not found.
bb delete datatype -n <name> Delete a datatype from the OpenAPI document.
bb delete repository -u <repository URL> Delete a local datatype repository.
bb delete repository -f <repository file> Delete a local datatype repository.
bb generate datatype Generate Typescript interfaces for all datatypes in the OpenAPI document's schema.
bb generate database -d <datatype name> Generate a Typescript class annotated with @database according to the datatype schema in the OpenAPI document.
Blackbox Annotations
Annotations for simplifying Blackbox server development.
C
@database() Overwrites each of the target class's methods with database access logic. In package blackbox-database. Use with configureDatabase(<mongo db config>)
M
@dbGetList, @dbGetListBy, @dbGet, @dbGetBy,@dbGetListWithQuery, @dbCreate, @dbUpdate, @dbDelete Overwrites the target method with database access logic. In package blackbox-database.
C
@named(name:string = undefined) Creates an instance of the class and associates it with the give name. In package blackbox-ioc.
M
@factory(name:string) Associates the value returned by the factory method with the given name. In package blackbox-ioc.
P
@autowired(name:string) Assigns the instance associated with the given name to the property. In package blackbox-ioc.
C
@serviceClass(tag:string = undefined) Marks a class as providing all services for a given tag. In package blackbox-ioc.
M
@service(name:string) Marks a method as provinding the service with the given name. In package blackbox-ioc.
M
@taggedService(tag:string,name:string) Marks a method as provinding the service for the given tag with the given name. In package blackbox-ioc.
P
@autowiredService(tag:string) Creates an object with functions for each service with tag. In package blackbox-ioc.
C
Class annotation
M
Method annotation
P
Property annotation