Locomotive matching
Review independent saved comparisons between locomotives.
Source 0.1.0 Private source package
How the calls fit together
Open an explicitly selected pair and review its evidence before a save or removal; saved evidence is not a physical verification.
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
locomotiveMatching.list
Lists a bounded page of matches and the model's current equipment revision without polling.
const result = await client.locomotiveMatching.list(
"1",
"2",
{}
);TypeScript parameters and return type
accountId· requiredstringOwning account.
locomotiveId· requiredstringEither participant whose saved matches should be listed.
options· optionalRailDeckRequestControlOptions & Readonly<{ after?: string }>Optional cancellation, timeout and explicit next-page cursor.
Returns Promise<MatchingPairList>.
Example evidence: Retained SDK transport fixture.
locomotiveMatching.get
Opens one match while preserving which model was originally adjusted.
const result = await client.locomotiveMatching.get(
"1",
"2",
"44444444-4444-4444-8444-444444444444",
{}
);TypeScript parameters and return type
accountId· requiredstringOwning account.
locomotiveId· requiredstringEither participant requesting this comparison.
pairId· requiredstringExplicit saved identity, not a default chosen by the server.
options· optionalRailDeckRequestControlOptionsOptional cancellation and timeout.
Returns Promise<MatchingPairView>.
Example evidence: Retained SDK transport fixture.
locomotiveMatching.save
Saves the original reviewed intent against one explicit pair and both equipment versions.
const result = await client.locomotiveMatching.save(
"1",
"2",
{
"intentId": "11111111-1111-4111-8111-111111111111",
"expectedRevision": 0,
"expectedEquipmentRevision": 0,
"confirmed": true,
"pairId": "44444444-4444-4444-8444-444444444444",
"matchedLocomotiveId": "3",
"expectedMatchedEquipmentRevision": 0,
"comparison": {
"schemaVersion": 2,
"calculationVersion": 1,
"evidence": "simulated",
"reference": {
"locomotiveId": "3",
"recordId": null,
"matchingRevision": 0,
"equipmentRevision": 0
},
"directions": [
{
"direction": "forward",
"referenceDirection": "forward",
"points": [
{
"referenceOutputPercent": 20,
"locomotiveOutputPercent": 20
},
{
"referenceOutputPercent": 80,
"locomotiveOutputPercent": 80
}
],
"starting": "last",
"stopping": "first"
},
{
"direction": "reverse",
"referenceDirection": "reverse",
"points": [
{
"referenceOutputPercent": 20,
"locomotiveOutputPercent": 20
},
{
"referenceOutputPercent": 80,
"locomotiveOutputPercent": 80
}
],
"starting": "last",
"stopping": "first"
}
]
}
},
{}
);TypeScript parameters and return type
accountId· requiredstringOwning account.
locomotiveId· requiredstringOriginally adjusted physical model.
input· requiredSaveMatchingPairCommandConfirmed pair intent and complete direct comparison.
options· optionalRailDeckRequestControlOptionsOptional cancellation and timeout, without automatic retries.
Returns Promise<MatchingMutationReceipt>.
Example evidence: Retained SDK transport fixture.
locomotiveMatching.remove
Removes only the selected pair, retaining equipment, other matches and immutable history.
const result = await client.locomotiveMatching.remove(
"1",
"2",
{
"intentId": "11111111-1111-4111-8111-111111111111",
"expectedRevision": 0,
"expectedEquipmentRevision": 0,
"confirmed": true,
"pairId": "44444444-4444-4444-8444-444444444444",
"matchedLocomotiveId": "3",
"expectedMatchedEquipmentRevision": 0
},
{}
);TypeScript parameters and return type
accountId· requiredstringOwning account.
locomotiveId· requiredstringOriginally adjusted physical model.
input· requiredMatchingPairMutationCommandOriginal removal intent and explicitly reviewed versions.
options· optionalRailDeckRequestControlOptionsOptional cancellation and timeout, without automatic retries.
Returns Promise<MatchingMutationReceipt>.
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 saved comparisons and then the pair explicitly chosen for review.
* @param client - Configured client; the caller owns current authority.
* @param accountId - Authorised account for this workflow.
* @param locomotiveId - Explicitly selected locomotive.
* @param pairId - Saved comparison chosen by the operator.
* @param signal - Caller-owned cancellation signal.
* @returns Saved comparison evidence, without a speed command or physical verification.
*/
export async function openSelectedComparison(
client: Client,
accountId: string,
locomotiveId: string,
pairId: string,
signal: AbortSignal,
) {
const options = { signal, timeoutMs: 15_000 };
const pairs = await client.locomotiveMatching.list(accountId, locomotiveId, options);
const selected = await client.locomotiveMatching.get(accountId, locomotiveId, pairId, options);
return { pairs, selected };
}
Download TypeScript example