Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

32 Commits

Repository files navigation

Orbital TypeScript client

A library to execute TaxiQL queries against the Orbital query server.

Getting started

Install the dependency with

npm install @orbitalhq/orbital-client

and create a file called orbital.config.json to the same folder that contains package.json with the following content:

{
"orbitalServerUrl": "<SCHEMA_SERVER_URL>"
}

where you replace <SCHEMA_SERVER_URL> with the URL of the schema server like http://schema-server.orbital.example.com.

Finally, run

npm run orbital:taxonomy:generate

This will generate a taxonomy file called taxonomy.ts next to package.json. This file should be committed to version control and be updated (by re-running npm run orbital:taxonomy:generate) whenever the schema changes.

Once the taxonomy file is generated, you can initialize the client:

import{asArray,buildClient,consoleLogger,HttpQueryClient}from'orbital-client';import{taxonomy}from'./taxonomy';constclient=buildClient<{},typeoftaxonomy>(taxonomy,newHttpQueryClient('http://localhost:9022'),{logger: consoleLogger,},);

and start executing queries

client.given(taxonomy.people.FirstName,'John').find(asArray(taxonomy.people.Person)).execute().subscribe((result)=>console.log(result[0].firstName));

which sends the following TaxiQL query to be executed on the Orbital server:

given {
people.FirstName = "John"
}
find { people.Person[] }

You can also access this query by calling .toTaxiQL() on the query builder.

constquery=client.given(taxonomy.people.FirstName,'John').find(asArray(taxonomy.people.Person)).toTaxiQl();console.log(query);

About

No description, website, or topics provided.

Resources

Stars

2 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages