Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@gobend/jsdk

Package Overview
Dependencies
Maintainers
1
Versions
60
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@gobend/jsdk

SDK for interacting with Bend data types

  • 0.12.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Development

Steps for new developers to get up and running with the Bend data-service

Dependencies

You will need Rust, NodeJS, and a number of other tools to develop properly on the data-service

  1. Rust stable
  2. NodeJS LTS
  3. For formatting, you'll need rustfmt
  • rustup component add rustfmt
Setting up the database
  1. Install diesel for MySQL: cargo install diesel_cli --no-default-features --features mysql
  2. Copy example.env to .env and replace with PlanetScale database details
  3. Run diesel migration run
Seeding Data
Run scripts/seed_factors_and_categories.sql to initialize the following:
  1. Codat Factors
  2. MCC Factors
  3. UNSPSC Factors
  4. Bend categories
  5. Bend category to mcc mappings
Run scripts/seed_db.sql to initialize the following:
  1. a v0 privileged API key for local use
  2. default user accounts
  3. a Bend org with memberships for the users
  4. a simulation bank connection with 9 months of transaction history
Run the service

cargo run

Testing the Docker Image

Run docker run -d -p 8000:8000 --env-file .env [IMAGE ID] to start the containerized api-service in a detached process.

Note that when targeting a PlanetScale database, the containerized service requires that ?ssl_mode=verify_identity&ssl_ca=/etc/ssl/certs/ca-certificates.crt be appended to the DATABASE_URL to specify the Certificate Authority roots for the debian environment. (See DB Connectivity)

Publishing the Image

  1. Install Google Cloud SDK
  2. Ensure you have access to the Container Registrar service account in GCP IAM & Admin
  3. Run gcloud auth login using an account with access to the Container Registrar
  4. Build the image docker build . --tag tcmoore/bend-api-service
  5. Run docker tag tcmoore/bend-api-service gcr.io/bend-330614/api-service (You can find the project id here)
  6. Run docker push gcr.io/bend-330614/api-service

Once logged in, you can also use the publish.sh script.

DB Connectivity

The data-service can be pointed at a remote PlanetScale database, or at a local MySQL server with a DATABASE_URL like mysql://root:@localhost:3306/bend (see the example.env file)

Tunneling to Local API Service

We use ngrok for the purpose of Local Tunneling, such as when testing the Brex integration

Example: ngrok http --region=us --hostname=bend.ngrok.io 8000

Troubleshooting & Notes

  • Models use UUID v4 for primary keys
  • Note that PlanetScale is a UX layer over Vitess, and inherits some limitations from Vitess. This imposes some restrictions on what MySQL features we use; for example, TRIGGERS are not supported. UUID ids therefore must be set at the application level.
  • E0658 Unstable Errors during the Docker build probably indicate an outdated version of Rust in the Dockerfile
  • version `GLIBC_2.29' not found when running the Docker image indicates a mismatched binary between the build container and the runner (both must use the same version of debian). This unexpected failure first occurred in June 2022 likely as a result of building from the latest cargo-chef image—it was resolved by updating the runner to debian bullseye

FAQs

Package last updated on 20 Dec 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc