Skip to main content

Rail Deck is being prepared for an invitation-only Alpha. Check current availability

Developer documentation

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 · required
RailDeckIdentifier

Account that owns the layouts.

requestOptions · optional
RailDeckRequestControlOptions

Caller-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 · required
RailDeckIdentifier

Owning account.

layoutId · required
RailDeckIdentifier

Reviewed layout.

input · required
SaveLayoutLibraryOrderCommand

Original intent, library, complete review and permutation.

options · optional
RailDeckRequestControlOptions

Cancellation 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 · required
RailDeckIdentifier

Account that will own the layout.

input · required
CreateRailDeckLayoutInput

Layout name and optional description.

requestOptions · optional
RailDeckRequestControlOptions

Caller-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 · required
RailDeckIdentifier

Account that owns the layout.

layoutId · required
RailDeckIdentifier

Layout to load.

requestOptions · optional
RailDeckRequestControlOptions

Caller-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 · required
RailDeckIdentifier

Account that owns the layout.

layoutId · required
RailDeckIdentifier

Layout to inspect.

requestOptions · optional
RailDeckRequestControlOptions

Caller-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 · required
RailDeckIdentifier

Authorised account containing the selected railway records.

layoutId · required
RailDeckIdentifier

Explicitly selected layout within that account.

requestOptions · optional
RailDeckRequestControlOptions

Caller-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 · required
RailDeckIdentifier

Account that owns the layout.

layoutId · required
RailDeckIdentifier

Layout to update.

input · required
UpdateRailDeckLayoutInput

Partial layout update.

requestOptions · optional
RailDeckRequestControlOptions

Caller-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 · required
RailDeckIdentifier

Account that owns the layout.

layoutId · required
RailDeckIdentifier

Layout to delete.

input · required
DeleteRailDeckLayoutInput

Confirmed fingerprint returned by `getDeletionPreview`.

requestOptions · optional
RailDeckRequestControlOptions

Caller-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.

Handle errors and uncertain outcomes

Choose another feature

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

Information reviewed .