Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import { Service, Token, Inject } from 'typedi';
import { IVscodeService, VscodeServiceToken } from './../vscodeService';
import { isNotNull, sourceLocationToRange } from '../../common/utils';
import generate from '@babel/generator';
import { isEqual } from 'lodash';
interface ModelEffectsCode {
range: Range;
code: string;
}
export interface IModelEffectsParser {
parseFile(path: string): Promise;
}
export const ModelEffectsParserToken = new Token();
const reduxSagaEffectsCommands = ['put', 'call', 'select', 'cancel', 'take', 'all'];
@Service(ModelEffectsParserToken)
// eslint-disable-next-line @typescript-eslint/class-name-casing
class _ModelEffectParser implements IModelEffectsParser {
public readonly vscodeService: IVscodeService;
constructor(
@Inject(VscodeServiceToken)
vscodeService: IVscodeService
) {
this.vscodeService = vscodeService;
}
public async parseFile(filePath: string) {
avatar_url: string;
expire_date: string;
}
export interface IPowerpackService {
userInfo: PowerpackUserInfo | null;
accessToken?: string;
bought: boolean;
expired: boolean;
startup(): Promise;
logout(): Promise;
refresh(): Promise;
}
export const IPowerpackService = new Token();
export interface HostService extends HasAsyncInit {
resolveHost(hostname: string): Promise;
createHostRecord(
name: string,
description: string,
content?,
): Promise;
deleteHostRecord(name: string): Promise;
setUseHost(name: string): Promise;
getHostRecord(name: string): HostRecord | undefined;
saveHostRecord(name: string, content: object): Promise;
getHostRecordList(): Promise;
}
export const HostServiceToken = new Token('service.host');
export const HostStorageToken = new Token('storage.host');
import { auth0ServerValidationNoAngularFactory, azNoAngular } from './helpers'
import * as express from 'express'
import * as bodyParser from 'body-parser'
import { map } from 'rxjs/operators'
import { AuthOptions } from 'auth0-js'
const swaggerJSDoc = require('swagger-jsdoc')
const swaggerUi = require('swagger-ui-express')
useContainer(Container)
export type Auth0Config = AuthOptions
export type SendGridAPIKey = string
export type Auth0Cert = string
export const AUTH0_MANAGEMENT_CLIENT_CONFIG = new Token()
export const SENDGRID_API_KEY = new Token()
export const AUTH0_CERT = new Token()
Container.set(
AUTH0_CERT,
process.env.AUTH0_CERT && process.env.AUTH0_CERT.replace(/\\n/g, '\n')
)
Container.set(SENDGRID_API_KEY, process.env.SENDGRID_API_KEY)
Container.set(AUTH0_MANAGEMENT_CLIENT_CONFIG, {
domain: process.env.AUTH0_DOMAIN || '',
clientID: process.env.AUTH0_CLIENT_ID || ''
} as AuthOptions)
export const useApi = (app: express.Application) => {
const swaggerSpec = swaggerJSDoc({
swaggerDefinition: {
info: {
export interface HostService extends HasAsyncInit {
resolveHost(hostname: string): Promise;
createHostRecord(
name: string,
description: string,
content?,
): Promise;
deleteHostRecord(name: string): Promise;
setUseHost(name: string): Promise;
getHostRecord(name: string): HostRecord | undefined;
saveHostRecord(name: string, content: object): Promise;
getHostRecordList(): Promise;
}
export const HostServiceToken = new Token('service.host');
export const HostStorageToken = new Token('storage.host');
namespace: string;
action: string;
}
interface FileInfoCache {
[filePath: string]: Action[];
}
interface ReferenceCache {
[model: string]: {
[action: string]: {
[filePath: string]: Location[];
};
};
}
export const ModelReferenceServiceToken = new Token();
@Service(ModelReferenceServiceToken)
export default class ModelReferenceService implements IModelReferenceService {
private modelReferenceParser: IModelReferenceParser;
private modelReferenceMap: Map;
private projectFileModelsMap: Map;
private modelInfoService: IModelInfoService;
private logger: ILogger;
private vscodeService: IVscodeService;
constructor(
@Inject(LoggerService)
logger: ILogger,
@Inject(VscodeServiceToken)
vscodeService: IVscodeService,
@Inject(ModelInfoServiceToken)
import { SharedObjectFactory } from '../graphql/shared-object.factory'
import { Container, Service, Token } from 'typedi'
import { AutoRelayConfigArgs, AutoRelayConfigArgsExistingModel, AutoRelayConfigArgsNoModel, AutoRelayOrmConnect } from '../interfaces/auto-relay-config.interface'
import { ClassValueThunk } from '..'
import * as Relay from 'graphql-relay'
export const PREFIX = new Token('PREFIX')
export const CONNECTION_BASE_OBJECT = new Token>('CONNECTION_BASE_OBJECT')
export const PAGINATION_OBJECT = new Token>('PAGINATION_OBJECT')
export const CONNECTIONARGS_OBJECT = new Token>('CONNECTIONARGS_OBJECT')
export const ORM_CONNECTION = new Token('ORM_CONNECTION')
@Service()
export class AutoRelayConfig {
protected static _sharedObjectFactory: SharedObjectFactory = Container.get(SharedObjectFactory)
protected static _config: AutoRelayConfigArgs = { } as any
constructor(
config: AutoRelayConfigArgs
) {
if (!config) throw new Error(`No config supplied to AutoRelay`)
Container.remove(PAGINATION_OBJECT, CONNECTIONARGS_OBJECT)
this._registerOrm(config)
} from '../../client/app/app.module'
import { auth0ServerValidationNoAngularFactory, azNoAngular } from './helpers'
import * as express from 'express'
import * as bodyParser from 'body-parser'
import { map } from 'rxjs/operators'
import { AuthOptions } from 'auth0-js'
const swaggerJSDoc = require('swagger-jsdoc')
const swaggerUi = require('swagger-ui-express')
useContainer(Container)
export type Auth0Config = AuthOptions
export type SendGridAPIKey = string
export type Auth0Cert = string
export const AUTH0_MANAGEMENT_CLIENT_CONFIG = new Token()
export const SENDGRID_API_KEY = new Token()
export const AUTH0_CERT = new Token()
Container.set(
AUTH0_CERT,
process.env.AUTH0_CERT && process.env.AUTH0_CERT.replace(/\\n/g, '\n')
)
Container.set(SENDGRID_API_KEY, process.env.SENDGRID_API_KEY)
Container.set(AUTH0_MANAGEMENT_CLIENT_CONFIG, {
domain: process.env.AUTH0_DOMAIN || '',
clientID: process.env.AUTH0_CLIENT_ID || ''
} as AuthOptions)
export const useApi = (app: express.Application) => {
const swaggerSpec = swaggerJSDoc({
swaggerDefinition: {
workspaceFolders: null,
workspaceConfigurations: null,
};
}
const workspaceConfigurations = workspaceFolders.map(f =>
vscode.workspace.getConfiguration(CONFIG_NAMESPACE, f.uri)
);
return { workspaceFolders, workspaceConfigurations };
}
export async function loadVscodeService(service: IVscodeService) {
const { workspaceFolders, workspaceConfigurations } = await getVscodeServiceArgs();
service.load(workspaceFolders, workspaceConfigurations);
}
export const VscodeServiceToken = new Token();
@Service(VscodeServiceToken)
export class VscodeService implements IVscodeService {
private workspaceFolders: vscode.WorkspaceFolder[];
private workspaceConfigurations: vscode.WorkspaceConfiguration[];
constructor() {
this.workspaceFolders = [];
this.workspaceConfigurations = [];
}
load(
workspaceFolders: vscode.WorkspaceFolder[] | null,
workspaceConfigurations: vscode.WorkspaceConfiguration[] | null
) {
if (!workspaceConfigurations || !workspaceFolders) {
import * as express from 'express'
import * as bodyParser from 'body-parser'
import { map } from 'rxjs/operators'
import { AuthOptions } from 'auth0-js'
const swaggerJSDoc = require('swagger-jsdoc')
const swaggerUi = require('swagger-ui-express')
useContainer(Container)
export type Auth0Config = AuthOptions
export type SendGridAPIKey = string
export type Auth0Cert = string
export const AUTH0_MANAGEMENT_CLIENT_CONFIG = new Token()
export const SENDGRID_API_KEY = new Token()
export const AUTH0_CERT = new Token()
Container.set(
AUTH0_CERT,
process.env.AUTH0_CERT && process.env.AUTH0_CERT.replace(/\\n/g, '\n')
)
Container.set(SENDGRID_API_KEY, process.env.SENDGRID_API_KEY)
Container.set(AUTH0_MANAGEMENT_CLIENT_CONFIG, {
domain: process.env.AUTH0_DOMAIN || '',
clientID: process.env.AUTH0_CLIENT_ID || ''
} as AuthOptions)
export const useApi = (app: express.Application) => {
const swaggerSpec = swaggerJSDoc({
swaggerDefinition: {
info: {
title: 'fusing-angular',