tempus-api-graphql
Version:
A GraphQL wrapper for the tempus api (tempus2.xyz)
175 lines (163 loc) • 5.16 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = void 0;
var _graphql = require("graphql");
var _tiers = _interopRequireDefault(require("./tiers"));
var _zone_type_enum = _interopRequireDefault(require("./zone_type_enum"));
var _zone = _interopRequireDefault(require("./zone"));
var _record = _interopRequireDefault(require("./record"));
var _player = _interopRequireDefault(require("./player"));
var _class_type_enum = _interopRequireDefault(require("./class_type_enum"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
var Author = new _graphql.GraphQLObjectType({
name: "Author",
fields: function fields() {
return {
id: {
type: new _graphql.GraphQLNonNull(_graphql.GraphQLInt)
},
name: {
type: new _graphql.GraphQLNonNull(_graphql.GraphQLString)
},
mapCount: {
type: new _graphql.GraphQLNonNull(_graphql.GraphQLInt),
resolve: function resolve(author) {
return author.map_count;
}
},
player: {
type: _player["default"]
}
};
}
});
var MapVideos = new _graphql.GraphQLObjectType({
name: "MapVideos",
fields: function fields() {
return {
soldier: {
type: _graphql.GraphQLString,
resolve: function resolve(videos) {
return videos.soldier && "https://youtube.com/watch?v=".concat(videos.soldier);
}
},
demoman: {
type: _graphql.GraphQLString,
resolve: function resolve(videos) {
return videos.demoman && "https://youtube.com/watch?v=".concat(videos.demoman);
}
}
};
}
});
var Zones = new _graphql.GraphQLObjectType({
name: "Zones",
fields: function fields() {
return {
bonus: {
type: new _graphql.GraphQLNonNull(new _graphql.GraphQLList(new _graphql.GraphQLNonNull(_zone["default"])))
},
bonusEnd: {
type: new _graphql.GraphQLNonNull(new _graphql.GraphQLList(new _graphql.GraphQLNonNull(_zone["default"])))
},
checkpoint: {
type: new _graphql.GraphQLNonNull(new _graphql.GraphQLList(new _graphql.GraphQLNonNull(_zone["default"])))
},
course: {
type: new _graphql.GraphQLNonNull(new _graphql.GraphQLList(new _graphql.GraphQLNonNull(_zone["default"])))
},
courseEnd: {
type: new _graphql.GraphQLNonNull(new _graphql.GraphQLList(new _graphql.GraphQLNonNull(_zone["default"])))
},
linear: {
type: new _graphql.GraphQLNonNull(new _graphql.GraphQLList(new _graphql.GraphQLNonNull(_zone["default"])))
},
map: {
type: new _graphql.GraphQLNonNull(new _graphql.GraphQLList(new _graphql.GraphQLNonNull(_zone["default"])))
},
mapEnd: {
type: new _graphql.GraphQLNonNull(new _graphql.GraphQLList(new _graphql.GraphQLNonNull(_zone["default"])))
},
misc: {
type: new _graphql.GraphQLNonNull(new _graphql.GraphQLList(new _graphql.GraphQLNonNull(_zone["default"])))
},
trick: {
type: new _graphql.GraphQLNonNull(new _graphql.GraphQLList(new _graphql.GraphQLNonNull(_zone["default"])))
}
};
}
});
var _default = new _graphql.GraphQLObjectType({
name: "Map",
description: "A jump map",
fields: function fields() {
return {
id: {
type: new _graphql.GraphQLNonNull(_graphql.GraphQLString)
},
name: {
type: new _graphql.GraphQLNonNull(_graphql.GraphQLString)
},
authors: {
type: new _graphql.GraphQLNonNull(new _graphql.GraphQLList(new _graphql.GraphQLNonNull(Author)))
},
videos: {
type: new _graphql.GraphQLNonNull(MapVideos)
},
tiers: {
type: new _graphql.GraphQLNonNull(_tiers["default"])
},
zones: {
type: new _graphql.GraphQLNonNull(Zones)
},
records: {
type: new _graphql.GraphQLNonNull(new _graphql.GraphQLList(new _graphql.GraphQLNonNull(_record["default"]))),
args: {
zoneType: {
type: _zone_type_enum["default"]
},
zoneId: {
type: _graphql.GraphQLInt
},
start: {
type: _graphql.GraphQLInt
},
limit: {
type: _graphql.GraphQLInt
},
"class": {
type: new _graphql.GraphQLNonNull(_class_type_enum["default"])
}
}
},
record: {
type: _record["default"],
args: {
zoneType: {
type: _zone_type_enum["default"]
},
zoneId: {
type: _graphql.GraphQLInt
},
playerId: {
type: new _graphql.GraphQLNonNull(_graphql.GraphQLInt)
},
"class": {
type: new _graphql.GraphQLNonNull(_class_type_enum["default"])
}
}
},
wr: {
type: _record["default"],
args: {
"class": {
type: new _graphql.GraphQLNonNull(_class_type_enum["default"])
}
}
}
};
}
});
exports["default"] = _default;