@arcblock/forge-proto
Advanced tools
Comparing version 0.6.4 to 0.6.5
25
index.js
@@ -8,2 +8,4 @@ const fs = require('fs'); | ||
const txTypePattern = /Tx$/; | ||
const stateTypePattern = /State$/; | ||
const stakeTypePattern = /^StakeFor/i; | ||
const lowerUnder = x => decamelize(x).toLowerCase(); | ||
@@ -71,4 +73,5 @@ | ||
const transactions = Object.keys(types).filter(x => txTypePattern.test(x)); | ||
const stakes = Object.keys(types).filter(x => stakeTypePattern.test(x)); | ||
return { types, vendorTypes, services, clients, transactions }; | ||
return { types, vendorTypes, services, clients, transactions, stakes }; | ||
} | ||
@@ -86,10 +89,10 @@ | ||
if (!/^Request/.test(type) && !/^Response/.test(type)) { | ||
if (/Tx$/.test(type)) { | ||
typeUrl = `fg:t:${lowerUnder(type.replace(/Tx$/, ''))}`; | ||
if (txTypePattern.test(type)) { | ||
typeUrl = `fg:t:${lowerUnder(type.replace(txTypePattern, ''))}`; | ||
} | ||
if (/State$/.test(type)) { | ||
typeUrl = `fg:s:${lowerUnder(type.replace(/State$/, ''))}`; | ||
if (stateTypePattern.test(type)) { | ||
typeUrl = `fg:s:${lowerUnder(type.replace(stateTypePattern, ''))}`; | ||
} | ||
if (/^StakeFor/.test(type)) { | ||
typeUrl = `fg:x:${lowerUnder(`Stake${type.replace(/^StakeFor/, '')}`)}`; | ||
if (stakeTypePattern.test(type)) { | ||
typeUrl = `fg:x:${lowerUnder(`Stake${type.replace(stakeTypePattern, '')}`)}`; | ||
} | ||
@@ -155,3 +158,5 @@ if (['TransactionInfo', 'TxStatus'].includes(type)) { | ||
const extraTypeUrls = {}; | ||
const { types, vendorTypes, clients, transactions } = processJs(path.resolve(__dirname, './lib/')); | ||
const { types, vendorTypes, clients, transactions, stakes } = processJs( | ||
path.resolve(__dirname, './lib/') | ||
); | ||
const { messages, enums, rpcs, spec, typeUrls } = processJson( | ||
@@ -162,2 +167,5 @@ path.resolve(__dirname, './lib/spec.json'), | ||
enums.SupportedTxs = transactions; | ||
enums.SupportedStakes = stakes; | ||
// Append app specific proto definition into search space | ||
@@ -214,3 +222,2 @@ function addSource({ baseDir, packageName, typeUrls: _typeUrls }) { | ||
messages, | ||
transactions, | ||
rpcs: Object.keys(clients).reduce((acc, x) => { | ||
@@ -217,0 +224,0 @@ acc[x] = clients[x]; |
{ | ||
"name": "@arcblock/forge-proto", | ||
"description": "Static modules generated from forge-sdk protobuf files", | ||
"version": "0.6.4", | ||
"version": "0.6.5", | ||
"author": "wangshijun <shijun@arcblock.io> (https://www.arcblock.io)", | ||
@@ -51,3 +51,3 @@ "bugs": { | ||
}, | ||
"gitHead": "86f7b59809aa0e0d0833b955de8566dee94fe5eb" | ||
"gitHead": "dd5cbe2d55dcafc16fcd81c0af9eab046acf1fcb" | ||
} |
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
1133315
32459