Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

microframework

Package Overview
Dependencies
Maintainers
1
Versions
38
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

microframework - npm Package Compare versions

Comparing version 0.1.4 to 0.1.5

Annotations.js

107

microframework.d.ts

@@ -46,2 +46,12 @@ declare module 'microframework/MicroFrameworkConfig' {

}
declare module 'microframework/MicroFrameworkUtils' {
import { Module } from 'microframework/Module';
export class MicroFrameworkUtils {
static getEnvironmentFile(file: string, environment: string): string;
static sortModulesByDependencies(modules: Module[]): void;
static deepClone<T>(object: T): T;
private static recursiveDependencies(dependencies, root?);
}
}
declare module 'microframework/exception/DependenciesMissingException' {

@@ -113,2 +123,6 @@ export class DependenciesMissingException extends Error {

/**
* Finds a module with given type registered in the registry.
*/
findModuleByType(type: Function): Module;
/**
* Bootstraps all modules.

@@ -127,5 +141,37 @@ */

}
declare module 'microframework/ConfigLoader' {
import { MicroFrameworkSettings } from 'microframework/MicroFrameworkSettings';
/**
* Loads configuration files into the framework.
*/
export class ConfigLoader {
private settings;
static DEFAULT_CONFIG_DIRECTORY: string;
static DEFAULT_CONFIG_FILE: string;
static DEFAULT_PARAMETERS_FILE: string;
constructor(settings: MicroFrameworkSettings);
/**
* Loads all configuration files and parameters.
*/
load(): void;
private loadConfigurations();
private loadParameters();
private requireFile(file);
private requireEnvironmentFile(file);
private getEnvironment();
private getConfigFiles();
private getParameterFiles();
}
}
declare module 'microframework/exception/MicroframeworkNameAlreadyExistException' {
export class MicroframeworkNameAlreadyExistException extends Error {
name: string;
constructor(name: string);
}
}
declare module 'microframework/MicroFrameworkBootstrapper' {
import { Container } from "typedi/Container";
import { MicroFrameworkSettings } from 'microframework/MicroFrameworkSettings';
import { Container } from "typedi/Container";
import { Configurator } from "configurator.ts/Configurator";

@@ -137,6 +183,10 @@ import { Module } from 'microframework/Module';

export class MicroFrameworkBootstrapper {
private nameOrSettings;
private settings;
private _configurator;
private modulesRegistry;
private _name;
private configuration;
constructor(settings: MicroFrameworkSettings);
constructor(name: string, settings: MicroFrameworkSettings);
/**

@@ -146,2 +196,3 @@ * Gets the Container of the typedi module.

container: Container;
name: string;
/**

@@ -152,2 +203,11 @@ * Gets the configurator used to config framework and its modules.

/**
* Sets the name used by microframework. Note that name must be set before bootstrapping the framework.
*/
setName(name: string): MicroFrameworkBootstrapper;
/**
* Sets the settings. Used if settings was not passed during object construction. Note that settings must be set
* before bootstrapping the framework.
*/
setSettings(settings: MicroFrameworkSettings): MicroFrameworkBootstrapper;
/**
* Registers all given modules in the framework.

@@ -160,2 +220,3 @@ */

registerModule(module: Module): MicroFrameworkBootstrapper;
findModuleByType(type: Function): Module;
/**

@@ -210,2 +271,6 @@ * Bootstraps the framework and all its modules.

/**
* Module can export some data which supposed to be used by other components.
*/
getModuleExports?<T>(): T;
/**
* Initializes module based on the given options. If this module's dependant modules are specified then instances

@@ -231,36 +296,20 @@ * of theses modules will be passed to this method.

}
declare module 'microframework/MicroFrameworkUtils' {
import { Module } from 'microframework/Module';
export class MicroFrameworkUtils {
static getEnvironmentFile(file: string, environment: string): string;
static sortModulesByDependencies(modules: Module[]): void;
static deepClone<T>(object: T): T;
private static recursiveDependencies(dependencies, root?);
declare module 'microframework/MicroFrameworkRegistry' {
import { MicroFrameworkBootstrapper } from 'microframework/MicroFrameworkBootstrapper';
export class MicroFrameworkRegistry {
private static instances;
static put(microFramework: MicroFrameworkBootstrapper): void;
static remove(microFramework: MicroFrameworkBootstrapper): void;
static get(name: string): MicroFrameworkBootstrapper;
static has(name: string): boolean;
}
}
declare module 'microframework/ConfigLoader' {
import { MicroFrameworkSettings } from 'microframework/MicroFrameworkSettings';
declare module 'microframework/Annotations' {
/**
* Loads configuration files into the framework.
* Gets the module
*/
export class ConfigLoader {
private settings;
static DEFAULT_CONFIG_DIRECTORY: string;
static DEFAULT_CONFIG_FILE: string;
static DEFAULT_PARAMETERS_FILE: string;
constructor(settings: MicroFrameworkSettings);
/**
* Loads all configuration files and parameters.
*/
load(): void;
private loadConfigurations();
private loadParameters();
private requireFile(file);
private requireEnvironmentFile(file);
private getEnvironment();
private getConfigFiles();
private getParameterFiles();
}
export function ModuleExports(moduleType: Function): Function;
export function ModuleExports(microframeworkName: string, moduleType: Function): Function;
}

@@ -11,2 +11,4 @@ "use strict";

var _typediContainer = require("typedi/Container");
var _ModulesRegistry = require("./ModulesRegistry");

@@ -16,6 +18,8 @@

var _typediContainer = require("typedi/Container");
var _configuratorTsConfigurator = require("configurator.ts/Configurator");
var _MicroFrameworkRegistry = require("./MicroFrameworkRegistry");
var _exceptionMicroframeworkNameAlreadyExistException = require("./exception/MicroframeworkNameAlreadyExistException");
/**

@@ -26,13 +30,21 @@ * This class runs microframework and its specified modules.

var MicroFrameworkBootstrapper = (function () {
// -------------------------------------------------------------------------
// Constructor
// -------------------------------------------------------------------------
function MicroFrameworkBootstrapper(settings) {
function MicroFrameworkBootstrapper(nameOrSettings, settings, _configurator, modulesRegistry, configLoader) {
_classCallCheck(this, MicroFrameworkBootstrapper);
this.nameOrSettings = nameOrSettings;
this.settings = settings;
new _ConfigLoader.ConfigLoader(settings).load();
this.configuration = _configuratorTsConfigurator.defaultConfigurator.get('framework');
this.modulesRegistry = new _ModulesRegistry.ModuleRegistry(settings, this.configuration, _configuratorTsConfigurator.defaultConfigurator);
this._configurator = _configurator;
this.modulesRegistry = modulesRegistry;
var name = undefined;
if (typeof nameOrSettings === 'string') {
name = nameOrSettings;
} else {
settings = nameOrSettings;
}
if (!_configurator) this._configurator = _configuratorTsConfigurator.defaultConfigurator;
if (!configLoader) configLoader = new _ConfigLoader.ConfigLoader(settings);
configLoader.load();
this.configuration = this._configurator.get('framework');
this.setName(name);
if (settings && !modulesRegistry) this.modulesRegistry = new _ModulesRegistry.ModuleRegistry(settings, this.configuration, this._configurator);
}

@@ -48,3 +60,3 @@

_createClass(MicroFrameworkBootstrapper, [{
key: "registerModules",
key: "setName",
// todo: find the way to remove global dependency

@@ -56,4 +68,26 @@

/**
* Sets the name used by microframework. Note that name must be set before bootstrapping the framework.
*/
value: function setName(name) {
if (_MicroFrameworkRegistry.MicroFrameworkRegistry.has(name || 'default')) throw new _exceptionMicroframeworkNameAlreadyExistException.MicroframeworkNameAlreadyExistException(name);
this._name = name || 'default';
return this;
}
/**
* Sets the settings. Used if settings was not passed during object construction. Note that settings must be set
* before bootstrapping the framework.
*/
}, {
key: "setSettings",
value: function setSettings(settings) {
this.settings = settings;
return this;
}
/**
* Registers all given modules in the framework.
*/
}, {
key: "registerModules",
value: function registerModules(modules) {

@@ -73,2 +107,7 @@ this.modulesRegistry.registerModules(modules);

}
}, {
key: "findModuleByType",
value: function findModuleByType(type) {
return this.modulesRegistry.findModuleByType(type);
}

@@ -83,2 +122,3 @@ /**

_MicroFrameworkRegistry.MicroFrameworkRegistry.put(this);
return this.modulesRegistry.bootstrapAllModules().then(function () {

@@ -95,2 +135,3 @@ return _this;

value: function shutdown() {
_MicroFrameworkRegistry.MicroFrameworkRegistry.remove(this);
return this.modulesRegistry.shutdownAllModules();

@@ -103,2 +144,7 @@ }

}
}, {
key: "name",
get: function get() {
return this._name;
}

@@ -111,3 +157,3 @@ /**

get: function get() {
return _configuratorTsConfigurator.defaultConfigurator;
return this._configurator;
}

@@ -114,0 +160,0 @@ }]);

@@ -80,2 +80,13 @@ "use strict";

/**
* Finds a module with given type registered in the registry.
*/
}, {
key: "findModuleByType",
value: function findModuleByType(type) {
return this.modules.reduce(function (found, module) {
return module instanceof type ? module : found;
}, undefined);
}
/**
* Bootstraps all modules.

@@ -82,0 +93,0 @@ */

{
"name": "microframework",
"version": "0.1.4",
"version": "0.1.5",
"description": "Micro framework is a bundle of express.js, mongodb ODM, validator, dependancy injection framework and restful controllers for your apps using Typescript",

@@ -5,0 +5,0 @@ "license": "Apache-2.0",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc