prioritize-client
v1.5.0
Published
Official spec-first TypeScript/JavaScript client for the Prioritize REST API (generated with OpenAPI Generator, typescript-fetch).
Maintainers
Readme
Prioritize TypeScript Client
Official TypeScript/JavaScript client library for the
Prioritize REST API (/api/v1). It is generated from
Prioritize's OpenAPI specification with OpenAPI Generator
(typescript-fetch generator) — the sources are never hand-written, so the client always matches the
contract of the release it targets.
- Runtime: the browser's
fetchand Node.js 18+ (fetchis global there); no runtime dependencies. - Client version tracks the API version: a
1.xclient targets the1.xREST API. - License: Apache-2.0 (same as Prioritize).
Status: generated from the released
1.3.0contract, which is what made resources reachable over REST — the flatGET /api/v1/resources,GET /api/v1/resources/{id}/values/latest, the combinedGET /api/v1/resources/statusand the resource-group listing. It is not yet published to npm — build it locally (see Building) or reference it via a local path.
Installation
Once published:
npm install prioritize-clientUntil then, from a local checkout:
npm install /path/to/prioritize-typescript-client # after `npm run build`Usage
Create a Configuration, point it at your Prioritize instance, add credentials, then call one of the
per-tag API classes (UsersApi, ProjectsApi, TasksApi, ResourcesApi, TelemetryRulesApi,
DocumentsApi, SkillsApi, …). Method names are <tag><OperationId>, e.g.
resourceGetAllResources(), resourceGetLatestValues({ id }).
Basic auth (default / dev profile)
import { Configuration, ResourcesApi } from "prioritize-client";
const config = new Configuration({
basePath: "http://localhost:8080", // the spec paths already carry /api/v1
username: "admin",
password: "p@ssword",
});
const resources = new ResourcesApi(config);
// Flat list of every resource the caller may read
const all = await resources.resourceGetAllResources();
// Latest telemetry value per data point of a resource
const values = await resources.resourceGetLatestValues({ id: all[0].id! });Bearer auth (Keycloak)
const config = new Configuration({
basePath: "https://prioritize.example.com",
accessToken: async () => myKeycloak.token!, // called per request
});Building
The generated npm package (package.json, tsconfig*.json, src/) is committed. To compile it:
npm install
npm run build # tsc -> dist/ (CommonJS) + dist/esm/ (ES modules)Regenerating from a new API release
The client is spec-first. To retarget it at a newer Prioritize release, drop the released
docs/openapi.json in and regenerate — the sources under src/ are overwritten, the hand-maintained
files (this README, LICENSE, pom.xml, generate.sh, .gitignore, openapi/) are preserved via
.openapi-generator-ignore:
./generate.sh /path/to/Prioritize/docs/openapi.jsonThis uses the Maven-based OpenAPI Generator harness (pom.xml) — the only reason Maven is involved; it
is not part of the published package. Remember to bump npmVersion in pom.xml to match the API
release before regenerating.
Releasing (maintainers)
Releases are published to npm by GitHub Actions (.github/workflows/publish.yml) when a v* tag is
pushed. Authentication uses npm Trusted Publishing (OIDC): GitHub mints a short-lived credential for
this repository and workflow, and npm verifies it. There is no NODE_AUTH_TOKEN, no granular access token
to store, and nothing that expires. Trusted publishing also satisfies npm's 2FA requirement, and npm
attaches a provenance attestation to the published package automatically.
# bump npmVersion in pom.xml, regenerate, commit, then:
git tag -a v1.5.0 -m "Release 1.5.0"
git push origin v1.5.0 # the workflow builds and publishesThe workflow refuses to publish if the tag disagrees with version in package.json.
One-time setup
On https://www.npmjs.com/package/prioritize-client/access, under Trusted publishers, add a GitHub Actions publisher:
| Field | Value |
|---|---|
| Organization or user | phaller222 |
| Repository | prioritize-typescript-client |
| Workflow filename | publish.yml |
| Environment | npm |
The environment name must match the environment: key in the workflow; create it under the repository's
Settings → Environments too.
