Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function (state, event, next) {
/** @type {?} */
var matches = actionMatcher(event);
/** @type {?} */
var isInitAction = matches(InitState) || matches(UpdateState);
// const layouts = snq(() => this.options.requirements.layouts.filter(layout => layout instanceof Type), []);
if (isInitAction && !this.initialized) {
var _a = transformRoutes(this.router.config), routes = _a.routes, wrappers = _a.wrappers;
routes = organizeRoutes(routes, wrappers);
state = setValue(state, 'ConfigState', tslib_1.__assign({}, (state.ConfigState && tslib_1.__assign({}, state.ConfigState)), this.options, { routes: routes }));
this.initialized = true;
}
return next(state, event);
};
ConfigPlugin.decorators = [
handle(state, event, next) {
/** @type {?} */
const matches = actionMatcher(event);
/** @type {?} */
const isInitAction = matches(InitState) || matches(UpdateState);
// const layouts = snq(() => this.options.requirements.layouts.filter(layout => layout instanceof Type), []);
if (isInitAction && !this.initialized) {
let { routes, wrappers } = transformRoutes(this.router.config);
routes = organizeRoutes(routes, wrappers);
state = setValue(state, 'ConfigState', Object.assign({}, (state.ConfigState && Object.assign({}, state.ConfigState)), this.options, { routes }));
this.initialized = true;
}
return next(state, event);
}
}
handle(state, event, next) {
/** @type {?} */
const matches = actionMatcher(event);
/** @type {?} */
const isInitAction = matches(InitState) || matches(UpdateState);
// const layouts = snq(() => this.options.requirements.layouts.filter(layout => layout instanceof Type), []);
if (isInitAction && !this.initialized) {
let { routes, wrappers } = transformRoutes(this.router.config);
routes = organizeRoutes(routes, wrappers);
state = setValue(state, 'ConfigState', Object.assign({}, (state.ConfigState && Object.assign({}, state.ConfigState)), this.options, { routes }));
this.initialized = true;
}
return next(state, event);
}
}
function (state, event, next) {
/** @type {?} */
var matches = actionMatcher(event);
/** @type {?} */
var isInitAction = matches(InitState) || matches(UpdateState);
// const layouts = snq(() => this.options.requirements.layouts.filter(layout => layout instanceof Type), []);
if (isInitAction && !this.initialized) {
var _a = transformRoutes(this.router.config), routes = _a.routes, wrappers = _a.wrappers;
routes = organizeRoutes(routes, wrappers);
state = setValue(state, 'ConfigState', __assign({}, (state.ConfigState && __assign({}, state.ConfigState)), this.options, { routes: routes }));
this.initialized = true;
}
return next(state, event);
};
ConfigPlugin.decorators = [
handle(state: any, event: any, next: NgxsNextPluginFn) {
const matches = actionMatcher(event);
const isInitAction = matches(InitState) || matches(UpdateState);
if (isInitAction && !this.initialized) {
const transformedRoutes = transformRoutes(this.router.config);
let { routes } = transformedRoutes;
const { wrappers } = transformedRoutes;
routes = organizeRoutes(routes, wrappers);
const flattedRoutes = flatRoutes(clone(routes));
state = setValue(state, 'ConfigState', {
...(state.ConfigState && { ...state.ConfigState }),
...this.options,
routes,
flattedRoutes,
});
public handle(states: PlainObject, action: ActionType, next: NgxsNextPluginFn): NgxsNextPluginFn {
if (this.size === 0 || isPlatformServer(this._platformId)) {
return next(states, action);
}
const matches: (action: ActionType) => boolean = actionMatcher(action);
const isInitAction: boolean = matches(InitState) || matches(UpdateState);
const canBeSyncStoreWithStorage: boolean =
this.size > 0 && (isInitAction || action.type === NEED_SYNC_TYPE_ACTION);
if (canBeSyncStoreWithStorage) {
for (const [provider] of this.entries) {
const engine: DataStorageEngine = this.exposeEngine(provider);
const key: string = this.ensureKey(provider);
const value: string | undefined = engine.getItem(key);
if (isNotNil(value)) {
try {
const data: string | undefined | null = this.deserialize(value);
if (isNotNil(data) || provider.nullable) {
NgxsDataStorageEngine.keys.set(key);
states = setValue(states, provider.path, data);
} else {
function (state, event, next) {
/** @type {?} */
var matches = actionMatcher(event);
/** @type {?} */
var isInitAction = matches(InitState) || matches(UpdateState);
if (isInitAction && !this.initialized) {
/** @type {?} */
var transformedRoutes = transformRoutes(this.router.config);
var routes = transformedRoutes.routes;
var wrappers = transformedRoutes.wrappers;
routes = organizeRoutes(routes, wrappers);
/** @type {?} */
var flattedRoutes = flatRoutes(clone(routes));
state = setValue(state, 'ConfigState', tslib_1.__assign({}, (state.ConfigState && tslib_1.__assign({}, state.ConfigState)), this.options, { routes: routes,
flattedRoutes: flattedRoutes }));
this.initialized = true;
}
return next(state, event);
};
handle(state, event, next) {
/** @type {?} */
const matches = actionMatcher(event);
/** @type {?} */
const isInitAction = matches(InitState) || matches(UpdateState);
if (isInitAction && !this.initialized) {
/** @type {?} */
const transformedRoutes = transformRoutes(this.router.config);
let { routes } = transformedRoutes;
const { wrappers } = transformedRoutes;
routes = organizeRoutes(routes, wrappers);
/** @type {?} */
const flattedRoutes = flatRoutes(clone(routes));
state = setValue(state, 'ConfigState', Object.assign({}, (state.ConfigState && Object.assign({}, state.ConfigState)), this.options, { routes,
flattedRoutes }));
this.initialized = true;
}
return next(state, event);
}