https://github.com/stackb/bzl-sdk-node
SDK for connecting to a Bzl instance via gRPC
https://github.com/stackb/bzl-sdk-node
Last synced: 4 months ago
JSON representation
SDK for connecting to a Bzl instance via gRPC
- Host: GitHub
- URL: https://github.com/stackb/bzl-sdk-node
- Owner: stackb
- License: apache-2.0
- Created: 2020-07-17T19:47:53.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2020-07-21T22:53:35.000Z (over 5 years ago)
- Last Synced: 2025-01-05T11:42:47.228Z (about 1 year ago)
- Language: JavaScript
- Size: 128 KB
- Stars: 1
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# bzl-sdk-node
[](https://www.npmjs.com/package/@stackb/bzl-sdk-node)
This repository contains the generated protobuf/grpc-js definitions for the
[Bzl](https://build.bzl.io) gRPC API as well as a more developer-friendly
index.js entrypoint.
Canonical API definitions are at https://github.com/stackb/apis/tree/master/build/stack/bzl/v1beta
## Usage
```
npm install @stackb/bzl-sdk-node
```
Given a running process (e.g. `bzl serve`), connect to the server and retrieve metadata:
```js
const grpc = require('@grpc/grpc-js');
const v1beta1 = require('@stackb/bzl-sdk-node').v1beta;
const client = new v1beta1.ApplicationClient(
'localhost:1080',
grpc.credentials.createInsecure());
client.waitForReady(4000, () => printMetadata);
function printMetadata() {
const request = new v1beta1.GetApplicationMetadataRequest();
client.getApplicationMetadata(request, (err, metadata) => {
if (err) {
console.warn('could not get metadata', err);
} else {
console.log(`Connected to Bzl ${metadata.getVersion()}`);
}
});
}
```