Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
log.info('Writing package metadata');
const relativeDestPath: string = path.relative(entryPoint.destinationPath, pkg.primary.destinationPath);
await writePackage(entryPoint, {
main: ensureUnixPath(path.join(relativeDestPath, 'bundles', entryPoint.flatModuleFile + '.umd.js')),
module: ensureUnixPath(path.join(relativeDestPath, 'esm5', entryPoint.flatModuleFile + '.js')),
es2015: ensureUnixPath(path.join(relativeDestPath, 'esm2015', entryPoint.flatModuleFile + '.js')),
typings: ensureUnixPath(`${entryPoint.flatModuleFile}.d.ts`),
// XX 'metadata' property in 'package.json' is non-standard. Keep it anyway?
metadata: ensureUnixPath(`${entryPoint.flatModuleFile}.metadata.json`)
});
log.success(`Built ${entryPoint.moduleId}`);
};
}
export const ENTRY_POINT_TRANSFORMS_TOKEN = new InjectionToken('ng.v5.entryPointTransforms');
export const ENTRY_POINT_TRANSFORMS_PROVIDER: FactoryProvider = {
provide: ENTRY_POINT_TRANSFORMS_TOKEN,
useFactory: transformSourcesFactory,
deps: [INIT_TS_CONFIG_TOKEN]
};
import { Inject, Injectable, InjectionToken, Optional } from 'injection-js'
import { CounterService } from './counter.service'
import { getClassName } from './helpers'
import { Logger } from './logger.service'
const defaultConfig = {
multiplyBy: 2,
}
export type MultiplyCounterConfig = typeof defaultConfig
export const MultiplyCounterConfig = new InjectionToken(
'MultiplyCounterConfig'
)
@Injectable()
export class MultiplyCounterService extends CounterService {
constructor(
@Optional()
@Inject(MultiplyCounterConfig)
private config: MultiplyCounterConfig,
public logger: Logger
) {
super(logger)
this.config = config || defaultConfig
}
onIncrement() {
this.setState((prevState) => {
import {TokenExtractorListener} from './event-listeners/token-extractor-listener';
import {AuthenticationTokenListener} from './event-listeners/authentication-token-listener';
import {InMemoryRefreshTokenManager} from './services/in-memory.refresh-token.manager';
import { BootstrapListener } from './event-listeners/bootstrap-listener';
import {SecurityController} from './controllers/security-controller';
import {AsyncEventDispatcher} from '@rxstack/async-event-dispatcher';
import {TokenAuthenticationProvider} from './authentication/token.authentication-provider';
import {ConnectionListener} from './event-listeners/connection-listener';
import {AbstractRefreshTokenManager, KeyLoader, TokenManager} from './services';
import {PlainTextPasswordEncoder} from './password-encoders';
export const AUTH_PROVIDER_REGISTRY = new InjectionToken('AUTH_PROVIDER_REGISTRY');
export const USER_PROVIDER_REGISTRY = new InjectionToken('USER_PROVIDER_REGISTRY');
export const PASSWORD_ENCODER_REGISTRY = new InjectionToken('PASSWORD_ENCODER_REGISTRY');
export const TOKEN_EXTRACTOR_REGISTRY = new InjectionToken('TOKEN_EXTRACTOR_REGISTRY');
export const TOKEN_MANAGER = new InjectionToken('TOKEN_MANAGER');
export const REFRESH_TOKEN_MANAGER = new InjectionToken('REFRESH_TOKEN_MANAGER');
@Module()
export class SecurityModule {
static configure(configuration: SecurityConfiguration): ModuleWithProviders {
return {
module: SecurityModule,
providers: [
{
provide: SecurityConfiguration,
useFactory: () => new SecurityConfiguration(configuration),
deps: []
},
...this.addCommonProviders(),
...this.addEncoderRelatedProviders(),
...this.addLocalAuthenticationProviders(),
export enum CompressorStrategy {
FILTERED = 1,
HUFFMAN_ONLY = 2,
RLE = 3,
FIXED = 4,
DEFAULT_STRATEGY = 0
}
export interface CompressorOpts {
level?: CompressorLevel;
methods?: Method[];
strategy?: CompressorStrategy;
threshold?: number;
}
export const COMPRESSOR_OPTS = new InjectionToken('COMPRESSOR_OPTS');
export const COMPRESSOR_DEFAULT_OPTS: CompressorOpts = {
level: CompressorLevel.DEFAULT_COMPRESSION,
methods: ALL_METHODS,
strategy: CompressorStrategy.DEFAULT_STRATEGY,
threshold: 1024
};
/**
* Request logger
*/
@Injectable() export class Compressor extends Middleware {
private opts: CompressorOpts;
import {UserPasswordAuthenticationProvider} from './authentication/user-password.authentication-provider';
import {TokenExtractorManager} from './token-extractors/token-extractor-manager';
import {QueryParameterTokenExtractor} from './token-extractors/query-parameter-token-extractor';
import {HeaderTokenExtractor} from './token-extractors/header-token-extractor';
import {TokenExtractorListener} from './event-listeners/token-extractor-listener';
import {AuthenticationTokenListener} from './event-listeners/authentication-token-listener';
import {InMemoryRefreshTokenManager} from './services/in-memory.refresh-token.manager';
import { BootstrapListener } from './event-listeners/bootstrap-listener';
import {SecurityController} from './controllers/security-controller';
import {AsyncEventDispatcher} from '@rxstack/async-event-dispatcher';
import {TokenAuthenticationProvider} from './authentication/token.authentication-provider';
import {ConnectionListener} from './event-listeners/connection-listener';
import {AbstractRefreshTokenManager, KeyLoader, TokenManager} from './services';
import {PlainTextPasswordEncoder} from './password-encoders';
export const AUTH_PROVIDER_REGISTRY = new InjectionToken('AUTH_PROVIDER_REGISTRY');
export const USER_PROVIDER_REGISTRY = new InjectionToken('USER_PROVIDER_REGISTRY');
export const PASSWORD_ENCODER_REGISTRY = new InjectionToken('PASSWORD_ENCODER_REGISTRY');
export const TOKEN_EXTRACTOR_REGISTRY = new InjectionToken('TOKEN_EXTRACTOR_REGISTRY');
export const TOKEN_MANAGER = new InjectionToken('TOKEN_MANAGER');
export const REFRESH_TOKEN_MANAGER = new InjectionToken('REFRESH_TOKEN_MANAGER');
@Module()
export class SecurityModule {
static configure(configuration: SecurityConfiguration): ModuleWithProviders {
return {
module: SecurityModule,
providers: [
{
provide: SecurityConfiguration,
useFactory: () => new SecurityConfiguration(configuration),
deps: []
import { InjectionToken, ValueProvider } from 'injection-js';
export const PROJECT_TOKEN = new InjectionToken(`ng.v5.project`);
export const provideProject = (project: string): ValueProvider => ({
provide: PROJECT_TOKEN,
useValue: project,
});
import { InjectionToken } from 'injection-js';
import { Transform } from '../../brocc/transform';
import { TransformProvider, provideTransform } from '../../brocc/transform.di';
import { writeBundlesTransform } from './write-bundles.transform';
export const WRITE_BUNDLES_TRANSFORM_TOKEN = new InjectionToken(`ng.v5.writeBundlesTransform`);
export const WRITE_BUNDLES_TRANSFORM: TransformProvider = provideTransform({
provide: WRITE_BUNDLES_TRANSFORM_TOKEN,
useFactory: () => writeBundlesTransform,
});
import { InjectionToken } from 'injection-js';
import { Transform } from '../../../brocc/transform';
import { TransformProvider, provideTransform } from '../../../brocc/transform.di';
import { templateTransform } from './template.transform';
export const TEMPLATE_TRANSFORM_TOKEN = new InjectionToken(`ng.v5.templateTransform`);
export const TEMPLATE_TRANSFORM: TransformProvider = provideTransform({
provide: TEMPLATE_TRANSFORM_TOKEN,
useFactory: () => templateTransform
});
export const provideTsConfig = (values?: ParsedConfiguration | string): Provider => {
return {
provide: DEFAULT_TS_CONFIG_TOKEN,
useFactory: () => {
return createDefaultTsConfig(values);
},
deps: [],
};
};
export const DEFAULT_TS_CONFIG_TOKEN = new InjectionToken('ng.v5.defaultTsConfig');
export const DEFAULT_TS_CONFIG_PROVIDER: Provider = provideTsConfig();
export const INIT_TS_CONFIG_TOKEN = new InjectionToken('ng.v5.initTsConfigTransform');
export const INIT_TS_CONFIG_TRANSFORM: TransformProvider = provideTransform({
provide: INIT_TS_CONFIG_TOKEN,
useFactory: initTsConfigTransformFactory,
deps: [DEFAULT_TS_CONFIG_TOKEN],
});
import { InjectionToken } from 'injection-js';
import { Transform } from '../../../brocc/transform';
import { TransformProvider, provideTransform } from '../../../brocc/transform.di';
import { transformSourcesTransform } from './transform-sources.transform';
export const TRANSFORM_SOURCES_TOKEN = new InjectionToken(`ng.v5.transformSourcesTransform`);
export const TRANSFORM_SOURCES_TRANSFORM: TransformProvider = provideTransform({
provide: TRANSFORM_SOURCES_TOKEN,
useFactory: () => transformSourcesTransform
});