Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const pick = (
key: K,
init?: Context[K] | Options[K],
): Context[K] | Options[K] => {
return prioritize(context[key], this.options[key], init);
};
return Math.random()
.toString(36)
.substr(2, 9);
}
const headers =
context.headers &&
context.headers.keys().map((k: string) => context.headers.get(k));
const opts = JSON.stringify({
includeQuery: context.includeQuery,
includeExtensions: context.includeExtensions,
headers,
});
return prioritize(context.uri, this.options.uri) + opts;
}
return operations.map(operation => {
const includeExtensions = prioritize(
operation.getContext().includeExtensions,
this.options.includeExtensions,
false,
);
const includeQuery = prioritize(
operation.getContext().includeQuery,
this.options.includeQuery,
true,
);
const body: Body = {
operationName: operation.operationName,
variables: operation.variables,
};
if (includeExtensions) {
body.extensions = operation.extensions;
}
if (includeQuery) {
body.query = print(operation.query);
private createOptions(operations: Operation[]): Options {
const context: Context = operations[0].getContext();
return {
method: prioritize(context.method, this.options.method, defaults.method),
uri: prioritize(context.uri, this.options.uri, defaults.uri),
withCredentials: prioritize(
context.withCredentials,
this.options.withCredentials,
),
};
}
private createOptions(operations: Operation[]): Options {
const context: Context = operations[0].getContext();
return {
method: prioritize(context.method, this.options.method, defaults.method),
uri: prioritize(context.uri, this.options.uri, defaults.uri),
withCredentials: prioritize(
context.withCredentials,
this.options.withCredentials,
),
};
}