COLNEO infohub JS API
@colneo/infohub-js-api is a JavaScript package that facilitates working with the COLNEO Infohub's REST interface.
It is hosted in our own registry (https://registry.colneo.digital
) and can be installed using common package managers such as npm.
This package provides browser-enabled globals (via /dist
) and an ESM bundle for module-based apps.
Getting started
Prerequisites
- User / Password
One has to login to our registry to access the package.
Request username/password from the COLNEO responsible person - Node.js
Installing and running scripts uses the npm package manager which comes with Node.js.
Use a recent LTS fromhttps://nodejs.org
.
1) Configure npm for the COLNEO registry
Create a .npmrc
file in your project root folder and add:
@colneo:registry=https://registry.colneo.digital/
always-auth=true
strict-ssl=false
save-optional=true
2) Authenticate
Log in to the private registry:
npm login --registry=https://registry.colneo.digital/
3) Install the package
npm install @colneo/infohub-js-api
How to use the package
Use in the browser (global build)
<!-- Global build example (from /dist) -->
<script src="@colneo/infohub-js-api/dist/infohub/InfohubContext.js"></script>
<script src="@colneo/infohub-js-api/dist/infohub/UserServices.js"></script>
<script>
const userServices = new UserServices();
// userServices.getById(...)
<\/script>
Use as ESM (module build)
<script type="module">
import {
InfohubContext,
UserServices,
UserGroupServices,
UserRoleServices,
RestServices
} from '@colneo/infohub-js-api/dist/index.esm.js';
const ctx = new InfohubContext({ /* ... */ });
const users = new UserServices();
// await users.getById(...)
<\/script>
Helpful commands
# Check who is logged in
npm whoami --registry https://registry.colneo.digital/
# See available versions
npm view @colneo/infohub-js-api versions --json --registry https://registry.colneo.digital/
# Update / Uninstall
npm update @colneo/infohub-js-api
npm uninstall @colneo/infohub-js-api
# Logout
npm logout --registry https://registry.colneo.digital/
# After logout, purge cached auth to prevent credential reuse
npm cache clear --force