@xemahq/platform-common
v0.87.0
Published
Shared NestJS building blocks for Xema services — auth guards, response redaction, CORS configuration, and crypto helpers.
Readme
@xemahq/platform-common
Foundation utilities shared across services
Overview
Domain-agnostic NestJS building blocks used by Xema services: auth guards and decorators, encryption, event envelopes, request context, redaction and payload helpers.
When to use it
- Use it when a service needs a shared helper or decorator rather than its own copy.
Installation
pnpm add @xemahq/platform-commonUsage
import { omitUndefined } from '@xemahq/platform-common';
const clean = omitUndefined({ a: 1, b: undefined });Organization and installation routes
User and agent tokens must send X-Xema-Org-Id on every route; a missing header is a 400. Service tokens may omit it. This needs AuthModule (forRoot or forRootAsync) with configureAuthMiddleware.
| Decorator | Effect |
| --- | --- |
| @InstallationScoped() | Route acts on the installation, not one organization. Admits only platform_owner or platform_admin; no org header needed. |
| @InstallationPermissionScoped(permission) | Installation route that needs one InstallationPermission. platform_owner holds all; platform_admin holds none. |
| @OperatorPlane() | Vendor operator-plane route. Admits only platform_operator, and only from the issuer set in AuthModule.forRoot({ operatorPlane: { issuer } }). |
Peer requirements
@nestjs/common,@nestjs/core,@nestjs/platform-express>= 10@nestjs/swagger>= 7rxjs>= 7
License
Apache-2.0 © Xema — xema.dev
