add shared contracts

Co-authored-by: Codex <noreply@openai.com>
This commit is contained in:
Harivansh Rathi 2026-03-31 21:25:38 +00:00
parent bc1878c1da
commit 679fd504a2
6 changed files with 126 additions and 0 deletions

View file

@ -0,0 +1,17 @@
{
"name": "@ainas/contracts",
"version": "0.1.0",
"private": true,
"type": "module",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"files": [
"dist",
"schemas"
],
"scripts": {
"build": "tsc -p tsconfig.json",
"typecheck": "tsc --noEmit -p tsconfig.json"
}
}

View file

@ -0,0 +1,48 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://ainas.local/schemas/control-plane-health.schema.json",
"type": "object",
"additionalProperties": false,
"required": [
"service",
"status",
"timestamp",
"uptimeSeconds",
"nextcloud"
],
"properties": {
"service": {
"const": "control-plane"
},
"status": {
"const": "ok"
},
"timestamp": {
"type": "string"
},
"uptimeSeconds": {
"type": "number"
},
"nextcloud": {
"type": "object",
"additionalProperties": false,
"required": [
"configured",
"baseUrl",
"provider"
],
"properties": {
"configured": {
"type": "boolean"
},
"baseUrl": {
"type": "string"
},
"provider": {
"const": "nextcloud"
}
}
}
}
}

View file

@ -0,0 +1,23 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://ainas.local/schemas/control-plane-version.schema.json",
"type": "object",
"additionalProperties": false,
"required": [
"service",
"version",
"apiVersion"
],
"properties": {
"service": {
"const": "control-plane"
},
"version": {
"type": "string"
},
"apiVersion": {
"const": "v1"
}
}
}

View file

@ -0,0 +1,25 @@
export const CONTROL_PLANE_ROUTES = {
health: "/health",
version: "/version"
} as const;
export interface NextcloudBackendStatus {
configured: boolean;
baseUrl: string;
provider: "nextcloud";
}
export interface ControlPlaneHealthResponse {
service: "control-plane";
status: "ok";
timestamp: string;
uptimeSeconds: number;
nextcloud: NextcloudBackendStatus;
}
export interface ControlPlaneVersionResponse {
service: "control-plane";
version: string;
apiVersion: "v1";
}

View file

@ -0,0 +1,2 @@
export * from "./control-plane.js";

View file

@ -0,0 +1,11 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"rootDir": "src",
"outDir": "dist"
},
"include": [
"src/**/*.ts"
]
}