Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
response = normalize(response, {
articles: arrayOf(article1)
});
}
}
// new Schema(key, [options])
const article2 = new Schema('articles');
// You can use a custom id attribute
const article3 = new Schema('articles', { idAttribute: 'slug' });
// Or you can specify a function to infer it
function generateSlug(entity: any) { /* ... */ }
const article4 = new Schema('articles', { idAttribute: generateSlug });
// Schema.prototype.define(nestedSchema)
const article5 = new Schema('articles');
const user5 = new Schema('users');
article5.define({
author: user5
});
// Schema.prototype.getKey()
const article6 = new Schema('articles');
article6.getKey();
// articles
};
// You can specify the name of the attribute that determines the schema
article9.define({
assets: arrayOf(asset9, { schemaAttribute: 'type' })
});
// Or you can specify a function to infer it
function inferSchema9(entity: any) { /* ... */ }
article9.define({
assets: arrayOf(asset9, { schemaAttribute: inferSchema9 })
});
// valuesOf(schema, [options])
const article10 = new Schema('articles');
const user10 = new Schema('users');
article10.define({
collaboratorsByRole: valuesOf(user10)
});
const article11 = new Schema('articles');
const user11 = new Schema('users');
const group11 = new Schema('groups');
const collaborator11 = {
users: user11,
groups: group11
};
// You can specify the name of the attribute that determines the schema
article11.define({
// users: {
// 7: { ... },
// ..
// }
// }
// }
response = normalize(response, {
articles: arrayOf(article1)
});
}
}
// new Schema(key, [options])
const article2 = new Schema('articles');
// You can use a custom id attribute
const article3 = new Schema('articles', { idAttribute: 'slug' });
// Or you can specify a function to infer it
function generateSlug(entity: any) { /* ... */ }
const article4 = new Schema('articles', { idAttribute: generateSlug });
// Schema.prototype.define(nestedSchema)
const article5 = new Schema('articles');
const user5 = new Schema('users');
article5.define({
author: user5
});
// }
// }
// }
response = normalize(response, {
articles: arrayOf(article1)
});
}
}
// new Schema(key, [options])
const article2 = new Schema('articles');
// You can use a custom id attribute
const article3 = new Schema('articles', { idAttribute: 'slug' });
// Or you can specify a function to infer it
function generateSlug(entity: any) { /* ... */ }
const article4 = new Schema('articles', { idAttribute: generateSlug });
// Schema.prototype.define(nestedSchema)
const article5 = new Schema('articles');
const user5 = new Schema('users');
article5.define({
author: user5
});
// Schema.prototype.getKey()
import { routerStateReducer as router } from "redux-router";
import { combineReducers } from "redux";
import * as ActionTypes from "../actions";
import { normalize, Schema, arrayOf } from "normalizr";
import _ from "lodash";
import {fromJS} from "immutable";
const Moment = new Schema("moments");
//const Transcript = new Schema("transcripts");
const Mission = new Schema("missions");
Moment.define({
//transcripts: arrayOf(Transcript), //removed from moment
mission: Mission
});
//TODO: figure this out
// Transcripts.define({
// transcripts: arrayOf(Transcript)
// });
const initialMomentState = {entities: {}, result: null, loading: false};
const initialTranscriptState = {transcripts: [], loading: false};
const initialAudioState = {audio: null, time: 0};
}
if (schemas) return schemas
// Content types with `id` properties
categorySchema = new Schema(ContentTypesPlural[ContentTypes.Category], { idAttribute })
commentSchema = new Schema(ContentTypesPlural[ContentTypes.Comment], { idAttribute })
mediaSchema = new Schema(ContentTypesPlural[ContentTypes.Media], { idAttribute })
pageSchema = new Schema(ContentTypesPlural[ContentTypes.Page], { idAttribute })
postSchema = new Schema(ContentTypesPlural[ContentTypes.Post], { idAttribute })
revisionSchema = new Schema(ContentTypesPlural[ContentTypes.PostRevision], { idAttribute })
tagSchema = new Schema(ContentTypesPlural[ContentTypes.Tag], { idAttribute })
userSchema = new Schema(ContentTypesPlural[ContentTypes.User], { idAttribute })
// Content types without `id` properties
postTypeSchema = new Schema(ContentTypesPlural[ContentTypes.PostType], { idAttribute: 'slug' })
postStatusSchema = new Schema(ContentTypesPlural[ContentTypes.PostStatus], { idAttribute: 'slug' })
taxonomySchema = new Schema(ContentTypesPlural[ContentTypes.Taxonomy], { idAttribute: 'slug' })
mediaSchema.define({
author: userSchema,
post: postSchema
})
pageSchema.define({
author: userSchema,
featuredMedia: mediaSchema
})
postSchema.define({
author: userSchema,
featuredMedia: mediaSchema,
// @flow
import { Schema } from 'normalizr';
import reducer from './reducer';
import createActions from './actions';
const schema = new Schema('directories');
export type Directory = {
id: string,
title: string;
directoryId: string;
sourceId: string;
open: boolean;
};
const actions = createActions(schema);
export default {
schema,
actions,
reducer,
};
));
};
export const DIRECTORY_LOADING = 'redux/cherrymusicapi/directory_loading';
export const DIRECTORY_LOADED = 'redux/cherrymusicapi/directory_loaded';
export const DIRECTORY_LOAD_ERROR = 'redux/cherrymusicapi/directory_load_error';
export const METADATA_LOAD_ENQUEUE = 'redux/cherrymusicapi/metadata_load_enqueue';
export const METADATA_LOAD = 'redux/cherrymusicapi/metadata_load';
export const METADATA_LOADING = 'redux/cherrymusicapi/metadata_loading';
export const METADATA_LOADED = 'redux/cherrymusicapi/metadata_loaded';
export const METADATA_LOAD_ERROR = 'redux/cherrymusicapi/metadata_load_error';
const trackSchema = new Schema('track', { idAttribute: 'path' });
const collectionSchema = new Schema('collection', { idAttribute: 'path' });
const compactSchema = new Schema('compact', { idAttribute: 'id' });
const playlistSchema = new Schema('playlist', { idAttribute: 'plid' });
export const LoadingStates = {
idle: 'idle',
loading: 'loading',
loaded: 'loaded',
error: 'error',
};
export const MetaDataLoadingStates = {
idle: 'idle',
loading: 'loading',
loaded: 'loaded',
error: 'error',
};
import { Schema, arrayOf } from 'normalizr';
const governor = new Schema('governors', {idAttribute: 'name'});
const term = new Schema('terms');
const policy = new Schema('policies');
const commitment = new Schema('commitments');
const progressReport = new Schema('progressReports');
const progressReportHistory = new Schema('progressReportHistories');
const progressRating = new Schema('progressRatings');
const user = new Schema('users');
governor.define({
Policies: arrayOf(policy),
Terms: arrayOf(term),
});
policy.define({
Commitments: arrayOf(commitment),
});
commitment.define({
ProgressReports: arrayOf(progressReport),
});
progressReport.define({
import { Schema, arrayOf } from 'normalizr'
export const sectionSchema = new Schema('sections')
export const personSchema = new Schema('persons')
export const topicSchema = new Schema('topics')
export const tagSchema = new Schema('tags')
export const imageSchema = new Schema('images')
export const articleSchema = new Schema('articles')
export const pageSchema = new Schema('pages')
export const templateSchema = new Schema('templates')
export const fileSchema = new Schema('files')
export const gallerySchema = new Schema('galleries')
export const zoneSchema = new Schema('zones')
export const widgetSchema = new Schema('widgets')
export const eventSchema = new Schema('events')
export const userSchema = new Schema('users')
export const videoSchema = new Schema('videos')
articleSchema.define({
section: sectionSchema,
authors: arrayOf(personSchema),
tags: arrayOf(tagSchema),
topic: topicSchema,
template: templateSchema,
featured_image: {
image: imageSchema,
}
})