@restatedev/restate-sdk 0.7.3-worker → 0.8.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.
Files changed (231) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +29 -51
  3. package/dist/clients/workflow_client.d.ts +77 -0
  4. package/dist/clients/workflow_client.d.ts.map +1 -0
  5. package/dist/clients/workflow_client.js +172 -0
  6. package/dist/clients/workflow_client.js.map +1 -0
  7. package/dist/connection/buffered_connection.js +44 -0
  8. package/dist/connection/buffered_connection.js.map +1 -0
  9. package/dist/connection/connection.js +13 -0
  10. package/dist/connection/connection.js.map +1 -0
  11. package/dist/connection/embedded_connection.js +59 -0
  12. package/dist/connection/embedded_connection.js.map +1 -0
  13. package/dist/connection/http_connection.js +203 -0
  14. package/dist/connection/http_connection.js.map +1 -0
  15. package/dist/connection/lambda_connection.js +58 -0
  16. package/dist/connection/lambda_connection.js.map +1 -0
  17. package/dist/{restate_context.d.ts → context.d.ts} +239 -170
  18. package/dist/context.d.ts.map +1 -0
  19. package/dist/context.js +113 -0
  20. package/dist/context.js.map +1 -0
  21. package/dist/{restate_context_impl.d.ts → context_impl.d.ts} +26 -30
  22. package/dist/context_impl.d.ts.map +1 -0
  23. package/dist/context_impl.js +439 -0
  24. package/dist/context_impl.js.map +1 -0
  25. package/dist/embedded/api.d.ts +2 -2
  26. package/dist/embedded/api.d.ts.map +1 -1
  27. package/dist/embedded/api.js +35 -0
  28. package/dist/embedded/api.js.map +1 -0
  29. package/dist/embedded/handler.d.ts +2 -2
  30. package/dist/embedded/handler.d.ts.map +1 -1
  31. package/dist/embedded/handler.js +26 -0
  32. package/dist/embedded/handler.js.map +1 -0
  33. package/dist/embedded/http2_remote.js +91 -0
  34. package/dist/embedded/http2_remote.js.map +1 -0
  35. package/dist/embedded/invocation.d.ts.map +1 -1
  36. package/dist/embedded/invocation.js +94 -0
  37. package/dist/embedded/invocation.js.map +1 -0
  38. package/dist/endpoint/endpoint_impl.d.ts +35 -0
  39. package/dist/endpoint/endpoint_impl.d.ts.map +1 -0
  40. package/dist/endpoint/endpoint_impl.js +405 -0
  41. package/dist/endpoint/endpoint_impl.js.map +1 -0
  42. package/dist/endpoint/http2_handler.d.ts +11 -0
  43. package/dist/endpoint/http2_handler.d.ts.map +1 -0
  44. package/dist/endpoint/http2_handler.js +119 -0
  45. package/dist/endpoint/http2_handler.js.map +1 -0
  46. package/dist/endpoint/lambda_handler.d.ts +15 -0
  47. package/dist/endpoint/lambda_handler.d.ts.map +1 -0
  48. package/dist/endpoint/lambda_handler.js +144 -0
  49. package/dist/endpoint/lambda_handler.js.map +1 -0
  50. package/dist/endpoint.d.ts +161 -0
  51. package/dist/endpoint.d.ts.map +1 -0
  52. package/dist/endpoint.js +22 -0
  53. package/dist/endpoint.js.map +1 -0
  54. package/dist/generated/dev/restate/events.js +371 -0
  55. package/dist/generated/dev/restate/events.js.map +1 -0
  56. package/dist/generated/dev/restate/ext.js +215 -0
  57. package/dist/generated/dev/restate/ext.js.map +1 -0
  58. package/dist/generated/google/protobuf/descriptor.js +6676 -0
  59. package/dist/generated/google/protobuf/descriptor.js.map +1 -0
  60. package/dist/generated/google/protobuf/empty.js +107 -0
  61. package/dist/generated/google/protobuf/empty.js.map +1 -0
  62. package/dist/generated/google/protobuf/struct.js +754 -0
  63. package/dist/generated/google/protobuf/struct.js.map +1 -0
  64. package/dist/generated/proto/discovery.js +364 -0
  65. package/dist/generated/proto/discovery.js.map +1 -0
  66. package/dist/generated/proto/dynrpc.js +668 -0
  67. package/dist/generated/proto/dynrpc.js.map +1 -0
  68. package/dist/generated/proto/javascript.d.ts +13 -0
  69. package/dist/generated/proto/javascript.d.ts.map +1 -1
  70. package/dist/generated/proto/javascript.js +416 -0
  71. package/dist/generated/proto/javascript.js.map +1 -0
  72. package/dist/generated/proto/protocol.d.ts +43 -0
  73. package/dist/generated/proto/protocol.d.ts.map +1 -1
  74. package/dist/generated/proto/protocol.js +2641 -0
  75. package/dist/generated/proto/protocol.js.map +1 -0
  76. package/dist/generated/proto/services.js +1535 -0
  77. package/dist/generated/proto/services.js.map +1 -0
  78. package/dist/generated/proto/test.js +321 -0
  79. package/dist/generated/proto/test.js.map +1 -0
  80. package/dist/invocation.d.ts +4 -1
  81. package/dist/invocation.d.ts.map +1 -1
  82. package/dist/invocation.js +157 -0
  83. package/dist/invocation.js.map +1 -0
  84. package/dist/io/decoder.d.ts +1 -0
  85. package/dist/io/decoder.d.ts.map +1 -1
  86. package/dist/io/decoder.js +140 -0
  87. package/dist/io/decoder.js.map +1 -0
  88. package/dist/io/encoder.d.ts +1 -2
  89. package/dist/io/encoder.d.ts.map +1 -1
  90. package/dist/io/encoder.js +68 -0
  91. package/dist/io/encoder.js.map +1 -0
  92. package/dist/journal.d.ts +13 -4
  93. package/dist/journal.d.ts.map +1 -1
  94. package/dist/journal.js +405 -0
  95. package/dist/journal.js.map +1 -0
  96. package/dist/local_state_store.d.ts +5 -3
  97. package/dist/local_state_store.d.ts.map +1 -1
  98. package/dist/local_state_store.js +82 -0
  99. package/dist/local_state_store.js.map +1 -0
  100. package/dist/logger.d.ts +19 -0
  101. package/dist/logger.d.ts.map +1 -0
  102. package/dist/logger.js +90 -0
  103. package/dist/logger.js.map +1 -0
  104. package/dist/promise_combinator_tracker.d.ts +29 -0
  105. package/dist/promise_combinator_tracker.d.ts.map +1 -0
  106. package/dist/promise_combinator_tracker.js +128 -0
  107. package/dist/promise_combinator_tracker.js.map +1 -0
  108. package/dist/public_api.d.ts +5 -5
  109. package/dist/public_api.d.ts.map +1 -1
  110. package/dist/public_api.js +60 -0
  111. package/dist/public_api.js.map +1 -0
  112. package/dist/state_machine.d.ts +19 -12
  113. package/dist/state_machine.d.ts.map +1 -1
  114. package/dist/state_machine.js +437 -0
  115. package/dist/state_machine.js.map +1 -0
  116. package/dist/types/errors.d.ts +12 -3
  117. package/dist/types/errors.d.ts.map +1 -1
  118. package/dist/types/errors.js +273 -0
  119. package/dist/types/errors.js.map +1 -0
  120. package/dist/types/grpc.d.ts +6 -4
  121. package/dist/types/grpc.d.ts.map +1 -1
  122. package/dist/types/grpc.js +81 -0
  123. package/dist/types/grpc.js.map +1 -0
  124. package/dist/types/protocol.d.ts +9 -5
  125. package/dist/types/protocol.d.ts.map +1 -1
  126. package/dist/types/protocol.js +147 -0
  127. package/dist/types/protocol.js.map +1 -0
  128. package/dist/types/router.d.ts +8 -8
  129. package/dist/types/router.d.ts.map +1 -1
  130. package/dist/types/router.js +36 -0
  131. package/dist/types/router.js.map +1 -0
  132. package/dist/types/types.d.ts +1 -0
  133. package/dist/types/types.d.ts.map +1 -1
  134. package/dist/types/types.js +138 -0
  135. package/dist/types/types.js.map +1 -0
  136. package/dist/utils/{assumpsions.d.ts → assumptions.d.ts} +1 -1
  137. package/dist/utils/{assumpsions.d.ts.map → assumptions.d.ts.map} +1 -1
  138. package/dist/utils/assumptions.js +101 -0
  139. package/dist/utils/assumptions.js.map +1 -0
  140. package/dist/utils/message_logger.d.ts +28 -0
  141. package/dist/utils/message_logger.d.ts.map +1 -0
  142. package/dist/utils/message_logger.js +88 -0
  143. package/dist/utils/message_logger.js.map +1 -0
  144. package/dist/utils/promises.d.ts +15 -0
  145. package/dist/utils/promises.d.ts.map +1 -0
  146. package/dist/utils/promises.js +67 -0
  147. package/dist/utils/promises.js.map +1 -0
  148. package/dist/utils/public_utils.js +49 -0
  149. package/dist/utils/public_utils.js.map +1 -0
  150. package/dist/utils/rand.d.ts +1 -1
  151. package/dist/utils/rand.d.ts.map +1 -1
  152. package/dist/utils/rand.js +114 -0
  153. package/dist/utils/rand.js.map +1 -0
  154. package/dist/utils/utils.d.ts +1 -10
  155. package/dist/utils/utils.d.ts.map +1 -1
  156. package/dist/utils/utils.js +122 -0
  157. package/dist/utils/utils.js.map +1 -0
  158. package/dist/workflows/workflow.d.ts +101 -0
  159. package/dist/workflows/workflow.d.ts.map +1 -0
  160. package/dist/workflows/workflow.js +80 -0
  161. package/dist/workflows/workflow.js.map +1 -0
  162. package/dist/workflows/workflow_state_service.d.ts +35 -0
  163. package/dist/workflows/workflow_state_service.d.ts.map +1 -0
  164. package/dist/workflows/workflow_state_service.js +201 -0
  165. package/dist/workflows/workflow_state_service.js.map +1 -0
  166. package/dist/workflows/workflow_wrapper_service.d.ts +10 -0
  167. package/dist/workflows/workflow_wrapper_service.d.ts.map +1 -0
  168. package/dist/workflows/workflow_wrapper_service.js +264 -0
  169. package/dist/workflows/workflow_wrapper_service.js.map +1 -0
  170. package/package.json +38 -39
  171. package/src/clients/workflow_client.ts +290 -0
  172. package/src/connection/buffered_connection.ts +47 -0
  173. package/src/connection/connection.ts +34 -0
  174. package/src/connection/embedded_connection.ts +62 -0
  175. package/src/connection/http_connection.ts +228 -0
  176. package/src/connection/lambda_connection.ts +69 -0
  177. package/src/context.ts +633 -0
  178. package/src/context_impl.ts +721 -0
  179. package/src/embedded/api.ts +57 -0
  180. package/src/embedded/handler.ts +36 -0
  181. package/src/embedded/http2_remote.ts +103 -0
  182. package/src/embedded/invocation.ts +126 -0
  183. package/src/endpoint/endpoint_impl.ts +623 -0
  184. package/src/endpoint/http2_handler.ts +151 -0
  185. package/src/endpoint/lambda_handler.ts +181 -0
  186. package/src/endpoint.ts +187 -0
  187. package/src/generated/dev/restate/events.ts +430 -0
  188. package/src/generated/dev/restate/ext.ts +238 -0
  189. package/src/generated/google/protobuf/descriptor.ts +7889 -0
  190. package/src/generated/google/protobuf/empty.ts +150 -0
  191. package/src/generated/google/protobuf/struct.ts +878 -0
  192. package/src/generated/proto/discovery.ts +423 -0
  193. package/src/generated/proto/dynrpc.ts +768 -0
  194. package/src/generated/proto/javascript.ts +488 -0
  195. package/src/generated/proto/protocol.ts +3091 -0
  196. package/src/generated/proto/services.ts +1834 -0
  197. package/src/generated/proto/test.ts +387 -0
  198. package/src/invocation.ts +212 -0
  199. package/src/io/decoder.ts +171 -0
  200. package/src/io/encoder.ts +72 -0
  201. package/src/journal.ts +537 -0
  202. package/src/local_state_store.ts +94 -0
  203. package/src/logger.ts +121 -0
  204. package/src/promise_combinator_tracker.ts +191 -0
  205. package/src/public_api.ts +53 -0
  206. package/src/state_machine.ts +635 -0
  207. package/src/types/errors.ts +297 -0
  208. package/src/types/grpc.ts +97 -0
  209. package/src/types/protocol.ts +201 -0
  210. package/src/types/router.ts +118 -0
  211. package/src/types/types.ts +160 -0
  212. package/src/utils/assumptions.ts +131 -0
  213. package/src/utils/message_logger.ts +112 -0
  214. package/src/utils/promises.ts +118 -0
  215. package/src/utils/public_utils.ts +91 -0
  216. package/src/utils/rand.ts +142 -0
  217. package/src/utils/utils.ts +178 -0
  218. package/src/workflows/workflow.ts +178 -0
  219. package/src/workflows/workflow_state_service.ts +299 -0
  220. package/src/workflows/workflow_wrapper_service.ts +314 -0
  221. package/dist/cloudflare_bundle.js +0 -27387
  222. package/dist/restate_context.d.ts.map +0 -1
  223. package/dist/restate_context_impl.d.ts.map +0 -1
  224. package/dist/server/base_restate_server.d.ts +0 -32
  225. package/dist/server/base_restate_server.d.ts.map +0 -1
  226. package/dist/server/restate_lambda_handler.d.ts +0 -104
  227. package/dist/server/restate_lambda_handler.d.ts.map +0 -1
  228. package/dist/server/restate_server.d.ts +0 -97
  229. package/dist/server/restate_server.d.ts.map +0 -1
  230. package/dist/utils/logger.d.ts +0 -60
  231. package/dist/utils/logger.d.ts.map +0 -1
@@ -0,0 +1,878 @@
1
+ /* eslint-disable */
2
+ import _m0 from "protobufjs/minimal";
3
+ import { FileDescriptorProto as FileDescriptorProto1 } from "ts-proto-descriptors";
4
+
5
+ export const protobufPackage = "google.protobuf";
6
+
7
+ /**
8
+ * `NullValue` is a singleton enumeration to represent the null value for the
9
+ * `Value` type union.
10
+ *
11
+ * The JSON representation for `NullValue` is JSON `null`.
12
+ */
13
+ export enum NullValue {
14
+ /** NULL_VALUE - Null value. */
15
+ NULL_VALUE = 0,
16
+ UNRECOGNIZED = -1,
17
+ }
18
+
19
+ export function nullValueFromJSON(object: any): NullValue {
20
+ switch (object) {
21
+ case 0:
22
+ case "NULL_VALUE":
23
+ return NullValue.NULL_VALUE;
24
+ case -1:
25
+ case "UNRECOGNIZED":
26
+ default:
27
+ return NullValue.UNRECOGNIZED;
28
+ }
29
+ }
30
+
31
+ export function nullValueToJSON(object: NullValue): string {
32
+ switch (object) {
33
+ case NullValue.NULL_VALUE:
34
+ return "NULL_VALUE";
35
+ case NullValue.UNRECOGNIZED:
36
+ default:
37
+ return "UNRECOGNIZED";
38
+ }
39
+ }
40
+
41
+ /**
42
+ * `Struct` represents a structured data value, consisting of fields
43
+ * which map to dynamically typed values. In some languages, `Struct`
44
+ * might be supported by a native representation. For example, in
45
+ * scripting languages like JS a struct is represented as an
46
+ * object. The details of that representation are described together
47
+ * with the proto support for the language.
48
+ *
49
+ * The JSON representation for `Struct` is JSON object.
50
+ */
51
+ export interface Struct {
52
+ /** Unordered map of dynamically typed values. */
53
+ fields: { [key: string]: any | undefined };
54
+ }
55
+
56
+ export interface Struct_FieldsEntry {
57
+ key: string;
58
+ value: any | undefined;
59
+ }
60
+
61
+ /**
62
+ * `Value` represents a dynamically typed value which can be either
63
+ * null, a number, a string, a boolean, a recursive struct value, or a
64
+ * list of values. A producer of value is expected to set one of these
65
+ * variants. Absence of any variant indicates an error.
66
+ *
67
+ * The JSON representation for `Value` is JSON value.
68
+ */
69
+ export interface Value {
70
+ /** Represents a null value. */
71
+ nullValue?:
72
+ | NullValue
73
+ | undefined;
74
+ /** Represents a double value. */
75
+ numberValue?:
76
+ | number
77
+ | undefined;
78
+ /** Represents a string value. */
79
+ stringValue?:
80
+ | string
81
+ | undefined;
82
+ /** Represents a boolean value. */
83
+ boolValue?:
84
+ | boolean
85
+ | undefined;
86
+ /** Represents a structured value. */
87
+ structValue?:
88
+ | { [key: string]: any }
89
+ | undefined;
90
+ /** Represents a repeated `Value`. */
91
+ listValue?: Array<any> | undefined;
92
+ }
93
+
94
+ /**
95
+ * `ListValue` is a wrapper around a repeated field of values.
96
+ *
97
+ * The JSON representation for `ListValue` is JSON array.
98
+ */
99
+ export interface ListValue {
100
+ /** Repeated field of dynamically typed values. */
101
+ values: any[];
102
+ }
103
+
104
+ function createBaseStruct(): Struct {
105
+ return { fields: {} };
106
+ }
107
+
108
+ export const Struct = {
109
+ encode(message: Struct, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
110
+ Object.entries(message.fields).forEach(([key, value]) => {
111
+ if (value !== undefined) {
112
+ Struct_FieldsEntry.encode({ key: key as any, value }, writer.uint32(10).fork()).ldelim();
113
+ }
114
+ });
115
+ return writer;
116
+ },
117
+
118
+ decode(input: _m0.Reader | Uint8Array, length?: number): Struct {
119
+ const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
120
+ let end = length === undefined ? reader.len : reader.pos + length;
121
+ const message = createBaseStruct();
122
+ while (reader.pos < end) {
123
+ const tag = reader.uint32();
124
+ switch (tag >>> 3) {
125
+ case 1:
126
+ if (tag !== 10) {
127
+ break;
128
+ }
129
+
130
+ const entry1 = Struct_FieldsEntry.decode(reader, reader.uint32());
131
+ if (entry1.value !== undefined) {
132
+ message.fields[entry1.key] = entry1.value;
133
+ }
134
+ continue;
135
+ }
136
+ if ((tag & 7) === 4 || tag === 0) {
137
+ break;
138
+ }
139
+ reader.skipType(tag & 7);
140
+ }
141
+ return message;
142
+ },
143
+
144
+ fromJSON(object: any): Struct {
145
+ return {
146
+ fields: isObject(object.fields)
147
+ ? Object.entries(object.fields).reduce<{ [key: string]: any | undefined }>((acc, [key, value]) => {
148
+ acc[key] = value as any | undefined;
149
+ return acc;
150
+ }, {})
151
+ : {},
152
+ };
153
+ },
154
+
155
+ toJSON(message: Struct): unknown {
156
+ const obj: any = {};
157
+ if (message.fields) {
158
+ const entries = Object.entries(message.fields);
159
+ if (entries.length > 0) {
160
+ obj.fields = {};
161
+ entries.forEach(([k, v]) => {
162
+ obj.fields[k] = v;
163
+ });
164
+ }
165
+ }
166
+ return obj;
167
+ },
168
+
169
+ create(base?: DeepPartial<Struct>): Struct {
170
+ return Struct.fromPartial(base ?? {});
171
+ },
172
+ fromPartial(object: DeepPartial<Struct>): Struct {
173
+ const message = createBaseStruct();
174
+ message.fields = Object.entries(object.fields ?? {}).reduce<{ [key: string]: any | undefined }>(
175
+ (acc, [key, value]) => {
176
+ if (value !== undefined) {
177
+ acc[key] = value;
178
+ }
179
+ return acc;
180
+ },
181
+ {},
182
+ );
183
+ return message;
184
+ },
185
+
186
+ wrap(object: { [key: string]: any } | undefined): Struct {
187
+ const struct = createBaseStruct();
188
+ if (object !== undefined) {
189
+ Object.keys(object).forEach((key) => {
190
+ struct.fields[key] = object[key];
191
+ });
192
+ }
193
+ return struct;
194
+ },
195
+
196
+ unwrap(message: Struct): { [key: string]: any } {
197
+ const object: { [key: string]: any } = {};
198
+ if (message.fields) {
199
+ Object.keys(message.fields).forEach((key) => {
200
+ object[key] = message.fields[key];
201
+ });
202
+ }
203
+ return object;
204
+ },
205
+ };
206
+
207
+ function createBaseStruct_FieldsEntry(): Struct_FieldsEntry {
208
+ return { key: "", value: undefined };
209
+ }
210
+
211
+ export const Struct_FieldsEntry = {
212
+ encode(message: Struct_FieldsEntry, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
213
+ if (message.key !== "") {
214
+ writer.uint32(10).string(message.key);
215
+ }
216
+ if (message.value !== undefined) {
217
+ Value.encode(Value.wrap(message.value), writer.uint32(18).fork()).ldelim();
218
+ }
219
+ return writer;
220
+ },
221
+
222
+ decode(input: _m0.Reader | Uint8Array, length?: number): Struct_FieldsEntry {
223
+ const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
224
+ let end = length === undefined ? reader.len : reader.pos + length;
225
+ const message = createBaseStruct_FieldsEntry();
226
+ while (reader.pos < end) {
227
+ const tag = reader.uint32();
228
+ switch (tag >>> 3) {
229
+ case 1:
230
+ if (tag !== 10) {
231
+ break;
232
+ }
233
+
234
+ message.key = reader.string();
235
+ continue;
236
+ case 2:
237
+ if (tag !== 18) {
238
+ break;
239
+ }
240
+
241
+ message.value = Value.unwrap(Value.decode(reader, reader.uint32()));
242
+ continue;
243
+ }
244
+ if ((tag & 7) === 4 || tag === 0) {
245
+ break;
246
+ }
247
+ reader.skipType(tag & 7);
248
+ }
249
+ return message;
250
+ },
251
+
252
+ fromJSON(object: any): Struct_FieldsEntry {
253
+ return {
254
+ key: isSet(object.key) ? globalThis.String(object.key) : "",
255
+ value: isSet(object?.value) ? object.value : undefined,
256
+ };
257
+ },
258
+
259
+ toJSON(message: Struct_FieldsEntry): unknown {
260
+ const obj: any = {};
261
+ if (message.key !== "") {
262
+ obj.key = message.key;
263
+ }
264
+ if (message.value !== undefined) {
265
+ obj.value = message.value;
266
+ }
267
+ return obj;
268
+ },
269
+
270
+ create(base?: DeepPartial<Struct_FieldsEntry>): Struct_FieldsEntry {
271
+ return Struct_FieldsEntry.fromPartial(base ?? {});
272
+ },
273
+ fromPartial(object: DeepPartial<Struct_FieldsEntry>): Struct_FieldsEntry {
274
+ const message = createBaseStruct_FieldsEntry();
275
+ message.key = object.key ?? "";
276
+ message.value = object.value ?? undefined;
277
+ return message;
278
+ },
279
+ };
280
+
281
+ function createBaseValue(): Value {
282
+ return {
283
+ nullValue: undefined,
284
+ numberValue: undefined,
285
+ stringValue: undefined,
286
+ boolValue: undefined,
287
+ structValue: undefined,
288
+ listValue: undefined,
289
+ };
290
+ }
291
+
292
+ export const Value = {
293
+ encode(message: Value, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
294
+ if (message.nullValue !== undefined) {
295
+ writer.uint32(8).int32(message.nullValue);
296
+ }
297
+ if (message.numberValue !== undefined) {
298
+ writer.uint32(17).double(message.numberValue);
299
+ }
300
+ if (message.stringValue !== undefined) {
301
+ writer.uint32(26).string(message.stringValue);
302
+ }
303
+ if (message.boolValue !== undefined) {
304
+ writer.uint32(32).bool(message.boolValue);
305
+ }
306
+ if (message.structValue !== undefined) {
307
+ Struct.encode(Struct.wrap(message.structValue), writer.uint32(42).fork()).ldelim();
308
+ }
309
+ if (message.listValue !== undefined) {
310
+ ListValue.encode(ListValue.wrap(message.listValue), writer.uint32(50).fork()).ldelim();
311
+ }
312
+ return writer;
313
+ },
314
+
315
+ decode(input: _m0.Reader | Uint8Array, length?: number): Value {
316
+ const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
317
+ let end = length === undefined ? reader.len : reader.pos + length;
318
+ const message = createBaseValue();
319
+ while (reader.pos < end) {
320
+ const tag = reader.uint32();
321
+ switch (tag >>> 3) {
322
+ case 1:
323
+ if (tag !== 8) {
324
+ break;
325
+ }
326
+
327
+ message.nullValue = reader.int32() as any;
328
+ continue;
329
+ case 2:
330
+ if (tag !== 17) {
331
+ break;
332
+ }
333
+
334
+ message.numberValue = reader.double();
335
+ continue;
336
+ case 3:
337
+ if (tag !== 26) {
338
+ break;
339
+ }
340
+
341
+ message.stringValue = reader.string();
342
+ continue;
343
+ case 4:
344
+ if (tag !== 32) {
345
+ break;
346
+ }
347
+
348
+ message.boolValue = reader.bool();
349
+ continue;
350
+ case 5:
351
+ if (tag !== 42) {
352
+ break;
353
+ }
354
+
355
+ message.structValue = Struct.unwrap(Struct.decode(reader, reader.uint32()));
356
+ continue;
357
+ case 6:
358
+ if (tag !== 50) {
359
+ break;
360
+ }
361
+
362
+ message.listValue = ListValue.unwrap(ListValue.decode(reader, reader.uint32()));
363
+ continue;
364
+ }
365
+ if ((tag & 7) === 4 || tag === 0) {
366
+ break;
367
+ }
368
+ reader.skipType(tag & 7);
369
+ }
370
+ return message;
371
+ },
372
+
373
+ fromJSON(object: any): Value {
374
+ return {
375
+ nullValue: isSet(object.nullValue) ? nullValueFromJSON(object.nullValue) : undefined,
376
+ numberValue: isSet(object.numberValue) ? globalThis.Number(object.numberValue) : undefined,
377
+ stringValue: isSet(object.stringValue) ? globalThis.String(object.stringValue) : undefined,
378
+ boolValue: isSet(object.boolValue) ? globalThis.Boolean(object.boolValue) : undefined,
379
+ structValue: isObject(object.structValue) ? object.structValue : undefined,
380
+ listValue: globalThis.Array.isArray(object.listValue) ? [...object.listValue] : undefined,
381
+ };
382
+ },
383
+
384
+ toJSON(message: Value): unknown {
385
+ const obj: any = {};
386
+ if (message.nullValue !== undefined) {
387
+ obj.nullValue = nullValueToJSON(message.nullValue);
388
+ }
389
+ if (message.numberValue !== undefined) {
390
+ obj.numberValue = message.numberValue;
391
+ }
392
+ if (message.stringValue !== undefined) {
393
+ obj.stringValue = message.stringValue;
394
+ }
395
+ if (message.boolValue !== undefined) {
396
+ obj.boolValue = message.boolValue;
397
+ }
398
+ if (message.structValue !== undefined) {
399
+ obj.structValue = message.structValue;
400
+ }
401
+ if (message.listValue !== undefined) {
402
+ obj.listValue = message.listValue;
403
+ }
404
+ return obj;
405
+ },
406
+
407
+ create(base?: DeepPartial<Value>): Value {
408
+ return Value.fromPartial(base ?? {});
409
+ },
410
+ fromPartial(object: DeepPartial<Value>): Value {
411
+ const message = createBaseValue();
412
+ message.nullValue = object.nullValue ?? undefined;
413
+ message.numberValue = object.numberValue ?? undefined;
414
+ message.stringValue = object.stringValue ?? undefined;
415
+ message.boolValue = object.boolValue ?? undefined;
416
+ message.structValue = object.structValue ?? undefined;
417
+ message.listValue = object.listValue ?? undefined;
418
+ return message;
419
+ },
420
+
421
+ wrap(value: any): Value {
422
+ const result = createBaseValue();
423
+ if (value === null) {
424
+ result.nullValue = NullValue.NULL_VALUE;
425
+ } else if (typeof value === "boolean") {
426
+ result.boolValue = value;
427
+ } else if (typeof value === "number") {
428
+ result.numberValue = value;
429
+ } else if (typeof value === "string") {
430
+ result.stringValue = value;
431
+ } else if (globalThis.Array.isArray(value)) {
432
+ result.listValue = value;
433
+ } else if (typeof value === "object") {
434
+ result.structValue = value;
435
+ } else if (typeof value !== "undefined") {
436
+ throw new globalThis.Error("Unsupported any value type: " + typeof value);
437
+ }
438
+ return result;
439
+ },
440
+
441
+ unwrap(message: any): string | number | boolean | Object | null | Array<any> | undefined {
442
+ if (message.stringValue !== undefined) {
443
+ return message.stringValue;
444
+ } else if (message?.numberValue !== undefined) {
445
+ return message.numberValue;
446
+ } else if (message?.boolValue !== undefined) {
447
+ return message.boolValue;
448
+ } else if (message?.structValue !== undefined) {
449
+ return message.structValue as any;
450
+ } else if (message?.listValue !== undefined) {
451
+ return message.listValue;
452
+ } else if (message?.nullValue !== undefined) {
453
+ return null;
454
+ }
455
+ return undefined;
456
+ },
457
+ };
458
+
459
+ function createBaseListValue(): ListValue {
460
+ return { values: [] };
461
+ }
462
+
463
+ export const ListValue = {
464
+ encode(message: ListValue, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
465
+ for (const v of message.values) {
466
+ Value.encode(Value.wrap(v!), writer.uint32(10).fork()).ldelim();
467
+ }
468
+ return writer;
469
+ },
470
+
471
+ decode(input: _m0.Reader | Uint8Array, length?: number): ListValue {
472
+ const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
473
+ let end = length === undefined ? reader.len : reader.pos + length;
474
+ const message = createBaseListValue();
475
+ while (reader.pos < end) {
476
+ const tag = reader.uint32();
477
+ switch (tag >>> 3) {
478
+ case 1:
479
+ if (tag !== 10) {
480
+ break;
481
+ }
482
+
483
+ message.values.push(Value.unwrap(Value.decode(reader, reader.uint32())));
484
+ continue;
485
+ }
486
+ if ((tag & 7) === 4 || tag === 0) {
487
+ break;
488
+ }
489
+ reader.skipType(tag & 7);
490
+ }
491
+ return message;
492
+ },
493
+
494
+ fromJSON(object: any): ListValue {
495
+ return { values: globalThis.Array.isArray(object?.values) ? [...object.values] : [] };
496
+ },
497
+
498
+ toJSON(message: ListValue): unknown {
499
+ const obj: any = {};
500
+ if (message.values?.length) {
501
+ obj.values = message.values;
502
+ }
503
+ return obj;
504
+ },
505
+
506
+ create(base?: DeepPartial<ListValue>): ListValue {
507
+ return ListValue.fromPartial(base ?? {});
508
+ },
509
+ fromPartial(object: DeepPartial<ListValue>): ListValue {
510
+ const message = createBaseListValue();
511
+ message.values = object.values?.map((e) => e) || [];
512
+ return message;
513
+ },
514
+
515
+ wrap(array: Array<any> | undefined): ListValue {
516
+ const result = createBaseListValue();
517
+ result.values = array ?? [];
518
+ return result;
519
+ },
520
+
521
+ unwrap(message: ListValue): Array<any> {
522
+ if (message?.hasOwnProperty("values") && globalThis.Array.isArray(message.values)) {
523
+ return message.values;
524
+ } else {
525
+ return message as any;
526
+ }
527
+ },
528
+ };
529
+
530
+ type ProtoMetaMessageOptions = {
531
+ options?: { [key: string]: any };
532
+ fields?: { [key: string]: { [key: string]: any } };
533
+ oneof?: { [key: string]: { [key: string]: any } };
534
+ nested?: { [key: string]: ProtoMetaMessageOptions };
535
+ };
536
+
537
+ export interface ProtoMetadata {
538
+ fileDescriptor: FileDescriptorProto1;
539
+ references: { [key: string]: any };
540
+ dependencies?: ProtoMetadata[];
541
+ options?: {
542
+ options?: { [key: string]: any };
543
+ services?: {
544
+ [key: string]: { options?: { [key: string]: any }; methods?: { [key: string]: { [key: string]: any } } };
545
+ };
546
+ messages?: { [key: string]: ProtoMetaMessageOptions };
547
+ enums?: { [key: string]: { options?: { [key: string]: any }; values?: { [key: string]: { [key: string]: any } } } };
548
+ };
549
+ }
550
+
551
+ export const protoMetadata: ProtoMetadata = {
552
+ fileDescriptor: FileDescriptorProto1.fromPartial({
553
+ "name": "google/protobuf/struct.proto",
554
+ "package": "google.protobuf",
555
+ "dependency": [],
556
+ "publicDependency": [],
557
+ "weakDependency": [],
558
+ "messageType": [{
559
+ "name": "Struct",
560
+ "field": [{
561
+ "name": "fields",
562
+ "number": 1,
563
+ "label": 3,
564
+ "type": 11,
565
+ "typeName": ".google.protobuf.Struct.FieldsEntry",
566
+ "extendee": "",
567
+ "defaultValue": "",
568
+ "oneofIndex": 0,
569
+ "jsonName": "fields",
570
+ "options": undefined,
571
+ "proto3Optional": false,
572
+ }],
573
+ "extension": [],
574
+ "nestedType": [{
575
+ "name": "FieldsEntry",
576
+ "field": [{
577
+ "name": "key",
578
+ "number": 1,
579
+ "label": 1,
580
+ "type": 9,
581
+ "typeName": "",
582
+ "extendee": "",
583
+ "defaultValue": "",
584
+ "oneofIndex": 0,
585
+ "jsonName": "key",
586
+ "options": undefined,
587
+ "proto3Optional": false,
588
+ }, {
589
+ "name": "value",
590
+ "number": 2,
591
+ "label": 1,
592
+ "type": 11,
593
+ "typeName": ".google.protobuf.Value",
594
+ "extendee": "",
595
+ "defaultValue": "",
596
+ "oneofIndex": 0,
597
+ "jsonName": "value",
598
+ "options": undefined,
599
+ "proto3Optional": false,
600
+ }],
601
+ "extension": [],
602
+ "nestedType": [],
603
+ "enumType": [],
604
+ "extensionRange": [],
605
+ "oneofDecl": [],
606
+ "options": {
607
+ "messageSetWireFormat": false,
608
+ "noStandardDescriptorAccessor": false,
609
+ "deprecated": false,
610
+ "mapEntry": true,
611
+ "uninterpretedOption": [],
612
+ },
613
+ "reservedRange": [],
614
+ "reservedName": [],
615
+ }],
616
+ "enumType": [],
617
+ "extensionRange": [],
618
+ "oneofDecl": [],
619
+ "options": undefined,
620
+ "reservedRange": [],
621
+ "reservedName": [],
622
+ }, {
623
+ "name": "Value",
624
+ "field": [{
625
+ "name": "null_value",
626
+ "number": 1,
627
+ "label": 1,
628
+ "type": 14,
629
+ "typeName": ".google.protobuf.NullValue",
630
+ "extendee": "",
631
+ "defaultValue": "",
632
+ "oneofIndex": 0,
633
+ "jsonName": "nullValue",
634
+ "options": undefined,
635
+ "proto3Optional": false,
636
+ }, {
637
+ "name": "number_value",
638
+ "number": 2,
639
+ "label": 1,
640
+ "type": 1,
641
+ "typeName": "",
642
+ "extendee": "",
643
+ "defaultValue": "",
644
+ "oneofIndex": 0,
645
+ "jsonName": "numberValue",
646
+ "options": undefined,
647
+ "proto3Optional": false,
648
+ }, {
649
+ "name": "string_value",
650
+ "number": 3,
651
+ "label": 1,
652
+ "type": 9,
653
+ "typeName": "",
654
+ "extendee": "",
655
+ "defaultValue": "",
656
+ "oneofIndex": 0,
657
+ "jsonName": "stringValue",
658
+ "options": undefined,
659
+ "proto3Optional": false,
660
+ }, {
661
+ "name": "bool_value",
662
+ "number": 4,
663
+ "label": 1,
664
+ "type": 8,
665
+ "typeName": "",
666
+ "extendee": "",
667
+ "defaultValue": "",
668
+ "oneofIndex": 0,
669
+ "jsonName": "boolValue",
670
+ "options": undefined,
671
+ "proto3Optional": false,
672
+ }, {
673
+ "name": "struct_value",
674
+ "number": 5,
675
+ "label": 1,
676
+ "type": 11,
677
+ "typeName": ".google.protobuf.Struct",
678
+ "extendee": "",
679
+ "defaultValue": "",
680
+ "oneofIndex": 0,
681
+ "jsonName": "structValue",
682
+ "options": undefined,
683
+ "proto3Optional": false,
684
+ }, {
685
+ "name": "list_value",
686
+ "number": 6,
687
+ "label": 1,
688
+ "type": 11,
689
+ "typeName": ".google.protobuf.ListValue",
690
+ "extendee": "",
691
+ "defaultValue": "",
692
+ "oneofIndex": 0,
693
+ "jsonName": "listValue",
694
+ "options": undefined,
695
+ "proto3Optional": false,
696
+ }],
697
+ "extension": [],
698
+ "nestedType": [],
699
+ "enumType": [],
700
+ "extensionRange": [],
701
+ "oneofDecl": [{ "name": "kind", "options": undefined }],
702
+ "options": undefined,
703
+ "reservedRange": [],
704
+ "reservedName": [],
705
+ }, {
706
+ "name": "ListValue",
707
+ "field": [{
708
+ "name": "values",
709
+ "number": 1,
710
+ "label": 3,
711
+ "type": 11,
712
+ "typeName": ".google.protobuf.Value",
713
+ "extendee": "",
714
+ "defaultValue": "",
715
+ "oneofIndex": 0,
716
+ "jsonName": "values",
717
+ "options": undefined,
718
+ "proto3Optional": false,
719
+ }],
720
+ "extension": [],
721
+ "nestedType": [],
722
+ "enumType": [],
723
+ "extensionRange": [],
724
+ "oneofDecl": [],
725
+ "options": undefined,
726
+ "reservedRange": [],
727
+ "reservedName": [],
728
+ }],
729
+ "enumType": [{
730
+ "name": "NullValue",
731
+ "value": [{ "name": "NULL_VALUE", "number": 0, "options": undefined }],
732
+ "options": undefined,
733
+ "reservedRange": [],
734
+ "reservedName": [],
735
+ }],
736
+ "service": [],
737
+ "extension": [],
738
+ "options": {
739
+ "javaPackage": "com.google.protobuf",
740
+ "javaOuterClassname": "StructProto",
741
+ "javaMultipleFiles": true,
742
+ "javaGenerateEqualsAndHash": false,
743
+ "javaStringCheckUtf8": false,
744
+ "optimizeFor": 1,
745
+ "goPackage": "google.golang.org/protobuf/types/known/structpb",
746
+ "ccGenericServices": false,
747
+ "javaGenericServices": false,
748
+ "pyGenericServices": false,
749
+ "phpGenericServices": false,
750
+ "deprecated": false,
751
+ "ccEnableArenas": true,
752
+ "objcClassPrefix": "GPB",
753
+ "csharpNamespace": "Google.Protobuf.WellKnownTypes",
754
+ "swiftPrefix": "",
755
+ "phpClassPrefix": "",
756
+ "phpNamespace": "",
757
+ "phpMetadataNamespace": "",
758
+ "rubyPackage": "",
759
+ "uninterpretedOption": [],
760
+ },
761
+ "sourceCodeInfo": {
762
+ "location": [{
763
+ "path": [4, 0],
764
+ "span": [50, 0, 53, 1],
765
+ "leadingComments":
766
+ " `Struct` represents a structured data value, consisting of fields\n which map to dynamically typed values. In some languages, `Struct`\n might be supported by a native representation. For example, in\n scripting languages like JS a struct is represented as an\n object. The details of that representation are described together\n with the proto support for the language.\n\n The JSON representation for `Struct` is JSON object.\n",
767
+ "trailingComments": "",
768
+ "leadingDetachedComments": [],
769
+ }, {
770
+ "path": [4, 0, 2, 0],
771
+ "span": [52, 2, 32],
772
+ "leadingComments": " Unordered map of dynamically typed values.\n",
773
+ "trailingComments": "",
774
+ "leadingDetachedComments": [],
775
+ }, {
776
+ "path": [4, 1],
777
+ "span": [61, 0, 77, 1],
778
+ "leadingComments":
779
+ " `Value` represents a dynamically typed value which can be either\n null, a number, a string, a boolean, a recursive struct value, or a\n list of values. A producer of value is expected to set one of these\n variants. Absence of any variant indicates an error.\n\n The JSON representation for `Value` is JSON value.\n",
780
+ "trailingComments": "",
781
+ "leadingDetachedComments": [],
782
+ }, {
783
+ "path": [4, 1, 8, 0],
784
+ "span": [63, 2, 76, 3],
785
+ "leadingComments": " The kind of value.\n",
786
+ "trailingComments": "",
787
+ "leadingDetachedComments": [],
788
+ }, {
789
+ "path": [4, 1, 2, 0],
790
+ "span": [65, 4, 29],
791
+ "leadingComments": " Represents a null value.\n",
792
+ "trailingComments": "",
793
+ "leadingDetachedComments": [],
794
+ }, {
795
+ "path": [4, 1, 2, 1],
796
+ "span": [67, 4, 28],
797
+ "leadingComments": " Represents a double value.\n",
798
+ "trailingComments": "",
799
+ "leadingDetachedComments": [],
800
+ }, {
801
+ "path": [4, 1, 2, 2],
802
+ "span": [69, 4, 28],
803
+ "leadingComments": " Represents a string value.\n",
804
+ "trailingComments": "",
805
+ "leadingDetachedComments": [],
806
+ }, {
807
+ "path": [4, 1, 2, 3],
808
+ "span": [71, 4, 24],
809
+ "leadingComments": " Represents a boolean value.\n",
810
+ "trailingComments": "",
811
+ "leadingDetachedComments": [],
812
+ }, {
813
+ "path": [4, 1, 2, 4],
814
+ "span": [73, 4, 28],
815
+ "leadingComments": " Represents a structured value.\n",
816
+ "trailingComments": "",
817
+ "leadingDetachedComments": [],
818
+ }, {
819
+ "path": [4, 1, 2, 5],
820
+ "span": [75, 4, 29],
821
+ "leadingComments": " Represents a repeated `Value`.\n",
822
+ "trailingComments": "",
823
+ "leadingDetachedComments": [],
824
+ }, {
825
+ "path": [5, 0],
826
+ "span": [83, 0, 86, 1],
827
+ "leadingComments":
828
+ " `NullValue` is a singleton enumeration to represent the null value for the\n `Value` type union.\n\n The JSON representation for `NullValue` is JSON `null`.\n",
829
+ "trailingComments": "",
830
+ "leadingDetachedComments": [],
831
+ }, {
832
+ "path": [5, 0, 2, 0],
833
+ "span": [85, 2, 17],
834
+ "leadingComments": " Null value.\n",
835
+ "trailingComments": "",
836
+ "leadingDetachedComments": [],
837
+ }, {
838
+ "path": [4, 2],
839
+ "span": [91, 0, 94, 1],
840
+ "leadingComments":
841
+ " `ListValue` is a wrapper around a repeated field of values.\n\n The JSON representation for `ListValue` is JSON array.\n",
842
+ "trailingComments": "",
843
+ "leadingDetachedComments": [],
844
+ }, {
845
+ "path": [4, 2, 2, 0],
846
+ "span": [93, 2, 28],
847
+ "leadingComments": " Repeated field of dynamically typed values.\n",
848
+ "trailingComments": "",
849
+ "leadingDetachedComments": [],
850
+ }],
851
+ },
852
+ "syntax": "proto3",
853
+ }),
854
+ references: {
855
+ ".google.protobuf.NullValue": NullValue,
856
+ ".google.protobuf.Struct": Struct,
857
+ ".google.protobuf.Struct.FieldsEntry": Struct_FieldsEntry,
858
+ ".google.protobuf.Value": Value,
859
+ ".google.protobuf.ListValue": ListValue,
860
+ },
861
+ dependencies: [],
862
+ };
863
+
864
+ type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
865
+
866
+ export type DeepPartial<T> = T extends Builtin ? T
867
+ : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>
868
+ : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
869
+ : T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> }
870
+ : Partial<T>;
871
+
872
+ function isObject(value: any): boolean {
873
+ return typeof value === "object" && value !== null;
874
+ }
875
+
876
+ function isSet(value: any): boolean {
877
+ return value !== null && value !== undefined;
878
+ }