stage-browser 0.0.0-stage → 0.1.1
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/README.md +136 -2
- package/build/icon.icns +0 -0
- package/build/icon.png +0 -0
- package/dist/bin/stage.js +111 -0
- package/dist/main/cli-args.js +28 -0
- package/dist/main/context-menu.js +68 -0
- package/dist/main/context.js +2 -0
- package/dist/main/extensions.js +78 -0
- package/dist/main/ipc.js +90 -0
- package/dist/main/main.js +279 -0
- package/dist/main/menu.js +140 -0
- package/dist/main/reveal.js +155 -0
- package/dist/main/selftest.js +490 -0
- package/dist/main/store.js +85 -0
- package/dist/main/suggest.js +43 -0
- package/dist/main/tabs.js +324 -0
- package/dist/main/url.js +38 -0
- package/dist/main/window.js +68 -0
- package/dist/preload/extension-compat.js +163 -0
- package/dist/preload/ui-preload.js +33 -0
- package/dist/shared/contract.js +6 -0
- package/dist/ui/app.js +653 -0
- package/dist/ui/index.html +41 -0
- package/dist/ui/mock.js +479 -0
- package/dist/ui/newtab.html +69 -0
- package/dist/ui/styles.css +410 -0
- package/node_modules/@types/chrome/LICENSE +21 -0
- package/node_modules/@types/chrome/README.md +15 -0
- package/node_modules/@types/chrome/chrome-cast/index.d.ts +1156 -0
- package/node_modules/@types/chrome/har-format/index.d.ts +6 -0
- package/node_modules/@types/chrome/index.d.ts +13786 -0
- package/node_modules/@types/chrome/package.json +99 -0
- package/node_modules/@types/filesystem/LICENSE +21 -0
- package/node_modules/@types/filesystem/README.md +15 -0
- package/node_modules/@types/filesystem/index.d.ts +564 -0
- package/node_modules/@types/filesystem/package.json +26 -0
- package/node_modules/@types/filewriter/LICENSE +21 -0
- package/node_modules/@types/filewriter/README.md +15 -0
- package/node_modules/@types/filewriter/index.d.ts +166 -0
- package/node_modules/@types/filewriter/package.json +25 -0
- package/node_modules/@types/har-format/LICENSE +21 -0
- package/node_modules/@types/har-format/README.md +15 -0
- package/node_modules/@types/har-format/index.d.ts +938 -0
- package/node_modules/@types/har-format/package.json +31 -0
- package/node_modules/adm-zip/LICENSE +21 -0
- package/node_modules/adm-zip/README.md +90 -0
- package/node_modules/adm-zip/adm-zip.js +1020 -0
- package/node_modules/adm-zip/headers/entryHeader.js +396 -0
- package/node_modules/adm-zip/headers/index.js +2 -0
- package/node_modules/adm-zip/headers/mainHeader.js +177 -0
- package/node_modules/adm-zip/methods/deflater.js +33 -0
- package/node_modules/adm-zip/methods/index.js +3 -0
- package/node_modules/adm-zip/methods/inflater.js +64 -0
- package/node_modules/adm-zip/methods/zipcrypto.js +175 -0
- package/node_modules/adm-zip/package.json +56 -0
- package/node_modules/adm-zip/types.d.ts +223 -0
- package/node_modules/adm-zip/util/constants.js +142 -0
- package/node_modules/adm-zip/util/decoder.js +5 -0
- package/node_modules/adm-zip/util/errors.js +66 -0
- package/node_modules/adm-zip/util/fattr.js +76 -0
- package/node_modules/adm-zip/util/index.js +5 -0
- package/node_modules/adm-zip/util/utils.js +481 -0
- package/node_modules/adm-zip/zipEntry.js +415 -0
- package/node_modules/adm-zip/zipFile.js +466 -0
- package/node_modules/debug/LICENSE +20 -0
- package/node_modules/debug/README.md +481 -0
- package/node_modules/debug/package.json +64 -0
- package/node_modules/debug/src/browser.js +272 -0
- package/node_modules/debug/src/common.js +292 -0
- package/node_modules/debug/src/index.js +10 -0
- package/node_modules/debug/src/node.js +263 -0
- package/node_modules/electron-chrome-web-store/README.md +143 -0
- package/node_modules/electron-chrome-web-store/dist/chrome-web-store.preload.js +299 -0
- package/node_modules/electron-chrome-web-store/dist/cjs/browser/index.js +1674 -0
- package/node_modules/electron-chrome-web-store/dist/esm/browser/index.mjs +950 -0
- package/node_modules/electron-chrome-web-store/dist/types/browser/api.d.ts +2 -0
- package/node_modules/electron-chrome-web-store/dist/types/browser/crx3.d.ts +20 -0
- package/node_modules/electron-chrome-web-store/dist/types/browser/id.d.ts +9 -0
- package/node_modules/electron-chrome-web-store/dist/types/browser/index.d.ts +62 -0
- package/node_modules/electron-chrome-web-store/dist/types/browser/installer.d.ts +29 -0
- package/node_modules/electron-chrome-web-store/dist/types/browser/loader.d.ts +18 -0
- package/node_modules/electron-chrome-web-store/dist/types/browser/types.d.ts +21 -0
- package/node_modules/electron-chrome-web-store/dist/types/browser/updater.d.ts +6 -0
- package/node_modules/electron-chrome-web-store/dist/types/browser/utils.d.ts +4 -0
- package/node_modules/electron-chrome-web-store/dist/types/common/constants.d.ts +44 -0
- package/node_modules/electron-chrome-web-store/dist/types/renderer/chrome-web-store.preload.d.ts +1 -0
- package/node_modules/electron-chrome-web-store/package.json +43 -0
- package/node_modules/ms/index.js +162 -0
- package/node_modules/ms/license.md +21 -0
- package/node_modules/ms/package.json +38 -0
- package/node_modules/ms/readme.md +59 -0
- package/node_modules/pbf/LICENSE +27 -0
- package/node_modules/pbf/README.md +293 -0
- package/node_modules/pbf/bin/pbf +17 -0
- package/node_modules/pbf/compile.js +441 -0
- package/node_modules/pbf/dist/pbf-dev.js +838 -0
- package/node_modules/pbf/dist/pbf.js +1 -0
- package/node_modules/pbf/index.d.ts +206 -0
- package/node_modules/pbf/index.js +830 -0
- package/node_modules/pbf/package.json +63 -0
- package/node_modules/protocol-buffers-schema/.travis.yml +7 -0
- package/node_modules/protocol-buffers-schema/LICENSE +21 -0
- package/node_modules/protocol-buffers-schema/README.md +122 -0
- package/node_modules/protocol-buffers-schema/example.js +11 -0
- package/node_modules/protocol-buffers-schema/example.proto +13 -0
- package/node_modules/protocol-buffers-schema/index.js +6 -0
- package/node_modules/protocol-buffers-schema/package.json +31 -0
- package/node_modules/protocol-buffers-schema/parse.js +769 -0
- package/node_modules/protocol-buffers-schema/stringify.js +206 -0
- package/node_modules/protocol-buffers-schema/test/fixtures/basic.json +90 -0
- package/node_modules/protocol-buffers-schema/test/fixtures/basic.proto +11 -0
- package/node_modules/protocol-buffers-schema/test/fixtures/comments.json +99 -0
- package/node_modules/protocol-buffers-schema/test/fixtures/comments.proto +19 -0
- package/node_modules/protocol-buffers-schema/test/fixtures/complex.json +125 -0
- package/node_modules/protocol-buffers-schema/test/fixtures/complex.proto +30 -0
- package/node_modules/protocol-buffers-schema/test/fixtures/enum.json +42 -0
- package/node_modules/protocol-buffers-schema/test/fixtures/enum.proto +8 -0
- package/node_modules/protocol-buffers-schema/test/fixtures/escaped-quotes.json +32 -0
- package/node_modules/protocol-buffers-schema/test/fixtures/escaped-quotes.proto +3 -0
- package/node_modules/protocol-buffers-schema/test/fixtures/extend.json +167 -0
- package/node_modules/protocol-buffers-schema/test/fixtures/extend.proto +19 -0
- package/node_modules/protocol-buffers-schema/test/fixtures/import.json +30 -0
- package/node_modules/protocol-buffers-schema/test/fixtures/import.proto +6 -0
- package/node_modules/protocol-buffers-schema/test/fixtures/map.json +33 -0
- package/node_modules/protocol-buffers-schema/test/fixtures/map.proto +3 -0
- package/node_modules/protocol-buffers-schema/test/fixtures/no-tags.proto +8 -0
- package/node_modules/protocol-buffers-schema/test/fixtures/oneof.json +41 -0
- package/node_modules/protocol-buffers-schema/test/fixtures/oneof.proto +6 -0
- package/node_modules/protocol-buffers-schema/test/fixtures/option.json +364 -0
- package/node_modules/protocol-buffers-schema/test/fixtures/option.proto +72 -0
- package/node_modules/protocol-buffers-schema/test/fixtures/options.json +47 -0
- package/node_modules/protocol-buffers-schema/test/fixtures/options.proto +8 -0
- package/node_modules/protocol-buffers-schema/test/fixtures/pheromon-trajectories.proto +8 -0
- package/node_modules/protocol-buffers-schema/test/fixtures/reserved.json +55 -0
- package/node_modules/protocol-buffers-schema/test/fixtures/reserved.proto +17 -0
- package/node_modules/protocol-buffers-schema/test/fixtures/search.json +30 -0
- package/node_modules/protocol-buffers-schema/test/fixtures/search.proto +5 -0
- package/node_modules/protocol-buffers-schema/test/fixtures/service.json +108 -0
- package/node_modules/protocol-buffers-schema/test/fixtures/service.proto +30 -0
- package/node_modules/protocol-buffers-schema/test/fixtures/valid-packed.proto +35 -0
- package/node_modules/protocol-buffers-schema/test/fixtures/version.json +90 -0
- package/node_modules/protocol-buffers-schema/test/fixtures/version.proto +13 -0
- package/node_modules/protocol-buffers-schema/test/index.js +157 -0
- package/node_modules/protocol-buffers-schema/tokenize.js +56 -0
- package/node_modules/resolve-protobuf-schema/.travis.yml +3 -0
- package/node_modules/resolve-protobuf-schema/LICENSE +21 -0
- package/node_modules/resolve-protobuf-schema/README.md +49 -0
- package/node_modules/resolve-protobuf-schema/index.js +50 -0
- package/node_modules/resolve-protobuf-schema/package.json +25 -0
- package/node_modules/resolve-protobuf-schema/test/a.proto +5 -0
- package/node_modules/resolve-protobuf-schema/test/b.proto +5 -0
- package/node_modules/resolve-protobuf-schema/test/c.proto +3 -0
- package/node_modules/resolve-protobuf-schema/test/index.js +49 -0
- package/package.json +64 -4
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import "google/protobuf/descriptor.proto";
|
|
2
|
+
|
|
3
|
+
extend google.protobuf.FileOptions {
|
|
4
|
+
optional string my_file_option = 50000;
|
|
5
|
+
}
|
|
6
|
+
extend google.protobuf.MessageOptions {
|
|
7
|
+
optional int32 my_message_option = 50001;
|
|
8
|
+
}
|
|
9
|
+
extend google.protobuf.FieldOptions {
|
|
10
|
+
optional float my_field_option = 50002;
|
|
11
|
+
}
|
|
12
|
+
extend google.protobuf.EnumOptions {
|
|
13
|
+
optional bool my_enum_option = 50003;
|
|
14
|
+
}
|
|
15
|
+
extend google.protobuf.EnumValueOptions {
|
|
16
|
+
optional uint32 my_enum_value_option = 50004;
|
|
17
|
+
}
|
|
18
|
+
extend google.protobuf.ServiceOptions {
|
|
19
|
+
optional MyEnum my_service_option = 50005;
|
|
20
|
+
}
|
|
21
|
+
extend google.protobuf.MethodOptions {
|
|
22
|
+
optional MyMessage my_method_option = 50006;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
option (my_file_option) = "Hello world!";
|
|
26
|
+
|
|
27
|
+
message MyMessage {
|
|
28
|
+
option (my_message_option) = 1234;
|
|
29
|
+
|
|
30
|
+
optional int32 foo = 1 [(my_field_option) = 4.5];
|
|
31
|
+
optional string bar = 2;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
enum MyEnum {
|
|
35
|
+
option (my_enum_option) = true;
|
|
36
|
+
|
|
37
|
+
FOO = 1 [(my_enum_value_option) = 321];
|
|
38
|
+
BAR = 2;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
message RequestType {}
|
|
42
|
+
message ResponseType {}
|
|
43
|
+
|
|
44
|
+
service MyService {
|
|
45
|
+
option (my_service_option) = FOO;
|
|
46
|
+
option (my_service_option_map) = {
|
|
47
|
+
foo: "bar";
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
rpc MyMethod(RequestType) returns(ResponseType) {
|
|
51
|
+
// Note: my_method_option has type MyMessage. We can set each field
|
|
52
|
+
// within it using a separate "option" line.
|
|
53
|
+
option (my_method_option).foo = 567;
|
|
54
|
+
option (my_method_option).bar = "Some string";
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
message FooOptions {
|
|
59
|
+
optional int32 opt1 = 1;
|
|
60
|
+
optional string opt2 = 2;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
extend google.protobuf.FieldOptions {
|
|
64
|
+
optional FooOptions foo_options = 1234;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// usage:
|
|
68
|
+
message Bar {
|
|
69
|
+
optional int32 a = 1 [(foo_options).opt1 = 123, (foo_options).opt2 = "baz"];
|
|
70
|
+
// alternative aggregate syntax (uses TextFormat):
|
|
71
|
+
optional int32 b = 2 [(foo_options) = { opt1: 123 opt2: "baz" }];
|
|
72
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
{
|
|
2
|
+
"syntax": 3,
|
|
3
|
+
"package": null,
|
|
4
|
+
"imports": [],
|
|
5
|
+
"enums": [],
|
|
6
|
+
"messages": [{
|
|
7
|
+
"name": "OptionFields",
|
|
8
|
+
"enums": [],
|
|
9
|
+
"extends": [],
|
|
10
|
+
"messages": [],
|
|
11
|
+
"options": {},
|
|
12
|
+
"fields": [{
|
|
13
|
+
"name": "type",
|
|
14
|
+
"type": "string",
|
|
15
|
+
"tag": 2,
|
|
16
|
+
"map": null,
|
|
17
|
+
"oneof": null,
|
|
18
|
+
"required": false,
|
|
19
|
+
"repeated": false,
|
|
20
|
+
"options": {
|
|
21
|
+
"mylist": "\"some,values,[here]\""
|
|
22
|
+
}
|
|
23
|
+
}],
|
|
24
|
+
"extensions": null
|
|
25
|
+
}, {
|
|
26
|
+
"name": "MoreOptionFields",
|
|
27
|
+
"enums": [],
|
|
28
|
+
"extends": [],
|
|
29
|
+
"messages": [],
|
|
30
|
+
"options": {},
|
|
31
|
+
"fields": [{
|
|
32
|
+
"name": "values",
|
|
33
|
+
"type": "string",
|
|
34
|
+
"tag": 3,
|
|
35
|
+
"map": null,
|
|
36
|
+
"oneof": null,
|
|
37
|
+
"required": false,
|
|
38
|
+
"repeated": false,
|
|
39
|
+
"options": {
|
|
40
|
+
"mylist2": "'[more, values], [here]'"
|
|
41
|
+
}
|
|
42
|
+
}],
|
|
43
|
+
"extensions": null
|
|
44
|
+
}],
|
|
45
|
+
"options": {},
|
|
46
|
+
"extends": []
|
|
47
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
{
|
|
2
|
+
"syntax": 3,
|
|
3
|
+
"package": null,
|
|
4
|
+
"imports": [],
|
|
5
|
+
"enums": [
|
|
6
|
+
{
|
|
7
|
+
"name": "ReservedEnum",
|
|
8
|
+
"values": {
|
|
9
|
+
"x": {
|
|
10
|
+
"value": 1,
|
|
11
|
+
"options": []
|
|
12
|
+
},
|
|
13
|
+
"y": {
|
|
14
|
+
"value": 10,
|
|
15
|
+
"options": []
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
"options": {}
|
|
19
|
+
}
|
|
20
|
+
],
|
|
21
|
+
"messages": [
|
|
22
|
+
{
|
|
23
|
+
"name": "Reserved",
|
|
24
|
+
"extensions": null,
|
|
25
|
+
"enums": [],
|
|
26
|
+
"extends": [],
|
|
27
|
+
"messages": [],
|
|
28
|
+
"options": {},
|
|
29
|
+
"fields": [
|
|
30
|
+
{
|
|
31
|
+
"name": "x",
|
|
32
|
+
"type": "string",
|
|
33
|
+
"tag": 1,
|
|
34
|
+
"map": null,
|
|
35
|
+
"oneof": null,
|
|
36
|
+
"required": false,
|
|
37
|
+
"repeated": false,
|
|
38
|
+
"options": {}
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"name": "y",
|
|
42
|
+
"type": "string",
|
|
43
|
+
"tag": 10,
|
|
44
|
+
"map": null,
|
|
45
|
+
"oneof": null,
|
|
46
|
+
"required": false,
|
|
47
|
+
"repeated": false,
|
|
48
|
+
"options": {}
|
|
49
|
+
}
|
|
50
|
+
]
|
|
51
|
+
}
|
|
52
|
+
],
|
|
53
|
+
"options": {},
|
|
54
|
+
"extends": []
|
|
55
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
syntax = "proto3";
|
|
2
|
+
|
|
3
|
+
message Reserved {
|
|
4
|
+
string x = 1;
|
|
5
|
+
reserved 2, 3;
|
|
6
|
+
reserved 5 to 9;
|
|
7
|
+
reserved "foo", "bar";
|
|
8
|
+
string y = 10;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
enum ReservedEnum {
|
|
12
|
+
x = 1;
|
|
13
|
+
reserved 2, 3;
|
|
14
|
+
reserved 5 to 9;
|
|
15
|
+
reserved "foo", "bar";
|
|
16
|
+
y = 10;
|
|
17
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{
|
|
2
|
+
"syntax": 3,
|
|
3
|
+
"package": null,
|
|
4
|
+
"imports": ["./result.proto"],
|
|
5
|
+
"enums": [],
|
|
6
|
+
"extends": [],
|
|
7
|
+
"messages": [
|
|
8
|
+
{
|
|
9
|
+
"name": "SearchResponse",
|
|
10
|
+
"extensions": null,
|
|
11
|
+
"enums": [],
|
|
12
|
+
"extends": [],
|
|
13
|
+
"options": {},
|
|
14
|
+
"messages": [],
|
|
15
|
+
"fields": [
|
|
16
|
+
{
|
|
17
|
+
"name": "result",
|
|
18
|
+
"type": "Result",
|
|
19
|
+
"tag": 1,
|
|
20
|
+
"map": null,
|
|
21
|
+
"oneof": null,
|
|
22
|
+
"required": false,
|
|
23
|
+
"repeated": true,
|
|
24
|
+
"options": {}
|
|
25
|
+
}
|
|
26
|
+
]
|
|
27
|
+
}
|
|
28
|
+
],
|
|
29
|
+
"options":{}
|
|
30
|
+
}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
{
|
|
2
|
+
"syntax": 3,
|
|
3
|
+
"package": null,
|
|
4
|
+
"imports": [],
|
|
5
|
+
"enums": [],
|
|
6
|
+
"extends": [],
|
|
7
|
+
"messages": [
|
|
8
|
+
{
|
|
9
|
+
"name": "HelloRequest",
|
|
10
|
+
"extensions": null,
|
|
11
|
+
"enums": [],
|
|
12
|
+
"extends": [],
|
|
13
|
+
"options": {},
|
|
14
|
+
"messages": [],
|
|
15
|
+
"fields": [
|
|
16
|
+
{
|
|
17
|
+
"name": "greeting",
|
|
18
|
+
"type": "string",
|
|
19
|
+
"tag": 1,
|
|
20
|
+
"map": null,
|
|
21
|
+
"oneof": null,
|
|
22
|
+
"required": false,
|
|
23
|
+
"repeated": false,
|
|
24
|
+
"options": {}
|
|
25
|
+
}
|
|
26
|
+
]
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"name": "HelloResponse",
|
|
30
|
+
"extensions": null,
|
|
31
|
+
"enums": [],
|
|
32
|
+
"extends": [],
|
|
33
|
+
"messages": [],
|
|
34
|
+
"options": {},
|
|
35
|
+
"fields": [
|
|
36
|
+
{
|
|
37
|
+
"name": "reply",
|
|
38
|
+
"type": "string",
|
|
39
|
+
"tag": 1,
|
|
40
|
+
"map": null,
|
|
41
|
+
"oneof": null,
|
|
42
|
+
"required": true,
|
|
43
|
+
"repeated": false,
|
|
44
|
+
"options": {}
|
|
45
|
+
}
|
|
46
|
+
]
|
|
47
|
+
}
|
|
48
|
+
],
|
|
49
|
+
"services": [
|
|
50
|
+
{
|
|
51
|
+
"name": "HelloService",
|
|
52
|
+
"methods": [
|
|
53
|
+
{
|
|
54
|
+
"name": "SayHello",
|
|
55
|
+
"input_type": "HelloRequest",
|
|
56
|
+
"output_type": "HelloResponse",
|
|
57
|
+
"client_streaming": false,
|
|
58
|
+
"server_streaming": false,
|
|
59
|
+
"options": {
|
|
60
|
+
"google.api.http": {
|
|
61
|
+
"get": "/v1/say-hello/echo/{greeting}",
|
|
62
|
+
"additional_bindings": [
|
|
63
|
+
{
|
|
64
|
+
"post": "/v2/say-hello",
|
|
65
|
+
"body": "greeting"
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
"get": "/v2/say-hello"
|
|
69
|
+
}
|
|
70
|
+
]
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
"name": "LotsOfReplies",
|
|
76
|
+
"input_type": "HelloRequest",
|
|
77
|
+
"output_type": "HelloResponse",
|
|
78
|
+
"client_streaming": false,
|
|
79
|
+
"server_streaming": true,
|
|
80
|
+
"options": {}
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
"name": "LotsOfGreetings",
|
|
84
|
+
"input_type": "HelloRequest",
|
|
85
|
+
"output_type": "HelloResponse",
|
|
86
|
+
"client_streaming": true,
|
|
87
|
+
"server_streaming": false,
|
|
88
|
+
"options": {
|
|
89
|
+
"google.api.http": {
|
|
90
|
+
"post": "/v1/lots-of-greetings",
|
|
91
|
+
"body": "*"
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
"name": "BidiHello",
|
|
97
|
+
"input_type": "HelloRequest",
|
|
98
|
+
"output_type": "HelloResponse",
|
|
99
|
+
"client_streaming": true,
|
|
100
|
+
"server_streaming": true,
|
|
101
|
+
"options": {}
|
|
102
|
+
}
|
|
103
|
+
],
|
|
104
|
+
"options": {}
|
|
105
|
+
}
|
|
106
|
+
],
|
|
107
|
+
"options": {}
|
|
108
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
message HelloRequest {
|
|
2
|
+
optional string greeting = 1;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
message HelloResponse {
|
|
6
|
+
required string reply = 1;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
service HelloService {
|
|
10
|
+
rpc SayHello(HelloRequest) returns (HelloResponse) {
|
|
11
|
+
option (google.api.http) = {
|
|
12
|
+
get: "/v1/say-hello/echo/{greeting}"
|
|
13
|
+
additional_bindings {
|
|
14
|
+
post: "/v2/say-hello"
|
|
15
|
+
body: "greeting"
|
|
16
|
+
}
|
|
17
|
+
additional_bindings {
|
|
18
|
+
get: "/v2/say-hello"
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
rpc LotsOfReplies(HelloRequest) returns (stream HelloResponse);
|
|
23
|
+
rpc LotsOfGreetings(stream HelloRequest) returns (HelloResponse) {
|
|
24
|
+
option (google.api.http) = {
|
|
25
|
+
post: "/v1/lots-of-greetings"
|
|
26
|
+
body: "*"
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
rpc BidiHello(stream HelloRequest) returns (stream HelloResponse);
|
|
30
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
message EnumCarrying{
|
|
2
|
+
enum E{
|
|
3
|
+
A = 0;
|
|
4
|
+
B = 1;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
message ValidPacked {
|
|
10
|
+
// varint wire types
|
|
11
|
+
repeated int32 f1 = 1 [packed = true];
|
|
12
|
+
repeated int64 f2 = 2 [packed = true];
|
|
13
|
+
repeated uint32 f3 = 3 [packed = true];
|
|
14
|
+
repeated uint64 f4 = 4 [packed = true];
|
|
15
|
+
repeated sint32 f5 = 5 [packed = true];
|
|
16
|
+
repeated sint64 f6 = 6 [packed = true];
|
|
17
|
+
repeated bool f7 = 7 [packed = true];
|
|
18
|
+
enum Corpus {
|
|
19
|
+
UNIVERSAL = 0;
|
|
20
|
+
WEB = 1;
|
|
21
|
+
}
|
|
22
|
+
repeated Corpus f8 = 8 [packed = true];
|
|
23
|
+
repeated EnumCarrying.E f9 = 9 [packed = true];
|
|
24
|
+
|
|
25
|
+
// 64-bit wire types
|
|
26
|
+
repeated fixed64 f10 = 10 [packed = true];
|
|
27
|
+
repeated sfixed64 f11 = 11 [packed = true];
|
|
28
|
+
repeated double f12 = 12 [packed = true];
|
|
29
|
+
|
|
30
|
+
// 32-bit wire types
|
|
31
|
+
repeated fixed32 f13 = 13 [packed = true];
|
|
32
|
+
repeated sfixed32 f14 = 14 [packed = true];
|
|
33
|
+
repeated float f15 = 15 [packed = true];
|
|
34
|
+
}
|
|
35
|
+
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
{
|
|
2
|
+
"syntax": 2,
|
|
3
|
+
"package": null,
|
|
4
|
+
"imports": [],
|
|
5
|
+
"enums": [],
|
|
6
|
+
"extends": [],
|
|
7
|
+
"messages": [
|
|
8
|
+
{
|
|
9
|
+
"name": "Point",
|
|
10
|
+
"enums": [],
|
|
11
|
+
"extends": [],
|
|
12
|
+
"messages": [],
|
|
13
|
+
"extensions": null,
|
|
14
|
+
"options": {},
|
|
15
|
+
"fields": [
|
|
16
|
+
{
|
|
17
|
+
"name": "x",
|
|
18
|
+
"type": "int32",
|
|
19
|
+
"tag": 1,
|
|
20
|
+
"map": null,
|
|
21
|
+
"oneof": null,
|
|
22
|
+
"required": true,
|
|
23
|
+
"repeated": false,
|
|
24
|
+
"options": {}
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"name": "y",
|
|
28
|
+
"type": "int32",
|
|
29
|
+
"tag": 2,
|
|
30
|
+
"map": null,
|
|
31
|
+
"oneof": null,
|
|
32
|
+
"required": true,
|
|
33
|
+
"repeated": false,
|
|
34
|
+
"options": {}
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
"name": "label",
|
|
38
|
+
"type": "string",
|
|
39
|
+
"tag": 3,
|
|
40
|
+
"map": null,
|
|
41
|
+
"oneof": null,
|
|
42
|
+
"required": false,
|
|
43
|
+
"repeated": false,
|
|
44
|
+
"options": {}
|
|
45
|
+
}
|
|
46
|
+
]
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
"name": "Line",
|
|
50
|
+
"enums": [],
|
|
51
|
+
"extends": [],
|
|
52
|
+
"extensions": null,
|
|
53
|
+
"options": {},
|
|
54
|
+
"messages": [],
|
|
55
|
+
"fields": [
|
|
56
|
+
{
|
|
57
|
+
"name": "start",
|
|
58
|
+
"type": "Point",
|
|
59
|
+
"tag": 1,
|
|
60
|
+
"map": null,
|
|
61
|
+
"oneof": null,
|
|
62
|
+
"required": true,
|
|
63
|
+
"repeated": false,
|
|
64
|
+
"options": {}
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
"name": "end",
|
|
68
|
+
"type": "Point",
|
|
69
|
+
"tag": 2,
|
|
70
|
+
"map": null,
|
|
71
|
+
"oneof": null,
|
|
72
|
+
"required": true,
|
|
73
|
+
"repeated": false,
|
|
74
|
+
"options": {}
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
"name": "label",
|
|
78
|
+
"type": "string",
|
|
79
|
+
"tag": 3,
|
|
80
|
+
"map": null,
|
|
81
|
+
"oneof": null,
|
|
82
|
+
"required": false,
|
|
83
|
+
"repeated": false,
|
|
84
|
+
"options": {}
|
|
85
|
+
}
|
|
86
|
+
]
|
|
87
|
+
}
|
|
88
|
+
],
|
|
89
|
+
"options":{}
|
|
90
|
+
}
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
var tape = require('tape')
|
|
2
|
+
var path = require('path')
|
|
3
|
+
var fs = require('fs')
|
|
4
|
+
var schema = require('../')
|
|
5
|
+
|
|
6
|
+
var fixture = function (name) {
|
|
7
|
+
return fs.readFileSync(path.join(__dirname, 'fixtures', name), 'utf-8')
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
tape('basic parse', function (t) {
|
|
11
|
+
t.same(schema.parse(fixture('basic.proto')), require('./fixtures/basic.json'))
|
|
12
|
+
t.end()
|
|
13
|
+
})
|
|
14
|
+
|
|
15
|
+
tape('basic parse + stringify', function (t) {
|
|
16
|
+
var syntax = 'syntax = "proto3";\n\n'
|
|
17
|
+
t.same(schema.stringify(schema.parse(fixture('basic.proto'))), syntax + fixture('basic.proto'))
|
|
18
|
+
t.end()
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
tape('complex parse', function (t) {
|
|
22
|
+
t.same(schema.parse(fixture('complex.proto')), require('./fixtures/complex.json'))
|
|
23
|
+
t.end()
|
|
24
|
+
})
|
|
25
|
+
|
|
26
|
+
tape('complex parse + stringify', function (t) {
|
|
27
|
+
var syntax = 'syntax = "proto3";\n\n'
|
|
28
|
+
t.same(schema.stringify(schema.parse(fixture('complex.proto'))), syntax + fixture('complex.proto'))
|
|
29
|
+
t.end()
|
|
30
|
+
})
|
|
31
|
+
|
|
32
|
+
tape('throws on invalid', function (t) {
|
|
33
|
+
t.plan(2)
|
|
34
|
+
try {
|
|
35
|
+
schema.parse('hello world')
|
|
36
|
+
} catch (err) {
|
|
37
|
+
t.ok(true, 'should fail')
|
|
38
|
+
}
|
|
39
|
+
try {
|
|
40
|
+
schema.parse('message Foo { lol }')
|
|
41
|
+
} catch (err) {
|
|
42
|
+
t.ok(true, 'should fail')
|
|
43
|
+
}
|
|
44
|
+
})
|
|
45
|
+
|
|
46
|
+
tape('comments parse', function (t) {
|
|
47
|
+
t.same(schema.parse(fixture('comments.proto')), require('./fixtures/comments.json'))
|
|
48
|
+
t.end()
|
|
49
|
+
})
|
|
50
|
+
|
|
51
|
+
tape('schema with imports', function (t) {
|
|
52
|
+
t.same(schema.parse(fixture('search.proto')), require('./fixtures/search.json'))
|
|
53
|
+
t.end()
|
|
54
|
+
})
|
|
55
|
+
|
|
56
|
+
tape('schema with imports loaded by path', function (t) {
|
|
57
|
+
t.same(schema.parse(fixture('search.proto')), require('./fixtures/search.json'))
|
|
58
|
+
t.end()
|
|
59
|
+
})
|
|
60
|
+
|
|
61
|
+
tape('schema with extends', function (t) {
|
|
62
|
+
t.same(schema.parse(fixture('extend.proto')), require('./fixtures/extend.json'))
|
|
63
|
+
t.end()
|
|
64
|
+
})
|
|
65
|
+
|
|
66
|
+
tape('comparing extended and not extended schema', function (t) {
|
|
67
|
+
var sch = schema.parse(fixture('extend.proto'))
|
|
68
|
+
t.same(sch.messages.MsgNormal, sch.messages.MsgExtend)
|
|
69
|
+
t.end()
|
|
70
|
+
})
|
|
71
|
+
|
|
72
|
+
tape('schema with oneof', function (t) {
|
|
73
|
+
t.same(schema.parse(fixture('oneof.proto')), require('./fixtures/oneof.json'))
|
|
74
|
+
t.end()
|
|
75
|
+
})
|
|
76
|
+
|
|
77
|
+
tape('schema with map', function (t) {
|
|
78
|
+
t.same(schema.parse(fixture('map.proto')), require('./fixtures/map.json'))
|
|
79
|
+
t.end()
|
|
80
|
+
})
|
|
81
|
+
|
|
82
|
+
tape('schema with syntax version', function (t) {
|
|
83
|
+
t.same(schema.parse(fixture('version.proto')), require('./fixtures/version.json'))
|
|
84
|
+
t.end()
|
|
85
|
+
})
|
|
86
|
+
|
|
87
|
+
tape('throws on misplaced syntax version', function (t) {
|
|
88
|
+
t.plan(1)
|
|
89
|
+
try {
|
|
90
|
+
schema.parse('message Foo { required int32 a = 1; }\n syntax = "proto3"')
|
|
91
|
+
} catch (err) {
|
|
92
|
+
t.ok(true, 'should fail')
|
|
93
|
+
}
|
|
94
|
+
})
|
|
95
|
+
|
|
96
|
+
tape('schema with reserved characters in options', function (t) {
|
|
97
|
+
t.same(schema.parse(fixture('options.proto')), require('./fixtures/options.json'))
|
|
98
|
+
t.end()
|
|
99
|
+
})
|
|
100
|
+
|
|
101
|
+
tape('service parse', function (t) {
|
|
102
|
+
t.same(schema.parse(fixture('service.proto')), require('./fixtures/service.json'))
|
|
103
|
+
t.end()
|
|
104
|
+
})
|
|
105
|
+
|
|
106
|
+
tape('service parse + stringify', function (t) {
|
|
107
|
+
var syntax = 'syntax = "proto3";\n\n'
|
|
108
|
+
t.same(schema.stringify(schema.parse(fixture('service.proto'))), syntax + fixture('service.proto'))
|
|
109
|
+
t.end()
|
|
110
|
+
})
|
|
111
|
+
|
|
112
|
+
tape('import parse + stringify', function (t) {
|
|
113
|
+
var syntax = 'syntax = "proto3";\n\n'
|
|
114
|
+
t.same(schema.stringify(schema.parse(fixture('search.proto'))), syntax + fixture('search.proto'))
|
|
115
|
+
t.end()
|
|
116
|
+
})
|
|
117
|
+
|
|
118
|
+
tape('enums with options', function (t) {
|
|
119
|
+
t.same(schema.parse(fixture('enum.proto')), require('./fixtures/enum.json'))
|
|
120
|
+
t.end()
|
|
121
|
+
})
|
|
122
|
+
|
|
123
|
+
tape('fail on no tags', function (t) {
|
|
124
|
+
t.throws(function () {
|
|
125
|
+
schema.parse(fixture('no-tags.proto'))
|
|
126
|
+
})
|
|
127
|
+
t.end()
|
|
128
|
+
})
|
|
129
|
+
|
|
130
|
+
tape('reserved', function (t) {
|
|
131
|
+
t.same(schema.parse(fixture('reserved.proto')), require('./fixtures/reserved.json'))
|
|
132
|
+
t.end()
|
|
133
|
+
})
|
|
134
|
+
|
|
135
|
+
tape('varint, 64-bit and 32-bit wire types can be packed', function (t) {
|
|
136
|
+
t.doesNotThrow(function () {
|
|
137
|
+
schema.parse(fixture('valid-packed.proto'))
|
|
138
|
+
}, 'should not throw')
|
|
139
|
+
t.end()
|
|
140
|
+
})
|
|
141
|
+
|
|
142
|
+
tape('non-primitive packed should throw', function (t) {
|
|
143
|
+
t.throws(function () {
|
|
144
|
+
schema.parse(fixture('pheromon-trajectories.proto'))
|
|
145
|
+
}, 'should throw')
|
|
146
|
+
t.end()
|
|
147
|
+
})
|
|
148
|
+
|
|
149
|
+
tape('custom options parse', function (t) {
|
|
150
|
+
t.same(schema.parse(fixture('option.proto')), require('./fixtures/option.json'))
|
|
151
|
+
t.end()
|
|
152
|
+
})
|
|
153
|
+
|
|
154
|
+
tape('escaped quotes in option value parse', function (t) {
|
|
155
|
+
t.same(schema.parse(fixture('escaped-quotes.proto')), require('./fixtures/escaped-quotes.json'))
|
|
156
|
+
t.end()
|
|
157
|
+
})
|