@dcl/protocol 1.0.0-29287211316.commit-e44c721 → 1.0.0-29501656680.commit-6a4362a
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -217
- package/out-js/decentraland/kernel/comms/rfc4/comms.gen.d.ts +0 -21
- package/out-js/decentraland/kernel/comms/rfc4/comms.gen.js +4 -124
- package/out-js/decentraland/kernel/comms/rfc4/comms.gen.js.map +1 -1
- package/out-js/decentraland/sdk/components/avatar_shape.gen.d.ts +0 -8
- package/out-js/decentraland/sdk/components/avatar_shape.gen.js +1 -35
- package/out-js/decentraland/sdk/components/avatar_shape.gen.js.map +1 -1
- package/out-js/decentraland/sdk/components/touch_screen_controls.gen.d.ts +77 -0
- package/out-js/decentraland/sdk/components/touch_screen_controls.gen.js +201 -0
- package/out-js/decentraland/sdk/components/touch_screen_controls.gen.js.map +1 -0
- package/out-js/decentraland/sdk/components/ui_input_binding.gen.d.ts +52 -0
- package/out-js/decentraland/sdk/components/ui_input_binding.gen.js +81 -0
- package/out-js/decentraland/sdk/components/ui_input_binding.gen.js.map +1 -0
- package/out-ts/decentraland/kernel/comms/rfc4/comms.gen.ts +2 -166
- package/out-ts/decentraland/sdk/components/avatar_shape.gen.ts +0 -34
- package/out-ts/decentraland/sdk/components/touch_screen_controls.gen.ts +265 -0
- package/out-ts/decentraland/sdk/components/ui_input_binding.gen.ts +114 -0
- package/package.json +6 -9
- package/proto/buf.yaml +47 -0
- package/proto/decentraland/kernel/comms/rfc4/comms.proto +0 -11
- package/proto/decentraland/sdk/components/avatar_shape.proto +0 -5
- package/proto/decentraland/sdk/components/light_source.proto +1 -1
- package/proto/decentraland/sdk/components/touch_screen_controls.proto +38 -0
- package/proto/decentraland/sdk/components/ui_input_binding.proto +27 -0
- package/proto/decentraland/sdk/components/virtual_camera.proto +0 -2
- package/proto/google/LICENSE +27 -0
- package/proto/google/README.md +1 -0
- package/proto/google/api/annotations.json +83 -0
- package/proto/google/api/annotations.proto +11 -0
- package/proto/google/api/http.json +86 -0
- package/proto/google/api/http.proto +31 -0
- package/proto/google/protobuf/api.json +118 -0
- package/proto/google/protobuf/api.proto +34 -0
- package/proto/google/protobuf/descriptor.json +739 -0
- package/proto/google/protobuf/descriptor.proto +286 -0
- package/proto/google/protobuf/source_context.json +20 -0
- package/proto/google/protobuf/source_context.proto +7 -0
- package/proto/google/protobuf/type.json +202 -0
- package/proto/google/protobuf/type.proto +89 -0
- package/public/sdk-components.proto +2 -0
- package/proto/decentraland/common/options.proto +0 -51
- package/proto/decentraland/common/quantization_example.proto +0 -164
- package/proto/decentraland/pulse/pulse_client.proto +0 -79
- package/proto/decentraland/pulse/pulse_server.proto +0 -144
- package/proto/decentraland/pulse/pulse_shared.proto +0 -57
- package/protoc-gen-bitwise/generator_csharp.js +0 -248
- package/protoc-gen-bitwise/options.js +0 -139
- package/protoc-gen-bitwise/plugin.js +0 -87
- package/protoc-gen-bitwise/runtime/cs/Quantize.cs +0 -70
- package/protoc-gen-bitwise/wire.js +0 -239
|
@@ -1,239 +0,0 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Self-contained protobuf wire-format codec for protoc-gen-bitwise.
|
|
5
|
-
*
|
|
6
|
-
* The plugin only needs a tiny slice of the descriptor/plugin schemas, so
|
|
7
|
-
* rather than pull in a protobuf runtime (which would force every consumer —
|
|
8
|
-
* including the sibling Pulse checkout that runs this file directly off disk —
|
|
9
|
-
* to `npm install` the protocol repo) we decode the handful of fields we care
|
|
10
|
-
* about by walking the wire format directly. This mirrors the original Python
|
|
11
|
-
* plugin, which already hand-parsed FieldOptions for the same reason.
|
|
12
|
-
*
|
|
13
|
-
* Decoded subset:
|
|
14
|
-
* CodeGeneratorRequest { file_to_generate = 1; proto_file = 15; }
|
|
15
|
-
* FileDescriptorProto { name = 1; package = 2; message_type = 4; }
|
|
16
|
-
* DescriptorProto { name = 1; field = 2; }
|
|
17
|
-
* FieldDescriptorProto { name = 1; label = 4; type = 5; options = 8 (raw bytes); }
|
|
18
|
-
*
|
|
19
|
-
* Encoded subset:
|
|
20
|
-
* CodeGeneratorResponse { error = 1; supported_features = 2; file = 15; }
|
|
21
|
-
* CodeGeneratorResponse.File { name = 1; content = 15; }
|
|
22
|
-
*
|
|
23
|
-
* Wire types: 0 = varint, 1 = 64-bit, 2 = length-delimited, 5 = 32-bit.
|
|
24
|
-
*/
|
|
25
|
-
|
|
26
|
-
// ---------------------------------------------------------------------------
|
|
27
|
-
// Low-level readers
|
|
28
|
-
// ---------------------------------------------------------------------------
|
|
29
|
-
|
|
30
|
-
/** Decode a protobuf varint at `pos`. Returns [value, newPos]. */
|
|
31
|
-
function readVarint(buf, pos) {
|
|
32
|
-
let result = 0
|
|
33
|
-
let shift = 0
|
|
34
|
-
let byte
|
|
35
|
-
do {
|
|
36
|
-
byte = buf[pos++]
|
|
37
|
-
// Multiplication (not <<) keeps values correct past 32 bits.
|
|
38
|
-
result += (byte & 0x7f) * Math.pow(2, shift)
|
|
39
|
-
shift += 7
|
|
40
|
-
} while (byte & 0x80)
|
|
41
|
-
return [result, pos]
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
/** Advance `pos` past a field of the given wire type. Returns newPos. */
|
|
45
|
-
function skipField(buf, pos, wireType) {
|
|
46
|
-
switch (wireType) {
|
|
47
|
-
case 0: // varint
|
|
48
|
-
return readVarint(buf, pos)[1]
|
|
49
|
-
case 1: // 64-bit
|
|
50
|
-
return pos + 8
|
|
51
|
-
case 2: {
|
|
52
|
-
// length-delimited
|
|
53
|
-
const [length, next] = readVarint(buf, pos)
|
|
54
|
-
return next + length
|
|
55
|
-
}
|
|
56
|
-
case 5: // 32-bit
|
|
57
|
-
return pos + 4
|
|
58
|
-
default:
|
|
59
|
-
// Groups (3/4) are deprecated and never appear in descriptors.
|
|
60
|
-
return pos
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
// ---------------------------------------------------------------------------
|
|
65
|
-
// Request decoding
|
|
66
|
-
// ---------------------------------------------------------------------------
|
|
67
|
-
|
|
68
|
-
function decodeFieldDescriptor(buf) {
|
|
69
|
-
const field = { name: '', label: 0, type: 0, optionsRaw: null }
|
|
70
|
-
let pos = 0
|
|
71
|
-
while (pos < buf.length) {
|
|
72
|
-
let tag
|
|
73
|
-
;[tag, pos] = readVarint(buf, pos)
|
|
74
|
-
const fieldNum = tag >>> 3
|
|
75
|
-
const wireType = tag & 0x7
|
|
76
|
-
if (fieldNum === 1 && wireType === 2) {
|
|
77
|
-
let len
|
|
78
|
-
;[len, pos] = readVarint(buf, pos)
|
|
79
|
-
field.name = buf.toString('utf8', pos, pos + len)
|
|
80
|
-
pos += len
|
|
81
|
-
} else if (fieldNum === 4 && wireType === 0) {
|
|
82
|
-
;[field.label, pos] = readVarint(buf, pos)
|
|
83
|
-
} else if (fieldNum === 5 && wireType === 0) {
|
|
84
|
-
;[field.type, pos] = readVarint(buf, pos)
|
|
85
|
-
} else if (fieldNum === 8 && wireType === 2) {
|
|
86
|
-
let len
|
|
87
|
-
;[len, pos] = readVarint(buf, pos)
|
|
88
|
-
// Keep the raw FieldOptions bytes so custom extensions survive (the
|
|
89
|
-
// descriptor schema doesn't know about ext 50001/50002).
|
|
90
|
-
field.optionsRaw = buf.subarray(pos, pos + len)
|
|
91
|
-
pos += len
|
|
92
|
-
} else {
|
|
93
|
-
pos = skipField(buf, pos, wireType)
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
return field
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
function decodeDescriptor(buf) {
|
|
100
|
-
const message = { name: '', field: [] }
|
|
101
|
-
let pos = 0
|
|
102
|
-
while (pos < buf.length) {
|
|
103
|
-
let tag
|
|
104
|
-
;[tag, pos] = readVarint(buf, pos)
|
|
105
|
-
const fieldNum = tag >>> 3
|
|
106
|
-
const wireType = tag & 0x7
|
|
107
|
-
if (fieldNum === 1 && wireType === 2) {
|
|
108
|
-
let len
|
|
109
|
-
;[len, pos] = readVarint(buf, pos)
|
|
110
|
-
message.name = buf.toString('utf8', pos, pos + len)
|
|
111
|
-
pos += len
|
|
112
|
-
} else if (fieldNum === 2 && wireType === 2) {
|
|
113
|
-
let len
|
|
114
|
-
;[len, pos] = readVarint(buf, pos)
|
|
115
|
-
message.field.push(decodeFieldDescriptor(buf.subarray(pos, pos + len)))
|
|
116
|
-
pos += len
|
|
117
|
-
} else {
|
|
118
|
-
// nested_type / enum_type / etc. are intentionally ignored — the
|
|
119
|
-
// generator only walks top-level messages, matching the Python plugin.
|
|
120
|
-
pos = skipField(buf, pos, wireType)
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
return message
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
function decodeFileDescriptor(buf) {
|
|
127
|
-
const file = { name: '', package: '', messageType: [] }
|
|
128
|
-
let pos = 0
|
|
129
|
-
while (pos < buf.length) {
|
|
130
|
-
let tag
|
|
131
|
-
;[tag, pos] = readVarint(buf, pos)
|
|
132
|
-
const fieldNum = tag >>> 3
|
|
133
|
-
const wireType = tag & 0x7
|
|
134
|
-
if (fieldNum === 1 && wireType === 2) {
|
|
135
|
-
let len
|
|
136
|
-
;[len, pos] = readVarint(buf, pos)
|
|
137
|
-
file.name = buf.toString('utf8', pos, pos + len)
|
|
138
|
-
pos += len
|
|
139
|
-
} else if (fieldNum === 2 && wireType === 2) {
|
|
140
|
-
let len
|
|
141
|
-
;[len, pos] = readVarint(buf, pos)
|
|
142
|
-
file.package = buf.toString('utf8', pos, pos + len)
|
|
143
|
-
pos += len
|
|
144
|
-
} else if (fieldNum === 4 && wireType === 2) {
|
|
145
|
-
let len
|
|
146
|
-
;[len, pos] = readVarint(buf, pos)
|
|
147
|
-
file.messageType.push(decodeDescriptor(buf.subarray(pos, pos + len)))
|
|
148
|
-
pos += len
|
|
149
|
-
} else {
|
|
150
|
-
pos = skipField(buf, pos, wireType)
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
return file
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
/** Decode a serialized CodeGeneratorRequest. */
|
|
157
|
-
function decodeRequest(buf) {
|
|
158
|
-
const request = { fileToGenerate: [], protoFile: [] }
|
|
159
|
-
let pos = 0
|
|
160
|
-
while (pos < buf.length) {
|
|
161
|
-
let tag
|
|
162
|
-
;[tag, pos] = readVarint(buf, pos)
|
|
163
|
-
const fieldNum = tag >>> 3
|
|
164
|
-
const wireType = tag & 0x7
|
|
165
|
-
if (fieldNum === 1 && wireType === 2) {
|
|
166
|
-
let len
|
|
167
|
-
;[len, pos] = readVarint(buf, pos)
|
|
168
|
-
request.fileToGenerate.push(buf.toString('utf8', pos, pos + len))
|
|
169
|
-
pos += len
|
|
170
|
-
} else if (fieldNum === 15 && wireType === 2) {
|
|
171
|
-
let len
|
|
172
|
-
;[len, pos] = readVarint(buf, pos)
|
|
173
|
-
request.protoFile.push(decodeFileDescriptor(buf.subarray(pos, pos + len)))
|
|
174
|
-
pos += len
|
|
175
|
-
} else {
|
|
176
|
-
pos = skipField(buf, pos, wireType)
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
return request
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
// ---------------------------------------------------------------------------
|
|
183
|
-
// Response encoding
|
|
184
|
-
// ---------------------------------------------------------------------------
|
|
185
|
-
|
|
186
|
-
/** Encode an unsigned integer as a protobuf varint Buffer. */
|
|
187
|
-
function encodeVarint(value) {
|
|
188
|
-
const bytes = []
|
|
189
|
-
let v = value
|
|
190
|
-
while (v > 0x7f) {
|
|
191
|
-
bytes.push((v & 0x7f) | 0x80)
|
|
192
|
-
v = Math.floor(v / 128)
|
|
193
|
-
}
|
|
194
|
-
bytes.push(v & 0x7f)
|
|
195
|
-
return Buffer.from(bytes)
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
function encodeTag(fieldNum, wireType) {
|
|
199
|
-
return encodeVarint((fieldNum << 3) | wireType)
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
/** Encode a length-delimited (string/bytes) field: tag + length + payload. */
|
|
203
|
-
function encodeLengthDelimited(fieldNum, payload) {
|
|
204
|
-
const buf = Buffer.isBuffer(payload) ? payload : Buffer.from(payload, 'utf8')
|
|
205
|
-
return Buffer.concat([encodeTag(fieldNum, 2), encodeVarint(buf.length), buf])
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
function encodeFile(file) {
|
|
209
|
-
return Buffer.concat([
|
|
210
|
-
encodeLengthDelimited(1, file.name), // name = 1
|
|
211
|
-
encodeLengthDelimited(15, file.content), // content = 15
|
|
212
|
-
])
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
/**
|
|
216
|
-
* Encode a CodeGeneratorResponse.
|
|
217
|
-
* @param {{error?: string|null, supportedFeatures?: number, files?: Array<{name:string,content:string}>}} response
|
|
218
|
-
*/
|
|
219
|
-
function encodeResponse(response) {
|
|
220
|
-
const parts = []
|
|
221
|
-
if (response.error != null) {
|
|
222
|
-
parts.push(encodeLengthDelimited(1, response.error)) // error = 1
|
|
223
|
-
}
|
|
224
|
-
if (response.supportedFeatures != null) {
|
|
225
|
-
parts.push(encodeTag(2, 0)) // supported_features = 2 (varint)
|
|
226
|
-
parts.push(encodeVarint(response.supportedFeatures))
|
|
227
|
-
}
|
|
228
|
-
for (const file of response.files || []) {
|
|
229
|
-
parts.push(encodeLengthDelimited(15, encodeFile(file))) // file = 15
|
|
230
|
-
}
|
|
231
|
-
return Buffer.concat(parts)
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
module.exports = {
|
|
235
|
-
readVarint,
|
|
236
|
-
skipField,
|
|
237
|
-
decodeRequest,
|
|
238
|
-
encodeResponse,
|
|
239
|
-
}
|