1
0
Fork 0
mirror of https://github.com/FrankerFaceZ/FrankerFaceZ.git synced 2025-10-13 22:41:57 +00:00

4.0.0-rc13.5

* Fixed: Stream up-time on channels.
* Fixed: More improvements to GraphQL merging logic.
* Fixed: Remove debug logging.
This commit is contained in:
SirStendec 2018-10-16 18:04:54 -04:00
parent 551a08bfd0
commit 87f3f1835b
9 changed files with 106 additions and 78 deletions

View file

@ -6,7 +6,7 @@
// ============================================================================
import Module from 'utilities/module';
import {get, deep_copy} from 'utilities/object';
import {get} from 'utilities/object';
import merge from 'utilities/graphql';
@ -213,9 +213,6 @@ export default class Apollo extends Module {
query = query_map && query_map.get(id),
modifiers = this.modifiers[operation];
const pre_modification = deep_copy(request.query);
if ( modifiers ) {
for(const mod of modifiers) {
if ( typeof mod === 'function' )
@ -249,8 +246,6 @@ export default class Apollo extends Module {
this.log.info('Unable to find GQL Print. Clearing store for query:', operation);
this.client.queryManager.queryStore.store[id] = null;
}
this.log.info('Query', operation, pre_modification, request.query, request.variables);
}
apolloPostFlight(response) {

View file

@ -1,5 +1,3 @@
import { deep_copy } from "./object";
'use strict';
// ============================================================================
@ -77,11 +75,15 @@ export const MERGE_METHODS = {
export function mergeList(a, b) {
let has_operation = false;
const a_names = {};
for(const item of a) {
if ( ! item || ! item.name || item.name.kind !== 'Name' )
continue;
if ( item.operation )
has_operation = true;
a_names[item.name.value] = item;
}
@ -92,10 +94,20 @@ export function mergeList(a, b) {
const name = item.name.value,
idx = a_names[name] ? a.indexOf(a_names[name]) : -1;
if ( idx !== -1 )
if ( idx !== -1 ) {
if ( a[idx].operation && item.operation && a[idx].operation !== item.operation )
continue;
a[idx] = merge(a[idx], item);
else
if ( a[idx].operation )
has_operation = true;
} else {
if ( has_operation && item.operation )
continue;
a.push(item);
}
}
return a;

View file

@ -11,6 +11,18 @@ export function sleep(delay) {
return new Promise(s => setTimeout(s, delay));
}
export function make_enum(...array) {
const out = {};
for(let i=0; i < array.length; i++) {
const word = array[i];
out[word] = i;
out[i] = word;
}
return out;
}
export function timeout(promise, delay) {
return new Promise((resolve, reject) => {