Layouts
Find, create and maintain a railway layout and its library order.
Source 0.1.0 Private source package
How the calls fit together
Read the layout before editing; use deletion previews before a separately confirmed removal.
JavaScript examples
Supply your configured client. Each call awaits a decoded result; errors pass to your caller. These identifiers and values are fictional. Use selected development records and review every change before running it. Opening this page sends no API requests.
See the complete TypeScript workflow · Explore the Node starter
layouts.list
Lists layouts in an account.
const result = await client.layouts.list(
"account 1",
{}
);TypeScript parameters and return type
accountId· requiredRailDeckIdentifierAccount that owns the layouts.
requestOptions· optionalRailDeckRequestControlOptionsCaller-owned cancellation signal and timeout; these controls never authorise an automatic mutation retry.
Returns Promise<RailDeckLayoutListResponse>.
Example evidence: Retained SDK transport fixture.
layouts.saveLibraryOrder
Saves one complete shared library order without changing layout membership.
const result = await client.layouts.saveLibraryOrder(
"23",
"31",
{
"library": "locomotives",
"requestId": "aaaaaaaa-aaaa-4aaa-8aaa-aaaaaaaaaaaa",
"reviewedIds": [
"7",
"8"
],
"orderedIds": [
"8",
"7"
]
},
{}
);TypeScript parameters and return type
accountId· requiredRailDeckIdentifierOwning account.
layoutId· requiredRailDeckIdentifierReviewed layout.
input· requiredSaveLayoutLibraryOrderCommandOriginal intent, library, complete review and permutation.
options· optionalRailDeckRequestControlOptionsCancellation and timeout; no automatic mutation replay.
Returns Promise<LayoutLibraryOrderReceipt>.
Example evidence: Retained SDK transport fixture.
layouts.create
Creates a layout inside an account.
const result = await client.layouts.create(
"account 1",
{
"name": "Demo"
},
{}
);TypeScript parameters and return type
accountId· requiredRailDeckIdentifierAccount that will own the layout.
input· requiredCreateRailDeckLayoutInputLayout name and optional description.
requestOptions· optionalRailDeckRequestControlOptionsCaller-owned cancellation signal and timeout; these controls never authorise an automatic mutation retry.
Returns Promise<RailDeckLayout>.
Example evidence: Retained SDK transport fixture.
layouts.get
Loads one layout.
const result = await client.layouts.get(
"account-1",
"layout-1",
{}
);TypeScript parameters and return type
accountId· requiredRailDeckIdentifierAccount that owns the layout.
layoutId· requiredRailDeckIdentifierLayout to load.
requestOptions· optionalRailDeckRequestControlOptionsCaller-owned cancellation signal and timeout; these controls never authorise an automatic mutation retry.
Returns Promise<RailDeckLayout>.
Example evidence: Retained SDK transport fixture.
layouts.getLifecycle
Loads non-mutating lifecycle readiness for one layout.
const result = await client.layouts.getLifecycle(
"account 1",
"layout 1",
{}
);TypeScript parameters and return type
accountId· requiredRailDeckIdentifierAccount that owns the layout.
layoutId· requiredRailDeckIdentifierLayout to inspect.
requestOptions· optionalRailDeckRequestControlOptionsCaller-owned cancellation signal and timeout; these controls never authorise an automatic mutation retry.
Returns Promise<RailDeckLayoutLifecycle>.
Example evidence: Retained SDK transport fixture.
layouts.getDeletionPreview
Loads the current consequences which must be reviewed before deletion.
const result = await client.layouts.getDeletionPreview(
"account 1",
"layout 1",
{}
);TypeScript parameters and return type
accountId· requiredRailDeckIdentifierAuthorised account containing the selected railway records.
layoutId· requiredRailDeckIdentifierExplicitly selected layout within that account.
requestOptions· optionalRailDeckRequestControlOptionsCaller-owned cancellation signal and timeout; these controls never authorise an automatic mutation retry.
Returns Promise<RailDeckLayoutDeletionPreview>.
Example evidence: Retained SDK transport fixture.
layouts.update
Updates one layout.
const result = await client.layouts.update(
"account-1",
"layout-1",
{
"name": "Renamed Junction"
},
{}
);TypeScript parameters and return type
accountId· requiredRailDeckIdentifierAccount that owns the layout.
layoutId· requiredRailDeckIdentifierLayout to update.
input· requiredUpdateRailDeckLayoutInputPartial layout update.
requestOptions· optionalRailDeckRequestControlOptionsCaller-owned cancellation signal and timeout; these controls never authorise an automatic mutation retry.
Returns Promise<RailDeckLayout>.
Example evidence: Retained SDK transport fixture.
layouts.delete
Deletes one layout after confirming an unchanged consequence preview.
const result = await client.layouts.delete(
"account-1",
"layout-1",
{
"previewFingerprint": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"confirmed": true
},
{}
);TypeScript parameters and return type
accountId· requiredRailDeckIdentifierAccount that owns the layout.
layoutId· requiredRailDeckIdentifierLayout to delete.
input· requiredDeleteRailDeckLayoutInputConfirmed fingerprint returned by `getDeletionPreview`.
requestOptions· optionalRailDeckRequestControlOptionsCaller-owned cancellation signal and timeout; these controls never authorise an automatic mutation retry.
Returns Promise<RailDeckSuccessResponse>.
Example evidence: Retained SDK transport fixture.
Download all TypeScript method examples
JavaScript calls and TypeScript downloads are checked through the real SDK using local response fixtures. This verifies the calls and decoding for those fixtures.
The complete TypeScript workflow
Follow how the calls fit together, including the review and recovery steps. Supply your configured client and explicitly selected development records. Importing the download performs no requests; mutations are never retried automatically.
import type { RailDeckDirectIntegrationClient as Client } from '@raildeck/frontend-sdk/direct-integration';
/**
* Read a saved layout and its lifecycle before presenting editing choices.
* @param client - Configured client; the caller owns current authority.
* @param accountId - Authorised account for this workflow.
* @param layoutId - Explicitly selected layout within the account.
* @param signal - Caller-owned cancellation signal.
* @returns The selected record and lifecycle; later writes require a separate decision.
*/
export async function prepareLayoutReview(
client: Client,
accountId: string,
layoutId: string,
signal: AbortSignal,
) {
const options = { signal, timeoutMs: 15_000 };
const layout = await client.layouts.get(accountId, layoutId, options);
const lifecycle = await client.layouts.getLifecycle(accountId, layoutId, options);
return { layout, lifecycle };
}
Download TypeScript example