protobufjs 5.0.1 → 5.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.travis.yml +2 -1
- package/README.md +144 -22
- package/bin/pbjs +2 -2
- package/bower.json +2 -2
- package/cli/pbjs/targets/amd.js +1 -1
- package/cli/pbjs/targets/json.js +8 -0
- package/cli/pbjs/util.js +1 -1
- package/cli/pbjs.js +1 -1
- package/dist/protobuf-light.js +166 -128
- package/dist/protobuf-light.min.js +88 -81
- package/dist/protobuf-light.min.js.gz +0 -0
- package/dist/protobuf-light.min.map +4 -4
- package/dist/protobuf.js +171 -129
- package/dist/protobuf.min.js +106 -98
- package/dist/protobuf.min.js.gz +0 -0
- package/dist/protobuf.min.map +4 -4
- package/docs/ProtoBuf.Builder.Message.html +1408 -971
- package/docs/ProtoBuf.Builder.Service.html +266 -197
- package/docs/ProtoBuf.Builder.html +758 -542
- package/docs/ProtoBuf.DotProto.Parser.html +223 -161
- package/docs/ProtoBuf.DotProto.Tokenizer.html +344 -248
- package/docs/ProtoBuf.DotProto.html +20 -12
- package/docs/ProtoBuf.Element.html +554 -554
- package/docs/ProtoBuf.Map.html +158 -123
- package/docs/ProtoBuf.Reflect.Element.html +286 -143
- package/docs/ProtoBuf.Reflect.Enum.Value.html +329 -228
- package/docs/ProtoBuf.Reflect.Enum.html +757 -537
- package/docs/ProtoBuf.Reflect.Extension.html +73 -56
- package/docs/ProtoBuf.Reflect.Message.ExtensionField.html +1013 -740
- package/docs/ProtoBuf.Reflect.Message.Field.html +926 -649
- package/docs/ProtoBuf.Reflect.Message.OneOf.html +327 -245
- package/docs/ProtoBuf.Reflect.Message.html +915 -651
- package/docs/ProtoBuf.Reflect.Namespace.html +648 -447
- package/docs/ProtoBuf.Reflect.Service.Method.html +363 -251
- package/docs/ProtoBuf.Reflect.Service.RPCMethod.html +545 -397
- package/docs/ProtoBuf.Reflect.Service.html +721 -511
- package/docs/ProtoBuf.Reflect.T.html +268 -197
- package/docs/ProtoBuf.Reflect.html +20 -12
- package/docs/ProtoBuf.Util.html +169 -118
- package/docs/ProtoBuf.html +840 -628
- package/docs/ProtoBuf.js.html +177 -134
- package/docs/fonts/OpenSans-Bold-webfont.eot +0 -0
- package/docs/fonts/OpenSans-Bold-webfont.svg +1830 -0
- package/docs/fonts/OpenSans-Bold-webfont.woff +0 -0
- package/docs/fonts/OpenSans-BoldItalic-webfont.eot +0 -0
- package/docs/fonts/OpenSans-BoldItalic-webfont.svg +1830 -0
- package/docs/fonts/OpenSans-BoldItalic-webfont.woff +0 -0
- package/docs/fonts/OpenSans-Italic-webfont.eot +0 -0
- package/docs/fonts/OpenSans-Italic-webfont.svg +1830 -0
- package/docs/fonts/OpenSans-Italic-webfont.woff +0 -0
- package/docs/fonts/OpenSans-Light-webfont.eot +0 -0
- package/docs/fonts/OpenSans-Light-webfont.svg +1831 -0
- package/docs/fonts/OpenSans-Light-webfont.woff +0 -0
- package/docs/fonts/OpenSans-LightItalic-webfont.eot +0 -0
- package/docs/fonts/OpenSans-LightItalic-webfont.svg +1835 -0
- package/docs/fonts/OpenSans-LightItalic-webfont.woff +0 -0
- package/docs/fonts/OpenSans-Regular-webfont.eot +0 -0
- package/docs/fonts/OpenSans-Regular-webfont.svg +1831 -0
- package/docs/fonts/OpenSans-Regular-webfont.woff +0 -0
- package/docs/index.html +7 -5
- package/docs/styles/jsdoc-default.css +95 -75
- package/docs/styles/prettify-tomorrow.css +1 -1
- package/examples/protoify/json.js +123 -123
- package/examples/protoify/json.json +123 -123
- package/examples/websocket/server.js +4 -4
- package/externs/protobuf.js +1 -1
- package/jsdoc.json +1 -1
- package/package.json +2 -2
- package/scripts/build.js +53 -53
- package/src/ProtoBuf/Builder/Message.js +9 -5
- package/src/ProtoBuf/Builder.js +19 -2
- package/src/ProtoBuf/DotProto/Parser.js +5 -1
- package/src/ProtoBuf/Reflect/Element.js +13 -1
- package/src/ProtoBuf/Reflect/Message/Field.js +2 -2
- package/src/ProtoBuf/Reflect/Message.js +6 -1
- package/src/ProtoBuf/Util.js +116 -116
- package/src/bower.json +1 -1
- package/src/google/protobuf/descriptor.json +27 -1
- package/tests/bench.txt +373 -373
- package/tests/complex.json +8 -1
- package/tests/custom-options.json +169 -169
- package/tests/extend.json +71 -71
- package/tests/imports.json +83 -83
- package/tests/nodeunit-browser/nodeunit.css +70 -70
- package/tests/nodeunit-browser/nodeunit.js +2108 -2108
- package/tests/options.json +32 -32
- package/tests/proto2js/Bar.json +46 -46
- package/tests/suite.js +43 -1
- package/sandbox/gapi/googleapis/google/api/annotations.proto +0 -29
- package/sandbox/gapi/googleapis/google/api/http.proto +0 -245
- package/sandbox/gapi/googleapis/google/datastore/v1beta3/datastore.proto +0 -281
- package/sandbox/gapi/googleapis/google/datastore/v1beta3/entity.proto +0 -189
- package/sandbox/gapi/googleapis/google/datastore/v1beta3/query.proto +0 -281
- package/sandbox/gapi/googleapis/google/longrunning/operations.proto +0 -144
- package/sandbox/gapi/googleapis/google/protobuf/any.proto +0 -98
- package/sandbox/gapi/googleapis/google/protobuf/any_test.proto +0 -41
- package/sandbox/gapi/googleapis/google/protobuf/api.proto +0 -201
- package/sandbox/gapi/googleapis/google/protobuf/descriptor.proto +0 -773
- package/sandbox/gapi/googleapis/google/protobuf/duration.proto +0 -95
- package/sandbox/gapi/googleapis/google/protobuf/empty.proto +0 -50
- package/sandbox/gapi/googleapis/google/protobuf/field_mask.proto +0 -167
- package/sandbox/gapi/googleapis/google/protobuf/map_lite_unittest.proto +0 -130
- package/sandbox/gapi/googleapis/google/protobuf/map_proto2_unittest.proto +0 -60
- package/sandbox/gapi/googleapis/google/protobuf/map_unittest.proto +0 -129
- package/sandbox/gapi/googleapis/google/protobuf/map_unittest_proto3.proto +0 -120
- package/sandbox/gapi/googleapis/google/protobuf/source_context.proto +0 -47
- package/sandbox/gapi/googleapis/google/protobuf/struct.proto +0 -94
- package/sandbox/gapi/googleapis/google/protobuf/timestamp.proto +0 -107
- package/sandbox/gapi/googleapis/google/protobuf/type.proto +0 -176
- package/sandbox/gapi/googleapis/google/protobuf/unittest.proto +0 -878
- package/sandbox/gapi/googleapis/google/protobuf/unittest_arena.proto +0 -46
- package/sandbox/gapi/googleapis/google/protobuf/unittest_custom_options.proto +0 -394
- package/sandbox/gapi/googleapis/google/protobuf/unittest_drop_unknown_fields.proto +0 -58
- package/sandbox/gapi/googleapis/google/protobuf/unittest_embed_optimize_for.proto +0 -51
- package/sandbox/gapi/googleapis/google/protobuf/unittest_empty.proto +0 -38
- package/sandbox/gapi/googleapis/google/protobuf/unittest_enormous_descriptor.proto +0 -1048
- package/sandbox/gapi/googleapis/google/protobuf/unittest_import.proto +0 -66
- package/sandbox/gapi/googleapis/google/protobuf/unittest_import_lite.proto +0 -52
- package/sandbox/gapi/googleapis/google/protobuf/unittest_import_proto3.proto +0 -68
- package/sandbox/gapi/googleapis/google/protobuf/unittest_import_public.proto +0 -41
- package/sandbox/gapi/googleapis/google/protobuf/unittest_import_public_lite.proto +0 -43
- package/sandbox/gapi/googleapis/google/protobuf/unittest_import_public_proto3.proto +0 -42
- package/sandbox/gapi/googleapis/google/protobuf/unittest_lite.proto +0 -385
- package/sandbox/gapi/googleapis/google/protobuf/unittest_lite_imports_nonlite.proto +0 -44
- package/sandbox/gapi/googleapis/google/protobuf/unittest_mset.proto +0 -82
- package/sandbox/gapi/googleapis/google/protobuf/unittest_mset_wire_format.proto +0 -52
- package/sandbox/gapi/googleapis/google/protobuf/unittest_no_arena.proto +0 -202
- package/sandbox/gapi/googleapis/google/protobuf/unittest_no_arena_import.proto +0 -37
- package/sandbox/gapi/googleapis/google/protobuf/unittest_no_arena_lite.proto +0 -42
- package/sandbox/gapi/googleapis/google/protobuf/unittest_no_field_presence.proto +0 -138
- package/sandbox/gapi/googleapis/google/protobuf/unittest_no_generic_services.proto +0 -54
- package/sandbox/gapi/googleapis/google/protobuf/unittest_optimize_for.proto +0 -67
- package/sandbox/gapi/googleapis/google/protobuf/unittest_preserve_unknown_enum.proto +0 -71
- package/sandbox/gapi/googleapis/google/protobuf/unittest_preserve_unknown_enum2.proto +0 -50
- package/sandbox/gapi/googleapis/google/protobuf/unittest_proto3.proto +0 -388
- package/sandbox/gapi/googleapis/google/protobuf/unittest_proto3_arena.proto +0 -206
- package/sandbox/gapi/googleapis/google/protobuf/unittest_well_known_types.proto +0 -112
- package/sandbox/gapi/googleapis/google/protobuf/unknown_enum_test.proto +0 -62
- package/sandbox/gapi/googleapis/google/protobuf/wrappers.proto +0 -117
- package/sandbox/gapi/googleapis/google/rpc/code.proto +0 -190
- package/sandbox/gapi/googleapis/google/rpc/error_details.proto +0 -157
- package/sandbox/gapi/googleapis/google/rpc/status.proto +0 -90
- package/sandbox/gapi/googleapis/google/type/color.proto +0 -163
- package/sandbox/gapi/googleapis/google/type/date.proto +0 -43
- package/sandbox/gapi/googleapis/google/type/dayofweek.proto +0 -50
- package/sandbox/gapi/googleapis/google/type/latlng.proto +0 -36
- package/sandbox/gapi/googleapis/google/type/money.proto +0 -40
- package/sandbox/gapi/googleapis/google/type/timeofday.proto +0 -42
- package/sandbox/gapi/test.js +0 -17
- package/sandbox/gapi/test.proto +0 -12
- package/sandbox/issue146/MyOptions.proto +0 -28
- package/sandbox/issue146/Sample.proto +0 -21
- package/sandbox/issue146/main.js +0 -3
- package/sandbox/issue147/enum.proto +0 -8
- package/sandbox/issue147/main.js +0 -3
- package/sandbox/issue182/commands.proto +0 -10
- package/sandbox/issue182/execute.js +0 -22
- package/sandbox/issue182/session_commands.proto +0 -14
- package/sandbox/issue289/A.proto +0 -8
- package/sandbox/issue289/B.proto +0 -8
- package/sandbox/issue289/common.proto +0 -5
- package/sandbox/issue289/main.js +0 -7
- package/sandbox/issue300/IAuth.proto +0 -14
- package/sandbox/issue300/Request.proto +0 -14
- package/sandbox/issue300/main.js +0 -26
- package/sandbox/issue347/index.js +0 -27
- package/sandbox/issue355/main.proto +0 -15
- package/sandbox/issue42/innerextend.proto +0 -18
- package/sandbox/issue42/main.js +0 -8
- package/sandbox/issue42/outerextend.proto +0 -17
|
@@ -1,163 +0,0 @@
|
|
|
1
|
-
// Copyright (c) 2015, Google Inc.
|
|
2
|
-
//
|
|
3
|
-
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
-
// you may not use this file except in compliance with the License.
|
|
5
|
-
// You may obtain a copy of the License at
|
|
6
|
-
//
|
|
7
|
-
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
-
//
|
|
9
|
-
// Unless required by applicable law or agreed to in writing, software
|
|
10
|
-
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
-
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
-
// See the License for the specific language governing permissions and
|
|
13
|
-
// limitations under the License.
|
|
14
|
-
|
|
15
|
-
syntax = "proto3";
|
|
16
|
-
|
|
17
|
-
package google.type;
|
|
18
|
-
|
|
19
|
-
import "google/protobuf/wrappers.proto";
|
|
20
|
-
|
|
21
|
-
option java_multiple_files = true;
|
|
22
|
-
option java_outer_classname = "ColorProto";
|
|
23
|
-
option java_package = "com.google.type";
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
// Represents a color in the RGBA color space. This representation is designed
|
|
27
|
-
// for simplicity of conversion to/from color representations in various
|
|
28
|
-
// languages over compactness; for example, the fields of this representation
|
|
29
|
-
// can be trivially provided to the constructor of "java.awt.Color" in Java; it
|
|
30
|
-
// can also be trivially provided to UIColor's "+colorWithRed:green:blue:alpha"
|
|
31
|
-
// method in iOS; and, with just a little work, it can be easily formatted into
|
|
32
|
-
// a CSS "rgba()" string in JavaScript, as well. Here are some examples:
|
|
33
|
-
//
|
|
34
|
-
// Example (Java):
|
|
35
|
-
//
|
|
36
|
-
// import com.google.type.Color;
|
|
37
|
-
//
|
|
38
|
-
// // ...
|
|
39
|
-
// public static java.awt.Color fromProto(Color protocolor) {
|
|
40
|
-
// float alpha = protocolor.hasAlpha()
|
|
41
|
-
// ? protocolor.getAlpha().getValue()
|
|
42
|
-
// : 1.0;
|
|
43
|
-
//
|
|
44
|
-
// return new java.awt.Color(
|
|
45
|
-
// protocolor.getRed(),
|
|
46
|
-
// protocolor.getGreen(),
|
|
47
|
-
// protocolor.getBlue(),
|
|
48
|
-
// alpha);
|
|
49
|
-
// }
|
|
50
|
-
//
|
|
51
|
-
// public static Color toProto(java.awt.Color color) {
|
|
52
|
-
// float red = (float) color.getRed();
|
|
53
|
-
// float green = (float) color.getGreen();
|
|
54
|
-
// float blue = (float) color.getBlue();
|
|
55
|
-
// float denominator = 255.0;
|
|
56
|
-
// Color.Builder resultBuilder =
|
|
57
|
-
// Color
|
|
58
|
-
// .newBuilder()
|
|
59
|
-
// .setRed(red / denominator)
|
|
60
|
-
// .setGreen(green / denominator)
|
|
61
|
-
// .setBlue(blue / denominator);
|
|
62
|
-
// int alpha = color.getAlpha();
|
|
63
|
-
// if (alpha != 255) {
|
|
64
|
-
// result.setAlpha(
|
|
65
|
-
// FloatValue
|
|
66
|
-
// .newBuilder()
|
|
67
|
-
// .setValue(((float) alpha) / denominator)
|
|
68
|
-
// .build());
|
|
69
|
-
// }
|
|
70
|
-
// return resultBuilder.build();
|
|
71
|
-
// }
|
|
72
|
-
// // ...
|
|
73
|
-
//
|
|
74
|
-
// Example (iOS / Obj-C):
|
|
75
|
-
//
|
|
76
|
-
// // ...
|
|
77
|
-
// static UIColor* fromProto(Color* protocolor) {
|
|
78
|
-
// float red = [protocolor red];
|
|
79
|
-
// float green = [protocolor green];
|
|
80
|
-
// float blue = [protocolor blue];
|
|
81
|
-
// FloatValue* alpha_wrapper = [protocolor alpha];
|
|
82
|
-
// float alpha = 1.0;
|
|
83
|
-
// if (alpha_wrapper != nil) {
|
|
84
|
-
// alpha = [alpha_wrapper value];
|
|
85
|
-
// }
|
|
86
|
-
// return [UIColor colorWithRed:red green:green blue:blue alpha:alpha];
|
|
87
|
-
// }
|
|
88
|
-
//
|
|
89
|
-
// static Color* toProto(UIColor* color) {
|
|
90
|
-
// CGFloat red, green, blue, alpha;
|
|
91
|
-
// if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) {
|
|
92
|
-
// return nil;
|
|
93
|
-
// }
|
|
94
|
-
// Color* result = [Color alloc] init];
|
|
95
|
-
// [result setRed:red];
|
|
96
|
-
// [result setGreen:green];
|
|
97
|
-
// [result setBlue:blue];
|
|
98
|
-
// if (alpha <= 0.9999) {
|
|
99
|
-
// [result setAlpha:floatWrapperWithValue(alpha)];
|
|
100
|
-
// }
|
|
101
|
-
// [result autorelease];
|
|
102
|
-
// return result;
|
|
103
|
-
// }
|
|
104
|
-
// // ...
|
|
105
|
-
//
|
|
106
|
-
// Example (JavaScript):
|
|
107
|
-
//
|
|
108
|
-
// // ...
|
|
109
|
-
//
|
|
110
|
-
// var protoToCssColor = function(rgb_color) {
|
|
111
|
-
// var redFrac = rgb_color.red || 0.0;
|
|
112
|
-
// var greenFrac = rgb_color.green || 0.0;
|
|
113
|
-
// var blueFrac = rgb_color.blue || 0.0;
|
|
114
|
-
// var red = Math.floor(redFrac * 255);
|
|
115
|
-
// var green = Math.floor(greenFrac * 255);
|
|
116
|
-
// var blue = Math.floor(blueFrac * 255);
|
|
117
|
-
//
|
|
118
|
-
// if (!('alpha' in rgb_color)) {
|
|
119
|
-
// return rgbToCssColor_(red, green, blue);
|
|
120
|
-
// }
|
|
121
|
-
//
|
|
122
|
-
// var alphaFrac = rgb_color.alpha.value || 0.0;
|
|
123
|
-
// var rgbParams = [red, green, blue].join(',');
|
|
124
|
-
// return ['rgba(', rgbParams, ',', alphaFrac, ')'].join('');
|
|
125
|
-
// };
|
|
126
|
-
//
|
|
127
|
-
// var rgbToCssColor_ = function(red, green, blue) {
|
|
128
|
-
// var rgbNumber = new Number((red << 16) | (green << 8) | blue);
|
|
129
|
-
// var hexString = rgbNumber.toString(16);
|
|
130
|
-
// var missingZeros = 6 - hexString.length;
|
|
131
|
-
// var resultBuilder = ['#'];
|
|
132
|
-
// for (var i = 0; i < missingZeros; i++) {
|
|
133
|
-
// resultBuilder.push('0');
|
|
134
|
-
// }
|
|
135
|
-
// resultBuilder.push(hexString);
|
|
136
|
-
// return resultBuilder.join('');
|
|
137
|
-
// };
|
|
138
|
-
//
|
|
139
|
-
// // ...
|
|
140
|
-
//
|
|
141
|
-
message Color {
|
|
142
|
-
// The amount of red in the color as a value in the interval [0, 1].
|
|
143
|
-
float red = 1;
|
|
144
|
-
|
|
145
|
-
// The amount of green in the color as a value in the interval [0, 1].
|
|
146
|
-
float green = 2;
|
|
147
|
-
|
|
148
|
-
// The amount of blue in the color as a value in the interval [0, 1].
|
|
149
|
-
float blue = 3;
|
|
150
|
-
|
|
151
|
-
// The fraction of this color that should be applied to the pixel. That is,
|
|
152
|
-
// the final pixel color is defined by the equation:
|
|
153
|
-
//
|
|
154
|
-
// pixel color = alpha * (this color) + (1.0 - alpha) * (background color)
|
|
155
|
-
//
|
|
156
|
-
// This means that a value of 1.0 corresponds to a solid color, whereas
|
|
157
|
-
// a value of 0.0 corresponds to a completely transparent color. This
|
|
158
|
-
// uses a wrapper message rather than a simple float scalar so that it is
|
|
159
|
-
// possible to distinguish between a default value and the value being unset.
|
|
160
|
-
// If omitted, this color object is to be rendered as a solid color
|
|
161
|
-
// (as if the alpha value had been explicitly given with a value of 1.0).
|
|
162
|
-
google.protobuf.FloatValue alpha = 4;
|
|
163
|
-
}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
// Copyright (c) 2015, Google Inc.
|
|
2
|
-
//
|
|
3
|
-
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
-
// you may not use this file except in compliance with the License.
|
|
5
|
-
// You may obtain a copy of the License at
|
|
6
|
-
//
|
|
7
|
-
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
-
//
|
|
9
|
-
// Unless required by applicable law or agreed to in writing, software
|
|
10
|
-
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
-
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
-
// See the License for the specific language governing permissions and
|
|
13
|
-
// limitations under the License.
|
|
14
|
-
|
|
15
|
-
syntax = "proto3";
|
|
16
|
-
|
|
17
|
-
package google.type;
|
|
18
|
-
|
|
19
|
-
option java_generate_equals_and_hash = true;
|
|
20
|
-
option java_multiple_files = true;
|
|
21
|
-
option java_outer_classname = "DateProto";
|
|
22
|
-
option java_package = "com.google.type";
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
// Represents a whole calendar date, e.g. date of birth. The time of day and
|
|
26
|
-
// time zone are either specified elsewhere or are not significant. The date
|
|
27
|
-
// is relative to the Proleptic Gregorian Calendar. The day may be 0 to
|
|
28
|
-
// represent a year and month where the day is not significant, e.g. credit card
|
|
29
|
-
// expiration date. The year may be 0 to represent a month and day independent
|
|
30
|
-
// of year, e.g. anniversary date. Related types are [google.type.TimeOfDay][google.type.TimeOfDay]
|
|
31
|
-
// and [google.protobuf.Timestamp][google.protobuf.Timestamp].
|
|
32
|
-
message Date {
|
|
33
|
-
// Year of date. Must be from 1 to 9,999, or 0 if specifying a date without
|
|
34
|
-
// a year.
|
|
35
|
-
int32 year = 1;
|
|
36
|
-
|
|
37
|
-
// Month of year of date. Must be from 1 to 12.
|
|
38
|
-
int32 month = 2;
|
|
39
|
-
|
|
40
|
-
// Day of month. Must be from 1 to 31 and valid for the year and month, or 0
|
|
41
|
-
// if specifying a year/month where the day is not sigificant.
|
|
42
|
-
int32 day = 3;
|
|
43
|
-
}
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
// Copyright (c) 2015, Google Inc.
|
|
2
|
-
//
|
|
3
|
-
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
-
// you may not use this file except in compliance with the License.
|
|
5
|
-
// You may obtain a copy of the License at
|
|
6
|
-
//
|
|
7
|
-
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
-
//
|
|
9
|
-
// Unless required by applicable law or agreed to in writing, software
|
|
10
|
-
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
-
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
-
// See the License for the specific language governing permissions and
|
|
13
|
-
// limitations under the License.
|
|
14
|
-
|
|
15
|
-
syntax = "proto3";
|
|
16
|
-
|
|
17
|
-
package google.type;
|
|
18
|
-
|
|
19
|
-
option java_generate_equals_and_hash = true;
|
|
20
|
-
option java_multiple_files = true;
|
|
21
|
-
option java_outer_classname = "DayOfWeekProto";
|
|
22
|
-
option java_package = "com.google.type";
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
// Represents a day of week.
|
|
26
|
-
enum DayOfWeek {
|
|
27
|
-
// The unspecified day-of-week.
|
|
28
|
-
DAY_OF_WEEK_UNSPECIFIED = 0;
|
|
29
|
-
|
|
30
|
-
// The day-of-week of Monday.
|
|
31
|
-
MONDAY = 1;
|
|
32
|
-
|
|
33
|
-
// The day-of-week of Tuesday.
|
|
34
|
-
TUESDAY = 2;
|
|
35
|
-
|
|
36
|
-
// The day-of-week of Wednesday.
|
|
37
|
-
WEDNESDAY = 3;
|
|
38
|
-
|
|
39
|
-
// The day-of-week of Thursday.
|
|
40
|
-
THURSDAY = 4;
|
|
41
|
-
|
|
42
|
-
// The day-of-week of Friday.
|
|
43
|
-
FRIDAY = 5;
|
|
44
|
-
|
|
45
|
-
// The day-of-week of Saturday.
|
|
46
|
-
SATURDAY = 6;
|
|
47
|
-
|
|
48
|
-
// The day-of-week of Sunday.
|
|
49
|
-
SUNDAY = 7;
|
|
50
|
-
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
// Copyright (c) 2015, Google Inc.
|
|
2
|
-
//
|
|
3
|
-
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
-
// you may not use this file except in compliance with the License.
|
|
5
|
-
// You may obtain a copy of the License at
|
|
6
|
-
//
|
|
7
|
-
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
-
//
|
|
9
|
-
// Unless required by applicable law or agreed to in writing, software
|
|
10
|
-
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
-
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
-
// See the License for the specific language governing permissions and
|
|
13
|
-
// limitations under the License.
|
|
14
|
-
|
|
15
|
-
syntax = "proto3";
|
|
16
|
-
|
|
17
|
-
package google.type;
|
|
18
|
-
|
|
19
|
-
option java_generate_equals_and_hash = true;
|
|
20
|
-
option java_multiple_files = true;
|
|
21
|
-
option java_outer_classname = "LatLngProto";
|
|
22
|
-
option java_package = "com.google.type";
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
// An object representing a latitude/longitude pair. This is expressed as a pair
|
|
26
|
-
// of doubles representing degrees latitude and degrees longitude. Unless
|
|
27
|
-
// specified otherwise, this must conform to the
|
|
28
|
-
// <a href="http://www.unoosa.org/pdf/icg/2012/template/WGS_84.pdf">WGS84
|
|
29
|
-
// standard</a>. Values must be within normalized ranges.
|
|
30
|
-
message LatLng {
|
|
31
|
-
// The latitude in degrees. It must be in the range [-90.0, +90.0].
|
|
32
|
-
double latitude = 1;
|
|
33
|
-
|
|
34
|
-
// The longitude in degrees. It must be in the range [-180.0, +180.0].
|
|
35
|
-
double longitude = 2;
|
|
36
|
-
}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
// Copyright (c) 2015, Google Inc.
|
|
2
|
-
//
|
|
3
|
-
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
-
// you may not use this file except in compliance with the License.
|
|
5
|
-
// You may obtain a copy of the License at
|
|
6
|
-
//
|
|
7
|
-
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
-
//
|
|
9
|
-
// Unless required by applicable law or agreed to in writing, software
|
|
10
|
-
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
-
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
-
// See the License for the specific language governing permissions and
|
|
13
|
-
// limitations under the License.
|
|
14
|
-
|
|
15
|
-
syntax = "proto3";
|
|
16
|
-
|
|
17
|
-
package google.type;
|
|
18
|
-
|
|
19
|
-
option java_multiple_files = true;
|
|
20
|
-
option java_outer_classname = "MoneyProto";
|
|
21
|
-
option java_package = "com.google.type";
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
// Represents an amount of money with its currency type.
|
|
25
|
-
message Money {
|
|
26
|
-
// The 3-letter currency code defined in ISO 4217.
|
|
27
|
-
string currency_code = 1;
|
|
28
|
-
|
|
29
|
-
// The whole units of the amount.
|
|
30
|
-
// For example if `currencyCode` is `"USD"`, then 1 unit is one US dollar.
|
|
31
|
-
int64 units = 2;
|
|
32
|
-
|
|
33
|
-
// Number of nano (10^-9) units of the amount.
|
|
34
|
-
// The value must be between -999,999,999 and +999,999,999 inclusive.
|
|
35
|
-
// If `units` is positive, `nanos` must be positive or zero.
|
|
36
|
-
// If `units` is zero, `nanos` can be positive, zero, or negative.
|
|
37
|
-
// If `units` is negative, `nanos` must be negative or zero.
|
|
38
|
-
// For example $-1.75 is represented as `units`=-1 and `nanos`=-750,000,000.
|
|
39
|
-
int32 nanos = 3;
|
|
40
|
-
}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
// Copyright (c) 2015, Google Inc.
|
|
2
|
-
//
|
|
3
|
-
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
-
// you may not use this file except in compliance with the License.
|
|
5
|
-
// You may obtain a copy of the License at
|
|
6
|
-
//
|
|
7
|
-
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
-
//
|
|
9
|
-
// Unless required by applicable law or agreed to in writing, software
|
|
10
|
-
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
-
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
-
// See the License for the specific language governing permissions and
|
|
13
|
-
// limitations under the License.
|
|
14
|
-
|
|
15
|
-
syntax = "proto3";
|
|
16
|
-
|
|
17
|
-
package google.type;
|
|
18
|
-
|
|
19
|
-
option java_generate_equals_and_hash = true;
|
|
20
|
-
option java_multiple_files = true;
|
|
21
|
-
option java_outer_classname = "TimeOfDayProto";
|
|
22
|
-
option java_package = "com.google.type";
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
// Represents a time of day. The date and time zone are either not significant
|
|
26
|
-
// or are specified elsewhere. An API may chose to allow leap seconds. Related
|
|
27
|
-
// types are [google.type.Date][google.type.Date] and [google.protobuf.Timestamp][google.protobuf.Timestamp].
|
|
28
|
-
message TimeOfDay {
|
|
29
|
-
// Hours of day in 24 hour format. Should be from 0 to 23. An API may choose
|
|
30
|
-
// to allow the value "24:00:00" for scenarios like business closing time.
|
|
31
|
-
int32 hours = 1;
|
|
32
|
-
|
|
33
|
-
// Minutes of hour of day. Must be from 0 to 59.
|
|
34
|
-
int32 minutes = 2;
|
|
35
|
-
|
|
36
|
-
// Seconds of minutes of the time. Must normally be from 0 to 59. An API may
|
|
37
|
-
// allow the value 60 if it allows leap-seconds.
|
|
38
|
-
int32 seconds = 3;
|
|
39
|
-
|
|
40
|
-
// Fractions of seconds in nanoseconds. Must be from 0 to 999,999,999.
|
|
41
|
-
int32 nanos = 4;
|
|
42
|
-
}
|
package/sandbox/gapi/test.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
var Suite = require("testjs"),
|
|
2
|
-
ProtoBuf = require("../../dist/ProtoBuf.js");
|
|
3
|
-
|
|
4
|
-
Suite.run({
|
|
5
|
-
"gapi": function(test) {
|
|
6
|
-
var builder = ProtoBuf.loadProtoFile("./test.proto");
|
|
7
|
-
var Value = builder.build("Value");
|
|
8
|
-
var value1 = new Value({
|
|
9
|
-
boolean_value: false
|
|
10
|
-
});
|
|
11
|
-
test.strictEqual(value1.value_type, "boolean_value");
|
|
12
|
-
|
|
13
|
-
var value2 = Value.decode(value1.encode());
|
|
14
|
-
test.strictEqual(value2.value_type, "boolean_value");
|
|
15
|
-
test.done();
|
|
16
|
-
}
|
|
17
|
-
});
|
package/sandbox/gapi/test.proto
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
package MyOptions;
|
|
2
|
-
|
|
3
|
-
import "google/protobuf/descriptor.proto";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
extend google.protobuf.FileOptions {
|
|
7
|
-
optional string file_option = 90000;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
extend google.protobuf.EnumOptions {
|
|
11
|
-
optional string enum_option = 90000;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
extend google.protobuf.EnumValueOptions {
|
|
15
|
-
optional string enum_value_option = 90000;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
extend google.protobuf.MessageOptions {
|
|
19
|
-
optional string message_option = 90000;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
extend google.protobuf.FieldOptions {
|
|
23
|
-
optional string field_option = 90000;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
extend google.protobuf.MethodOptions {
|
|
27
|
-
optional string method_option = 90000;
|
|
28
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
package Sample;
|
|
2
|
-
|
|
3
|
-
import "MyOptions.proto";
|
|
4
|
-
|
|
5
|
-
option (MyOptions.file_option) = "Option!";
|
|
6
|
-
|
|
7
|
-
enum EnumType {
|
|
8
|
-
option (MyOptions.enum_option) = "Option!";
|
|
9
|
-
VALUE = 1 [(MyOptions.enum_value_option) = "Option!"];
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
message MessageType {
|
|
13
|
-
option (MyOptions.message_option) = "Option!";
|
|
14
|
-
required string field = 1 [(MyOptions.field_option) = "Option!"];
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
service ServiceType {
|
|
18
|
-
rpc rpcCall (MessageType) returns (MessageType) {
|
|
19
|
-
option (MyOptions.method_option) = "Option!";
|
|
20
|
-
}
|
|
21
|
-
}
|
package/sandbox/issue146/main.js
DELETED
package/sandbox/issue147/main.js
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
var ProtoBuf = require("../../index.js");
|
|
2
|
-
|
|
3
|
-
var builder = ProtoBuf.loadProtoFile(__dirname+'/commands.proto'),
|
|
4
|
-
Container = builder.build('CommandContainer'),
|
|
5
|
-
SessionCommand = builder.build('SessionCommand'),
|
|
6
|
-
Login = builder.build('Command_Login');
|
|
7
|
-
|
|
8
|
-
var login = new Login({
|
|
9
|
-
"user_name": "demo",
|
|
10
|
-
"password": "abc123"
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
var container = new Container();
|
|
14
|
-
var command = new SessionCommand();
|
|
15
|
-
command.set(".Command_Login.ext", login);
|
|
16
|
-
container.add('session_command', command);
|
|
17
|
-
|
|
18
|
-
var container = new Container({
|
|
19
|
-
'session_command': [new SessionCommand({
|
|
20
|
-
'.Command_Login.ext': login
|
|
21
|
-
})]
|
|
22
|
-
});
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
message SessionCommand {
|
|
2
|
-
enum SessionCommandType {
|
|
3
|
-
LOGIN = 1001;
|
|
4
|
-
}
|
|
5
|
-
extensions 100 to max;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
message Command_Login {
|
|
9
|
-
extend SessionCommand {
|
|
10
|
-
optional Command_Login ext = 1001;
|
|
11
|
-
}
|
|
12
|
-
optional string user_name = 1;
|
|
13
|
-
optional string password = 2;
|
|
14
|
-
}
|
package/sandbox/issue289/A.proto
DELETED
package/sandbox/issue289/B.proto
DELETED
package/sandbox/issue289/main.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
package IAuth;
|
|
2
|
-
|
|
3
|
-
message Name {
|
|
4
|
-
required string name = 1;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
message User {}
|
|
8
|
-
|
|
9
|
-
service Impl {
|
|
10
|
-
rpc user (Name) returns (User) {
|
|
11
|
-
option (core.rpcdoc) = "Get user data.";
|
|
12
|
-
option (core.auth) = true; // user or member of the admin group
|
|
13
|
-
}
|
|
14
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
package RpcMessage;
|
|
2
|
-
message Request {
|
|
3
|
-
enum Type {
|
|
4
|
-
RT_REQ = 1;
|
|
5
|
-
RT_SIGNATURE = 2;
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
optional Type type = 1 [default = RT_REQ];
|
|
9
|
-
optional fixed32 signature = 2 [default = 0];
|
|
10
|
-
optional string instance = 3;
|
|
11
|
-
optional string method = 4;
|
|
12
|
-
optional bytes pbin = 5;
|
|
13
|
-
optional string serverRouteAddr = 6;
|
|
14
|
-
}
|
package/sandbox/issue300/main.js
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
var ProtoBuf = require("../../index.js");
|
|
2
|
-
|
|
3
|
-
var builder = ProtoBuf.loadProtoFile(__dirname+'/Request.proto');
|
|
4
|
-
ProtoBuf.loadProtoFile(__dirname+"/IAuth.proto", builder);
|
|
5
|
-
|
|
6
|
-
var Request = builder.build('RpcMessage.Request'),
|
|
7
|
-
Name = builder.build('IAuth.Name');
|
|
8
|
-
|
|
9
|
-
var name = new Name("name"),
|
|
10
|
-
type = Request.Type.RT_REQ;
|
|
11
|
-
|
|
12
|
-
var msg = new Request({
|
|
13
|
-
type: type,
|
|
14
|
-
signature: 754793469,
|
|
15
|
-
instance : "Auth",
|
|
16
|
-
method : "user",
|
|
17
|
-
pbin : name.encode(),
|
|
18
|
-
serverRouteAddr: "address"
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
// Send it over the wire, but don't use a binary string but base64 here...
|
|
22
|
-
var buffer = msg.encode().toBase64();
|
|
23
|
-
|
|
24
|
-
// Decode it on the receiving end...
|
|
25
|
-
var request = Request.decode(buffer, "base64");
|
|
26
|
-
console.log(request);
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
var ProtoBuf = require('../../'),
|
|
2
|
-
ByteBuffer = ProtoBuf.ByteBuffer;
|
|
3
|
-
var prototext = String(function() {
|
|
4
|
-
/*
|
|
5
|
-
package str;
|
|
6
|
-
|
|
7
|
-
message Value {
|
|
8
|
-
oneof type {
|
|
9
|
-
string string = 1;
|
|
10
|
-
bytes bytes = 2;
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
*/
|
|
14
|
-
}).match(/\/\*([^]*)\*\//)[1];
|
|
15
|
-
|
|
16
|
-
var builder = ProtoBuf.loadProto(prototext);
|
|
17
|
-
var messageValue = builder.build('str.Value');
|
|
18
|
-
var bb = ByteBuffer.wrap([10, 1, 97, 10, 2, 98, 98, 10, 3, 99, 99, 99]);
|
|
19
|
-
bb.printDebug();
|
|
20
|
-
var value1 = messageValue.decode(bb);
|
|
21
|
-
bb.printDebug();
|
|
22
|
-
bb = ByteBuffer.wrap([10, 3, 99, 99, 99]);
|
|
23
|
-
bb.printDebug();
|
|
24
|
-
var value2 = messageValue.decode(bb);
|
|
25
|
-
bb.printDebug();
|
|
26
|
-
console.log('value1: %j', value1);
|
|
27
|
-
console.log('value2: %j', value2);
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
message A {
|
|
2
|
-
repeated group EntryResponse = 1 {
|
|
3
|
-
required ResponseType response_type = 2;
|
|
4
|
-
optional string id_string = 3;
|
|
5
|
-
optional string parent_id_string = 4;
|
|
6
|
-
optional int64 position_in_parent = 5;
|
|
7
|
-
optional int64 version = 6;
|
|
8
|
-
optional string name = 7;
|
|
9
|
-
optional string non_unique_name = 8;
|
|
10
|
-
optional string error_message = 9;
|
|
11
|
-
optional int64 mtime = 10;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
message ResponseType {}
|
|
15
|
-
}
|