@snap/push2web 0.23.0 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Push2Web.d.ts +1 -1
- package/dist/Push2Web.js +1 -1
- package/dist/generated-api-client/camera_kit/v3/export.d.ts +21 -463
- package/dist/generated-api-client/camera_kit/v3/export.js +322 -186
- package/dist/generated-api-client/camera_kit/v3/lens.d.ts +21 -307
- package/dist/generated-api-client/camera_kit/v3/lens.js +445 -203
- package/dist/generated-api-client/camera_kit/v3/push_to_device.d.ts +34 -335
- package/dist/generated-api-client/camera_kit/v3/push_to_device.js +431 -265
- package/dist/generated-api-client/core/snap_status_code.d.ts +14 -20
- package/dist/generated-api-client/core/snap_status_code.js +55 -30
- package/dist/generated-api-client/google/api/annotations.js +5 -6
- package/dist/generated-api-client/google/api/http.d.ts +17 -3342
- package/dist/generated-api-client/google/api/http.js +180 -100
- package/dist/generated-api-client/google/protobuf/any.d.ts +14 -16
- package/dist/generated-api-client/google/protobuf/any.js +51 -44
- package/dist/generated-api-client/google/protobuf/descriptor.d.ts +128 -50211
- package/dist/generated-api-client/google/protobuf/descriptor.js +1665 -966
- package/docs/html/classes/Push2Web.html +2 -2
- package/docs/html/enums/Code.html +2 -2
- package/docs/html/enums/ListenLensPushResponse_ExcludedLens_Code.html +2 -2
- package/docs/html/enums/State.html +2 -2
- package/docs/html/index.html +2 -2
- package/docs/html/interfaces/Lens.html +2 -2
- package/docs/html/modules.html +2 -2
- package/docs/html/types/CommunicationErrorEvent.html +2 -2
- package/docs/html/types/ErrorEvent.html +1 -1
- package/docs/html/types/GenericErrorEvent.html +2 -2
- package/docs/html/types/LensExcludedErrorEvent.html +2 -2
- package/docs/html/types/LensReceivedEvent.html +1 -1
- package/docs/html/types/Push2WebEvents.html +1 -1
- package/docs/html/types/SubscriptionChangedEvent.html +1 -1
- package/docs/html/types/SubscriptionInstance.html +2 -2
- package/docs/md/classes/Push2Web.md +1 -1
- package/docs/md/enums/Code.md +1 -1
- package/docs/md/enums/ListenLensPushResponse_ExcludedLens_Code.md +1 -1
- package/docs/md/enums/State.md +1 -1
- package/docs/md/interfaces/Lens.md +1 -1
- package/docs/md/modules.md +2 -2
- package/package.json +4 -5
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { grpc } from
|
|
3
|
-
import
|
|
4
|
-
import { Observable } from
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
export const protobufPackage = 'com.snap.camerakit.v3';
|
|
1
|
+
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
|
2
|
+
import { grpc } from "@improbable-eng/grpc-web";
|
|
3
|
+
import { BrowserHeaders } from "browser-headers";
|
|
4
|
+
import { Observable } from "rxjs";
|
|
5
|
+
import { share } from "rxjs/operators";
|
|
6
|
+
import { Lens } from "./lens";
|
|
7
|
+
export const protobufPackage = "com.snap.camerakit.v3";
|
|
9
8
|
export var PushLensSubscriptionResponse_ExcludedLens_Code;
|
|
10
9
|
(function (PushLensSubscriptionResponse_ExcludedLens_Code) {
|
|
11
10
|
PushLensSubscriptionResponse_ExcludedLens_Code["UNSET"] = "UNSET";
|
|
@@ -44,24 +43,40 @@ export function pushLensSubscriptionResponse_ExcludedLens_CodeFromJSON(object) {
|
|
|
44
43
|
}
|
|
45
44
|
export function pushLensSubscriptionResponse_ExcludedLens_CodeToJSON(object) {
|
|
46
45
|
switch (object) {
|
|
47
|
-
case PushLensSubscriptionResponse_ExcludedLens_Code.UNSET:
|
|
48
|
-
|
|
49
|
-
case PushLensSubscriptionResponse_ExcludedLens_Code.
|
|
50
|
-
|
|
51
|
-
case PushLensSubscriptionResponse_ExcludedLens_Code.
|
|
52
|
-
|
|
53
|
-
|
|
46
|
+
case PushLensSubscriptionResponse_ExcludedLens_Code.UNSET:
|
|
47
|
+
return "UNSET";
|
|
48
|
+
case PushLensSubscriptionResponse_ExcludedLens_Code.UNKNOWN:
|
|
49
|
+
return "UNKNOWN";
|
|
50
|
+
case PushLensSubscriptionResponse_ExcludedLens_Code.NOT_FOUND:
|
|
51
|
+
return "NOT_FOUND";
|
|
52
|
+
case PushLensSubscriptionResponse_ExcludedLens_Code.INCOMPATIBLE_LENS_CORE_VERSION:
|
|
53
|
+
return "INCOMPATIBLE_LENS_CORE_VERSION";
|
|
54
|
+
case PushLensSubscriptionResponse_ExcludedLens_Code.ARCHIVED_OR_INVISIBLE:
|
|
55
|
+
return "ARCHIVED_OR_INVISIBLE";
|
|
56
|
+
case PushLensSubscriptionResponse_ExcludedLens_Code.CONTAINS_MUSIC:
|
|
57
|
+
return "CONTAINS_MUSIC";
|
|
58
|
+
case PushLensSubscriptionResponse_ExcludedLens_Code.UNRECOGNIZED:
|
|
59
|
+
default:
|
|
60
|
+
return "UNRECOGNIZED";
|
|
54
61
|
}
|
|
55
62
|
}
|
|
56
63
|
export function pushLensSubscriptionResponse_ExcludedLens_CodeToNumber(object) {
|
|
57
64
|
switch (object) {
|
|
58
|
-
case PushLensSubscriptionResponse_ExcludedLens_Code.UNSET:
|
|
59
|
-
|
|
60
|
-
case PushLensSubscriptionResponse_ExcludedLens_Code.
|
|
61
|
-
|
|
62
|
-
case PushLensSubscriptionResponse_ExcludedLens_Code.
|
|
63
|
-
|
|
64
|
-
|
|
65
|
+
case PushLensSubscriptionResponse_ExcludedLens_Code.UNSET:
|
|
66
|
+
return 0;
|
|
67
|
+
case PushLensSubscriptionResponse_ExcludedLens_Code.UNKNOWN:
|
|
68
|
+
return 1;
|
|
69
|
+
case PushLensSubscriptionResponse_ExcludedLens_Code.NOT_FOUND:
|
|
70
|
+
return 2;
|
|
71
|
+
case PushLensSubscriptionResponse_ExcludedLens_Code.INCOMPATIBLE_LENS_CORE_VERSION:
|
|
72
|
+
return 3;
|
|
73
|
+
case PushLensSubscriptionResponse_ExcludedLens_Code.ARCHIVED_OR_INVISIBLE:
|
|
74
|
+
return 4;
|
|
75
|
+
case PushLensSubscriptionResponse_ExcludedLens_Code.CONTAINS_MUSIC:
|
|
76
|
+
return 5;
|
|
77
|
+
case PushLensSubscriptionResponse_ExcludedLens_Code.UNRECOGNIZED:
|
|
78
|
+
default:
|
|
79
|
+
return -1;
|
|
65
80
|
}
|
|
66
81
|
}
|
|
67
82
|
export var ListenLensPushResponse_ExcludedLens_Code;
|
|
@@ -102,31 +117,47 @@ export function listenLensPushResponse_ExcludedLens_CodeFromJSON(object) {
|
|
|
102
117
|
}
|
|
103
118
|
export function listenLensPushResponse_ExcludedLens_CodeToJSON(object) {
|
|
104
119
|
switch (object) {
|
|
105
|
-
case ListenLensPushResponse_ExcludedLens_Code.UNSET:
|
|
106
|
-
|
|
107
|
-
case ListenLensPushResponse_ExcludedLens_Code.
|
|
108
|
-
|
|
109
|
-
case ListenLensPushResponse_ExcludedLens_Code.
|
|
110
|
-
|
|
111
|
-
|
|
120
|
+
case ListenLensPushResponse_ExcludedLens_Code.UNSET:
|
|
121
|
+
return "UNSET";
|
|
122
|
+
case ListenLensPushResponse_ExcludedLens_Code.UNKNOWN:
|
|
123
|
+
return "UNKNOWN";
|
|
124
|
+
case ListenLensPushResponse_ExcludedLens_Code.NOT_FOUND:
|
|
125
|
+
return "NOT_FOUND";
|
|
126
|
+
case ListenLensPushResponse_ExcludedLens_Code.INCOMPATIBLE_LENS_CORE_VERSION:
|
|
127
|
+
return "INCOMPATIBLE_LENS_CORE_VERSION";
|
|
128
|
+
case ListenLensPushResponse_ExcludedLens_Code.ARCHIVED_OR_INVISIBLE:
|
|
129
|
+
return "ARCHIVED_OR_INVISIBLE";
|
|
130
|
+
case ListenLensPushResponse_ExcludedLens_Code.CONTAINS_MUSIC:
|
|
131
|
+
return "CONTAINS_MUSIC";
|
|
132
|
+
case ListenLensPushResponse_ExcludedLens_Code.UNRECOGNIZED:
|
|
133
|
+
default:
|
|
134
|
+
return "UNRECOGNIZED";
|
|
112
135
|
}
|
|
113
136
|
}
|
|
114
137
|
export function listenLensPushResponse_ExcludedLens_CodeToNumber(object) {
|
|
115
138
|
switch (object) {
|
|
116
|
-
case ListenLensPushResponse_ExcludedLens_Code.UNSET:
|
|
117
|
-
|
|
118
|
-
case ListenLensPushResponse_ExcludedLens_Code.
|
|
119
|
-
|
|
120
|
-
case ListenLensPushResponse_ExcludedLens_Code.
|
|
121
|
-
|
|
122
|
-
|
|
139
|
+
case ListenLensPushResponse_ExcludedLens_Code.UNSET:
|
|
140
|
+
return 0;
|
|
141
|
+
case ListenLensPushResponse_ExcludedLens_Code.UNKNOWN:
|
|
142
|
+
return 1;
|
|
143
|
+
case ListenLensPushResponse_ExcludedLens_Code.NOT_FOUND:
|
|
144
|
+
return 2;
|
|
145
|
+
case ListenLensPushResponse_ExcludedLens_Code.INCOMPATIBLE_LENS_CORE_VERSION:
|
|
146
|
+
return 3;
|
|
147
|
+
case ListenLensPushResponse_ExcludedLens_Code.ARCHIVED_OR_INVISIBLE:
|
|
148
|
+
return 4;
|
|
149
|
+
case ListenLensPushResponse_ExcludedLens_Code.CONTAINS_MUSIC:
|
|
150
|
+
return 5;
|
|
151
|
+
case ListenLensPushResponse_ExcludedLens_Code.UNRECOGNIZED:
|
|
152
|
+
default:
|
|
153
|
+
return -1;
|
|
123
154
|
}
|
|
124
155
|
}
|
|
125
156
|
function createBasePushLensSubscriptionRequest() {
|
|
126
|
-
return { accountId: "", extensionRequestContext: new Uint8Array(), heartbeat: 0 };
|
|
157
|
+
return { accountId: "", extensionRequestContext: new Uint8Array(0), heartbeat: 0 };
|
|
127
158
|
}
|
|
128
159
|
export const PushLensSubscriptionRequest = {
|
|
129
|
-
encode(message, writer =
|
|
160
|
+
encode(message, writer = new BinaryWriter()) {
|
|
130
161
|
if (message.accountId !== "") {
|
|
131
162
|
writer.uint32(10).string(message.accountId);
|
|
132
163
|
}
|
|
@@ -139,100 +170,134 @@ export const PushLensSubscriptionRequest = {
|
|
|
139
170
|
return writer;
|
|
140
171
|
},
|
|
141
172
|
decode(input, length) {
|
|
142
|
-
const reader = input instanceof
|
|
173
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
143
174
|
let end = length === undefined ? reader.len : reader.pos + length;
|
|
144
175
|
const message = createBasePushLensSubscriptionRequest();
|
|
145
176
|
while (reader.pos < end) {
|
|
146
177
|
const tag = reader.uint32();
|
|
147
178
|
switch (tag >>> 3) {
|
|
148
|
-
case 1:
|
|
179
|
+
case 1: {
|
|
180
|
+
if (tag !== 10) {
|
|
181
|
+
break;
|
|
182
|
+
}
|
|
149
183
|
message.accountId = reader.string();
|
|
150
|
-
|
|
151
|
-
|
|
184
|
+
continue;
|
|
185
|
+
}
|
|
186
|
+
case 2: {
|
|
187
|
+
if (tag !== 18) {
|
|
188
|
+
break;
|
|
189
|
+
}
|
|
152
190
|
message.extensionRequestContext = reader.bytes();
|
|
153
|
-
|
|
154
|
-
|
|
191
|
+
continue;
|
|
192
|
+
}
|
|
193
|
+
case 3: {
|
|
194
|
+
if (tag !== 24) {
|
|
195
|
+
break;
|
|
196
|
+
}
|
|
155
197
|
message.heartbeat = reader.int32();
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
198
|
+
continue;
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
202
|
+
break;
|
|
160
203
|
}
|
|
204
|
+
reader.skip(tag & 7);
|
|
161
205
|
}
|
|
162
206
|
return message;
|
|
163
207
|
},
|
|
164
208
|
fromJSON(object) {
|
|
165
209
|
return {
|
|
166
|
-
accountId: isSet(object.accountId)
|
|
167
|
-
? String(object.accountId)
|
|
168
|
-
: "",
|
|
210
|
+
accountId: isSet(object.accountId) ? globalThis.String(object.accountId) : "",
|
|
169
211
|
extensionRequestContext: isSet(object.extensionRequestContext)
|
|
170
212
|
? bytesFromBase64(object.extensionRequestContext)
|
|
171
|
-
: new Uint8Array(),
|
|
172
|
-
heartbeat: isSet(object.heartbeat)
|
|
173
|
-
? Number(object.heartbeat)
|
|
174
|
-
: 0,
|
|
213
|
+
: new Uint8Array(0),
|
|
214
|
+
heartbeat: isSet(object.heartbeat) ? globalThis.Number(object.heartbeat) : 0,
|
|
175
215
|
};
|
|
176
216
|
},
|
|
177
217
|
toJSON(message) {
|
|
178
218
|
const obj = {};
|
|
179
|
-
message.accountId !==
|
|
180
|
-
|
|
181
|
-
|
|
219
|
+
if (message.accountId !== "") {
|
|
220
|
+
obj.accountId = message.accountId;
|
|
221
|
+
}
|
|
222
|
+
if (message.extensionRequestContext.length !== 0) {
|
|
223
|
+
obj.extensionRequestContext = base64FromBytes(message.extensionRequestContext);
|
|
224
|
+
}
|
|
225
|
+
if (message.heartbeat !== 0) {
|
|
226
|
+
obj.heartbeat = Math.round(message.heartbeat);
|
|
227
|
+
}
|
|
182
228
|
return obj;
|
|
183
229
|
},
|
|
230
|
+
create(base) {
|
|
231
|
+
return PushLensSubscriptionRequest.fromPartial(base ?? {});
|
|
232
|
+
},
|
|
184
233
|
fromPartial(object) {
|
|
185
234
|
const message = createBasePushLensSubscriptionRequest();
|
|
186
235
|
message.accountId = object.accountId ?? "";
|
|
187
|
-
message.extensionRequestContext = object.extensionRequestContext ?? new Uint8Array();
|
|
236
|
+
message.extensionRequestContext = object.extensionRequestContext ?? new Uint8Array(0);
|
|
188
237
|
message.heartbeat = object.heartbeat ?? 0;
|
|
189
238
|
return message;
|
|
190
|
-
}
|
|
239
|
+
},
|
|
191
240
|
};
|
|
192
241
|
function createBasePushLensSubscriptionResponse() {
|
|
193
242
|
return { lens: undefined, excludedLens: undefined, heartbeat: 0, lenses: {} };
|
|
194
243
|
}
|
|
195
244
|
export const PushLensSubscriptionResponse = {
|
|
245
|
+
encode() {
|
|
246
|
+
throw new Error("Not implemented.");
|
|
247
|
+
},
|
|
196
248
|
decode(input, length) {
|
|
197
|
-
const reader = input instanceof
|
|
249
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
198
250
|
let end = length === undefined ? reader.len : reader.pos + length;
|
|
199
251
|
const message = createBasePushLensSubscriptionResponse();
|
|
200
252
|
while (reader.pos < end) {
|
|
201
253
|
const tag = reader.uint32();
|
|
202
254
|
switch (tag >>> 3) {
|
|
203
|
-
case 1:
|
|
255
|
+
case 1: {
|
|
256
|
+
if (tag !== 10) {
|
|
257
|
+
break;
|
|
258
|
+
}
|
|
204
259
|
message.lens = Lens.decode(reader, reader.uint32());
|
|
205
|
-
|
|
206
|
-
|
|
260
|
+
continue;
|
|
261
|
+
}
|
|
262
|
+
case 2: {
|
|
263
|
+
if (tag !== 18) {
|
|
264
|
+
break;
|
|
265
|
+
}
|
|
207
266
|
message.excludedLens = PushLensSubscriptionResponse_ExcludedLens.decode(reader, reader.uint32());
|
|
208
|
-
|
|
209
|
-
|
|
267
|
+
continue;
|
|
268
|
+
}
|
|
269
|
+
case 3: {
|
|
270
|
+
if (tag !== 24) {
|
|
271
|
+
break;
|
|
272
|
+
}
|
|
210
273
|
message.heartbeat = reader.int32();
|
|
211
|
-
|
|
212
|
-
|
|
274
|
+
continue;
|
|
275
|
+
}
|
|
276
|
+
case 4: {
|
|
277
|
+
if (tag !== 34) {
|
|
278
|
+
break;
|
|
279
|
+
}
|
|
213
280
|
const entry4 = PushLensSubscriptionResponse_LensesEntry.decode(reader, reader.uint32());
|
|
214
281
|
if (entry4.value !== undefined) {
|
|
215
282
|
message.lenses[entry4.key] = entry4.value;
|
|
216
283
|
}
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
284
|
+
continue;
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
288
|
+
break;
|
|
221
289
|
}
|
|
290
|
+
reader.skip(tag & 7);
|
|
222
291
|
}
|
|
223
292
|
return message;
|
|
224
293
|
},
|
|
225
294
|
fromJSON(object) {
|
|
226
295
|
return {
|
|
227
|
-
lens: isSet(object.lens)
|
|
228
|
-
? Lens.fromJSON(object.lens)
|
|
229
|
-
: undefined,
|
|
296
|
+
lens: isSet(object.lens) ? Lens.fromJSON(object.lens) : undefined,
|
|
230
297
|
excludedLens: isSet(object.excludedLens)
|
|
231
298
|
? PushLensSubscriptionResponse_ExcludedLens.fromJSON(object.excludedLens)
|
|
232
299
|
: undefined,
|
|
233
|
-
heartbeat: isSet(object.heartbeat)
|
|
234
|
-
? Number(object.heartbeat)
|
|
235
|
-
: 0,
|
|
300
|
+
heartbeat: isSet(object.heartbeat) ? globalThis.Number(object.heartbeat) : 0,
|
|
236
301
|
lenses: isObject(object.lenses)
|
|
237
302
|
? Object.entries(object.lenses).reduce((acc, [key, value]) => {
|
|
238
303
|
acc[key] = bytesFromBase64(value);
|
|
@@ -243,22 +308,32 @@ export const PushLensSubscriptionResponse = {
|
|
|
243
308
|
},
|
|
244
309
|
toJSON(message) {
|
|
245
310
|
const obj = {};
|
|
246
|
-
message.lens !== undefined
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
311
|
+
if (message.lens !== undefined) {
|
|
312
|
+
obj.lens = Lens.toJSON(message.lens);
|
|
313
|
+
}
|
|
314
|
+
if (message.excludedLens !== undefined) {
|
|
315
|
+
obj.excludedLens = PushLensSubscriptionResponse_ExcludedLens.toJSON(message.excludedLens);
|
|
316
|
+
}
|
|
317
|
+
if (message.heartbeat !== 0) {
|
|
318
|
+
obj.heartbeat = Math.round(message.heartbeat);
|
|
319
|
+
}
|
|
250
320
|
if (message.lenses) {
|
|
251
|
-
Object.entries(message.lenses)
|
|
252
|
-
|
|
253
|
-
|
|
321
|
+
const entries = Object.entries(message.lenses);
|
|
322
|
+
if (entries.length > 0) {
|
|
323
|
+
obj.lenses = {};
|
|
324
|
+
entries.forEach(([k, v]) => {
|
|
325
|
+
obj.lenses[k] = base64FromBytes(v);
|
|
326
|
+
});
|
|
327
|
+
}
|
|
254
328
|
}
|
|
255
329
|
return obj;
|
|
256
330
|
},
|
|
331
|
+
create(base) {
|
|
332
|
+
return PushLensSubscriptionResponse.fromPartial(base ?? {});
|
|
333
|
+
},
|
|
257
334
|
fromPartial(object) {
|
|
258
335
|
const message = createBasePushLensSubscriptionResponse();
|
|
259
|
-
message.lens = (object.lens !== undefined && object.lens !== null)
|
|
260
|
-
? Lens.fromPartial(object.lens)
|
|
261
|
-
: undefined;
|
|
336
|
+
message.lens = (object.lens !== undefined && object.lens !== null) ? Lens.fromPartial(object.lens) : undefined;
|
|
262
337
|
message.excludedLens = (object.excludedLens !== undefined && object.excludedLens !== null)
|
|
263
338
|
? PushLensSubscriptionResponse_ExcludedLens.fromPartial(object.excludedLens)
|
|
264
339
|
: undefined;
|
|
@@ -270,84 +345,109 @@ export const PushLensSubscriptionResponse = {
|
|
|
270
345
|
return acc;
|
|
271
346
|
}, {});
|
|
272
347
|
return message;
|
|
273
|
-
}
|
|
348
|
+
},
|
|
274
349
|
};
|
|
275
350
|
function createBasePushLensSubscriptionResponse_LensesEntry() {
|
|
276
|
-
return { key: "", value: new Uint8Array() };
|
|
351
|
+
return { key: "", value: new Uint8Array(0) };
|
|
277
352
|
}
|
|
278
353
|
export const PushLensSubscriptionResponse_LensesEntry = {
|
|
354
|
+
encode() {
|
|
355
|
+
throw new Error("Not implemented.");
|
|
356
|
+
},
|
|
279
357
|
decode(input, length) {
|
|
280
|
-
const reader = input instanceof
|
|
358
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
281
359
|
let end = length === undefined ? reader.len : reader.pos + length;
|
|
282
360
|
const message = createBasePushLensSubscriptionResponse_LensesEntry();
|
|
283
361
|
while (reader.pos < end) {
|
|
284
362
|
const tag = reader.uint32();
|
|
285
363
|
switch (tag >>> 3) {
|
|
286
|
-
case 1:
|
|
364
|
+
case 1: {
|
|
365
|
+
if (tag !== 10) {
|
|
366
|
+
break;
|
|
367
|
+
}
|
|
287
368
|
message.key = reader.string();
|
|
288
|
-
|
|
289
|
-
|
|
369
|
+
continue;
|
|
370
|
+
}
|
|
371
|
+
case 2: {
|
|
372
|
+
if (tag !== 18) {
|
|
373
|
+
break;
|
|
374
|
+
}
|
|
290
375
|
message.value = reader.bytes();
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
reader.skipType(tag & 7);
|
|
294
|
-
break;
|
|
376
|
+
continue;
|
|
377
|
+
}
|
|
295
378
|
}
|
|
379
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
380
|
+
break;
|
|
381
|
+
}
|
|
382
|
+
reader.skip(tag & 7);
|
|
296
383
|
}
|
|
297
384
|
return message;
|
|
298
385
|
},
|
|
299
386
|
fromJSON(object) {
|
|
300
387
|
return {
|
|
301
|
-
key: isSet(object.key)
|
|
302
|
-
|
|
303
|
-
: "",
|
|
304
|
-
value: isSet(object.value)
|
|
305
|
-
? bytesFromBase64(object.value)
|
|
306
|
-
: new Uint8Array(),
|
|
388
|
+
key: isSet(object.key) ? globalThis.String(object.key) : "",
|
|
389
|
+
value: isSet(object.value) ? bytesFromBase64(object.value) : new Uint8Array(0),
|
|
307
390
|
};
|
|
308
391
|
},
|
|
309
392
|
toJSON(message) {
|
|
310
393
|
const obj = {};
|
|
311
|
-
message.key !==
|
|
312
|
-
|
|
394
|
+
if (message.key !== "") {
|
|
395
|
+
obj.key = message.key;
|
|
396
|
+
}
|
|
397
|
+
if (message.value.length !== 0) {
|
|
398
|
+
obj.value = base64FromBytes(message.value);
|
|
399
|
+
}
|
|
313
400
|
return obj;
|
|
314
401
|
},
|
|
402
|
+
create(base) {
|
|
403
|
+
return PushLensSubscriptionResponse_LensesEntry.fromPartial(base ?? {});
|
|
404
|
+
},
|
|
315
405
|
fromPartial(object) {
|
|
316
406
|
const message = createBasePushLensSubscriptionResponse_LensesEntry();
|
|
317
407
|
message.key = object.key ?? "";
|
|
318
|
-
message.value = object.value ?? new Uint8Array();
|
|
408
|
+
message.value = object.value ?? new Uint8Array(0);
|
|
319
409
|
return message;
|
|
320
|
-
}
|
|
410
|
+
},
|
|
321
411
|
};
|
|
322
412
|
function createBasePushLensSubscriptionResponse_ExcludedLens() {
|
|
323
413
|
return { lensId: "0", code: PushLensSubscriptionResponse_ExcludedLens_Code.UNSET };
|
|
324
414
|
}
|
|
325
415
|
export const PushLensSubscriptionResponse_ExcludedLens = {
|
|
416
|
+
encode() {
|
|
417
|
+
throw new Error("Not implemented.");
|
|
418
|
+
},
|
|
326
419
|
decode(input, length) {
|
|
327
|
-
const reader = input instanceof
|
|
420
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
328
421
|
let end = length === undefined ? reader.len : reader.pos + length;
|
|
329
422
|
const message = createBasePushLensSubscriptionResponse_ExcludedLens();
|
|
330
423
|
while (reader.pos < end) {
|
|
331
424
|
const tag = reader.uint32();
|
|
332
425
|
switch (tag >>> 3) {
|
|
333
|
-
case 1:
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
426
|
+
case 1: {
|
|
427
|
+
if (tag !== 8) {
|
|
428
|
+
break;
|
|
429
|
+
}
|
|
430
|
+
message.lensId = reader.int64().toString();
|
|
431
|
+
continue;
|
|
432
|
+
}
|
|
433
|
+
case 2: {
|
|
434
|
+
if (tag !== 16) {
|
|
435
|
+
break;
|
|
436
|
+
}
|
|
337
437
|
message.code = pushLensSubscriptionResponse_ExcludedLens_CodeFromJSON(reader.int32());
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
reader.skipType(tag & 7);
|
|
341
|
-
break;
|
|
438
|
+
continue;
|
|
439
|
+
}
|
|
342
440
|
}
|
|
441
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
442
|
+
break;
|
|
443
|
+
}
|
|
444
|
+
reader.skip(tag & 7);
|
|
343
445
|
}
|
|
344
446
|
return message;
|
|
345
447
|
},
|
|
346
448
|
fromJSON(object) {
|
|
347
449
|
return {
|
|
348
|
-
lensId: isSet(object.lensId)
|
|
349
|
-
? String(object.lensId)
|
|
350
|
-
: "0",
|
|
450
|
+
lensId: isSet(object.lensId) ? globalThis.String(object.lensId) : "0",
|
|
351
451
|
code: isSet(object.code)
|
|
352
452
|
? pushLensSubscriptionResponse_ExcludedLens_CodeFromJSON(object.code)
|
|
353
453
|
: PushLensSubscriptionResponse_ExcludedLens_Code.UNSET,
|
|
@@ -355,22 +455,29 @@ export const PushLensSubscriptionResponse_ExcludedLens = {
|
|
|
355
455
|
},
|
|
356
456
|
toJSON(message) {
|
|
357
457
|
const obj = {};
|
|
358
|
-
message.lensId !==
|
|
359
|
-
|
|
458
|
+
if (message.lensId !== "0") {
|
|
459
|
+
obj.lensId = message.lensId;
|
|
460
|
+
}
|
|
461
|
+
if (message.code !== PushLensSubscriptionResponse_ExcludedLens_Code.UNSET) {
|
|
462
|
+
obj.code = pushLensSubscriptionResponse_ExcludedLens_CodeToJSON(message.code);
|
|
463
|
+
}
|
|
360
464
|
return obj;
|
|
361
465
|
},
|
|
466
|
+
create(base) {
|
|
467
|
+
return PushLensSubscriptionResponse_ExcludedLens.fromPartial(base ?? {});
|
|
468
|
+
},
|
|
362
469
|
fromPartial(object) {
|
|
363
470
|
const message = createBasePushLensSubscriptionResponse_ExcludedLens();
|
|
364
471
|
message.lensId = object.lensId ?? "0";
|
|
365
472
|
message.code = object.code ?? PushLensSubscriptionResponse_ExcludedLens_Code.UNSET;
|
|
366
473
|
return message;
|
|
367
|
-
}
|
|
474
|
+
},
|
|
368
475
|
};
|
|
369
476
|
function createBaseListenLensPushRequest() {
|
|
370
|
-
return { extensionRequestContext: new Uint8Array(), heartbeat: 0 };
|
|
477
|
+
return { extensionRequestContext: new Uint8Array(0), heartbeat: 0 };
|
|
371
478
|
}
|
|
372
479
|
export const ListenLensPushRequest = {
|
|
373
|
-
encode(message, writer =
|
|
480
|
+
encode(message, writer = new BinaryWriter()) {
|
|
374
481
|
if (message.extensionRequestContext.length !== 0) {
|
|
375
482
|
writer.uint32(18).bytes(message.extensionRequestContext);
|
|
376
483
|
}
|
|
@@ -380,22 +487,31 @@ export const ListenLensPushRequest = {
|
|
|
380
487
|
return writer;
|
|
381
488
|
},
|
|
382
489
|
decode(input, length) {
|
|
383
|
-
const reader = input instanceof
|
|
490
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
384
491
|
let end = length === undefined ? reader.len : reader.pos + length;
|
|
385
492
|
const message = createBaseListenLensPushRequest();
|
|
386
493
|
while (reader.pos < end) {
|
|
387
494
|
const tag = reader.uint32();
|
|
388
495
|
switch (tag >>> 3) {
|
|
389
|
-
case 2:
|
|
496
|
+
case 2: {
|
|
497
|
+
if (tag !== 18) {
|
|
498
|
+
break;
|
|
499
|
+
}
|
|
390
500
|
message.extensionRequestContext = reader.bytes();
|
|
391
|
-
|
|
392
|
-
|
|
501
|
+
continue;
|
|
502
|
+
}
|
|
503
|
+
case 3: {
|
|
504
|
+
if (tag !== 24) {
|
|
505
|
+
break;
|
|
506
|
+
}
|
|
393
507
|
message.heartbeat = reader.int32();
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
reader.skipType(tag & 7);
|
|
397
|
-
break;
|
|
508
|
+
continue;
|
|
509
|
+
}
|
|
398
510
|
}
|
|
511
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
512
|
+
break;
|
|
513
|
+
}
|
|
514
|
+
reader.skip(tag & 7);
|
|
399
515
|
}
|
|
400
516
|
return message;
|
|
401
517
|
},
|
|
@@ -403,52 +519,73 @@ export const ListenLensPushRequest = {
|
|
|
403
519
|
return {
|
|
404
520
|
extensionRequestContext: isSet(object.extensionRequestContext)
|
|
405
521
|
? bytesFromBase64(object.extensionRequestContext)
|
|
406
|
-
: new Uint8Array(),
|
|
407
|
-
heartbeat: isSet(object.heartbeat)
|
|
408
|
-
? Number(object.heartbeat)
|
|
409
|
-
: 0,
|
|
522
|
+
: new Uint8Array(0),
|
|
523
|
+
heartbeat: isSet(object.heartbeat) ? globalThis.Number(object.heartbeat) : 0,
|
|
410
524
|
};
|
|
411
525
|
},
|
|
412
526
|
toJSON(message) {
|
|
413
527
|
const obj = {};
|
|
414
|
-
|
|
415
|
-
|
|
528
|
+
if (message.extensionRequestContext.length !== 0) {
|
|
529
|
+
obj.extensionRequestContext = base64FromBytes(message.extensionRequestContext);
|
|
530
|
+
}
|
|
531
|
+
if (message.heartbeat !== 0) {
|
|
532
|
+
obj.heartbeat = Math.round(message.heartbeat);
|
|
533
|
+
}
|
|
416
534
|
return obj;
|
|
417
535
|
},
|
|
536
|
+
create(base) {
|
|
537
|
+
return ListenLensPushRequest.fromPartial(base ?? {});
|
|
538
|
+
},
|
|
418
539
|
fromPartial(object) {
|
|
419
540
|
const message = createBaseListenLensPushRequest();
|
|
420
|
-
message.extensionRequestContext = object.extensionRequestContext ?? new Uint8Array();
|
|
541
|
+
message.extensionRequestContext = object.extensionRequestContext ?? new Uint8Array(0);
|
|
421
542
|
message.heartbeat = object.heartbeat ?? 0;
|
|
422
543
|
return message;
|
|
423
|
-
}
|
|
544
|
+
},
|
|
424
545
|
};
|
|
425
546
|
function createBaseListenLensPushResponse() {
|
|
426
547
|
return { excludedLens: undefined, heartbeat: 0, lenses: {} };
|
|
427
548
|
}
|
|
428
549
|
export const ListenLensPushResponse = {
|
|
550
|
+
encode() {
|
|
551
|
+
throw new Error("Not implemented.");
|
|
552
|
+
},
|
|
429
553
|
decode(input, length) {
|
|
430
|
-
const reader = input instanceof
|
|
554
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
431
555
|
let end = length === undefined ? reader.len : reader.pos + length;
|
|
432
556
|
const message = createBaseListenLensPushResponse();
|
|
433
557
|
while (reader.pos < end) {
|
|
434
558
|
const tag = reader.uint32();
|
|
435
559
|
switch (tag >>> 3) {
|
|
436
|
-
case 2:
|
|
560
|
+
case 2: {
|
|
561
|
+
if (tag !== 18) {
|
|
562
|
+
break;
|
|
563
|
+
}
|
|
437
564
|
message.excludedLens = ListenLensPushResponse_ExcludedLens.decode(reader, reader.uint32());
|
|
438
|
-
|
|
439
|
-
|
|
565
|
+
continue;
|
|
566
|
+
}
|
|
567
|
+
case 3: {
|
|
568
|
+
if (tag !== 24) {
|
|
569
|
+
break;
|
|
570
|
+
}
|
|
440
571
|
message.heartbeat = reader.int32();
|
|
441
|
-
|
|
442
|
-
|
|
572
|
+
continue;
|
|
573
|
+
}
|
|
574
|
+
case 4: {
|
|
575
|
+
if (tag !== 34) {
|
|
576
|
+
break;
|
|
577
|
+
}
|
|
443
578
|
const entry4 = ListenLensPushResponse_LensesEntry.decode(reader, reader.uint32());
|
|
444
579
|
if (entry4.value !== undefined) {
|
|
445
580
|
message.lenses[entry4.key] = entry4.value;
|
|
446
581
|
}
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
582
|
+
continue;
|
|
583
|
+
}
|
|
584
|
+
}
|
|
585
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
586
|
+
break;
|
|
451
587
|
}
|
|
588
|
+
reader.skip(tag & 7);
|
|
452
589
|
}
|
|
453
590
|
return message;
|
|
454
591
|
},
|
|
@@ -457,9 +594,7 @@ export const ListenLensPushResponse = {
|
|
|
457
594
|
excludedLens: isSet(object.excludedLens)
|
|
458
595
|
? ListenLensPushResponse_ExcludedLens.fromJSON(object.excludedLens)
|
|
459
596
|
: undefined,
|
|
460
|
-
heartbeat: isSet(object.heartbeat)
|
|
461
|
-
? Number(object.heartbeat)
|
|
462
|
-
: 0,
|
|
597
|
+
heartbeat: isSet(object.heartbeat) ? globalThis.Number(object.heartbeat) : 0,
|
|
463
598
|
lenses: isObject(object.lenses)
|
|
464
599
|
? Object.entries(object.lenses).reduce((acc, [key, value]) => {
|
|
465
600
|
acc[key] = bytesFromBase64(value);
|
|
@@ -470,16 +605,26 @@ export const ListenLensPushResponse = {
|
|
|
470
605
|
},
|
|
471
606
|
toJSON(message) {
|
|
472
607
|
const obj = {};
|
|
473
|
-
message.excludedLens !== undefined
|
|
474
|
-
|
|
475
|
-
|
|
608
|
+
if (message.excludedLens !== undefined) {
|
|
609
|
+
obj.excludedLens = ListenLensPushResponse_ExcludedLens.toJSON(message.excludedLens);
|
|
610
|
+
}
|
|
611
|
+
if (message.heartbeat !== 0) {
|
|
612
|
+
obj.heartbeat = Math.round(message.heartbeat);
|
|
613
|
+
}
|
|
476
614
|
if (message.lenses) {
|
|
477
|
-
Object.entries(message.lenses)
|
|
478
|
-
|
|
479
|
-
|
|
615
|
+
const entries = Object.entries(message.lenses);
|
|
616
|
+
if (entries.length > 0) {
|
|
617
|
+
obj.lenses = {};
|
|
618
|
+
entries.forEach(([k, v]) => {
|
|
619
|
+
obj.lenses[k] = base64FromBytes(v);
|
|
620
|
+
});
|
|
621
|
+
}
|
|
480
622
|
}
|
|
481
623
|
return obj;
|
|
482
624
|
},
|
|
625
|
+
create(base) {
|
|
626
|
+
return ListenLensPushResponse.fromPartial(base ?? {});
|
|
627
|
+
},
|
|
483
628
|
fromPartial(object) {
|
|
484
629
|
const message = createBaseListenLensPushResponse();
|
|
485
630
|
message.excludedLens = (object.excludedLens !== undefined && object.excludedLens !== null)
|
|
@@ -493,84 +638,109 @@ export const ListenLensPushResponse = {
|
|
|
493
638
|
return acc;
|
|
494
639
|
}, {});
|
|
495
640
|
return message;
|
|
496
|
-
}
|
|
641
|
+
},
|
|
497
642
|
};
|
|
498
643
|
function createBaseListenLensPushResponse_LensesEntry() {
|
|
499
|
-
return { key: "", value: new Uint8Array() };
|
|
644
|
+
return { key: "", value: new Uint8Array(0) };
|
|
500
645
|
}
|
|
501
646
|
export const ListenLensPushResponse_LensesEntry = {
|
|
647
|
+
encode() {
|
|
648
|
+
throw new Error("Not implemented.");
|
|
649
|
+
},
|
|
502
650
|
decode(input, length) {
|
|
503
|
-
const reader = input instanceof
|
|
651
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
504
652
|
let end = length === undefined ? reader.len : reader.pos + length;
|
|
505
653
|
const message = createBaseListenLensPushResponse_LensesEntry();
|
|
506
654
|
while (reader.pos < end) {
|
|
507
655
|
const tag = reader.uint32();
|
|
508
656
|
switch (tag >>> 3) {
|
|
509
|
-
case 1:
|
|
657
|
+
case 1: {
|
|
658
|
+
if (tag !== 10) {
|
|
659
|
+
break;
|
|
660
|
+
}
|
|
510
661
|
message.key = reader.string();
|
|
511
|
-
|
|
512
|
-
|
|
662
|
+
continue;
|
|
663
|
+
}
|
|
664
|
+
case 2: {
|
|
665
|
+
if (tag !== 18) {
|
|
666
|
+
break;
|
|
667
|
+
}
|
|
513
668
|
message.value = reader.bytes();
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
669
|
+
continue;
|
|
670
|
+
}
|
|
671
|
+
}
|
|
672
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
673
|
+
break;
|
|
518
674
|
}
|
|
675
|
+
reader.skip(tag & 7);
|
|
519
676
|
}
|
|
520
677
|
return message;
|
|
521
678
|
},
|
|
522
679
|
fromJSON(object) {
|
|
523
680
|
return {
|
|
524
|
-
key: isSet(object.key)
|
|
525
|
-
|
|
526
|
-
: "",
|
|
527
|
-
value: isSet(object.value)
|
|
528
|
-
? bytesFromBase64(object.value)
|
|
529
|
-
: new Uint8Array(),
|
|
681
|
+
key: isSet(object.key) ? globalThis.String(object.key) : "",
|
|
682
|
+
value: isSet(object.value) ? bytesFromBase64(object.value) : new Uint8Array(0),
|
|
530
683
|
};
|
|
531
684
|
},
|
|
532
685
|
toJSON(message) {
|
|
533
686
|
const obj = {};
|
|
534
|
-
message.key !==
|
|
535
|
-
|
|
687
|
+
if (message.key !== "") {
|
|
688
|
+
obj.key = message.key;
|
|
689
|
+
}
|
|
690
|
+
if (message.value.length !== 0) {
|
|
691
|
+
obj.value = base64FromBytes(message.value);
|
|
692
|
+
}
|
|
536
693
|
return obj;
|
|
537
694
|
},
|
|
695
|
+
create(base) {
|
|
696
|
+
return ListenLensPushResponse_LensesEntry.fromPartial(base ?? {});
|
|
697
|
+
},
|
|
538
698
|
fromPartial(object) {
|
|
539
699
|
const message = createBaseListenLensPushResponse_LensesEntry();
|
|
540
700
|
message.key = object.key ?? "";
|
|
541
|
-
message.value = object.value ?? new Uint8Array();
|
|
701
|
+
message.value = object.value ?? new Uint8Array(0);
|
|
542
702
|
return message;
|
|
543
|
-
}
|
|
703
|
+
},
|
|
544
704
|
};
|
|
545
705
|
function createBaseListenLensPushResponse_ExcludedLens() {
|
|
546
706
|
return { lensId: "0", code: ListenLensPushResponse_ExcludedLens_Code.UNSET };
|
|
547
707
|
}
|
|
548
708
|
export const ListenLensPushResponse_ExcludedLens = {
|
|
709
|
+
encode() {
|
|
710
|
+
throw new Error("Not implemented.");
|
|
711
|
+
},
|
|
549
712
|
decode(input, length) {
|
|
550
|
-
const reader = input instanceof
|
|
713
|
+
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
551
714
|
let end = length === undefined ? reader.len : reader.pos + length;
|
|
552
715
|
const message = createBaseListenLensPushResponse_ExcludedLens();
|
|
553
716
|
while (reader.pos < end) {
|
|
554
717
|
const tag = reader.uint32();
|
|
555
718
|
switch (tag >>> 3) {
|
|
556
|
-
case 1:
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
719
|
+
case 1: {
|
|
720
|
+
if (tag !== 8) {
|
|
721
|
+
break;
|
|
722
|
+
}
|
|
723
|
+
message.lensId = reader.int64().toString();
|
|
724
|
+
continue;
|
|
725
|
+
}
|
|
726
|
+
case 2: {
|
|
727
|
+
if (tag !== 16) {
|
|
728
|
+
break;
|
|
729
|
+
}
|
|
560
730
|
message.code = listenLensPushResponse_ExcludedLens_CodeFromJSON(reader.int32());
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
731
|
+
continue;
|
|
732
|
+
}
|
|
733
|
+
}
|
|
734
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
735
|
+
break;
|
|
565
736
|
}
|
|
737
|
+
reader.skip(tag & 7);
|
|
566
738
|
}
|
|
567
739
|
return message;
|
|
568
740
|
},
|
|
569
741
|
fromJSON(object) {
|
|
570
742
|
return {
|
|
571
|
-
lensId: isSet(object.lensId)
|
|
572
|
-
? String(object.lensId)
|
|
573
|
-
: "0",
|
|
743
|
+
lensId: isSet(object.lensId) ? globalThis.String(object.lensId) : "0",
|
|
574
744
|
code: isSet(object.code)
|
|
575
745
|
? listenLensPushResponse_ExcludedLens_CodeFromJSON(object.code)
|
|
576
746
|
: ListenLensPushResponse_ExcludedLens_Code.UNSET,
|
|
@@ -578,16 +748,23 @@ export const ListenLensPushResponse_ExcludedLens = {
|
|
|
578
748
|
},
|
|
579
749
|
toJSON(message) {
|
|
580
750
|
const obj = {};
|
|
581
|
-
message.lensId !==
|
|
582
|
-
|
|
751
|
+
if (message.lensId !== "0") {
|
|
752
|
+
obj.lensId = message.lensId;
|
|
753
|
+
}
|
|
754
|
+
if (message.code !== ListenLensPushResponse_ExcludedLens_Code.UNSET) {
|
|
755
|
+
obj.code = listenLensPushResponse_ExcludedLens_CodeToJSON(message.code);
|
|
756
|
+
}
|
|
583
757
|
return obj;
|
|
584
758
|
},
|
|
759
|
+
create(base) {
|
|
760
|
+
return ListenLensPushResponse_ExcludedLens.fromPartial(base ?? {});
|
|
761
|
+
},
|
|
585
762
|
fromPartial(object) {
|
|
586
763
|
const message = createBaseListenLensPushResponse_ExcludedLens();
|
|
587
764
|
message.lensId = object.lensId ?? "0";
|
|
588
765
|
message.code = object.code ?? ListenLensPushResponse_ExcludedLens_Code.UNSET;
|
|
589
766
|
return message;
|
|
590
|
-
}
|
|
767
|
+
},
|
|
591
768
|
};
|
|
592
769
|
export class PushToDeviceClientImpl {
|
|
593
770
|
rpc;
|
|
@@ -597,31 +774,13 @@ export class PushToDeviceClientImpl {
|
|
|
597
774
|
this.ListenLensPush = this.ListenLensPush.bind(this);
|
|
598
775
|
}
|
|
599
776
|
PushLensSubscription(request, metadata) {
|
|
600
|
-
|
|
777
|
+
throw new Error("ts-proto does not yet support client streaming!");
|
|
601
778
|
}
|
|
602
779
|
ListenLensPush(request, metadata) {
|
|
603
780
|
return this.rpc.invoke(PushToDeviceListenLensPushDesc, ListenLensPushRequest.fromPartial(request), metadata);
|
|
604
781
|
}
|
|
605
782
|
}
|
|
606
|
-
export const PushToDeviceDesc = {
|
|
607
|
-
serviceName: "com.snap.camerakit.v3.PushToDevice",
|
|
608
|
-
};
|
|
609
|
-
export const PushToDevicePushLensSubscriptionDesc = {
|
|
610
|
-
methodName: "PushLensSubscription",
|
|
611
|
-
service: PushToDeviceDesc,
|
|
612
|
-
requestStream: false,
|
|
613
|
-
responseStream: true,
|
|
614
|
-
requestType: {
|
|
615
|
-
serializeBinary() {
|
|
616
|
-
return PushLensSubscriptionRequest.encode(this).finish();
|
|
617
|
-
},
|
|
618
|
-
},
|
|
619
|
-
responseType: {
|
|
620
|
-
deserializeBinary(data) {
|
|
621
|
-
return { ...PushLensSubscriptionResponse.decode(data), toObject() { return this; } };
|
|
622
|
-
}
|
|
623
|
-
},
|
|
624
|
-
};
|
|
783
|
+
export const PushToDeviceDesc = { serviceName: "com.snap.camerakit.v3.PushToDevice" };
|
|
625
784
|
export const PushToDeviceListenLensPushDesc = {
|
|
626
785
|
methodName: "ListenLensPush",
|
|
627
786
|
service: PushToDeviceDesc,
|
|
@@ -634,8 +793,14 @@ export const PushToDeviceListenLensPushDesc = {
|
|
|
634
793
|
},
|
|
635
794
|
responseType: {
|
|
636
795
|
deserializeBinary(data) {
|
|
637
|
-
|
|
638
|
-
|
|
796
|
+
const value = ListenLensPushResponse.decode(data);
|
|
797
|
+
return {
|
|
798
|
+
...value,
|
|
799
|
+
toObject() {
|
|
800
|
+
return value;
|
|
801
|
+
},
|
|
802
|
+
};
|
|
803
|
+
},
|
|
639
804
|
},
|
|
640
805
|
};
|
|
641
806
|
export class GrpcWebImpl {
|
|
@@ -649,22 +814,20 @@ export class GrpcWebImpl {
|
|
|
649
814
|
const request = { ..._request, ...methodDesc.requestType };
|
|
650
815
|
const maybeCombinedMetadata = metadata && this.options.metadata
|
|
651
816
|
? new BrowserHeaders({ ...this.options?.metadata.headersMap, ...metadata?.headersMap })
|
|
652
|
-
: metadata
|
|
817
|
+
: metadata ?? this.options.metadata;
|
|
653
818
|
return new Promise((resolve, reject) => {
|
|
654
819
|
grpc.unary(methodDesc, {
|
|
655
820
|
request,
|
|
656
821
|
host: this.host,
|
|
657
|
-
metadata: maybeCombinedMetadata,
|
|
658
|
-
transport: this.options.transport,
|
|
659
|
-
debug: this.options.debug,
|
|
822
|
+
metadata: maybeCombinedMetadata ?? {},
|
|
823
|
+
...(this.options.transport !== undefined ? { transport: this.options.transport } : {}),
|
|
824
|
+
debug: this.options.debug ?? false,
|
|
660
825
|
onEnd: function (response) {
|
|
661
826
|
if (response.status === grpc.Code.OK) {
|
|
662
|
-
resolve(response.message);
|
|
827
|
+
resolve(response.message.toObject());
|
|
663
828
|
}
|
|
664
829
|
else {
|
|
665
|
-
const err = new
|
|
666
|
-
err.code = response.status;
|
|
667
|
-
err.metadata = response.trailers;
|
|
830
|
+
const err = new GrpcWebError(response.statusMessage, response.status, response.trailers);
|
|
668
831
|
reject(err);
|
|
669
832
|
}
|
|
670
833
|
},
|
|
@@ -672,22 +835,23 @@ export class GrpcWebImpl {
|
|
|
672
835
|
});
|
|
673
836
|
}
|
|
674
837
|
invoke(methodDesc, _request, metadata) {
|
|
675
|
-
const upStreamCodes =
|
|
838
|
+
const upStreamCodes = this.options.upStreamRetryCodes ?? [];
|
|
676
839
|
const DEFAULT_TIMEOUT_TIME = 3000;
|
|
677
840
|
const request = { ..._request, ...methodDesc.requestType };
|
|
841
|
+
const transport = this.options.streamingTransport ?? this.options.transport;
|
|
678
842
|
const maybeCombinedMetadata = metadata && this.options.metadata
|
|
679
843
|
? new BrowserHeaders({ ...this.options?.metadata.headersMap, ...metadata?.headersMap })
|
|
680
|
-
: metadata
|
|
681
|
-
return new Observable(observer => {
|
|
682
|
-
const upStream = (
|
|
844
|
+
: metadata ?? this.options.metadata;
|
|
845
|
+
return new Observable((observer) => {
|
|
846
|
+
const upStream = () => {
|
|
683
847
|
const client = grpc.invoke(methodDesc, {
|
|
684
848
|
host: this.host,
|
|
685
849
|
request,
|
|
686
|
-
transport
|
|
687
|
-
metadata: maybeCombinedMetadata,
|
|
688
|
-
debug: this.options.debug,
|
|
850
|
+
...(transport !== undefined ? { transport } : {}),
|
|
851
|
+
metadata: maybeCombinedMetadata ?? {},
|
|
852
|
+
debug: this.options.debug ?? false,
|
|
689
853
|
onMessage: (next) => observer.next(next),
|
|
690
|
-
onEnd: (code, message) => {
|
|
854
|
+
onEnd: (code, message, trailers) => {
|
|
691
855
|
if (code === 0) {
|
|
692
856
|
observer.complete();
|
|
693
857
|
}
|
|
@@ -695,54 +859,56 @@ export class GrpcWebImpl {
|
|
|
695
859
|
setTimeout(upStream, DEFAULT_TIMEOUT_TIME);
|
|
696
860
|
}
|
|
697
861
|
else {
|
|
698
|
-
|
|
862
|
+
const err = new Error(message);
|
|
863
|
+
err.code = code;
|
|
864
|
+
err.metadata = trailers;
|
|
865
|
+
observer.error(err);
|
|
699
866
|
}
|
|
700
867
|
},
|
|
701
868
|
});
|
|
702
869
|
observer.add(() => client.close());
|
|
703
|
-
}
|
|
870
|
+
};
|
|
704
871
|
upStream();
|
|
705
872
|
}).pipe(share());
|
|
706
873
|
}
|
|
707
874
|
}
|
|
708
|
-
var globalThis = (() => {
|
|
709
|
-
if (typeof globalThis !== "undefined")
|
|
710
|
-
return globalThis;
|
|
711
|
-
if (typeof self !== "undefined")
|
|
712
|
-
return self;
|
|
713
|
-
if (typeof window !== "undefined")
|
|
714
|
-
return window;
|
|
715
|
-
if (typeof global !== "undefined")
|
|
716
|
-
return global;
|
|
717
|
-
throw "Unable to locate global object";
|
|
718
|
-
})();
|
|
719
|
-
const atob = globalThis.atob || ((b64) => globalThis.Buffer.from(b64, 'base64').toString('binary'));
|
|
720
875
|
function bytesFromBase64(b64) {
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
876
|
+
if (globalThis.Buffer) {
|
|
877
|
+
return Uint8Array.from(globalThis.Buffer.from(b64, "base64"));
|
|
878
|
+
}
|
|
879
|
+
else {
|
|
880
|
+
const bin = globalThis.atob(b64);
|
|
881
|
+
const arr = new Uint8Array(bin.length);
|
|
882
|
+
for (let i = 0; i < bin.length; ++i) {
|
|
883
|
+
arr[i] = bin.charCodeAt(i);
|
|
884
|
+
}
|
|
885
|
+
return arr;
|
|
725
886
|
}
|
|
726
|
-
return arr;
|
|
727
887
|
}
|
|
728
|
-
const btoa = globalThis.btoa || ((bin) => globalThis.Buffer.from(bin, 'binary').toString('base64'));
|
|
729
888
|
function base64FromBytes(arr) {
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
889
|
+
if (globalThis.Buffer) {
|
|
890
|
+
return globalThis.Buffer.from(arr).toString("base64");
|
|
891
|
+
}
|
|
892
|
+
else {
|
|
893
|
+
const bin = [];
|
|
894
|
+
arr.forEach((byte) => {
|
|
895
|
+
bin.push(globalThis.String.fromCharCode(byte));
|
|
896
|
+
});
|
|
897
|
+
return globalThis.btoa(bin.join(""));
|
|
733
898
|
}
|
|
734
|
-
return btoa(bin.join(''));
|
|
735
|
-
}
|
|
736
|
-
function longToString(long) {
|
|
737
|
-
return long.toString();
|
|
738
|
-
}
|
|
739
|
-
if (_m0.util.Long !== Long) {
|
|
740
|
-
_m0.util.Long = Long;
|
|
741
|
-
_m0.configure();
|
|
742
899
|
}
|
|
743
900
|
function isObject(value) {
|
|
744
|
-
return typeof value ===
|
|
901
|
+
return typeof value === "object" && value !== null;
|
|
745
902
|
}
|
|
746
903
|
function isSet(value) {
|
|
747
904
|
return value !== null && value !== undefined;
|
|
748
905
|
}
|
|
906
|
+
export class GrpcWebError extends globalThis.Error {
|
|
907
|
+
code;
|
|
908
|
+
metadata;
|
|
909
|
+
constructor(message, code, metadata) {
|
|
910
|
+
super(message);
|
|
911
|
+
this.code = code;
|
|
912
|
+
this.metadata = metadata;
|
|
913
|
+
}
|
|
914
|
+
}
|