Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
willTransition: function(transition) {
this._super(...arguments);
if (
typeof transition !== 'undefined' &&
(transition.from.name.endsWith('nspaces.create') ||
transition.from.name.startsWith('nspace.dc.acls.tokens'))
) {
// Only when we create, reload the nspaces in the main menu to update them
// as we don't block for those
// And also when we [Use] a token reload the nspaces that you are able to see,
// including your permissions for being able to manage namespaces
// Potentially we should just do this on every single transition
// but then we would need to check to see if nspaces are enabled
Promise.all([
this.nspacesRepo.findAll(),
this.nspacesRepo.authorize(
get(this.controller, 'dc.Name'),
get(this.controller, 'nspace.Name')
),
]).then(([nspaces, permissions]) => {
if (typeof this.controller !== 'undefined') {
this.controller.setProperties({
nspaces: nspaces,
permissions: permissions,
});
}
});
}
},
},
build() {
this._seen = Object.create(null);
this.onBuildStart();
// TODO this could cache much more than it currently does across rebuilds, but we'd need to be smart to invalidate
// things correctly when dependencies change
let processPromises = this.listFiles().map((sourcePath) => {
return this.process(ensurePosixPath(sourcePath));
});
return Promise.all(processPromises)
.then((result) => {
this.onBuildSuccess();
this.onBuildEnd();
return result;
})
.catch((error) => {
this.onBuildError();
this.onBuildEnd();
throw error;
});
}
it('returns limited amount of documents', function() {
var results1 = collection.limit(3).get();
var results2 = collection.limit(1).get();
var results3 = collection.limit(6).get();
var results4 = collection.limit(10).get();
db.flush();
return Promise.all([
expect(results1).to.eventually.have.property('size').to.equal(3),
expect(results2).to.eventually.have.property('size').to.equal(1),
expect(results3).to.eventually.have.property('size').to.equal(6),
expect(results4).to.eventually.have.property('size').to.equal(6)
]);
});
});
rejectAll() {
this.requests.forEach((request) => request.reject());
return EmberPromise.all(this.requests);
}
}
loadImages() {
const images = this.images();
if (images) {
return Promise.all(
Object.keys(images).map((id) => {
return loadImage(images[id]).then((img) => (this[id] = img));
})
);
}
return Promise.resolve();
},
save() {
let promiseLabel = `DS: RecordArray#save ${this.modelName}`;
let promise = Promise.all(this.invoke('save'), promiseLabel).then(
() => this,
null,
'DS: RecordArray#save return RecordArray'
);
return PromiseArray.create({ promise });
},
_scheduleFetchMany(internalModels, options) {
let fetches = new Array(internalModels.length);
for (let i = 0; i < internalModels.length; i++) {
fetches[i] = this._scheduleFetch(internalModels[i], options);
}
return Promise.all(fetches);
},
run: function(commandOptions, rawArgs) {
var port = commandOptions.port;
var self = this;
var ngrokServer = new Promise(function(resolve, reject) {
ngrok.connect(port, function(err, url) {
ncp.copy(url);
self.ui.writeLine('Your sharable URL is ' + url + ' and has been copied to your clipboard.');
resolve();
});
});
return Promise.all([ngrokServer, this._super.run.apply(this, arguments)]);
}
})
});
const iv = window.crypto.getRandomValues(new Uint8Array(12));
const encryptedPromise = Promise.all([
decryptedPromise,
keyPromise
]).then(([decrypted, key]) => {
return window.crypto.subtle.encrypt(
{ name: "AES-GCM", iv, tagLength: 128 },
key,
decrypted
);
});
Promise.all([encryptedPromise, exportedKeyPromise, dataPromise]).then(
([encrypted, exportedKey, data]) => {
uploadsKeys[file.name] = exportedKey;
uploadsType[file.name] = file.type;
uploadsData[file.name] = data;
const blob = new Blob([iv, encrypted], {
type: "application/x-binary"
});
const f = new File([blob], `${file.name}.encrypted`);
editor.$().fileupload("send", {
files: [f],
originalFiles: [f],
formData: { type: "composer" }
});
}
);