3d8ae4a7a3
* Generate more code from wallet defs * generate "type WalletLND { ... }" * generate "union WalletDetails = WalletLND | ..." * hardcode function for __resolveType * add comments where updates are needed if another server wallet is added * Fix type for LN addresses * Generate __resolveType from wallet.type column
23 lines
666 B
JavaScript
23 lines
666 B
JavaScript
export function fieldToGqlArg (field) {
|
|
let arg = `${field.name}: String`
|
|
if (!field.optional) {
|
|
arg += '!'
|
|
}
|
|
return arg
|
|
}
|
|
|
|
export function generateResolverName (walletField) {
|
|
const capitalized = walletField[0].toUpperCase() + walletField.slice(1)
|
|
return `upsert${capitalized}`
|
|
}
|
|
|
|
export function generateTypeDefName (walletField) {
|
|
return walletField[0].toUpperCase() + walletField.slice(1)
|
|
}
|
|
|
|
export function walletTypeToResolveType (walletType) {
|
|
// wallet type is in UPPER_CASE but __resolveType requires PascalCase
|
|
const PascalCase = walletType.split('_').map(s => s[0].toUpperCase() + s.slice(1)).join()
|
|
return `Wallet${PascalCase}`
|
|
}
|