@gravity-ui/gateway 1.0.0

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 (64) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +269 -0
  3. package/bin/patch.js +13 -0
  4. package/build/components/grpc.d.ts +24 -0
  5. package/build/components/grpc.js +664 -0
  6. package/build/components/mixed.d.ts +11 -0
  7. package/build/components/mixed.js +66 -0
  8. package/build/components/rest.d.ts +7 -0
  9. package/build/components/rest.js +291 -0
  10. package/build/constants.d.ts +46 -0
  11. package/build/constants.js +101 -0
  12. package/build/index.d.ts +11 -0
  13. package/build/index.js +285 -0
  14. package/build/models/common.d.ts +241 -0
  15. package/build/models/common.js +8 -0
  16. package/build/models/context.d.ts +22 -0
  17. package/build/models/context.js +2 -0
  18. package/build/models/error.d.ts +12 -0
  19. package/build/models/error.js +2 -0
  20. package/build/utils/axios.d.ts +2 -0
  21. package/build/utils/axios.js +24 -0
  22. package/build/utils/common.d.ts +15 -0
  23. package/build/utils/common.js +50 -0
  24. package/build/utils/create-context-api.d.ts +4 -0
  25. package/build/utils/create-context-api.js +45 -0
  26. package/build/utils/grpc-reflection.d.ts +22 -0
  27. package/build/utils/grpc-reflection.js +56 -0
  28. package/build/utils/grpc.d.ts +15 -0
  29. package/build/utils/grpc.js +55 -0
  30. package/build/utils/overrideEndpoints/index.d.ts +2 -0
  31. package/build/utils/overrideEndpoints/index.js +4 -0
  32. package/build/utils/overrideEndpoints/overrideEndpoints.d.ts +17 -0
  33. package/build/utils/overrideEndpoints/overrideEndpoints.js +103 -0
  34. package/build/utils/parse-error.d.ts +32 -0
  35. package/build/utils/parse-error.js +224 -0
  36. package/build/utils/redact-sensitive-headers.d.ts +4 -0
  37. package/build/utils/redact-sensitive-headers.js +16 -0
  38. package/build/utils/typed-api.d.ts +2 -0
  39. package/build/utils/typed-api.js +7 -0
  40. package/build/utils/validate.d.ts +4 -0
  41. package/build/utils/validate.js +56 -0
  42. package/package.json +91 -0
  43. package/patches/grpc-reflection-js+0.1.2.patch +87 -0
  44. package/patches/protobufjs+6.11.4.patch +121 -0
  45. package/proto/google/api/annotations.proto +31 -0
  46. package/proto/google/api/http.proto +291 -0
  47. package/proto/google/protobuf/any.proto +158 -0
  48. package/proto/google/protobuf/api.proto +208 -0
  49. package/proto/google/protobuf/compiler/plugin.proto +183 -0
  50. package/proto/google/protobuf/descriptor.proto +909 -0
  51. package/proto/google/protobuf/duration.proto +116 -0
  52. package/proto/google/protobuf/empty.proto +52 -0
  53. package/proto/google/protobuf/field_mask.proto +245 -0
  54. package/proto/google/protobuf/source_context.proto +48 -0
  55. package/proto/google/protobuf/struct.proto +95 -0
  56. package/proto/google/protobuf/timestamp.proto +147 -0
  57. package/proto/google/protobuf/type.proto +187 -0
  58. package/proto/google/protobuf/wrappers.proto +123 -0
  59. package/proto/google/rpc/README.md +5 -0
  60. package/proto/google/rpc/code.proto +186 -0
  61. package/proto/google/rpc/error_details.proto +200 -0
  62. package/proto/google/rpc/status.proto +92 -0
  63. package/proto/google/type/dayofweek.proto +51 -0
  64. package/proto/google/type/timeofday.proto +45 -0
@@ -0,0 +1,200 @@
1
+ // Copyright 2017 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.rpc;
18
+
19
+ import "google/protobuf/duration.proto";
20
+
21
+ option go_package = "google.golang.org/genproto/googleapis/rpc/errdetails;errdetails";
22
+ option java_multiple_files = true;
23
+ option java_outer_classname = "ErrorDetailsProto";
24
+ option java_package = "com.google.rpc";
25
+ option objc_class_prefix = "RPC";
26
+
27
+
28
+ // Describes when the clients can retry a failed request. Clients could ignore
29
+ // the recommendation here or retry when this information is missing from error
30
+ // responses.
31
+ //
32
+ // It's always recommended that clients should use exponential backoff when
33
+ // retrying.
34
+ //
35
+ // Clients should wait until `retry_delay` amount of time has passed since
36
+ // receiving the error response before retrying. If retrying requests also
37
+ // fail, clients should use an exponential backoff scheme to gradually increase
38
+ // the delay between retries based on `retry_delay`, until either a maximum
39
+ // number of retires have been reached or a maximum retry delay cap has been
40
+ // reached.
41
+ message RetryInfo {
42
+ // Clients should wait at least this long between retrying the same request.
43
+ google.protobuf.Duration retry_delay = 1;
44
+ }
45
+
46
+ // Describes additional debugging info.
47
+ message DebugInfo {
48
+ // The stack trace entries indicating where the error occurred.
49
+ repeated string stack_entries = 1;
50
+
51
+ // Additional debugging information provided by the server.
52
+ string detail = 2;
53
+ }
54
+
55
+ // Describes how a quota check failed.
56
+ //
57
+ // For example if a daily limit was exceeded for the calling project,
58
+ // a service could respond with a QuotaFailure detail containing the project
59
+ // id and the description of the quota limit that was exceeded. If the
60
+ // calling project hasn't enabled the service in the developer console, then
61
+ // a service could respond with the project id and set `service_disabled`
62
+ // to true.
63
+ //
64
+ // Also see RetryDetail and Help types for other details about handling a
65
+ // quota failure.
66
+ message QuotaFailure {
67
+ // A message type used to describe a single quota violation. For example, a
68
+ // daily quota or a custom quota that was exceeded.
69
+ message Violation {
70
+ // The subject on which the quota check failed.
71
+ // For example, "clientip:<ip address of client>" or "project:<Google
72
+ // developer project id>".
73
+ string subject = 1;
74
+
75
+ // A description of how the quota check failed. Clients can use this
76
+ // description to find more about the quota configuration in the service's
77
+ // public documentation, or find the relevant quota limit to adjust through
78
+ // developer console.
79
+ //
80
+ // For example: "Service disabled" or "Daily Limit for read operations
81
+ // exceeded".
82
+ string description = 2;
83
+ }
84
+
85
+ // Describes all quota violations.
86
+ repeated Violation violations = 1;
87
+ }
88
+
89
+ // Describes what preconditions have failed.
90
+ //
91
+ // For example, if an RPC failed because it required the Terms of Service to be
92
+ // acknowledged, it could list the terms of service violation in the
93
+ // PreconditionFailure message.
94
+ message PreconditionFailure {
95
+ // A message type used to describe a single precondition failure.
96
+ message Violation {
97
+ // The type of PreconditionFailure. We recommend using a service-specific
98
+ // enum type to define the supported precondition violation types. For
99
+ // example, "TOS" for "Terms of Service violation".
100
+ string type = 1;
101
+
102
+ // The subject, relative to the type, that failed.
103
+ // For example, "google.com/cloud" relative to the "TOS" type would
104
+ // indicate which terms of service is being referenced.
105
+ string subject = 2;
106
+
107
+ // A description of how the precondition failed. Developers can use this
108
+ // description to understand how to fix the failure.
109
+ //
110
+ // For example: "Terms of service not accepted".
111
+ string description = 3;
112
+ }
113
+
114
+ // Describes all precondition violations.
115
+ repeated Violation violations = 1;
116
+ }
117
+
118
+ // Describes violations in a client request. This error type focuses on the
119
+ // syntactic aspects of the request.
120
+ message BadRequest {
121
+ // A message type used to describe a single bad request field.
122
+ message FieldViolation {
123
+ // A path leading to a field in the request body. The value will be a
124
+ // sequence of dot-separated identifiers that identify a protocol buffer
125
+ // field. E.g., "field_violations.field" would identify this field.
126
+ string field = 1;
127
+
128
+ // A description of why the request element is bad.
129
+ string description = 2;
130
+ }
131
+
132
+ // Describes all violations in a client request.
133
+ repeated FieldViolation field_violations = 1;
134
+ }
135
+
136
+ // Contains metadata about the request that clients can attach when filing a bug
137
+ // or providing other forms of feedback.
138
+ message RequestInfo {
139
+ // An opaque string that should only be interpreted by the service generating
140
+ // it. For example, it can be used to identify requests in the service's logs.
141
+ string request_id = 1;
142
+
143
+ // Any data that was used to serve this request. For example, an encrypted
144
+ // stack trace that can be sent back to the service provider for debugging.
145
+ string serving_data = 2;
146
+ }
147
+
148
+ // Describes the resource that is being accessed.
149
+ message ResourceInfo {
150
+ // A name for the type of resource being accessed, e.g. "sql table",
151
+ // "cloud storage bucket", "file", "Google calendar"; or the type URL
152
+ // of the resource: e.g. "type.googleapis.com/google.pubsub.v1.Topic".
153
+ string resource_type = 1;
154
+
155
+ // The name of the resource being accessed. For example, a shared calendar
156
+ // name: "example.com_4fghdhgsrgh@group.calendar.google.com", if the current
157
+ // error is [google.rpc.Code.PERMISSION_DENIED][google.rpc.Code.PERMISSION_DENIED].
158
+ string resource_name = 2;
159
+
160
+ // The owner of the resource (optional).
161
+ // For example, "user:<owner email>" or "project:<Google developer project
162
+ // id>".
163
+ string owner = 3;
164
+
165
+ // Describes what error is encountered when accessing this resource.
166
+ // For example, updating a cloud project may require the `writer` permission
167
+ // on the developer console project.
168
+ string description = 4;
169
+ }
170
+
171
+ // Provides links to documentation or for performing an out of band action.
172
+ //
173
+ // For example, if a quota check failed with an error indicating the calling
174
+ // project hasn't enabled the accessed service, this can contain a URL pointing
175
+ // directly to the right place in the developer console to flip the bit.
176
+ message Help {
177
+ // Describes a URL link.
178
+ message Link {
179
+ // Describes what the link offers.
180
+ string description = 1;
181
+
182
+ // The URL of the link.
183
+ string url = 2;
184
+ }
185
+
186
+ // URL(s) pointing to additional information on handling the current error.
187
+ repeated Link links = 1;
188
+ }
189
+
190
+ // Provides a localized error message that is safe to return to the user
191
+ // which can be attached to an RPC error.
192
+ message LocalizedMessage {
193
+ // The locale used following the specification defined at
194
+ // http://www.rfc-editor.org/rfc/bcp/bcp47.txt.
195
+ // Examples are: "en-US", "fr-CH", "es-MX"
196
+ string locale = 1;
197
+
198
+ // The localized error message in the above locale.
199
+ string message = 2;
200
+ }
@@ -0,0 +1,92 @@
1
+ // Copyright 2017 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.rpc;
18
+
19
+ import "google/protobuf/any.proto";
20
+
21
+ option go_package = "google.golang.org/genproto/googleapis/rpc/status;status";
22
+ option java_multiple_files = true;
23
+ option java_outer_classname = "StatusProto";
24
+ option java_package = "com.google.rpc";
25
+ option objc_class_prefix = "RPC";
26
+
27
+
28
+ // The `Status` type defines a logical error model that is suitable for different
29
+ // programming environments, including REST APIs and RPC APIs. It is used by
30
+ // [gRPC](https://github.com/grpc). The error model is designed to be:
31
+ //
32
+ // - Simple to use and understand for most users
33
+ // - Flexible enough to meet unexpected needs
34
+ //
35
+ // # Overview
36
+ //
37
+ // The `Status` message contains three pieces of data: error code, error message,
38
+ // and error details. The error code should be an enum value of
39
+ // [google.rpc.Code][google.rpc.Code], but it may accept additional error codes if needed. The
40
+ // error message should be a developer-facing English message that helps
41
+ // developers *understand* and *resolve* the error. If a localized user-facing
42
+ // error message is needed, put the localized message in the error details or
43
+ // localize it in the client. The optional error details may contain arbitrary
44
+ // information about the error. There is a predefined set of error detail types
45
+ // in the package `google.rpc` that can be used for common error conditions.
46
+ //
47
+ // # Language mapping
48
+ //
49
+ // The `Status` message is the logical representation of the error model, but it
50
+ // is not necessarily the actual wire format. When the `Status` message is
51
+ // exposed in different client libraries and different wire protocols, it can be
52
+ // mapped differently. For example, it will likely be mapped to some exceptions
53
+ // in Java, but more likely mapped to some error codes in C.
54
+ //
55
+ // # Other uses
56
+ //
57
+ // The error model and the `Status` message can be used in a variety of
58
+ // environments, either with or without APIs, to provide a
59
+ // consistent developer experience across different environments.
60
+ //
61
+ // Example uses of this error model include:
62
+ //
63
+ // - Partial errors. If a service needs to return partial errors to the client,
64
+ // it may embed the `Status` in the normal response to indicate the partial
65
+ // errors.
66
+ //
67
+ // - Workflow errors. A typical workflow has multiple steps. Each step may
68
+ // have a `Status` message for error reporting.
69
+ //
70
+ // - Batch operations. If a client uses batch request and batch response, the
71
+ // `Status` message should be used directly inside batch response, one for
72
+ // each error sub-response.
73
+ //
74
+ // - Asynchronous operations. If an API call embeds asynchronous operation
75
+ // results in its response, the status of those operations should be
76
+ // represented directly using the `Status` message.
77
+ //
78
+ // - Logging. If some API errors are stored in logs, the message `Status` could
79
+ // be used directly after any stripping needed for security/privacy reasons.
80
+ message Status {
81
+ // The status code, which should be an enum value of [google.rpc.Code][google.rpc.Code].
82
+ int32 code = 1;
83
+
84
+ // A developer-facing error message, which should be in English. Any
85
+ // user-facing error message should be localized and sent in the
86
+ // [google.rpc.Status.details][google.rpc.Status.details] field, or localized by the client.
87
+ string message = 2;
88
+
89
+ // A list of messages that carry the error details. There is a common set of
90
+ // message types for APIs to use.
91
+ repeated google.protobuf.Any details = 3;
92
+ }
@@ -0,0 +1,51 @@
1
+ // Copyright 2016 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 go_package = "google.golang.org/genproto/googleapis/type/dayofweek;dayofweek";
20
+ option java_multiple_files = true;
21
+ option java_outer_classname = "DayOfWeekProto";
22
+ option java_package = "com.google.type";
23
+ option objc_class_prefix = "GTP";
24
+
25
+
26
+ // Represents a day of week.
27
+ enum DayOfWeek {
28
+ // The unspecified day-of-week.
29
+ DAY_OF_WEEK_UNSPECIFIED = 0;
30
+
31
+ // The day-of-week of Monday.
32
+ MONDAY = 1;
33
+
34
+ // The day-of-week of Tuesday.
35
+ TUESDAY = 2;
36
+
37
+ // The day-of-week of Wednesday.
38
+ WEDNESDAY = 3;
39
+
40
+ // The day-of-week of Thursday.
41
+ THURSDAY = 4;
42
+
43
+ // The day-of-week of Friday.
44
+ FRIDAY = 5;
45
+
46
+ // The day-of-week of Saturday.
47
+ SATURDAY = 6;
48
+
49
+ // The day-of-week of Sunday.
50
+ SUNDAY = 7;
51
+ }
@@ -0,0 +1,45 @@
1
+ // Copyright 2019 Google LLC.
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
+
16
+ syntax = "proto3";
17
+
18
+ package google.type;
19
+
20
+ option cc_enable_arenas = true;
21
+ option go_package = "google.golang.org/genproto/googleapis/type/timeofday;timeofday";
22
+ option java_multiple_files = true;
23
+ option java_outer_classname = "TimeOfDayProto";
24
+ option java_package = "com.google.type";
25
+ option objc_class_prefix = "GTP";
26
+
27
+
28
+ // Represents a time of day. The date and time zone are either not significant
29
+ // or are specified elsewhere. An API may choose to allow leap seconds. Related
30
+ // types are [google.type.Date][google.type.Date] and `google.protobuf.Timestamp`.
31
+ message TimeOfDay {
32
+ // Hours of day in 24 hour format. Should be from 0 to 23. An API may choose
33
+ // to allow the value "24:00:00" for scenarios like business closing time.
34
+ int32 hours = 1;
35
+
36
+ // Minutes of hour of day. Must be from 0 to 59.
37
+ int32 minutes = 2;
38
+
39
+ // Seconds of minutes of the time. Must normally be from 0 to 59. An API may
40
+ // allow the value 60 if it allows leap-seconds.
41
+ int32 seconds = 3;
42
+
43
+ // Fractions of seconds in nanoseconds. Must be from 0 to 999,999,999.
44
+ int32 nanos = 4;
45
+ }