/* FIXME: allBlockDevices, for representing every single block device that's hosted on this physical drive, linearly. Need to figure out how that works with representation of mdraid arrays, LVM volumes, etc. */
/* The below is to ensure that commands that produce a full list of all possible items, only ever get called and processed *once* per query, no matter what data is requested. */
/* FIXME: This seems to be added into a global registry somehow? How to specify this explicitly on a query without relying on globals? */
newgraphql.GraphQLScalarType({
name:"ByteSize",
description:"A value that represents a value on a byte scale",
serialize:(value)=>{
returnJSON.stringify(value);
},
parseValue:(value)=>{
returnJSON.parse(value);
},
parseLiteral:(value)=>{
returnJSON.parse(value);
},
});
newgraphql.GraphQLScalarType({
name:"TimeSize",
description:"A value that represents a value on a time scale",
serialize:(value)=>{
returnJSON.stringify(value);
},
parseValue:(value)=>{
returnJSON.parse(value);
},
parseLiteral:(value)=>{
returnJSON.parse(value);
},
});
functionwithProperty(dataSource,id,property){
returnwithData(dataSource,id,(value)=>{
returnvalue[property];
});
}
functionwithData(dataSource,id,callback){
returnfunction(_,{data}){
returnPromise.try(()=>{
if(data[dataSource]!=null){
returndata[dataSource].load(id);
}else{
thrownewError(`Specified data source '${dataSource}' does not exist`);
}
}).then((value)=>{
if(value!=null){
returncallback(value);
}else{
thrownewError(`Got a null value from data source '${dataSource}' for ID '${id}'`);
}
});
};
}
letAll=Symbol("All");
functioncreateLoaders(){
/* The below is to ensure that commands that produce a full list of all possible items, only ever get called and processed *once* per query, no matter what data is requested. */
/* FIXME: allBlockDevices, for representing every single block device that's hosted on this physical drive, linearly. Need to figure out how that works with representation of mdraid arrays, LVM volumes, etc. */
// FIXME: If we intend to target macOS, a lot of whitespace-based output splitting won't work: https://www.mail-archive.com/austin-group-l@opengroup.org/msg01678.html
// FIXME: If we intend to target macOS, a lot of whitespace-based output splitting won't work: https://www.mail-archive.com/austin-group-l@opengroup.org/msg01678.html