Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
parseFieldAccess(args) {
const parsedAccess = parseFieldAccess(args);
const fieldDefaults = { create: false, update: false, delete: false };
return Object.keys(parsedAccess).reduce((prev, schemaName) => {
prev[schemaName] = { ...fieldDefaults, read: parsedAccess[schemaName].read };
return prev;
}, {});
}
}
parseFieldAccess(args) {
return parseFieldAccess(args);
}
this.lists = {};
this.listsArray = [];
this.getListByKey = key => this.lists[key];
this._extendedTypes = [];
this._extendedQueries = [];
this._extendedMutations = [];
this._graphQLQuery = {};
this._cookieSecret = cookieSecret;
this._secureCookies = secureCookies;
this._cookieMaxAge = cookieMaxAge;
this._sessionStore = sessionStore;
this.eventHandlers = { onConnect };
this.registeredTypes = new Set();
this._schemaNames = schemaNames;
this.appVersion = appVersion;
this.appVersion.access = parseCustomAccess({
access: this.appVersion.access,
schemaNames: this._schemaNames,
defaultAccess: true,
});
if (adapters) {
this.adapters = adapters;
this.defaultAdapter = defaultAdapter;
} else if (adapter) {
this.adapters = { [adapter.constructor.name]: adapter };
this.defaultAdapter = adapter.constructor.name;
} else {
throw new Error('No database adapter provided');
}
this.queryLimits = {
const _parseAccess = obj => ({
...obj,
access: parseCustomAccess({
access: obj.access,
schemaNames: this._schemaNames,
defaultAccess: this.defaultAccess.custom,
}),
});
createManyMutationName: `create${_listQueryName}`,
whereInputName: `${_itemQueryName}WhereInput`,
whereUniqueInputName: `${_itemQueryName}WhereUniqueInput`,
updateInputName: `${_itemQueryName}UpdateInput`,
createInputName: `${_itemQueryName}CreateInput`,
updateManyInputName: `${_listQueryName}UpdateInput`,
createManyInputName: `${_listQueryName}CreateInput`,
relateToManyInputName: `${_itemQueryName}RelateToManyInput`,
relateToOneInputName: `${_itemQueryName}RelateToOneInput`,
};
this.adapterName = adapter.name;
this.adapter = adapter.newListAdapter(this.key, adapterConfig);
this._schemaNames = schemaNames;
this.access = parseListAccess({
schemaNames: this._schemaNames,
listKey: key,
access,
defaultAccess: this.defaultAccess.list,
});
this.queryLimits = {
maxResults: Infinity,
...queryLimits,
};
if (this.queryLimits.maxResults < 1) {
throw new Error(`List ${label}'s queryLimits.maxResults can't be < 1`);
}
if (!['object', 'function', 'undefined'].includes(typeof cacheHint)) {
throw new Error(`List ${label}'s cacheHint must be an object or function`);