mirror of
https://github.com/harivansh-afk/betterNAS.git
synced 2026-04-20 01:00:28 +00:00
skeleton schemas
This commit is contained in:
parent
0032487ca1
commit
4f174ec3a8
9 changed files with 470 additions and 42 deletions
97
packages/contracts/src/foundation.ts
Normal file
97
packages/contracts/src/foundation.ts
Normal file
|
|
@ -0,0 +1,97 @@
|
|||
export const FOUNDATION_API_ROUTES = {
|
||||
registerNode: "/api/v1/nodes/register",
|
||||
nodeHeartbeat: "/api/v1/nodes/:nodeId/heartbeat",
|
||||
listExports: "/api/v1/exports",
|
||||
issueMountProfile: "/api/v1/mount-profiles/issue",
|
||||
issueCloudProfile: "/api/v1/cloud-profiles/issue"
|
||||
} as const;
|
||||
|
||||
export type NasNodeStatus = "online" | "offline" | "degraded";
|
||||
export type StorageAccessProtocol = "webdav";
|
||||
export type AccessMode = "mount" | "cloud";
|
||||
export type AccessPrincipalType = "user" | "device";
|
||||
export type MountCredentialMode = "session-token" | "app-password";
|
||||
export type CloudProvider = "nextcloud";
|
||||
|
||||
export interface NasNode {
|
||||
id: string;
|
||||
machineId: string;
|
||||
displayName: string;
|
||||
agentVersion: string;
|
||||
status: NasNodeStatus;
|
||||
lastSeenAt: string;
|
||||
directAddress: string | null;
|
||||
relayAddress: string | null;
|
||||
}
|
||||
|
||||
export interface StorageExport {
|
||||
id: string;
|
||||
nasNodeId: string;
|
||||
label: string;
|
||||
path: string;
|
||||
protocols: StorageAccessProtocol[];
|
||||
capacityBytes: number | null;
|
||||
tags: string[];
|
||||
}
|
||||
|
||||
export interface AccessGrant {
|
||||
id: string;
|
||||
exportId: string;
|
||||
principalType: AccessPrincipalType;
|
||||
principalId: string;
|
||||
modes: AccessMode[];
|
||||
readonly: boolean;
|
||||
}
|
||||
|
||||
export interface MountProfile {
|
||||
id: string;
|
||||
exportId: string;
|
||||
protocol: "webdav";
|
||||
displayName: string;
|
||||
mountUrl: string;
|
||||
readonly: boolean;
|
||||
credentialMode: MountCredentialMode;
|
||||
}
|
||||
|
||||
export interface CloudProfile {
|
||||
id: string;
|
||||
exportId: string;
|
||||
provider: CloudProvider;
|
||||
baseUrl: string;
|
||||
path: string;
|
||||
}
|
||||
|
||||
export interface StorageExportInput {
|
||||
label: string;
|
||||
path: string;
|
||||
protocols: StorageAccessProtocol[];
|
||||
capacityBytes: number | null;
|
||||
tags: string[];
|
||||
}
|
||||
|
||||
export interface NodeRegistrationRequest {
|
||||
machineId: string;
|
||||
displayName: string;
|
||||
agentVersion: string;
|
||||
directAddress: string | null;
|
||||
relayAddress: string | null;
|
||||
exports: StorageExportInput[];
|
||||
}
|
||||
|
||||
export interface NodeHeartbeatRequest {
|
||||
nodeId: string;
|
||||
status: NasNodeStatus;
|
||||
lastSeenAt: string;
|
||||
}
|
||||
|
||||
export interface MountProfileRequest {
|
||||
userId: string;
|
||||
deviceId: string;
|
||||
exportId: string;
|
||||
}
|
||||
|
||||
export interface CloudProfileRequest {
|
||||
userId: string;
|
||||
exportId: string;
|
||||
provider: CloudProvider;
|
||||
}
|
||||
|
|
@ -1,2 +1,2 @@
|
|||
export * from "./control-plane.js";
|
||||
|
||||
export * from "./foundation.js";
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue