Regenerate the contracts' TypeScript: the key parsers name their parameter apart from the parts (issue 1966)
Claude-Session: https://claude.ai/code/session_01NcbgfFSnn24M3GcqttoU7i
This commit is contained in:
@@ -43,13 +43,13 @@ export function placementByNodeNodeKey(node: string): string {
|
||||
}
|
||||
|
||||
/** The parts of a key of the form "<node>.node", or undefined for a key of another form. */
|
||||
export function parsePlacementByNodeNodeKey(key: string): { node: string } | undefined {
|
||||
let rest = key;
|
||||
const at0 = rest.indexOf(".node");
|
||||
if (at0 <= 0) return undefined;
|
||||
const node = rest.slice(0, at0);
|
||||
rest = rest.slice(at0 + 5);
|
||||
if (rest !== "") return undefined;
|
||||
export function parsePlacementByNodeNodeKey(_key: string): { node: string } | undefined {
|
||||
let _rest = _key;
|
||||
const _at0 = _rest.indexOf(".node");
|
||||
if (_at0 <= 0) return undefined;
|
||||
const node = _rest.slice(0, _at0);
|
||||
_rest = _rest.slice(_at0 + 5);
|
||||
if (_rest !== "") return undefined;
|
||||
return { node };
|
||||
}
|
||||
|
||||
@@ -59,16 +59,16 @@ export function placementByNodeModuleKey(node: string, module: string): string {
|
||||
}
|
||||
|
||||
/** The parts of a key of the form "<node>.<module>", or undefined for a key of another form. */
|
||||
export function parsePlacementByNodeModuleKey(key: string): { node: string; module: string } | undefined {
|
||||
let rest = key;
|
||||
const at0 = rest.indexOf(".");
|
||||
if (at0 <= 0) return undefined;
|
||||
const node = rest.slice(0, at0);
|
||||
rest = rest.slice(at0 + 1);
|
||||
if (rest === "") return undefined;
|
||||
const module = rest;
|
||||
rest = "";
|
||||
if (rest !== "") return undefined;
|
||||
export function parsePlacementByNodeModuleKey(_key: string): { node: string; module: string } | undefined {
|
||||
let _rest = _key;
|
||||
const _at0 = _rest.indexOf(".");
|
||||
if (_at0 <= 0) return undefined;
|
||||
const node = _rest.slice(0, _at0);
|
||||
_rest = _rest.slice(_at0 + 1);
|
||||
if (_rest === "") return undefined;
|
||||
const module = _rest;
|
||||
_rest = "";
|
||||
if (_rest !== "") return undefined;
|
||||
return { node, module };
|
||||
}
|
||||
|
||||
@@ -78,12 +78,12 @@ export function proposalsByProposalKey(proposal: string): string {
|
||||
}
|
||||
|
||||
/** The parts of a key of the form "<proposal>", or undefined for a key of another form. */
|
||||
export function parseProposalsByProposalKey(key: string): { proposal: string } | undefined {
|
||||
let rest = key;
|
||||
if (rest === "") return undefined;
|
||||
const proposal = rest;
|
||||
rest = "";
|
||||
if (rest !== "") return undefined;
|
||||
export function parseProposalsByProposalKey(_key: string): { proposal: string } | undefined {
|
||||
let _rest = _key;
|
||||
if (_rest === "") return undefined;
|
||||
const proposal = _rest;
|
||||
_rest = "";
|
||||
if (_rest !== "") return undefined;
|
||||
return { proposal };
|
||||
}
|
||||
|
||||
@@ -93,16 +93,16 @@ export function candidatesByProposalNodeKey(proposal: string, node: string): str
|
||||
}
|
||||
|
||||
/** The parts of a key of the form "<proposal>.<node>", or undefined for a key of another form. */
|
||||
export function parseCandidatesByProposalNodeKey(key: string): { proposal: string; node: string } | undefined {
|
||||
let rest = key;
|
||||
const at0 = rest.indexOf(".");
|
||||
if (at0 <= 0) return undefined;
|
||||
const proposal = rest.slice(0, at0);
|
||||
rest = rest.slice(at0 + 1);
|
||||
if (rest === "") return undefined;
|
||||
const node = rest;
|
||||
rest = "";
|
||||
if (rest !== "") return undefined;
|
||||
export function parseCandidatesByProposalNodeKey(_key: string): { proposal: string; node: string } | undefined {
|
||||
let _rest = _key;
|
||||
const _at0 = _rest.indexOf(".");
|
||||
if (_at0 <= 0) return undefined;
|
||||
const proposal = _rest.slice(0, _at0);
|
||||
_rest = _rest.slice(_at0 + 1);
|
||||
if (_rest === "") return undefined;
|
||||
const node = _rest;
|
||||
_rest = "";
|
||||
if (_rest !== "") return undefined;
|
||||
return { proposal, node };
|
||||
}
|
||||
|
||||
@@ -112,18 +112,18 @@ export function pulsesByAnswerProposalNodeKey(proposal: string, node: string): s
|
||||
}
|
||||
|
||||
/** The parts of a key of the form "answer.<proposal>.<node>", or undefined for a key of another form. */
|
||||
export function parsePulsesByAnswerProposalNodeKey(key: string): { proposal: string; node: string } | undefined {
|
||||
let rest = key;
|
||||
if (!rest.startsWith("answer.")) return undefined;
|
||||
rest = rest.slice(7);
|
||||
const at1 = rest.indexOf(".");
|
||||
if (at1 <= 0) return undefined;
|
||||
const proposal = rest.slice(0, at1);
|
||||
rest = rest.slice(at1 + 1);
|
||||
if (rest === "") return undefined;
|
||||
const node = rest;
|
||||
rest = "";
|
||||
if (rest !== "") return undefined;
|
||||
export function parsePulsesByAnswerProposalNodeKey(_key: string): { proposal: string; node: string } | undefined {
|
||||
let _rest = _key;
|
||||
if (!_rest.startsWith("answer.")) return undefined;
|
||||
_rest = _rest.slice(7);
|
||||
const _at1 = _rest.indexOf(".");
|
||||
if (_at1 <= 0) return undefined;
|
||||
const proposal = _rest.slice(0, _at1);
|
||||
_rest = _rest.slice(_at1 + 1);
|
||||
if (_rest === "") return undefined;
|
||||
const node = _rest;
|
||||
_rest = "";
|
||||
if (_rest !== "") return undefined;
|
||||
return { proposal, node };
|
||||
}
|
||||
|
||||
@@ -133,14 +133,14 @@ export function pulsesByAskProposalKey(proposal: string): string {
|
||||
}
|
||||
|
||||
/** The parts of a key of the form "ask.<proposal>", or undefined for a key of another form. */
|
||||
export function parsePulsesByAskProposalKey(key: string): { proposal: string } | undefined {
|
||||
let rest = key;
|
||||
if (!rest.startsWith("ask.")) return undefined;
|
||||
rest = rest.slice(4);
|
||||
if (rest === "") return undefined;
|
||||
const proposal = rest;
|
||||
rest = "";
|
||||
if (rest !== "") return undefined;
|
||||
export function parsePulsesByAskProposalKey(_key: string): { proposal: string } | undefined {
|
||||
let _rest = _key;
|
||||
if (!_rest.startsWith("ask.")) return undefined;
|
||||
_rest = _rest.slice(4);
|
||||
if (_rest === "") return undefined;
|
||||
const proposal = _rest;
|
||||
_rest = "";
|
||||
if (_rest !== "") return undefined;
|
||||
return { proposal };
|
||||
}
|
||||
|
||||
@@ -150,12 +150,12 @@ export function seatHoldersBySeatKey(seat: string): string {
|
||||
}
|
||||
|
||||
/** The parts of a key of the form "<seat>", or undefined for a key of another form. */
|
||||
export function parseSeatHoldersBySeatKey(key: string): { seat: string } | undefined {
|
||||
let rest = key;
|
||||
if (rest === "") return undefined;
|
||||
const seat = rest;
|
||||
rest = "";
|
||||
if (rest !== "") return undefined;
|
||||
export function parseSeatHoldersBySeatKey(_key: string): { seat: string } | undefined {
|
||||
let _rest = _key;
|
||||
if (_rest === "") return undefined;
|
||||
const seat = _rest;
|
||||
_rest = "";
|
||||
if (_rest !== "") return undefined;
|
||||
return { seat };
|
||||
}
|
||||
|
||||
@@ -165,16 +165,16 @@ export function seatHoldersBySeatNodeKey(seat: string, node: string): string {
|
||||
}
|
||||
|
||||
/** The parts of a key of the form "<seat>.<node>", or undefined for a key of another form. */
|
||||
export function parseSeatHoldersBySeatNodeKey(key: string): { seat: string; node: string } | undefined {
|
||||
let rest = key;
|
||||
const at0 = rest.indexOf(".");
|
||||
if (at0 <= 0) return undefined;
|
||||
const seat = rest.slice(0, at0);
|
||||
rest = rest.slice(at0 + 1);
|
||||
if (rest === "") return undefined;
|
||||
const node = rest;
|
||||
rest = "";
|
||||
if (rest !== "") return undefined;
|
||||
export function parseSeatHoldersBySeatNodeKey(_key: string): { seat: string; node: string } | undefined {
|
||||
let _rest = _key;
|
||||
const _at0 = _rest.indexOf(".");
|
||||
if (_at0 <= 0) return undefined;
|
||||
const seat = _rest.slice(0, _at0);
|
||||
_rest = _rest.slice(_at0 + 1);
|
||||
if (_rest === "") return undefined;
|
||||
const node = _rest;
|
||||
_rest = "";
|
||||
if (_rest !== "") return undefined;
|
||||
return { seat, node };
|
||||
}
|
||||
|
||||
|
||||
@@ -29,18 +29,18 @@ export function wantsByWantNodeModuleKey(node: string, module: string): string {
|
||||
}
|
||||
|
||||
/** The parts of a key of the form "want.<node>.<module>", or undefined for a key of another form. */
|
||||
export function parseWantsByWantNodeModuleKey(key: string): { node: string; module: string } | undefined {
|
||||
let rest = key;
|
||||
if (!rest.startsWith("want.")) return undefined;
|
||||
rest = rest.slice(5);
|
||||
const at1 = rest.indexOf(".");
|
||||
if (at1 <= 0) return undefined;
|
||||
const node = rest.slice(0, at1);
|
||||
rest = rest.slice(at1 + 1);
|
||||
if (rest === "") return undefined;
|
||||
const module = rest;
|
||||
rest = "";
|
||||
if (rest !== "") return undefined;
|
||||
export function parseWantsByWantNodeModuleKey(_key: string): { node: string; module: string } | undefined {
|
||||
let _rest = _key;
|
||||
if (!_rest.startsWith("want.")) return undefined;
|
||||
_rest = _rest.slice(5);
|
||||
const _at1 = _rest.indexOf(".");
|
||||
if (_at1 <= 0) return undefined;
|
||||
const node = _rest.slice(0, _at1);
|
||||
_rest = _rest.slice(_at1 + 1);
|
||||
if (_rest === "") return undefined;
|
||||
const module = _rest;
|
||||
_rest = "";
|
||||
if (_rest !== "") return undefined;
|
||||
return { node, module };
|
||||
}
|
||||
|
||||
@@ -50,15 +50,15 @@ export function wantsByWantNodeNodeKey(node: string): string {
|
||||
}
|
||||
|
||||
/** The parts of a key of the form "want.<node>.node", or undefined for a key of another form. */
|
||||
export function parseWantsByWantNodeNodeKey(key: string): { node: string } | undefined {
|
||||
let rest = key;
|
||||
if (!rest.startsWith("want.")) return undefined;
|
||||
rest = rest.slice(5);
|
||||
const at1 = rest.indexOf(".node");
|
||||
if (at1 <= 0) return undefined;
|
||||
const node = rest.slice(0, at1);
|
||||
rest = rest.slice(at1 + 5);
|
||||
if (rest !== "") return undefined;
|
||||
export function parseWantsByWantNodeNodeKey(_key: string): { node: string } | undefined {
|
||||
let _rest = _key;
|
||||
if (!_rest.startsWith("want.")) return undefined;
|
||||
_rest = _rest.slice(5);
|
||||
const _at1 = _rest.indexOf(".node");
|
||||
if (_at1 <= 0) return undefined;
|
||||
const node = _rest.slice(0, _at1);
|
||||
_rest = _rest.slice(_at1 + 5);
|
||||
if (_rest !== "") return undefined;
|
||||
return { node };
|
||||
}
|
||||
|
||||
@@ -68,18 +68,18 @@ export function wantsByHeldModuleFingerprintKey(module: string, fingerprint: str
|
||||
}
|
||||
|
||||
/** The parts of a key of the form "held.<module>.<fingerprint>", or undefined for a key of another form. */
|
||||
export function parseWantsByHeldModuleFingerprintKey(key: string): { module: string; fingerprint: string } | undefined {
|
||||
let rest = key;
|
||||
if (!rest.startsWith("held.")) return undefined;
|
||||
rest = rest.slice(5);
|
||||
const at1 = rest.indexOf(".");
|
||||
if (at1 <= 0) return undefined;
|
||||
const module = rest.slice(0, at1);
|
||||
rest = rest.slice(at1 + 1);
|
||||
if (rest === "") return undefined;
|
||||
const fingerprint = rest;
|
||||
rest = "";
|
||||
if (rest !== "") return undefined;
|
||||
export function parseWantsByHeldModuleFingerprintKey(_key: string): { module: string; fingerprint: string } | undefined {
|
||||
let _rest = _key;
|
||||
if (!_rest.startsWith("held.")) return undefined;
|
||||
_rest = _rest.slice(5);
|
||||
const _at1 = _rest.indexOf(".");
|
||||
if (_at1 <= 0) return undefined;
|
||||
const module = _rest.slice(0, _at1);
|
||||
_rest = _rest.slice(_at1 + 1);
|
||||
if (_rest === "") return undefined;
|
||||
const fingerprint = _rest;
|
||||
_rest = "";
|
||||
if (_rest !== "") return undefined;
|
||||
return { module, fingerprint };
|
||||
}
|
||||
|
||||
@@ -89,16 +89,16 @@ export function differencesByNodeModuleKey(node: string, module: string): string
|
||||
}
|
||||
|
||||
/** The parts of a key of the form "<node>.<module>", or undefined for a key of another form. */
|
||||
export function parseDifferencesByNodeModuleKey(key: string): { node: string; module: string } | undefined {
|
||||
let rest = key;
|
||||
const at0 = rest.indexOf(".");
|
||||
if (at0 <= 0) return undefined;
|
||||
const node = rest.slice(0, at0);
|
||||
rest = rest.slice(at0 + 1);
|
||||
if (rest === "") return undefined;
|
||||
const module = rest;
|
||||
rest = "";
|
||||
if (rest !== "") return undefined;
|
||||
export function parseDifferencesByNodeModuleKey(_key: string): { node: string; module: string } | undefined {
|
||||
let _rest = _key;
|
||||
const _at0 = _rest.indexOf(".");
|
||||
if (_at0 <= 0) return undefined;
|
||||
const node = _rest.slice(0, _at0);
|
||||
_rest = _rest.slice(_at0 + 1);
|
||||
if (_rest === "") return undefined;
|
||||
const module = _rest;
|
||||
_rest = "";
|
||||
if (_rest !== "") return undefined;
|
||||
return { node, module };
|
||||
}
|
||||
|
||||
@@ -108,16 +108,16 @@ export function compositionsByGroupHeadsKey(group: string, heads: string): strin
|
||||
}
|
||||
|
||||
/** The parts of a key of the form "<group>.<heads>", or undefined for a key of another form. */
|
||||
export function parseCompositionsByGroupHeadsKey(key: string): { group: string; heads: string } | undefined {
|
||||
let rest = key;
|
||||
const at0 = rest.indexOf(".");
|
||||
if (at0 <= 0) return undefined;
|
||||
const group = rest.slice(0, at0);
|
||||
rest = rest.slice(at0 + 1);
|
||||
if (rest === "") return undefined;
|
||||
const heads = rest;
|
||||
rest = "";
|
||||
if (rest !== "") return undefined;
|
||||
export function parseCompositionsByGroupHeadsKey(_key: string): { group: string; heads: string } | undefined {
|
||||
let _rest = _key;
|
||||
const _at0 = _rest.indexOf(".");
|
||||
if (_at0 <= 0) return undefined;
|
||||
const group = _rest.slice(0, _at0);
|
||||
_rest = _rest.slice(_at0 + 1);
|
||||
if (_rest === "") return undefined;
|
||||
const heads = _rest;
|
||||
_rest = "";
|
||||
if (_rest !== "") return undefined;
|
||||
return { group, heads };
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user