forest-cli
Version:
The Lumberjacks' toolbelt is the Forest CLI which makes easy to manage your back office application directly from the terminal.
51 lines • 2.91 kB
TypeScript
import type { JsonApiDocument, JsonPatchOp, LayoutDomain, LayoutScope } from './types';
/**
* Read/write access to a rendering's layout, folders and workflows documents.
*
* The "layout" is the server-side rendering. There is no raw GET for the
* layout domain (GET /api/layout returns []); the source of truth is the
* JSON:API rendering document, read by name through
* `GET /api/renderings/:project/:env/:team` — the same route the frontend uses.
*
* This adapter intentionally returns the raw response body (snake_case
* attributes, `included` graph) so the rendering mapper can invert the
* serialization itself. It reuses the toolbelt authenticator/env exactly like
* the other managers (TeamManager, EnvironmentManager) — no auth is
* re-implemented here. Later milestones (diff/apply) add the
* `PATCH /api/:domain` write path on top of the same headers.
*/
export default class LayoutManager {
private readonly authenticator;
private readonly serverUrl;
constructor();
/** GET /api/renderings/:project/:env/:team — the rendering as JSON:API. */
getRendering(scope: LayoutScope): Promise<JsonApiDocument>;
/**
* GET /api/:domain/:project/:env/:team — the raw patchable document for a
* non-layout domain (folders, workflows). The layout domain has no usable raw
* GET (it returns []), so use {@link getRendering} for it instead.
*/
getLayoutDomain(domain: Exclude<LayoutDomain, 'layout'>, scope: LayoutScope): Promise<unknown[]>;
/**
* PATCH /api/:domain — apply an RFC 6902 JSON-Patch array, scoped by the
* environment/team headers. The patch is atomic server-side; a 204 is
* expected on success. Only `op`/`path`/`value` are sent (planner metadata
* is dropped). A no-op array is skipped entirely.
*/
patchDomain(domain: LayoutDomain, ops: JsonPatchOp[], scope: LayoutScope): Promise<void>;
/** The numeric rendering id for this scope (needed by the workflow presigned request). */
getRenderingId(scope: LayoutScope): Promise<number>;
/**
* Download the currently-stored BPMN of a workflow version, to diff against a
* freshly compiled one (idempotency). The server returns a presigned S3 GET
* URL; the bytes are then fetched straight from S3 (no Forest auth there).
*/
getWorkflowBpmn(scope: LayoutScope, workflowId: string, collectionId: string, version: string, renderingId: number): Promise<string>;
/**
* Upload a workflow's compiled BPMN and return its S3 version id (to store in
* `bpmnAwsS3Identifier`). Mirrors the Forest UI exactly: ask the server for a
* presigned S3 POST, multipart-upload the BPMN to S3, read `x-amz-version-id`.
*/
uploadWorkflowBpmn(scope: LayoutScope, workflowId: string, collectionId: string, renderingId: number, bpmn: string): Promise<string>;
}
//# sourceMappingURL=layout-manager.d.ts.map