@replit/protocol 0.4.28 → 0.4.31

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.
@@ -0,0 +1,59 @@
1
+ import type { BinaryWriteOptions } from "@protobuf-ts/runtime";
2
+ import type { IBinaryWriter } from "@protobuf-ts/runtime";
3
+ import type { BinaryReadOptions } from "@protobuf-ts/runtime";
4
+ import type { IBinaryReader } from "@protobuf-ts/runtime";
5
+ import type { PartialMessage } from "@protobuf-ts/runtime";
6
+ import { MessageType } from "@protobuf-ts/runtime";
7
+ /**
8
+ * @generated from protobuf message replit.goval.api.oci.OciRuntimeProfile
9
+ */
10
+ export interface OciRuntimeProfile {
11
+ /**
12
+ * Raw OCI Config.User. Empty selects the OCI default root user.
13
+ *
14
+ * @generated from protobuf field: string user = 1
15
+ */
16
+ user: string;
17
+ /**
18
+ * Effective absolute working directory. Empty OCI WorkingDir becomes "/".
19
+ *
20
+ * @generated from protobuf field: string working_directory = 2
21
+ */
22
+ workingDirectory: string;
23
+ /**
24
+ * Raw OCI Config.Env entries in source order, including duplicates.
25
+ *
26
+ * @generated from protobuf field: repeated string env = 3
27
+ */
28
+ env: string[];
29
+ /**
30
+ * The remaining fields are set only on the boot-time copy after resolving
31
+ * Config.User against the final rootfs and user namespace.
32
+ *
33
+ * @generated from protobuf field: optional int32 uid = 4
34
+ */
35
+ uid?: number;
36
+ /**
37
+ * @generated from protobuf field: optional int32 gid = 5
38
+ */
39
+ gid?: number;
40
+ /**
41
+ * @generated from protobuf field: repeated int32 supplementary_gids = 6
42
+ */
43
+ supplementaryGids: number[];
44
+ /**
45
+ * @generated from protobuf field: string home = 7
46
+ */
47
+ home: string;
48
+ }
49
+ declare class OciRuntimeProfile$Type extends MessageType<OciRuntimeProfile> {
50
+ constructor();
51
+ create(value?: PartialMessage<OciRuntimeProfile>): OciRuntimeProfile;
52
+ internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: OciRuntimeProfile): OciRuntimeProfile;
53
+ internalBinaryWrite(message: OciRuntimeProfile, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter;
54
+ }
55
+ /**
56
+ * @generated MessageType for protobuf message replit.goval.api.oci.OciRuntimeProfile
57
+ */
58
+ export declare const OciRuntimeProfile: OciRuntimeProfile$Type;
59
+ export {};
@@ -0,0 +1,105 @@
1
+ import { UnknownFieldHandler } from "@protobuf-ts/runtime";
2
+ import { WireType } from "@protobuf-ts/runtime";
3
+ import { reflectionMergePartial } from "@protobuf-ts/runtime";
4
+ import { MessageType } from "@protobuf-ts/runtime";
5
+ // @generated message type with reflection information, may provide speed optimized methods
6
+ class OciRuntimeProfile$Type extends MessageType {
7
+ constructor() {
8
+ super("replit.goval.api.oci.OciRuntimeProfile", [
9
+ { no: 1, name: "user", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
10
+ { no: 2, name: "working_directory", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
11
+ { no: 3, name: "env", kind: "scalar", repeat: 2 /*RepeatType.UNPACKED*/, T: 9 /*ScalarType.STRING*/ },
12
+ { no: 4, name: "uid", kind: "scalar", opt: true, T: 5 /*ScalarType.INT32*/ },
13
+ { no: 5, name: "gid", kind: "scalar", opt: true, T: 5 /*ScalarType.INT32*/ },
14
+ { no: 6, name: "supplementary_gids", kind: "scalar", repeat: 1 /*RepeatType.PACKED*/, T: 5 /*ScalarType.INT32*/ },
15
+ { no: 7, name: "home", kind: "scalar", T: 9 /*ScalarType.STRING*/ }
16
+ ]);
17
+ }
18
+ create(value) {
19
+ const message = globalThis.Object.create((this.messagePrototype));
20
+ message.user = "";
21
+ message.workingDirectory = "";
22
+ message.env = [];
23
+ message.supplementaryGids = [];
24
+ message.home = "";
25
+ if (value !== undefined)
26
+ reflectionMergePartial(this, message, value);
27
+ return message;
28
+ }
29
+ internalBinaryRead(reader, length, options, target) {
30
+ let message = target ?? this.create(), end = reader.pos + length;
31
+ while (reader.pos < end) {
32
+ let [fieldNo, wireType] = reader.tag();
33
+ switch (fieldNo) {
34
+ case /* string user */ 1:
35
+ message.user = reader.string();
36
+ break;
37
+ case /* string working_directory */ 2:
38
+ message.workingDirectory = reader.string();
39
+ break;
40
+ case /* repeated string env */ 3:
41
+ message.env.push(reader.string());
42
+ break;
43
+ case /* optional int32 uid */ 4:
44
+ message.uid = reader.int32();
45
+ break;
46
+ case /* optional int32 gid */ 5:
47
+ message.gid = reader.int32();
48
+ break;
49
+ case /* repeated int32 supplementary_gids */ 6:
50
+ if (wireType === WireType.LengthDelimited)
51
+ for (let e = reader.int32() + reader.pos; reader.pos < e;)
52
+ message.supplementaryGids.push(reader.int32());
53
+ else
54
+ message.supplementaryGids.push(reader.int32());
55
+ break;
56
+ case /* string home */ 7:
57
+ message.home = reader.string();
58
+ break;
59
+ default:
60
+ let u = options.readUnknownField;
61
+ if (u === "throw")
62
+ throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
63
+ let d = reader.skip(wireType);
64
+ if (u !== false)
65
+ (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
66
+ }
67
+ }
68
+ return message;
69
+ }
70
+ internalBinaryWrite(message, writer, options) {
71
+ /* string user = 1; */
72
+ if (message.user !== "")
73
+ writer.tag(1, WireType.LengthDelimited).string(message.user);
74
+ /* string working_directory = 2; */
75
+ if (message.workingDirectory !== "")
76
+ writer.tag(2, WireType.LengthDelimited).string(message.workingDirectory);
77
+ /* repeated string env = 3; */
78
+ for (let i = 0; i < message.env.length; i++)
79
+ writer.tag(3, WireType.LengthDelimited).string(message.env[i]);
80
+ /* optional int32 uid = 4; */
81
+ if (message.uid !== undefined)
82
+ writer.tag(4, WireType.Varint).int32(message.uid);
83
+ /* optional int32 gid = 5; */
84
+ if (message.gid !== undefined)
85
+ writer.tag(5, WireType.Varint).int32(message.gid);
86
+ /* repeated int32 supplementary_gids = 6; */
87
+ if (message.supplementaryGids.length) {
88
+ writer.tag(6, WireType.LengthDelimited).fork();
89
+ for (let i = 0; i < message.supplementaryGids.length; i++)
90
+ writer.int32(message.supplementaryGids[i]);
91
+ writer.join();
92
+ }
93
+ /* string home = 7; */
94
+ if (message.home !== "")
95
+ writer.tag(7, WireType.LengthDelimited).string(message.home);
96
+ let u = options.writeUnknownFields;
97
+ if (u !== false)
98
+ (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
99
+ return writer;
100
+ }
101
+ }
102
+ /**
103
+ * @generated MessageType for protobuf message replit.goval.api.oci.OciRuntimeProfile
104
+ */
105
+ export const OciRuntimeProfile = new OciRuntimeProfile$Type();
@@ -156,6 +156,19 @@ export interface Repl {
156
156
  * @generated from protobuf field: string custom_skills_bucket = 18
157
157
  */
158
158
  customSkillsBucket: string;
159
+ /**
160
+ * Email address of the user who owns the repl.
161
+ *
162
+ * @generated from protobuf field: string user_email = 19
163
+ */
164
+ userEmail: string;
165
+ /**
166
+ * A boolean indicating that dotdevproxy should inject the ChatGPT
167
+ * link-override script into this repl's HTML responses.
168
+ *
169
+ * @generated from protobuf field: bool inject_chatgpt_link_override = 20
170
+ */
171
+ injectChatgptLinkOverride: boolean;
159
172
  }
160
173
  /**
161
174
  * autocontainer needs to know if we are in a teams org
@@ -203,7 +203,9 @@ class Repl$Type extends MessageType {
203
203
  { no: 15, name: "use_repl_shield", kind: "scalar", T: 8 /*ScalarType.BOOL*/ },
204
204
  { no: 16, name: "connectors_host", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
205
205
  { no: 17, name: "backer_job_metadata", kind: "map", K: 9 /*ScalarType.STRING*/, V: { kind: "scalar", T: 9 /*ScalarType.STRING*/ } },
206
- { no: 18, name: "custom_skills_bucket", kind: "scalar", T: 9 /*ScalarType.STRING*/ }
206
+ { no: 18, name: "custom_skills_bucket", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
207
+ { no: 19, name: "user_email", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
208
+ { no: 20, name: "inject_chatgpt_link_override", kind: "scalar", T: 8 /*ScalarType.BOOL*/ }
207
209
  ]);
208
210
  }
209
211
  create(value) {
@@ -222,6 +224,8 @@ class Repl$Type extends MessageType {
222
224
  message.connectorsHost = "";
223
225
  message.backerJobMetadata = {};
224
226
  message.customSkillsBucket = "";
227
+ message.userEmail = "";
228
+ message.injectChatgptLinkOverride = false;
225
229
  if (value !== undefined)
226
230
  reflectionMergePartial(this, message, value);
227
231
  return message;
@@ -282,6 +286,12 @@ class Repl$Type extends MessageType {
282
286
  case /* string custom_skills_bucket */ 18:
283
287
  message.customSkillsBucket = reader.string();
284
288
  break;
289
+ case /* string user_email */ 19:
290
+ message.userEmail = reader.string();
291
+ break;
292
+ case /* bool inject_chatgpt_link_override */ 20:
293
+ message.injectChatgptLinkOverride = reader.bool();
294
+ break;
285
295
  default:
286
296
  let u = options.readUnknownField;
287
297
  if (u === "throw")
@@ -361,6 +371,12 @@ class Repl$Type extends MessageType {
361
371
  /* string custom_skills_bucket = 18; */
362
372
  if (message.customSkillsBucket !== "")
363
373
  writer.tag(18, WireType.LengthDelimited).string(message.customSkillsBucket);
374
+ /* string user_email = 19; */
375
+ if (message.userEmail !== "")
376
+ writer.tag(19, WireType.LengthDelimited).string(message.userEmail);
377
+ /* bool inject_chatgpt_link_override = 20; */
378
+ if (message.injectChatgptLinkOverride !== false)
379
+ writer.tag(20, WireType.Varint).bool(message.injectChatgptLinkOverride);
364
380
  let u = options.writeUnknownFields;
365
381
  if (u !== false)
366
382
  (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
@@ -188,8 +188,9 @@ export interface ReplToken {
188
188
  before?: Timestamp;
189
189
  /**
190
190
  * Resource tier selects the Goval 3 resource size. Current values are
191
- * "medium" and "large". Goval 3 combines this with `paid` to select a
192
- * ReplPool tier such as "free-medium", "paid-medium", or "paid-large".
191
+ * "small", "medium", and "large". Goval 3 combines this with `paid` to
192
+ * select a ReplPool tier such as "free-small", "paid-medium", or
193
+ * "paid-large".
193
194
  *
194
195
  * @generated from protobuf field: string resource_tier = 25
195
196
  */
@@ -200,6 +201,24 @@ export interface ReplToken {
200
201
  * @generated from protobuf field: optional google.protobuf.Duration idle_timeout = 26
201
202
  */
202
203
  idleTimeout?: Duration;
204
+ /**
205
+ * @deprecated
206
+ * @generated from protobuf field: replit.goval.api.token.ReplToken.Mode mode = 27 [deprecated = true]
207
+ */
208
+ mode: ReplToken_Mode;
209
+ /**
210
+ * The Jetplane resource group containing this repl.
211
+ *
212
+ * @generated from protobuf field: string resource_group_id = 28
213
+ */
214
+ resourceGroupId: string;
215
+ /**
216
+ * Whether automated abuse detection may request takedowns for this repl.
217
+ * Unset is treated as false.
218
+ *
219
+ * @generated from protobuf field: optional bool automated_takedown_eligible = 29
220
+ */
221
+ automatedTakedownEligible?: boolean;
203
222
  }
204
223
  /**
205
224
  * Metadata for the classroom. This is deprecated and should be removed
@@ -300,6 +319,25 @@ export declare enum ReplToken_WireFormat {
300
319
  */
301
320
  RIVER = 3
302
321
  }
322
+ /**
323
+ * Deprecated: Jetplane's persisted Repl mode is authoritative.
324
+ *
325
+ * @generated from protobuf enum replit.goval.api.token.ReplToken.Mode
326
+ */
327
+ export declare enum ReplToken_Mode {
328
+ /**
329
+ * @generated from protobuf enum value: MODE_UNSPECIFIED = 0;
330
+ */
331
+ UNSPECIFIED = 0,
332
+ /**
333
+ * @generated from protobuf enum value: MODE_WORKSPACE = 1;
334
+ */
335
+ WORKSPACE = 1,
336
+ /**
337
+ * @generated from protobuf enum value: MODE_MACHINE = 2;
338
+ */
339
+ MACHINE = 2
340
+ }
303
341
  declare class ReplToken$Type extends MessageType<ReplToken> {
304
342
  constructor();
305
343
  create(value?: PartialMessage<ReplToken>): ReplToken;
@@ -44,6 +44,26 @@ export var ReplToken_WireFormat;
44
44
  */
45
45
  ReplToken_WireFormat[ReplToken_WireFormat["RIVER"] = 3] = "RIVER";
46
46
  })(ReplToken_WireFormat || (ReplToken_WireFormat = {}));
47
+ /**
48
+ * Deprecated: Jetplane's persisted Repl mode is authoritative.
49
+ *
50
+ * @generated from protobuf enum replit.goval.api.token.ReplToken.Mode
51
+ */
52
+ export var ReplToken_Mode;
53
+ (function (ReplToken_Mode) {
54
+ /**
55
+ * @generated from protobuf enum value: MODE_UNSPECIFIED = 0;
56
+ */
57
+ ReplToken_Mode[ReplToken_Mode["UNSPECIFIED"] = 0] = "UNSPECIFIED";
58
+ /**
59
+ * @generated from protobuf enum value: MODE_WORKSPACE = 1;
60
+ */
61
+ ReplToken_Mode[ReplToken_Mode["WORKSPACE"] = 1] = "WORKSPACE";
62
+ /**
63
+ * @generated from protobuf enum value: MODE_MACHINE = 2;
64
+ */
65
+ ReplToken_Mode[ReplToken_Mode["MACHINE"] = 2] = "MACHINE";
66
+ })(ReplToken_Mode || (ReplToken_Mode = {}));
47
67
  // @generated message type with reflection information, may provide speed optimized methods
48
68
  class ReplToken$Type extends MessageType {
49
69
  constructor() {
@@ -69,7 +89,10 @@ class ReplToken$Type extends MessageType {
69
89
  { no: 22, name: "external_secrets", kind: "message", repeat: 2 /*RepeatType.UNPACKED*/, T: () => ReplToken_ExternalSecret },
70
90
  { no: 23, name: "before", kind: "message", T: () => Timestamp },
71
91
  { no: 25, name: "resource_tier", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
72
- { no: 26, name: "idle_timeout", kind: "message", T: () => Duration }
92
+ { no: 26, name: "idle_timeout", kind: "message", T: () => Duration },
93
+ { no: 27, name: "mode", kind: "enum", T: () => ["replit.goval.api.token.ReplToken.Mode", ReplToken_Mode, "MODE_"] },
94
+ { no: 28, name: "resource_group_id", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
95
+ { no: 29, name: "automated_takedown_eligible", kind: "scalar", opt: true, T: 8 /*ScalarType.BOOL*/ }
73
96
  ]);
74
97
  }
75
98
  create(value) {
@@ -85,6 +108,8 @@ class ReplToken$Type extends MessageType {
85
108
  message.replexec = false;
86
109
  message.externalSecrets = [];
87
110
  message.resourceTier = "";
111
+ message.mode = 0;
112
+ message.resourceGroupId = "";
88
113
  if (value !== undefined)
89
114
  reflectionMergePartial(this, message, value);
90
115
  return message;
@@ -169,6 +194,15 @@ class ReplToken$Type extends MessageType {
169
194
  case /* optional google.protobuf.Duration idle_timeout */ 26:
170
195
  message.idleTimeout = Duration.internalBinaryRead(reader, reader.uint32(), options, message.idleTimeout);
171
196
  break;
197
+ case /* replit.goval.api.token.ReplToken.Mode mode = 27 [deprecated = true] */ 27:
198
+ message.mode = reader.int32();
199
+ break;
200
+ case /* string resource_group_id */ 28:
201
+ message.resourceGroupId = reader.string();
202
+ break;
203
+ case /* optional bool automated_takedown_eligible */ 29:
204
+ message.automatedTakedownEligible = reader.bool();
205
+ break;
172
206
  default:
173
207
  let u = options.readUnknownField;
174
208
  if (u === "throw")
@@ -247,6 +281,15 @@ class ReplToken$Type extends MessageType {
247
281
  /* optional google.protobuf.Duration idle_timeout = 26; */
248
282
  if (message.idleTimeout)
249
283
  Duration.internalBinaryWrite(message.idleTimeout, writer.tag(26, WireType.LengthDelimited).fork(), options).join();
284
+ /* replit.goval.api.token.ReplToken.Mode mode = 27 [deprecated = true]; */
285
+ if (message.mode !== 0)
286
+ writer.tag(27, WireType.Varint).int32(message.mode);
287
+ /* string resource_group_id = 28; */
288
+ if (message.resourceGroupId !== "")
289
+ writer.tag(28, WireType.LengthDelimited).string(message.resourceGroupId);
290
+ /* optional bool automated_takedown_eligible = 29; */
291
+ if (message.automatedTakedownEligible !== undefined)
292
+ writer.tag(29, WireType.Varint).bool(message.automatedTakedownEligible);
250
293
  let u = options.writeUnknownFields;
251
294
  if (u !== false)
252
295
  (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
@@ -6,6 +6,7 @@ import type { PartialMessage } from "@protobuf-ts/runtime";
6
6
  import { MessageType } from "@protobuf-ts/runtime";
7
7
  import { Struct } from "../google/protobuf/struct.js";
8
8
  import { Timestamp } from "../google/protobuf/timestamp.js";
9
+ import { OciRuntimeProfile } from "./oci/runtime_profile.js";
9
10
  import { Pid2Binary } from "./repl/repl.js";
10
11
  import { Empty } from "../google/protobuf/empty.js";
11
12
  /**
@@ -1843,6 +1844,10 @@ export interface Pid1Config {
1843
1844
  * @generated from protobuf field: replit.goval.api.repl.Pid2Binary pid2_info = 6
1844
1845
  */
1845
1846
  pid2Info?: Pid2Binary;
1847
+ /**
1848
+ * @generated from protobuf field: replit.goval.api.oci.OciRuntimeProfile oci_runtime_profile = 8
1849
+ */
1850
+ ociRuntimeProfile?: OciRuntimeProfile;
1846
1851
  }
1847
1852
  /**
1848
1853
  * @generated from protobuf message replit.goval.api.FSLock
package/dist/api/types.js CHANGED
@@ -4,6 +4,7 @@ import { reflectionMergePartial } from "@protobuf-ts/runtime";
4
4
  import { MessageType } from "@protobuf-ts/runtime";
5
5
  import { Struct } from "../google/protobuf/struct.js";
6
6
  import { Timestamp } from "../google/protobuf/timestamp.js";
7
+ import { OciRuntimeProfile } from "./oci/runtime_profile.js";
7
8
  import { Pid2Binary } from "./repl/repl.js";
8
9
  import { Empty } from "../google/protobuf/empty.js";
9
10
  /**
@@ -3977,7 +3978,8 @@ class Pid1Config$Type extends MessageType {
3977
3978
  { no: 3, name: "env", kind: "map", K: 9 /*ScalarType.STRING*/, V: { kind: "scalar", T: 9 /*ScalarType.STRING*/ } },
3978
3979
  { no: 4, name: "noStore", kind: "scalar", T: 8 /*ScalarType.BOOL*/ },
3979
3980
  { no: 5, name: "noninteractiveFSChange", kind: "scalar", T: 8 /*ScalarType.BOOL*/ },
3980
- { no: 6, name: "pid2_info", kind: "message", T: () => Pid2Binary }
3981
+ { no: 6, name: "pid2_info", kind: "message", T: () => Pid2Binary },
3982
+ { no: 8, name: "oci_runtime_profile", kind: "message", T: () => OciRuntimeProfile }
3981
3983
  ]);
3982
3984
  }
3983
3985
  create(value) {
@@ -4014,6 +4016,9 @@ class Pid1Config$Type extends MessageType {
4014
4016
  case /* replit.goval.api.repl.Pid2Binary pid2_info */ 6:
4015
4017
  message.pid2Info = Pid2Binary.internalBinaryRead(reader, reader.uint32(), options, message.pid2Info);
4016
4018
  break;
4019
+ case /* replit.goval.api.oci.OciRuntimeProfile oci_runtime_profile */ 8:
4020
+ message.ociRuntimeProfile = OciRuntimeProfile.internalBinaryRead(reader, reader.uint32(), options, message.ociRuntimeProfile);
4021
+ break;
4017
4022
  default:
4018
4023
  let u = options.readUnknownField;
4019
4024
  if (u === "throw")
@@ -4060,6 +4065,9 @@ class Pid1Config$Type extends MessageType {
4060
4065
  /* replit.goval.api.repl.Pid2Binary pid2_info = 6; */
4061
4066
  if (message.pid2Info)
4062
4067
  Pid2Binary.internalBinaryWrite(message.pid2Info, writer.tag(6, WireType.LengthDelimited).fork(), options).join();
4068
+ /* replit.goval.api.oci.OciRuntimeProfile oci_runtime_profile = 8; */
4069
+ if (message.ociRuntimeProfile)
4070
+ OciRuntimeProfile.internalBinaryWrite(message.ociRuntimeProfile, writer.tag(8, WireType.LengthDelimited).fork(), options).join();
4063
4071
  let u = options.writeUnknownFields;
4064
4072
  if (u !== false)
4065
4073
  (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
@@ -0,0 +1,180 @@
1
+ import type { BinaryWriteOptions } from "@protobuf-ts/runtime";
2
+ import type { IBinaryWriter } from "@protobuf-ts/runtime";
3
+ import type { IBinaryReader } from "@protobuf-ts/runtime";
4
+ import type { PartialMessage } from "@protobuf-ts/runtime";
5
+ import type { JsonValue } from "@protobuf-ts/runtime";
6
+ import type { JsonReadOptions } from "@protobuf-ts/runtime";
7
+ import type { JsonWriteOptions } from "@protobuf-ts/runtime";
8
+ import type { BinaryReadOptions } from "@protobuf-ts/runtime";
9
+ import type { IMessageType } from "@protobuf-ts/runtime";
10
+ import { MessageType } from "@protobuf-ts/runtime";
11
+ /**
12
+ * `Any` contains an arbitrary serialized protocol buffer message along with a
13
+ * URL that describes the type of the serialized message.
14
+ *
15
+ * Protobuf library provides support to pack/unpack Any values in the form
16
+ * of utility functions or additional generated methods of the Any type.
17
+ *
18
+ * Example 1: Pack and unpack a message in C++.
19
+ *
20
+ * Foo foo = ...;
21
+ * Any any;
22
+ * any.PackFrom(foo);
23
+ * ...
24
+ * if (any.UnpackTo(&foo)) {
25
+ * ...
26
+ * }
27
+ *
28
+ * Example 2: Pack and unpack a message in Java.
29
+ *
30
+ * Foo foo = ...;
31
+ * Any any = Any.pack(foo);
32
+ * ...
33
+ * if (any.is(Foo.class)) {
34
+ * foo = any.unpack(Foo.class);
35
+ * }
36
+ * // or ...
37
+ * if (any.isSameTypeAs(Foo.getDefaultInstance())) {
38
+ * foo = any.unpack(Foo.getDefaultInstance());
39
+ * }
40
+ *
41
+ * Example 3: Pack and unpack a message in Python.
42
+ *
43
+ * foo = Foo(...)
44
+ * any = Any()
45
+ * any.Pack(foo)
46
+ * ...
47
+ * if any.Is(Foo.DESCRIPTOR):
48
+ * any.Unpack(foo)
49
+ * ...
50
+ *
51
+ * Example 4: Pack and unpack a message in Go
52
+ *
53
+ * foo := &pb.Foo{...}
54
+ * any, err := anypb.New(foo)
55
+ * if err != nil {
56
+ * ...
57
+ * }
58
+ * ...
59
+ * foo := &pb.Foo{}
60
+ * if err := any.UnmarshalTo(foo); err != nil {
61
+ * ...
62
+ * }
63
+ *
64
+ * The pack methods provided by protobuf library will by default use
65
+ * 'type.googleapis.com/full.type.name' as the type URL and the unpack
66
+ * methods only use the fully qualified type name after the last '/'
67
+ * in the type URL, for example "foo.bar.com/x/y.z" will yield type
68
+ * name "y.z".
69
+ *
70
+ * JSON
71
+ * ====
72
+ * The JSON representation of an `Any` value uses the regular
73
+ * representation of the deserialized, embedded message, with an
74
+ * additional field `@type` which contains the type URL. Example:
75
+ *
76
+ * package google.profile;
77
+ * message Person {
78
+ * string first_name = 1;
79
+ * string last_name = 2;
80
+ * }
81
+ *
82
+ * {
83
+ * "@type": "type.googleapis.com/google.profile.Person",
84
+ * "firstName": <string>,
85
+ * "lastName": <string>
86
+ * }
87
+ *
88
+ * If the embedded message type is well-known and has a custom JSON
89
+ * representation, that representation will be embedded adding a field
90
+ * `value` which holds the custom JSON in addition to the `@type`
91
+ * field. Example (for message [google.protobuf.Duration][]):
92
+ *
93
+ * {
94
+ * "@type": "type.googleapis.com/google.protobuf.Duration",
95
+ * "value": "1.212s"
96
+ * }
97
+ *
98
+ *
99
+ * @generated from protobuf message google.protobuf.Any
100
+ */
101
+ export interface Any {
102
+ /**
103
+ * A URL/resource name that uniquely identifies the type of the serialized
104
+ * protocol buffer message. This string must contain at least
105
+ * one "/" character. The last segment of the URL's path must represent
106
+ * the fully qualified name of the type (as in
107
+ * `path/google.protobuf.Duration`). The name should be in a canonical form
108
+ * (e.g., leading "." is not accepted).
109
+ *
110
+ * In practice, teams usually precompile into the binary all types that they
111
+ * expect it to use in the context of Any. However, for URLs which use the
112
+ * scheme `http`, `https`, or no scheme, one can optionally set up a type
113
+ * server that maps type URLs to message definitions as follows:
114
+ *
115
+ * * If no scheme is provided, `https` is assumed.
116
+ * * An HTTP GET on the URL must yield a [google.protobuf.Type][]
117
+ * value in binary format, or produce an error.
118
+ * * Applications are allowed to cache lookup results based on the
119
+ * URL, or have them precompiled into a binary to avoid any
120
+ * lookup. Therefore, binary compatibility needs to be preserved
121
+ * on changes to types. (Use versioned type names to manage
122
+ * breaking changes.)
123
+ *
124
+ * Note: this functionality is not currently available in the official
125
+ * protobuf release, and it is not used for type URLs beginning with
126
+ * type.googleapis.com. As of May 2023, there are no widely used type server
127
+ * implementations and no plans to implement one.
128
+ *
129
+ * Schemes other than `http`, `https` (or the empty scheme) might be
130
+ * used with implementation specific semantics.
131
+ *
132
+ *
133
+ * @generated from protobuf field: string type_url = 1
134
+ */
135
+ typeUrl: string;
136
+ /**
137
+ * Must be a valid serialized protocol buffer of the above specified type.
138
+ *
139
+ * @generated from protobuf field: bytes value = 2
140
+ */
141
+ value: Uint8Array;
142
+ }
143
+ declare class Any$Type extends MessageType<Any> {
144
+ constructor();
145
+ /**
146
+ * Pack the message into a new `Any`.
147
+ *
148
+ * Uses 'type.googleapis.com/full.type.name' as the type URL.
149
+ */
150
+ pack<T extends object>(message: T, type: IMessageType<T>): Any;
151
+ /**
152
+ * Unpack the message from the `Any`.
153
+ */
154
+ unpack<T extends object>(any: Any, type: IMessageType<T>, options?: Partial<BinaryReadOptions>): T;
155
+ /**
156
+ * Does the given `Any` contain a packed message of the given type?
157
+ */
158
+ contains(any: Any, type: IMessageType<any> | string): boolean;
159
+ /**
160
+ * Convert the message to canonical JSON value.
161
+ *
162
+ * You have to provide the `typeRegistry` option so that the
163
+ * packed message can be converted to JSON.
164
+ *
165
+ * The `typeRegistry` option is also required to read
166
+ * `google.protobuf.Any` from JSON format.
167
+ */
168
+ internalJsonWrite(any: Any, options: JsonWriteOptions): JsonValue;
169
+ internalJsonRead(json: JsonValue, options: JsonReadOptions, target?: Any): Any;
170
+ typeNameToUrl(name: string): string;
171
+ typeUrlToName(url: string): string;
172
+ create(value?: PartialMessage<Any>): Any;
173
+ internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: Any): Any;
174
+ internalBinaryWrite(message: Any, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter;
175
+ }
176
+ /**
177
+ * @generated MessageType for protobuf message google.protobuf.Any
178
+ */
179
+ export declare const Any: Any$Type;
180
+ export {};