Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
.catch(() => {
// For some users with no favourites, Gravity produces an error of "Collection Not Found".
// This can cause the Gravity endpoint to produce a 404, so we will intercept the error
// and return an empty list instead.
return connectionFromArray([], options)
})
},
resolve: (_, args) => connectionFromArray(getWidgets(args), args)
}
resolve: async (obj, args) => {
const array = await getObjectsFromUrls(obj[prop] || []);
return {
...connectionFromArray(array, args),
totalCount: array.length,
};
},
};
async resolve(user, args, { realm, authorization: a, pool }: Context) {
const tx = await pool.connect();
try {
return a
? connectionFromArray(
await filter(await user.grants(tx), grant =>
grant.isAccessibleBy(realm, a, tx)
),
args
)
: null;
} finally {
tx.release();
}
}
},
resolve: (faction, args) => connectionFromArray(
faction.ships.map((id) => getShip(id)),
args
),
},
WHERE
replacement_record_id IS NULL
${args.includeDisabled ? "" : "AND enabled = true"}
`
);
if (!ids.rows.length) {
return [];
}
const roles = await Role.read(
tx,
ids.rows.map(({ id }) => id)
);
return connectionFromArray(
await filter(roles, role => role.isAccessibleBy(realm, a, tx)),
args
);
} finally {
tx.release();
}
}
};
resolve: (base, args) => connectionFromArray(db.getKeys(), args),
};
resolve: async (_, args) => {
const sites = (await getAllSites())
.filter((site) => args.createdAfter ? new Date(args.createdAfter).getTime() < new Date(site.created).getTime() : true)
.filter((site) => args.environmentType ? args.environmentType == site.siteEnvironment : true);
return connectionFromArray(sites, args);
},
};