@bitwarden/sdk-internal 0.2.0-main.157 → 0.2.0-main.158

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/VERSION CHANGED
@@ -1 +1 @@
1
- 6a9ca8ce0d1559c52dacd21225c32528dedabf44
1
+ 6e9768b88baec149ab5713b291d9965b9e53aa09
@@ -435,11 +435,16 @@ export type Endpoint =
435
435
  | "DesktopRenderer"
436
436
  | "DesktopMain";
437
437
 
438
- export interface CommunicationBackend {
438
+ export interface IpcCommunicationBackendSender {
439
439
  send(message: OutgoingMessage): Promise<void>;
440
- receive(): Promise<IncomingMessage>;
441
440
  }
442
441
 
442
+ export interface ChannelError extends Error {
443
+ name: "ChannelError";
444
+ }
445
+
446
+ export function isChannelError(error: any): error is ChannelError;
447
+
443
448
  export interface DeserializeError extends Error {
444
449
  name: "DeserializeError";
445
450
  }
@@ -1122,9 +1127,21 @@ export class IncomingMessage {
1122
1127
  }
1123
1128
  export class IpcClient {
1124
1129
  free(): void;
1125
- constructor(communication_provider: CommunicationBackend);
1130
+ constructor(communication_provider: IpcCommunicationBackend);
1126
1131
  send(message: OutgoingMessage): Promise<void>;
1127
- receive(): Promise<IncomingMessage>;
1132
+ subscribe(): Promise<IpcClientSubscription>;
1133
+ }
1134
+ export class IpcClientSubscription {
1135
+ private constructor();
1136
+ free(): void;
1137
+ }
1138
+ export class IpcCommunicationBackend {
1139
+ free(): void;
1140
+ constructor(sender: IpcCommunicationBackendSender);
1141
+ /**
1142
+ * JavaScript function to provide a received message to the backend/IPC framework.
1143
+ */
1144
+ deliver_message(message: IncomingMessage): void;
1128
1145
  }
1129
1146
  export class OutgoingMessage {
1130
1147
  free(): void;
@@ -347,6 +347,19 @@ function _assertClass(instance, klass) {
347
347
  throw new Error(`expected instance of ${klass.name}`);
348
348
  }
349
349
  }
350
+ /**
351
+ * @param {any} error
352
+ * @returns {boolean}
353
+ */
354
+ export function isChannelError(error) {
355
+ try {
356
+ const ret = wasm.isChannelError(addBorrowedObject(error));
357
+ return ret !== 0;
358
+ } finally {
359
+ heap[stack_pointer++] = undefined;
360
+ }
361
+ }
362
+
350
363
  /**
351
364
  * @param {any} error
352
365
  * @returns {boolean}
@@ -587,7 +600,7 @@ function __wbg_adapter_53(arg0, arg1, arg2) {
587
600
  );
588
601
  }
589
602
 
590
- function __wbg_adapter_233(arg0, arg1, arg2, arg3) {
603
+ function __wbg_adapter_232(arg0, arg1, arg2, arg3) {
591
604
  wasm.wasm_bindgen__convert__closures__invoke2_mut__h2a33b0877ef96682(
592
605
  arg0,
593
606
  arg1,
@@ -1553,14 +1566,6 @@ const IncomingMessageFinalization =
1553
1566
  : new FinalizationRegistry((ptr) => wasm.__wbg_incomingmessage_free(ptr >>> 0, 1));
1554
1567
 
1555
1568
  export class IncomingMessage {
1556
- static __wrap(ptr) {
1557
- ptr = ptr >>> 0;
1558
- const obj = Object.create(IncomingMessage.prototype);
1559
- obj.__wbg_ptr = ptr;
1560
- IncomingMessageFinalization.register(obj, obj.__wbg_ptr, obj);
1561
- return obj;
1562
- }
1563
-
1564
1569
  __destroy_into_raw() {
1565
1570
  const ptr = this.__wbg_ptr;
1566
1571
  this.__wbg_ptr = 0;
@@ -1704,10 +1709,12 @@ export class IpcClient {
1704
1709
  wasm.__wbg_ipcclient_free(ptr, 0);
1705
1710
  }
1706
1711
  /**
1707
- * @param {CommunicationBackend} communication_provider
1712
+ * @param {IpcCommunicationBackend} communication_provider
1708
1713
  */
1709
1714
  constructor(communication_provider) {
1710
- const ret = wasm.ipcclient_new(addHeapObject(communication_provider));
1715
+ _assertClass(communication_provider, IpcCommunicationBackend);
1716
+ var ptr0 = communication_provider.__destroy_into_raw();
1717
+ const ret = wasm.ipcclient_new(ptr0);
1711
1718
  this.__wbg_ptr = ret >>> 0;
1712
1719
  IpcClientFinalization.register(this, this.__wbg_ptr, this);
1713
1720
  return this;
@@ -1723,14 +1730,88 @@ export class IpcClient {
1723
1730
  return takeObject(ret);
1724
1731
  }
1725
1732
  /**
1726
- * @returns {Promise<IncomingMessage>}
1733
+ * @returns {Promise<IpcClientSubscription>}
1727
1734
  */
1728
- receive() {
1729
- const ret = wasm.ipcclient_receive(this.__wbg_ptr);
1735
+ subscribe() {
1736
+ const ret = wasm.ipcclient_subscribe(this.__wbg_ptr);
1730
1737
  return takeObject(ret);
1731
1738
  }
1732
1739
  }
1733
1740
 
1741
+ const IpcClientSubscriptionFinalization =
1742
+ typeof FinalizationRegistry === "undefined"
1743
+ ? { register: () => {}, unregister: () => {} }
1744
+ : new FinalizationRegistry((ptr) => wasm.__wbg_ipcclientsubscription_free(ptr >>> 0, 1));
1745
+
1746
+ export class IpcClientSubscription {
1747
+ static __wrap(ptr) {
1748
+ ptr = ptr >>> 0;
1749
+ const obj = Object.create(IpcClientSubscription.prototype);
1750
+ obj.__wbg_ptr = ptr;
1751
+ IpcClientSubscriptionFinalization.register(obj, obj.__wbg_ptr, obj);
1752
+ return obj;
1753
+ }
1754
+
1755
+ __destroy_into_raw() {
1756
+ const ptr = this.__wbg_ptr;
1757
+ this.__wbg_ptr = 0;
1758
+ IpcClientSubscriptionFinalization.unregister(this);
1759
+ return ptr;
1760
+ }
1761
+
1762
+ free() {
1763
+ const ptr = this.__destroy_into_raw();
1764
+ wasm.__wbg_ipcclientsubscription_free(ptr, 0);
1765
+ }
1766
+ }
1767
+
1768
+ const IpcCommunicationBackendFinalization =
1769
+ typeof FinalizationRegistry === "undefined"
1770
+ ? { register: () => {}, unregister: () => {} }
1771
+ : new FinalizationRegistry((ptr) => wasm.__wbg_ipccommunicationbackend_free(ptr >>> 0, 1));
1772
+
1773
+ export class IpcCommunicationBackend {
1774
+ __destroy_into_raw() {
1775
+ const ptr = this.__wbg_ptr;
1776
+ this.__wbg_ptr = 0;
1777
+ IpcCommunicationBackendFinalization.unregister(this);
1778
+ return ptr;
1779
+ }
1780
+
1781
+ free() {
1782
+ const ptr = this.__destroy_into_raw();
1783
+ wasm.__wbg_ipccommunicationbackend_free(ptr, 0);
1784
+ }
1785
+ /**
1786
+ * @param {IpcCommunicationBackendSender} sender
1787
+ */
1788
+ constructor(sender) {
1789
+ const ret = wasm.ipccommunicationbackend_new(addHeapObject(sender));
1790
+ this.__wbg_ptr = ret >>> 0;
1791
+ IpcCommunicationBackendFinalization.register(this, this.__wbg_ptr, this);
1792
+ return this;
1793
+ }
1794
+ /**
1795
+ * JavaScript function to provide a received message to the backend/IPC framework.
1796
+ * @param {IncomingMessage} message
1797
+ */
1798
+ deliver_message(message) {
1799
+ try {
1800
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1801
+ _assertClass(message, IncomingMessage);
1802
+ var ptr0 = message.__destroy_into_raw();
1803
+ wasm.ipccommunicationbackend_deliver_message(retptr, this.__wbg_ptr, ptr0);
1804
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1805
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1806
+ if (r1) {
1807
+ throw takeObject(r0);
1808
+ }
1809
+ } finally {
1810
+ wasm.__wbindgen_add_to_stack_pointer(16);
1811
+ }
1812
+ }
1813
+ }
1814
+
1734
1815
  const OutgoingMessageFinalization =
1735
1816
  typeof FinalizationRegistry === "undefined"
1736
1817
  ? { register: () => {}, unregister: () => {} }
@@ -2052,14 +2133,6 @@ const ReceiveErrorFinalization =
2052
2133
  : new FinalizationRegistry((ptr) => wasm.__wbg_receiveerror_free(ptr >>> 0, 1));
2053
2134
 
2054
2135
  export class ReceiveError {
2055
- static __wrap(ptr) {
2056
- ptr = ptr >>> 0;
2057
- const obj = Object.create(ReceiveError.prototype);
2058
- obj.__wbg_ptr = ptr;
2059
- ReceiveErrorFinalization.register(obj, obj.__wbg_ptr, obj);
2060
- return obj;
2061
- }
2062
-
2063
2136
  __destroy_into_raw() {
2064
2137
  const ptr = this.__wbg_ptr;
2065
2138
  this.__wbg_ptr = 0;
@@ -2447,11 +2520,6 @@ export function __wbg_headers_9cb51cfd2ac780a4(arg0) {
2447
2520
  return addHeapObject(ret);
2448
2521
  }
2449
2522
 
2450
- export function __wbg_incomingmessage_new(arg0) {
2451
- const ret = IncomingMessage.__wrap(arg0);
2452
- return addHeapObject(ret);
2453
- }
2454
-
2455
2523
  export function __wbg_info_033d8b8a0838f1d3(arg0, arg1, arg2, arg3) {
2456
2524
  console.info(getObject(arg0), getObject(arg1), getObject(arg2), getObject(arg3));
2457
2525
  }
@@ -2500,6 +2568,11 @@ export function __wbg_instanceof_Uint8Array_17156bcf118086a9(arg0) {
2500
2568
  return ret;
2501
2569
  }
2502
2570
 
2571
+ export function __wbg_ipcclientsubscription_new(arg0) {
2572
+ const ret = IpcClientSubscription.__wrap(arg0);
2573
+ return addHeapObject(ret);
2574
+ }
2575
+
2503
2576
  export function __wbg_isArray_a1eab7e0d067391b(arg0) {
2504
2577
  const ret = Array.isArray(getObject(arg0));
2505
2578
  return ret;
@@ -2553,7 +2626,7 @@ export function __wbg_new_23a2665fac83c611(arg0, arg1) {
2553
2626
  const a = state0.a;
2554
2627
  state0.a = 0;
2555
2628
  try {
2556
- return __wbg_adapter_233(a, state0.b, arg0, arg1);
2629
+ return __wbg_adapter_232(a, state0.b, arg0, arg1);
2557
2630
  } finally {
2558
2631
  state0.a = a;
2559
2632
  }
@@ -2695,18 +2768,6 @@ export function __wbg_randomFillSync_ac0988aba3254290() {
2695
2768
  }, arguments);
2696
2769
  }
2697
2770
 
2698
- export function __wbg_receive_9512d555fb8b5130() {
2699
- return handleError(function (arg0) {
2700
- const ret = getObject(arg0).receive();
2701
- return addHeapObject(ret);
2702
- }, arguments);
2703
- }
2704
-
2705
- export function __wbg_receiveerror_new(arg0) {
2706
- const ret = ReceiveError.__wrap(arg0);
2707
- return addHeapObject(ret);
2708
- }
2709
-
2710
2771
  export function __wbg_require_60cc747a6bc5215a() {
2711
2772
  return handleError(function () {
2712
2773
  const ret = module.require;
@@ -2719,7 +2780,7 @@ export function __wbg_resolve_4851785c9c5f573d(arg0) {
2719
2780
  return addHeapObject(ret);
2720
2781
  }
2721
2782
 
2722
- export function __wbg_send_c9eacaae08065b18() {
2783
+ export function __wbg_send_9b8fc6bb517867dd() {
2723
2784
  return handleError(function (arg0, arg1) {
2724
2785
  const ret = getObject(arg0).send(OutgoingMessage.__wrap(arg1));
2725
2786
  return addHeapObject(ret);
@@ -2927,13 +2988,13 @@ export function __wbindgen_cb_drop(arg0) {
2927
2988
  return ret;
2928
2989
  }
2929
2990
 
2930
- export function __wbindgen_closure_wrapper2851(arg0, arg1, arg2) {
2931
- const ret = makeMutClosure(arg0, arg1, 662, __wbg_adapter_50);
2991
+ export function __wbindgen_closure_wrapper2861(arg0, arg1, arg2) {
2992
+ const ret = makeMutClosure(arg0, arg1, 658, __wbg_adapter_50);
2932
2993
  return addHeapObject(ret);
2933
2994
  }
2934
2995
 
2935
- export function __wbindgen_closure_wrapper3236(arg0, arg1, arg2) {
2936
- const ret = makeMutClosure(arg0, arg1, 783, __wbg_adapter_53);
2996
+ export function __wbindgen_closure_wrapper3246(arg0, arg1, arg2) {
2997
+ const ret = makeMutClosure(arg0, arg1, 779, __wbg_adapter_53);
2937
2998
  return addHeapObject(ret);
2938
2999
  }
2939
3000
 
Binary file
@@ -47,6 +47,9 @@ export const __wbg_get_incomingmessage_source: (a: number) => number;
47
47
  export const __wbg_set_incomingmessage_source: (a: number, b: number) => void;
48
48
  export const __wbg_get_incomingmessage_topic: (a: number, b: number) => void;
49
49
  export const __wbg_set_incomingmessage_topic: (a: number, b: number, c: number) => void;
50
+ export const __wbg_ipccommunicationbackend_free: (a: number, b: number) => void;
51
+ export const ipccommunicationbackend_new: (a: number) => number;
52
+ export const ipccommunicationbackend_deliver_message: (a: number, b: number, c: number) => void;
50
53
  export const __wbg_senderror_free: (a: number, b: number) => void;
51
54
  export const __wbg_receiveerror_free: (a: number, b: number) => void;
52
55
  export const __wbg_get_receiveerror_timeout: (a: number) => number;
@@ -56,9 +59,10 @@ export const __wbg_set_receiveerror_crypto: (a: number, b: number) => void;
56
59
  export const __wbg_get_receiveerror_communication: (a: number) => number;
57
60
  export const __wbg_set_receiveerror_communication: (a: number, b: number) => void;
58
61
  export const __wbg_ipcclient_free: (a: number, b: number) => void;
62
+ export const __wbg_ipcclientsubscription_free: (a: number, b: number) => void;
59
63
  export const ipcclient_new: (a: number) => number;
60
64
  export const ipcclient_send: (a: number, b: number) => number;
61
- export const ipcclient_receive: (a: number) => number;
65
+ export const ipcclient_subscribe: (a: number) => number;
62
66
  export const outgoingmessage_new: (a: number, b: number, c: number, d: number, e: number) => number;
63
67
  export const outgoingmessage_new_json_payload: (
64
68
  a: number,
@@ -76,6 +80,7 @@ export const incomingmessage_new: (
76
80
  f: number,
77
81
  ) => number;
78
82
  export const incomingmessage_parse_payload_as_json: (a: number) => number;
83
+ export const isChannelError: (a: number) => number;
79
84
  export const isDeserializeError: (a: number) => number;
80
85
  export const __wbg_set_senderror_crypto: (a: number, b: number) => void;
81
86
  export const __wbg_set_senderror_communication: (a: number, b: number) => void;