title = _.upperFirst(title); title = title.replace(/I18N/, 'I18n');
`public class _Instance${lodash.upperFirst(composite.compositeName)}`, '{' ]); writer.writeLineIndented([ '}', `public class ${lodash.upperFirst(composite.compositeName)}Class`, '{' ]); writer.writeLineIndented([ '[JsonProperty("$instance")]', `public _Instance${lodash.upperFirst(composite.compositeName)} _instance;` ]); writer.decreaseIndentation(); writer.writeLineIndented([ '}', `public ${lodash.upperFirst(composite.compositeName)}Class[] ${composite.compositeName};` ]); });
toFastcallName(typeName) { return _.upperFirst(_.camelCase(typeName)) .replace('Uint', 'UInt') .replace('Longlong', 'LongLong'); }
get(name) { name = _.upperFirst(_.camelCase(name)); if(this.models[name]) return this.models[name]; try { this.models[name] = require(`models/${_.snakeCase(name)}`); } catch(e) { throw e; } return this.models[name]; }
Object.keys(primitiveFields) .map( fieldKey => `type ${globalId}Connection${_.upperFirst( fieldKey, )} {${Schema.formatGQL(connectionFields[fieldKey])}}`, ) .join('\n\n')
_(datatypes).groupBy('category').each((group, key) => { group = _.groupBy(group, (el) => el.sub_category || 'generic'); desc += `### ${key} Types`; _.each(group, (types, sKey) => { if (sKey === 'generic') { desc += toMdList(types, 1); } else { desc += `\n#### ${_.upperFirst(sKey)} Types`; desc += toMdList(types, 2); } }); });
load(file) { if(!this.logger) { this.logger = this.akyuu.logger.get("model-loader"); } const directory = path.join(`${this.akyuu.projectRoot}/models`, file); let filenames; try { filenames = fs.readdirSync(directory); } catch(e) { return; } for(let i = 0; i < filenames.length; i++) { const stat = fs.statSync(`${directory}/${filenames[i]}`); if(stat.isDirectory()) { this.load(`${file}/${filenames[i]}`); } else if(_.endsWith(filenames[i], ".js")) { const modelName = _.upperFirst(_.camelCase(filenames[i].substr(0, filenames[i].length - 3))); this.models[modelName] = require(`${directory}/${filenames[i]}`); this.logger.info(`Model \`${modelName}\` loaded.`); } } }
this.getFieldsByTypes( fields, this.isNotOfTypeArray, (fieldType, fieldName) => `[${globalId}Connection${_.upperFirst(fieldName)}]`, )
async function execBeforePlugins () { const hookName = `before${_.upperFirst(this._op)}` const plugins = _.filter(this._plugins, plugin => plugin.hooks[hookName]) if (!plugins.length) { return } for (const plugin of plugins) { debug(`model: ${this._model._name}, plugin: ${plugin.name}, beforeHook: ${hookName}, args: ${JSON.stringify(this._args)}`) try { await plugin.hooks[hookName].apply(this, plugin.args) } catch (e) { e.model = this._model._name e.op = this._op e.args = this._args e.pluginName = plugin.name e.pluginOp = hookName e.pluginArgs = plugin.args throw e } debug(`model: ${this._model._name}, plugin: ${plugin.name}, afterHook: ${hookName}, args: ${JSON.stringify(this._args)}`) } }
// Install dependencies for each plugins _.forEach(plugins, plugin => { const pluginPath = path.join(pluginsDirPath, plugin); console.log(`πΈ Plugin - ${_.upperFirst(plugin)}`); console.log('π¦ Installing packages...'); try { const install = exec(`cd ${pluginPath} && npm install --prod --ignore-scripts`, { silent: true }); if (install.stderr && install.code !== 0) { console.error(install.stderr); process.exit(1); } console.log('β Success'); console.log(''); } catch (err) { console.log(err); } });
_.merge(acc.resolver[globalId], { [association.alias]: async obj => { const withRelated = await resolvers.fetch( { id: obj[model.primaryKey], model: name, }, plugin, [association.alias], false, ); const entry = withRelated && withRelated.toJSON ? withRelated.toJSON() : withRelated; // Set the _type only when the value is defined if (entry[association.alias]) { entry[association.alias]._type = _.upperFirst( association.model, ); } return entry[association.alias]; }, })
message: "{{name}} has too many parameters ({{count}}). Maximum allowed is {{max}}.", data: { name: lodash.upperFirst(astUtils.getFunctionNameWithKind(node)), count: node.params.length, max: numParams
}) .forEach(function (plugin) { shell.echo(`πΈ Plugin - ${_.upperFirst(plugin)}`); shell.echo('π¦ Installing packages...'); shell.cd(path.resolve(plugins, plugin));
const getByRefDocFnName = getByRefDocPrefix + _.upperFirst(_.camelCase(indexName)); const getByRefDocOrFailFnName = getByRefDocPrefix + _.upperFirst(_.camelCase(indexName)) + 'OrFail';
async function execAfterPlugins (result) { const hookName = `after${_.upperFirst(this._op)}` const plugins = _.filter(this._plugins, plugin => plugin.hooks[hookName]) if (!plugins.length) { return result } for (const plugin of plugins) { debug(`model: ${this._model._name}, plugin: ${plugin.name}, beforeHook: ${hookName}, args: ${JSON.stringify(this._args)}`) try { result = await plugin.hooks[hookName].apply(this, [result].concat(plugin.args)) } catch (e) { e.model = this._model._name e.op = this._op e.args = this._args e.pluginName = plugin.name e.pluginOp = hookName e.pluginArgs = plugin.args e.result = result throw e } debug(`model: ${this._model._name}, plugin: ${plugin.name}, afterHook: ${hookName}, args: ${JSON.stringify(this._args)}`) } return result }