@@ -173,34 +173,29 @@ export function isFabricConfigJSON(
173173 log : Logger ,
174174) : obj is FabricConfigJSON {
175175 if ( typeof obj !== "object" || obj === null ) {
176- log . error ( "isFabricConfigJSON: obj is not an object or is null" ) ;
177176 return false ;
178177 }
179178 const objRecord = obj as Record < string , unknown > ;
180179
181180 if ( ! ( "channelName" in obj ) || typeof objRecord . channelName !== "string" ) {
182- log . error ( "isFabricConfigJSON: channelName missing or not a string" ) ;
183181 return false ;
184182 }
185183 if (
186184 ! ( "userIdentity" in obj ) ||
187185 ! isUserIdentity ( objRecord . userIdentity , log )
188186 ) {
189- log . error ( "isFabricConfigJSON: userIdentity missing or invalid" ) ;
190187 return false ;
191188 }
192189 if (
193190 ! ( "connectorOptions" in obj ) ||
194191 ! isFabricOptionsJSON ( objRecord . connectorOptions , log )
195192 ) {
196- log . error ( "isFabricConfigJSON: connectorOptions missing or invalid" ) ;
197193 return false ;
198194 }
199195 if (
200196 ! ( "networkIdentification" in obj ) ||
201197 ! isNetworkId ( objRecord . networkIdentification )
202198 ) {
203- log . error ( "isFabricConfigJSON: networkIdentification missing or invalid" ) ;
204199 return false ;
205200 }
206201 if (
@@ -210,75 +205,58 @@ export function isFabricConfigJSON(
210205 ( org ) => typeof org === "object" && org !== null ,
211206 ) )
212207 ) {
213- log . error ( "isFabricConfigJSON: targetOrganizations invalid" ) ;
214208 return false ;
215209 }
216210 if ( ! ( "caFilePath" in obj ) || typeof objRecord . caFilePath !== "string" ) {
217- log . error ( "isFabricConfigJSON: caFilePath missing or not a string" ) ;
218211 return false ;
219212 }
220213 if (
221214 ! ( "coreYamlFilePath" in obj ) ||
222215 typeof objRecord . coreYamlFilePath !== "string"
223216 ) {
224- log . error ( "isFabricConfigJSON: coreYamlFilePath missing or not a string" ) ;
225217 return false ;
226218 }
227219 if ( "ccSequence" in obj && typeof objRecord . ccSequence !== "number" ) {
228- log . error ( "isFabricConfigJSON: ccSequence present but not a number" ) ;
229220 return false ;
230221 }
231222 if ( "orderer" in obj && typeof objRecord . orderer !== "string" ) {
232- log . error ( "isFabricConfigJSON: orderer present but not a string" ) ;
233223 return false ;
234224 }
235225 if (
236226 "ordererTLSHostnameOverride" in obj &&
237227 typeof objRecord . ordererTLSHostnameOverride !== "string"
238228 ) {
239- log . error (
240- "isFabricConfigJSON: ordererTLSHostnameOverride present but not a string" ,
241- ) ;
242229 return false ;
243230 }
244231 if ( "connTimeout" in obj && typeof objRecord . connTimeout !== "number" ) {
245- log . error ( "isFabricConfigJSON: connTimeout present but not a number" ) ;
246232 return false ;
247233 }
248234 if (
249235 "signaturePolicy" in obj &&
250236 typeof objRecord . signaturePolicy !== "string"
251237 ) {
252- log . error ( "isFabricConfigJSON: signaturePolicy present but not a string" ) ;
253238 return false ;
254239 }
255240 if ( "mspId" in obj && typeof objRecord . mspId !== "string" ) {
256- log . error ( "isFabricConfigJSON: mspId present but not a string" ) ;
257241 return false ;
258242 }
259243 if (
260244 "wrapperContractName" in obj &&
261245 typeof objRecord . wrapperContractName !== "string"
262246 ) {
263- log . error (
264- "isFabricConfigJSON: wrapperContractName present but not a string" ,
265- ) ;
266247 return false ;
267248 }
268249 if ( "leafId" in obj && typeof objRecord . leafId !== "string" ) {
269- log . error ( "isFabricConfigJSON: leafId present but not a string" ) ;
270250 return false ;
271251 }
272252 if ( "keyPair" in obj && ! isKeyPairJSON ( obj . keyPair ) ) {
273- log . error ( "isFabricConfigJSON: keyPair present but invalid" ) ;
274253 return false ;
275254 }
276255 if (
277256 "claimFormats" in obj &&
278257 ( ! Array . isArray ( objRecord . claimFormats ) ||
279258 ! objRecord . claimFormats . every ( ( format ) => isClaimFormat ( format ) ) )
280259 ) {
281- log . error ( "isFabricConfigJSON: claimFormats present but invalid" ) ;
282260 return false ;
283261 }
284262 return true ;
0 commit comments