@replit/protocol 0.4.29 → 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.
- package/dist/api/jetplane/repl/repl.client.d.ts +50 -0
- package/dist/api/jetplane/repl/repl.client.js +39 -8
- package/dist/api/jetplane/repl/repl.d.ts +338 -13
- package/dist/api/jetplane/repl/repl.js +656 -13
- package/dist/api/lore/lore.d.ts +6 -0
- package/dist/api/lore/lore.js +9 -1
- package/dist/api/lore/service.client.d.ts +120 -0
- package/dist/api/lore/service.client.js +98 -24
- package/dist/api/lore/service.d.ts +461 -0
- package/dist/api/lore/service.js +1096 -158
- package/dist/api/oci/runtime_profile.d.ts +59 -0
- package/dist/api/oci/runtime_profile.js +105 -0
- package/dist/api/token/token.d.ts +13 -0
- package/dist/api/token/token.js +16 -1
- package/dist/api/types.d.ts +5 -0
- package/dist/api/types.js +9 -1
- package/dist/google/protobuf/any.d.ts +180 -0
- package/dist/google/protobuf/any.js +151 -0
- package/dist/google/protobuf/field_mask.d.ts +18 -16
- package/dist/google/protobuf/struct.d.ts +22 -33
- package/dist/google/protobuf/struct.js +3 -8
- package/dist/google/protobuf/timestamp.d.ts +8 -9
- package/dist/google/rpc/status.d.ts +35 -0
- package/dist/google/rpc/status.js +68 -0
- package/iotester/index.d.ts +3516 -6
- package/iotester/index.js +15288 -6455
- package/main/index.d.ts +3516 -6
- package/main/index.js +15288 -6455
- package/package.json +1 -1
|
@@ -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();
|
|
@@ -206,6 +206,19 @@ export interface ReplToken {
|
|
|
206
206
|
* @generated from protobuf field: replit.goval.api.token.ReplToken.Mode mode = 27 [deprecated = true]
|
|
207
207
|
*/
|
|
208
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;
|
|
209
222
|
}
|
|
210
223
|
/**
|
|
211
224
|
* Metadata for the classroom. This is deprecated and should be removed
|
package/dist/api/token/token.js
CHANGED
|
@@ -90,7 +90,9 @@ class ReplToken$Type extends MessageType {
|
|
|
90
90
|
{ no: 23, name: "before", kind: "message", T: () => Timestamp },
|
|
91
91
|
{ no: 25, name: "resource_tier", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
|
|
92
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_"] }
|
|
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*/ }
|
|
94
96
|
]);
|
|
95
97
|
}
|
|
96
98
|
create(value) {
|
|
@@ -107,6 +109,7 @@ class ReplToken$Type extends MessageType {
|
|
|
107
109
|
message.externalSecrets = [];
|
|
108
110
|
message.resourceTier = "";
|
|
109
111
|
message.mode = 0;
|
|
112
|
+
message.resourceGroupId = "";
|
|
110
113
|
if (value !== undefined)
|
|
111
114
|
reflectionMergePartial(this, message, value);
|
|
112
115
|
return message;
|
|
@@ -194,6 +197,12 @@ class ReplToken$Type extends MessageType {
|
|
|
194
197
|
case /* replit.goval.api.token.ReplToken.Mode mode = 27 [deprecated = true] */ 27:
|
|
195
198
|
message.mode = reader.int32();
|
|
196
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;
|
|
197
206
|
default:
|
|
198
207
|
let u = options.readUnknownField;
|
|
199
208
|
if (u === "throw")
|
|
@@ -275,6 +284,12 @@ class ReplToken$Type extends MessageType {
|
|
|
275
284
|
/* replit.goval.api.token.ReplToken.Mode mode = 27 [deprecated = true]; */
|
|
276
285
|
if (message.mode !== 0)
|
|
277
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);
|
|
278
293
|
let u = options.writeUnknownFields;
|
|
279
294
|
if (u !== false)
|
|
280
295
|
(u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
|
package/dist/api/types.d.ts
CHANGED
|
@@ -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 {};
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import { WireType } from "@protobuf-ts/runtime";
|
|
2
|
+
import { UnknownFieldHandler } from "@protobuf-ts/runtime";
|
|
3
|
+
import { reflectionMergePartial } from "@protobuf-ts/runtime";
|
|
4
|
+
import { isJsonObject } from "@protobuf-ts/runtime";
|
|
5
|
+
import { typeofJsonValue } from "@protobuf-ts/runtime";
|
|
6
|
+
import { jsonWriteOptions } from "@protobuf-ts/runtime";
|
|
7
|
+
import { MessageType } from "@protobuf-ts/runtime";
|
|
8
|
+
// @generated message type with reflection information, may provide speed optimized methods
|
|
9
|
+
class Any$Type extends MessageType {
|
|
10
|
+
constructor() {
|
|
11
|
+
super("google.protobuf.Any", [
|
|
12
|
+
{ no: 1, name: "type_url", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
|
|
13
|
+
{ no: 2, name: "value", kind: "scalar", T: 12 /*ScalarType.BYTES*/ }
|
|
14
|
+
]);
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Pack the message into a new `Any`.
|
|
18
|
+
*
|
|
19
|
+
* Uses 'type.googleapis.com/full.type.name' as the type URL.
|
|
20
|
+
*/
|
|
21
|
+
pack(message, type) {
|
|
22
|
+
return {
|
|
23
|
+
typeUrl: this.typeNameToUrl(type.typeName), value: type.toBinary(message),
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Unpack the message from the `Any`.
|
|
28
|
+
*/
|
|
29
|
+
unpack(any, type, options) {
|
|
30
|
+
if (!this.contains(any, type))
|
|
31
|
+
throw new Error("Cannot unpack google.protobuf.Any with typeUrl '" + any.typeUrl + "' as " + type.typeName + ".");
|
|
32
|
+
return type.fromBinary(any.value, options);
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Does the given `Any` contain a packed message of the given type?
|
|
36
|
+
*/
|
|
37
|
+
contains(any, type) {
|
|
38
|
+
if (!any.typeUrl.length)
|
|
39
|
+
return false;
|
|
40
|
+
let wants = typeof type == "string" ? type : type.typeName;
|
|
41
|
+
let has = this.typeUrlToName(any.typeUrl);
|
|
42
|
+
return wants === has;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Convert the message to canonical JSON value.
|
|
46
|
+
*
|
|
47
|
+
* You have to provide the `typeRegistry` option so that the
|
|
48
|
+
* packed message can be converted to JSON.
|
|
49
|
+
*
|
|
50
|
+
* The `typeRegistry` option is also required to read
|
|
51
|
+
* `google.protobuf.Any` from JSON format.
|
|
52
|
+
*/
|
|
53
|
+
internalJsonWrite(any, options) {
|
|
54
|
+
if (any.typeUrl === "")
|
|
55
|
+
return {};
|
|
56
|
+
let typeName = this.typeUrlToName(any.typeUrl);
|
|
57
|
+
let opt = jsonWriteOptions(options);
|
|
58
|
+
let type = opt.typeRegistry?.find(t => t.typeName === typeName);
|
|
59
|
+
if (!type)
|
|
60
|
+
throw new globalThis.Error("Unable to convert google.protobuf.Any with typeUrl '" + any.typeUrl + "' to JSON. The specified type " + typeName + " is not available in the type registry.");
|
|
61
|
+
let value = type.fromBinary(any.value, { readUnknownField: false });
|
|
62
|
+
let json = type.internalJsonWrite(value, opt);
|
|
63
|
+
if (typeName.startsWith("google.protobuf.") || !isJsonObject(json))
|
|
64
|
+
json = { value: json };
|
|
65
|
+
json["@type"] = any.typeUrl;
|
|
66
|
+
return json;
|
|
67
|
+
}
|
|
68
|
+
internalJsonRead(json, options, target) {
|
|
69
|
+
if (!isJsonObject(json))
|
|
70
|
+
throw new globalThis.Error("Unable to parse google.protobuf.Any from JSON " + typeofJsonValue(json) + ".");
|
|
71
|
+
if (typeof json["@type"] != "string" || json["@type"] == "")
|
|
72
|
+
return this.create();
|
|
73
|
+
let typeName = this.typeUrlToName(json["@type"]);
|
|
74
|
+
let type = options?.typeRegistry?.find(t => t.typeName == typeName);
|
|
75
|
+
if (!type)
|
|
76
|
+
throw new globalThis.Error("Unable to parse google.protobuf.Any from JSON. The specified type " + typeName + " is not available in the type registry.");
|
|
77
|
+
let value;
|
|
78
|
+
if (typeName.startsWith("google.protobuf.") && json.hasOwnProperty("value"))
|
|
79
|
+
value = type.fromJson(json["value"], options);
|
|
80
|
+
else {
|
|
81
|
+
let copy = Object.assign({}, json);
|
|
82
|
+
delete copy["@type"];
|
|
83
|
+
value = type.fromJson(copy, options);
|
|
84
|
+
}
|
|
85
|
+
if (target === undefined)
|
|
86
|
+
target = this.create();
|
|
87
|
+
target.typeUrl = json["@type"];
|
|
88
|
+
target.value = type.toBinary(value);
|
|
89
|
+
return target;
|
|
90
|
+
}
|
|
91
|
+
typeNameToUrl(name) {
|
|
92
|
+
if (!name.length)
|
|
93
|
+
throw new Error("invalid type name: " + name);
|
|
94
|
+
return "type.googleapis.com/" + name;
|
|
95
|
+
}
|
|
96
|
+
typeUrlToName(url) {
|
|
97
|
+
if (!url.length)
|
|
98
|
+
throw new Error("invalid type url: " + url);
|
|
99
|
+
let slash = url.lastIndexOf("/");
|
|
100
|
+
let name = slash > 0 ? url.substring(slash + 1) : url;
|
|
101
|
+
if (!name.length)
|
|
102
|
+
throw new Error("invalid type url: " + url);
|
|
103
|
+
return name;
|
|
104
|
+
}
|
|
105
|
+
create(value) {
|
|
106
|
+
const message = globalThis.Object.create((this.messagePrototype));
|
|
107
|
+
message.typeUrl = "";
|
|
108
|
+
message.value = new Uint8Array(0);
|
|
109
|
+
if (value !== undefined)
|
|
110
|
+
reflectionMergePartial(this, message, value);
|
|
111
|
+
return message;
|
|
112
|
+
}
|
|
113
|
+
internalBinaryRead(reader, length, options, target) {
|
|
114
|
+
let message = target ?? this.create(), end = reader.pos + length;
|
|
115
|
+
while (reader.pos < end) {
|
|
116
|
+
let [fieldNo, wireType] = reader.tag();
|
|
117
|
+
switch (fieldNo) {
|
|
118
|
+
case /* string type_url */ 1:
|
|
119
|
+
message.typeUrl = reader.string();
|
|
120
|
+
break;
|
|
121
|
+
case /* bytes value */ 2:
|
|
122
|
+
message.value = reader.bytes();
|
|
123
|
+
break;
|
|
124
|
+
default:
|
|
125
|
+
let u = options.readUnknownField;
|
|
126
|
+
if (u === "throw")
|
|
127
|
+
throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
|
|
128
|
+
let d = reader.skip(wireType);
|
|
129
|
+
if (u !== false)
|
|
130
|
+
(u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
return message;
|
|
134
|
+
}
|
|
135
|
+
internalBinaryWrite(message, writer, options) {
|
|
136
|
+
/* string type_url = 1; */
|
|
137
|
+
if (message.typeUrl !== "")
|
|
138
|
+
writer.tag(1, WireType.LengthDelimited).string(message.typeUrl);
|
|
139
|
+
/* bytes value = 2; */
|
|
140
|
+
if (message.value.length)
|
|
141
|
+
writer.tag(2, WireType.LengthDelimited).bytes(message.value);
|
|
142
|
+
let u = options.writeUnknownFields;
|
|
143
|
+
if (u !== false)
|
|
144
|
+
(u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
|
|
145
|
+
return writer;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* @generated MessageType for protobuf message google.protobuf.Any
|
|
150
|
+
*/
|
|
151
|
+
export const Any = new Any$Type();
|
|
@@ -120,22 +120,24 @@ import { MessageType } from "@protobuf-ts/runtime";
|
|
|
120
120
|
* An implementation may provide options to override this default behavior for
|
|
121
121
|
* repeated and message fields.
|
|
122
122
|
*
|
|
123
|
-
*
|
|
124
|
-
*
|
|
125
|
-
*
|
|
126
|
-
*
|
|
127
|
-
*
|
|
128
|
-
*
|
|
129
|
-
*
|
|
130
|
-
*
|
|
131
|
-
*
|
|
132
|
-
*
|
|
133
|
-
*
|
|
134
|
-
*
|
|
135
|
-
*
|
|
136
|
-
*
|
|
137
|
-
*
|
|
138
|
-
*
|
|
123
|
+
* In order to reset a field's value to the default, the field must
|
|
124
|
+
* be in the mask and set to the default value in the provided resource.
|
|
125
|
+
* Hence, in order to reset all fields of a resource, provide a default
|
|
126
|
+
* instance of the resource and set all fields in the mask, or do
|
|
127
|
+
* not provide a mask as described below.
|
|
128
|
+
*
|
|
129
|
+
* If a field mask is not present on update, the operation applies to
|
|
130
|
+
* all fields (as if a field mask of all fields has been specified).
|
|
131
|
+
* Note that in the presence of schema evolution, this may mean that
|
|
132
|
+
* fields the client does not know and has therefore not filled into
|
|
133
|
+
* the request will be reset to their default. If this is unwanted
|
|
134
|
+
* behavior, a specific service may require a client to always specify
|
|
135
|
+
* a field mask, producing an error if not.
|
|
136
|
+
*
|
|
137
|
+
* As with get operations, the location of the resource which
|
|
138
|
+
* describes the updated values in the request message depends on the
|
|
139
|
+
* operation kind. In any case, the effect of the field mask is
|
|
140
|
+
* required to be honored by the API.
|
|
139
141
|
*
|
|
140
142
|
* ## Considerations for HTTP REST
|
|
141
143
|
*
|