@dbx-tools/auth 0.6.161 → 0.6.167

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/lib/index.js CHANGED
@@ -1,7 +1,1631 @@
1
- // GENERATED by projen watch - DO NOT EDIT.
2
- // Regenerated from the exporting modules in ./src.
3
- // Hand edits are overwritten on the next watch; this file is read-only.
4
- export const PACKAGE_IDENTIFIER = "@dbx-tools/auth";
5
- export * as auth from "./src/auth.js";
6
- export * as storage from "./src/storage.js";
7
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSwyQ0FBMkM7QUFDM0MsbURBQW1EO0FBQ25ELHdFQUF3RTtBQUV4RSxNQUFNLENBQUMsTUFBTSxrQkFBa0IsR0FBRyxpQkFBaUIsQ0FBQztBQUNwRCxPQUFPLEtBQUssSUFBSSxNQUFNLGVBQWUsQ0FBQztBQUN0QyxPQUFPLEtBQUssT0FBTyxNQUFNLGtCQUFrQixDQUFDIiwic291cmNlc0NvbnRlbnQiOlsiLy8gR0VORVJBVEVEIGJ5IHByb2plbiB3YXRjaCAtIERPIE5PVCBFRElULlxuLy8gUmVnZW5lcmF0ZWQgZnJvbSB0aGUgZXhwb3J0aW5nIG1vZHVsZXMgaW4gLi9zcmMuXG4vLyBIYW5kIGVkaXRzIGFyZSBvdmVyd3JpdHRlbiBvbiB0aGUgbmV4dCB3YXRjaDsgdGhpcyBmaWxlIGlzIHJlYWQtb25seS5cblxuZXhwb3J0IGNvbnN0IFBBQ0tBR0VfSURFTlRJRklFUiA9IFwiQGRieC10b29scy9hdXRoXCI7XG5leHBvcnQgKiBhcyBhdXRoIGZyb20gXCIuL3NyYy9hdXRoLnRzXCI7XG5leHBvcnQgKiBhcyBzdG9yYWdlIGZyb20gXCIuL3NyYy9zdG9yYWdlLnRzXCI7XG5leHBvcnQgdHlwZSB7IEF1dGhvcml6ZUlkZW50aXR5LCBBdXRoRW1haWxPcHRpb25zLCBQYXNzd29yZGxlc3NBdXRoT3B0aW9ucywgUGFzc3dvcmRsZXNzQXV0aFJ1bnRpbWUgfSBmcm9tIFwiLi9zcmMvYXV0aC50c1wiO1xuZXhwb3J0IHR5cGUgeyBBdXRoU3RvcmFnZU1vZGUsIEF1dGhTdG9yYWdlQ29uZmlnLCBSZXNvbHZlZEF1dGhTdG9yYWdlQ29uZmlnLCBBdXRoRGF0YWJhc2UsIEF1dGhTdG9yYWdlIH0gZnJvbSBcIi4vc3JjL3N0b3JhZ2UudHNcIjtcbiJdfQ==
1
+ var __defProp = Object.defineProperty;
2
+ var __returnValue = (v) => v;
3
+ function __exportSetter(name, newValue) {
4
+ this[name] = __returnValue.bind(null, newValue);
5
+ }
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, {
9
+ get: all[name],
10
+ enumerable: true,
11
+ configurable: true,
12
+ set: __exportSetter.bind(all, name)
13
+ });
14
+ };
15
+
16
+ // src/bindings.ts
17
+ var exports_bindings = {};
18
+ __export(exports_bindings, {
19
+ uniffiModule: () => _bindings_default,
20
+ uniffiInitAsync: () => uniffiInitAsync,
21
+ credentialKey: () => credentialKey,
22
+ createStorageHandle: () => createStorageHandle,
23
+ createProviderAuthWithStorage: () => createProviderAuthWithStorage,
24
+ createProviderAuth: () => createProviderAuth,
25
+ canonicalScopes: () => canonicalScopes,
26
+ StorageHandle: () => StorageHandle,
27
+ StorageAdapterImpl: () => StorageAdapterImpl,
28
+ Storage: () => Storage,
29
+ ProviderOptions: () => ProviderOptions,
30
+ ProviderAuth: () => ProviderAuth,
31
+ OAuthGrant: () => OAuthGrant,
32
+ FileLayout: () => FileLayout,
33
+ AuthOptions: () => AuthOptions,
34
+ AuthError_Tags: () => AuthError_Tags,
35
+ AuthError: () => AuthError,
36
+ AccessToken: () => AccessToken
37
+ });
38
+
39
+ // src/_bindings-ffi.ts
40
+ import lib from "@ubjs/node";
41
+ var { UniffiNativeModule, FfiType, resolveLibPath } = lib;
42
+ var DEFINITIONS = {
43
+ symbols: {
44
+ rustbuffer_alloc: "ffi_dbx_tools_auth_rustbuffer_alloc",
45
+ rustbuffer_free: "ffi_dbx_tools_auth_rustbuffer_free",
46
+ rustbuffer_from_bytes: "ffi_dbx_tools_auth_rustbuffer_from_bytes"
47
+ },
48
+ functions: {
49
+ ffi_dbx_tools_auth_rust_future_poll_u8: {
50
+ args: [FfiType.Handle, FfiType.Callback("RustFutureContinuationCallback"), FfiType.Handle],
51
+ ret: FfiType.Void,
52
+ hasRustCallStatus: false
53
+ },
54
+ ffi_dbx_tools_auth_rust_future_cancel_u8: {
55
+ args: [FfiType.Handle],
56
+ ret: FfiType.Void,
57
+ hasRustCallStatus: false
58
+ },
59
+ ffi_dbx_tools_auth_rust_future_complete_u8: {
60
+ args: [FfiType.Handle],
61
+ ret: FfiType.UInt8,
62
+ hasRustCallStatus: true
63
+ },
64
+ ffi_dbx_tools_auth_rust_future_free_u8: {
65
+ args: [FfiType.Handle],
66
+ ret: FfiType.Void,
67
+ hasRustCallStatus: false
68
+ },
69
+ ffi_dbx_tools_auth_rust_future_poll_i8: {
70
+ args: [FfiType.Handle, FfiType.Callback("RustFutureContinuationCallback"), FfiType.Handle],
71
+ ret: FfiType.Void,
72
+ hasRustCallStatus: false
73
+ },
74
+ ffi_dbx_tools_auth_rust_future_cancel_i8: {
75
+ args: [FfiType.Handle],
76
+ ret: FfiType.Void,
77
+ hasRustCallStatus: false
78
+ },
79
+ ffi_dbx_tools_auth_rust_future_complete_i8: {
80
+ args: [FfiType.Handle],
81
+ ret: FfiType.Int8,
82
+ hasRustCallStatus: true
83
+ },
84
+ ffi_dbx_tools_auth_rust_future_free_i8: {
85
+ args: [FfiType.Handle],
86
+ ret: FfiType.Void,
87
+ hasRustCallStatus: false
88
+ },
89
+ ffi_dbx_tools_auth_rust_future_poll_u16: {
90
+ args: [FfiType.Handle, FfiType.Callback("RustFutureContinuationCallback"), FfiType.Handle],
91
+ ret: FfiType.Void,
92
+ hasRustCallStatus: false
93
+ },
94
+ ffi_dbx_tools_auth_rust_future_cancel_u16: {
95
+ args: [FfiType.Handle],
96
+ ret: FfiType.Void,
97
+ hasRustCallStatus: false
98
+ },
99
+ ffi_dbx_tools_auth_rust_future_complete_u16: {
100
+ args: [FfiType.Handle],
101
+ ret: FfiType.UInt16,
102
+ hasRustCallStatus: true
103
+ },
104
+ ffi_dbx_tools_auth_rust_future_free_u16: {
105
+ args: [FfiType.Handle],
106
+ ret: FfiType.Void,
107
+ hasRustCallStatus: false
108
+ },
109
+ ffi_dbx_tools_auth_rust_future_poll_i16: {
110
+ args: [FfiType.Handle, FfiType.Callback("RustFutureContinuationCallback"), FfiType.Handle],
111
+ ret: FfiType.Void,
112
+ hasRustCallStatus: false
113
+ },
114
+ ffi_dbx_tools_auth_rust_future_cancel_i16: {
115
+ args: [FfiType.Handle],
116
+ ret: FfiType.Void,
117
+ hasRustCallStatus: false
118
+ },
119
+ ffi_dbx_tools_auth_rust_future_complete_i16: {
120
+ args: [FfiType.Handle],
121
+ ret: FfiType.Int16,
122
+ hasRustCallStatus: true
123
+ },
124
+ ffi_dbx_tools_auth_rust_future_free_i16: {
125
+ args: [FfiType.Handle],
126
+ ret: FfiType.Void,
127
+ hasRustCallStatus: false
128
+ },
129
+ ffi_dbx_tools_auth_rust_future_poll_u32: {
130
+ args: [FfiType.Handle, FfiType.Callback("RustFutureContinuationCallback"), FfiType.Handle],
131
+ ret: FfiType.Void,
132
+ hasRustCallStatus: false
133
+ },
134
+ ffi_dbx_tools_auth_rust_future_cancel_u32: {
135
+ args: [FfiType.Handle],
136
+ ret: FfiType.Void,
137
+ hasRustCallStatus: false
138
+ },
139
+ ffi_dbx_tools_auth_rust_future_complete_u32: {
140
+ args: [FfiType.Handle],
141
+ ret: FfiType.UInt32,
142
+ hasRustCallStatus: true
143
+ },
144
+ ffi_dbx_tools_auth_rust_future_free_u32: {
145
+ args: [FfiType.Handle],
146
+ ret: FfiType.Void,
147
+ hasRustCallStatus: false
148
+ },
149
+ ffi_dbx_tools_auth_rust_future_poll_i32: {
150
+ args: [FfiType.Handle, FfiType.Callback("RustFutureContinuationCallback"), FfiType.Handle],
151
+ ret: FfiType.Void,
152
+ hasRustCallStatus: false
153
+ },
154
+ ffi_dbx_tools_auth_rust_future_cancel_i32: {
155
+ args: [FfiType.Handle],
156
+ ret: FfiType.Void,
157
+ hasRustCallStatus: false
158
+ },
159
+ ffi_dbx_tools_auth_rust_future_complete_i32: {
160
+ args: [FfiType.Handle],
161
+ ret: FfiType.Int32,
162
+ hasRustCallStatus: true
163
+ },
164
+ ffi_dbx_tools_auth_rust_future_free_i32: {
165
+ args: [FfiType.Handle],
166
+ ret: FfiType.Void,
167
+ hasRustCallStatus: false
168
+ },
169
+ ffi_dbx_tools_auth_rust_future_poll_u64: {
170
+ args: [FfiType.Handle, FfiType.Callback("RustFutureContinuationCallback"), FfiType.Handle],
171
+ ret: FfiType.Void,
172
+ hasRustCallStatus: false
173
+ },
174
+ ffi_dbx_tools_auth_rust_future_cancel_u64: {
175
+ args: [FfiType.Handle],
176
+ ret: FfiType.Void,
177
+ hasRustCallStatus: false
178
+ },
179
+ ffi_dbx_tools_auth_rust_future_complete_u64: {
180
+ args: [FfiType.Handle],
181
+ ret: FfiType.Handle,
182
+ hasRustCallStatus: true
183
+ },
184
+ ffi_dbx_tools_auth_rust_future_free_u64: {
185
+ args: [FfiType.Handle],
186
+ ret: FfiType.Void,
187
+ hasRustCallStatus: false
188
+ },
189
+ ffi_dbx_tools_auth_rust_future_poll_i64: {
190
+ args: [FfiType.Handle, FfiType.Callback("RustFutureContinuationCallback"), FfiType.Handle],
191
+ ret: FfiType.Void,
192
+ hasRustCallStatus: false
193
+ },
194
+ ffi_dbx_tools_auth_rust_future_cancel_i64: {
195
+ args: [FfiType.Handle],
196
+ ret: FfiType.Void,
197
+ hasRustCallStatus: false
198
+ },
199
+ ffi_dbx_tools_auth_rust_future_complete_i64: {
200
+ args: [FfiType.Handle],
201
+ ret: FfiType.Int64,
202
+ hasRustCallStatus: true
203
+ },
204
+ ffi_dbx_tools_auth_rust_future_free_i64: {
205
+ args: [FfiType.Handle],
206
+ ret: FfiType.Void,
207
+ hasRustCallStatus: false
208
+ },
209
+ ffi_dbx_tools_auth_rust_future_poll_f32: {
210
+ args: [FfiType.Handle, FfiType.Callback("RustFutureContinuationCallback"), FfiType.Handle],
211
+ ret: FfiType.Void,
212
+ hasRustCallStatus: false
213
+ },
214
+ ffi_dbx_tools_auth_rust_future_cancel_f32: {
215
+ args: [FfiType.Handle],
216
+ ret: FfiType.Void,
217
+ hasRustCallStatus: false
218
+ },
219
+ ffi_dbx_tools_auth_rust_future_complete_f32: {
220
+ args: [FfiType.Handle],
221
+ ret: FfiType.Float32,
222
+ hasRustCallStatus: true
223
+ },
224
+ ffi_dbx_tools_auth_rust_future_free_f32: {
225
+ args: [FfiType.Handle],
226
+ ret: FfiType.Void,
227
+ hasRustCallStatus: false
228
+ },
229
+ ffi_dbx_tools_auth_rust_future_poll_f64: {
230
+ args: [FfiType.Handle, FfiType.Callback("RustFutureContinuationCallback"), FfiType.Handle],
231
+ ret: FfiType.Void,
232
+ hasRustCallStatus: false
233
+ },
234
+ ffi_dbx_tools_auth_rust_future_cancel_f64: {
235
+ args: [FfiType.Handle],
236
+ ret: FfiType.Void,
237
+ hasRustCallStatus: false
238
+ },
239
+ ffi_dbx_tools_auth_rust_future_complete_f64: {
240
+ args: [FfiType.Handle],
241
+ ret: FfiType.Float64,
242
+ hasRustCallStatus: true
243
+ },
244
+ ffi_dbx_tools_auth_rust_future_free_f64: {
245
+ args: [FfiType.Handle],
246
+ ret: FfiType.Void,
247
+ hasRustCallStatus: false
248
+ },
249
+ ffi_dbx_tools_auth_rust_future_poll_rust_buffer: {
250
+ args: [FfiType.Handle, FfiType.Callback("RustFutureContinuationCallback"), FfiType.Handle],
251
+ ret: FfiType.Void,
252
+ hasRustCallStatus: false
253
+ },
254
+ ffi_dbx_tools_auth_rust_future_cancel_rust_buffer: {
255
+ args: [FfiType.Handle],
256
+ ret: FfiType.Void,
257
+ hasRustCallStatus: false
258
+ },
259
+ ffi_dbx_tools_auth_rust_future_complete_rust_buffer: {
260
+ args: [FfiType.Handle],
261
+ ret: FfiType.RustBuffer,
262
+ hasRustCallStatus: true
263
+ },
264
+ ffi_dbx_tools_auth_rust_future_free_rust_buffer: {
265
+ args: [FfiType.Handle],
266
+ ret: FfiType.Void,
267
+ hasRustCallStatus: false
268
+ },
269
+ ffi_dbx_tools_auth_rust_future_poll_void: {
270
+ args: [FfiType.Handle, FfiType.Callback("RustFutureContinuationCallback"), FfiType.Handle],
271
+ ret: FfiType.Void,
272
+ hasRustCallStatus: false
273
+ },
274
+ ffi_dbx_tools_auth_rust_future_cancel_void: {
275
+ args: [FfiType.Handle],
276
+ ret: FfiType.Void,
277
+ hasRustCallStatus: false
278
+ },
279
+ ffi_dbx_tools_auth_rust_future_complete_void: {
280
+ args: [FfiType.Handle],
281
+ ret: FfiType.Void,
282
+ hasRustCallStatus: true
283
+ },
284
+ ffi_dbx_tools_auth_rust_future_free_void: {
285
+ args: [FfiType.Handle],
286
+ ret: FfiType.Void,
287
+ hasRustCallStatus: false
288
+ },
289
+ uniffi_dbx_tools_auth_fn_clone_providerauth: {
290
+ args: [FfiType.Handle],
291
+ ret: FfiType.Handle,
292
+ hasRustCallStatus: true
293
+ },
294
+ uniffi_dbx_tools_auth_fn_free_providerauth: {
295
+ args: [FfiType.Handle],
296
+ ret: FfiType.Void,
297
+ hasRustCallStatus: true
298
+ },
299
+ uniffi_dbx_tools_auth_fn_clone_storageadapter: {
300
+ args: [FfiType.Handle],
301
+ ret: FfiType.Handle,
302
+ hasRustCallStatus: true
303
+ },
304
+ uniffi_dbx_tools_auth_fn_free_storageadapter: {
305
+ args: [FfiType.Handle],
306
+ ret: FfiType.Void,
307
+ hasRustCallStatus: true
308
+ },
309
+ uniffi_dbx_tools_auth_fn_clone_storagehandle: {
310
+ args: [FfiType.Handle],
311
+ ret: FfiType.Handle,
312
+ hasRustCallStatus: true
313
+ },
314
+ uniffi_dbx_tools_auth_fn_free_storagehandle: {
315
+ args: [FfiType.Handle],
316
+ ret: FfiType.Void,
317
+ hasRustCallStatus: true
318
+ },
319
+ uniffi_dbx_tools_auth_fn_init_callback_vtable_storageadapter: {
320
+ args: [FfiType.Reference(FfiType.Struct("VTableCallbackInterfaceDbxToolsAuthStorageAdapter"))],
321
+ ret: FfiType.Void,
322
+ hasRustCallStatus: false
323
+ },
324
+ uniffi_dbx_tools_auth_fn_func_canonical_scopes: {
325
+ args: [FfiType.RustBuffer],
326
+ ret: FfiType.RustBuffer,
327
+ hasRustCallStatus: true
328
+ },
329
+ uniffi_dbx_tools_auth_fn_func_create_provider_auth: {
330
+ args: [FfiType.RustBuffer],
331
+ ret: FfiType.Handle,
332
+ hasRustCallStatus: false
333
+ },
334
+ uniffi_dbx_tools_auth_fn_func_create_provider_auth_with_storage: {
335
+ args: [FfiType.RustBuffer, FfiType.Handle],
336
+ ret: FfiType.Handle,
337
+ hasRustCallStatus: false
338
+ },
339
+ uniffi_dbx_tools_auth_fn_func_create_storage_handle: {
340
+ args: [FfiType.Handle],
341
+ ret: FfiType.Handle,
342
+ hasRustCallStatus: true
343
+ },
344
+ uniffi_dbx_tools_auth_fn_func_credential_key: {
345
+ args: [FfiType.RustBuffer, FfiType.RustBuffer, FfiType.RustBuffer],
346
+ ret: FfiType.RustBuffer,
347
+ hasRustCallStatus: true
348
+ },
349
+ uniffi_dbx_tools_auth_fn_method_providerauth_force_refresh_token: {
350
+ args: [FfiType.Handle],
351
+ ret: FfiType.Handle,
352
+ hasRustCallStatus: false
353
+ },
354
+ uniffi_dbx_tools_auth_fn_method_providerauth_logout: {
355
+ args: [FfiType.Handle],
356
+ ret: FfiType.Handle,
357
+ hasRustCallStatus: false
358
+ },
359
+ uniffi_dbx_tools_auth_fn_method_providerauth_refresh_rejected_token: {
360
+ args: [FfiType.Handle, FfiType.RustBuffer],
361
+ ret: FfiType.Handle,
362
+ hasRustCallStatus: false
363
+ },
364
+ uniffi_dbx_tools_auth_fn_method_providerauth_token: {
365
+ args: [FfiType.Handle, FfiType.RustBuffer],
366
+ ret: FfiType.Handle,
367
+ hasRustCallStatus: false
368
+ },
369
+ uniffi_dbx_tools_auth_fn_method_storageadapter_load: {
370
+ args: [FfiType.Handle, FfiType.RustBuffer],
371
+ ret: FfiType.Handle,
372
+ hasRustCallStatus: false
373
+ },
374
+ uniffi_dbx_tools_auth_fn_method_storageadapter_prepare_write: {
375
+ args: [FfiType.Handle],
376
+ ret: FfiType.Handle,
377
+ hasRustCallStatus: false
378
+ },
379
+ uniffi_dbx_tools_auth_fn_method_storageadapter_save: {
380
+ args: [FfiType.Handle, FfiType.RustBuffer, FfiType.RustBuffer],
381
+ ret: FfiType.Handle,
382
+ hasRustCallStatus: false
383
+ },
384
+ uniffi_dbx_tools_auth_fn_method_storageadapter_remove: {
385
+ args: [FfiType.Handle, FfiType.RustBuffer],
386
+ ret: FfiType.Handle,
387
+ hasRustCallStatus: false
388
+ },
389
+ uniffi_dbx_tools_auth_fn_method_storageadapter_acquire_lock: {
390
+ args: [FfiType.Handle, FfiType.RustBuffer, FfiType.UInt64],
391
+ ret: FfiType.Handle,
392
+ hasRustCallStatus: false
393
+ },
394
+ uniffi_dbx_tools_auth_fn_method_storageadapter_release_lock: {
395
+ args: [FfiType.Handle, FfiType.RustBuffer],
396
+ ret: FfiType.Handle,
397
+ hasRustCallStatus: false
398
+ },
399
+ uniffi_dbx_tools_auth_fn_method_storageadapter_name: {
400
+ args: [FfiType.Handle],
401
+ ret: FfiType.RustBuffer,
402
+ hasRustCallStatus: true
403
+ },
404
+ ffi_dbx_tools_auth_uniffi_contract_version: {
405
+ args: [],
406
+ ret: FfiType.UInt32,
407
+ hasRustCallStatus: false
408
+ },
409
+ uniffi_dbx_tools_auth_checksum_func_canonical_scopes: {
410
+ args: [],
411
+ ret: FfiType.UInt16,
412
+ hasRustCallStatus: false
413
+ },
414
+ uniffi_dbx_tools_auth_checksum_func_create_provider_auth: {
415
+ args: [],
416
+ ret: FfiType.UInt16,
417
+ hasRustCallStatus: false
418
+ },
419
+ uniffi_dbx_tools_auth_checksum_func_create_provider_auth_with_storage: {
420
+ args: [],
421
+ ret: FfiType.UInt16,
422
+ hasRustCallStatus: false
423
+ },
424
+ uniffi_dbx_tools_auth_checksum_func_create_storage_handle: {
425
+ args: [],
426
+ ret: FfiType.UInt16,
427
+ hasRustCallStatus: false
428
+ },
429
+ uniffi_dbx_tools_auth_checksum_func_credential_key: {
430
+ args: [],
431
+ ret: FfiType.UInt16,
432
+ hasRustCallStatus: false
433
+ },
434
+ uniffi_dbx_tools_auth_checksum_method_providerauth_force_refresh_token: {
435
+ args: [],
436
+ ret: FfiType.UInt16,
437
+ hasRustCallStatus: false
438
+ },
439
+ uniffi_dbx_tools_auth_checksum_method_providerauth_logout: {
440
+ args: [],
441
+ ret: FfiType.UInt16,
442
+ hasRustCallStatus: false
443
+ },
444
+ uniffi_dbx_tools_auth_checksum_method_providerauth_refresh_rejected_token: {
445
+ args: [],
446
+ ret: FfiType.UInt16,
447
+ hasRustCallStatus: false
448
+ },
449
+ uniffi_dbx_tools_auth_checksum_method_providerauth_token: {
450
+ args: [],
451
+ ret: FfiType.UInt16,
452
+ hasRustCallStatus: false
453
+ },
454
+ uniffi_dbx_tools_auth_checksum_method_storageadapter_load: {
455
+ args: [],
456
+ ret: FfiType.UInt16,
457
+ hasRustCallStatus: false
458
+ },
459
+ uniffi_dbx_tools_auth_checksum_method_storageadapter_prepare_write: {
460
+ args: [],
461
+ ret: FfiType.UInt16,
462
+ hasRustCallStatus: false
463
+ },
464
+ uniffi_dbx_tools_auth_checksum_method_storageadapter_save: {
465
+ args: [],
466
+ ret: FfiType.UInt16,
467
+ hasRustCallStatus: false
468
+ },
469
+ uniffi_dbx_tools_auth_checksum_method_storageadapter_remove: {
470
+ args: [],
471
+ ret: FfiType.UInt16,
472
+ hasRustCallStatus: false
473
+ },
474
+ uniffi_dbx_tools_auth_checksum_method_storageadapter_acquire_lock: {
475
+ args: [],
476
+ ret: FfiType.UInt16,
477
+ hasRustCallStatus: false
478
+ },
479
+ uniffi_dbx_tools_auth_checksum_method_storageadapter_release_lock: {
480
+ args: [],
481
+ ret: FfiType.UInt16,
482
+ hasRustCallStatus: false
483
+ },
484
+ uniffi_dbx_tools_auth_checksum_method_storageadapter_name: {
485
+ args: [],
486
+ ret: FfiType.UInt16,
487
+ hasRustCallStatus: false
488
+ }
489
+ },
490
+ callbacks: {
491
+ RustFutureContinuationCallback: {
492
+ args: [FfiType.Handle, FfiType.Int8],
493
+ ret: FfiType.Void,
494
+ hasRustCallStatus: false
495
+ },
496
+ ForeignFutureDroppedCallback: {
497
+ args: [FfiType.Handle],
498
+ ret: FfiType.Void,
499
+ hasRustCallStatus: false
500
+ },
501
+ ForeignFutureCompleterust_buffer: {
502
+ args: [FfiType.Handle, FfiType.Struct("ForeignFutureResultRustBuffer")],
503
+ ret: FfiType.Void,
504
+ hasRustCallStatus: false
505
+ },
506
+ CallbackInterfaceDbxToolsAuthStorageAdapterMethod0: {
507
+ args: [FfiType.Handle, FfiType.RustBuffer, FfiType.Callback("ForeignFutureCompleterust_buffer"), FfiType.Handle],
508
+ ret: FfiType.Struct("ForeignFutureDroppedCallbackStruct"),
509
+ hasRustCallStatus: false,
510
+ outReturn: true
511
+ },
512
+ ForeignFutureCompletevoid: {
513
+ args: [FfiType.Handle, FfiType.Struct("ForeignFutureResultVoid")],
514
+ ret: FfiType.Void,
515
+ hasRustCallStatus: false
516
+ },
517
+ CallbackInterfaceDbxToolsAuthStorageAdapterMethod1: {
518
+ args: [FfiType.Handle, FfiType.Callback("ForeignFutureCompletevoid"), FfiType.Handle],
519
+ ret: FfiType.Struct("ForeignFutureDroppedCallbackStruct"),
520
+ hasRustCallStatus: false,
521
+ outReturn: true
522
+ },
523
+ CallbackInterfaceDbxToolsAuthStorageAdapterMethod2: {
524
+ args: [FfiType.Handle, FfiType.RustBuffer, FfiType.RustBuffer, FfiType.Callback("ForeignFutureCompletevoid"), FfiType.Handle],
525
+ ret: FfiType.Struct("ForeignFutureDroppedCallbackStruct"),
526
+ hasRustCallStatus: false,
527
+ outReturn: true
528
+ },
529
+ CallbackInterfaceDbxToolsAuthStorageAdapterMethod3: {
530
+ args: [FfiType.Handle, FfiType.RustBuffer, FfiType.Callback("ForeignFutureCompletevoid"), FfiType.Handle],
531
+ ret: FfiType.Struct("ForeignFutureDroppedCallbackStruct"),
532
+ hasRustCallStatus: false,
533
+ outReturn: true
534
+ },
535
+ CallbackInterfaceDbxToolsAuthStorageAdapterMethod4: {
536
+ args: [FfiType.Handle, FfiType.RustBuffer, FfiType.UInt64, FfiType.Callback("ForeignFutureCompleterust_buffer"), FfiType.Handle],
537
+ ret: FfiType.Struct("ForeignFutureDroppedCallbackStruct"),
538
+ hasRustCallStatus: false,
539
+ outReturn: true
540
+ },
541
+ CallbackInterfaceDbxToolsAuthStorageAdapterMethod5: {
542
+ args: [FfiType.Handle, FfiType.RustBuffer, FfiType.Callback("ForeignFutureCompletevoid"), FfiType.Handle],
543
+ ret: FfiType.Struct("ForeignFutureDroppedCallbackStruct"),
544
+ hasRustCallStatus: false,
545
+ outReturn: true
546
+ },
547
+ CallbackInterfaceDbxToolsAuthStorageAdapterMethod6: {
548
+ args: [FfiType.Handle],
549
+ ret: FfiType.RustBuffer,
550
+ hasRustCallStatus: true,
551
+ outReturn: true
552
+ },
553
+ CallbackInterfaceCloneDbxToolsAuth_StorageAdapter: {
554
+ args: [FfiType.Handle],
555
+ ret: FfiType.Handle,
556
+ hasRustCallStatus: false
557
+ },
558
+ CallbackInterfaceFreeDbxToolsAuth_StorageAdapter: {
559
+ args: [FfiType.Handle],
560
+ ret: FfiType.Void,
561
+ hasRustCallStatus: false
562
+ }
563
+ },
564
+ structs: {
565
+ ForeignFutureDroppedCallbackStruct: [
566
+ { name: "handle", type: FfiType.Handle },
567
+ { name: "free", type: FfiType.Callback("ForeignFutureDroppedCallback") }
568
+ ],
569
+ ForeignFutureResultRustBuffer: [
570
+ { name: "return_value", type: FfiType.RustBuffer },
571
+ { name: "call_status", type: FfiType.RustCallStatus }
572
+ ],
573
+ ForeignFutureResultVoid: [
574
+ { name: "call_status", type: FfiType.RustCallStatus }
575
+ ],
576
+ VTableCallbackInterfaceDbxToolsAuthStorageAdapter: [
577
+ { name: "uniffi_free", type: FfiType.Callback("CallbackInterfaceFreeDbxToolsAuth_StorageAdapter") },
578
+ { name: "uniffi_clone", type: FfiType.Callback("CallbackInterfaceCloneDbxToolsAuth_StorageAdapter") },
579
+ { name: "load", type: FfiType.Callback("CallbackInterfaceDbxToolsAuthStorageAdapterMethod0") },
580
+ { name: "prepare_write", type: FfiType.Callback("CallbackInterfaceDbxToolsAuthStorageAdapterMethod1") },
581
+ { name: "save", type: FfiType.Callback("CallbackInterfaceDbxToolsAuthStorageAdapterMethod2") },
582
+ { name: "remove", type: FfiType.Callback("CallbackInterfaceDbxToolsAuthStorageAdapterMethod3") },
583
+ { name: "acquire_lock", type: FfiType.Callback("CallbackInterfaceDbxToolsAuthStorageAdapterMethod4") },
584
+ { name: "release_lock", type: FfiType.Callback("CallbackInterfaceDbxToolsAuthStorageAdapterMethod5") },
585
+ { name: "name", type: FfiType.Callback("CallbackInterfaceDbxToolsAuthStorageAdapterMethod6") }
586
+ ]
587
+ }
588
+ };
589
+ var _nativeModule;
590
+ var getter = () => {
591
+ if (!_nativeModule) {
592
+ const libPath = resolveLibPath({
593
+ crateName: "dbx_tools_auth",
594
+ callerUrl: import.meta.url,
595
+ npmPackageBase: "@dbx-tools/auth-",
596
+ tripleStyle: "node"
597
+ });
598
+ const mod_ = UniffiNativeModule.open(libPath);
599
+ _nativeModule = mod_.register(DEFINITIONS);
600
+ }
601
+ return _nativeModule;
602
+ };
603
+ var _bindings_ffi_default = getter;
604
+
605
+ // src/_bindings.ts
606
+ import {
607
+ AbstractFfiConverterByteArray,
608
+ FfiConverterArray,
609
+ FfiConverterBool,
610
+ FfiConverterInt64,
611
+ FfiConverterObject,
612
+ FfiConverterObjectWithCallbacks,
613
+ FfiConverterOptional,
614
+ FfiConverterUInt64,
615
+ UniffiAbstractObject,
616
+ UniffiError,
617
+ UniffiInternalError,
618
+ UniffiResult,
619
+ UniffiRustCaller,
620
+ destructorGuardSymbol,
621
+ pointerLiteralSymbol,
622
+ uniffiCreateFfiConverterString,
623
+ uniffiCreateRecord,
624
+ uniffiRustCallAsync,
625
+ uniffiTraitInterfaceCall,
626
+ uniffiTraitInterfaceCallAsyncWithError,
627
+ uniffiTypeNameSymbol
628
+ } from "@ubjs/core";
629
+ var uniffiCaller = new UniffiRustCaller(() => ({ code: 0 }));
630
+ var uniffiIsDebug = typeof process !== "object" || process?.env?.NODE_ENV !== "production" || false;
631
+ function canonicalScopes(scopes) {
632
+ const __rb = uniffiCaller.rustCall((callStatus) => {
633
+ return _bindings_ffi_default().uniffi_dbx_tools_auth_fn_func_canonical_scopes(FfiConverterSequenceString.lower(scopes, _bindings_ffi_default().rustbuffer_alloc), callStatus);
634
+ }, FfiConverterString.lift.bind(FfiConverterString));
635
+ try {
636
+ return FfiConverterSequenceString.lift(__rb);
637
+ } finally {
638
+ _bindings_ffi_default().rustbuffer_free(__rb);
639
+ }
640
+ }
641
+ async function createProviderAuth(options, asyncOpts_) {
642
+ const __stack = uniffiIsDebug ? new Error().stack : undefined;
643
+ try {
644
+ return await uniffiRustCallAsync(uniffiCaller, () => {
645
+ return _bindings_ffi_default().uniffi_dbx_tools_auth_fn_func_create_provider_auth(FfiConverterTypeProviderOptions.lower(options, _bindings_ffi_default().rustbuffer_alloc));
646
+ }, _bindings_ffi_default().ffi_dbx_tools_auth_rust_future_poll_u64, _bindings_ffi_default().ffi_dbx_tools_auth_rust_future_cancel_u64, _bindings_ffi_default().ffi_dbx_tools_auth_rust_future_complete_u64, _bindings_ffi_default().ffi_dbx_tools_auth_rust_future_free_u64, FfiConverterTypeProviderAuth.lift.bind(FfiConverterTypeProviderAuth), FfiConverterString.lift.bind(FfiConverterString), asyncOpts_, FfiConverterTypeAuthError.lift.bind(FfiConverterTypeAuthError));
647
+ } catch (__error) {
648
+ if (uniffiIsDebug && __error instanceof Error) {
649
+ __error.stack = __stack;
650
+ }
651
+ throw __error;
652
+ }
653
+ }
654
+ async function createProviderAuthWithStorage(options, storage, asyncOpts_) {
655
+ const __stack = uniffiIsDebug ? new Error().stack : undefined;
656
+ try {
657
+ return await uniffiRustCallAsync(uniffiCaller, () => {
658
+ return _bindings_ffi_default().uniffi_dbx_tools_auth_fn_func_create_provider_auth_with_storage(FfiConverterTypeProviderOptions.lower(options, _bindings_ffi_default().rustbuffer_alloc), FfiConverterTypeStorageHandle.lower(storage, _bindings_ffi_default().rustbuffer_alloc));
659
+ }, _bindings_ffi_default().ffi_dbx_tools_auth_rust_future_poll_u64, _bindings_ffi_default().ffi_dbx_tools_auth_rust_future_cancel_u64, _bindings_ffi_default().ffi_dbx_tools_auth_rust_future_complete_u64, _bindings_ffi_default().ffi_dbx_tools_auth_rust_future_free_u64, FfiConverterTypeProviderAuth.lift.bind(FfiConverterTypeProviderAuth), FfiConverterString.lift.bind(FfiConverterString), asyncOpts_, FfiConverterTypeAuthError.lift.bind(FfiConverterTypeAuthError));
660
+ } catch (__error) {
661
+ if (uniffiIsDebug && __error instanceof Error) {
662
+ __error.stack = __stack;
663
+ }
664
+ throw __error;
665
+ }
666
+ }
667
+ function createStorageHandle(storage) {
668
+ return FfiConverterTypeStorageHandle.lift(uniffiCaller.rustCall((callStatus) => {
669
+ return _bindings_ffi_default().uniffi_dbx_tools_auth_fn_func_create_storage_handle(FfiConverterTypeStorageAdapter.lower(storage, _bindings_ffi_default().rustbuffer_alloc), callStatus);
670
+ }, FfiConverterString.lift.bind(FfiConverterString)));
671
+ }
672
+ function credentialKey(provider, profile, scopes) {
673
+ const __rb = uniffiCaller.rustCall((callStatus) => {
674
+ return _bindings_ffi_default().uniffi_dbx_tools_auth_fn_func_credential_key(FfiConverterString.lower(provider, _bindings_ffi_default().rustbuffer_alloc), FfiConverterOptionalString.lower(profile, _bindings_ffi_default().rustbuffer_alloc), FfiConverterSequenceString.lower(scopes, _bindings_ffi_default().rustbuffer_alloc), callStatus);
675
+ }, FfiConverterString.lift.bind(FfiConverterString));
676
+ try {
677
+ return FfiConverterString.lift(__rb);
678
+ } finally {
679
+ _bindings_ffi_default().rustbuffer_free(__rb);
680
+ }
681
+ }
682
+ var stringConverter = (() => {
683
+ const encoder = new TextEncoder;
684
+ const decoder = new TextDecoder;
685
+ return {
686
+ stringToBytes: (s) => encoder.encode(s),
687
+ bytesToString: (ab) => decoder.decode(ab),
688
+ stringByteLength: (s) => encoder.encode(s).byteLength,
689
+ writeStringIntoBuffer: (s, buf, offset) => {
690
+ const view = new Uint8Array(buf.arrayBuffer, offset, buf.arrayBuffer.byteLength - offset);
691
+ return encoder.encodeInto(s, view).written;
692
+ },
693
+ readStringFromBuffer: (buf, offset, length) => decoder.decode(new Uint8Array(buf.arrayBuffer, offset, length))
694
+ };
695
+ })();
696
+ var FfiConverterString = uniffiCreateFfiConverterString(stringConverter);
697
+ var AccessToken = (() => {
698
+ const defaults = () => ({});
699
+ const create = (() => {
700
+ return uniffiCreateRecord(defaults);
701
+ })();
702
+ return Object.freeze({
703
+ create,
704
+ new: create,
705
+ defaults: () => Object.freeze(defaults())
706
+ });
707
+ })();
708
+ var FfiConverterTypeAccessToken = (() => {
709
+
710
+ class FFIConverter extends AbstractFfiConverterByteArray {
711
+ readFromCursor(c) {
712
+ return {
713
+ accessToken: FfiConverterString.readFromCursor(c),
714
+ tokenType: FfiConverterString.readFromCursor(c),
715
+ expiry: FfiConverterOptionalString.readFromCursor(c),
716
+ scopes: FfiConverterSequenceString.readFromCursor(c)
717
+ };
718
+ }
719
+ writeIntoCursor(value, c) {
720
+ FfiConverterString.writeIntoCursor(value.accessToken, c);
721
+ FfiConverterString.writeIntoCursor(value.tokenType, c);
722
+ FfiConverterOptionalString.writeIntoCursor(value.expiry, c);
723
+ FfiConverterSequenceString.writeIntoCursor(value.scopes, c);
724
+ }
725
+ allocationSize(value) {
726
+ return FfiConverterString.allocationSize(value.accessToken) + FfiConverterString.allocationSize(value.tokenType) + FfiConverterOptionalString.allocationSize(value.expiry) + FfiConverterSequenceString.allocationSize(value.scopes);
727
+ }
728
+ }
729
+ return new FFIConverter;
730
+ })();
731
+ var AuthOptions = (() => {
732
+ const defaults = () => ({
733
+ refreshBufferSeconds: BigInt("300"),
734
+ lockTimeoutSeconds: BigInt("30"),
735
+ loginTimeoutSeconds: BigInt("3600"),
736
+ callbackImageSrc: undefined
737
+ });
738
+ const create = (() => {
739
+ return uniffiCreateRecord(defaults);
740
+ })();
741
+ return Object.freeze({
742
+ create,
743
+ new: create,
744
+ defaults: () => Object.freeze(defaults())
745
+ });
746
+ })();
747
+ var FfiConverterTypeAuthOptions = (() => {
748
+
749
+ class FFIConverter extends AbstractFfiConverterByteArray {
750
+ readFromCursor(c) {
751
+ return {
752
+ refreshBufferSeconds: FfiConverterInt64.readFromCursor(c),
753
+ lockTimeoutSeconds: FfiConverterUInt64.readFromCursor(c),
754
+ loginTimeoutSeconds: FfiConverterUInt64.readFromCursor(c),
755
+ callbackImageSrc: FfiConverterOptionalString.readFromCursor(c)
756
+ };
757
+ }
758
+ writeIntoCursor(value, c) {
759
+ FfiConverterInt64.writeIntoCursor(value.refreshBufferSeconds, c);
760
+ FfiConverterUInt64.writeIntoCursor(value.lockTimeoutSeconds, c);
761
+ FfiConverterUInt64.writeIntoCursor(value.loginTimeoutSeconds, c);
762
+ FfiConverterOptionalString.writeIntoCursor(value.callbackImageSrc, c);
763
+ }
764
+ allocationSize(value) {
765
+ return FfiConverterInt64.allocationSize(value.refreshBufferSeconds) + FfiConverterUInt64.allocationSize(value.lockTimeoutSeconds) + FfiConverterUInt64.allocationSize(value.loginTimeoutSeconds) + FfiConverterOptionalString.allocationSize(value.callbackImageSrc);
766
+ }
767
+ }
768
+ return new FFIConverter;
769
+ })();
770
+ var OAuthGrant;
771
+ ((OAuthGrant2) => {
772
+ OAuthGrant2[OAuthGrant2["AuthorizationCode"] = 0] = "AuthorizationCode";
773
+ OAuthGrant2[OAuthGrant2["ClientCredentials"] = 1] = "ClientCredentials";
774
+ })(OAuthGrant ||= {});
775
+ var FfiConverterTypeOAuthGrant = (() => {
776
+
777
+ class FFIConverter extends AbstractFfiConverterByteArray {
778
+ readFromCursor(c) {
779
+ switch (c.readI32()) {
780
+ case 1:
781
+ return 0 /* AuthorizationCode */;
782
+ case 2:
783
+ return 1 /* ClientCredentials */;
784
+ default:
785
+ throw new UniffiInternalError.UnexpectedEnumCase;
786
+ }
787
+ }
788
+ writeIntoCursor(value, c) {
789
+ switch (value) {
790
+ case 0 /* AuthorizationCode */:
791
+ return c.writeI32(1);
792
+ case 1 /* ClientCredentials */:
793
+ return c.writeI32(2);
794
+ }
795
+ }
796
+ allocationSize(value) {
797
+ return 4;
798
+ }
799
+ }
800
+ return new FFIConverter;
801
+ })();
802
+ var Storage;
803
+ ((Storage2) => {
804
+ Storage2[Storage2["Auto"] = 0] = "Auto";
805
+ Storage2[Storage2["Memory"] = 1] = "Memory";
806
+ Storage2[Storage2["File"] = 2] = "File";
807
+ })(Storage ||= {});
808
+ var FfiConverterTypeStorage = (() => {
809
+
810
+ class FFIConverter extends AbstractFfiConverterByteArray {
811
+ readFromCursor(c) {
812
+ switch (c.readI32()) {
813
+ case 1:
814
+ return 0 /* Auto */;
815
+ case 2:
816
+ return 1 /* Memory */;
817
+ case 3:
818
+ return 2 /* File */;
819
+ default:
820
+ throw new UniffiInternalError.UnexpectedEnumCase;
821
+ }
822
+ }
823
+ writeIntoCursor(value, c) {
824
+ switch (value) {
825
+ case 0 /* Auto */:
826
+ return c.writeI32(1);
827
+ case 1 /* Memory */:
828
+ return c.writeI32(2);
829
+ case 2 /* File */:
830
+ return c.writeI32(3);
831
+ }
832
+ }
833
+ allocationSize(value) {
834
+ return 4;
835
+ }
836
+ }
837
+ return new FFIConverter;
838
+ })();
839
+ var FileLayout;
840
+ ((FileLayout2) => {
841
+ FileLayout2[FileLayout2["Single"] = 0] = "Single";
842
+ FileLayout2[FileLayout2["PerCredential"] = 1] = "PerCredential";
843
+ })(FileLayout ||= {});
844
+ var FfiConverterTypeFileLayout = (() => {
845
+
846
+ class FFIConverter extends AbstractFfiConverterByteArray {
847
+ readFromCursor(c) {
848
+ switch (c.readI32()) {
849
+ case 1:
850
+ return 0 /* Single */;
851
+ case 2:
852
+ return 1 /* PerCredential */;
853
+ default:
854
+ throw new UniffiInternalError.UnexpectedEnumCase;
855
+ }
856
+ }
857
+ writeIntoCursor(value, c) {
858
+ switch (value) {
859
+ case 0 /* Single */:
860
+ return c.writeI32(1);
861
+ case 1 /* PerCredential */:
862
+ return c.writeI32(2);
863
+ }
864
+ }
865
+ allocationSize(value) {
866
+ return 4;
867
+ }
868
+ }
869
+ return new FFIConverter;
870
+ })();
871
+ var ProviderOptions = (() => {
872
+ const defaults = () => ({
873
+ authorizationEndpoint: undefined,
874
+ clientSecret: undefined,
875
+ profile: undefined,
876
+ scopes: [],
877
+ grant: undefined,
878
+ cacheDir: undefined,
879
+ storage: undefined,
880
+ fileLayout: undefined,
881
+ auth: undefined
882
+ });
883
+ const create = (() => {
884
+ return uniffiCreateRecord(defaults);
885
+ })();
886
+ return Object.freeze({
887
+ create,
888
+ new: create,
889
+ defaults: () => Object.freeze(defaults())
890
+ });
891
+ })();
892
+ var FfiConverterTypeProviderOptions = (() => {
893
+
894
+ class FFIConverter extends AbstractFfiConverterByteArray {
895
+ readFromCursor(c) {
896
+ return {
897
+ provider: FfiConverterString.readFromCursor(c),
898
+ clientId: FfiConverterString.readFromCursor(c),
899
+ tokenEndpoint: FfiConverterString.readFromCursor(c),
900
+ authorizationEndpoint: FfiConverterOptionalString.readFromCursor(c),
901
+ clientSecret: FfiConverterOptionalString.readFromCursor(c),
902
+ profile: FfiConverterOptionalString.readFromCursor(c),
903
+ scopes: FfiConverterSequenceString.readFromCursor(c),
904
+ grant: FfiConverterOptionalTypeOAuthGrant.readFromCursor(c),
905
+ cacheDir: FfiConverterOptionalString.readFromCursor(c),
906
+ storage: FfiConverterOptionalTypeStorage.readFromCursor(c),
907
+ fileLayout: FfiConverterOptionalTypeFileLayout.readFromCursor(c),
908
+ auth: FfiConverterOptionalTypeAuthOptions.readFromCursor(c)
909
+ };
910
+ }
911
+ writeIntoCursor(value, c) {
912
+ FfiConverterString.writeIntoCursor(value.provider, c);
913
+ FfiConverterString.writeIntoCursor(value.clientId, c);
914
+ FfiConverterString.writeIntoCursor(value.tokenEndpoint, c);
915
+ FfiConverterOptionalString.writeIntoCursor(value.authorizationEndpoint, c);
916
+ FfiConverterOptionalString.writeIntoCursor(value.clientSecret, c);
917
+ FfiConverterOptionalString.writeIntoCursor(value.profile, c);
918
+ FfiConverterSequenceString.writeIntoCursor(value.scopes, c);
919
+ FfiConverterOptionalTypeOAuthGrant.writeIntoCursor(value.grant, c);
920
+ FfiConverterOptionalString.writeIntoCursor(value.cacheDir, c);
921
+ FfiConverterOptionalTypeStorage.writeIntoCursor(value.storage, c);
922
+ FfiConverterOptionalTypeFileLayout.writeIntoCursor(value.fileLayout, c);
923
+ FfiConverterOptionalTypeAuthOptions.writeIntoCursor(value.auth, c);
924
+ }
925
+ allocationSize(value) {
926
+ return FfiConverterString.allocationSize(value.provider) + FfiConverterString.allocationSize(value.clientId) + FfiConverterString.allocationSize(value.tokenEndpoint) + FfiConverterOptionalString.allocationSize(value.authorizationEndpoint) + FfiConverterOptionalString.allocationSize(value.clientSecret) + FfiConverterOptionalString.allocationSize(value.profile) + FfiConverterSequenceString.allocationSize(value.scopes) + FfiConverterOptionalTypeOAuthGrant.allocationSize(value.grant) + FfiConverterOptionalString.allocationSize(value.cacheDir) + FfiConverterOptionalTypeStorage.allocationSize(value.storage) + FfiConverterOptionalTypeFileLayout.allocationSize(value.fileLayout) + FfiConverterOptionalTypeAuthOptions.allocationSize(value.auth);
927
+ }
928
+ }
929
+ return new FFIConverter;
930
+ })();
931
+ var AuthError_Tags;
932
+ ((AuthError_Tags2) => {
933
+ AuthError_Tags2["Failure"] = "Failure";
934
+ })(AuthError_Tags ||= {});
935
+ var AuthError = (() => {
936
+
937
+ class Failure_ extends UniffiError {
938
+ [uniffiTypeNameSymbol] = "AuthError";
939
+ tag = "Failure" /* Failure */;
940
+ inner;
941
+ constructor(inner) {
942
+ super("AuthError", "Failure");
943
+ this.inner = Object.freeze(inner);
944
+ }
945
+ static new(inner) {
946
+ return new Failure_(inner);
947
+ }
948
+ static instanceOf(obj) {
949
+ return obj.tag === "Failure" /* Failure */;
950
+ }
951
+ static hasInner(obj) {
952
+ return Failure_.instanceOf(obj);
953
+ }
954
+ static getInner(obj) {
955
+ return obj.inner;
956
+ }
957
+ }
958
+ function instanceOf(obj) {
959
+ return obj[uniffiTypeNameSymbol] === "AuthError";
960
+ }
961
+ return Object.freeze({
962
+ instanceOf,
963
+ Failure: Failure_
964
+ });
965
+ })();
966
+ var FfiConverterTypeAuthError = (() => {
967
+
968
+ class FFIConverter extends AbstractFfiConverterByteArray {
969
+ readFromCursor(c) {
970
+ switch (c.readI32()) {
971
+ case 1:
972
+ return new AuthError.Failure({ message: FfiConverterString.readFromCursor(c) });
973
+ default:
974
+ throw new UniffiInternalError.UnexpectedEnumCase;
975
+ }
976
+ }
977
+ writeIntoCursor(value, c) {
978
+ switch (value.tag) {
979
+ case "Failure" /* Failure */: {
980
+ c.writeI32(1);
981
+ const inner = value.inner;
982
+ FfiConverterString.writeIntoCursor(inner.message, c);
983
+ return;
984
+ }
985
+ default:
986
+ throw new UniffiInternalError.UnexpectedEnumCase;
987
+ }
988
+ }
989
+ allocationSize(value) {
990
+ switch (value.tag) {
991
+ case "Failure" /* Failure */: {
992
+ const inner = value.inner;
993
+ let size = 4;
994
+ size += FfiConverterString.allocationSize(inner.message);
995
+ return size;
996
+ }
997
+ default:
998
+ throw new UniffiInternalError.UnexpectedEnumCase;
999
+ }
1000
+ }
1001
+ }
1002
+ return new FFIConverter;
1003
+ })();
1004
+
1005
+ class ProviderAuth extends UniffiAbstractObject {
1006
+ [uniffiTypeNameSymbol] = "ProviderAuth";
1007
+ [destructorGuardSymbol];
1008
+ [pointerLiteralSymbol];
1009
+ constructor(pointer) {
1010
+ super();
1011
+ this[pointerLiteralSymbol] = pointer;
1012
+ this[destructorGuardSymbol] = uniffiTypeProviderAuthObjectFactory.bless(pointer);
1013
+ }
1014
+ async forceRefreshToken(asyncOpts_) {
1015
+ const __stack = uniffiIsDebug ? new Error().stack : undefined;
1016
+ try {
1017
+ return await uniffiRustCallAsync(uniffiCaller, () => {
1018
+ return _bindings_ffi_default().uniffi_dbx_tools_auth_fn_method_providerauth_force_refresh_token(uniffiTypeProviderAuthObjectFactory.clonePointer(this));
1019
+ }, _bindings_ffi_default().ffi_dbx_tools_auth_rust_future_poll_rust_buffer, _bindings_ffi_default().ffi_dbx_tools_auth_rust_future_cancel_rust_buffer, _bindings_ffi_default().ffi_dbx_tools_auth_rust_future_complete_rust_buffer, _bindings_ffi_default().ffi_dbx_tools_auth_rust_future_free_rust_buffer, (__rb) => {
1020
+ try {
1021
+ return FfiConverterTypeAccessToken.lift(__rb);
1022
+ } finally {
1023
+ _bindings_ffi_default().rustbuffer_free(__rb);
1024
+ }
1025
+ }, FfiConverterString.lift.bind(FfiConverterString), asyncOpts_, FfiConverterTypeAuthError.lift.bind(FfiConverterTypeAuthError));
1026
+ } catch (__error) {
1027
+ if (uniffiIsDebug && __error instanceof Error) {
1028
+ __error.stack = __stack;
1029
+ }
1030
+ throw __error;
1031
+ }
1032
+ }
1033
+ async logout(asyncOpts_) {
1034
+ const __stack = uniffiIsDebug ? new Error().stack : undefined;
1035
+ try {
1036
+ return await uniffiRustCallAsync(uniffiCaller, () => {
1037
+ return _bindings_ffi_default().uniffi_dbx_tools_auth_fn_method_providerauth_logout(uniffiTypeProviderAuthObjectFactory.clonePointer(this));
1038
+ }, _bindings_ffi_default().ffi_dbx_tools_auth_rust_future_poll_void, _bindings_ffi_default().ffi_dbx_tools_auth_rust_future_cancel_void, _bindings_ffi_default().ffi_dbx_tools_auth_rust_future_complete_void, _bindings_ffi_default().ffi_dbx_tools_auth_rust_future_free_void, (_v) => {}, FfiConverterString.lift.bind(FfiConverterString), asyncOpts_, FfiConverterTypeAuthError.lift.bind(FfiConverterTypeAuthError));
1039
+ } catch (__error) {
1040
+ if (uniffiIsDebug && __error instanceof Error) {
1041
+ __error.stack = __stack;
1042
+ }
1043
+ throw __error;
1044
+ }
1045
+ }
1046
+ async refreshRejectedToken(staleAccessToken, asyncOpts_) {
1047
+ const __stack = uniffiIsDebug ? new Error().stack : undefined;
1048
+ try {
1049
+ return await uniffiRustCallAsync(uniffiCaller, () => {
1050
+ return _bindings_ffi_default().uniffi_dbx_tools_auth_fn_method_providerauth_refresh_rejected_token(uniffiTypeProviderAuthObjectFactory.clonePointer(this), FfiConverterString.lower(staleAccessToken, _bindings_ffi_default().rustbuffer_alloc));
1051
+ }, _bindings_ffi_default().ffi_dbx_tools_auth_rust_future_poll_rust_buffer, _bindings_ffi_default().ffi_dbx_tools_auth_rust_future_cancel_rust_buffer, _bindings_ffi_default().ffi_dbx_tools_auth_rust_future_complete_rust_buffer, _bindings_ffi_default().ffi_dbx_tools_auth_rust_future_free_rust_buffer, (__rb) => {
1052
+ try {
1053
+ return FfiConverterTypeAccessToken.lift(__rb);
1054
+ } finally {
1055
+ _bindings_ffi_default().rustbuffer_free(__rb);
1056
+ }
1057
+ }, FfiConverterString.lift.bind(FfiConverterString), asyncOpts_, FfiConverterTypeAuthError.lift.bind(FfiConverterTypeAuthError));
1058
+ } catch (__error) {
1059
+ if (uniffiIsDebug && __error instanceof Error) {
1060
+ __error.stack = __stack;
1061
+ }
1062
+ throw __error;
1063
+ }
1064
+ }
1065
+ async token(login = undefined, asyncOpts_) {
1066
+ const __stack = uniffiIsDebug ? new Error().stack : undefined;
1067
+ try {
1068
+ return await uniffiRustCallAsync(uniffiCaller, () => {
1069
+ return _bindings_ffi_default().uniffi_dbx_tools_auth_fn_method_providerauth_token(uniffiTypeProviderAuthObjectFactory.clonePointer(this), FfiConverterOptionalBoolean.lower(login, _bindings_ffi_default().rustbuffer_alloc));
1070
+ }, _bindings_ffi_default().ffi_dbx_tools_auth_rust_future_poll_rust_buffer, _bindings_ffi_default().ffi_dbx_tools_auth_rust_future_cancel_rust_buffer, _bindings_ffi_default().ffi_dbx_tools_auth_rust_future_complete_rust_buffer, _bindings_ffi_default().ffi_dbx_tools_auth_rust_future_free_rust_buffer, (__rb) => {
1071
+ try {
1072
+ return FfiConverterTypeAccessToken.lift(__rb);
1073
+ } finally {
1074
+ _bindings_ffi_default().rustbuffer_free(__rb);
1075
+ }
1076
+ }, FfiConverterString.lift.bind(FfiConverterString), asyncOpts_, FfiConverterTypeAuthError.lift.bind(FfiConverterTypeAuthError));
1077
+ } catch (__error) {
1078
+ if (uniffiIsDebug && __error instanceof Error) {
1079
+ __error.stack = __stack;
1080
+ }
1081
+ throw __error;
1082
+ }
1083
+ }
1084
+ uniffiDestroy() {
1085
+ const ptr = this[destructorGuardSymbol];
1086
+ if (ptr !== undefined) {
1087
+ const pointer = uniffiTypeProviderAuthObjectFactory.pointer(this);
1088
+ uniffiTypeProviderAuthObjectFactory.freePointer(pointer);
1089
+ uniffiTypeProviderAuthObjectFactory.unbless(ptr);
1090
+ delete this[destructorGuardSymbol];
1091
+ }
1092
+ }
1093
+ static instanceOf(obj_) {
1094
+ return uniffiTypeProviderAuthObjectFactory.isConcreteType(obj_);
1095
+ }
1096
+ }
1097
+ var uniffiTypeProviderAuthObjectFactory = (() => {
1098
+ const registry = typeof FinalizationRegistry !== "undefined" ? new FinalizationRegistry((heldValue) => {
1099
+ uniffiTypeProviderAuthObjectFactory.freePointer(heldValue);
1100
+ }) : null;
1101
+ return {
1102
+ create(pointer) {
1103
+ const instance = Object.create(ProviderAuth.prototype);
1104
+ instance[pointerLiteralSymbol] = pointer;
1105
+ instance[destructorGuardSymbol] = this.bless(pointer);
1106
+ instance[uniffiTypeNameSymbol] = "ProviderAuth";
1107
+ return instance;
1108
+ },
1109
+ bless(p) {
1110
+ const ptr = {
1111
+ p,
1112
+ markDestroyed: () => {
1113
+ return;
1114
+ }
1115
+ };
1116
+ if (registry) {
1117
+ registry.register(ptr, p, ptr);
1118
+ }
1119
+ return ptr;
1120
+ },
1121
+ unbless(ptr_) {
1122
+ if (registry) {
1123
+ registry.unregister(ptr_);
1124
+ }
1125
+ },
1126
+ pointer(obj_) {
1127
+ if (obj_[destructorGuardSymbol] === undefined) {
1128
+ throw new UniffiInternalError.UnexpectedNullPointer;
1129
+ }
1130
+ return obj_[pointerLiteralSymbol];
1131
+ },
1132
+ clonePointer(obj_) {
1133
+ const pointer = this.pointer(obj_);
1134
+ return uniffiCaller.rustCall((callStatus) => _bindings_ffi_default().uniffi_dbx_tools_auth_fn_clone_providerauth(pointer, callStatus), FfiConverterString.lift);
1135
+ },
1136
+ freePointer(pointer) {
1137
+ uniffiCaller.rustCall((callStatus) => _bindings_ffi_default().uniffi_dbx_tools_auth_fn_free_providerauth(pointer, callStatus), FfiConverterString.lift);
1138
+ },
1139
+ isConcreteType(obj_) {
1140
+ return obj_[destructorGuardSymbol] && obj_[uniffiTypeNameSymbol] === "ProviderAuth";
1141
+ }
1142
+ };
1143
+ })();
1144
+ var FfiConverterTypeProviderAuth = new FfiConverterObject(uniffiTypeProviderAuthObjectFactory);
1145
+
1146
+ class StorageAdapterImpl extends UniffiAbstractObject {
1147
+ [uniffiTypeNameSymbol] = "StorageAdapterImpl";
1148
+ [destructorGuardSymbol];
1149
+ [pointerLiteralSymbol];
1150
+ constructor(pointer) {
1151
+ super();
1152
+ this[pointerLiteralSymbol] = pointer;
1153
+ this[destructorGuardSymbol] = uniffiTypeStorageAdapterImplObjectFactory.bless(pointer);
1154
+ }
1155
+ async load(profile, asyncOpts_) {
1156
+ const __stack = uniffiIsDebug ? new Error().stack : undefined;
1157
+ try {
1158
+ return await uniffiRustCallAsync(uniffiCaller, () => {
1159
+ return _bindings_ffi_default().uniffi_dbx_tools_auth_fn_method_storageadapter_load(uniffiTypeStorageAdapterImplObjectFactory.clonePointer(this), FfiConverterString.lower(profile, _bindings_ffi_default().rustbuffer_alloc));
1160
+ }, _bindings_ffi_default().ffi_dbx_tools_auth_rust_future_poll_rust_buffer, _bindings_ffi_default().ffi_dbx_tools_auth_rust_future_cancel_rust_buffer, _bindings_ffi_default().ffi_dbx_tools_auth_rust_future_complete_rust_buffer, _bindings_ffi_default().ffi_dbx_tools_auth_rust_future_free_rust_buffer, (__rb) => {
1161
+ try {
1162
+ return FfiConverterOptionalString.lift(__rb);
1163
+ } finally {
1164
+ _bindings_ffi_default().rustbuffer_free(__rb);
1165
+ }
1166
+ }, FfiConverterString.lift.bind(FfiConverterString), asyncOpts_, FfiConverterTypeAuthError.lift.bind(FfiConverterTypeAuthError));
1167
+ } catch (__error) {
1168
+ if (uniffiIsDebug && __error instanceof Error) {
1169
+ __error.stack = __stack;
1170
+ }
1171
+ throw __error;
1172
+ }
1173
+ }
1174
+ async prepareWrite(asyncOpts_) {
1175
+ const __stack = uniffiIsDebug ? new Error().stack : undefined;
1176
+ try {
1177
+ return await uniffiRustCallAsync(uniffiCaller, () => {
1178
+ return _bindings_ffi_default().uniffi_dbx_tools_auth_fn_method_storageadapter_prepare_write(uniffiTypeStorageAdapterImplObjectFactory.clonePointer(this));
1179
+ }, _bindings_ffi_default().ffi_dbx_tools_auth_rust_future_poll_void, _bindings_ffi_default().ffi_dbx_tools_auth_rust_future_cancel_void, _bindings_ffi_default().ffi_dbx_tools_auth_rust_future_complete_void, _bindings_ffi_default().ffi_dbx_tools_auth_rust_future_free_void, (_v) => {}, FfiConverterString.lift.bind(FfiConverterString), asyncOpts_, FfiConverterTypeAuthError.lift.bind(FfiConverterTypeAuthError));
1180
+ } catch (__error) {
1181
+ if (uniffiIsDebug && __error instanceof Error) {
1182
+ __error.stack = __stack;
1183
+ }
1184
+ throw __error;
1185
+ }
1186
+ }
1187
+ async save(profile, token, asyncOpts_) {
1188
+ const __stack = uniffiIsDebug ? new Error().stack : undefined;
1189
+ try {
1190
+ return await uniffiRustCallAsync(uniffiCaller, () => {
1191
+ return _bindings_ffi_default().uniffi_dbx_tools_auth_fn_method_storageadapter_save(uniffiTypeStorageAdapterImplObjectFactory.clonePointer(this), FfiConverterString.lower(profile, _bindings_ffi_default().rustbuffer_alloc), FfiConverterString.lower(token, _bindings_ffi_default().rustbuffer_alloc));
1192
+ }, _bindings_ffi_default().ffi_dbx_tools_auth_rust_future_poll_void, _bindings_ffi_default().ffi_dbx_tools_auth_rust_future_cancel_void, _bindings_ffi_default().ffi_dbx_tools_auth_rust_future_complete_void, _bindings_ffi_default().ffi_dbx_tools_auth_rust_future_free_void, (_v) => {}, FfiConverterString.lift.bind(FfiConverterString), asyncOpts_, FfiConverterTypeAuthError.lift.bind(FfiConverterTypeAuthError));
1193
+ } catch (__error) {
1194
+ if (uniffiIsDebug && __error instanceof Error) {
1195
+ __error.stack = __stack;
1196
+ }
1197
+ throw __error;
1198
+ }
1199
+ }
1200
+ async remove(profile, asyncOpts_) {
1201
+ const __stack = uniffiIsDebug ? new Error().stack : undefined;
1202
+ try {
1203
+ return await uniffiRustCallAsync(uniffiCaller, () => {
1204
+ return _bindings_ffi_default().uniffi_dbx_tools_auth_fn_method_storageadapter_remove(uniffiTypeStorageAdapterImplObjectFactory.clonePointer(this), FfiConverterString.lower(profile, _bindings_ffi_default().rustbuffer_alloc));
1205
+ }, _bindings_ffi_default().ffi_dbx_tools_auth_rust_future_poll_void, _bindings_ffi_default().ffi_dbx_tools_auth_rust_future_cancel_void, _bindings_ffi_default().ffi_dbx_tools_auth_rust_future_complete_void, _bindings_ffi_default().ffi_dbx_tools_auth_rust_future_free_void, (_v) => {}, FfiConverterString.lift.bind(FfiConverterString), asyncOpts_, FfiConverterTypeAuthError.lift.bind(FfiConverterTypeAuthError));
1206
+ } catch (__error) {
1207
+ if (uniffiIsDebug && __error instanceof Error) {
1208
+ __error.stack = __stack;
1209
+ }
1210
+ throw __error;
1211
+ }
1212
+ }
1213
+ async acquireLock(profile, timeoutMillis, asyncOpts_) {
1214
+ const __stack = uniffiIsDebug ? new Error().stack : undefined;
1215
+ try {
1216
+ return await uniffiRustCallAsync(uniffiCaller, () => {
1217
+ return _bindings_ffi_default().uniffi_dbx_tools_auth_fn_method_storageadapter_acquire_lock(uniffiTypeStorageAdapterImplObjectFactory.clonePointer(this), FfiConverterString.lower(profile, _bindings_ffi_default().rustbuffer_alloc), FfiConverterUInt64.lower(timeoutMillis, _bindings_ffi_default().rustbuffer_alloc));
1218
+ }, _bindings_ffi_default().ffi_dbx_tools_auth_rust_future_poll_rust_buffer, _bindings_ffi_default().ffi_dbx_tools_auth_rust_future_cancel_rust_buffer, _bindings_ffi_default().ffi_dbx_tools_auth_rust_future_complete_rust_buffer, _bindings_ffi_default().ffi_dbx_tools_auth_rust_future_free_rust_buffer, (__rb) => {
1219
+ try {
1220
+ return FfiConverterString.lift(__rb);
1221
+ } finally {
1222
+ _bindings_ffi_default().rustbuffer_free(__rb);
1223
+ }
1224
+ }, FfiConverterString.lift.bind(FfiConverterString), asyncOpts_, FfiConverterTypeAuthError.lift.bind(FfiConverterTypeAuthError));
1225
+ } catch (__error) {
1226
+ if (uniffiIsDebug && __error instanceof Error) {
1227
+ __error.stack = __stack;
1228
+ }
1229
+ throw __error;
1230
+ }
1231
+ }
1232
+ async releaseLock(lease, asyncOpts_) {
1233
+ const __stack = uniffiIsDebug ? new Error().stack : undefined;
1234
+ try {
1235
+ return await uniffiRustCallAsync(uniffiCaller, () => {
1236
+ return _bindings_ffi_default().uniffi_dbx_tools_auth_fn_method_storageadapter_release_lock(uniffiTypeStorageAdapterImplObjectFactory.clonePointer(this), FfiConverterString.lower(lease, _bindings_ffi_default().rustbuffer_alloc));
1237
+ }, _bindings_ffi_default().ffi_dbx_tools_auth_rust_future_poll_void, _bindings_ffi_default().ffi_dbx_tools_auth_rust_future_cancel_void, _bindings_ffi_default().ffi_dbx_tools_auth_rust_future_complete_void, _bindings_ffi_default().ffi_dbx_tools_auth_rust_future_free_void, (_v) => {}, FfiConverterString.lift.bind(FfiConverterString), asyncOpts_, FfiConverterTypeAuthError.lift.bind(FfiConverterTypeAuthError));
1238
+ } catch (__error) {
1239
+ if (uniffiIsDebug && __error instanceof Error) {
1240
+ __error.stack = __stack;
1241
+ }
1242
+ throw __error;
1243
+ }
1244
+ }
1245
+ name() {
1246
+ const __rb = uniffiCaller.rustCall((callStatus) => {
1247
+ return _bindings_ffi_default().uniffi_dbx_tools_auth_fn_method_storageadapter_name(uniffiTypeStorageAdapterImplObjectFactory.clonePointer(this), callStatus);
1248
+ }, FfiConverterString.lift.bind(FfiConverterString));
1249
+ try {
1250
+ return FfiConverterString.lift(__rb);
1251
+ } finally {
1252
+ _bindings_ffi_default().rustbuffer_free(__rb);
1253
+ }
1254
+ }
1255
+ uniffiDestroy() {
1256
+ const ptr = this[destructorGuardSymbol];
1257
+ if (ptr !== undefined) {
1258
+ const pointer = uniffiTypeStorageAdapterImplObjectFactory.pointer(this);
1259
+ uniffiTypeStorageAdapterImplObjectFactory.freePointer(pointer);
1260
+ uniffiTypeStorageAdapterImplObjectFactory.unbless(ptr);
1261
+ delete this[destructorGuardSymbol];
1262
+ }
1263
+ }
1264
+ static instanceOf(obj_) {
1265
+ return uniffiTypeStorageAdapterImplObjectFactory.isConcreteType(obj_);
1266
+ }
1267
+ }
1268
+ var uniffiTypeStorageAdapterImplObjectFactory = (() => {
1269
+ const registry = typeof FinalizationRegistry !== "undefined" ? new FinalizationRegistry((heldValue) => {
1270
+ uniffiTypeStorageAdapterImplObjectFactory.freePointer(heldValue);
1271
+ }) : null;
1272
+ return {
1273
+ create(pointer) {
1274
+ const instance = Object.create(StorageAdapterImpl.prototype);
1275
+ instance[pointerLiteralSymbol] = pointer;
1276
+ instance[destructorGuardSymbol] = this.bless(pointer);
1277
+ instance[uniffiTypeNameSymbol] = "StorageAdapterImpl";
1278
+ return instance;
1279
+ },
1280
+ bless(p) {
1281
+ const ptr = {
1282
+ p,
1283
+ markDestroyed: () => {
1284
+ return;
1285
+ }
1286
+ };
1287
+ if (registry) {
1288
+ registry.register(ptr, p, ptr);
1289
+ }
1290
+ return ptr;
1291
+ },
1292
+ unbless(ptr_) {
1293
+ if (registry) {
1294
+ registry.unregister(ptr_);
1295
+ }
1296
+ },
1297
+ pointer(obj_) {
1298
+ if (obj_[destructorGuardSymbol] === undefined) {
1299
+ throw new UniffiInternalError.UnexpectedNullPointer;
1300
+ }
1301
+ return obj_[pointerLiteralSymbol];
1302
+ },
1303
+ clonePointer(obj_) {
1304
+ const pointer = this.pointer(obj_);
1305
+ return uniffiCaller.rustCall((callStatus) => _bindings_ffi_default().uniffi_dbx_tools_auth_fn_clone_storageadapter(pointer, callStatus), FfiConverterString.lift);
1306
+ },
1307
+ freePointer(pointer) {
1308
+ uniffiCaller.rustCall((callStatus) => _bindings_ffi_default().uniffi_dbx_tools_auth_fn_free_storageadapter(pointer, callStatus), FfiConverterString.lift);
1309
+ },
1310
+ isConcreteType(obj_) {
1311
+ return obj_[destructorGuardSymbol] && obj_[uniffiTypeNameSymbol] === "StorageAdapterImpl";
1312
+ }
1313
+ };
1314
+ })();
1315
+ var FfiConverterTypeStorageAdapter = new FfiConverterObjectWithCallbacks(uniffiTypeStorageAdapterImplObjectFactory);
1316
+ var uniffiCallbackInterfaceStorageAdapter = {
1317
+ vtable: {
1318
+ load: (uniffiHandle, profile, uniffiFutureCallback, uniffiCallbackData) => {
1319
+ const uniffiMakeCall = async (signal) => {
1320
+ const jsCallback = FfiConverterTypeStorageAdapter.lift(uniffiHandle);
1321
+ return await jsCallback.load(FfiConverterString.lift(profile), { signal });
1322
+ };
1323
+ const uniffiHandleSuccess = (returnValue) => {
1324
+ uniffiFutureCallback.call(uniffiFutureCallback, uniffiCallbackData, {
1325
+ return_value: FfiConverterOptionalString.lower(returnValue, _bindings_ffi_default().rustbuffer_alloc),
1326
+ call_status: uniffiCaller.createCallStatus()
1327
+ });
1328
+ };
1329
+ const uniffiHandleError = (code, errorBuf) => {
1330
+ uniffiFutureCallback.call(uniffiFutureCallback, uniffiCallbackData, {
1331
+ return_value: new Uint8Array(0),
1332
+ call_status: uniffiCaller.createErrorStatus(code, errorBuf)
1333
+ });
1334
+ };
1335
+ const uniffiForeignFuture = uniffiTraitInterfaceCallAsyncWithError(uniffiMakeCall, uniffiHandleSuccess, uniffiHandleError, AuthError.instanceOf, FfiConverterTypeAuthError.lower.bind(FfiConverterTypeAuthError), FfiConverterString.lower.bind(FfiConverterString), _bindings_ffi_default().rustbuffer_alloc);
1336
+ return uniffiForeignFuture;
1337
+ },
1338
+ prepare_write: (uniffiHandle, uniffiFutureCallback, uniffiCallbackData) => {
1339
+ const uniffiMakeCall = async (signal) => {
1340
+ const jsCallback = FfiConverterTypeStorageAdapter.lift(uniffiHandle);
1341
+ return await jsCallback.prepareWrite({ signal });
1342
+ };
1343
+ const uniffiHandleSuccess = (returnValue) => {
1344
+ uniffiFutureCallback.call(uniffiFutureCallback, uniffiCallbackData, {
1345
+ call_status: uniffiCaller.createCallStatus()
1346
+ });
1347
+ };
1348
+ const uniffiHandleError = (code, errorBuf) => {
1349
+ uniffiFutureCallback.call(uniffiFutureCallback, uniffiCallbackData, {
1350
+ call_status: uniffiCaller.createErrorStatus(code, errorBuf)
1351
+ });
1352
+ };
1353
+ const uniffiForeignFuture = uniffiTraitInterfaceCallAsyncWithError(uniffiMakeCall, uniffiHandleSuccess, uniffiHandleError, AuthError.instanceOf, FfiConverterTypeAuthError.lower.bind(FfiConverterTypeAuthError), FfiConverterString.lower.bind(FfiConverterString), _bindings_ffi_default().rustbuffer_alloc);
1354
+ return uniffiForeignFuture;
1355
+ },
1356
+ save: (uniffiHandle, profile, token, uniffiFutureCallback, uniffiCallbackData) => {
1357
+ const uniffiMakeCall = async (signal) => {
1358
+ const jsCallback = FfiConverterTypeStorageAdapter.lift(uniffiHandle);
1359
+ return await jsCallback.save(FfiConverterString.lift(profile), FfiConverterString.lift(token), { signal });
1360
+ };
1361
+ const uniffiHandleSuccess = (returnValue) => {
1362
+ uniffiFutureCallback.call(uniffiFutureCallback, uniffiCallbackData, {
1363
+ call_status: uniffiCaller.createCallStatus()
1364
+ });
1365
+ };
1366
+ const uniffiHandleError = (code, errorBuf) => {
1367
+ uniffiFutureCallback.call(uniffiFutureCallback, uniffiCallbackData, {
1368
+ call_status: uniffiCaller.createErrorStatus(code, errorBuf)
1369
+ });
1370
+ };
1371
+ const uniffiForeignFuture = uniffiTraitInterfaceCallAsyncWithError(uniffiMakeCall, uniffiHandleSuccess, uniffiHandleError, AuthError.instanceOf, FfiConverterTypeAuthError.lower.bind(FfiConverterTypeAuthError), FfiConverterString.lower.bind(FfiConverterString), _bindings_ffi_default().rustbuffer_alloc);
1372
+ return uniffiForeignFuture;
1373
+ },
1374
+ remove: (uniffiHandle, profile, uniffiFutureCallback, uniffiCallbackData) => {
1375
+ const uniffiMakeCall = async (signal) => {
1376
+ const jsCallback = FfiConverterTypeStorageAdapter.lift(uniffiHandle);
1377
+ return await jsCallback.remove(FfiConverterString.lift(profile), { signal });
1378
+ };
1379
+ const uniffiHandleSuccess = (returnValue) => {
1380
+ uniffiFutureCallback.call(uniffiFutureCallback, uniffiCallbackData, {
1381
+ call_status: uniffiCaller.createCallStatus()
1382
+ });
1383
+ };
1384
+ const uniffiHandleError = (code, errorBuf) => {
1385
+ uniffiFutureCallback.call(uniffiFutureCallback, uniffiCallbackData, {
1386
+ call_status: uniffiCaller.createErrorStatus(code, errorBuf)
1387
+ });
1388
+ };
1389
+ const uniffiForeignFuture = uniffiTraitInterfaceCallAsyncWithError(uniffiMakeCall, uniffiHandleSuccess, uniffiHandleError, AuthError.instanceOf, FfiConverterTypeAuthError.lower.bind(FfiConverterTypeAuthError), FfiConverterString.lower.bind(FfiConverterString), _bindings_ffi_default().rustbuffer_alloc);
1390
+ return uniffiForeignFuture;
1391
+ },
1392
+ acquire_lock: (uniffiHandle, profile, timeoutMillis, uniffiFutureCallback, uniffiCallbackData) => {
1393
+ const uniffiMakeCall = async (signal) => {
1394
+ const jsCallback = FfiConverterTypeStorageAdapter.lift(uniffiHandle);
1395
+ return await jsCallback.acquireLock(FfiConverterString.lift(profile), FfiConverterUInt64.lift(timeoutMillis), { signal });
1396
+ };
1397
+ const uniffiHandleSuccess = (returnValue) => {
1398
+ uniffiFutureCallback.call(uniffiFutureCallback, uniffiCallbackData, {
1399
+ return_value: FfiConverterString.lower(returnValue, _bindings_ffi_default().rustbuffer_alloc),
1400
+ call_status: uniffiCaller.createCallStatus()
1401
+ });
1402
+ };
1403
+ const uniffiHandleError = (code, errorBuf) => {
1404
+ uniffiFutureCallback.call(uniffiFutureCallback, uniffiCallbackData, {
1405
+ return_value: new Uint8Array(0),
1406
+ call_status: uniffiCaller.createErrorStatus(code, errorBuf)
1407
+ });
1408
+ };
1409
+ const uniffiForeignFuture = uniffiTraitInterfaceCallAsyncWithError(uniffiMakeCall, uniffiHandleSuccess, uniffiHandleError, AuthError.instanceOf, FfiConverterTypeAuthError.lower.bind(FfiConverterTypeAuthError), FfiConverterString.lower.bind(FfiConverterString), _bindings_ffi_default().rustbuffer_alloc);
1410
+ return uniffiForeignFuture;
1411
+ },
1412
+ release_lock: (uniffiHandle, lease, uniffiFutureCallback, uniffiCallbackData) => {
1413
+ const uniffiMakeCall = async (signal) => {
1414
+ const jsCallback = FfiConverterTypeStorageAdapter.lift(uniffiHandle);
1415
+ return await jsCallback.releaseLock(FfiConverterString.lift(lease), { signal });
1416
+ };
1417
+ const uniffiHandleSuccess = (returnValue) => {
1418
+ uniffiFutureCallback.call(uniffiFutureCallback, uniffiCallbackData, {
1419
+ call_status: uniffiCaller.createCallStatus()
1420
+ });
1421
+ };
1422
+ const uniffiHandleError = (code, errorBuf) => {
1423
+ uniffiFutureCallback.call(uniffiFutureCallback, uniffiCallbackData, {
1424
+ call_status: uniffiCaller.createErrorStatus(code, errorBuf)
1425
+ });
1426
+ };
1427
+ const uniffiForeignFuture = uniffiTraitInterfaceCallAsyncWithError(uniffiMakeCall, uniffiHandleSuccess, uniffiHandleError, AuthError.instanceOf, FfiConverterTypeAuthError.lower.bind(FfiConverterTypeAuthError), FfiConverterString.lower.bind(FfiConverterString), _bindings_ffi_default().rustbuffer_alloc);
1428
+ return uniffiForeignFuture;
1429
+ },
1430
+ name: (uniffiHandle) => {
1431
+ const uniffiMakeCall = () => {
1432
+ const jsCallback = FfiConverterTypeStorageAdapter.lift(uniffiHandle);
1433
+ return jsCallback.name();
1434
+ };
1435
+ const uniffiResult = UniffiResult.ready();
1436
+ const uniffiHandleSuccess = (obj) => {
1437
+ UniffiResult.writeSuccess(uniffiResult, FfiConverterString.lower(obj, _bindings_ffi_default().rustbuffer_alloc));
1438
+ };
1439
+ const uniffiHandleError = (code, errBuf) => {
1440
+ UniffiResult.writeError(uniffiResult, code, errBuf);
1441
+ };
1442
+ uniffiTraitInterfaceCall(uniffiMakeCall, uniffiHandleSuccess, uniffiHandleError, FfiConverterString.lower.bind(FfiConverterString), _bindings_ffi_default().rustbuffer_alloc);
1443
+ return uniffiResult;
1444
+ },
1445
+ uniffi_free: (uniffiHandle) => {
1446
+ FfiConverterTypeStorageAdapter.drop(uniffiHandle);
1447
+ },
1448
+ uniffi_clone: (uniffiHandle) => {
1449
+ return FfiConverterTypeStorageAdapter.clone(uniffiHandle);
1450
+ }
1451
+ },
1452
+ register: () => {
1453
+ _bindings_ffi_default().uniffi_dbx_tools_auth_fn_init_callback_vtable_storageadapter(uniffiCallbackInterfaceStorageAdapter.vtable);
1454
+ }
1455
+ };
1456
+
1457
+ class StorageHandle extends UniffiAbstractObject {
1458
+ [uniffiTypeNameSymbol] = "StorageHandle";
1459
+ [destructorGuardSymbol];
1460
+ [pointerLiteralSymbol];
1461
+ constructor(pointer) {
1462
+ super();
1463
+ this[pointerLiteralSymbol] = pointer;
1464
+ this[destructorGuardSymbol] = uniffiTypeStorageHandleObjectFactory.bless(pointer);
1465
+ }
1466
+ uniffiDestroy() {
1467
+ const ptr = this[destructorGuardSymbol];
1468
+ if (ptr !== undefined) {
1469
+ const pointer = uniffiTypeStorageHandleObjectFactory.pointer(this);
1470
+ uniffiTypeStorageHandleObjectFactory.freePointer(pointer);
1471
+ uniffiTypeStorageHandleObjectFactory.unbless(ptr);
1472
+ delete this[destructorGuardSymbol];
1473
+ }
1474
+ }
1475
+ static instanceOf(obj_) {
1476
+ return uniffiTypeStorageHandleObjectFactory.isConcreteType(obj_);
1477
+ }
1478
+ }
1479
+ var uniffiTypeStorageHandleObjectFactory = (() => {
1480
+ const registry = typeof FinalizationRegistry !== "undefined" ? new FinalizationRegistry((heldValue) => {
1481
+ uniffiTypeStorageHandleObjectFactory.freePointer(heldValue);
1482
+ }) : null;
1483
+ return {
1484
+ create(pointer) {
1485
+ const instance = Object.create(StorageHandle.prototype);
1486
+ instance[pointerLiteralSymbol] = pointer;
1487
+ instance[destructorGuardSymbol] = this.bless(pointer);
1488
+ instance[uniffiTypeNameSymbol] = "StorageHandle";
1489
+ return instance;
1490
+ },
1491
+ bless(p) {
1492
+ const ptr = {
1493
+ p,
1494
+ markDestroyed: () => {
1495
+ return;
1496
+ }
1497
+ };
1498
+ if (registry) {
1499
+ registry.register(ptr, p, ptr);
1500
+ }
1501
+ return ptr;
1502
+ },
1503
+ unbless(ptr_) {
1504
+ if (registry) {
1505
+ registry.unregister(ptr_);
1506
+ }
1507
+ },
1508
+ pointer(obj_) {
1509
+ if (obj_[destructorGuardSymbol] === undefined) {
1510
+ throw new UniffiInternalError.UnexpectedNullPointer;
1511
+ }
1512
+ return obj_[pointerLiteralSymbol];
1513
+ },
1514
+ clonePointer(obj_) {
1515
+ const pointer = this.pointer(obj_);
1516
+ return uniffiCaller.rustCall((callStatus) => _bindings_ffi_default().uniffi_dbx_tools_auth_fn_clone_storagehandle(pointer, callStatus), FfiConverterString.lift);
1517
+ },
1518
+ freePointer(pointer) {
1519
+ uniffiCaller.rustCall((callStatus) => _bindings_ffi_default().uniffi_dbx_tools_auth_fn_free_storagehandle(pointer, callStatus), FfiConverterString.lift);
1520
+ },
1521
+ isConcreteType(obj_) {
1522
+ return obj_[destructorGuardSymbol] && obj_[uniffiTypeNameSymbol] === "StorageHandle";
1523
+ }
1524
+ };
1525
+ })();
1526
+ var FfiConverterTypeStorageHandle = new FfiConverterObject(uniffiTypeStorageHandleObjectFactory);
1527
+ var FfiConverterOptionalString = new FfiConverterOptional(FfiConverterString);
1528
+ var FfiConverterSequenceString = new FfiConverterArray(FfiConverterString);
1529
+ var FfiConverterOptionalTypeOAuthGrant = new FfiConverterOptional(FfiConverterTypeOAuthGrant);
1530
+ var FfiConverterOptionalTypeStorage = new FfiConverterOptional(FfiConverterTypeStorage);
1531
+ var FfiConverterOptionalTypeFileLayout = new FfiConverterOptional(FfiConverterTypeFileLayout);
1532
+ var FfiConverterOptionalTypeAuthOptions = new FfiConverterOptional(FfiConverterTypeAuthOptions);
1533
+ var FfiConverterOptionalBoolean = new FfiConverterOptional(FfiConverterBool);
1534
+ function uniffiEnsureInitialized() {
1535
+ const bindingsContractVersion = 30;
1536
+ const scaffoldingContractVersion = _bindings_ffi_default().ffi_dbx_tools_auth_uniffi_contract_version();
1537
+ if (bindingsContractVersion !== scaffoldingContractVersion) {
1538
+ throw new UniffiInternalError.ContractVersionMismatch(scaffoldingContractVersion, bindingsContractVersion);
1539
+ }
1540
+ if (_bindings_ffi_default().uniffi_dbx_tools_auth_checksum_func_canonical_scopes() !== 18689) {
1541
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_dbx_tools_auth_checksum_func_canonical_scopes");
1542
+ }
1543
+ if (_bindings_ffi_default().uniffi_dbx_tools_auth_checksum_func_create_provider_auth() !== 20751) {
1544
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_dbx_tools_auth_checksum_func_create_provider_auth");
1545
+ }
1546
+ if (_bindings_ffi_default().uniffi_dbx_tools_auth_checksum_func_create_provider_auth_with_storage() !== 25852) {
1547
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_dbx_tools_auth_checksum_func_create_provider_auth_with_storage");
1548
+ }
1549
+ if (_bindings_ffi_default().uniffi_dbx_tools_auth_checksum_func_create_storage_handle() !== 15844) {
1550
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_dbx_tools_auth_checksum_func_create_storage_handle");
1551
+ }
1552
+ if (_bindings_ffi_default().uniffi_dbx_tools_auth_checksum_func_credential_key() !== 22562) {
1553
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_dbx_tools_auth_checksum_func_credential_key");
1554
+ }
1555
+ if (_bindings_ffi_default().uniffi_dbx_tools_auth_checksum_method_providerauth_force_refresh_token() !== 35205) {
1556
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_dbx_tools_auth_checksum_method_providerauth_force_refresh_token");
1557
+ }
1558
+ if (_bindings_ffi_default().uniffi_dbx_tools_auth_checksum_method_providerauth_logout() !== 58116) {
1559
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_dbx_tools_auth_checksum_method_providerauth_logout");
1560
+ }
1561
+ if (_bindings_ffi_default().uniffi_dbx_tools_auth_checksum_method_providerauth_refresh_rejected_token() !== 40032) {
1562
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_dbx_tools_auth_checksum_method_providerauth_refresh_rejected_token");
1563
+ }
1564
+ if (_bindings_ffi_default().uniffi_dbx_tools_auth_checksum_method_providerauth_token() !== 54952) {
1565
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_dbx_tools_auth_checksum_method_providerauth_token");
1566
+ }
1567
+ if (_bindings_ffi_default().uniffi_dbx_tools_auth_checksum_method_storageadapter_load() !== 2549) {
1568
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_dbx_tools_auth_checksum_method_storageadapter_load");
1569
+ }
1570
+ if (_bindings_ffi_default().uniffi_dbx_tools_auth_checksum_method_storageadapter_prepare_write() !== 1371) {
1571
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_dbx_tools_auth_checksum_method_storageadapter_prepare_write");
1572
+ }
1573
+ if (_bindings_ffi_default().uniffi_dbx_tools_auth_checksum_method_storageadapter_save() !== 50464) {
1574
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_dbx_tools_auth_checksum_method_storageadapter_save");
1575
+ }
1576
+ if (_bindings_ffi_default().uniffi_dbx_tools_auth_checksum_method_storageadapter_remove() !== 46592) {
1577
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_dbx_tools_auth_checksum_method_storageadapter_remove");
1578
+ }
1579
+ if (_bindings_ffi_default().uniffi_dbx_tools_auth_checksum_method_storageadapter_acquire_lock() !== 13715) {
1580
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_dbx_tools_auth_checksum_method_storageadapter_acquire_lock");
1581
+ }
1582
+ if (_bindings_ffi_default().uniffi_dbx_tools_auth_checksum_method_storageadapter_release_lock() !== 42072) {
1583
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_dbx_tools_auth_checksum_method_storageadapter_release_lock");
1584
+ }
1585
+ if (_bindings_ffi_default().uniffi_dbx_tools_auth_checksum_method_storageadapter_name() !== 674) {
1586
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_dbx_tools_auth_checksum_method_storageadapter_name");
1587
+ }
1588
+ uniffiCallbackInterfaceStorageAdapter.register();
1589
+ }
1590
+ var _bindings_default = Object.freeze({
1591
+ initialize: uniffiEnsureInitialized,
1592
+ converters: {
1593
+ FfiConverterTypeAccessToken,
1594
+ FfiConverterTypeAuthError,
1595
+ FfiConverterTypeAuthOptions,
1596
+ FfiConverterTypeFileLayout,
1597
+ FfiConverterTypeOAuthGrant,
1598
+ FfiConverterTypeProviderAuth,
1599
+ FfiConverterTypeProviderOptions,
1600
+ FfiConverterTypeStorage,
1601
+ FfiConverterTypeStorageAdapter,
1602
+ FfiConverterTypeStorageHandle
1603
+ }
1604
+ });
1605
+ // src/bindings.ts
1606
+ _bindings_default.initialize();
1607
+ async function uniffiInitAsync() {}
1608
+ // index.ts
1609
+ var PACKAGE_IDENTIFIER = "@dbx-tools/auth";
1610
+ export {
1611
+ _bindings_default as uniffiModule,
1612
+ uniffiInitAsync,
1613
+ credentialKey,
1614
+ createStorageHandle,
1615
+ createProviderAuthWithStorage,
1616
+ createProviderAuth,
1617
+ canonicalScopes,
1618
+ exports_bindings as bindings,
1619
+ StorageHandle,
1620
+ StorageAdapterImpl,
1621
+ Storage,
1622
+ ProviderOptions,
1623
+ ProviderAuth,
1624
+ PACKAGE_IDENTIFIER,
1625
+ OAuthGrant,
1626
+ FileLayout,
1627
+ AuthOptions,
1628
+ AuthError_Tags,
1629
+ AuthError,
1630
+ AccessToken
1631
+ };