mirror of
https://github.com/musix-org/musix-oss
synced 2025-06-17 07:36:01 +00:00
Modules
This commit is contained in:
72
node_modules/protobufjs/ext/descriptor/README.md
generated
vendored
Normal file
72
node_modules/protobufjs/ext/descriptor/README.md
generated
vendored
Normal file
@ -0,0 +1,72 @@
|
||||
protobufjs/ext/descriptor
|
||||
=========================
|
||||
|
||||
Experimental extension for interoperability with [descriptor.proto](https://github.com/google/protobuf/blob/master/src/google/protobuf/descriptor.proto) types.
|
||||
|
||||
Usage
|
||||
-----
|
||||
|
||||
```js
|
||||
var protobuf = require("protobufjs"), // requires the full library
|
||||
descriptor = require("protobufjs/ext/descriptor");
|
||||
|
||||
var root = ...;
|
||||
|
||||
// convert any existing root instance to the corresponding descriptor type
|
||||
var descriptor = root.toDescriptor("proto2");
|
||||
// ^ returns a FileDescriptorSet message, see table below
|
||||
|
||||
// encode to a descriptor buffer
|
||||
var buffer = descriptor.FileDescriptorSet.encode(descriptor).finish();
|
||||
|
||||
// decode from a descriptor buffer
|
||||
var decodedDescriptor = descriptor.FileDescriptorSet.decode(buffer);
|
||||
|
||||
// convert any existing descriptor to a root instance
|
||||
root = protobuf.Root.fromDescriptor(decodedDescriptor);
|
||||
// ^ expects a FileDescriptorSet message or buffer, see table below
|
||||
|
||||
// and start all over again
|
||||
```
|
||||
|
||||
API
|
||||
---
|
||||
|
||||
The extension adds `.fromDescriptor(descriptor[, syntax])` and `#toDescriptor([syntax])` methods to reflection objects and exports the `.google.protobuf` namespace of the internally used `Root` instance containing the following types present in descriptor.proto:
|
||||
|
||||
| Descriptor type | protobuf.js type | Remarks
|
||||
|-------------------------------|------------------|---------
|
||||
| **FileDescriptorSet** | Root |
|
||||
| FileDescriptorProto | | dependencies are not supported
|
||||
| FileOptions | |
|
||||
| FileOptionsOptimizeMode | |
|
||||
| SourceCodeInfo | | not supported
|
||||
| SourceCodeInfoLocation | |
|
||||
| GeneratedCodeInfo | | not supported
|
||||
| GeneratedCodeInfoAnnotation | |
|
||||
| **DescriptorProto** | Type |
|
||||
| MessageOptions | |
|
||||
| DescriptorProtoExtensionRange | |
|
||||
| DescriptorProtoReservedRange | |
|
||||
| **FieldDescriptorProto** | Field |
|
||||
| FieldDescriptorProtoLabel | |
|
||||
| FieldDescriptorProtoType | |
|
||||
| FieldOptions | |
|
||||
| FieldOptionsCType | |
|
||||
| FieldOptionsJSType | |
|
||||
| **OneofDescriptorProto** | OneOf |
|
||||
| OneofOptions | |
|
||||
| **EnumDescriptorProto** | Enum |
|
||||
| EnumOptions | |
|
||||
| EnumValueDescriptorProto | |
|
||||
| EnumValueOptions | | not supported
|
||||
| **ServiceDescriptorProto** | Service |
|
||||
| ServiceOptions | |
|
||||
| **MethodDescriptorProto** | Method |
|
||||
| MethodOptions | |
|
||||
| UninterpretedOption | | not supported
|
||||
| UninterpretedOptionNamePart | |
|
||||
|
||||
Note that not all features of descriptor.proto translate perfectly to a protobuf.js root instance. A root instance has only limited knowlege of packages or individual files for example, which is then compensated by guessing and generating fictional file names.
|
||||
|
||||
When using TypeScript, the respective interface types can be used to reference specific message instances (i.e. `protobuf.Message<IDescriptorProto>`).
|
191
node_modules/protobufjs/ext/descriptor/index.d.ts
generated
vendored
Normal file
191
node_modules/protobufjs/ext/descriptor/index.d.ts
generated
vendored
Normal file
@ -0,0 +1,191 @@
|
||||
import * as $protobuf from "../..";
|
||||
export const FileDescriptorSet: $protobuf.Type;
|
||||
|
||||
export const FileDescriptorProto: $protobuf.Type;
|
||||
|
||||
export const DescriptorProto: $protobuf.Type & {
|
||||
ExtensionRange: $protobuf.Type,
|
||||
ReservedRange: $protobuf.Type
|
||||
};
|
||||
|
||||
export const FieldDescriptorProto: $protobuf.Type & {
|
||||
Label: $protobuf.Enum,
|
||||
Type: $protobuf.Enum
|
||||
};
|
||||
|
||||
export const OneofDescriptorProto: $protobuf.Type;
|
||||
|
||||
export const EnumDescriptorProto: $protobuf.Type;
|
||||
|
||||
export const ServiceDescriptorProto: $protobuf.Type;
|
||||
|
||||
export const EnumValueDescriptorProto: $protobuf.Type;
|
||||
|
||||
export const MethodDescriptorProto: $protobuf.Type;
|
||||
|
||||
export const FileOptions: $protobuf.Type & {
|
||||
OptimizeMode: $protobuf.Enum
|
||||
};
|
||||
|
||||
export const MessageOptions: $protobuf.Type;
|
||||
|
||||
export const FieldOptions: $protobuf.Type & {
|
||||
CType: $protobuf.Enum,
|
||||
JSType: $protobuf.Enum
|
||||
};
|
||||
|
||||
export const OneofOptions: $protobuf.Type;
|
||||
|
||||
export const EnumOptions: $protobuf.Type;
|
||||
|
||||
export const EnumValueOptions: $protobuf.Type;
|
||||
|
||||
export const ServiceOptions: $protobuf.Type;
|
||||
|
||||
export const MethodOptions: $protobuf.Type;
|
||||
|
||||
export const UninterpretedOption: $protobuf.Type & {
|
||||
NamePart: $protobuf.Type
|
||||
};
|
||||
|
||||
export const SourceCodeInfo: $protobuf.Type & {
|
||||
Location: $protobuf.Type
|
||||
};
|
||||
|
||||
export const GeneratedCodeInfo: $protobuf.Type & {
|
||||
Annotation: $protobuf.Type
|
||||
};
|
||||
|
||||
export interface IFileDescriptorSet {
|
||||
file: IFileDescriptorProto[];
|
||||
}
|
||||
|
||||
export interface IFileDescriptorProto {
|
||||
name?: string;
|
||||
package?: string;
|
||||
dependency?: any;
|
||||
publicDependency?: any;
|
||||
weakDependency?: any;
|
||||
messageType?: IDescriptorProto[];
|
||||
enumType?: IEnumDescriptorProto[];
|
||||
service?: IServiceDescriptorProto[];
|
||||
extension?: IFieldDescriptorProto[];
|
||||
options?: IFileOptions;
|
||||
sourceCodeInfo?: any;
|
||||
syntax?: string;
|
||||
}
|
||||
|
||||
export interface IFileOptions {
|
||||
javaPackage?: string;
|
||||
javaOuterClassname?: string;
|
||||
javaMultipleFiles?: boolean;
|
||||
javaGenerateEqualsAndHash?: boolean;
|
||||
javaStringCheckUtf8?: boolean;
|
||||
optimizeFor?: IFileOptionsOptimizeMode;
|
||||
goPackage?: string;
|
||||
ccGenericServices?: boolean;
|
||||
javaGenericServices?: boolean;
|
||||
pyGenericServices?: boolean;
|
||||
deprecated?: boolean;
|
||||
ccEnableArenas?: boolean;
|
||||
objcClassPrefix?: string;
|
||||
csharpNamespace?: string;
|
||||
}
|
||||
|
||||
type IFileOptionsOptimizeMode = number;
|
||||
|
||||
export interface IDescriptorProto {
|
||||
name?: string;
|
||||
field?: IFieldDescriptorProto[];
|
||||
extension?: IFieldDescriptorProto[];
|
||||
nestedType?: IDescriptorProto[];
|
||||
enumType?: IEnumDescriptorProto[];
|
||||
extensionRange?: IDescriptorProtoExtensionRange[];
|
||||
oneofDecl?: IOneofDescriptorProto[];
|
||||
options?: IMessageOptions;
|
||||
reservedRange?: IDescriptorProtoReservedRange[];
|
||||
reservedName?: string[];
|
||||
}
|
||||
|
||||
export interface IMessageOptions {
|
||||
mapEntry?: boolean;
|
||||
}
|
||||
|
||||
export interface IDescriptorProtoExtensionRange {
|
||||
start?: number;
|
||||
end?: number;
|
||||
}
|
||||
|
||||
export interface IDescriptorProtoReservedRange {
|
||||
start?: number;
|
||||
end?: number;
|
||||
}
|
||||
|
||||
export interface IFieldDescriptorProto {
|
||||
name?: string;
|
||||
number?: number;
|
||||
label?: IFieldDescriptorProtoLabel;
|
||||
type?: IFieldDescriptorProtoType;
|
||||
typeName?: string;
|
||||
extendee?: string;
|
||||
defaultValue?: string;
|
||||
oneofIndex?: number;
|
||||
jsonName?: any;
|
||||
options?: IFieldOptions;
|
||||
}
|
||||
|
||||
type IFieldDescriptorProtoLabel = number;
|
||||
|
||||
type IFieldDescriptorProtoType = number;
|
||||
|
||||
export interface IFieldOptions {
|
||||
packed?: boolean;
|
||||
jstype?: IFieldOptionsJSType;
|
||||
}
|
||||
|
||||
type IFieldOptionsJSType = number;
|
||||
|
||||
export interface IEnumDescriptorProto {
|
||||
name?: string;
|
||||
value?: IEnumValueDescriptorProto[];
|
||||
options?: IEnumOptions;
|
||||
}
|
||||
|
||||
export interface IEnumValueDescriptorProto {
|
||||
name?: string;
|
||||
number?: number;
|
||||
options?: any;
|
||||
}
|
||||
|
||||
export interface IEnumOptions {
|
||||
allowAlias?: boolean;
|
||||
deprecated?: boolean;
|
||||
}
|
||||
|
||||
export interface IOneofDescriptorProto {
|
||||
name?: string;
|
||||
options?: any;
|
||||
}
|
||||
|
||||
export interface IServiceDescriptorProto {
|
||||
name?: string;
|
||||
method?: IMethodDescriptorProto[];
|
||||
options?: IServiceOptions;
|
||||
}
|
||||
|
||||
export interface IServiceOptions {
|
||||
deprecated?: boolean;
|
||||
}
|
||||
|
||||
export interface IMethodDescriptorProto {
|
||||
name?: string;
|
||||
inputType?: string;
|
||||
outputType?: string;
|
||||
options?: IMethodOptions;
|
||||
clientStreaming?: boolean;
|
||||
serverStreaming?: boolean;
|
||||
}
|
||||
|
||||
export interface IMethodOptions {
|
||||
deprecated?: boolean;
|
||||
}
|
1052
node_modules/protobufjs/ext/descriptor/index.js
generated
vendored
Normal file
1052
node_modules/protobufjs/ext/descriptor/index.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
54
node_modules/protobufjs/ext/descriptor/test.js
generated
vendored
Normal file
54
node_modules/protobufjs/ext/descriptor/test.js
generated
vendored
Normal file
@ -0,0 +1,54 @@
|
||||
/*eslint-disable no-console*/
|
||||
"use strict";
|
||||
var protobuf = require("../../"),
|
||||
descriptor = require(".");
|
||||
|
||||
/* var proto = {
|
||||
nested: {
|
||||
Message: {
|
||||
fields: {
|
||||
foo: {
|
||||
type: "string",
|
||||
id: 1
|
||||
}
|
||||
},
|
||||
nested: {
|
||||
SubMessage: {
|
||||
fields: {}
|
||||
}
|
||||
}
|
||||
},
|
||||
Enum: {
|
||||
values: {
|
||||
ONE: 1,
|
||||
TWO: 2
|
||||
}
|
||||
}
|
||||
}
|
||||
}; */
|
||||
|
||||
// var root = protobuf.Root.fromJSON(proto).resolveAll();
|
||||
var root = protobuf.loadSync("tests/data/google/protobuf/descriptor.proto").resolveAll();
|
||||
|
||||
// console.log("Original proto", JSON.stringify(root, null, 2));
|
||||
|
||||
var msg = root.toDescriptor();
|
||||
|
||||
// console.log("\nDescriptor", JSON.stringify(msg.toObject(), null, 2));
|
||||
|
||||
var buf = descriptor.FileDescriptorSet.encode(msg).finish();
|
||||
var root2 = protobuf.Root.fromDescriptor(buf, "proto2").resolveAll();
|
||||
|
||||
// console.log("\nDecoded proto", JSON.stringify(root2, null, 2));
|
||||
|
||||
var diff = require("deep-diff").diff(root.toJSON(), root2.toJSON());
|
||||
if (diff) {
|
||||
diff.forEach(function(diff) {
|
||||
console.log(diff.kind + " @ " + diff.path.join("."));
|
||||
console.log("lhs:", typeof diff.lhs, diff.lhs);
|
||||
console.log("rhs:", typeof diff.rhs, diff.rhs);
|
||||
console.log();
|
||||
});
|
||||
process.exitCode = 1;
|
||||
} else
|
||||
console.log("no differences");
|
Reference in New Issue
Block a user