@agntcy/slim-bindings-linux-arm64-gnu 2.0.0-alpha.3 → 2.0.0-alpha.5
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/index.d.ts +3 -0
- package/index.js +4 -0
- package/libslim_bindings.so +0 -0
- package/package.json +1 -1
- package/slim_bindings-ffi.d.ts +34 -211
- package/slim_bindings-ffi.js +304 -1085
- package/slim_bindings.d.ts +541 -2237
- package/slim_bindings.js +1015 -4100
- package/slim_rpc-ffi.d.ts +271 -0
- package/slim_rpc-ffi.js +1233 -0
- package/slim_rpc.d.ts +1931 -0
- package/slim_rpc.js +3660 -0
package/slim_rpc.d.ts
ADDED
|
@@ -0,0 +1,1931 @@
|
|
|
1
|
+
import { type AppLike, type NameLike } from "./slim_bindings";
|
|
2
|
+
import { type UniffiByteArray, type UniffiGcObject, type UniffiHandle, FfiConverterObject, FfiConverterObjectWithCallbacks, RustBuffer, UniffiAbstractObject, destructorGuardSymbol, pointerLiteralSymbol, uniffiTypeNameSymbol } from "@ubjs/core";
|
|
3
|
+
/**
|
|
4
|
+
* Per-message context for a multicast RPC response — identifies which group
|
|
5
|
+
* member sent the response.
|
|
6
|
+
*/
|
|
7
|
+
export type RpcMessageContext = {
|
|
8
|
+
/**
|
|
9
|
+
* The SLIM name of the group member that sent this response.
|
|
10
|
+
*/
|
|
11
|
+
source: NameLike;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Generated factory for {@link RpcMessageContext} record objects.
|
|
15
|
+
*/
|
|
16
|
+
export declare const RpcMessageContext: Readonly<{
|
|
17
|
+
create: (partial: Partial<RpcMessageContext> & Required<Omit<RpcMessageContext, "source">>) => RpcMessageContext;
|
|
18
|
+
new: (partial: Partial<RpcMessageContext> & Required<Omit<RpcMessageContext, "source">>) => RpcMessageContext;
|
|
19
|
+
defaults: () => Partial<RpcMessageContext>;
|
|
20
|
+
}>;
|
|
21
|
+
/**
|
|
22
|
+
* A single item in a multicast response stream, pairing the response payload
|
|
23
|
+
* with the identity of the member that produced it.
|
|
24
|
+
*/
|
|
25
|
+
export type RpcMulticastItem = {
|
|
26
|
+
/**
|
|
27
|
+
* Context identifying the source member.
|
|
28
|
+
*/
|
|
29
|
+
context: RpcMessageContext;
|
|
30
|
+
/**
|
|
31
|
+
* The encoded response payload (raw bytes).
|
|
32
|
+
*/
|
|
33
|
+
message: ArrayBuffer;
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* Generated factory for {@link RpcMulticastItem} record objects.
|
|
37
|
+
*/
|
|
38
|
+
export declare const RpcMulticastItem: Readonly<{
|
|
39
|
+
create: (partial: Partial<RpcMulticastItem> & Required<Omit<RpcMulticastItem, "message" | "context">>) => RpcMulticastItem;
|
|
40
|
+
new: (partial: Partial<RpcMulticastItem> & Required<Omit<RpcMulticastItem, "message" | "context">>) => RpcMulticastItem;
|
|
41
|
+
defaults: () => Partial<RpcMulticastItem>;
|
|
42
|
+
}>;
|
|
43
|
+
/**
|
|
44
|
+
* gRPC status codes
|
|
45
|
+
*/
|
|
46
|
+
export declare enum RpcCode {
|
|
47
|
+
/**
|
|
48
|
+
* Success
|
|
49
|
+
*/
|
|
50
|
+
Ok = 0,
|
|
51
|
+
/**
|
|
52
|
+
* The operation was cancelled
|
|
53
|
+
*/
|
|
54
|
+
Cancelled = 1,
|
|
55
|
+
/**
|
|
56
|
+
* Unknown error
|
|
57
|
+
*/
|
|
58
|
+
Unknown = 2,
|
|
59
|
+
/**
|
|
60
|
+
* Client specified an invalid argument
|
|
61
|
+
*/
|
|
62
|
+
InvalidArgument = 3,
|
|
63
|
+
/**
|
|
64
|
+
* Deadline exceeded before operation could complete
|
|
65
|
+
*/
|
|
66
|
+
DeadlineExceeded = 4,
|
|
67
|
+
/**
|
|
68
|
+
* Some requested entity was not found
|
|
69
|
+
*/
|
|
70
|
+
NotFound = 5,
|
|
71
|
+
/**
|
|
72
|
+
* Some entity that we attempted to create already exists
|
|
73
|
+
*/
|
|
74
|
+
AlreadyExists = 6,
|
|
75
|
+
/**
|
|
76
|
+
* The caller does not have permission to execute the specified operation
|
|
77
|
+
*/
|
|
78
|
+
PermissionDenied = 7,
|
|
79
|
+
/**
|
|
80
|
+
* Some resource has been exhausted
|
|
81
|
+
*/
|
|
82
|
+
ResourceExhausted = 8,
|
|
83
|
+
/**
|
|
84
|
+
* The system is not in a state required for the operation's execution
|
|
85
|
+
*/
|
|
86
|
+
FailedPrecondition = 9,
|
|
87
|
+
/**
|
|
88
|
+
* The operation was aborted
|
|
89
|
+
*/
|
|
90
|
+
Aborted = 10,
|
|
91
|
+
/**
|
|
92
|
+
* Operation was attempted past the valid range
|
|
93
|
+
*/
|
|
94
|
+
OutOfRange = 11,
|
|
95
|
+
/**
|
|
96
|
+
* Operation is not implemented or not supported
|
|
97
|
+
*/
|
|
98
|
+
Unimplemented = 12,
|
|
99
|
+
/**
|
|
100
|
+
* Internal errors
|
|
101
|
+
*/
|
|
102
|
+
Internal = 13,
|
|
103
|
+
/**
|
|
104
|
+
* The service is currently unavailable
|
|
105
|
+
*/
|
|
106
|
+
Unavailable = 14,
|
|
107
|
+
/**
|
|
108
|
+
* Unrecoverable data loss or corruption
|
|
109
|
+
*/
|
|
110
|
+
DataLoss = 15,
|
|
111
|
+
/**
|
|
112
|
+
* The request does not have valid authentication credentials
|
|
113
|
+
*/
|
|
114
|
+
Unauthenticated = 16
|
|
115
|
+
}
|
|
116
|
+
export declare enum RpcError_Tags {
|
|
117
|
+
Rpc = "Rpc",
|
|
118
|
+
MulticastRpc = "MulticastRpc",
|
|
119
|
+
MulticastSessionClosed = "MulticastSessionClosed"
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* UniFFI-compatible RPC error
|
|
123
|
+
*
|
|
124
|
+
* This represents RPC errors with gRPC-compatible status codes.
|
|
125
|
+
*/
|
|
126
|
+
export declare const RpcError: Readonly<{
|
|
127
|
+
instanceOf: (obj: any) => obj is RpcError;
|
|
128
|
+
Rpc: {
|
|
129
|
+
new (inner: {
|
|
130
|
+
code: RpcCode;
|
|
131
|
+
message: string;
|
|
132
|
+
details?: ArrayBuffer;
|
|
133
|
+
}): {
|
|
134
|
+
readonly tag: RpcError_Tags.Rpc;
|
|
135
|
+
readonly inner: Readonly<{
|
|
136
|
+
code: RpcCode;
|
|
137
|
+
message: string;
|
|
138
|
+
details?: ArrayBuffer;
|
|
139
|
+
}>;
|
|
140
|
+
/**
|
|
141
|
+
* @private
|
|
142
|
+
* This field is private and should not be used, use `tag` instead.
|
|
143
|
+
*/
|
|
144
|
+
readonly [uniffiTypeNameSymbol]: "RpcError";
|
|
145
|
+
name: string;
|
|
146
|
+
message: string;
|
|
147
|
+
stack?: string;
|
|
148
|
+
};
|
|
149
|
+
"new"(inner: {
|
|
150
|
+
code: RpcCode;
|
|
151
|
+
message: string;
|
|
152
|
+
details?: ArrayBuffer;
|
|
153
|
+
}): {
|
|
154
|
+
readonly tag: RpcError_Tags.Rpc;
|
|
155
|
+
readonly inner: Readonly<{
|
|
156
|
+
code: RpcCode;
|
|
157
|
+
message: string;
|
|
158
|
+
details?: ArrayBuffer;
|
|
159
|
+
}>;
|
|
160
|
+
/**
|
|
161
|
+
* @private
|
|
162
|
+
* This field is private and should not be used, use `tag` instead.
|
|
163
|
+
*/
|
|
164
|
+
readonly [uniffiTypeNameSymbol]: "RpcError";
|
|
165
|
+
name: string;
|
|
166
|
+
message: string;
|
|
167
|
+
stack?: string;
|
|
168
|
+
};
|
|
169
|
+
instanceOf(obj: any): obj is {
|
|
170
|
+
readonly tag: RpcError_Tags.Rpc;
|
|
171
|
+
readonly inner: Readonly<{
|
|
172
|
+
code: RpcCode;
|
|
173
|
+
message: string;
|
|
174
|
+
details?: ArrayBuffer;
|
|
175
|
+
}>;
|
|
176
|
+
/**
|
|
177
|
+
* @private
|
|
178
|
+
* This field is private and should not be used, use `tag` instead.
|
|
179
|
+
*/
|
|
180
|
+
readonly [uniffiTypeNameSymbol]: "RpcError";
|
|
181
|
+
name: string;
|
|
182
|
+
message: string;
|
|
183
|
+
stack?: string;
|
|
184
|
+
};
|
|
185
|
+
hasInner(obj: any): obj is {
|
|
186
|
+
readonly tag: RpcError_Tags.Rpc;
|
|
187
|
+
readonly inner: Readonly<{
|
|
188
|
+
code: RpcCode;
|
|
189
|
+
message: string;
|
|
190
|
+
details?: ArrayBuffer;
|
|
191
|
+
}>;
|
|
192
|
+
/**
|
|
193
|
+
* @private
|
|
194
|
+
* This field is private and should not be used, use `tag` instead.
|
|
195
|
+
*/
|
|
196
|
+
readonly [uniffiTypeNameSymbol]: "RpcError";
|
|
197
|
+
name: string;
|
|
198
|
+
message: string;
|
|
199
|
+
stack?: string;
|
|
200
|
+
};
|
|
201
|
+
getInner(obj: {
|
|
202
|
+
readonly tag: RpcError_Tags.Rpc;
|
|
203
|
+
readonly inner: Readonly<{
|
|
204
|
+
code: RpcCode;
|
|
205
|
+
message: string;
|
|
206
|
+
details?: ArrayBuffer;
|
|
207
|
+
}>;
|
|
208
|
+
/**
|
|
209
|
+
* @private
|
|
210
|
+
* This field is private and should not be used, use `tag` instead.
|
|
211
|
+
*/
|
|
212
|
+
readonly [uniffiTypeNameSymbol]: "RpcError";
|
|
213
|
+
name: string;
|
|
214
|
+
message: string;
|
|
215
|
+
stack?: string;
|
|
216
|
+
}): Readonly<{
|
|
217
|
+
code: RpcCode;
|
|
218
|
+
message: string;
|
|
219
|
+
details?: ArrayBuffer;
|
|
220
|
+
}>;
|
|
221
|
+
captureStackTrace(targetObject: object, constructorOpt?: Function): void;
|
|
222
|
+
prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;
|
|
223
|
+
stackTraceLimit: number;
|
|
224
|
+
};
|
|
225
|
+
MulticastRpc: {
|
|
226
|
+
new (inner: {
|
|
227
|
+
origin: string;
|
|
228
|
+
code: RpcCode;
|
|
229
|
+
message: string;
|
|
230
|
+
details?: ArrayBuffer;
|
|
231
|
+
}): {
|
|
232
|
+
readonly tag: RpcError_Tags.MulticastRpc;
|
|
233
|
+
readonly inner: Readonly<{
|
|
234
|
+
origin: string;
|
|
235
|
+
code: RpcCode;
|
|
236
|
+
message: string;
|
|
237
|
+
details?: ArrayBuffer;
|
|
238
|
+
}>;
|
|
239
|
+
/**
|
|
240
|
+
* @private
|
|
241
|
+
* This field is private and should not be used, use `tag` instead.
|
|
242
|
+
*/
|
|
243
|
+
readonly [uniffiTypeNameSymbol]: "RpcError";
|
|
244
|
+
name: string;
|
|
245
|
+
message: string;
|
|
246
|
+
stack?: string;
|
|
247
|
+
};
|
|
248
|
+
"new"(inner: {
|
|
249
|
+
origin: string;
|
|
250
|
+
code: RpcCode;
|
|
251
|
+
message: string;
|
|
252
|
+
details?: ArrayBuffer;
|
|
253
|
+
}): {
|
|
254
|
+
readonly tag: RpcError_Tags.MulticastRpc;
|
|
255
|
+
readonly inner: Readonly<{
|
|
256
|
+
origin: string;
|
|
257
|
+
code: RpcCode;
|
|
258
|
+
message: string;
|
|
259
|
+
details?: ArrayBuffer;
|
|
260
|
+
}>;
|
|
261
|
+
/**
|
|
262
|
+
* @private
|
|
263
|
+
* This field is private and should not be used, use `tag` instead.
|
|
264
|
+
*/
|
|
265
|
+
readonly [uniffiTypeNameSymbol]: "RpcError";
|
|
266
|
+
name: string;
|
|
267
|
+
message: string;
|
|
268
|
+
stack?: string;
|
|
269
|
+
};
|
|
270
|
+
instanceOf(obj: any): obj is {
|
|
271
|
+
readonly tag: RpcError_Tags.MulticastRpc;
|
|
272
|
+
readonly inner: Readonly<{
|
|
273
|
+
origin: string;
|
|
274
|
+
code: RpcCode;
|
|
275
|
+
message: string;
|
|
276
|
+
details?: ArrayBuffer;
|
|
277
|
+
}>;
|
|
278
|
+
/**
|
|
279
|
+
* @private
|
|
280
|
+
* This field is private and should not be used, use `tag` instead.
|
|
281
|
+
*/
|
|
282
|
+
readonly [uniffiTypeNameSymbol]: "RpcError";
|
|
283
|
+
name: string;
|
|
284
|
+
message: string;
|
|
285
|
+
stack?: string;
|
|
286
|
+
};
|
|
287
|
+
hasInner(obj: any): obj is {
|
|
288
|
+
readonly tag: RpcError_Tags.MulticastRpc;
|
|
289
|
+
readonly inner: Readonly<{
|
|
290
|
+
origin: string;
|
|
291
|
+
code: RpcCode;
|
|
292
|
+
message: string;
|
|
293
|
+
details?: ArrayBuffer;
|
|
294
|
+
}>;
|
|
295
|
+
/**
|
|
296
|
+
* @private
|
|
297
|
+
* This field is private and should not be used, use `tag` instead.
|
|
298
|
+
*/
|
|
299
|
+
readonly [uniffiTypeNameSymbol]: "RpcError";
|
|
300
|
+
name: string;
|
|
301
|
+
message: string;
|
|
302
|
+
stack?: string;
|
|
303
|
+
};
|
|
304
|
+
getInner(obj: {
|
|
305
|
+
readonly tag: RpcError_Tags.MulticastRpc;
|
|
306
|
+
readonly inner: Readonly<{
|
|
307
|
+
origin: string;
|
|
308
|
+
code: RpcCode;
|
|
309
|
+
message: string;
|
|
310
|
+
details?: ArrayBuffer;
|
|
311
|
+
}>;
|
|
312
|
+
/**
|
|
313
|
+
* @private
|
|
314
|
+
* This field is private and should not be used, use `tag` instead.
|
|
315
|
+
*/
|
|
316
|
+
readonly [uniffiTypeNameSymbol]: "RpcError";
|
|
317
|
+
name: string;
|
|
318
|
+
message: string;
|
|
319
|
+
stack?: string;
|
|
320
|
+
}): Readonly<{
|
|
321
|
+
origin: string;
|
|
322
|
+
code: RpcCode;
|
|
323
|
+
message: string;
|
|
324
|
+
details?: ArrayBuffer;
|
|
325
|
+
}>;
|
|
326
|
+
captureStackTrace(targetObject: object, constructorOpt?: Function): void;
|
|
327
|
+
prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;
|
|
328
|
+
stackTraceLimit: number;
|
|
329
|
+
};
|
|
330
|
+
MulticastSessionClosed: {
|
|
331
|
+
new (inner: {
|
|
332
|
+
completed: bigint;
|
|
333
|
+
total: bigint;
|
|
334
|
+
received: Array<string>;
|
|
335
|
+
missing: Array<string>;
|
|
336
|
+
}): {
|
|
337
|
+
readonly tag: RpcError_Tags.MulticastSessionClosed;
|
|
338
|
+
readonly inner: Readonly<{
|
|
339
|
+
completed: bigint;
|
|
340
|
+
total: bigint;
|
|
341
|
+
received: Array<string>;
|
|
342
|
+
missing: Array<string>;
|
|
343
|
+
}>;
|
|
344
|
+
/**
|
|
345
|
+
* @private
|
|
346
|
+
* This field is private and should not be used, use `tag` instead.
|
|
347
|
+
*/
|
|
348
|
+
readonly [uniffiTypeNameSymbol]: "RpcError";
|
|
349
|
+
name: string;
|
|
350
|
+
message: string;
|
|
351
|
+
stack?: string;
|
|
352
|
+
};
|
|
353
|
+
"new"(inner: {
|
|
354
|
+
completed: bigint;
|
|
355
|
+
total: bigint;
|
|
356
|
+
received: Array<string>;
|
|
357
|
+
missing: Array<string>;
|
|
358
|
+
}): {
|
|
359
|
+
readonly tag: RpcError_Tags.MulticastSessionClosed;
|
|
360
|
+
readonly inner: Readonly<{
|
|
361
|
+
completed: bigint;
|
|
362
|
+
total: bigint;
|
|
363
|
+
received: Array<string>;
|
|
364
|
+
missing: Array<string>;
|
|
365
|
+
}>;
|
|
366
|
+
/**
|
|
367
|
+
* @private
|
|
368
|
+
* This field is private and should not be used, use `tag` instead.
|
|
369
|
+
*/
|
|
370
|
+
readonly [uniffiTypeNameSymbol]: "RpcError";
|
|
371
|
+
name: string;
|
|
372
|
+
message: string;
|
|
373
|
+
stack?: string;
|
|
374
|
+
};
|
|
375
|
+
instanceOf(obj: any): obj is {
|
|
376
|
+
readonly tag: RpcError_Tags.MulticastSessionClosed;
|
|
377
|
+
readonly inner: Readonly<{
|
|
378
|
+
completed: bigint;
|
|
379
|
+
total: bigint;
|
|
380
|
+
received: Array<string>;
|
|
381
|
+
missing: Array<string>;
|
|
382
|
+
}>;
|
|
383
|
+
/**
|
|
384
|
+
* @private
|
|
385
|
+
* This field is private and should not be used, use `tag` instead.
|
|
386
|
+
*/
|
|
387
|
+
readonly [uniffiTypeNameSymbol]: "RpcError";
|
|
388
|
+
name: string;
|
|
389
|
+
message: string;
|
|
390
|
+
stack?: string;
|
|
391
|
+
};
|
|
392
|
+
hasInner(obj: any): obj is {
|
|
393
|
+
readonly tag: RpcError_Tags.MulticastSessionClosed;
|
|
394
|
+
readonly inner: Readonly<{
|
|
395
|
+
completed: bigint;
|
|
396
|
+
total: bigint;
|
|
397
|
+
received: Array<string>;
|
|
398
|
+
missing: Array<string>;
|
|
399
|
+
}>;
|
|
400
|
+
/**
|
|
401
|
+
* @private
|
|
402
|
+
* This field is private and should not be used, use `tag` instead.
|
|
403
|
+
*/
|
|
404
|
+
readonly [uniffiTypeNameSymbol]: "RpcError";
|
|
405
|
+
name: string;
|
|
406
|
+
message: string;
|
|
407
|
+
stack?: string;
|
|
408
|
+
};
|
|
409
|
+
getInner(obj: {
|
|
410
|
+
readonly tag: RpcError_Tags.MulticastSessionClosed;
|
|
411
|
+
readonly inner: Readonly<{
|
|
412
|
+
completed: bigint;
|
|
413
|
+
total: bigint;
|
|
414
|
+
received: Array<string>;
|
|
415
|
+
missing: Array<string>;
|
|
416
|
+
}>;
|
|
417
|
+
/**
|
|
418
|
+
* @private
|
|
419
|
+
* This field is private and should not be used, use `tag` instead.
|
|
420
|
+
*/
|
|
421
|
+
readonly [uniffiTypeNameSymbol]: "RpcError";
|
|
422
|
+
name: string;
|
|
423
|
+
message: string;
|
|
424
|
+
stack?: string;
|
|
425
|
+
}): Readonly<{
|
|
426
|
+
completed: bigint;
|
|
427
|
+
total: bigint;
|
|
428
|
+
received: Array<string>;
|
|
429
|
+
missing: Array<string>;
|
|
430
|
+
}>;
|
|
431
|
+
captureStackTrace(targetObject: object, constructorOpt?: Function): void;
|
|
432
|
+
prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;
|
|
433
|
+
stackTraceLimit: number;
|
|
434
|
+
};
|
|
435
|
+
}>;
|
|
436
|
+
/**
|
|
437
|
+
* UniFFI-compatible RPC error
|
|
438
|
+
*
|
|
439
|
+
* This represents RPC errors with gRPC-compatible status codes.
|
|
440
|
+
*/
|
|
441
|
+
export type RpcError = InstanceType<typeof RpcError['Rpc' | 'MulticastRpc' | 'MulticastSessionClosed']>;
|
|
442
|
+
export declare enum MulticastStreamMessage_Tags {
|
|
443
|
+
Data = "Data",
|
|
444
|
+
Error = "Error",
|
|
445
|
+
End = "End"
|
|
446
|
+
}
|
|
447
|
+
/**
|
|
448
|
+
* Message from a multicast response stream.
|
|
449
|
+
*/
|
|
450
|
+
export declare const MulticastStreamMessage: Readonly<{
|
|
451
|
+
instanceOf: (obj: any) => obj is MulticastStreamMessage;
|
|
452
|
+
Data: {
|
|
453
|
+
new (inner: {
|
|
454
|
+
item: RpcMulticastItem;
|
|
455
|
+
}): {
|
|
456
|
+
readonly tag: MulticastStreamMessage_Tags.Data;
|
|
457
|
+
readonly inner: Readonly<{
|
|
458
|
+
item: RpcMulticastItem;
|
|
459
|
+
}>;
|
|
460
|
+
/**
|
|
461
|
+
* @private
|
|
462
|
+
* This field is private and should not be used, use `tag` instead.
|
|
463
|
+
*/
|
|
464
|
+
readonly [uniffiTypeNameSymbol]: "MulticastStreamMessage";
|
|
465
|
+
};
|
|
466
|
+
"new"(inner: {
|
|
467
|
+
item: RpcMulticastItem;
|
|
468
|
+
}): {
|
|
469
|
+
readonly tag: MulticastStreamMessage_Tags.Data;
|
|
470
|
+
readonly inner: Readonly<{
|
|
471
|
+
item: RpcMulticastItem;
|
|
472
|
+
}>;
|
|
473
|
+
/**
|
|
474
|
+
* @private
|
|
475
|
+
* This field is private and should not be used, use `tag` instead.
|
|
476
|
+
*/
|
|
477
|
+
readonly [uniffiTypeNameSymbol]: "MulticastStreamMessage";
|
|
478
|
+
};
|
|
479
|
+
instanceOf(obj: any): obj is {
|
|
480
|
+
readonly tag: MulticastStreamMessage_Tags.Data;
|
|
481
|
+
readonly inner: Readonly<{
|
|
482
|
+
item: RpcMulticastItem;
|
|
483
|
+
}>;
|
|
484
|
+
/**
|
|
485
|
+
* @private
|
|
486
|
+
* This field is private and should not be used, use `tag` instead.
|
|
487
|
+
*/
|
|
488
|
+
readonly [uniffiTypeNameSymbol]: "MulticastStreamMessage";
|
|
489
|
+
};
|
|
490
|
+
};
|
|
491
|
+
Error: {
|
|
492
|
+
new (inner: {
|
|
493
|
+
error: RpcError;
|
|
494
|
+
}): {
|
|
495
|
+
readonly tag: MulticastStreamMessage_Tags.Error;
|
|
496
|
+
readonly inner: Readonly<{
|
|
497
|
+
error: RpcError;
|
|
498
|
+
}>;
|
|
499
|
+
/**
|
|
500
|
+
* @private
|
|
501
|
+
* This field is private and should not be used, use `tag` instead.
|
|
502
|
+
*/
|
|
503
|
+
readonly [uniffiTypeNameSymbol]: "MulticastStreamMessage";
|
|
504
|
+
};
|
|
505
|
+
"new"(inner: {
|
|
506
|
+
error: RpcError;
|
|
507
|
+
}): {
|
|
508
|
+
readonly tag: MulticastStreamMessage_Tags.Error;
|
|
509
|
+
readonly inner: Readonly<{
|
|
510
|
+
error: RpcError;
|
|
511
|
+
}>;
|
|
512
|
+
/**
|
|
513
|
+
* @private
|
|
514
|
+
* This field is private and should not be used, use `tag` instead.
|
|
515
|
+
*/
|
|
516
|
+
readonly [uniffiTypeNameSymbol]: "MulticastStreamMessage";
|
|
517
|
+
};
|
|
518
|
+
instanceOf(obj: any): obj is {
|
|
519
|
+
readonly tag: MulticastStreamMessage_Tags.Error;
|
|
520
|
+
readonly inner: Readonly<{
|
|
521
|
+
error: RpcError;
|
|
522
|
+
}>;
|
|
523
|
+
/**
|
|
524
|
+
* @private
|
|
525
|
+
* This field is private and should not be used, use `tag` instead.
|
|
526
|
+
*/
|
|
527
|
+
readonly [uniffiTypeNameSymbol]: "MulticastStreamMessage";
|
|
528
|
+
};
|
|
529
|
+
};
|
|
530
|
+
End: {
|
|
531
|
+
new (): {
|
|
532
|
+
readonly tag: MulticastStreamMessage_Tags.End;
|
|
533
|
+
/**
|
|
534
|
+
* @private
|
|
535
|
+
* This field is private and should not be used, use `tag` instead.
|
|
536
|
+
*/
|
|
537
|
+
readonly [uniffiTypeNameSymbol]: "MulticastStreamMessage";
|
|
538
|
+
};
|
|
539
|
+
"new"(): {
|
|
540
|
+
readonly tag: MulticastStreamMessage_Tags.End;
|
|
541
|
+
/**
|
|
542
|
+
* @private
|
|
543
|
+
* This field is private and should not be used, use `tag` instead.
|
|
544
|
+
*/
|
|
545
|
+
readonly [uniffiTypeNameSymbol]: "MulticastStreamMessage";
|
|
546
|
+
};
|
|
547
|
+
instanceOf(obj: any): obj is {
|
|
548
|
+
readonly tag: MulticastStreamMessage_Tags.End;
|
|
549
|
+
/**
|
|
550
|
+
* @private
|
|
551
|
+
* This field is private and should not be used, use `tag` instead.
|
|
552
|
+
*/
|
|
553
|
+
readonly [uniffiTypeNameSymbol]: "MulticastStreamMessage";
|
|
554
|
+
};
|
|
555
|
+
};
|
|
556
|
+
}>;
|
|
557
|
+
/**
|
|
558
|
+
* Message from a multicast response stream.
|
|
559
|
+
*/
|
|
560
|
+
export type MulticastStreamMessage = InstanceType<typeof MulticastStreamMessage['Data' | 'Error' | 'End']>;
|
|
561
|
+
export declare enum StreamMessage_Tags {
|
|
562
|
+
Data = "Data",
|
|
563
|
+
Error = "Error",
|
|
564
|
+
End = "End"
|
|
565
|
+
}
|
|
566
|
+
/**
|
|
567
|
+
* Message from a stream
|
|
568
|
+
*/
|
|
569
|
+
export declare const StreamMessage: Readonly<{
|
|
570
|
+
instanceOf: (obj: any) => obj is StreamMessage;
|
|
571
|
+
Data: {
|
|
572
|
+
new (v0: ArrayBuffer): {
|
|
573
|
+
readonly tag: StreamMessage_Tags.Data;
|
|
574
|
+
readonly inner: Readonly<[ArrayBuffer]>;
|
|
575
|
+
/**
|
|
576
|
+
* @private
|
|
577
|
+
* This field is private and should not be used, use `tag` instead.
|
|
578
|
+
*/
|
|
579
|
+
readonly [uniffiTypeNameSymbol]: "StreamMessage";
|
|
580
|
+
};
|
|
581
|
+
"new"(v0: ArrayBuffer): {
|
|
582
|
+
readonly tag: StreamMessage_Tags.Data;
|
|
583
|
+
readonly inner: Readonly<[ArrayBuffer]>;
|
|
584
|
+
/**
|
|
585
|
+
* @private
|
|
586
|
+
* This field is private and should not be used, use `tag` instead.
|
|
587
|
+
*/
|
|
588
|
+
readonly [uniffiTypeNameSymbol]: "StreamMessage";
|
|
589
|
+
};
|
|
590
|
+
instanceOf(obj: any): obj is {
|
|
591
|
+
readonly tag: StreamMessage_Tags.Data;
|
|
592
|
+
readonly inner: Readonly<[ArrayBuffer]>;
|
|
593
|
+
/**
|
|
594
|
+
* @private
|
|
595
|
+
* This field is private and should not be used, use `tag` instead.
|
|
596
|
+
*/
|
|
597
|
+
readonly [uniffiTypeNameSymbol]: "StreamMessage";
|
|
598
|
+
};
|
|
599
|
+
};
|
|
600
|
+
Error: {
|
|
601
|
+
new (v0: RpcError): {
|
|
602
|
+
readonly tag: StreamMessage_Tags.Error;
|
|
603
|
+
readonly inner: Readonly<[RpcError]>;
|
|
604
|
+
/**
|
|
605
|
+
* @private
|
|
606
|
+
* This field is private and should not be used, use `tag` instead.
|
|
607
|
+
*/
|
|
608
|
+
readonly [uniffiTypeNameSymbol]: "StreamMessage";
|
|
609
|
+
};
|
|
610
|
+
"new"(v0: RpcError): {
|
|
611
|
+
readonly tag: StreamMessage_Tags.Error;
|
|
612
|
+
readonly inner: Readonly<[RpcError]>;
|
|
613
|
+
/**
|
|
614
|
+
* @private
|
|
615
|
+
* This field is private and should not be used, use `tag` instead.
|
|
616
|
+
*/
|
|
617
|
+
readonly [uniffiTypeNameSymbol]: "StreamMessage";
|
|
618
|
+
};
|
|
619
|
+
instanceOf(obj: any): obj is {
|
|
620
|
+
readonly tag: StreamMessage_Tags.Error;
|
|
621
|
+
readonly inner: Readonly<[RpcError]>;
|
|
622
|
+
/**
|
|
623
|
+
* @private
|
|
624
|
+
* This field is private and should not be used, use `tag` instead.
|
|
625
|
+
*/
|
|
626
|
+
readonly [uniffiTypeNameSymbol]: "StreamMessage";
|
|
627
|
+
};
|
|
628
|
+
};
|
|
629
|
+
End: {
|
|
630
|
+
new (): {
|
|
631
|
+
readonly tag: StreamMessage_Tags.End;
|
|
632
|
+
/**
|
|
633
|
+
* @private
|
|
634
|
+
* This field is private and should not be used, use `tag` instead.
|
|
635
|
+
*/
|
|
636
|
+
readonly [uniffiTypeNameSymbol]: "StreamMessage";
|
|
637
|
+
};
|
|
638
|
+
"new"(): {
|
|
639
|
+
readonly tag: StreamMessage_Tags.End;
|
|
640
|
+
/**
|
|
641
|
+
* @private
|
|
642
|
+
* This field is private and should not be used, use `tag` instead.
|
|
643
|
+
*/
|
|
644
|
+
readonly [uniffiTypeNameSymbol]: "StreamMessage";
|
|
645
|
+
};
|
|
646
|
+
instanceOf(obj: any): obj is {
|
|
647
|
+
readonly tag: StreamMessage_Tags.End;
|
|
648
|
+
/**
|
|
649
|
+
* @private
|
|
650
|
+
* This field is private and should not be used, use `tag` instead.
|
|
651
|
+
*/
|
|
652
|
+
readonly [uniffiTypeNameSymbol]: "StreamMessage";
|
|
653
|
+
};
|
|
654
|
+
};
|
|
655
|
+
}>;
|
|
656
|
+
/**
|
|
657
|
+
* Message from a stream
|
|
658
|
+
*/
|
|
659
|
+
export type StreamMessage = InstanceType<typeof StreamMessage['Data' | 'Error' | 'End']>;
|
|
660
|
+
/**
|
|
661
|
+
* Bidirectional stream handler for stream-to-stream RPC calls
|
|
662
|
+
*
|
|
663
|
+
* Allows sending and receiving messages concurrently.
|
|
664
|
+
*/
|
|
665
|
+
export interface BidiStreamHandlerLike {
|
|
666
|
+
/**
|
|
667
|
+
* Close the request stream (no more messages will be sent)
|
|
668
|
+
*/
|
|
669
|
+
closeSend(): void;
|
|
670
|
+
/**
|
|
671
|
+
* Close the request stream (async version)
|
|
672
|
+
*/
|
|
673
|
+
closeSendAsync(asyncOpts_?: {
|
|
674
|
+
signal: AbortSignal;
|
|
675
|
+
}): Promise<void>;
|
|
676
|
+
/**
|
|
677
|
+
* Receive the next response message (blocking version)
|
|
678
|
+
*/
|
|
679
|
+
recv(): StreamMessage;
|
|
680
|
+
/**
|
|
681
|
+
* Receive the next response message (async version)
|
|
682
|
+
*/
|
|
683
|
+
recvAsync(asyncOpts_?: {
|
|
684
|
+
signal: AbortSignal;
|
|
685
|
+
}): Promise<StreamMessage>;
|
|
686
|
+
/**
|
|
687
|
+
* Send a request message to the stream (blocking version)
|
|
688
|
+
*/
|
|
689
|
+
send(data: ArrayBuffer): void;
|
|
690
|
+
/**
|
|
691
|
+
* Send a request message to the stream (async version)
|
|
692
|
+
*/
|
|
693
|
+
sendAsync(data: ArrayBuffer, asyncOpts_?: {
|
|
694
|
+
signal: AbortSignal;
|
|
695
|
+
}): Promise<void>;
|
|
696
|
+
}
|
|
697
|
+
/**
|
|
698
|
+
* @deprecated Use `BidiStreamHandlerLike` instead.
|
|
699
|
+
*/
|
|
700
|
+
export type BidiStreamHandlerInterface = BidiStreamHandlerLike;
|
|
701
|
+
/**
|
|
702
|
+
* Bidirectional stream handler for stream-to-stream RPC calls
|
|
703
|
+
*
|
|
704
|
+
* Allows sending and receiving messages concurrently.
|
|
705
|
+
*/
|
|
706
|
+
export declare class BidiStreamHandler extends UniffiAbstractObject implements BidiStreamHandlerLike {
|
|
707
|
+
readonly [uniffiTypeNameSymbol] = "BidiStreamHandler";
|
|
708
|
+
readonly [destructorGuardSymbol]: UniffiGcObject;
|
|
709
|
+
readonly [pointerLiteralSymbol]: UniffiHandle;
|
|
710
|
+
private constructor();
|
|
711
|
+
/**
|
|
712
|
+
* Close the request stream (no more messages will be sent)
|
|
713
|
+
*/
|
|
714
|
+
closeSend(): void;
|
|
715
|
+
/**
|
|
716
|
+
* Close the request stream (async version)
|
|
717
|
+
*/
|
|
718
|
+
closeSendAsync(asyncOpts_?: {
|
|
719
|
+
signal: AbortSignal;
|
|
720
|
+
}): Promise<void>;
|
|
721
|
+
/**
|
|
722
|
+
* Receive the next response message (blocking version)
|
|
723
|
+
*/
|
|
724
|
+
recv(): StreamMessage;
|
|
725
|
+
/**
|
|
726
|
+
* Receive the next response message (async version)
|
|
727
|
+
*/
|
|
728
|
+
recvAsync(asyncOpts_?: {
|
|
729
|
+
signal: AbortSignal;
|
|
730
|
+
}): Promise<StreamMessage>;
|
|
731
|
+
/**
|
|
732
|
+
* Send a request message to the stream (blocking version)
|
|
733
|
+
*/
|
|
734
|
+
send(data: ArrayBuffer): void;
|
|
735
|
+
/**
|
|
736
|
+
* Send a request message to the stream (async version)
|
|
737
|
+
*/
|
|
738
|
+
sendAsync(data: ArrayBuffer, asyncOpts_?: {
|
|
739
|
+
signal: AbortSignal;
|
|
740
|
+
}): Promise<void>;
|
|
741
|
+
uniffiDestroy(): void;
|
|
742
|
+
static instanceOf(obj_: any): obj_ is BidiStreamHandler;
|
|
743
|
+
}
|
|
744
|
+
/**
|
|
745
|
+
* Bidirectional stream handler for multicast stream-to-unary and
|
|
746
|
+
* stream-to-stream RPC calls.
|
|
747
|
+
*
|
|
748
|
+
* Send request messages via [`send`](Self::send) / [`send_async`](Self::send_async),
|
|
749
|
+
* close the request stream via [`close_send`](Self::close_send), and receive
|
|
750
|
+
* responses via [`recv`](Self::recv) / [`recv_async`](Self::recv_async). Each
|
|
751
|
+
* response item carries the source member's identity.
|
|
752
|
+
*/
|
|
753
|
+
export interface MulticastBidiStreamHandlerLike {
|
|
754
|
+
/**
|
|
755
|
+
* Close the request stream — signals that no more messages will be sent
|
|
756
|
+
* (blocking).
|
|
757
|
+
*/
|
|
758
|
+
closeSend(): void;
|
|
759
|
+
/**
|
|
760
|
+
* Close the request stream (async).
|
|
761
|
+
*/
|
|
762
|
+
closeSendAsync(asyncOpts_?: {
|
|
763
|
+
signal: AbortSignal;
|
|
764
|
+
}): Promise<void>;
|
|
765
|
+
/**
|
|
766
|
+
* Receive the next response item (blocking).
|
|
767
|
+
*/
|
|
768
|
+
recv(): MulticastStreamMessage;
|
|
769
|
+
/**
|
|
770
|
+
* Receive the next response item (async).
|
|
771
|
+
*/
|
|
772
|
+
recvAsync(asyncOpts_?: {
|
|
773
|
+
signal: AbortSignal;
|
|
774
|
+
}): Promise<MulticastStreamMessage>;
|
|
775
|
+
/**
|
|
776
|
+
* Send a request message to the stream (blocking).
|
|
777
|
+
*/
|
|
778
|
+
send(data: ArrayBuffer): void;
|
|
779
|
+
/**
|
|
780
|
+
* Send a request message to the stream (async).
|
|
781
|
+
*/
|
|
782
|
+
sendAsync(data: ArrayBuffer, asyncOpts_?: {
|
|
783
|
+
signal: AbortSignal;
|
|
784
|
+
}): Promise<void>;
|
|
785
|
+
}
|
|
786
|
+
/**
|
|
787
|
+
* @deprecated Use `MulticastBidiStreamHandlerLike` instead.
|
|
788
|
+
*/
|
|
789
|
+
export type MulticastBidiStreamHandlerInterface = MulticastBidiStreamHandlerLike;
|
|
790
|
+
/**
|
|
791
|
+
* Bidirectional stream handler for multicast stream-to-unary and
|
|
792
|
+
* stream-to-stream RPC calls.
|
|
793
|
+
*
|
|
794
|
+
* Send request messages via [`send`](Self::send) / [`send_async`](Self::send_async),
|
|
795
|
+
* close the request stream via [`close_send`](Self::close_send), and receive
|
|
796
|
+
* responses via [`recv`](Self::recv) / [`recv_async`](Self::recv_async). Each
|
|
797
|
+
* response item carries the source member's identity.
|
|
798
|
+
*/
|
|
799
|
+
export declare class MulticastBidiStreamHandler extends UniffiAbstractObject implements MulticastBidiStreamHandlerLike {
|
|
800
|
+
readonly [uniffiTypeNameSymbol] = "MulticastBidiStreamHandler";
|
|
801
|
+
readonly [destructorGuardSymbol]: UniffiGcObject;
|
|
802
|
+
readonly [pointerLiteralSymbol]: UniffiHandle;
|
|
803
|
+
private constructor();
|
|
804
|
+
/**
|
|
805
|
+
* Close the request stream — signals that no more messages will be sent
|
|
806
|
+
* (blocking).
|
|
807
|
+
*/
|
|
808
|
+
closeSend(): void;
|
|
809
|
+
/**
|
|
810
|
+
* Close the request stream (async).
|
|
811
|
+
*/
|
|
812
|
+
closeSendAsync(asyncOpts_?: {
|
|
813
|
+
signal: AbortSignal;
|
|
814
|
+
}): Promise<void>;
|
|
815
|
+
/**
|
|
816
|
+
* Receive the next response item (blocking).
|
|
817
|
+
*/
|
|
818
|
+
recv(): MulticastStreamMessage;
|
|
819
|
+
/**
|
|
820
|
+
* Receive the next response item (async).
|
|
821
|
+
*/
|
|
822
|
+
recvAsync(asyncOpts_?: {
|
|
823
|
+
signal: AbortSignal;
|
|
824
|
+
}): Promise<MulticastStreamMessage>;
|
|
825
|
+
/**
|
|
826
|
+
* Send a request message to the stream (blocking).
|
|
827
|
+
*/
|
|
828
|
+
send(data: ArrayBuffer): void;
|
|
829
|
+
/**
|
|
830
|
+
* Send a request message to the stream (async).
|
|
831
|
+
*/
|
|
832
|
+
sendAsync(data: ArrayBuffer, asyncOpts_?: {
|
|
833
|
+
signal: AbortSignal;
|
|
834
|
+
}): Promise<void>;
|
|
835
|
+
uniffiDestroy(): void;
|
|
836
|
+
static instanceOf(obj_: any): obj_ is MulticastBidiStreamHandler;
|
|
837
|
+
}
|
|
838
|
+
/**
|
|
839
|
+
* Response stream reader for multicast RPC calls.
|
|
840
|
+
*
|
|
841
|
+
* Allows pulling `RpcMulticastItem`s from a GROUP response stream one at a
|
|
842
|
+
* time. Each item carries the source member's identity alongside the payload.
|
|
843
|
+
*/
|
|
844
|
+
export interface MulticastResponseReaderLike {
|
|
845
|
+
/**
|
|
846
|
+
* Pull the next item from the multicast response stream (blocking).
|
|
847
|
+
*/
|
|
848
|
+
next(): MulticastStreamMessage;
|
|
849
|
+
/**
|
|
850
|
+
* Pull the next item from the multicast response stream (async).
|
|
851
|
+
*/
|
|
852
|
+
nextAsync(asyncOpts_?: {
|
|
853
|
+
signal: AbortSignal;
|
|
854
|
+
}): Promise<MulticastStreamMessage>;
|
|
855
|
+
}
|
|
856
|
+
/**
|
|
857
|
+
* @deprecated Use `MulticastResponseReaderLike` instead.
|
|
858
|
+
*/
|
|
859
|
+
export type MulticastResponseReaderInterface = MulticastResponseReaderLike;
|
|
860
|
+
/**
|
|
861
|
+
* Response stream reader for multicast RPC calls.
|
|
862
|
+
*
|
|
863
|
+
* Allows pulling `RpcMulticastItem`s from a GROUP response stream one at a
|
|
864
|
+
* time. Each item carries the source member's identity alongside the payload.
|
|
865
|
+
*/
|
|
866
|
+
export declare class MulticastResponseReader extends UniffiAbstractObject implements MulticastResponseReaderLike {
|
|
867
|
+
readonly [uniffiTypeNameSymbol] = "MulticastResponseReader";
|
|
868
|
+
readonly [destructorGuardSymbol]: UniffiGcObject;
|
|
869
|
+
readonly [pointerLiteralSymbol]: UniffiHandle;
|
|
870
|
+
private constructor();
|
|
871
|
+
/**
|
|
872
|
+
* Pull the next item from the multicast response stream (blocking).
|
|
873
|
+
*/
|
|
874
|
+
next(): MulticastStreamMessage;
|
|
875
|
+
/**
|
|
876
|
+
* Pull the next item from the multicast response stream (async).
|
|
877
|
+
*/
|
|
878
|
+
nextAsync(asyncOpts_?: {
|
|
879
|
+
signal: AbortSignal;
|
|
880
|
+
}): Promise<MulticastStreamMessage>;
|
|
881
|
+
uniffiDestroy(): void;
|
|
882
|
+
static instanceOf(obj_: any): obj_ is MulticastResponseReader;
|
|
883
|
+
}
|
|
884
|
+
/**
|
|
885
|
+
* Request stream writer for stream-to-unary RPC calls
|
|
886
|
+
*
|
|
887
|
+
* Allows sending multiple request messages and getting a final response.
|
|
888
|
+
*/
|
|
889
|
+
export interface RequestStreamWriterLike {
|
|
890
|
+
/**
|
|
891
|
+
* Finalize the stream and get the response (async version)
|
|
892
|
+
*
|
|
893
|
+
* **Deprecated**: Use [`finalize_stream_async`](Self::finalize_stream_async) instead.
|
|
894
|
+
*/
|
|
895
|
+
finalizeAsync(asyncOpts_?: {
|
|
896
|
+
signal: AbortSignal;
|
|
897
|
+
}): Promise<ArrayBuffer>;
|
|
898
|
+
/**
|
|
899
|
+
* Finalize the stream and get the response (blocking version)
|
|
900
|
+
*/
|
|
901
|
+
finalizeStream(): ArrayBuffer;
|
|
902
|
+
/**
|
|
903
|
+
* Finalize the stream and get the response (async version)
|
|
904
|
+
*/
|
|
905
|
+
finalizeStreamAsync(asyncOpts_?: {
|
|
906
|
+
signal: AbortSignal;
|
|
907
|
+
}): Promise<ArrayBuffer>;
|
|
908
|
+
/**
|
|
909
|
+
* Send a request message to the stream (blocking version)
|
|
910
|
+
*/
|
|
911
|
+
send(data: ArrayBuffer): void;
|
|
912
|
+
/**
|
|
913
|
+
* Send a request message to the stream (async version)
|
|
914
|
+
*/
|
|
915
|
+
sendAsync(data: ArrayBuffer, asyncOpts_?: {
|
|
916
|
+
signal: AbortSignal;
|
|
917
|
+
}): Promise<void>;
|
|
918
|
+
}
|
|
919
|
+
/**
|
|
920
|
+
* @deprecated Use `RequestStreamWriterLike` instead.
|
|
921
|
+
*/
|
|
922
|
+
export type RequestStreamWriterInterface = RequestStreamWriterLike;
|
|
923
|
+
/**
|
|
924
|
+
* Request stream writer for stream-to-unary RPC calls
|
|
925
|
+
*
|
|
926
|
+
* Allows sending multiple request messages and getting a final response.
|
|
927
|
+
*/
|
|
928
|
+
export declare class RequestStreamWriter extends UniffiAbstractObject implements RequestStreamWriterLike {
|
|
929
|
+
readonly [uniffiTypeNameSymbol] = "RequestStreamWriter";
|
|
930
|
+
readonly [destructorGuardSymbol]: UniffiGcObject;
|
|
931
|
+
readonly [pointerLiteralSymbol]: UniffiHandle;
|
|
932
|
+
private constructor();
|
|
933
|
+
/**
|
|
934
|
+
* Finalize the stream and get the response (async version)
|
|
935
|
+
*
|
|
936
|
+
* **Deprecated**: Use [`finalize_stream_async`](Self::finalize_stream_async) instead.
|
|
937
|
+
*/
|
|
938
|
+
finalizeAsync(asyncOpts_?: {
|
|
939
|
+
signal: AbortSignal;
|
|
940
|
+
}): Promise<ArrayBuffer>;
|
|
941
|
+
/**
|
|
942
|
+
* Finalize the stream and get the response (blocking version)
|
|
943
|
+
*/
|
|
944
|
+
finalizeStream(): ArrayBuffer;
|
|
945
|
+
/**
|
|
946
|
+
* Finalize the stream and get the response (async version)
|
|
947
|
+
*/
|
|
948
|
+
finalizeStreamAsync(asyncOpts_?: {
|
|
949
|
+
signal: AbortSignal;
|
|
950
|
+
}): Promise<ArrayBuffer>;
|
|
951
|
+
/**
|
|
952
|
+
* Send a request message to the stream (blocking version)
|
|
953
|
+
*/
|
|
954
|
+
send(data: ArrayBuffer): void;
|
|
955
|
+
/**
|
|
956
|
+
* Send a request message to the stream (async version)
|
|
957
|
+
*/
|
|
958
|
+
sendAsync(data: ArrayBuffer, asyncOpts_?: {
|
|
959
|
+
signal: AbortSignal;
|
|
960
|
+
}): Promise<void>;
|
|
961
|
+
uniffiDestroy(): void;
|
|
962
|
+
static instanceOf(obj_: any): obj_ is RequestStreamWriter;
|
|
963
|
+
}
|
|
964
|
+
/**
|
|
965
|
+
* Response stream reader for unary-to-stream RPC calls
|
|
966
|
+
*
|
|
967
|
+
* Allows pulling messages from a server response stream one at a time.
|
|
968
|
+
*/
|
|
969
|
+
export interface ResponseStreamReaderLike {
|
|
970
|
+
/**
|
|
971
|
+
* Pull the next message from the response stream (blocking version)
|
|
972
|
+
*
|
|
973
|
+
* Returns a StreamMessage indicating the result
|
|
974
|
+
*/
|
|
975
|
+
next(): StreamMessage;
|
|
976
|
+
/**
|
|
977
|
+
* Pull the next message from the response stream (async version)
|
|
978
|
+
*
|
|
979
|
+
* Returns a StreamMessage indicating the result
|
|
980
|
+
*/
|
|
981
|
+
nextAsync(asyncOpts_?: {
|
|
982
|
+
signal: AbortSignal;
|
|
983
|
+
}): Promise<StreamMessage>;
|
|
984
|
+
}
|
|
985
|
+
/**
|
|
986
|
+
* @deprecated Use `ResponseStreamReaderLike` instead.
|
|
987
|
+
*/
|
|
988
|
+
export type ResponseStreamReaderInterface = ResponseStreamReaderLike;
|
|
989
|
+
/**
|
|
990
|
+
* Response stream reader for unary-to-stream RPC calls
|
|
991
|
+
*
|
|
992
|
+
* Allows pulling messages from a server response stream one at a time.
|
|
993
|
+
*/
|
|
994
|
+
export declare class ResponseStreamReader extends UniffiAbstractObject implements ResponseStreamReaderLike {
|
|
995
|
+
readonly [uniffiTypeNameSymbol] = "ResponseStreamReader";
|
|
996
|
+
readonly [destructorGuardSymbol]: UniffiGcObject;
|
|
997
|
+
readonly [pointerLiteralSymbol]: UniffiHandle;
|
|
998
|
+
private constructor();
|
|
999
|
+
/**
|
|
1000
|
+
* Pull the next message from the response stream (blocking version)
|
|
1001
|
+
*
|
|
1002
|
+
* Returns a StreamMessage indicating the result
|
|
1003
|
+
*/
|
|
1004
|
+
next(): StreamMessage;
|
|
1005
|
+
/**
|
|
1006
|
+
* Pull the next message from the response stream (async version)
|
|
1007
|
+
*
|
|
1008
|
+
* Returns a StreamMessage indicating the result
|
|
1009
|
+
*/
|
|
1010
|
+
nextAsync(asyncOpts_?: {
|
|
1011
|
+
signal: AbortSignal;
|
|
1012
|
+
}): Promise<StreamMessage>;
|
|
1013
|
+
uniffiDestroy(): void;
|
|
1014
|
+
static instanceOf(obj_: any): obj_ is ResponseStreamReader;
|
|
1015
|
+
}
|
|
1016
|
+
/**
|
|
1017
|
+
* Client-side channel for making RPC calls.
|
|
1018
|
+
*
|
|
1019
|
+
* Manages a single persistent SLIM session: either a `PointToPoint` session
|
|
1020
|
+
* to a single remote server, or a `Multicast` (GROUP) session shared across
|
|
1021
|
+
* multiple remote servers. The session is lazily initialised and recreated
|
|
1022
|
+
* when dead.
|
|
1023
|
+
*
|
|
1024
|
+
* ## Constructor
|
|
1025
|
+
*
|
|
1026
|
+
* - `new_with_members_internal(app, members)` — Smart constructor:
|
|
1027
|
+
* - **1 member**: creates a P2P channel.
|
|
1028
|
+
* - **Many members**: creates a GROUP channel with a generated session name
|
|
1029
|
+
* and auto-invites all members on the first multicast call.
|
|
1030
|
+
*/
|
|
1031
|
+
export interface ChannelLike {
|
|
1032
|
+
/**
|
|
1033
|
+
* Broadcast a request stream to all GROUP members and stream their
|
|
1034
|
+
* responses.
|
|
1035
|
+
*
|
|
1036
|
+
* Semantically equivalent to `call_multicast_stream_unary` at the
|
|
1037
|
+
* transport level; the difference (one vs many responses per member) is
|
|
1038
|
+
* determined by the server handler.
|
|
1039
|
+
*/
|
|
1040
|
+
callMulticastStreamStream(serviceName: string, methodName: string, timeout: number | undefined, metadata: Map<string, string> | undefined): MulticastBidiStreamHandlerLike;
|
|
1041
|
+
/**
|
|
1042
|
+
* Broadcast a request stream to all GROUP members and collect their
|
|
1043
|
+
* responses.
|
|
1044
|
+
*
|
|
1045
|
+
* Returns a handler that lets you send requests and receive responses
|
|
1046
|
+
* concurrently. Use `send` / `send_async` to push request messages,
|
|
1047
|
+
* `close_send` / `close_send_async` to signal end-of-requests, and
|
|
1048
|
+
* `recv` / `recv_async` to pull response items.
|
|
1049
|
+
*/
|
|
1050
|
+
callMulticastStreamUnary(serviceName: string, methodName: string, timeout: number | undefined, metadata: Map<string, string> | undefined): MulticastBidiStreamHandlerLike;
|
|
1051
|
+
/**
|
|
1052
|
+
* Broadcast one request to all GROUP members and collect their responses.
|
|
1053
|
+
*
|
|
1054
|
+
* Returns a reader from which each member's response (wrapped in
|
|
1055
|
+
* `MulticastStreamMessage`) can be pulled one at a time (blocking).
|
|
1056
|
+
*/
|
|
1057
|
+
callMulticastUnary(serviceName: string, methodName: string, request: ArrayBuffer, timeout: number | undefined, metadata: Map<string, string> | undefined): MulticastResponseReaderLike;
|
|
1058
|
+
/**
|
|
1059
|
+
* Broadcast one request to all GROUP members and collect their responses
|
|
1060
|
+
* (async).
|
|
1061
|
+
*/
|
|
1062
|
+
callMulticastUnaryAsync(serviceName: string, methodName: string, request: ArrayBuffer, timeout: number | undefined, metadata: Map<string, string> | undefined, asyncOpts_?: {
|
|
1063
|
+
signal: AbortSignal;
|
|
1064
|
+
}): Promise<MulticastResponseReaderLike>;
|
|
1065
|
+
/**
|
|
1066
|
+
* Broadcast one request to all GROUP members and stream their responses
|
|
1067
|
+
* (blocking).
|
|
1068
|
+
*
|
|
1069
|
+
* Semantically identical to `call_multicast_unary` at the transport level;
|
|
1070
|
+
* the difference is that each member may send multiple responses before its
|
|
1071
|
+
* EOS, which the server handler determines.
|
|
1072
|
+
*/
|
|
1073
|
+
callMulticastUnaryStream(serviceName: string, methodName: string, request: ArrayBuffer, timeout: number | undefined, metadata: Map<string, string> | undefined): MulticastResponseReaderLike;
|
|
1074
|
+
/**
|
|
1075
|
+
* Broadcast one request to all GROUP members and stream their responses
|
|
1076
|
+
* (async).
|
|
1077
|
+
*/
|
|
1078
|
+
callMulticastUnaryStreamAsync(serviceName: string, methodName: string, request: ArrayBuffer, timeout: number | undefined, metadata: Map<string, string> | undefined, asyncOpts_?: {
|
|
1079
|
+
signal: AbortSignal;
|
|
1080
|
+
}): Promise<MulticastResponseReaderLike>;
|
|
1081
|
+
callStreamStream(serviceName: string, methodName: string, timeout: number | undefined, metadata: Map<string, string> | undefined): BidiStreamHandlerLike;
|
|
1082
|
+
callStreamUnary(serviceName: string, methodName: string, timeout: number | undefined, metadata: Map<string, string> | undefined): RequestStreamWriterLike;
|
|
1083
|
+
callUnary(serviceName: string, methodName: string, request: ArrayBuffer, timeout: number | undefined, metadata: Map<string, string> | undefined): ArrayBuffer;
|
|
1084
|
+
callUnaryAsync(serviceName: string, methodName: string, request: ArrayBuffer, timeout: number | undefined, metadata: Map<string, string> | undefined, asyncOpts_?: {
|
|
1085
|
+
signal: AbortSignal;
|
|
1086
|
+
}): Promise<ArrayBuffer>;
|
|
1087
|
+
callUnaryStream(serviceName: string, methodName: string, request: ArrayBuffer, timeout: number | undefined, metadata: Map<string, string> | undefined): ResponseStreamReaderLike;
|
|
1088
|
+
callUnaryStreamAsync(serviceName: string, methodName: string, request: ArrayBuffer, timeout: number | undefined, metadata: Map<string, string> | undefined, asyncOpts_?: {
|
|
1089
|
+
signal: AbortSignal;
|
|
1090
|
+
}): Promise<ResponseStreamReaderLike>;
|
|
1091
|
+
/**
|
|
1092
|
+
* Async FFI wrapper for [`Channel::close`].
|
|
1093
|
+
*/
|
|
1094
|
+
closeAsync(timeout: number | undefined, asyncOpts_?: {
|
|
1095
|
+
signal: AbortSignal;
|
|
1096
|
+
}): Promise<void>;
|
|
1097
|
+
/**
|
|
1098
|
+
* Blocking FFI wrapper for [`Channel::close`].
|
|
1099
|
+
*/
|
|
1100
|
+
closeBlocking(timeout: number | undefined): void;
|
|
1101
|
+
}
|
|
1102
|
+
/**
|
|
1103
|
+
* @deprecated Use `ChannelLike` instead.
|
|
1104
|
+
*/
|
|
1105
|
+
export type ChannelInterface = ChannelLike;
|
|
1106
|
+
/**
|
|
1107
|
+
* Client-side channel for making RPC calls.
|
|
1108
|
+
*
|
|
1109
|
+
* Manages a single persistent SLIM session: either a `PointToPoint` session
|
|
1110
|
+
* to a single remote server, or a `Multicast` (GROUP) session shared across
|
|
1111
|
+
* multiple remote servers. The session is lazily initialised and recreated
|
|
1112
|
+
* when dead.
|
|
1113
|
+
*
|
|
1114
|
+
* ## Constructor
|
|
1115
|
+
*
|
|
1116
|
+
* - `new_with_members_internal(app, members)` — Smart constructor:
|
|
1117
|
+
* - **1 member**: creates a P2P channel.
|
|
1118
|
+
* - **Many members**: creates a GROUP channel with a generated session name
|
|
1119
|
+
* and auto-invites all members on the first multicast call.
|
|
1120
|
+
*/
|
|
1121
|
+
export declare class Channel extends UniffiAbstractObject implements ChannelLike {
|
|
1122
|
+
readonly [uniffiTypeNameSymbol] = "Channel";
|
|
1123
|
+
readonly [destructorGuardSymbol]: UniffiGcObject;
|
|
1124
|
+
readonly [pointerLiteralSymbol]: UniffiHandle;
|
|
1125
|
+
constructor(app: AppLike, remote: NameLike);
|
|
1126
|
+
static newGroup(app: AppLike, members: Array<NameLike>): ChannelLike;
|
|
1127
|
+
static newGroupWithConnection(app: AppLike, members: Array<NameLike>, connectionId: bigint | undefined): ChannelLike;
|
|
1128
|
+
static newWithConnection(app: AppLike, remote: NameLike, connectionId: bigint | undefined): ChannelLike;
|
|
1129
|
+
/**
|
|
1130
|
+
* Broadcast a request stream to all GROUP members and stream their
|
|
1131
|
+
* responses.
|
|
1132
|
+
*
|
|
1133
|
+
* Semantically equivalent to `call_multicast_stream_unary` at the
|
|
1134
|
+
* transport level; the difference (one vs many responses per member) is
|
|
1135
|
+
* determined by the server handler.
|
|
1136
|
+
*/
|
|
1137
|
+
callMulticastStreamStream(serviceName: string, methodName: string, timeout: number | undefined, metadata: Map<string, string> | undefined): MulticastBidiStreamHandlerLike;
|
|
1138
|
+
/**
|
|
1139
|
+
* Broadcast a request stream to all GROUP members and collect their
|
|
1140
|
+
* responses.
|
|
1141
|
+
*
|
|
1142
|
+
* Returns a handler that lets you send requests and receive responses
|
|
1143
|
+
* concurrently. Use `send` / `send_async` to push request messages,
|
|
1144
|
+
* `close_send` / `close_send_async` to signal end-of-requests, and
|
|
1145
|
+
* `recv` / `recv_async` to pull response items.
|
|
1146
|
+
*/
|
|
1147
|
+
callMulticastStreamUnary(serviceName: string, methodName: string, timeout: number | undefined, metadata: Map<string, string> | undefined): MulticastBidiStreamHandlerLike;
|
|
1148
|
+
/**
|
|
1149
|
+
* Broadcast one request to all GROUP members and collect their responses.
|
|
1150
|
+
*
|
|
1151
|
+
* Returns a reader from which each member's response (wrapped in
|
|
1152
|
+
* `MulticastStreamMessage`) can be pulled one at a time (blocking).
|
|
1153
|
+
*/
|
|
1154
|
+
callMulticastUnary(serviceName: string, methodName: string, request: ArrayBuffer, timeout: number | undefined, metadata: Map<string, string> | undefined): MulticastResponseReaderLike;
|
|
1155
|
+
/**
|
|
1156
|
+
* Broadcast one request to all GROUP members and collect their responses
|
|
1157
|
+
* (async).
|
|
1158
|
+
*/
|
|
1159
|
+
callMulticastUnaryAsync(serviceName: string, methodName: string, request: ArrayBuffer, timeout: number | undefined, metadata: Map<string, string> | undefined, asyncOpts_?: {
|
|
1160
|
+
signal: AbortSignal;
|
|
1161
|
+
}): Promise<MulticastResponseReaderLike>;
|
|
1162
|
+
/**
|
|
1163
|
+
* Broadcast one request to all GROUP members and stream their responses
|
|
1164
|
+
* (blocking).
|
|
1165
|
+
*
|
|
1166
|
+
* Semantically identical to `call_multicast_unary` at the transport level;
|
|
1167
|
+
* the difference is that each member may send multiple responses before its
|
|
1168
|
+
* EOS, which the server handler determines.
|
|
1169
|
+
*/
|
|
1170
|
+
callMulticastUnaryStream(serviceName: string, methodName: string, request: ArrayBuffer, timeout: number | undefined, metadata: Map<string, string> | undefined): MulticastResponseReaderLike;
|
|
1171
|
+
/**
|
|
1172
|
+
* Broadcast one request to all GROUP members and stream their responses
|
|
1173
|
+
* (async).
|
|
1174
|
+
*/
|
|
1175
|
+
callMulticastUnaryStreamAsync(serviceName: string, methodName: string, request: ArrayBuffer, timeout: number | undefined, metadata: Map<string, string> | undefined, asyncOpts_?: {
|
|
1176
|
+
signal: AbortSignal;
|
|
1177
|
+
}): Promise<MulticastResponseReaderLike>;
|
|
1178
|
+
callStreamStream(serviceName: string, methodName: string, timeout: number | undefined, metadata: Map<string, string> | undefined): BidiStreamHandlerLike;
|
|
1179
|
+
callStreamUnary(serviceName: string, methodName: string, timeout: number | undefined, metadata: Map<string, string> | undefined): RequestStreamWriterLike;
|
|
1180
|
+
callUnary(serviceName: string, methodName: string, request: ArrayBuffer, timeout: number | undefined, metadata: Map<string, string> | undefined): ArrayBuffer;
|
|
1181
|
+
callUnaryAsync(serviceName: string, methodName: string, request: ArrayBuffer, timeout: number | undefined, metadata: Map<string, string> | undefined, asyncOpts_?: {
|
|
1182
|
+
signal: AbortSignal;
|
|
1183
|
+
}): Promise<ArrayBuffer>;
|
|
1184
|
+
callUnaryStream(serviceName: string, methodName: string, request: ArrayBuffer, timeout: number | undefined, metadata: Map<string, string> | undefined): ResponseStreamReaderLike;
|
|
1185
|
+
callUnaryStreamAsync(serviceName: string, methodName: string, request: ArrayBuffer, timeout: number | undefined, metadata: Map<string, string> | undefined, asyncOpts_?: {
|
|
1186
|
+
signal: AbortSignal;
|
|
1187
|
+
}): Promise<ResponseStreamReaderLike>;
|
|
1188
|
+
/**
|
|
1189
|
+
* Async FFI wrapper for [`Channel::close`].
|
|
1190
|
+
*/
|
|
1191
|
+
closeAsync(timeout: number | undefined, asyncOpts_?: {
|
|
1192
|
+
signal: AbortSignal;
|
|
1193
|
+
}): Promise<void>;
|
|
1194
|
+
/**
|
|
1195
|
+
* Blocking FFI wrapper for [`Channel::close`].
|
|
1196
|
+
*/
|
|
1197
|
+
closeBlocking(timeout: number | undefined): void;
|
|
1198
|
+
uniffiDestroy(): void;
|
|
1199
|
+
static instanceOf(obj_: any): obj_ is Channel;
|
|
1200
|
+
}
|
|
1201
|
+
/**
|
|
1202
|
+
* Context passed to RPC handlers
|
|
1203
|
+
*
|
|
1204
|
+
* Contains all contextual information about an RPC call including:
|
|
1205
|
+
* - Session information (source, destination, session ID)
|
|
1206
|
+
* - Metadata (key-value pairs)
|
|
1207
|
+
* - Deadline/timeout information
|
|
1208
|
+
* - Message routing details
|
|
1209
|
+
*/
|
|
1210
|
+
export interface ContextLike {
|
|
1211
|
+
/**
|
|
1212
|
+
* Get the deadline for this RPC call
|
|
1213
|
+
*/
|
|
1214
|
+
deadline(): Date;
|
|
1215
|
+
/**
|
|
1216
|
+
* Check if the deadline has been exceeded
|
|
1217
|
+
*/
|
|
1218
|
+
isDeadlineExceeded(): boolean;
|
|
1219
|
+
/**
|
|
1220
|
+
* Get the rpc session metadata
|
|
1221
|
+
*/
|
|
1222
|
+
metadata(): Map<string, string>;
|
|
1223
|
+
/**
|
|
1224
|
+
* Get the remaining time until deadline
|
|
1225
|
+
*
|
|
1226
|
+
* Returns Duration::ZERO if the deadline has already passed
|
|
1227
|
+
*/
|
|
1228
|
+
remainingTime(): number;
|
|
1229
|
+
/**
|
|
1230
|
+
* Get the session ID
|
|
1231
|
+
*/
|
|
1232
|
+
sessionId(): string;
|
|
1233
|
+
}
|
|
1234
|
+
/**
|
|
1235
|
+
* @deprecated Use `ContextLike` instead.
|
|
1236
|
+
*/
|
|
1237
|
+
export type ContextInterface = ContextLike;
|
|
1238
|
+
/**
|
|
1239
|
+
* Context passed to RPC handlers
|
|
1240
|
+
*
|
|
1241
|
+
* Contains all contextual information about an RPC call including:
|
|
1242
|
+
* - Session information (source, destination, session ID)
|
|
1243
|
+
* - Metadata (key-value pairs)
|
|
1244
|
+
* - Deadline/timeout information
|
|
1245
|
+
* - Message routing details
|
|
1246
|
+
*/
|
|
1247
|
+
export declare class Context extends UniffiAbstractObject implements ContextLike {
|
|
1248
|
+
readonly [uniffiTypeNameSymbol] = "Context";
|
|
1249
|
+
readonly [destructorGuardSymbol]: UniffiGcObject;
|
|
1250
|
+
readonly [pointerLiteralSymbol]: UniffiHandle;
|
|
1251
|
+
private constructor();
|
|
1252
|
+
/**
|
|
1253
|
+
* Get the deadline for this RPC call
|
|
1254
|
+
*/
|
|
1255
|
+
deadline(): Date;
|
|
1256
|
+
/**
|
|
1257
|
+
* Check if the deadline has been exceeded
|
|
1258
|
+
*/
|
|
1259
|
+
isDeadlineExceeded(): boolean;
|
|
1260
|
+
/**
|
|
1261
|
+
* Get the rpc session metadata
|
|
1262
|
+
*/
|
|
1263
|
+
metadata(): Map<string, string>;
|
|
1264
|
+
/**
|
|
1265
|
+
* Get the remaining time until deadline
|
|
1266
|
+
*
|
|
1267
|
+
* Returns Duration::ZERO if the deadline has already passed
|
|
1268
|
+
*/
|
|
1269
|
+
remainingTime(): number;
|
|
1270
|
+
/**
|
|
1271
|
+
* Get the session ID
|
|
1272
|
+
*/
|
|
1273
|
+
sessionId(): string;
|
|
1274
|
+
uniffiDestroy(): void;
|
|
1275
|
+
static instanceOf(obj_: any): obj_ is Context;
|
|
1276
|
+
}
|
|
1277
|
+
/**
|
|
1278
|
+
* Request stream reader
|
|
1279
|
+
*
|
|
1280
|
+
* Allows pulling messages from a client request stream.
|
|
1281
|
+
* This wraps the underlying async stream and provides a blocking interface
|
|
1282
|
+
* suitable for UniFFI callback traits.
|
|
1283
|
+
*/
|
|
1284
|
+
export interface RequestStreamLike {
|
|
1285
|
+
/**
|
|
1286
|
+
* Pull the next message from the stream (blocking version)
|
|
1287
|
+
*
|
|
1288
|
+
* Returns a StreamMessage indicating the result
|
|
1289
|
+
*/
|
|
1290
|
+
next(): StreamMessage;
|
|
1291
|
+
/**
|
|
1292
|
+
* Pull the next message from the stream (async version)
|
|
1293
|
+
*
|
|
1294
|
+
* Returns a StreamMessage indicating the result
|
|
1295
|
+
*/
|
|
1296
|
+
nextAsync(asyncOpts_?: {
|
|
1297
|
+
signal: AbortSignal;
|
|
1298
|
+
}): Promise<StreamMessage>;
|
|
1299
|
+
}
|
|
1300
|
+
/**
|
|
1301
|
+
* @deprecated Use `RequestStreamLike` instead.
|
|
1302
|
+
*/
|
|
1303
|
+
export type RequestStreamInterface = RequestStreamLike;
|
|
1304
|
+
/**
|
|
1305
|
+
* Request stream reader
|
|
1306
|
+
*
|
|
1307
|
+
* Allows pulling messages from a client request stream.
|
|
1308
|
+
* This wraps the underlying async stream and provides a blocking interface
|
|
1309
|
+
* suitable for UniFFI callback traits.
|
|
1310
|
+
*/
|
|
1311
|
+
export declare class RequestStream extends UniffiAbstractObject implements RequestStreamLike {
|
|
1312
|
+
readonly [uniffiTypeNameSymbol] = "RequestStream";
|
|
1313
|
+
readonly [destructorGuardSymbol]: UniffiGcObject;
|
|
1314
|
+
readonly [pointerLiteralSymbol]: UniffiHandle;
|
|
1315
|
+
private constructor();
|
|
1316
|
+
/**
|
|
1317
|
+
* Pull the next message from the stream (blocking version)
|
|
1318
|
+
*
|
|
1319
|
+
* Returns a StreamMessage indicating the result
|
|
1320
|
+
*/
|
|
1321
|
+
next(): StreamMessage;
|
|
1322
|
+
/**
|
|
1323
|
+
* Pull the next message from the stream (async version)
|
|
1324
|
+
*
|
|
1325
|
+
* Returns a StreamMessage indicating the result
|
|
1326
|
+
*/
|
|
1327
|
+
nextAsync(asyncOpts_?: {
|
|
1328
|
+
signal: AbortSignal;
|
|
1329
|
+
}): Promise<StreamMessage>;
|
|
1330
|
+
uniffiDestroy(): void;
|
|
1331
|
+
static instanceOf(obj_: any): obj_ is RequestStream;
|
|
1332
|
+
}
|
|
1333
|
+
/**
|
|
1334
|
+
* Response stream writer
|
|
1335
|
+
*
|
|
1336
|
+
* Allows pushing messages to a client response stream.
|
|
1337
|
+
* This wraps an async channel sender and provides a blocking interface
|
|
1338
|
+
* suitable for UniFFI callback traits.
|
|
1339
|
+
*/
|
|
1340
|
+
export interface ResponseSinkLike {
|
|
1341
|
+
/**
|
|
1342
|
+
* Close the response stream (blocking version)
|
|
1343
|
+
*
|
|
1344
|
+
* Signals that no more messages will be sent.
|
|
1345
|
+
* The stream will end gracefully.
|
|
1346
|
+
*/
|
|
1347
|
+
close(): void;
|
|
1348
|
+
/**
|
|
1349
|
+
* Close the response stream (async version)
|
|
1350
|
+
*
|
|
1351
|
+
* Signals that no more messages will be sent.
|
|
1352
|
+
* The stream will end gracefully.
|
|
1353
|
+
*/
|
|
1354
|
+
closeAsync(asyncOpts_?: {
|
|
1355
|
+
signal: AbortSignal;
|
|
1356
|
+
}): Promise<void>;
|
|
1357
|
+
/**
|
|
1358
|
+
* Check if the sink has been closed (blocking version)
|
|
1359
|
+
*/
|
|
1360
|
+
isClosed(): boolean;
|
|
1361
|
+
/**
|
|
1362
|
+
* Check if the sink has been closed (async version)
|
|
1363
|
+
*/
|
|
1364
|
+
isClosedAsync(asyncOpts_?: {
|
|
1365
|
+
signal: AbortSignal;
|
|
1366
|
+
}): Promise<boolean>;
|
|
1367
|
+
/**
|
|
1368
|
+
* Send a message to the response stream (blocking version)
|
|
1369
|
+
*
|
|
1370
|
+
* Returns an error if the stream has been closed or if sending fails.
|
|
1371
|
+
*/
|
|
1372
|
+
send(data: ArrayBuffer): void;
|
|
1373
|
+
/**
|
|
1374
|
+
* Send a message to the response stream (async version)
|
|
1375
|
+
*
|
|
1376
|
+
* Returns an error if the stream has been closed or if sending fails.
|
|
1377
|
+
*/
|
|
1378
|
+
sendAsync(data: ArrayBuffer, asyncOpts_?: {
|
|
1379
|
+
signal: AbortSignal;
|
|
1380
|
+
}): Promise<void>;
|
|
1381
|
+
/**
|
|
1382
|
+
* Send an error to the response stream and close it (blocking version)
|
|
1383
|
+
*
|
|
1384
|
+
* This terminates the stream with an error status.
|
|
1385
|
+
*/
|
|
1386
|
+
sendError(error: RpcError): void;
|
|
1387
|
+
/**
|
|
1388
|
+
* Send an error to the response stream and close it (async version)
|
|
1389
|
+
*
|
|
1390
|
+
* This terminates the stream with an error status.
|
|
1391
|
+
*/
|
|
1392
|
+
sendErrorAsync(error: RpcError, asyncOpts_?: {
|
|
1393
|
+
signal: AbortSignal;
|
|
1394
|
+
}): Promise<void>;
|
|
1395
|
+
}
|
|
1396
|
+
/**
|
|
1397
|
+
* @deprecated Use `ResponseSinkLike` instead.
|
|
1398
|
+
*/
|
|
1399
|
+
export type ResponseSinkInterface = ResponseSinkLike;
|
|
1400
|
+
/**
|
|
1401
|
+
* Response stream writer
|
|
1402
|
+
*
|
|
1403
|
+
* Allows pushing messages to a client response stream.
|
|
1404
|
+
* This wraps an async channel sender and provides a blocking interface
|
|
1405
|
+
* suitable for UniFFI callback traits.
|
|
1406
|
+
*/
|
|
1407
|
+
export declare class ResponseSink extends UniffiAbstractObject implements ResponseSinkLike {
|
|
1408
|
+
readonly [uniffiTypeNameSymbol] = "ResponseSink";
|
|
1409
|
+
readonly [destructorGuardSymbol]: UniffiGcObject;
|
|
1410
|
+
readonly [pointerLiteralSymbol]: UniffiHandle;
|
|
1411
|
+
private constructor();
|
|
1412
|
+
/**
|
|
1413
|
+
* Close the response stream (blocking version)
|
|
1414
|
+
*
|
|
1415
|
+
* Signals that no more messages will be sent.
|
|
1416
|
+
* The stream will end gracefully.
|
|
1417
|
+
*/
|
|
1418
|
+
close(): void;
|
|
1419
|
+
/**
|
|
1420
|
+
* Close the response stream (async version)
|
|
1421
|
+
*
|
|
1422
|
+
* Signals that no more messages will be sent.
|
|
1423
|
+
* The stream will end gracefully.
|
|
1424
|
+
*/
|
|
1425
|
+
closeAsync(asyncOpts_?: {
|
|
1426
|
+
signal: AbortSignal;
|
|
1427
|
+
}): Promise<void>;
|
|
1428
|
+
/**
|
|
1429
|
+
* Check if the sink has been closed (blocking version)
|
|
1430
|
+
*/
|
|
1431
|
+
isClosed(): boolean;
|
|
1432
|
+
/**
|
|
1433
|
+
* Check if the sink has been closed (async version)
|
|
1434
|
+
*/
|
|
1435
|
+
isClosedAsync(asyncOpts_?: {
|
|
1436
|
+
signal: AbortSignal;
|
|
1437
|
+
}): Promise<boolean>;
|
|
1438
|
+
/**
|
|
1439
|
+
* Send a message to the response stream (blocking version)
|
|
1440
|
+
*
|
|
1441
|
+
* Returns an error if the stream has been closed or if sending fails.
|
|
1442
|
+
*/
|
|
1443
|
+
send(data: ArrayBuffer): void;
|
|
1444
|
+
/**
|
|
1445
|
+
* Send a message to the response stream (async version)
|
|
1446
|
+
*
|
|
1447
|
+
* Returns an error if the stream has been closed or if sending fails.
|
|
1448
|
+
*/
|
|
1449
|
+
sendAsync(data: ArrayBuffer, asyncOpts_?: {
|
|
1450
|
+
signal: AbortSignal;
|
|
1451
|
+
}): Promise<void>;
|
|
1452
|
+
/**
|
|
1453
|
+
* Send an error to the response stream and close it (blocking version)
|
|
1454
|
+
*
|
|
1455
|
+
* This terminates the stream with an error status.
|
|
1456
|
+
*/
|
|
1457
|
+
sendError(error: RpcError): void;
|
|
1458
|
+
/**
|
|
1459
|
+
* Send an error to the response stream and close it (async version)
|
|
1460
|
+
*
|
|
1461
|
+
* This terminates the stream with an error status.
|
|
1462
|
+
*/
|
|
1463
|
+
sendErrorAsync(error: RpcError, asyncOpts_?: {
|
|
1464
|
+
signal: AbortSignal;
|
|
1465
|
+
}): Promise<void>;
|
|
1466
|
+
uniffiDestroy(): void;
|
|
1467
|
+
static instanceOf(obj_: any): obj_ is ResponseSink;
|
|
1468
|
+
}
|
|
1469
|
+
/**
|
|
1470
|
+
* Stream-to-Stream RPC handler trait
|
|
1471
|
+
*
|
|
1472
|
+
* Implement this trait to handle stream-to-stream RPC calls.
|
|
1473
|
+
* The handler receives multiple requests via the stream and sends multiple responses via the sink.
|
|
1474
|
+
*/
|
|
1475
|
+
export interface StreamStreamHandler {
|
|
1476
|
+
/**
|
|
1477
|
+
* Handle a stream-to-stream RPC call
|
|
1478
|
+
*
|
|
1479
|
+
* # Arguments
|
|
1480
|
+
* * `stream` - Request stream to pull messages from
|
|
1481
|
+
* * `context` - RPC context with metadata and session information
|
|
1482
|
+
* * `sink` - Response sink to send streaming responses
|
|
1483
|
+
*
|
|
1484
|
+
* # Returns
|
|
1485
|
+
* Ok(()) if handling succeeded, or an error
|
|
1486
|
+
*
|
|
1487
|
+
* # Note
|
|
1488
|
+
* You must call `sink.close()` or `sink.send_error()` when done.
|
|
1489
|
+
*/
|
|
1490
|
+
handle(stream: RequestStreamLike, context: ContextLike, sink: ResponseSinkLike, asyncOpts_?: {
|
|
1491
|
+
signal: AbortSignal;
|
|
1492
|
+
}): Promise<void>;
|
|
1493
|
+
}
|
|
1494
|
+
/**
|
|
1495
|
+
* Stream-to-Stream RPC handler trait
|
|
1496
|
+
*
|
|
1497
|
+
* Implement this trait to handle stream-to-stream RPC calls.
|
|
1498
|
+
* The handler receives multiple requests via the stream and sends multiple responses via the sink.
|
|
1499
|
+
*/
|
|
1500
|
+
export declare class StreamStreamHandlerImpl extends UniffiAbstractObject implements StreamStreamHandler {
|
|
1501
|
+
readonly [uniffiTypeNameSymbol] = "StreamStreamHandlerImpl";
|
|
1502
|
+
readonly [destructorGuardSymbol]: UniffiGcObject;
|
|
1503
|
+
readonly [pointerLiteralSymbol]: UniffiHandle;
|
|
1504
|
+
private constructor();
|
|
1505
|
+
/**
|
|
1506
|
+
* Handle a stream-to-stream RPC call
|
|
1507
|
+
*
|
|
1508
|
+
* # Arguments
|
|
1509
|
+
* * `stream` - Request stream to pull messages from
|
|
1510
|
+
* * `context` - RPC context with metadata and session information
|
|
1511
|
+
* * `sink` - Response sink to send streaming responses
|
|
1512
|
+
*
|
|
1513
|
+
* # Returns
|
|
1514
|
+
* Ok(()) if handling succeeded, or an error
|
|
1515
|
+
*
|
|
1516
|
+
* # Note
|
|
1517
|
+
* You must call `sink.close()` or `sink.send_error()` when done.
|
|
1518
|
+
*/
|
|
1519
|
+
handle(stream: RequestStreamLike, context: ContextLike, sink: ResponseSinkLike, asyncOpts_?: {
|
|
1520
|
+
signal: AbortSignal;
|
|
1521
|
+
}): Promise<void>;
|
|
1522
|
+
uniffiDestroy(): void;
|
|
1523
|
+
static instanceOf(obj_: any): obj_ is StreamStreamHandlerImpl;
|
|
1524
|
+
}
|
|
1525
|
+
/**
|
|
1526
|
+
* Stream-to-Unary RPC handler trait
|
|
1527
|
+
*
|
|
1528
|
+
* Implement this trait to handle stream-to-unary RPC calls.
|
|
1529
|
+
* The handler receives multiple requests via the stream and returns a single response.
|
|
1530
|
+
*/
|
|
1531
|
+
export interface StreamUnaryHandler {
|
|
1532
|
+
/**
|
|
1533
|
+
* Handle a stream-to-unary RPC call
|
|
1534
|
+
*
|
|
1535
|
+
* # Arguments
|
|
1536
|
+
* * `stream` - Request stream to pull messages from
|
|
1537
|
+
* * `context` - RPC context with metadata and session information
|
|
1538
|
+
*
|
|
1539
|
+
* # Returns
|
|
1540
|
+
* The response message bytes or an error
|
|
1541
|
+
*/
|
|
1542
|
+
handle(stream: RequestStreamLike, context: ContextLike, asyncOpts_?: {
|
|
1543
|
+
signal: AbortSignal;
|
|
1544
|
+
}): Promise<ArrayBuffer>;
|
|
1545
|
+
}
|
|
1546
|
+
/**
|
|
1547
|
+
* Stream-to-Unary RPC handler trait
|
|
1548
|
+
*
|
|
1549
|
+
* Implement this trait to handle stream-to-unary RPC calls.
|
|
1550
|
+
* The handler receives multiple requests via the stream and returns a single response.
|
|
1551
|
+
*/
|
|
1552
|
+
export declare class StreamUnaryHandlerImpl extends UniffiAbstractObject implements StreamUnaryHandler {
|
|
1553
|
+
readonly [uniffiTypeNameSymbol] = "StreamUnaryHandlerImpl";
|
|
1554
|
+
readonly [destructorGuardSymbol]: UniffiGcObject;
|
|
1555
|
+
readonly [pointerLiteralSymbol]: UniffiHandle;
|
|
1556
|
+
private constructor();
|
|
1557
|
+
/**
|
|
1558
|
+
* Handle a stream-to-unary RPC call
|
|
1559
|
+
*
|
|
1560
|
+
* # Arguments
|
|
1561
|
+
* * `stream` - Request stream to pull messages from
|
|
1562
|
+
* * `context` - RPC context with metadata and session information
|
|
1563
|
+
*
|
|
1564
|
+
* # Returns
|
|
1565
|
+
* The response message bytes or an error
|
|
1566
|
+
*/
|
|
1567
|
+
handle(stream: RequestStreamLike, context: ContextLike, asyncOpts_?: {
|
|
1568
|
+
signal: AbortSignal;
|
|
1569
|
+
}): Promise<ArrayBuffer>;
|
|
1570
|
+
uniffiDestroy(): void;
|
|
1571
|
+
static instanceOf(obj_: any): obj_ is StreamUnaryHandlerImpl;
|
|
1572
|
+
}
|
|
1573
|
+
/**
|
|
1574
|
+
* Unary-to-Stream RPC handler trait
|
|
1575
|
+
*
|
|
1576
|
+
* Implement this trait to handle unary-to-stream RPC calls.
|
|
1577
|
+
* The handler receives a single request and sends multiple responses via the sink.
|
|
1578
|
+
*/
|
|
1579
|
+
export interface UnaryStreamHandler {
|
|
1580
|
+
/**
|
|
1581
|
+
* Handle a unary-to-stream RPC call
|
|
1582
|
+
*
|
|
1583
|
+
* # Arguments
|
|
1584
|
+
* * `request` - The request message bytes
|
|
1585
|
+
* * `context` - RPC context with metadata and session information
|
|
1586
|
+
* * `sink` - Response sink to send streaming responses
|
|
1587
|
+
*
|
|
1588
|
+
* # Returns
|
|
1589
|
+
* Ok(()) if handling succeeded, or an error
|
|
1590
|
+
*
|
|
1591
|
+
* # Note
|
|
1592
|
+
* You must call `sink.close()` or `sink.send_error()` when done.
|
|
1593
|
+
*/
|
|
1594
|
+
handle(request: ArrayBuffer, context: ContextLike, sink: ResponseSinkLike, asyncOpts_?: {
|
|
1595
|
+
signal: AbortSignal;
|
|
1596
|
+
}): Promise<void>;
|
|
1597
|
+
}
|
|
1598
|
+
/**
|
|
1599
|
+
* Unary-to-Stream RPC handler trait
|
|
1600
|
+
*
|
|
1601
|
+
* Implement this trait to handle unary-to-stream RPC calls.
|
|
1602
|
+
* The handler receives a single request and sends multiple responses via the sink.
|
|
1603
|
+
*/
|
|
1604
|
+
export declare class UnaryStreamHandlerImpl extends UniffiAbstractObject implements UnaryStreamHandler {
|
|
1605
|
+
readonly [uniffiTypeNameSymbol] = "UnaryStreamHandlerImpl";
|
|
1606
|
+
readonly [destructorGuardSymbol]: UniffiGcObject;
|
|
1607
|
+
readonly [pointerLiteralSymbol]: UniffiHandle;
|
|
1608
|
+
private constructor();
|
|
1609
|
+
/**
|
|
1610
|
+
* Handle a unary-to-stream RPC call
|
|
1611
|
+
*
|
|
1612
|
+
* # Arguments
|
|
1613
|
+
* * `request` - The request message bytes
|
|
1614
|
+
* * `context` - RPC context with metadata and session information
|
|
1615
|
+
* * `sink` - Response sink to send streaming responses
|
|
1616
|
+
*
|
|
1617
|
+
* # Returns
|
|
1618
|
+
* Ok(()) if handling succeeded, or an error
|
|
1619
|
+
*
|
|
1620
|
+
* # Note
|
|
1621
|
+
* You must call `sink.close()` or `sink.send_error()` when done.
|
|
1622
|
+
*/
|
|
1623
|
+
handle(request: ArrayBuffer, context: ContextLike, sink: ResponseSinkLike, asyncOpts_?: {
|
|
1624
|
+
signal: AbortSignal;
|
|
1625
|
+
}): Promise<void>;
|
|
1626
|
+
uniffiDestroy(): void;
|
|
1627
|
+
static instanceOf(obj_: any): obj_ is UnaryStreamHandlerImpl;
|
|
1628
|
+
}
|
|
1629
|
+
/**
|
|
1630
|
+
* Unary-to-Unary RPC handler trait
|
|
1631
|
+
*
|
|
1632
|
+
* Implement this trait to handle unary-to-unary RPC calls.
|
|
1633
|
+
* The handler receives a single request and returns a single response.
|
|
1634
|
+
*/
|
|
1635
|
+
export interface UnaryUnaryHandler {
|
|
1636
|
+
/**
|
|
1637
|
+
* Handle a unary-to-unary RPC call
|
|
1638
|
+
*
|
|
1639
|
+
* # Arguments
|
|
1640
|
+
* * `request` - The request message bytes
|
|
1641
|
+
* * `context` - RPC context with metadata and session information
|
|
1642
|
+
*
|
|
1643
|
+
* # Returns
|
|
1644
|
+
* The response message bytes or an error
|
|
1645
|
+
*/
|
|
1646
|
+
handle(request: ArrayBuffer, context: ContextLike, asyncOpts_?: {
|
|
1647
|
+
signal: AbortSignal;
|
|
1648
|
+
}): Promise<ArrayBuffer>;
|
|
1649
|
+
}
|
|
1650
|
+
/**
|
|
1651
|
+
* Unary-to-Unary RPC handler trait
|
|
1652
|
+
*
|
|
1653
|
+
* Implement this trait to handle unary-to-unary RPC calls.
|
|
1654
|
+
* The handler receives a single request and returns a single response.
|
|
1655
|
+
*/
|
|
1656
|
+
export declare class UnaryUnaryHandlerImpl extends UniffiAbstractObject implements UnaryUnaryHandler {
|
|
1657
|
+
readonly [uniffiTypeNameSymbol] = "UnaryUnaryHandlerImpl";
|
|
1658
|
+
readonly [destructorGuardSymbol]: UniffiGcObject;
|
|
1659
|
+
readonly [pointerLiteralSymbol]: UniffiHandle;
|
|
1660
|
+
private constructor();
|
|
1661
|
+
/**
|
|
1662
|
+
* Handle a unary-to-unary RPC call
|
|
1663
|
+
*
|
|
1664
|
+
* # Arguments
|
|
1665
|
+
* * `request` - The request message bytes
|
|
1666
|
+
* * `context` - RPC context with metadata and session information
|
|
1667
|
+
*
|
|
1668
|
+
* # Returns
|
|
1669
|
+
* The response message bytes or an error
|
|
1670
|
+
*/
|
|
1671
|
+
handle(request: ArrayBuffer, context: ContextLike, asyncOpts_?: {
|
|
1672
|
+
signal: AbortSignal;
|
|
1673
|
+
}): Promise<ArrayBuffer>;
|
|
1674
|
+
uniffiDestroy(): void;
|
|
1675
|
+
static instanceOf(obj_: any): obj_ is UnaryUnaryHandlerImpl;
|
|
1676
|
+
}
|
|
1677
|
+
/**
|
|
1678
|
+
* RPC Server
|
|
1679
|
+
*
|
|
1680
|
+
* Handles incoming RPC requests by creating sessions and dispatching
|
|
1681
|
+
* to registered service handlers.
|
|
1682
|
+
*
|
|
1683
|
+
* # Example
|
|
1684
|
+
*
|
|
1685
|
+
* ```ignore
|
|
1686
|
+
* # use slim_bindings::{Server, Context, RpcError, Decoder, Encoder, App, Name};
|
|
1687
|
+
* # use std::sync::Arc;
|
|
1688
|
+
* # fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|
1689
|
+
* # use slim_bindings::{IdentityProviderConfig, IdentityVerifierConfig};
|
|
1690
|
+
* # let app_name = Arc::new(Name::new("test".to_string(), "app".to_string(), "v1".to_string()));
|
|
1691
|
+
* # let provider = IdentityProviderConfig::SharedSecret { id: "test".to_string(), data: "secret".to_string() };
|
|
1692
|
+
* # let verifier = IdentityVerifierConfig::SharedSecret { id: "test".to_string(), data: "secret".to_string() };
|
|
1693
|
+
* # let app = App::new(app_name, provider, verifier)?;
|
|
1694
|
+
* # let core_app = app.inner();
|
|
1695
|
+
* # let notification_rx = app.notification_receiver();
|
|
1696
|
+
* # #[derive(Default)]
|
|
1697
|
+
* # struct Request {}
|
|
1698
|
+
* # impl Decoder for Request {
|
|
1699
|
+
* # fn decode(_buf: impl Into<Vec<u8>>) -> Result<Self, RpcError> { Ok(Request::default()) }
|
|
1700
|
+
* # }
|
|
1701
|
+
* # #[derive(Default)]
|
|
1702
|
+
* # struct Response {}
|
|
1703
|
+
* # impl Encoder for Response {
|
|
1704
|
+
* # fn encode(self) -> Result<Vec<u8>, RpcError> { Ok(vec![]) }
|
|
1705
|
+
* # }
|
|
1706
|
+
* let base_name = Name::new("org".to_string(), "namespace".to_string(), "service".to_string());
|
|
1707
|
+
* let server = Server::new_with_shared_rx_and_connection(core_app, base_name.as_slim_name(), None, notification_rx, None);
|
|
1708
|
+
*
|
|
1709
|
+
* // Register handlers
|
|
1710
|
+
* server.register_unary_unary_internal(
|
|
1711
|
+
* "MyService",
|
|
1712
|
+
* "MyMethod",
|
|
1713
|
+
* |request: Request, _ctx: Context| async move {
|
|
1714
|
+
* Ok(Response::default())
|
|
1715
|
+
* }
|
|
1716
|
+
* );
|
|
1717
|
+
* # Ok(())
|
|
1718
|
+
* # }
|
|
1719
|
+
* ```
|
|
1720
|
+
*/
|
|
1721
|
+
export interface ServerLike {
|
|
1722
|
+
registerStreamStream(serviceName: string, methodName: string, handler: StreamStreamHandler): void;
|
|
1723
|
+
registerStreamUnary(serviceName: string, methodName: string, handler: StreamUnaryHandler): void;
|
|
1724
|
+
registerUnaryStream(serviceName: string, methodName: string, handler: UnaryStreamHandler): void;
|
|
1725
|
+
registerUnaryUnary(serviceName: string, methodName: string, handler: UnaryUnaryHandler): void;
|
|
1726
|
+
/**
|
|
1727
|
+
* Async FFI wrapper for [`Server::serve`].
|
|
1728
|
+
*/
|
|
1729
|
+
serveAsync(asyncOpts_?: {
|
|
1730
|
+
signal: AbortSignal;
|
|
1731
|
+
}): Promise<void>;
|
|
1732
|
+
/**
|
|
1733
|
+
* Blocking FFI wrapper for [`Server::serve`].
|
|
1734
|
+
*/
|
|
1735
|
+
serveBlocking(): void;
|
|
1736
|
+
/**
|
|
1737
|
+
* Async FFI wrapper for [`Server::shutdown`].
|
|
1738
|
+
*/
|
|
1739
|
+
shutdownAsync(asyncOpts_?: {
|
|
1740
|
+
signal: AbortSignal;
|
|
1741
|
+
}): Promise<void>;
|
|
1742
|
+
/**
|
|
1743
|
+
* Blocking FFI wrapper for [`Server::shutdown`].
|
|
1744
|
+
*/
|
|
1745
|
+
shutdownBlocking(): void;
|
|
1746
|
+
}
|
|
1747
|
+
/**
|
|
1748
|
+
* @deprecated Use `ServerLike` instead.
|
|
1749
|
+
*/
|
|
1750
|
+
export type ServerInterface = ServerLike;
|
|
1751
|
+
/**
|
|
1752
|
+
* RPC Server
|
|
1753
|
+
*
|
|
1754
|
+
* Handles incoming RPC requests by creating sessions and dispatching
|
|
1755
|
+
* to registered service handlers.
|
|
1756
|
+
*
|
|
1757
|
+
* # Example
|
|
1758
|
+
*
|
|
1759
|
+
* ```ignore
|
|
1760
|
+
* # use slim_bindings::{Server, Context, RpcError, Decoder, Encoder, App, Name};
|
|
1761
|
+
* # use std::sync::Arc;
|
|
1762
|
+
* # fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|
1763
|
+
* # use slim_bindings::{IdentityProviderConfig, IdentityVerifierConfig};
|
|
1764
|
+
* # let app_name = Arc::new(Name::new("test".to_string(), "app".to_string(), "v1".to_string()));
|
|
1765
|
+
* # let provider = IdentityProviderConfig::SharedSecret { id: "test".to_string(), data: "secret".to_string() };
|
|
1766
|
+
* # let verifier = IdentityVerifierConfig::SharedSecret { id: "test".to_string(), data: "secret".to_string() };
|
|
1767
|
+
* # let app = App::new(app_name, provider, verifier)?;
|
|
1768
|
+
* # let core_app = app.inner();
|
|
1769
|
+
* # let notification_rx = app.notification_receiver();
|
|
1770
|
+
* # #[derive(Default)]
|
|
1771
|
+
* # struct Request {}
|
|
1772
|
+
* # impl Decoder for Request {
|
|
1773
|
+
* # fn decode(_buf: impl Into<Vec<u8>>) -> Result<Self, RpcError> { Ok(Request::default()) }
|
|
1774
|
+
* # }
|
|
1775
|
+
* # #[derive(Default)]
|
|
1776
|
+
* # struct Response {}
|
|
1777
|
+
* # impl Encoder for Response {
|
|
1778
|
+
* # fn encode(self) -> Result<Vec<u8>, RpcError> { Ok(vec![]) }
|
|
1779
|
+
* # }
|
|
1780
|
+
* let base_name = Name::new("org".to_string(), "namespace".to_string(), "service".to_string());
|
|
1781
|
+
* let server = Server::new_with_shared_rx_and_connection(core_app, base_name.as_slim_name(), None, notification_rx, None);
|
|
1782
|
+
*
|
|
1783
|
+
* // Register handlers
|
|
1784
|
+
* server.register_unary_unary_internal(
|
|
1785
|
+
* "MyService",
|
|
1786
|
+
* "MyMethod",
|
|
1787
|
+
* |request: Request, _ctx: Context| async move {
|
|
1788
|
+
* Ok(Response::default())
|
|
1789
|
+
* }
|
|
1790
|
+
* );
|
|
1791
|
+
* # Ok(())
|
|
1792
|
+
* # }
|
|
1793
|
+
* ```
|
|
1794
|
+
*/
|
|
1795
|
+
export declare class Server extends UniffiAbstractObject implements ServerLike {
|
|
1796
|
+
readonly [uniffiTypeNameSymbol] = "Server";
|
|
1797
|
+
readonly [destructorGuardSymbol]: UniffiGcObject;
|
|
1798
|
+
readonly [pointerLiteralSymbol]: UniffiHandle;
|
|
1799
|
+
/**
|
|
1800
|
+
* Create a new RPC server
|
|
1801
|
+
*
|
|
1802
|
+
* This is the primary constructor for creating an RPC server instance
|
|
1803
|
+
* that can handle incoming RPC requests over SLIM.
|
|
1804
|
+
*
|
|
1805
|
+
* # Arguments
|
|
1806
|
+
* * `app` - The SLIM application instance that provides the underlying
|
|
1807
|
+
* network transport and session management
|
|
1808
|
+
* * `base_name` - The base name for this service (e.g., org.namespace.service).
|
|
1809
|
+
* This name is used to construct subscription names for RPC methods.
|
|
1810
|
+
*
|
|
1811
|
+
* # Returns
|
|
1812
|
+
* A new RPC server instance wrapped in an Arc for shared ownership
|
|
1813
|
+
*/
|
|
1814
|
+
constructor(app: AppLike, baseName: NameLike);
|
|
1815
|
+
/**
|
|
1816
|
+
* Create a new RPC server with optional connection ID
|
|
1817
|
+
*
|
|
1818
|
+
* The connection ID is used to set up routing before serving RPC requests,
|
|
1819
|
+
* enabling multi-hop RPC calls through specific connections.
|
|
1820
|
+
*
|
|
1821
|
+
* # Arguments
|
|
1822
|
+
* * `app` - The SLIM application instance that provides the underlying
|
|
1823
|
+
* network transport and session management
|
|
1824
|
+
* * `base_name` - The base name for this service (e.g., org.namespace.service).
|
|
1825
|
+
* This name is used to construct subscription names for RPC methods.
|
|
1826
|
+
* * `connection_id` - Optional connection ID for routing setup
|
|
1827
|
+
*
|
|
1828
|
+
* # Returns
|
|
1829
|
+
* A new RPC server instance wrapped in an Arc for shared ownership
|
|
1830
|
+
*/
|
|
1831
|
+
static newWithConnection(app: AppLike, baseName: NameLike, connectionId: bigint | undefined): ServerLike;
|
|
1832
|
+
registerStreamStream(serviceName: string, methodName: string, handler: StreamStreamHandler): void;
|
|
1833
|
+
registerStreamUnary(serviceName: string, methodName: string, handler: StreamUnaryHandler): void;
|
|
1834
|
+
registerUnaryStream(serviceName: string, methodName: string, handler: UnaryStreamHandler): void;
|
|
1835
|
+
registerUnaryUnary(serviceName: string, methodName: string, handler: UnaryUnaryHandler): void;
|
|
1836
|
+
/**
|
|
1837
|
+
* Async FFI wrapper for [`Server::serve`].
|
|
1838
|
+
*/
|
|
1839
|
+
serveAsync(asyncOpts_?: {
|
|
1840
|
+
signal: AbortSignal;
|
|
1841
|
+
}): Promise<void>;
|
|
1842
|
+
/**
|
|
1843
|
+
* Blocking FFI wrapper for [`Server::serve`].
|
|
1844
|
+
*/
|
|
1845
|
+
serveBlocking(): void;
|
|
1846
|
+
/**
|
|
1847
|
+
* Async FFI wrapper for [`Server::shutdown`].
|
|
1848
|
+
*/
|
|
1849
|
+
shutdownAsync(asyncOpts_?: {
|
|
1850
|
+
signal: AbortSignal;
|
|
1851
|
+
}): Promise<void>;
|
|
1852
|
+
/**
|
|
1853
|
+
* Blocking FFI wrapper for [`Server::shutdown`].
|
|
1854
|
+
*/
|
|
1855
|
+
shutdownBlocking(): void;
|
|
1856
|
+
uniffiDestroy(): void;
|
|
1857
|
+
static instanceOf(obj_: any): obj_ is Server;
|
|
1858
|
+
}
|
|
1859
|
+
/**
|
|
1860
|
+
* This should be called before anything else.
|
|
1861
|
+
*
|
|
1862
|
+
* It is likely that this is being done for you by the library's `index.ts`.
|
|
1863
|
+
*
|
|
1864
|
+
* It checks versions of uniffi between when the Rust scaffolding was generated
|
|
1865
|
+
* and when the bindings were generated.
|
|
1866
|
+
*
|
|
1867
|
+
* It also initializes the machinery to enable Rust to talk back to Javascript.
|
|
1868
|
+
*/
|
|
1869
|
+
declare function uniffiEnsureInitialized(): void;
|
|
1870
|
+
declare const _default: Readonly<{
|
|
1871
|
+
initialize: typeof uniffiEnsureInitialized;
|
|
1872
|
+
converters: {
|
|
1873
|
+
FfiConverterTypeBidiStreamHandler: FfiConverterObject<BidiStreamHandlerLike>;
|
|
1874
|
+
FfiConverterTypeChannel: FfiConverterObject<ChannelLike>;
|
|
1875
|
+
FfiConverterTypeContext: FfiConverterObject<ContextLike>;
|
|
1876
|
+
FfiConverterTypeMulticastBidiStreamHandler: FfiConverterObject<MulticastBidiStreamHandlerLike>;
|
|
1877
|
+
FfiConverterTypeMulticastResponseReader: FfiConverterObject<MulticastResponseReaderLike>;
|
|
1878
|
+
FfiConverterTypeMulticastStreamMessage: {
|
|
1879
|
+
read(from: RustBuffer): MulticastStreamMessage;
|
|
1880
|
+
write(value: MulticastStreamMessage, into: RustBuffer): void;
|
|
1881
|
+
allocationSize(value: MulticastStreamMessage): number;
|
|
1882
|
+
lift(value: UniffiByteArray): MulticastStreamMessage;
|
|
1883
|
+
lower(value: MulticastStreamMessage, alloc: import("@ubjs/core").RustBufferAllocator): UniffiByteArray;
|
|
1884
|
+
};
|
|
1885
|
+
FfiConverterTypeRequestStream: FfiConverterObject<RequestStreamLike>;
|
|
1886
|
+
FfiConverterTypeRequestStreamWriter: FfiConverterObject<RequestStreamWriterLike>;
|
|
1887
|
+
FfiConverterTypeResponseSink: FfiConverterObject<ResponseSinkLike>;
|
|
1888
|
+
FfiConverterTypeResponseStreamReader: FfiConverterObject<ResponseStreamReaderLike>;
|
|
1889
|
+
FfiConverterTypeRpcCode: {
|
|
1890
|
+
read(from: RustBuffer): RpcCode;
|
|
1891
|
+
write(value: RpcCode, into: RustBuffer): void;
|
|
1892
|
+
allocationSize(value: RpcCode): number;
|
|
1893
|
+
lift(value: UniffiByteArray): RpcCode;
|
|
1894
|
+
lower(value: RpcCode, alloc: import("@ubjs/core").RustBufferAllocator): UniffiByteArray;
|
|
1895
|
+
};
|
|
1896
|
+
FfiConverterTypeRpcError: {
|
|
1897
|
+
read(from: RustBuffer): RpcError;
|
|
1898
|
+
write(value: RpcError, into: RustBuffer): void;
|
|
1899
|
+
allocationSize(value: RpcError): number;
|
|
1900
|
+
lift(value: UniffiByteArray): RpcError;
|
|
1901
|
+
lower(value: RpcError, alloc: import("@ubjs/core").RustBufferAllocator): UniffiByteArray;
|
|
1902
|
+
};
|
|
1903
|
+
FfiConverterTypeRpcMessageContext: {
|
|
1904
|
+
read(from: RustBuffer): RpcMessageContext;
|
|
1905
|
+
write(value: RpcMessageContext, into: RustBuffer): void;
|
|
1906
|
+
allocationSize(value: RpcMessageContext): number;
|
|
1907
|
+
lift(value: UniffiByteArray): RpcMessageContext;
|
|
1908
|
+
lower(value: RpcMessageContext, alloc: import("@ubjs/core").RustBufferAllocator): UniffiByteArray;
|
|
1909
|
+
};
|
|
1910
|
+
FfiConverterTypeRpcMulticastItem: {
|
|
1911
|
+
read(from: RustBuffer): RpcMulticastItem;
|
|
1912
|
+
write(value: RpcMulticastItem, into: RustBuffer): void;
|
|
1913
|
+
allocationSize(value: RpcMulticastItem): number;
|
|
1914
|
+
lift(value: UniffiByteArray): RpcMulticastItem;
|
|
1915
|
+
lower(value: RpcMulticastItem, alloc: import("@ubjs/core").RustBufferAllocator): UniffiByteArray;
|
|
1916
|
+
};
|
|
1917
|
+
FfiConverterTypeServer: FfiConverterObject<ServerLike>;
|
|
1918
|
+
FfiConverterTypeStreamMessage: {
|
|
1919
|
+
read(from: RustBuffer): StreamMessage;
|
|
1920
|
+
write(value: StreamMessage, into: RustBuffer): void;
|
|
1921
|
+
allocationSize(value: StreamMessage): number;
|
|
1922
|
+
lift(value: UniffiByteArray): StreamMessage;
|
|
1923
|
+
lower(value: StreamMessage, alloc: import("@ubjs/core").RustBufferAllocator): UniffiByteArray;
|
|
1924
|
+
};
|
|
1925
|
+
FfiConverterTypeStreamStreamHandler: FfiConverterObjectWithCallbacks<StreamStreamHandler>;
|
|
1926
|
+
FfiConverterTypeStreamUnaryHandler: FfiConverterObjectWithCallbacks<StreamUnaryHandler>;
|
|
1927
|
+
FfiConverterTypeUnaryStreamHandler: FfiConverterObjectWithCallbacks<UnaryStreamHandler>;
|
|
1928
|
+
FfiConverterTypeUnaryUnaryHandler: FfiConverterObjectWithCallbacks<UnaryUnaryHandler>;
|
|
1929
|
+
};
|
|
1930
|
+
}>;
|
|
1931
|
+
export default _default;
|