Skip to content

ondewo/ondewo-survey-client-nodejs

Repository files navigation

npm version

ONDEWO SURVEY Client NodeJS

Overview

@ondewo/survey-client-nodejs is a compiled version of the ONDEWO SURVEY API using the ONDEWO PROTO COMPILER. Here you can find the SURVEY API documentation.

ONDEWO APIs use Protocol Buffers version 3 (proto3) as their Interface Definition Language (IDL) to define the API interface and the structure of the payload messages. The same interface definition is used for gRPC versions of the API in all languages.

Setup

Using NPM:

npm i --save @ondewo/survey-client-nodejs

Using GitHub:

git clone https://github.com/ondewo/ondewo-survey-client-nodejs.git ## Clone repository
cd ondewo-survey-client-nodejs                                      ## Change into repo-directoy
make setup_developer_environment_locally                         ## Install dependencies

Package structure

npm
├── api
│   ├── google
│   │   ├── api
│   │   │   ├── annotations_grpc_pb.js
│   │   │   ├── annotations_pb.d.ts
│   │   │   └── annotations_pb.js
│   │   └── protobuf
│   │       ├── empty_grpc_pb.js
│   │       ├── empty_pb.d.ts
│   │       ├── empty_pb.js
│   │       ├── field_mask_grpc_pb.js
│   │       ├── field_mask_pb.d.ts
│   │       ├── field_mask_pb.js
│   │       ├── struct_grpc_pb.js
│   │       ├── struct_pb.d.ts
│   │       └── struct_pb.js
│   └── ondewo
│       └── survey
│           ├── fhir_grpc_pb.d.ts
│           ├── fhir_grpc_pb.js
│           ├── fhir_pb.d.ts
│           ├── fhir_pb.js
│           ├── survey_grpc_pb.d.ts
│           ├── survey_grpc_pb.js
│           ├── survey_pb.d.ts
│           └── survey_pb.js
├── LICENSE
├── package.json
├── public-api.d.ts
├── public-api.js
└── README.md

Build

The make build command is dependent on 2 repositories and their speciefied version:

Other than creating the proto-code, build also installs the dev-dependencies and changes the owner of the proto-code-files from root to the current user.

In the case that some google .protos were not automatically generated, exists the option of creating a proto-deps.txt inside of the src folder. There, import statements can be written the same way as they are in .proto files.

import "google/api/http.proto"; //Example
  <---- New Line

⚠️ The last line in the proto-deps.txt needs to be an empty new line, otherwise the compiler will fail

GitHub Repository - Release Automation

The repository is published to GitHub and NPM by the Automated Release Process of ONDEWO.

TODO after PR merge:

  • checkout master
    git checkout master
  • pull newest state
    git pull
  • Adjust ONDEWO_SURVEY_VERSION in the Makefile

  • Add new Release Notes to src/RELEASE.md in following format:
    ## Release ONDEWO Survey Nodejs Client X.X.X    <----- Beginning of Notes
    
    ...<NOTES>...
    
    *****************                             <----- End of Notes
    
  • release
    make ondewo_release

The release process can be divided into 6 Steps:
  1. build specified version of the ondewo-survey-api
  2. commit and push all changes in code resulting from the build
  3. Publish the created npm folder to npmjs.com
  4. Create and push the release branch e.g. release/1.3.20
  5. Create and push the release tag e.g. 1.3.20
  6. Create a new Release on GitHub

⚠️ The Release Automation checks if the build has created all the proto-code files, but it does not check the code-integrity. Please build and test the generated code prior to starting the release process.