forest-cli
Version:
The Lumberjacks' toolbelt is the Forest CLI which makes easy to manage your back office application directly from the terminal.
46 lines • 1.81 kB
TypeScript
/**
* Rebuilds the patchable "layout" document from the serialized rendering.
*
* The server has no raw GET for the layout domain (GET /api/layout always
* returns [] — the renderings table has no `layout` column). The frontend
* reads the layout through GET /api/renderings/:project/:env/:team, a JSON:API
* document (snake_case attributes, resources split into `included`). This
* module inverts that serialization into the configuration shape the PATCH
* paths address (camelCase, see the server's collection validators/models).
*
* v1 maps the curated, patchable subset: collections base props, columns,
* fields, segments, actions, viewEdit.summaryView, and dashboards.
*/
import type { JsonApiDocument } from './types';
export type CanonicalCollection = {
defaultSortingFieldName: null | string;
defaultSortingOrder: null | string;
displayName: null | string;
displayNamePlural: null | string;
icon: null | string;
id: string;
layout: {
actions: Array<Record<string, unknown>>;
columns: Array<{
id: string;
isVisible: boolean;
position: number;
}>;
fields: Array<Record<string, unknown>>;
segments: Array<Record<string, unknown>>;
viewEdit: {
summaryView: unknown;
};
};
restrictedToSegments: boolean;
};
export type CanonicalLayout = {
collections: CanonicalCollection[];
dashboards: Array<Record<string, unknown>>;
inboxes: Array<Record<string, unknown>>;
sections: unknown;
workspaces: Array<Record<string, unknown>>;
};
/** Build the canonical patchable layout document from a rendering response. */
export declare function renderingToCanonical(doc: JsonApiDocument): CanonicalLayout;
//# sourceMappingURL=rendering-mapper.d.ts.map