@dbx-tools/google-rs 0.6.188

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/README.md ADDED
@@ -0,0 +1,15 @@
1
+ # `@dbx-tools/google-rs`
2
+
3
+ Google integrations backed by native Rust libraries. The current surface is
4
+ Google Application Default Credentials.
5
+
6
+ ```ts
7
+ import { createGoogleAuth, GoogleAuthOptions } from "@dbx-tools/google-rs";
8
+
9
+ const auth = await createGoogleAuth(GoogleAuthOptions.create({}));
10
+ const token = await auth.token();
11
+ ```
12
+
13
+ ADC checks `GOOGLE_APPLICATION_CREDENTIALS`, gcloud's well-known credentials
14
+ file, then the Google Cloud metadata service. It never invokes gcloud or
15
+ rewrites ADC. Shared token lifecycle types come from `@dbx-tools/core-rs`.
package/index.ts ADDED
@@ -0,0 +1,7 @@
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
+
5
+ export const PACKAGE_IDENTIFIER = "@dbx-tools/google-rs";
6
+ export const PACKAGE_VERSION = "0.6.188";
7
+ export * from "./src/bindings.ts";
package/lib/index.js ADDED
@@ -0,0 +1,675 @@
1
+ // src/_bindings-ffi.ts
2
+ import lib from "@ubjs/node";
3
+ var { UniffiNativeModule, FfiType, resolveLibPath } = lib;
4
+ var DEFINITIONS = {
5
+ symbols: {
6
+ rustbuffer_alloc: "ffi_dbx_tools_google_rustbuffer_alloc",
7
+ rustbuffer_free: "ffi_dbx_tools_google_rustbuffer_free",
8
+ rustbuffer_from_bytes: "ffi_dbx_tools_google_rustbuffer_from_bytes"
9
+ },
10
+ functions: {
11
+ ffi_dbx_tools_google_rust_future_poll_u8: {
12
+ args: [FfiType.Handle, FfiType.Callback("RustFutureContinuationCallback"), FfiType.Handle],
13
+ ret: FfiType.Void,
14
+ hasRustCallStatus: false
15
+ },
16
+ ffi_dbx_tools_google_rust_future_cancel_u8: {
17
+ args: [FfiType.Handle],
18
+ ret: FfiType.Void,
19
+ hasRustCallStatus: false
20
+ },
21
+ ffi_dbx_tools_google_rust_future_complete_u8: {
22
+ args: [FfiType.Handle],
23
+ ret: FfiType.UInt8,
24
+ hasRustCallStatus: true
25
+ },
26
+ ffi_dbx_tools_google_rust_future_free_u8: {
27
+ args: [FfiType.Handle],
28
+ ret: FfiType.Void,
29
+ hasRustCallStatus: false
30
+ },
31
+ ffi_dbx_tools_google_rust_future_poll_i8: {
32
+ args: [FfiType.Handle, FfiType.Callback("RustFutureContinuationCallback"), FfiType.Handle],
33
+ ret: FfiType.Void,
34
+ hasRustCallStatus: false
35
+ },
36
+ ffi_dbx_tools_google_rust_future_cancel_i8: {
37
+ args: [FfiType.Handle],
38
+ ret: FfiType.Void,
39
+ hasRustCallStatus: false
40
+ },
41
+ ffi_dbx_tools_google_rust_future_complete_i8: {
42
+ args: [FfiType.Handle],
43
+ ret: FfiType.Int8,
44
+ hasRustCallStatus: true
45
+ },
46
+ ffi_dbx_tools_google_rust_future_free_i8: {
47
+ args: [FfiType.Handle],
48
+ ret: FfiType.Void,
49
+ hasRustCallStatus: false
50
+ },
51
+ ffi_dbx_tools_google_rust_future_poll_u16: {
52
+ args: [FfiType.Handle, FfiType.Callback("RustFutureContinuationCallback"), FfiType.Handle],
53
+ ret: FfiType.Void,
54
+ hasRustCallStatus: false
55
+ },
56
+ ffi_dbx_tools_google_rust_future_cancel_u16: {
57
+ args: [FfiType.Handle],
58
+ ret: FfiType.Void,
59
+ hasRustCallStatus: false
60
+ },
61
+ ffi_dbx_tools_google_rust_future_complete_u16: {
62
+ args: [FfiType.Handle],
63
+ ret: FfiType.UInt16,
64
+ hasRustCallStatus: true
65
+ },
66
+ ffi_dbx_tools_google_rust_future_free_u16: {
67
+ args: [FfiType.Handle],
68
+ ret: FfiType.Void,
69
+ hasRustCallStatus: false
70
+ },
71
+ ffi_dbx_tools_google_rust_future_poll_i16: {
72
+ args: [FfiType.Handle, FfiType.Callback("RustFutureContinuationCallback"), FfiType.Handle],
73
+ ret: FfiType.Void,
74
+ hasRustCallStatus: false
75
+ },
76
+ ffi_dbx_tools_google_rust_future_cancel_i16: {
77
+ args: [FfiType.Handle],
78
+ ret: FfiType.Void,
79
+ hasRustCallStatus: false
80
+ },
81
+ ffi_dbx_tools_google_rust_future_complete_i16: {
82
+ args: [FfiType.Handle],
83
+ ret: FfiType.Int16,
84
+ hasRustCallStatus: true
85
+ },
86
+ ffi_dbx_tools_google_rust_future_free_i16: {
87
+ args: [FfiType.Handle],
88
+ ret: FfiType.Void,
89
+ hasRustCallStatus: false
90
+ },
91
+ ffi_dbx_tools_google_rust_future_poll_u32: {
92
+ args: [FfiType.Handle, FfiType.Callback("RustFutureContinuationCallback"), FfiType.Handle],
93
+ ret: FfiType.Void,
94
+ hasRustCallStatus: false
95
+ },
96
+ ffi_dbx_tools_google_rust_future_cancel_u32: {
97
+ args: [FfiType.Handle],
98
+ ret: FfiType.Void,
99
+ hasRustCallStatus: false
100
+ },
101
+ ffi_dbx_tools_google_rust_future_complete_u32: {
102
+ args: [FfiType.Handle],
103
+ ret: FfiType.UInt32,
104
+ hasRustCallStatus: true
105
+ },
106
+ ffi_dbx_tools_google_rust_future_free_u32: {
107
+ args: [FfiType.Handle],
108
+ ret: FfiType.Void,
109
+ hasRustCallStatus: false
110
+ },
111
+ ffi_dbx_tools_google_rust_future_poll_i32: {
112
+ args: [FfiType.Handle, FfiType.Callback("RustFutureContinuationCallback"), FfiType.Handle],
113
+ ret: FfiType.Void,
114
+ hasRustCallStatus: false
115
+ },
116
+ ffi_dbx_tools_google_rust_future_cancel_i32: {
117
+ args: [FfiType.Handle],
118
+ ret: FfiType.Void,
119
+ hasRustCallStatus: false
120
+ },
121
+ ffi_dbx_tools_google_rust_future_complete_i32: {
122
+ args: [FfiType.Handle],
123
+ ret: FfiType.Int32,
124
+ hasRustCallStatus: true
125
+ },
126
+ ffi_dbx_tools_google_rust_future_free_i32: {
127
+ args: [FfiType.Handle],
128
+ ret: FfiType.Void,
129
+ hasRustCallStatus: false
130
+ },
131
+ ffi_dbx_tools_google_rust_future_poll_u64: {
132
+ args: [FfiType.Handle, FfiType.Callback("RustFutureContinuationCallback"), FfiType.Handle],
133
+ ret: FfiType.Void,
134
+ hasRustCallStatus: false
135
+ },
136
+ ffi_dbx_tools_google_rust_future_cancel_u64: {
137
+ args: [FfiType.Handle],
138
+ ret: FfiType.Void,
139
+ hasRustCallStatus: false
140
+ },
141
+ ffi_dbx_tools_google_rust_future_complete_u64: {
142
+ args: [FfiType.Handle],
143
+ ret: FfiType.Handle,
144
+ hasRustCallStatus: true
145
+ },
146
+ ffi_dbx_tools_google_rust_future_free_u64: {
147
+ args: [FfiType.Handle],
148
+ ret: FfiType.Void,
149
+ hasRustCallStatus: false
150
+ },
151
+ ffi_dbx_tools_google_rust_future_poll_i64: {
152
+ args: [FfiType.Handle, FfiType.Callback("RustFutureContinuationCallback"), FfiType.Handle],
153
+ ret: FfiType.Void,
154
+ hasRustCallStatus: false
155
+ },
156
+ ffi_dbx_tools_google_rust_future_cancel_i64: {
157
+ args: [FfiType.Handle],
158
+ ret: FfiType.Void,
159
+ hasRustCallStatus: false
160
+ },
161
+ ffi_dbx_tools_google_rust_future_complete_i64: {
162
+ args: [FfiType.Handle],
163
+ ret: FfiType.Int64,
164
+ hasRustCallStatus: true
165
+ },
166
+ ffi_dbx_tools_google_rust_future_free_i64: {
167
+ args: [FfiType.Handle],
168
+ ret: FfiType.Void,
169
+ hasRustCallStatus: false
170
+ },
171
+ ffi_dbx_tools_google_rust_future_poll_f32: {
172
+ args: [FfiType.Handle, FfiType.Callback("RustFutureContinuationCallback"), FfiType.Handle],
173
+ ret: FfiType.Void,
174
+ hasRustCallStatus: false
175
+ },
176
+ ffi_dbx_tools_google_rust_future_cancel_f32: {
177
+ args: [FfiType.Handle],
178
+ ret: FfiType.Void,
179
+ hasRustCallStatus: false
180
+ },
181
+ ffi_dbx_tools_google_rust_future_complete_f32: {
182
+ args: [FfiType.Handle],
183
+ ret: FfiType.Float32,
184
+ hasRustCallStatus: true
185
+ },
186
+ ffi_dbx_tools_google_rust_future_free_f32: {
187
+ args: [FfiType.Handle],
188
+ ret: FfiType.Void,
189
+ hasRustCallStatus: false
190
+ },
191
+ ffi_dbx_tools_google_rust_future_poll_f64: {
192
+ args: [FfiType.Handle, FfiType.Callback("RustFutureContinuationCallback"), FfiType.Handle],
193
+ ret: FfiType.Void,
194
+ hasRustCallStatus: false
195
+ },
196
+ ffi_dbx_tools_google_rust_future_cancel_f64: {
197
+ args: [FfiType.Handle],
198
+ ret: FfiType.Void,
199
+ hasRustCallStatus: false
200
+ },
201
+ ffi_dbx_tools_google_rust_future_complete_f64: {
202
+ args: [FfiType.Handle],
203
+ ret: FfiType.Float64,
204
+ hasRustCallStatus: true
205
+ },
206
+ ffi_dbx_tools_google_rust_future_free_f64: {
207
+ args: [FfiType.Handle],
208
+ ret: FfiType.Void,
209
+ hasRustCallStatus: false
210
+ },
211
+ ffi_dbx_tools_google_rust_future_poll_rust_buffer: {
212
+ args: [FfiType.Handle, FfiType.Callback("RustFutureContinuationCallback"), FfiType.Handle],
213
+ ret: FfiType.Void,
214
+ hasRustCallStatus: false
215
+ },
216
+ ffi_dbx_tools_google_rust_future_cancel_rust_buffer: {
217
+ args: [FfiType.Handle],
218
+ ret: FfiType.Void,
219
+ hasRustCallStatus: false
220
+ },
221
+ ffi_dbx_tools_google_rust_future_complete_rust_buffer: {
222
+ args: [FfiType.Handle],
223
+ ret: FfiType.RustBuffer,
224
+ hasRustCallStatus: true
225
+ },
226
+ ffi_dbx_tools_google_rust_future_free_rust_buffer: {
227
+ args: [FfiType.Handle],
228
+ ret: FfiType.Void,
229
+ hasRustCallStatus: false
230
+ },
231
+ ffi_dbx_tools_google_rust_future_poll_void: {
232
+ args: [FfiType.Handle, FfiType.Callback("RustFutureContinuationCallback"), FfiType.Handle],
233
+ ret: FfiType.Void,
234
+ hasRustCallStatus: false
235
+ },
236
+ ffi_dbx_tools_google_rust_future_cancel_void: {
237
+ args: [FfiType.Handle],
238
+ ret: FfiType.Void,
239
+ hasRustCallStatus: false
240
+ },
241
+ ffi_dbx_tools_google_rust_future_complete_void: {
242
+ args: [FfiType.Handle],
243
+ ret: FfiType.Void,
244
+ hasRustCallStatus: true
245
+ },
246
+ ffi_dbx_tools_google_rust_future_free_void: {
247
+ args: [FfiType.Handle],
248
+ ret: FfiType.Void,
249
+ hasRustCallStatus: false
250
+ },
251
+ uniffi_dbx_tools_google_fn_clone_googleauth: {
252
+ args: [FfiType.Handle],
253
+ ret: FfiType.Handle,
254
+ hasRustCallStatus: true
255
+ },
256
+ uniffi_dbx_tools_google_fn_free_googleauth: {
257
+ args: [FfiType.Handle],
258
+ ret: FfiType.Void,
259
+ hasRustCallStatus: true
260
+ },
261
+ uniffi_dbx_tools_google_fn_func_create_google_auth: {
262
+ args: [FfiType.RustBuffer],
263
+ ret: FfiType.Handle,
264
+ hasRustCallStatus: false
265
+ },
266
+ uniffi_dbx_tools_google_fn_method_googleauth_force_refresh_token: {
267
+ args: [FfiType.Handle],
268
+ ret: FfiType.Handle,
269
+ hasRustCallStatus: false
270
+ },
271
+ uniffi_dbx_tools_google_fn_method_googleauth_logout: {
272
+ args: [FfiType.Handle],
273
+ ret: FfiType.Handle,
274
+ hasRustCallStatus: false
275
+ },
276
+ uniffi_dbx_tools_google_fn_method_googleauth_refresh_rejected_token: {
277
+ args: [FfiType.Handle, FfiType.RustBuffer],
278
+ ret: FfiType.Handle,
279
+ hasRustCallStatus: false
280
+ },
281
+ uniffi_dbx_tools_google_fn_method_googleauth_status: {
282
+ args: [FfiType.Handle],
283
+ ret: FfiType.RustBuffer,
284
+ hasRustCallStatus: true
285
+ },
286
+ uniffi_dbx_tools_google_fn_method_googleauth_token: {
287
+ args: [FfiType.Handle],
288
+ ret: FfiType.Handle,
289
+ hasRustCallStatus: false
290
+ },
291
+ ffi_dbx_tools_google_uniffi_contract_version: {
292
+ args: [],
293
+ ret: FfiType.UInt32,
294
+ hasRustCallStatus: false
295
+ },
296
+ uniffi_dbx_tools_google_checksum_func_create_google_auth: {
297
+ args: [],
298
+ ret: FfiType.UInt16,
299
+ hasRustCallStatus: false
300
+ },
301
+ uniffi_dbx_tools_google_checksum_method_googleauth_force_refresh_token: {
302
+ args: [],
303
+ ret: FfiType.UInt16,
304
+ hasRustCallStatus: false
305
+ },
306
+ uniffi_dbx_tools_google_checksum_method_googleauth_logout: {
307
+ args: [],
308
+ ret: FfiType.UInt16,
309
+ hasRustCallStatus: false
310
+ },
311
+ uniffi_dbx_tools_google_checksum_method_googleauth_refresh_rejected_token: {
312
+ args: [],
313
+ ret: FfiType.UInt16,
314
+ hasRustCallStatus: false
315
+ },
316
+ uniffi_dbx_tools_google_checksum_method_googleauth_status: {
317
+ args: [],
318
+ ret: FfiType.UInt16,
319
+ hasRustCallStatus: false
320
+ },
321
+ uniffi_dbx_tools_google_checksum_method_googleauth_token: {
322
+ args: [],
323
+ ret: FfiType.UInt16,
324
+ hasRustCallStatus: false
325
+ }
326
+ },
327
+ callbacks: {
328
+ RustFutureContinuationCallback: {
329
+ args: [FfiType.Handle, FfiType.Int8],
330
+ ret: FfiType.Void,
331
+ hasRustCallStatus: false
332
+ },
333
+ ForeignFutureDroppedCallback: {
334
+ args: [FfiType.Handle],
335
+ ret: FfiType.Void,
336
+ hasRustCallStatus: false
337
+ }
338
+ },
339
+ structs: {
340
+ ForeignFutureDroppedCallbackStruct: [
341
+ { name: "handle", type: FfiType.Handle },
342
+ { name: "free", type: FfiType.Callback("ForeignFutureDroppedCallback") }
343
+ ]
344
+ }
345
+ };
346
+ var _nativeModule;
347
+ var getter = () => {
348
+ if (!_nativeModule) {
349
+ const libPath = resolveLibPath({
350
+ crateName: "dbx_tools_google",
351
+ callerUrl: import.meta.url,
352
+ npmPackageBase: "@dbx-tools/google-rs-",
353
+ tripleStyle: "node"
354
+ });
355
+ const mod_ = UniffiNativeModule.open(libPath);
356
+ _nativeModule = mod_.register(DEFINITIONS);
357
+ }
358
+ return _nativeModule;
359
+ };
360
+ var _bindings_ffi_default = getter;
361
+
362
+ // src/_bindings.ts
363
+ import {
364
+ AbstractFfiConverterByteArray,
365
+ FfiConverterObject,
366
+ FfiConverterOptional,
367
+ FfiConverterUInt64,
368
+ UniffiAbstractObject,
369
+ UniffiInternalError,
370
+ UniffiRustCaller,
371
+ destructorGuardSymbol,
372
+ pointerLiteralSymbol,
373
+ uniffiCreateFfiConverterString,
374
+ uniffiCreateRecord,
375
+ uniffiRustCallAsync,
376
+ uniffiTypeNameSymbol
377
+ } from "@ubjs/core";
378
+ import { uniffiModule as uniffiDbxToolsCoreModule } from "@dbx-tools/core-rs";
379
+ var { FfiConverterTypeAccessToken, FfiConverterTypeAuthError, FfiConverterTypeAuthOptions } = uniffiDbxToolsCoreModule.converters;
380
+ var uniffiCaller = new UniffiRustCaller(() => ({ code: 0 }));
381
+ var uniffiIsDebug = typeof process !== "object" || process?.env?.NODE_ENV !== "production" || false;
382
+ async function createGoogleAuth(options, asyncOpts_) {
383
+ const __stack = uniffiIsDebug ? new Error().stack : undefined;
384
+ try {
385
+ return await uniffiRustCallAsync(uniffiCaller, () => {
386
+ return _bindings_ffi_default().uniffi_dbx_tools_google_fn_func_create_google_auth(FfiConverterTypeGoogleAuthOptions.lower(options, _bindings_ffi_default().rustbuffer_alloc));
387
+ }, _bindings_ffi_default().ffi_dbx_tools_google_rust_future_poll_u64, _bindings_ffi_default().ffi_dbx_tools_google_rust_future_cancel_u64, _bindings_ffi_default().ffi_dbx_tools_google_rust_future_complete_u64, _bindings_ffi_default().ffi_dbx_tools_google_rust_future_free_u64, FfiConverterTypeGoogleAuth.lift.bind(FfiConverterTypeGoogleAuth), FfiConverterString.lift.bind(FfiConverterString), asyncOpts_, FfiConverterTypeAuthError.lift.bind(FfiConverterTypeAuthError));
388
+ } catch (__error) {
389
+ if (uniffiIsDebug && __error instanceof Error) {
390
+ __error.stack = __stack;
391
+ }
392
+ throw __error;
393
+ }
394
+ }
395
+ var GoogleAuthOptions = (() => {
396
+ const defaults = () => ({
397
+ auth: undefined,
398
+ accessTokenTtlSeconds: BigInt("3600")
399
+ });
400
+ const create = (() => {
401
+ return uniffiCreateRecord(defaults);
402
+ })();
403
+ return Object.freeze({
404
+ create,
405
+ new: create,
406
+ defaults: () => Object.freeze(defaults())
407
+ });
408
+ })();
409
+ var FfiConverterTypeGoogleAuthOptions = (() => {
410
+
411
+ class FFIConverter extends AbstractFfiConverterByteArray {
412
+ readFromCursor(c) {
413
+ return {
414
+ auth: FfiConverterOptionalTypeAuthOptions.readFromCursor(c),
415
+ accessTokenTtlSeconds: FfiConverterUInt64.readFromCursor(c)
416
+ };
417
+ }
418
+ writeIntoCursor(value, c) {
419
+ FfiConverterOptionalTypeAuthOptions.writeIntoCursor(value.auth, c);
420
+ FfiConverterUInt64.writeIntoCursor(value.accessTokenTtlSeconds, c);
421
+ }
422
+ allocationSize(value) {
423
+ return FfiConverterOptionalTypeAuthOptions.allocationSize(value.auth) + FfiConverterUInt64.allocationSize(value.accessTokenTtlSeconds);
424
+ }
425
+ }
426
+ return new FFIConverter;
427
+ })();
428
+ var stringConverter = (() => {
429
+ const encoder = new TextEncoder;
430
+ const decoder = new TextDecoder;
431
+ return {
432
+ stringToBytes: (s) => encoder.encode(s),
433
+ bytesToString: (ab) => decoder.decode(ab),
434
+ stringByteLength: (s) => encoder.encode(s).byteLength,
435
+ writeStringIntoBuffer: (s, buf, offset) => {
436
+ const view = new Uint8Array(buf.arrayBuffer, offset, buf.arrayBuffer.byteLength - offset);
437
+ return encoder.encodeInto(s, view).written;
438
+ },
439
+ readStringFromBuffer: (buf, offset, length) => decoder.decode(new Uint8Array(buf.arrayBuffer, offset, length))
440
+ };
441
+ })();
442
+ var FfiConverterString = uniffiCreateFfiConverterString(stringConverter);
443
+ var GoogleAuthStatus = (() => {
444
+ const defaults = () => ({});
445
+ const create = (() => {
446
+ return uniffiCreateRecord(defaults);
447
+ })();
448
+ return Object.freeze({
449
+ create,
450
+ new: create,
451
+ defaults: () => Object.freeze(defaults())
452
+ });
453
+ })();
454
+ var FfiConverterTypeGoogleAuthStatus = (() => {
455
+
456
+ class FFIConverter extends AbstractFfiConverterByteArray {
457
+ readFromCursor(c) {
458
+ return {
459
+ credentialsPath: FfiConverterOptionalString.readFromCursor(c),
460
+ storage: FfiConverterString.readFromCursor(c)
461
+ };
462
+ }
463
+ writeIntoCursor(value, c) {
464
+ FfiConverterOptionalString.writeIntoCursor(value.credentialsPath, c);
465
+ FfiConverterString.writeIntoCursor(value.storage, c);
466
+ }
467
+ allocationSize(value) {
468
+ return FfiConverterOptionalString.allocationSize(value.credentialsPath) + FfiConverterString.allocationSize(value.storage);
469
+ }
470
+ }
471
+ return new FFIConverter;
472
+ })();
473
+
474
+ class GoogleAuth extends UniffiAbstractObject {
475
+ [uniffiTypeNameSymbol] = "GoogleAuth";
476
+ [destructorGuardSymbol];
477
+ [pointerLiteralSymbol];
478
+ constructor(pointer) {
479
+ super();
480
+ this[pointerLiteralSymbol] = pointer;
481
+ this[destructorGuardSymbol] = uniffiTypeGoogleAuthObjectFactory.bless(pointer);
482
+ }
483
+ async forceRefreshToken(asyncOpts_) {
484
+ const __stack = uniffiIsDebug ? new Error().stack : undefined;
485
+ try {
486
+ return await uniffiRustCallAsync(uniffiCaller, () => {
487
+ return _bindings_ffi_default().uniffi_dbx_tools_google_fn_method_googleauth_force_refresh_token(uniffiTypeGoogleAuthObjectFactory.clonePointer(this));
488
+ }, _bindings_ffi_default().ffi_dbx_tools_google_rust_future_poll_rust_buffer, _bindings_ffi_default().ffi_dbx_tools_google_rust_future_cancel_rust_buffer, _bindings_ffi_default().ffi_dbx_tools_google_rust_future_complete_rust_buffer, _bindings_ffi_default().ffi_dbx_tools_google_rust_future_free_rust_buffer, (__rb) => {
489
+ try {
490
+ return FfiConverterTypeAccessToken.lift(__rb);
491
+ } finally {
492
+ _bindings_ffi_default().rustbuffer_free(__rb);
493
+ }
494
+ }, FfiConverterString.lift.bind(FfiConverterString), asyncOpts_, FfiConverterTypeAuthError.lift.bind(FfiConverterTypeAuthError));
495
+ } catch (__error) {
496
+ if (uniffiIsDebug && __error instanceof Error) {
497
+ __error.stack = __stack;
498
+ }
499
+ throw __error;
500
+ }
501
+ }
502
+ async logout(asyncOpts_) {
503
+ const __stack = uniffiIsDebug ? new Error().stack : undefined;
504
+ try {
505
+ return await uniffiRustCallAsync(uniffiCaller, () => {
506
+ return _bindings_ffi_default().uniffi_dbx_tools_google_fn_method_googleauth_logout(uniffiTypeGoogleAuthObjectFactory.clonePointer(this));
507
+ }, _bindings_ffi_default().ffi_dbx_tools_google_rust_future_poll_void, _bindings_ffi_default().ffi_dbx_tools_google_rust_future_cancel_void, _bindings_ffi_default().ffi_dbx_tools_google_rust_future_complete_void, _bindings_ffi_default().ffi_dbx_tools_google_rust_future_free_void, (_v) => {}, FfiConverterString.lift.bind(FfiConverterString), asyncOpts_, FfiConverterTypeAuthError.lift.bind(FfiConverterTypeAuthError));
508
+ } catch (__error) {
509
+ if (uniffiIsDebug && __error instanceof Error) {
510
+ __error.stack = __stack;
511
+ }
512
+ throw __error;
513
+ }
514
+ }
515
+ async refreshRejectedToken(staleAccessToken, asyncOpts_) {
516
+ const __stack = uniffiIsDebug ? new Error().stack : undefined;
517
+ try {
518
+ return await uniffiRustCallAsync(uniffiCaller, () => {
519
+ return _bindings_ffi_default().uniffi_dbx_tools_google_fn_method_googleauth_refresh_rejected_token(uniffiTypeGoogleAuthObjectFactory.clonePointer(this), FfiConverterString.lower(staleAccessToken, _bindings_ffi_default().rustbuffer_alloc));
520
+ }, _bindings_ffi_default().ffi_dbx_tools_google_rust_future_poll_rust_buffer, _bindings_ffi_default().ffi_dbx_tools_google_rust_future_cancel_rust_buffer, _bindings_ffi_default().ffi_dbx_tools_google_rust_future_complete_rust_buffer, _bindings_ffi_default().ffi_dbx_tools_google_rust_future_free_rust_buffer, (__rb) => {
521
+ try {
522
+ return FfiConverterTypeAccessToken.lift(__rb);
523
+ } finally {
524
+ _bindings_ffi_default().rustbuffer_free(__rb);
525
+ }
526
+ }, FfiConverterString.lift.bind(FfiConverterString), asyncOpts_, FfiConverterTypeAuthError.lift.bind(FfiConverterTypeAuthError));
527
+ } catch (__error) {
528
+ if (uniffiIsDebug && __error instanceof Error) {
529
+ __error.stack = __stack;
530
+ }
531
+ throw __error;
532
+ }
533
+ }
534
+ status() {
535
+ const __rb = uniffiCaller.rustCall((callStatus) => {
536
+ return _bindings_ffi_default().uniffi_dbx_tools_google_fn_method_googleauth_status(uniffiTypeGoogleAuthObjectFactory.clonePointer(this), callStatus);
537
+ }, FfiConverterString.lift.bind(FfiConverterString));
538
+ try {
539
+ return FfiConverterTypeGoogleAuthStatus.lift(__rb);
540
+ } finally {
541
+ _bindings_ffi_default().rustbuffer_free(__rb);
542
+ }
543
+ }
544
+ async token(asyncOpts_) {
545
+ const __stack = uniffiIsDebug ? new Error().stack : undefined;
546
+ try {
547
+ return await uniffiRustCallAsync(uniffiCaller, () => {
548
+ return _bindings_ffi_default().uniffi_dbx_tools_google_fn_method_googleauth_token(uniffiTypeGoogleAuthObjectFactory.clonePointer(this));
549
+ }, _bindings_ffi_default().ffi_dbx_tools_google_rust_future_poll_rust_buffer, _bindings_ffi_default().ffi_dbx_tools_google_rust_future_cancel_rust_buffer, _bindings_ffi_default().ffi_dbx_tools_google_rust_future_complete_rust_buffer, _bindings_ffi_default().ffi_dbx_tools_google_rust_future_free_rust_buffer, (__rb) => {
550
+ try {
551
+ return FfiConverterTypeAccessToken.lift(__rb);
552
+ } finally {
553
+ _bindings_ffi_default().rustbuffer_free(__rb);
554
+ }
555
+ }, FfiConverterString.lift.bind(FfiConverterString), asyncOpts_, FfiConverterTypeAuthError.lift.bind(FfiConverterTypeAuthError));
556
+ } catch (__error) {
557
+ if (uniffiIsDebug && __error instanceof Error) {
558
+ __error.stack = __stack;
559
+ }
560
+ throw __error;
561
+ }
562
+ }
563
+ uniffiDestroy() {
564
+ const ptr = this[destructorGuardSymbol];
565
+ if (ptr !== undefined) {
566
+ const pointer = uniffiTypeGoogleAuthObjectFactory.pointer(this);
567
+ uniffiTypeGoogleAuthObjectFactory.freePointer(pointer);
568
+ uniffiTypeGoogleAuthObjectFactory.unbless(ptr);
569
+ delete this[destructorGuardSymbol];
570
+ }
571
+ }
572
+ static instanceOf(obj_) {
573
+ return uniffiTypeGoogleAuthObjectFactory.isConcreteType(obj_);
574
+ }
575
+ }
576
+ var uniffiTypeGoogleAuthObjectFactory = (() => {
577
+ const registry = typeof FinalizationRegistry !== "undefined" ? new FinalizationRegistry((heldValue) => {
578
+ uniffiTypeGoogleAuthObjectFactory.freePointer(heldValue);
579
+ }) : null;
580
+ return {
581
+ create(pointer) {
582
+ const instance = Object.create(GoogleAuth.prototype);
583
+ instance[pointerLiteralSymbol] = pointer;
584
+ instance[destructorGuardSymbol] = this.bless(pointer);
585
+ instance[uniffiTypeNameSymbol] = "GoogleAuth";
586
+ return instance;
587
+ },
588
+ bless(p) {
589
+ const ptr = {
590
+ p,
591
+ markDestroyed: () => {
592
+ return;
593
+ }
594
+ };
595
+ if (registry) {
596
+ registry.register(ptr, p, ptr);
597
+ }
598
+ return ptr;
599
+ },
600
+ unbless(ptr_) {
601
+ if (registry) {
602
+ registry.unregister(ptr_);
603
+ }
604
+ },
605
+ pointer(obj_) {
606
+ if (obj_[destructorGuardSymbol] === undefined) {
607
+ throw new UniffiInternalError.UnexpectedNullPointer;
608
+ }
609
+ return obj_[pointerLiteralSymbol];
610
+ },
611
+ clonePointer(obj_) {
612
+ const pointer = this.pointer(obj_);
613
+ return uniffiCaller.rustCall((callStatus) => _bindings_ffi_default().uniffi_dbx_tools_google_fn_clone_googleauth(pointer, callStatus), FfiConverterString.lift);
614
+ },
615
+ freePointer(pointer) {
616
+ uniffiCaller.rustCall((callStatus) => _bindings_ffi_default().uniffi_dbx_tools_google_fn_free_googleauth(pointer, callStatus), FfiConverterString.lift);
617
+ },
618
+ isConcreteType(obj_) {
619
+ return obj_[destructorGuardSymbol] && obj_[uniffiTypeNameSymbol] === "GoogleAuth";
620
+ }
621
+ };
622
+ })();
623
+ var FfiConverterTypeGoogleAuth = new FfiConverterObject(uniffiTypeGoogleAuthObjectFactory);
624
+ var FfiConverterOptionalTypeAuthOptions = new FfiConverterOptional(FfiConverterTypeAuthOptions);
625
+ var FfiConverterOptionalString = new FfiConverterOptional(FfiConverterString);
626
+ function uniffiEnsureInitialized() {
627
+ const bindingsContractVersion = 30;
628
+ const scaffoldingContractVersion = _bindings_ffi_default().ffi_dbx_tools_google_uniffi_contract_version();
629
+ if (bindingsContractVersion !== scaffoldingContractVersion) {
630
+ throw new UniffiInternalError.ContractVersionMismatch(scaffoldingContractVersion, bindingsContractVersion);
631
+ }
632
+ if (_bindings_ffi_default().uniffi_dbx_tools_google_checksum_func_create_google_auth() !== 8482) {
633
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_dbx_tools_google_checksum_func_create_google_auth");
634
+ }
635
+ if (_bindings_ffi_default().uniffi_dbx_tools_google_checksum_method_googleauth_force_refresh_token() !== 40538) {
636
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_dbx_tools_google_checksum_method_googleauth_force_refresh_token");
637
+ }
638
+ if (_bindings_ffi_default().uniffi_dbx_tools_google_checksum_method_googleauth_logout() !== 28220) {
639
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_dbx_tools_google_checksum_method_googleauth_logout");
640
+ }
641
+ if (_bindings_ffi_default().uniffi_dbx_tools_google_checksum_method_googleauth_refresh_rejected_token() !== 56472) {
642
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_dbx_tools_google_checksum_method_googleauth_refresh_rejected_token");
643
+ }
644
+ if (_bindings_ffi_default().uniffi_dbx_tools_google_checksum_method_googleauth_status() !== 21388) {
645
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_dbx_tools_google_checksum_method_googleauth_status");
646
+ }
647
+ if (_bindings_ffi_default().uniffi_dbx_tools_google_checksum_method_googleauth_token() !== 20454) {
648
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_dbx_tools_google_checksum_method_googleauth_token");
649
+ }
650
+ }
651
+ var _bindings_default = Object.freeze({
652
+ initialize: uniffiEnsureInitialized,
653
+ converters: {
654
+ FfiConverterTypeGoogleAuth,
655
+ FfiConverterTypeGoogleAuthOptions,
656
+ FfiConverterTypeGoogleAuthStatus
657
+ }
658
+ });
659
+ // src/bindings.ts
660
+ _bindings_default.initialize();
661
+ async function uniffiInitAsync() {}
662
+
663
+ // index.ts
664
+ var PACKAGE_IDENTIFIER = "@dbx-tools/google-rs";
665
+ var PACKAGE_VERSION = "0.6.188";
666
+ export {
667
+ _bindings_default as uniffiModule,
668
+ uniffiInitAsync,
669
+ createGoogleAuth,
670
+ PACKAGE_VERSION,
671
+ PACKAGE_IDENTIFIER,
672
+ GoogleAuthStatus,
673
+ GoogleAuthOptions,
674
+ GoogleAuth
675
+ };