Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
},
auxTimelines(root, { simulatorId }) {
const sim = App.simulators.find(s => s.id === simulatorId);
return sim && sim.timelines;
}
},
Mutation: mutationHelper(schema),
Subscription: {
missionsUpdate: {
resolve: (rootValue, { missionId }) => {
if (missionId) {
return rootValue.filter(m => m.id === missionId);
}
return rootValue;
},
subscribe: withFilter(
() => pubsub.asyncIterator("missionsUpdate"),
(rootValue, { missionId }) => {
if (missionId) {
return !!rootValue.find(m => m.id === missionId);
}
return true;
}
)
},
auxTimelinesUpdate: {
resolve: (rootValue, { missionId }) => {
return rootValue.timelines;
},
subscribe: withFilter(
() => pubsub.asyncIterator("auxTimelinesUpdate"),
(rootValue, { simulatorId }) => {
);
if (!crm) return null;
let fighter = crm.fighters.find(c => c.clientId === clientId);
if (!fighter) {
fighter = crm.addFighter({ clientId });
}
return fighter;
}
},
Mutation: mutationHelper(schema),
Subscription: {
crmUpdate: {
resolve(rootQuery) {
return rootQuery;
},
subscribe: withFilter(
() => pubsub.asyncIterator("crmUpdate"),
(rootValue, { simulatorId }) => {
return rootValue.simulatorId === simulatorId;
}
)
},
crmFighterUpdate: {
resolve(rootQuery) {
return rootQuery;
},
subscribe: withFilter(
() => pubsub.asyncIterator("crmFighterUpdate"),
(rootValue, { simulatorId, clientId }) => {
return (
rootValue.simulatorId === simulatorId &&
rootValue.clientId === clientId
},
oneComputerCore(root, { id }) {
return App.systems.find(s => s.id === id);
}
},
Mutation: mutationHelper(schema),
Subscription: {
computerCoreUpdate: {
resolve(rootValue, { simulatorId }) {
let returnVal = rootValue;
if (simulatorId) {
returnVal = returnVal.filter(s => s.simulatorId === simulatorId);
}
return returnVal;
},
subscribe: withFilter(
() => pubsub.asyncIterator("computerCoreUpdate"),
(rootValue, { simulatorId }) => {
let returnVal = rootValue;
if (simulatorId) {
returnVal = returnVal.filter(s => s.simulatorId === simulatorId);
}
return returnVal.length > 0;
}
)
}
}
};
export default { schema, resolver };
if (simulatorId) {
return App.softwarePanels.filter(s => s.simulatorId === simulatorId);
}
return App.softwarePanels.filter(s => !s.simulatorId);
}
},
Mutation: mutationHelper(schema),
Subscription: {
softwarePanelsUpdate: {
resolve(rootValue, { simulatorId }) {
if (simulatorId) {
return rootValue.filter(s => s.simulatorId === simulatorId);
}
return rootValue.filter(s => !s.simulatorId);
},
subscribe: withFilter(
() => pubsub.asyncIterator("softwarePanelsUpdate"),
rootValue => true
)
}
}
};
export default { schema, resolver };
});
},
thruster(root, { id }) {
return App.systems.find(s => s.id === id);
}
},
Mutation: mutationHelper(schema),
Subscription: {
rotationChange: {
resolve(root, { simulatorId }) {
if (simulatorId) {
return root.simulatorId === simulatorId && root;
}
return root;
},
subscribe: withFilter(
() => pubsub.asyncIterator("rotationChange"),
rootValue => !!rootValue
)
}
}
};
export default { schema, resolver };
},
subscribe: withFilter(
() => pubsub.asyncIterator("coreFeedUpdate"),
(rootValue, { simulatorId }) => {
if (simulatorId) {
return !!rootValue.find(r => r.simulatorId === simulatorId);
}
return true;
}
)
},
syncTime: {
resolve(rootValue) {
return rootValue;
},
subscribe: withFilter(
() => pubsub.asyncIterator("syncTime"),
(rootValue, { simulatorId }) => {
if (rootValue.simulatorId === simulatorId) {
return true;
}
return false;
}
)
}
}
};
export default { schema, resolver };
)
},
cancelSound: {
resolve: payload => payload.id,
subscribe: withFilter(
() => pubsub.asyncIterator("cancelSound"),
(rootValue, { clientId }) => {
if (rootValue && rootValue.clients.indexOf(clientId) > -1)
return true;
return false;
}
)
},
cancelAllSounds: {
resolve: payload => !!payload,
subscribe: withFilter(
() => pubsub.asyncIterator("cancelAllSounds"),
(rootValue, { clientId }) => {
return rootValue && !!rootValue.find(c => c.id === clientId);
}
)
},
cancelLoopingSounds: {
resolve: payload => !!payload,
subscribe: withFilter(
() => pubsub.asyncIterator("cancelLoopingSounds"),
(rootValue, { clientId }) => {
return rootValue && !!rootValue.find(c => c.id === clientId);
}
)
}
}
longRangeCommunications(root, { simulatorId }) {
let lrComm = App.systems.filter(s => s.type === "LongRangeComm");
if (simulatorId) return lrComm.filter(s => s.simulatorId === simulatorId);
return lrComm;
}
},
Mutation: mutationHelper(schema),
Subscription: {
longRangeCommunicationsUpdate: {
resolve(rootValue, { simulatorId }) {
if (simulatorId) {
return rootValue.filter(s => s.simulatorId === simulatorId);
}
return rootValue;
},
subscribe: withFilter(
() => pubsub.asyncIterator("longRangeCommunicationsUpdate"),
rootValue => !!(rootValue && rootValue.length)
)
}
}
};
export default { schema, resolver };
const auth = getOAuthClient();
const sheets = google.sheets({ version: "v4", auth });
const sheet = await sheets.spreadsheets.get({ spreadsheetId });
return sheet;
}
},
Mutation: mutationHelper(schema),
Subscription: {
googleSheetsUpdate: {
resolve(rootValue, { simulatorId }) {
if (simulatorId) {
return rootValue.filter(s => s.simulatorId === simulatorId);
}
return rootValue;
},
subscribe: withFilter(
() => pubsub.asyncIterator("googleSheetsUpdate"),
(rootValue, args) => {
return true;
}
)
}
}
};
export default { schema, resolver };
groupName: groupName || '',
groupPicture: groupPicture || '',
}),
updateGroup: (obj, { chatId, groupName, groupPicture }, { injector }) => injector.get(ChatProvider).updateGroup(chatId, {
groupName: groupName || '',
groupPicture: groupPicture || '',
}),
removeChat: (obj, { chatId }, { injector }) => injector.get(ChatProvider).removeChat(chatId),
updateUser: (obj, { name, picture }, { injector }) => injector.get(ChatProvider).updateUser({
name: name || '',
picture: picture || '',
}),
},
Subscription: {
chatAdded: {
subscribe: withFilter((root, args, { injector }: ModuleContext) => injector.get(PubSub).asyncIterator('chatAdded'),
(data: { chatAdded: Chat, creatorId: number }, variables, { injector }: ModuleContext) =>
data && injector.get(ChatProvider).filterChatAddedOrUpdated(data.chatAdded, data.creatorId)
),
},
chatUpdated: {
subscribe: withFilter((root, args, { injector }: ModuleContext) => injector.get(PubSub).asyncIterator('chatUpdated'),
(data: { chatUpdated: Chat, updaterId: number }, variables, { injector }: ModuleContext) =>
data && injector.get(ChatProvider).filterChatAddedOrUpdated(data.chatUpdated, data.updaterId)
),
},
},
Chat: {
name: (chat, args, { injector }) => injector.get(ChatProvider).getChatName(chat),
picture: (chat, args, { injector }) => injector.get(ChatProvider).getChatPicture(chat),
allTimeMembers: (chat, args, { injector }) => injector.get(ChatProvider).getChatAllTimeMembers(chat),
listingMembers: (chat, args, { injector }) => injector.get(ChatProvider).getChatListingMembers(chat),