@bitwarden/sdk-internal 0.2.0-main.212 → 0.2.0-main.213

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.
@@ -1,5 +1,20 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
+ /**
4
+ * Registers a DiscoverHandler so that the client can respond to DiscoverRequests.
5
+ */
6
+ export function ipcRegisterDiscoverHandler(
7
+ ipc_client: IpcClient,
8
+ response: DiscoverResponse,
9
+ ): Promise<void>;
10
+ /**
11
+ * Sends a DiscoverRequest to the specified destination and returns the response.
12
+ */
13
+ export function ipcRequestDiscover(
14
+ ipc_client: IpcClient,
15
+ destination: Endpoint,
16
+ abort_signal?: AbortSignal | null,
17
+ ): Promise<DiscoverResponse>;
3
18
  export function set_log_level(level: LogLevel): void;
4
19
  export function init_sdk(log_level?: LogLevel | null): void;
5
20
  /**
@@ -575,6 +590,10 @@ export interface PassphraseError extends Error {
575
590
 
576
591
  export function isPassphraseError(error: any): error is PassphraseError;
577
592
 
593
+ export interface DiscoverResponse {
594
+ version: string;
595
+ }
596
+
578
597
  export type Endpoint =
579
598
  | { Web: { id: number } }
580
599
  | "BrowserForeground"
@@ -598,6 +617,13 @@ export interface DeserializeError extends Error {
598
617
 
599
618
  export function isDeserializeError(error: any): error is DeserializeError;
600
619
 
620
+ export interface RequestError extends Error {
621
+ name: "RequestError";
622
+ variant: "Subscribe" | "Receive" | "Timeout" | "Send" | "RpcError";
623
+ }
624
+
625
+ export function isRequestError(error: any): error is RequestError;
626
+
601
627
  export interface TypedReceiveError extends Error {
602
628
  name: "TypedReceiveError";
603
629
  variant: "Channel" | "Timeout" | "Cancelled" | "Typing";
@@ -1364,7 +1390,7 @@ export class IpcClient {
1364
1390
  export class IpcClientSubscription {
1365
1391
  private constructor();
1366
1392
  free(): void;
1367
- receive(abort_signal?: any | null): Promise<IncomingMessage>;
1393
+ receive(abort_signal?: AbortSignal | null): Promise<IncomingMessage>;
1368
1394
  }
1369
1395
  /**
1370
1396
  * JavaScript implementation of the `CommunicationBackend` trait for IPC communication.
@@ -393,6 +393,35 @@ function _assertClass(instance, klass) {
393
393
  throw new Error(`expected instance of ${klass.name}`);
394
394
  }
395
395
  }
396
+ /**
397
+ * Registers a DiscoverHandler so that the client can respond to DiscoverRequests.
398
+ * @param {IpcClient} ipc_client
399
+ * @param {DiscoverResponse} response
400
+ * @returns {Promise<void>}
401
+ */
402
+ module.exports.ipcRegisterDiscoverHandler = function (ipc_client, response) {
403
+ _assertClass(ipc_client, IpcClient);
404
+ const ret = wasm.ipcRegisterDiscoverHandler(ipc_client.__wbg_ptr, addHeapObject(response));
405
+ return takeObject(ret);
406
+ };
407
+
408
+ /**
409
+ * Sends a DiscoverRequest to the specified destination and returns the response.
410
+ * @param {IpcClient} ipc_client
411
+ * @param {Endpoint} destination
412
+ * @param {AbortSignal | null} [abort_signal]
413
+ * @returns {Promise<DiscoverResponse>}
414
+ */
415
+ module.exports.ipcRequestDiscover = function (ipc_client, destination, abort_signal) {
416
+ _assertClass(ipc_client, IpcClient);
417
+ const ret = wasm.ipcRequestDiscover(
418
+ ipc_client.__wbg_ptr,
419
+ addHeapObject(destination),
420
+ isLikeNone(abort_signal) ? 0 : addHeapObject(abort_signal),
421
+ );
422
+ return takeObject(ret);
423
+ };
424
+
396
425
  /**
397
426
  * @param {any} error
398
427
  * @returns {boolean}
@@ -419,6 +448,19 @@ module.exports.isDeserializeError = function (error) {
419
448
  }
420
449
  };
421
450
 
451
+ /**
452
+ * @param {any} error
453
+ * @returns {boolean}
454
+ */
455
+ module.exports.isRequestError = function (error) {
456
+ try {
457
+ const ret = wasm.isRequestError(addBorrowedObject(error));
458
+ return ret !== 0;
459
+ } finally {
460
+ heap[stack_pointer++] = undefined;
461
+ }
462
+ };
463
+
422
464
  /**
423
465
  * @param {any} error
424
466
  * @returns {boolean}
@@ -705,7 +747,7 @@ function __wbg_adapter_56(arg0, arg1, arg2) {
705
747
  );
706
748
  }
707
749
 
708
- function __wbg_adapter_271(arg0, arg1, arg2, arg3) {
750
+ function __wbg_adapter_274(arg0, arg1, arg2, arg3) {
709
751
  wasm.wasm_bindgen__convert__closures__invoke2_mut__h8776500d04a3e634(
710
752
  arg0,
711
753
  arg1,
@@ -1987,7 +2029,7 @@ class IpcClientSubscription {
1987
2029
  wasm.__wbg_ipcclientsubscription_free(ptr, 0);
1988
2030
  }
1989
2031
  /**
1990
- * @param {any | null} [abort_signal]
2032
+ * @param {AbortSignal | null} [abort_signal]
1991
2033
  * @returns {Promise<IncomingMessage>}
1992
2034
  */
1993
2035
  receive(abort_signal) {
@@ -3289,7 +3331,7 @@ module.exports.__wbg_get_b9b93047fe3cf45b = function (arg0, arg1) {
3289
3331
  return addHeapObject(ret);
3290
3332
  };
3291
3333
 
3292
- module.exports.__wbg_get_f7bd93223b71a83e = function () {
3334
+ module.exports.__wbg_get_d80c1589d30c292a = function () {
3293
3335
  return handleError(function (arg0, arg1, arg2) {
3294
3336
  let deferred0_0;
3295
3337
  let deferred0_1;
@@ -3404,7 +3446,7 @@ module.exports.__wbg_length_e2d2a49132c1b256 = function (arg0) {
3404
3446
  return ret;
3405
3447
  };
3406
3448
 
3407
- module.exports.__wbg_list_a632257712ef903a = function () {
3449
+ module.exports.__wbg_list_d11c20983c361f70 = function () {
3408
3450
  return handleError(function (arg0) {
3409
3451
  const ret = getObject(arg0).list();
3410
3452
  return addHeapObject(ret);
@@ -3439,7 +3481,7 @@ module.exports.__wbg_new_23a2665fac83c611 = function (arg0, arg1) {
3439
3481
  const a = state0.a;
3440
3482
  state0.a = 0;
3441
3483
  try {
3442
- return __wbg_adapter_271(a, state0.b, arg0, arg1);
3484
+ return __wbg_adapter_274(a, state0.b, arg0, arg1);
3443
3485
  } finally {
3444
3486
  state0.a = a;
3445
3487
  }
@@ -3581,7 +3623,7 @@ module.exports.__wbg_randomFillSync_ac0988aba3254290 = function () {
3581
3623
  }, arguments);
3582
3624
  };
3583
3625
 
3584
- module.exports.__wbg_remove_bb1b975ea93b448a = function () {
3626
+ module.exports.__wbg_remove_212f779b207179b5 = function () {
3585
3627
  return handleError(function (arg0, arg1, arg2) {
3586
3628
  let deferred0_0;
3587
3629
  let deferred0_1;
@@ -3628,7 +3670,11 @@ module.exports.__wbg_set_3f1d0b984ed272ed = function (arg0, arg1, arg2) {
3628
3670
  getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
3629
3671
  };
3630
3672
 
3631
- module.exports.__wbg_set_581efd75a64cfdb7 = function () {
3673
+ module.exports.__wbg_set_65595bdd868b3009 = function (arg0, arg1, arg2) {
3674
+ getObject(arg0).set(getObject(arg1), arg2 >>> 0);
3675
+ };
3676
+
3677
+ module.exports.__wbg_set_7f4f0ad9ebd5a35e = function () {
3632
3678
  return handleError(function (arg0, arg1, arg2, arg3) {
3633
3679
  let deferred0_0;
3634
3680
  let deferred0_1;
@@ -3643,10 +3689,6 @@ module.exports.__wbg_set_581efd75a64cfdb7 = function () {
3643
3689
  }, arguments);
3644
3690
  };
3645
3691
 
3646
- module.exports.__wbg_set_65595bdd868b3009 = function (arg0, arg1, arg2) {
3647
- getObject(arg0).set(getObject(arg1), arg2 >>> 0);
3648
- };
3649
-
3650
3692
  module.exports.__wbg_setbody_5923b78a95eedf29 = function (arg0, arg1) {
3651
3693
  getObject(arg0).body = getObject(arg1);
3652
3694
  };
@@ -3826,18 +3868,18 @@ module.exports.__wbindgen_cb_drop = function (arg0) {
3826
3868
  return ret;
3827
3869
  };
3828
3870
 
3829
- module.exports.__wbindgen_closure_wrapper2654 = function (arg0, arg1, arg2) {
3830
- const ret = makeMutClosure(arg0, arg1, 795, __wbg_adapter_50);
3871
+ module.exports.__wbindgen_closure_wrapper2827 = function (arg0, arg1, arg2) {
3872
+ const ret = makeMutClosure(arg0, arg1, 904, __wbg_adapter_50);
3831
3873
  return addHeapObject(ret);
3832
3874
  };
3833
3875
 
3834
- module.exports.__wbindgen_closure_wrapper3494 = function (arg0, arg1, arg2) {
3835
- const ret = makeMutClosure(arg0, arg1, 879, __wbg_adapter_53);
3876
+ module.exports.__wbindgen_closure_wrapper3667 = function (arg0, arg1, arg2) {
3877
+ const ret = makeMutClosure(arg0, arg1, 988, __wbg_adapter_53);
3836
3878
  return addHeapObject(ret);
3837
3879
  };
3838
3880
 
3839
- module.exports.__wbindgen_closure_wrapper3907 = function (arg0, arg1, arg2) {
3840
- const ret = makeMutClosure(arg0, arg1, 1002, __wbg_adapter_56);
3881
+ module.exports.__wbindgen_closure_wrapper4085 = function (arg0, arg1, arg2) {
3882
+ const ret = makeMutClosure(arg0, arg1, 1111, __wbg_adapter_56);
3841
3883
  return addHeapObject(ret);
3842
3884
  };
3843
3885
 
@@ -63,6 +63,8 @@ export const __wbg_set_incomingmessage_topic: (a: number, b: number, c: number)
63
63
  export const __wbg_ipccommunicationbackend_free: (a: number, b: number) => void;
64
64
  export const ipccommunicationbackend_new: (a: number) => number;
65
65
  export const ipccommunicationbackend_receive: (a: number, b: number, c: number) => void;
66
+ export const ipcRegisterDiscoverHandler: (a: number, b: number) => number;
67
+ export const ipcRequestDiscover: (a: number, b: number, c: number) => number;
66
68
  export const __wbg_ipcclient_free: (a: number, b: number) => void;
67
69
  export const __wbg_ipcclientsubscription_free: (a: number, b: number) => void;
68
70
  export const ipcclientsubscription_receive: (a: number, b: number) => number;
@@ -90,6 +92,7 @@ export const incomingmessage_new: (
90
92
  export const incomingmessage_parse_payload_as_json: (a: number) => number;
91
93
  export const isChannelError: (a: number) => number;
92
94
  export const isDeserializeError: (a: number) => number;
95
+ export const isRequestError: (a: number) => number;
93
96
  export const isTypedReceiveError: (a: number) => number;
94
97
  export const isReceiveError: (a: number) => number;
95
98
  export const isSubscribeError: (a: number) => number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bitwarden/sdk-internal",
3
- "version": "0.2.0-main.212",
3
+ "version": "0.2.0-main.213",
4
4
  "license": "GPL-3.0",
5
5
  "files": [
6
6
  "bitwarden_wasm_internal_bg.js",