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,714 @@
1
+ "use strict";
2
+
3
+ // This file was autogenerated by some hot garbage in the `uniffi-bindgen-react-native` crate.
4
+ // Trust me, you don't want to mess with it!
5
+ import nativeModule from "./jazz_rn-ffi.js";
6
+ import { AbstractFfiConverterByteArray, FfiConverterCallback, FfiConverterInt32, FfiConverterInt64, FfiConverterObject, FfiConverterOptional, FfiConverterUInt64, UniffiAbstractObject, UniffiError, UniffiInternalError, UniffiResult, UniffiRustCaller, destructorGuardSymbol, pointerLiteralSymbol, uniffiCreateFfiConverterString, uniffiTraitInterfaceCall, uniffiTypeNameSymbol } from 'uniffi-bindgen-react-native';
7
+
8
+ // Get converters from the other files, if any.
9
+ const uniffiCaller = new UniffiRustCaller(() => ({
10
+ code: 0
11
+ }));
12
+ const uniffiIsDebug =
13
+ // @ts-ignore -- The process global might not be defined
14
+ typeof process !== 'object' ||
15
+ // @ts-ignore -- The process global might not be defined
16
+ process?.env?.NODE_ENV !== 'production' || false;
17
+ // Public interface members begin here.
18
+
19
+ export function currentTimestampMs() {
20
+ return FfiConverterInt64.lift(uniffiCaller.rustCall(/*caller:*/callStatus => {
21
+ return nativeModule().ubrn_uniffi_jazz_rn_fn_func_current_timestamp_ms(callStatus);
22
+ }, /*liftString:*/FfiConverterString.lift));
23
+ }
24
+ export function generateId() {
25
+ return FfiConverterString.lift(uniffiCaller.rustCall(/*caller:*/callStatus => {
26
+ return nativeModule().ubrn_uniffi_jazz_rn_fn_func_generate_id(callStatus);
27
+ }, /*liftString:*/FfiConverterString.lift));
28
+ }
29
+ // Put the implementation in a struct so we don't pollute the top-level namespace
30
+ const uniffiCallbackInterfaceBatchedTickCallback = {
31
+ // Create the VTable using a series of closures.
32
+ // ts automatically converts these into C callback functions.
33
+ vtable: {
34
+ requestBatchedTick: uniffiHandle => {
35
+ const uniffiMakeCall = () => {
36
+ const jsCallback = FfiConverterTypeBatchedTickCallback.lift(uniffiHandle);
37
+ return jsCallback.requestBatchedTick();
38
+ };
39
+ const uniffiResult = UniffiResult.ready();
40
+ const uniffiHandleSuccess = obj => {};
41
+ const uniffiHandleError = (code, errBuf) => {
42
+ UniffiResult.writeError(uniffiResult, code, errBuf);
43
+ };
44
+ uniffiTraitInterfaceCall(/*makeCall:*/uniffiMakeCall, /*handleSuccess:*/uniffiHandleSuccess, /*handleError:*/uniffiHandleError, /*lowerString:*/FfiConverterString.lower);
45
+ return uniffiResult;
46
+ },
47
+ uniffiFree: uniffiHandle => {
48
+ // BatchedTickCallback: this will throw a stale handle error if the handle isn't found.
49
+ FfiConverterTypeBatchedTickCallback.drop(uniffiHandle);
50
+ }
51
+ },
52
+ register: () => {
53
+ nativeModule().ubrn_uniffi_jazz_rn_fn_init_callback_vtable_batchedtickcallback(uniffiCallbackInterfaceBatchedTickCallback.vtable);
54
+ }
55
+ };
56
+
57
+ // FfiConverter protocol for callback interfaces
58
+ const FfiConverterTypeBatchedTickCallback = new FfiConverterCallback();
59
+ // Put the implementation in a struct so we don't pollute the top-level namespace
60
+ const uniffiCallbackInterfaceSubscriptionCallback = {
61
+ // Create the VTable using a series of closures.
62
+ // ts automatically converts these into C callback functions.
63
+ vtable: {
64
+ onUpdate: (uniffiHandle, deltaJson) => {
65
+ const uniffiMakeCall = () => {
66
+ const jsCallback = FfiConverterTypeSubscriptionCallback.lift(uniffiHandle);
67
+ return jsCallback.onUpdate(FfiConverterString.lift(deltaJson));
68
+ };
69
+ const uniffiResult = UniffiResult.ready();
70
+ const uniffiHandleSuccess = obj => {};
71
+ const uniffiHandleError = (code, errBuf) => {
72
+ UniffiResult.writeError(uniffiResult, code, errBuf);
73
+ };
74
+ uniffiTraitInterfaceCall(/*makeCall:*/uniffiMakeCall, /*handleSuccess:*/uniffiHandleSuccess, /*handleError:*/uniffiHandleError, /*lowerString:*/FfiConverterString.lower);
75
+ return uniffiResult;
76
+ },
77
+ uniffiFree: uniffiHandle => {
78
+ // SubscriptionCallback: this will throw a stale handle error if the handle isn't found.
79
+ FfiConverterTypeSubscriptionCallback.drop(uniffiHandle);
80
+ }
81
+ },
82
+ register: () => {
83
+ nativeModule().ubrn_uniffi_jazz_rn_fn_init_callback_vtable_subscriptioncallback(uniffiCallbackInterfaceSubscriptionCallback.vtable);
84
+ }
85
+ };
86
+
87
+ // FfiConverter protocol for callback interfaces
88
+ const FfiConverterTypeSubscriptionCallback = new FfiConverterCallback();
89
+ // Put the implementation in a struct so we don't pollute the top-level namespace
90
+ const uniffiCallbackInterfaceSyncMessageCallback = {
91
+ // Create the VTable using a series of closures.
92
+ // ts automatically converts these into C callback functions.
93
+ vtable: {
94
+ onSyncMessage: (uniffiHandle, messageJson) => {
95
+ const uniffiMakeCall = () => {
96
+ const jsCallback = FfiConverterTypeSyncMessageCallback.lift(uniffiHandle);
97
+ return jsCallback.onSyncMessage(FfiConverterString.lift(messageJson));
98
+ };
99
+ const uniffiResult = UniffiResult.ready();
100
+ const uniffiHandleSuccess = obj => {};
101
+ const uniffiHandleError = (code, errBuf) => {
102
+ UniffiResult.writeError(uniffiResult, code, errBuf);
103
+ };
104
+ uniffiTraitInterfaceCall(/*makeCall:*/uniffiMakeCall, /*handleSuccess:*/uniffiHandleSuccess, /*handleError:*/uniffiHandleError, /*lowerString:*/FfiConverterString.lower);
105
+ return uniffiResult;
106
+ },
107
+ uniffiFree: uniffiHandle => {
108
+ // SyncMessageCallback: this will throw a stale handle error if the handle isn't found.
109
+ FfiConverterTypeSyncMessageCallback.drop(uniffiHandle);
110
+ }
111
+ },
112
+ register: () => {
113
+ nativeModule().ubrn_uniffi_jazz_rn_fn_init_callback_vtable_syncmessagecallback(uniffiCallbackInterfaceSyncMessageCallback.vtable);
114
+ }
115
+ };
116
+
117
+ // FfiConverter protocol for callback interfaces
118
+ const FfiConverterTypeSyncMessageCallback = new FfiConverterCallback();
119
+ const stringConverter = {
120
+ stringToBytes: s => uniffiCaller.rustCall(status => nativeModule().ubrn_uniffi_internal_fn_func_ffi__string_to_arraybuffer(s, status)),
121
+ bytesToString: ab => uniffiCaller.rustCall(status => nativeModule().ubrn_uniffi_internal_fn_func_ffi__arraybuffer_to_string(ab, status)),
122
+ stringByteLength: s => uniffiCaller.rustCall(status => nativeModule().ubrn_uniffi_internal_fn_func_ffi__string_to_byte_length(s, status))
123
+ };
124
+ const FfiConverterString = uniffiCreateFfiConverterString(stringConverter);
125
+
126
+ // Error type: JazzRnError
127
+
128
+ // Enum: JazzRnError
129
+ export let JazzRnError_Tags = /*#__PURE__*/function (JazzRnError_Tags) {
130
+ JazzRnError_Tags["InvalidJson"] = "InvalidJson";
131
+ JazzRnError_Tags["InvalidUuid"] = "InvalidUuid";
132
+ JazzRnError_Tags["InvalidTier"] = "InvalidTier";
133
+ JazzRnError_Tags["Schema"] = "Schema";
134
+ JazzRnError_Tags["Runtime"] = "Runtime";
135
+ JazzRnError_Tags["Internal"] = "Internal";
136
+ return JazzRnError_Tags;
137
+ }({});
138
+ export const JazzRnError = (() => {
139
+ class InvalidJson_ extends UniffiError {
140
+ /**
141
+ * @private
142
+ * This field is private and should not be used, use `tag` instead.
143
+ */
144
+ [uniffiTypeNameSymbol] = 'JazzRnError';
145
+ tag = JazzRnError_Tags.InvalidJson;
146
+ constructor(inner) {
147
+ super('JazzRnError', 'InvalidJson');
148
+ this.inner = Object.freeze(inner);
149
+ }
150
+ static new(inner) {
151
+ return new InvalidJson_(inner);
152
+ }
153
+ static instanceOf(obj) {
154
+ return obj.tag === JazzRnError_Tags.InvalidJson;
155
+ }
156
+ static hasInner(obj) {
157
+ return InvalidJson_.instanceOf(obj);
158
+ }
159
+ static getInner(obj) {
160
+ return obj.inner;
161
+ }
162
+ }
163
+ class InvalidUuid_ extends UniffiError {
164
+ /**
165
+ * @private
166
+ * This field is private and should not be used, use `tag` instead.
167
+ */
168
+ [uniffiTypeNameSymbol] = 'JazzRnError';
169
+ tag = JazzRnError_Tags.InvalidUuid;
170
+ constructor(inner) {
171
+ super('JazzRnError', 'InvalidUuid');
172
+ this.inner = Object.freeze(inner);
173
+ }
174
+ static new(inner) {
175
+ return new InvalidUuid_(inner);
176
+ }
177
+ static instanceOf(obj) {
178
+ return obj.tag === JazzRnError_Tags.InvalidUuid;
179
+ }
180
+ static hasInner(obj) {
181
+ return InvalidUuid_.instanceOf(obj);
182
+ }
183
+ static getInner(obj) {
184
+ return obj.inner;
185
+ }
186
+ }
187
+ class InvalidTier_ extends UniffiError {
188
+ /**
189
+ * @private
190
+ * This field is private and should not be used, use `tag` instead.
191
+ */
192
+ [uniffiTypeNameSymbol] = 'JazzRnError';
193
+ tag = JazzRnError_Tags.InvalidTier;
194
+ constructor(inner) {
195
+ super('JazzRnError', 'InvalidTier');
196
+ this.inner = Object.freeze(inner);
197
+ }
198
+ static new(inner) {
199
+ return new InvalidTier_(inner);
200
+ }
201
+ static instanceOf(obj) {
202
+ return obj.tag === JazzRnError_Tags.InvalidTier;
203
+ }
204
+ static hasInner(obj) {
205
+ return InvalidTier_.instanceOf(obj);
206
+ }
207
+ static getInner(obj) {
208
+ return obj.inner;
209
+ }
210
+ }
211
+ class Schema_ extends UniffiError {
212
+ /**
213
+ * @private
214
+ * This field is private and should not be used, use `tag` instead.
215
+ */
216
+ [uniffiTypeNameSymbol] = 'JazzRnError';
217
+ tag = JazzRnError_Tags.Schema;
218
+ constructor(inner) {
219
+ super('JazzRnError', 'Schema');
220
+ this.inner = Object.freeze(inner);
221
+ }
222
+ static new(inner) {
223
+ return new Schema_(inner);
224
+ }
225
+ static instanceOf(obj) {
226
+ return obj.tag === JazzRnError_Tags.Schema;
227
+ }
228
+ static hasInner(obj) {
229
+ return Schema_.instanceOf(obj);
230
+ }
231
+ static getInner(obj) {
232
+ return obj.inner;
233
+ }
234
+ }
235
+ class Runtime_ extends UniffiError {
236
+ /**
237
+ * @private
238
+ * This field is private and should not be used, use `tag` instead.
239
+ */
240
+ [uniffiTypeNameSymbol] = 'JazzRnError';
241
+ tag = JazzRnError_Tags.Runtime;
242
+ constructor(inner) {
243
+ super('JazzRnError', 'Runtime');
244
+ this.inner = Object.freeze(inner);
245
+ }
246
+ static new(inner) {
247
+ return new Runtime_(inner);
248
+ }
249
+ static instanceOf(obj) {
250
+ return obj.tag === JazzRnError_Tags.Runtime;
251
+ }
252
+ static hasInner(obj) {
253
+ return Runtime_.instanceOf(obj);
254
+ }
255
+ static getInner(obj) {
256
+ return obj.inner;
257
+ }
258
+ }
259
+ class Internal_ extends UniffiError {
260
+ /**
261
+ * @private
262
+ * This field is private and should not be used, use `tag` instead.
263
+ */
264
+ [uniffiTypeNameSymbol] = 'JazzRnError';
265
+ tag = JazzRnError_Tags.Internal;
266
+ constructor(inner) {
267
+ super('JazzRnError', 'Internal');
268
+ this.inner = Object.freeze(inner);
269
+ }
270
+ static new(inner) {
271
+ return new Internal_(inner);
272
+ }
273
+ static instanceOf(obj) {
274
+ return obj.tag === JazzRnError_Tags.Internal;
275
+ }
276
+ static hasInner(obj) {
277
+ return Internal_.instanceOf(obj);
278
+ }
279
+ static getInner(obj) {
280
+ return obj.inner;
281
+ }
282
+ }
283
+ function instanceOf(obj) {
284
+ return obj[uniffiTypeNameSymbol] === 'JazzRnError';
285
+ }
286
+ return Object.freeze({
287
+ instanceOf,
288
+ InvalidJson: InvalidJson_,
289
+ InvalidUuid: InvalidUuid_,
290
+ InvalidTier: InvalidTier_,
291
+ Schema: Schema_,
292
+ Runtime: Runtime_,
293
+ Internal: Internal_
294
+ });
295
+ })();
296
+ // FfiConverter for enum JazzRnError
297
+ const FfiConverterTypeJazzRnError = (() => {
298
+ const ordinalConverter = FfiConverterInt32;
299
+ class FFIConverter extends AbstractFfiConverterByteArray {
300
+ read(from) {
301
+ switch (ordinalConverter.read(from)) {
302
+ case 1:
303
+ return new JazzRnError.InvalidJson({
304
+ message: FfiConverterString.read(from)
305
+ });
306
+ case 2:
307
+ return new JazzRnError.InvalidUuid({
308
+ message: FfiConverterString.read(from)
309
+ });
310
+ case 3:
311
+ return new JazzRnError.InvalidTier({
312
+ message: FfiConverterString.read(from)
313
+ });
314
+ case 4:
315
+ return new JazzRnError.Schema({
316
+ message: FfiConverterString.read(from)
317
+ });
318
+ case 5:
319
+ return new JazzRnError.Runtime({
320
+ message: FfiConverterString.read(from)
321
+ });
322
+ case 6:
323
+ return new JazzRnError.Internal({
324
+ message: FfiConverterString.read(from)
325
+ });
326
+ default:
327
+ throw new UniffiInternalError.UnexpectedEnumCase();
328
+ }
329
+ }
330
+ write(value, into) {
331
+ switch (value.tag) {
332
+ case JazzRnError_Tags.InvalidJson:
333
+ {
334
+ ordinalConverter.write(1, into);
335
+ const inner = value.inner;
336
+ FfiConverterString.write(inner.message, into);
337
+ return;
338
+ }
339
+ case JazzRnError_Tags.InvalidUuid:
340
+ {
341
+ ordinalConverter.write(2, into);
342
+ const inner = value.inner;
343
+ FfiConverterString.write(inner.message, into);
344
+ return;
345
+ }
346
+ case JazzRnError_Tags.InvalidTier:
347
+ {
348
+ ordinalConverter.write(3, into);
349
+ const inner = value.inner;
350
+ FfiConverterString.write(inner.message, into);
351
+ return;
352
+ }
353
+ case JazzRnError_Tags.Schema:
354
+ {
355
+ ordinalConverter.write(4, into);
356
+ const inner = value.inner;
357
+ FfiConverterString.write(inner.message, into);
358
+ return;
359
+ }
360
+ case JazzRnError_Tags.Runtime:
361
+ {
362
+ ordinalConverter.write(5, into);
363
+ const inner = value.inner;
364
+ FfiConverterString.write(inner.message, into);
365
+ return;
366
+ }
367
+ case JazzRnError_Tags.Internal:
368
+ {
369
+ ordinalConverter.write(6, into);
370
+ const inner = value.inner;
371
+ FfiConverterString.write(inner.message, into);
372
+ return;
373
+ }
374
+ default:
375
+ // Throwing from here means that JazzRnError_Tags hasn't matched an ordinal.
376
+ throw new UniffiInternalError.UnexpectedEnumCase();
377
+ }
378
+ }
379
+ allocationSize(value) {
380
+ switch (value.tag) {
381
+ case JazzRnError_Tags.InvalidJson:
382
+ {
383
+ const inner = value.inner;
384
+ let size = ordinalConverter.allocationSize(1);
385
+ size += FfiConverterString.allocationSize(inner.message);
386
+ return size;
387
+ }
388
+ case JazzRnError_Tags.InvalidUuid:
389
+ {
390
+ const inner = value.inner;
391
+ let size = ordinalConverter.allocationSize(2);
392
+ size += FfiConverterString.allocationSize(inner.message);
393
+ return size;
394
+ }
395
+ case JazzRnError_Tags.InvalidTier:
396
+ {
397
+ const inner = value.inner;
398
+ let size = ordinalConverter.allocationSize(3);
399
+ size += FfiConverterString.allocationSize(inner.message);
400
+ return size;
401
+ }
402
+ case JazzRnError_Tags.Schema:
403
+ {
404
+ const inner = value.inner;
405
+ let size = ordinalConverter.allocationSize(4);
406
+ size += FfiConverterString.allocationSize(inner.message);
407
+ return size;
408
+ }
409
+ case JazzRnError_Tags.Runtime:
410
+ {
411
+ const inner = value.inner;
412
+ let size = ordinalConverter.allocationSize(5);
413
+ size += FfiConverterString.allocationSize(inner.message);
414
+ return size;
415
+ }
416
+ case JazzRnError_Tags.Internal:
417
+ {
418
+ const inner = value.inner;
419
+ let size = ordinalConverter.allocationSize(6);
420
+ size += FfiConverterString.allocationSize(inner.message);
421
+ return size;
422
+ }
423
+ default:
424
+ throw new UniffiInternalError.UnexpectedEnumCase();
425
+ }
426
+ }
427
+ }
428
+ return new FFIConverter();
429
+ })();
430
+ export class RnRuntime extends UniffiAbstractObject {
431
+ [uniffiTypeNameSymbol] = 'RnRuntime';
432
+ constructor(schemaJson, appId, jazzEnv, userBranch, tier, dataPath) /*throws*/{
433
+ super();
434
+ const pointer = uniffiCaller.rustCallWithError(/*liftError:*/FfiConverterTypeJazzRnError.lift.bind(FfiConverterTypeJazzRnError), /*caller:*/callStatus => {
435
+ return nativeModule().ubrn_uniffi_jazz_rn_fn_constructor_rnruntime_new(FfiConverterString.lower(schemaJson), FfiConverterString.lower(appId), FfiConverterString.lower(jazzEnv), FfiConverterString.lower(userBranch), FfiConverterOptionalString.lower(tier), FfiConverterOptionalString.lower(dataPath), callStatus);
436
+ }, /*liftString:*/FfiConverterString.lift);
437
+ this[pointerLiteralSymbol] = pointer;
438
+ this[destructorGuardSymbol] = uniffiTypeRnRuntimeObjectFactory.bless(pointer);
439
+ }
440
+ addClient() /*throws*/{
441
+ return FfiConverterString.lift(uniffiCaller.rustCallWithError(/*liftError:*/FfiConverterTypeJazzRnError.lift.bind(FfiConverterTypeJazzRnError), /*caller:*/callStatus => {
442
+ return nativeModule().ubrn_uniffi_jazz_rn_fn_method_rnruntime_add_client(uniffiTypeRnRuntimeObjectFactory.clonePointer(this), callStatus);
443
+ }, /*liftString:*/FfiConverterString.lift));
444
+ }
445
+ addServer() /*throws*/{
446
+ uniffiCaller.rustCallWithError(/*liftError:*/FfiConverterTypeJazzRnError.lift.bind(FfiConverterTypeJazzRnError), /*caller:*/callStatus => {
447
+ nativeModule().ubrn_uniffi_jazz_rn_fn_method_rnruntime_add_server(uniffiTypeRnRuntimeObjectFactory.clonePointer(this), callStatus);
448
+ }, /*liftString:*/FfiConverterString.lift);
449
+ }
450
+
451
+ /**
452
+ * Run a batched tick. JS should call this when asked via `on_batched_tick_needed`.
453
+ */
454
+ batchedTick() /*throws*/{
455
+ uniffiCaller.rustCallWithError(/*liftError:*/FfiConverterTypeJazzRnError.lift.bind(FfiConverterTypeJazzRnError), /*caller:*/callStatus => {
456
+ nativeModule().ubrn_uniffi_jazz_rn_fn_method_rnruntime_batched_tick(uniffiTypeRnRuntimeObjectFactory.clonePointer(this), callStatus);
457
+ }, /*liftString:*/FfiConverterString.lift);
458
+ }
459
+
460
+ /**
461
+ * Flush and close the underlying storage, releasing filesystem locks.
462
+ */
463
+ close() /*throws*/{
464
+ uniffiCaller.rustCallWithError(/*liftError:*/FfiConverterTypeJazzRnError.lift.bind(FfiConverterTypeJazzRnError), /*caller:*/callStatus => {
465
+ nativeModule().ubrn_uniffi_jazz_rn_fn_method_rnruntime_close(uniffiTypeRnRuntimeObjectFactory.clonePointer(this), callStatus);
466
+ }, /*liftString:*/FfiConverterString.lift);
467
+ }
468
+ delete_(objectId) /*throws*/{
469
+ uniffiCaller.rustCallWithError(/*liftError:*/FfiConverterTypeJazzRnError.lift.bind(FfiConverterTypeJazzRnError), /*caller:*/callStatus => {
470
+ nativeModule().ubrn_uniffi_jazz_rn_fn_method_rnruntime_delete(uniffiTypeRnRuntimeObjectFactory.clonePointer(this), FfiConverterString.lower(objectId), callStatus);
471
+ }, /*liftString:*/FfiConverterString.lift);
472
+ }
473
+ flush() /*throws*/{
474
+ uniffiCaller.rustCallWithError(/*liftError:*/FfiConverterTypeJazzRnError.lift.bind(FfiConverterTypeJazzRnError), /*caller:*/callStatus => {
475
+ nativeModule().ubrn_uniffi_jazz_rn_fn_method_rnruntime_flush(uniffiTypeRnRuntimeObjectFactory.clonePointer(this), callStatus);
476
+ }, /*liftString:*/FfiConverterString.lift);
477
+ }
478
+ getSchemaHash() /*throws*/{
479
+ return FfiConverterString.lift(uniffiCaller.rustCallWithError(/*liftError:*/FfiConverterTypeJazzRnError.lift.bind(FfiConverterTypeJazzRnError), /*caller:*/callStatus => {
480
+ return nativeModule().ubrn_uniffi_jazz_rn_fn_method_rnruntime_get_schema_hash(uniffiTypeRnRuntimeObjectFactory.clonePointer(this), callStatus);
481
+ }, /*liftString:*/FfiConverterString.lift));
482
+ }
483
+ insert(table, valuesJson) /*throws*/{
484
+ return FfiConverterString.lift(uniffiCaller.rustCallWithError(/*liftError:*/FfiConverterTypeJazzRnError.lift.bind(FfiConverterTypeJazzRnError), /*caller:*/callStatus => {
485
+ return nativeModule().ubrn_uniffi_jazz_rn_fn_method_rnruntime_insert(uniffiTypeRnRuntimeObjectFactory.clonePointer(this), FfiConverterString.lower(table), FfiConverterString.lower(valuesJson), callStatus);
486
+ }, /*liftString:*/FfiConverterString.lift));
487
+ }
488
+
489
+ /**
490
+ * Register a JS callback that schedules `batched_tick()` calls.
491
+ */
492
+ onBatchedTickNeeded(callback) /*throws*/{
493
+ uniffiCaller.rustCallWithError(/*liftError:*/FfiConverterTypeJazzRnError.lift.bind(FfiConverterTypeJazzRnError), /*caller:*/callStatus => {
494
+ nativeModule().ubrn_uniffi_jazz_rn_fn_method_rnruntime_on_batched_tick_needed(uniffiTypeRnRuntimeObjectFactory.clonePointer(this), FfiConverterOptionalTypeBatchedTickCallback.lower(callback), callStatus);
495
+ }, /*liftString:*/FfiConverterString.lift);
496
+ }
497
+ onSyncMessageReceived(messageJson) /*throws*/{
498
+ uniffiCaller.rustCallWithError(/*liftError:*/FfiConverterTypeJazzRnError.lift.bind(FfiConverterTypeJazzRnError), /*caller:*/callStatus => {
499
+ nativeModule().ubrn_uniffi_jazz_rn_fn_method_rnruntime_on_sync_message_received(uniffiTypeRnRuntimeObjectFactory.clonePointer(this), FfiConverterString.lower(messageJson), callStatus);
500
+ }, /*liftString:*/FfiConverterString.lift);
501
+ }
502
+ onSyncMessageReceivedFromClient(clientId, messageJson) /*throws*/{
503
+ uniffiCaller.rustCallWithError(/*liftError:*/FfiConverterTypeJazzRnError.lift.bind(FfiConverterTypeJazzRnError), /*caller:*/callStatus => {
504
+ nativeModule().ubrn_uniffi_jazz_rn_fn_method_rnruntime_on_sync_message_received_from_client(uniffiTypeRnRuntimeObjectFactory.clonePointer(this), FfiConverterString.lower(clientId), FfiConverterString.lower(messageJson), callStatus);
505
+ }, /*liftString:*/FfiConverterString.lift);
506
+ }
507
+
508
+ /**
509
+ * Register a JS callback for outbound sync messages.
510
+ */
511
+ onSyncMessageToSend(callback) /*throws*/{
512
+ uniffiCaller.rustCallWithError(/*liftError:*/FfiConverterTypeJazzRnError.lift.bind(FfiConverterTypeJazzRnError), /*caller:*/callStatus => {
513
+ nativeModule().ubrn_uniffi_jazz_rn_fn_method_rnruntime_on_sync_message_to_send(uniffiTypeRnRuntimeObjectFactory.clonePointer(this), FfiConverterOptionalTypeSyncMessageCallback.lower(callback), callStatus);
514
+ }, /*liftString:*/FfiConverterString.lift);
515
+ }
516
+
517
+ /**
518
+ * One-shot query returning a JSON string:
519
+ * `[{ "id": "<uuid>", "values": [ {type, value}, ... ] }, ...]`.
520
+ */
521
+ query(queryJson, sessionJson, settledTier) /*throws*/{
522
+ return FfiConverterString.lift(uniffiCaller.rustCallWithError(/*liftError:*/FfiConverterTypeJazzRnError.lift.bind(FfiConverterTypeJazzRnError), /*caller:*/callStatus => {
523
+ return nativeModule().ubrn_uniffi_jazz_rn_fn_method_rnruntime_query(uniffiTypeRnRuntimeObjectFactory.clonePointer(this), FfiConverterString.lower(queryJson), FfiConverterOptionalString.lower(sessionJson), FfiConverterOptionalString.lower(settledTier), callStatus);
524
+ }, /*liftString:*/FfiConverterString.lift));
525
+ }
526
+ removeServer() /*throws*/{
527
+ uniffiCaller.rustCallWithError(/*liftError:*/FfiConverterTypeJazzRnError.lift.bind(FfiConverterTypeJazzRnError), /*caller:*/callStatus => {
528
+ nativeModule().ubrn_uniffi_jazz_rn_fn_method_rnruntime_remove_server(uniffiTypeRnRuntimeObjectFactory.clonePointer(this), callStatus);
529
+ }, /*liftString:*/FfiConverterString.lift);
530
+ }
531
+ setClientRole(clientId, role) /*throws*/{
532
+ uniffiCaller.rustCallWithError(/*liftError:*/FfiConverterTypeJazzRnError.lift.bind(FfiConverterTypeJazzRnError), /*caller:*/callStatus => {
533
+ nativeModule().ubrn_uniffi_jazz_rn_fn_method_rnruntime_set_client_role(uniffiTypeRnRuntimeObjectFactory.clonePointer(this), FfiConverterString.lower(clientId), FfiConverterString.lower(role), callStatus);
534
+ }, /*liftString:*/FfiConverterString.lift);
535
+ }
536
+ subscribe(queryJson, callback, sessionJson, settledTier) /*throws*/{
537
+ return FfiConverterUInt64.lift(uniffiCaller.rustCallWithError(/*liftError:*/FfiConverterTypeJazzRnError.lift.bind(FfiConverterTypeJazzRnError), /*caller:*/callStatus => {
538
+ return nativeModule().ubrn_uniffi_jazz_rn_fn_method_rnruntime_subscribe(uniffiTypeRnRuntimeObjectFactory.clonePointer(this), FfiConverterString.lower(queryJson), FfiConverterTypeSubscriptionCallback.lower(callback), FfiConverterOptionalString.lower(sessionJson), FfiConverterOptionalString.lower(settledTier), callStatus);
539
+ }, /*liftString:*/FfiConverterString.lift));
540
+ }
541
+ unsubscribe(handle) /*throws*/{
542
+ uniffiCaller.rustCallWithError(/*liftError:*/FfiConverterTypeJazzRnError.lift.bind(FfiConverterTypeJazzRnError), /*caller:*/callStatus => {
543
+ nativeModule().ubrn_uniffi_jazz_rn_fn_method_rnruntime_unsubscribe(uniffiTypeRnRuntimeObjectFactory.clonePointer(this), FfiConverterUInt64.lower(handle), callStatus);
544
+ }, /*liftString:*/FfiConverterString.lift);
545
+ }
546
+ update(objectId, valuesJson) /*throws*/{
547
+ uniffiCaller.rustCallWithError(/*liftError:*/FfiConverterTypeJazzRnError.lift.bind(FfiConverterTypeJazzRnError), /*caller:*/callStatus => {
548
+ nativeModule().ubrn_uniffi_jazz_rn_fn_method_rnruntime_update(uniffiTypeRnRuntimeObjectFactory.clonePointer(this), FfiConverterString.lower(objectId), FfiConverterString.lower(valuesJson), callStatus);
549
+ }, /*liftString:*/FfiConverterString.lift);
550
+ }
551
+
552
+ /**
553
+ * {@inheritDoc uniffi-bindgen-react-native#UniffiAbstractObject.uniffiDestroy}
554
+ */
555
+ uniffiDestroy() {
556
+ const ptr = this[destructorGuardSymbol];
557
+ if (ptr !== undefined) {
558
+ const pointer = uniffiTypeRnRuntimeObjectFactory.pointer(this);
559
+ uniffiTypeRnRuntimeObjectFactory.freePointer(pointer);
560
+ uniffiTypeRnRuntimeObjectFactory.unbless(ptr);
561
+ delete this[destructorGuardSymbol];
562
+ }
563
+ }
564
+ static instanceOf(obj) {
565
+ return uniffiTypeRnRuntimeObjectFactory.isConcreteType(obj);
566
+ }
567
+ }
568
+ const uniffiTypeRnRuntimeObjectFactory = (() => {
569
+ return {
570
+ create(pointer) {
571
+ const instance = Object.create(RnRuntime.prototype);
572
+ instance[pointerLiteralSymbol] = pointer;
573
+ instance[destructorGuardSymbol] = this.bless(pointer);
574
+ instance[uniffiTypeNameSymbol] = 'RnRuntime';
575
+ return instance;
576
+ },
577
+ bless(p) {
578
+ return uniffiCaller.rustCall(/*caller:*/status => nativeModule().ubrn_uniffi_internal_fn_method_rnruntime_ffi__bless_pointer(p, status), /*liftString:*/FfiConverterString.lift);
579
+ },
580
+ unbless(ptr) {
581
+ ptr.markDestroyed();
582
+ },
583
+ pointer(obj) {
584
+ if (obj[destructorGuardSymbol] === undefined) {
585
+ throw new UniffiInternalError.UnexpectedNullPointer();
586
+ }
587
+ return obj[pointerLiteralSymbol];
588
+ },
589
+ clonePointer(obj) {
590
+ const pointer = this.pointer(obj);
591
+ return uniffiCaller.rustCall(/*caller:*/callStatus => nativeModule().ubrn_uniffi_jazz_rn_fn_clone_rnruntime(pointer, callStatus), /*liftString:*/FfiConverterString.lift);
592
+ },
593
+ freePointer(pointer) {
594
+ uniffiCaller.rustCall(/*caller:*/callStatus => nativeModule().ubrn_uniffi_jazz_rn_fn_free_rnruntime(pointer, callStatus), /*liftString:*/FfiConverterString.lift);
595
+ },
596
+ isConcreteType(obj) {
597
+ return obj[destructorGuardSymbol] && obj[uniffiTypeNameSymbol] === 'RnRuntime';
598
+ }
599
+ };
600
+ })();
601
+ // FfiConverter for RnRuntimeInterface
602
+ const FfiConverterTypeRnRuntime = new FfiConverterObject(uniffiTypeRnRuntimeObjectFactory);
603
+
604
+ // FfiConverter for BatchedTickCallback | undefined
605
+ const FfiConverterOptionalTypeBatchedTickCallback = new FfiConverterOptional(FfiConverterTypeBatchedTickCallback);
606
+
607
+ // FfiConverter for SyncMessageCallback | undefined
608
+ const FfiConverterOptionalTypeSyncMessageCallback = new FfiConverterOptional(FfiConverterTypeSyncMessageCallback);
609
+
610
+ // FfiConverter for string | undefined
611
+ const FfiConverterOptionalString = new FfiConverterOptional(FfiConverterString);
612
+
613
+ /**
614
+ * This should be called before anything else.
615
+ *
616
+ * It is likely that this is being done for you by the library's `index.ts`.
617
+ *
618
+ * It checks versions of uniffi between when the Rust scaffolding was generated
619
+ * and when the bindings were generated.
620
+ *
621
+ * It also initializes the machinery to enable Rust to talk back to Javascript.
622
+ */
623
+ function uniffiEnsureInitialized() {
624
+ // Get the bindings contract version from our ComponentInterface
625
+ const bindingsContractVersion = 29;
626
+ // Get the scaffolding contract version by calling the into the dylib
627
+ const scaffoldingContractVersion = nativeModule().ubrn_ffi_jazz_rn_uniffi_contract_version();
628
+ if (bindingsContractVersion !== scaffoldingContractVersion) {
629
+ throw new UniffiInternalError.ContractVersionMismatch(scaffoldingContractVersion, bindingsContractVersion);
630
+ }
631
+ if (nativeModule().ubrn_uniffi_jazz_rn_checksum_func_current_timestamp_ms() !== 20765) {
632
+ throw new UniffiInternalError.ApiChecksumMismatch('uniffi_jazz_rn_checksum_func_current_timestamp_ms');
633
+ }
634
+ if (nativeModule().ubrn_uniffi_jazz_rn_checksum_func_generate_id() !== 58723) {
635
+ throw new UniffiInternalError.ApiChecksumMismatch('uniffi_jazz_rn_checksum_func_generate_id');
636
+ }
637
+ if (nativeModule().ubrn_uniffi_jazz_rn_checksum_method_rnruntime_add_client() !== 20251) {
638
+ throw new UniffiInternalError.ApiChecksumMismatch('uniffi_jazz_rn_checksum_method_rnruntime_add_client');
639
+ }
640
+ if (nativeModule().ubrn_uniffi_jazz_rn_checksum_method_rnruntime_add_server() !== 28260) {
641
+ throw new UniffiInternalError.ApiChecksumMismatch('uniffi_jazz_rn_checksum_method_rnruntime_add_server');
642
+ }
643
+ if (nativeModule().ubrn_uniffi_jazz_rn_checksum_method_rnruntime_batched_tick() !== 23711) {
644
+ throw new UniffiInternalError.ApiChecksumMismatch('uniffi_jazz_rn_checksum_method_rnruntime_batched_tick');
645
+ }
646
+ if (nativeModule().ubrn_uniffi_jazz_rn_checksum_method_rnruntime_close() !== 17169) {
647
+ throw new UniffiInternalError.ApiChecksumMismatch('uniffi_jazz_rn_checksum_method_rnruntime_close');
648
+ }
649
+ if (nativeModule().ubrn_uniffi_jazz_rn_checksum_method_rnruntime_delete() !== 4621) {
650
+ throw new UniffiInternalError.ApiChecksumMismatch('uniffi_jazz_rn_checksum_method_rnruntime_delete');
651
+ }
652
+ if (nativeModule().ubrn_uniffi_jazz_rn_checksum_method_rnruntime_flush() !== 62556) {
653
+ throw new UniffiInternalError.ApiChecksumMismatch('uniffi_jazz_rn_checksum_method_rnruntime_flush');
654
+ }
655
+ if (nativeModule().ubrn_uniffi_jazz_rn_checksum_method_rnruntime_get_schema_hash() !== 39147) {
656
+ throw new UniffiInternalError.ApiChecksumMismatch('uniffi_jazz_rn_checksum_method_rnruntime_get_schema_hash');
657
+ }
658
+ if (nativeModule().ubrn_uniffi_jazz_rn_checksum_method_rnruntime_insert() !== 12677) {
659
+ throw new UniffiInternalError.ApiChecksumMismatch('uniffi_jazz_rn_checksum_method_rnruntime_insert');
660
+ }
661
+ if (nativeModule().ubrn_uniffi_jazz_rn_checksum_method_rnruntime_on_batched_tick_needed() !== 36428) {
662
+ throw new UniffiInternalError.ApiChecksumMismatch('uniffi_jazz_rn_checksum_method_rnruntime_on_batched_tick_needed');
663
+ }
664
+ if (nativeModule().ubrn_uniffi_jazz_rn_checksum_method_rnruntime_on_sync_message_received() !== 57227) {
665
+ throw new UniffiInternalError.ApiChecksumMismatch('uniffi_jazz_rn_checksum_method_rnruntime_on_sync_message_received');
666
+ }
667
+ if (nativeModule().ubrn_uniffi_jazz_rn_checksum_method_rnruntime_on_sync_message_received_from_client() !== 32020) {
668
+ throw new UniffiInternalError.ApiChecksumMismatch('uniffi_jazz_rn_checksum_method_rnruntime_on_sync_message_received_from_client');
669
+ }
670
+ if (nativeModule().ubrn_uniffi_jazz_rn_checksum_method_rnruntime_on_sync_message_to_send() !== 58836) {
671
+ throw new UniffiInternalError.ApiChecksumMismatch('uniffi_jazz_rn_checksum_method_rnruntime_on_sync_message_to_send');
672
+ }
673
+ if (nativeModule().ubrn_uniffi_jazz_rn_checksum_method_rnruntime_query() !== 33623) {
674
+ throw new UniffiInternalError.ApiChecksumMismatch('uniffi_jazz_rn_checksum_method_rnruntime_query');
675
+ }
676
+ if (nativeModule().ubrn_uniffi_jazz_rn_checksum_method_rnruntime_remove_server() !== 7238) {
677
+ throw new UniffiInternalError.ApiChecksumMismatch('uniffi_jazz_rn_checksum_method_rnruntime_remove_server');
678
+ }
679
+ if (nativeModule().ubrn_uniffi_jazz_rn_checksum_method_rnruntime_set_client_role() !== 4241) {
680
+ throw new UniffiInternalError.ApiChecksumMismatch('uniffi_jazz_rn_checksum_method_rnruntime_set_client_role');
681
+ }
682
+ if (nativeModule().ubrn_uniffi_jazz_rn_checksum_method_rnruntime_subscribe() !== 24615) {
683
+ throw new UniffiInternalError.ApiChecksumMismatch('uniffi_jazz_rn_checksum_method_rnruntime_subscribe');
684
+ }
685
+ if (nativeModule().ubrn_uniffi_jazz_rn_checksum_method_rnruntime_unsubscribe() !== 22724) {
686
+ throw new UniffiInternalError.ApiChecksumMismatch('uniffi_jazz_rn_checksum_method_rnruntime_unsubscribe');
687
+ }
688
+ if (nativeModule().ubrn_uniffi_jazz_rn_checksum_method_rnruntime_update() !== 52169) {
689
+ throw new UniffiInternalError.ApiChecksumMismatch('uniffi_jazz_rn_checksum_method_rnruntime_update');
690
+ }
691
+ if (nativeModule().ubrn_uniffi_jazz_rn_checksum_constructor_rnruntime_new() !== 5640) {
692
+ throw new UniffiInternalError.ApiChecksumMismatch('uniffi_jazz_rn_checksum_constructor_rnruntime_new');
693
+ }
694
+ if (nativeModule().ubrn_uniffi_jazz_rn_checksum_method_batchedtickcallback_request_batched_tick() !== 53765) {
695
+ throw new UniffiInternalError.ApiChecksumMismatch('uniffi_jazz_rn_checksum_method_batchedtickcallback_request_batched_tick');
696
+ }
697
+ if (nativeModule().ubrn_uniffi_jazz_rn_checksum_method_subscriptioncallback_on_update() !== 5131) {
698
+ throw new UniffiInternalError.ApiChecksumMismatch('uniffi_jazz_rn_checksum_method_subscriptioncallback_on_update');
699
+ }
700
+ if (nativeModule().ubrn_uniffi_jazz_rn_checksum_method_syncmessagecallback_on_sync_message() !== 26254) {
701
+ throw new UniffiInternalError.ApiChecksumMismatch('uniffi_jazz_rn_checksum_method_syncmessagecallback_on_sync_message');
702
+ }
703
+ uniffiCallbackInterfaceBatchedTickCallback.register();
704
+ uniffiCallbackInterfaceSubscriptionCallback.register();
705
+ uniffiCallbackInterfaceSyncMessageCallback.register();
706
+ }
707
+ export default Object.freeze({
708
+ initialize: uniffiEnsureInitialized,
709
+ converters: {
710
+ FfiConverterTypeJazzRnError,
711
+ FfiConverterTypeRnRuntime
712
+ }
713
+ });
714
+ //# sourceMappingURL=jazz_rn.js.map