Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const fileAdapter = new LocalFileAdapter({
src: LOCAL_FILE_SRC,
path: LOCAL_FILE_ROUTE,
});
let embedAdapter;
if (process.env.NODE_ENV === 'test') {
embedAdapter = new MockOEmbedAdapter();
} else if (iframely.apiKey) {
embedAdapter = new IframelyOEmbedAdapter({ apiKey: iframely.apiKey });
}
let cloudinaryAdapter;
try {
cloudinaryAdapter = new CloudinaryAdapter({
...cloudinary,
folder: 'avatars',
});
} catch (e) {
// Downgrade from an error to a warning if the dev does not have a
// Cloudinary API Key set up. This will disable any fields which rely
// on this functionality.
console.warn(e.message);
}
keystone.createList('User', {
fields: {
name: { type: Text },
email: { type: Text, isUnique: true },
dob: {
type: CalendarDay,
const LOCAL_FILE_ROUTE = `${staticRoute}/avatars`;
const Stars = require('./custom-fields/Stars');
const getYear = require('date-fns/get_year');
// TODO: Make this work again
// const SecurePassword = require('./custom-fields/SecurePassword');
const { MongooseAdapter } = require('@keystonejs/adapter-mongoose');
const keystone = new Keystone({
name: 'Cypress Test Project Basic',
adapter: new MongooseAdapter(),
});
const fileAdapter = new LocalFileAdapter({
src: LOCAL_FILE_SRC,
path: LOCAL_FILE_ROUTE,
});
let embedAdapter;
if (process.env.NODE_ENV === 'test') {
embedAdapter = new MockOEmbedAdapter();
} else if (iframely.apiKey) {
embedAdapter = new IframelyOEmbedAdapter({ apiKey: iframely.apiKey });
}
let cloudinaryAdapter;
try {
cloudinaryAdapter = new CloudinaryAdapter({
...cloudinary,
import {
Text,
CloudinaryImage,
Integer,
Relationship,
} from '@keystonejs/fields';
import { CloudinaryAdapter } from '@keystonejs/file-adapters';
import { byTracking, atTracking } from '@keystonejs/list-plugins';
const cloudinaryAdapter = new CloudinaryAdapter({
cloudName: process.env.CLOUDINARY_CLOUD_NAME,
apiKey: process.env.CLOUDINARY_KEY,
apiSecret: process.env.CLOUDINARY_SECRET,
folder: 'sick-fits-keystone',
});
export default {
fields: {
name: { type: Text, isRequired: true },
description: { type: Text, isMultiline: true },
image: { type: CloudinaryImage, adapter: cloudinaryAdapter },
largeImage: { type: CloudinaryImage, adapter: cloudinaryAdapter },
price: { type: Integer },
user: {
type: Relationship,
ref: 'User',