@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.
@@ -1,4 +1,4 @@
1
- import { type UniffiByteArray, type UniffiGcObject, type UniffiHandle, FfiConverterObject, FfiConverterObjectWithCallbacks, RustBuffer, UniffiAbstractObject, destructorGuardSymbol, pointerLiteralSymbol, uniffiTypeNameSymbol } from "@ubjs/core";
1
+ import { type UniffiByteArray, type UniffiGcObject, type UniffiHandle, FfiConverterObject, RustBuffer, UniffiAbstractObject, destructorGuardSymbol, pointerLiteralSymbol, uniffiTypeNameSymbol } from "@ubjs/core";
2
2
  /**
3
3
  * Create a new Service with builder pattern
4
4
  */
@@ -1422,8 +1422,8 @@ export type ClientConfig = {
1422
1422
  * Generated factory for {@link ClientConfig} record objects.
1423
1423
  */
1424
1424
  export declare const ClientConfig: Readonly<{
1425
- create: (partial: Partial<ClientConfig> & Required<Omit<ClientConfig, "origin" | "tls" | "headers" | "endpoint" | "serverName" | "compression" | "rateLimit" | "keepalive" | "proxy" | "connectTimeout" | "requestTimeout" | "bufferSize" | "auth" | "backoff" | "metadata" | "requireHeaderMac">>) => ClientConfig;
1426
- new: (partial: Partial<ClientConfig> & Required<Omit<ClientConfig, "origin" | "tls" | "headers" | "endpoint" | "serverName" | "compression" | "rateLimit" | "keepalive" | "proxy" | "connectTimeout" | "requestTimeout" | "bufferSize" | "auth" | "backoff" | "metadata" | "requireHeaderMac">>) => ClientConfig;
1425
+ create: (partial: Partial<ClientConfig> & Required<Omit<ClientConfig, "tls" | "headers" | "endpoint" | "origin" | "serverName" | "compression" | "rateLimit" | "keepalive" | "proxy" | "connectTimeout" | "requestTimeout" | "bufferSize" | "auth" | "backoff" | "metadata" | "requireHeaderMac">>) => ClientConfig;
1426
+ new: (partial: Partial<ClientConfig> & Required<Omit<ClientConfig, "tls" | "headers" | "endpoint" | "origin" | "serverName" | "compression" | "rateLimit" | "keepalive" | "proxy" | "connectTimeout" | "requestTimeout" | "bufferSize" | "auth" | "backoff" | "metadata" | "requireHeaderMac">>) => ClientConfig;
1427
1427
  defaults: () => Partial<ClientConfig>;
1428
1428
  }>;
1429
1429
  /**
@@ -1904,46 +1904,6 @@ export declare const ReceivedMessage: Readonly<{
1904
1904
  new: (partial: Partial<ReceivedMessage> & Required<Omit<ReceivedMessage, "context" | "payload">>) => ReceivedMessage;
1905
1905
  defaults: () => Partial<ReceivedMessage>;
1906
1906
  }>;
1907
- /**
1908
- * Per-message context for a multicast RPC response — identifies which group
1909
- * member sent the response.
1910
- */
1911
- export type RpcMessageContext = {
1912
- /**
1913
- * The SLIM name of the group member that sent this response.
1914
- */
1915
- source: NameLike;
1916
- };
1917
- /**
1918
- * Generated factory for {@link RpcMessageContext} record objects.
1919
- */
1920
- export declare const RpcMessageContext: Readonly<{
1921
- create: (partial: Partial<RpcMessageContext> & Required<Omit<RpcMessageContext, "source">>) => RpcMessageContext;
1922
- new: (partial: Partial<RpcMessageContext> & Required<Omit<RpcMessageContext, "source">>) => RpcMessageContext;
1923
- defaults: () => Partial<RpcMessageContext>;
1924
- }>;
1925
- /**
1926
- * A single item in a multicast response stream, pairing the response payload
1927
- * with the identity of the member that produced it.
1928
- */
1929
- export type RpcMulticastItem = {
1930
- /**
1931
- * Context identifying the source member.
1932
- */
1933
- context: RpcMessageContext;
1934
- /**
1935
- * The encoded response payload (raw bytes).
1936
- */
1937
- message: ArrayBuffer;
1938
- };
1939
- /**
1940
- * Generated factory for {@link RpcMulticastItem} record objects.
1941
- */
1942
- export declare const RpcMulticastItem: Readonly<{
1943
- create: (partial: Partial<RpcMulticastItem> & Required<Omit<RpcMulticastItem, "message" | "context">>) => RpcMulticastItem;
1944
- new: (partial: Partial<RpcMulticastItem> & Required<Omit<RpcMulticastItem, "message" | "context">>) => RpcMulticastItem;
1945
- defaults: () => Partial<RpcMulticastItem>;
1946
- }>;
1947
1907
  /**
1948
1908
  * Runtime configuration for the SLIM bindings
1949
1909
  *
@@ -3911,2249 +3871,331 @@ export declare const IdentityVerifierConfig: Readonly<{
3911
3871
  */
3912
3872
  export type IdentityVerifierConfig = InstanceType<typeof IdentityVerifierConfig['SharedSecret' | 'Jwt' | 'Spire' | 'None']>;
3913
3873
  /**
3914
- * gRPC status codes
3874
+ * Transport protocol for dataplane communication.
3875
+ */
3876
+ export declare enum TransportProtocol {
3877
+ Grpc = 0,
3878
+ Websocket = 1
3879
+ }
3880
+ /**
3881
+ * Adapter that bridges the App API with language-bindings interface
3882
+ *
3883
+ * This adapter uses enum-based auth types (`AuthProvider`/`AuthVerifier`) instead of generics
3884
+ * to be compatible with UniFFI, supporting multiple authentication mechanisms (SharedSecret,
3885
+ * JWT, SPIRE, StaticToken). It provides both synchronous (blocking) and asynchronous methods
3886
+ * for flexibility.
3915
3887
  */
3916
- export declare enum RpcCode {
3888
+ export interface AppLike {
3917
3889
  /**
3918
- * Success
3890
+ * Create a new session (blocking version for FFI)
3891
+ *
3892
+ * Returns a SessionWithCompletion containing the session context and a completion handle.
3893
+ * Call `.wait()` on the completion handle to wait for session establishment.
3894
+ */
3895
+ createSession(config: SessionConfig, destination: NameLike): SessionWithCompletion;
3896
+ /**
3897
+ * Create a new session and wait for completion (blocking version)
3898
+ *
3899
+ * This method creates a session and blocks until the session establishment completes.
3900
+ * Returns only the session context, as the completion has already been awaited.
3901
+ */
3902
+ createSessionAndWait(config: SessionConfig, destination: NameLike): SessionLike;
3903
+ /**
3904
+ * Create a new session and wait for completion (async version)
3905
+ *
3906
+ * This method creates a session and waits until the session establishment completes.
3907
+ * Returns only the session context, as the completion has already been awaited.
3908
+ */
3909
+ createSessionAndWaitAsync(config: SessionConfig, destination: NameLike, asyncOpts_?: {
3910
+ signal: AbortSignal;
3911
+ }): Promise<SessionLike>;
3912
+ /**
3913
+ * Create a new session (async version)
3914
+ *
3915
+ * Returns a SessionWithCompletion containing the session context and a completion handle.
3916
+ * Await the completion handle to wait for session establishment.
3917
+ * For point-to-point sessions, this ensures the remote peer has acknowledged the session.
3918
+ * For multicast sessions, this ensures the initial setup is complete.
3919
3919
  */
3920
- Ok = 0,
3920
+ createSessionAsync(config: SessionConfig, destination: NameLike, asyncOpts_?: {
3921
+ signal: AbortSignal;
3922
+ }): Promise<SessionWithCompletion>;
3921
3923
  /**
3922
- * The operation was cancelled
3924
+ * Delete a session (blocking version for FFI)
3925
+ *
3926
+ * Returns a completion handle that can be awaited to ensure the deletion completes.
3923
3927
  */
3924
- Cancelled = 1,
3928
+ deleteSession(session: SessionLike): CompletionHandleLike;
3925
3929
  /**
3926
- * Unknown error
3930
+ * Delete a session and wait for completion (blocking version)
3931
+ *
3932
+ * This method deletes a session and blocks until the deletion completes.
3927
3933
  */
3928
- Unknown = 2,
3934
+ deleteSessionAndWait(session: SessionLike): void;
3929
3935
  /**
3930
- * Client specified an invalid argument
3936
+ * Delete a session and wait for completion (async version)
3937
+ *
3938
+ * This method deletes a session and waits until the deletion completes.
3931
3939
  */
3932
- InvalidArgument = 3,
3940
+ deleteSessionAndWaitAsync(session: SessionLike, asyncOpts_?: {
3941
+ signal: AbortSignal;
3942
+ }): Promise<void>;
3933
3943
  /**
3934
- * Deadline exceeded before operation could complete
3944
+ * Delete a session (async version)
3945
+ *
3946
+ * Returns a completion handle that can be awaited to ensure the deletion completes.
3935
3947
  */
3936
- DeadlineExceeded = 4,
3948
+ deleteSessionAsync(session: SessionLike, asyncOpts_?: {
3949
+ signal: AbortSignal;
3950
+ }): Promise<CompletionHandleLike>;
3937
3951
  /**
3938
- * Some requested entity was not found
3952
+ * Get the app ID in UUID format
3939
3953
  */
3940
- NotFound = 5,
3954
+ id(): string;
3941
3955
  /**
3942
- * Some entity that we attempted to create already exists
3956
+ * Listen for incoming sessions (blocking version for FFI)
3943
3957
  */
3944
- AlreadyExists = 6,
3958
+ listenForSession(timeout: number | undefined): SessionLike;
3945
3959
  /**
3946
- * The caller does not have permission to execute the specified operation
3960
+ * Listen for incoming sessions (async version)
3947
3961
  */
3948
- PermissionDenied = 7,
3962
+ listenForSessionAsync(timeout: number | undefined, asyncOpts_?: {
3963
+ signal: AbortSignal;
3964
+ }): Promise<SessionLike>;
3949
3965
  /**
3950
- * Some resource has been exhausted
3966
+ * Get the app name
3951
3967
  */
3952
- ResourceExhausted = 8,
3968
+ name(): NameLike;
3953
3969
  /**
3954
- * The system is not in a state required for the operation's execution
3970
+ * Remove a route (blocking version for FFI)
3955
3971
  */
3956
- FailedPrecondition = 9,
3972
+ removeRoute(name: NameLike, connectionId: bigint): void;
3957
3973
  /**
3958
- * The operation was aborted
3974
+ * Remove a route (async version)
3959
3975
  */
3960
- Aborted = 10,
3976
+ removeRouteAsync(name: NameLike, connectionId: bigint, asyncOpts_?: {
3977
+ signal: AbortSignal;
3978
+ }): Promise<void>;
3961
3979
  /**
3962
- * Operation was attempted past the valid range
3980
+ * Set a route to a name for a specific connection (blocking version for FFI)
3963
3981
  */
3964
- OutOfRange = 11,
3982
+ setRoute(name: NameLike, connectionId: bigint): void;
3965
3983
  /**
3966
- * Operation is not implemented or not supported
3984
+ * Set a route to a name for a specific connection (async version)
3967
3985
  */
3968
- Unimplemented = 12,
3986
+ setRouteAsync(name: NameLike, connectionId: bigint, asyncOpts_?: {
3987
+ signal: AbortSignal;
3988
+ }): Promise<void>;
3969
3989
  /**
3970
- * Internal errors
3990
+ * Subscribe to a session name (blocking version for FFI)
3971
3991
  */
3972
- Internal = 13,
3992
+ subscribe(name: NameLike, connectionId: bigint | undefined): void;
3973
3993
  /**
3974
- * The service is currently unavailable
3994
+ * Subscribe to a name (async version)
3975
3995
  */
3976
- Unavailable = 14,
3996
+ subscribeAsync(name: NameLike, connectionId: bigint | undefined, asyncOpts_?: {
3997
+ signal: AbortSignal;
3998
+ }): Promise<void>;
3977
3999
  /**
3978
- * Unrecoverable data loss or corruption
4000
+ * Unsubscribe from a name (blocking version for FFI)
3979
4001
  */
3980
- DataLoss = 15,
4002
+ unsubscribe(name: NameLike, connectionId: bigint | undefined): void;
3981
4003
  /**
3982
- * The request does not have valid authentication credentials
4004
+ * Unsubscribe from a name (async version)
3983
4005
  */
3984
- Unauthenticated = 16
3985
- }
3986
- export declare enum RpcError_Tags {
3987
- Rpc = "Rpc",
3988
- MulticastRpc = "MulticastRpc",
3989
- MulticastSessionClosed = "MulticastSessionClosed"
4006
+ unsubscribeAsync(name: NameLike, connectionId: bigint | undefined, asyncOpts_?: {
4007
+ signal: AbortSignal;
4008
+ }): Promise<void>;
3990
4009
  }
3991
4010
  /**
3992
- * UniFFI-compatible RPC error
4011
+ * @deprecated Use `AppLike` instead.
4012
+ */
4013
+ export type AppInterface = AppLike;
4014
+ /**
4015
+ * Adapter that bridges the App API with language-bindings interface
3993
4016
  *
3994
- * This represents RPC errors with gRPC-compatible status codes.
4017
+ * This adapter uses enum-based auth types (`AuthProvider`/`AuthVerifier`) instead of generics
4018
+ * to be compatible with UniFFI, supporting multiple authentication mechanisms (SharedSecret,
4019
+ * JWT, SPIRE, StaticToken). It provides both synchronous (blocking) and asynchronous methods
4020
+ * for flexibility.
3995
4021
  */
3996
- export declare const RpcError: Readonly<{
3997
- instanceOf: (obj: any) => obj is RpcError;
3998
- Rpc: {
3999
- new (inner: {
4000
- code: RpcCode;
4001
- message: string;
4002
- details?: ArrayBuffer;
4003
- }): {
4004
- readonly tag: RpcError_Tags.Rpc;
4005
- readonly inner: Readonly<{
4006
- code: RpcCode;
4007
- message: string;
4008
- details?: ArrayBuffer;
4009
- }>;
4010
- /**
4011
- * @private
4012
- * This field is private and should not be used, use `tag` instead.
4013
- */
4014
- readonly [uniffiTypeNameSymbol]: "RpcError";
4015
- name: string;
4016
- message: string;
4017
- stack?: string;
4018
- };
4019
- "new"(inner: {
4020
- code: RpcCode;
4021
- message: string;
4022
- details?: ArrayBuffer;
4023
- }): {
4024
- readonly tag: RpcError_Tags.Rpc;
4025
- readonly inner: Readonly<{
4026
- code: RpcCode;
4027
- message: string;
4028
- details?: ArrayBuffer;
4029
- }>;
4030
- /**
4031
- * @private
4032
- * This field is private and should not be used, use `tag` instead.
4033
- */
4034
- readonly [uniffiTypeNameSymbol]: "RpcError";
4035
- name: string;
4036
- message: string;
4037
- stack?: string;
4038
- };
4039
- instanceOf(obj: any): obj is {
4040
- readonly tag: RpcError_Tags.Rpc;
4041
- readonly inner: Readonly<{
4042
- code: RpcCode;
4043
- message: string;
4044
- details?: ArrayBuffer;
4045
- }>;
4046
- /**
4047
- * @private
4048
- * This field is private and should not be used, use `tag` instead.
4049
- */
4050
- readonly [uniffiTypeNameSymbol]: "RpcError";
4051
- name: string;
4052
- message: string;
4053
- stack?: string;
4054
- };
4055
- hasInner(obj: any): obj is {
4056
- readonly tag: RpcError_Tags.Rpc;
4057
- readonly inner: Readonly<{
4058
- code: RpcCode;
4059
- message: string;
4060
- details?: ArrayBuffer;
4061
- }>;
4062
- /**
4063
- * @private
4064
- * This field is private and should not be used, use `tag` instead.
4065
- */
4066
- readonly [uniffiTypeNameSymbol]: "RpcError";
4067
- name: string;
4068
- message: string;
4069
- stack?: string;
4070
- };
4071
- getInner(obj: {
4072
- readonly tag: RpcError_Tags.Rpc;
4073
- readonly inner: Readonly<{
4074
- code: RpcCode;
4075
- message: string;
4076
- details?: ArrayBuffer;
4077
- }>;
4078
- /**
4079
- * @private
4080
- * This field is private and should not be used, use `tag` instead.
4081
- */
4082
- readonly [uniffiTypeNameSymbol]: "RpcError";
4083
- name: string;
4084
- message: string;
4085
- stack?: string;
4086
- }): Readonly<{
4087
- code: RpcCode;
4088
- message: string;
4089
- details?: ArrayBuffer;
4090
- }>;
4091
- captureStackTrace(targetObject: object, constructorOpt?: Function): void;
4092
- prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;
4093
- stackTraceLimit: number;
4094
- };
4095
- MulticastRpc: {
4096
- new (inner: {
4097
- origin: string;
4098
- code: RpcCode;
4099
- message: string;
4100
- details?: ArrayBuffer;
4101
- }): {
4102
- readonly tag: RpcError_Tags.MulticastRpc;
4103
- readonly inner: Readonly<{
4104
- origin: string;
4105
- code: RpcCode;
4106
- message: string;
4107
- details?: ArrayBuffer;
4108
- }>;
4109
- /**
4110
- * @private
4111
- * This field is private and should not be used, use `tag` instead.
4112
- */
4113
- readonly [uniffiTypeNameSymbol]: "RpcError";
4114
- name: string;
4115
- message: string;
4116
- stack?: string;
4117
- };
4118
- "new"(inner: {
4119
- origin: string;
4120
- code: RpcCode;
4121
- message: string;
4122
- details?: ArrayBuffer;
4123
- }): {
4124
- readonly tag: RpcError_Tags.MulticastRpc;
4125
- readonly inner: Readonly<{
4126
- origin: string;
4127
- code: RpcCode;
4128
- message: string;
4129
- details?: ArrayBuffer;
4130
- }>;
4131
- /**
4132
- * @private
4133
- * This field is private and should not be used, use `tag` instead.
4134
- */
4135
- readonly [uniffiTypeNameSymbol]: "RpcError";
4136
- name: string;
4137
- message: string;
4138
- stack?: string;
4139
- };
4140
- instanceOf(obj: any): obj is {
4141
- readonly tag: RpcError_Tags.MulticastRpc;
4142
- readonly inner: Readonly<{
4143
- origin: string;
4144
- code: RpcCode;
4145
- message: string;
4146
- details?: ArrayBuffer;
4147
- }>;
4148
- /**
4149
- * @private
4150
- * This field is private and should not be used, use `tag` instead.
4151
- */
4152
- readonly [uniffiTypeNameSymbol]: "RpcError";
4153
- name: string;
4154
- message: string;
4155
- stack?: string;
4156
- };
4157
- hasInner(obj: any): obj is {
4158
- readonly tag: RpcError_Tags.MulticastRpc;
4159
- readonly inner: Readonly<{
4160
- origin: string;
4161
- code: RpcCode;
4162
- message: string;
4163
- details?: ArrayBuffer;
4164
- }>;
4165
- /**
4166
- * @private
4167
- * This field is private and should not be used, use `tag` instead.
4168
- */
4169
- readonly [uniffiTypeNameSymbol]: "RpcError";
4170
- name: string;
4171
- message: string;
4172
- stack?: string;
4173
- };
4174
- getInner(obj: {
4175
- readonly tag: RpcError_Tags.MulticastRpc;
4176
- readonly inner: Readonly<{
4177
- origin: string;
4178
- code: RpcCode;
4179
- message: string;
4180
- details?: ArrayBuffer;
4181
- }>;
4182
- /**
4183
- * @private
4184
- * This field is private and should not be used, use `tag` instead.
4185
- */
4186
- readonly [uniffiTypeNameSymbol]: "RpcError";
4187
- name: string;
4188
- message: string;
4189
- stack?: string;
4190
- }): Readonly<{
4191
- origin: string;
4192
- code: RpcCode;
4193
- message: string;
4194
- details?: ArrayBuffer;
4195
- }>;
4196
- captureStackTrace(targetObject: object, constructorOpt?: Function): void;
4197
- prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;
4198
- stackTraceLimit: number;
4199
- };
4200
- MulticastSessionClosed: {
4201
- new (inner: {
4202
- completed: bigint;
4203
- total: bigint;
4204
- received: Array<string>;
4205
- missing: Array<string>;
4206
- }): {
4207
- readonly tag: RpcError_Tags.MulticastSessionClosed;
4208
- readonly inner: Readonly<{
4209
- completed: bigint;
4210
- total: bigint;
4211
- received: Array<string>;
4212
- missing: Array<string>;
4213
- }>;
4214
- /**
4215
- * @private
4216
- * This field is private and should not be used, use `tag` instead.
4217
- */
4218
- readonly [uniffiTypeNameSymbol]: "RpcError";
4219
- name: string;
4220
- message: string;
4221
- stack?: string;
4222
- };
4223
- "new"(inner: {
4224
- completed: bigint;
4225
- total: bigint;
4226
- received: Array<string>;
4227
- missing: Array<string>;
4228
- }): {
4229
- readonly tag: RpcError_Tags.MulticastSessionClosed;
4230
- readonly inner: Readonly<{
4231
- completed: bigint;
4232
- total: bigint;
4233
- received: Array<string>;
4234
- missing: Array<string>;
4235
- }>;
4236
- /**
4237
- * @private
4238
- * This field is private and should not be used, use `tag` instead.
4239
- */
4240
- readonly [uniffiTypeNameSymbol]: "RpcError";
4241
- name: string;
4242
- message: string;
4243
- stack?: string;
4244
- };
4245
- instanceOf(obj: any): obj is {
4246
- readonly tag: RpcError_Tags.MulticastSessionClosed;
4247
- readonly inner: Readonly<{
4248
- completed: bigint;
4249
- total: bigint;
4250
- received: Array<string>;
4251
- missing: Array<string>;
4252
- }>;
4253
- /**
4254
- * @private
4255
- * This field is private and should not be used, use `tag` instead.
4256
- */
4257
- readonly [uniffiTypeNameSymbol]: "RpcError";
4258
- name: string;
4259
- message: string;
4260
- stack?: string;
4261
- };
4262
- hasInner(obj: any): obj is {
4263
- readonly tag: RpcError_Tags.MulticastSessionClosed;
4264
- readonly inner: Readonly<{
4265
- completed: bigint;
4266
- total: bigint;
4267
- received: Array<string>;
4268
- missing: Array<string>;
4269
- }>;
4270
- /**
4271
- * @private
4272
- * This field is private and should not be used, use `tag` instead.
4273
- */
4274
- readonly [uniffiTypeNameSymbol]: "RpcError";
4275
- name: string;
4276
- message: string;
4277
- stack?: string;
4278
- };
4279
- getInner(obj: {
4280
- readonly tag: RpcError_Tags.MulticastSessionClosed;
4281
- readonly inner: Readonly<{
4282
- completed: bigint;
4283
- total: bigint;
4284
- received: Array<string>;
4285
- missing: Array<string>;
4286
- }>;
4287
- /**
4288
- * @private
4289
- * This field is private and should not be used, use `tag` instead.
4290
- */
4291
- readonly [uniffiTypeNameSymbol]: "RpcError";
4292
- name: string;
4293
- message: string;
4294
- stack?: string;
4295
- }): Readonly<{
4296
- completed: bigint;
4297
- total: bigint;
4298
- received: Array<string>;
4299
- missing: Array<string>;
4300
- }>;
4301
- captureStackTrace(targetObject: object, constructorOpt?: Function): void;
4302
- prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;
4303
- stackTraceLimit: number;
4304
- };
4305
- }>;
4306
- /**
4307
- * UniFFI-compatible RPC error
4308
- *
4309
- * This represents RPC errors with gRPC-compatible status codes.
4310
- */
4311
- export type RpcError = InstanceType<typeof RpcError['Rpc' | 'MulticastRpc' | 'MulticastSessionClosed']>;
4312
- export declare enum MulticastStreamMessage_Tags {
4313
- Data = "Data",
4314
- Error = "Error",
4315
- End = "End"
4316
- }
4317
- /**
4318
- * Message from a multicast response stream.
4319
- */
4320
- export declare const MulticastStreamMessage: Readonly<{
4321
- instanceOf: (obj: any) => obj is MulticastStreamMessage;
4322
- Data: {
4323
- new (inner: {
4324
- item: RpcMulticastItem;
4325
- }): {
4326
- readonly tag: MulticastStreamMessage_Tags.Data;
4327
- readonly inner: Readonly<{
4328
- item: RpcMulticastItem;
4329
- }>;
4330
- /**
4331
- * @private
4332
- * This field is private and should not be used, use `tag` instead.
4333
- */
4334
- readonly [uniffiTypeNameSymbol]: "MulticastStreamMessage";
4335
- };
4336
- "new"(inner: {
4337
- item: RpcMulticastItem;
4338
- }): {
4339
- readonly tag: MulticastStreamMessage_Tags.Data;
4340
- readonly inner: Readonly<{
4341
- item: RpcMulticastItem;
4342
- }>;
4343
- /**
4344
- * @private
4345
- * This field is private and should not be used, use `tag` instead.
4346
- */
4347
- readonly [uniffiTypeNameSymbol]: "MulticastStreamMessage";
4348
- };
4349
- instanceOf(obj: any): obj is {
4350
- readonly tag: MulticastStreamMessage_Tags.Data;
4351
- readonly inner: Readonly<{
4352
- item: RpcMulticastItem;
4353
- }>;
4354
- /**
4355
- * @private
4356
- * This field is private and should not be used, use `tag` instead.
4357
- */
4358
- readonly [uniffiTypeNameSymbol]: "MulticastStreamMessage";
4359
- };
4360
- };
4361
- Error: {
4362
- new (inner: {
4363
- error: RpcError;
4364
- }): {
4365
- readonly tag: MulticastStreamMessage_Tags.Error;
4366
- readonly inner: Readonly<{
4367
- error: RpcError;
4368
- }>;
4369
- /**
4370
- * @private
4371
- * This field is private and should not be used, use `tag` instead.
4372
- */
4373
- readonly [uniffiTypeNameSymbol]: "MulticastStreamMessage";
4374
- };
4375
- "new"(inner: {
4376
- error: RpcError;
4377
- }): {
4378
- readonly tag: MulticastStreamMessage_Tags.Error;
4379
- readonly inner: Readonly<{
4380
- error: RpcError;
4381
- }>;
4382
- /**
4383
- * @private
4384
- * This field is private and should not be used, use `tag` instead.
4385
- */
4386
- readonly [uniffiTypeNameSymbol]: "MulticastStreamMessage";
4387
- };
4388
- instanceOf(obj: any): obj is {
4389
- readonly tag: MulticastStreamMessage_Tags.Error;
4390
- readonly inner: Readonly<{
4391
- error: RpcError;
4392
- }>;
4393
- /**
4394
- * @private
4395
- * This field is private and should not be used, use `tag` instead.
4396
- */
4397
- readonly [uniffiTypeNameSymbol]: "MulticastStreamMessage";
4398
- };
4399
- };
4400
- End: {
4401
- new (): {
4402
- readonly tag: MulticastStreamMessage_Tags.End;
4403
- /**
4404
- * @private
4405
- * This field is private and should not be used, use `tag` instead.
4406
- */
4407
- readonly [uniffiTypeNameSymbol]: "MulticastStreamMessage";
4408
- };
4409
- "new"(): {
4410
- readonly tag: MulticastStreamMessage_Tags.End;
4411
- /**
4412
- * @private
4413
- * This field is private and should not be used, use `tag` instead.
4414
- */
4415
- readonly [uniffiTypeNameSymbol]: "MulticastStreamMessage";
4416
- };
4417
- instanceOf(obj: any): obj is {
4418
- readonly tag: MulticastStreamMessage_Tags.End;
4419
- /**
4420
- * @private
4421
- * This field is private and should not be used, use `tag` instead.
4422
- */
4423
- readonly [uniffiTypeNameSymbol]: "MulticastStreamMessage";
4424
- };
4425
- };
4426
- }>;
4427
- /**
4428
- * Message from a multicast response stream.
4429
- */
4430
- export type MulticastStreamMessage = InstanceType<typeof MulticastStreamMessage['Data' | 'Error' | 'End']>;
4431
- export declare enum StreamMessage_Tags {
4432
- Data = "Data",
4433
- Error = "Error",
4434
- End = "End"
4435
- }
4436
- /**
4437
- * Message from a stream
4438
- */
4439
- export declare const StreamMessage: Readonly<{
4440
- instanceOf: (obj: any) => obj is StreamMessage;
4441
- Data: {
4442
- new (v0: ArrayBuffer): {
4443
- readonly tag: StreamMessage_Tags.Data;
4444
- readonly inner: Readonly<[ArrayBuffer]>;
4445
- /**
4446
- * @private
4447
- * This field is private and should not be used, use `tag` instead.
4448
- */
4449
- readonly [uniffiTypeNameSymbol]: "StreamMessage";
4450
- };
4451
- "new"(v0: ArrayBuffer): {
4452
- readonly tag: StreamMessage_Tags.Data;
4453
- readonly inner: Readonly<[ArrayBuffer]>;
4454
- /**
4455
- * @private
4456
- * This field is private and should not be used, use `tag` instead.
4457
- */
4458
- readonly [uniffiTypeNameSymbol]: "StreamMessage";
4459
- };
4460
- instanceOf(obj: any): obj is {
4461
- readonly tag: StreamMessage_Tags.Data;
4462
- readonly inner: Readonly<[ArrayBuffer]>;
4463
- /**
4464
- * @private
4465
- * This field is private and should not be used, use `tag` instead.
4466
- */
4467
- readonly [uniffiTypeNameSymbol]: "StreamMessage";
4468
- };
4469
- };
4470
- Error: {
4471
- new (v0: RpcError): {
4472
- readonly tag: StreamMessage_Tags.Error;
4473
- readonly inner: Readonly<[RpcError]>;
4474
- /**
4475
- * @private
4476
- * This field is private and should not be used, use `tag` instead.
4477
- */
4478
- readonly [uniffiTypeNameSymbol]: "StreamMessage";
4479
- };
4480
- "new"(v0: RpcError): {
4481
- readonly tag: StreamMessage_Tags.Error;
4482
- readonly inner: Readonly<[RpcError]>;
4483
- /**
4484
- * @private
4485
- * This field is private and should not be used, use `tag` instead.
4486
- */
4487
- readonly [uniffiTypeNameSymbol]: "StreamMessage";
4488
- };
4489
- instanceOf(obj: any): obj is {
4490
- readonly tag: StreamMessage_Tags.Error;
4491
- readonly inner: Readonly<[RpcError]>;
4492
- /**
4493
- * @private
4494
- * This field is private and should not be used, use `tag` instead.
4495
- */
4496
- readonly [uniffiTypeNameSymbol]: "StreamMessage";
4497
- };
4498
- };
4499
- End: {
4500
- new (): {
4501
- readonly tag: StreamMessage_Tags.End;
4502
- /**
4503
- * @private
4504
- * This field is private and should not be used, use `tag` instead.
4505
- */
4506
- readonly [uniffiTypeNameSymbol]: "StreamMessage";
4507
- };
4508
- "new"(): {
4509
- readonly tag: StreamMessage_Tags.End;
4510
- /**
4511
- * @private
4512
- * This field is private and should not be used, use `tag` instead.
4513
- */
4514
- readonly [uniffiTypeNameSymbol]: "StreamMessage";
4515
- };
4516
- instanceOf(obj: any): obj is {
4517
- readonly tag: StreamMessage_Tags.End;
4518
- /**
4519
- * @private
4520
- * This field is private and should not be used, use `tag` instead.
4521
- */
4522
- readonly [uniffiTypeNameSymbol]: "StreamMessage";
4523
- };
4524
- };
4525
- }>;
4526
- /**
4527
- * Message from a stream
4528
- */
4529
- export type StreamMessage = InstanceType<typeof StreamMessage['Data' | 'Error' | 'End']>;
4530
- /**
4531
- * Transport protocol for dataplane communication.
4532
- */
4533
- export declare enum TransportProtocol {
4534
- Grpc = 0,
4535
- Websocket = 1
4536
- }
4537
- /**
4538
- * Adapter that bridges the App API with language-bindings interface
4539
- *
4540
- * This adapter uses enum-based auth types (`AuthProvider`/`AuthVerifier`) instead of generics
4541
- * to be compatible with UniFFI, supporting multiple authentication mechanisms (SharedSecret,
4542
- * JWT, SPIRE, StaticToken). It provides both synchronous (blocking) and asynchronous methods
4543
- * for flexibility.
4544
- */
4545
- export interface AppLike {
4546
- /**
4547
- * Create a new session (blocking version for FFI)
4548
- *
4549
- * Returns a SessionWithCompletion containing the session context and a completion handle.
4550
- * Call `.wait()` on the completion handle to wait for session establishment.
4551
- */
4552
- createSession(config: SessionConfig, destination: NameLike): SessionWithCompletion;
4553
- /**
4554
- * Create a new session and wait for completion (blocking version)
4555
- *
4556
- * This method creates a session and blocks until the session establishment completes.
4557
- * Returns only the session context, as the completion has already been awaited.
4558
- */
4559
- createSessionAndWait(config: SessionConfig, destination: NameLike): SessionLike;
4560
- /**
4561
- * Create a new session and wait for completion (async version)
4562
- *
4563
- * This method creates a session and waits until the session establishment completes.
4564
- * Returns only the session context, as the completion has already been awaited.
4565
- */
4566
- createSessionAndWaitAsync(config: SessionConfig, destination: NameLike, asyncOpts_?: {
4567
- signal: AbortSignal;
4568
- }): Promise<SessionLike>;
4569
- /**
4570
- * Create a new session (async version)
4571
- *
4572
- * Returns a SessionWithCompletion containing the session context and a completion handle.
4573
- * Await the completion handle to wait for session establishment.
4574
- * For point-to-point sessions, this ensures the remote peer has acknowledged the session.
4575
- * For multicast sessions, this ensures the initial setup is complete.
4576
- */
4577
- createSessionAsync(config: SessionConfig, destination: NameLike, asyncOpts_?: {
4578
- signal: AbortSignal;
4579
- }): Promise<SessionWithCompletion>;
4580
- /**
4581
- * Delete a session (blocking version for FFI)
4582
- *
4583
- * Returns a completion handle that can be awaited to ensure the deletion completes.
4584
- */
4585
- deleteSession(session: SessionLike): CompletionHandleLike;
4586
- /**
4587
- * Delete a session and wait for completion (blocking version)
4588
- *
4589
- * This method deletes a session and blocks until the deletion completes.
4590
- */
4591
- deleteSessionAndWait(session: SessionLike): void;
4592
- /**
4593
- * Delete a session and wait for completion (async version)
4594
- *
4595
- * This method deletes a session and waits until the deletion completes.
4596
- */
4597
- deleteSessionAndWaitAsync(session: SessionLike, asyncOpts_?: {
4598
- signal: AbortSignal;
4599
- }): Promise<void>;
4600
- /**
4601
- * Delete a session (async version)
4602
- *
4603
- * Returns a completion handle that can be awaited to ensure the deletion completes.
4604
- */
4605
- deleteSessionAsync(session: SessionLike, asyncOpts_?: {
4606
- signal: AbortSignal;
4607
- }): Promise<CompletionHandleLike>;
4608
- /**
4609
- * Get the app ID in UUID format
4610
- */
4611
- id(): string;
4612
- /**
4613
- * Listen for incoming sessions (blocking version for FFI)
4614
- */
4615
- listenForSession(timeout: number | undefined): SessionLike;
4616
- /**
4617
- * Listen for incoming sessions (async version)
4618
- */
4619
- listenForSessionAsync(timeout: number | undefined, asyncOpts_?: {
4620
- signal: AbortSignal;
4621
- }): Promise<SessionLike>;
4622
- /**
4623
- * Get the app name
4624
- */
4625
- name(): NameLike;
4626
- /**
4627
- * Remove a route (blocking version for FFI)
4628
- */
4629
- removeRoute(name: NameLike, connectionId: bigint): void;
4630
- /**
4631
- * Remove a route (async version)
4632
- */
4633
- removeRouteAsync(name: NameLike, connectionId: bigint, asyncOpts_?: {
4634
- signal: AbortSignal;
4635
- }): Promise<void>;
4636
- /**
4637
- * Set a route to a name for a specific connection (blocking version for FFI)
4638
- */
4639
- setRoute(name: NameLike, connectionId: bigint): void;
4640
- /**
4641
- * Set a route to a name for a specific connection (async version)
4642
- */
4643
- setRouteAsync(name: NameLike, connectionId: bigint, asyncOpts_?: {
4644
- signal: AbortSignal;
4645
- }): Promise<void>;
4646
- /**
4647
- * Subscribe to a session name (blocking version for FFI)
4648
- */
4649
- subscribe(name: NameLike, connectionId: bigint | undefined): void;
4650
- /**
4651
- * Subscribe to a name (async version)
4652
- */
4653
- subscribeAsync(name: NameLike, connectionId: bigint | undefined, asyncOpts_?: {
4654
- signal: AbortSignal;
4655
- }): Promise<void>;
4656
- /**
4657
- * Unsubscribe from a name (blocking version for FFI)
4658
- */
4659
- unsubscribe(name: NameLike, connectionId: bigint | undefined): void;
4660
- /**
4661
- * Unsubscribe from a name (async version)
4662
- */
4663
- unsubscribeAsync(name: NameLike, connectionId: bigint | undefined, asyncOpts_?: {
4664
- signal: AbortSignal;
4665
- }): Promise<void>;
4666
- }
4667
- /**
4668
- * @deprecated Use `AppLike` instead.
4669
- */
4670
- export type AppInterface = AppLike;
4671
- /**
4672
- * Adapter that bridges the App API with language-bindings interface
4673
- *
4674
- * This adapter uses enum-based auth types (`AuthProvider`/`AuthVerifier`) instead of generics
4675
- * to be compatible with UniFFI, supporting multiple authentication mechanisms (SharedSecret,
4676
- * JWT, SPIRE, StaticToken). It provides both synchronous (blocking) and asynchronous methods
4677
- * for flexibility.
4678
- */
4679
- export declare class App extends UniffiAbstractObject implements AppLike {
4680
- readonly [uniffiTypeNameSymbol] = "App";
4681
- readonly [destructorGuardSymbol]: UniffiGcObject;
4682
- readonly [pointerLiteralSymbol]: UniffiHandle;
4683
- /**
4684
- * Create a new App with identity provider and verifier configurations
4685
- *
4686
- * This is the main entry point for creating a SLIM application from language bindings.
4687
- *
4688
- * # Arguments
4689
- * * `base_name` - The base name for the app (without ID)
4690
- * * `identity_provider_config` - Configuration for proving identity to others
4691
- * * `identity_verifier_config` - Configuration for verifying identity of others
4692
- *
4693
- * # Returns
4694
- * * `Ok(Arc<App>)` - Successfully created adapter
4695
- * * `Err(SlimError)` - If adapter creation fails
4696
- *
4697
- * # Supported Identity Types
4698
- * - SharedSecret: Symmetric key authentication
4699
- * - JWT: Dynamic JWT generation/verification with signing/decoding keys
4700
- * - StaticJWT: Static JWT loaded from file with auto-reload
4701
- */
4702
- constructor(baseName: NameLike, identityProviderConfig: IdentityProviderConfig, identityVerifierConfig: IdentityVerifierConfig);
4703
- /**
4704
- * Create a new App with traffic direction (blocking version)
4705
- *
4706
- * This is a convenience function for creating a SLIM application with configurable
4707
- * traffic direction (send-only, receive-only, bidirectional, or none).
4708
- *
4709
- * # Arguments
4710
- * * `name` - The base name for the app (without ID)
4711
- * * `identity_provider_config` - Configuration for proving identity to others
4712
- * * `identity_verifier_config` - Configuration for verifying identity of others
4713
- * * `direction` - Traffic direction for sessions (Send, Recv, Bidirectional, or None)
4714
- *
4715
- * # Returns
4716
- * * `Ok(Arc<App>)` - Successfully created app
4717
- * * `Err(SlimError)` - If app creation fails
4718
- */
4719
- static newWithDirection(name: NameLike, identityProviderConfig: IdentityProviderConfig, identityVerifierConfig: IdentityVerifierConfig, direction: Direction): AppLike;
4720
- /**
4721
- * Create a new App with SharedSecret authentication (blocking version)
4722
- *
4723
- * This is a convenience function for creating a SLIM application using SharedSecret authentication.
4724
- *
4725
- * # Arguments
4726
- * * `name` - The base name for the app (without ID)
4727
- * * `secret` - The shared secret string for authentication
4728
- *
4729
- * # Returns
4730
- * * `Ok(Arc<App>)` - Successfully created adapter
4731
- * * `Err(SlimError)` - If adapter creation fails
4732
- */
4733
- static newWithSecret(name: NameLike, secret: string): AppLike;
4734
- /**
4735
- * Create a new session (blocking version for FFI)
4736
- *
4737
- * Returns a SessionWithCompletion containing the session context and a completion handle.
4738
- * Call `.wait()` on the completion handle to wait for session establishment.
4739
- */
4740
- createSession(config: SessionConfig, destination: NameLike): SessionWithCompletion;
4741
- /**
4742
- * Create a new session and wait for completion (blocking version)
4743
- *
4744
- * This method creates a session and blocks until the session establishment completes.
4745
- * Returns only the session context, as the completion has already been awaited.
4746
- */
4747
- createSessionAndWait(config: SessionConfig, destination: NameLike): SessionLike;
4748
- /**
4749
- * Create a new session and wait for completion (async version)
4750
- *
4751
- * This method creates a session and waits until the session establishment completes.
4752
- * Returns only the session context, as the completion has already been awaited.
4753
- */
4754
- createSessionAndWaitAsync(config: SessionConfig, destination: NameLike, asyncOpts_?: {
4755
- signal: AbortSignal;
4756
- }): Promise<SessionLike>;
4757
- /**
4758
- * Create a new session (async version)
4759
- *
4760
- * Returns a SessionWithCompletion containing the session context and a completion handle.
4761
- * Await the completion handle to wait for session establishment.
4762
- * For point-to-point sessions, this ensures the remote peer has acknowledged the session.
4763
- * For multicast sessions, this ensures the initial setup is complete.
4764
- */
4765
- createSessionAsync(config: SessionConfig, destination: NameLike, asyncOpts_?: {
4766
- signal: AbortSignal;
4767
- }): Promise<SessionWithCompletion>;
4768
- /**
4769
- * Delete a session (blocking version for FFI)
4770
- *
4771
- * Returns a completion handle that can be awaited to ensure the deletion completes.
4772
- */
4773
- deleteSession(session: SessionLike): CompletionHandleLike;
4774
- /**
4775
- * Delete a session and wait for completion (blocking version)
4776
- *
4777
- * This method deletes a session and blocks until the deletion completes.
4778
- */
4779
- deleteSessionAndWait(session: SessionLike): void;
4780
- /**
4781
- * Delete a session and wait for completion (async version)
4782
- *
4783
- * This method deletes a session and waits until the deletion completes.
4784
- */
4785
- deleteSessionAndWaitAsync(session: SessionLike, asyncOpts_?: {
4786
- signal: AbortSignal;
4787
- }): Promise<void>;
4788
- /**
4789
- * Delete a session (async version)
4790
- *
4791
- * Returns a completion handle that can be awaited to ensure the deletion completes.
4792
- */
4793
- deleteSessionAsync(session: SessionLike, asyncOpts_?: {
4794
- signal: AbortSignal;
4795
- }): Promise<CompletionHandleLike>;
4796
- /**
4797
- * Get the app ID in UUID format
4798
- */
4799
- id(): string;
4800
- /**
4801
- * Listen for incoming sessions (blocking version for FFI)
4802
- */
4803
- listenForSession(timeout: number | undefined): SessionLike;
4804
- /**
4805
- * Listen for incoming sessions (async version)
4806
- */
4807
- listenForSessionAsync(timeout: number | undefined, asyncOpts_?: {
4808
- signal: AbortSignal;
4809
- }): Promise<SessionLike>;
4810
- /**
4811
- * Get the app name
4812
- */
4813
- name(): NameLike;
4814
- /**
4815
- * Remove a route (blocking version for FFI)
4816
- */
4817
- removeRoute(name: NameLike, connectionId: bigint): void;
4818
- /**
4819
- * Remove a route (async version)
4820
- */
4821
- removeRouteAsync(name: NameLike, connectionId: bigint, asyncOpts_?: {
4822
- signal: AbortSignal;
4823
- }): Promise<void>;
4824
- /**
4825
- * Set a route to a name for a specific connection (blocking version for FFI)
4826
- */
4827
- setRoute(name: NameLike, connectionId: bigint): void;
4828
- /**
4829
- * Set a route to a name for a specific connection (async version)
4830
- */
4831
- setRouteAsync(name: NameLike, connectionId: bigint, asyncOpts_?: {
4832
- signal: AbortSignal;
4833
- }): Promise<void>;
4834
- /**
4835
- * Subscribe to a session name (blocking version for FFI)
4836
- */
4837
- subscribe(name: NameLike, connectionId: bigint | undefined): void;
4838
- /**
4839
- * Subscribe to a name (async version)
4840
- */
4841
- subscribeAsync(name: NameLike, connectionId: bigint | undefined, asyncOpts_?: {
4842
- signal: AbortSignal;
4843
- }): Promise<void>;
4844
- /**
4845
- * Unsubscribe from a name (blocking version for FFI)
4846
- */
4847
- unsubscribe(name: NameLike, connectionId: bigint | undefined): void;
4848
- /**
4849
- * Unsubscribe from a name (async version)
4850
- */
4851
- unsubscribeAsync(name: NameLike, connectionId: bigint | undefined, asyncOpts_?: {
4852
- signal: AbortSignal;
4853
- }): Promise<void>;
4854
- uniffiDestroy(): void;
4855
- static instanceOf(obj_: any): obj_ is App;
4856
- }
4857
- /**
4858
- * Bidirectional stream handler for stream-to-stream RPC calls
4859
- *
4860
- * Allows sending and receiving messages concurrently.
4861
- */
4862
- export interface BidiStreamHandlerLike {
4863
- /**
4864
- * Close the request stream (no more messages will be sent)
4865
- */
4866
- closeSend(): void;
4867
- /**
4868
- * Close the request stream (async version)
4869
- */
4870
- closeSendAsync(asyncOpts_?: {
4871
- signal: AbortSignal;
4872
- }): Promise<void>;
4873
- /**
4874
- * Receive the next response message (blocking version)
4875
- */
4876
- recv(): StreamMessage;
4877
- /**
4878
- * Receive the next response message (async version)
4879
- */
4880
- recvAsync(asyncOpts_?: {
4881
- signal: AbortSignal;
4882
- }): Promise<StreamMessage>;
4883
- /**
4884
- * Send a request message to the stream (blocking version)
4885
- */
4886
- send(data: ArrayBuffer): void;
4887
- /**
4888
- * Send a request message to the stream (async version)
4889
- */
4890
- sendAsync(data: ArrayBuffer, asyncOpts_?: {
4891
- signal: AbortSignal;
4892
- }): Promise<void>;
4893
- }
4894
- /**
4895
- * @deprecated Use `BidiStreamHandlerLike` instead.
4896
- */
4897
- export type BidiStreamHandlerInterface = BidiStreamHandlerLike;
4898
- /**
4899
- * Bidirectional stream handler for stream-to-stream RPC calls
4900
- *
4901
- * Allows sending and receiving messages concurrently.
4902
- */
4903
- export declare class BidiStreamHandler extends UniffiAbstractObject implements BidiStreamHandlerLike {
4904
- readonly [uniffiTypeNameSymbol] = "BidiStreamHandler";
4905
- readonly [destructorGuardSymbol]: UniffiGcObject;
4906
- readonly [pointerLiteralSymbol]: UniffiHandle;
4907
- private constructor();
4908
- /**
4909
- * Close the request stream (no more messages will be sent)
4910
- */
4911
- closeSend(): void;
4912
- /**
4913
- * Close the request stream (async version)
4914
- */
4915
- closeSendAsync(asyncOpts_?: {
4916
- signal: AbortSignal;
4917
- }): Promise<void>;
4918
- /**
4919
- * Receive the next response message (blocking version)
4920
- */
4921
- recv(): StreamMessage;
4922
- /**
4923
- * Receive the next response message (async version)
4924
- */
4925
- recvAsync(asyncOpts_?: {
4926
- signal: AbortSignal;
4927
- }): Promise<StreamMessage>;
4928
- /**
4929
- * Send a request message to the stream (blocking version)
4930
- */
4931
- send(data: ArrayBuffer): void;
4932
- /**
4933
- * Send a request message to the stream (async version)
4934
- */
4935
- sendAsync(data: ArrayBuffer, asyncOpts_?: {
4936
- signal: AbortSignal;
4937
- }): Promise<void>;
4938
- uniffiDestroy(): void;
4939
- static instanceOf(obj_: any): obj_ is BidiStreamHandler;
4940
- }
4941
- /**
4942
- * Bidirectional stream handler for multicast stream-to-unary and
4943
- * stream-to-stream RPC calls.
4944
- *
4945
- * Send request messages via [`send`](Self::send) / [`send_async`](Self::send_async),
4946
- * close the request stream via [`close_send`](Self::close_send), and receive
4947
- * responses via [`recv`](Self::recv) / [`recv_async`](Self::recv_async). Each
4948
- * response item carries the source member's identity.
4949
- */
4950
- export interface MulticastBidiStreamHandlerLike {
4951
- /**
4952
- * Close the request stream — signals that no more messages will be sent
4953
- * (blocking).
4954
- */
4955
- closeSend(): void;
4956
- /**
4957
- * Close the request stream (async).
4958
- */
4959
- closeSendAsync(asyncOpts_?: {
4960
- signal: AbortSignal;
4961
- }): Promise<void>;
4962
- /**
4963
- * Receive the next response item (blocking).
4964
- */
4965
- recv(): MulticastStreamMessage;
4966
- /**
4967
- * Receive the next response item (async).
4968
- */
4969
- recvAsync(asyncOpts_?: {
4970
- signal: AbortSignal;
4971
- }): Promise<MulticastStreamMessage>;
4972
- /**
4973
- * Send a request message to the stream (blocking).
4974
- */
4975
- send(data: ArrayBuffer): void;
4976
- /**
4977
- * Send a request message to the stream (async).
4978
- */
4979
- sendAsync(data: ArrayBuffer, asyncOpts_?: {
4980
- signal: AbortSignal;
4981
- }): Promise<void>;
4982
- }
4983
- /**
4984
- * @deprecated Use `MulticastBidiStreamHandlerLike` instead.
4985
- */
4986
- export type MulticastBidiStreamHandlerInterface = MulticastBidiStreamHandlerLike;
4987
- /**
4988
- * Bidirectional stream handler for multicast stream-to-unary and
4989
- * stream-to-stream RPC calls.
4990
- *
4991
- * Send request messages via [`send`](Self::send) / [`send_async`](Self::send_async),
4992
- * close the request stream via [`close_send`](Self::close_send), and receive
4993
- * responses via [`recv`](Self::recv) / [`recv_async`](Self::recv_async). Each
4994
- * response item carries the source member's identity.
4995
- */
4996
- export declare class MulticastBidiStreamHandler extends UniffiAbstractObject implements MulticastBidiStreamHandlerLike {
4997
- readonly [uniffiTypeNameSymbol] = "MulticastBidiStreamHandler";
4998
- readonly [destructorGuardSymbol]: UniffiGcObject;
4999
- readonly [pointerLiteralSymbol]: UniffiHandle;
5000
- private constructor();
5001
- /**
5002
- * Close the request stream — signals that no more messages will be sent
5003
- * (blocking).
5004
- */
5005
- closeSend(): void;
5006
- /**
5007
- * Close the request stream (async).
5008
- */
5009
- closeSendAsync(asyncOpts_?: {
5010
- signal: AbortSignal;
5011
- }): Promise<void>;
5012
- /**
5013
- * Receive the next response item (blocking).
5014
- */
5015
- recv(): MulticastStreamMessage;
5016
- /**
5017
- * Receive the next response item (async).
5018
- */
5019
- recvAsync(asyncOpts_?: {
5020
- signal: AbortSignal;
5021
- }): Promise<MulticastStreamMessage>;
5022
- /**
5023
- * Send a request message to the stream (blocking).
5024
- */
5025
- send(data: ArrayBuffer): void;
5026
- /**
5027
- * Send a request message to the stream (async).
5028
- */
5029
- sendAsync(data: ArrayBuffer, asyncOpts_?: {
5030
- signal: AbortSignal;
5031
- }): Promise<void>;
5032
- uniffiDestroy(): void;
5033
- static instanceOf(obj_: any): obj_ is MulticastBidiStreamHandler;
5034
- }
5035
- /**
5036
- * Response stream reader for multicast RPC calls.
5037
- *
5038
- * Allows pulling `RpcMulticastItem`s from a GROUP response stream one at a
5039
- * time. Each item carries the source member's identity alongside the payload.
5040
- */
5041
- export interface MulticastResponseReaderLike {
5042
- /**
5043
- * Pull the next item from the multicast response stream (blocking).
5044
- */
5045
- next(): MulticastStreamMessage;
5046
- /**
5047
- * Pull the next item from the multicast response stream (async).
5048
- */
5049
- nextAsync(asyncOpts_?: {
5050
- signal: AbortSignal;
5051
- }): Promise<MulticastStreamMessage>;
5052
- }
5053
- /**
5054
- * @deprecated Use `MulticastResponseReaderLike` instead.
5055
- */
5056
- export type MulticastResponseReaderInterface = MulticastResponseReaderLike;
5057
- /**
5058
- * Response stream reader for multicast RPC calls.
5059
- *
5060
- * Allows pulling `RpcMulticastItem`s from a GROUP response stream one at a
5061
- * time. Each item carries the source member's identity alongside the payload.
5062
- */
5063
- export declare class MulticastResponseReader extends UniffiAbstractObject implements MulticastResponseReaderLike {
5064
- readonly [uniffiTypeNameSymbol] = "MulticastResponseReader";
5065
- readonly [destructorGuardSymbol]: UniffiGcObject;
5066
- readonly [pointerLiteralSymbol]: UniffiHandle;
5067
- private constructor();
5068
- /**
5069
- * Pull the next item from the multicast response stream (blocking).
5070
- */
5071
- next(): MulticastStreamMessage;
5072
- /**
5073
- * Pull the next item from the multicast response stream (async).
5074
- */
5075
- nextAsync(asyncOpts_?: {
5076
- signal: AbortSignal;
5077
- }): Promise<MulticastStreamMessage>;
5078
- uniffiDestroy(): void;
5079
- static instanceOf(obj_: any): obj_ is MulticastResponseReader;
5080
- }
5081
- /**
5082
- * Request stream writer for stream-to-unary RPC calls
5083
- *
5084
- * Allows sending multiple request messages and getting a final response.
5085
- */
5086
- export interface RequestStreamWriterLike {
5087
- /**
5088
- * Finalize the stream and get the response (async version)
5089
- *
5090
- * **Deprecated**: Use [`finalize_stream_async`](Self::finalize_stream_async) instead.
5091
- */
5092
- finalizeAsync(asyncOpts_?: {
5093
- signal: AbortSignal;
5094
- }): Promise<ArrayBuffer>;
5095
- /**
5096
- * Finalize the stream and get the response (blocking version)
5097
- */
5098
- finalizeStream(): ArrayBuffer;
5099
- /**
5100
- * Finalize the stream and get the response (async version)
5101
- */
5102
- finalizeStreamAsync(asyncOpts_?: {
5103
- signal: AbortSignal;
5104
- }): Promise<ArrayBuffer>;
5105
- /**
5106
- * Send a request message to the stream (blocking version)
5107
- */
5108
- send(data: ArrayBuffer): void;
5109
- /**
5110
- * Send a request message to the stream (async version)
5111
- */
5112
- sendAsync(data: ArrayBuffer, asyncOpts_?: {
5113
- signal: AbortSignal;
5114
- }): Promise<void>;
5115
- }
5116
- /**
5117
- * @deprecated Use `RequestStreamWriterLike` instead.
5118
- */
5119
- export type RequestStreamWriterInterface = RequestStreamWriterLike;
5120
- /**
5121
- * Request stream writer for stream-to-unary RPC calls
5122
- *
5123
- * Allows sending multiple request messages and getting a final response.
5124
- */
5125
- export declare class RequestStreamWriter extends UniffiAbstractObject implements RequestStreamWriterLike {
5126
- readonly [uniffiTypeNameSymbol] = "RequestStreamWriter";
5127
- readonly [destructorGuardSymbol]: UniffiGcObject;
5128
- readonly [pointerLiteralSymbol]: UniffiHandle;
5129
- private constructor();
5130
- /**
5131
- * Finalize the stream and get the response (async version)
5132
- *
5133
- * **Deprecated**: Use [`finalize_stream_async`](Self::finalize_stream_async) instead.
5134
- */
5135
- finalizeAsync(asyncOpts_?: {
5136
- signal: AbortSignal;
5137
- }): Promise<ArrayBuffer>;
5138
- /**
5139
- * Finalize the stream and get the response (blocking version)
5140
- */
5141
- finalizeStream(): ArrayBuffer;
5142
- /**
5143
- * Finalize the stream and get the response (async version)
5144
- */
5145
- finalizeStreamAsync(asyncOpts_?: {
5146
- signal: AbortSignal;
5147
- }): Promise<ArrayBuffer>;
5148
- /**
5149
- * Send a request message to the stream (blocking version)
5150
- */
5151
- send(data: ArrayBuffer): void;
5152
- /**
5153
- * Send a request message to the stream (async version)
5154
- */
5155
- sendAsync(data: ArrayBuffer, asyncOpts_?: {
5156
- signal: AbortSignal;
5157
- }): Promise<void>;
5158
- uniffiDestroy(): void;
5159
- static instanceOf(obj_: any): obj_ is RequestStreamWriter;
5160
- }
5161
- /**
5162
- * Response stream reader for unary-to-stream RPC calls
5163
- *
5164
- * Allows pulling messages from a server response stream one at a time.
5165
- */
5166
- export interface ResponseStreamReaderLike {
5167
- /**
5168
- * Pull the next message from the response stream (blocking version)
5169
- *
5170
- * Returns a StreamMessage indicating the result
5171
- */
5172
- next(): StreamMessage;
5173
- /**
5174
- * Pull the next message from the response stream (async version)
5175
- *
5176
- * Returns a StreamMessage indicating the result
5177
- */
5178
- nextAsync(asyncOpts_?: {
5179
- signal: AbortSignal;
5180
- }): Promise<StreamMessage>;
5181
- }
5182
- /**
5183
- * @deprecated Use `ResponseStreamReaderLike` instead.
5184
- */
5185
- export type ResponseStreamReaderInterface = ResponseStreamReaderLike;
5186
- /**
5187
- * Response stream reader for unary-to-stream RPC calls
5188
- *
5189
- * Allows pulling messages from a server response stream one at a time.
5190
- */
5191
- export declare class ResponseStreamReader extends UniffiAbstractObject implements ResponseStreamReaderLike {
5192
- readonly [uniffiTypeNameSymbol] = "ResponseStreamReader";
5193
- readonly [destructorGuardSymbol]: UniffiGcObject;
5194
- readonly [pointerLiteralSymbol]: UniffiHandle;
5195
- private constructor();
5196
- /**
5197
- * Pull the next message from the response stream (blocking version)
5198
- *
5199
- * Returns a StreamMessage indicating the result
5200
- */
5201
- next(): StreamMessage;
5202
- /**
5203
- * Pull the next message from the response stream (async version)
5204
- *
5205
- * Returns a StreamMessage indicating the result
5206
- */
5207
- nextAsync(asyncOpts_?: {
5208
- signal: AbortSignal;
5209
- }): Promise<StreamMessage>;
5210
- uniffiDestroy(): void;
5211
- static instanceOf(obj_: any): obj_ is ResponseStreamReader;
5212
- }
5213
- /**
5214
- * Client-side channel for making RPC calls.
5215
- *
5216
- * Manages a single persistent SLIM session: either a `PointToPoint` session
5217
- * to a single remote server, or a `Multicast` (GROUP) session shared across
5218
- * multiple remote servers. The session is lazily initialised and recreated
5219
- * when dead.
5220
- *
5221
- * ## Constructor
5222
- *
5223
- * - `new_with_members_internal(app, members)` — Smart constructor:
5224
- * - **1 member**: creates a P2P channel.
5225
- * - **Many members**: creates a GROUP channel with a generated session name
5226
- * and auto-invites all members on the first multicast call.
5227
- */
5228
- export interface ChannelLike {
5229
- /**
5230
- * Broadcast a request stream to all GROUP members and stream their
5231
- * responses.
5232
- *
5233
- * Semantically equivalent to `call_multicast_stream_unary` at the
5234
- * transport level; the difference (one vs many responses per member) is
5235
- * determined by the server handler.
5236
- */
5237
- callMulticastStreamStream(serviceName: string, methodName: string, timeout: number | undefined, metadata: Map<string, string> | undefined): MulticastBidiStreamHandlerLike;
5238
- /**
5239
- * Broadcast a request stream to all GROUP members and collect their
5240
- * responses.
5241
- *
5242
- * Returns a handler that lets you send requests and receive responses
5243
- * concurrently. Use `send` / `send_async` to push request messages,
5244
- * `close_send` / `close_send_async` to signal end-of-requests, and
5245
- * `recv` / `recv_async` to pull response items.
5246
- */
5247
- callMulticastStreamUnary(serviceName: string, methodName: string, timeout: number | undefined, metadata: Map<string, string> | undefined): MulticastBidiStreamHandlerLike;
5248
- /**
5249
- * Broadcast one request to all GROUP members and collect their responses.
5250
- *
5251
- * Returns a reader from which each member's response (wrapped in
5252
- * `MulticastStreamMessage`) can be pulled one at a time (blocking).
5253
- */
5254
- callMulticastUnary(serviceName: string, methodName: string, request: ArrayBuffer, timeout: number | undefined, metadata: Map<string, string> | undefined): MulticastResponseReaderLike;
5255
- /**
5256
- * Broadcast one request to all GROUP members and collect their responses
5257
- * (async).
5258
- */
5259
- callMulticastUnaryAsync(serviceName: string, methodName: string, request: ArrayBuffer, timeout: number | undefined, metadata: Map<string, string> | undefined, asyncOpts_?: {
5260
- signal: AbortSignal;
5261
- }): Promise<MulticastResponseReaderLike>;
5262
- /**
5263
- * Broadcast one request to all GROUP members and stream their responses
5264
- * (blocking).
5265
- *
5266
- * Semantically identical to `call_multicast_unary` at the transport level;
5267
- * the difference is that each member may send multiple responses before its
5268
- * EOS, which the server handler determines.
5269
- */
5270
- callMulticastUnaryStream(serviceName: string, methodName: string, request: ArrayBuffer, timeout: number | undefined, metadata: Map<string, string> | undefined): MulticastResponseReaderLike;
5271
- /**
5272
- * Broadcast one request to all GROUP members and stream their responses
5273
- * (async).
5274
- */
5275
- callMulticastUnaryStreamAsync(serviceName: string, methodName: string, request: ArrayBuffer, timeout: number | undefined, metadata: Map<string, string> | undefined, asyncOpts_?: {
5276
- signal: AbortSignal;
5277
- }): Promise<MulticastResponseReaderLike>;
5278
- callStreamStream(serviceName: string, methodName: string, timeout: number | undefined, metadata: Map<string, string> | undefined): BidiStreamHandlerLike;
5279
- callStreamUnary(serviceName: string, methodName: string, timeout: number | undefined, metadata: Map<string, string> | undefined): RequestStreamWriterLike;
5280
- callUnary(serviceName: string, methodName: string, request: ArrayBuffer, timeout: number | undefined, metadata: Map<string, string> | undefined): ArrayBuffer;
5281
- callUnaryAsync(serviceName: string, methodName: string, request: ArrayBuffer, timeout: number | undefined, metadata: Map<string, string> | undefined, asyncOpts_?: {
5282
- signal: AbortSignal;
5283
- }): Promise<ArrayBuffer>;
5284
- callUnaryStream(serviceName: string, methodName: string, request: ArrayBuffer, timeout: number | undefined, metadata: Map<string, string> | undefined): ResponseStreamReaderLike;
5285
- callUnaryStreamAsync(serviceName: string, methodName: string, request: ArrayBuffer, timeout: number | undefined, metadata: Map<string, string> | undefined, asyncOpts_?: {
5286
- signal: AbortSignal;
5287
- }): Promise<ResponseStreamReaderLike>;
5288
- /**
5289
- * Close the persistent SLIM session held by this channel, if any.
5290
- *
5291
- * `timeout` optionally bounds how long to wait for the session layer to
5292
- * confirm the close before giving up and proceeding with cleanup anyway.
5293
- * Pass `None` to wait indefinitely.
5294
- *
5295
- * After this call the channel can still be used; a new session will be
5296
- * created automatically on the next RPC call.
5297
- */
5298
- close(timeout: number | undefined): void;
5299
- /**
5300
- * Async version of [`close`](Self::close).
5301
- */
5302
- closeAsync(timeout: number | undefined, asyncOpts_?: {
5303
- signal: AbortSignal;
5304
- }): Promise<void>;
5305
- }
5306
- /**
5307
- * @deprecated Use `ChannelLike` instead.
5308
- */
5309
- export type ChannelInterface = ChannelLike;
5310
- /**
5311
- * Client-side channel for making RPC calls.
5312
- *
5313
- * Manages a single persistent SLIM session: either a `PointToPoint` session
5314
- * to a single remote server, or a `Multicast` (GROUP) session shared across
5315
- * multiple remote servers. The session is lazily initialised and recreated
5316
- * when dead.
5317
- *
5318
- * ## Constructor
5319
- *
5320
- * - `new_with_members_internal(app, members)` — Smart constructor:
5321
- * - **1 member**: creates a P2P channel.
5322
- * - **Many members**: creates a GROUP channel with a generated session name
5323
- * and auto-invites all members on the first multicast call.
5324
- */
5325
- export declare class Channel extends UniffiAbstractObject implements ChannelLike {
5326
- readonly [uniffiTypeNameSymbol] = "Channel";
5327
- readonly [destructorGuardSymbol]: UniffiGcObject;
5328
- readonly [pointerLiteralSymbol]: UniffiHandle;
5329
- constructor(app: AppLike, remote: NameLike);
5330
- static newGroup(app: AppLike, members: Array<NameLike>): ChannelLike;
5331
- static newGroupWithConnection(app: AppLike, members: Array<NameLike>, connectionId: bigint | undefined): ChannelLike;
5332
- static newWithConnection(app: AppLike, remote: NameLike, connectionId: bigint | undefined): ChannelLike;
5333
- /**
5334
- * Broadcast a request stream to all GROUP members and stream their
5335
- * responses.
5336
- *
5337
- * Semantically equivalent to `call_multicast_stream_unary` at the
5338
- * transport level; the difference (one vs many responses per member) is
5339
- * determined by the server handler.
5340
- */
5341
- callMulticastStreamStream(serviceName: string, methodName: string, timeout: number | undefined, metadata: Map<string, string> | undefined): MulticastBidiStreamHandlerLike;
5342
- /**
5343
- * Broadcast a request stream to all GROUP members and collect their
5344
- * responses.
5345
- *
5346
- * Returns a handler that lets you send requests and receive responses
5347
- * concurrently. Use `send` / `send_async` to push request messages,
5348
- * `close_send` / `close_send_async` to signal end-of-requests, and
5349
- * `recv` / `recv_async` to pull response items.
5350
- */
5351
- callMulticastStreamUnary(serviceName: string, methodName: string, timeout: number | undefined, metadata: Map<string, string> | undefined): MulticastBidiStreamHandlerLike;
5352
- /**
5353
- * Broadcast one request to all GROUP members and collect their responses.
5354
- *
5355
- * Returns a reader from which each member's response (wrapped in
5356
- * `MulticastStreamMessage`) can be pulled one at a time (blocking).
5357
- */
5358
- callMulticastUnary(serviceName: string, methodName: string, request: ArrayBuffer, timeout: number | undefined, metadata: Map<string, string> | undefined): MulticastResponseReaderLike;
5359
- /**
5360
- * Broadcast one request to all GROUP members and collect their responses
5361
- * (async).
5362
- */
5363
- callMulticastUnaryAsync(serviceName: string, methodName: string, request: ArrayBuffer, timeout: number | undefined, metadata: Map<string, string> | undefined, asyncOpts_?: {
5364
- signal: AbortSignal;
5365
- }): Promise<MulticastResponseReaderLike>;
5366
- /**
5367
- * Broadcast one request to all GROUP members and stream their responses
5368
- * (blocking).
5369
- *
5370
- * Semantically identical to `call_multicast_unary` at the transport level;
5371
- * the difference is that each member may send multiple responses before its
5372
- * EOS, which the server handler determines.
5373
- */
5374
- callMulticastUnaryStream(serviceName: string, methodName: string, request: ArrayBuffer, timeout: number | undefined, metadata: Map<string, string> | undefined): MulticastResponseReaderLike;
5375
- /**
5376
- * Broadcast one request to all GROUP members and stream their responses
5377
- * (async).
5378
- */
5379
- callMulticastUnaryStreamAsync(serviceName: string, methodName: string, request: ArrayBuffer, timeout: number | undefined, metadata: Map<string, string> | undefined, asyncOpts_?: {
5380
- signal: AbortSignal;
5381
- }): Promise<MulticastResponseReaderLike>;
5382
- callStreamStream(serviceName: string, methodName: string, timeout: number | undefined, metadata: Map<string, string> | undefined): BidiStreamHandlerLike;
5383
- callStreamUnary(serviceName: string, methodName: string, timeout: number | undefined, metadata: Map<string, string> | undefined): RequestStreamWriterLike;
5384
- callUnary(serviceName: string, methodName: string, request: ArrayBuffer, timeout: number | undefined, metadata: Map<string, string> | undefined): ArrayBuffer;
5385
- callUnaryAsync(serviceName: string, methodName: string, request: ArrayBuffer, timeout: number | undefined, metadata: Map<string, string> | undefined, asyncOpts_?: {
5386
- signal: AbortSignal;
5387
- }): Promise<ArrayBuffer>;
5388
- callUnaryStream(serviceName: string, methodName: string, request: ArrayBuffer, timeout: number | undefined, metadata: Map<string, string> | undefined): ResponseStreamReaderLike;
5389
- callUnaryStreamAsync(serviceName: string, methodName: string, request: ArrayBuffer, timeout: number | undefined, metadata: Map<string, string> | undefined, asyncOpts_?: {
5390
- signal: AbortSignal;
5391
- }): Promise<ResponseStreamReaderLike>;
5392
- /**
5393
- * Close the persistent SLIM session held by this channel, if any.
5394
- *
5395
- * `timeout` optionally bounds how long to wait for the session layer to
5396
- * confirm the close before giving up and proceeding with cleanup anyway.
5397
- * Pass `None` to wait indefinitely.
5398
- *
5399
- * After this call the channel can still be used; a new session will be
5400
- * created automatically on the next RPC call.
5401
- */
5402
- close(timeout: number | undefined): void;
5403
- /**
5404
- * Async version of [`close`](Self::close).
5405
- */
5406
- closeAsync(timeout: number | undefined, asyncOpts_?: {
5407
- signal: AbortSignal;
5408
- }): Promise<void>;
5409
- uniffiDestroy(): void;
5410
- static instanceOf(obj_: any): obj_ is Channel;
5411
- }
5412
- /**
5413
- * Context passed to RPC handlers
5414
- *
5415
- * Contains all contextual information about an RPC call including:
5416
- * - Session information (source, destination, session ID)
5417
- * - Metadata (key-value pairs)
5418
- * - Deadline/timeout information
5419
- * - Message routing details
5420
- */
5421
- export interface ContextLike {
5422
- /**
5423
- * Get the deadline for this RPC call
5424
- */
5425
- deadline(): Date;
5426
- /**
5427
- * Check if the deadline has been exceeded
5428
- */
5429
- isDeadlineExceeded(): boolean;
5430
- /**
5431
- * Get the rpc session metadata
5432
- */
5433
- metadata(): Map<string, string>;
5434
- /**
5435
- * Get the remaining time until deadline
5436
- *
5437
- * Returns Duration::ZERO if the deadline has already passed
5438
- */
5439
- remainingTime(): number;
5440
- /**
5441
- * Get the session ID
5442
- */
5443
- sessionId(): string;
5444
- }
5445
- /**
5446
- * @deprecated Use `ContextLike` instead.
5447
- */
5448
- export type ContextInterface = ContextLike;
5449
- /**
5450
- * Context passed to RPC handlers
5451
- *
5452
- * Contains all contextual information about an RPC call including:
5453
- * - Session information (source, destination, session ID)
5454
- * - Metadata (key-value pairs)
5455
- * - Deadline/timeout information
5456
- * - Message routing details
5457
- */
5458
- export declare class Context extends UniffiAbstractObject implements ContextLike {
5459
- readonly [uniffiTypeNameSymbol] = "Context";
5460
- readonly [destructorGuardSymbol]: UniffiGcObject;
5461
- readonly [pointerLiteralSymbol]: UniffiHandle;
5462
- private constructor();
5463
- /**
5464
- * Get the deadline for this RPC call
5465
- */
5466
- deadline(): Date;
5467
- /**
5468
- * Check if the deadline has been exceeded
5469
- */
5470
- isDeadlineExceeded(): boolean;
5471
- /**
5472
- * Get the rpc session metadata
5473
- */
5474
- metadata(): Map<string, string>;
5475
- /**
5476
- * Get the remaining time until deadline
5477
- *
5478
- * Returns Duration::ZERO if the deadline has already passed
5479
- */
5480
- remainingTime(): number;
5481
- /**
5482
- * Get the session ID
5483
- */
5484
- sessionId(): string;
5485
- uniffiDestroy(): void;
5486
- static instanceOf(obj_: any): obj_ is Context;
5487
- }
5488
- /**
5489
- * Request stream reader
5490
- *
5491
- * Allows pulling messages from a client request stream.
5492
- * This wraps the underlying async stream and provides a blocking interface
5493
- * suitable for UniFFI callback traits.
5494
- */
5495
- export interface RequestStreamLike {
5496
- /**
5497
- * Pull the next message from the stream (blocking version)
5498
- *
5499
- * Returns a StreamMessage indicating the result
5500
- */
5501
- next(): StreamMessage;
5502
- /**
5503
- * Pull the next message from the stream (async version)
5504
- *
5505
- * Returns a StreamMessage indicating the result
5506
- */
5507
- nextAsync(asyncOpts_?: {
5508
- signal: AbortSignal;
5509
- }): Promise<StreamMessage>;
5510
- }
5511
- /**
5512
- * @deprecated Use `RequestStreamLike` instead.
5513
- */
5514
- export type RequestStreamInterface = RequestStreamLike;
5515
- /**
5516
- * Request stream reader
5517
- *
5518
- * Allows pulling messages from a client request stream.
5519
- * This wraps the underlying async stream and provides a blocking interface
5520
- * suitable for UniFFI callback traits.
5521
- */
5522
- export declare class RequestStream extends UniffiAbstractObject implements RequestStreamLike {
5523
- readonly [uniffiTypeNameSymbol] = "RequestStream";
5524
- readonly [destructorGuardSymbol]: UniffiGcObject;
5525
- readonly [pointerLiteralSymbol]: UniffiHandle;
5526
- private constructor();
5527
- /**
5528
- * Pull the next message from the stream (blocking version)
5529
- *
5530
- * Returns a StreamMessage indicating the result
5531
- */
5532
- next(): StreamMessage;
5533
- /**
5534
- * Pull the next message from the stream (async version)
5535
- *
5536
- * Returns a StreamMessage indicating the result
5537
- */
5538
- nextAsync(asyncOpts_?: {
5539
- signal: AbortSignal;
5540
- }): Promise<StreamMessage>;
5541
- uniffiDestroy(): void;
5542
- static instanceOf(obj_: any): obj_ is RequestStream;
5543
- }
5544
- /**
5545
- * Response stream writer
5546
- *
5547
- * Allows pushing messages to a client response stream.
5548
- * This wraps an async channel sender and provides a blocking interface
5549
- * suitable for UniFFI callback traits.
5550
- */
5551
- export interface ResponseSinkLike {
5552
- /**
5553
- * Close the response stream (blocking version)
5554
- *
5555
- * Signals that no more messages will be sent.
5556
- * The stream will end gracefully.
5557
- */
5558
- close(): void;
5559
- /**
5560
- * Close the response stream (async version)
5561
- *
5562
- * Signals that no more messages will be sent.
5563
- * The stream will end gracefully.
5564
- */
5565
- closeAsync(asyncOpts_?: {
5566
- signal: AbortSignal;
5567
- }): Promise<void>;
5568
- /**
5569
- * Check if the sink has been closed (blocking version)
5570
- */
5571
- isClosed(): boolean;
5572
- /**
5573
- * Check if the sink has been closed (async version)
5574
- */
5575
- isClosedAsync(asyncOpts_?: {
5576
- signal: AbortSignal;
5577
- }): Promise<boolean>;
5578
- /**
5579
- * Send a message to the response stream (blocking version)
5580
- *
5581
- * Returns an error if the stream has been closed or if sending fails.
5582
- */
5583
- send(data: ArrayBuffer): void;
5584
- /**
5585
- * Send a message to the response stream (async version)
5586
- *
5587
- * Returns an error if the stream has been closed or if sending fails.
5588
- */
5589
- sendAsync(data: ArrayBuffer, asyncOpts_?: {
5590
- signal: AbortSignal;
5591
- }): Promise<void>;
5592
- /**
5593
- * Send an error to the response stream and close it (blocking version)
5594
- *
5595
- * This terminates the stream with an error status.
5596
- */
5597
- sendError(error: RpcError): void;
5598
- /**
5599
- * Send an error to the response stream and close it (async version)
5600
- *
5601
- * This terminates the stream with an error status.
5602
- */
5603
- sendErrorAsync(error: RpcError, asyncOpts_?: {
5604
- signal: AbortSignal;
5605
- }): Promise<void>;
5606
- }
5607
- /**
5608
- * @deprecated Use `ResponseSinkLike` instead.
5609
- */
5610
- export type ResponseSinkInterface = ResponseSinkLike;
5611
- /**
5612
- * Response stream writer
5613
- *
5614
- * Allows pushing messages to a client response stream.
5615
- * This wraps an async channel sender and provides a blocking interface
5616
- * suitable for UniFFI callback traits.
5617
- */
5618
- export declare class ResponseSink extends UniffiAbstractObject implements ResponseSinkLike {
5619
- readonly [uniffiTypeNameSymbol] = "ResponseSink";
5620
- readonly [destructorGuardSymbol]: UniffiGcObject;
5621
- readonly [pointerLiteralSymbol]: UniffiHandle;
5622
- private constructor();
5623
- /**
5624
- * Close the response stream (blocking version)
5625
- *
5626
- * Signals that no more messages will be sent.
5627
- * The stream will end gracefully.
5628
- */
5629
- close(): void;
5630
- /**
5631
- * Close the response stream (async version)
5632
- *
5633
- * Signals that no more messages will be sent.
5634
- * The stream will end gracefully.
5635
- */
5636
- closeAsync(asyncOpts_?: {
5637
- signal: AbortSignal;
5638
- }): Promise<void>;
5639
- /**
5640
- * Check if the sink has been closed (blocking version)
5641
- */
5642
- isClosed(): boolean;
5643
- /**
5644
- * Check if the sink has been closed (async version)
5645
- */
5646
- isClosedAsync(asyncOpts_?: {
5647
- signal: AbortSignal;
5648
- }): Promise<boolean>;
5649
- /**
5650
- * Send a message to the response stream (blocking version)
5651
- *
5652
- * Returns an error if the stream has been closed or if sending fails.
5653
- */
5654
- send(data: ArrayBuffer): void;
5655
- /**
5656
- * Send a message to the response stream (async version)
5657
- *
5658
- * Returns an error if the stream has been closed or if sending fails.
5659
- */
5660
- sendAsync(data: ArrayBuffer, asyncOpts_?: {
5661
- signal: AbortSignal;
5662
- }): Promise<void>;
5663
- /**
5664
- * Send an error to the response stream and close it (blocking version)
5665
- *
5666
- * This terminates the stream with an error status.
5667
- */
5668
- sendError(error: RpcError): void;
5669
- /**
5670
- * Send an error to the response stream and close it (async version)
5671
- *
5672
- * This terminates the stream with an error status.
5673
- */
5674
- sendErrorAsync(error: RpcError, asyncOpts_?: {
5675
- signal: AbortSignal;
5676
- }): Promise<void>;
5677
- uniffiDestroy(): void;
5678
- static instanceOf(obj_: any): obj_ is ResponseSink;
5679
- }
5680
- /**
5681
- * Stream-to-Stream RPC handler trait
5682
- *
5683
- * Implement this trait to handle stream-to-stream RPC calls.
5684
- * The handler receives multiple requests via the stream and sends multiple responses via the sink.
5685
- */
5686
- export interface StreamStreamHandler {
5687
- /**
5688
- * Handle a stream-to-stream RPC call
5689
- *
5690
- * # Arguments
5691
- * * `stream` - Request stream to pull messages from
5692
- * * `context` - RPC context with metadata and session information
5693
- * * `sink` - Response sink to send streaming responses
5694
- *
5695
- * # Returns
5696
- * Ok(()) if handling succeeded, or an error
5697
- *
5698
- * # Note
5699
- * You must call `sink.close()` or `sink.send_error()` when done.
5700
- */
5701
- handle(stream: RequestStreamLike, context: ContextLike, sink: ResponseSinkLike, asyncOpts_?: {
5702
- signal: AbortSignal;
5703
- }): Promise<void>;
5704
- }
5705
- /**
5706
- * Stream-to-Stream RPC handler trait
5707
- *
5708
- * Implement this trait to handle stream-to-stream RPC calls.
5709
- * The handler receives multiple requests via the stream and sends multiple responses via the sink.
5710
- */
5711
- export declare class StreamStreamHandlerImpl extends UniffiAbstractObject implements StreamStreamHandler {
5712
- readonly [uniffiTypeNameSymbol] = "StreamStreamHandlerImpl";
4022
+ export declare class App extends UniffiAbstractObject implements AppLike {
4023
+ readonly [uniffiTypeNameSymbol] = "App";
5713
4024
  readonly [destructorGuardSymbol]: UniffiGcObject;
5714
4025
  readonly [pointerLiteralSymbol]: UniffiHandle;
5715
- private constructor();
5716
4026
  /**
5717
- * Handle a stream-to-stream RPC call
4027
+ * Create a new App with identity provider and verifier configurations
4028
+ *
4029
+ * This is the main entry point for creating a SLIM application from language bindings.
5718
4030
  *
5719
4031
  * # Arguments
5720
- * * `stream` - Request stream to pull messages from
5721
- * * `context` - RPC context with metadata and session information
5722
- * * `sink` - Response sink to send streaming responses
4032
+ * * `base_name` - The base name for the app (without ID)
4033
+ * * `identity_provider_config` - Configuration for proving identity to others
4034
+ * * `identity_verifier_config` - Configuration for verifying identity of others
5723
4035
  *
5724
4036
  * # Returns
5725
- * Ok(()) if handling succeeded, or an error
4037
+ * * `Ok(Arc<App>)` - Successfully created adapter
4038
+ * * `Err(SlimError)` - If adapter creation fails
5726
4039
  *
5727
- * # Note
5728
- * You must call `sink.close()` or `sink.send_error()` when done.
4040
+ * # Supported Identity Types
4041
+ * - SharedSecret: Symmetric key authentication
4042
+ * - JWT: Dynamic JWT generation/verification with signing/decoding keys
4043
+ * - StaticJWT: Static JWT loaded from file with auto-reload
5729
4044
  */
5730
- handle(stream: RequestStreamLike, context: ContextLike, sink: ResponseSinkLike, asyncOpts_?: {
5731
- signal: AbortSignal;
5732
- }): Promise<void>;
5733
- uniffiDestroy(): void;
5734
- static instanceOf(obj_: any): obj_ is StreamStreamHandlerImpl;
5735
- }
5736
- /**
5737
- * Stream-to-Unary RPC handler trait
5738
- *
5739
- * Implement this trait to handle stream-to-unary RPC calls.
5740
- * The handler receives multiple requests via the stream and returns a single response.
5741
- */
5742
- export interface StreamUnaryHandler {
4045
+ constructor(baseName: NameLike, identityProviderConfig: IdentityProviderConfig, identityVerifierConfig: IdentityVerifierConfig);
5743
4046
  /**
5744
- * Handle a stream-to-unary RPC call
5745
- *
5746
- * # Arguments
5747
- * * `stream` - Request stream to pull messages from
5748
- * * `context` - RPC context with metadata and session information
4047
+ * Create a new App with traffic direction (blocking version)
5749
4048
  *
5750
- * # Returns
5751
- * The response message bytes or an error
5752
- */
5753
- handle(stream: RequestStreamLike, context: ContextLike, asyncOpts_?: {
5754
- signal: AbortSignal;
5755
- }): Promise<ArrayBuffer>;
5756
- }
5757
- /**
5758
- * Stream-to-Unary RPC handler trait
5759
- *
5760
- * Implement this trait to handle stream-to-unary RPC calls.
5761
- * The handler receives multiple requests via the stream and returns a single response.
5762
- */
5763
- export declare class StreamUnaryHandlerImpl extends UniffiAbstractObject implements StreamUnaryHandler {
5764
- readonly [uniffiTypeNameSymbol] = "StreamUnaryHandlerImpl";
5765
- readonly [destructorGuardSymbol]: UniffiGcObject;
5766
- readonly [pointerLiteralSymbol]: UniffiHandle;
5767
- private constructor();
5768
- /**
5769
- * Handle a stream-to-unary RPC call
4049
+ * This is a convenience function for creating a SLIM application with configurable
4050
+ * traffic direction (send-only, receive-only, bidirectional, or none).
5770
4051
  *
5771
4052
  * # Arguments
5772
- * * `stream` - Request stream to pull messages from
5773
- * * `context` - RPC context with metadata and session information
4053
+ * * `name` - The base name for the app (without ID)
4054
+ * * `identity_provider_config` - Configuration for proving identity to others
4055
+ * * `identity_verifier_config` - Configuration for verifying identity of others
4056
+ * * `direction` - Traffic direction for sessions (Send, Recv, Bidirectional, or None)
5774
4057
  *
5775
4058
  * # Returns
5776
- * The response message bytes or an error
4059
+ * * `Ok(Arc<App>)` - Successfully created app
4060
+ * * `Err(SlimError)` - If app creation fails
5777
4061
  */
5778
- handle(stream: RequestStreamLike, context: ContextLike, asyncOpts_?: {
5779
- signal: AbortSignal;
5780
- }): Promise<ArrayBuffer>;
5781
- uniffiDestroy(): void;
5782
- static instanceOf(obj_: any): obj_ is StreamUnaryHandlerImpl;
5783
- }
5784
- /**
5785
- * Unary-to-Stream RPC handler trait
5786
- *
5787
- * Implement this trait to handle unary-to-stream RPC calls.
5788
- * The handler receives a single request and sends multiple responses via the sink.
5789
- */
5790
- export interface UnaryStreamHandler {
4062
+ static newWithDirection(name: NameLike, identityProviderConfig: IdentityProviderConfig, identityVerifierConfig: IdentityVerifierConfig, direction: Direction): AppLike;
5791
4063
  /**
5792
- * Handle a unary-to-stream RPC call
5793
- *
5794
- * # Arguments
5795
- * * `request` - The request message bytes
5796
- * * `context` - RPC context with metadata and session information
5797
- * * `sink` - Response sink to send streaming responses
5798
- *
5799
- * # Returns
5800
- * Ok(()) if handling succeeded, or an error
4064
+ * Create a new App with SharedSecret authentication (blocking version)
5801
4065
  *
5802
- * # Note
5803
- * You must call `sink.close()` or `sink.send_error()` when done.
5804
- */
5805
- handle(request: ArrayBuffer, context: ContextLike, sink: ResponseSinkLike, asyncOpts_?: {
5806
- signal: AbortSignal;
5807
- }): Promise<void>;
5808
- }
5809
- /**
5810
- * Unary-to-Stream RPC handler trait
5811
- *
5812
- * Implement this trait to handle unary-to-stream RPC calls.
5813
- * The handler receives a single request and sends multiple responses via the sink.
5814
- */
5815
- export declare class UnaryStreamHandlerImpl extends UniffiAbstractObject implements UnaryStreamHandler {
5816
- readonly [uniffiTypeNameSymbol] = "UnaryStreamHandlerImpl";
5817
- readonly [destructorGuardSymbol]: UniffiGcObject;
5818
- readonly [pointerLiteralSymbol]: UniffiHandle;
5819
- private constructor();
5820
- /**
5821
- * Handle a unary-to-stream RPC call
4066
+ * This is a convenience function for creating a SLIM application using SharedSecret authentication.
5822
4067
  *
5823
4068
  * # Arguments
5824
- * * `request` - The request message bytes
5825
- * * `context` - RPC context with metadata and session information
5826
- * * `sink` - Response sink to send streaming responses
4069
+ * * `name` - The base name for the app (without ID)
4070
+ * * `secret` - The shared secret string for authentication
5827
4071
  *
5828
4072
  * # Returns
5829
- * Ok(()) if handling succeeded, or an error
5830
- *
5831
- * # Note
5832
- * You must call `sink.close()` or `sink.send_error()` when done.
4073
+ * * `Ok(Arc<App>)` - Successfully created adapter
4074
+ * * `Err(SlimError)` - If adapter creation fails
5833
4075
  */
5834
- handle(request: ArrayBuffer, context: ContextLike, sink: ResponseSinkLike, asyncOpts_?: {
5835
- signal: AbortSignal;
5836
- }): Promise<void>;
5837
- uniffiDestroy(): void;
5838
- static instanceOf(obj_: any): obj_ is UnaryStreamHandlerImpl;
5839
- }
5840
- /**
5841
- * Unary-to-Unary RPC handler trait
5842
- *
5843
- * Implement this trait to handle unary-to-unary RPC calls.
5844
- * The handler receives a single request and returns a single response.
5845
- */
5846
- export interface UnaryUnaryHandler {
4076
+ static newWithSecret(name: NameLike, secret: string): AppLike;
5847
4077
  /**
5848
- * Handle a unary-to-unary RPC call
5849
- *
5850
- * # Arguments
5851
- * * `request` - The request message bytes
5852
- * * `context` - RPC context with metadata and session information
4078
+ * Create a new session (blocking version for FFI)
5853
4079
  *
5854
- * # Returns
5855
- * The response message bytes or an error
4080
+ * Returns a SessionWithCompletion containing the session context and a completion handle.
4081
+ * Call `.wait()` on the completion handle to wait for session establishment.
5856
4082
  */
5857
- handle(request: ArrayBuffer, context: ContextLike, asyncOpts_?: {
5858
- signal: AbortSignal;
5859
- }): Promise<ArrayBuffer>;
5860
- }
5861
- /**
5862
- * Unary-to-Unary RPC handler trait
5863
- *
5864
- * Implement this trait to handle unary-to-unary RPC calls.
5865
- * The handler receives a single request and returns a single response.
5866
- */
5867
- export declare class UnaryUnaryHandlerImpl extends UniffiAbstractObject implements UnaryUnaryHandler {
5868
- readonly [uniffiTypeNameSymbol] = "UnaryUnaryHandlerImpl";
5869
- readonly [destructorGuardSymbol]: UniffiGcObject;
5870
- readonly [pointerLiteralSymbol]: UniffiHandle;
5871
- private constructor();
4083
+ createSession(config: SessionConfig, destination: NameLike): SessionWithCompletion;
5872
4084
  /**
5873
- * Handle a unary-to-unary RPC call
5874
- *
5875
- * # Arguments
5876
- * * `request` - The request message bytes
5877
- * * `context` - RPC context with metadata and session information
4085
+ * Create a new session and wait for completion (blocking version)
5878
4086
  *
5879
- * # Returns
5880
- * The response message bytes or an error
4087
+ * This method creates a session and blocks until the session establishment completes.
4088
+ * Returns only the session context, as the completion has already been awaited.
5881
4089
  */
5882
- handle(request: ArrayBuffer, context: ContextLike, asyncOpts_?: {
5883
- signal: AbortSignal;
5884
- }): Promise<ArrayBuffer>;
5885
- uniffiDestroy(): void;
5886
- static instanceOf(obj_: any): obj_ is UnaryUnaryHandlerImpl;
5887
- }
5888
- /**
5889
- * RPC Server
5890
- *
5891
- * Handles incoming RPC requests by creating sessions and dispatching
5892
- * to registered service handlers.
5893
- *
5894
- * # Example
5895
- *
5896
- * ```no_run
5897
- * # use slim_bindings::{Server, Context, RpcError, Decoder, Encoder, App, Name};
5898
- * # use std::sync::Arc;
5899
- * # fn main() -> Result<(), Box<dyn std::error::Error>> {
5900
- * # use slim_bindings::{IdentityProviderConfig, IdentityVerifierConfig};
5901
- * # let app_name = Arc::new(Name::new("test".to_string(), "app".to_string(), "v1".to_string()));
5902
- * # let provider = IdentityProviderConfig::SharedSecret { id: "test".to_string(), data: "secret".to_string() };
5903
- * # let verifier = IdentityVerifierConfig::SharedSecret { id: "test".to_string(), data: "secret".to_string() };
5904
- * # let app = App::new(app_name, provider, verifier)?;
5905
- * # let core_app = app.inner();
5906
- * # let notification_rx = app.notification_receiver();
5907
- * # #[derive(Default)]
5908
- * # struct Request {}
5909
- * # impl Decoder for Request {
5910
- * # fn decode(_buf: impl Into<Vec<u8>>) -> Result<Self, RpcError> { Ok(Request::default()) }
5911
- * # }
5912
- * # #[derive(Default)]
5913
- * # struct Response {}
5914
- * # impl Encoder for Response {
5915
- * # fn encode(self) -> Result<Vec<u8>, RpcError> { Ok(vec![]) }
5916
- * # }
5917
- * let base_name = Name::new("org".to_string(), "namespace".to_string(), "service".to_string());
5918
- * let server = Server::new_with_shared_rx_and_connection(core_app, base_name.as_slim_name(), None, notification_rx, None);
5919
- *
5920
- * // Register handlers
5921
- * server.register_unary_unary_internal(
5922
- * "MyService",
5923
- * "MyMethod",
5924
- * |request: Request, _ctx: Context| async move {
5925
- * Ok(Response::default())
5926
- * }
5927
- * );
5928
- * # Ok(())
5929
- * # }
5930
- * ```
5931
- */
5932
- export interface ServerLike {
4090
+ createSessionAndWait(config: SessionConfig, destination: NameLike): SessionLike;
5933
4091
  /**
5934
- * Register a stream-to-stream RPC handler
4092
+ * Create a new session and wait for completion (async version)
5935
4093
  *
5936
- * # Arguments
5937
- * * `service_name` - The service name
5938
- * * `method_name` - The method name
5939
- * * `handler` - Implementation of the StreamStreamHandler trait
4094
+ * This method creates a session and waits until the session establishment completes.
4095
+ * Returns only the session context, as the completion has already been awaited.
5940
4096
  */
5941
- registerStreamStream(serviceName: string, methodName: string, handler: StreamStreamHandler): void;
4097
+ createSessionAndWaitAsync(config: SessionConfig, destination: NameLike, asyncOpts_?: {
4098
+ signal: AbortSignal;
4099
+ }): Promise<SessionLike>;
5942
4100
  /**
5943
- * Register a stream-to-unary RPC handler
4101
+ * Create a new session (async version)
5944
4102
  *
5945
- * # Arguments
5946
- * * `service_name` - The service name
5947
- * * `method_name` - The method name
5948
- * * `handler` - Implementation of the StreamUnaryHandler trait
4103
+ * Returns a SessionWithCompletion containing the session context and a completion handle.
4104
+ * Await the completion handle to wait for session establishment.
4105
+ * For point-to-point sessions, this ensures the remote peer has acknowledged the session.
4106
+ * For multicast sessions, this ensures the initial setup is complete.
5949
4107
  */
5950
- registerStreamUnary(serviceName: string, methodName: string, handler: StreamUnaryHandler): void;
4108
+ createSessionAsync(config: SessionConfig, destination: NameLike, asyncOpts_?: {
4109
+ signal: AbortSignal;
4110
+ }): Promise<SessionWithCompletion>;
5951
4111
  /**
5952
- * Register a unary-to-stream RPC handler
4112
+ * Delete a session (blocking version for FFI)
5953
4113
  *
5954
- * # Arguments
5955
- * * `service_name` - The service name
5956
- * * `method_name` - The method name
5957
- * * `handler` - Implementation of the UnaryStreamHandler trait
4114
+ * Returns a completion handle that can be awaited to ensure the deletion completes.
5958
4115
  */
5959
- registerUnaryStream(serviceName: string, methodName: string, handler: UnaryStreamHandler): void;
4116
+ deleteSession(session: SessionLike): CompletionHandleLike;
5960
4117
  /**
5961
- * Register a unary-to-unary RPC handler
4118
+ * Delete a session and wait for completion (blocking version)
5962
4119
  *
5963
- * # Arguments
5964
- * * `service_name` - The service name (e.g., "MyService")
5965
- * * `method_name` - The method name (e.g., "GetUser")
5966
- * * `handler` - Implementation of the UnaryUnaryHandler trait
4120
+ * This method deletes a session and blocks until the deletion completes.
5967
4121
  */
5968
- registerUnaryUnary(serviceName: string, methodName: string, handler: UnaryUnaryHandler): void;
4122
+ deleteSessionAndWait(session: SessionLike): void;
5969
4123
  /**
5970
- * Start serving RPC requests (blocking version)
4124
+ * Delete a session and wait for completion (async version)
5971
4125
  *
5972
- * This is a blocking method that runs until the server is shut down.
5973
- * It listens for incoming RPC calls and dispatches them to registered handlers.
4126
+ * This method deletes a session and waits until the deletion completes.
5974
4127
  */
5975
- serve(): void;
4128
+ deleteSessionAndWaitAsync(session: SessionLike, asyncOpts_?: {
4129
+ signal: AbortSignal;
4130
+ }): Promise<void>;
5976
4131
  /**
5977
- * Start serving RPC requests (async version)
4132
+ * Delete a session (async version)
5978
4133
  *
5979
- * This is an async method that runs until the server is shut down.
5980
- * It listens for incoming RPC calls and dispatches them to registered handlers.
4134
+ * Returns a completion handle that can be awaited to ensure the deletion completes.
5981
4135
  */
5982
- serveAsync(asyncOpts_?: {
4136
+ deleteSessionAsync(session: SessionLike, asyncOpts_?: {
5983
4137
  signal: AbortSignal;
5984
- }): Promise<void>;
4138
+ }): Promise<CompletionHandleLike>;
5985
4139
  /**
5986
- * Shutdown the server gracefully (blocking version)
5987
- *
5988
- * This signals the server to stop accepting new requests and wait for
5989
- * in-flight requests to complete.
4140
+ * Get the app ID in UUID format
5990
4141
  */
5991
- shutdown(): void;
4142
+ id(): string;
5992
4143
  /**
5993
- * Shutdown the server gracefully (async version)
5994
- *
5995
- * This signals the server to stop accepting new requests and wait for
5996
- * in-flight requests to complete.
4144
+ * Listen for incoming sessions (blocking version for FFI)
5997
4145
  */
5998
- shutdownAsync(asyncOpts_?: {
5999
- signal: AbortSignal;
6000
- }): Promise<void>;
6001
- }
6002
- /**
6003
- * @deprecated Use `ServerLike` instead.
6004
- */
6005
- export type ServerInterface = ServerLike;
6006
- /**
6007
- * RPC Server
6008
- *
6009
- * Handles incoming RPC requests by creating sessions and dispatching
6010
- * to registered service handlers.
6011
- *
6012
- * # Example
6013
- *
6014
- * ```no_run
6015
- * # use slim_bindings::{Server, Context, RpcError, Decoder, Encoder, App, Name};
6016
- * # use std::sync::Arc;
6017
- * # fn main() -> Result<(), Box<dyn std::error::Error>> {
6018
- * # use slim_bindings::{IdentityProviderConfig, IdentityVerifierConfig};
6019
- * # let app_name = Arc::new(Name::new("test".to_string(), "app".to_string(), "v1".to_string()));
6020
- * # let provider = IdentityProviderConfig::SharedSecret { id: "test".to_string(), data: "secret".to_string() };
6021
- * # let verifier = IdentityVerifierConfig::SharedSecret { id: "test".to_string(), data: "secret".to_string() };
6022
- * # let app = App::new(app_name, provider, verifier)?;
6023
- * # let core_app = app.inner();
6024
- * # let notification_rx = app.notification_receiver();
6025
- * # #[derive(Default)]
6026
- * # struct Request {}
6027
- * # impl Decoder for Request {
6028
- * # fn decode(_buf: impl Into<Vec<u8>>) -> Result<Self, RpcError> { Ok(Request::default()) }
6029
- * # }
6030
- * # #[derive(Default)]
6031
- * # struct Response {}
6032
- * # impl Encoder for Response {
6033
- * # fn encode(self) -> Result<Vec<u8>, RpcError> { Ok(vec![]) }
6034
- * # }
6035
- * let base_name = Name::new("org".to_string(), "namespace".to_string(), "service".to_string());
6036
- * let server = Server::new_with_shared_rx_and_connection(core_app, base_name.as_slim_name(), None, notification_rx, None);
6037
- *
6038
- * // Register handlers
6039
- * server.register_unary_unary_internal(
6040
- * "MyService",
6041
- * "MyMethod",
6042
- * |request: Request, _ctx: Context| async move {
6043
- * Ok(Response::default())
6044
- * }
6045
- * );
6046
- * # Ok(())
6047
- * # }
6048
- * ```
6049
- */
6050
- export declare class Server extends UniffiAbstractObject implements ServerLike {
6051
- readonly [uniffiTypeNameSymbol] = "Server";
6052
- readonly [destructorGuardSymbol]: UniffiGcObject;
6053
- readonly [pointerLiteralSymbol]: UniffiHandle;
4146
+ listenForSession(timeout: number | undefined): SessionLike;
6054
4147
  /**
6055
- * Create a new RPC server
6056
- *
6057
- * This is the primary constructor for creating an RPC server instance
6058
- * that can handle incoming RPC requests over SLIM.
6059
- *
6060
- * # Arguments
6061
- * * `app` - The SLIM application instance that provides the underlying
6062
- * network transport and session management
6063
- * * `base_name` - The base name for this service (e.g., org.namespace.service).
6064
- * This name is used to construct subscription names for RPC methods.
6065
- *
6066
- * # Returns
6067
- * A new RPC server instance wrapped in an Arc for shared ownership
4148
+ * Listen for incoming sessions (async version)
6068
4149
  */
6069
- constructor(app: AppLike, baseName: NameLike);
4150
+ listenForSessionAsync(timeout: number | undefined, asyncOpts_?: {
4151
+ signal: AbortSignal;
4152
+ }): Promise<SessionLike>;
6070
4153
  /**
6071
- * Create a new RPC server with optional connection ID
6072
- *
6073
- * The connection ID is used to set up routing before serving RPC requests,
6074
- * enabling multi-hop RPC calls through specific connections.
6075
- *
6076
- * # Arguments
6077
- * * `app` - The SLIM application instance that provides the underlying
6078
- * network transport and session management
6079
- * * `base_name` - The base name for this service (e.g., org.namespace.service).
6080
- * This name is used to construct subscription names for RPC methods.
6081
- * * `connection_id` - Optional connection ID for routing setup
6082
- *
6083
- * # Returns
6084
- * A new RPC server instance wrapped in an Arc for shared ownership
4154
+ * Get the app name
6085
4155
  */
6086
- static newWithConnection(app: AppLike, baseName: NameLike, connectionId: bigint | undefined): ServerLike;
4156
+ name(): NameLike;
6087
4157
  /**
6088
- * Register a stream-to-stream RPC handler
6089
- *
6090
- * # Arguments
6091
- * * `service_name` - The service name
6092
- * * `method_name` - The method name
6093
- * * `handler` - Implementation of the StreamStreamHandler trait
4158
+ * Remove a route (blocking version for FFI)
6094
4159
  */
6095
- registerStreamStream(serviceName: string, methodName: string, handler: StreamStreamHandler): void;
4160
+ removeRoute(name: NameLike, connectionId: bigint): void;
6096
4161
  /**
6097
- * Register a stream-to-unary RPC handler
6098
- *
6099
- * # Arguments
6100
- * * `service_name` - The service name
6101
- * * `method_name` - The method name
6102
- * * `handler` - Implementation of the StreamUnaryHandler trait
4162
+ * Remove a route (async version)
6103
4163
  */
6104
- registerStreamUnary(serviceName: string, methodName: string, handler: StreamUnaryHandler): void;
4164
+ removeRouteAsync(name: NameLike, connectionId: bigint, asyncOpts_?: {
4165
+ signal: AbortSignal;
4166
+ }): Promise<void>;
6105
4167
  /**
6106
- * Register a unary-to-stream RPC handler
6107
- *
6108
- * # Arguments
6109
- * * `service_name` - The service name
6110
- * * `method_name` - The method name
6111
- * * `handler` - Implementation of the UnaryStreamHandler trait
4168
+ * Set a route to a name for a specific connection (blocking version for FFI)
6112
4169
  */
6113
- registerUnaryStream(serviceName: string, methodName: string, handler: UnaryStreamHandler): void;
4170
+ setRoute(name: NameLike, connectionId: bigint): void;
6114
4171
  /**
6115
- * Register a unary-to-unary RPC handler
6116
- *
6117
- * # Arguments
6118
- * * `service_name` - The service name (e.g., "MyService")
6119
- * * `method_name` - The method name (e.g., "GetUser")
6120
- * * `handler` - Implementation of the UnaryUnaryHandler trait
4172
+ * Set a route to a name for a specific connection (async version)
6121
4173
  */
6122
- registerUnaryUnary(serviceName: string, methodName: string, handler: UnaryUnaryHandler): void;
4174
+ setRouteAsync(name: NameLike, connectionId: bigint, asyncOpts_?: {
4175
+ signal: AbortSignal;
4176
+ }): Promise<void>;
6123
4177
  /**
6124
- * Start serving RPC requests (blocking version)
6125
- *
6126
- * This is a blocking method that runs until the server is shut down.
6127
- * It listens for incoming RPC calls and dispatches them to registered handlers.
4178
+ * Subscribe to a session name (blocking version for FFI)
6128
4179
  */
6129
- serve(): void;
4180
+ subscribe(name: NameLike, connectionId: bigint | undefined): void;
6130
4181
  /**
6131
- * Start serving RPC requests (async version)
6132
- *
6133
- * This is an async method that runs until the server is shut down.
6134
- * It listens for incoming RPC calls and dispatches them to registered handlers.
4182
+ * Subscribe to a name (async version)
6135
4183
  */
6136
- serveAsync(asyncOpts_?: {
4184
+ subscribeAsync(name: NameLike, connectionId: bigint | undefined, asyncOpts_?: {
6137
4185
  signal: AbortSignal;
6138
4186
  }): Promise<void>;
6139
4187
  /**
6140
- * Shutdown the server gracefully (blocking version)
6141
- *
6142
- * This signals the server to stop accepting new requests and wait for
6143
- * in-flight requests to complete.
4188
+ * Unsubscribe from a name (blocking version for FFI)
6144
4189
  */
6145
- shutdown(): void;
4190
+ unsubscribe(name: NameLike, connectionId: bigint | undefined): void;
6146
4191
  /**
6147
- * Shutdown the server gracefully (async version)
6148
- *
6149
- * This signals the server to stop accepting new requests and wait for
6150
- * in-flight requests to complete.
4192
+ * Unsubscribe from a name (async version)
6151
4193
  */
6152
- shutdownAsync(asyncOpts_?: {
4194
+ unsubscribeAsync(name: NameLike, connectionId: bigint | undefined, asyncOpts_?: {
6153
4195
  signal: AbortSignal;
6154
4196
  }): Promise<void>;
6155
4197
  uniffiDestroy(): void;
6156
- static instanceOf(obj_: any): obj_ is Server;
4198
+ static instanceOf(obj_: any): obj_ is App;
6157
4199
  }
6158
4200
  /**
6159
4201
  * Service wrapper for uniffi bindings
@@ -6539,7 +4581,6 @@ declare const _default: Readonly<{
6539
4581
  lift(value: UniffiByteArray): BasicAuth;
6540
4582
  lower(value: BasicAuth, alloc: import("@ubjs/core").RustBufferAllocator): UniffiByteArray;
6541
4583
  };
6542
- FfiConverterTypeBidiStreamHandler: FfiConverterObject<BidiStreamHandlerLike>;
6543
4584
  FfiConverterTypeBuildInfo: {
6544
4585
  read(from: RustBuffer): BuildInfo;
6545
4586
  write(value: BuildInfo, into: RustBuffer): void;
@@ -6554,7 +4595,6 @@ declare const _default: Readonly<{
6554
4595
  lift(value: UniffiByteArray): CaSource;
6555
4596
  lower(value: CaSource, alloc: import("@ubjs/core").RustBufferAllocator): UniffiByteArray;
6556
4597
  };
6557
- FfiConverterTypeChannel: FfiConverterObject<ChannelLike>;
6558
4598
  FfiConverterTypeClientAuthenticationConfig: {
6559
4599
  read(from: RustBuffer): ClientAuthenticationConfig;
6560
4600
  write(value: ClientAuthenticationConfig, into: RustBuffer): void;
@@ -6584,7 +4624,6 @@ declare const _default: Readonly<{
6584
4624
  lift(value: UniffiByteArray): CompressionType;
6585
4625
  lower(value: CompressionType, alloc: import("@ubjs/core").RustBufferAllocator): UniffiByteArray;
6586
4626
  };
6587
- FfiConverterTypeContext: FfiConverterObject<ContextLike>;
6588
4627
  FfiConverterTypeDataplaneConfig: {
6589
4628
  read(from: RustBuffer): DataplaneConfig;
6590
4629
  write(value: DataplaneConfig, into: RustBuffer): void;
@@ -6697,15 +4736,6 @@ declare const _default: Readonly<{
6697
4736
  lift(value: UniffiByteArray): MlsSettings;
6698
4737
  lower(value: MlsSettings, alloc: import("@ubjs/core").RustBufferAllocator): UniffiByteArray;
6699
4738
  };
6700
- FfiConverterTypeMulticastBidiStreamHandler: FfiConverterObject<MulticastBidiStreamHandlerLike>;
6701
- FfiConverterTypeMulticastResponseReader: FfiConverterObject<MulticastResponseReaderLike>;
6702
- FfiConverterTypeMulticastStreamMessage: {
6703
- read(from: RustBuffer): MulticastStreamMessage;
6704
- write(value: MulticastStreamMessage, into: RustBuffer): void;
6705
- allocationSize(value: MulticastStreamMessage): number;
6706
- lift(value: UniffiByteArray): MulticastStreamMessage;
6707
- lower(value: MulticastStreamMessage, alloc: import("@ubjs/core").RustBufferAllocator): UniffiByteArray;
6708
- };
6709
4739
  FfiConverterTypeName: FfiConverterObject<NameLike>;
6710
4740
  FfiConverterTypeProxyConfig: {
6711
4741
  read(from: RustBuffer): ProxyConfig;
@@ -6721,38 +4751,6 @@ declare const _default: Readonly<{
6721
4751
  lift(value: UniffiByteArray): ReceivedMessage;
6722
4752
  lower(value: ReceivedMessage, alloc: import("@ubjs/core").RustBufferAllocator): UniffiByteArray;
6723
4753
  };
6724
- FfiConverterTypeRequestStream: FfiConverterObject<RequestStreamLike>;
6725
- FfiConverterTypeRequestStreamWriter: FfiConverterObject<RequestStreamWriterLike>;
6726
- FfiConverterTypeResponseSink: FfiConverterObject<ResponseSinkLike>;
6727
- FfiConverterTypeResponseStreamReader: FfiConverterObject<ResponseStreamReaderLike>;
6728
- FfiConverterTypeRpcCode: {
6729
- read(from: RustBuffer): RpcCode;
6730
- write(value: RpcCode, into: RustBuffer): void;
6731
- allocationSize(value: RpcCode): number;
6732
- lift(value: UniffiByteArray): RpcCode;
6733
- lower(value: RpcCode, alloc: import("@ubjs/core").RustBufferAllocator): UniffiByteArray;
6734
- };
6735
- FfiConverterTypeRpcError: {
6736
- read(from: RustBuffer): RpcError;
6737
- write(value: RpcError, into: RustBuffer): void;
6738
- allocationSize(value: RpcError): number;
6739
- lift(value: UniffiByteArray): RpcError;
6740
- lower(value: RpcError, alloc: import("@ubjs/core").RustBufferAllocator): UniffiByteArray;
6741
- };
6742
- FfiConverterTypeRpcMessageContext: {
6743
- read(from: RustBuffer): RpcMessageContext;
6744
- write(value: RpcMessageContext, into: RustBuffer): void;
6745
- allocationSize(value: RpcMessageContext): number;
6746
- lift(value: UniffiByteArray): RpcMessageContext;
6747
- lower(value: RpcMessageContext, alloc: import("@ubjs/core").RustBufferAllocator): UniffiByteArray;
6748
- };
6749
- FfiConverterTypeRpcMulticastItem: {
6750
- read(from: RustBuffer): RpcMulticastItem;
6751
- write(value: RpcMulticastItem, into: RustBuffer): void;
6752
- allocationSize(value: RpcMulticastItem): number;
6753
- lift(value: UniffiByteArray): RpcMulticastItem;
6754
- lower(value: RpcMulticastItem, alloc: import("@ubjs/core").RustBufferAllocator): UniffiByteArray;
6755
- };
6756
4754
  FfiConverterTypeRuntimeConfig: {
6757
4755
  read(from: RustBuffer): RuntimeConfig;
6758
4756
  write(value: RuntimeConfig, into: RustBuffer): void;
@@ -6760,7 +4758,6 @@ declare const _default: Readonly<{
6760
4758
  lift(value: UniffiByteArray): RuntimeConfig;
6761
4759
  lower(value: RuntimeConfig, alloc: import("@ubjs/core").RustBufferAllocator): UniffiByteArray;
6762
4760
  };
6763
- FfiConverterTypeServer: FfiConverterObject<ServerLike>;
6764
4761
  FfiConverterTypeServerAuthenticationConfig: {
6765
4762
  read(from: RustBuffer): ServerAuthenticationConfig;
6766
4763
  write(value: ServerAuthenticationConfig, into: RustBuffer): void;
@@ -6826,15 +4823,6 @@ declare const _default: Readonly<{
6826
4823
  lift(value: UniffiByteArray): StaticJwtAuth;
6827
4824
  lower(value: StaticJwtAuth, alloc: import("@ubjs/core").RustBufferAllocator): UniffiByteArray;
6828
4825
  };
6829
- FfiConverterTypeStreamMessage: {
6830
- read(from: RustBuffer): StreamMessage;
6831
- write(value: StreamMessage, into: RustBuffer): void;
6832
- allocationSize(value: StreamMessage): number;
6833
- lift(value: UniffiByteArray): StreamMessage;
6834
- lower(value: StreamMessage, alloc: import("@ubjs/core").RustBufferAllocator): UniffiByteArray;
6835
- };
6836
- FfiConverterTypeStreamStreamHandler: FfiConverterObjectWithCallbacks<StreamStreamHandler>;
6837
- FfiConverterTypeStreamUnaryHandler: FfiConverterObjectWithCallbacks<StreamUnaryHandler>;
6838
4826
  FfiConverterTypeTlsClientConfig: {
6839
4827
  read(from: RustBuffer): TlsClientConfig;
6840
4828
  write(value: TlsClientConfig, into: RustBuffer): void;
@@ -6870,8 +4858,6 @@ declare const _default: Readonly<{
6870
4858
  lift(value: UniffiByteArray): TransportProtocol;
6871
4859
  lower(value: TransportProtocol, alloc: import("@ubjs/core").RustBufferAllocator): UniffiByteArray;
6872
4860
  };
6873
- FfiConverterTypeUnaryStreamHandler: FfiConverterObjectWithCallbacks<UnaryStreamHandler>;
6874
- FfiConverterTypeUnaryUnaryHandler: FfiConverterObjectWithCallbacks<UnaryUnaryHandler>;
6875
4861
  };
6876
4862
  }>;
6877
4863
  export default _default;