
Security News
Socket Releases Free Certified Patches for Critical vm2 Sandbox Escape
A critical vm2 sandbox escape can allow untrusted JavaScript to break isolation and execute commands on the host Node.js process.
ruben-ts-client
Advanced tools
For the production of models, schemas and services we are using https://github.com/ferdikoomen/openapi-typescript-codegen. It is a tool we were already using on the dashboard and it overall produces the best results for our use case. There are some adaptations we do the generated services, but they are minimal. We do not export the core client and instead have our own implementations. Models and schemas are currently untouched, but as stated before, the services are touched and updated.
The original services are generated as classes, where each method is a static method.
As an example, to place an order, one would call it as: OrdersService.createOrderByQuantity
A service in the case of openapi schema is a tagGroup, while the method is the operationId.
Both the client configuration (url, headers) and the request operation (how to perform the
API call) are hardcoded/static as well, meaning we perform a createOrderByQuantity always
with the same client configuration and logic to perform the request. This is not ideal since
we might want to provide different implementations or even maybe have multiple clients with
different configurations (using multiple clients for multiple accounts/users for example).
Since we don't have duplicated operationIds, we have agreed to provide all these methods at
the base level of the client, so we do not want to address them via tagGroups.
To accomodate for points above, these changes are made in all generated service files:
config and client as abstract protected consts.static modifiers from methodsconfig and clientCancelablePromise, change OpenAPI to ClientConfig)This allows us to do a bit of a hackish behaviour, and have our client provide the config and
client implementations, and then add all methods of the services to it. It makes all
operationIds present at the base level. We then create an interface on the client that inherits
from all the services, putting the operationIds types in the client class. This is known as
mixin in Typescript.
See for more info: https://www.typescriptlang.org/docs/handbook/mixins.html#alternative-pattern
To make this automatic creation of the client a reality, we emply a strategy where a base_client.ts
is used to generate the final client.ts. The main stages are:
base_client.ts is copied as a base to client.tsindex.ts is appended to client.ts so as to have the models and schemas also at the base level.
This makes it possible to use lune.Mass vs lune.models.Mass. This can only be achieved since
we don't mix names between models, schemas and operations.We currently use Axios to perform the operations and define our config via an interface dedicated to hold it. The core implementation still requires a bit of work, and is still highly based on the original core library since it was quite good tbh.
Check example-usage folder for a basic usage of the library in both TS and JS. But mostly, all you
need is to add it as a dependency, create a new client and use as normally :)
We use docker to make sure all builds are the same. To get a shell inside it, just do:
make shell
Once inside, to fully rebuild the client library from the openapi schema. Just do:
make build-from-schema
If all you want is to check if everything is building, you can use:
make build
or
make build-from-source (checks linting)
Feel free to explore all other commands in the Makefile.
Publishing currently requires manual intervention to up the version. The recommended way is to create a release in github. This will automatically be published to NPM once accepted.
FAQs
A typescript implementation of Rust's Result and Option objects.
The npm package ruben-ts-client receives a total of 3 weekly downloads. As such, ruben-ts-client popularity was classified as not popular.
We found that ruben-ts-client demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

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.

Security News
A critical vm2 sandbox escape can allow untrusted JavaScript to break isolation and execute commands on the host Node.js process.

Research
Five malicious NuGet packages impersonate Chinese .NET libraries to deploy a stealer targeting browser credentials, crypto wallets, SSH keys, and local files.

Security News
pnpm 11 turns on a 1-day Minimum Release Age and blocks exotic subdeps by default, adding safeguards against fast-moving supply chain attacks.