1.0.32 • Published 26 days ago

@rainbow-o23/n2 v1.0.32

Weekly downloads
-
License
MIT
Repository
github
Last release
26 days ago

Static Badge

Nest

Module Formats

o23/n2

In simple terms, o23/n2 is a tool that publishes a given pipeline as a web application using NestJS. In this module, we handle the following tasks:

  • Registering all pipelines and exposing the specified ones as REST APIs,
  • Redirecting logs to standard web log output,
  • Providing standard error handling, where all errors will be caught and processed uniformly,
  • Providing a health check API and a version API,
  • Providing a standard pipeline invocation API. Please note that this API is fully compatible with all data processing pipelines but not with file processing pipelines.

Request

Support request parsing as following:

  • API path,
  • Method,
  • Request headers,
  • Path parameters,
  • Query string parameters,
  • Files,
  • Json body.

The thing to note is that when multiple types of request data are enabled, o23/n2 will degrade and merge them into a single JSON object, and each part has its own naming conventions as follows:

  • Request headers: headers, or given names,
  • Path parameters: pathParams, or given names,
  • Query string parameters: queryParams, or given names,
  • Files: file for single file, files for multiple files, or given names,
  • Json body: body.

Response

Support response outputs as following:

  • Response headers,
  • File download,
  • Json body.

APIs

Health Check

- URL: /
- Method: Get
- Response: { up: true, message: 'Hello there, I am OK now.' }

App Version

- URL: /version
- Method: Get
- Response: { version: 'UNDOCUMENTED', builtAt: 'UNDOCUMENTED' }

Pipeline Trigger

- URL: /pipeline
- Method: Post
- Request: { code: 'string'; payload: 'any' }
- Response: 'any'

The specific data format for the request payload and response depends on the pipeline that needs to be executed.

Referring to the example in o23/scaffold on how to build an application based on o23/n2, won't go into detail here.

Environment Parameters

NameTypeDefault ValueComments
app.portnumber3100Application server port.
app.contextstring/o23Application api context.
app.namestringO23-N99Application name.
app.providerstringRainbow TeamApplication provider.
app.versionstringUNDOCUMENTEDApplication build version.
app.built.atstringUNDOCUMENTEDApplication build time.
app.body.json.max.sizestring50mbRequest maximum body size, for json body.
app.body.urlencoded.max.sizestring50mbRequest maximum body size, for urlencoded body.
app.cors.enabledbooleanfalseEnable cors.
app.cors.optionsjsonCorsOptions of @nestjs/common.
logger.file.enabledbooleanfalseEnable file log.
logger.file.rotate.enabledbooleantrueEnable rotate file log.
logger.error.filestringlogs/error-%DATE%.logError log file.
logger.error.levelstringerrorLogger level for error log file.
logger.error.jsonbooleantrueUse json format.
logger.error.date.patternstringYYYY-MM-DDError log file date pattern.
logger.error.zipped.archivebooleanfalseEnabled zip for error log file.
logger.error.max.filesstring30dError log file keeping time.
logger.error.max.sizestring10mError log file maximum size.
logger.combined.filestringlogs/combined-%DATE%.logStandard log file.
logger.combined.levelstringlogLogger level for standard log file.
logger.combined.jsonbooleantrueUse json format.
logger.combined.date.patternstringYYYY-MM-DDStandard log file date pattern.
logger.combined.zipped.archivebooleanfalseEnabled zip for standard log file.
logger.combined.max.filesstring7dStandard log file keeping time.
logger.combined.max.sizestring10mStandard log file maximum size.
logger.console.enabledbooleanfalseEnable console log.
logger.console.levelstringdebugLogger level for console log.
1.0.32

26 days ago

1.0.31

26 days ago

1.0.30

27 days ago

1.0.29

1 month ago

1.0.28

1 month ago

1.0.27

1 month ago

1.0.26

1 month ago

1.0.25

1 month ago

1.0.24

2 months ago

1.0.23

2 months ago

1.0.22

2 months ago

0.1.21

3 months ago

0.1.21-alpha.2

3 months ago

0.1.21-alpha.1

3 months ago

0.1.20

3 months ago

0.1.16

3 months ago

0.1.17

3 months ago

0.1.18

3 months ago

0.1.19

3 months ago

0.1.15

3 months ago

0.1.10

3 months ago

0.1.11

3 months ago

0.1.12

3 months ago

0.1.13

3 months ago

0.1.14

3 months ago

0.1.9

4 months ago

0.1.8

4 months ago

0.1.7

4 months ago

0.1.6

4 months ago

0.1.5

4 months ago

0.1.4

4 months ago

0.1.3

4 months ago

0.1.2

4 months ago

0.1.2-alpha.3

4 months ago

0.1.2-alpha.2

4 months ago

0.1.2-alpha

4 months ago

0.1.1

4 months ago