Skip to content

armgit / TREK

Public Imported from GitHub
0

The most complete open-source travel planner: real-time collaboration, bookings, budgets, packing lists, journals, offline PWA, SSO and an AI-ready MCP server, with planet-wide place search and routing built in.

823 B
Raw Blame
import { serviceIdentityStatusSchema, type ServiceIdentityStatus } from '@trek/shared';
import { serviceIdentityApi } from '../api/serviceIdentity';
import { requireOnline } from './onlineOnly';

/**
 * The installation's identity towards the TREK services, as the admin card
 * shows it. **Deliberately online-only, and no Dexie table:** it is live
 * server state, and a cached copy would show an allowance that is long gone.
 */
export const serviceIdentityRepo = {
  async status(signal?: AbortSignal): Promise<ServiceIdentityStatus> {
    requireOnline();
    return serviceIdentityStatusSchema.parse(await serviceIdentityApi.status(signal));
  },

  async regenerate(): Promise<ServiceIdentityStatus> {
    requireOnline();
    return serviceIdentityStatusSchema.parse(await serviceIdentityApi.regenerate());
  },
};