protobufjs 4.1.2 → 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.
Files changed (188) hide show
  1. package/.travis.yml +3 -1
  2. package/README.md +147 -25
  3. package/bin/pbjs +2 -2
  4. package/bower.json +3 -3
  5. package/cli/pbjs/targets/amd.js +1 -1
  6. package/cli/pbjs/targets/json.js +9 -1
  7. package/cli/pbjs/targets/proto.js +48 -24
  8. package/cli/pbjs/util.js +1 -1
  9. package/cli/pbjs.js +9 -2
  10. package/dist/README.md +10 -10
  11. package/dist/{ProtoBuf-light.js → protobuf-light.js} +207 -152
  12. package/dist/protobuf-light.min.js +94 -0
  13. package/dist/protobuf-light.min.js.gz +0 -0
  14. package/dist/protobuf-light.min.map +8 -0
  15. package/dist/{ProtoBuf.js → protobuf.js} +265 -175
  16. package/dist/protobuf.min.js +116 -0
  17. package/dist/protobuf.min.js.gz +0 -0
  18. package/dist/protobuf.min.map +8 -0
  19. package/docs/ProtoBuf.Builder.Message.html +1473 -967
  20. package/docs/ProtoBuf.Builder.Service.html +266 -197
  21. package/docs/ProtoBuf.Builder.html +758 -542
  22. package/docs/ProtoBuf.DotProto.Parser.html +223 -161
  23. package/docs/ProtoBuf.DotProto.Tokenizer.html +344 -248
  24. package/docs/ProtoBuf.DotProto.html +20 -12
  25. package/docs/ProtoBuf.Element.html +554 -554
  26. package/docs/ProtoBuf.Map.html +158 -123
  27. package/docs/ProtoBuf.Reflect.Element.html +286 -143
  28. package/docs/ProtoBuf.Reflect.Enum.Value.html +329 -228
  29. package/docs/ProtoBuf.Reflect.Enum.html +757 -537
  30. package/docs/ProtoBuf.Reflect.Extension.html +73 -56
  31. package/docs/ProtoBuf.Reflect.Message.ExtensionField.html +1013 -740
  32. package/docs/ProtoBuf.Reflect.Message.Field.html +926 -649
  33. package/docs/ProtoBuf.Reflect.Message.OneOf.html +327 -245
  34. package/docs/ProtoBuf.Reflect.Message.html +919 -652
  35. package/docs/ProtoBuf.Reflect.Namespace.html +648 -447
  36. package/docs/ProtoBuf.Reflect.Service.Method.html +363 -251
  37. package/docs/ProtoBuf.Reflect.Service.RPCMethod.html +545 -397
  38. package/docs/ProtoBuf.Reflect.Service.html +721 -511
  39. package/docs/ProtoBuf.Reflect.T.html +268 -197
  40. package/docs/ProtoBuf.Reflect.html +20 -12
  41. package/docs/ProtoBuf.Util.html +169 -118
  42. package/docs/ProtoBuf.html +840 -628
  43. package/docs/ProtoBuf.js.html +271 -180
  44. package/docs/fonts/OpenSans-Bold-webfont.eot +0 -0
  45. package/docs/fonts/OpenSans-Bold-webfont.svg +1830 -0
  46. package/docs/fonts/OpenSans-Bold-webfont.woff +0 -0
  47. package/docs/fonts/OpenSans-BoldItalic-webfont.eot +0 -0
  48. package/docs/fonts/OpenSans-BoldItalic-webfont.svg +1830 -0
  49. package/docs/fonts/OpenSans-BoldItalic-webfont.woff +0 -0
  50. package/docs/fonts/OpenSans-Italic-webfont.eot +0 -0
  51. package/docs/fonts/OpenSans-Italic-webfont.svg +1830 -0
  52. package/docs/fonts/OpenSans-Italic-webfont.woff +0 -0
  53. package/docs/fonts/OpenSans-Light-webfont.eot +0 -0
  54. package/docs/fonts/OpenSans-Light-webfont.svg +1831 -0
  55. package/docs/fonts/OpenSans-Light-webfont.woff +0 -0
  56. package/docs/fonts/OpenSans-LightItalic-webfont.eot +0 -0
  57. package/docs/fonts/OpenSans-LightItalic-webfont.svg +1835 -0
  58. package/docs/fonts/OpenSans-LightItalic-webfont.woff +0 -0
  59. package/docs/fonts/OpenSans-Regular-webfont.eot +0 -0
  60. package/docs/fonts/OpenSans-Regular-webfont.svg +1831 -0
  61. package/docs/fonts/OpenSans-Regular-webfont.woff +0 -0
  62. package/docs/index.html +7 -5
  63. package/docs/styles/jsdoc-default.css +95 -75
  64. package/docs/styles/prettify-tomorrow.css +1 -1
  65. package/donate.png +0 -0
  66. package/examples/protoify/json.js +123 -123
  67. package/examples/protoify/json.json +123 -123
  68. package/examples/websocket/server.js +4 -4
  69. package/externs/{ProtoBuf.js → protobuf.js} +933 -922
  70. package/index.js +1 -18
  71. package/jsdoc.json +1 -1
  72. package/package.json +11 -11
  73. package/protobuf.png +0 -0
  74. package/scripts/build.js +53 -58
  75. package/src/ProtoBuf/Builder/Message.js +18 -9
  76. package/src/ProtoBuf/Builder/Service.js +3 -0
  77. package/src/ProtoBuf/Builder.js +34 -10
  78. package/src/ProtoBuf/DotProto/Parser.js +58 -23
  79. package/src/ProtoBuf/Reflect/Element.js +17 -4
  80. package/src/ProtoBuf/Reflect/Message/Field.js +6 -5
  81. package/src/ProtoBuf/Reflect/Message.js +9 -4
  82. package/src/ProtoBuf/Util.js +116 -116
  83. package/src/bower.json +2 -2
  84. package/src/google/protobuf/descriptor.json +55 -15
  85. package/src/{ProtoBuf.js → protobuf.js} +0 -0
  86. package/src/wrap.js +4 -4
  87. package/tests/bench.txt +373 -373
  88. package/tests/complex.json +8 -1
  89. package/tests/custom-options.json +169 -169
  90. package/tests/extend.json +71 -71
  91. package/tests/imports-weak.proto +7 -0
  92. package/tests/imports.json +83 -83
  93. package/tests/nodeunit-browser/nodeunit.css +70 -70
  94. package/tests/nodeunit-browser/nodeunit.js +2108 -2108
  95. package/tests/options.json +32 -32
  96. package/tests/proto2js/Bar.json +46 -46
  97. package/tests/suite.js +107 -82
  98. package/ProtoBuf.png +0 -0
  99. package/dist/ProtoBuf-light.min.js +0 -87
  100. package/dist/ProtoBuf-light.min.js.gz +0 -0
  101. package/dist/ProtoBuf-light.min.map +0 -8
  102. package/dist/ProtoBuf.min.js +0 -108
  103. package/dist/ProtoBuf.min.js.gz +0 -0
  104. package/dist/ProtoBuf.min.map +0 -8
  105. package/externs/ByteBuffer.js +0 -767
  106. package/externs/Long.js +0 -328
  107. package/sandbox/gapi/googleapis/google/api/annotations.proto +0 -29
  108. package/sandbox/gapi/googleapis/google/api/http.proto +0 -245
  109. package/sandbox/gapi/googleapis/google/datastore/v1beta3/datastore.proto +0 -281
  110. package/sandbox/gapi/googleapis/google/datastore/v1beta3/entity.proto +0 -189
  111. package/sandbox/gapi/googleapis/google/datastore/v1beta3/query.proto +0 -281
  112. package/sandbox/gapi/googleapis/google/longrunning/operations.proto +0 -144
  113. package/sandbox/gapi/googleapis/google/protobuf/any.proto +0 -98
  114. package/sandbox/gapi/googleapis/google/protobuf/any_test.proto +0 -41
  115. package/sandbox/gapi/googleapis/google/protobuf/api.proto +0 -201
  116. package/sandbox/gapi/googleapis/google/protobuf/descriptor.proto +0 -773
  117. package/sandbox/gapi/googleapis/google/protobuf/duration.proto +0 -95
  118. package/sandbox/gapi/googleapis/google/protobuf/empty.proto +0 -50
  119. package/sandbox/gapi/googleapis/google/protobuf/field_mask.proto +0 -167
  120. package/sandbox/gapi/googleapis/google/protobuf/map_lite_unittest.proto +0 -130
  121. package/sandbox/gapi/googleapis/google/protobuf/map_proto2_unittest.proto +0 -60
  122. package/sandbox/gapi/googleapis/google/protobuf/map_unittest.proto +0 -129
  123. package/sandbox/gapi/googleapis/google/protobuf/map_unittest_proto3.proto +0 -120
  124. package/sandbox/gapi/googleapis/google/protobuf/source_context.proto +0 -47
  125. package/sandbox/gapi/googleapis/google/protobuf/struct.proto +0 -94
  126. package/sandbox/gapi/googleapis/google/protobuf/timestamp.proto +0 -107
  127. package/sandbox/gapi/googleapis/google/protobuf/type.proto +0 -176
  128. package/sandbox/gapi/googleapis/google/protobuf/unittest.proto +0 -878
  129. package/sandbox/gapi/googleapis/google/protobuf/unittest_arena.proto +0 -46
  130. package/sandbox/gapi/googleapis/google/protobuf/unittest_custom_options.proto +0 -394
  131. package/sandbox/gapi/googleapis/google/protobuf/unittest_drop_unknown_fields.proto +0 -58
  132. package/sandbox/gapi/googleapis/google/protobuf/unittest_embed_optimize_for.proto +0 -51
  133. package/sandbox/gapi/googleapis/google/protobuf/unittest_empty.proto +0 -38
  134. package/sandbox/gapi/googleapis/google/protobuf/unittest_enormous_descriptor.proto +0 -1048
  135. package/sandbox/gapi/googleapis/google/protobuf/unittest_import.proto +0 -66
  136. package/sandbox/gapi/googleapis/google/protobuf/unittest_import_lite.proto +0 -52
  137. package/sandbox/gapi/googleapis/google/protobuf/unittest_import_proto3.proto +0 -68
  138. package/sandbox/gapi/googleapis/google/protobuf/unittest_import_public.proto +0 -41
  139. package/sandbox/gapi/googleapis/google/protobuf/unittest_import_public_lite.proto +0 -43
  140. package/sandbox/gapi/googleapis/google/protobuf/unittest_import_public_proto3.proto +0 -42
  141. package/sandbox/gapi/googleapis/google/protobuf/unittest_lite.proto +0 -385
  142. package/sandbox/gapi/googleapis/google/protobuf/unittest_lite_imports_nonlite.proto +0 -44
  143. package/sandbox/gapi/googleapis/google/protobuf/unittest_mset.proto +0 -82
  144. package/sandbox/gapi/googleapis/google/protobuf/unittest_mset_wire_format.proto +0 -52
  145. package/sandbox/gapi/googleapis/google/protobuf/unittest_no_arena.proto +0 -202
  146. package/sandbox/gapi/googleapis/google/protobuf/unittest_no_arena_import.proto +0 -37
  147. package/sandbox/gapi/googleapis/google/protobuf/unittest_no_arena_lite.proto +0 -42
  148. package/sandbox/gapi/googleapis/google/protobuf/unittest_no_field_presence.proto +0 -138
  149. package/sandbox/gapi/googleapis/google/protobuf/unittest_no_generic_services.proto +0 -54
  150. package/sandbox/gapi/googleapis/google/protobuf/unittest_optimize_for.proto +0 -67
  151. package/sandbox/gapi/googleapis/google/protobuf/unittest_preserve_unknown_enum.proto +0 -71
  152. package/sandbox/gapi/googleapis/google/protobuf/unittest_preserve_unknown_enum2.proto +0 -50
  153. package/sandbox/gapi/googleapis/google/protobuf/unittest_proto3.proto +0 -388
  154. package/sandbox/gapi/googleapis/google/protobuf/unittest_proto3_arena.proto +0 -206
  155. package/sandbox/gapi/googleapis/google/protobuf/unittest_well_known_types.proto +0 -112
  156. package/sandbox/gapi/googleapis/google/protobuf/unknown_enum_test.proto +0 -62
  157. package/sandbox/gapi/googleapis/google/protobuf/wrappers.proto +0 -117
  158. package/sandbox/gapi/googleapis/google/rpc/code.proto +0 -190
  159. package/sandbox/gapi/googleapis/google/rpc/error_details.proto +0 -157
  160. package/sandbox/gapi/googleapis/google/rpc/status.proto +0 -90
  161. package/sandbox/gapi/googleapis/google/type/color.proto +0 -163
  162. package/sandbox/gapi/googleapis/google/type/date.proto +0 -43
  163. package/sandbox/gapi/googleapis/google/type/dayofweek.proto +0 -50
  164. package/sandbox/gapi/googleapis/google/type/latlng.proto +0 -36
  165. package/sandbox/gapi/googleapis/google/type/money.proto +0 -40
  166. package/sandbox/gapi/googleapis/google/type/timeofday.proto +0 -42
  167. package/sandbox/gapi/test.js +0 -17
  168. package/sandbox/gapi/test.proto +0 -12
  169. package/sandbox/issue146/MyOptions.proto +0 -28
  170. package/sandbox/issue146/Sample.proto +0 -21
  171. package/sandbox/issue146/main.js +0 -3
  172. package/sandbox/issue147/enum.proto +0 -8
  173. package/sandbox/issue147/main.js +0 -3
  174. package/sandbox/issue182/commands.proto +0 -10
  175. package/sandbox/issue182/execute.js +0 -22
  176. package/sandbox/issue182/session_commands.proto +0 -14
  177. package/sandbox/issue289/A.proto +0 -8
  178. package/sandbox/issue289/B.proto +0 -8
  179. package/sandbox/issue289/common.proto +0 -5
  180. package/sandbox/issue289/main.js +0 -7
  181. package/sandbox/issue300/IAuth.proto +0 -14
  182. package/sandbox/issue300/Request.proto +0 -14
  183. package/sandbox/issue300/main.js +0 -26
  184. package/sandbox/issue42/innerextend.proto +0 -18
  185. package/sandbox/issue42/main.js +0 -8
  186. package/sandbox/issue42/outerextend.proto +0 -17
  187. package/tests/gtfs-realtime.proto +0 -552
  188. package/webpack.config.js +0 -9
@@ -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
- }
@@ -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
- });
@@ -1,12 +0,0 @@
1
- syntax = "proto3";
2
-
3
- message Entity {
4
- map<string, Value> properties = 3;
5
- }
6
-
7
- message Value {
8
- oneof value_type {
9
- // A boolean value.
10
- bool boolean_value = 1;
11
- }
12
- }
@@ -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
- }
@@ -1,3 +0,0 @@
1
- var ProtoBuf = require("../../index.js");
2
-
3
- var root = ProtoBuf.loadProtoFile(__dirname+"/Sample.proto").build();
@@ -1,8 +0,0 @@
1
- enum _test {
2
- VALUE1 = 1;
3
- VALUE2 = 2;
4
- }
5
-
6
- message TestMessage {
7
- required _test test = 1;
8
- }
@@ -1,3 +0,0 @@
1
- var ProtoBuf = require("../../index.js");
2
-
3
- var root = ProtoBuf.loadProtoFile(__dirname+"/enum.proto").build();
@@ -1,10 +0,0 @@
1
- import "session_commands.proto";
2
-
3
- message CommandContainer {
4
- optional uint64 cmd_id = 1;
5
-
6
- optional uint32 game_id = 10;
7
- optional uint32 room_id = 20;
8
-
9
- repeated SessionCommand session_command = 100;
10
- }
@@ -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
- }
@@ -1,8 +0,0 @@
1
- package sys;
2
- import "common.proto";
3
-
4
- message A {
5
- extend BaseRequest {
6
- optional A cmd = 101;
7
- }
8
- }
@@ -1,8 +0,0 @@
1
- package stock;
2
- import "common.proto";
3
-
4
- message B {
5
- extend sys.BaseRequest {
6
- optional B cmd = 102;
7
- }
8
- }
@@ -1,5 +0,0 @@
1
- package sys;
2
-
3
- message BaseRequest {
4
- extensions 100 to max;
5
- }
@@ -1,7 +0,0 @@
1
- var ProtoBuf = require("../../");
2
-
3
- var builder = ProtoBuf.newBuilder({ convertFieldsToCamelCase: true });
4
- ProtoBuf.loadProtoFile("A.proto", builder);
5
- ProtoBuf.loadProtoFile("B.proto", builder);
6
-
7
- builder.build();
@@ -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
- }
@@ -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,18 +0,0 @@
1
- message Foo {
2
- optional string blah = 1;
3
- extensions 1000 to max;
4
- }
5
-
6
- message PersonA {
7
- extend Foo {
8
- optional PersonA persona = 1001;
9
- }
10
- required string name = 1;
11
- }
12
-
13
- message PersonB {
14
- extend Foo {
15
- optional PersonB personb = 1002;
16
- }
17
- required int32 bleh = 1;
18
- }
@@ -1,8 +0,0 @@
1
- var ProtoBuf = require("../../index.js");
2
-
3
- var root = ProtoBuf.loadProtoFile(__dirname+"/innerextend.proto").build();
4
- console.log(root);
5
-
6
- root = ProtoBuf.loadProtoFile(__dirname+"/outerextend.proto").build();
7
- console.log(root);
8
-
@@ -1,17 +0,0 @@
1
- message Foo {
2
- optional string blah = 1;
3
- extensions 1000 to max;
4
- }
5
-
6
- message PersonA {
7
- required string name = 1;
8
- }
9
-
10
- message PersonB {
11
- required int32 bleh = 1;
12
- }
13
-
14
- extend Foo {
15
- optional PersonA persona = 1001;
16
- optional PersonB personb = 1002;
17
- }