ffi-bindings 1.0.0 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +23 -4
- package/src/generated/matrix_sdk.ts +1843 -0
- package/src/generated/matrix_sdk_base.ts +252 -0
- package/src/generated/matrix_sdk_common.ts +370 -0
- package/src/generated/matrix_sdk_crypto.ts +1280 -0
- package/src/generated/matrix_sdk_ffi.ts +65263 -0
- package/src/generated/matrix_sdk_ui.ts +816 -0
- package/src/generated/wasm-bindgen/index.d.ts +5455 -0
- package/src/generated/wasm-bindgen/index.js +14223 -0
- package/src/generated/wasm-bindgen/index_bg.wasm +0 -0
- package/src/generated/wasm-bindgen/index_bg.wasm.d.ts +2840 -0
- package/src/generated-compat/matrix_sdk.js +454 -395
- package/src/generated-compat/matrix_sdk_base.js +39 -34
- package/src/generated-compat/matrix_sdk_common.js +245 -35
- package/src/generated-compat/matrix_sdk_crypto.js +547 -128
- package/src/generated-compat/matrix_sdk_ffi.js +3057 -2696
- package/src/generated-compat/matrix_sdk_ui.js +580 -46
- package/src/generated-compat/wasm-bindgen/index.d.js +66 -0
- package/src/generated-compat/wasm-bindgen/index.d.ts +5455 -0
- package/src/generated-compat/wasm-bindgen/index.js +10572 -8359
- package/src/generated-compat/wasm-bindgen/index_bg.wasm +0 -0
- package/src/generated-compat/wasm-bindgen/index_bg.wasm.d.ts +2840 -0
- package/src/index.web.js +126 -34
- package/src/index.web.js.bak +132 -0
- package/src/index.web.ts +46 -0
- package/src/index.web.ts.bak +46 -0
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
// This file was autogenerated by some hot garbage in the `uniffi-bindgen-react-native` crate.
|
|
2
|
+
// Trust me, you don't want to mess with it!
|
|
3
|
+
|
|
4
|
+
/* tslint:disable */
|
|
5
|
+
/* eslint-disable */
|
|
6
|
+
// @ts-nocheck
|
|
7
|
+
import * as wasmBundle from "./wasm-bindgen/index.js";
|
|
8
|
+
import {
|
|
9
|
+
type UniffiByteArray,
|
|
10
|
+
type UniffiDuration,
|
|
11
|
+
AbstractFfiConverterByteArray,
|
|
12
|
+
FfiConverterBool,
|
|
13
|
+
FfiConverterDuration,
|
|
14
|
+
FfiConverterInt32,
|
|
15
|
+
FfiConverterOptional,
|
|
16
|
+
FfiConverterUInt64,
|
|
17
|
+
RustBuffer,
|
|
18
|
+
UniffiInternalError,
|
|
19
|
+
UniffiRustCaller,
|
|
20
|
+
uniffiCreateFfiConverterString,
|
|
21
|
+
uniffiCreateRecord } from "uniffi-bindgen-react-native";
|
|
22
|
+
|
|
23
|
+
// Get converters from the other files, if any.
|
|
24
|
+
const nativeModule = () => wasmBundle;
|
|
25
|
+
const uniffiCaller = new UniffiRustCaller(() => new wasmBundle.RustCallStatus());
|
|
26
|
+
|
|
27
|
+
const uniffiIsDebug =
|
|
28
|
+
// @ts-ignore -- The process global might not be defined
|
|
29
|
+
typeof process !== "object" ||
|
|
30
|
+
// @ts-ignore -- The process global might not be defined
|
|
31
|
+
process?.env?.NODE_ENV !== "production" ||
|
|
32
|
+
false;
|
|
33
|
+
// Public interface members begin here.
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* The retention policy for media content used by the [`MediaStore`].
|
|
45
|
+
*
|
|
46
|
+
* [`EventCacheStore`]: crate::event_cache::store::EventCacheStore
|
|
47
|
+
*/
|
|
48
|
+
export type MediaRetentionPolicy = {
|
|
49
|
+
/**
|
|
50
|
+
* The maximum authorized size of the overall media cache, in bytes.
|
|
51
|
+
*
|
|
52
|
+
* The cache size is defined as the sum of the sizes of all the (possibly
|
|
53
|
+
* encrypted) media contents in the cache, excluding any metadata
|
|
54
|
+
* associated with them.
|
|
55
|
+
*
|
|
56
|
+
* If this is set and the cache size is bigger than this value, the oldest
|
|
57
|
+
* media contents in the cache will be removed during a cleanup until the
|
|
58
|
+
* cache size is below this threshold.
|
|
59
|
+
*
|
|
60
|
+
* Note that it is possible for the cache size to temporarily exceed this
|
|
61
|
+
* value between two cleanups.
|
|
62
|
+
*
|
|
63
|
+
* Defaults to 400 MiB.
|
|
64
|
+
*/
|
|
65
|
+
maxCacheSize?: /*u64*/bigint,
|
|
66
|
+
/**
|
|
67
|
+
* The maximum authorized size of a single media content, in bytes.
|
|
68
|
+
*
|
|
69
|
+
* The size of a media content is the size taken by the content in the
|
|
70
|
+
* database, after it was possibly encrypted, so it might differ from the
|
|
71
|
+
* initial size of the content.
|
|
72
|
+
*
|
|
73
|
+
* The maximum authorized size of a single media content is actually the
|
|
74
|
+
* lowest value between `max_cache_size` and `max_file_size`.
|
|
75
|
+
*
|
|
76
|
+
* If it is set, media content bigger than the maximum size will not be
|
|
77
|
+
* cached. If the maximum size changed after media content that exceeds the
|
|
78
|
+
* new value was cached, the corresponding content will be removed
|
|
79
|
+
* during a cleanup.
|
|
80
|
+
*
|
|
81
|
+
* Defaults to 20 MiB.
|
|
82
|
+
*/
|
|
83
|
+
maxFileSize?: /*u64*/bigint,
|
|
84
|
+
/**
|
|
85
|
+
* The duration after which unaccessed media content is considered
|
|
86
|
+
* expired.
|
|
87
|
+
*
|
|
88
|
+
* If this is set, media content whose last access is older than this
|
|
89
|
+
* duration will be removed from the media cache during a cleanup.
|
|
90
|
+
*
|
|
91
|
+
* Defaults to 60 days.
|
|
92
|
+
*/
|
|
93
|
+
lastAccessExpiry?: UniffiDuration,
|
|
94
|
+
/**
|
|
95
|
+
* The duration between two automatic media cache cleanups.
|
|
96
|
+
*
|
|
97
|
+
* If this is set, a cleanup will be triggered after the given duration
|
|
98
|
+
* is elapsed, at the next call to the media cache API. If this is set to
|
|
99
|
+
* zero, each call to the media cache API will trigger a cleanup. If this
|
|
100
|
+
* is `None`, cleanups will only occur if they are triggered manually.
|
|
101
|
+
*
|
|
102
|
+
* Defaults to running cleanups daily.
|
|
103
|
+
*/
|
|
104
|
+
cleanupFrequency?: UniffiDuration
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Generated factory for {@link MediaRetentionPolicy} record objects.
|
|
109
|
+
*/
|
|
110
|
+
export const MediaRetentionPolicy = (() => {
|
|
111
|
+
const defaults = () => ({
|
|
112
|
+
});
|
|
113
|
+
const create = (() => {
|
|
114
|
+
return uniffiCreateRecord<MediaRetentionPolicy, ReturnType<typeof defaults>>(defaults);
|
|
115
|
+
})();
|
|
116
|
+
return Object.freeze({
|
|
117
|
+
create,
|
|
118
|
+
new: create,
|
|
119
|
+
defaults: () => Object.freeze(defaults()) as Partial<MediaRetentionPolicy>,
|
|
120
|
+
|
|
121
|
+
});
|
|
122
|
+
})();
|
|
123
|
+
|
|
124
|
+
const FfiConverterTypeMediaRetentionPolicy = (() => {
|
|
125
|
+
type TypeName = MediaRetentionPolicy;
|
|
126
|
+
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
|
|
127
|
+
read(from: RustBuffer): TypeName {
|
|
128
|
+
return {
|
|
129
|
+
maxCacheSize: FfiConverterOptionalUInt64.read(from),
|
|
130
|
+
maxFileSize: FfiConverterOptionalUInt64.read(from),
|
|
131
|
+
lastAccessExpiry: FfiConverterOptionalDuration.read(from),
|
|
132
|
+
cleanupFrequency: FfiConverterOptionalDuration.read(from)
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
write(value: TypeName, into: RustBuffer): void {
|
|
136
|
+
FfiConverterOptionalUInt64.write(value.maxCacheSize, into);
|
|
137
|
+
FfiConverterOptionalUInt64.write(value.maxFileSize, into);
|
|
138
|
+
FfiConverterOptionalDuration.write(value.lastAccessExpiry, into);
|
|
139
|
+
FfiConverterOptionalDuration.write(value.cleanupFrequency, into);
|
|
140
|
+
}
|
|
141
|
+
allocationSize(value: TypeName): number {
|
|
142
|
+
return FfiConverterOptionalUInt64.allocationSize(value.maxCacheSize) +
|
|
143
|
+
FfiConverterOptionalUInt64.allocationSize(value.maxFileSize) +
|
|
144
|
+
FfiConverterOptionalDuration.allocationSize(value.lastAccessExpiry) +
|
|
145
|
+
FfiConverterOptionalDuration.allocationSize(value.cleanupFrequency);
|
|
146
|
+
|
|
147
|
+
}
|
|
148
|
+
};
|
|
149
|
+
return new FFIConverter();
|
|
150
|
+
})();
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
const stringConverter = (() => {
|
|
154
|
+
const encoder = new TextEncoder();
|
|
155
|
+
const decoder = new TextDecoder();
|
|
156
|
+
return {
|
|
157
|
+
stringToBytes: (s: string) => encoder.encode(s),
|
|
158
|
+
bytesToString: (ab: UniffiByteArray) => decoder.decode(ab),
|
|
159
|
+
stringByteLength: (s: string) => encoder.encode(s).byteLength,
|
|
160
|
+
};
|
|
161
|
+
})();
|
|
162
|
+
const FfiConverterString = uniffiCreateFfiConverterString(stringConverter);
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* Represents the state of a room encryption.
|
|
169
|
+
*/
|
|
170
|
+
export enum EncryptionState {
|
|
171
|
+
/**
|
|
172
|
+
* The room is encrypted.
|
|
173
|
+
*/
|
|
174
|
+
Encrypted,
|
|
175
|
+
/**
|
|
176
|
+
* The room is not encrypted.
|
|
177
|
+
*/
|
|
178
|
+
NotEncrypted,
|
|
179
|
+
/**
|
|
180
|
+
* The state of the room encryption is unknown, probably because the
|
|
181
|
+
* `/sync` did not provide all data needed to decide.
|
|
182
|
+
*/
|
|
183
|
+
Unknown
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
const FfiConverterTypeEncryptionState = (() => {
|
|
187
|
+
const ordinalConverter = FfiConverterInt32;
|
|
188
|
+
type TypeName = EncryptionState;
|
|
189
|
+
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
|
|
190
|
+
read(from: RustBuffer): TypeName {
|
|
191
|
+
switch (ordinalConverter.read(from)) {
|
|
192
|
+
case 1: return EncryptionState.Encrypted;
|
|
193
|
+
case 2: return EncryptionState.NotEncrypted;
|
|
194
|
+
case 3: return EncryptionState.Unknown;
|
|
195
|
+
default: throw new UniffiInternalError.UnexpectedEnumCase();
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
write(value: TypeName, into: RustBuffer): void {
|
|
199
|
+
switch (value) {
|
|
200
|
+
case EncryptionState.Encrypted: return ordinalConverter.write(1, into);
|
|
201
|
+
case EncryptionState.NotEncrypted: return ordinalConverter.write(2, into);
|
|
202
|
+
case EncryptionState.Unknown: return ordinalConverter.write(3, into);
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
allocationSize(value: TypeName): number {
|
|
206
|
+
return ordinalConverter.allocationSize(0);
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
return new FFIConverter();
|
|
210
|
+
})();
|
|
211
|
+
|
|
212
|
+
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
|
|
216
|
+
// FfiConverter for UniffiDuration | undefined
|
|
217
|
+
const FfiConverterOptionalDuration = new FfiConverterOptional(FfiConverterDuration);
|
|
218
|
+
|
|
219
|
+
|
|
220
|
+
// FfiConverter for /*u64*/bigint | undefined
|
|
221
|
+
const FfiConverterOptionalUInt64 = new FfiConverterOptional(FfiConverterUInt64);
|
|
222
|
+
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
/**
|
|
226
|
+
* This should be called before anything else.
|
|
227
|
+
*
|
|
228
|
+
* It is likely that this is being done for you by the library's `index.ts`.
|
|
229
|
+
*
|
|
230
|
+
* It checks versions of uniffi between when the Rust scaffolding was generated
|
|
231
|
+
* and when the bindings were generated.
|
|
232
|
+
*
|
|
233
|
+
* It also initializes the machinery to enable Rust to talk back to Javascript.
|
|
234
|
+
*/
|
|
235
|
+
function uniffiEnsureInitialized() {
|
|
236
|
+
// Get the bindings contract version from our ComponentInterface
|
|
237
|
+
const bindingsContractVersion = 30;
|
|
238
|
+
// Get the scaffolding contract version by calling the into the dylib
|
|
239
|
+
const scaffoldingContractVersion = nativeModule().ubrn_ffi_matrix_sdk_base_uniffi_contract_version();
|
|
240
|
+
if (bindingsContractVersion !== scaffoldingContractVersion) {
|
|
241
|
+
throw new UniffiInternalError.ContractVersionMismatch(scaffoldingContractVersion, bindingsContractVersion);
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
export default Object.freeze({
|
|
247
|
+
initialize: uniffiEnsureInitialized,
|
|
248
|
+
converters: {
|
|
249
|
+
FfiConverterTypeEncryptionState,
|
|
250
|
+
FfiConverterTypeMediaRetentionPolicy,
|
|
251
|
+
}
|
|
252
|
+
});
|
|
@@ -0,0 +1,370 @@
|
|
|
1
|
+
// This file was autogenerated by some hot garbage in the `uniffi-bindgen-react-native` crate.
|
|
2
|
+
// Trust me, you don't want to mess with it!
|
|
3
|
+
|
|
4
|
+
/* tslint:disable */
|
|
5
|
+
/* eslint-disable */
|
|
6
|
+
// @ts-nocheck
|
|
7
|
+
import * as wasmBundle from "./wasm-bindgen/index.js";
|
|
8
|
+
import {
|
|
9
|
+
type UniffiByteArray,
|
|
10
|
+
AbstractFfiConverterByteArray,
|
|
11
|
+
FfiConverterBool,
|
|
12
|
+
FfiConverterInt32,
|
|
13
|
+
FfiConverterOptional,
|
|
14
|
+
RustBuffer,
|
|
15
|
+
UniffiEnum,
|
|
16
|
+
UniffiInternalError,
|
|
17
|
+
UniffiRustCaller,
|
|
18
|
+
uniffiCreateFfiConverterString,
|
|
19
|
+
uniffiTypeNameSymbol } from "uniffi-bindgen-react-native";
|
|
20
|
+
|
|
21
|
+
// Get converters from the other files, if any.
|
|
22
|
+
const nativeModule = () => wasmBundle;
|
|
23
|
+
const uniffiCaller = new UniffiRustCaller(() => new wasmBundle.RustCallStatus());
|
|
24
|
+
|
|
25
|
+
const uniffiIsDebug =
|
|
26
|
+
// @ts-ignore -- The process global might not be defined
|
|
27
|
+
typeof process !== "object" ||
|
|
28
|
+
// @ts-ignore -- The process global might not be defined
|
|
29
|
+
process?.env?.NODE_ENV !== "production" ||
|
|
30
|
+
false;
|
|
31
|
+
// Public interface members begin here.
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
const stringConverter = (() => {
|
|
40
|
+
const encoder = new TextEncoder();
|
|
41
|
+
const decoder = new TextDecoder();
|
|
42
|
+
return {
|
|
43
|
+
stringToBytes: (s: string) => encoder.encode(s),
|
|
44
|
+
bytesToString: (ab: UniffiByteArray) => decoder.decode(ab),
|
|
45
|
+
stringByteLength: (s: string) => encoder.encode(s).byteLength,
|
|
46
|
+
};
|
|
47
|
+
})();
|
|
48
|
+
const FfiConverterString = uniffiCreateFfiConverterString(stringConverter);
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
// Enum: BackgroundTaskFailureReason
|
|
52
|
+
export enum BackgroundTaskFailureReason_Tags {
|
|
53
|
+
Panic = "Panic",
|
|
54
|
+
Error = "Error",
|
|
55
|
+
EarlyTermination = "EarlyTermination"
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Reason why a background task failed.
|
|
59
|
+
*/
|
|
60
|
+
export const BackgroundTaskFailureReason = (() => {
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
type Panic__interface = {
|
|
64
|
+
tag: BackgroundTaskFailureReason_Tags.Panic;
|
|
65
|
+
inner: Readonly<{message: string | undefined; panicBacktrace: string | undefined}>
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* The task panicked.
|
|
71
|
+
*/
|
|
72
|
+
class Panic_ extends UniffiEnum implements Panic__interface {
|
|
73
|
+
/**
|
|
74
|
+
* @private
|
|
75
|
+
* This field is private and should not be used, use `tag` instead.
|
|
76
|
+
*/
|
|
77
|
+
readonly [uniffiTypeNameSymbol] = "BackgroundTaskFailureReason";
|
|
78
|
+
readonly tag = BackgroundTaskFailureReason_Tags.Panic;
|
|
79
|
+
readonly inner: Readonly<{message: string | undefined; panicBacktrace: string | undefined}>;
|
|
80
|
+
constructor(inner: {
|
|
81
|
+
/**
|
|
82
|
+
* The panic message, if it could be extracted.
|
|
83
|
+
*/message: string | undefined,
|
|
84
|
+
/**
|
|
85
|
+
* Backtrace captured after the panic (if available).
|
|
86
|
+
*/panicBacktrace: string | undefined }) {
|
|
87
|
+
super("BackgroundTaskFailureReason", "Panic");
|
|
88
|
+
this.inner = Object.freeze(inner);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
static new(inner: {
|
|
92
|
+
/**
|
|
93
|
+
* The panic message, if it could be extracted.
|
|
94
|
+
*/message: string | undefined,
|
|
95
|
+
/**
|
|
96
|
+
* Backtrace captured after the panic (if available).
|
|
97
|
+
*/panicBacktrace: string | undefined }): Panic_ {
|
|
98
|
+
return new Panic_(inner);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
static instanceOf(obj: any): obj is Panic_ {
|
|
102
|
+
return obj.tag === BackgroundTaskFailureReason_Tags.Panic;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
type Error__interface = {
|
|
112
|
+
tag: BackgroundTaskFailureReason_Tags.Error;
|
|
113
|
+
inner: Readonly<{error: string}>
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* The task returned an error.
|
|
119
|
+
*/
|
|
120
|
+
class Error_ extends UniffiEnum implements Error__interface {
|
|
121
|
+
/**
|
|
122
|
+
* @private
|
|
123
|
+
* This field is private and should not be used, use `tag` instead.
|
|
124
|
+
*/
|
|
125
|
+
readonly [uniffiTypeNameSymbol] = "BackgroundTaskFailureReason";
|
|
126
|
+
readonly tag = BackgroundTaskFailureReason_Tags.Error;
|
|
127
|
+
readonly inner: Readonly<{error: string}>;
|
|
128
|
+
constructor(inner: {
|
|
129
|
+
/**
|
|
130
|
+
* String representation of the error.
|
|
131
|
+
*/error: string }) {
|
|
132
|
+
super("BackgroundTaskFailureReason", "Error");
|
|
133
|
+
this.inner = Object.freeze(inner);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
static new(inner: {
|
|
137
|
+
/**
|
|
138
|
+
* String representation of the error.
|
|
139
|
+
*/error: string }): Error_ {
|
|
140
|
+
return new Error_(inner);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
static instanceOf(obj: any): obj is Error_ {
|
|
144
|
+
return obj.tag === BackgroundTaskFailureReason_Tags.Error;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
type EarlyTermination__interface = {
|
|
154
|
+
tag: BackgroundTaskFailureReason_Tags.EarlyTermination
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* The task ended unexpectedly (for tasks expected to run forever).
|
|
160
|
+
*/
|
|
161
|
+
class EarlyTermination_ extends UniffiEnum implements EarlyTermination__interface {
|
|
162
|
+
/**
|
|
163
|
+
* @private
|
|
164
|
+
* This field is private and should not be used, use `tag` instead.
|
|
165
|
+
*/
|
|
166
|
+
readonly [uniffiTypeNameSymbol] = "BackgroundTaskFailureReason";
|
|
167
|
+
readonly tag = BackgroundTaskFailureReason_Tags.EarlyTermination;
|
|
168
|
+
constructor() {
|
|
169
|
+
super("BackgroundTaskFailureReason", "EarlyTermination");
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
static new(): EarlyTermination_ {
|
|
173
|
+
return new EarlyTermination_();
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
static instanceOf(obj: any): obj is EarlyTermination_ {
|
|
177
|
+
return obj.tag === BackgroundTaskFailureReason_Tags.EarlyTermination;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
function instanceOf(obj: any): obj is BackgroundTaskFailureReason {
|
|
186
|
+
return obj[uniffiTypeNameSymbol] === "BackgroundTaskFailureReason";
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
return Object.freeze({
|
|
190
|
+
instanceOf,
|
|
191
|
+
Panic: Panic_,
|
|
192
|
+
Error: Error_,
|
|
193
|
+
EarlyTermination: EarlyTermination_
|
|
194
|
+
});
|
|
195
|
+
|
|
196
|
+
})();
|
|
197
|
+
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* Reason why a background task failed.
|
|
201
|
+
*/
|
|
202
|
+
|
|
203
|
+
export type BackgroundTaskFailureReason = InstanceType<
|
|
204
|
+
typeof BackgroundTaskFailureReason[keyof Omit<typeof BackgroundTaskFailureReason, 'instanceOf'>]
|
|
205
|
+
>;
|
|
206
|
+
|
|
207
|
+
// FfiConverter for enum BackgroundTaskFailureReason
|
|
208
|
+
const FfiConverterTypeBackgroundTaskFailureReason = (() => {
|
|
209
|
+
const ordinalConverter = FfiConverterInt32;
|
|
210
|
+
type TypeName = BackgroundTaskFailureReason;
|
|
211
|
+
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
|
|
212
|
+
read(from: RustBuffer): TypeName {
|
|
213
|
+
switch (ordinalConverter.read(from)) {
|
|
214
|
+
case 1: return new BackgroundTaskFailureReason.Panic({message: FfiConverterOptionalString.read(from), panicBacktrace: FfiConverterOptionalString.read(from) });
|
|
215
|
+
case 2: return new BackgroundTaskFailureReason.Error({error: FfiConverterString.read(from) });
|
|
216
|
+
case 3: return new BackgroundTaskFailureReason.EarlyTermination();
|
|
217
|
+
default: throw new UniffiInternalError.UnexpectedEnumCase();
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
write(value: TypeName, into: RustBuffer): void {
|
|
221
|
+
switch (value.tag) {
|
|
222
|
+
case BackgroundTaskFailureReason_Tags.Panic: {
|
|
223
|
+
ordinalConverter.write(1, into);
|
|
224
|
+
const inner = value.inner;
|
|
225
|
+
FfiConverterOptionalString.write(inner.message, into);
|
|
226
|
+
FfiConverterOptionalString.write(inner.panicBacktrace, into);
|
|
227
|
+
return;
|
|
228
|
+
}
|
|
229
|
+
case BackgroundTaskFailureReason_Tags.Error: {
|
|
230
|
+
ordinalConverter.write(2, into);
|
|
231
|
+
const inner = value.inner;
|
|
232
|
+
FfiConverterString.write(inner.error, into);
|
|
233
|
+
return;
|
|
234
|
+
}
|
|
235
|
+
case BackgroundTaskFailureReason_Tags.EarlyTermination: {
|
|
236
|
+
ordinalConverter.write(3, into);
|
|
237
|
+
return;
|
|
238
|
+
}
|
|
239
|
+
default:
|
|
240
|
+
// Throwing from here means that BackgroundTaskFailureReason_Tags hasn't matched an ordinal.
|
|
241
|
+
throw new UniffiInternalError.UnexpectedEnumCase();
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
allocationSize(value: TypeName): number {
|
|
245
|
+
switch (value.tag) {
|
|
246
|
+
case BackgroundTaskFailureReason_Tags.Panic: {
|
|
247
|
+
const inner = value.inner;
|
|
248
|
+
let size = ordinalConverter.allocationSize(1);
|
|
249
|
+
size += FfiConverterOptionalString.allocationSize(inner.message);
|
|
250
|
+
size += FfiConverterOptionalString.allocationSize(inner.panicBacktrace);
|
|
251
|
+
return size;
|
|
252
|
+
}
|
|
253
|
+
case BackgroundTaskFailureReason_Tags.Error: {
|
|
254
|
+
const inner = value.inner;
|
|
255
|
+
let size = ordinalConverter.allocationSize(2);
|
|
256
|
+
size += FfiConverterString.allocationSize(inner.error);
|
|
257
|
+
return size;
|
|
258
|
+
}
|
|
259
|
+
case BackgroundTaskFailureReason_Tags.EarlyTermination: {
|
|
260
|
+
return ordinalConverter.allocationSize(3);
|
|
261
|
+
}
|
|
262
|
+
default: throw new UniffiInternalError.UnexpectedEnumCase();
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
return new FFIConverter();
|
|
267
|
+
})();
|
|
268
|
+
|
|
269
|
+
|
|
270
|
+
|
|
271
|
+
/**
|
|
272
|
+
* A machine-readable representation of the authenticity for a `ShieldState`.
|
|
273
|
+
*/
|
|
274
|
+
export enum ShieldStateCode {
|
|
275
|
+
/**
|
|
276
|
+
* Not enough information available to check the authenticity.
|
|
277
|
+
*/
|
|
278
|
+
AuthenticityNotGuaranteed,
|
|
279
|
+
/**
|
|
280
|
+
* The sending device isn't yet known by the Client.
|
|
281
|
+
*/
|
|
282
|
+
UnknownDevice,
|
|
283
|
+
/**
|
|
284
|
+
* The sending device hasn't been verified by the sender.
|
|
285
|
+
*/
|
|
286
|
+
UnsignedDevice,
|
|
287
|
+
/**
|
|
288
|
+
* The sender hasn't been verified by the Client's user.
|
|
289
|
+
*/
|
|
290
|
+
UnverifiedIdentity,
|
|
291
|
+
/**
|
|
292
|
+
* The sender was previously verified but changed their identity.
|
|
293
|
+
*/
|
|
294
|
+
VerificationViolation,
|
|
295
|
+
/**
|
|
296
|
+
* The `sender` field on the event does not match the owner of the device
|
|
297
|
+
* that established the Megolm session.
|
|
298
|
+
*/
|
|
299
|
+
MismatchedSender
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
const FfiConverterTypeShieldStateCode = (() => {
|
|
303
|
+
const ordinalConverter = FfiConverterInt32;
|
|
304
|
+
type TypeName = ShieldStateCode;
|
|
305
|
+
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
|
|
306
|
+
read(from: RustBuffer): TypeName {
|
|
307
|
+
switch (ordinalConverter.read(from)) {
|
|
308
|
+
case 1: return ShieldStateCode.AuthenticityNotGuaranteed;
|
|
309
|
+
case 2: return ShieldStateCode.UnknownDevice;
|
|
310
|
+
case 3: return ShieldStateCode.UnsignedDevice;
|
|
311
|
+
case 4: return ShieldStateCode.UnverifiedIdentity;
|
|
312
|
+
case 5: return ShieldStateCode.VerificationViolation;
|
|
313
|
+
case 6: return ShieldStateCode.MismatchedSender;
|
|
314
|
+
default: throw new UniffiInternalError.UnexpectedEnumCase();
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
write(value: TypeName, into: RustBuffer): void {
|
|
318
|
+
switch (value) {
|
|
319
|
+
case ShieldStateCode.AuthenticityNotGuaranteed: return ordinalConverter.write(1, into);
|
|
320
|
+
case ShieldStateCode.UnknownDevice: return ordinalConverter.write(2, into);
|
|
321
|
+
case ShieldStateCode.UnsignedDevice: return ordinalConverter.write(3, into);
|
|
322
|
+
case ShieldStateCode.UnverifiedIdentity: return ordinalConverter.write(4, into);
|
|
323
|
+
case ShieldStateCode.VerificationViolation: return ordinalConverter.write(5, into);
|
|
324
|
+
case ShieldStateCode.MismatchedSender: return ordinalConverter.write(6, into);
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
allocationSize(value: TypeName): number {
|
|
328
|
+
return ordinalConverter.allocationSize(0);
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
return new FFIConverter();
|
|
332
|
+
})();
|
|
333
|
+
|
|
334
|
+
|
|
335
|
+
|
|
336
|
+
|
|
337
|
+
|
|
338
|
+
// FfiConverter for string | undefined
|
|
339
|
+
const FfiConverterOptionalString = new FfiConverterOptional(FfiConverterString);
|
|
340
|
+
|
|
341
|
+
|
|
342
|
+
|
|
343
|
+
/**
|
|
344
|
+
* This should be called before anything else.
|
|
345
|
+
*
|
|
346
|
+
* It is likely that this is being done for you by the library's `index.ts`.
|
|
347
|
+
*
|
|
348
|
+
* It checks versions of uniffi between when the Rust scaffolding was generated
|
|
349
|
+
* and when the bindings were generated.
|
|
350
|
+
*
|
|
351
|
+
* It also initializes the machinery to enable Rust to talk back to Javascript.
|
|
352
|
+
*/
|
|
353
|
+
function uniffiEnsureInitialized() {
|
|
354
|
+
// Get the bindings contract version from our ComponentInterface
|
|
355
|
+
const bindingsContractVersion = 30;
|
|
356
|
+
// Get the scaffolding contract version by calling the into the dylib
|
|
357
|
+
const scaffoldingContractVersion = nativeModule().ubrn_ffi_matrix_sdk_common_uniffi_contract_version();
|
|
358
|
+
if (bindingsContractVersion !== scaffoldingContractVersion) {
|
|
359
|
+
throw new UniffiInternalError.ContractVersionMismatch(scaffoldingContractVersion, bindingsContractVersion);
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
export default Object.freeze({
|
|
365
|
+
initialize: uniffiEnsureInitialized,
|
|
366
|
+
converters: {
|
|
367
|
+
FfiConverterTypeBackgroundTaskFailureReason,
|
|
368
|
+
FfiConverterTypeShieldStateCode,
|
|
369
|
+
}
|
|
370
|
+
});
|