Skip to content

Commit

Permalink
Release 1.0.0-alpha.24 🐜
Browse files Browse the repository at this point in the history
- Fixed DataSource
- Fixed LifeCycle Interface
- Created ModelProvider interface
- Created OnixMethod interface
- Updated tests to correctly implement lifecycles
  • Loading branch information
Jonathan committed May 5, 2018
1 parent 0ad4bd8 commit d1eb830
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 14 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@onixjs/core",
"version": "1.0.0-alpha.23",
"version": "1.0.0-alpha.24",
"description": "An Enterprise Grade NodeJS Platform that implements Industry Standards and Patterns in order to provide Connectivity, Stability, High-Availability and High-Performance.",
"main": "dist/src/index.js",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export class OnixJS {
* @description Current Onix Version.
*/
get version(): string {
return '1.0.0-alpha.23';
return '1.0.0-alpha.24';
}
/**
* @property router
Expand Down
22 changes: 15 additions & 7 deletions src/interfaces/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ export interface IModuleConfig {
* on any RPC call for any component living in this component.
*/
lifecycle?: (
app: IApp,
metadata: IMetaData,
method: () => Promise<any>,
models: ModelProvider,
message: OnixMessage,
method: OnixMethod,
) => Promise<any>;
/**
* @property models
Expand Down Expand Up @@ -222,7 +222,7 @@ export interface Constructor {
export interface IDataSource {
connect();
disconnect();
register(name: Constructor, model: any, schema: IModel);
register(Class: Constructor, model, schema);
}
/**
* @interface IModelConfig
Expand Down Expand Up @@ -284,12 +284,20 @@ export interface IComponentConfig {
after the module lifecycle, it won't override but
it will execute after the module's one */
lifecycle?: (
app: IApp,
metadata: IMetaData,
method: () => Promise<any>,
models: ModelProvider,
message: OnixMessage,
method: OnixMethod,
) => Promise<any>;
}

export interface OnixMethod {
(): Promise<any>;
}

export interface ModelProvider {
<T>(name: string): T;
}

export interface IMiddleware extends IViewConfig {
param?: IRouterParamConfig;
method: string;
Expand Down
9 changes: 4 additions & 5 deletions test/todo.shared/todo.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ import {Module} from '../../src/index';
import {TodoComponent} from './todo.component';
import {TodoModel} from './todo.model';
import {TodoService} from './todo.service';
import {TodoApp} from '../todo.app';
import {OnixMessage} from '../../src/interfaces';
import {OnixMessage, ModelProvider, OnixMethod} from '../../src/interfaces';
/**
* @class TodoModule
* @author Jonathan Casarrubias
Expand All @@ -17,10 +16,10 @@ import {OnixMessage} from '../../src/interfaces';
renderers: [],
components: [TodoComponent],
lifecycle: async (
app: TodoApp,
models: ModelProvider,
message: OnixMessage,
method,
): Promise<any> => {
method: OnixMethod,
): Promise<TodoModel> => {
// Add createdAt for any newly created todo
if (message.rpc.match(/addTodo/)) {
// Add Created At
Expand Down

0 comments on commit d1eb830

Please sign in to comment.