@@ -121,8 +121,8 @@ function buildNamespace(ref, ns) {
121
121
push ( "" ) ;
122
122
pushComment ( [
123
123
ns . comment || "Namespace " + ns . name + "." ,
124
- "@namespace" ,
125
- ns . parent instanceof protobuf . Root ? "@name " + escapeName ( ns . name ) : "@memberof " + exportName ( ns . parent ) ,
124
+ "@exports " + exportName ( ns ) ,
125
+ "@namespace"
126
126
] ) ;
127
127
push ( ( config . es6 ? "const" : "var" ) + " " + escapeName ( ns . name ) + " = {};" ) ;
128
128
}
@@ -348,13 +348,11 @@ function toJsType(field) {
348
348
}
349
349
350
350
function buildType ( ref , type ) {
351
- var fullName = type . fullName . substring ( 1 ) ;
352
351
353
352
if ( config . comments ) {
354
353
var typeDef = [
355
354
"Properties of " + aOrAn ( type . name ) + "." ,
356
- "@interface I" + escapeName ( type . name ) ,
357
- type . parent instanceof protobuf . Root ? "@name I" + escapeName ( type . name ) : "@memberof " + exportName ( type . parent )
355
+ "@interface " + exportName ( type , true )
358
356
] ;
359
357
type . fieldsArray . forEach ( function ( field ) {
360
358
var prop = util . safeProp ( field . name ) ;
@@ -369,11 +367,10 @@ function buildType(ref, type) {
369
367
push ( "" ) ;
370
368
pushComment ( [
371
369
"Constructs a new " + type . name + "." ,
372
- type . comment ? "@classdesc " + type . comment : null ,
370
+ "@exports " + exportName ( type ) ,
371
+ "@classdesc " + ( type . comment || "Represents " + aOrAn ( type . name ) ) ,
373
372
"@constructor" ,
374
- // "@extends $protobuf.Message<" + exportName(type) + ">",
375
- "@param {" + exportName ( type , true ) + "=} [" + ( config . beautify ? "properties" : "p" ) + "] Properties to set" ,
376
- type . parent instanceof protobuf . Root ? "@name " + escapeName ( type . name ) : "@memberof " + exportName ( type . parent )
373
+ "@param {" + exportName ( type , true ) + "=} [" + ( config . beautify ? "properties" : "p" ) + "] Properties to set"
377
374
] ) ;
378
375
buildFunction ( type , type . name , Type . generateConstructor ( type ) ) ;
379
376
@@ -425,7 +422,7 @@ function buildType(ref, type) {
425
422
push ( "" ) ;
426
423
pushComment ( [
427
424
oneof . comment || type . name + " " + oneof . name + "." ,
428
- "@name " + fullName + "#" + escapeName ( oneof . name ) ,
425
+ "@name " + exportName ( type ) + "#" + escapeName ( oneof . name ) ,
429
426
"@type {string|undefined}"
430
427
] ) ;
431
428
push ( "Object.defineProperty(" + escapeName ( type . name ) + ".prototype, " + JSON . stringify ( oneof . name ) + ", {" ) ;
@@ -453,7 +450,7 @@ function buildType(ref, type) {
453
450
if ( config . encode ) {
454
451
push ( "" ) ;
455
452
pushComment ( [
456
- "Encodes the specified " + type . name + " message. Does not implicitly {@link " + fullName + ".verify|verify} messages." ,
453
+ "Encodes the specified " + type . name + " message. Does not implicitly {@link " + exportName ( type ) + ".verify|verify} messages." ,
457
454
"@param {" + exportName ( type , ! config . forceMessage ) + "} " + ( config . beautify ? "message" : "m" ) + " " + type . name + " message or plain object to encode" ,
458
455
"@param {$protobuf.Writer} [" + ( config . beautify ? "writer" : "w" ) + "] Writer to encode to" ,
459
456
"@returns {$protobuf.Writer} Writer"
@@ -463,7 +460,7 @@ function buildType(ref, type) {
463
460
if ( config . delimited ) {
464
461
push ( "" ) ;
465
462
pushComment ( [
466
- "Encodes the specified " + type . name + " message, length delimited. Does not implicitly {@link " + fullName + ".verify|verify} messages." ,
463
+ "Encodes the specified " + type . name + " message, length delimited. Does not implicitly {@link " + exportName ( type ) + ".verify|verify} messages." ,
467
464
"@param {" + exportName ( type , ! config . forceMessage ) + "} message " + type . name + " message or plain object to encode" ,
468
465
"@param {$protobuf.Writer} [writer] Writer to encode to" ,
469
466
"@returns {$protobuf.Writer} Writer"
@@ -482,7 +479,7 @@ function buildType(ref, type) {
482
479
"Decodes " + aOrAn ( type . name ) + " message from the specified reader or buffer." ,
483
480
"@param {$protobuf.Reader|Uint8Array} " + ( config . beautify ? "reader" : "r" ) + " Reader or buffer to decode from" ,
484
481
"@param {number} [" + ( config . beautify ? "length" : "l" ) + "] Message length if known beforehand" ,
485
- "@returns {" + fullName + "} " + type . name ,
482
+ "@returns {" + exportName ( type ) + "} " + type . name ,
486
483
"@throws {Error} If the payload is not a reader or valid buffer" ,
487
484
"@throws {$protobuf.util.ProtocolError} If required fields are missing"
488
485
] ) ;
@@ -493,7 +490,7 @@ function buildType(ref, type) {
493
490
pushComment ( [
494
491
"Decodes " + aOrAn ( type . name ) + " message from the specified reader or buffer, length delimited." ,
495
492
"@param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from" ,
496
- "@returns {" + fullName + "} " + type . name ,
493
+ "@returns {" + exportName ( type ) + "} " + type . name ,
497
494
"@throws {Error} If the payload is not a reader or valid buffer" ,
498
495
"@throws {$protobuf.util.ProtocolError} If required fields are missing"
499
496
] ) ;
@@ -524,14 +521,14 @@ function buildType(ref, type) {
524
521
pushComment ( [
525
522
"Creates " + aOrAn ( type . name ) + " message from a plain object. Also converts values to their respective internal types." ,
526
523
"@param {Object.<string,*>} " + ( config . beautify ? "object" : "d" ) + " Plain object" ,
527
- "@returns {" + fullName + "} " + type . name
524
+ "@returns {" + exportName ( type ) + "} " + type . name
528
525
] ) ;
529
526
buildFunction ( type , "fromObject" , protobuf . converter . fromObject ( type ) ) ;
530
527
531
528
push ( "" ) ;
532
529
pushComment ( [
533
530
"Creates a plain object from " + aOrAn ( type . name ) + " message. Also converts values to other types if specified." ,
534
- "@param {" + fullName + "} " + ( config . beautify ? "message" : "m" ) + " " + type . name ,
531
+ "@param {" + exportName ( type ) + "} " + ( config . beautify ? "message" : "m" ) + " " + type . name ,
535
532
"@param {$protobuf.IConversionOptions} [" + ( config . beautify ? "options" : "o" ) + "] Conversion options" ,
536
533
"@returns {Object.<string,*>} Plain object"
537
534
] ) ;
@@ -555,13 +552,13 @@ function buildService(ref, service) {
555
552
push ( "" ) ;
556
553
pushComment ( [
557
554
"Constructs a new " + service . name + " service." ,
558
- service . comment ? "@classdesc " + service . comment : null ,
555
+ "@exports " + exportName ( service ) ,
556
+ "@classdesc " + ( service . comment || "Represents " + aOrAn ( service . name ) ) ,
559
557
"@extends $protobuf.rpc.Service" ,
560
558
"@constructor" ,
561
559
"@param {$protobuf.RPCImpl} rpcImpl RPC implementation" ,
562
560
"@param {boolean} [requestDelimited=false] Whether requests are length-delimited" ,
563
- "@param {boolean} [responseDelimited=false] Whether responses are length-delimited" ,
564
- service . parent instanceof protobuf . Root ? "@name " + escapeName ( service . name ) : "@memberof " + exportName ( service . parent )
561
+ "@param {boolean} [responseDelimited=false] Whether responses are length-delimited"
565
562
] ) ;
566
563
push ( "function " + escapeName ( service . name ) + "(rpcImpl, requestDelimited, responseDelimited) {" ) ;
567
564
++ indent ;
@@ -598,7 +595,7 @@ function buildService(ref, service) {
598
595
"@typedef " + cbName ,
599
596
"@type {function}" ,
600
597
"@param {Error|null} error Error, if any" ,
601
- "@param {" + method . resolvedResponseType . fullName . substring ( 1 ) + "} [response] " + method . resolvedResponseType . name
598
+ "@param {" + exportName ( method . resolvedResponseType ) + "} [response] " + method . resolvedResponseType . name
602
599
] ) ;
603
600
push ( "" ) ;
604
601
pushComment ( [
@@ -609,15 +606,14 @@ function buildService(ref, service) {
609
606
] ) ;
610
607
push ( escapeName ( service . name ) + ".prototype" + util . safeProp ( lcName ) + " = function " + escapeName ( lcName ) + "(request, callback) {" ) ;
611
608
++ indent ;
612
- push ( "return this.rpcCall(" + escapeName ( lcName ) + ", $root" + method . resolvedRequestType . fullName + ", $root" + method . resolvedResponseType . fullName + ", request, callback);" ) ;
609
+ push ( "return this.rpcCall(" + escapeName ( lcName ) + ", $root. " + exportName ( method . resolvedRequestType ) + ", $root. " + exportName ( method . resolvedResponseType ) + ", request, callback);" ) ;
613
610
-- indent ;
614
611
push ( "};" ) ;
615
612
if ( config . comments )
616
613
push ( "" ) ;
617
614
pushComment ( [
618
615
method . comment || "Calls " + method . name + "." ,
619
- "@name " + escapeName ( service . name ) + "#" + lcName ,
620
- "@function" ,
616
+ "@function " + escapeName ( service . name ) + "#" + lcName ,
621
617
"@param {" + exportName ( method . resolvedRequestType , ! config . forceMessage ) + "} request " + method . resolvedRequestType . name + " message or plain object" ,
622
618
"@returns {Promise<" + exportName ( method . resolvedResponseType ) + ">} Promise" ,
623
619
"@variation 2"
@@ -630,9 +626,7 @@ function buildEnum(ref, enm) {
630
626
push ( "" ) ;
631
627
var comment = [
632
628
enm . comment || enm . name + " enum." ,
633
- "@name " + escapeName ( enm . name ) ,
634
- "@enum {number}" ,
635
- enm . parent instanceof protobuf . Root ? "@name " + escapeName ( enm . name ) : "@memberof " + exportName ( enm . parent )
629
+ "@enum {number} " + exportName ( enm )
636
630
] ;
637
631
Object . keys ( enm . values ) . forEach ( function ( key ) {
638
632
var val = enm . values [ key ] ;
0 commit comments