@bitwarden/sdk-internal 0.2.0-main.231 → 0.2.0-main.232

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.
@@ -998,6 +998,16 @@ export interface SecureNoteView {
998
998
  type: SecureNoteType;
999
999
  }
1000
1000
 
1001
+ /**
1002
+ * Request to add or edit a folder.
1003
+ */
1004
+ export interface FolderAddEditRequest {
1005
+ /**
1006
+ * The new name of the folder.
1007
+ */
1008
+ name: string;
1009
+ }
1010
+
1001
1011
  export interface Folder {
1002
1012
  id: Uuid | undefined;
1003
1013
  name: EncString;
@@ -1052,6 +1062,34 @@ export interface PasswordHistory {
1052
1062
  lastUsedDate: DateTime<Utc>;
1053
1063
  }
1054
1064
 
1065
+ export interface GetFolderError extends Error {
1066
+ name: "GetFolderError";
1067
+ variant: "ItemNotFound" | "Crypto" | "RepositoryError";
1068
+ }
1069
+
1070
+ export function isGetFolderError(error: any): error is GetFolderError;
1071
+
1072
+ export interface EditFolderError extends Error {
1073
+ name: "EditFolderError";
1074
+ variant:
1075
+ | "ItemNotFound"
1076
+ | "Crypto"
1077
+ | "Api"
1078
+ | "VaultParse"
1079
+ | "MissingField"
1080
+ | "RepositoryError"
1081
+ | "Uuid";
1082
+ }
1083
+
1084
+ export function isEditFolderError(error: any): error is EditFolderError;
1085
+
1086
+ export interface CreateFolderError extends Error {
1087
+ name: "CreateFolderError";
1088
+ variant: "Crypto" | "Api" | "VaultParse" | "MissingField" | "RepositoryError";
1089
+ }
1090
+
1091
+ export function isCreateFolderError(error: any): error is CreateFolderError;
1092
+
1055
1093
  export interface Collection {
1056
1094
  id: Uuid | undefined;
1057
1095
  organizationId: Uuid;
@@ -1401,12 +1439,40 @@ export class ExporterClient {
1401
1439
  */
1402
1440
  import_cxf(payload: string): Cipher[];
1403
1441
  }
1442
+ /**
1443
+ * Wrapper for folder specific functionality.
1444
+ */
1404
1445
  export class FoldersClient {
1405
1446
  private constructor();
1406
1447
  free(): void;
1448
+ /**
1449
+ * Encrypt a [FolderView] to a [Folder].
1450
+ */
1407
1451
  encrypt(folder_view: FolderView): Folder;
1452
+ /**
1453
+ * Encrypt a [Folder] to [FolderView].
1454
+ */
1408
1455
  decrypt(folder: Folder): FolderView;
1456
+ /**
1457
+ * Decrypt a list of [Folder]s to a list of [FolderView]s.
1458
+ */
1409
1459
  decrypt_list(folders: Folder[]): FolderView[];
1460
+ /**
1461
+ * Get all folders from state and decrypt them to a list of [FolderView].
1462
+ */
1463
+ list(): Promise<FolderView[]>;
1464
+ /**
1465
+ * Get a specific [Folder] by its ID from state and decrypt it to a [FolderView].
1466
+ */
1467
+ get(folder_id: string): Promise<FolderView>;
1468
+ /**
1469
+ * Create a new [Folder] and save it to the server.
1470
+ */
1471
+ create(request: FolderAddEditRequest): Promise<FolderView>;
1472
+ /**
1473
+ * Edit the [Folder] and save it to the server.
1474
+ */
1475
+ edit(folder_id: string, request: FolderAddEditRequest): Promise<FolderView>;
1410
1476
  }
1411
1477
  export class GeneratorClient {
1412
1478
  private constructor();
@@ -1652,6 +1718,7 @@ export class StateClient {
1652
1718
  private constructor();
1653
1719
  free(): void;
1654
1720
  register_cipher_repository(store: Repository<Cipher>): void;
1721
+ register_folder_repository(store: Repository<Folder>): void;
1655
1722
  }
1656
1723
  export class TotpClient {
1657
1724
  private constructor();
@@ -604,6 +604,45 @@ module.exports.isTotpError = function (error) {
604
604
  }
605
605
  };
606
606
 
607
+ /**
608
+ * @param {any} error
609
+ * @returns {boolean}
610
+ */
611
+ module.exports.isGetFolderError = function (error) {
612
+ try {
613
+ const ret = wasm.isGetFolderError(addBorrowedObject(error));
614
+ return ret !== 0;
615
+ } finally {
616
+ heap[stack_pointer++] = undefined;
617
+ }
618
+ };
619
+
620
+ /**
621
+ * @param {any} error
622
+ * @returns {boolean}
623
+ */
624
+ module.exports.isEditFolderError = function (error) {
625
+ try {
626
+ const ret = wasm.isEditFolderError(addBorrowedObject(error));
627
+ return ret !== 0;
628
+ } finally {
629
+ heap[stack_pointer++] = undefined;
630
+ }
631
+ };
632
+
633
+ /**
634
+ * @param {any} error
635
+ * @returns {boolean}
636
+ */
637
+ module.exports.isCreateFolderError = function (error) {
638
+ try {
639
+ const ret = wasm.isCreateFolderError(addBorrowedObject(error));
640
+ return ret !== 0;
641
+ } finally {
642
+ heap[stack_pointer++] = undefined;
643
+ }
644
+ };
645
+
607
646
  /**
608
647
  * @param {any} error
609
648
  * @returns {boolean}
@@ -738,21 +777,21 @@ module.exports.isTestError = function (error) {
738
777
  }
739
778
  };
740
779
 
741
- function __wbg_adapter_50(arg0, arg1) {
780
+ function __wbg_adapter_54(arg0, arg1) {
742
781
  wasm._dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h31333524c3115e44(
743
782
  arg0,
744
783
  arg1,
745
784
  );
746
785
  }
747
786
 
748
- function __wbg_adapter_53(arg0, arg1) {
787
+ function __wbg_adapter_57(arg0, arg1) {
749
788
  wasm._dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h2b093e5f83b42fbd(
750
789
  arg0,
751
790
  arg1,
752
791
  );
753
792
  }
754
793
 
755
- function __wbg_adapter_56(arg0, arg1, arg2) {
794
+ function __wbg_adapter_60(arg0, arg1, arg2) {
756
795
  wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__hb01d8be1001e4f40(
757
796
  arg0,
758
797
  arg1,
@@ -760,7 +799,7 @@ function __wbg_adapter_56(arg0, arg1, arg2) {
760
799
  );
761
800
  }
762
801
 
763
- function __wbg_adapter_281(arg0, arg1, arg2, arg3) {
802
+ function __wbg_adapter_301(arg0, arg1, arg2, arg3) {
764
803
  wasm.wasm_bindgen__convert__closures__invoke2_mut__h8776500d04a3e634(
765
804
  arg0,
766
805
  arg1,
@@ -1659,7 +1698,9 @@ const FoldersClientFinalization =
1659
1698
  typeof FinalizationRegistry === "undefined"
1660
1699
  ? { register: () => {}, unregister: () => {} }
1661
1700
  : new FinalizationRegistry((ptr) => wasm.__wbg_foldersclient_free(ptr >>> 0, 1));
1662
-
1701
+ /**
1702
+ * Wrapper for folder specific functionality.
1703
+ */
1663
1704
  class FoldersClient {
1664
1705
  static __wrap(ptr) {
1665
1706
  ptr = ptr >>> 0;
@@ -1681,6 +1722,7 @@ class FoldersClient {
1681
1722
  wasm.__wbg_foldersclient_free(ptr, 0);
1682
1723
  }
1683
1724
  /**
1725
+ * Encrypt a [FolderView] to a [Folder].
1684
1726
  * @param {FolderView} folder_view
1685
1727
  * @returns {Folder}
1686
1728
  */
@@ -1700,6 +1742,7 @@ class FoldersClient {
1700
1742
  }
1701
1743
  }
1702
1744
  /**
1745
+ * Encrypt a [Folder] to [FolderView].
1703
1746
  * @param {Folder} folder
1704
1747
  * @returns {FolderView}
1705
1748
  */
@@ -1719,6 +1762,7 @@ class FoldersClient {
1719
1762
  }
1720
1763
  }
1721
1764
  /**
1765
+ * Decrypt a list of [Folder]s to a list of [FolderView]s.
1722
1766
  * @param {Folder[]} folders
1723
1767
  * @returns {FolderView[]}
1724
1768
  */
@@ -1742,6 +1786,46 @@ class FoldersClient {
1742
1786
  wasm.__wbindgen_add_to_stack_pointer(16);
1743
1787
  }
1744
1788
  }
1789
+ /**
1790
+ * Get all folders from state and decrypt them to a list of [FolderView].
1791
+ * @returns {Promise<FolderView[]>}
1792
+ */
1793
+ list() {
1794
+ const ret = wasm.foldersclient_list(this.__wbg_ptr);
1795
+ return takeObject(ret);
1796
+ }
1797
+ /**
1798
+ * Get a specific [Folder] by its ID from state and decrypt it to a [FolderView].
1799
+ * @param {string} folder_id
1800
+ * @returns {Promise<FolderView>}
1801
+ */
1802
+ get(folder_id) {
1803
+ const ptr0 = passStringToWasm0(folder_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1804
+ const len0 = WASM_VECTOR_LEN;
1805
+ const ret = wasm.foldersclient_get(this.__wbg_ptr, ptr0, len0);
1806
+ return takeObject(ret);
1807
+ }
1808
+ /**
1809
+ * Create a new [Folder] and save it to the server.
1810
+ * @param {FolderAddEditRequest} request
1811
+ * @returns {Promise<FolderView>}
1812
+ */
1813
+ create(request) {
1814
+ const ret = wasm.foldersclient_create(this.__wbg_ptr, addHeapObject(request));
1815
+ return takeObject(ret);
1816
+ }
1817
+ /**
1818
+ * Edit the [Folder] and save it to the server.
1819
+ * @param {string} folder_id
1820
+ * @param {FolderAddEditRequest} request
1821
+ * @returns {Promise<FolderView>}
1822
+ */
1823
+ edit(folder_id, request) {
1824
+ const ptr0 = passStringToWasm0(folder_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1825
+ const len0 = WASM_VECTOR_LEN;
1826
+ const ret = wasm.foldersclient_edit(this.__wbg_ptr, ptr0, len0, addHeapObject(request));
1827
+ return takeObject(ret);
1828
+ }
1745
1829
  }
1746
1830
  module.exports.FoldersClient = FoldersClient;
1747
1831
 
@@ -3168,6 +3252,12 @@ class StateClient {
3168
3252
  register_cipher_repository(store) {
3169
3253
  wasm.stateclient_register_cipher_repository(this.__wbg_ptr, addHeapObject(store));
3170
3254
  }
3255
+ /**
3256
+ * @param {Repository<Folder>} store
3257
+ */
3258
+ register_folder_repository(store) {
3259
+ wasm.stateclient_register_folder_repository(this.__wbg_ptr, addHeapObject(store));
3260
+ }
3171
3261
  }
3172
3262
  module.exports.StateClient = StateClient;
3173
3263
 
@@ -3430,7 +3520,7 @@ module.exports.__wbg_getTime_46267b1c24877e30 = function (arg0) {
3430
3520
  return ret;
3431
3521
  };
3432
3522
 
3433
- module.exports.__wbg_get_29fa07573edd0414 = function () {
3523
+ module.exports.__wbg_get_1620f903ed9a676f = function () {
3434
3524
  return handleError(function (arg0, arg1, arg2) {
3435
3525
  let deferred0_0;
3436
3526
  let deferred0_1;
@@ -3457,7 +3547,22 @@ module.exports.__wbg_get_b9b93047fe3cf45b = function (arg0, arg1) {
3457
3547
  return addHeapObject(ret);
3458
3548
  };
3459
3549
 
3460
- module.exports.__wbg_getaccesstoken_c1ea3be055452912 = function (arg0) {
3550
+ module.exports.__wbg_get_e94e796a5527c131 = function () {
3551
+ return handleError(function (arg0, arg1, arg2) {
3552
+ let deferred0_0;
3553
+ let deferred0_1;
3554
+ try {
3555
+ deferred0_0 = arg1;
3556
+ deferred0_1 = arg2;
3557
+ const ret = getObject(arg0).get(getStringFromWasm0(arg1, arg2));
3558
+ return addHeapObject(ret);
3559
+ } finally {
3560
+ wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
3561
+ }
3562
+ }, arguments);
3563
+ };
3564
+
3565
+ module.exports.__wbg_getaccesstoken_115c028df526c10b = function (arg0) {
3461
3566
  const ret = getObject(arg0).get_access_token();
3462
3567
  return addHeapObject(ret);
3463
3568
  };
@@ -3562,7 +3667,14 @@ module.exports.__wbg_length_e2d2a49132c1b256 = function (arg0) {
3562
3667
  return ret;
3563
3668
  };
3564
3669
 
3565
- module.exports.__wbg_list_b393427351b308b4 = function () {
3670
+ module.exports.__wbg_list_2a92e7addacc7a2d = function () {
3671
+ return handleError(function (arg0) {
3672
+ const ret = getObject(arg0).list();
3673
+ return addHeapObject(ret);
3674
+ }, arguments);
3675
+ };
3676
+
3677
+ module.exports.__wbg_list_6d9131c88a8d0a17 = function () {
3566
3678
  return handleError(function (arg0) {
3567
3679
  const ret = getObject(arg0).list();
3568
3680
  return addHeapObject(ret);
@@ -3597,7 +3709,7 @@ module.exports.__wbg_new_23a2665fac83c611 = function (arg0, arg1) {
3597
3709
  const a = state0.a;
3598
3710
  state0.a = 0;
3599
3711
  try {
3600
- return __wbg_adapter_281(a, state0.b, arg0, arg1);
3712
+ return __wbg_adapter_301(a, state0.b, arg0, arg1);
3601
3713
  } finally {
3602
3714
  state0.a = a;
3603
3715
  }
@@ -3739,7 +3851,22 @@ module.exports.__wbg_randomFillSync_ac0988aba3254290 = function () {
3739
3851
  }, arguments);
3740
3852
  };
3741
3853
 
3742
- module.exports.__wbg_remove_39bec51fb6464483 = function () {
3854
+ module.exports.__wbg_remove_050f4c22aba9e8c7 = function () {
3855
+ return handleError(function (arg0, arg1, arg2) {
3856
+ let deferred0_0;
3857
+ let deferred0_1;
3858
+ try {
3859
+ deferred0_0 = arg1;
3860
+ deferred0_1 = arg2;
3861
+ const ret = getObject(arg0).remove(getStringFromWasm0(arg1, arg2));
3862
+ return addHeapObject(ret);
3863
+ } finally {
3864
+ wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
3865
+ }
3866
+ }, arguments);
3867
+ };
3868
+
3869
+ module.exports.__wbg_remove_c9b8a1e5e4b15f5f = function () {
3743
3870
  return handleError(function (arg0, arg1, arg2) {
3744
3871
  let deferred0_0;
3745
3872
  let deferred0_1;
@@ -3790,7 +3917,22 @@ module.exports.__wbg_set_65595bdd868b3009 = function (arg0, arg1, arg2) {
3790
3917
  getObject(arg0).set(getObject(arg1), arg2 >>> 0);
3791
3918
  };
3792
3919
 
3793
- module.exports.__wbg_set_dac2905b348768e9 = function () {
3920
+ module.exports.__wbg_set_c0f7f01bcd881751 = function () {
3921
+ return handleError(function (arg0, arg1, arg2, arg3) {
3922
+ let deferred0_0;
3923
+ let deferred0_1;
3924
+ try {
3925
+ deferred0_0 = arg1;
3926
+ deferred0_1 = arg2;
3927
+ const ret = getObject(arg0).set(getStringFromWasm0(arg1, arg2), takeObject(arg3));
3928
+ return addHeapObject(ret);
3929
+ } finally {
3930
+ wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
3931
+ }
3932
+ }, arguments);
3933
+ };
3934
+
3935
+ module.exports.__wbg_set_f85eb67e00c0abef = function () {
3794
3936
  return handleError(function (arg0, arg1, arg2, arg3) {
3795
3937
  let deferred0_0;
3796
3938
  let deferred0_1;
@@ -3946,6 +4088,15 @@ module.exports.__wbg_warn_aaf1f4664a035bd6 = function (arg0, arg1, arg2, arg3) {
3946
4088
  console.warn(getObject(arg0), getObject(arg1), getObject(arg2), getObject(arg3));
3947
4089
  };
3948
4090
 
4091
+ module.exports.__wbindgen_array_new = function () {
4092
+ const ret = [];
4093
+ return addHeapObject(ret);
4094
+ };
4095
+
4096
+ module.exports.__wbindgen_array_push = function (arg0, arg1) {
4097
+ getObject(arg0).push(takeObject(arg1));
4098
+ };
4099
+
3949
4100
  module.exports.__wbindgen_as_number = function (arg0) {
3950
4101
  const ret = +getObject(arg0);
3951
4102
  return ret;
@@ -3984,18 +4135,18 @@ module.exports.__wbindgen_cb_drop = function (arg0) {
3984
4135
  return ret;
3985
4136
  };
3986
4137
 
3987
- module.exports.__wbindgen_closure_wrapper2952 = function (arg0, arg1, arg2) {
3988
- const ret = makeMutClosure(arg0, arg1, 928, __wbg_adapter_50);
4138
+ module.exports.__wbindgen_closure_wrapper3245 = function (arg0, arg1, arg2) {
4139
+ const ret = makeMutClosure(arg0, arg1, 1034, __wbg_adapter_54);
3989
4140
  return addHeapObject(ret);
3990
4141
  };
3991
4142
 
3992
- module.exports.__wbindgen_closure_wrapper3792 = function (arg0, arg1, arg2) {
3993
- const ret = makeMutClosure(arg0, arg1, 1012, __wbg_adapter_53);
4143
+ module.exports.__wbindgen_closure_wrapper4086 = function (arg0, arg1, arg2) {
4144
+ const ret = makeMutClosure(arg0, arg1, 1118, __wbg_adapter_57);
3994
4145
  return addHeapObject(ret);
3995
4146
  };
3996
4147
 
3997
- module.exports.__wbindgen_closure_wrapper4211 = function (arg0, arg1, arg2) {
3998
- const ret = makeMutClosure(arg0, arg1, 1134, __wbg_adapter_56);
4148
+ module.exports.__wbindgen_closure_wrapper4522 = function (arg0, arg1, arg2) {
4149
+ const ret = makeMutClosure(arg0, arg1, 1251, __wbg_adapter_60);
3999
4150
  return addHeapObject(ret);
4000
4151
  };
4001
4152
 
@@ -135,6 +135,10 @@ export const ciphersclient_decrypt_fido2_private_key: (a: number, b: number, c:
135
135
  export const foldersclient_encrypt: (a: number, b: number, c: number) => void;
136
136
  export const foldersclient_decrypt: (a: number, b: number, c: number) => void;
137
137
  export const foldersclient_decrypt_list: (a: number, b: number, c: number, d: number) => void;
138
+ export const foldersclient_list: (a: number) => number;
139
+ export const foldersclient_get: (a: number, b: number, c: number) => number;
140
+ export const foldersclient_create: (a: number, b: number) => number;
141
+ export const foldersclient_edit: (a: number, b: number, c: number, d: number) => number;
138
142
  export const vaultclient_attachments: (a: number) => number;
139
143
  export const totpclient_generate_totp: (
140
144
  a: number,
@@ -147,6 +151,9 @@ export const totpclient_generate_totp: (
147
151
  export const isDecryptError: (a: number) => number;
148
152
  export const isEncryptError: (a: number) => number;
149
153
  export const isTotpError: (a: number) => number;
154
+ export const isGetFolderError: (a: number) => number;
155
+ export const isEditFolderError: (a: number) => number;
156
+ export const isCreateFolderError: (a: number) => number;
150
157
  export const isCipherError: (a: number) => number;
151
158
  export const isDecryptFileError: (a: number) => number;
152
159
  export const isEncryptFileError: (a: number) => number;
@@ -168,6 +175,7 @@ export const bitwardenclient_platform: (a: number) => number;
168
175
  export const set_log_level: (a: number) => void;
169
176
  export const init_sdk: (a: number) => void;
170
177
  export const stateclient_register_cipher_repository: (a: number, b: number) => void;
178
+ export const stateclient_register_folder_repository: (a: number, b: number) => void;
171
179
  export const __wbg_purecrypto_free: (a: number, b: number) => void;
172
180
  export const purecrypto_symmetric_decrypt: (
173
181
  a: number,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bitwarden/sdk-internal",
3
- "version": "0.2.0-main.231",
3
+ "version": "0.2.0-main.232",
4
4
  "license": "GPL-3.0",
5
5
  "files": [
6
6
  "bitwarden_wasm_internal_bg.js",