Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const DEFAULTS = {
// The name of the index
name: String(),
// Creates a unique index so that the collection will not accept insertion
// of documents where the index key or keys match an existing value in the index.
unique: Boolean(true),
// Builds the index in the background so that building
// an index does not block other database activities.
background: Boolean(false),
// If true, the index only references documents with the specified field.
sparse: Boolean(false),
// Order of the index
ascending: Boolean(true)
};
class Index extends Record(DEFAULTS) {
/**
* Ensure the index is created
* @param {MongoDB.Collection} collection
* @param {String} field
* @return {Promise}
*/
ensure(collection, field) {
const options = this.toMongoOptions();
return Promise.nfcall(
collection.createIndex.bind(collection),
{
[field]: this.ascending ? 1 : -1
},
type?: string
name?: string,
_attachments?: any,
referencingDocuments?: Immutable.List,
};
const defaultMediaModelParams = {
modelType: 'MediaModel',
webContent: new contentTypes.WebContent(),
guid: '',
type: types.LegacyTypes.webcontent,
name: '',
_attachments: {},
referencingDocuments: Immutable.List(),
};
export class MediaModel extends Immutable.Record(defaultMediaModelParams) {
modelType: 'MediaModel';
webContent: contentTypes.WebContent;
guid: string;
type: string;
name: string;
// tslint:disable-next-line
_attachments: any;
referencingDocuments: Immutable.List;
constructor(params?: MediaModelParams) {
params ? super(params) : super();
}
},
});
/**
* This is a customized fromJs function used to translate plain old Javascript
* objects into this Immutable Record. Example usage:
*
* // The pojo is your javascript object
* const record = FloatClause.fromJs(pojo);
*/
FloatClause.fromJs = function fromJs(pojo) {
const pojoWithNestedImmutables = RecordUtils.fromJs(pojo, FloatClause.fromJsReviver);
return new extended_FloatClause(pojoWithNestedImmutables);
};
export const StringClause = Immutable.Record({
// optional STRING
comparator: undefined,
// optional STRING
value: undefined,
}, 'StringClause');
/**
* By default Immutable.fromJS will translate an object field in JSON into Immutable.Map.
* This reviver allow us to keep the Immutable.Record type when serializing JSON message
* into nested Immutable Record class.
*/
StringClause.fromJsReviver = function fromJsReviver(key, value) {
switch (key) {
default:
return Immutable.fromJS(value);
if (types.ExpressionStatement.check(stmt)) {
return stmt.expression;
}
else {
return fail('not an expression statement', stmt)();
}
}), parse.finish)(body.body, 0, function(expr) {
return aeval(store, environment, expr);
}, fail('failed to parse body', body.body));
}, fail('not a function expression', this.fun));
}
}
var Call = new Record({
type: 'Call',
store: null,
environment: null,
f: null,
es: null,
kont: null,
label: null
});
Call.prototype.succs = function() {
var store = this.store, environment = this.environment;
var args = new List(this.es).map(function(e) {
return Au(store, environment, e);
});
export const makePathUserSetting: I.RecordFactory = I.Record({
sort: makeSortSetting(),
})
export const makeTransferState: I.RecordFactory = I.Record({
type: 'download',
entryType: 'unknown',
path: Types.stringToPath(''),
localPath: '',
completePortion: 0,
error: undefined,
isDone: false,
})
export const makeState: I.RecordFactory = I.Record({
pathItems: I.Map([[Types.stringToPath('/keybase'), makeFolder()]]),
pathUserSettings: I.Map([[Types.stringToPath('/keybase'), makePathUserSetting()]]),
loadingPaths: I.Set(),
transfers: I.Map(),
})
const makeBasicPathItemIconSpec = (iconType: IconType, iconColor: string): Types.PathItemIconSpec => ({
type: 'basic',
iconType,
iconColor,
})
const makeTeamAvatarPathItemIconSpec = (teamName: string): Types.PathItemIconSpec => ({
type: 'teamAvatar',
teamName,
})
FILE_BROWSER_GET_LIST,
} from '../actions'
export const Folder = new Record({
type: 'folder',
name: '',
path: '',
})
export const File = new Record({
type: 'file',
name: '',
path: '',
extension: '',
date: null,
})
export const FileBrowseState = new Record({
folders: new List(),
files: new List(),
path: '',
isRequesting: false,
lastError: null,
})
export const FileStates = new Record({
replays: new FileBrowseState(),
maps: new FileBrowseState(),
})
export default keyedReducer(new FileStates(), {
[FILE_BROWSER_GET_LIST_BEGIN](state, action) {
return state.setIn([action.payload.browseId, 'isRequesting'], true)
},
export class ModelDef extends Record(modelDefDefaults) {
constructor(params: ModelDefProps) {
super(params);
}
get(value: T): ModelDefProps[T] {
return super.get(value);
}
}
const contextDefaults = {
project: (null as any) as Project,
models: List(),
};
export class Context extends Record(contextDefaults) {
constructor(project: Project, model: Model, prevContext?: Context) {
const models = prevContext ? prevContext.models : List();
super({
project,
models: models.push(model),
});
}
get parent(): Model {
return defined(this.models.last());
}
get mainModel(): Model {
return defined(this.project.model(this.project.main.modelName));
}
/**
* @type {string}
*/
elementReference: null,
/**
* @type {string}
*/
_path: null
});
/**
* @constructor
* @param {object} model
*/
var SmartObject = Immutable.Record({
/**
* @type {string}
*/
_obj: null,
/**
* @type {string}
*/
fileReference: null,
/**
* @type {boolean}
*/
linked: null,
/**
import I from 'immutable';
const _type = I.Record({
name: null,
}, 'type');
export const TYPE_MOORE = _type({name: "moore"});
export const TYPE_MEALY = _type({name: "mealy"});
export const _stateMachine = I.Record({
type: TYPE_MOORE,
inputs: I.List(),
outputs: I.List(),
states: I.List(),
initialState: null,
}, 'stateMachine');
export const _input = I.Record({
name: "",
initialValue: false,
}, 'input');
export const _output = I.Record({
name: "",
}, 'output');
import { Record } from 'immutable';
import Team from './Team';
const defaults = {
homeTeam: new Team(),
awayTeam: new Team(),
};
export default class Matchup extends Record(defaults) {}