Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
fileExists(filePath) {
return new EmberPromise(function(resolve) {
let filer = this.get('filer');
filer.fs.root.getFile(filePath, {}, function() {
resolve(true);
}, function() {
// if ls errs, file doesn't exist.
resolve(false);
});
}.bind(this));
},
export default function fdPreloadStageMetadata(store, stagePk) {
return new Promise(function(resolve, reject) {
let promises = [];
const projectionName = 'FdPreloadMetadata';
// stage promise
let modelName = 'fd-dev-stage';
let q = new Builder(store, modelName)
.selectByProjection(projectionName)
.byId(stagePk)
.build();
promises.push(store.query(modelName, q));
// classes promise
promises.push(getPromise(store, stagePk, 'fd-dev-class', projectionName));
// associations promise
load({ user_id }) {
let signInThing = this.signInThing;
let user = { id: user_id, name: 'alex' };
return new Promise(r => {
setTimeout(() => {
r({
user,
fun: Math.floor(300 * Math.random()),
})
}, 800);
});
}
}
function writeFile(rootPath, filePath, contents) {
return new RSVP.Promise(function(resolve) {
fs.writeFile(path.join(rootPath, filePath), contents, resolve);
});
}
beforeUpdate() {
let isFulfilling = this.get('isFulfilling');
let isNew = this.get('model.isNew');
if (isNew || isFulfilling) {
return new EmberPromise(function(resolve, reject) {
let newMedication = this.get('model');
newMedication.validate().then(function() {
if (newMedication.get('isValid')) {
if (isNew) {
if (isEmpty(newMedication.get('patient'))) {
this.addNewPatient();
reject({
ignore: true,
message: 'creating new patient first'
});
} else {
newMedication.set('medicationTitle', newMedication.get('inventoryItem.name'));
newMedication.set('priceOfMedication', newMedication.get('inventoryItem.price'));
newMedication.set('status', 'Requested');
newMedication.set('requestedBy', newMedication.getUserName());
newMedication.set('requestedDate', new Date());
router.post('/validate', function (req, res) {
var fileName = tempDir + '/' + Guid.raw(),
parametersFileName = tempDir + '/' + Guid.raw(),
promise = new RSVP.Promise((resolve) => {
resolve();
}),
preReqFileName,
preReqParametersFileName;
replaceSpecialParameterPlaceholders(req);
debug('pull request number: ' + req.body.pull_request);
if (req.body.pull_request) {
promise = promise
.then(() => {
return replaceRawLinksForPR(req.body.template, req.body.pull_request);
})
.then((modifiedTemplate) => {
debug('modified template is:');
debug(modifiedTemplate);
function checkMain(main, libDir) {
if (!main) {
return Promise.resolve(false);
}
if (main.substr(main.length - 3, 3) === '.js') {
main = main.substr(0, main.length - 3);
}
return new Promise(function(resolve) {
fs.exists(path.resolve(dir, libDir || '.', main) + '.js', function(exists) {
resolve(exists);
});
});
}
export function nextTick() {
return new RSVP.Promise((resolve) => {
schedule('afterRender', () => {
rAF(() => {
resolve();
});
});
});
}
project: project,
id: uuid.v4()
});
updateData.pushObject(configuration);
}
let stage = store.createRecord('fd-dev-stage', {
name: this.get('projectName'),
description: this.get('projectDescription'),
configuration: configuration,
});
this.get('appState').loading();
new Promise(function(resolve) {
if (updateData.length > 0) {
resolve(store.batchUpdate(updateData));
} else {
resolve();
}
})
.then(() => stage.save())
.then(() => {
currentProjectContext.setCurrentConfiguration(configuration);
currentProjectContext.setCurrentStage(stage);
return FdPreloadStageMetadata.call(this, store, currentProjectContext.getCurrentStage());
})
.then(() => currentProjectContext.getAutogeneratedSystemPromise())
.then(() => {
this.get('appState').reset();
this.props.actions.register(email, confirmEmail, firstName, lastName, password).then((success) => {
this.setState({ loading: false });
if (success) {
this.props.actions.updateAccountPromotions(promotionsChecked);
new RSVP.Promise((resolve) => {
this.props.actions.getUser()
.then(() => resolve())
.catch(() => resolve());
}).finally(() => {
this.props.history.push('/account-success');
});
}
});
});