grpc-code-gen
Advanced tools
Comparing version 6.1.7 to 6.1.8
@@ -134,12 +134,19 @@ "use strict"; | ||
`function getGrpcClientFactory() { return getGrpcClient<${typeName}>(${service.name}) };`, | ||
`export const ${service.name[0].toLowerCase()}${service.name.slice(1)} = <${typeName}>(new Object());`, | ||
`export const ${service.name[0].toLowerCase()}${service.name.slice(1)}:any = <${typeName}>(new Object());`, | ||
`export const ${service.name[0].toLowerCase()}${service.name.slice(1)}V2:any = <${typeName}>(new Object());`, | ||
`Object.entries(base${service.name[0]}${service.name.slice(1)}.constructor.prototype) | ||
.filter(([methodName]) => /^[A-Za-z0-9]+$/g.test(methodName)).forEach(item => { | ||
(${service.name[0].toLowerCase()}${service.name.slice(1)} as any)[item[0]] = async function (...option: []) { | ||
${service.name[0].toLowerCase()}${service.name.slice(1)}[item[0]] = async function (...option: []) { | ||
try { return await (base${service.name[0]}${service.name.slice(1)} as any)[item[0]](...option) } catch (err) { | ||
restrtGrpcRules(base${service.name[0]}${service.name.slice(1)}, err); | ||
console.info(err); | ||
throw err; | ||
} | ||
} | ||
${service.name[0].toLowerCase()}${service.name.slice(1)}V2[item[0]] = async function (...option: []) { | ||
try { return await (base${service.name[0]}${service.name.slice(1)} as any)[item[0]](...option) } catch (err) { | ||
restrtGrpcRules(base${service.name[0]}${service.name.slice(1)}, err); | ||
const message = (err.details || err.message || err.error || '').toLowerCase(); | ||
return { error: err, error_details: message, response:{} } | ||
} | ||
} | ||
});`, | ||
@@ -146,0 +153,0 @@ `Service.prototype.restartServer = base${service.name[0]}${service.name.slice(1)}.restartServer = function () { base${service.name[0]}${service.name.slice(1)} = getGrpcClientFactory()};`, |
{ | ||
"name": "grpc-code-gen", | ||
"version": "6.1.7", | ||
"version": "6.1.8", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "repository": "https://github.com/yunkeCN/grpc-code-gen.git", |
@@ -186,12 +186,19 @@ import * as fs from "fs-extra"; | ||
`function getGrpcClientFactory() { return getGrpcClient<${typeName}>(${service.name}) };`, | ||
`export const ${service.name[0].toLowerCase()}${service.name.slice(1)} = <${typeName}>(new Object());`, | ||
`export const ${service.name[0].toLowerCase()}${service.name.slice(1)}:any = <${typeName}>(new Object());`, | ||
`export const ${service.name[0].toLowerCase()}${service.name.slice(1)}V2:any = <${typeName}>(new Object());`, | ||
`Object.entries(base${service.name[0]}${service.name.slice(1)}.constructor.prototype) | ||
.filter(([methodName]) => /^[A-Za-z0-9]+$/g.test(methodName)).forEach(item => { | ||
(${service.name[0].toLowerCase()}${service.name.slice(1)} as any)[item[0]] = async function (...option: []) { | ||
${service.name[0].toLowerCase()}${service.name.slice(1)}[item[0]] = async function (...option: []) { | ||
try { return await (base${service.name[0]}${service.name.slice(1)} as any)[item[0]](...option) } catch (err) { | ||
restrtGrpcRules(base${service.name[0]}${service.name.slice(1)}, err); | ||
console.info(err); | ||
throw err; | ||
} | ||
} | ||
${service.name[0].toLowerCase()}${service.name.slice(1)}V2[item[0]] = async function (...option: []) { | ||
try { return await (base${service.name[0]}${service.name.slice(1)} as any)[item[0]](...option) } catch (err) { | ||
restrtGrpcRules(base${service.name[0]}${service.name.slice(1)}, err); | ||
const message = (err.details || err.message || err.error || '').toLowerCase(); | ||
return { error: err, error_details: message, response:{} } | ||
} | ||
} | ||
});`, | ||
@@ -198,0 +205,0 @@ `Service.prototype.restartServer = base${service.name[0]}${service.name.slice(1)}.restartServer = function () { base${service.name[0]}${service.name.slice(1)} = getGrpcClientFactory()};`, |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
101514
2655