- * @returns {array} Array of names of resource types.
- */
- __get_all_collections: function(chips){
- const names = [];
- for (const collection in chips.collection){
- names.push(collection);
- }
- return names;
- },
- get_all_collections: function(){
- return this.__get_all_collections(chips);
- },
- /**
- * Checks if chip exists
- * @param {string} type - chip type
- * @param {string} name - chip name
- * @returns {boolean} true if exists, otherwise false
- */
- chip_exists: function(type, name){
- if (chips[type] && chips[type][name]){
- return true;
- } else {
- return false;
- }
- },
- __get_chip: function(chips, type, name){
- try {
- const ret = chips[type][name];
- if (ret === undefined){
- throw new Error(`Chip of type ${type} and name ${name} has not yet been registered`);
- }
- return ret;
- } catch (e){
- throw new Errors.ValidationError(`ChipManager was asked to return a chip of type "${type}" and name "${name}", but it was not found`, {}, {short_message: "chip_not_found"});
- throw Errors.Error("Chip manager was requested to return a datastore chip. Multiple chips of type `datastore` have been registered, and no default provided in configuration.");
- log_error(`Syntax error in sealious.yml:\n#{e.message}`);
- process.exit(1);
- } else if (e.code === "ENOENT"){
- log("\n\n\tNo 'sealious.yml' file detected.\n\tConsider creating it alongside your app's package.json file if you want to configure the app's chips.\n\n");