@informatiq/admin-contract (1.4.0)
Installation
@informatiq:registry=https://devops.cloudhost.es/api/packages/CloudHost/npm/npm install @informatiq/admin-contract@1.4.0"@informatiq/admin-contract": "1.4.0"About this package
@informatiq/admin-contract
Stable v1 contract for a CloudHost product's founder-only service API. All routes use the X-Admin-Token header through requireServiceAuth; this token is deliberately independent of the product's tenant JWT secret.
Routes: GET /api/admin/tenants, GET /api/admin/tenants/:id/staff, PATCH /api/admin/staff/:id, POST /api/admin/staff/:id/reset, GET /api/admin/usage, and GET /api/admin/billing.
The reset response is deliberately Record<string, unknown> because reset semantics differ by product. Usage is Record<string, number> so each product can expose meaningful numeric counters without changing this package.
GET /api/admin/billing returns a per-tenant billing summary (subscription status/plan, active addon keys, recent payments) — a dashboard view for founders, not a general-purpose accounting export. Products without a billing model can simply not implement this route; fleet-admin only calls it for apps that advertise support.
Product -> fleet-admin client
callFleetAdmin(baseUrl, token, path, body) is the one shared fetch-with-timeout-and-error-check wrapper for calling fleet-admin's /api/internal/* routes (FLEET_ADMIN_URL/FLEET_ADMIN_TOKEN) — every product used to hand-write this itself (Redsys client wrappers, error pushers). Throws FleetAdminError (with .status/.body) on a non-2xx response.
createKmsClient(baseUrl, token) returns { wrap(plaintext), unwrap(ciphertext) } — Polyp-as-KMS. Products call this instead of holding their own ENCRYPTION_KEY; fleet-admin is the single custodian of the AES key fleet-wide. Backed by POST /api/internal/kms/{wrap,unwrap} on fleet-admin.
Dependencies
Development Dependencies
| ID | Version |
|---|---|
| @types/express | ^5.0.3 |
| express | ^5.1.0 |
| typescript | ^5.9.2 |
Peer Dependencies
| ID | Version |
|---|---|
| express | >=4 <6 |