This commit is contained in:
crusader 2018-06-01 18:45:28 +09:00
parent 16ee0e825f
commit 46c1c55d61
169 changed files with 54 additions and 3890 deletions

View File

@ -12,7 +12,7 @@ import { ListSelector } from '../../store';
import { Target } from '@overflow/commons-typescript/model/target';
import { Infra, InfraHost, InfraService } from '@overflow/commons-typescript/model/infra';
import { Domain, DomainMember } from '@overflow/commons-typescript/model/domain';
import { AuthContainerSelector } from '@overflow/shared/auth/store';
import { AuthSelector } from '@overflow/shared/auth/store';
// import { sensorListSelector } from '@overflow/sensor/store';
@ -66,7 +66,7 @@ export class MapComponent implements OnInit, AfterContentInit {
ngAfterContentInit() {
this.listStore.select(AuthContainerSelector.selectDomainMember).subscribe(
this.listStore.select(AuthSelector.selectDomainMember).subscribe(
(domainMember: DomainMember) => {
// const pageParams: PageParams = {

View File

@ -4,10 +4,10 @@ import { AbstractControl, FormBuilder, FormGroup, Validators} from '@angular/for
import { DomainMember } from '@overflow/commons-typescript/model/domain';
import { Observable, of } from 'rxjs';
import { Store } from '@ngrx/store';
import { AuthContainerSelector } from '@overflow/shared/auth/store';
import { AuthSelector } from '@overflow/shared/auth/store';
import * as AuthStore from '@overflow/shared/auth/store/auth';
import { catchError, map, tap } from 'rxjs/operators';
import { MemberService } from '../service/member.service';
import * as MemberEntityStore from '../store/entity/member';
@Component({
selector: 'of-member-profile',
@ -33,7 +33,7 @@ export class MemberProfileComponent implements OnInit, OnDestroy {
}
ngOnInit() {
this.store.select(AuthContainerSelector.selectDomainMember).subscribe(
this.store.select(AuthSelector.selectDomainMember).subscribe(
(domainMember: DomainMember) => {
this.domainMember = domainMember;
}
@ -89,7 +89,7 @@ export class MemberProfileComponent implements OnInit, OnDestroy {
this.pending$ = of(true);
}),
map((rmember: Member) => {
this.store.dispatch(new MemberEntityStore.ModifySuccess(rmember));
this.store.dispatch(new AuthStore.ModifySuccess(rmember));
}),
catchError(err => {
this.error$ = of(err);

View File

@ -1,7 +0,0 @@
import { MemberSigninContainerComponent } from './member-signin-container.component';
import { MemberTotpContainerComponent } from './member-totp-container.component';
export const CONTAINERS = [
MemberSigninContainerComponent,
MemberTotpContainerComponent,
];

View File

@ -1,7 +0,0 @@
<of-member-signin
[member]="member$ | async"
(signin)="onSignin($event)"
(signup)="onSignup()"
(resetPassword)="onResetPassword()"
>
</of-member-signin>

View File

@ -1,25 +0,0 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { MemberSigninContainerComponent } from './member-signin-container.component';
describe('MemberSigninContainerComponent', () => {
let component: MemberSigninContainerComponent;
let fixture: ComponentFixture<MemberSigninContainerComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ MemberSigninContainerComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(MemberSigninContainerComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@ -1,46 +0,0 @@
import {Component, OnInit, Input, Output, EventEmitter} from '@angular/core';
import { Store, select } from '@ngrx/store';
import { Observable } from 'rxjs';
import { MemberSigninContainerSelector } from '../store';
import * as MemberEntityStore from '../store/entity/member';
import { Member } from '@overflow/commons-typescript/model/member';
@Component({
selector: 'of-member-signin-container',
templateUrl: './member-signin-container.component.html',
})
export class MemberSigninContainerComponent implements OnInit {
@Input() returnURL: string;
@Output() resetPassword = new EventEmitter();
@Output() signup = new EventEmitter();
member$: Observable<Member>;
pending$: Observable<boolean>;
error$: Observable<any>;
constructor(
private store: Store<any>,
) {
}
ngOnInit() {
this.member$ = this.store.pipe(select(MemberSigninContainerSelector.selectMember));
this.pending$ = this.store.pipe(select(MemberSigninContainerSelector.selectPending));
this.error$ = this.store.pipe(select(MemberSigninContainerSelector.selectError));
}
onSignin(info: {email: string, password: string}) {
this.store.dispatch(new MemberEntityStore.Signin({...info, returnURL: this.returnURL}));
}
onSignup() {
this.signup.emit();
}
onResetPassword() {
this.resetPassword.emit();
}
}

View File

@ -1,7 +0,0 @@
<of-member-totp
[domainMember]="domainMember$ | async"
[totp]="totp$ | async"
(regist)="regist($event)"
(create)="create()"
>
</of-member-totp>

View File

@ -1,25 +0,0 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { MemberTotpContainerComponent } from './totp.component';
describe('TotpComponent', () => {
let component: MemberTotpContainerComponent;
let fixture: ComponentFixture<MemberTotpContainerComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ MemberTotpContainerComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(MemberTotpContainerComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@ -1,40 +0,0 @@
import { Component, OnInit } from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router';
import { Store } from '@ngrx/store';
import { Member, MemberTotp } from '@overflow/commons-typescript/model/member';
import { Observable } from 'rxjs';
import { DomainMember } from '@overflow/commons-typescript/model/domain';
import * as TotpEntityStore from '../store/entity/member-totp';
import { AuthContainerSelector } from '@overflow/shared/auth/store';
@Component({
selector: 'of-member-totp-container',
templateUrl: './member-totp-container.component.html',
})
export class MemberTotpContainerComponent implements OnInit {
domainMember$: Observable<DomainMember>;
totp$: Observable<MemberTotp[]>;
lists = [];
constructor(
private activatedRoute: ActivatedRoute,
private router: Router,
private store: Store<any>,
) { }
ngOnInit() {
this.domainMember$ = this.store.select(AuthContainerSelector.selectDomainMember);
}
regist(info: {member: Member, code: string, secretCode: string}) {
const secretCode = 'X6AWAK573M5372NM';
this.store.dispatch(new TotpEntityStore.Regist(info));
}
create(member: Member) {
this.store.dispatch(new TotpEntityStore.CreateTotp(member));
}
}

View File

@ -1,18 +0,0 @@
import { NgModule } from '@angular/core';
import { StoreModule } from '@ngrx/store';
import { EffectsModule } from '@ngrx/effects';
import {
REDUCERS,
EFFECTS,
} from './store';
import { MODULE } from './member.constant';
@NgModule({
imports: [
StoreModule.forFeature(MODULE.name, REDUCERS),
EffectsModule.forFeature(EFFECTS),
],
})
export class MemberStoreModule { }

View File

@ -2,11 +2,9 @@ import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { RouterModule } from '@angular/router';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { MemberStoreModule } from './member-store.module';
import { MemberRESTModule } from './member-rest.module';
import { COMPONENTS } from './component';
import { CONTAINERS } from './container';
import { SERVICES } from './service';
import { UIModule } from '@overflow/shared/ui/ui.module';
import { QRCodeModule } from 'angularx-qrcode';
@ -18,7 +16,6 @@ import { RecaptchaModule } from 'angular-google-recaptcha';
RouterModule,
FormsModule,
ReactiveFormsModule,
MemberStoreModule,
MemberRESTModule,
UIModule,
QRCodeModule,
@ -28,11 +25,9 @@ import { RecaptchaModule } from 'angular-google-recaptcha';
],
declarations: [
COMPONENTS,
CONTAINERS,
],
exports: [
COMPONENTS,
CONTAINERS,
],
providers: [
SERVICES,

View File

@ -1,3 +0,0 @@
export * from './member-modify.reducer';
export * from './member-modify.state';

View File

@ -1,38 +0,0 @@
import {
Actions,
ActionType,
} from '../../entity/member/member.action';
import {
State,
initialState,
} from './member-modify.state';
export function reducer(state = initialState, action: Actions): State {
switch (action.type) {
case ActionType.Modify: {
return {
pending: true,
error: null,
};
}
case ActionType.ModifySuccess: {
return {
pending: false,
error: null,
};
}
case ActionType.ModifyFailure: {
return {
pending: false,
error: action.payload,
};
}
default: {
return state;
}
}
}

View File

@ -1,23 +0,0 @@
import { Selector, createSelector } from '@ngrx/store';
import { RESTClientError } from '@loafer/ng-rest';
import { Member } from '@overflow/commons-typescript/model/member';
export interface State {
pending: boolean;
error: RESTClientError;
}
export const initialState: State = {
pending: false,
error: null,
};
export function getSelectors(selector: Selector<any, State>) {
return {
selectPending: createSelector(selector, (state: State) => state.pending),
selectError: createSelector(selector, (state: State) => state.error),
};
}

View File

@ -1,2 +0,0 @@
export * from './member-signin.reducer';
export * from './member-signin.state';

View File

@ -1,47 +0,0 @@
import {
Actions as MemberActions,
ActionType as MemberActionType,
} from '../../entity/member/member.action';
import {
State,
initialState,
} from './member-signin.state';
import {
Actions as AuthActions,
ActionType as AuthActionType,
} from '@overflow/shared/auth/store/container/auth';
export function reducer(state: State = initialState, action: MemberActions | AuthActions): State {
switch (action.type) {
case MemberActionType.Signin: {
return {
member: null,
pending: true,
error: null,
};
}
case AuthActionType.SigninSuccess: {
return {
member: action.payload.domainMember.member,
pending: false,
error: null,
};
}
case AuthActionType.SigninFailure: {
return {
member: null,
pending: false,
error: action.payload,
};
}
default: {
return state;
}
}
}

View File

@ -1,24 +0,0 @@
import { Selector, createSelector } from '@ngrx/store';
import { RESTClientError } from '@loafer/ng-rest';
import { Member } from '@overflow/commons-typescript/model/member';
export interface State {
member: Member;
pending: boolean;
error: RESTClientError;
}
export const initialState: State = {
member: null,
pending: false,
error: null,
};
export function getSelectors(selector: Selector<any, State>) {
return {
selectMember: createSelector(selector, (state: State) => state.member),
selectPending: createSelector(selector, (state: State) => state.pending),
selectError: createSelector(selector, (state: State) => state.error),
};
}

View File

@ -1,2 +0,0 @@
export * from './member-signout.reducer';
export * from './member-signout.state';

View File

@ -1,44 +0,0 @@
import {
Actions as MemberActions,
ActionType as MemberActionType,
} from '../../entity/member/member.action';
import {
State,
initialState,
} from './member-signout.state';
import {
Actions as AuthActions,
ActionType as AuthActionType,
} from '@overflow/shared/auth/store/container/auth';
export function reducer(state = initialState, action: MemberActions | AuthActions): State {
switch (action.type) {
case MemberActionType.Signout: {
return {
pending: true,
error: null,
};
}
case AuthActionType.SignoutSuccess: {
return {
pending: false,
error: null,
};
}
case AuthActionType.SignoutFailure: {
return {
pending: false,
error: null,
};
}
default: {
return state;
}
}
}

View File

@ -1,20 +0,0 @@
import { Selector, createSelector } from '@ngrx/store';
import { RESTClientError } from '@loafer/ng-rest';
export interface State {
pending: boolean;
error: RESTClientError;
}
export const initialState: State = {
pending: false,
error: null,
};
export function getSelectors(selector: Selector<any, State>) {
return {
selectPending: createSelector(selector, (state: State) => state.pending),
selectError: createSelector(selector, (state: State) => state.error),
};
}

View File

@ -1,3 +0,0 @@
export * from './member-totp.reducer';
export * from './member-totp.state';

View File

@ -1,97 +0,0 @@
import {
Actions,
ActionType,
} from '../../entity/member-totp/member-totp.action';
import {
State,
initialState,
} from './member-totp.state';
export function reducer(state = initialState, action: Actions): State {
switch (action.type) {
case ActionType.CreateTotp: {
return {
secretKey: null,
sourceURI: null,
pending: true,
error: null,
};
}
case ActionType.CreateTotpSuccess: {
return {
secretKey: action.payload.key,
sourceURI: action.payload.uri,
pending: false,
error: null,
};
}
case ActionType.CreateTotpFailure: {
return {
secretKey: null,
sourceURI: null,
pending: false,
error: action.payload,
};
}
case ActionType.Regist: {
return {
secretKey: null,
sourceURI: null,
pending: true,
error: null,
};
}
case ActionType.RegistSuccess: {
return {
secretKey: null,
sourceURI: null,
pending: true,
error: null,
};
}
case ActionType.RegistFailure: {
return {
secretKey: null,
sourceURI: null,
pending: true,
error: action.payload,
};
}
case ActionType.CheckCodeForMember: {
return {
secretKey: null,
sourceURI: null,
pending: true,
error: null,
};
}
case ActionType.CheckCodeForMemberSuccess: {
return {
secretKey: null,
sourceURI: null,
pending: true,
error: null,
};
}
case ActionType.CheckCodeForMemberFailure: {
return {
secretKey: null,
sourceURI: null,
pending: true,
error: action.payload,
};
}
default: {
return state;
}
}
}

View File

@ -1,25 +0,0 @@
import { Selector, createSelector } from '@ngrx/store';
import { RPCClientError } from '@loafer/ng-rpc';
export interface State {
secretKey: string;
sourceURI: string;
pending: boolean;
error: RPCClientError;
}
export const initialState: State = {
secretKey: null,
sourceURI: null,
pending: false,
error: null,
};
export function getSelectors(selector: Selector<any, State>) {
return {
selectSecretKey: createSelector(selector, (state: State) => state.secretKey),
selectSourceURI: createSelector(selector, (state: State) => state.sourceURI),
selectPending: createSelector(selector, (state: State) => state.pending),
selectError: createSelector(selector, (state: State) => state.error),
};
}

View File

@ -1,2 +0,0 @@
export * from './member-totp.action';
export * from './member-totp.effect';

View File

@ -1,87 +0,0 @@
import { Action } from '@ngrx/store';
import { RPCClientError } from '@loafer/ng-rpc';
import { Member } from '@overflow/commons-typescript/model/member';
export enum ActionType {
CreateTotp = '[member.member-totp] CreateTotp',
CreateTotpSuccess = '[member.member-totp] CreateTotpSuccess',
CreateTotpFailure = '[member.member-totp] CreateTotpFailure',
Regist = '[member.member-totp] Regist',
RegistSuccess = '[member.member-totp] RegistSuccess',
RegistFailure = '[member.member-totp] RegistFailure',
CheckCodeForMember = '[member.member-totp] CheckCodeForMember',
CheckCodeForMemberSuccess = '[member.member-totp] CheckCodeForMemberSuccess',
CheckCodeForMemberFailure = '[member.member-totp] CheckCodeForMemberFailure',
}
export class CreateTotp implements Action {
readonly type = ActionType.CreateTotp;
constructor(public payload: Member) {}
}
export class CreateTotpSuccess implements Action {
readonly type = ActionType.CreateTotpSuccess;
constructor(public payload: {key: string, uri: string}) {}
}
export class CreateTotpFailure implements Action {
readonly type = ActionType.CreateTotpFailure;
constructor(public payload: RPCClientError) {}
}
// ----------------------------------------------------------------------------------------
export class Regist implements Action {
readonly type = ActionType.Regist;
constructor(public payload: {member: Member, secretCode: string, code: string}) {}
}
export class RegistSuccess implements Action {
readonly type = ActionType.RegistSuccess;
}
export class RegistFailure implements Action {
readonly type = ActionType.RegistFailure;
constructor(public payload: RPCClientError) {}
}
// ----------------------------------------------------------------------------------------
export class CheckCodeForMember implements Action {
readonly type = ActionType.CheckCodeForMember;
constructor(public payload: {member: Member, code: string}) {}
}
export class CheckCodeForMemberSuccess implements Action {
readonly type = ActionType.CheckCodeForMemberSuccess;
constructor(public payload: boolean) {}
}
export class CheckCodeForMemberFailure implements Action {
readonly type = ActionType.CheckCodeForMemberFailure;
constructor(public payload: RPCClientError) {}
}
export type Actions =
| CreateTotp
| CreateTotpSuccess
| CreateTotpFailure
| Regist
| RegistSuccess
| RegistFailure
| CheckCodeForMember
| CheckCodeForMemberSuccess
| CheckCodeForMemberFailure
;

View File

@ -1,15 +0,0 @@
import { TestBed, inject } from '@angular/core/testing';
import { Effects } from './member-totp.effect';
describe('member-totp.Effects', () => {
beforeEach(() => {
TestBed.configureTestingModule({
providers: [Effects]
});
});
it('should be created', inject([Effects], (effects: Effects) => {
expect(effects).toBeTruthy();
}));
});

View File

@ -1,81 +0,0 @@
import { Injectable } from '@angular/core';
import { Effect, Actions, ofType } from '@ngrx/effects';
import { of } from 'rxjs/observable/of';
import { catchError, exhaustMap, map } from 'rxjs/operators';
import { MemberTotpService } from '../../../service/member-totp.service';
import {
CreateTotp,
CreateTotpSuccess,
CreateTotpFailure,
Regist,
RegistSuccess,
RegistFailure,
CheckCodeForMember,
CheckCodeForMemberSuccess,
CheckCodeForMemberFailure,
ActionType,
} from './member-totp.action';
import {Member} from '@overflow/commons-typescript/model/member';
@Injectable()
export class Effects {
constructor(
private actions$: Actions,
private memberTotpService: MemberTotpService,
) { }
@Effect()
createTotp$ = this.actions$.pipe(
ofType(ActionType.CreateTotp),
map(( action: CreateTotp ) => action.payload),
exhaustMap(( member: Member ) =>
this.memberTotpService
.createTotp(member)
.pipe(
map((result: any) => {
return new CreateTotpSuccess({ key: result.secretKey, uri: result.sourceURI});
}),
catchError(error => of(new CreateTotpFailure(error)))
)
)
);
@Effect()
regist$ = this.actions$.pipe(
ofType(ActionType.Regist),
map(( action: Regist ) => action.payload),
exhaustMap(( totpInfo: { member: Member, secretCode: string, code: string } ) =>
this.memberTotpService
.regist(totpInfo.member, totpInfo.secretCode, totpInfo.code)
.pipe(
map(() => {
return new RegistSuccess();
}),
catchError(error => of(new RegistFailure(error)))
)
)
);
@Effect()
checkCodeForMember$ = this.actions$.pipe(
ofType(ActionType.CheckCodeForMember),
map(( action: CheckCodeForMember ) => action.payload),
exhaustMap(( totpInfo: { member: Member, code: string } ) =>
this.memberTotpService
.checkCodeForMember(totpInfo.member, totpInfo.code)
.pipe(
map((result: boolean) => {
return new CheckCodeForMemberSuccess(result);
}),
catchError(error => of(new CheckCodeForMemberFailure(error)))
)
)
);
}

View File

@ -1,3 +0,0 @@
export * from './member.action';
export * from './member.effect';

View File

@ -1,49 +0,0 @@
import { Action } from '@ngrx/store';
import { RESTClientError } from '@loafer/ng-rest';
import { Member } from '@overflow/commons-typescript/model/member';
import {EmailAuth} from '@overflow/commons-typescript/model/email/EmailAuth';
export enum ActionType {
Signin = '[member.member] Signin',
Signout = '[member.member] Signout',
Modify = '[member.member] Modify',
ModifySuccess = '[member.member] ModifySuccess',
ModifyFailure = '[member.member] ModifyFailure',
}
export class Signin implements Action {
readonly type = ActionType.Signin;
constructor(public payload: { email: string, password: string, returnURL: string }) { }
}
export class Signout implements Action {
readonly type = ActionType.Signout;
}
export class Modify implements Action {
readonly type = ActionType.Modify;
constructor(public payload: Member ) {}
}
export class ModifySuccess implements Action {
readonly type = ActionType.ModifySuccess;
constructor(public payload: Member) {}
}
export class ModifyFailure implements Action {
readonly type = ActionType.ModifyFailure;
constructor(public payload: RESTClientError) {}
}
export type Actions =
| Signin
| Signout
| Modify
| ModifySuccess
| ModifyFailure
;

View File

@ -1,15 +0,0 @@
import { TestBed, inject } from '@angular/core/testing';
import { Effects } from './member.effect';
describe('member-entity.Effects', () => {
beforeEach(() => {
TestBed.configureTestingModule({
providers: [Effects]
});
});
it('should be created', inject([Effects], (effects: Effects) => {
expect(effects).toBeTruthy();
}));
});

View File

@ -1,71 +0,0 @@
import { Injectable } from '@angular/core';
import { Router } from '@angular/router';
import { Effect, Actions, ofType } from '@ngrx/effects';
import { of } from 'rxjs';
import { catchError, exhaustMap, map, tap } from 'rxjs/operators';
import { Member } from '@overflow/commons-typescript/model/member';
import { MemberService } from '../../../service/member.service';
import {
Signin,
Modify,
ModifySuccess,
ModifyFailure,
ActionType,
} from './member.action';
import {
SigninSuccess,
SigninFailure,
SigninCookieSuccess,
SigninCookieFailure,
} from '@overflow/shared/auth/store/container/auth';
import { DomainMember } from '@overflow/commons-typescript/model/domain';
import { EmailAuthService } from '../../../service/email-auth.service';
import {EmailAuth} from '@overflow/commons-typescript/model/email/EmailAuth';
@Injectable()
export class Effects {
constructor(
private actions$: Actions,
private memberService: MemberService,
private emailAuthService: EmailAuthService,
private router: Router
) { }
@Effect()
signin$ = this.actions$.pipe(
ofType(ActionType.Signin),
map((action: Signin) => action.payload),
exhaustMap((signinInfo: { email: string, password: string, returnURL: string }) =>
this.memberService
.signin(signinInfo.email, signinInfo.password)
.pipe(
map((result: { authToken: string, domainMember: DomainMember }) => {
return new SigninSuccess({ authToken: result.authToken, domainMember: result.domainMember, returnURL: signinInfo.returnURL });
}),
catchError(error => of(new SigninFailure(error)))
)
)
);
@Effect()
modify$ = this.actions$.pipe(
ofType(ActionType.Modify),
map((action: Modify) => action.payload),
exhaustMap((member: Member) =>
this.memberService
.modify(member)
.pipe(
map((newMember: Member) => {
return new ModifySuccess(newMember);
}),
catchError(error => of(new ModifyFailure(error)))
)
)
);
}

View File

@ -1,48 +0,0 @@
import {
createSelector,
createFeatureSelector,
} from '@ngrx/store';
import { MODULE } from '../member.constant';
import * as MemberEntityStore from './entity/member';
import * as MemberTOTPEntityStore from './entity/member-totp';
import * as MemberSigninContainerStore from './container/signin';
import * as MemberModifyContainerStore from './container/modify';
import * as MemberSignoutContainerStore from './container/signout';
export interface State {
member_signin_container: MemberSigninContainerStore.State;
member_modify_container: MemberModifyContainerStore.State;
member_signout_container: MemberSignoutContainerStore.State;
}
export const REDUCERS = {
member_signin_container: MemberSigninContainerStore.reducer,
member_modify_container: MemberModifyContainerStore.reducer,
member_signout_container: MemberSignoutContainerStore.reducer,
};
export const EFFECTS = [
MemberEntityStore.Effects,
MemberTOTPEntityStore.Effects,
];
export const selectState = createFeatureSelector<State>(MODULE.name);
export const MemberSigninContainerSelector = MemberSigninContainerStore.getSelectors(createSelector(
selectState,
(state: State) => state.member_signin_container
));
export const MemberModifyContainerSelector = MemberModifyContainerStore.getSelectors(createSelector(
selectState,
(state: State) => state.member_modify_container
));
export const MemberSignoutContainerSelector = MemberSignoutContainerStore.getSelectors(createSelector(
selectState,
(state: State) => state.member_signout_container
));

View File

@ -1,24 +0,0 @@
import { NgModule } from '@angular/core';
import { StoreModule } from '@ngrx/store';
import { StoreDevtoolsModule } from '@ngrx/store-devtools';
import {
StoreRouterConnectingModule,
RouterStateSerializer,
} from '@ngrx/router-store';
import { EffectsModule } from '@ngrx/effects';
import { combineReducers, ActionReducer, ActionReducerMap, MetaReducer } from '@ngrx/store';
import {
REDUCERS,
EFFECTS,
} from './store';
import { MODULE } from './meta.constant';
@NgModule({
imports: [
StoreModule.forFeature(MODULE.name, REDUCERS),
EffectsModule.forFeature(EFFECTS),
],
})
export class MetaStoreModule { }

View File

@ -6,13 +6,10 @@ import { UIModule } from '@overflow/shared/ui/ui.module';
import { COMPONENTS } from './component';
import { SERVICES } from './service';
import { MetaStoreModule } from './meta-store.module';
@NgModule({
imports: [
CommonModule,
UIModule,
MetaStoreModule,
],
declarations: [
COMPONENTS,

View File

@ -1,4 +0,0 @@
export * from './meta-crawler-input-item.action';
export * from './meta-crawler-input-item.effect';
export * from './meta-crawler-input-item.reducer';
export * from './meta-crawler-input-item.state';

View File

@ -1,34 +0,0 @@
import { Action } from '@ngrx/store';
import { RPCClientError } from '@loafer/ng-rpc';
import { NoAuthProbe } from '@overflow/commons-typescript/model/noauth';
import { MetaCrawler, MetaCrawlerInputItem } from '@overflow/commons-typescript/model/meta';
export enum ActionType {
ReadAllByMetaCrawler = '[meta.meta-crawler-input-item] ReadAllByMetaCrawler',
ReadAllByMetaCrawlerSuccess = '[meta.meta-crawler-input-item] ReadAllByMetaCrawlerSuccess',
ReadAllByMetaCrawlerFailure = '[meta.meta-crawler-input-item] ReadAllByMetaCrawlerFailure',
}
export class ReadAllByMetaCrawler implements Action {
readonly type = ActionType.ReadAllByMetaCrawler;
constructor(public payload: MetaCrawler) {}
}
export class ReadAllByMetaCrawlerSuccess implements Action {
readonly type = ActionType.ReadAllByMetaCrawlerSuccess;
constructor(public payload: MetaCrawlerInputItem[]) {}
}
export class ReadAllByMetaCrawlerFailure implements Action {
readonly type = ActionType.ReadAllByMetaCrawlerFailure;
constructor(public payload: RPCClientError) {}
}
export type Actions =
| ReadAllByMetaCrawler
| ReadAllByMetaCrawlerSuccess
| ReadAllByMetaCrawlerFailure
;

View File

@ -1,40 +0,0 @@
import { Injectable } from '@angular/core';
import { Effect, Actions, ofType } from '@ngrx/effects';
import { of } from 'rxjs';
import { catchError, exhaustMap, map, tap } from 'rxjs/operators';
import { MetaCrawler, MetaCrawlerInputItem } from '@overflow/commons-typescript/model/meta';
import { MetaCrawlerInputItemService } from '../../../service/meta-crawler-input-item.service';
import {
ReadAllByMetaCrawler,
ReadAllByMetaCrawlerSuccess,
ReadAllByMetaCrawlerFailure,
ActionType,
} from './meta-crawler-input-item.action';
@Injectable()
export class Effects {
constructor(
private actions$: Actions,
private metaCrawlerInputItemService: MetaCrawlerInputItemService,
) { }
@Effect()
readAllByMetaCrawler$ = this.actions$.pipe(
ofType(ActionType.ReadAllByMetaCrawler),
map((action: ReadAllByMetaCrawler) => action.payload),
exhaustMap((metaCrawler: MetaCrawler) =>
this.metaCrawlerInputItemService
.readAllByMetaCrawler(metaCrawler)
.pipe(
map((result: MetaCrawlerInputItem[]) => {
return new ReadAllByMetaCrawlerSuccess(result);
}),
catchError(error => of(new ReadAllByMetaCrawlerFailure(error)))
)
)
);
}

View File

@ -1,15 +0,0 @@
import { ActionType, Actions } from './meta-crawler-input-item.action';
import {
State,
initialState,
metaCrawlerInputItemEntityAdapter,
} from './meta-crawler-input-item.state';
export function reducer(state: State = initialState, action: Actions): State {
switch (action.type) {
default: {
return state;
}
}
}

View File

@ -1,17 +0,0 @@
import { RPCClientError } from '@loafer/ng-rpc';
import { Selector, createSelector } from '@ngrx/store';
import { createEntityAdapter, EntityState } from '@loafer/ng-entity';
import { MetaCrawler, MetaCrawlerInputItem } from '@overflow/commons-typescript/model/meta';
export const metaCrawlerInputItemEntityAdapter = createEntityAdapter<MetaCrawlerInputItem, RPCClientError>();
export interface State extends EntityState<MetaCrawlerInputItem, RPCClientError> {
}
export const initialState: State = metaCrawlerInputItemEntityAdapter.getInitialState({
});
export function getSelectors(selector: Selector<any, State>) {
return {
...metaCrawlerInputItemEntityAdapter.getSelectors(selector),
};
}

View File

@ -1,4 +0,0 @@
export * from './meta-crawler.action';
export * from './meta-crawler.effect';
export * from './meta-crawler.reducer';
export * from './meta-crawler.state';

View File

@ -1,33 +0,0 @@
import { Action } from '@ngrx/store';
import { RPCClientError } from '@loafer/ng-rpc';
import { NoAuthProbe } from '@overflow/commons-typescript/model/noauth';
import { MetaCrawler } from '@overflow/commons-typescript/model/meta';
export enum ActionType {
ReadAll = '[meta.meta-crawler] ReadAll',
ReadAllSuccess = '[meta.meta-crawler] ReadAllSuccess',
ReadAllFailure = '[meta.meta-crawler] ReadAllFailure',
}
export class ReadAll implements Action {
readonly type = ActionType.ReadAll;
}
export class ReadAllSuccess implements Action {
readonly type = ActionType.ReadAllSuccess;
constructor(public payload: MetaCrawler[]) {}
}
export class ReadAllFailure implements Action {
readonly type = ActionType.ReadAllFailure;
constructor(public payload: RPCClientError) {}
}
export type Actions =
| ReadAll
| ReadAllSuccess
| ReadAllFailure
;

View File

@ -1,43 +0,0 @@
import { Injectable } from '@angular/core';
import { of } from 'rxjs';
import { Effect, Actions, ofType } from '@ngrx/effects';
import { catchError, exhaustMap, map, tap } from 'rxjs/operators';
import { MetaCrawler } from '@overflow/commons-typescript/model/meta';
import { MetaCrawlerService } from '../../../service/meta-crawler.service';
import {
ReadAll,
ReadAllSuccess,
ReadAllFailure,
ActionType,
} from './meta-crawler.action';
import {
MetaCrawlerEntitySelector,
} from '../../';
@Injectable()
export class Effects {
constructor(
private actions$: Actions,
private metaCrawlerService: MetaCrawlerService,
) { }
@Effect()
readAll$ = this.actions$.pipe(
ofType(ActionType.ReadAll),
exhaustMap(() =>
this.metaCrawlerService
.readAll()
.pipe(
map((result: MetaCrawler[]) => {
return new ReadAllSuccess(result);
}),
catchError(error => of(new ReadAllFailure(error)))
)
)
);
}

View File

@ -1,26 +0,0 @@
import { ActionType, Actions } from './meta-crawler.action';
import {
State,
initialState,
metaCrawlerEntityAdapter,
} from './meta-crawler.state';
export function reducer(state: State = initialState, action: Actions): State {
switch (action.type) {
case ActionType.ReadAll: {
return {
...state,
};
}
case ActionType.ReadAllSuccess: {
return metaCrawlerEntityAdapter.setAll(action.payload, state);
}
case ActionType.ReadAllFailure: {
return metaCrawlerEntityAdapter.setError(action.payload, state);
}
default: {
return state;
}
}
}

View File

@ -1,20 +0,0 @@
import { RPCClientError } from '@loafer/ng-rpc';
import { Selector, createSelector } from '@ngrx/store';
import { createEntityAdapter, EntityState } from '@loafer/ng-entity';
import { MetaCrawler } from '@overflow/commons-typescript/model/meta';
export const metaCrawlerEntityAdapter = createEntityAdapter<MetaCrawler, RPCClientError>();
export interface State extends EntityState<MetaCrawler, RPCClientError> {
pending: boolean;
}
export const initialState: State = metaCrawlerEntityAdapter.getInitialState({
pending: false,
});
export function getSelectors(selector: Selector<any, State>) {
return {
...metaCrawlerEntityAdapter.getSelectors(selector),
selectPending: createSelector(selector, (state: State) => state.pending),
};
}

View File

@ -1,4 +0,0 @@
export * from './meta-history-type.action';
export * from './meta-history-type.effect';
export * from './meta-history-type.reducer';
export * from './meta-history-type.state';

View File

@ -1,33 +0,0 @@
import { Action } from '@ngrx/store';
import { RPCClientError } from '@loafer/ng-rpc';
import { NoAuthProbe } from '@overflow/commons-typescript/model/noauth';
import { MetaHistoryType } from '@overflow/commons-typescript/model/meta';
export enum ActionType {
ReadAll = '[meta.meta-history-type] ReadAll',
ReadAllSuccess = '[meta.meta-history-type] ReadAllSuccess',
ReadAllFailure = '[meta.meta-history-type] ReadAllFailure',
}
export class ReadAll implements Action {
readonly type = ActionType.ReadAll;
}
export class ReadAllSuccess implements Action {
readonly type = ActionType.ReadAllSuccess;
constructor(public payload: MetaHistoryType[]) {}
}
export class ReadAllFailure implements Action {
readonly type = ActionType.ReadAllFailure;
constructor(public payload: RPCClientError) {}
}
export type Actions =
| ReadAll
| ReadAllSuccess
| ReadAllFailure
;

View File

@ -1,39 +0,0 @@
import { Injectable } from '@angular/core';
import { Effect, Actions, ofType } from '@ngrx/effects';
import { of } from 'rxjs';
import { catchError, exhaustMap, map, tap } from 'rxjs/operators';
import { MetaHistoryType } from '@overflow/commons-typescript/model/meta';
import { MetaHistoryTypeService } from '../../../service/meta-history-type.service';
import {
ReadAll,
ReadAllSuccess,
ReadAllFailure,
ActionType,
} from './meta-history-type.action';
@Injectable()
export class Effects {
constructor(
private actions$: Actions,
private metaHistoryTypeService: MetaHistoryTypeService,
) { }
@Effect()
readAll$ = this.actions$.pipe(
ofType(ActionType.ReadAll),
exhaustMap(() =>
this.metaHistoryTypeService
.readAll()
.pipe(
map((result: MetaHistoryType[]) => {
return new ReadAllSuccess(result);
}),
catchError(error => of(new ReadAllFailure(error)))
)
)
);
}

View File

@ -1,26 +0,0 @@
import { ActionType, Actions } from './meta-history-type.action';
import {
State,
initialState,
metaHistoryTypeEntityAdapter,
} from './meta-history-type.state';
export function reducer(state: State = initialState, action: Actions): State {
switch (action.type) {
case ActionType.ReadAll: {
return {
...state,
};
}
case ActionType.ReadAllSuccess: {
return metaHistoryTypeEntityAdapter.setAll(action.payload, state);
}
case ActionType.ReadAllFailure: {
return metaHistoryTypeEntityAdapter.setError(action.payload, state);
}
default: {
return state;
}
}
}

View File

@ -1,17 +0,0 @@
import { RPCClientError } from '@loafer/ng-rpc';
import { Selector, createSelector } from '@ngrx/store';
import { createEntityAdapter, EntityState } from '@loafer/ng-entity';
import { MetaHistoryType } from '@overflow/commons-typescript/model/meta';
export const metaHistoryTypeEntityAdapter = createEntityAdapter<MetaHistoryType, RPCClientError>();
export interface State extends EntityState<MetaHistoryType, RPCClientError> {
}
export const initialState: State = metaHistoryTypeEntityAdapter.getInitialState({
});
export function getSelectors(selector: Selector<any, State>) {
return {
...metaHistoryTypeEntityAdapter.getSelectors(selector),
};
}

View File

@ -1,4 +0,0 @@
export * from './meta-infra-type.action';
export * from './meta-infra-type.effect';
export * from './meta-infra-type.reducer';
export * from './meta-infra-type.state';

View File

@ -1,33 +0,0 @@
import { Action } from '@ngrx/store';
import { RPCClientError } from '@loafer/ng-rpc';
import { NoAuthProbe } from '@overflow/commons-typescript/model/noauth';
import { MetaInfraType } from '@overflow/commons-typescript/model/meta';
export enum ActionType {
ReadAll = '[meta.meta-infra-type] ReadAll',
ReadAllSuccess = '[meta.meta-infra-type] ReadAllSuccess',
ReadAllFailure = '[meta.meta-infra-type] ReadAllFailure',
}
export class ReadAll implements Action {
readonly type = ActionType.ReadAll;
}
export class ReadAllSuccess implements Action {
readonly type = ActionType.ReadAllSuccess;
constructor(public payload: MetaInfraType[]) {}
}
export class ReadAllFailure implements Action {
readonly type = ActionType.ReadAllFailure;
constructor(public payload: RPCClientError) {}
}
export type Actions =
| ReadAll
| ReadAllSuccess
| ReadAllFailure
;

View File

@ -1,39 +0,0 @@
import { Injectable } from '@angular/core';
import { Effect, Actions, ofType } from '@ngrx/effects';
import { of } from 'rxjs';
import { catchError, exhaustMap, map, tap } from 'rxjs/operators';
import { MetaInfraType } from '@overflow/commons-typescript/model/meta';
import { MetaInfraTypeService } from '../../../service/meta-infra-type.service';
import {
ReadAll,
ReadAllSuccess,
ReadAllFailure,
ActionType,
} from './meta-infra-type.action';
@Injectable()
export class Effects {
constructor(
private actions$: Actions,
private metaInfraTypeService: MetaInfraTypeService,
) { }
@Effect()
readAll$ = this.actions$.pipe(
ofType(ActionType.ReadAll),
exhaustMap(() =>
this.metaInfraTypeService
.readAll()
.pipe(
map((result: MetaInfraType[]) => {
return new ReadAllSuccess(result);
}),
catchError(error => of(new ReadAllFailure(error)))
)
)
);
}

View File

@ -1,26 +0,0 @@
import { ActionType, Actions } from './meta-infra-type.action';
import {
State,
initialState,
metaInfraTypeEntityAdapter,
} from './meta-infra-type.state';
export function reducer(state: State = initialState, action: Actions): State {
switch (action.type) {
case ActionType.ReadAll: {
return {
...state,
};
}
case ActionType.ReadAllSuccess: {
return metaInfraTypeEntityAdapter.setAll(action.payload, state);
}
case ActionType.ReadAllFailure: {
return metaInfraTypeEntityAdapter.setError(action.payload, state);
}
default: {
return state;
}
}
}

View File

@ -1,17 +0,0 @@
import { RPCClientError } from '@loafer/ng-rpc';
import { Selector, createSelector } from '@ngrx/store';
import { createEntityAdapter, EntityState } from '@loafer/ng-entity';
import { MetaInfraType } from '@overflow/commons-typescript/model/meta';
export const metaInfraTypeEntityAdapter = createEntityAdapter<MetaInfraType, RPCClientError>();
export interface State extends EntityState<MetaInfraType, RPCClientError> {
}
export const initialState: State = metaInfraTypeEntityAdapter.getInitialState({
});
export function getSelectors(selector: Selector<any, State>) {
return {
...metaInfraTypeEntityAdapter.getSelectors(selector),
};
}

View File

@ -1,4 +0,0 @@
export * from './meta-infra-vendor.action';
export * from './meta-infra-vendor.effect';
export * from './meta-infra-vendor.reducer';
export * from './meta-infra-vendor.state';

View File

@ -1,35 +0,0 @@
import { Action } from '@ngrx/store';
import { RPCClientError } from '@loafer/ng-rpc';
import { NoAuthProbe } from '@overflow/commons-typescript/model/noauth';
import { MetaInfraVendor, MetaInfraType } from '@overflow/commons-typescript/model/meta';
export enum ActionType {
ReadAllByMetaInfraType = '[meta.meta-infra-vendor] ReadAllByMetaInfraType',
ReadAllByMetaInfraTypeSuccess = '[meta.meta-infra-vendor] ReadAllByMetaInfraTypeSuccess',
ReadAllByMetaInfraTypeFailure = '[meta.meta-infra-vendor] ReadAllByMetaInfraTypeFailure',
}
export class ReadAllByMetaInfraType implements Action {
readonly type = ActionType.ReadAllByMetaInfraType;
constructor(public payload: MetaInfraType) {}
}
export class ReadAllByMetaInfraTypeSuccess implements Action {
readonly type = ActionType.ReadAllByMetaInfraTypeSuccess;
constructor(public payload: MetaInfraVendor[]) {}
}
export class ReadAllByMetaInfraTypeFailure implements Action {
readonly type = ActionType.ReadAllByMetaInfraTypeFailure;
constructor(public payload: RPCClientError) {}
}
export type Actions =
| ReadAllByMetaInfraType
| ReadAllByMetaInfraTypeSuccess
| ReadAllByMetaInfraTypeFailure
;

View File

@ -1,40 +0,0 @@
import { Injectable } from '@angular/core';
import { Effect, Actions, ofType } from '@ngrx/effects';
import { of } from 'rxjs';
import { catchError, exhaustMap, map, tap } from 'rxjs/operators';
import { MetaInfraVendor, MetaInfraType } from '@overflow/commons-typescript/model/meta';
import { MetaInfraVendorService } from '../../../service/meta-infra-vendor.service';
import {
ReadAllByMetaInfraType,
ReadAllByMetaInfraTypeSuccess,
ReadAllByMetaInfraTypeFailure,
ActionType,
} from './meta-infra-vendor.action';
@Injectable()
export class Effects {
constructor(
private actions$: Actions,
private metaInfraVendorService: MetaInfraVendorService,
) { }
@Effect()
readAllByMetaInfraType$ = this.actions$.pipe(
ofType(ActionType.ReadAllByMetaInfraType),
map((action: ReadAllByMetaInfraType) => action.payload),
exhaustMap((metaInfraType: MetaInfraType) =>
this.metaInfraVendorService
.readAllByMetaInfraType(metaInfraType)
.pipe(
map((result: MetaInfraVendor[]) => {
return new ReadAllByMetaInfraTypeSuccess(result);
}),
catchError(error => of(new ReadAllByMetaInfraTypeFailure(error)))
)
)
);
}

View File

@ -1,15 +0,0 @@
import { ActionType, Actions } from './meta-infra-vendor.action';
import {
State,
initialState,
metaCrawlerEntityAdapter,
} from './meta-infra-vendor.state';
export function reducer(state: State = initialState, action: Actions): State {
switch (action.type) {
default: {
return state;
}
}
}

View File

@ -1,17 +0,0 @@
import { RPCClientError } from '@loafer/ng-rpc';
import { Selector, createSelector } from '@ngrx/store';
import { createEntityAdapter, EntityState } from '@loafer/ng-entity';
import { MetaInfraVendor } from '@overflow/commons-typescript/model/meta';
export const metaCrawlerEntityAdapter = createEntityAdapter<MetaInfraVendor, RPCClientError>();
export interface State extends EntityState<MetaInfraVendor, RPCClientError> {
}
export const initialState: State = metaCrawlerEntityAdapter.getInitialState({
});
export function getSelectors(selector: Selector<any, State>) {
return {
...metaCrawlerEntityAdapter.getSelectors(selector),
};
}

View File

@ -1,4 +0,0 @@
export * from './meta-input-type.action';
export * from './meta-input-type.effect';
export * from './meta-input-type.reducer';
export * from './meta-input-type.state';

View File

@ -1,33 +0,0 @@
import { Action } from '@ngrx/store';
import { RPCClientError } from '@loafer/ng-rpc';
import { NoAuthProbe } from '@overflow/commons-typescript/model/noauth';
import { MetaInputType } from '@overflow/commons-typescript/model/meta';
export enum ActionType {
ReadAll = '[meta.meta-input-type] ReadAll',
ReadAllSuccess = '[meta.meta-input-type] ReadAllSuccess',
ReadAllFailure = '[meta.meta-input-type] ReadAllFailure',
}
export class ReadAll implements Action {
readonly type = ActionType.ReadAll;
}
export class ReadAllSuccess implements Action {
readonly type = ActionType.ReadAllSuccess;
constructor(public payload: MetaInputType[]) {}
}
export class ReadAllFailure implements Action {
readonly type = ActionType.ReadAllFailure;
constructor(public payload: RPCClientError) {}
}
export type Actions =
| ReadAll
| ReadAllSuccess
| ReadAllFailure
;

View File

@ -1,39 +0,0 @@
import { Injectable } from '@angular/core';
import { Effect, Actions, ofType } from '@ngrx/effects';
import { of } from 'rxjs';
import { catchError, exhaustMap, map, tap } from 'rxjs/operators';
import { MetaInputType } from '@overflow/commons-typescript/model/meta';
import { MetaInputTypeService } from '../../../service/meta-input-type.service';
import {
ReadAll,
ReadAllSuccess,
ReadAllFailure,
ActionType,
} from './meta-input-type.action';
@Injectable()
export class Effects {
constructor(
private actions$: Actions,
private metaInputTypeService: MetaInputTypeService,
) { }
@Effect()
readAll$ = this.actions$.pipe(
ofType(ActionType.ReadAll),
exhaustMap(() =>
this.metaInputTypeService
.readAll()
.pipe(
map((result: MetaInputType[]) => {
return new ReadAllSuccess(result);
}),
catchError(error => of(new ReadAllFailure(error)))
)
)
);
}

View File

@ -1,26 +0,0 @@
import { ActionType, Actions } from './meta-input-type.action';
import {
State,
initialState,
metaInputTypeEntityAdapter,
} from './meta-input-type.state';
export function reducer(state: State = initialState, action: Actions): State {
switch (action.type) {
case ActionType.ReadAll: {
return {
...state,
};
}
case ActionType.ReadAllSuccess: {
return metaInputTypeEntityAdapter.setAll(action.payload, state);
}
case ActionType.ReadAllFailure: {
return metaInputTypeEntityAdapter.setError(action.payload, state);
}
default: {
return state;
}
}
}

View File

@ -1,17 +0,0 @@
import { RPCClientError } from '@loafer/ng-rpc';
import { Selector, createSelector } from '@ngrx/store';
import { createEntityAdapter, EntityState } from '@loafer/ng-entity';
import { MetaInputType } from '@overflow/commons-typescript/model/meta';
export const metaInputTypeEntityAdapter = createEntityAdapter<MetaInputType, RPCClientError>();
export interface State extends EntityState<MetaInputType, RPCClientError> {
}
export const initialState: State = metaInputTypeEntityAdapter.getInitialState({
});
export function getSelectors(selector: Selector<any, State>) {
return {
...metaInputTypeEntityAdapter.getSelectors(selector),
};
}

View File

@ -1,4 +0,0 @@
export * from './meta-member-status.action';
export * from './meta-member-status.effect';
export * from './meta-member-status.reducer';
export * from './meta-member-status.state';

View File

@ -1,33 +0,0 @@
import { Action } from '@ngrx/store';
import { RPCClientError } from '@loafer/ng-rpc';
import { NoAuthProbe } from '@overflow/commons-typescript/model/noauth';
import { MetaMemberStatus } from '@overflow/commons-typescript/model/meta';
export enum ActionType {
ReadAll = '[meta.meta-member-status] ReadAll',
ReadAllSuccess = '[meta.meta-member-status] ReadAllSuccess',
ReadAllFailure = '[meta.meta-member-status] ReadAllFailure',
}
export class ReadAll implements Action {
readonly type = ActionType.ReadAll;
}
export class ReadAllSuccess implements Action {
readonly type = ActionType.ReadAllSuccess;
constructor(public payload: MetaMemberStatus[]) {}
}
export class ReadAllFailure implements Action {
readonly type = ActionType.ReadAllFailure;
constructor(public payload: RPCClientError) {}
}
export type Actions =
| ReadAll
| ReadAllSuccess
| ReadAllFailure
;

View File

@ -1,39 +0,0 @@
import { Injectable } from '@angular/core';
import { Effect, Actions, ofType } from '@ngrx/effects';
import { of } from 'rxjs';
import { catchError, exhaustMap, map, tap } from 'rxjs/operators';
import { MetaMemberStatus } from '@overflow/commons-typescript/model/meta';
import { MetaMemberStatusService } from '../../../service/meta-member-status.service';
import {
ReadAll,
ReadAllSuccess,
ReadAllFailure,
ActionType,
} from './meta-member-status.action';
@Injectable()
export class Effects {
constructor(
private actions$: Actions,
private metaMemberStatusService: MetaMemberStatusService,
) { }
@Effect()
readAll$ = this.actions$.pipe(
ofType(ActionType.ReadAll),
exhaustMap(() =>
this.metaMemberStatusService
.readAll()
.pipe(
map((result: MetaMemberStatus[]) => {
return new ReadAllSuccess(result);
}),
catchError(error => of(new ReadAllFailure(error)))
)
)
);
}

View File

@ -1,26 +0,0 @@
import { ActionType, Actions } from './meta-member-status.action';
import {
State,
initialState,
metaMemberStatusEntityAdapter,
} from './meta-member-status.state';
export function reducer(state: State = initialState, action: Actions): State {
switch (action.type) {
case ActionType.ReadAll: {
return {
...state,
};
}
case ActionType.ReadAllSuccess: {
return metaMemberStatusEntityAdapter.setAll(action.payload, state);
}
case ActionType.ReadAllFailure: {
return metaMemberStatusEntityAdapter.setError(action.payload, state);
}
default: {
return state;
}
}
}

View File

@ -1,17 +0,0 @@
import { RPCClientError } from '@loafer/ng-rpc';
import { Selector, createSelector } from '@ngrx/store';
import { createEntityAdapter, EntityState } from '@loafer/ng-entity';
import { MetaMemberStatus } from '@overflow/commons-typescript/model/meta';
export const metaMemberStatusEntityAdapter = createEntityAdapter<MetaMemberStatus, RPCClientError>();
export interface State extends EntityState<MetaMemberStatus, RPCClientError> {
}
export const initialState: State = metaMemberStatusEntityAdapter.getInitialState({
});
export function getSelectors(selector: Selector<any, State>) {
return {
...metaMemberStatusEntityAdapter.getSelectors(selector),
};
}

View File

@ -1,4 +0,0 @@
export * from './meta-noauth-probe-status.action';
export * from './meta-noauth-probe-status.effect';
export * from './meta-noauth-probe-status.reducer';
export * from './meta-noauth-probe-status.state';

View File

@ -1,33 +0,0 @@
import { Action } from '@ngrx/store';
import { RPCClientError } from '@loafer/ng-rpc';
import { NoAuthProbe } from '@overflow/commons-typescript/model/noauth';
import { MetaNoAuthProbeStatus } from '@overflow/commons-typescript/model/meta';
export enum ActionType {
ReadAll = '[meta.meta-noauth-probe-status] ReadAll',
ReadAllSuccess = '[meta.meta-noauth-probe-status] ReadAllSuccess',
ReadAllFailure = '[meta.meta-noauth-probe-status] ReadAllFailure',
}
export class ReadAll implements Action {
readonly type = ActionType.ReadAll;
}
export class ReadAllSuccess implements Action {
readonly type = ActionType.ReadAllSuccess;
constructor(public payload: MetaNoAuthProbeStatus[]) {}
}
export class ReadAllFailure implements Action {
readonly type = ActionType.ReadAllFailure;
constructor(public payload: RPCClientError) {}
}
export type Actions =
| ReadAll
| ReadAllSuccess
| ReadAllFailure
;

View File

@ -1,39 +0,0 @@
import { Injectable } from '@angular/core';
import { Effect, Actions, ofType } from '@ngrx/effects';
import { of } from 'rxjs';
import { catchError, exhaustMap, map, tap } from 'rxjs/operators';
import { MetaNoAuthProbeStatus } from '@overflow/commons-typescript/model/meta';
import { MetaNoAuthProbeStatusService } from '../../../service/meta-noauth-probe-status.service';
import {
ReadAll,
ReadAllSuccess,
ReadAllFailure,
ActionType,
} from './meta-noauth-probe-status.action';
@Injectable()
export class Effects {
constructor(
private actions$: Actions,
private metaNoAuthProbeStatusService: MetaNoAuthProbeStatusService,
) { }
@Effect()
readAll$ = this.actions$.pipe(
ofType(ActionType.ReadAll),
exhaustMap(() =>
this.metaNoAuthProbeStatusService
.readAll()
.pipe(
map((result: MetaNoAuthProbeStatus[]) => {
return new ReadAllSuccess(result);
}),
catchError(error => of(new ReadAllFailure(error)))
)
)
);
}

View File

@ -1,26 +0,0 @@
import { ActionType, Actions } from './meta-noauth-probe-status.action';
import {
State,
initialState,
metaNoAuthProbeStatusEntityAdapter,
} from './meta-noauth-probe-status.state';
export function reducer(state: State = initialState, action: Actions): State {
switch (action.type) {
case ActionType.ReadAll: {
return {
...state,
};
}
case ActionType.ReadAllSuccess: {
return metaNoAuthProbeStatusEntityAdapter.setAll(action.payload, state);
}
case ActionType.ReadAllFailure: {
return metaNoAuthProbeStatusEntityAdapter.setError(action.payload, state);
}
default: {
return state;
}
}
}

View File

@ -1,17 +0,0 @@
import { RPCClientError } from '@loafer/ng-rpc';
import { Selector, createSelector } from '@ngrx/store';
import { createEntityAdapter, EntityState } from '@loafer/ng-entity';
import { MetaNoAuthProbeStatus } from '@overflow/commons-typescript/model/meta';
export const metaNoAuthProbeStatusEntityAdapter = createEntityAdapter<MetaNoAuthProbeStatus, RPCClientError>();
export interface State extends EntityState<MetaNoAuthProbeStatus, RPCClientError> {
}
export const initialState: State = metaNoAuthProbeStatusEntityAdapter.getInitialState({
});
export function getSelectors(selector: Selector<any, State>) {
return {
...metaNoAuthProbeStatusEntityAdapter.getSelectors(selector),
};
}

View File

@ -1,4 +0,0 @@
export * from './meta-probe-architecture.action';
export * from './meta-probe-architecture.effect';
export * from './meta-probe-architecture.reducer';
export * from './meta-probe-architecture.state';

View File

@ -1,33 +0,0 @@
import { Action } from '@ngrx/store';
import { RPCClientError } from '@loafer/ng-rpc';
import { NoAuthProbe } from '@overflow/commons-typescript/model/noauth';
import { MetaProbeArchitecture } from '@overflow/commons-typescript/model/meta';
export enum ActionType {
ReadAll = '[meta.meta-probe-architecture] ReadAll',
ReadAllSuccess = '[meta.meta-probe-architecture] ReadAllSuccess',
ReadAllFailure = '[meta.meta-probe-architecture] ReadAllFailure',
}
export class ReadAll implements Action {
readonly type = ActionType.ReadAll;
}
export class ReadAllSuccess implements Action {
readonly type = ActionType.ReadAllSuccess;
constructor(public payload: MetaProbeArchitecture[]) {}
}
export class ReadAllFailure implements Action {
readonly type = ActionType.ReadAllFailure;
constructor(public payload: RPCClientError) {}
}
export type Actions =
| ReadAll
| ReadAllSuccess
| ReadAllFailure
;

View File

@ -1,39 +0,0 @@
import { Injectable } from '@angular/core';
import { Effect, Actions, ofType } from '@ngrx/effects';
import { of } from 'rxjs';
import { catchError, exhaustMap, map, tap } from 'rxjs/operators';
import { MetaProbeArchitecture } from '@overflow/commons-typescript/model/meta';
import { MetaProbeArchitectureService } from '../../../service/meta-probe-architecture.service';
import {
ReadAll,
ReadAllSuccess,
ReadAllFailure,
ActionType,
} from './meta-probe-architecture.action';
@Injectable()
export class Effects {
constructor(
private actions$: Actions,
private metaProbeArchitectureService: MetaProbeArchitectureService,
) { }
@Effect()
readAll$ = this.actions$.pipe(
ofType(ActionType.ReadAll),
exhaustMap(() =>
this.metaProbeArchitectureService
.readAll()
.pipe(
map((result: MetaProbeArchitecture[]) => {
return new ReadAllSuccess(result);
}),
catchError(error => of(new ReadAllFailure(error)))
)
)
);
}

View File

@ -1,26 +0,0 @@
import { ActionType, Actions } from './meta-probe-architecture.action';
import {
State,
initialState,
metaProbeArchitectureEntityAdapter,
} from './meta-probe-architecture.state';
export function reducer(state: State = initialState, action: Actions): State {
switch (action.type) {
case ActionType.ReadAll: {
return {
...state,
};
}
case ActionType.ReadAllSuccess: {
return metaProbeArchitectureEntityAdapter.setAll(action.payload, state);
}
case ActionType.ReadAllFailure: {
return metaProbeArchitectureEntityAdapter.setError(action.payload, state);
}
default: {
return state;
}
}
}

View File

@ -1,17 +0,0 @@
import { RPCClientError } from '@loafer/ng-rpc';
import { Selector, createSelector } from '@ngrx/store';
import { createEntityAdapter, EntityState } from '@loafer/ng-entity';
import { MetaProbeArchitecture } from '@overflow/commons-typescript/model/meta';
export const metaProbeArchitectureEntityAdapter = createEntityAdapter<MetaProbeArchitecture, RPCClientError>();
export interface State extends EntityState<MetaProbeArchitecture, RPCClientError> {
}
export const initialState: State = metaProbeArchitectureEntityAdapter.getInitialState({
});
export function getSelectors(selector: Selector<any, State>) {
return {
...metaProbeArchitectureEntityAdapter.getSelectors(selector),
};
}

View File

@ -1,4 +0,0 @@
export * from './meta-probe-os.action';
export * from './meta-probe-os.effect';
export * from './meta-probe-os.reducer';
export * from './meta-probe-os.state';

View File

@ -1,33 +0,0 @@
import { Action } from '@ngrx/store';
import { RPCClientError } from '@loafer/ng-rpc';
import { NoAuthProbe } from '@overflow/commons-typescript/model/noauth';
import { MetaProbeOs } from '@overflow/commons-typescript/model/meta';
export enum ActionType {
ReadAll = '[meta.meta-probe-os] ReadAll',
ReadAllSuccess = '[meta.meta-probe-os] ReadAllSuccess',
ReadAllFailure = '[meta.meta-probe-os] ReadAllFailure',
}
export class ReadAll implements Action {
readonly type = ActionType.ReadAll;
}
export class ReadAllSuccess implements Action {
readonly type = ActionType.ReadAllSuccess;
constructor(public payload: MetaProbeOs[]) {}
}
export class ReadAllFailure implements Action {
readonly type = ActionType.ReadAllFailure;
constructor(public payload: RPCClientError) {}
}
export type Actions =
| ReadAll
| ReadAllSuccess
| ReadAllFailure
;

View File

@ -1,39 +0,0 @@
import { Injectable } from '@angular/core';
import { Effect, Actions, ofType } from '@ngrx/effects';
import { of } from 'rxjs';
import { catchError, exhaustMap, map, tap } from 'rxjs/operators';
import { MetaProbeOs } from '@overflow/commons-typescript/model/meta';
import { MetaProbeOsService } from '../../../service/meta-probe-os.service';
import {
ReadAll,
ReadAllSuccess,
ReadAllFailure,
ActionType,
} from './meta-probe-os.action';
@Injectable()
export class Effects {
constructor(
private actions$: Actions,
private metaProbeOsService: MetaProbeOsService,
) { }
@Effect()
readAll$ = this.actions$.pipe(
ofType(ActionType.ReadAll),
exhaustMap(() =>
this.metaProbeOsService
.readAll()
.pipe(
map((result: MetaProbeOs[]) => {
return new ReadAllSuccess(result);
}),
catchError(error => of(new ReadAllFailure(error)))
)
)
);
}

View File

@ -1,26 +0,0 @@
import { ActionType, Actions } from './meta-probe-os.action';
import {
State,
initialState,
metaProbeOsEntityAdapter,
} from './meta-probe-os.state';
export function reducer(state: State = initialState, action: Actions): State {
switch (action.type) {
case ActionType.ReadAll: {
return {
...state,
};
}
case ActionType.ReadAllSuccess: {
return metaProbeOsEntityAdapter.setAll(action.payload, state);
}
case ActionType.ReadAllFailure: {
return metaProbeOsEntityAdapter.setError(action.payload, state);
}
default: {
return state;
}
}
}

View File

@ -1,17 +0,0 @@
import { RPCClientError } from '@loafer/ng-rpc';
import { Selector, createSelector } from '@ngrx/store';
import { createEntityAdapter, EntityState } from '@loafer/ng-entity';
import { MetaProbeOs } from '@overflow/commons-typescript/model/meta';
export const metaProbeOsEntityAdapter = createEntityAdapter<MetaProbeOs, RPCClientError>();
export interface State extends EntityState<MetaProbeOs, RPCClientError> {
}
export const initialState: State = metaProbeOsEntityAdapter.getInitialState({
});
export function getSelectors(selector: Selector<any, State>) {
return {
...metaProbeOsEntityAdapter.getSelectors(selector),
};
}

View File

@ -1,4 +0,0 @@
export * from './meta-probe-package.action';
export * from './meta-probe-package.effect';
export * from './meta-probe-package.reducer';
export * from './meta-probe-package.state';

View File

@ -1,34 +0,0 @@
import { Action } from '@ngrx/store';
import { RPCClientError } from '@loafer/ng-rpc';
import { NoAuthProbe } from '@overflow/commons-typescript/model/noauth';
import { MetaProbePackage, MetaProbeOs } from '@overflow/commons-typescript/model/meta';
export enum ActionType {
ReadAllByOs = '[meta.meta-probe-package] ReadAllByOs',
ReadAllByOsSuccess = '[meta.meta-probe-package] ReadAllByOsSuccess',
ReadAllByOsFailure = '[meta.meta-probe-package] ReadAllByOsFailure',
}
export class ReadAllByOs implements Action {
readonly type = ActionType.ReadAllByOs;
constructor(public payload: MetaProbeOs) {}
}
export class ReadAllByOsSuccess implements Action {
readonly type = ActionType.ReadAllByOsSuccess;
constructor(public payload: MetaProbePackage[]) {}
}
export class ReadAllByOsFailure implements Action {
readonly type = ActionType.ReadAllByOsFailure;
constructor(public payload: RPCClientError) {}
}
export type Actions =
| ReadAllByOs
| ReadAllByOsSuccess
| ReadAllByOsFailure
;

View File

@ -1,40 +0,0 @@
import { Injectable } from '@angular/core';
import { Effect, Actions, ofType } from '@ngrx/effects';
import { of } from 'rxjs';
import { catchError, exhaustMap, map, tap } from 'rxjs/operators';
import { MetaProbePackage, MetaProbeOs } from '@overflow/commons-typescript/model/meta';
import { MetaProbePackageService } from '../../../service/meta-probe-package.service';
import {
ReadAllByOs,
ReadAllByOsSuccess,
ReadAllByOsFailure,
ActionType,
} from './meta-probe-package.action';
@Injectable()
export class Effects {
constructor(
private actions$: Actions,
private metaProbePackageService: MetaProbePackageService,
) { }
@Effect()
readAllByOs$ = this.actions$.pipe(
ofType(ActionType.ReadAllByOs),
map((action: ReadAllByOs) => action.payload),
exhaustMap((metaProbeOs: MetaProbeOs) =>
this.metaProbePackageService
.readAllByOs(metaProbeOs)
.pipe(
map((result: MetaProbePackage[]) => {
return new ReadAllByOsSuccess(result);
}),
catchError(error => of(new ReadAllByOsFailure(error)))
)
)
);
}

View File

@ -1,15 +0,0 @@
import { ActionType, Actions } from './meta-probe-package.action';
import {
State,
initialState,
metaProbePackageEntityAdapter,
} from './meta-probe-package.state';
export function reducer(state: State = initialState, action: Actions): State {
switch (action.type) {
default: {
return state;
}
}
}

View File

@ -1,17 +0,0 @@
import { RPCClientError } from '@loafer/ng-rpc';
import { Selector, createSelector } from '@ngrx/store';
import { createEntityAdapter, EntityState } from '@loafer/ng-entity';
import { MetaProbePackage } from '@overflow/commons-typescript/model/meta';
export const metaProbePackageEntityAdapter = createEntityAdapter<MetaProbePackage, RPCClientError>();
export interface State extends EntityState<MetaProbePackage, RPCClientError> {
}
export const initialState: State = metaProbePackageEntityAdapter.getInitialState({
});
export function getSelectors(selector: Selector<any, State>) {
return {
...metaProbePackageEntityAdapter.getSelectors(selector),
};
}

View File

@ -1,4 +0,0 @@
export * from './meta-probe-status.action';
export * from './meta-probe-status.effect';
export * from './meta-probe-status.reducer';
export * from './meta-probe-status.state';

View File

@ -1,33 +0,0 @@
import { Action } from '@ngrx/store';
import { RPCClientError } from '@loafer/ng-rpc';
import { NoAuthProbe } from '@overflow/commons-typescript/model/noauth';
import { MetaProbeStatus } from '@overflow/commons-typescript/model/meta';
export enum ActionType {
ReadAll = '[meta.meta-probe-status] ReadAll',
ReadAllSuccess = '[meta.meta-probe-status] ReadAllSuccess',
ReadAllFailure = '[meta.meta-probe-status] ReadAllFailure',
}
export class ReadAll implements Action {
readonly type = ActionType.ReadAll;
}
export class ReadAllSuccess implements Action {
readonly type = ActionType.ReadAllSuccess;
constructor(public payload: MetaProbeStatus[]) {}
}
export class ReadAllFailure implements Action {
readonly type = ActionType.ReadAllFailure;
constructor(public payload: RPCClientError) {}
}
export type Actions =
| ReadAll
| ReadAllSuccess
| ReadAllFailure
;

View File

@ -1,39 +0,0 @@
import { Injectable } from '@angular/core';
import { Effect, Actions, ofType } from '@ngrx/effects';
import { of } from 'rxjs';
import { catchError, exhaustMap, map, tap } from 'rxjs/operators';
import { MetaProbeStatus } from '@overflow/commons-typescript/model/meta';
import { MetaProbeStatusService } from '../../../service/meta-probe-status.service';
import {
ReadAll,
ReadAllSuccess,
ReadAllFailure,
ActionType,
} from './meta-probe-status.action';
@Injectable()
export class Effects {
constructor(
private actions$: Actions,
private metaProbeStatusService: MetaProbeStatusService,
) { }
@Effect()
readAll$ = this.actions$.pipe(
ofType(ActionType.ReadAll),
exhaustMap(() =>
this.metaProbeStatusService
.readAll()
.pipe(
map((result: MetaProbeStatus[]) => {
return new ReadAllSuccess(result);
}),
catchError(error => of(new ReadAllFailure(error)))
)
)
);
}

View File

@ -1,26 +0,0 @@
import { ActionType, Actions } from './meta-probe-status.action';
import {
State,
initialState,
metaProbeStatusEntityAdapter,
} from './meta-probe-status.state';
export function reducer(state: State = initialState, action: Actions): State {
switch (action.type) {
case ActionType.ReadAll: {
return {
...state,
};
}
case ActionType.ReadAllSuccess: {
return metaProbeStatusEntityAdapter.setAll(action.payload, state);
}
case ActionType.ReadAllFailure: {
return metaProbeStatusEntityAdapter.setError(action.payload, state);
}
default: {
return state;
}
}
}

View File

@ -1,17 +0,0 @@
import { RPCClientError } from '@loafer/ng-rpc';
import { Selector, createSelector } from '@ngrx/store';
import { createEntityAdapter, EntityState } from '@loafer/ng-entity';
import { MetaProbeStatus } from '@overflow/commons-typescript/model/meta';
export const metaProbeStatusEntityAdapter = createEntityAdapter<MetaProbeStatus, RPCClientError>();
export interface State extends EntityState<MetaProbeStatus, RPCClientError> {
}
export const initialState: State = metaProbeStatusEntityAdapter.getInitialState({
});
export function getSelectors(selector: Selector<any, State>) {
return {
...metaProbeStatusEntityAdapter.getSelectors(selector),
};
}

View File

@ -1,4 +0,0 @@
export * from './meta-probe-task-type.action';
export * from './meta-probe-task-type.effect';
export * from './meta-probe-task-type.reducer';
export * from './meta-probe-task-type.state';

View File

@ -1,33 +0,0 @@
import { Action } from '@ngrx/store';
import { RPCClientError } from '@loafer/ng-rpc';
import { NoAuthProbe } from '@overflow/commons-typescript/model/noauth';
import { MetaProbeTaskType } from '@overflow/commons-typescript/model/meta';
export enum ActionType {
ReadAll = '[meta.meta-probe-task-type] ReadAll',
ReadAllSuccess = '[meta.meta-probe-task-type] ReadAllSuccess',
ReadAllFailure = '[meta.meta-probe-task-type] ReadAllFailure',
}
export class ReadAll implements Action {
readonly type = ActionType.ReadAll;
}
export class ReadAllSuccess implements Action {
readonly type = ActionType.ReadAllSuccess;
constructor(public payload: MetaProbeTaskType[]) {}
}
export class ReadAllFailure implements Action {
readonly type = ActionType.ReadAllFailure;
constructor(public payload: RPCClientError) {}
}
export type Actions =
| ReadAll
| ReadAllSuccess
| ReadAllFailure
;

View File

@ -1,39 +0,0 @@
import { Injectable } from '@angular/core';
import { Effect, Actions, ofType } from '@ngrx/effects';
import { of } from 'rxjs';
import { catchError, exhaustMap, map, tap } from 'rxjs/operators';
import { MetaProbeTaskType } from '@overflow/commons-typescript/model/meta';
import { MetaProbeTaskTypeService } from '../../../service/meta-probe-task-type.service';
import {
ReadAll,
ReadAllSuccess,
ReadAllFailure,
ActionType,
} from './meta-probe-task-type.action';
@Injectable()
export class Effects {
constructor(
private actions$: Actions,
private metaProbeTaskTypeService: MetaProbeTaskTypeService,
) { }
@Effect()
readAll$ = this.actions$.pipe(
ofType(ActionType.ReadAll),
exhaustMap(() =>
this.metaProbeTaskTypeService
.readAll()
.pipe(
map((result: MetaProbeTaskType[]) => {
return new ReadAllSuccess(result);
}),
catchError(error => of(new ReadAllFailure(error)))
)
)
);
}

View File

@ -1,26 +0,0 @@
import { ActionType, Actions } from './meta-probe-task-type.action';
import {
State,
initialState,
metaProbeTaskTypeEntityAdapter,
} from './meta-probe-task-type.state';
export function reducer(state: State = initialState, action: Actions): State {
switch (action.type) {
case ActionType.ReadAll: {
return {
...state,
};
}
case ActionType.ReadAllSuccess: {
return metaProbeTaskTypeEntityAdapter.setAll(action.payload, state);
}
case ActionType.ReadAllFailure: {
return metaProbeTaskTypeEntityAdapter.setError(action.payload, state);
}
default: {
return state;
}
}
}

View File

@ -1,17 +0,0 @@
import { RPCClientError } from '@loafer/ng-rpc';
import { Selector, createSelector } from '@ngrx/store';
import { createEntityAdapter, EntityState } from '@loafer/ng-entity';
import { MetaProbeTaskType } from '@overflow/commons-typescript/model/meta';
export const metaProbeTaskTypeEntityAdapter = createEntityAdapter<MetaProbeTaskType, RPCClientError>();
export interface State extends EntityState<MetaProbeTaskType, RPCClientError> {
}
export const initialState: State = metaProbeTaskTypeEntityAdapter.getInitialState({
});
export function getSelectors(selector: Selector<any, State>) {
return {
...metaProbeTaskTypeEntityAdapter.getSelectors(selector),
};
}

View File

@ -1,4 +0,0 @@
export * from './meta-probe-version.action';
export * from './meta-probe-version.effect';
export * from './meta-probe-version.reducer';
export * from './meta-probe-version.state';

Some files were not shown because too many files have changed in this diff Show More