diff --git a/.angular-cli.json b/.angular-cli.json index a19b861..4e682d7 100644 --- a/.angular-cli.json +++ b/.angular-cli.json @@ -1,12 +1,12 @@ { "$schema": "./node_modules/@angular/cli/lib/config/schema.json", "project": { - "name": "js" + "name": "example-app" }, "apps": [ { - "root": "src", - "outDir": "dist", + "root": "example-app", + "outDir": "example-dist", "assets": [ "assets", "favicon.ico" @@ -17,7 +17,7 @@ "test": "test.ts", "tsconfig": "tsconfig.app.json", "testTsconfig": "tsconfig.spec.json", - "prefix": "app", + "prefix": "of", "styles": [ "styles.css" ], @@ -36,11 +36,11 @@ }, "lint": [ { - "project": "src/tsconfig.app.json", + "project": "example-app/tsconfig.app.json", "exclude": "**/node_modules/**" }, { - "project": "src/tsconfig.spec.json", + "project": "example-app/tsconfig.spec.json", "exclude": "**/node_modules/**" }, { @@ -54,7 +54,7 @@ } }, "defaults": { - "styleExt": "css", + "styleExt": "scss", "component": {} } } diff --git a/example-app/app/app-routing.module.ts b/example-app/app/app-routing.module.ts new file mode 100644 index 0000000..38d5b5b --- /dev/null +++ b/example-app/app/app-routing.module.ts @@ -0,0 +1,12 @@ +import { NgModule } from '@angular/core'; +import { Routes, RouterModule, PreloadAllModules } from '@angular/router'; + +const routes: Routes = [ + { path: 'auth', loadChildren: './pages/auth/auth-page.module#AuthPageModule' }, +]; + +@NgModule({ + imports: [RouterModule.forRoot(routes, {useHash: true, preloadingStrategy: PreloadAllModules})], + exports: [RouterModule], +}) +export class AppRoutingModule { } diff --git a/example-app/app/app-store.module.ts b/example-app/app/app-store.module.ts new file mode 100644 index 0000000..594aef1 --- /dev/null +++ b/example-app/app/app-store.module.ts @@ -0,0 +1,23 @@ +import { NgModule } from '@angular/core'; +import { StoreModule, combineReducers, ActionReducer, ActionReducerMap, MetaReducer } from '@ngrx/store'; + +import { environment } from '../environments/environment'; + +import { + NgRxStoreModule, +} from '@loafer/ngrx-store'; + + +@NgModule({ + exports: [ + StoreModule, + ], + imports: [ + StoreModule.forRoot({}), + NgRxStoreModule, + ], + providers: [ + ], + +}) +export class AppStoreModule { } diff --git a/src/app/app.component.css b/example-app/app/app.component.css similarity index 100% rename from src/app/app.component.css rename to example-app/app/app.component.css diff --git a/example-app/app/app.component.html b/example-app/app/app.component.html new file mode 100644 index 0000000..0680b43 --- /dev/null +++ b/example-app/app/app.component.html @@ -0,0 +1 @@ + diff --git a/src/app/app.component.spec.ts b/example-app/app/app.component.spec.ts similarity index 100% rename from src/app/app.component.spec.ts rename to example-app/app/app.component.spec.ts diff --git a/src/app/app.component.ts b/example-app/app/app.component.ts similarity index 100% rename from src/app/app.component.ts rename to example-app/app/app.component.ts diff --git a/src/app/app.module.ts b/example-app/app/app.module.ts similarity index 59% rename from src/app/app.module.ts rename to example-app/app/app.module.ts index 926975a..7af05cb 100644 --- a/src/app/app.module.ts +++ b/example-app/app/app.module.ts @@ -1,16 +1,21 @@ import { BrowserModule } from '@angular/platform-browser'; import { NgModule } from '@angular/core'; +import { AppStoreModule } from './app-store.module'; +import { AppRoutingModule } from './app-routing.module'; + import { AppComponent } from './app.component'; @NgModule({ declarations: [ - AppComponent + AppComponent, ], imports: [ - BrowserModule + BrowserModule, + AppRoutingModule, + AppStoreModule, ], providers: [], bootstrap: [AppComponent] diff --git a/example-app/app/pages/auth/auth-page-routing.module.ts b/example-app/app/pages/auth/auth-page-routing.module.ts new file mode 100644 index 0000000..2d44ad9 --- /dev/null +++ b/example-app/app/pages/auth/auth-page-routing.module.ts @@ -0,0 +1,23 @@ +import { NgModule } from '@angular/core'; +import { Routes, RouterModule } from '@angular/router'; +import { AuthPageComponent } from './auth-page.component'; + +import { SigninPageComponent } from './signin/signin-page.component'; + +const routes: Routes = [ + { + path: '', + component: AuthPageComponent, + children: [ + { path: '', redirectTo: 'signin' }, + { path: 'signin', component: SigninPageComponent }, + ] + } +]; + +@NgModule({ + imports: [RouterModule.forChild(routes)], + exports: [RouterModule] +}) +export class AuthPageRoutingModule { } + diff --git a/example-app/app/pages/auth/auth-page.component.html b/example-app/app/pages/auth/auth-page.component.html new file mode 100644 index 0000000..90c6b64 --- /dev/null +++ b/example-app/app/pages/auth/auth-page.component.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/.gitkeep b/example-app/app/pages/auth/auth-page.component.scss similarity index 100% rename from src/assets/.gitkeep rename to example-app/app/pages/auth/auth-page.component.scss diff --git a/example-app/app/pages/auth/auth-page.component.spec.ts b/example-app/app/pages/auth/auth-page.component.spec.ts new file mode 100644 index 0000000..46c03ce --- /dev/null +++ b/example-app/app/pages/auth/auth-page.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { AuthPageComponent } from './auth-page.component'; + +describe('AuthPageComponent', () => { + let component: AuthPageComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ AuthPageComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(AuthPageComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/example-app/app/pages/auth/auth-page.component.ts b/example-app/app/pages/auth/auth-page.component.ts new file mode 100644 index 0000000..f977c1b --- /dev/null +++ b/example-app/app/pages/auth/auth-page.component.ts @@ -0,0 +1,15 @@ +import { Component, OnInit } from '@angular/core'; + +@Component({ + selector: 'of-pages-auth', + templateUrl: './auth-page.component.html', + styleUrls: ['./auth-page.component.scss'] +}) +export class AuthPageComponent implements OnInit { + + constructor() { } + + ngOnInit() { + } + +} diff --git a/example-app/app/pages/auth/auth-page.module.ts b/example-app/app/pages/auth/auth-page.module.ts new file mode 100644 index 0000000..9dfc68f --- /dev/null +++ b/example-app/app/pages/auth/auth-page.module.ts @@ -0,0 +1,24 @@ +import { NgModule } from '@angular/core'; +import { CommonModule } from '@angular/common'; + +import { MemberModule } from '../../../packages/member/member.module'; + +import { AuthPageComponent } from './auth-page.component'; +import { AuthPageRoutingModule } from './auth-page-routing.module'; + +import { SigninPageComponent } from './signin/signin-page.component'; + +export const COMPONENTS = [ + AuthPageComponent, + SigninPageComponent, +]; + +@NgModule({ + imports: [ + CommonModule, + AuthPageRoutingModule, + MemberModule, + ], + declarations: COMPONENTS, +}) +export class AuthPageModule { } diff --git a/example-app/app/pages/auth/signin/signin-page.component.html b/example-app/app/pages/auth/signin/signin-page.component.html new file mode 100644 index 0000000..5824b4a --- /dev/null +++ b/example-app/app/pages/auth/signin/signin-page.component.html @@ -0,0 +1,12 @@ +
+
+
+ +
+
+
diff --git a/example-app/app/pages/auth/signin/signin-page.component.scss b/example-app/app/pages/auth/signin/signin-page.component.scss new file mode 100644 index 0000000..4238314 --- /dev/null +++ b/example-app/app/pages/auth/signin/signin-page.component.scss @@ -0,0 +1,9 @@ +.signin-form { + min-width: 150px; + max-width: 500px; + width: 100%; +} + +.signin-full-width { + width: 100%; +} diff --git a/example-app/app/pages/auth/signin/signin-page.component.spec.ts b/example-app/app/pages/auth/signin/signin-page.component.spec.ts new file mode 100644 index 0000000..3848731 --- /dev/null +++ b/example-app/app/pages/auth/signin/signin-page.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { SigninPageComponent } from './signin-page.component'; + +describe('SigninPageComponent', () => { + let component: SigninPageComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ SigninPageComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(SigninPageComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/example-app/app/pages/auth/signin/signin-page.component.ts b/example-app/app/pages/auth/signin/signin-page.component.ts new file mode 100644 index 0000000..4a38baf --- /dev/null +++ b/example-app/app/pages/auth/signin/signin-page.component.ts @@ -0,0 +1,25 @@ +import { Component, OnInit } from '@angular/core'; +import { ActivatedRoute, Router } from '@angular/router'; +import { Form, FormBuilder, FormGroup, FormGroupDirective, FormControl, NgForm, Validators } from '@angular/forms'; +import { ErrorStateMatcher } from '@angular/material/core'; + +@Component({ + selector: 'of-pages-auth-signin', + templateUrl: './signin-page.component.html', + styleUrls: ['./signin-page.component.scss'], +}) +export class SigninPageComponent implements OnInit { + + constructor( + private router: Router, + private activatedRoute: ActivatedRoute, + ) { } + + ngOnInit() { + + } + + initForm() { + } + +} diff --git a/example-app/assets/.gitkeep b/example-app/assets/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/src/environments/environment.prod.ts b/example-app/environments/environment.prod.ts similarity index 100% rename from src/environments/environment.prod.ts rename to example-app/environments/environment.prod.ts diff --git a/src/environments/environment.ts b/example-app/environments/environment.ts similarity index 100% rename from src/environments/environment.ts rename to example-app/environments/environment.ts diff --git a/src/favicon.ico b/example-app/favicon.ico similarity index 100% rename from src/favicon.ico rename to example-app/favicon.ico diff --git a/src/index.html b/example-app/index.html similarity index 100% rename from src/index.html rename to example-app/index.html diff --git a/src/main.ts b/example-app/main.ts similarity index 100% rename from src/main.ts rename to example-app/main.ts diff --git a/example-app/packages/member/component/signin/signin.component.html b/example-app/packages/member/component/signin/signin.component.html new file mode 100644 index 0000000..7851fe9 --- /dev/null +++ b/example-app/packages/member/component/signin/signin.component.html @@ -0,0 +1 @@ +
works
\ No newline at end of file diff --git a/example-app/packages/member/component/signin/signin.component.scss b/example-app/packages/member/component/signin/signin.component.scss new file mode 100644 index 0000000..067d3f5 --- /dev/null +++ b/example-app/packages/member/component/signin/signin.component.scss @@ -0,0 +1,37 @@ +$gray-lighter: #eceeef !default; +$image_path: "/assets/images/" !default; + +$prefix: 'sigin'; + +.#{$prefix} { + + &-conainer { + min-height: 100%; + background-size: cover; + padding: 100px; + } + + &-main { + position: relative; + margin: 0 auto; + width: 500px; + } +} + +.full-width { + width: 100%; +} + +.help { + +} + +.is-danger { + +} + +.redirect { + font-size: 14px; + margin-left: 10px; + color: #00AAAA; +} \ No newline at end of file diff --git a/example-app/packages/member/component/signin/signin.component.spec.ts b/example-app/packages/member/component/signin/signin.component.spec.ts new file mode 100644 index 0000000..c64b0b2 --- /dev/null +++ b/example-app/packages/member/component/signin/signin.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { SigninComponent } from './signin.component'; + +describe('SigninComponent', () => { + let component: SigninComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ SigninComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(SigninComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/example-app/packages/member/component/signin/signin.component.ts b/example-app/packages/member/component/signin/signin.component.ts new file mode 100644 index 0000000..cc4886c --- /dev/null +++ b/example-app/packages/member/component/signin/signin.component.ts @@ -0,0 +1,39 @@ +import { Component, OnInit } from '@angular/core'; +import { ActivatedRoute, Router } from '@angular/router'; +import { FormGroup, FormBuilder, Validators } from '@angular/forms'; +import { Store, select } from '@ngrx/store'; + +import { State } from '../../store/auth.state'; + +@Component({ + selector: 'of-member-signin', + templateUrl: './signin.component.html', + styleUrls: ['./signin.component.scss'] +}) +export class SigninComponent implements OnInit { + constructor( + private activatedRoute: ActivatedRoute, + private router: Router, + private store: Store, + ) { + } + + ngOnInit() { + this.initForm(); + + } + + initForm() { + + } + + resetPasswordBtnClick() { + this.router.navigateByUrl('/auth/reset-password'); + } + + signupBtnClick() { + this.router.navigateByUrl('/auth/signup'); + } + signin() { + } +} diff --git a/example-app/packages/member/member.module.ts b/example-app/packages/member/member.module.ts new file mode 100644 index 0000000..e75d7d6 --- /dev/null +++ b/example-app/packages/member/member.module.ts @@ -0,0 +1,27 @@ +import { BrowserModule } from '@angular/platform-browser'; +import { NgModule } from '@angular/core'; + +import { + NgRxStoreModule, +} from '@loafer/ngrx-store'; + +import { SigninComponent } from './component/signin/signin.component'; +import { MemberService } from './service/member.service'; +import { AuthStore } from './store/auth.store'; + +@NgModule({ + declarations: [ + SigninComponent + ], + exports: [ + SigninComponent, + ], + imports: [ + NgRxStoreModule.forFeature('member'), + ], + providers: [ + MemberService, + AuthStore + ] +}) +export class MemberModule { } diff --git a/example-app/packages/member/service/member.service.ts b/example-app/packages/member/service/member.service.ts new file mode 100644 index 0000000..96ff772 --- /dev/null +++ b/example-app/packages/member/service/member.service.ts @@ -0,0 +1,24 @@ +import { Injectable } from '@angular/core'; +import { Observable } from 'rxjs/Observable'; +import { Subject } from 'rxjs/Subject'; + +import 'rxjs/add/operator/map'; + +@Injectable() +export class MemberService { + + public constructor( + ) { + + } + + public signin(email: string, password: string): Observable { + const body = { + signinId: email, + signinPw: password, + }; + + const subject: Subject = new Subject(); + return subject; + } +} diff --git a/example-app/packages/member/store/auth.action.ts b/example-app/packages/member/store/auth.action.ts new file mode 100644 index 0000000..a3f94af --- /dev/null +++ b/example-app/packages/member/store/auth.action.ts @@ -0,0 +1,25 @@ +import { Action } from '@ngrx/store'; + +export enum ActionType { + Signin = '[member.auth] Signin', + SigninSuccess = '[member.auth] SigninSuccess', + SigninFailure = '[member.auth] SigninFailure', +} + +export class Signin implements Action { + readonly type = ActionType.Signin; + + constructor(public payload: {email: string, password: string, returnURL: string}) {} +} + +export class SigninSuccess implements Action { + readonly type = ActionType.SigninSuccess; + + constructor(public payload: any) {} +} + +export class SigninFailure implements Action { + readonly type = ActionType.SigninFailure; + + constructor(public payload: any) {} +} diff --git a/example-app/packages/member/store/auth.state.ts b/example-app/packages/member/store/auth.state.ts new file mode 100644 index 0000000..1c776b4 --- /dev/null +++ b/example-app/packages/member/store/auth.state.ts @@ -0,0 +1,9 @@ +export interface State { + signined: boolean; + pending: boolean; +} + +export const initialState: State = { + signined: false, + pending: false, +}; diff --git a/example-app/packages/member/store/auth.store.ts b/example-app/packages/member/store/auth.store.ts new file mode 100644 index 0000000..50f8438 --- /dev/null +++ b/example-app/packages/member/store/auth.store.ts @@ -0,0 +1,59 @@ +import { Actions } from '@ngrx/effects'; + +import { Observable } from 'rxjs/Observable'; +import 'rxjs/add/operator/switchMap'; +import 'rxjs/add/operator/map'; + +import { + Store, + Action, + Effect, + ofAction, +} from '@loafer/ngrx-store'; + +import { + Signin, + SigninSuccess, + SigninFailure, +} from './auth.action'; + +import { + State, + initialState, +} from './auth.state'; + +import { MemberService } from '../service/member.service'; + +@Store(initialState) +export class AuthStore { + + public constructor( + private actions$: Actions, + private memberService: MemberService, + ) { + + } + + @Action(Signin) + signin(state: State, action: Signin) { + + } + + @Action(SigninSuccess) + signinSuccess(state: State, action: SigninSuccess) { + + } + + @Action(SigninFailure) + signinFailure(state: State, action: SigninFailure) { + + } + + @Effect(Signin) + signinEffect(state: State, { payload }: Signin) { + this.memberService.signin(payload.email, payload.password) + .map((result: any) => { + + }); + } +} diff --git a/src/polyfills.ts b/example-app/polyfills.ts similarity index 100% rename from src/polyfills.ts rename to example-app/polyfills.ts diff --git a/src/styles.css b/example-app/styles.css similarity index 100% rename from src/styles.css rename to example-app/styles.css diff --git a/src/test.ts b/example-app/test.ts similarity index 100% rename from src/test.ts rename to example-app/test.ts diff --git a/src/tsconfig.app.json b/example-app/tsconfig.app.json similarity index 64% rename from src/tsconfig.app.json rename to example-app/tsconfig.app.json index 39ba8db..3c475a4 100644 --- a/src/tsconfig.app.json +++ b/example-app/tsconfig.app.json @@ -4,6 +4,12 @@ "outDir": "../out-tsc/app", "baseUrl": "./", "module": "es2015", + "paths": { + "@loafer/ngrx-store": [ + "../modules/ngrx-store" + ] + }, + "rootDir": "../", "types": [] }, "exclude": [ diff --git a/src/tsconfig.spec.json b/example-app/tsconfig.spec.json similarity index 100% rename from src/tsconfig.spec.json rename to example-app/tsconfig.spec.json diff --git a/src/typings.d.ts b/example-app/typings.d.ts similarity index 100% rename from src/typings.d.ts rename to example-app/typings.d.ts diff --git a/modules/ngrx-store/index.ts b/modules/ngrx-store/index.ts new file mode 100644 index 0000000..ddc163e --- /dev/null +++ b/modules/ngrx-store/index.ts @@ -0,0 +1,2 @@ +export * from './public_api'; + diff --git a/modules/ngrx-store/package.json b/modules/ngrx-store/package.json new file mode 100644 index 0000000..fb2fcf3 --- /dev/null +++ b/modules/ngrx-store/package.json @@ -0,0 +1,28 @@ +{ + "name": "@loafer/ngrx-store", + "version": "0.0.1", + "module": "@loafer/ngrx-store.es5.js", + "es2015": "@loafer/ngrx-store.js", + "main": "bundles/ngrx-store.umd.js", + "typings": "ngrx-store.d.ts", + "repository": { + "type": "git", + "url": "https://git.loafle.net/loafer/js.git" + }, + "keywords": [ + "RxJS", + "Angular", + "Redux" + ], + "author": "Rob Wormald ", + "license": "MIT", + "bugs": { + "url": "https://www.loafle.com" + }, + "homepage": "https://www.loafle.com", + "peerDependencies": { + "@angular/core": "^5.0.0", + "@ngrx/store": "^5.2.0", + "rxjs": "^5.5.0" + } +} diff --git a/modules/ngrx-store/public_api.ts b/modules/ngrx-store/public_api.ts new file mode 100644 index 0000000..52fe596 --- /dev/null +++ b/modules/ngrx-store/public_api.ts @@ -0,0 +1,15 @@ +export { NgRxStoreModule } from './src/ngrx-store.module'; +export { + createReducer, + ofAction, +} from './src/core'; +export { + Action, + Effect, + Store, + Select, +} from './src/decorator'; +export { + NgRxStoreSelect, +} from './src/service'; + diff --git a/modules/ngrx-store/src/core/factory.ts b/modules/ngrx-store/src/core/factory.ts new file mode 100644 index 0000000..4b3b53e --- /dev/null +++ b/modules/ngrx-store/src/core/factory.ts @@ -0,0 +1,56 @@ +import { Action } from '@ngrx/store'; +import { take, materialize } from 'rxjs/operators'; + +import { NGRX_STORE_META, StoreMetadata } from './meta-data'; +import { NgRxStoreSelect } from '../service'; + +export function createReducer( + store: | {new (...args: any[]): any} | any +): (state: State, action: Action | any) => State { + const isInstance = !store.prototype; + const clazz = isInstance ? store.constructor : store; + + if (!clazz.hasOwnProperty(NGRX_STORE_META)) { + throw new Error('A reducer can be created from a @Store decorated class only.'); + } + + const instance = isInstance ? store : new store(); + const { initialState, actions, effects } = clazz[NGRX_STORE_META] as StoreMetadata; + + return function(state: any = initialState, action: Action) { + const actionMeta = actions[action.type]; + if (actionMeta) { + const result = instance[actionMeta.methodName](state, action); + if (result === undefined) { + if (Array.isArray(state)) { + return [...state]; + } else { + return { ...state }; + } + } + state = result; + } + + const effectMeta = effects[action.type]; + if (effectMeta) { + const retVal = instance[effectMeta.methodName](state, action); + if (retVal) { + if (retVal.subscribe) { + retVal.pipe(materialize()).subscribe((res: any) => { + if (res.value && NgRxStoreSelect.store) { + NgRxStoreSelect.store.dispatch(res.value); + } + }); + } else if (NgRxStoreSelect.store) { + if (Array.isArray(retVal)) { + retVal.forEach(r => NgRxStoreSelect.store && NgRxStoreSelect.store.dispatch(r)); + } else { + NgRxStoreSelect.store.dispatch(retVal); + } + } + } + } + + return state; + }; +} diff --git a/modules/ngrx-store/src/core/index.ts b/modules/ngrx-store/src/core/index.ts new file mode 100644 index 0000000..929ab72 --- /dev/null +++ b/modules/ngrx-store/src/core/index.ts @@ -0,0 +1,6 @@ +export * from './factory'; +export * from './meta-data'; +export * from './of-action'; +export * from './token'; +export * from './type'; + diff --git a/modules/ngrx-store/src/core/meta-data.ts b/modules/ngrx-store/src/core/meta-data.ts new file mode 100644 index 0000000..a8efb1a --- /dev/null +++ b/modules/ngrx-store/src/core/meta-data.ts @@ -0,0 +1,28 @@ +import { ActionType } from './type'; + +export const NGRX_STORE_META = '__ngrx__store__'; + +export interface StoreMetadata { + initialState?: any; + actions: ActionsMeta; + effects: ActionsMeta; +} + +export interface ActionMeta { + action: ActionType; + methodName: string; + type: string; +} + +export interface ActionsMeta { + [type: string]: ActionMeta; +} + +export function ensureStoreMetadata(target: any): StoreMetadata { + // see https://github.com/angular/angular/blob/master/packages/core/src/util/decorators.ts#L60 + if (!target.hasOwnProperty(NGRX_STORE_META)) { + const defaultMetadata: StoreMetadata = { actions: {}, effects: {} }; + Object.defineProperty(target, NGRX_STORE_META, { value: defaultMetadata }); + } + return target[NGRX_STORE_META]; +} diff --git a/modules/ngrx-store/src/core/of-action.ts b/modules/ngrx-store/src/core/of-action.ts new file mode 100644 index 0000000..1a7aa75 --- /dev/null +++ b/modules/ngrx-store/src/core/of-action.ts @@ -0,0 +1,15 @@ +import { Action } from '@ngrx/store'; +import { filter } from 'rxjs/operators'; +import { OperatorFunction } from 'rxjs/interfaces'; +import { ActionType } from './type'; + +export function ofAction(allowedType: ActionType): OperatorFunction; +export function ofAction(...allowedTypes: ActionType[]): OperatorFunction; +export function ofAction(...allowedTypes: ActionType[]): OperatorFunction { + const allowedMap: {[key: string]: any} = {}; + + allowedTypes.forEach(clazz => (allowedMap[new clazz().type] = true)); + return filter((action: Action) => { + return allowedMap[action.type]; + }); +} diff --git a/modules/ngrx-store/src/core/token.ts b/modules/ngrx-store/src/core/token.ts new file mode 100644 index 0000000..1e1edcf --- /dev/null +++ b/modules/ngrx-store/src/core/token.ts @@ -0,0 +1,4 @@ +import { InjectionToken } from '@angular/core'; + +export const _STORE = new InjectionToken('@loafer/ngrx-store Internal Store'); +export const _STORE_FEATURE = new InjectionToken('@loafer/ngrx-store Internal Store Features'); diff --git a/modules/ngrx-store/src/core/type.ts b/modules/ngrx-store/src/core/type.ts new file mode 100644 index 0000000..5d26efc --- /dev/null +++ b/modules/ngrx-store/src/core/type.ts @@ -0,0 +1,5 @@ +import { Action } from '@ngrx/store'; + +export interface ActionType { + new (...args: any[]): T; +} diff --git a/modules/ngrx-store/src/decorator/action.ts b/modules/ngrx-store/src/decorator/action.ts new file mode 100644 index 0000000..9c14dae --- /dev/null +++ b/modules/ngrx-store/src/decorator/action.ts @@ -0,0 +1,27 @@ +import { + ActionType, + ensureStoreMetadata, +} from '../core'; + +export function Action(...actionsClasses: ActionType[]) { + return function(target: any, name: string, descriptor: TypedPropertyDescriptor) { + const meta = ensureStoreMetadata(target.constructor); + + for (const clazz of actionsClasses) { + const inst = new clazz(); + const type = inst.type; + + if (meta.actions[type]) { + throw new Error( + `@Action for '${type}' is defined multiple times in functions '${meta.actions[type].methodName}' and '${name}'` + ); + } + + meta.actions[type] = { + action: clazz, + methodName: name, + type + }; + } + }; +} diff --git a/modules/ngrx-store/src/decorator/effect.ts b/modules/ngrx-store/src/decorator/effect.ts new file mode 100644 index 0000000..a343671 --- /dev/null +++ b/modules/ngrx-store/src/decorator/effect.ts @@ -0,0 +1,27 @@ +import { + ActionType, + ensureStoreMetadata, +} from '../core'; + +export function Effect(...effectClasses: ActionType[]) { + return function(target: any, name: string, descriptor: TypedPropertyDescriptor) { + const meta = ensureStoreMetadata(target.constructor); + + for (const clazz of effectClasses) { + const inst = new clazz(); + const type = inst.type; + + if (meta.effects[type]) { + throw new Error( + `@Effect for '${type}' is defined multiple times in functions '${meta.effects[type].methodName}' and '${name}'` + ); + } + + meta.effects[type] = { + action: clazz, + methodName: name, + type + }; + } + }; +} diff --git a/modules/ngrx-store/src/decorator/index.ts b/modules/ngrx-store/src/decorator/index.ts new file mode 100644 index 0000000..e7bcba7 --- /dev/null +++ b/modules/ngrx-store/src/decorator/index.ts @@ -0,0 +1,4 @@ +export * from './action'; +export * from './effect'; +export * from './select'; +export * from './store'; diff --git a/modules/ngrx-store/src/decorator/select.ts b/modules/ngrx-store/src/decorator/select.ts new file mode 100644 index 0000000..1f468eb --- /dev/null +++ b/modules/ngrx-store/src/decorator/select.ts @@ -0,0 +1,76 @@ +import { Selector } from '@ngrx/store'; + +import { NgRxStoreSelect } from '../service'; + +/** + * Slice state from the store. + */ +export function Select(selector: Selector): (target: any, name: string) => void; +export function Select(selectorOrFeature?: string, ...paths: string[]): (target: any, name: string) => void; +export function Select(selectorOrFeature?: string | Selector, ...paths: string[]) { + return function(target: any, name: string): void { + const selectorFnName = '__' + name + '__selector'; + let fn: Selector; + // Nothing here? Use propery name as selector + if (!selectorOrFeature) { + selectorOrFeature = name; + } + + // Handle string vs Selector + if (typeof selectorOrFeature === 'string') { + const propsArray = paths.length ? [selectorOrFeature, ...paths] : selectorOrFeature.split('.'); + fn = fastPropGetter(propsArray); + } else { + fn = selectorOrFeature; + } + + const createSelect = () => { + const store = NgRxStoreSelect.store; + if (!store) { + throw new Error('NgRxStoreSelect not connected to store!'); + } + return store.select(fn); + }; + + if (target[selectorFnName]) { + throw new Error('You cannot use @Select decorator and a ' + selectorFnName + ' property.'); + } + + // Redefine property + if (delete target[name]) { + Object.defineProperty(target, selectorFnName, { + writable: true, + enumerable: false, + configurable: true + }); + + Object.defineProperty(target, name, { + get: function() { + return target[selectorFnName] || (target[selectorFnName] = createSelect.apply(target)); + // return this[selectorFnName] || (this[selectorFnName] = createSelect.apply(this)); + }, + enumerable: true, + configurable: true + }); + } + }; +} + +/** + * The generated function is faster than: + * - pluck (Observable operator) + * - memoize (old ngrx-actions implementation) + * - MemoizedSelector (ngrx) + */ +export function fastPropGetter(paths: string[]): (x: any) => any { + const segments = paths; + let seg = 'store.' + segments[0], + i = 0; + const l = segments.length; + let expr = seg; + while (++i < l) { + expr = expr + ' && ' + (seg = seg + '.' + segments[i]); + } + const fn = new Function('store', 'return ' + expr + ';'); + return <(x: any) => any>fn; +} diff --git a/modules/ngrx-store/src/decorator/store.ts b/modules/ngrx-store/src/decorator/store.ts new file mode 100644 index 0000000..f298ccf --- /dev/null +++ b/modules/ngrx-store/src/decorator/store.ts @@ -0,0 +1,12 @@ +import { + ensureStoreMetadata, +} from '../core'; + +export function Store(initialState?: State): (target: Function) => void; +export function Store(initialState?: any): (target: Function) => void; +export function Store(initialState: any = {}) { + return function(target: Function) { + const meta = ensureStoreMetadata(target); + meta.initialState = initialState; + }; +} diff --git a/modules/ngrx-store/src/ngrx-store.module.ts b/modules/ngrx-store/src/ngrx-store.module.ts new file mode 100644 index 0000000..c6e3f97 --- /dev/null +++ b/modules/ngrx-store/src/ngrx-store.module.ts @@ -0,0 +1,101 @@ +import { + NgModule, + Inject, + Optional, + ModuleWithProviders, + OnDestroy, + InjectionToken, + Injector, +} from '@angular/core'; + +import { + StoreModule, + Store, + combineReducers, + ReducerManager, +} from '@ngrx/store'; + +import { + _STORE, + _STORE_FEATURE, + createReducer, +} from './core'; + +import { NgRxStoreSelect } from './service'; + +@NgModule({ + imports: [ + StoreModule, + ], + providers: [ + NgRxStoreSelect, + ], +}) +export class NgRxStoreModule { + static forRoot(reducers: any): ModuleWithProviders { + return { + ngModule: NgRxStoreModule, + providers: [ + { provide: _STORE, useValue: reducers }, + ], + }; + } + + static forFeature(featureName: string, reducers?: any): ModuleWithProviders { + return { + ngModule: NgRxStoreModule, + providers: [ + { provide: _STORE_FEATURE, useValue: { featureName, reducers } }, + ], + }; + } + + constructor( + @Optional() @Inject(_STORE) reducers: any, + @Optional() @Inject(_STORE_FEATURE) featureReducers: any, + + reducerFactory: ReducerManager, + store: Store, + parentInjector: Injector, + select: NgRxStoreSelect, + ) { + select.connect(store); + + if (reducers) { + for (const key in reducers) { + if (!reducers.hasOwnProperty(key)) { + continue; + } + const clazz = reducers[key]; + const inst = parentInjector.get(clazz, new clazz()); + reducerFactory.addReducer(key, createReducer(inst)); + } + } + + if (featureReducers) { + if (typeof featureReducers.key !== 'string') { + featureReducers.reducers = featureReducers.key; + featureReducers.key = undefined; + } + + const mapped: {[key: string]: any} = {}; + for (const key in featureReducers.reducers) { + if (!featureReducers.reducers.hasOwnProperty(key)) { + continue; + } + + const clazz = featureReducers.reducers[key]; + const inst = parentInjector.get(clazz, new clazz()); + mapped[key] = createReducer(inst); + } + + if (featureReducers.key) { + reducerFactory.addFeature({ + reducers: mapped, + reducerFactory: combineReducers, + key: featureReducers.key + }); + } + } + } +} diff --git a/modules/ngrx-store/src/service/index.ts b/modules/ngrx-store/src/service/index.ts new file mode 100644 index 0000000..b4f8e6d --- /dev/null +++ b/modules/ngrx-store/src/service/index.ts @@ -0,0 +1 @@ +export * from './ngrx-store-select'; diff --git a/modules/ngrx-store/src/service/ngrx-store-select.ts b/modules/ngrx-store/src/service/ngrx-store-select.ts new file mode 100644 index 0000000..4499f38 --- /dev/null +++ b/modules/ngrx-store/src/service/ngrx-store-select.ts @@ -0,0 +1,11 @@ +import { Injectable } from '@angular/core'; +import { Store } from '@ngrx/store'; + +@Injectable() +export class NgRxStoreSelect { + static store: Store | undefined = undefined; + + connect(store: Store) { + NgRxStoreSelect.store = store; + } +} diff --git a/modules/ngrx-store/tsconfig-build.json b/modules/ngrx-store/tsconfig-build.json new file mode 100644 index 0000000..45a7014 --- /dev/null +++ b/modules/ngrx-store/tsconfig-build.json @@ -0,0 +1,32 @@ + +{ + "compilerOptions": { + "baseUrl": ".", + "declaration": true, + "experimentalDecorators": true, + "inlineSources": true, + "lib": [ + "es2015", + "dom" + ], + "module": "es2015", + "moduleResolution": "node", + "outDir": "../../dist/packages/ngrx-store", + "paths": { }, + "rootDir": ".", + "skipLibCheck": true, + "strict": true, + "stripInternal": true, + "sourceMap": true, + "target": "es2015" + }, + "files": [ + "public_api.ts" + ], + "angularCompilerOptions": { + "annotateForClosureCompiler": true, + "strictMetadataEmit": true, + "flatModuleOutFile": "index.js", + "flatModuleId": "@loafer/ngrx-store" + } +} diff --git a/package.json b/package.json index 0961cc1..fb78636 100644 --- a/package.json +++ b/package.json @@ -1,38 +1,46 @@ { - "name": "js", - "version": "0.0.0", + "name": "@loafer/js", + "version": "0.0.1", "license": "MIT", "scripts": { - "ng": "ng", - "start": "ng serve", - "build": "ng build --prod", - "test": "ng test", - "lint": "ng lint", - "e2e": "ng e2e" + "build": "ts-node ./build/index.ts", + "deploy:builds": "ts-node ./build/deploy-build.ts", + "test:unit": "node ./tests.js", + "test": "nyc yarn run test:unit", + "clean": "git clean -xdf && yarn && yarn run bootstrap", + "cli": "ng", + "example:start": "yarn run cli serve" + }, + "engines": { + "node": ">=8.6.0", + "npm": ">=5.3.0", + "yarn": ">=1.3.0 <2.0.0" }, - "private": true, "dependencies": { + "@angular/cdk": "^5.2.0" + }, + "devDependencies": { "@angular/animations": "^5.2.0", + "@angular/cli": "1.6.5", "@angular/common": "^5.2.0", "@angular/compiler": "^5.2.0", + "@angular/compiler-cli": "^5.2.0", "@angular/core": "^5.2.0", "@angular/forms": "^5.2.0", "@angular/http": "^5.2.0", + "@angular/material": "^5.2.0", "@angular/platform-browser": "^5.2.0", "@angular/platform-browser-dynamic": "^5.2.0", + "@angular/platform-server": "^5.2.0", "@angular/router": "^5.2.0", - "core-js": "^2.4.1", - "rxjs": "^5.5.6", - "zone.js": "^0.8.19" - }, - "devDependencies": { - "@angular/cli": "1.6.5", - "@angular/compiler-cli": "^5.2.0", - "@angular/language-service": "^5.2.0", + "@ngrx/effects": "^5.2.0", + "@ngrx/store": "^5.2.0", "@types/jasmine": "~2.8.3", "@types/jasminewd2": "~2.0.2", "@types/node": "~6.0.60", "codelyzer": "^4.0.1", + "core-js": "^2.4.1", + "hammerjs": "^2.0.8", "jasmine-core": "~2.8.0", "jasmine-spec-reporter": "~4.2.1", "karma": "~2.0.0", @@ -42,8 +50,10 @@ "karma-jasmine": "~1.1.0", "karma-jasmine-html-reporter": "^0.2.2", "protractor": "~5.1.2", + "rxjs": "^5.5.6", "ts-node": "~4.1.0", "tslint": "~5.9.1", - "typescript": "~2.5.3" + "typescript": "~2.5.3", + "zone.js": "^0.8.19" } } diff --git a/src/app/app.component.html b/src/app/app.component.html deleted file mode 100644 index fa2706a..0000000 --- a/src/app/app.component.html +++ /dev/null @@ -1,20 +0,0 @@ - -
-

- Welcome to {{ title }}! -

- Angular Logo -
-

Here are some links to help you start:

- - diff --git a/tsconfig.json b/tsconfig.json index a6c016b..2456977 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,19 +1,34 @@ { + "buildOnSave": false, "compileOnSave": false, "compilerOptions": { - "outDir": "./dist/out-tsc", - "sourceMap": true, + "baseUrl": "", "declaration": false, - "moduleResolution": "node", "emitDecoratorMetadata": true, "experimentalDecorators": true, - "target": "es5", - "typeRoots": [ - "node_modules/@types" - ], "lib": [ "es2017", "dom" + ], + "module": "commonjs", + "moduleResolution": "node", + "noStrictGenericChecks": true, + "outDir": "../out-tsc/app", + "paths": { + "@loafer/ngrx-store": [ + "./modules/ngrx-store" + ] + }, + "rootDir": "./", + "sourceMap": true, + "strict": true, + "target": "es5", + "typeRoots": [ + "node_modules/@types" ] - } + }, + "exclude": [ + "node_modules", + "**/*/node_modules" + ], } diff --git a/yarn.lock b/yarn.lock index 9732372..58f606f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -33,6 +33,12 @@ dependencies: tslib "^1.7.1" +"@angular/cdk@^5.2.0": + version "5.2.4" + resolved "https://registry.yarnpkg.com/@angular/cdk/-/cdk-5.2.4.tgz#c0a429a8710d8fedb157f546e21cb49d4335f7f7" + dependencies: + tslib "^1.7.1" + "@angular/cli@1.6.5": version "1.6.5" resolved "https://registry.yarnpkg.com/@angular/cli/-/cli-1.6.5.tgz#9217c5d5c366292aca61fb0328c406bb5b0f2d76" @@ -136,9 +142,11 @@ dependencies: tslib "^1.7.1" -"@angular/language-service@^5.2.0": - version "5.2.9" - resolved "https://registry.yarnpkg.com/@angular/language-service/-/language-service-5.2.9.tgz#4838bb6319c99e8f5beb08bdfb392ee9a1173766" +"@angular/material@^5.2.0": + version "5.2.4" + resolved "https://registry.yarnpkg.com/@angular/material/-/material-5.2.4.tgz#9e823798324283d23ea839156fac5bcb73443d55" + dependencies: + tslib "^1.7.1" "@angular/platform-browser-dynamic@^5.2.0": version "5.2.9" @@ -152,12 +160,28 @@ dependencies: tslib "^1.7.1" +"@angular/platform-server@^5.2.0": + version "5.2.9" + resolved "https://registry.yarnpkg.com/@angular/platform-server/-/platform-server-5.2.9.tgz#9905cc152242472da2557bf9fec73685449b92c4" + dependencies: + domino "^1.0.29" + tslib "^1.7.1" + xhr2 "^0.1.4" + "@angular/router@^5.2.0": version "5.2.9" resolved "https://registry.yarnpkg.com/@angular/router/-/router-5.2.9.tgz#0369df6e60c6da3a5842c6eb35e3958d4ffe727e" dependencies: tslib "^1.7.1" +"@ngrx/effects@^5.2.0": + version "5.2.0" + resolved "https://registry.yarnpkg.com/@ngrx/effects/-/effects-5.2.0.tgz#aa762b69cb6fd4644d724a1cecd265caa42baf09" + +"@ngrx/store@^5.2.0": + version "5.2.0" + resolved "https://registry.yarnpkg.com/@ngrx/store/-/store-5.2.0.tgz#627ed74c9cd95462930485d912a557117b23903e" + "@ngtools/json-schema@1.1.0", "@ngtools/json-schema@^1.1.0": version "1.1.0" resolved "https://registry.yarnpkg.com/@ngtools/json-schema/-/json-schema-1.1.0.tgz#c3a0c544d62392acc2813a42c8a0dc6f58f86922" @@ -288,7 +312,7 @@ ajv@^4.9.1: co "^4.6.0" json-stable-stringify "^1.0.1" -ajv@^5.0.0, ajv@^5.1.0, ajv@^5.1.5, ajv@~5.5.1: +ajv@^5.0.0, ajv@^5.1.5, ajv@~5.5.1: version "5.5.2" resolved "https://registry.yarnpkg.com/ajv/-/ajv-5.5.2.tgz#73b5eeca3fab653e3d3f9422b341ad42205dc965" dependencies: @@ -579,11 +603,7 @@ aws-sign2@~0.6.0: version "0.6.0" resolved "https://registry.yarnpkg.com/aws-sign2/-/aws-sign2-0.6.0.tgz#14342dd38dbcc94d0e5b87d763cd63612c0e794f" -aws-sign2@~0.7.0: - version "0.7.0" - resolved "https://registry.yarnpkg.com/aws-sign2/-/aws-sign2-0.7.0.tgz#b46e890934a9591f2d2f6f86d7e6a9f1b3fe76a8" - -aws4@^1.2.1, aws4@^1.6.0: +aws4@^1.2.1: version "1.6.0" resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.6.0.tgz#83ef5ca860b2b32e4a0deedee8c771b9db57471e" @@ -796,18 +816,6 @@ boom@2.x.x: dependencies: hoek "2.x.x" -boom@4.x.x: - version "4.3.1" - resolved "https://registry.yarnpkg.com/boom/-/boom-4.3.1.tgz#4f8a3005cb4a7e3889f749030fd25b96e01d2e31" - dependencies: - hoek "4.x.x" - -boom@5.x.x: - version "5.2.0" - resolved "https://registry.yarnpkg.com/boom/-/boom-5.2.0.tgz#5dd9da6ee3a5f302077436290cb717d3f4a54e02" - dependencies: - hoek "4.x.x" - brace-expansion@^1.1.7: version "1.1.11" resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd" @@ -1366,7 +1374,7 @@ combine-source-map@~0.8.0: lodash.memoize "~3.0.3" source-map "~0.5.3" -combined-stream@1.0.6, combined-stream@^1.0.5, combined-stream@~1.0.5: +combined-stream@^1.0.5, combined-stream@~1.0.5: version "1.0.6" resolved "https://registry.yarnpkg.com/combined-stream/-/combined-stream-1.0.6.tgz#723e7df6e801ac5613113a7e445a9b69cb632818" dependencies: @@ -1589,12 +1597,6 @@ cryptiles@2.x.x: dependencies: boom "2.x.x" -cryptiles@3.x.x: - version "3.1.2" - resolved "https://registry.yarnpkg.com/cryptiles/-/cryptiles-3.1.2.tgz#a89fbb220f5ce25ec56e8c4aa8a4fd7b5b0d29fe" - dependencies: - boom "5.x.x" - crypto-browserify@^3.0.0, crypto-browserify@^3.11.0: version "3.12.0" resolved "https://registry.yarnpkg.com/crypto-browserify/-/crypto-browserify-3.12.0.tgz#396cf9f3137f03e4b8e532c58f698254e00f80ec" @@ -1755,15 +1757,15 @@ date-now@^0.1.4: version "0.1.4" resolved "https://registry.yarnpkg.com/date-now/-/date-now-0.1.4.tgz#eaf439fd4d4848ad74e5cc7dbef200672b9e345b" -debug@*, debug@^3.1.0, debug@~3.1.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/debug/-/debug-3.1.0.tgz#5bb5a0672628b64149566ba16819e61518c67261" +debug@*, debug@2, debug@2.6.9, debug@^2.2.0, debug@^2.3.3, debug@^2.6.6, debug@^2.6.8, debug@~2.6.4, debug@~2.6.6: + version "2.6.9" + resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f" dependencies: ms "2.0.0" -debug@2, debug@2.6.9, debug@^2.2.0, debug@^2.3.3, debug@^2.6.6, debug@^2.6.8, debug@~2.6.4, debug@~2.6.6: - version "2.6.9" - resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f" +debug@^3.1.0, debug@~3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/debug/-/debug-3.1.0.tgz#5bb5a0672628b64149566ba16819e61518c67261" dependencies: ms "2.0.0" @@ -2001,6 +2003,10 @@ domhandler@2.1: dependencies: domelementtype "1" +domino@^1.0.29: + version "1.0.30" + resolved "https://registry.yarnpkg.com/domino/-/domino-1.0.30.tgz#54a4154ecae968616680f8feba3cedff355c71f4" + domutils@1.1: version "1.1.6" resolved "https://registry.yarnpkg.com/domutils/-/domutils-1.1.6.tgz#bddc3de099b9a2efacc51c623f28f416ecc57485" @@ -2416,7 +2422,7 @@ extend-shallow@^3.0.0, extend-shallow@^3.0.2: assign-symbols "^1.0.0" is-extendable "^1.0.1" -extend@3, extend@^3.0.0, extend@~3.0.0, extend@~3.0.1: +extend@3, extend@^3.0.0, extend@~3.0.0: version "3.0.1" resolved "https://registry.yarnpkg.com/extend/-/extend-3.0.1.tgz#a755ea7bc1adfcc5a31ce7e762dbaadc5e636444" @@ -2627,14 +2633,6 @@ form-data@~2.1.1: combined-stream "^1.0.5" mime-types "^2.1.12" -form-data@~2.3.1: - version "2.3.2" - resolved "https://registry.yarnpkg.com/form-data/-/form-data-2.3.2.tgz#4970498be604c20c005d4f5c23aecd21d6b49099" - dependencies: - asynckit "^0.4.0" - combined-stream "1.0.6" - mime-types "^2.1.12" - forwarded@~0.1.2: version "0.1.2" resolved "https://registry.yarnpkg.com/forwarded/-/forwarded-0.1.2.tgz#98c23dab1175657b8c0573e8ceccd91b0ff18c84" @@ -2880,6 +2878,10 @@ graceful-fs@^4.1.11, graceful-fs@^4.1.2, graceful-fs@^4.1.6: version "4.1.11" resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.1.11.tgz#0e8bdfe4d1ddb8854d64e04ea7c00e2a026e5658" +hammerjs@^2.0.8: + version "2.0.8" + resolved "https://registry.yarnpkg.com/hammerjs/-/hammerjs-2.0.8.tgz#04ef77862cff2bb79d30f7692095930222bf60f1" + handle-thing@^1.2.5: version "1.2.5" resolved "https://registry.yarnpkg.com/handle-thing/-/handle-thing-1.2.5.tgz#fd7aad726bf1a5fd16dfc29b2f7a6601d27139c4" @@ -2898,10 +2900,6 @@ har-schema@^1.0.5: version "1.0.5" resolved "https://registry.yarnpkg.com/har-schema/-/har-schema-1.0.5.tgz#d263135f43307c02c602afc8fe95970c0151369e" -har-schema@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/har-schema/-/har-schema-2.0.0.tgz#a94c2224ebcac04782a0d9035521f24735b7ec92" - har-validator@~2.0.6: version "2.0.6" resolved "https://registry.yarnpkg.com/har-validator/-/har-validator-2.0.6.tgz#cdcbc08188265ad119b6a5a7c8ab70eecfb5d27d" @@ -2918,13 +2916,6 @@ har-validator@~4.2.1: ajv "^4.9.1" har-schema "^1.0.5" -har-validator@~5.0.3: - version "5.0.3" - resolved "https://registry.yarnpkg.com/har-validator/-/har-validator-5.0.3.tgz#ba402c266194f15956ef15e0fcf242993f6a7dfd" - dependencies: - ajv "^5.1.0" - har-schema "^2.0.0" - has-ansi@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/has-ansi/-/has-ansi-2.0.0.tgz#34f5049ce1ecdf2b0649af3ef24e45ed35416d91" @@ -3019,15 +3010,6 @@ hawk@3.1.3, hawk@~3.1.3: hoek "2.x.x" sntp "1.x.x" -hawk@~6.0.2: - version "6.0.2" - resolved "https://registry.yarnpkg.com/hawk/-/hawk-6.0.2.tgz#af4d914eb065f9b5ce4d9d11c1cb2126eecc3038" - dependencies: - boom "4.x.x" - cryptiles "3.x.x" - hoek "4.x.x" - sntp "2.x.x" - he@1.1.x: version "1.1.1" resolved "https://registry.yarnpkg.com/he/-/he-1.1.1.tgz#93410fd21b009735151f8868c2f271f3427e23fd" @@ -3051,10 +3033,6 @@ hoek@2.x.x: version "2.16.3" resolved "https://registry.yarnpkg.com/hoek/-/hoek-2.16.3.tgz#20bb7403d3cea398e91dc4710a8ff1b8274a25ed" -hoek@4.x.x: - version "4.2.1" - resolved "https://registry.yarnpkg.com/hoek/-/hoek-4.2.1.tgz#9634502aa12c445dd5a7c5734b572bb8738aacbb" - homedir-polyfill@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/homedir-polyfill/-/homedir-polyfill-1.0.1.tgz#4c2bbc8a758998feebf5ed68580f76d46768b4bc" @@ -3168,14 +3146,6 @@ http-signature@~1.1.0: jsprim "^1.2.2" sshpk "^1.7.0" -http-signature@~1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/http-signature/-/http-signature-1.2.0.tgz#9aecd925114772f3d95b65a60abb8f7c18fbace1" - dependencies: - assert-plus "^1.0.0" - jsprim "^1.2.2" - sshpk "^1.7.0" - httpntlm@1.6.1: version "1.6.1" resolved "https://registry.yarnpkg.com/httpntlm/-/httpntlm-1.6.1.tgz#ad01527143a2e8773cfae6a96f58656bb52a34b2" @@ -4687,7 +4657,7 @@ number-is-nan@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/number-is-nan/-/number-is-nan-1.0.1.tgz#097b602b53422a522c1afb8790318336941a011d" -oauth-sign@~0.8.1, oauth-sign@~0.8.2: +oauth-sign@~0.8.1: version "0.8.2" resolved "https://registry.yarnpkg.com/oauth-sign/-/oauth-sign-0.8.2.tgz#46a6ab7f0aead8deae9ec0565780b7d4efeb9d43" @@ -5020,10 +4990,6 @@ performance-now@^0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/performance-now/-/performance-now-0.2.0.tgz#33ef30c5c77d4ea21c5a53869d91b56d8f2555e5" -performance-now@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/performance-now/-/performance-now-2.1.0.tgz#6309f4e0e5fa913ec1c69307ae364b4b377c9e7b" - pify@^2.0.0, pify@^2.3.0: version "2.3.0" resolved "https://registry.yarnpkg.com/pify/-/pify-2.3.0.tgz#ed141a6ac043a849ea588498e7dca8b15330e90c" @@ -5487,7 +5453,7 @@ qjobs@^1.1.4: version "1.2.0" resolved "https://registry.yarnpkg.com/qjobs/-/qjobs-1.2.0.tgz#c45e9c61800bd087ef88d7e256423bdd49e5d071" -qs@6.5.1, qs@~6.5.1: +qs@6.5.1: version "6.5.1" resolved "https://registry.yarnpkg.com/qs/-/qs-6.5.1.tgz#349cdf6eef89ec45c12d7d5eb3fc0c870343a6d8" @@ -5780,32 +5746,32 @@ repeating@^2.0.0: dependencies: is-finite "^1.0.0" -request@2, request@^2.0.0, request@^2.74.0, request@^2.78.0: - version "2.85.0" - resolved "https://registry.yarnpkg.com/request/-/request-2.85.0.tgz#5a03615a47c61420b3eb99b7dba204f83603e1fa" +request@2, request@2.81.0, request@^2.0.0, request@^2.74.0, request@^2.78.0: + version "2.81.0" + resolved "https://registry.yarnpkg.com/request/-/request-2.81.0.tgz#c6928946a0e06c5f8d6f8a9333469ffda46298a0" dependencies: - aws-sign2 "~0.7.0" - aws4 "^1.6.0" + aws-sign2 "~0.6.0" + aws4 "^1.2.1" caseless "~0.12.0" combined-stream "~1.0.5" - extend "~3.0.1" + extend "~3.0.0" forever-agent "~0.6.1" - form-data "~2.3.1" - har-validator "~5.0.3" - hawk "~6.0.2" - http-signature "~1.2.0" + form-data "~2.1.1" + har-validator "~4.2.1" + hawk "~3.1.3" + http-signature "~1.1.0" is-typedarray "~1.0.0" isstream "~0.1.2" json-stringify-safe "~5.0.1" - mime-types "~2.1.17" - oauth-sign "~0.8.2" - performance-now "^2.1.0" - qs "~6.5.1" - safe-buffer "^5.1.1" - stringstream "~0.0.5" - tough-cookie "~2.3.3" + mime-types "~2.1.7" + oauth-sign "~0.8.1" + performance-now "^0.2.0" + qs "~6.4.0" + safe-buffer "^5.0.1" + stringstream "~0.0.4" + tough-cookie "~2.3.0" tunnel-agent "^0.6.0" - uuid "^3.1.0" + uuid "^3.0.0" request@2.75.x: version "2.75.0" @@ -5833,33 +5799,6 @@ request@2.75.x: tough-cookie "~2.3.0" tunnel-agent "~0.4.1" -request@2.81.0: - version "2.81.0" - resolved "https://registry.yarnpkg.com/request/-/request-2.81.0.tgz#c6928946a0e06c5f8d6f8a9333469ffda46298a0" - dependencies: - aws-sign2 "~0.6.0" - aws4 "^1.2.1" - caseless "~0.12.0" - combined-stream "~1.0.5" - extend "~3.0.0" - forever-agent "~0.6.1" - form-data "~2.1.1" - har-validator "~4.2.1" - hawk "~3.1.3" - http-signature "~1.1.0" - is-typedarray "~1.0.0" - isstream "~0.1.2" - json-stringify-safe "~5.0.1" - mime-types "~2.1.7" - oauth-sign "~0.8.1" - performance-now "^0.2.0" - qs "~6.4.0" - safe-buffer "^5.0.1" - stringstream "~0.0.4" - tough-cookie "~2.3.0" - tunnel-agent "^0.6.0" - uuid "^3.0.0" - request@~2.79.0: version "2.79.0" resolved "https://registry.yarnpkg.com/request/-/request-2.79.0.tgz#4dfe5bf6be8b8cdc37fcf93e04b65577722710de" @@ -6269,12 +6208,6 @@ sntp@1.x.x: dependencies: hoek "2.x.x" -sntp@2.x.x: - version "2.1.0" - resolved "https://registry.yarnpkg.com/sntp/-/sntp-2.1.0.tgz#2c6cec14fedc2222739caf9b5c3d85d1cc5a2cc8" - dependencies: - hoek "4.x.x" - socket.io-adapter@~1.1.0: version "1.1.1" resolved "https://registry.yarnpkg.com/socket.io-adapter/-/socket.io-adapter-1.1.1.tgz#2a805e8a14d6372124dd9159ad4502f8cb07f06b" @@ -6597,7 +6530,7 @@ string_decoder@~0.10.x: version "0.10.31" resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-0.10.31.tgz#62e203bc41766c6c28c9fc84301dab1c5310fa94" -stringstream@~0.0.4, stringstream@~0.0.5: +stringstream@~0.0.4: version "0.0.5" resolved "https://registry.yarnpkg.com/stringstream/-/stringstream-0.0.5.tgz#4e484cd4de5a0bbbee18e46307710a8a81621878" @@ -6830,7 +6763,7 @@ toposort@^1.0.0: version "1.0.6" resolved "https://registry.yarnpkg.com/toposort/-/toposort-1.0.6.tgz#c31748e55d210effc00fdcdc7d6e68d7d7bb9cec" -tough-cookie@~2.3.0, tough-cookie@~2.3.3: +tough-cookie@~2.3.0: version "2.3.4" resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-2.3.4.tgz#ec60cee38ac675063ffc97a5c18970578ee83655" dependencies: @@ -7159,7 +7092,7 @@ utils-merge@1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/utils-merge/-/utils-merge-1.0.1.tgz#9f95710f50a267947b2ccc124741c1028427e713" -uuid@^3.0.0, uuid@^3.0.1, uuid@^3.1.0: +uuid@^3.0.0, uuid@^3.0.1: version "3.2.1" resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.2.1.tgz#12c528bb9d58d0b9265d9a2f6f0fe8be17ff1f14" @@ -7433,6 +7366,10 @@ ws@~3.3.1: safe-buffer "~5.1.0" ultron "~1.1.0" +xhr2@^0.1.4: + version "0.1.4" + resolved "https://registry.yarnpkg.com/xhr2/-/xhr2-0.1.4.tgz#7f87658847716db5026323812f818cadab387a5f" + xml-char-classes@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/xml-char-classes/-/xml-char-classes-1.0.0.tgz#64657848a20ffc5df583a42ad8a277b4512bbc4d"