/** * Transport-neutral client contracts and pure helpers for the policy gear. * * Hosts normally adapt these methods to their generated FieldPolicyCollection * client. Identity is intentionally absent from mutations: the server derives * tenant/user scope from the authenticated ambient context. */ import type { FieldPolicyEditorRow, FieldPolicyEditorState, FieldPolicyEditorStateResult, FieldPolicyScopeType } from '../types.js'; export interface FieldPolicyEditorAdapter { load(input: { objectRef: string; }): Promise; create(input: FieldPolicyEditorMutation): Promise; update(input: FieldPolicyEditorMutation & { id: string; }): Promise; delete(input: { id: string; }): Promise; } /** Generated-client compatible sparse write shape. `defaultValue` is JSON. */ export interface FieldPolicyEditorMutation { objectRef: string; fieldName: string; scopeType: FieldPolicyScopeType; defaultValue: string | null; displayOrder: number | null; help: string | null; label: string | null; locked: boolean | null; visibility: 'basic' | 'advanced' | 'hidden' | null; } export type FieldPolicyEditorTab = 'organization' | 'personal'; export type FieldPolicyOrganizationScope = 'app' | 'tenant'; export interface FieldPolicyEditorDraft { defaultEnabled: boolean; defaultValue: unknown; displayOrder: number | null; help: string | null; label: string | null; locked: boolean | null; visibility: 'basic' | 'advanced' | 'hidden' | null; } export declare function isFieldPolicyEditorState(result: unknown, expectedObjectRef?: string): result is FieldPolicyEditorState; /** Safe message extraction for generated custom actions, whose client type is `any`. */ export declare function editorStateErrorMessage(result: unknown): string; export declare function rowForScope(state: FieldPolicyEditorState, fieldName: string, scope: FieldPolicyScopeType): FieldPolicyEditorRow | undefined; export declare function draftFromRow(row?: FieldPolicyEditorRow): FieldPolicyEditorDraft; export declare function mutationFromDraft(objectRef: string, fieldName: string, scopeType: FieldPolicyScopeType, draft: FieldPolicyEditorDraft): FieldPolicyEditorMutation; /** * Serialize the explicit default-value wire channel without ever leaking an * `undefined` payload into a generated client. JSON null remains intentional. */ export declare function serializeDefaultValue(value: unknown): string; export declare function defaultValueSerializationError(value: unknown): string | null; export declare function requiredVisibilityIsInvalid(required: boolean, visibility: FieldPolicyEditorDraft['visibility'], effectiveDefault: unknown): boolean; export declare function hasUsableDefault(value: unknown): boolean; /** Structural AdminShell seam; importing smrt-svelte here would invert the DAG. */ export interface FieldPolicyFocusTool { id: string; label: string; description?: string; order?: number; component?: unknown; render?: unknown; subject?: { type: string; id: string; label?: string; }; } export interface FieldPolicyFocusToolRegistrar { registerFocusTool(tool: FieldPolicyFocusTool): () => void; } /** * Registers an object-form settings tool with AdminShell-compatible state. * AdminShell passes `{ tool, shell }` to a component focus tool; callers pass * that component through `tool.component` without Fields importing the shell. */ export declare function registerFieldPolicyFocusTool(shell: FieldPolicyFocusToolRegistrar, objectRef: string, tool: Omit): () => void; //# sourceMappingURL=field-policy-editor.d.ts.map