1.0.59 • Published 7 months ago

@rainbow-o23/n2 v1.0.59

Weekly downloads
-
License
MIT
Repository
github
Last release
7 months 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, - Static exposed response headers, which pre-defined in pipeline, - Authorization related response headers, which returned by authentication pipeline, - Scoped trace ids, which pre-defined in configuration and created/gathered by pipeline steps,
  • 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.auth.enabledbooleanfalseEnable authentication.
app.auth.pipelinestringAuthenticatePipeline code for authentication and authorization.
app.auth.authorization.exposebooleanfalseExpose authorization token into response header or not.
app.auth.authorization.expose.namestringO23-AuthorizationExpose authorization token header name.
app.auth.authentication.exposebooleantrueExpose authentication into response header or not.
app.auth.authentication.expose.namestringO23-AuthenticationExpose authentication header name.
app.auth.roles.exposebooleanfalseExpose authorized roles into response header or not.
app.auth.roles.expose.namestringO23-Authorized-RolesExpose authorized roles header name.
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.
app.schedule.enabledbooleanfalseEnable schedule.
app.schedule.on.clusterbooleanfalseEnable schedule on cluster, usually on production.
app.schedule.max.interval.no.cluster.locknumber3600Maximum interval for schedule without cluster lock.
app.schedule.obtain.cluster.execution.lock.pipelinestringScheduleObtainClusterExecutionLockPipeline code for obtaining cluster execution lock.
app.schedule.job.log.persistbooleanfalseEnable scheduled job log persist.
app.schedule.job.create.pipelinestringScheduleCreateJobPipeline code for creating scheduled job log.
app.schedule.job.result.write.pipelinestringScheduleWriteJobResultPipeline code for writing scheduled job result.
1.0.48

12 months ago

1.0.47

12 months ago

1.0.46

12 months ago

1.0.58-alpha.3

7 months ago

1.0.49

12 months ago

1.0.58-alpha.2

7 months ago

1.0.51

11 months ago

1.0.50

12 months ago

1.0.55

11 months ago

1.0.54

11 months ago

1.0.53

11 months ago

1.0.52

11 months ago

1.0.59

7 months ago

1.0.58

7 months ago

1.0.57

7 months ago

1.0.56

11 months ago

1.0.45

1 year ago

1.0.44

1 year ago

1.0.37

1 year ago

1.0.36

1 year ago

1.0.39

1 year ago

1.0.38

1 year ago

1.0.40

1 year ago

1.0.43

1 year ago

1.0.42

1 year ago

1.0.41

1 year ago

1.0.33

1 year ago

1.0.35

1 year ago

1.0.34

1 year ago

1.0.32

2 years ago

1.0.31

2 years ago

1.0.30

2 years ago

1.0.29

2 years ago

1.0.28

2 years ago

1.0.27

2 years ago

1.0.26

2 years ago

1.0.25

2 years ago

1.0.24

2 years ago

1.0.23

2 years ago

1.0.22

2 years ago

0.1.21

2 years ago

0.1.21-alpha.2

2 years ago

0.1.21-alpha.1

2 years ago

0.1.20

2 years ago

0.1.16

2 years ago

0.1.17

2 years ago

0.1.18

2 years ago

0.1.19

2 years ago

0.1.15

2 years ago

0.1.10

2 years ago

0.1.11

2 years ago

0.1.12

2 years ago

0.1.13

2 years ago

0.1.14

2 years ago

0.1.9

2 years ago

0.1.8

2 years ago

0.1.7

2 years ago

0.1.6

2 years ago

0.1.5

2 years ago

0.1.4

2 years ago

0.1.3

2 years ago

0.1.2

2 years ago

0.1.2-alpha.3

2 years ago

0.1.2-alpha.2

2 years ago

0.1.2-alpha

2 years ago

0.1.1

2 years ago