import type { Key } from '@astrale-os/sdk/schema' import { Key as admitKey } from '@astrale-os/sdk/schema' export function viewKey(input: string): Key.View { const key = admitKey(input) if (!key.slice(key.indexOf(':') + 1).startsWith('view.')) { throw new TypeError(`Invalid View key '${input}'.`) } return key as Key.View }