Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
console.log('mapping through choices', choice)
return Object.assign({}, {choice_text: choice.choice_text});
});
if (choices.length) data = Object.assign(data, {choices: choices})
}
console.log('question data', data)
delete data.id;
delete data.node;
return data;
}
}
Question.fields = {
id: attr(),
node: oneToOne('Node'),
allow_multiple: attr(),
type_constraint: attr()
};
Question.modelName = 'Question';
class Node extends CRUDModel {
denormalize() {
console.log('this', this.ref)
const sub_surveys = this.sub_surveys.toModelArray().map(sub_survey => sub_survey.denormalize())
console.log('this id', this.ref.id)
const question = this.question.denormalize();
// console.log('the question', question)
// const questionNode = Object.assign({}, question)
let data = Object.assign({}, this.ref, {node: question})
.toModelArray()
.forEach((link) => {
// #TODO check if this is safe when REMOVE_NODE deletes nodeModel
if (link.portFromModel.outputParent.id == payload.parameterId) {
link.portToModel.inputParent.update(payload.newValues);
}
});
break;
}
return undefined;
}
}
Link.modelName = 'Link';
Link.fields = {
id: attr(),
portFrom: fk({
to: 'Port',
as: 'portFromModel',
relatedName: 'outputLinks',
}),
portTo: fk({
to: 'Port',
as: 'portToModel',
relatedName: 'inputLinks',
}),
};
export default Link;
orm,
(state) => state.orm,
(session) => {
return session.Sticky.all().toRefArray();
}
);
export const nodes = createSelector(
orm,
(state) => state.orm,
(session) => {
return session.Node.all().toRefArray();
}
);
export const languageNames = createSelector(
orm,
(state) => state.orm,
(session) => {
return session.Language.all()
.toModelArray()
.map((language) => language.name);
}
);
export const nodesWithParameters = createSelector(
orm,
(state) => state.orm,
(session) => {
// #TODO: this graph is quite some antipattern to functional
// programming...
const nodes = session.Node.all().toModelArray();
(session) => {
return session.Node.all().toRefArray();
}
);
export const languageNames = createSelector(
orm,
(state) => state.orm,
(session) => {
return session.Language.all()
.toModelArray()
.map((language) => language.name);
}
);
export const nodesWithParameters = createSelector(
orm,
(state) => state.orm,
(session) => {
// #TODO: this graph is quite some antipattern to functional
// programming...
const nodes = session.Node.all().toModelArray();
const graph = Graph.getInstance();
let sorted;
try {
const order = GraphAlgorithms.topsort(graph);
sorted = nodes.sort((a, b) => order.findIndex((id) => id === a.id)
- order.findIndex((id) => id === b.id));
} catch (error) {
// #TODO not sure how to check this:
// if (error instanceof CycleException) {
class Bucket extends CRUDModel {
denormalize() {
const data = Object.assign({}, this.ref)
delete data.id;
delete data.survey;
return data;
}
};
Bucket.modelName = 'Bucket';
Bucket.fields = {
id: attr(), // non-relational field for any value; optional but highly recommended
bucket_type: attr(),
bucket: attr(),
survey: fk('Survey', 'buckets')
};
class Logic extends CRUDModel {
denormalize() {
const data = Object.assign({}, this.ref)
delete data.id
delete data.question
return data
}
};
Logic.modelName = 'Logic';
Logic.fields = {
id: attr(),
.forEach((link) => {
// #TODO check if this is safe when REMOVE_NODE deletes nodeModel
if (link.portFromModel.outputParent.id == payload.parameterId) {
link.portToModel.inputParent.update(payload.newValues);
}
});
break;
}
return undefined;
}
}
Link.modelName = 'Link';
Link.fields = {
id: attr(),
portFrom: fk({
to: 'Port',
as: 'portFromModel',
relatedName: 'outputLinks',
}),
portTo: fk({
to: 'Port',
as: 'portToModel',
relatedName: 'inputLinks',
}),
};
export default Link;
name: nodeLanguage,
nodes: [payload.id],
});
}
});
break;
}
return undefined;
}
}
Language.modelName = 'Language';
Language.fields = {
name: attr(),
numberInEditor: attr(),
// languages
nodes: many({
to: 'Node',
as: 'nodes',
relatedName: 'languages',
}),
};
export default Language;
}
static get modelName() {
return 'Comment';
}
static get options() {
return {
idAttribute: 'id'
};
}
}
/* Schema ==================================================================== */
const schema = new ORM();
schema.register(Post, Comment);
/* Export Schema ==================================================================== */
export default schema;
}
static get modelName() {
return 'Notification';
}
static get options() {
return {
idAttribute: 'id'
};
}
}
/* Schema ==================================================================== */
const schema = new ORM();
schema.register(Notification);
/* Export Schema ==================================================================== */
export default schema;
}
static get modelName() {
return 'Conversation';
}
static get options() {
return {
idAttribute: 'id'
};
}
}
/* Schema ==================================================================== */
const schema = new ORM();
schema.register(Message, Conversation);
/* Export Schema ==================================================================== */
export default schema;