jazz-rn 2.0.0-alpha.6

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.
Files changed (37) hide show
  1. package/JazzRn.podspec +44 -0
  2. package/README.md +47 -0
  3. package/android/CMakeLists.txt +76 -0
  4. package/android/build.gradle +144 -0
  5. package/android/cpp-adapter.cpp +43 -0
  6. package/android/gradle.properties +5 -0
  7. package/android/src/main/AndroidManifest.xml +5 -0
  8. package/android/src/main/java/com/jazzrn/JazzRnModule.kt +43 -0
  9. package/android/src/main/java/com/jazzrn/JazzRnPackage.kt +34 -0
  10. package/cpp/jazz-rn.cpp +16 -0
  11. package/cpp/jazz-rn.h +15 -0
  12. package/ios/JazzRn.h +16 -0
  13. package/ios/JazzRn.mm +66 -0
  14. package/lib/module/NativeJazzRn.js +7 -0
  15. package/lib/module/NativeJazzRn.js.map +1 -0
  16. package/lib/module/generated/jazz_rn-ffi.js +43 -0
  17. package/lib/module/generated/jazz_rn-ffi.js.map +1 -0
  18. package/lib/module/generated/jazz_rn.js +714 -0
  19. package/lib/module/generated/jazz_rn.js.map +1 -0
  20. package/lib/module/index.js +43 -0
  21. package/lib/module/index.js.map +1 -0
  22. package/lib/module/package.json +1 -0
  23. package/lib/typescript/package.json +1 -0
  24. package/lib/typescript/src/NativeJazzRn.d.ts +8 -0
  25. package/lib/typescript/src/NativeJazzRn.d.ts.map +1 -0
  26. package/lib/typescript/src/generated/jazz_rn-ffi.d.ts +147 -0
  27. package/lib/typescript/src/generated/jazz_rn-ffi.d.ts.map +1 -0
  28. package/lib/typescript/src/generated/jazz_rn.d.ts +644 -0
  29. package/lib/typescript/src/generated/jazz_rn.d.ts.map +1 -0
  30. package/lib/typescript/src/index.d.ts +8 -0
  31. package/lib/typescript/src/index.d.ts.map +1 -0
  32. package/package.json +170 -0
  33. package/react-native.config.js +11 -0
  34. package/src/NativeJazzRn.ts +10 -0
  35. package/src/generated/jazz_rn-ffi.ts +360 -0
  36. package/src/generated/jazz_rn.ts +1391 -0
  37. package/src/index.tsx +41 -0
@@ -0,0 +1,1391 @@
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
+ import nativeModule, {
4
+ type UniffiRustFutureContinuationCallback,
5
+ type UniffiForeignFuture,
6
+ type UniffiForeignFutureStructU8,
7
+ type UniffiForeignFutureCompleteU8,
8
+ type UniffiForeignFutureStructI8,
9
+ type UniffiForeignFutureCompleteI8,
10
+ type UniffiForeignFutureStructU16,
11
+ type UniffiForeignFutureCompleteU16,
12
+ type UniffiForeignFutureStructI16,
13
+ type UniffiForeignFutureCompleteI16,
14
+ type UniffiForeignFutureStructU32,
15
+ type UniffiForeignFutureCompleteU32,
16
+ type UniffiForeignFutureStructI32,
17
+ type UniffiForeignFutureCompleteI32,
18
+ type UniffiForeignFutureStructU64,
19
+ type UniffiForeignFutureCompleteU64,
20
+ type UniffiForeignFutureStructI64,
21
+ type UniffiForeignFutureCompleteI64,
22
+ type UniffiForeignFutureStructF32,
23
+ type UniffiForeignFutureCompleteF32,
24
+ type UniffiForeignFutureStructF64,
25
+ type UniffiForeignFutureCompleteF64,
26
+ type UniffiForeignFutureStructPointer,
27
+ type UniffiForeignFutureCompletePointer,
28
+ type UniffiForeignFutureStructRustBuffer,
29
+ type UniffiForeignFutureCompleteRustBuffer,
30
+ type UniffiForeignFutureStructVoid,
31
+ type UniffiForeignFutureCompleteVoid,
32
+ type UniffiVTableCallbackInterfaceBatchedTickCallback,
33
+ type UniffiVTableCallbackInterfaceSubscriptionCallback,
34
+ type UniffiVTableCallbackInterfaceSyncMessageCallback,
35
+ } from './jazz_rn-ffi';
36
+ import {
37
+ type FfiConverter,
38
+ type UniffiByteArray,
39
+ type UniffiHandle,
40
+ type UniffiObjectFactory,
41
+ type UniffiReferenceHolder,
42
+ type UniffiRustArcPtr,
43
+ type UniffiRustCallStatus,
44
+ type UnsafeMutableRawPointer,
45
+ AbstractFfiConverterByteArray,
46
+ FfiConverterBool,
47
+ FfiConverterCallback,
48
+ FfiConverterInt32,
49
+ FfiConverterInt64,
50
+ FfiConverterObject,
51
+ FfiConverterOptional,
52
+ FfiConverterUInt64,
53
+ RustBuffer,
54
+ UniffiAbstractObject,
55
+ UniffiError,
56
+ UniffiInternalError,
57
+ UniffiResult,
58
+ UniffiRustCaller,
59
+ destructorGuardSymbol,
60
+ pointerLiteralSymbol,
61
+ uniffiCreateFfiConverterString,
62
+ uniffiTraitInterfaceCall,
63
+ uniffiTypeNameSymbol,
64
+ variantOrdinalSymbol,
65
+ } from 'uniffi-bindgen-react-native';
66
+
67
+ // Get converters from the other files, if any.
68
+ const uniffiCaller = new UniffiRustCaller(() => ({ code: 0 }));
69
+
70
+ const uniffiIsDebug =
71
+ // @ts-ignore -- The process global might not be defined
72
+ typeof process !== 'object' ||
73
+ // @ts-ignore -- The process global might not be defined
74
+ process?.env?.NODE_ENV !== 'production' ||
75
+ false;
76
+ // Public interface members begin here.
77
+
78
+ export function currentTimestampMs(): /*i64*/ bigint {
79
+ return FfiConverterInt64.lift(
80
+ uniffiCaller.rustCall(
81
+ /*caller:*/ (callStatus) => {
82
+ return nativeModule().ubrn_uniffi_jazz_rn_fn_func_current_timestamp_ms(
83
+ callStatus
84
+ );
85
+ },
86
+ /*liftString:*/ FfiConverterString.lift
87
+ )
88
+ );
89
+ }
90
+ export function generateId(): string {
91
+ return FfiConverterString.lift(
92
+ uniffiCaller.rustCall(
93
+ /*caller:*/ (callStatus) => {
94
+ return nativeModule().ubrn_uniffi_jazz_rn_fn_func_generate_id(
95
+ callStatus
96
+ );
97
+ },
98
+ /*liftString:*/ FfiConverterString.lift
99
+ )
100
+ );
101
+ }
102
+
103
+ export interface BatchedTickCallback {
104
+ /**
105
+ * Called by Rust when it wants JS to call `runtime.batched_tick()`.
106
+ */
107
+ requestBatchedTick(): void;
108
+ }
109
+
110
+ // Put the implementation in a struct so we don't pollute the top-level namespace
111
+ const uniffiCallbackInterfaceBatchedTickCallback: {
112
+ vtable: UniffiVTableCallbackInterfaceBatchedTickCallback;
113
+ register: () => void;
114
+ } = {
115
+ // Create the VTable using a series of closures.
116
+ // ts automatically converts these into C callback functions.
117
+ vtable: {
118
+ requestBatchedTick: (uniffiHandle: bigint) => {
119
+ const uniffiMakeCall = (): void => {
120
+ const jsCallback =
121
+ FfiConverterTypeBatchedTickCallback.lift(uniffiHandle);
122
+ return jsCallback.requestBatchedTick();
123
+ };
124
+ const uniffiResult = UniffiResult.ready<void>();
125
+ const uniffiHandleSuccess = (obj: any) => {};
126
+ const uniffiHandleError = (code: number, errBuf: UniffiByteArray) => {
127
+ UniffiResult.writeError(uniffiResult, code, errBuf);
128
+ };
129
+ uniffiTraitInterfaceCall(
130
+ /*makeCall:*/ uniffiMakeCall,
131
+ /*handleSuccess:*/ uniffiHandleSuccess,
132
+ /*handleError:*/ uniffiHandleError,
133
+ /*lowerString:*/ FfiConverterString.lower
134
+ );
135
+ return uniffiResult;
136
+ },
137
+ uniffiFree: (uniffiHandle: UniffiHandle): void => {
138
+ // BatchedTickCallback: this will throw a stale handle error if the handle isn't found.
139
+ FfiConverterTypeBatchedTickCallback.drop(uniffiHandle);
140
+ },
141
+ },
142
+ register: () => {
143
+ nativeModule().ubrn_uniffi_jazz_rn_fn_init_callback_vtable_batchedtickcallback(
144
+ uniffiCallbackInterfaceBatchedTickCallback.vtable
145
+ );
146
+ },
147
+ };
148
+
149
+ // FfiConverter protocol for callback interfaces
150
+ const FfiConverterTypeBatchedTickCallback =
151
+ new FfiConverterCallback<BatchedTickCallback>();
152
+
153
+ export interface SubscriptionCallback {
154
+ /**
155
+ * Called when a subscription produces an update.
156
+ */
157
+ onUpdate(deltaJson: string): void;
158
+ }
159
+
160
+ // Put the implementation in a struct so we don't pollute the top-level namespace
161
+ const uniffiCallbackInterfaceSubscriptionCallback: {
162
+ vtable: UniffiVTableCallbackInterfaceSubscriptionCallback;
163
+ register: () => void;
164
+ } = {
165
+ // Create the VTable using a series of closures.
166
+ // ts automatically converts these into C callback functions.
167
+ vtable: {
168
+ onUpdate: (uniffiHandle: bigint, deltaJson: Uint8Array) => {
169
+ const uniffiMakeCall = (): void => {
170
+ const jsCallback =
171
+ FfiConverterTypeSubscriptionCallback.lift(uniffiHandle);
172
+ return jsCallback.onUpdate(FfiConverterString.lift(deltaJson));
173
+ };
174
+ const uniffiResult = UniffiResult.ready<void>();
175
+ const uniffiHandleSuccess = (obj: any) => {};
176
+ const uniffiHandleError = (code: number, errBuf: UniffiByteArray) => {
177
+ UniffiResult.writeError(uniffiResult, code, errBuf);
178
+ };
179
+ uniffiTraitInterfaceCall(
180
+ /*makeCall:*/ uniffiMakeCall,
181
+ /*handleSuccess:*/ uniffiHandleSuccess,
182
+ /*handleError:*/ uniffiHandleError,
183
+ /*lowerString:*/ FfiConverterString.lower
184
+ );
185
+ return uniffiResult;
186
+ },
187
+ uniffiFree: (uniffiHandle: UniffiHandle): void => {
188
+ // SubscriptionCallback: this will throw a stale handle error if the handle isn't found.
189
+ FfiConverterTypeSubscriptionCallback.drop(uniffiHandle);
190
+ },
191
+ },
192
+ register: () => {
193
+ nativeModule().ubrn_uniffi_jazz_rn_fn_init_callback_vtable_subscriptioncallback(
194
+ uniffiCallbackInterfaceSubscriptionCallback.vtable
195
+ );
196
+ },
197
+ };
198
+
199
+ // FfiConverter protocol for callback interfaces
200
+ const FfiConverterTypeSubscriptionCallback =
201
+ new FfiConverterCallback<SubscriptionCallback>();
202
+
203
+ export interface SyncMessageCallback {
204
+ /**
205
+ * Called by Rust when it has an outbox message to send.
206
+ */
207
+ onSyncMessage(messageJson: string): void;
208
+ }
209
+
210
+ // Put the implementation in a struct so we don't pollute the top-level namespace
211
+ const uniffiCallbackInterfaceSyncMessageCallback: {
212
+ vtable: UniffiVTableCallbackInterfaceSyncMessageCallback;
213
+ register: () => void;
214
+ } = {
215
+ // Create the VTable using a series of closures.
216
+ // ts automatically converts these into C callback functions.
217
+ vtable: {
218
+ onSyncMessage: (uniffiHandle: bigint, messageJson: Uint8Array) => {
219
+ const uniffiMakeCall = (): void => {
220
+ const jsCallback =
221
+ FfiConverterTypeSyncMessageCallback.lift(uniffiHandle);
222
+ return jsCallback.onSyncMessage(FfiConverterString.lift(messageJson));
223
+ };
224
+ const uniffiResult = UniffiResult.ready<void>();
225
+ const uniffiHandleSuccess = (obj: any) => {};
226
+ const uniffiHandleError = (code: number, errBuf: UniffiByteArray) => {
227
+ UniffiResult.writeError(uniffiResult, code, errBuf);
228
+ };
229
+ uniffiTraitInterfaceCall(
230
+ /*makeCall:*/ uniffiMakeCall,
231
+ /*handleSuccess:*/ uniffiHandleSuccess,
232
+ /*handleError:*/ uniffiHandleError,
233
+ /*lowerString:*/ FfiConverterString.lower
234
+ );
235
+ return uniffiResult;
236
+ },
237
+ uniffiFree: (uniffiHandle: UniffiHandle): void => {
238
+ // SyncMessageCallback: this will throw a stale handle error if the handle isn't found.
239
+ FfiConverterTypeSyncMessageCallback.drop(uniffiHandle);
240
+ },
241
+ },
242
+ register: () => {
243
+ nativeModule().ubrn_uniffi_jazz_rn_fn_init_callback_vtable_syncmessagecallback(
244
+ uniffiCallbackInterfaceSyncMessageCallback.vtable
245
+ );
246
+ },
247
+ };
248
+
249
+ // FfiConverter protocol for callback interfaces
250
+ const FfiConverterTypeSyncMessageCallback =
251
+ new FfiConverterCallback<SyncMessageCallback>();
252
+
253
+ const stringConverter = {
254
+ stringToBytes: (s: string) =>
255
+ uniffiCaller.rustCall((status) =>
256
+ nativeModule().ubrn_uniffi_internal_fn_func_ffi__string_to_arraybuffer(
257
+ s,
258
+ status
259
+ )
260
+ ),
261
+ bytesToString: (ab: UniffiByteArray) =>
262
+ uniffiCaller.rustCall((status) =>
263
+ nativeModule().ubrn_uniffi_internal_fn_func_ffi__arraybuffer_to_string(
264
+ ab,
265
+ status
266
+ )
267
+ ),
268
+ stringByteLength: (s: string) =>
269
+ uniffiCaller.rustCall((status) =>
270
+ nativeModule().ubrn_uniffi_internal_fn_func_ffi__string_to_byte_length(
271
+ s,
272
+ status
273
+ )
274
+ ),
275
+ };
276
+ const FfiConverterString = uniffiCreateFfiConverterString(stringConverter);
277
+
278
+ // Error type: JazzRnError
279
+
280
+ // Enum: JazzRnError
281
+ export enum JazzRnError_Tags {
282
+ InvalidJson = 'InvalidJson',
283
+ InvalidUuid = 'InvalidUuid',
284
+ InvalidTier = 'InvalidTier',
285
+ Schema = 'Schema',
286
+ Runtime = 'Runtime',
287
+ Internal = 'Internal',
288
+ }
289
+ export const JazzRnError = (() => {
290
+ type InvalidJson__interface = {
291
+ tag: JazzRnError_Tags.InvalidJson;
292
+ inner: Readonly<{ message: string }>;
293
+ };
294
+
295
+ class InvalidJson_ extends UniffiError implements InvalidJson__interface {
296
+ /**
297
+ * @private
298
+ * This field is private and should not be used, use `tag` instead.
299
+ */
300
+ readonly [uniffiTypeNameSymbol] = 'JazzRnError';
301
+ readonly tag = JazzRnError_Tags.InvalidJson;
302
+ readonly inner: Readonly<{ message: string }>;
303
+ constructor(inner: { message: string }) {
304
+ super('JazzRnError', 'InvalidJson');
305
+ this.inner = Object.freeze(inner);
306
+ }
307
+
308
+ static new(inner: { message: string }): InvalidJson_ {
309
+ return new InvalidJson_(inner);
310
+ }
311
+
312
+ static instanceOf(obj: any): obj is InvalidJson_ {
313
+ return obj.tag === JazzRnError_Tags.InvalidJson;
314
+ }
315
+
316
+ static hasInner(obj: any): obj is InvalidJson_ {
317
+ return InvalidJson_.instanceOf(obj);
318
+ }
319
+
320
+ static getInner(obj: InvalidJson_): Readonly<{ message: string }> {
321
+ return obj.inner;
322
+ }
323
+ }
324
+
325
+ type InvalidUuid__interface = {
326
+ tag: JazzRnError_Tags.InvalidUuid;
327
+ inner: Readonly<{ message: string }>;
328
+ };
329
+
330
+ class InvalidUuid_ extends UniffiError implements InvalidUuid__interface {
331
+ /**
332
+ * @private
333
+ * This field is private and should not be used, use `tag` instead.
334
+ */
335
+ readonly [uniffiTypeNameSymbol] = 'JazzRnError';
336
+ readonly tag = JazzRnError_Tags.InvalidUuid;
337
+ readonly inner: Readonly<{ message: string }>;
338
+ constructor(inner: { message: string }) {
339
+ super('JazzRnError', 'InvalidUuid');
340
+ this.inner = Object.freeze(inner);
341
+ }
342
+
343
+ static new(inner: { message: string }): InvalidUuid_ {
344
+ return new InvalidUuid_(inner);
345
+ }
346
+
347
+ static instanceOf(obj: any): obj is InvalidUuid_ {
348
+ return obj.tag === JazzRnError_Tags.InvalidUuid;
349
+ }
350
+
351
+ static hasInner(obj: any): obj is InvalidUuid_ {
352
+ return InvalidUuid_.instanceOf(obj);
353
+ }
354
+
355
+ static getInner(obj: InvalidUuid_): Readonly<{ message: string }> {
356
+ return obj.inner;
357
+ }
358
+ }
359
+
360
+ type InvalidTier__interface = {
361
+ tag: JazzRnError_Tags.InvalidTier;
362
+ inner: Readonly<{ message: string }>;
363
+ };
364
+
365
+ class InvalidTier_ extends UniffiError implements InvalidTier__interface {
366
+ /**
367
+ * @private
368
+ * This field is private and should not be used, use `tag` instead.
369
+ */
370
+ readonly [uniffiTypeNameSymbol] = 'JazzRnError';
371
+ readonly tag = JazzRnError_Tags.InvalidTier;
372
+ readonly inner: Readonly<{ message: string }>;
373
+ constructor(inner: { message: string }) {
374
+ super('JazzRnError', 'InvalidTier');
375
+ this.inner = Object.freeze(inner);
376
+ }
377
+
378
+ static new(inner: { message: string }): InvalidTier_ {
379
+ return new InvalidTier_(inner);
380
+ }
381
+
382
+ static instanceOf(obj: any): obj is InvalidTier_ {
383
+ return obj.tag === JazzRnError_Tags.InvalidTier;
384
+ }
385
+
386
+ static hasInner(obj: any): obj is InvalidTier_ {
387
+ return InvalidTier_.instanceOf(obj);
388
+ }
389
+
390
+ static getInner(obj: InvalidTier_): Readonly<{ message: string }> {
391
+ return obj.inner;
392
+ }
393
+ }
394
+
395
+ type Schema__interface = {
396
+ tag: JazzRnError_Tags.Schema;
397
+ inner: Readonly<{ message: string }>;
398
+ };
399
+
400
+ class Schema_ extends UniffiError implements Schema__interface {
401
+ /**
402
+ * @private
403
+ * This field is private and should not be used, use `tag` instead.
404
+ */
405
+ readonly [uniffiTypeNameSymbol] = 'JazzRnError';
406
+ readonly tag = JazzRnError_Tags.Schema;
407
+ readonly inner: Readonly<{ message: string }>;
408
+ constructor(inner: { message: string }) {
409
+ super('JazzRnError', 'Schema');
410
+ this.inner = Object.freeze(inner);
411
+ }
412
+
413
+ static new(inner: { message: string }): Schema_ {
414
+ return new Schema_(inner);
415
+ }
416
+
417
+ static instanceOf(obj: any): obj is Schema_ {
418
+ return obj.tag === JazzRnError_Tags.Schema;
419
+ }
420
+
421
+ static hasInner(obj: any): obj is Schema_ {
422
+ return Schema_.instanceOf(obj);
423
+ }
424
+
425
+ static getInner(obj: Schema_): Readonly<{ message: string }> {
426
+ return obj.inner;
427
+ }
428
+ }
429
+
430
+ type Runtime__interface = {
431
+ tag: JazzRnError_Tags.Runtime;
432
+ inner: Readonly<{ message: string }>;
433
+ };
434
+
435
+ class Runtime_ extends UniffiError implements Runtime__interface {
436
+ /**
437
+ * @private
438
+ * This field is private and should not be used, use `tag` instead.
439
+ */
440
+ readonly [uniffiTypeNameSymbol] = 'JazzRnError';
441
+ readonly tag = JazzRnError_Tags.Runtime;
442
+ readonly inner: Readonly<{ message: string }>;
443
+ constructor(inner: { message: string }) {
444
+ super('JazzRnError', 'Runtime');
445
+ this.inner = Object.freeze(inner);
446
+ }
447
+
448
+ static new(inner: { message: string }): Runtime_ {
449
+ return new Runtime_(inner);
450
+ }
451
+
452
+ static instanceOf(obj: any): obj is Runtime_ {
453
+ return obj.tag === JazzRnError_Tags.Runtime;
454
+ }
455
+
456
+ static hasInner(obj: any): obj is Runtime_ {
457
+ return Runtime_.instanceOf(obj);
458
+ }
459
+
460
+ static getInner(obj: Runtime_): Readonly<{ message: string }> {
461
+ return obj.inner;
462
+ }
463
+ }
464
+
465
+ type Internal__interface = {
466
+ tag: JazzRnError_Tags.Internal;
467
+ inner: Readonly<{ message: string }>;
468
+ };
469
+
470
+ class Internal_ extends UniffiError implements Internal__interface {
471
+ /**
472
+ * @private
473
+ * This field is private and should not be used, use `tag` instead.
474
+ */
475
+ readonly [uniffiTypeNameSymbol] = 'JazzRnError';
476
+ readonly tag = JazzRnError_Tags.Internal;
477
+ readonly inner: Readonly<{ message: string }>;
478
+ constructor(inner: { message: string }) {
479
+ super('JazzRnError', 'Internal');
480
+ this.inner = Object.freeze(inner);
481
+ }
482
+
483
+ static new(inner: { message: string }): Internal_ {
484
+ return new Internal_(inner);
485
+ }
486
+
487
+ static instanceOf(obj: any): obj is Internal_ {
488
+ return obj.tag === JazzRnError_Tags.Internal;
489
+ }
490
+
491
+ static hasInner(obj: any): obj is Internal_ {
492
+ return Internal_.instanceOf(obj);
493
+ }
494
+
495
+ static getInner(obj: Internal_): Readonly<{ message: string }> {
496
+ return obj.inner;
497
+ }
498
+ }
499
+
500
+ function instanceOf(obj: any): obj is JazzRnError {
501
+ return obj[uniffiTypeNameSymbol] === 'JazzRnError';
502
+ }
503
+
504
+ return Object.freeze({
505
+ instanceOf,
506
+ InvalidJson: InvalidJson_,
507
+ InvalidUuid: InvalidUuid_,
508
+ InvalidTier: InvalidTier_,
509
+ Schema: Schema_,
510
+ Runtime: Runtime_,
511
+ Internal: Internal_,
512
+ });
513
+ })();
514
+
515
+ export type JazzRnError = InstanceType<
516
+ (typeof JazzRnError)[keyof Omit<typeof JazzRnError, 'instanceOf'>]
517
+ >;
518
+
519
+ // FfiConverter for enum JazzRnError
520
+ const FfiConverterTypeJazzRnError = (() => {
521
+ const ordinalConverter = FfiConverterInt32;
522
+ type TypeName = JazzRnError;
523
+ class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
524
+ read(from: RustBuffer): TypeName {
525
+ switch (ordinalConverter.read(from)) {
526
+ case 1:
527
+ return new JazzRnError.InvalidJson({
528
+ message: FfiConverterString.read(from),
529
+ });
530
+ case 2:
531
+ return new JazzRnError.InvalidUuid({
532
+ message: FfiConverterString.read(from),
533
+ });
534
+ case 3:
535
+ return new JazzRnError.InvalidTier({
536
+ message: FfiConverterString.read(from),
537
+ });
538
+ case 4:
539
+ return new JazzRnError.Schema({
540
+ message: FfiConverterString.read(from),
541
+ });
542
+ case 5:
543
+ return new JazzRnError.Runtime({
544
+ message: FfiConverterString.read(from),
545
+ });
546
+ case 6:
547
+ return new JazzRnError.Internal({
548
+ message: FfiConverterString.read(from),
549
+ });
550
+ default:
551
+ throw new UniffiInternalError.UnexpectedEnumCase();
552
+ }
553
+ }
554
+ write(value: TypeName, into: RustBuffer): void {
555
+ switch (value.tag) {
556
+ case JazzRnError_Tags.InvalidJson: {
557
+ ordinalConverter.write(1, into);
558
+ const inner = value.inner;
559
+ FfiConverterString.write(inner.message, into);
560
+ return;
561
+ }
562
+ case JazzRnError_Tags.InvalidUuid: {
563
+ ordinalConverter.write(2, into);
564
+ const inner = value.inner;
565
+ FfiConverterString.write(inner.message, into);
566
+ return;
567
+ }
568
+ case JazzRnError_Tags.InvalidTier: {
569
+ ordinalConverter.write(3, into);
570
+ const inner = value.inner;
571
+ FfiConverterString.write(inner.message, into);
572
+ return;
573
+ }
574
+ case JazzRnError_Tags.Schema: {
575
+ ordinalConverter.write(4, into);
576
+ const inner = value.inner;
577
+ FfiConverterString.write(inner.message, into);
578
+ return;
579
+ }
580
+ case JazzRnError_Tags.Runtime: {
581
+ ordinalConverter.write(5, into);
582
+ const inner = value.inner;
583
+ FfiConverterString.write(inner.message, into);
584
+ return;
585
+ }
586
+ case JazzRnError_Tags.Internal: {
587
+ ordinalConverter.write(6, into);
588
+ const inner = value.inner;
589
+ FfiConverterString.write(inner.message, into);
590
+ return;
591
+ }
592
+ default:
593
+ // Throwing from here means that JazzRnError_Tags hasn't matched an ordinal.
594
+ throw new UniffiInternalError.UnexpectedEnumCase();
595
+ }
596
+ }
597
+ allocationSize(value: TypeName): number {
598
+ switch (value.tag) {
599
+ case JazzRnError_Tags.InvalidJson: {
600
+ const inner = value.inner;
601
+ let size = ordinalConverter.allocationSize(1);
602
+ size += FfiConverterString.allocationSize(inner.message);
603
+ return size;
604
+ }
605
+ case JazzRnError_Tags.InvalidUuid: {
606
+ const inner = value.inner;
607
+ let size = ordinalConverter.allocationSize(2);
608
+ size += FfiConverterString.allocationSize(inner.message);
609
+ return size;
610
+ }
611
+ case JazzRnError_Tags.InvalidTier: {
612
+ const inner = value.inner;
613
+ let size = ordinalConverter.allocationSize(3);
614
+ size += FfiConverterString.allocationSize(inner.message);
615
+ return size;
616
+ }
617
+ case JazzRnError_Tags.Schema: {
618
+ const inner = value.inner;
619
+ let size = ordinalConverter.allocationSize(4);
620
+ size += FfiConverterString.allocationSize(inner.message);
621
+ return size;
622
+ }
623
+ case JazzRnError_Tags.Runtime: {
624
+ const inner = value.inner;
625
+ let size = ordinalConverter.allocationSize(5);
626
+ size += FfiConverterString.allocationSize(inner.message);
627
+ return size;
628
+ }
629
+ case JazzRnError_Tags.Internal: {
630
+ const inner = value.inner;
631
+ let size = ordinalConverter.allocationSize(6);
632
+ size += FfiConverterString.allocationSize(inner.message);
633
+ return size;
634
+ }
635
+ default:
636
+ throw new UniffiInternalError.UnexpectedEnumCase();
637
+ }
638
+ }
639
+ }
640
+ return new FFIConverter();
641
+ })();
642
+
643
+ export interface RnRuntimeInterface {
644
+ addClient() /*throws*/ : string;
645
+ addServer() /*throws*/ : void;
646
+ /**
647
+ * Run a batched tick. JS should call this when asked via `on_batched_tick_needed`.
648
+ */
649
+ batchedTick() /*throws*/ : void;
650
+ /**
651
+ * Flush and close the underlying storage, releasing filesystem locks.
652
+ */
653
+ close() /*throws*/ : void;
654
+ delete_(objectId: string) /*throws*/ : void;
655
+ flush() /*throws*/ : void;
656
+ getSchemaHash() /*throws*/ : string;
657
+ insert(table: string, valuesJson: string) /*throws*/ : string;
658
+ /**
659
+ * Register a JS callback that schedules `batched_tick()` calls.
660
+ */
661
+ onBatchedTickNeeded(
662
+ callback: BatchedTickCallback | undefined
663
+ ) /*throws*/ : void;
664
+ onSyncMessageReceived(messageJson: string) /*throws*/ : void;
665
+ onSyncMessageReceivedFromClient(
666
+ clientId: string,
667
+ messageJson: string
668
+ ) /*throws*/ : void;
669
+ /**
670
+ * Register a JS callback for outbound sync messages.
671
+ */
672
+ onSyncMessageToSend(
673
+ callback: SyncMessageCallback | undefined
674
+ ) /*throws*/ : void;
675
+ /**
676
+ * One-shot query returning a JSON string:
677
+ * `[{ "id": "<uuid>", "values": [ {type, value}, ... ] }, ...]`.
678
+ */
679
+ query(
680
+ queryJson: string,
681
+ sessionJson: string | undefined,
682
+ settledTier: string | undefined
683
+ ) /*throws*/ : string;
684
+ removeServer() /*throws*/ : void;
685
+ setClientRole(clientId: string, role: string) /*throws*/ : void;
686
+ subscribe(
687
+ queryJson: string,
688
+ callback: SubscriptionCallback,
689
+ sessionJson: string | undefined,
690
+ settledTier: string | undefined
691
+ ) /*throws*/ : /*u64*/ bigint;
692
+ unsubscribe(handle: /*u64*/ bigint) /*throws*/ : void;
693
+ update(objectId: string, valuesJson: string) /*throws*/ : void;
694
+ }
695
+
696
+ export class RnRuntime
697
+ extends UniffiAbstractObject
698
+ implements RnRuntimeInterface
699
+ {
700
+ readonly [uniffiTypeNameSymbol] = 'RnRuntime';
701
+ readonly [destructorGuardSymbol]: UniffiRustArcPtr;
702
+ readonly [pointerLiteralSymbol]: UnsafeMutableRawPointer;
703
+ constructor(
704
+ schemaJson: string,
705
+ appId: string,
706
+ jazzEnv: string,
707
+ userBranch: string,
708
+ tier: string | undefined,
709
+ dataPath: string | undefined
710
+ ) /*throws*/ {
711
+ super();
712
+ const pointer = uniffiCaller.rustCallWithError(
713
+ /*liftError:*/ FfiConverterTypeJazzRnError.lift.bind(
714
+ FfiConverterTypeJazzRnError
715
+ ),
716
+ /*caller:*/ (callStatus) => {
717
+ return nativeModule().ubrn_uniffi_jazz_rn_fn_constructor_rnruntime_new(
718
+ FfiConverterString.lower(schemaJson),
719
+ FfiConverterString.lower(appId),
720
+ FfiConverterString.lower(jazzEnv),
721
+ FfiConverterString.lower(userBranch),
722
+ FfiConverterOptionalString.lower(tier),
723
+ FfiConverterOptionalString.lower(dataPath),
724
+ callStatus
725
+ );
726
+ },
727
+ /*liftString:*/ FfiConverterString.lift
728
+ );
729
+ this[pointerLiteralSymbol] = pointer;
730
+ this[destructorGuardSymbol] =
731
+ uniffiTypeRnRuntimeObjectFactory.bless(pointer);
732
+ }
733
+
734
+ public addClient(): string /*throws*/ {
735
+ return FfiConverterString.lift(
736
+ uniffiCaller.rustCallWithError(
737
+ /*liftError:*/ FfiConverterTypeJazzRnError.lift.bind(
738
+ FfiConverterTypeJazzRnError
739
+ ),
740
+ /*caller:*/ (callStatus) => {
741
+ return nativeModule().ubrn_uniffi_jazz_rn_fn_method_rnruntime_add_client(
742
+ uniffiTypeRnRuntimeObjectFactory.clonePointer(this),
743
+ callStatus
744
+ );
745
+ },
746
+ /*liftString:*/ FfiConverterString.lift
747
+ )
748
+ );
749
+ }
750
+
751
+ public addServer(): void /*throws*/ {
752
+ uniffiCaller.rustCallWithError(
753
+ /*liftError:*/ FfiConverterTypeJazzRnError.lift.bind(
754
+ FfiConverterTypeJazzRnError
755
+ ),
756
+ /*caller:*/ (callStatus) => {
757
+ nativeModule().ubrn_uniffi_jazz_rn_fn_method_rnruntime_add_server(
758
+ uniffiTypeRnRuntimeObjectFactory.clonePointer(this),
759
+ callStatus
760
+ );
761
+ },
762
+ /*liftString:*/ FfiConverterString.lift
763
+ );
764
+ }
765
+
766
+ /**
767
+ * Run a batched tick. JS should call this when asked via `on_batched_tick_needed`.
768
+ */
769
+ public batchedTick(): void /*throws*/ {
770
+ uniffiCaller.rustCallWithError(
771
+ /*liftError:*/ FfiConverterTypeJazzRnError.lift.bind(
772
+ FfiConverterTypeJazzRnError
773
+ ),
774
+ /*caller:*/ (callStatus) => {
775
+ nativeModule().ubrn_uniffi_jazz_rn_fn_method_rnruntime_batched_tick(
776
+ uniffiTypeRnRuntimeObjectFactory.clonePointer(this),
777
+ callStatus
778
+ );
779
+ },
780
+ /*liftString:*/ FfiConverterString.lift
781
+ );
782
+ }
783
+
784
+ /**
785
+ * Flush and close the underlying storage, releasing filesystem locks.
786
+ */
787
+ public close(): void /*throws*/ {
788
+ uniffiCaller.rustCallWithError(
789
+ /*liftError:*/ FfiConverterTypeJazzRnError.lift.bind(
790
+ FfiConverterTypeJazzRnError
791
+ ),
792
+ /*caller:*/ (callStatus) => {
793
+ nativeModule().ubrn_uniffi_jazz_rn_fn_method_rnruntime_close(
794
+ uniffiTypeRnRuntimeObjectFactory.clonePointer(this),
795
+ callStatus
796
+ );
797
+ },
798
+ /*liftString:*/ FfiConverterString.lift
799
+ );
800
+ }
801
+
802
+ public delete_(objectId: string): void /*throws*/ {
803
+ uniffiCaller.rustCallWithError(
804
+ /*liftError:*/ FfiConverterTypeJazzRnError.lift.bind(
805
+ FfiConverterTypeJazzRnError
806
+ ),
807
+ /*caller:*/ (callStatus) => {
808
+ nativeModule().ubrn_uniffi_jazz_rn_fn_method_rnruntime_delete(
809
+ uniffiTypeRnRuntimeObjectFactory.clonePointer(this),
810
+ FfiConverterString.lower(objectId),
811
+ callStatus
812
+ );
813
+ },
814
+ /*liftString:*/ FfiConverterString.lift
815
+ );
816
+ }
817
+
818
+ public flush(): void /*throws*/ {
819
+ uniffiCaller.rustCallWithError(
820
+ /*liftError:*/ FfiConverterTypeJazzRnError.lift.bind(
821
+ FfiConverterTypeJazzRnError
822
+ ),
823
+ /*caller:*/ (callStatus) => {
824
+ nativeModule().ubrn_uniffi_jazz_rn_fn_method_rnruntime_flush(
825
+ uniffiTypeRnRuntimeObjectFactory.clonePointer(this),
826
+ callStatus
827
+ );
828
+ },
829
+ /*liftString:*/ FfiConverterString.lift
830
+ );
831
+ }
832
+
833
+ public getSchemaHash(): string /*throws*/ {
834
+ return FfiConverterString.lift(
835
+ uniffiCaller.rustCallWithError(
836
+ /*liftError:*/ FfiConverterTypeJazzRnError.lift.bind(
837
+ FfiConverterTypeJazzRnError
838
+ ),
839
+ /*caller:*/ (callStatus) => {
840
+ return nativeModule().ubrn_uniffi_jazz_rn_fn_method_rnruntime_get_schema_hash(
841
+ uniffiTypeRnRuntimeObjectFactory.clonePointer(this),
842
+ callStatus
843
+ );
844
+ },
845
+ /*liftString:*/ FfiConverterString.lift
846
+ )
847
+ );
848
+ }
849
+
850
+ public insert(table: string, valuesJson: string): string /*throws*/ {
851
+ return FfiConverterString.lift(
852
+ uniffiCaller.rustCallWithError(
853
+ /*liftError:*/ FfiConverterTypeJazzRnError.lift.bind(
854
+ FfiConverterTypeJazzRnError
855
+ ),
856
+ /*caller:*/ (callStatus) => {
857
+ return nativeModule().ubrn_uniffi_jazz_rn_fn_method_rnruntime_insert(
858
+ uniffiTypeRnRuntimeObjectFactory.clonePointer(this),
859
+ FfiConverterString.lower(table),
860
+ FfiConverterString.lower(valuesJson),
861
+ callStatus
862
+ );
863
+ },
864
+ /*liftString:*/ FfiConverterString.lift
865
+ )
866
+ );
867
+ }
868
+
869
+ /**
870
+ * Register a JS callback that schedules `batched_tick()` calls.
871
+ */
872
+ public onBatchedTickNeeded(
873
+ callback: BatchedTickCallback | undefined
874
+ ): void /*throws*/ {
875
+ uniffiCaller.rustCallWithError(
876
+ /*liftError:*/ FfiConverterTypeJazzRnError.lift.bind(
877
+ FfiConverterTypeJazzRnError
878
+ ),
879
+ /*caller:*/ (callStatus) => {
880
+ nativeModule().ubrn_uniffi_jazz_rn_fn_method_rnruntime_on_batched_tick_needed(
881
+ uniffiTypeRnRuntimeObjectFactory.clonePointer(this),
882
+ FfiConverterOptionalTypeBatchedTickCallback.lower(callback),
883
+ callStatus
884
+ );
885
+ },
886
+ /*liftString:*/ FfiConverterString.lift
887
+ );
888
+ }
889
+
890
+ public onSyncMessageReceived(messageJson: string): void /*throws*/ {
891
+ uniffiCaller.rustCallWithError(
892
+ /*liftError:*/ FfiConverterTypeJazzRnError.lift.bind(
893
+ FfiConverterTypeJazzRnError
894
+ ),
895
+ /*caller:*/ (callStatus) => {
896
+ nativeModule().ubrn_uniffi_jazz_rn_fn_method_rnruntime_on_sync_message_received(
897
+ uniffiTypeRnRuntimeObjectFactory.clonePointer(this),
898
+ FfiConverterString.lower(messageJson),
899
+ callStatus
900
+ );
901
+ },
902
+ /*liftString:*/ FfiConverterString.lift
903
+ );
904
+ }
905
+
906
+ public onSyncMessageReceivedFromClient(
907
+ clientId: string,
908
+ messageJson: string
909
+ ): void /*throws*/ {
910
+ uniffiCaller.rustCallWithError(
911
+ /*liftError:*/ FfiConverterTypeJazzRnError.lift.bind(
912
+ FfiConverterTypeJazzRnError
913
+ ),
914
+ /*caller:*/ (callStatus) => {
915
+ nativeModule().ubrn_uniffi_jazz_rn_fn_method_rnruntime_on_sync_message_received_from_client(
916
+ uniffiTypeRnRuntimeObjectFactory.clonePointer(this),
917
+ FfiConverterString.lower(clientId),
918
+ FfiConverterString.lower(messageJson),
919
+ callStatus
920
+ );
921
+ },
922
+ /*liftString:*/ FfiConverterString.lift
923
+ );
924
+ }
925
+
926
+ /**
927
+ * Register a JS callback for outbound sync messages.
928
+ */
929
+ public onSyncMessageToSend(
930
+ callback: SyncMessageCallback | undefined
931
+ ): void /*throws*/ {
932
+ uniffiCaller.rustCallWithError(
933
+ /*liftError:*/ FfiConverterTypeJazzRnError.lift.bind(
934
+ FfiConverterTypeJazzRnError
935
+ ),
936
+ /*caller:*/ (callStatus) => {
937
+ nativeModule().ubrn_uniffi_jazz_rn_fn_method_rnruntime_on_sync_message_to_send(
938
+ uniffiTypeRnRuntimeObjectFactory.clonePointer(this),
939
+ FfiConverterOptionalTypeSyncMessageCallback.lower(callback),
940
+ callStatus
941
+ );
942
+ },
943
+ /*liftString:*/ FfiConverterString.lift
944
+ );
945
+ }
946
+
947
+ /**
948
+ * One-shot query returning a JSON string:
949
+ * `[{ "id": "<uuid>", "values": [ {type, value}, ... ] }, ...]`.
950
+ */
951
+ public query(
952
+ queryJson: string,
953
+ sessionJson: string | undefined,
954
+ settledTier: string | undefined
955
+ ): string /*throws*/ {
956
+ return FfiConverterString.lift(
957
+ uniffiCaller.rustCallWithError(
958
+ /*liftError:*/ FfiConverterTypeJazzRnError.lift.bind(
959
+ FfiConverterTypeJazzRnError
960
+ ),
961
+ /*caller:*/ (callStatus) => {
962
+ return nativeModule().ubrn_uniffi_jazz_rn_fn_method_rnruntime_query(
963
+ uniffiTypeRnRuntimeObjectFactory.clonePointer(this),
964
+ FfiConverterString.lower(queryJson),
965
+ FfiConverterOptionalString.lower(sessionJson),
966
+ FfiConverterOptionalString.lower(settledTier),
967
+ callStatus
968
+ );
969
+ },
970
+ /*liftString:*/ FfiConverterString.lift
971
+ )
972
+ );
973
+ }
974
+
975
+ public removeServer(): void /*throws*/ {
976
+ uniffiCaller.rustCallWithError(
977
+ /*liftError:*/ FfiConverterTypeJazzRnError.lift.bind(
978
+ FfiConverterTypeJazzRnError
979
+ ),
980
+ /*caller:*/ (callStatus) => {
981
+ nativeModule().ubrn_uniffi_jazz_rn_fn_method_rnruntime_remove_server(
982
+ uniffiTypeRnRuntimeObjectFactory.clonePointer(this),
983
+ callStatus
984
+ );
985
+ },
986
+ /*liftString:*/ FfiConverterString.lift
987
+ );
988
+ }
989
+
990
+ public setClientRole(clientId: string, role: string): void /*throws*/ {
991
+ uniffiCaller.rustCallWithError(
992
+ /*liftError:*/ FfiConverterTypeJazzRnError.lift.bind(
993
+ FfiConverterTypeJazzRnError
994
+ ),
995
+ /*caller:*/ (callStatus) => {
996
+ nativeModule().ubrn_uniffi_jazz_rn_fn_method_rnruntime_set_client_role(
997
+ uniffiTypeRnRuntimeObjectFactory.clonePointer(this),
998
+ FfiConverterString.lower(clientId),
999
+ FfiConverterString.lower(role),
1000
+ callStatus
1001
+ );
1002
+ },
1003
+ /*liftString:*/ FfiConverterString.lift
1004
+ );
1005
+ }
1006
+
1007
+ public subscribe(
1008
+ queryJson: string,
1009
+ callback: SubscriptionCallback,
1010
+ sessionJson: string | undefined,
1011
+ settledTier: string | undefined
1012
+ ): /*u64*/ bigint /*throws*/ {
1013
+ return FfiConverterUInt64.lift(
1014
+ uniffiCaller.rustCallWithError(
1015
+ /*liftError:*/ FfiConverterTypeJazzRnError.lift.bind(
1016
+ FfiConverterTypeJazzRnError
1017
+ ),
1018
+ /*caller:*/ (callStatus) => {
1019
+ return nativeModule().ubrn_uniffi_jazz_rn_fn_method_rnruntime_subscribe(
1020
+ uniffiTypeRnRuntimeObjectFactory.clonePointer(this),
1021
+ FfiConverterString.lower(queryJson),
1022
+ FfiConverterTypeSubscriptionCallback.lower(callback),
1023
+ FfiConverterOptionalString.lower(sessionJson),
1024
+ FfiConverterOptionalString.lower(settledTier),
1025
+ callStatus
1026
+ );
1027
+ },
1028
+ /*liftString:*/ FfiConverterString.lift
1029
+ )
1030
+ );
1031
+ }
1032
+
1033
+ public unsubscribe(handle: /*u64*/ bigint): void /*throws*/ {
1034
+ uniffiCaller.rustCallWithError(
1035
+ /*liftError:*/ FfiConverterTypeJazzRnError.lift.bind(
1036
+ FfiConverterTypeJazzRnError
1037
+ ),
1038
+ /*caller:*/ (callStatus) => {
1039
+ nativeModule().ubrn_uniffi_jazz_rn_fn_method_rnruntime_unsubscribe(
1040
+ uniffiTypeRnRuntimeObjectFactory.clonePointer(this),
1041
+ FfiConverterUInt64.lower(handle),
1042
+ callStatus
1043
+ );
1044
+ },
1045
+ /*liftString:*/ FfiConverterString.lift
1046
+ );
1047
+ }
1048
+
1049
+ public update(objectId: string, valuesJson: string): void /*throws*/ {
1050
+ uniffiCaller.rustCallWithError(
1051
+ /*liftError:*/ FfiConverterTypeJazzRnError.lift.bind(
1052
+ FfiConverterTypeJazzRnError
1053
+ ),
1054
+ /*caller:*/ (callStatus) => {
1055
+ nativeModule().ubrn_uniffi_jazz_rn_fn_method_rnruntime_update(
1056
+ uniffiTypeRnRuntimeObjectFactory.clonePointer(this),
1057
+ FfiConverterString.lower(objectId),
1058
+ FfiConverterString.lower(valuesJson),
1059
+ callStatus
1060
+ );
1061
+ },
1062
+ /*liftString:*/ FfiConverterString.lift
1063
+ );
1064
+ }
1065
+
1066
+ /**
1067
+ * {@inheritDoc uniffi-bindgen-react-native#UniffiAbstractObject.uniffiDestroy}
1068
+ */
1069
+ uniffiDestroy(): void {
1070
+ const ptr = (this as any)[destructorGuardSymbol];
1071
+ if (ptr !== undefined) {
1072
+ const pointer = uniffiTypeRnRuntimeObjectFactory.pointer(this);
1073
+ uniffiTypeRnRuntimeObjectFactory.freePointer(pointer);
1074
+ uniffiTypeRnRuntimeObjectFactory.unbless(ptr);
1075
+ delete (this as any)[destructorGuardSymbol];
1076
+ }
1077
+ }
1078
+
1079
+ static instanceOf(obj: any): obj is RnRuntime {
1080
+ return uniffiTypeRnRuntimeObjectFactory.isConcreteType(obj);
1081
+ }
1082
+ }
1083
+
1084
+ const uniffiTypeRnRuntimeObjectFactory: UniffiObjectFactory<RnRuntimeInterface> =
1085
+ (() => {
1086
+ return {
1087
+ create(pointer: UnsafeMutableRawPointer): RnRuntimeInterface {
1088
+ const instance = Object.create(RnRuntime.prototype);
1089
+ instance[pointerLiteralSymbol] = pointer;
1090
+ instance[destructorGuardSymbol] = this.bless(pointer);
1091
+ instance[uniffiTypeNameSymbol] = 'RnRuntime';
1092
+ return instance;
1093
+ },
1094
+
1095
+ bless(p: UnsafeMutableRawPointer): UniffiRustArcPtr {
1096
+ return uniffiCaller.rustCall(
1097
+ /*caller:*/ (status) =>
1098
+ nativeModule().ubrn_uniffi_internal_fn_method_rnruntime_ffi__bless_pointer(
1099
+ p,
1100
+ status
1101
+ ),
1102
+ /*liftString:*/ FfiConverterString.lift
1103
+ );
1104
+ },
1105
+
1106
+ unbless(ptr: UniffiRustArcPtr) {
1107
+ ptr.markDestroyed();
1108
+ },
1109
+
1110
+ pointer(obj: RnRuntimeInterface): UnsafeMutableRawPointer {
1111
+ if ((obj as any)[destructorGuardSymbol] === undefined) {
1112
+ throw new UniffiInternalError.UnexpectedNullPointer();
1113
+ }
1114
+ return (obj as any)[pointerLiteralSymbol];
1115
+ },
1116
+
1117
+ clonePointer(obj: RnRuntimeInterface): UnsafeMutableRawPointer {
1118
+ const pointer = this.pointer(obj);
1119
+ return uniffiCaller.rustCall(
1120
+ /*caller:*/ (callStatus) =>
1121
+ nativeModule().ubrn_uniffi_jazz_rn_fn_clone_rnruntime(
1122
+ pointer,
1123
+ callStatus
1124
+ ),
1125
+ /*liftString:*/ FfiConverterString.lift
1126
+ );
1127
+ },
1128
+
1129
+ freePointer(pointer: UnsafeMutableRawPointer): void {
1130
+ uniffiCaller.rustCall(
1131
+ /*caller:*/ (callStatus) =>
1132
+ nativeModule().ubrn_uniffi_jazz_rn_fn_free_rnruntime(
1133
+ pointer,
1134
+ callStatus
1135
+ ),
1136
+ /*liftString:*/ FfiConverterString.lift
1137
+ );
1138
+ },
1139
+
1140
+ isConcreteType(obj: any): obj is RnRuntimeInterface {
1141
+ return (
1142
+ obj[destructorGuardSymbol] &&
1143
+ obj[uniffiTypeNameSymbol] === 'RnRuntime'
1144
+ );
1145
+ },
1146
+ };
1147
+ })();
1148
+ // FfiConverter for RnRuntimeInterface
1149
+ const FfiConverterTypeRnRuntime = new FfiConverterObject(
1150
+ uniffiTypeRnRuntimeObjectFactory
1151
+ );
1152
+
1153
+ // FfiConverter for BatchedTickCallback | undefined
1154
+ const FfiConverterOptionalTypeBatchedTickCallback = new FfiConverterOptional(
1155
+ FfiConverterTypeBatchedTickCallback
1156
+ );
1157
+
1158
+ // FfiConverter for SyncMessageCallback | undefined
1159
+ const FfiConverterOptionalTypeSyncMessageCallback = new FfiConverterOptional(
1160
+ FfiConverterTypeSyncMessageCallback
1161
+ );
1162
+
1163
+ // FfiConverter for string | undefined
1164
+ const FfiConverterOptionalString = new FfiConverterOptional(FfiConverterString);
1165
+
1166
+ /**
1167
+ * This should be called before anything else.
1168
+ *
1169
+ * It is likely that this is being done for you by the library's `index.ts`.
1170
+ *
1171
+ * It checks versions of uniffi between when the Rust scaffolding was generated
1172
+ * and when the bindings were generated.
1173
+ *
1174
+ * It also initializes the machinery to enable Rust to talk back to Javascript.
1175
+ */
1176
+ function uniffiEnsureInitialized() {
1177
+ // Get the bindings contract version from our ComponentInterface
1178
+ const bindingsContractVersion = 29;
1179
+ // Get the scaffolding contract version by calling the into the dylib
1180
+ const scaffoldingContractVersion =
1181
+ nativeModule().ubrn_ffi_jazz_rn_uniffi_contract_version();
1182
+ if (bindingsContractVersion !== scaffoldingContractVersion) {
1183
+ throw new UniffiInternalError.ContractVersionMismatch(
1184
+ scaffoldingContractVersion,
1185
+ bindingsContractVersion
1186
+ );
1187
+ }
1188
+ if (
1189
+ nativeModule().ubrn_uniffi_jazz_rn_checksum_func_current_timestamp_ms() !==
1190
+ 20765
1191
+ ) {
1192
+ throw new UniffiInternalError.ApiChecksumMismatch(
1193
+ 'uniffi_jazz_rn_checksum_func_current_timestamp_ms'
1194
+ );
1195
+ }
1196
+ if (
1197
+ nativeModule().ubrn_uniffi_jazz_rn_checksum_func_generate_id() !== 58723
1198
+ ) {
1199
+ throw new UniffiInternalError.ApiChecksumMismatch(
1200
+ 'uniffi_jazz_rn_checksum_func_generate_id'
1201
+ );
1202
+ }
1203
+ if (
1204
+ nativeModule().ubrn_uniffi_jazz_rn_checksum_method_rnruntime_add_client() !==
1205
+ 20251
1206
+ ) {
1207
+ throw new UniffiInternalError.ApiChecksumMismatch(
1208
+ 'uniffi_jazz_rn_checksum_method_rnruntime_add_client'
1209
+ );
1210
+ }
1211
+ if (
1212
+ nativeModule().ubrn_uniffi_jazz_rn_checksum_method_rnruntime_add_server() !==
1213
+ 28260
1214
+ ) {
1215
+ throw new UniffiInternalError.ApiChecksumMismatch(
1216
+ 'uniffi_jazz_rn_checksum_method_rnruntime_add_server'
1217
+ );
1218
+ }
1219
+ if (
1220
+ nativeModule().ubrn_uniffi_jazz_rn_checksum_method_rnruntime_batched_tick() !==
1221
+ 23711
1222
+ ) {
1223
+ throw new UniffiInternalError.ApiChecksumMismatch(
1224
+ 'uniffi_jazz_rn_checksum_method_rnruntime_batched_tick'
1225
+ );
1226
+ }
1227
+ if (
1228
+ nativeModule().ubrn_uniffi_jazz_rn_checksum_method_rnruntime_close() !==
1229
+ 17169
1230
+ ) {
1231
+ throw new UniffiInternalError.ApiChecksumMismatch(
1232
+ 'uniffi_jazz_rn_checksum_method_rnruntime_close'
1233
+ );
1234
+ }
1235
+ if (
1236
+ nativeModule().ubrn_uniffi_jazz_rn_checksum_method_rnruntime_delete() !==
1237
+ 4621
1238
+ ) {
1239
+ throw new UniffiInternalError.ApiChecksumMismatch(
1240
+ 'uniffi_jazz_rn_checksum_method_rnruntime_delete'
1241
+ );
1242
+ }
1243
+ if (
1244
+ nativeModule().ubrn_uniffi_jazz_rn_checksum_method_rnruntime_flush() !==
1245
+ 62556
1246
+ ) {
1247
+ throw new UniffiInternalError.ApiChecksumMismatch(
1248
+ 'uniffi_jazz_rn_checksum_method_rnruntime_flush'
1249
+ );
1250
+ }
1251
+ if (
1252
+ nativeModule().ubrn_uniffi_jazz_rn_checksum_method_rnruntime_get_schema_hash() !==
1253
+ 39147
1254
+ ) {
1255
+ throw new UniffiInternalError.ApiChecksumMismatch(
1256
+ 'uniffi_jazz_rn_checksum_method_rnruntime_get_schema_hash'
1257
+ );
1258
+ }
1259
+ if (
1260
+ nativeModule().ubrn_uniffi_jazz_rn_checksum_method_rnruntime_insert() !==
1261
+ 12677
1262
+ ) {
1263
+ throw new UniffiInternalError.ApiChecksumMismatch(
1264
+ 'uniffi_jazz_rn_checksum_method_rnruntime_insert'
1265
+ );
1266
+ }
1267
+ if (
1268
+ nativeModule().ubrn_uniffi_jazz_rn_checksum_method_rnruntime_on_batched_tick_needed() !==
1269
+ 36428
1270
+ ) {
1271
+ throw new UniffiInternalError.ApiChecksumMismatch(
1272
+ 'uniffi_jazz_rn_checksum_method_rnruntime_on_batched_tick_needed'
1273
+ );
1274
+ }
1275
+ if (
1276
+ nativeModule().ubrn_uniffi_jazz_rn_checksum_method_rnruntime_on_sync_message_received() !==
1277
+ 57227
1278
+ ) {
1279
+ throw new UniffiInternalError.ApiChecksumMismatch(
1280
+ 'uniffi_jazz_rn_checksum_method_rnruntime_on_sync_message_received'
1281
+ );
1282
+ }
1283
+ if (
1284
+ nativeModule().ubrn_uniffi_jazz_rn_checksum_method_rnruntime_on_sync_message_received_from_client() !==
1285
+ 32020
1286
+ ) {
1287
+ throw new UniffiInternalError.ApiChecksumMismatch(
1288
+ 'uniffi_jazz_rn_checksum_method_rnruntime_on_sync_message_received_from_client'
1289
+ );
1290
+ }
1291
+ if (
1292
+ nativeModule().ubrn_uniffi_jazz_rn_checksum_method_rnruntime_on_sync_message_to_send() !==
1293
+ 58836
1294
+ ) {
1295
+ throw new UniffiInternalError.ApiChecksumMismatch(
1296
+ 'uniffi_jazz_rn_checksum_method_rnruntime_on_sync_message_to_send'
1297
+ );
1298
+ }
1299
+ if (
1300
+ nativeModule().ubrn_uniffi_jazz_rn_checksum_method_rnruntime_query() !==
1301
+ 33623
1302
+ ) {
1303
+ throw new UniffiInternalError.ApiChecksumMismatch(
1304
+ 'uniffi_jazz_rn_checksum_method_rnruntime_query'
1305
+ );
1306
+ }
1307
+ if (
1308
+ nativeModule().ubrn_uniffi_jazz_rn_checksum_method_rnruntime_remove_server() !==
1309
+ 7238
1310
+ ) {
1311
+ throw new UniffiInternalError.ApiChecksumMismatch(
1312
+ 'uniffi_jazz_rn_checksum_method_rnruntime_remove_server'
1313
+ );
1314
+ }
1315
+ if (
1316
+ nativeModule().ubrn_uniffi_jazz_rn_checksum_method_rnruntime_set_client_role() !==
1317
+ 4241
1318
+ ) {
1319
+ throw new UniffiInternalError.ApiChecksumMismatch(
1320
+ 'uniffi_jazz_rn_checksum_method_rnruntime_set_client_role'
1321
+ );
1322
+ }
1323
+ if (
1324
+ nativeModule().ubrn_uniffi_jazz_rn_checksum_method_rnruntime_subscribe() !==
1325
+ 24615
1326
+ ) {
1327
+ throw new UniffiInternalError.ApiChecksumMismatch(
1328
+ 'uniffi_jazz_rn_checksum_method_rnruntime_subscribe'
1329
+ );
1330
+ }
1331
+ if (
1332
+ nativeModule().ubrn_uniffi_jazz_rn_checksum_method_rnruntime_unsubscribe() !==
1333
+ 22724
1334
+ ) {
1335
+ throw new UniffiInternalError.ApiChecksumMismatch(
1336
+ 'uniffi_jazz_rn_checksum_method_rnruntime_unsubscribe'
1337
+ );
1338
+ }
1339
+ if (
1340
+ nativeModule().ubrn_uniffi_jazz_rn_checksum_method_rnruntime_update() !==
1341
+ 52169
1342
+ ) {
1343
+ throw new UniffiInternalError.ApiChecksumMismatch(
1344
+ 'uniffi_jazz_rn_checksum_method_rnruntime_update'
1345
+ );
1346
+ }
1347
+ if (
1348
+ nativeModule().ubrn_uniffi_jazz_rn_checksum_constructor_rnruntime_new() !==
1349
+ 5640
1350
+ ) {
1351
+ throw new UniffiInternalError.ApiChecksumMismatch(
1352
+ 'uniffi_jazz_rn_checksum_constructor_rnruntime_new'
1353
+ );
1354
+ }
1355
+ if (
1356
+ nativeModule().ubrn_uniffi_jazz_rn_checksum_method_batchedtickcallback_request_batched_tick() !==
1357
+ 53765
1358
+ ) {
1359
+ throw new UniffiInternalError.ApiChecksumMismatch(
1360
+ 'uniffi_jazz_rn_checksum_method_batchedtickcallback_request_batched_tick'
1361
+ );
1362
+ }
1363
+ if (
1364
+ nativeModule().ubrn_uniffi_jazz_rn_checksum_method_subscriptioncallback_on_update() !==
1365
+ 5131
1366
+ ) {
1367
+ throw new UniffiInternalError.ApiChecksumMismatch(
1368
+ 'uniffi_jazz_rn_checksum_method_subscriptioncallback_on_update'
1369
+ );
1370
+ }
1371
+ if (
1372
+ nativeModule().ubrn_uniffi_jazz_rn_checksum_method_syncmessagecallback_on_sync_message() !==
1373
+ 26254
1374
+ ) {
1375
+ throw new UniffiInternalError.ApiChecksumMismatch(
1376
+ 'uniffi_jazz_rn_checksum_method_syncmessagecallback_on_sync_message'
1377
+ );
1378
+ }
1379
+
1380
+ uniffiCallbackInterfaceBatchedTickCallback.register();
1381
+ uniffiCallbackInterfaceSubscriptionCallback.register();
1382
+ uniffiCallbackInterfaceSyncMessageCallback.register();
1383
+ }
1384
+
1385
+ export default Object.freeze({
1386
+ initialize: uniffiEnsureInitialized,
1387
+ converters: {
1388
+ FfiConverterTypeJazzRnError,
1389
+ FfiConverterTypeRnRuntime,
1390
+ },
1391
+ });