forked from r.muellner/velum-raycast
feat: preselect all entity types except IP, Datum and Referenz
Forms and the project-file command now preselect the backend's default_entity_types from /api/entity-types instead of every type. Older backends without that field fall back to all types except IP, DATUM and REFERENZ. Saved project selections are still loaded unchanged; the project-file command keeps excluding ORT by default as before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
22
src/lib/entity-types.ts
Normal file
22
src/lib/entity-types.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
import type { EntityType } from "../types";
|
||||
|
||||
/** Fallback for Velum backends that do not report `default_entity_types` yet. */
|
||||
export const DEFAULT_DISABLED_ENTITY_TYPES: readonly EntityType[] = [
|
||||
"IP",
|
||||
"DATUM",
|
||||
"REFERENZ",
|
||||
];
|
||||
|
||||
export type EntityTypeCatalog = { all: EntityType[]; defaults: EntityType[] };
|
||||
|
||||
/** Preselection for unconfigured contexts; the backend default wins when it is available. */
|
||||
export function entityTypeCatalog(payload: {
|
||||
entity_types: EntityType[];
|
||||
default_entity_types?: EntityType[];
|
||||
}): EntityTypeCatalog {
|
||||
const all = payload.entity_types;
|
||||
const defaults = payload.default_entity_types
|
||||
? payload.default_entity_types.filter((type) => all.includes(type))
|
||||
: all.filter((type) => !DEFAULT_DISABLED_ENTITY_TYPES.includes(type));
|
||||
return { all, defaults };
|
||||
}
|
||||
Reference in New Issue
Block a user