@agntcy/slim-bindings-linux-arm64-gnu 2.0.0-alpha.3 → 2.0.0-alpha.4

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/slim_rpc.js ADDED
@@ -0,0 +1,3660 @@
1
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
2
+ // This file was autogenerated by some hot garbage in the `uniffi-bindgen-react-native` crate.
3
+ // Trust me, you don't want to mess with it!
4
+ /* tslint:disable */
5
+ /* eslint-disable */
6
+ // @ts-nocheck
7
+ import nativeModule from "./slim_rpc-ffi.js";
8
+ import { AbstractFfiConverterByteArray, FfiConverterArray, FfiConverterArrayBuffer, FfiConverterBool, FfiConverterDuration, FfiConverterInt32, FfiConverterMap, FfiConverterObject, FfiConverterObjectWithCallbacks, FfiConverterOptional, FfiConverterTimestamp, FfiConverterUInt64, UniffiAbstractObject, UniffiEnum, UniffiError, UniffiInternalError, UniffiRustCaller, destructorGuardSymbol, pointerLiteralSymbol, uniffiCreateFfiConverterString, uniffiCreateRecord, uniffiRustCallAsync, uniffiTraitInterfaceCallAsyncWithError, uniffiTypeNameSymbol, } from "@ubjs/core";
9
+ import uniffiSlimBindingsModule from "./slim_bindings.js";
10
+ const { FfiConverterTypeApp, FfiConverterTypeName } = uniffiSlimBindingsModule.converters;
11
+ const uniffiCaller = new UniffiRustCaller(() => ({ code: 0 }));
12
+ const uniffiIsDebug =
13
+ // @ts-ignore -- The process global might not be defined
14
+ typeof process !== "object" ||
15
+ // @ts-ignore -- The process global might not be defined
16
+ process?.env?.NODE_ENV !== "production" ||
17
+ false;
18
+ /**
19
+ * Generated factory for {@link RpcMessageContext} record objects.
20
+ */
21
+ export const RpcMessageContext = (() => {
22
+ const defaults = () => ({});
23
+ const create = (() => {
24
+ return uniffiCreateRecord(defaults);
25
+ })();
26
+ return Object.freeze({
27
+ create,
28
+ new: create,
29
+ defaults: () => Object.freeze(defaults()),
30
+ });
31
+ })();
32
+ const FfiConverterTypeRpcMessageContext = (() => {
33
+ class FFIConverter extends AbstractFfiConverterByteArray {
34
+ read(from) {
35
+ return {
36
+ source: FfiConverterTypeName.read(from)
37
+ };
38
+ }
39
+ write(value, into) {
40
+ FfiConverterTypeName.write(value.source, into);
41
+ }
42
+ allocationSize(value) {
43
+ return FfiConverterTypeName.allocationSize(value.source);
44
+ }
45
+ }
46
+ ;
47
+ return new FFIConverter();
48
+ })();
49
+ /**
50
+ * Generated factory for {@link RpcMulticastItem} record objects.
51
+ */
52
+ export const RpcMulticastItem = (() => {
53
+ const defaults = () => ({});
54
+ const create = (() => {
55
+ return uniffiCreateRecord(defaults);
56
+ })();
57
+ return Object.freeze({
58
+ create,
59
+ new: create,
60
+ defaults: () => Object.freeze(defaults()),
61
+ });
62
+ })();
63
+ const FfiConverterTypeRpcMulticastItem = (() => {
64
+ class FFIConverter extends AbstractFfiConverterByteArray {
65
+ read(from) {
66
+ return {
67
+ context: FfiConverterTypeRpcMessageContext.read(from),
68
+ message: FfiConverterArrayBuffer.read(from)
69
+ };
70
+ }
71
+ write(value, into) {
72
+ FfiConverterTypeRpcMessageContext.write(value.context, into);
73
+ FfiConverterArrayBuffer.write(value.message, into);
74
+ }
75
+ allocationSize(value) {
76
+ return FfiConverterTypeRpcMessageContext.allocationSize(value.context) +
77
+ FfiConverterArrayBuffer.allocationSize(value.message);
78
+ }
79
+ }
80
+ ;
81
+ return new FFIConverter();
82
+ })();
83
+ /**
84
+ * gRPC status codes
85
+ */
86
+ export var RpcCode;
87
+ (function (RpcCode) {
88
+ /**
89
+ * Success
90
+ */
91
+ RpcCode[RpcCode["Ok"] = 0] = "Ok";
92
+ /**
93
+ * The operation was cancelled
94
+ */
95
+ RpcCode[RpcCode["Cancelled"] = 1] = "Cancelled";
96
+ /**
97
+ * Unknown error
98
+ */
99
+ RpcCode[RpcCode["Unknown"] = 2] = "Unknown";
100
+ /**
101
+ * Client specified an invalid argument
102
+ */
103
+ RpcCode[RpcCode["InvalidArgument"] = 3] = "InvalidArgument";
104
+ /**
105
+ * Deadline exceeded before operation could complete
106
+ */
107
+ RpcCode[RpcCode["DeadlineExceeded"] = 4] = "DeadlineExceeded";
108
+ /**
109
+ * Some requested entity was not found
110
+ */
111
+ RpcCode[RpcCode["NotFound"] = 5] = "NotFound";
112
+ /**
113
+ * Some entity that we attempted to create already exists
114
+ */
115
+ RpcCode[RpcCode["AlreadyExists"] = 6] = "AlreadyExists";
116
+ /**
117
+ * The caller does not have permission to execute the specified operation
118
+ */
119
+ RpcCode[RpcCode["PermissionDenied"] = 7] = "PermissionDenied";
120
+ /**
121
+ * Some resource has been exhausted
122
+ */
123
+ RpcCode[RpcCode["ResourceExhausted"] = 8] = "ResourceExhausted";
124
+ /**
125
+ * The system is not in a state required for the operation's execution
126
+ */
127
+ RpcCode[RpcCode["FailedPrecondition"] = 9] = "FailedPrecondition";
128
+ /**
129
+ * The operation was aborted
130
+ */
131
+ RpcCode[RpcCode["Aborted"] = 10] = "Aborted";
132
+ /**
133
+ * Operation was attempted past the valid range
134
+ */
135
+ RpcCode[RpcCode["OutOfRange"] = 11] = "OutOfRange";
136
+ /**
137
+ * Operation is not implemented or not supported
138
+ */
139
+ RpcCode[RpcCode["Unimplemented"] = 12] = "Unimplemented";
140
+ /**
141
+ * Internal errors
142
+ */
143
+ RpcCode[RpcCode["Internal"] = 13] = "Internal";
144
+ /**
145
+ * The service is currently unavailable
146
+ */
147
+ RpcCode[RpcCode["Unavailable"] = 14] = "Unavailable";
148
+ /**
149
+ * Unrecoverable data loss or corruption
150
+ */
151
+ RpcCode[RpcCode["DataLoss"] = 15] = "DataLoss";
152
+ /**
153
+ * The request does not have valid authentication credentials
154
+ */
155
+ RpcCode[RpcCode["Unauthenticated"] = 16] = "Unauthenticated";
156
+ })(RpcCode || (RpcCode = {}));
157
+ const FfiConverterTypeRpcCode = (() => {
158
+ const ordinalConverter = FfiConverterInt32;
159
+ class FFIConverter extends AbstractFfiConverterByteArray {
160
+ read(from) {
161
+ switch (ordinalConverter.read(from)) {
162
+ case 1: return RpcCode.Ok;
163
+ case 2: return RpcCode.Cancelled;
164
+ case 3: return RpcCode.Unknown;
165
+ case 4: return RpcCode.InvalidArgument;
166
+ case 5: return RpcCode.DeadlineExceeded;
167
+ case 6: return RpcCode.NotFound;
168
+ case 7: return RpcCode.AlreadyExists;
169
+ case 8: return RpcCode.PermissionDenied;
170
+ case 9: return RpcCode.ResourceExhausted;
171
+ case 10: return RpcCode.FailedPrecondition;
172
+ case 11: return RpcCode.Aborted;
173
+ case 12: return RpcCode.OutOfRange;
174
+ case 13: return RpcCode.Unimplemented;
175
+ case 14: return RpcCode.Internal;
176
+ case 15: return RpcCode.Unavailable;
177
+ case 16: return RpcCode.DataLoss;
178
+ case 17: return RpcCode.Unauthenticated;
179
+ default: throw new UniffiInternalError.UnexpectedEnumCase();
180
+ }
181
+ }
182
+ write(value, into) {
183
+ switch (value) {
184
+ case RpcCode.Ok: return ordinalConverter.write(1, into);
185
+ case RpcCode.Cancelled: return ordinalConverter.write(2, into);
186
+ case RpcCode.Unknown: return ordinalConverter.write(3, into);
187
+ case RpcCode.InvalidArgument: return ordinalConverter.write(4, into);
188
+ case RpcCode.DeadlineExceeded: return ordinalConverter.write(5, into);
189
+ case RpcCode.NotFound: return ordinalConverter.write(6, into);
190
+ case RpcCode.AlreadyExists: return ordinalConverter.write(7, into);
191
+ case RpcCode.PermissionDenied: return ordinalConverter.write(8, into);
192
+ case RpcCode.ResourceExhausted: return ordinalConverter.write(9, into);
193
+ case RpcCode.FailedPrecondition: return ordinalConverter.write(10, into);
194
+ case RpcCode.Aborted: return ordinalConverter.write(11, into);
195
+ case RpcCode.OutOfRange: return ordinalConverter.write(12, into);
196
+ case RpcCode.Unimplemented: return ordinalConverter.write(13, into);
197
+ case RpcCode.Internal: return ordinalConverter.write(14, into);
198
+ case RpcCode.Unavailable: return ordinalConverter.write(15, into);
199
+ case RpcCode.DataLoss: return ordinalConverter.write(16, into);
200
+ case RpcCode.Unauthenticated: return ordinalConverter.write(17, into);
201
+ }
202
+ }
203
+ allocationSize(value) {
204
+ return ordinalConverter.allocationSize(0);
205
+ }
206
+ }
207
+ return new FFIConverter();
208
+ })();
209
+ const stringConverter = (() => {
210
+ const encoder = new TextEncoder();
211
+ const decoder = new TextDecoder();
212
+ return {
213
+ stringToBytes: (s) => encoder.encode(s),
214
+ bytesToString: (ab) => decoder.decode(ab),
215
+ stringByteLength: (s) => encoder.encode(s).byteLength,
216
+ writeStringIntoBuffer: (s, buf, offset) => {
217
+ const view = new Uint8Array(buf.arrayBuffer, offset, buf.arrayBuffer.byteLength - offset);
218
+ return encoder.encodeInto(s, view).written;
219
+ },
220
+ readStringFromBuffer: (buf, offset, length) => decoder.decode(new Uint8Array(buf.arrayBuffer, offset, length)),
221
+ };
222
+ })();
223
+ const FfiConverterString = uniffiCreateFfiConverterString(stringConverter);
224
+ // Error type: RpcError
225
+ export var RpcError_Tags;
226
+ (function (RpcError_Tags) {
227
+ RpcError_Tags["Rpc"] = "Rpc";
228
+ RpcError_Tags["MulticastRpc"] = "MulticastRpc";
229
+ RpcError_Tags["MulticastSessionClosed"] = "MulticastSessionClosed";
230
+ })(RpcError_Tags || (RpcError_Tags = {}));
231
+ /**
232
+ * UniFFI-compatible RPC error
233
+ *
234
+ * This represents RPC errors with gRPC-compatible status codes.
235
+ */
236
+ export const RpcError = (() => {
237
+ var _q, _r, _s;
238
+ class Rpc_ extends UniffiError {
239
+ constructor(inner) {
240
+ super("RpcError", "Rpc");
241
+ /**
242
+ * @private
243
+ * This field is private and should not be used, use `tag` instead.
244
+ */
245
+ this[_q] = "RpcError";
246
+ this.tag = RpcError_Tags.Rpc;
247
+ this.inner = Object.freeze(inner);
248
+ }
249
+ static new(inner) {
250
+ return new Rpc_(inner);
251
+ }
252
+ static instanceOf(obj) {
253
+ return obj.tag === RpcError_Tags.Rpc;
254
+ }
255
+ static hasInner(obj) {
256
+ return Rpc_.instanceOf(obj);
257
+ }
258
+ static getInner(obj) {
259
+ return obj.inner;
260
+ }
261
+ }
262
+ _q = uniffiTypeNameSymbol;
263
+ class MulticastRpc_ extends UniffiError {
264
+ constructor(inner) {
265
+ super("RpcError", "MulticastRpc");
266
+ /**
267
+ * @private
268
+ * This field is private and should not be used, use `tag` instead.
269
+ */
270
+ this[_r] = "RpcError";
271
+ this.tag = RpcError_Tags.MulticastRpc;
272
+ this.inner = Object.freeze(inner);
273
+ }
274
+ static new(inner) {
275
+ return new MulticastRpc_(inner);
276
+ }
277
+ static instanceOf(obj) {
278
+ return obj.tag === RpcError_Tags.MulticastRpc;
279
+ }
280
+ static hasInner(obj) {
281
+ return MulticastRpc_.instanceOf(obj);
282
+ }
283
+ static getInner(obj) {
284
+ return obj.inner;
285
+ }
286
+ }
287
+ _r = uniffiTypeNameSymbol;
288
+ class MulticastSessionClosed_ extends UniffiError {
289
+ constructor(inner) {
290
+ super("RpcError", "MulticastSessionClosed");
291
+ /**
292
+ * @private
293
+ * This field is private and should not be used, use `tag` instead.
294
+ */
295
+ this[_s] = "RpcError";
296
+ this.tag = RpcError_Tags.MulticastSessionClosed;
297
+ this.inner = Object.freeze(inner);
298
+ }
299
+ static new(inner) {
300
+ return new MulticastSessionClosed_(inner);
301
+ }
302
+ static instanceOf(obj) {
303
+ return obj.tag === RpcError_Tags.MulticastSessionClosed;
304
+ }
305
+ static hasInner(obj) {
306
+ return MulticastSessionClosed_.instanceOf(obj);
307
+ }
308
+ static getInner(obj) {
309
+ return obj.inner;
310
+ }
311
+ }
312
+ _s = uniffiTypeNameSymbol;
313
+ function instanceOf(obj) {
314
+ return obj[uniffiTypeNameSymbol] === "RpcError";
315
+ }
316
+ return Object.freeze({
317
+ instanceOf,
318
+ Rpc: Rpc_,
319
+ MulticastRpc: MulticastRpc_,
320
+ MulticastSessionClosed: MulticastSessionClosed_
321
+ });
322
+ })();
323
+ // FfiConverter for enum RpcError
324
+ const FfiConverterTypeRpcError = (() => {
325
+ const ordinalConverter = FfiConverterInt32;
326
+ class FFIConverter extends AbstractFfiConverterByteArray {
327
+ read(from) {
328
+ switch (ordinalConverter.read(from)) {
329
+ case 1: return new RpcError.Rpc({ code: FfiConverterTypeRpcCode.read(from), message: FfiConverterString.read(from), details: FfiConverterOptionalBytes.read(from) });
330
+ case 2: return new RpcError.MulticastRpc({ origin: FfiConverterString.read(from), code: FfiConverterTypeRpcCode.read(from), message: FfiConverterString.read(from), details: FfiConverterOptionalBytes.read(from) });
331
+ case 3: return new RpcError.MulticastSessionClosed({ completed: FfiConverterUInt64.read(from), total: FfiConverterUInt64.read(from), received: FfiConverterSequenceString.read(from), missing: FfiConverterSequenceString.read(from) });
332
+ default: throw new UniffiInternalError.UnexpectedEnumCase();
333
+ }
334
+ }
335
+ write(value, into) {
336
+ switch (value.tag) {
337
+ case RpcError_Tags.Rpc: {
338
+ ordinalConverter.write(1, into);
339
+ const inner = value.inner;
340
+ FfiConverterTypeRpcCode.write(inner.code, into);
341
+ FfiConverterString.write(inner.message, into);
342
+ FfiConverterOptionalBytes.write(inner.details, into);
343
+ return;
344
+ }
345
+ case RpcError_Tags.MulticastRpc: {
346
+ ordinalConverter.write(2, into);
347
+ const inner = value.inner;
348
+ FfiConverterString.write(inner.origin, into);
349
+ FfiConverterTypeRpcCode.write(inner.code, into);
350
+ FfiConverterString.write(inner.message, into);
351
+ FfiConverterOptionalBytes.write(inner.details, into);
352
+ return;
353
+ }
354
+ case RpcError_Tags.MulticastSessionClosed: {
355
+ ordinalConverter.write(3, into);
356
+ const inner = value.inner;
357
+ FfiConverterUInt64.write(inner.completed, into);
358
+ FfiConverterUInt64.write(inner.total, into);
359
+ FfiConverterSequenceString.write(inner.received, into);
360
+ FfiConverterSequenceString.write(inner.missing, into);
361
+ return;
362
+ }
363
+ default:
364
+ // Throwing from here means that RpcError_Tags hasn't matched an ordinal.
365
+ throw new UniffiInternalError.UnexpectedEnumCase();
366
+ }
367
+ }
368
+ allocationSize(value) {
369
+ switch (value.tag) {
370
+ case RpcError_Tags.Rpc: {
371
+ const inner = value.inner;
372
+ let size = ordinalConverter.allocationSize(1);
373
+ size += FfiConverterTypeRpcCode.allocationSize(inner.code);
374
+ size += FfiConverterString.allocationSize(inner.message);
375
+ size += FfiConverterOptionalBytes.allocationSize(inner.details);
376
+ return size;
377
+ }
378
+ case RpcError_Tags.MulticastRpc: {
379
+ const inner = value.inner;
380
+ let size = ordinalConverter.allocationSize(2);
381
+ size += FfiConverterString.allocationSize(inner.origin);
382
+ size += FfiConverterTypeRpcCode.allocationSize(inner.code);
383
+ size += FfiConverterString.allocationSize(inner.message);
384
+ size += FfiConverterOptionalBytes.allocationSize(inner.details);
385
+ return size;
386
+ }
387
+ case RpcError_Tags.MulticastSessionClosed: {
388
+ const inner = value.inner;
389
+ let size = ordinalConverter.allocationSize(3);
390
+ size += FfiConverterUInt64.allocationSize(inner.completed);
391
+ size += FfiConverterUInt64.allocationSize(inner.total);
392
+ size += FfiConverterSequenceString.allocationSize(inner.received);
393
+ size += FfiConverterSequenceString.allocationSize(inner.missing);
394
+ return size;
395
+ }
396
+ default: throw new UniffiInternalError.UnexpectedEnumCase();
397
+ }
398
+ }
399
+ }
400
+ return new FFIConverter();
401
+ })();
402
+ // Enum: MulticastStreamMessage
403
+ export var MulticastStreamMessage_Tags;
404
+ (function (MulticastStreamMessage_Tags) {
405
+ MulticastStreamMessage_Tags["Data"] = "Data";
406
+ MulticastStreamMessage_Tags["Error"] = "Error";
407
+ MulticastStreamMessage_Tags["End"] = "End";
408
+ })(MulticastStreamMessage_Tags || (MulticastStreamMessage_Tags = {}));
409
+ /**
410
+ * Message from a multicast response stream.
411
+ */
412
+ export const MulticastStreamMessage = (() => {
413
+ var _q, _r, _s;
414
+ /**
415
+ * Successfully received response item with source context.
416
+ */
417
+ class Data_ extends UniffiEnum {
418
+ constructor(inner) {
419
+ super("MulticastStreamMessage", "Data");
420
+ /**
421
+ * @private
422
+ * This field is private and should not be used, use `tag` instead.
423
+ */
424
+ this[_q] = "MulticastStreamMessage";
425
+ this.tag = MulticastStreamMessage_Tags.Data;
426
+ this.inner = Object.freeze(inner);
427
+ }
428
+ static new(inner) {
429
+ return new Data_(inner);
430
+ }
431
+ static instanceOf(obj) {
432
+ return obj.tag === MulticastStreamMessage_Tags.Data;
433
+ }
434
+ }
435
+ _q = uniffiTypeNameSymbol;
436
+ /**
437
+ * Error from one member — other members may still be active.
438
+ */
439
+ class Error_ extends UniffiEnum {
440
+ constructor(inner) {
441
+ super("MulticastStreamMessage", "Error");
442
+ /**
443
+ * @private
444
+ * This field is private and should not be used, use `tag` instead.
445
+ */
446
+ this[_r] = "MulticastStreamMessage";
447
+ this.tag = MulticastStreamMessage_Tags.Error;
448
+ this.inner = Object.freeze(inner);
449
+ }
450
+ static new(inner) {
451
+ return new Error_(inner);
452
+ }
453
+ static instanceOf(obj) {
454
+ return obj.tag === MulticastStreamMessage_Tags.Error;
455
+ }
456
+ }
457
+ _r = uniffiTypeNameSymbol;
458
+ /**
459
+ * All members have finished — the stream has ended.
460
+ */
461
+ class End_ extends UniffiEnum {
462
+ constructor() {
463
+ super("MulticastStreamMessage", "End");
464
+ /**
465
+ * @private
466
+ * This field is private and should not be used, use `tag` instead.
467
+ */
468
+ this[_s] = "MulticastStreamMessage";
469
+ this.tag = MulticastStreamMessage_Tags.End;
470
+ }
471
+ static new() {
472
+ return new End_();
473
+ }
474
+ static instanceOf(obj) {
475
+ return obj.tag === MulticastStreamMessage_Tags.End;
476
+ }
477
+ }
478
+ _s = uniffiTypeNameSymbol;
479
+ function instanceOf(obj) {
480
+ return obj[uniffiTypeNameSymbol] === "MulticastStreamMessage";
481
+ }
482
+ return Object.freeze({
483
+ instanceOf,
484
+ Data: Data_,
485
+ Error: Error_,
486
+ End: End_
487
+ });
488
+ })();
489
+ // FfiConverter for enum MulticastStreamMessage
490
+ const FfiConverterTypeMulticastStreamMessage = (() => {
491
+ const ordinalConverter = FfiConverterInt32;
492
+ class FFIConverter extends AbstractFfiConverterByteArray {
493
+ read(from) {
494
+ switch (ordinalConverter.read(from)) {
495
+ case 1: return new MulticastStreamMessage.Data({ item: FfiConverterTypeRpcMulticastItem.read(from) });
496
+ case 2: return new MulticastStreamMessage.Error({ error: FfiConverterTypeRpcError.read(from) });
497
+ case 3: return new MulticastStreamMessage.End();
498
+ default: throw new UniffiInternalError.UnexpectedEnumCase();
499
+ }
500
+ }
501
+ write(value, into) {
502
+ switch (value.tag) {
503
+ case MulticastStreamMessage_Tags.Data: {
504
+ ordinalConverter.write(1, into);
505
+ const inner = value.inner;
506
+ FfiConverterTypeRpcMulticastItem.write(inner.item, into);
507
+ return;
508
+ }
509
+ case MulticastStreamMessage_Tags.Error: {
510
+ ordinalConverter.write(2, into);
511
+ const inner = value.inner;
512
+ FfiConverterTypeRpcError.write(inner.error, into);
513
+ return;
514
+ }
515
+ case MulticastStreamMessage_Tags.End: {
516
+ ordinalConverter.write(3, into);
517
+ return;
518
+ }
519
+ default:
520
+ // Throwing from here means that MulticastStreamMessage_Tags hasn't matched an ordinal.
521
+ throw new UniffiInternalError.UnexpectedEnumCase();
522
+ }
523
+ }
524
+ allocationSize(value) {
525
+ switch (value.tag) {
526
+ case MulticastStreamMessage_Tags.Data: {
527
+ const inner = value.inner;
528
+ let size = ordinalConverter.allocationSize(1);
529
+ size += FfiConverterTypeRpcMulticastItem.allocationSize(inner.item);
530
+ return size;
531
+ }
532
+ case MulticastStreamMessage_Tags.Error: {
533
+ const inner = value.inner;
534
+ let size = ordinalConverter.allocationSize(2);
535
+ size += FfiConverterTypeRpcError.allocationSize(inner.error);
536
+ return size;
537
+ }
538
+ case MulticastStreamMessage_Tags.End: {
539
+ return ordinalConverter.allocationSize(3);
540
+ }
541
+ default: throw new UniffiInternalError.UnexpectedEnumCase();
542
+ }
543
+ }
544
+ }
545
+ return new FFIConverter();
546
+ })();
547
+ // Enum: StreamMessage
548
+ export var StreamMessage_Tags;
549
+ (function (StreamMessage_Tags) {
550
+ StreamMessage_Tags["Data"] = "Data";
551
+ StreamMessage_Tags["Error"] = "Error";
552
+ StreamMessage_Tags["End"] = "End";
553
+ })(StreamMessage_Tags || (StreamMessage_Tags = {}));
554
+ /**
555
+ * Message from a stream
556
+ */
557
+ export const StreamMessage = (() => {
558
+ var _q, _r, _s;
559
+ /**
560
+ * Successfully received data
561
+ */
562
+ class Data_ extends UniffiEnum {
563
+ constructor(v0) {
564
+ super("StreamMessage", "Data");
565
+ /**
566
+ * @private
567
+ * This field is private and should not be used, use `tag` instead.
568
+ */
569
+ this[_q] = "StreamMessage";
570
+ this.tag = StreamMessage_Tags.Data;
571
+ this.inner = Object.freeze([v0]);
572
+ }
573
+ static new(v0) {
574
+ return new Data_(v0);
575
+ }
576
+ static instanceOf(obj) {
577
+ return obj.tag === StreamMessage_Tags.Data;
578
+ }
579
+ }
580
+ _q = uniffiTypeNameSymbol;
581
+ /**
582
+ * Stream error occurred
583
+ */
584
+ class Error_ extends UniffiEnum {
585
+ constructor(v0) {
586
+ super("StreamMessage", "Error");
587
+ /**
588
+ * @private
589
+ * This field is private and should not be used, use `tag` instead.
590
+ */
591
+ this[_r] = "StreamMessage";
592
+ this.tag = StreamMessage_Tags.Error;
593
+ this.inner = Object.freeze([v0]);
594
+ }
595
+ static new(v0) {
596
+ return new Error_(v0);
597
+ }
598
+ static instanceOf(obj) {
599
+ return obj.tag === StreamMessage_Tags.Error;
600
+ }
601
+ }
602
+ _r = uniffiTypeNameSymbol;
603
+ /**
604
+ * Stream has ended
605
+ */
606
+ class End_ extends UniffiEnum {
607
+ constructor() {
608
+ super("StreamMessage", "End");
609
+ /**
610
+ * @private
611
+ * This field is private and should not be used, use `tag` instead.
612
+ */
613
+ this[_s] = "StreamMessage";
614
+ this.tag = StreamMessage_Tags.End;
615
+ }
616
+ static new() {
617
+ return new End_();
618
+ }
619
+ static instanceOf(obj) {
620
+ return obj.tag === StreamMessage_Tags.End;
621
+ }
622
+ }
623
+ _s = uniffiTypeNameSymbol;
624
+ function instanceOf(obj) {
625
+ return obj[uniffiTypeNameSymbol] === "StreamMessage";
626
+ }
627
+ return Object.freeze({
628
+ instanceOf,
629
+ Data: Data_,
630
+ Error: Error_,
631
+ End: End_
632
+ });
633
+ })();
634
+ // FfiConverter for enum StreamMessage
635
+ const FfiConverterTypeStreamMessage = (() => {
636
+ const ordinalConverter = FfiConverterInt32;
637
+ class FFIConverter extends AbstractFfiConverterByteArray {
638
+ read(from) {
639
+ switch (ordinalConverter.read(from)) {
640
+ case 1: return new StreamMessage.Data(FfiConverterArrayBuffer.read(from));
641
+ case 2: return new StreamMessage.Error(FfiConverterTypeRpcError.read(from));
642
+ case 3: return new StreamMessage.End();
643
+ default: throw new UniffiInternalError.UnexpectedEnumCase();
644
+ }
645
+ }
646
+ write(value, into) {
647
+ switch (value.tag) {
648
+ case StreamMessage_Tags.Data: {
649
+ ordinalConverter.write(1, into);
650
+ const inner = value.inner;
651
+ FfiConverterArrayBuffer.write(inner[0], into);
652
+ return;
653
+ }
654
+ case StreamMessage_Tags.Error: {
655
+ ordinalConverter.write(2, into);
656
+ const inner = value.inner;
657
+ FfiConverterTypeRpcError.write(inner[0], into);
658
+ return;
659
+ }
660
+ case StreamMessage_Tags.End: {
661
+ ordinalConverter.write(3, into);
662
+ return;
663
+ }
664
+ default:
665
+ // Throwing from here means that StreamMessage_Tags hasn't matched an ordinal.
666
+ throw new UniffiInternalError.UnexpectedEnumCase();
667
+ }
668
+ }
669
+ allocationSize(value) {
670
+ switch (value.tag) {
671
+ case StreamMessage_Tags.Data: {
672
+ const inner = value.inner;
673
+ let size = ordinalConverter.allocationSize(1);
674
+ size += FfiConverterArrayBuffer.allocationSize(inner[0]);
675
+ return size;
676
+ }
677
+ case StreamMessage_Tags.Error: {
678
+ const inner = value.inner;
679
+ let size = ordinalConverter.allocationSize(2);
680
+ size += FfiConverterTypeRpcError.allocationSize(inner[0]);
681
+ return size;
682
+ }
683
+ case StreamMessage_Tags.End: {
684
+ return ordinalConverter.allocationSize(3);
685
+ }
686
+ default: throw new UniffiInternalError.UnexpectedEnumCase();
687
+ }
688
+ }
689
+ }
690
+ return new FFIConverter();
691
+ })();
692
+ /**
693
+ * Bidirectional stream handler for stream-to-stream RPC calls
694
+ *
695
+ * Allows sending and receiving messages concurrently.
696
+ */
697
+ export class BidiStreamHandler extends UniffiAbstractObject {
698
+ // No primary constructor declared for this class.
699
+ constructor(pointer) {
700
+ super();
701
+ this[_a] = "BidiStreamHandler";
702
+ this[pointerLiteralSymbol] = pointer;
703
+ this[destructorGuardSymbol] = uniffiTypeBidiStreamHandlerObjectFactory.bless(pointer);
704
+ }
705
+ /**
706
+ * Close the request stream (no more messages will be sent)
707
+ */
708
+ closeSend() {
709
+ uniffiCaller.rustCallWithError(
710
+ /*liftError:*/ FfiConverterTypeRpcError.lift.bind(FfiConverterTypeRpcError),
711
+ /*caller:*/ (callStatus) => {
712
+ nativeModule().uniffi_slim_rpc_fn_method_bidistreamhandler_close_send(uniffiTypeBidiStreamHandlerObjectFactory.clonePointer(this), callStatus);
713
+ },
714
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString));
715
+ }
716
+ /**
717
+ * Close the request stream (async version)
718
+ */
719
+ async closeSendAsync(asyncOpts_) {
720
+ const __stack = uniffiIsDebug ? new Error().stack : undefined;
721
+ try {
722
+ return await uniffiRustCallAsync(
723
+ /*rustCaller:*/ uniffiCaller,
724
+ /*rustFutureFunc:*/ () => {
725
+ return nativeModule().uniffi_slim_rpc_fn_method_bidistreamhandler_close_send_async(uniffiTypeBidiStreamHandlerObjectFactory.clonePointer(this));
726
+ },
727
+ /*pollFunc:*/ nativeModule().ffi_slim_rpc_rust_future_poll_void,
728
+ /*cancelFunc:*/ nativeModule().ffi_slim_rpc_rust_future_cancel_void,
729
+ /*completeFunc:*/ nativeModule().ffi_slim_rpc_rust_future_complete_void,
730
+ /*freeFunc:*/ nativeModule().ffi_slim_rpc_rust_future_free_void,
731
+ /*liftFunc:*/ (_v) => { },
732
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
733
+ /*asyncOpts:*/ asyncOpts_,
734
+ /*errorHandler:*/ FfiConverterTypeRpcError.lift.bind(FfiConverterTypeRpcError));
735
+ }
736
+ catch (__error) {
737
+ if (uniffiIsDebug && __error instanceof Error) {
738
+ __error.stack = __stack;
739
+ }
740
+ throw __error;
741
+ }
742
+ }
743
+ /**
744
+ * Receive the next response message (blocking version)
745
+ */
746
+ recv() {
747
+ return ((__rb) => {
748
+ try {
749
+ return FfiConverterTypeStreamMessage.lift(__rb);
750
+ }
751
+ finally {
752
+ nativeModule().rustbuffer_free(__rb);
753
+ }
754
+ })(uniffiCaller.rustCall(
755
+ /*caller:*/ (callStatus) => {
756
+ return nativeModule().uniffi_slim_rpc_fn_method_bidistreamhandler_recv(uniffiTypeBidiStreamHandlerObjectFactory.clonePointer(this), callStatus);
757
+ },
758
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString)));
759
+ }
760
+ /**
761
+ * Receive the next response message (async version)
762
+ */
763
+ async recvAsync(asyncOpts_) {
764
+ const __stack = uniffiIsDebug ? new Error().stack : undefined;
765
+ try {
766
+ return await uniffiRustCallAsync(
767
+ /*rustCaller:*/ uniffiCaller,
768
+ /*rustFutureFunc:*/ () => {
769
+ return nativeModule().uniffi_slim_rpc_fn_method_bidistreamhandler_recv_async(uniffiTypeBidiStreamHandlerObjectFactory.clonePointer(this));
770
+ },
771
+ /*pollFunc:*/ nativeModule().ffi_slim_rpc_rust_future_poll_rust_buffer,
772
+ /*cancelFunc:*/ nativeModule().ffi_slim_rpc_rust_future_cancel_rust_buffer,
773
+ /*completeFunc:*/ nativeModule().ffi_slim_rpc_rust_future_complete_rust_buffer,
774
+ /*freeFunc:*/ nativeModule().ffi_slim_rpc_rust_future_free_rust_buffer,
775
+ // Async returns always go through the JS-side converter: the
776
+ // FFI symbol returns the future handle (u64), and the user-level
777
+ // RustBuffer comes back via the shared `rust_future_complete_*`
778
+ // export. The bytes the runtime hands back must be deserialized
779
+ // here using the per-callable return-type converter.
780
+ /*liftFunc:*/ FfiConverterTypeStreamMessage.lift.bind(FfiConverterTypeStreamMessage),
781
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
782
+ /*asyncOpts:*/ asyncOpts_);
783
+ }
784
+ catch (__error) {
785
+ if (uniffiIsDebug && __error instanceof Error) {
786
+ __error.stack = __stack;
787
+ }
788
+ throw __error;
789
+ }
790
+ }
791
+ /**
792
+ * Send a request message to the stream (blocking version)
793
+ */
794
+ send(data) {
795
+ uniffiCaller.rustCallWithError(
796
+ /*liftError:*/ FfiConverterTypeRpcError.lift.bind(FfiConverterTypeRpcError),
797
+ /*caller:*/ (callStatus) => {
798
+ nativeModule().uniffi_slim_rpc_fn_method_bidistreamhandler_send(uniffiTypeBidiStreamHandlerObjectFactory.clonePointer(this), FfiConverterArrayBuffer.lower(data, nativeModule().rustbuffer_alloc), callStatus);
799
+ },
800
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString));
801
+ }
802
+ /**
803
+ * Send a request message to the stream (async version)
804
+ */
805
+ async sendAsync(data, asyncOpts_) {
806
+ const __stack = uniffiIsDebug ? new Error().stack : undefined;
807
+ try {
808
+ return await uniffiRustCallAsync(
809
+ /*rustCaller:*/ uniffiCaller,
810
+ /*rustFutureFunc:*/ () => {
811
+ return nativeModule().uniffi_slim_rpc_fn_method_bidistreamhandler_send_async(uniffiTypeBidiStreamHandlerObjectFactory.clonePointer(this), FfiConverterArrayBuffer.lower(data, nativeModule().rustbuffer_alloc));
812
+ },
813
+ /*pollFunc:*/ nativeModule().ffi_slim_rpc_rust_future_poll_void,
814
+ /*cancelFunc:*/ nativeModule().ffi_slim_rpc_rust_future_cancel_void,
815
+ /*completeFunc:*/ nativeModule().ffi_slim_rpc_rust_future_complete_void,
816
+ /*freeFunc:*/ nativeModule().ffi_slim_rpc_rust_future_free_void,
817
+ /*liftFunc:*/ (_v) => { },
818
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
819
+ /*asyncOpts:*/ asyncOpts_,
820
+ /*errorHandler:*/ FfiConverterTypeRpcError.lift.bind(FfiConverterTypeRpcError));
821
+ }
822
+ catch (__error) {
823
+ if (uniffiIsDebug && __error instanceof Error) {
824
+ __error.stack = __stack;
825
+ }
826
+ throw __error;
827
+ }
828
+ }
829
+ uniffiDestroy() {
830
+ const ptr = this[destructorGuardSymbol];
831
+ if (ptr !== undefined) {
832
+ const pointer = uniffiTypeBidiStreamHandlerObjectFactory.pointer(this);
833
+ uniffiTypeBidiStreamHandlerObjectFactory.freePointer(pointer);
834
+ uniffiTypeBidiStreamHandlerObjectFactory.unbless(ptr);
835
+ delete this[destructorGuardSymbol];
836
+ }
837
+ }
838
+ static instanceOf(obj_) {
839
+ return uniffiTypeBidiStreamHandlerObjectFactory.isConcreteType(obj_);
840
+ }
841
+ }
842
+ _a = uniffiTypeNameSymbol;
843
+ const uniffiTypeBidiStreamHandlerObjectFactory = (() => {
844
+ /// <reference lib="es2021" />
845
+ const registry = typeof FinalizationRegistry !== 'undefined' ? new FinalizationRegistry((heldValue) => {
846
+ uniffiTypeBidiStreamHandlerObjectFactory.freePointer(heldValue);
847
+ }) : null;
848
+ return {
849
+ create(pointer) {
850
+ const instance = Object.create(BidiStreamHandler.prototype);
851
+ instance[pointerLiteralSymbol] = pointer;
852
+ instance[destructorGuardSymbol] = this.bless(pointer);
853
+ instance[uniffiTypeNameSymbol] = "BidiStreamHandler";
854
+ return instance;
855
+ },
856
+ bless(p) {
857
+ const ptr = {
858
+ p, // make sure this object doesn't get optimized away.
859
+ markDestroyed: () => undefined,
860
+ };
861
+ if (registry) {
862
+ registry.register(ptr, p, ptr);
863
+ }
864
+ return ptr;
865
+ },
866
+ unbless(ptr_) {
867
+ if (registry) {
868
+ registry.unregister(ptr_);
869
+ }
870
+ },
871
+ pointer(obj_) {
872
+ if (obj_[destructorGuardSymbol] === undefined) {
873
+ throw new UniffiInternalError.UnexpectedNullPointer();
874
+ }
875
+ return obj_[pointerLiteralSymbol];
876
+ },
877
+ clonePointer(obj_) {
878
+ const pointer = this.pointer(obj_);
879
+ return uniffiCaller.rustCall(
880
+ /*caller:*/ (callStatus) => nativeModule().uniffi_slim_rpc_fn_clone_bidistreamhandler(pointer, callStatus),
881
+ /*liftString:*/ FfiConverterString.lift);
882
+ },
883
+ freePointer(pointer) {
884
+ uniffiCaller.rustCall(
885
+ /*caller:*/ (callStatus) => nativeModule().uniffi_slim_rpc_fn_free_bidistreamhandler(pointer, callStatus),
886
+ /*liftString:*/ FfiConverterString.lift);
887
+ },
888
+ isConcreteType(obj_) {
889
+ return obj_[destructorGuardSymbol] && obj_[uniffiTypeNameSymbol] === "BidiStreamHandler";
890
+ },
891
+ };
892
+ })();
893
+ const FfiConverterTypeBidiStreamHandler = new FfiConverterObject(uniffiTypeBidiStreamHandlerObjectFactory);
894
+ /**
895
+ * Bidirectional stream handler for multicast stream-to-unary and
896
+ * stream-to-stream RPC calls.
897
+ *
898
+ * Send request messages via [`send`](Self::send) / [`send_async`](Self::send_async),
899
+ * close the request stream via [`close_send`](Self::close_send), and receive
900
+ * responses via [`recv`](Self::recv) / [`recv_async`](Self::recv_async). Each
901
+ * response item carries the source member's identity.
902
+ */
903
+ export class MulticastBidiStreamHandler extends UniffiAbstractObject {
904
+ // No primary constructor declared for this class.
905
+ constructor(pointer) {
906
+ super();
907
+ this[_b] = "MulticastBidiStreamHandler";
908
+ this[pointerLiteralSymbol] = pointer;
909
+ this[destructorGuardSymbol] = uniffiTypeMulticastBidiStreamHandlerObjectFactory.bless(pointer);
910
+ }
911
+ /**
912
+ * Close the request stream — signals that no more messages will be sent
913
+ * (blocking).
914
+ */
915
+ closeSend() {
916
+ uniffiCaller.rustCallWithError(
917
+ /*liftError:*/ FfiConverterTypeRpcError.lift.bind(FfiConverterTypeRpcError),
918
+ /*caller:*/ (callStatus) => {
919
+ nativeModule().uniffi_slim_rpc_fn_method_multicastbidistreamhandler_close_send(uniffiTypeMulticastBidiStreamHandlerObjectFactory.clonePointer(this), callStatus);
920
+ },
921
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString));
922
+ }
923
+ /**
924
+ * Close the request stream (async).
925
+ */
926
+ async closeSendAsync(asyncOpts_) {
927
+ const __stack = uniffiIsDebug ? new Error().stack : undefined;
928
+ try {
929
+ return await uniffiRustCallAsync(
930
+ /*rustCaller:*/ uniffiCaller,
931
+ /*rustFutureFunc:*/ () => {
932
+ return nativeModule().uniffi_slim_rpc_fn_method_multicastbidistreamhandler_close_send_async(uniffiTypeMulticastBidiStreamHandlerObjectFactory.clonePointer(this));
933
+ },
934
+ /*pollFunc:*/ nativeModule().ffi_slim_rpc_rust_future_poll_void,
935
+ /*cancelFunc:*/ nativeModule().ffi_slim_rpc_rust_future_cancel_void,
936
+ /*completeFunc:*/ nativeModule().ffi_slim_rpc_rust_future_complete_void,
937
+ /*freeFunc:*/ nativeModule().ffi_slim_rpc_rust_future_free_void,
938
+ /*liftFunc:*/ (_v) => { },
939
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
940
+ /*asyncOpts:*/ asyncOpts_,
941
+ /*errorHandler:*/ FfiConverterTypeRpcError.lift.bind(FfiConverterTypeRpcError));
942
+ }
943
+ catch (__error) {
944
+ if (uniffiIsDebug && __error instanceof Error) {
945
+ __error.stack = __stack;
946
+ }
947
+ throw __error;
948
+ }
949
+ }
950
+ /**
951
+ * Receive the next response item (blocking).
952
+ */
953
+ recv() {
954
+ return ((__rb) => {
955
+ try {
956
+ return FfiConverterTypeMulticastStreamMessage.lift(__rb);
957
+ }
958
+ finally {
959
+ nativeModule().rustbuffer_free(__rb);
960
+ }
961
+ })(uniffiCaller.rustCall(
962
+ /*caller:*/ (callStatus) => {
963
+ return nativeModule().uniffi_slim_rpc_fn_method_multicastbidistreamhandler_recv(uniffiTypeMulticastBidiStreamHandlerObjectFactory.clonePointer(this), callStatus);
964
+ },
965
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString)));
966
+ }
967
+ /**
968
+ * Receive the next response item (async).
969
+ */
970
+ async recvAsync(asyncOpts_) {
971
+ const __stack = uniffiIsDebug ? new Error().stack : undefined;
972
+ try {
973
+ return await uniffiRustCallAsync(
974
+ /*rustCaller:*/ uniffiCaller,
975
+ /*rustFutureFunc:*/ () => {
976
+ return nativeModule().uniffi_slim_rpc_fn_method_multicastbidistreamhandler_recv_async(uniffiTypeMulticastBidiStreamHandlerObjectFactory.clonePointer(this));
977
+ },
978
+ /*pollFunc:*/ nativeModule().ffi_slim_rpc_rust_future_poll_rust_buffer,
979
+ /*cancelFunc:*/ nativeModule().ffi_slim_rpc_rust_future_cancel_rust_buffer,
980
+ /*completeFunc:*/ nativeModule().ffi_slim_rpc_rust_future_complete_rust_buffer,
981
+ /*freeFunc:*/ nativeModule().ffi_slim_rpc_rust_future_free_rust_buffer,
982
+ // Async returns always go through the JS-side converter: the
983
+ // FFI symbol returns the future handle (u64), and the user-level
984
+ // RustBuffer comes back via the shared `rust_future_complete_*`
985
+ // export. The bytes the runtime hands back must be deserialized
986
+ // here using the per-callable return-type converter.
987
+ /*liftFunc:*/ FfiConverterTypeMulticastStreamMessage.lift.bind(FfiConverterTypeMulticastStreamMessage),
988
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
989
+ /*asyncOpts:*/ asyncOpts_);
990
+ }
991
+ catch (__error) {
992
+ if (uniffiIsDebug && __error instanceof Error) {
993
+ __error.stack = __stack;
994
+ }
995
+ throw __error;
996
+ }
997
+ }
998
+ /**
999
+ * Send a request message to the stream (blocking).
1000
+ */
1001
+ send(data) {
1002
+ uniffiCaller.rustCallWithError(
1003
+ /*liftError:*/ FfiConverterTypeRpcError.lift.bind(FfiConverterTypeRpcError),
1004
+ /*caller:*/ (callStatus) => {
1005
+ nativeModule().uniffi_slim_rpc_fn_method_multicastbidistreamhandler_send(uniffiTypeMulticastBidiStreamHandlerObjectFactory.clonePointer(this), FfiConverterArrayBuffer.lower(data, nativeModule().rustbuffer_alloc), callStatus);
1006
+ },
1007
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString));
1008
+ }
1009
+ /**
1010
+ * Send a request message to the stream (async).
1011
+ */
1012
+ async sendAsync(data, asyncOpts_) {
1013
+ const __stack = uniffiIsDebug ? new Error().stack : undefined;
1014
+ try {
1015
+ return await uniffiRustCallAsync(
1016
+ /*rustCaller:*/ uniffiCaller,
1017
+ /*rustFutureFunc:*/ () => {
1018
+ return nativeModule().uniffi_slim_rpc_fn_method_multicastbidistreamhandler_send_async(uniffiTypeMulticastBidiStreamHandlerObjectFactory.clonePointer(this), FfiConverterArrayBuffer.lower(data, nativeModule().rustbuffer_alloc));
1019
+ },
1020
+ /*pollFunc:*/ nativeModule().ffi_slim_rpc_rust_future_poll_void,
1021
+ /*cancelFunc:*/ nativeModule().ffi_slim_rpc_rust_future_cancel_void,
1022
+ /*completeFunc:*/ nativeModule().ffi_slim_rpc_rust_future_complete_void,
1023
+ /*freeFunc:*/ nativeModule().ffi_slim_rpc_rust_future_free_void,
1024
+ /*liftFunc:*/ (_v) => { },
1025
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
1026
+ /*asyncOpts:*/ asyncOpts_,
1027
+ /*errorHandler:*/ FfiConverterTypeRpcError.lift.bind(FfiConverterTypeRpcError));
1028
+ }
1029
+ catch (__error) {
1030
+ if (uniffiIsDebug && __error instanceof Error) {
1031
+ __error.stack = __stack;
1032
+ }
1033
+ throw __error;
1034
+ }
1035
+ }
1036
+ uniffiDestroy() {
1037
+ const ptr = this[destructorGuardSymbol];
1038
+ if (ptr !== undefined) {
1039
+ const pointer = uniffiTypeMulticastBidiStreamHandlerObjectFactory.pointer(this);
1040
+ uniffiTypeMulticastBidiStreamHandlerObjectFactory.freePointer(pointer);
1041
+ uniffiTypeMulticastBidiStreamHandlerObjectFactory.unbless(ptr);
1042
+ delete this[destructorGuardSymbol];
1043
+ }
1044
+ }
1045
+ static instanceOf(obj_) {
1046
+ return uniffiTypeMulticastBidiStreamHandlerObjectFactory.isConcreteType(obj_);
1047
+ }
1048
+ }
1049
+ _b = uniffiTypeNameSymbol;
1050
+ const uniffiTypeMulticastBidiStreamHandlerObjectFactory = (() => {
1051
+ /// <reference lib="es2021" />
1052
+ const registry = typeof FinalizationRegistry !== 'undefined' ? new FinalizationRegistry((heldValue) => {
1053
+ uniffiTypeMulticastBidiStreamHandlerObjectFactory.freePointer(heldValue);
1054
+ }) : null;
1055
+ return {
1056
+ create(pointer) {
1057
+ const instance = Object.create(MulticastBidiStreamHandler.prototype);
1058
+ instance[pointerLiteralSymbol] = pointer;
1059
+ instance[destructorGuardSymbol] = this.bless(pointer);
1060
+ instance[uniffiTypeNameSymbol] = "MulticastBidiStreamHandler";
1061
+ return instance;
1062
+ },
1063
+ bless(p) {
1064
+ const ptr = {
1065
+ p, // make sure this object doesn't get optimized away.
1066
+ markDestroyed: () => undefined,
1067
+ };
1068
+ if (registry) {
1069
+ registry.register(ptr, p, ptr);
1070
+ }
1071
+ return ptr;
1072
+ },
1073
+ unbless(ptr_) {
1074
+ if (registry) {
1075
+ registry.unregister(ptr_);
1076
+ }
1077
+ },
1078
+ pointer(obj_) {
1079
+ if (obj_[destructorGuardSymbol] === undefined) {
1080
+ throw new UniffiInternalError.UnexpectedNullPointer();
1081
+ }
1082
+ return obj_[pointerLiteralSymbol];
1083
+ },
1084
+ clonePointer(obj_) {
1085
+ const pointer = this.pointer(obj_);
1086
+ return uniffiCaller.rustCall(
1087
+ /*caller:*/ (callStatus) => nativeModule().uniffi_slim_rpc_fn_clone_multicastbidistreamhandler(pointer, callStatus),
1088
+ /*liftString:*/ FfiConverterString.lift);
1089
+ },
1090
+ freePointer(pointer) {
1091
+ uniffiCaller.rustCall(
1092
+ /*caller:*/ (callStatus) => nativeModule().uniffi_slim_rpc_fn_free_multicastbidistreamhandler(pointer, callStatus),
1093
+ /*liftString:*/ FfiConverterString.lift);
1094
+ },
1095
+ isConcreteType(obj_) {
1096
+ return obj_[destructorGuardSymbol] && obj_[uniffiTypeNameSymbol] === "MulticastBidiStreamHandler";
1097
+ },
1098
+ };
1099
+ })();
1100
+ const FfiConverterTypeMulticastBidiStreamHandler = new FfiConverterObject(uniffiTypeMulticastBidiStreamHandlerObjectFactory);
1101
+ /**
1102
+ * Response stream reader for multicast RPC calls.
1103
+ *
1104
+ * Allows pulling `RpcMulticastItem`s from a GROUP response stream one at a
1105
+ * time. Each item carries the source member's identity alongside the payload.
1106
+ */
1107
+ export class MulticastResponseReader extends UniffiAbstractObject {
1108
+ // No primary constructor declared for this class.
1109
+ constructor(pointer) {
1110
+ super();
1111
+ this[_c] = "MulticastResponseReader";
1112
+ this[pointerLiteralSymbol] = pointer;
1113
+ this[destructorGuardSymbol] = uniffiTypeMulticastResponseReaderObjectFactory.bless(pointer);
1114
+ }
1115
+ /**
1116
+ * Pull the next item from the multicast response stream (blocking).
1117
+ */
1118
+ next() {
1119
+ return ((__rb) => {
1120
+ try {
1121
+ return FfiConverterTypeMulticastStreamMessage.lift(__rb);
1122
+ }
1123
+ finally {
1124
+ nativeModule().rustbuffer_free(__rb);
1125
+ }
1126
+ })(uniffiCaller.rustCall(
1127
+ /*caller:*/ (callStatus) => {
1128
+ return nativeModule().uniffi_slim_rpc_fn_method_multicastresponsereader_next(uniffiTypeMulticastResponseReaderObjectFactory.clonePointer(this), callStatus);
1129
+ },
1130
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString)));
1131
+ }
1132
+ /**
1133
+ * Pull the next item from the multicast response stream (async).
1134
+ */
1135
+ async nextAsync(asyncOpts_) {
1136
+ const __stack = uniffiIsDebug ? new Error().stack : undefined;
1137
+ try {
1138
+ return await uniffiRustCallAsync(
1139
+ /*rustCaller:*/ uniffiCaller,
1140
+ /*rustFutureFunc:*/ () => {
1141
+ return nativeModule().uniffi_slim_rpc_fn_method_multicastresponsereader_next_async(uniffiTypeMulticastResponseReaderObjectFactory.clonePointer(this));
1142
+ },
1143
+ /*pollFunc:*/ nativeModule().ffi_slim_rpc_rust_future_poll_rust_buffer,
1144
+ /*cancelFunc:*/ nativeModule().ffi_slim_rpc_rust_future_cancel_rust_buffer,
1145
+ /*completeFunc:*/ nativeModule().ffi_slim_rpc_rust_future_complete_rust_buffer,
1146
+ /*freeFunc:*/ nativeModule().ffi_slim_rpc_rust_future_free_rust_buffer,
1147
+ // Async returns always go through the JS-side converter: the
1148
+ // FFI symbol returns the future handle (u64), and the user-level
1149
+ // RustBuffer comes back via the shared `rust_future_complete_*`
1150
+ // export. The bytes the runtime hands back must be deserialized
1151
+ // here using the per-callable return-type converter.
1152
+ /*liftFunc:*/ FfiConverterTypeMulticastStreamMessage.lift.bind(FfiConverterTypeMulticastStreamMessage),
1153
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
1154
+ /*asyncOpts:*/ asyncOpts_);
1155
+ }
1156
+ catch (__error) {
1157
+ if (uniffiIsDebug && __error instanceof Error) {
1158
+ __error.stack = __stack;
1159
+ }
1160
+ throw __error;
1161
+ }
1162
+ }
1163
+ uniffiDestroy() {
1164
+ const ptr = this[destructorGuardSymbol];
1165
+ if (ptr !== undefined) {
1166
+ const pointer = uniffiTypeMulticastResponseReaderObjectFactory.pointer(this);
1167
+ uniffiTypeMulticastResponseReaderObjectFactory.freePointer(pointer);
1168
+ uniffiTypeMulticastResponseReaderObjectFactory.unbless(ptr);
1169
+ delete this[destructorGuardSymbol];
1170
+ }
1171
+ }
1172
+ static instanceOf(obj_) {
1173
+ return uniffiTypeMulticastResponseReaderObjectFactory.isConcreteType(obj_);
1174
+ }
1175
+ }
1176
+ _c = uniffiTypeNameSymbol;
1177
+ const uniffiTypeMulticastResponseReaderObjectFactory = (() => {
1178
+ /// <reference lib="es2021" />
1179
+ const registry = typeof FinalizationRegistry !== 'undefined' ? new FinalizationRegistry((heldValue) => {
1180
+ uniffiTypeMulticastResponseReaderObjectFactory.freePointer(heldValue);
1181
+ }) : null;
1182
+ return {
1183
+ create(pointer) {
1184
+ const instance = Object.create(MulticastResponseReader.prototype);
1185
+ instance[pointerLiteralSymbol] = pointer;
1186
+ instance[destructorGuardSymbol] = this.bless(pointer);
1187
+ instance[uniffiTypeNameSymbol] = "MulticastResponseReader";
1188
+ return instance;
1189
+ },
1190
+ bless(p) {
1191
+ const ptr = {
1192
+ p, // make sure this object doesn't get optimized away.
1193
+ markDestroyed: () => undefined,
1194
+ };
1195
+ if (registry) {
1196
+ registry.register(ptr, p, ptr);
1197
+ }
1198
+ return ptr;
1199
+ },
1200
+ unbless(ptr_) {
1201
+ if (registry) {
1202
+ registry.unregister(ptr_);
1203
+ }
1204
+ },
1205
+ pointer(obj_) {
1206
+ if (obj_[destructorGuardSymbol] === undefined) {
1207
+ throw new UniffiInternalError.UnexpectedNullPointer();
1208
+ }
1209
+ return obj_[pointerLiteralSymbol];
1210
+ },
1211
+ clonePointer(obj_) {
1212
+ const pointer = this.pointer(obj_);
1213
+ return uniffiCaller.rustCall(
1214
+ /*caller:*/ (callStatus) => nativeModule().uniffi_slim_rpc_fn_clone_multicastresponsereader(pointer, callStatus),
1215
+ /*liftString:*/ FfiConverterString.lift);
1216
+ },
1217
+ freePointer(pointer) {
1218
+ uniffiCaller.rustCall(
1219
+ /*caller:*/ (callStatus) => nativeModule().uniffi_slim_rpc_fn_free_multicastresponsereader(pointer, callStatus),
1220
+ /*liftString:*/ FfiConverterString.lift);
1221
+ },
1222
+ isConcreteType(obj_) {
1223
+ return obj_[destructorGuardSymbol] && obj_[uniffiTypeNameSymbol] === "MulticastResponseReader";
1224
+ },
1225
+ };
1226
+ })();
1227
+ const FfiConverterTypeMulticastResponseReader = new FfiConverterObject(uniffiTypeMulticastResponseReaderObjectFactory);
1228
+ /**
1229
+ * Request stream writer for stream-to-unary RPC calls
1230
+ *
1231
+ * Allows sending multiple request messages and getting a final response.
1232
+ */
1233
+ export class RequestStreamWriter extends UniffiAbstractObject {
1234
+ // No primary constructor declared for this class.
1235
+ constructor(pointer) {
1236
+ super();
1237
+ this[_d] = "RequestStreamWriter";
1238
+ this[pointerLiteralSymbol] = pointer;
1239
+ this[destructorGuardSymbol] = uniffiTypeRequestStreamWriterObjectFactory.bless(pointer);
1240
+ }
1241
+ /**
1242
+ * Finalize the stream and get the response (async version)
1243
+ *
1244
+ * **Deprecated**: Use [`finalize_stream_async`](Self::finalize_stream_async) instead.
1245
+ */
1246
+ async finalizeAsync(asyncOpts_) {
1247
+ const __stack = uniffiIsDebug ? new Error().stack : undefined;
1248
+ try {
1249
+ return await uniffiRustCallAsync(
1250
+ /*rustCaller:*/ uniffiCaller,
1251
+ /*rustFutureFunc:*/ () => {
1252
+ return nativeModule().uniffi_slim_rpc_fn_method_requeststreamwriter_finalize_async(uniffiTypeRequestStreamWriterObjectFactory.clonePointer(this));
1253
+ },
1254
+ /*pollFunc:*/ nativeModule().ffi_slim_rpc_rust_future_poll_rust_buffer,
1255
+ /*cancelFunc:*/ nativeModule().ffi_slim_rpc_rust_future_cancel_rust_buffer,
1256
+ /*completeFunc:*/ nativeModule().ffi_slim_rpc_rust_future_complete_rust_buffer,
1257
+ /*freeFunc:*/ nativeModule().ffi_slim_rpc_rust_future_free_rust_buffer,
1258
+ // Async returns always go through the JS-side converter: the
1259
+ // FFI symbol returns the future handle (u64), and the user-level
1260
+ // RustBuffer comes back via the shared `rust_future_complete_*`
1261
+ // export. The bytes the runtime hands back must be deserialized
1262
+ // here using the per-callable return-type converter.
1263
+ /*liftFunc:*/ FfiConverterArrayBuffer.lift.bind(FfiConverterArrayBuffer),
1264
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
1265
+ /*asyncOpts:*/ asyncOpts_,
1266
+ /*errorHandler:*/ FfiConverterTypeRpcError.lift.bind(FfiConverterTypeRpcError));
1267
+ }
1268
+ catch (__error) {
1269
+ if (uniffiIsDebug && __error instanceof Error) {
1270
+ __error.stack = __stack;
1271
+ }
1272
+ throw __error;
1273
+ }
1274
+ }
1275
+ /**
1276
+ * Finalize the stream and get the response (blocking version)
1277
+ */
1278
+ finalizeStream() {
1279
+ return ((__rb) => {
1280
+ try {
1281
+ return FfiConverterArrayBuffer.lift(__rb);
1282
+ }
1283
+ finally {
1284
+ nativeModule().rustbuffer_free(__rb);
1285
+ }
1286
+ })(uniffiCaller.rustCallWithError(
1287
+ /*liftError:*/ FfiConverterTypeRpcError.lift.bind(FfiConverterTypeRpcError),
1288
+ /*caller:*/ (callStatus) => {
1289
+ return nativeModule().uniffi_slim_rpc_fn_method_requeststreamwriter_finalize_stream(uniffiTypeRequestStreamWriterObjectFactory.clonePointer(this), callStatus);
1290
+ },
1291
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString)));
1292
+ }
1293
+ /**
1294
+ * Finalize the stream and get the response (async version)
1295
+ */
1296
+ async finalizeStreamAsync(asyncOpts_) {
1297
+ const __stack = uniffiIsDebug ? new Error().stack : undefined;
1298
+ try {
1299
+ return await uniffiRustCallAsync(
1300
+ /*rustCaller:*/ uniffiCaller,
1301
+ /*rustFutureFunc:*/ () => {
1302
+ return nativeModule().uniffi_slim_rpc_fn_method_requeststreamwriter_finalize_stream_async(uniffiTypeRequestStreamWriterObjectFactory.clonePointer(this));
1303
+ },
1304
+ /*pollFunc:*/ nativeModule().ffi_slim_rpc_rust_future_poll_rust_buffer,
1305
+ /*cancelFunc:*/ nativeModule().ffi_slim_rpc_rust_future_cancel_rust_buffer,
1306
+ /*completeFunc:*/ nativeModule().ffi_slim_rpc_rust_future_complete_rust_buffer,
1307
+ /*freeFunc:*/ nativeModule().ffi_slim_rpc_rust_future_free_rust_buffer,
1308
+ // Async returns always go through the JS-side converter: the
1309
+ // FFI symbol returns the future handle (u64), and the user-level
1310
+ // RustBuffer comes back via the shared `rust_future_complete_*`
1311
+ // export. The bytes the runtime hands back must be deserialized
1312
+ // here using the per-callable return-type converter.
1313
+ /*liftFunc:*/ FfiConverterArrayBuffer.lift.bind(FfiConverterArrayBuffer),
1314
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
1315
+ /*asyncOpts:*/ asyncOpts_,
1316
+ /*errorHandler:*/ FfiConverterTypeRpcError.lift.bind(FfiConverterTypeRpcError));
1317
+ }
1318
+ catch (__error) {
1319
+ if (uniffiIsDebug && __error instanceof Error) {
1320
+ __error.stack = __stack;
1321
+ }
1322
+ throw __error;
1323
+ }
1324
+ }
1325
+ /**
1326
+ * Send a request message to the stream (blocking version)
1327
+ */
1328
+ send(data) {
1329
+ uniffiCaller.rustCallWithError(
1330
+ /*liftError:*/ FfiConverterTypeRpcError.lift.bind(FfiConverterTypeRpcError),
1331
+ /*caller:*/ (callStatus) => {
1332
+ nativeModule().uniffi_slim_rpc_fn_method_requeststreamwriter_send(uniffiTypeRequestStreamWriterObjectFactory.clonePointer(this), FfiConverterArrayBuffer.lower(data, nativeModule().rustbuffer_alloc), callStatus);
1333
+ },
1334
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString));
1335
+ }
1336
+ /**
1337
+ * Send a request message to the stream (async version)
1338
+ */
1339
+ async sendAsync(data, asyncOpts_) {
1340
+ const __stack = uniffiIsDebug ? new Error().stack : undefined;
1341
+ try {
1342
+ return await uniffiRustCallAsync(
1343
+ /*rustCaller:*/ uniffiCaller,
1344
+ /*rustFutureFunc:*/ () => {
1345
+ return nativeModule().uniffi_slim_rpc_fn_method_requeststreamwriter_send_async(uniffiTypeRequestStreamWriterObjectFactory.clonePointer(this), FfiConverterArrayBuffer.lower(data, nativeModule().rustbuffer_alloc));
1346
+ },
1347
+ /*pollFunc:*/ nativeModule().ffi_slim_rpc_rust_future_poll_void,
1348
+ /*cancelFunc:*/ nativeModule().ffi_slim_rpc_rust_future_cancel_void,
1349
+ /*completeFunc:*/ nativeModule().ffi_slim_rpc_rust_future_complete_void,
1350
+ /*freeFunc:*/ nativeModule().ffi_slim_rpc_rust_future_free_void,
1351
+ /*liftFunc:*/ (_v) => { },
1352
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
1353
+ /*asyncOpts:*/ asyncOpts_,
1354
+ /*errorHandler:*/ FfiConverterTypeRpcError.lift.bind(FfiConverterTypeRpcError));
1355
+ }
1356
+ catch (__error) {
1357
+ if (uniffiIsDebug && __error instanceof Error) {
1358
+ __error.stack = __stack;
1359
+ }
1360
+ throw __error;
1361
+ }
1362
+ }
1363
+ uniffiDestroy() {
1364
+ const ptr = this[destructorGuardSymbol];
1365
+ if (ptr !== undefined) {
1366
+ const pointer = uniffiTypeRequestStreamWriterObjectFactory.pointer(this);
1367
+ uniffiTypeRequestStreamWriterObjectFactory.freePointer(pointer);
1368
+ uniffiTypeRequestStreamWriterObjectFactory.unbless(ptr);
1369
+ delete this[destructorGuardSymbol];
1370
+ }
1371
+ }
1372
+ static instanceOf(obj_) {
1373
+ return uniffiTypeRequestStreamWriterObjectFactory.isConcreteType(obj_);
1374
+ }
1375
+ }
1376
+ _d = uniffiTypeNameSymbol;
1377
+ const uniffiTypeRequestStreamWriterObjectFactory = (() => {
1378
+ /// <reference lib="es2021" />
1379
+ const registry = typeof FinalizationRegistry !== 'undefined' ? new FinalizationRegistry((heldValue) => {
1380
+ uniffiTypeRequestStreamWriterObjectFactory.freePointer(heldValue);
1381
+ }) : null;
1382
+ return {
1383
+ create(pointer) {
1384
+ const instance = Object.create(RequestStreamWriter.prototype);
1385
+ instance[pointerLiteralSymbol] = pointer;
1386
+ instance[destructorGuardSymbol] = this.bless(pointer);
1387
+ instance[uniffiTypeNameSymbol] = "RequestStreamWriter";
1388
+ return instance;
1389
+ },
1390
+ bless(p) {
1391
+ const ptr = {
1392
+ p, // make sure this object doesn't get optimized away.
1393
+ markDestroyed: () => undefined,
1394
+ };
1395
+ if (registry) {
1396
+ registry.register(ptr, p, ptr);
1397
+ }
1398
+ return ptr;
1399
+ },
1400
+ unbless(ptr_) {
1401
+ if (registry) {
1402
+ registry.unregister(ptr_);
1403
+ }
1404
+ },
1405
+ pointer(obj_) {
1406
+ if (obj_[destructorGuardSymbol] === undefined) {
1407
+ throw new UniffiInternalError.UnexpectedNullPointer();
1408
+ }
1409
+ return obj_[pointerLiteralSymbol];
1410
+ },
1411
+ clonePointer(obj_) {
1412
+ const pointer = this.pointer(obj_);
1413
+ return uniffiCaller.rustCall(
1414
+ /*caller:*/ (callStatus) => nativeModule().uniffi_slim_rpc_fn_clone_requeststreamwriter(pointer, callStatus),
1415
+ /*liftString:*/ FfiConverterString.lift);
1416
+ },
1417
+ freePointer(pointer) {
1418
+ uniffiCaller.rustCall(
1419
+ /*caller:*/ (callStatus) => nativeModule().uniffi_slim_rpc_fn_free_requeststreamwriter(pointer, callStatus),
1420
+ /*liftString:*/ FfiConverterString.lift);
1421
+ },
1422
+ isConcreteType(obj_) {
1423
+ return obj_[destructorGuardSymbol] && obj_[uniffiTypeNameSymbol] === "RequestStreamWriter";
1424
+ },
1425
+ };
1426
+ })();
1427
+ const FfiConverterTypeRequestStreamWriter = new FfiConverterObject(uniffiTypeRequestStreamWriterObjectFactory);
1428
+ /**
1429
+ * Response stream reader for unary-to-stream RPC calls
1430
+ *
1431
+ * Allows pulling messages from a server response stream one at a time.
1432
+ */
1433
+ export class ResponseStreamReader extends UniffiAbstractObject {
1434
+ // No primary constructor declared for this class.
1435
+ constructor(pointer) {
1436
+ super();
1437
+ this[_e] = "ResponseStreamReader";
1438
+ this[pointerLiteralSymbol] = pointer;
1439
+ this[destructorGuardSymbol] = uniffiTypeResponseStreamReaderObjectFactory.bless(pointer);
1440
+ }
1441
+ /**
1442
+ * Pull the next message from the response stream (blocking version)
1443
+ *
1444
+ * Returns a StreamMessage indicating the result
1445
+ */
1446
+ next() {
1447
+ return ((__rb) => {
1448
+ try {
1449
+ return FfiConverterTypeStreamMessage.lift(__rb);
1450
+ }
1451
+ finally {
1452
+ nativeModule().rustbuffer_free(__rb);
1453
+ }
1454
+ })(uniffiCaller.rustCall(
1455
+ /*caller:*/ (callStatus) => {
1456
+ return nativeModule().uniffi_slim_rpc_fn_method_responsestreamreader_next(uniffiTypeResponseStreamReaderObjectFactory.clonePointer(this), callStatus);
1457
+ },
1458
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString)));
1459
+ }
1460
+ /**
1461
+ * Pull the next message from the response stream (async version)
1462
+ *
1463
+ * Returns a StreamMessage indicating the result
1464
+ */
1465
+ async nextAsync(asyncOpts_) {
1466
+ const __stack = uniffiIsDebug ? new Error().stack : undefined;
1467
+ try {
1468
+ return await uniffiRustCallAsync(
1469
+ /*rustCaller:*/ uniffiCaller,
1470
+ /*rustFutureFunc:*/ () => {
1471
+ return nativeModule().uniffi_slim_rpc_fn_method_responsestreamreader_next_async(uniffiTypeResponseStreamReaderObjectFactory.clonePointer(this));
1472
+ },
1473
+ /*pollFunc:*/ nativeModule().ffi_slim_rpc_rust_future_poll_rust_buffer,
1474
+ /*cancelFunc:*/ nativeModule().ffi_slim_rpc_rust_future_cancel_rust_buffer,
1475
+ /*completeFunc:*/ nativeModule().ffi_slim_rpc_rust_future_complete_rust_buffer,
1476
+ /*freeFunc:*/ nativeModule().ffi_slim_rpc_rust_future_free_rust_buffer,
1477
+ // Async returns always go through the JS-side converter: the
1478
+ // FFI symbol returns the future handle (u64), and the user-level
1479
+ // RustBuffer comes back via the shared `rust_future_complete_*`
1480
+ // export. The bytes the runtime hands back must be deserialized
1481
+ // here using the per-callable return-type converter.
1482
+ /*liftFunc:*/ FfiConverterTypeStreamMessage.lift.bind(FfiConverterTypeStreamMessage),
1483
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
1484
+ /*asyncOpts:*/ asyncOpts_);
1485
+ }
1486
+ catch (__error) {
1487
+ if (uniffiIsDebug && __error instanceof Error) {
1488
+ __error.stack = __stack;
1489
+ }
1490
+ throw __error;
1491
+ }
1492
+ }
1493
+ uniffiDestroy() {
1494
+ const ptr = this[destructorGuardSymbol];
1495
+ if (ptr !== undefined) {
1496
+ const pointer = uniffiTypeResponseStreamReaderObjectFactory.pointer(this);
1497
+ uniffiTypeResponseStreamReaderObjectFactory.freePointer(pointer);
1498
+ uniffiTypeResponseStreamReaderObjectFactory.unbless(ptr);
1499
+ delete this[destructorGuardSymbol];
1500
+ }
1501
+ }
1502
+ static instanceOf(obj_) {
1503
+ return uniffiTypeResponseStreamReaderObjectFactory.isConcreteType(obj_);
1504
+ }
1505
+ }
1506
+ _e = uniffiTypeNameSymbol;
1507
+ const uniffiTypeResponseStreamReaderObjectFactory = (() => {
1508
+ /// <reference lib="es2021" />
1509
+ const registry = typeof FinalizationRegistry !== 'undefined' ? new FinalizationRegistry((heldValue) => {
1510
+ uniffiTypeResponseStreamReaderObjectFactory.freePointer(heldValue);
1511
+ }) : null;
1512
+ return {
1513
+ create(pointer) {
1514
+ const instance = Object.create(ResponseStreamReader.prototype);
1515
+ instance[pointerLiteralSymbol] = pointer;
1516
+ instance[destructorGuardSymbol] = this.bless(pointer);
1517
+ instance[uniffiTypeNameSymbol] = "ResponseStreamReader";
1518
+ return instance;
1519
+ },
1520
+ bless(p) {
1521
+ const ptr = {
1522
+ p, // make sure this object doesn't get optimized away.
1523
+ markDestroyed: () => undefined,
1524
+ };
1525
+ if (registry) {
1526
+ registry.register(ptr, p, ptr);
1527
+ }
1528
+ return ptr;
1529
+ },
1530
+ unbless(ptr_) {
1531
+ if (registry) {
1532
+ registry.unregister(ptr_);
1533
+ }
1534
+ },
1535
+ pointer(obj_) {
1536
+ if (obj_[destructorGuardSymbol] === undefined) {
1537
+ throw new UniffiInternalError.UnexpectedNullPointer();
1538
+ }
1539
+ return obj_[pointerLiteralSymbol];
1540
+ },
1541
+ clonePointer(obj_) {
1542
+ const pointer = this.pointer(obj_);
1543
+ return uniffiCaller.rustCall(
1544
+ /*caller:*/ (callStatus) => nativeModule().uniffi_slim_rpc_fn_clone_responsestreamreader(pointer, callStatus),
1545
+ /*liftString:*/ FfiConverterString.lift);
1546
+ },
1547
+ freePointer(pointer) {
1548
+ uniffiCaller.rustCall(
1549
+ /*caller:*/ (callStatus) => nativeModule().uniffi_slim_rpc_fn_free_responsestreamreader(pointer, callStatus),
1550
+ /*liftString:*/ FfiConverterString.lift);
1551
+ },
1552
+ isConcreteType(obj_) {
1553
+ return obj_[destructorGuardSymbol] && obj_[uniffiTypeNameSymbol] === "ResponseStreamReader";
1554
+ },
1555
+ };
1556
+ })();
1557
+ const FfiConverterTypeResponseStreamReader = new FfiConverterObject(uniffiTypeResponseStreamReaderObjectFactory);
1558
+ /**
1559
+ * Client-side channel for making RPC calls.
1560
+ *
1561
+ * Manages a single persistent SLIM session: either a `PointToPoint` session
1562
+ * to a single remote server, or a `Multicast` (GROUP) session shared across
1563
+ * multiple remote servers. The session is lazily initialised and recreated
1564
+ * when dead.
1565
+ *
1566
+ * ## Constructor
1567
+ *
1568
+ * - `new_with_members_internal(app, members)` — Smart constructor:
1569
+ * - **1 member**: creates a P2P channel.
1570
+ * - **Many members**: creates a GROUP channel with a generated session name
1571
+ * and auto-invites all members on the first multicast call.
1572
+ */
1573
+ export class Channel extends UniffiAbstractObject {
1574
+ constructor(app, remote) {
1575
+ super();
1576
+ this[_f] = "Channel";
1577
+ const pointer = uniffiCaller.rustCall(
1578
+ /*caller:*/ (callStatus) => {
1579
+ return nativeModule().uniffi_slim_rpc_fn_constructor_channel_new(FfiConverterTypeApp.lower(app, nativeModule().rustbuffer_alloc), FfiConverterTypeName.lower(remote, nativeModule().rustbuffer_alloc), callStatus);
1580
+ },
1581
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString));
1582
+ this[pointerLiteralSymbol] = pointer;
1583
+ this[destructorGuardSymbol] = uniffiTypeChannelObjectFactory.bless(pointer);
1584
+ }
1585
+ static newGroup(app, members) {
1586
+ return FfiConverterTypeChannel.lift(uniffiCaller.rustCallWithError(
1587
+ /*liftError:*/ FfiConverterTypeRpcError.lift.bind(FfiConverterTypeRpcError),
1588
+ /*caller:*/ (callStatus) => {
1589
+ return nativeModule().uniffi_slim_rpc_fn_constructor_channel_new_group(FfiConverterTypeApp.lower(app, nativeModule().rustbuffer_alloc), FfiConverterSequenceTypeName.lower(members, nativeModule().rustbuffer_alloc), callStatus);
1590
+ },
1591
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString)));
1592
+ }
1593
+ static newGroupWithConnection(app, members, connectionId) {
1594
+ return FfiConverterTypeChannel.lift(uniffiCaller.rustCallWithError(
1595
+ /*liftError:*/ FfiConverterTypeRpcError.lift.bind(FfiConverterTypeRpcError),
1596
+ /*caller:*/ (callStatus) => {
1597
+ return nativeModule().uniffi_slim_rpc_fn_constructor_channel_new_group_with_connection(FfiConverterTypeApp.lower(app, nativeModule().rustbuffer_alloc), FfiConverterSequenceTypeName.lower(members, nativeModule().rustbuffer_alloc), FfiConverterOptionalUInt64.lower(connectionId, nativeModule().rustbuffer_alloc), callStatus);
1598
+ },
1599
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString)));
1600
+ }
1601
+ static newWithConnection(app, remote, connectionId) {
1602
+ return FfiConverterTypeChannel.lift(uniffiCaller.rustCall(
1603
+ /*caller:*/ (callStatus) => {
1604
+ return nativeModule().uniffi_slim_rpc_fn_constructor_channel_new_with_connection(FfiConverterTypeApp.lower(app, nativeModule().rustbuffer_alloc), FfiConverterTypeName.lower(remote, nativeModule().rustbuffer_alloc), FfiConverterOptionalUInt64.lower(connectionId, nativeModule().rustbuffer_alloc), callStatus);
1605
+ },
1606
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString)));
1607
+ }
1608
+ /**
1609
+ * Broadcast a request stream to all GROUP members and stream their
1610
+ * responses.
1611
+ *
1612
+ * Semantically equivalent to `call_multicast_stream_unary` at the
1613
+ * transport level; the difference (one vs many responses per member) is
1614
+ * determined by the server handler.
1615
+ */
1616
+ callMulticastStreamStream(serviceName, methodName, timeout, metadata) {
1617
+ return FfiConverterTypeMulticastBidiStreamHandler.lift(uniffiCaller.rustCall(
1618
+ /*caller:*/ (callStatus) => {
1619
+ return nativeModule().uniffi_slim_rpc_fn_method_channel_call_multicast_stream_stream(uniffiTypeChannelObjectFactory.clonePointer(this), FfiConverterString.lower(serviceName, nativeModule().rustbuffer_alloc), FfiConverterString.lower(methodName, nativeModule().rustbuffer_alloc), FfiConverterOptionalDuration.lower(timeout, nativeModule().rustbuffer_alloc), FfiConverterOptionalMapStringString.lower(metadata, nativeModule().rustbuffer_alloc), callStatus);
1620
+ },
1621
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString)));
1622
+ }
1623
+ /**
1624
+ * Broadcast a request stream to all GROUP members and collect their
1625
+ * responses.
1626
+ *
1627
+ * Returns a handler that lets you send requests and receive responses
1628
+ * concurrently. Use `send` / `send_async` to push request messages,
1629
+ * `close_send` / `close_send_async` to signal end-of-requests, and
1630
+ * `recv` / `recv_async` to pull response items.
1631
+ */
1632
+ callMulticastStreamUnary(serviceName, methodName, timeout, metadata) {
1633
+ return FfiConverterTypeMulticastBidiStreamHandler.lift(uniffiCaller.rustCall(
1634
+ /*caller:*/ (callStatus) => {
1635
+ return nativeModule().uniffi_slim_rpc_fn_method_channel_call_multicast_stream_unary(uniffiTypeChannelObjectFactory.clonePointer(this), FfiConverterString.lower(serviceName, nativeModule().rustbuffer_alloc), FfiConverterString.lower(methodName, nativeModule().rustbuffer_alloc), FfiConverterOptionalDuration.lower(timeout, nativeModule().rustbuffer_alloc), FfiConverterOptionalMapStringString.lower(metadata, nativeModule().rustbuffer_alloc), callStatus);
1636
+ },
1637
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString)));
1638
+ }
1639
+ /**
1640
+ * Broadcast one request to all GROUP members and collect their responses.
1641
+ *
1642
+ * Returns a reader from which each member's response (wrapped in
1643
+ * `MulticastStreamMessage`) can be pulled one at a time (blocking).
1644
+ */
1645
+ callMulticastUnary(serviceName, methodName, request, timeout, metadata) {
1646
+ return FfiConverterTypeMulticastResponseReader.lift(uniffiCaller.rustCallWithError(
1647
+ /*liftError:*/ FfiConverterTypeRpcError.lift.bind(FfiConverterTypeRpcError),
1648
+ /*caller:*/ (callStatus) => {
1649
+ return nativeModule().uniffi_slim_rpc_fn_method_channel_call_multicast_unary(uniffiTypeChannelObjectFactory.clonePointer(this), FfiConverterString.lower(serviceName, nativeModule().rustbuffer_alloc), FfiConverterString.lower(methodName, nativeModule().rustbuffer_alloc), FfiConverterArrayBuffer.lower(request, nativeModule().rustbuffer_alloc), FfiConverterOptionalDuration.lower(timeout, nativeModule().rustbuffer_alloc), FfiConverterOptionalMapStringString.lower(metadata, nativeModule().rustbuffer_alloc), callStatus);
1650
+ },
1651
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString)));
1652
+ }
1653
+ /**
1654
+ * Broadcast one request to all GROUP members and collect their responses
1655
+ * (async).
1656
+ */
1657
+ async callMulticastUnaryAsync(serviceName, methodName, request, timeout, metadata, asyncOpts_) {
1658
+ const __stack = uniffiIsDebug ? new Error().stack : undefined;
1659
+ try {
1660
+ return await uniffiRustCallAsync(
1661
+ /*rustCaller:*/ uniffiCaller,
1662
+ /*rustFutureFunc:*/ () => {
1663
+ return nativeModule().uniffi_slim_rpc_fn_method_channel_call_multicast_unary_async(uniffiTypeChannelObjectFactory.clonePointer(this), FfiConverterString.lower(serviceName, nativeModule().rustbuffer_alloc), FfiConverterString.lower(methodName, nativeModule().rustbuffer_alloc), FfiConverterArrayBuffer.lower(request, nativeModule().rustbuffer_alloc), FfiConverterOptionalDuration.lower(timeout, nativeModule().rustbuffer_alloc), FfiConverterOptionalMapStringString.lower(metadata, nativeModule().rustbuffer_alloc));
1664
+ },
1665
+ /*pollFunc:*/ nativeModule().ffi_slim_rpc_rust_future_poll_u64,
1666
+ /*cancelFunc:*/ nativeModule().ffi_slim_rpc_rust_future_cancel_u64,
1667
+ /*completeFunc:*/ nativeModule().ffi_slim_rpc_rust_future_complete_u64,
1668
+ /*freeFunc:*/ nativeModule().ffi_slim_rpc_rust_future_free_u64,
1669
+ // Async returns always go through the JS-side converter: the
1670
+ // FFI symbol returns the future handle (u64), and the user-level
1671
+ // RustBuffer comes back via the shared `rust_future_complete_*`
1672
+ // export. The bytes the runtime hands back must be deserialized
1673
+ // here using the per-callable return-type converter.
1674
+ /*liftFunc:*/ FfiConverterTypeMulticastResponseReader.lift.bind(FfiConverterTypeMulticastResponseReader),
1675
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
1676
+ /*asyncOpts:*/ asyncOpts_,
1677
+ /*errorHandler:*/ FfiConverterTypeRpcError.lift.bind(FfiConverterTypeRpcError));
1678
+ }
1679
+ catch (__error) {
1680
+ if (uniffiIsDebug && __error instanceof Error) {
1681
+ __error.stack = __stack;
1682
+ }
1683
+ throw __error;
1684
+ }
1685
+ }
1686
+ /**
1687
+ * Broadcast one request to all GROUP members and stream their responses
1688
+ * (blocking).
1689
+ *
1690
+ * Semantically identical to `call_multicast_unary` at the transport level;
1691
+ * the difference is that each member may send multiple responses before its
1692
+ * EOS, which the server handler determines.
1693
+ */
1694
+ callMulticastUnaryStream(serviceName, methodName, request, timeout, metadata) {
1695
+ return FfiConverterTypeMulticastResponseReader.lift(uniffiCaller.rustCallWithError(
1696
+ /*liftError:*/ FfiConverterTypeRpcError.lift.bind(FfiConverterTypeRpcError),
1697
+ /*caller:*/ (callStatus) => {
1698
+ return nativeModule().uniffi_slim_rpc_fn_method_channel_call_multicast_unary_stream(uniffiTypeChannelObjectFactory.clonePointer(this), FfiConverterString.lower(serviceName, nativeModule().rustbuffer_alloc), FfiConverterString.lower(methodName, nativeModule().rustbuffer_alloc), FfiConverterArrayBuffer.lower(request, nativeModule().rustbuffer_alloc), FfiConverterOptionalDuration.lower(timeout, nativeModule().rustbuffer_alloc), FfiConverterOptionalMapStringString.lower(metadata, nativeModule().rustbuffer_alloc), callStatus);
1699
+ },
1700
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString)));
1701
+ }
1702
+ /**
1703
+ * Broadcast one request to all GROUP members and stream their responses
1704
+ * (async).
1705
+ */
1706
+ async callMulticastUnaryStreamAsync(serviceName, methodName, request, timeout, metadata, asyncOpts_) {
1707
+ const __stack = uniffiIsDebug ? new Error().stack : undefined;
1708
+ try {
1709
+ return await uniffiRustCallAsync(
1710
+ /*rustCaller:*/ uniffiCaller,
1711
+ /*rustFutureFunc:*/ () => {
1712
+ return nativeModule().uniffi_slim_rpc_fn_method_channel_call_multicast_unary_stream_async(uniffiTypeChannelObjectFactory.clonePointer(this), FfiConverterString.lower(serviceName, nativeModule().rustbuffer_alloc), FfiConverterString.lower(methodName, nativeModule().rustbuffer_alloc), FfiConverterArrayBuffer.lower(request, nativeModule().rustbuffer_alloc), FfiConverterOptionalDuration.lower(timeout, nativeModule().rustbuffer_alloc), FfiConverterOptionalMapStringString.lower(metadata, nativeModule().rustbuffer_alloc));
1713
+ },
1714
+ /*pollFunc:*/ nativeModule().ffi_slim_rpc_rust_future_poll_u64,
1715
+ /*cancelFunc:*/ nativeModule().ffi_slim_rpc_rust_future_cancel_u64,
1716
+ /*completeFunc:*/ nativeModule().ffi_slim_rpc_rust_future_complete_u64,
1717
+ /*freeFunc:*/ nativeModule().ffi_slim_rpc_rust_future_free_u64,
1718
+ // Async returns always go through the JS-side converter: the
1719
+ // FFI symbol returns the future handle (u64), and the user-level
1720
+ // RustBuffer comes back via the shared `rust_future_complete_*`
1721
+ // export. The bytes the runtime hands back must be deserialized
1722
+ // here using the per-callable return-type converter.
1723
+ /*liftFunc:*/ FfiConverterTypeMulticastResponseReader.lift.bind(FfiConverterTypeMulticastResponseReader),
1724
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
1725
+ /*asyncOpts:*/ asyncOpts_,
1726
+ /*errorHandler:*/ FfiConverterTypeRpcError.lift.bind(FfiConverterTypeRpcError));
1727
+ }
1728
+ catch (__error) {
1729
+ if (uniffiIsDebug && __error instanceof Error) {
1730
+ __error.stack = __stack;
1731
+ }
1732
+ throw __error;
1733
+ }
1734
+ }
1735
+ callStreamStream(serviceName, methodName, timeout, metadata) {
1736
+ return FfiConverterTypeBidiStreamHandler.lift(uniffiCaller.rustCall(
1737
+ /*caller:*/ (callStatus) => {
1738
+ return nativeModule().uniffi_slim_rpc_fn_method_channel_call_stream_stream(uniffiTypeChannelObjectFactory.clonePointer(this), FfiConverterString.lower(serviceName, nativeModule().rustbuffer_alloc), FfiConverterString.lower(methodName, nativeModule().rustbuffer_alloc), FfiConverterOptionalDuration.lower(timeout, nativeModule().rustbuffer_alloc), FfiConverterOptionalMapStringString.lower(metadata, nativeModule().rustbuffer_alloc), callStatus);
1739
+ },
1740
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString)));
1741
+ }
1742
+ callStreamUnary(serviceName, methodName, timeout, metadata) {
1743
+ return FfiConverterTypeRequestStreamWriter.lift(uniffiCaller.rustCall(
1744
+ /*caller:*/ (callStatus) => {
1745
+ return nativeModule().uniffi_slim_rpc_fn_method_channel_call_stream_unary(uniffiTypeChannelObjectFactory.clonePointer(this), FfiConverterString.lower(serviceName, nativeModule().rustbuffer_alloc), FfiConverterString.lower(methodName, nativeModule().rustbuffer_alloc), FfiConverterOptionalDuration.lower(timeout, nativeModule().rustbuffer_alloc), FfiConverterOptionalMapStringString.lower(metadata, nativeModule().rustbuffer_alloc), callStatus);
1746
+ },
1747
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString)));
1748
+ }
1749
+ callUnary(serviceName, methodName, request, timeout, metadata) {
1750
+ return ((__rb) => {
1751
+ try {
1752
+ return FfiConverterArrayBuffer.lift(__rb);
1753
+ }
1754
+ finally {
1755
+ nativeModule().rustbuffer_free(__rb);
1756
+ }
1757
+ })(uniffiCaller.rustCallWithError(
1758
+ /*liftError:*/ FfiConverterTypeRpcError.lift.bind(FfiConverterTypeRpcError),
1759
+ /*caller:*/ (callStatus) => {
1760
+ return nativeModule().uniffi_slim_rpc_fn_method_channel_call_unary(uniffiTypeChannelObjectFactory.clonePointer(this), FfiConverterString.lower(serviceName, nativeModule().rustbuffer_alloc), FfiConverterString.lower(methodName, nativeModule().rustbuffer_alloc), FfiConverterArrayBuffer.lower(request, nativeModule().rustbuffer_alloc), FfiConverterOptionalDuration.lower(timeout, nativeModule().rustbuffer_alloc), FfiConverterOptionalMapStringString.lower(metadata, nativeModule().rustbuffer_alloc), callStatus);
1761
+ },
1762
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString)));
1763
+ }
1764
+ async callUnaryAsync(serviceName, methodName, request, timeout, metadata, asyncOpts_) {
1765
+ const __stack = uniffiIsDebug ? new Error().stack : undefined;
1766
+ try {
1767
+ return await uniffiRustCallAsync(
1768
+ /*rustCaller:*/ uniffiCaller,
1769
+ /*rustFutureFunc:*/ () => {
1770
+ return nativeModule().uniffi_slim_rpc_fn_method_channel_call_unary_async(uniffiTypeChannelObjectFactory.clonePointer(this), FfiConverterString.lower(serviceName, nativeModule().rustbuffer_alloc), FfiConverterString.lower(methodName, nativeModule().rustbuffer_alloc), FfiConverterArrayBuffer.lower(request, nativeModule().rustbuffer_alloc), FfiConverterOptionalDuration.lower(timeout, nativeModule().rustbuffer_alloc), FfiConverterOptionalMapStringString.lower(metadata, nativeModule().rustbuffer_alloc));
1771
+ },
1772
+ /*pollFunc:*/ nativeModule().ffi_slim_rpc_rust_future_poll_rust_buffer,
1773
+ /*cancelFunc:*/ nativeModule().ffi_slim_rpc_rust_future_cancel_rust_buffer,
1774
+ /*completeFunc:*/ nativeModule().ffi_slim_rpc_rust_future_complete_rust_buffer,
1775
+ /*freeFunc:*/ nativeModule().ffi_slim_rpc_rust_future_free_rust_buffer,
1776
+ // Async returns always go through the JS-side converter: the
1777
+ // FFI symbol returns the future handle (u64), and the user-level
1778
+ // RustBuffer comes back via the shared `rust_future_complete_*`
1779
+ // export. The bytes the runtime hands back must be deserialized
1780
+ // here using the per-callable return-type converter.
1781
+ /*liftFunc:*/ FfiConverterArrayBuffer.lift.bind(FfiConverterArrayBuffer),
1782
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
1783
+ /*asyncOpts:*/ asyncOpts_,
1784
+ /*errorHandler:*/ FfiConverterTypeRpcError.lift.bind(FfiConverterTypeRpcError));
1785
+ }
1786
+ catch (__error) {
1787
+ if (uniffiIsDebug && __error instanceof Error) {
1788
+ __error.stack = __stack;
1789
+ }
1790
+ throw __error;
1791
+ }
1792
+ }
1793
+ callUnaryStream(serviceName, methodName, request, timeout, metadata) {
1794
+ return FfiConverterTypeResponseStreamReader.lift(uniffiCaller.rustCallWithError(
1795
+ /*liftError:*/ FfiConverterTypeRpcError.lift.bind(FfiConverterTypeRpcError),
1796
+ /*caller:*/ (callStatus) => {
1797
+ return nativeModule().uniffi_slim_rpc_fn_method_channel_call_unary_stream(uniffiTypeChannelObjectFactory.clonePointer(this), FfiConverterString.lower(serviceName, nativeModule().rustbuffer_alloc), FfiConverterString.lower(methodName, nativeModule().rustbuffer_alloc), FfiConverterArrayBuffer.lower(request, nativeModule().rustbuffer_alloc), FfiConverterOptionalDuration.lower(timeout, nativeModule().rustbuffer_alloc), FfiConverterOptionalMapStringString.lower(metadata, nativeModule().rustbuffer_alloc), callStatus);
1798
+ },
1799
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString)));
1800
+ }
1801
+ async callUnaryStreamAsync(serviceName, methodName, request, timeout, metadata, asyncOpts_) {
1802
+ const __stack = uniffiIsDebug ? new Error().stack : undefined;
1803
+ try {
1804
+ return await uniffiRustCallAsync(
1805
+ /*rustCaller:*/ uniffiCaller,
1806
+ /*rustFutureFunc:*/ () => {
1807
+ return nativeModule().uniffi_slim_rpc_fn_method_channel_call_unary_stream_async(uniffiTypeChannelObjectFactory.clonePointer(this), FfiConverterString.lower(serviceName, nativeModule().rustbuffer_alloc), FfiConverterString.lower(methodName, nativeModule().rustbuffer_alloc), FfiConverterArrayBuffer.lower(request, nativeModule().rustbuffer_alloc), FfiConverterOptionalDuration.lower(timeout, nativeModule().rustbuffer_alloc), FfiConverterOptionalMapStringString.lower(metadata, nativeModule().rustbuffer_alloc));
1808
+ },
1809
+ /*pollFunc:*/ nativeModule().ffi_slim_rpc_rust_future_poll_u64,
1810
+ /*cancelFunc:*/ nativeModule().ffi_slim_rpc_rust_future_cancel_u64,
1811
+ /*completeFunc:*/ nativeModule().ffi_slim_rpc_rust_future_complete_u64,
1812
+ /*freeFunc:*/ nativeModule().ffi_slim_rpc_rust_future_free_u64,
1813
+ // Async returns always go through the JS-side converter: the
1814
+ // FFI symbol returns the future handle (u64), and the user-level
1815
+ // RustBuffer comes back via the shared `rust_future_complete_*`
1816
+ // export. The bytes the runtime hands back must be deserialized
1817
+ // here using the per-callable return-type converter.
1818
+ /*liftFunc:*/ FfiConverterTypeResponseStreamReader.lift.bind(FfiConverterTypeResponseStreamReader),
1819
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
1820
+ /*asyncOpts:*/ asyncOpts_,
1821
+ /*errorHandler:*/ FfiConverterTypeRpcError.lift.bind(FfiConverterTypeRpcError));
1822
+ }
1823
+ catch (__error) {
1824
+ if (uniffiIsDebug && __error instanceof Error) {
1825
+ __error.stack = __stack;
1826
+ }
1827
+ throw __error;
1828
+ }
1829
+ }
1830
+ /**
1831
+ * Async FFI wrapper for [`Channel::close`].
1832
+ */
1833
+ async closeAsync(timeout, asyncOpts_) {
1834
+ const __stack = uniffiIsDebug ? new Error().stack : undefined;
1835
+ try {
1836
+ return await uniffiRustCallAsync(
1837
+ /*rustCaller:*/ uniffiCaller,
1838
+ /*rustFutureFunc:*/ () => {
1839
+ return nativeModule().uniffi_slim_rpc_fn_method_channel_close_async(uniffiTypeChannelObjectFactory.clonePointer(this), FfiConverterOptionalDuration.lower(timeout, nativeModule().rustbuffer_alloc));
1840
+ },
1841
+ /*pollFunc:*/ nativeModule().ffi_slim_rpc_rust_future_poll_void,
1842
+ /*cancelFunc:*/ nativeModule().ffi_slim_rpc_rust_future_cancel_void,
1843
+ /*completeFunc:*/ nativeModule().ffi_slim_rpc_rust_future_complete_void,
1844
+ /*freeFunc:*/ nativeModule().ffi_slim_rpc_rust_future_free_void,
1845
+ /*liftFunc:*/ (_v) => { },
1846
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
1847
+ /*asyncOpts:*/ asyncOpts_,
1848
+ /*errorHandler:*/ FfiConverterTypeRpcError.lift.bind(FfiConverterTypeRpcError));
1849
+ }
1850
+ catch (__error) {
1851
+ if (uniffiIsDebug && __error instanceof Error) {
1852
+ __error.stack = __stack;
1853
+ }
1854
+ throw __error;
1855
+ }
1856
+ }
1857
+ /**
1858
+ * Blocking FFI wrapper for [`Channel::close`].
1859
+ */
1860
+ closeBlocking(timeout) {
1861
+ uniffiCaller.rustCallWithError(
1862
+ /*liftError:*/ FfiConverterTypeRpcError.lift.bind(FfiConverterTypeRpcError),
1863
+ /*caller:*/ (callStatus) => {
1864
+ nativeModule().uniffi_slim_rpc_fn_method_channel_close_blocking(uniffiTypeChannelObjectFactory.clonePointer(this), FfiConverterOptionalDuration.lower(timeout, nativeModule().rustbuffer_alloc), callStatus);
1865
+ },
1866
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString));
1867
+ }
1868
+ uniffiDestroy() {
1869
+ const ptr = this[destructorGuardSymbol];
1870
+ if (ptr !== undefined) {
1871
+ const pointer = uniffiTypeChannelObjectFactory.pointer(this);
1872
+ uniffiTypeChannelObjectFactory.freePointer(pointer);
1873
+ uniffiTypeChannelObjectFactory.unbless(ptr);
1874
+ delete this[destructorGuardSymbol];
1875
+ }
1876
+ }
1877
+ static instanceOf(obj_) {
1878
+ return uniffiTypeChannelObjectFactory.isConcreteType(obj_);
1879
+ }
1880
+ }
1881
+ _f = uniffiTypeNameSymbol;
1882
+ const uniffiTypeChannelObjectFactory = (() => {
1883
+ /// <reference lib="es2021" />
1884
+ const registry = typeof FinalizationRegistry !== 'undefined' ? new FinalizationRegistry((heldValue) => {
1885
+ uniffiTypeChannelObjectFactory.freePointer(heldValue);
1886
+ }) : null;
1887
+ return {
1888
+ create(pointer) {
1889
+ const instance = Object.create(Channel.prototype);
1890
+ instance[pointerLiteralSymbol] = pointer;
1891
+ instance[destructorGuardSymbol] = this.bless(pointer);
1892
+ instance[uniffiTypeNameSymbol] = "Channel";
1893
+ return instance;
1894
+ },
1895
+ bless(p) {
1896
+ const ptr = {
1897
+ p, // make sure this object doesn't get optimized away.
1898
+ markDestroyed: () => undefined,
1899
+ };
1900
+ if (registry) {
1901
+ registry.register(ptr, p, ptr);
1902
+ }
1903
+ return ptr;
1904
+ },
1905
+ unbless(ptr_) {
1906
+ if (registry) {
1907
+ registry.unregister(ptr_);
1908
+ }
1909
+ },
1910
+ pointer(obj_) {
1911
+ if (obj_[destructorGuardSymbol] === undefined) {
1912
+ throw new UniffiInternalError.UnexpectedNullPointer();
1913
+ }
1914
+ return obj_[pointerLiteralSymbol];
1915
+ },
1916
+ clonePointer(obj_) {
1917
+ const pointer = this.pointer(obj_);
1918
+ return uniffiCaller.rustCall(
1919
+ /*caller:*/ (callStatus) => nativeModule().uniffi_slim_rpc_fn_clone_channel(pointer, callStatus),
1920
+ /*liftString:*/ FfiConverterString.lift);
1921
+ },
1922
+ freePointer(pointer) {
1923
+ uniffiCaller.rustCall(
1924
+ /*caller:*/ (callStatus) => nativeModule().uniffi_slim_rpc_fn_free_channel(pointer, callStatus),
1925
+ /*liftString:*/ FfiConverterString.lift);
1926
+ },
1927
+ isConcreteType(obj_) {
1928
+ return obj_[destructorGuardSymbol] && obj_[uniffiTypeNameSymbol] === "Channel";
1929
+ },
1930
+ };
1931
+ })();
1932
+ const FfiConverterTypeChannel = new FfiConverterObject(uniffiTypeChannelObjectFactory);
1933
+ /**
1934
+ * Context passed to RPC handlers
1935
+ *
1936
+ * Contains all contextual information about an RPC call including:
1937
+ * - Session information (source, destination, session ID)
1938
+ * - Metadata (key-value pairs)
1939
+ * - Deadline/timeout information
1940
+ * - Message routing details
1941
+ */
1942
+ export class Context extends UniffiAbstractObject {
1943
+ // No primary constructor declared for this class.
1944
+ constructor(pointer) {
1945
+ super();
1946
+ this[_g] = "Context";
1947
+ this[pointerLiteralSymbol] = pointer;
1948
+ this[destructorGuardSymbol] = uniffiTypeContextObjectFactory.bless(pointer);
1949
+ }
1950
+ /**
1951
+ * Get the deadline for this RPC call
1952
+ */
1953
+ deadline() {
1954
+ return ((__rb) => {
1955
+ try {
1956
+ return FfiConverterTimestamp.lift(__rb);
1957
+ }
1958
+ finally {
1959
+ nativeModule().rustbuffer_free(__rb);
1960
+ }
1961
+ })(uniffiCaller.rustCall(
1962
+ /*caller:*/ (callStatus) => {
1963
+ return nativeModule().uniffi_slim_rpc_fn_method_context_deadline(uniffiTypeContextObjectFactory.clonePointer(this), callStatus);
1964
+ },
1965
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString)));
1966
+ }
1967
+ /**
1968
+ * Check if the deadline has been exceeded
1969
+ */
1970
+ isDeadlineExceeded() {
1971
+ return FfiConverterBool.lift(uniffiCaller.rustCall(
1972
+ /*caller:*/ (callStatus) => {
1973
+ return nativeModule().uniffi_slim_rpc_fn_method_context_is_deadline_exceeded(uniffiTypeContextObjectFactory.clonePointer(this), callStatus);
1974
+ },
1975
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString)));
1976
+ }
1977
+ /**
1978
+ * Get the rpc session metadata
1979
+ */
1980
+ metadata() {
1981
+ return ((__rb) => {
1982
+ try {
1983
+ return FfiConverterMapStringString.lift(__rb);
1984
+ }
1985
+ finally {
1986
+ nativeModule().rustbuffer_free(__rb);
1987
+ }
1988
+ })(uniffiCaller.rustCall(
1989
+ /*caller:*/ (callStatus) => {
1990
+ return nativeModule().uniffi_slim_rpc_fn_method_context_metadata(uniffiTypeContextObjectFactory.clonePointer(this), callStatus);
1991
+ },
1992
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString)));
1993
+ }
1994
+ /**
1995
+ * Get the remaining time until deadline
1996
+ *
1997
+ * Returns Duration::ZERO if the deadline has already passed
1998
+ */
1999
+ remainingTime() {
2000
+ return ((__rb) => {
2001
+ try {
2002
+ return FfiConverterDuration.lift(__rb);
2003
+ }
2004
+ finally {
2005
+ nativeModule().rustbuffer_free(__rb);
2006
+ }
2007
+ })(uniffiCaller.rustCall(
2008
+ /*caller:*/ (callStatus) => {
2009
+ return nativeModule().uniffi_slim_rpc_fn_method_context_remaining_time(uniffiTypeContextObjectFactory.clonePointer(this), callStatus);
2010
+ },
2011
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString)));
2012
+ }
2013
+ /**
2014
+ * Get the session ID
2015
+ */
2016
+ sessionId() {
2017
+ return ((__rb) => {
2018
+ try {
2019
+ return FfiConverterString.lift(__rb);
2020
+ }
2021
+ finally {
2022
+ nativeModule().rustbuffer_free(__rb);
2023
+ }
2024
+ })(uniffiCaller.rustCall(
2025
+ /*caller:*/ (callStatus) => {
2026
+ return nativeModule().uniffi_slim_rpc_fn_method_context_session_id(uniffiTypeContextObjectFactory.clonePointer(this), callStatus);
2027
+ },
2028
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString)));
2029
+ }
2030
+ uniffiDestroy() {
2031
+ const ptr = this[destructorGuardSymbol];
2032
+ if (ptr !== undefined) {
2033
+ const pointer = uniffiTypeContextObjectFactory.pointer(this);
2034
+ uniffiTypeContextObjectFactory.freePointer(pointer);
2035
+ uniffiTypeContextObjectFactory.unbless(ptr);
2036
+ delete this[destructorGuardSymbol];
2037
+ }
2038
+ }
2039
+ static instanceOf(obj_) {
2040
+ return uniffiTypeContextObjectFactory.isConcreteType(obj_);
2041
+ }
2042
+ }
2043
+ _g = uniffiTypeNameSymbol;
2044
+ const uniffiTypeContextObjectFactory = (() => {
2045
+ /// <reference lib="es2021" />
2046
+ const registry = typeof FinalizationRegistry !== 'undefined' ? new FinalizationRegistry((heldValue) => {
2047
+ uniffiTypeContextObjectFactory.freePointer(heldValue);
2048
+ }) : null;
2049
+ return {
2050
+ create(pointer) {
2051
+ const instance = Object.create(Context.prototype);
2052
+ instance[pointerLiteralSymbol] = pointer;
2053
+ instance[destructorGuardSymbol] = this.bless(pointer);
2054
+ instance[uniffiTypeNameSymbol] = "Context";
2055
+ return instance;
2056
+ },
2057
+ bless(p) {
2058
+ const ptr = {
2059
+ p, // make sure this object doesn't get optimized away.
2060
+ markDestroyed: () => undefined,
2061
+ };
2062
+ if (registry) {
2063
+ registry.register(ptr, p, ptr);
2064
+ }
2065
+ return ptr;
2066
+ },
2067
+ unbless(ptr_) {
2068
+ if (registry) {
2069
+ registry.unregister(ptr_);
2070
+ }
2071
+ },
2072
+ pointer(obj_) {
2073
+ if (obj_[destructorGuardSymbol] === undefined) {
2074
+ throw new UniffiInternalError.UnexpectedNullPointer();
2075
+ }
2076
+ return obj_[pointerLiteralSymbol];
2077
+ },
2078
+ clonePointer(obj_) {
2079
+ const pointer = this.pointer(obj_);
2080
+ return uniffiCaller.rustCall(
2081
+ /*caller:*/ (callStatus) => nativeModule().uniffi_slim_rpc_fn_clone_context(pointer, callStatus),
2082
+ /*liftString:*/ FfiConverterString.lift);
2083
+ },
2084
+ freePointer(pointer) {
2085
+ uniffiCaller.rustCall(
2086
+ /*caller:*/ (callStatus) => nativeModule().uniffi_slim_rpc_fn_free_context(pointer, callStatus),
2087
+ /*liftString:*/ FfiConverterString.lift);
2088
+ },
2089
+ isConcreteType(obj_) {
2090
+ return obj_[destructorGuardSymbol] && obj_[uniffiTypeNameSymbol] === "Context";
2091
+ },
2092
+ };
2093
+ })();
2094
+ const FfiConverterTypeContext = new FfiConverterObject(uniffiTypeContextObjectFactory);
2095
+ /**
2096
+ * Request stream reader
2097
+ *
2098
+ * Allows pulling messages from a client request stream.
2099
+ * This wraps the underlying async stream and provides a blocking interface
2100
+ * suitable for UniFFI callback traits.
2101
+ */
2102
+ export class RequestStream extends UniffiAbstractObject {
2103
+ // No primary constructor declared for this class.
2104
+ constructor(pointer) {
2105
+ super();
2106
+ this[_h] = "RequestStream";
2107
+ this[pointerLiteralSymbol] = pointer;
2108
+ this[destructorGuardSymbol] = uniffiTypeRequestStreamObjectFactory.bless(pointer);
2109
+ }
2110
+ /**
2111
+ * Pull the next message from the stream (blocking version)
2112
+ *
2113
+ * Returns a StreamMessage indicating the result
2114
+ */
2115
+ next() {
2116
+ return ((__rb) => {
2117
+ try {
2118
+ return FfiConverterTypeStreamMessage.lift(__rb);
2119
+ }
2120
+ finally {
2121
+ nativeModule().rustbuffer_free(__rb);
2122
+ }
2123
+ })(uniffiCaller.rustCall(
2124
+ /*caller:*/ (callStatus) => {
2125
+ return nativeModule().uniffi_slim_rpc_fn_method_requeststream_next(uniffiTypeRequestStreamObjectFactory.clonePointer(this), callStatus);
2126
+ },
2127
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString)));
2128
+ }
2129
+ /**
2130
+ * Pull the next message from the stream (async version)
2131
+ *
2132
+ * Returns a StreamMessage indicating the result
2133
+ */
2134
+ async nextAsync(asyncOpts_) {
2135
+ const __stack = uniffiIsDebug ? new Error().stack : undefined;
2136
+ try {
2137
+ return await uniffiRustCallAsync(
2138
+ /*rustCaller:*/ uniffiCaller,
2139
+ /*rustFutureFunc:*/ () => {
2140
+ return nativeModule().uniffi_slim_rpc_fn_method_requeststream_next_async(uniffiTypeRequestStreamObjectFactory.clonePointer(this));
2141
+ },
2142
+ /*pollFunc:*/ nativeModule().ffi_slim_rpc_rust_future_poll_rust_buffer,
2143
+ /*cancelFunc:*/ nativeModule().ffi_slim_rpc_rust_future_cancel_rust_buffer,
2144
+ /*completeFunc:*/ nativeModule().ffi_slim_rpc_rust_future_complete_rust_buffer,
2145
+ /*freeFunc:*/ nativeModule().ffi_slim_rpc_rust_future_free_rust_buffer,
2146
+ // Async returns always go through the JS-side converter: the
2147
+ // FFI symbol returns the future handle (u64), and the user-level
2148
+ // RustBuffer comes back via the shared `rust_future_complete_*`
2149
+ // export. The bytes the runtime hands back must be deserialized
2150
+ // here using the per-callable return-type converter.
2151
+ /*liftFunc:*/ FfiConverterTypeStreamMessage.lift.bind(FfiConverterTypeStreamMessage),
2152
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
2153
+ /*asyncOpts:*/ asyncOpts_);
2154
+ }
2155
+ catch (__error) {
2156
+ if (uniffiIsDebug && __error instanceof Error) {
2157
+ __error.stack = __stack;
2158
+ }
2159
+ throw __error;
2160
+ }
2161
+ }
2162
+ uniffiDestroy() {
2163
+ const ptr = this[destructorGuardSymbol];
2164
+ if (ptr !== undefined) {
2165
+ const pointer = uniffiTypeRequestStreamObjectFactory.pointer(this);
2166
+ uniffiTypeRequestStreamObjectFactory.freePointer(pointer);
2167
+ uniffiTypeRequestStreamObjectFactory.unbless(ptr);
2168
+ delete this[destructorGuardSymbol];
2169
+ }
2170
+ }
2171
+ static instanceOf(obj_) {
2172
+ return uniffiTypeRequestStreamObjectFactory.isConcreteType(obj_);
2173
+ }
2174
+ }
2175
+ _h = uniffiTypeNameSymbol;
2176
+ const uniffiTypeRequestStreamObjectFactory = (() => {
2177
+ /// <reference lib="es2021" />
2178
+ const registry = typeof FinalizationRegistry !== 'undefined' ? new FinalizationRegistry((heldValue) => {
2179
+ uniffiTypeRequestStreamObjectFactory.freePointer(heldValue);
2180
+ }) : null;
2181
+ return {
2182
+ create(pointer) {
2183
+ const instance = Object.create(RequestStream.prototype);
2184
+ instance[pointerLiteralSymbol] = pointer;
2185
+ instance[destructorGuardSymbol] = this.bless(pointer);
2186
+ instance[uniffiTypeNameSymbol] = "RequestStream";
2187
+ return instance;
2188
+ },
2189
+ bless(p) {
2190
+ const ptr = {
2191
+ p, // make sure this object doesn't get optimized away.
2192
+ markDestroyed: () => undefined,
2193
+ };
2194
+ if (registry) {
2195
+ registry.register(ptr, p, ptr);
2196
+ }
2197
+ return ptr;
2198
+ },
2199
+ unbless(ptr_) {
2200
+ if (registry) {
2201
+ registry.unregister(ptr_);
2202
+ }
2203
+ },
2204
+ pointer(obj_) {
2205
+ if (obj_[destructorGuardSymbol] === undefined) {
2206
+ throw new UniffiInternalError.UnexpectedNullPointer();
2207
+ }
2208
+ return obj_[pointerLiteralSymbol];
2209
+ },
2210
+ clonePointer(obj_) {
2211
+ const pointer = this.pointer(obj_);
2212
+ return uniffiCaller.rustCall(
2213
+ /*caller:*/ (callStatus) => nativeModule().uniffi_slim_rpc_fn_clone_requeststream(pointer, callStatus),
2214
+ /*liftString:*/ FfiConverterString.lift);
2215
+ },
2216
+ freePointer(pointer) {
2217
+ uniffiCaller.rustCall(
2218
+ /*caller:*/ (callStatus) => nativeModule().uniffi_slim_rpc_fn_free_requeststream(pointer, callStatus),
2219
+ /*liftString:*/ FfiConverterString.lift);
2220
+ },
2221
+ isConcreteType(obj_) {
2222
+ return obj_[destructorGuardSymbol] && obj_[uniffiTypeNameSymbol] === "RequestStream";
2223
+ },
2224
+ };
2225
+ })();
2226
+ const FfiConverterTypeRequestStream = new FfiConverterObject(uniffiTypeRequestStreamObjectFactory);
2227
+ /**
2228
+ * Response stream writer
2229
+ *
2230
+ * Allows pushing messages to a client response stream.
2231
+ * This wraps an async channel sender and provides a blocking interface
2232
+ * suitable for UniFFI callback traits.
2233
+ */
2234
+ export class ResponseSink extends UniffiAbstractObject {
2235
+ // No primary constructor declared for this class.
2236
+ constructor(pointer) {
2237
+ super();
2238
+ this[_j] = "ResponseSink";
2239
+ this[pointerLiteralSymbol] = pointer;
2240
+ this[destructorGuardSymbol] = uniffiTypeResponseSinkObjectFactory.bless(pointer);
2241
+ }
2242
+ /**
2243
+ * Close the response stream (blocking version)
2244
+ *
2245
+ * Signals that no more messages will be sent.
2246
+ * The stream will end gracefully.
2247
+ */
2248
+ close() {
2249
+ uniffiCaller.rustCallWithError(
2250
+ /*liftError:*/ FfiConverterTypeRpcError.lift.bind(FfiConverterTypeRpcError),
2251
+ /*caller:*/ (callStatus) => {
2252
+ nativeModule().uniffi_slim_rpc_fn_method_responsesink_close(uniffiTypeResponseSinkObjectFactory.clonePointer(this), callStatus);
2253
+ },
2254
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString));
2255
+ }
2256
+ /**
2257
+ * Close the response stream (async version)
2258
+ *
2259
+ * Signals that no more messages will be sent.
2260
+ * The stream will end gracefully.
2261
+ */
2262
+ async closeAsync(asyncOpts_) {
2263
+ const __stack = uniffiIsDebug ? new Error().stack : undefined;
2264
+ try {
2265
+ return await uniffiRustCallAsync(
2266
+ /*rustCaller:*/ uniffiCaller,
2267
+ /*rustFutureFunc:*/ () => {
2268
+ return nativeModule().uniffi_slim_rpc_fn_method_responsesink_close_async(uniffiTypeResponseSinkObjectFactory.clonePointer(this));
2269
+ },
2270
+ /*pollFunc:*/ nativeModule().ffi_slim_rpc_rust_future_poll_void,
2271
+ /*cancelFunc:*/ nativeModule().ffi_slim_rpc_rust_future_cancel_void,
2272
+ /*completeFunc:*/ nativeModule().ffi_slim_rpc_rust_future_complete_void,
2273
+ /*freeFunc:*/ nativeModule().ffi_slim_rpc_rust_future_free_void,
2274
+ /*liftFunc:*/ (_v) => { },
2275
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
2276
+ /*asyncOpts:*/ asyncOpts_,
2277
+ /*errorHandler:*/ FfiConverterTypeRpcError.lift.bind(FfiConverterTypeRpcError));
2278
+ }
2279
+ catch (__error) {
2280
+ if (uniffiIsDebug && __error instanceof Error) {
2281
+ __error.stack = __stack;
2282
+ }
2283
+ throw __error;
2284
+ }
2285
+ }
2286
+ /**
2287
+ * Check if the sink has been closed (blocking version)
2288
+ */
2289
+ isClosed() {
2290
+ return FfiConverterBool.lift(uniffiCaller.rustCall(
2291
+ /*caller:*/ (callStatus) => {
2292
+ return nativeModule().uniffi_slim_rpc_fn_method_responsesink_is_closed(uniffiTypeResponseSinkObjectFactory.clonePointer(this), callStatus);
2293
+ },
2294
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString)));
2295
+ }
2296
+ /**
2297
+ * Check if the sink has been closed (async version)
2298
+ */
2299
+ async isClosedAsync(asyncOpts_) {
2300
+ const __stack = uniffiIsDebug ? new Error().stack : undefined;
2301
+ try {
2302
+ return await uniffiRustCallAsync(
2303
+ /*rustCaller:*/ uniffiCaller,
2304
+ /*rustFutureFunc:*/ () => {
2305
+ return nativeModule().uniffi_slim_rpc_fn_method_responsesink_is_closed_async(uniffiTypeResponseSinkObjectFactory.clonePointer(this));
2306
+ },
2307
+ /*pollFunc:*/ nativeModule().ffi_slim_rpc_rust_future_poll_i8,
2308
+ /*cancelFunc:*/ nativeModule().ffi_slim_rpc_rust_future_cancel_i8,
2309
+ /*completeFunc:*/ nativeModule().ffi_slim_rpc_rust_future_complete_i8,
2310
+ /*freeFunc:*/ nativeModule().ffi_slim_rpc_rust_future_free_i8,
2311
+ // Async returns always go through the JS-side converter: the
2312
+ // FFI symbol returns the future handle (u64), and the user-level
2313
+ // RustBuffer comes back via the shared `rust_future_complete_*`
2314
+ // export. The bytes the runtime hands back must be deserialized
2315
+ // here using the per-callable return-type converter.
2316
+ /*liftFunc:*/ FfiConverterBool.lift.bind(FfiConverterBool),
2317
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
2318
+ /*asyncOpts:*/ asyncOpts_);
2319
+ }
2320
+ catch (__error) {
2321
+ if (uniffiIsDebug && __error instanceof Error) {
2322
+ __error.stack = __stack;
2323
+ }
2324
+ throw __error;
2325
+ }
2326
+ }
2327
+ /**
2328
+ * Send a message to the response stream (blocking version)
2329
+ *
2330
+ * Returns an error if the stream has been closed or if sending fails.
2331
+ */
2332
+ send(data) {
2333
+ uniffiCaller.rustCallWithError(
2334
+ /*liftError:*/ FfiConverterTypeRpcError.lift.bind(FfiConverterTypeRpcError),
2335
+ /*caller:*/ (callStatus) => {
2336
+ nativeModule().uniffi_slim_rpc_fn_method_responsesink_send(uniffiTypeResponseSinkObjectFactory.clonePointer(this), FfiConverterArrayBuffer.lower(data, nativeModule().rustbuffer_alloc), callStatus);
2337
+ },
2338
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString));
2339
+ }
2340
+ /**
2341
+ * Send a message to the response stream (async version)
2342
+ *
2343
+ * Returns an error if the stream has been closed or if sending fails.
2344
+ */
2345
+ async sendAsync(data, asyncOpts_) {
2346
+ const __stack = uniffiIsDebug ? new Error().stack : undefined;
2347
+ try {
2348
+ return await uniffiRustCallAsync(
2349
+ /*rustCaller:*/ uniffiCaller,
2350
+ /*rustFutureFunc:*/ () => {
2351
+ return nativeModule().uniffi_slim_rpc_fn_method_responsesink_send_async(uniffiTypeResponseSinkObjectFactory.clonePointer(this), FfiConverterArrayBuffer.lower(data, nativeModule().rustbuffer_alloc));
2352
+ },
2353
+ /*pollFunc:*/ nativeModule().ffi_slim_rpc_rust_future_poll_void,
2354
+ /*cancelFunc:*/ nativeModule().ffi_slim_rpc_rust_future_cancel_void,
2355
+ /*completeFunc:*/ nativeModule().ffi_slim_rpc_rust_future_complete_void,
2356
+ /*freeFunc:*/ nativeModule().ffi_slim_rpc_rust_future_free_void,
2357
+ /*liftFunc:*/ (_v) => { },
2358
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
2359
+ /*asyncOpts:*/ asyncOpts_,
2360
+ /*errorHandler:*/ FfiConverterTypeRpcError.lift.bind(FfiConverterTypeRpcError));
2361
+ }
2362
+ catch (__error) {
2363
+ if (uniffiIsDebug && __error instanceof Error) {
2364
+ __error.stack = __stack;
2365
+ }
2366
+ throw __error;
2367
+ }
2368
+ }
2369
+ /**
2370
+ * Send an error to the response stream and close it (blocking version)
2371
+ *
2372
+ * This terminates the stream with an error status.
2373
+ */
2374
+ sendError(error) {
2375
+ uniffiCaller.rustCallWithError(
2376
+ /*liftError:*/ FfiConverterTypeRpcError.lift.bind(FfiConverterTypeRpcError),
2377
+ /*caller:*/ (callStatus) => {
2378
+ nativeModule().uniffi_slim_rpc_fn_method_responsesink_send_error(uniffiTypeResponseSinkObjectFactory.clonePointer(this), FfiConverterTypeRpcError.lower(error, nativeModule().rustbuffer_alloc), callStatus);
2379
+ },
2380
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString));
2381
+ }
2382
+ /**
2383
+ * Send an error to the response stream and close it (async version)
2384
+ *
2385
+ * This terminates the stream with an error status.
2386
+ */
2387
+ async sendErrorAsync(error, asyncOpts_) {
2388
+ const __stack = uniffiIsDebug ? new Error().stack : undefined;
2389
+ try {
2390
+ return await uniffiRustCallAsync(
2391
+ /*rustCaller:*/ uniffiCaller,
2392
+ /*rustFutureFunc:*/ () => {
2393
+ return nativeModule().uniffi_slim_rpc_fn_method_responsesink_send_error_async(uniffiTypeResponseSinkObjectFactory.clonePointer(this), FfiConverterTypeRpcError.lower(error, nativeModule().rustbuffer_alloc));
2394
+ },
2395
+ /*pollFunc:*/ nativeModule().ffi_slim_rpc_rust_future_poll_void,
2396
+ /*cancelFunc:*/ nativeModule().ffi_slim_rpc_rust_future_cancel_void,
2397
+ /*completeFunc:*/ nativeModule().ffi_slim_rpc_rust_future_complete_void,
2398
+ /*freeFunc:*/ nativeModule().ffi_slim_rpc_rust_future_free_void,
2399
+ /*liftFunc:*/ (_v) => { },
2400
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
2401
+ /*asyncOpts:*/ asyncOpts_,
2402
+ /*errorHandler:*/ FfiConverterTypeRpcError.lift.bind(FfiConverterTypeRpcError));
2403
+ }
2404
+ catch (__error) {
2405
+ if (uniffiIsDebug && __error instanceof Error) {
2406
+ __error.stack = __stack;
2407
+ }
2408
+ throw __error;
2409
+ }
2410
+ }
2411
+ uniffiDestroy() {
2412
+ const ptr = this[destructorGuardSymbol];
2413
+ if (ptr !== undefined) {
2414
+ const pointer = uniffiTypeResponseSinkObjectFactory.pointer(this);
2415
+ uniffiTypeResponseSinkObjectFactory.freePointer(pointer);
2416
+ uniffiTypeResponseSinkObjectFactory.unbless(ptr);
2417
+ delete this[destructorGuardSymbol];
2418
+ }
2419
+ }
2420
+ static instanceOf(obj_) {
2421
+ return uniffiTypeResponseSinkObjectFactory.isConcreteType(obj_);
2422
+ }
2423
+ }
2424
+ _j = uniffiTypeNameSymbol;
2425
+ const uniffiTypeResponseSinkObjectFactory = (() => {
2426
+ /// <reference lib="es2021" />
2427
+ const registry = typeof FinalizationRegistry !== 'undefined' ? new FinalizationRegistry((heldValue) => {
2428
+ uniffiTypeResponseSinkObjectFactory.freePointer(heldValue);
2429
+ }) : null;
2430
+ return {
2431
+ create(pointer) {
2432
+ const instance = Object.create(ResponseSink.prototype);
2433
+ instance[pointerLiteralSymbol] = pointer;
2434
+ instance[destructorGuardSymbol] = this.bless(pointer);
2435
+ instance[uniffiTypeNameSymbol] = "ResponseSink";
2436
+ return instance;
2437
+ },
2438
+ bless(p) {
2439
+ const ptr = {
2440
+ p, // make sure this object doesn't get optimized away.
2441
+ markDestroyed: () => undefined,
2442
+ };
2443
+ if (registry) {
2444
+ registry.register(ptr, p, ptr);
2445
+ }
2446
+ return ptr;
2447
+ },
2448
+ unbless(ptr_) {
2449
+ if (registry) {
2450
+ registry.unregister(ptr_);
2451
+ }
2452
+ },
2453
+ pointer(obj_) {
2454
+ if (obj_[destructorGuardSymbol] === undefined) {
2455
+ throw new UniffiInternalError.UnexpectedNullPointer();
2456
+ }
2457
+ return obj_[pointerLiteralSymbol];
2458
+ },
2459
+ clonePointer(obj_) {
2460
+ const pointer = this.pointer(obj_);
2461
+ return uniffiCaller.rustCall(
2462
+ /*caller:*/ (callStatus) => nativeModule().uniffi_slim_rpc_fn_clone_responsesink(pointer, callStatus),
2463
+ /*liftString:*/ FfiConverterString.lift);
2464
+ },
2465
+ freePointer(pointer) {
2466
+ uniffiCaller.rustCall(
2467
+ /*caller:*/ (callStatus) => nativeModule().uniffi_slim_rpc_fn_free_responsesink(pointer, callStatus),
2468
+ /*liftString:*/ FfiConverterString.lift);
2469
+ },
2470
+ isConcreteType(obj_) {
2471
+ return obj_[destructorGuardSymbol] && obj_[uniffiTypeNameSymbol] === "ResponseSink";
2472
+ },
2473
+ };
2474
+ })();
2475
+ const FfiConverterTypeResponseSink = new FfiConverterObject(uniffiTypeResponseSinkObjectFactory);
2476
+ /**
2477
+ * Stream-to-Stream RPC handler trait
2478
+ *
2479
+ * Implement this trait to handle stream-to-stream RPC calls.
2480
+ * The handler receives multiple requests via the stream and sends multiple responses via the sink.
2481
+ */
2482
+ export class StreamStreamHandlerImpl extends UniffiAbstractObject {
2483
+ // No primary constructor declared for this class.
2484
+ constructor(pointer) {
2485
+ super();
2486
+ this[_k] = "StreamStreamHandlerImpl";
2487
+ this[pointerLiteralSymbol] = pointer;
2488
+ this[destructorGuardSymbol] = uniffiTypeStreamStreamHandlerImplObjectFactory.bless(pointer);
2489
+ }
2490
+ /**
2491
+ * Handle a stream-to-stream RPC call
2492
+ *
2493
+ * # Arguments
2494
+ * * `stream` - Request stream to pull messages from
2495
+ * * `context` - RPC context with metadata and session information
2496
+ * * `sink` - Response sink to send streaming responses
2497
+ *
2498
+ * # Returns
2499
+ * Ok(()) if handling succeeded, or an error
2500
+ *
2501
+ * # Note
2502
+ * You must call `sink.close()` or `sink.send_error()` when done.
2503
+ */
2504
+ async handle(stream, context, sink, asyncOpts_) {
2505
+ const __stack = uniffiIsDebug ? new Error().stack : undefined;
2506
+ try {
2507
+ return await uniffiRustCallAsync(
2508
+ /*rustCaller:*/ uniffiCaller,
2509
+ /*rustFutureFunc:*/ () => {
2510
+ return nativeModule().uniffi_slim_rpc_fn_method_streamstreamhandler_handle(uniffiTypeStreamStreamHandlerImplObjectFactory.clonePointer(this), FfiConverterTypeRequestStream.lower(stream, nativeModule().rustbuffer_alloc), FfiConverterTypeContext.lower(context, nativeModule().rustbuffer_alloc), FfiConverterTypeResponseSink.lower(sink, nativeModule().rustbuffer_alloc));
2511
+ },
2512
+ /*pollFunc:*/ nativeModule().ffi_slim_rpc_rust_future_poll_void,
2513
+ /*cancelFunc:*/ nativeModule().ffi_slim_rpc_rust_future_cancel_void,
2514
+ /*completeFunc:*/ nativeModule().ffi_slim_rpc_rust_future_complete_void,
2515
+ /*freeFunc:*/ nativeModule().ffi_slim_rpc_rust_future_free_void,
2516
+ /*liftFunc:*/ (_v) => { },
2517
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
2518
+ /*asyncOpts:*/ asyncOpts_,
2519
+ /*errorHandler:*/ FfiConverterTypeRpcError.lift.bind(FfiConverterTypeRpcError));
2520
+ }
2521
+ catch (__error) {
2522
+ if (uniffiIsDebug && __error instanceof Error) {
2523
+ __error.stack = __stack;
2524
+ }
2525
+ throw __error;
2526
+ }
2527
+ }
2528
+ uniffiDestroy() {
2529
+ const ptr = this[destructorGuardSymbol];
2530
+ if (ptr !== undefined) {
2531
+ const pointer = uniffiTypeStreamStreamHandlerImplObjectFactory.pointer(this);
2532
+ uniffiTypeStreamStreamHandlerImplObjectFactory.freePointer(pointer);
2533
+ uniffiTypeStreamStreamHandlerImplObjectFactory.unbless(ptr);
2534
+ delete this[destructorGuardSymbol];
2535
+ }
2536
+ }
2537
+ static instanceOf(obj_) {
2538
+ return uniffiTypeStreamStreamHandlerImplObjectFactory.isConcreteType(obj_);
2539
+ }
2540
+ }
2541
+ _k = uniffiTypeNameSymbol;
2542
+ const uniffiTypeStreamStreamHandlerImplObjectFactory = (() => {
2543
+ /// <reference lib="es2021" />
2544
+ const registry = typeof FinalizationRegistry !== 'undefined' ? new FinalizationRegistry((heldValue) => {
2545
+ uniffiTypeStreamStreamHandlerImplObjectFactory.freePointer(heldValue);
2546
+ }) : null;
2547
+ return {
2548
+ create(pointer) {
2549
+ const instance = Object.create(StreamStreamHandlerImpl.prototype);
2550
+ instance[pointerLiteralSymbol] = pointer;
2551
+ instance[destructorGuardSymbol] = this.bless(pointer);
2552
+ instance[uniffiTypeNameSymbol] = "StreamStreamHandlerImpl";
2553
+ return instance;
2554
+ },
2555
+ bless(p) {
2556
+ const ptr = {
2557
+ p, // make sure this object doesn't get optimized away.
2558
+ markDestroyed: () => undefined,
2559
+ };
2560
+ if (registry) {
2561
+ registry.register(ptr, p, ptr);
2562
+ }
2563
+ return ptr;
2564
+ },
2565
+ unbless(ptr_) {
2566
+ if (registry) {
2567
+ registry.unregister(ptr_);
2568
+ }
2569
+ },
2570
+ pointer(obj_) {
2571
+ if (obj_[destructorGuardSymbol] === undefined) {
2572
+ throw new UniffiInternalError.UnexpectedNullPointer();
2573
+ }
2574
+ return obj_[pointerLiteralSymbol];
2575
+ },
2576
+ clonePointer(obj_) {
2577
+ const pointer = this.pointer(obj_);
2578
+ return uniffiCaller.rustCall(
2579
+ /*caller:*/ (callStatus) => nativeModule().uniffi_slim_rpc_fn_clone_streamstreamhandler(pointer, callStatus),
2580
+ /*liftString:*/ FfiConverterString.lift);
2581
+ },
2582
+ freePointer(pointer) {
2583
+ uniffiCaller.rustCall(
2584
+ /*caller:*/ (callStatus) => nativeModule().uniffi_slim_rpc_fn_free_streamstreamhandler(pointer, callStatus),
2585
+ /*liftString:*/ FfiConverterString.lift);
2586
+ },
2587
+ isConcreteType(obj_) {
2588
+ return obj_[destructorGuardSymbol] && obj_[uniffiTypeNameSymbol] === "StreamStreamHandlerImpl";
2589
+ },
2590
+ };
2591
+ })();
2592
+ const FfiConverterTypeStreamStreamHandler = new FfiConverterObjectWithCallbacks(uniffiTypeStreamStreamHandlerImplObjectFactory);
2593
+ // Add a vtable for the callbacks that go in StreamStreamHandler.
2594
+ // Put the implementation in a struct so we don't pollute the top-level namespace
2595
+ const uniffiCallbackInterfaceStreamStreamHandler = {
2596
+ // Create the VTable using a series of closures.
2597
+ // ts automatically converts these into C callback functions.
2598
+ vtable: {
2599
+ handle: (uniffiHandle, stream, context, sink, uniffiFutureCallback, uniffiCallbackData) => {
2600
+ const uniffiMakeCall = async (signal) => {
2601
+ const jsCallback = FfiConverterTypeStreamStreamHandler.lift(uniffiHandle);
2602
+ return await jsCallback.handle(FfiConverterTypeRequestStream.lift(stream), FfiConverterTypeContext.lift(context), FfiConverterTypeResponseSink.lift(sink), { signal });
2603
+ };
2604
+ const uniffiHandleSuccess = (returnValue) => {
2605
+ uniffiFutureCallback.call(uniffiFutureCallback, uniffiCallbackData,
2606
+ /* UniffiForeignFutureResultVoid */ {
2607
+ call_status: uniffiCaller.createCallStatus()
2608
+ });
2609
+ };
2610
+ const uniffiHandleError = (code, errorBuf) => {
2611
+ uniffiFutureCallback.call(uniffiFutureCallback, uniffiCallbackData,
2612
+ /* UniffiForeignFutureResultVoid */ {
2613
+ // TODO create callstatus with error.
2614
+ call_status: uniffiCaller.createErrorStatus(code, errorBuf),
2615
+ });
2616
+ };
2617
+ const uniffiForeignFuture = uniffiTraitInterfaceCallAsyncWithError(
2618
+ /*makeCall:*/ uniffiMakeCall,
2619
+ /*handleSuccess:*/ uniffiHandleSuccess,
2620
+ /*handleError:*/ uniffiHandleError,
2621
+ /*isErrorType:*/ RpcError.instanceOf,
2622
+ /*lowerError:*/ FfiConverterTypeRpcError.lower.bind(FfiConverterTypeRpcError),
2623
+ /*lowerString:*/ FfiConverterString.lower.bind(FfiConverterString),
2624
+ /*alloc:*/ nativeModule().rustbuffer_alloc);
2625
+ return uniffiForeignFuture;
2626
+ },
2627
+ uniffi_free: (uniffiHandle) => {
2628
+ // this will throw a stale handle error if the handle isn't found.
2629
+ FfiConverterTypeStreamStreamHandler.drop(uniffiHandle);
2630
+ },
2631
+ uniffi_clone: (uniffiHandle) => {
2632
+ return FfiConverterTypeStreamStreamHandler.clone(uniffiHandle);
2633
+ }
2634
+ },
2635
+ register: () => {
2636
+ nativeModule().uniffi_slim_rpc_fn_init_callback_vtable_streamstreamhandler(uniffiCallbackInterfaceStreamStreamHandler.vtable);
2637
+ },
2638
+ };
2639
+ /**
2640
+ * Stream-to-Unary RPC handler trait
2641
+ *
2642
+ * Implement this trait to handle stream-to-unary RPC calls.
2643
+ * The handler receives multiple requests via the stream and returns a single response.
2644
+ */
2645
+ export class StreamUnaryHandlerImpl extends UniffiAbstractObject {
2646
+ // No primary constructor declared for this class.
2647
+ constructor(pointer) {
2648
+ super();
2649
+ this[_l] = "StreamUnaryHandlerImpl";
2650
+ this[pointerLiteralSymbol] = pointer;
2651
+ this[destructorGuardSymbol] = uniffiTypeStreamUnaryHandlerImplObjectFactory.bless(pointer);
2652
+ }
2653
+ /**
2654
+ * Handle a stream-to-unary RPC call
2655
+ *
2656
+ * # Arguments
2657
+ * * `stream` - Request stream to pull messages from
2658
+ * * `context` - RPC context with metadata and session information
2659
+ *
2660
+ * # Returns
2661
+ * The response message bytes or an error
2662
+ */
2663
+ async handle(stream, context, asyncOpts_) {
2664
+ const __stack = uniffiIsDebug ? new Error().stack : undefined;
2665
+ try {
2666
+ return await uniffiRustCallAsync(
2667
+ /*rustCaller:*/ uniffiCaller,
2668
+ /*rustFutureFunc:*/ () => {
2669
+ return nativeModule().uniffi_slim_rpc_fn_method_streamunaryhandler_handle(uniffiTypeStreamUnaryHandlerImplObjectFactory.clonePointer(this), FfiConverterTypeRequestStream.lower(stream, nativeModule().rustbuffer_alloc), FfiConverterTypeContext.lower(context, nativeModule().rustbuffer_alloc));
2670
+ },
2671
+ /*pollFunc:*/ nativeModule().ffi_slim_rpc_rust_future_poll_rust_buffer,
2672
+ /*cancelFunc:*/ nativeModule().ffi_slim_rpc_rust_future_cancel_rust_buffer,
2673
+ /*completeFunc:*/ nativeModule().ffi_slim_rpc_rust_future_complete_rust_buffer,
2674
+ /*freeFunc:*/ nativeModule().ffi_slim_rpc_rust_future_free_rust_buffer,
2675
+ // Async returns always go through the JS-side converter: the
2676
+ // FFI symbol returns the future handle (u64), and the user-level
2677
+ // RustBuffer comes back via the shared `rust_future_complete_*`
2678
+ // export. The bytes the runtime hands back must be deserialized
2679
+ // here using the per-callable return-type converter.
2680
+ /*liftFunc:*/ FfiConverterArrayBuffer.lift.bind(FfiConverterArrayBuffer),
2681
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
2682
+ /*asyncOpts:*/ asyncOpts_,
2683
+ /*errorHandler:*/ FfiConverterTypeRpcError.lift.bind(FfiConverterTypeRpcError));
2684
+ }
2685
+ catch (__error) {
2686
+ if (uniffiIsDebug && __error instanceof Error) {
2687
+ __error.stack = __stack;
2688
+ }
2689
+ throw __error;
2690
+ }
2691
+ }
2692
+ uniffiDestroy() {
2693
+ const ptr = this[destructorGuardSymbol];
2694
+ if (ptr !== undefined) {
2695
+ const pointer = uniffiTypeStreamUnaryHandlerImplObjectFactory.pointer(this);
2696
+ uniffiTypeStreamUnaryHandlerImplObjectFactory.freePointer(pointer);
2697
+ uniffiTypeStreamUnaryHandlerImplObjectFactory.unbless(ptr);
2698
+ delete this[destructorGuardSymbol];
2699
+ }
2700
+ }
2701
+ static instanceOf(obj_) {
2702
+ return uniffiTypeStreamUnaryHandlerImplObjectFactory.isConcreteType(obj_);
2703
+ }
2704
+ }
2705
+ _l = uniffiTypeNameSymbol;
2706
+ const uniffiTypeStreamUnaryHandlerImplObjectFactory = (() => {
2707
+ /// <reference lib="es2021" />
2708
+ const registry = typeof FinalizationRegistry !== 'undefined' ? new FinalizationRegistry((heldValue) => {
2709
+ uniffiTypeStreamUnaryHandlerImplObjectFactory.freePointer(heldValue);
2710
+ }) : null;
2711
+ return {
2712
+ create(pointer) {
2713
+ const instance = Object.create(StreamUnaryHandlerImpl.prototype);
2714
+ instance[pointerLiteralSymbol] = pointer;
2715
+ instance[destructorGuardSymbol] = this.bless(pointer);
2716
+ instance[uniffiTypeNameSymbol] = "StreamUnaryHandlerImpl";
2717
+ return instance;
2718
+ },
2719
+ bless(p) {
2720
+ const ptr = {
2721
+ p, // make sure this object doesn't get optimized away.
2722
+ markDestroyed: () => undefined,
2723
+ };
2724
+ if (registry) {
2725
+ registry.register(ptr, p, ptr);
2726
+ }
2727
+ return ptr;
2728
+ },
2729
+ unbless(ptr_) {
2730
+ if (registry) {
2731
+ registry.unregister(ptr_);
2732
+ }
2733
+ },
2734
+ pointer(obj_) {
2735
+ if (obj_[destructorGuardSymbol] === undefined) {
2736
+ throw new UniffiInternalError.UnexpectedNullPointer();
2737
+ }
2738
+ return obj_[pointerLiteralSymbol];
2739
+ },
2740
+ clonePointer(obj_) {
2741
+ const pointer = this.pointer(obj_);
2742
+ return uniffiCaller.rustCall(
2743
+ /*caller:*/ (callStatus) => nativeModule().uniffi_slim_rpc_fn_clone_streamunaryhandler(pointer, callStatus),
2744
+ /*liftString:*/ FfiConverterString.lift);
2745
+ },
2746
+ freePointer(pointer) {
2747
+ uniffiCaller.rustCall(
2748
+ /*caller:*/ (callStatus) => nativeModule().uniffi_slim_rpc_fn_free_streamunaryhandler(pointer, callStatus),
2749
+ /*liftString:*/ FfiConverterString.lift);
2750
+ },
2751
+ isConcreteType(obj_) {
2752
+ return obj_[destructorGuardSymbol] && obj_[uniffiTypeNameSymbol] === "StreamUnaryHandlerImpl";
2753
+ },
2754
+ };
2755
+ })();
2756
+ const FfiConverterTypeStreamUnaryHandler = new FfiConverterObjectWithCallbacks(uniffiTypeStreamUnaryHandlerImplObjectFactory);
2757
+ // Add a vtable for the callbacks that go in StreamUnaryHandler.
2758
+ // Put the implementation in a struct so we don't pollute the top-level namespace
2759
+ const uniffiCallbackInterfaceStreamUnaryHandler = {
2760
+ // Create the VTable using a series of closures.
2761
+ // ts automatically converts these into C callback functions.
2762
+ vtable: {
2763
+ handle: (uniffiHandle, stream, context, uniffiFutureCallback, uniffiCallbackData) => {
2764
+ const uniffiMakeCall = async (signal) => {
2765
+ const jsCallback = FfiConverterTypeStreamUnaryHandler.lift(uniffiHandle);
2766
+ return await jsCallback.handle(FfiConverterTypeRequestStream.lift(stream), FfiConverterTypeContext.lift(context), { signal });
2767
+ };
2768
+ const uniffiHandleSuccess = (returnValue) => {
2769
+ uniffiFutureCallback.call(uniffiFutureCallback, uniffiCallbackData,
2770
+ /* UniffiForeignFutureResultRustBuffer */ {
2771
+ return_value: FfiConverterArrayBuffer.lower(returnValue, nativeModule().rustbuffer_alloc),
2772
+ call_status: uniffiCaller.createCallStatus()
2773
+ });
2774
+ };
2775
+ const uniffiHandleError = (code, errorBuf) => {
2776
+ uniffiFutureCallback.call(uniffiFutureCallback, uniffiCallbackData,
2777
+ /* UniffiForeignFutureResultRustBuffer */ {
2778
+ return_value: /*empty*/ new Uint8Array(0),
2779
+ // TODO create callstatus with error.
2780
+ call_status: uniffiCaller.createErrorStatus(code, errorBuf),
2781
+ });
2782
+ };
2783
+ const uniffiForeignFuture = uniffiTraitInterfaceCallAsyncWithError(
2784
+ /*makeCall:*/ uniffiMakeCall,
2785
+ /*handleSuccess:*/ uniffiHandleSuccess,
2786
+ /*handleError:*/ uniffiHandleError,
2787
+ /*isErrorType:*/ RpcError.instanceOf,
2788
+ /*lowerError:*/ FfiConverterTypeRpcError.lower.bind(FfiConverterTypeRpcError),
2789
+ /*lowerString:*/ FfiConverterString.lower.bind(FfiConverterString),
2790
+ /*alloc:*/ nativeModule().rustbuffer_alloc);
2791
+ return uniffiForeignFuture;
2792
+ },
2793
+ uniffi_free: (uniffiHandle) => {
2794
+ // this will throw a stale handle error if the handle isn't found.
2795
+ FfiConverterTypeStreamUnaryHandler.drop(uniffiHandle);
2796
+ },
2797
+ uniffi_clone: (uniffiHandle) => {
2798
+ return FfiConverterTypeStreamUnaryHandler.clone(uniffiHandle);
2799
+ }
2800
+ },
2801
+ register: () => {
2802
+ nativeModule().uniffi_slim_rpc_fn_init_callback_vtable_streamunaryhandler(uniffiCallbackInterfaceStreamUnaryHandler.vtable);
2803
+ },
2804
+ };
2805
+ /**
2806
+ * Unary-to-Stream RPC handler trait
2807
+ *
2808
+ * Implement this trait to handle unary-to-stream RPC calls.
2809
+ * The handler receives a single request and sends multiple responses via the sink.
2810
+ */
2811
+ export class UnaryStreamHandlerImpl extends UniffiAbstractObject {
2812
+ // No primary constructor declared for this class.
2813
+ constructor(pointer) {
2814
+ super();
2815
+ this[_m] = "UnaryStreamHandlerImpl";
2816
+ this[pointerLiteralSymbol] = pointer;
2817
+ this[destructorGuardSymbol] = uniffiTypeUnaryStreamHandlerImplObjectFactory.bless(pointer);
2818
+ }
2819
+ /**
2820
+ * Handle a unary-to-stream RPC call
2821
+ *
2822
+ * # Arguments
2823
+ * * `request` - The request message bytes
2824
+ * * `context` - RPC context with metadata and session information
2825
+ * * `sink` - Response sink to send streaming responses
2826
+ *
2827
+ * # Returns
2828
+ * Ok(()) if handling succeeded, or an error
2829
+ *
2830
+ * # Note
2831
+ * You must call `sink.close()` or `sink.send_error()` when done.
2832
+ */
2833
+ async handle(request, context, sink, asyncOpts_) {
2834
+ const __stack = uniffiIsDebug ? new Error().stack : undefined;
2835
+ try {
2836
+ return await uniffiRustCallAsync(
2837
+ /*rustCaller:*/ uniffiCaller,
2838
+ /*rustFutureFunc:*/ () => {
2839
+ return nativeModule().uniffi_slim_rpc_fn_method_unarystreamhandler_handle(uniffiTypeUnaryStreamHandlerImplObjectFactory.clonePointer(this), FfiConverterArrayBuffer.lower(request, nativeModule().rustbuffer_alloc), FfiConverterTypeContext.lower(context, nativeModule().rustbuffer_alloc), FfiConverterTypeResponseSink.lower(sink, nativeModule().rustbuffer_alloc));
2840
+ },
2841
+ /*pollFunc:*/ nativeModule().ffi_slim_rpc_rust_future_poll_void,
2842
+ /*cancelFunc:*/ nativeModule().ffi_slim_rpc_rust_future_cancel_void,
2843
+ /*completeFunc:*/ nativeModule().ffi_slim_rpc_rust_future_complete_void,
2844
+ /*freeFunc:*/ nativeModule().ffi_slim_rpc_rust_future_free_void,
2845
+ /*liftFunc:*/ (_v) => { },
2846
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
2847
+ /*asyncOpts:*/ asyncOpts_,
2848
+ /*errorHandler:*/ FfiConverterTypeRpcError.lift.bind(FfiConverterTypeRpcError));
2849
+ }
2850
+ catch (__error) {
2851
+ if (uniffiIsDebug && __error instanceof Error) {
2852
+ __error.stack = __stack;
2853
+ }
2854
+ throw __error;
2855
+ }
2856
+ }
2857
+ uniffiDestroy() {
2858
+ const ptr = this[destructorGuardSymbol];
2859
+ if (ptr !== undefined) {
2860
+ const pointer = uniffiTypeUnaryStreamHandlerImplObjectFactory.pointer(this);
2861
+ uniffiTypeUnaryStreamHandlerImplObjectFactory.freePointer(pointer);
2862
+ uniffiTypeUnaryStreamHandlerImplObjectFactory.unbless(ptr);
2863
+ delete this[destructorGuardSymbol];
2864
+ }
2865
+ }
2866
+ static instanceOf(obj_) {
2867
+ return uniffiTypeUnaryStreamHandlerImplObjectFactory.isConcreteType(obj_);
2868
+ }
2869
+ }
2870
+ _m = uniffiTypeNameSymbol;
2871
+ const uniffiTypeUnaryStreamHandlerImplObjectFactory = (() => {
2872
+ /// <reference lib="es2021" />
2873
+ const registry = typeof FinalizationRegistry !== 'undefined' ? new FinalizationRegistry((heldValue) => {
2874
+ uniffiTypeUnaryStreamHandlerImplObjectFactory.freePointer(heldValue);
2875
+ }) : null;
2876
+ return {
2877
+ create(pointer) {
2878
+ const instance = Object.create(UnaryStreamHandlerImpl.prototype);
2879
+ instance[pointerLiteralSymbol] = pointer;
2880
+ instance[destructorGuardSymbol] = this.bless(pointer);
2881
+ instance[uniffiTypeNameSymbol] = "UnaryStreamHandlerImpl";
2882
+ return instance;
2883
+ },
2884
+ bless(p) {
2885
+ const ptr = {
2886
+ p, // make sure this object doesn't get optimized away.
2887
+ markDestroyed: () => undefined,
2888
+ };
2889
+ if (registry) {
2890
+ registry.register(ptr, p, ptr);
2891
+ }
2892
+ return ptr;
2893
+ },
2894
+ unbless(ptr_) {
2895
+ if (registry) {
2896
+ registry.unregister(ptr_);
2897
+ }
2898
+ },
2899
+ pointer(obj_) {
2900
+ if (obj_[destructorGuardSymbol] === undefined) {
2901
+ throw new UniffiInternalError.UnexpectedNullPointer();
2902
+ }
2903
+ return obj_[pointerLiteralSymbol];
2904
+ },
2905
+ clonePointer(obj_) {
2906
+ const pointer = this.pointer(obj_);
2907
+ return uniffiCaller.rustCall(
2908
+ /*caller:*/ (callStatus) => nativeModule().uniffi_slim_rpc_fn_clone_unarystreamhandler(pointer, callStatus),
2909
+ /*liftString:*/ FfiConverterString.lift);
2910
+ },
2911
+ freePointer(pointer) {
2912
+ uniffiCaller.rustCall(
2913
+ /*caller:*/ (callStatus) => nativeModule().uniffi_slim_rpc_fn_free_unarystreamhandler(pointer, callStatus),
2914
+ /*liftString:*/ FfiConverterString.lift);
2915
+ },
2916
+ isConcreteType(obj_) {
2917
+ return obj_[destructorGuardSymbol] && obj_[uniffiTypeNameSymbol] === "UnaryStreamHandlerImpl";
2918
+ },
2919
+ };
2920
+ })();
2921
+ const FfiConverterTypeUnaryStreamHandler = new FfiConverterObjectWithCallbacks(uniffiTypeUnaryStreamHandlerImplObjectFactory);
2922
+ // Add a vtable for the callbacks that go in UnaryStreamHandler.
2923
+ // Put the implementation in a struct so we don't pollute the top-level namespace
2924
+ const uniffiCallbackInterfaceUnaryStreamHandler = {
2925
+ // Create the VTable using a series of closures.
2926
+ // ts automatically converts these into C callback functions.
2927
+ vtable: {
2928
+ handle: (uniffiHandle, request, context, sink, uniffiFutureCallback, uniffiCallbackData) => {
2929
+ const uniffiMakeCall = async (signal) => {
2930
+ const jsCallback = FfiConverterTypeUnaryStreamHandler.lift(uniffiHandle);
2931
+ return await jsCallback.handle(FfiConverterArrayBuffer.lift(request), FfiConverterTypeContext.lift(context), FfiConverterTypeResponseSink.lift(sink), { signal });
2932
+ };
2933
+ const uniffiHandleSuccess = (returnValue) => {
2934
+ uniffiFutureCallback.call(uniffiFutureCallback, uniffiCallbackData,
2935
+ /* UniffiForeignFutureResultVoid */ {
2936
+ call_status: uniffiCaller.createCallStatus()
2937
+ });
2938
+ };
2939
+ const uniffiHandleError = (code, errorBuf) => {
2940
+ uniffiFutureCallback.call(uniffiFutureCallback, uniffiCallbackData,
2941
+ /* UniffiForeignFutureResultVoid */ {
2942
+ // TODO create callstatus with error.
2943
+ call_status: uniffiCaller.createErrorStatus(code, errorBuf),
2944
+ });
2945
+ };
2946
+ const uniffiForeignFuture = uniffiTraitInterfaceCallAsyncWithError(
2947
+ /*makeCall:*/ uniffiMakeCall,
2948
+ /*handleSuccess:*/ uniffiHandleSuccess,
2949
+ /*handleError:*/ uniffiHandleError,
2950
+ /*isErrorType:*/ RpcError.instanceOf,
2951
+ /*lowerError:*/ FfiConverterTypeRpcError.lower.bind(FfiConverterTypeRpcError),
2952
+ /*lowerString:*/ FfiConverterString.lower.bind(FfiConverterString),
2953
+ /*alloc:*/ nativeModule().rustbuffer_alloc);
2954
+ return uniffiForeignFuture;
2955
+ },
2956
+ uniffi_free: (uniffiHandle) => {
2957
+ // this will throw a stale handle error if the handle isn't found.
2958
+ FfiConverterTypeUnaryStreamHandler.drop(uniffiHandle);
2959
+ },
2960
+ uniffi_clone: (uniffiHandle) => {
2961
+ return FfiConverterTypeUnaryStreamHandler.clone(uniffiHandle);
2962
+ }
2963
+ },
2964
+ register: () => {
2965
+ nativeModule().uniffi_slim_rpc_fn_init_callback_vtable_unarystreamhandler(uniffiCallbackInterfaceUnaryStreamHandler.vtable);
2966
+ },
2967
+ };
2968
+ /**
2969
+ * Unary-to-Unary RPC handler trait
2970
+ *
2971
+ * Implement this trait to handle unary-to-unary RPC calls.
2972
+ * The handler receives a single request and returns a single response.
2973
+ */
2974
+ export class UnaryUnaryHandlerImpl extends UniffiAbstractObject {
2975
+ // No primary constructor declared for this class.
2976
+ constructor(pointer) {
2977
+ super();
2978
+ this[_o] = "UnaryUnaryHandlerImpl";
2979
+ this[pointerLiteralSymbol] = pointer;
2980
+ this[destructorGuardSymbol] = uniffiTypeUnaryUnaryHandlerImplObjectFactory.bless(pointer);
2981
+ }
2982
+ /**
2983
+ * Handle a unary-to-unary RPC call
2984
+ *
2985
+ * # Arguments
2986
+ * * `request` - The request message bytes
2987
+ * * `context` - RPC context with metadata and session information
2988
+ *
2989
+ * # Returns
2990
+ * The response message bytes or an error
2991
+ */
2992
+ async handle(request, context, asyncOpts_) {
2993
+ const __stack = uniffiIsDebug ? new Error().stack : undefined;
2994
+ try {
2995
+ return await uniffiRustCallAsync(
2996
+ /*rustCaller:*/ uniffiCaller,
2997
+ /*rustFutureFunc:*/ () => {
2998
+ return nativeModule().uniffi_slim_rpc_fn_method_unaryunaryhandler_handle(uniffiTypeUnaryUnaryHandlerImplObjectFactory.clonePointer(this), FfiConverterArrayBuffer.lower(request, nativeModule().rustbuffer_alloc), FfiConverterTypeContext.lower(context, nativeModule().rustbuffer_alloc));
2999
+ },
3000
+ /*pollFunc:*/ nativeModule().ffi_slim_rpc_rust_future_poll_rust_buffer,
3001
+ /*cancelFunc:*/ nativeModule().ffi_slim_rpc_rust_future_cancel_rust_buffer,
3002
+ /*completeFunc:*/ nativeModule().ffi_slim_rpc_rust_future_complete_rust_buffer,
3003
+ /*freeFunc:*/ nativeModule().ffi_slim_rpc_rust_future_free_rust_buffer,
3004
+ // Async returns always go through the JS-side converter: the
3005
+ // FFI symbol returns the future handle (u64), and the user-level
3006
+ // RustBuffer comes back via the shared `rust_future_complete_*`
3007
+ // export. The bytes the runtime hands back must be deserialized
3008
+ // here using the per-callable return-type converter.
3009
+ /*liftFunc:*/ FfiConverterArrayBuffer.lift.bind(FfiConverterArrayBuffer),
3010
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
3011
+ /*asyncOpts:*/ asyncOpts_,
3012
+ /*errorHandler:*/ FfiConverterTypeRpcError.lift.bind(FfiConverterTypeRpcError));
3013
+ }
3014
+ catch (__error) {
3015
+ if (uniffiIsDebug && __error instanceof Error) {
3016
+ __error.stack = __stack;
3017
+ }
3018
+ throw __error;
3019
+ }
3020
+ }
3021
+ uniffiDestroy() {
3022
+ const ptr = this[destructorGuardSymbol];
3023
+ if (ptr !== undefined) {
3024
+ const pointer = uniffiTypeUnaryUnaryHandlerImplObjectFactory.pointer(this);
3025
+ uniffiTypeUnaryUnaryHandlerImplObjectFactory.freePointer(pointer);
3026
+ uniffiTypeUnaryUnaryHandlerImplObjectFactory.unbless(ptr);
3027
+ delete this[destructorGuardSymbol];
3028
+ }
3029
+ }
3030
+ static instanceOf(obj_) {
3031
+ return uniffiTypeUnaryUnaryHandlerImplObjectFactory.isConcreteType(obj_);
3032
+ }
3033
+ }
3034
+ _o = uniffiTypeNameSymbol;
3035
+ const uniffiTypeUnaryUnaryHandlerImplObjectFactory = (() => {
3036
+ /// <reference lib="es2021" />
3037
+ const registry = typeof FinalizationRegistry !== 'undefined' ? new FinalizationRegistry((heldValue) => {
3038
+ uniffiTypeUnaryUnaryHandlerImplObjectFactory.freePointer(heldValue);
3039
+ }) : null;
3040
+ return {
3041
+ create(pointer) {
3042
+ const instance = Object.create(UnaryUnaryHandlerImpl.prototype);
3043
+ instance[pointerLiteralSymbol] = pointer;
3044
+ instance[destructorGuardSymbol] = this.bless(pointer);
3045
+ instance[uniffiTypeNameSymbol] = "UnaryUnaryHandlerImpl";
3046
+ return instance;
3047
+ },
3048
+ bless(p) {
3049
+ const ptr = {
3050
+ p, // make sure this object doesn't get optimized away.
3051
+ markDestroyed: () => undefined,
3052
+ };
3053
+ if (registry) {
3054
+ registry.register(ptr, p, ptr);
3055
+ }
3056
+ return ptr;
3057
+ },
3058
+ unbless(ptr_) {
3059
+ if (registry) {
3060
+ registry.unregister(ptr_);
3061
+ }
3062
+ },
3063
+ pointer(obj_) {
3064
+ if (obj_[destructorGuardSymbol] === undefined) {
3065
+ throw new UniffiInternalError.UnexpectedNullPointer();
3066
+ }
3067
+ return obj_[pointerLiteralSymbol];
3068
+ },
3069
+ clonePointer(obj_) {
3070
+ const pointer = this.pointer(obj_);
3071
+ return uniffiCaller.rustCall(
3072
+ /*caller:*/ (callStatus) => nativeModule().uniffi_slim_rpc_fn_clone_unaryunaryhandler(pointer, callStatus),
3073
+ /*liftString:*/ FfiConverterString.lift);
3074
+ },
3075
+ freePointer(pointer) {
3076
+ uniffiCaller.rustCall(
3077
+ /*caller:*/ (callStatus) => nativeModule().uniffi_slim_rpc_fn_free_unaryunaryhandler(pointer, callStatus),
3078
+ /*liftString:*/ FfiConverterString.lift);
3079
+ },
3080
+ isConcreteType(obj_) {
3081
+ return obj_[destructorGuardSymbol] && obj_[uniffiTypeNameSymbol] === "UnaryUnaryHandlerImpl";
3082
+ },
3083
+ };
3084
+ })();
3085
+ const FfiConverterTypeUnaryUnaryHandler = new FfiConverterObjectWithCallbacks(uniffiTypeUnaryUnaryHandlerImplObjectFactory);
3086
+ // Add a vtable for the callbacks that go in UnaryUnaryHandler.
3087
+ // Put the implementation in a struct so we don't pollute the top-level namespace
3088
+ const uniffiCallbackInterfaceUnaryUnaryHandler = {
3089
+ // Create the VTable using a series of closures.
3090
+ // ts automatically converts these into C callback functions.
3091
+ vtable: {
3092
+ handle: (uniffiHandle, request, context, uniffiFutureCallback, uniffiCallbackData) => {
3093
+ const uniffiMakeCall = async (signal) => {
3094
+ const jsCallback = FfiConverterTypeUnaryUnaryHandler.lift(uniffiHandle);
3095
+ return await jsCallback.handle(FfiConverterArrayBuffer.lift(request), FfiConverterTypeContext.lift(context), { signal });
3096
+ };
3097
+ const uniffiHandleSuccess = (returnValue) => {
3098
+ uniffiFutureCallback.call(uniffiFutureCallback, uniffiCallbackData,
3099
+ /* UniffiForeignFutureResultRustBuffer */ {
3100
+ return_value: FfiConverterArrayBuffer.lower(returnValue, nativeModule().rustbuffer_alloc),
3101
+ call_status: uniffiCaller.createCallStatus()
3102
+ });
3103
+ };
3104
+ const uniffiHandleError = (code, errorBuf) => {
3105
+ uniffiFutureCallback.call(uniffiFutureCallback, uniffiCallbackData,
3106
+ /* UniffiForeignFutureResultRustBuffer */ {
3107
+ return_value: /*empty*/ new Uint8Array(0),
3108
+ // TODO create callstatus with error.
3109
+ call_status: uniffiCaller.createErrorStatus(code, errorBuf),
3110
+ });
3111
+ };
3112
+ const uniffiForeignFuture = uniffiTraitInterfaceCallAsyncWithError(
3113
+ /*makeCall:*/ uniffiMakeCall,
3114
+ /*handleSuccess:*/ uniffiHandleSuccess,
3115
+ /*handleError:*/ uniffiHandleError,
3116
+ /*isErrorType:*/ RpcError.instanceOf,
3117
+ /*lowerError:*/ FfiConverterTypeRpcError.lower.bind(FfiConverterTypeRpcError),
3118
+ /*lowerString:*/ FfiConverterString.lower.bind(FfiConverterString),
3119
+ /*alloc:*/ nativeModule().rustbuffer_alloc);
3120
+ return uniffiForeignFuture;
3121
+ },
3122
+ uniffi_free: (uniffiHandle) => {
3123
+ // this will throw a stale handle error if the handle isn't found.
3124
+ FfiConverterTypeUnaryUnaryHandler.drop(uniffiHandle);
3125
+ },
3126
+ uniffi_clone: (uniffiHandle) => {
3127
+ return FfiConverterTypeUnaryUnaryHandler.clone(uniffiHandle);
3128
+ }
3129
+ },
3130
+ register: () => {
3131
+ nativeModule().uniffi_slim_rpc_fn_init_callback_vtable_unaryunaryhandler(uniffiCallbackInterfaceUnaryUnaryHandler.vtable);
3132
+ },
3133
+ };
3134
+ /**
3135
+ * RPC Server
3136
+ *
3137
+ * Handles incoming RPC requests by creating sessions and dispatching
3138
+ * to registered service handlers.
3139
+ *
3140
+ * # Example
3141
+ *
3142
+ * ```ignore
3143
+ * # use slim_bindings::{Server, Context, RpcError, Decoder, Encoder, App, Name};
3144
+ * # use std::sync::Arc;
3145
+ * # fn main() -> Result<(), Box<dyn std::error::Error>> {
3146
+ * # use slim_bindings::{IdentityProviderConfig, IdentityVerifierConfig};
3147
+ * # let app_name = Arc::new(Name::new("test".to_string(), "app".to_string(), "v1".to_string()));
3148
+ * # let provider = IdentityProviderConfig::SharedSecret { id: "test".to_string(), data: "secret".to_string() };
3149
+ * # let verifier = IdentityVerifierConfig::SharedSecret { id: "test".to_string(), data: "secret".to_string() };
3150
+ * # let app = App::new(app_name, provider, verifier)?;
3151
+ * # let core_app = app.inner();
3152
+ * # let notification_rx = app.notification_receiver();
3153
+ * # #[derive(Default)]
3154
+ * # struct Request {}
3155
+ * # impl Decoder for Request {
3156
+ * # fn decode(_buf: impl Into<Vec<u8>>) -> Result<Self, RpcError> { Ok(Request::default()) }
3157
+ * # }
3158
+ * # #[derive(Default)]
3159
+ * # struct Response {}
3160
+ * # impl Encoder for Response {
3161
+ * # fn encode(self) -> Result<Vec<u8>, RpcError> { Ok(vec![]) }
3162
+ * # }
3163
+ * let base_name = Name::new("org".to_string(), "namespace".to_string(), "service".to_string());
3164
+ * let server = Server::new_with_shared_rx_and_connection(core_app, base_name.as_slim_name(), None, notification_rx, None);
3165
+ *
3166
+ * // Register handlers
3167
+ * server.register_unary_unary_internal(
3168
+ * "MyService",
3169
+ * "MyMethod",
3170
+ * |request: Request, _ctx: Context| async move {
3171
+ * Ok(Response::default())
3172
+ * }
3173
+ * );
3174
+ * # Ok(())
3175
+ * # }
3176
+ * ```
3177
+ */
3178
+ export class Server extends UniffiAbstractObject {
3179
+ /**
3180
+ * Create a new RPC server
3181
+ *
3182
+ * This is the primary constructor for creating an RPC server instance
3183
+ * that can handle incoming RPC requests over SLIM.
3184
+ *
3185
+ * # Arguments
3186
+ * * `app` - The SLIM application instance that provides the underlying
3187
+ * network transport and session management
3188
+ * * `base_name` - The base name for this service (e.g., org.namespace.service).
3189
+ * This name is used to construct subscription names for RPC methods.
3190
+ *
3191
+ * # Returns
3192
+ * A new RPC server instance wrapped in an Arc for shared ownership
3193
+ */
3194
+ constructor(app, baseName) {
3195
+ super();
3196
+ this[_p] = "Server";
3197
+ const pointer = uniffiCaller.rustCall(
3198
+ /*caller:*/ (callStatus) => {
3199
+ return nativeModule().uniffi_slim_rpc_fn_constructor_server_new(FfiConverterTypeApp.lower(app, nativeModule().rustbuffer_alloc), FfiConverterTypeName.lower(baseName, nativeModule().rustbuffer_alloc), callStatus);
3200
+ },
3201
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString));
3202
+ this[pointerLiteralSymbol] = pointer;
3203
+ this[destructorGuardSymbol] = uniffiTypeServerObjectFactory.bless(pointer);
3204
+ }
3205
+ /**
3206
+ * Create a new RPC server with optional connection ID
3207
+ *
3208
+ * The connection ID is used to set up routing before serving RPC requests,
3209
+ * enabling multi-hop RPC calls through specific connections.
3210
+ *
3211
+ * # Arguments
3212
+ * * `app` - The SLIM application instance that provides the underlying
3213
+ * network transport and session management
3214
+ * * `base_name` - The base name for this service (e.g., org.namespace.service).
3215
+ * This name is used to construct subscription names for RPC methods.
3216
+ * * `connection_id` - Optional connection ID for routing setup
3217
+ *
3218
+ * # Returns
3219
+ * A new RPC server instance wrapped in an Arc for shared ownership
3220
+ */
3221
+ static newWithConnection(app, baseName, connectionId) {
3222
+ return FfiConverterTypeServer.lift(uniffiCaller.rustCall(
3223
+ /*caller:*/ (callStatus) => {
3224
+ return nativeModule().uniffi_slim_rpc_fn_constructor_server_new_with_connection(FfiConverterTypeApp.lower(app, nativeModule().rustbuffer_alloc), FfiConverterTypeName.lower(baseName, nativeModule().rustbuffer_alloc), FfiConverterOptionalUInt64.lower(connectionId, nativeModule().rustbuffer_alloc), callStatus);
3225
+ },
3226
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString)));
3227
+ }
3228
+ registerStreamStream(serviceName, methodName, handler) {
3229
+ uniffiCaller.rustCall(
3230
+ /*caller:*/ (callStatus) => {
3231
+ nativeModule().uniffi_slim_rpc_fn_method_server_register_stream_stream(uniffiTypeServerObjectFactory.clonePointer(this), FfiConverterString.lower(serviceName, nativeModule().rustbuffer_alloc), FfiConverterString.lower(methodName, nativeModule().rustbuffer_alloc), FfiConverterTypeStreamStreamHandler.lower(handler, nativeModule().rustbuffer_alloc), callStatus);
3232
+ },
3233
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString));
3234
+ }
3235
+ registerStreamUnary(serviceName, methodName, handler) {
3236
+ uniffiCaller.rustCall(
3237
+ /*caller:*/ (callStatus) => {
3238
+ nativeModule().uniffi_slim_rpc_fn_method_server_register_stream_unary(uniffiTypeServerObjectFactory.clonePointer(this), FfiConverterString.lower(serviceName, nativeModule().rustbuffer_alloc), FfiConverterString.lower(methodName, nativeModule().rustbuffer_alloc), FfiConverterTypeStreamUnaryHandler.lower(handler, nativeModule().rustbuffer_alloc), callStatus);
3239
+ },
3240
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString));
3241
+ }
3242
+ registerUnaryStream(serviceName, methodName, handler) {
3243
+ uniffiCaller.rustCall(
3244
+ /*caller:*/ (callStatus) => {
3245
+ nativeModule().uniffi_slim_rpc_fn_method_server_register_unary_stream(uniffiTypeServerObjectFactory.clonePointer(this), FfiConverterString.lower(serviceName, nativeModule().rustbuffer_alloc), FfiConverterString.lower(methodName, nativeModule().rustbuffer_alloc), FfiConverterTypeUnaryStreamHandler.lower(handler, nativeModule().rustbuffer_alloc), callStatus);
3246
+ },
3247
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString));
3248
+ }
3249
+ registerUnaryUnary(serviceName, methodName, handler) {
3250
+ uniffiCaller.rustCall(
3251
+ /*caller:*/ (callStatus) => {
3252
+ nativeModule().uniffi_slim_rpc_fn_method_server_register_unary_unary(uniffiTypeServerObjectFactory.clonePointer(this), FfiConverterString.lower(serviceName, nativeModule().rustbuffer_alloc), FfiConverterString.lower(methodName, nativeModule().rustbuffer_alloc), FfiConverterTypeUnaryUnaryHandler.lower(handler, nativeModule().rustbuffer_alloc), callStatus);
3253
+ },
3254
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString));
3255
+ }
3256
+ /**
3257
+ * Async FFI wrapper for [`Server::serve`].
3258
+ */
3259
+ async serveAsync(asyncOpts_) {
3260
+ const __stack = uniffiIsDebug ? new Error().stack : undefined;
3261
+ try {
3262
+ return await uniffiRustCallAsync(
3263
+ /*rustCaller:*/ uniffiCaller,
3264
+ /*rustFutureFunc:*/ () => {
3265
+ return nativeModule().uniffi_slim_rpc_fn_method_server_serve_async(uniffiTypeServerObjectFactory.clonePointer(this));
3266
+ },
3267
+ /*pollFunc:*/ nativeModule().ffi_slim_rpc_rust_future_poll_void,
3268
+ /*cancelFunc:*/ nativeModule().ffi_slim_rpc_rust_future_cancel_void,
3269
+ /*completeFunc:*/ nativeModule().ffi_slim_rpc_rust_future_complete_void,
3270
+ /*freeFunc:*/ nativeModule().ffi_slim_rpc_rust_future_free_void,
3271
+ /*liftFunc:*/ (_v) => { },
3272
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
3273
+ /*asyncOpts:*/ asyncOpts_,
3274
+ /*errorHandler:*/ FfiConverterTypeRpcError.lift.bind(FfiConverterTypeRpcError));
3275
+ }
3276
+ catch (__error) {
3277
+ if (uniffiIsDebug && __error instanceof Error) {
3278
+ __error.stack = __stack;
3279
+ }
3280
+ throw __error;
3281
+ }
3282
+ }
3283
+ /**
3284
+ * Blocking FFI wrapper for [`Server::serve`].
3285
+ */
3286
+ serveBlocking() {
3287
+ uniffiCaller.rustCallWithError(
3288
+ /*liftError:*/ FfiConverterTypeRpcError.lift.bind(FfiConverterTypeRpcError),
3289
+ /*caller:*/ (callStatus) => {
3290
+ nativeModule().uniffi_slim_rpc_fn_method_server_serve_blocking(uniffiTypeServerObjectFactory.clonePointer(this), callStatus);
3291
+ },
3292
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString));
3293
+ }
3294
+ /**
3295
+ * Async FFI wrapper for [`Server::shutdown`].
3296
+ */
3297
+ async shutdownAsync(asyncOpts_) {
3298
+ const __stack = uniffiIsDebug ? new Error().stack : undefined;
3299
+ try {
3300
+ return await uniffiRustCallAsync(
3301
+ /*rustCaller:*/ uniffiCaller,
3302
+ /*rustFutureFunc:*/ () => {
3303
+ return nativeModule().uniffi_slim_rpc_fn_method_server_shutdown_async(uniffiTypeServerObjectFactory.clonePointer(this));
3304
+ },
3305
+ /*pollFunc:*/ nativeModule().ffi_slim_rpc_rust_future_poll_void,
3306
+ /*cancelFunc:*/ nativeModule().ffi_slim_rpc_rust_future_cancel_void,
3307
+ /*completeFunc:*/ nativeModule().ffi_slim_rpc_rust_future_complete_void,
3308
+ /*freeFunc:*/ nativeModule().ffi_slim_rpc_rust_future_free_void,
3309
+ /*liftFunc:*/ (_v) => { },
3310
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
3311
+ /*asyncOpts:*/ asyncOpts_);
3312
+ }
3313
+ catch (__error) {
3314
+ if (uniffiIsDebug && __error instanceof Error) {
3315
+ __error.stack = __stack;
3316
+ }
3317
+ throw __error;
3318
+ }
3319
+ }
3320
+ /**
3321
+ * Blocking FFI wrapper for [`Server::shutdown`].
3322
+ */
3323
+ shutdownBlocking() {
3324
+ uniffiCaller.rustCall(
3325
+ /*caller:*/ (callStatus) => {
3326
+ nativeModule().uniffi_slim_rpc_fn_method_server_shutdown_blocking(uniffiTypeServerObjectFactory.clonePointer(this), callStatus);
3327
+ },
3328
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString));
3329
+ }
3330
+ uniffiDestroy() {
3331
+ const ptr = this[destructorGuardSymbol];
3332
+ if (ptr !== undefined) {
3333
+ const pointer = uniffiTypeServerObjectFactory.pointer(this);
3334
+ uniffiTypeServerObjectFactory.freePointer(pointer);
3335
+ uniffiTypeServerObjectFactory.unbless(ptr);
3336
+ delete this[destructorGuardSymbol];
3337
+ }
3338
+ }
3339
+ static instanceOf(obj_) {
3340
+ return uniffiTypeServerObjectFactory.isConcreteType(obj_);
3341
+ }
3342
+ }
3343
+ _p = uniffiTypeNameSymbol;
3344
+ const uniffiTypeServerObjectFactory = (() => {
3345
+ /// <reference lib="es2021" />
3346
+ const registry = typeof FinalizationRegistry !== 'undefined' ? new FinalizationRegistry((heldValue) => {
3347
+ uniffiTypeServerObjectFactory.freePointer(heldValue);
3348
+ }) : null;
3349
+ return {
3350
+ create(pointer) {
3351
+ const instance = Object.create(Server.prototype);
3352
+ instance[pointerLiteralSymbol] = pointer;
3353
+ instance[destructorGuardSymbol] = this.bless(pointer);
3354
+ instance[uniffiTypeNameSymbol] = "Server";
3355
+ return instance;
3356
+ },
3357
+ bless(p) {
3358
+ const ptr = {
3359
+ p, // make sure this object doesn't get optimized away.
3360
+ markDestroyed: () => undefined,
3361
+ };
3362
+ if (registry) {
3363
+ registry.register(ptr, p, ptr);
3364
+ }
3365
+ return ptr;
3366
+ },
3367
+ unbless(ptr_) {
3368
+ if (registry) {
3369
+ registry.unregister(ptr_);
3370
+ }
3371
+ },
3372
+ pointer(obj_) {
3373
+ if (obj_[destructorGuardSymbol] === undefined) {
3374
+ throw new UniffiInternalError.UnexpectedNullPointer();
3375
+ }
3376
+ return obj_[pointerLiteralSymbol];
3377
+ },
3378
+ clonePointer(obj_) {
3379
+ const pointer = this.pointer(obj_);
3380
+ return uniffiCaller.rustCall(
3381
+ /*caller:*/ (callStatus) => nativeModule().uniffi_slim_rpc_fn_clone_server(pointer, callStatus),
3382
+ /*liftString:*/ FfiConverterString.lift);
3383
+ },
3384
+ freePointer(pointer) {
3385
+ uniffiCaller.rustCall(
3386
+ /*caller:*/ (callStatus) => nativeModule().uniffi_slim_rpc_fn_free_server(pointer, callStatus),
3387
+ /*liftString:*/ FfiConverterString.lift);
3388
+ },
3389
+ isConcreteType(obj_) {
3390
+ return obj_[destructorGuardSymbol] && obj_[uniffiTypeNameSymbol] === "Server";
3391
+ },
3392
+ };
3393
+ })();
3394
+ const FfiConverterTypeServer = new FfiConverterObject(uniffiTypeServerObjectFactory);
3395
+ // FfiConverter for ArrayBuffer | undefined
3396
+ const FfiConverterOptionalBytes = new FfiConverterOptional(FfiConverterArrayBuffer);
3397
+ // FfiConverter for Array<string>
3398
+ const FfiConverterSequenceString = new FfiConverterArray(FfiConverterString);
3399
+ // FfiConverter for number | undefined
3400
+ const FfiConverterOptionalDuration = new FfiConverterOptional(FfiConverterDuration);
3401
+ // FfiConverter for Map<string, string>
3402
+ const FfiConverterMapStringString = new FfiConverterMap(FfiConverterString, FfiConverterString);
3403
+ // FfiConverter for Map<string, string> | undefined
3404
+ const FfiConverterOptionalMapStringString = new FfiConverterOptional(FfiConverterMapStringString);
3405
+ // FfiConverter for Array<NameLike>
3406
+ const FfiConverterSequenceTypeName = new FfiConverterArray(FfiConverterTypeName);
3407
+ // FfiConverter for bigint | undefined
3408
+ const FfiConverterOptionalUInt64 = new FfiConverterOptional(FfiConverterUInt64);
3409
+ /**
3410
+ * This should be called before anything else.
3411
+ *
3412
+ * It is likely that this is being done for you by the library's `index.ts`.
3413
+ *
3414
+ * It checks versions of uniffi between when the Rust scaffolding was generated
3415
+ * and when the bindings were generated.
3416
+ *
3417
+ * It also initializes the machinery to enable Rust to talk back to Javascript.
3418
+ */
3419
+ function uniffiEnsureInitialized() {
3420
+ // Get the bindings contract version from our ComponentInterface
3421
+ const bindingsContractVersion = 30;
3422
+ // Get the scaffolding contract version by calling the into the dylib
3423
+ const scaffoldingContractVersion = nativeModule().ffi_slim_rpc_uniffi_contract_version();
3424
+ if (bindingsContractVersion !== scaffoldingContractVersion) {
3425
+ throw new UniffiInternalError.ContractVersionMismatch(scaffoldingContractVersion, bindingsContractVersion);
3426
+ }
3427
+ if (nativeModule().uniffi_slim_rpc_checksum_method_bidistreamhandler_close_send() !== 8554) {
3428
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_slim_rpc_checksum_method_bidistreamhandler_close_send");
3429
+ }
3430
+ if (nativeModule().uniffi_slim_rpc_checksum_method_bidistreamhandler_close_send_async() !== 61385) {
3431
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_slim_rpc_checksum_method_bidistreamhandler_close_send_async");
3432
+ }
3433
+ if (nativeModule().uniffi_slim_rpc_checksum_method_bidistreamhandler_recv() !== 22600) {
3434
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_slim_rpc_checksum_method_bidistreamhandler_recv");
3435
+ }
3436
+ if (nativeModule().uniffi_slim_rpc_checksum_method_bidistreamhandler_recv_async() !== 32615) {
3437
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_slim_rpc_checksum_method_bidistreamhandler_recv_async");
3438
+ }
3439
+ if (nativeModule().uniffi_slim_rpc_checksum_method_bidistreamhandler_send() !== 6430) {
3440
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_slim_rpc_checksum_method_bidistreamhandler_send");
3441
+ }
3442
+ if (nativeModule().uniffi_slim_rpc_checksum_method_bidistreamhandler_send_async() !== 15973) {
3443
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_slim_rpc_checksum_method_bidistreamhandler_send_async");
3444
+ }
3445
+ if (nativeModule().uniffi_slim_rpc_checksum_constructor_channel_new() !== 61597) {
3446
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_slim_rpc_checksum_constructor_channel_new");
3447
+ }
3448
+ if (nativeModule().uniffi_slim_rpc_checksum_constructor_channel_new_group() !== 40792) {
3449
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_slim_rpc_checksum_constructor_channel_new_group");
3450
+ }
3451
+ if (nativeModule().uniffi_slim_rpc_checksum_constructor_channel_new_group_with_connection() !== 4099) {
3452
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_slim_rpc_checksum_constructor_channel_new_group_with_connection");
3453
+ }
3454
+ if (nativeModule().uniffi_slim_rpc_checksum_constructor_channel_new_with_connection() !== 29890) {
3455
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_slim_rpc_checksum_constructor_channel_new_with_connection");
3456
+ }
3457
+ if (nativeModule().uniffi_slim_rpc_checksum_method_channel_call_multicast_stream_stream() !== 20862) {
3458
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_slim_rpc_checksum_method_channel_call_multicast_stream_stream");
3459
+ }
3460
+ if (nativeModule().uniffi_slim_rpc_checksum_method_channel_call_multicast_stream_unary() !== 3931) {
3461
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_slim_rpc_checksum_method_channel_call_multicast_stream_unary");
3462
+ }
3463
+ if (nativeModule().uniffi_slim_rpc_checksum_method_channel_call_multicast_unary() !== 45399) {
3464
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_slim_rpc_checksum_method_channel_call_multicast_unary");
3465
+ }
3466
+ if (nativeModule().uniffi_slim_rpc_checksum_method_channel_call_multicast_unary_async() !== 41182) {
3467
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_slim_rpc_checksum_method_channel_call_multicast_unary_async");
3468
+ }
3469
+ if (nativeModule().uniffi_slim_rpc_checksum_method_channel_call_multicast_unary_stream() !== 1791) {
3470
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_slim_rpc_checksum_method_channel_call_multicast_unary_stream");
3471
+ }
3472
+ if (nativeModule().uniffi_slim_rpc_checksum_method_channel_call_multicast_unary_stream_async() !== 51748) {
3473
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_slim_rpc_checksum_method_channel_call_multicast_unary_stream_async");
3474
+ }
3475
+ if (nativeModule().uniffi_slim_rpc_checksum_method_channel_call_stream_stream() !== 17894) {
3476
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_slim_rpc_checksum_method_channel_call_stream_stream");
3477
+ }
3478
+ if (nativeModule().uniffi_slim_rpc_checksum_method_channel_call_stream_unary() !== 53775) {
3479
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_slim_rpc_checksum_method_channel_call_stream_unary");
3480
+ }
3481
+ if (nativeModule().uniffi_slim_rpc_checksum_method_channel_call_unary() !== 38109) {
3482
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_slim_rpc_checksum_method_channel_call_unary");
3483
+ }
3484
+ if (nativeModule().uniffi_slim_rpc_checksum_method_channel_call_unary_async() !== 4778) {
3485
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_slim_rpc_checksum_method_channel_call_unary_async");
3486
+ }
3487
+ if (nativeModule().uniffi_slim_rpc_checksum_method_channel_call_unary_stream() !== 57715) {
3488
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_slim_rpc_checksum_method_channel_call_unary_stream");
3489
+ }
3490
+ if (nativeModule().uniffi_slim_rpc_checksum_method_channel_call_unary_stream_async() !== 60204) {
3491
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_slim_rpc_checksum_method_channel_call_unary_stream_async");
3492
+ }
3493
+ if (nativeModule().uniffi_slim_rpc_checksum_method_channel_close_async() !== 50290) {
3494
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_slim_rpc_checksum_method_channel_close_async");
3495
+ }
3496
+ if (nativeModule().uniffi_slim_rpc_checksum_method_channel_close_blocking() !== 14890) {
3497
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_slim_rpc_checksum_method_channel_close_blocking");
3498
+ }
3499
+ if (nativeModule().uniffi_slim_rpc_checksum_method_context_deadline() !== 24900) {
3500
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_slim_rpc_checksum_method_context_deadline");
3501
+ }
3502
+ if (nativeModule().uniffi_slim_rpc_checksum_method_context_is_deadline_exceeded() !== 28770) {
3503
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_slim_rpc_checksum_method_context_is_deadline_exceeded");
3504
+ }
3505
+ if (nativeModule().uniffi_slim_rpc_checksum_method_context_metadata() !== 27768) {
3506
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_slim_rpc_checksum_method_context_metadata");
3507
+ }
3508
+ if (nativeModule().uniffi_slim_rpc_checksum_method_context_remaining_time() !== 37807) {
3509
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_slim_rpc_checksum_method_context_remaining_time");
3510
+ }
3511
+ if (nativeModule().uniffi_slim_rpc_checksum_method_context_session_id() !== 20837) {
3512
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_slim_rpc_checksum_method_context_session_id");
3513
+ }
3514
+ if (nativeModule().uniffi_slim_rpc_checksum_method_multicastbidistreamhandler_close_send() !== 43173) {
3515
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_slim_rpc_checksum_method_multicastbidistreamhandler_close_send");
3516
+ }
3517
+ if (nativeModule().uniffi_slim_rpc_checksum_method_multicastbidistreamhandler_close_send_async() !== 23110) {
3518
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_slim_rpc_checksum_method_multicastbidistreamhandler_close_send_async");
3519
+ }
3520
+ if (nativeModule().uniffi_slim_rpc_checksum_method_multicastbidistreamhandler_recv() !== 48140) {
3521
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_slim_rpc_checksum_method_multicastbidistreamhandler_recv");
3522
+ }
3523
+ if (nativeModule().uniffi_slim_rpc_checksum_method_multicastbidistreamhandler_recv_async() !== 30100) {
3524
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_slim_rpc_checksum_method_multicastbidistreamhandler_recv_async");
3525
+ }
3526
+ if (nativeModule().uniffi_slim_rpc_checksum_method_multicastbidistreamhandler_send() !== 9203) {
3527
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_slim_rpc_checksum_method_multicastbidistreamhandler_send");
3528
+ }
3529
+ if (nativeModule().uniffi_slim_rpc_checksum_method_multicastbidistreamhandler_send_async() !== 44011) {
3530
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_slim_rpc_checksum_method_multicastbidistreamhandler_send_async");
3531
+ }
3532
+ if (nativeModule().uniffi_slim_rpc_checksum_method_multicastresponsereader_next() !== 61701) {
3533
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_slim_rpc_checksum_method_multicastresponsereader_next");
3534
+ }
3535
+ if (nativeModule().uniffi_slim_rpc_checksum_method_multicastresponsereader_next_async() !== 39972) {
3536
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_slim_rpc_checksum_method_multicastresponsereader_next_async");
3537
+ }
3538
+ if (nativeModule().uniffi_slim_rpc_checksum_method_requeststream_next() !== 20595) {
3539
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_slim_rpc_checksum_method_requeststream_next");
3540
+ }
3541
+ if (nativeModule().uniffi_slim_rpc_checksum_method_requeststream_next_async() !== 54349) {
3542
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_slim_rpc_checksum_method_requeststream_next_async");
3543
+ }
3544
+ if (nativeModule().uniffi_slim_rpc_checksum_method_requeststreamwriter_finalize_async() !== 32632) {
3545
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_slim_rpc_checksum_method_requeststreamwriter_finalize_async");
3546
+ }
3547
+ if (nativeModule().uniffi_slim_rpc_checksum_method_requeststreamwriter_finalize_stream() !== 54088) {
3548
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_slim_rpc_checksum_method_requeststreamwriter_finalize_stream");
3549
+ }
3550
+ if (nativeModule().uniffi_slim_rpc_checksum_method_requeststreamwriter_finalize_stream_async() !== 17032) {
3551
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_slim_rpc_checksum_method_requeststreamwriter_finalize_stream_async");
3552
+ }
3553
+ if (nativeModule().uniffi_slim_rpc_checksum_method_requeststreamwriter_send() !== 12390) {
3554
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_slim_rpc_checksum_method_requeststreamwriter_send");
3555
+ }
3556
+ if (nativeModule().uniffi_slim_rpc_checksum_method_requeststreamwriter_send_async() !== 8265) {
3557
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_slim_rpc_checksum_method_requeststreamwriter_send_async");
3558
+ }
3559
+ if (nativeModule().uniffi_slim_rpc_checksum_method_responsesink_close() !== 38345) {
3560
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_slim_rpc_checksum_method_responsesink_close");
3561
+ }
3562
+ if (nativeModule().uniffi_slim_rpc_checksum_method_responsesink_close_async() !== 40886) {
3563
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_slim_rpc_checksum_method_responsesink_close_async");
3564
+ }
3565
+ if (nativeModule().uniffi_slim_rpc_checksum_method_responsesink_is_closed() !== 38814) {
3566
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_slim_rpc_checksum_method_responsesink_is_closed");
3567
+ }
3568
+ if (nativeModule().uniffi_slim_rpc_checksum_method_responsesink_is_closed_async() !== 10047) {
3569
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_slim_rpc_checksum_method_responsesink_is_closed_async");
3570
+ }
3571
+ if (nativeModule().uniffi_slim_rpc_checksum_method_responsesink_send() !== 20957) {
3572
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_slim_rpc_checksum_method_responsesink_send");
3573
+ }
3574
+ if (nativeModule().uniffi_slim_rpc_checksum_method_responsesink_send_async() !== 42417) {
3575
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_slim_rpc_checksum_method_responsesink_send_async");
3576
+ }
3577
+ if (nativeModule().uniffi_slim_rpc_checksum_method_responsesink_send_error() !== 19981) {
3578
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_slim_rpc_checksum_method_responsesink_send_error");
3579
+ }
3580
+ if (nativeModule().uniffi_slim_rpc_checksum_method_responsesink_send_error_async() !== 13763) {
3581
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_slim_rpc_checksum_method_responsesink_send_error_async");
3582
+ }
3583
+ if (nativeModule().uniffi_slim_rpc_checksum_method_responsestreamreader_next() !== 36597) {
3584
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_slim_rpc_checksum_method_responsestreamreader_next");
3585
+ }
3586
+ if (nativeModule().uniffi_slim_rpc_checksum_method_responsestreamreader_next_async() !== 61931) {
3587
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_slim_rpc_checksum_method_responsestreamreader_next_async");
3588
+ }
3589
+ if (nativeModule().uniffi_slim_rpc_checksum_constructor_server_new() !== 34121) {
3590
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_slim_rpc_checksum_constructor_server_new");
3591
+ }
3592
+ if (nativeModule().uniffi_slim_rpc_checksum_constructor_server_new_with_connection() !== 20181) {
3593
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_slim_rpc_checksum_constructor_server_new_with_connection");
3594
+ }
3595
+ if (nativeModule().uniffi_slim_rpc_checksum_method_server_register_stream_stream() !== 8915) {
3596
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_slim_rpc_checksum_method_server_register_stream_stream");
3597
+ }
3598
+ if (nativeModule().uniffi_slim_rpc_checksum_method_server_register_stream_unary() !== 1327) {
3599
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_slim_rpc_checksum_method_server_register_stream_unary");
3600
+ }
3601
+ if (nativeModule().uniffi_slim_rpc_checksum_method_server_register_unary_stream() !== 36089) {
3602
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_slim_rpc_checksum_method_server_register_unary_stream");
3603
+ }
3604
+ if (nativeModule().uniffi_slim_rpc_checksum_method_server_register_unary_unary() !== 4683) {
3605
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_slim_rpc_checksum_method_server_register_unary_unary");
3606
+ }
3607
+ if (nativeModule().uniffi_slim_rpc_checksum_method_server_serve_async() !== 31185) {
3608
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_slim_rpc_checksum_method_server_serve_async");
3609
+ }
3610
+ if (nativeModule().uniffi_slim_rpc_checksum_method_server_serve_blocking() !== 43892) {
3611
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_slim_rpc_checksum_method_server_serve_blocking");
3612
+ }
3613
+ if (nativeModule().uniffi_slim_rpc_checksum_method_server_shutdown_async() !== 43873) {
3614
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_slim_rpc_checksum_method_server_shutdown_async");
3615
+ }
3616
+ if (nativeModule().uniffi_slim_rpc_checksum_method_server_shutdown_blocking() !== 33785) {
3617
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_slim_rpc_checksum_method_server_shutdown_blocking");
3618
+ }
3619
+ if (nativeModule().uniffi_slim_rpc_checksum_method_streamstreamhandler_handle() !== 2118) {
3620
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_slim_rpc_checksum_method_streamstreamhandler_handle");
3621
+ }
3622
+ if (nativeModule().uniffi_slim_rpc_checksum_method_streamunaryhandler_handle() !== 24345) {
3623
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_slim_rpc_checksum_method_streamunaryhandler_handle");
3624
+ }
3625
+ if (nativeModule().uniffi_slim_rpc_checksum_method_unarystreamhandler_handle() !== 50805) {
3626
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_slim_rpc_checksum_method_unarystreamhandler_handle");
3627
+ }
3628
+ if (nativeModule().uniffi_slim_rpc_checksum_method_unaryunaryhandler_handle() !== 28269) {
3629
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_slim_rpc_checksum_method_unaryunaryhandler_handle");
3630
+ }
3631
+ uniffiCallbackInterfaceStreamStreamHandler.register();
3632
+ uniffiCallbackInterfaceStreamUnaryHandler.register();
3633
+ uniffiCallbackInterfaceUnaryStreamHandler.register();
3634
+ uniffiCallbackInterfaceUnaryUnaryHandler.register();
3635
+ }
3636
+ export default Object.freeze({
3637
+ initialize: uniffiEnsureInitialized,
3638
+ converters: {
3639
+ FfiConverterTypeBidiStreamHandler,
3640
+ FfiConverterTypeChannel,
3641
+ FfiConverterTypeContext,
3642
+ FfiConverterTypeMulticastBidiStreamHandler,
3643
+ FfiConverterTypeMulticastResponseReader,
3644
+ FfiConverterTypeMulticastStreamMessage,
3645
+ FfiConverterTypeRequestStream,
3646
+ FfiConverterTypeRequestStreamWriter,
3647
+ FfiConverterTypeResponseSink,
3648
+ FfiConverterTypeResponseStreamReader,
3649
+ FfiConverterTypeRpcCode,
3650
+ FfiConverterTypeRpcError,
3651
+ FfiConverterTypeRpcMessageContext,
3652
+ FfiConverterTypeRpcMulticastItem,
3653
+ FfiConverterTypeServer,
3654
+ FfiConverterTypeStreamMessage,
3655
+ FfiConverterTypeStreamStreamHandler,
3656
+ FfiConverterTypeStreamUnaryHandler,
3657
+ FfiConverterTypeUnaryStreamHandler,
3658
+ FfiConverterTypeUnaryUnaryHandler,
3659
+ }
3660
+ });