MCPcopy Create free account
hub / github.com/EvoMap/evolver / creditsFromPayload

Function creditsFromPayload

src/gep/cliContracts.js:1053–1066  ·  view source on GitHub ↗
(payload)

Source from the content-addressed store, hash-verified

1051}
1052
1053function creditsFromPayload(payload) {
1054 const required = numberField(payload, 'required');
1055 const available = numberField(payload, 'available');
1056 const estimated = firstNumberField(payload, ['estimated', 'estimate']);
1057 const charged = numberField(payload, 'charged');
1058 const balanceKind = safeTokenField(stringField(payload, 'balance_kind') || stringField(payload, 'balanceKind'));
1059 const out = {};
1060 if (required !== undefined) out.required = required;
1061 if (available !== undefined) out.available = available;
1062 if (estimated !== undefined) out.estimated = estimated;
1063 if (charged !== undefined) out.charged = charged;
1064 if (balanceKind) out.balance_kind = balanceKind;
1065 return Object.keys(out).length ? out : undefined;
1066}
1067
1068function normalizePublishStatus(body) {
1069 const b = record(body) || {};

Callers 2

runPublishCommandFunction · 0.85
extractCreditsFunction · 0.85

Calls 4

firstNumberFieldFunction · 0.85
safeTokenFieldFunction · 0.85
stringFieldFunction · 0.85
numberFieldFunction · 0.70

Tested by

no test coverage detected