@mentingo/competencies-sdk
v0.1.0
Published
Server-side client and contracts for the Mentingo competencies plugin.
Keywords
Readme
@mentingo/competencies-sdk
Server-side client and contracts for the competencies plugin. Requires Node.js 22.15 or newer. Keep the API key and trusted actor scope on the server.
import { createCompetenciesClient } from "@mentingo/competencies-sdk";
const client = createCompetenciesClient({
baseURL: process.env.COMPETENCIES_BASE_URL!,
apiKey: process.env.COMPETENCIES_API_KEY!,
tenantId: tenant.id,
});
const configuration = await client.configuration();
if (configuration.capabilities.competencies.enabled) {
const workspace = await client.workspace(actorContext);
}Build actorContext from the current authenticated user, permissions and managed subjects on each request. Never copy it from browser input. The plugin additionally checks its own verifier lists. Bind every client to the matching tenant and key scope.
workspace(actor, subjectId?, profileId?, teamOnly?) supports selected-profile comparisons. teamOnly restricts subjects to the actor's current managed-subject IDs.
The SDK sends bearer authentication and x-tenant-id, refuses redirects and applies a 15-second deadline. Failed responses throw CompetenciesApiError with a status and without the response body. Download methods return a stream; pipe it to the authorized response. fetch can be supplied for deterministic transport tests.
Commands use version/revision checks and stable request IDs for repeatable evidence and assignment work. Learning facts use stable identities and monotonic revisions; complete reconciliation snapshots are distinct from incremental delivery.
Levels require all conditions at that level and below it. Employees submit their own evidence; designated condition verifiers review it. Managers read their current subjects, while administrators manage the tenant catalog and job profiles. Import contracts without the client using @mentingo/competencies-sdk/types.
Build and verify with pnpm build, pnpm typecheck and pnpm test. Package publication is a separate release operation.
MIT. See LICENSE.
