Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
config = await traverseConfig(path, newFile, config)
}
lazyTypes.clear();
Container.get(BootstrapService).Fields = {
mutation: {},
query: {},
subscription: {}
};
if (config.$mode === 'basic') {
await MakeBasicSchema(config);
}
if (config.$mode === 'advanced') {
await MakeAdvancedSchema(config);
}
Container.get(ApolloService).init();
// await SchemaIntrospection()
} catch (e) {
console.error(e);
}
isRunning = false;
if (config.$views) {
config.$views = await transpileComponentsForViews(config.$views)
}
if(config.$components) {
config.$components = (await transpileComponentsInit(config.$components as string[])).map(c => c && c.link ? c.link : c) as any;
}
Container.reset(Config)
Container.remove(Config)
Container.set(Config, config);
let metaKey: string;
if (config._meta) {
metaKey = findMetaKey(getMetaPath(path), config._meta);
}
if (configWatchers.filter(p => path.includes(p)).length) {
config = await deep(newFile);
} else if (config._meta && metaKey) {
// First level deepnest
config[metaKey] = await deep(newFile);
} else {
// Traverse recursive and find metadata for specific file and update it
config = await traverseConfig(path, newFile, config)
}
lazyTypes.clear();
Container.get(BootstrapService).Fields = {
mutation: {},
query: {},
subscription: {}
};
if (config.$mode === 'basic') {
await MakeBasicSchema(config);
}
if (config.$mode === 'advanced') {
await MakeAdvancedSchema(config);
}
Container.get(ApolloService).init();
// await SchemaIntrospection()
} catch (e) {
console.error(e);
}
isRunning = false;
// await SchemaIntrospection()
} catch (e) {
console.error(e);
}
isRunning = false;
if (config.$views) {
config.$views = await transpileComponentsForViews(config.$views)
}
if(config.$components) {
config.$components = (await transpileComponentsInit(config.$components as string[])).map(c => c && c.link ? c.link : c) as any;
}
Container.reset(Config)
Container.remove(Config)
Container.set(Config, config);
if (config.$views) {
Container.get(PubSubService).publish('listenForChanges', config.$views);
}
Container.reset('main-config-compiled')
Container.remove('main-config-compiled')
Container.set('main-config-compiled', config)
console.log(`📦 Bundle realoaded! ${Date.now() - timer}ms`, path);
}
Container.get(ApolloService).init();
// await SchemaIntrospection()
} catch (e) {
console.error(e);
}
isRunning = false;
if (config.$views) {
config.$views = await transpileComponentsForViews(config.$views)
}
if(config.$components) {
config.$components = (await transpileComponentsInit(config.$components as string[])).map(c => c && c.link ? c.link : c) as any;
}
Container.reset(Config)
Container.remove(Config)
Container.set(Config, config);
if (config.$views) {
Container.get(PubSubService).publish('listenForChanges', config.$views);
}
Container.reset('main-config-compiled')
Container.remove('main-config-compiled')
Container.set('main-config-compiled', config)
console.log(`📦 Bundle realoaded! ${Date.now() - timer}ms`, path);
}
}
Container.get(ApolloService).init();
// await SchemaIntrospection()
} catch (e) {
console.error(e);
}
isRunning = false;
if (config.$views) {
config.$views = await transpileComponentsForViews(config.$views)
}
if(config.$components) {
config.$components = (await transpileComponentsInit(config.$components as string[])).map(c => c && c.link ? c.link : c) as any;
}
Container.reset(Config)
Container.remove(Config)
Container.set(Config, config);
if (config.$views) {
Container.get(PubSubService).publish('listenForChanges', config.$views);
}
Container.reset('main-config-compiled')
Container.remove('main-config-compiled')
Container.set('main-config-compiled', config)
console.log(`📦 Bundle realoaded! ${Date.now() - timer}ms`, path);
}
// traverseMap.push(...(config.$components as string[]).map(c => ({path: c.replace('💉', ''), parent: null})))
// }
if (config.$views) {
process.argv.push('--hot-reload', '--client')
}
if (includes('--hot-reload')) {
config.$externals.forEach(e =>
traverseMap.push({ parent: null, path: e.file })
);
watchBundles(traverseMap.map(f => f.path), config);
}
config.$components = config.$components || [];
if (config.$components.length) {
config.$components = (await predictConfig(config.$components as string[]) || []).map(c => c.link)
}
Container.set('main-config-compiled', config)
console.log(
'You can extract this schema by running --generate command'
);
return true;
}
}
const imports = [];
if (file && file.$imports) {
const transpiledModules = await TranspileAndGetAll(
file.$imports.map(file => ({ file: file.replace('💉', '') } as Externals)),
'imports'
);
imports.push(
...transpiledModules.map(f => getFirstItem(require(f.transpiledFile)))
);
}
if (file && file.$components) {
await transpileComponentsInit(file.$components as string[]);
}
BootstrapFramework(AppModule, [
...imports,
CoreModule.forRoot({
graphql: {
openBrowser: nextOrDefault('--random', true, v =>
v === 'true' ? false : true
),
buildAstDefinitions: false, // Removed ast definition since directives are lost,
graphiQlPath: '/graphiql',
graphiqlOptions: {
endpointURL: '/graphiql'
}
},
pubsub: {
authentication: 'pubsub-auth'
},
server: {
randomPort: nextOrDefault('--random', false),
hapi: {
"$resolvers": {
"findUser": {
"name": "Kristiyan Tachev",
"email": "test@gmail.com",
"phone": 414141,
"arrayOfNumbers": [515151, 412414],
"arrayOfStrings": ["515151", "412414"]
}
}
}
`, { encoding: 'utf-8' });
}
}
else {
core_1.BootstrapFramework(app_module_1.AppModule, [
core_2.CoreModule.forRoot({
graphql: {
openBrowser: args_extractors_1.nextOrDefault('--random', true, v => v === 'true' ? false : true),
buildAstDefinitions: false // Removed ast definition since directives are lost
},
server: {
randomPort: args_extractors_1.nextOrDefault('--random', false),
hapi: {
port: args_extractors_1.nextOrDefault('--port', 9000, p => Number(p))
}
}
})
]).subscribe(() => console.log('Started'), console.log.bind(console));
}
}
})
async listenForChanges(views: ConfigViews) {
return this.getViewsConfig(views);
}
getViewsConfig(views?: ConfigViews) {
const config = Container.get('main-config-compiled');
return {
components: config.$components,
views: viewsToArray(views || config.$views),
schema: printSchema(Container.get(BootstrapService).schema)
};
}
@Type(ClientType)
@Mutation()
async clientReady(root, payload, context) {
// const config = Container.get('main-config-compiled');
// if (config.$views) {
// config.$views = modifyViewsConfig(
// config.$views,
// await mapComponentsPath(config.$views)
// );
// this.pubsub.publish('listenForChanges', config.$views);
// }
return this.getViewsConfig();
}
}
console.error(e);
}
isRunning = false;
if (config.$views) {
config.$views = await transpileComponentsForViews(config.$views)
}
if(config.$components) {
config.$components = (await transpileComponentsInit(config.$components as string[])).map(c => c && c.link ? c.link : c) as any;
}
Container.reset(Config)
Container.remove(Config)
Container.set(Config, config);
if (config.$views) {
Container.get(PubSubService).publish('listenForChanges', config.$views);
}
Container.reset('main-config-compiled')
Container.remove('main-config-compiled')
Container.set('main-config-compiled', config)
console.log(`📦 Bundle realoaded! ${Date.now() - timer}ms`, path);
}