@icure/api 6.0.0 → 6.0.2

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.
@@ -15,7 +15,9 @@ class KeyStorageImpl {
15
15
  this._storage = storage;
16
16
  }
17
17
  deleteKeypair(key) {
18
- return this._storage.deleteItem(key);
18
+ return __awaiter(this, void 0, void 0, function* () {
19
+ return yield this._storage.removeItem(key);
20
+ });
19
21
  }
20
22
  getKeypair(key) {
21
23
  var _a;
@@ -1 +1 @@
1
- {"version":3,"file":"KeyStorageImpl.js","sourceRoot":"","sources":["../../../icc-x-api/storage/KeyStorageImpl.ts"],"names":[],"mappings":";;;;;;;;;;;;AAGA,MAAa,cAAc;IAGzB,YAAY,OAA8B;QACxC,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAA;IACzB,CAAC;IAED,aAAa,CAAC,GAAW;QACvB,OAAO,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,GAAG,CAAC,CAAA;IACtC,CAAC;IAEK,UAAU,CAAC,GAAW;;;YAC1B,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,MAAA,CAAC,MAAM,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,mCAAI,IAAI,CAAC,CAAA;YACtE,OAAO,OAAO,CAAC,cAAc,CAAC,WAAW,CAAC,IAAI,OAAO,CAAC,cAAc,CAAC,YAAY,CAAC;gBAChF,CAAC,CAAC;oBACE,SAAS,EAAE,OAAO,CAAC,SAAuB;oBAC1C,UAAU,EAAE,OAAO,CAAC,UAAwB;iBAC7C;gBACH,CAAC,CAAC,SAAS,CAAA;;KACd;IAEK,aAAa,CAAC,GAAW;;;YAC7B,OAAO,MAAA,CAAC,MAAM,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,0CAAE,UAAU,CAAA;;KAChD;IAEK,YAAY,CAAC,GAAW;;;YAC5B,OAAO,MAAA,CAAC,MAAM,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,0CAAE,SAAS,CAAA;;KAC/C;IAEK,YAAY,CAAC,GAAW,EAAE,OAA0D;;YACxF,OAAO,MAAM,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAA;QAClE,CAAC;KAAA;CACF;AAhCD,wCAgCC","sourcesContent":["import { StorageFacade } from './StorageFacade'\nimport { KeyStorageFacade } from './KeyStorageFacade'\n\nexport class KeyStorageImpl implements KeyStorageFacade {\n private readonly _storage: StorageFacade<string>\n\n constructor(storage: StorageFacade<string>) {\n this._storage = storage\n }\n\n deleteKeypair(key: string): Promise<void> {\n return this._storage.deleteItem(key)\n }\n\n async getKeypair(key: string): Promise<{ publicKey: JsonWebKey; privateKey: JsonWebKey } | undefined> {\n const keyPair = JSON.parse((await this._storage.getItem(key)) ?? '{}')\n return keyPair.hasOwnProperty('publicKey') && keyPair.hasOwnProperty('privateKey')\n ? {\n publicKey: keyPair.publicKey as JsonWebKey,\n privateKey: keyPair.privateKey as JsonWebKey,\n }\n : undefined\n }\n\n async getPrivateKey(key: string): Promise<JsonWebKey | undefined> {\n return (await this.getKeypair(key))?.privateKey\n }\n\n async getPublicKey(key: string): Promise<JsonWebKey | undefined> {\n return (await this.getKeypair(key))?.publicKey\n }\n\n async storeKeyPair(key: string, keyPair: { publicKey: JsonWebKey; privateKey: JsonWebKey }): Promise<void> {\n return await this._storage.setItem(key, JSON.stringify(keyPair))\n }\n}\n"]}
1
+ {"version":3,"file":"KeyStorageImpl.js","sourceRoot":"","sources":["../../../icc-x-api/storage/KeyStorageImpl.ts"],"names":[],"mappings":";;;;;;;;;;;;AAGA,MAAa,cAAc;IAGzB,YAAY,OAA8B;QACxC,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAA;IACzB,CAAC;IAEK,aAAa,CAAC,GAAW;;YAC7B,OAAO,MAAM,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,GAAG,CAAC,CAAA;QAC5C,CAAC;KAAA;IAEK,UAAU,CAAC,GAAW;;;YAC1B,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,MAAA,CAAC,MAAM,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,mCAAI,IAAI,CAAC,CAAA;YACtE,OAAO,OAAO,CAAC,cAAc,CAAC,WAAW,CAAC,IAAI,OAAO,CAAC,cAAc,CAAC,YAAY,CAAC;gBAChF,CAAC,CAAC;oBACE,SAAS,EAAE,OAAO,CAAC,SAAuB;oBAC1C,UAAU,EAAE,OAAO,CAAC,UAAwB;iBAC7C;gBACH,CAAC,CAAC,SAAS,CAAA;;KACd;IAEK,aAAa,CAAC,GAAW;;;YAC7B,OAAO,MAAA,CAAC,MAAM,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,0CAAE,UAAU,CAAA;;KAChD;IAEK,YAAY,CAAC,GAAW;;;YAC5B,OAAO,MAAA,CAAC,MAAM,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,0CAAE,SAAS,CAAA;;KAC/C;IAEK,YAAY,CAAC,GAAW,EAAE,OAA0D;;YACxF,OAAO,MAAM,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAA;QAClE,CAAC;KAAA;CACF;AAhCD,wCAgCC","sourcesContent":["import { StorageFacade } from './StorageFacade'\nimport { KeyStorageFacade } from './KeyStorageFacade'\n\nexport class KeyStorageImpl implements KeyStorageFacade {\n private readonly _storage: StorageFacade<string>\n\n constructor(storage: StorageFacade<string>) {\n this._storage = storage\n }\n\n async deleteKeypair(key: string): Promise<void> {\n return await this._storage.removeItem(key)\n }\n\n async getKeypair(key: string): Promise<{ publicKey: JsonWebKey; privateKey: JsonWebKey } | undefined> {\n const keyPair = JSON.parse((await this._storage.getItem(key)) ?? '{}')\n return keyPair.hasOwnProperty('publicKey') && keyPair.hasOwnProperty('privateKey')\n ? {\n publicKey: keyPair.publicKey as JsonWebKey,\n privateKey: keyPair.privateKey as JsonWebKey,\n }\n : undefined\n }\n\n async getPrivateKey(key: string): Promise<JsonWebKey | undefined> {\n return (await this.getKeypair(key))?.privateKey\n }\n\n async getPublicKey(key: string): Promise<JsonWebKey | undefined> {\n return (await this.getKeypair(key))?.publicKey\n }\n\n async storeKeyPair(key: string, keyPair: { publicKey: JsonWebKey; privateKey: JsonWebKey }): Promise<void> {\n return await this._storage.setItem(key, JSON.stringify(keyPair))\n }\n}\n"]}
@@ -1,6 +1,6 @@
1
1
  import { StorageFacade } from './StorageFacade';
2
2
  export declare class LocalStorageImpl implements StorageFacade<string> {
3
3
  getItem(key: string): Promise<string | undefined>;
4
- deleteItem(key: string): Promise<void>;
4
+ removeItem(key: string): Promise<void>;
5
5
  setItem(key: string, valueToStore: string): Promise<void>;
6
6
  }
@@ -14,11 +14,19 @@ class LocalStorageImpl {
14
14
  getItem(key) {
15
15
  var _a;
16
16
  return __awaiter(this, void 0, void 0, function* () {
17
+ if (typeof Storage === 'undefined') {
18
+ console.error('Your browser does not support HTML5 Browser Local Storage !');
19
+ throw new Error('Your browser does not support HTML5 Browser Local Storage !');
20
+ }
17
21
  return (_a = localStorage.getItem(key)) !== null && _a !== void 0 ? _a : undefined;
18
22
  });
19
23
  }
20
- deleteItem(key) {
24
+ removeItem(key) {
21
25
  return __awaiter(this, void 0, void 0, function* () {
26
+ if (typeof Storage === 'undefined') {
27
+ console.error('Your browser does not support HTML5 Browser Local Storage !');
28
+ throw new Error('Your browser does not support HTML5 Browser Local Storage !');
29
+ }
22
30
  return localStorage.removeItem(key);
23
31
  });
24
32
  }
@@ -26,7 +34,7 @@ class LocalStorageImpl {
26
34
  return __awaiter(this, void 0, void 0, function* () {
27
35
  if (typeof Storage === 'undefined') {
28
36
  console.error('Your browser does not support HTML5 Browser Local Storage !');
29
- throw 'Your browser does not support HTML5 Browser Local Storage !';
37
+ throw new Error('Your browser does not support HTML5 Browser Local Storage !');
30
38
  }
31
39
  return localStorage.setItem(key, valueToStore);
32
40
  });
@@ -1 +1 @@
1
- {"version":3,"file":"LocalStorageImpl.js","sourceRoot":"","sources":["../../../icc-x-api/storage/LocalStorageImpl.ts"],"names":[],"mappings":";;;;;;;;;;;;AAEA,MAAa,gBAAgB;IACrB,OAAO,CAAC,GAAW;;;YACvB,OAAO,MAAA,YAAY,CAAC,OAAO,CAAC,GAAG,CAAC,mCAAI,SAAS,CAAA;;KAC9C;IAEK,UAAU,CAAC,GAAW;;YAC1B,OAAO,YAAY,CAAC,UAAU,CAAC,GAAG,CAAC,CAAA;QACrC,CAAC;KAAA;IAEK,OAAO,CAAC,GAAW,EAAE,YAAoB;;YAC7C,IAAI,OAAO,OAAO,KAAK,WAAW,EAAE;gBAClC,OAAO,CAAC,KAAK,CAAC,6DAA6D,CAAC,CAAA;gBAC5E,MAAM,6DAA6D,CAAA;aACpE;YACD,OAAO,YAAY,CAAC,OAAO,CAAC,GAAG,EAAE,YAAY,CAAC,CAAA;QAChD,CAAC;KAAA;CACF;AAhBD,4CAgBC","sourcesContent":["import { StorageFacade } from './StorageFacade'\n\nexport class LocalStorageImpl implements StorageFacade<string> {\n async getItem(key: string): Promise<string | undefined> {\n return localStorage.getItem(key) ?? undefined\n }\n\n async deleteItem(key: string): Promise<void> {\n return localStorage.removeItem(key)\n }\n\n async setItem(key: string, valueToStore: string): Promise<void> {\n if (typeof Storage === 'undefined') {\n console.error('Your browser does not support HTML5 Browser Local Storage !')\n throw 'Your browser does not support HTML5 Browser Local Storage !'\n }\n return localStorage.setItem(key, valueToStore)\n }\n}\n"]}
1
+ {"version":3,"file":"LocalStorageImpl.js","sourceRoot":"","sources":["../../../icc-x-api/storage/LocalStorageImpl.ts"],"names":[],"mappings":";;;;;;;;;;;;AAEA,MAAa,gBAAgB;IACrB,OAAO,CAAC,GAAW;;;YACvB,IAAI,OAAO,OAAO,KAAK,WAAW,EAAE;gBAClC,OAAO,CAAC,KAAK,CAAC,6DAA6D,CAAC,CAAA;gBAC5E,MAAM,IAAI,KAAK,CAAC,6DAA6D,CAAC,CAAA;aAC/E;YACD,OAAO,MAAA,YAAY,CAAC,OAAO,CAAC,GAAG,CAAC,mCAAI,SAAS,CAAA;;KAC9C;IAEK,UAAU,CAAC,GAAW;;YAC1B,IAAI,OAAO,OAAO,KAAK,WAAW,EAAE;gBAClC,OAAO,CAAC,KAAK,CAAC,6DAA6D,CAAC,CAAA;gBAC5E,MAAM,IAAI,KAAK,CAAC,6DAA6D,CAAC,CAAA;aAC/E;YACD,OAAO,YAAY,CAAC,UAAU,CAAC,GAAG,CAAC,CAAA;QACrC,CAAC;KAAA;IAEK,OAAO,CAAC,GAAW,EAAE,YAAoB;;YAC7C,IAAI,OAAO,OAAO,KAAK,WAAW,EAAE;gBAClC,OAAO,CAAC,KAAK,CAAC,6DAA6D,CAAC,CAAA;gBAC5E,MAAM,IAAI,KAAK,CAAC,6DAA6D,CAAC,CAAA;aAC/E;YACD,OAAO,YAAY,CAAC,OAAO,CAAC,GAAG,EAAE,YAAY,CAAC,CAAA;QAChD,CAAC;KAAA;CACF;AAxBD,4CAwBC","sourcesContent":["import { StorageFacade } from './StorageFacade'\n\nexport class LocalStorageImpl implements StorageFacade<string> {\n async getItem(key: string): Promise<string | undefined> {\n if (typeof Storage === 'undefined') {\n console.error('Your browser does not support HTML5 Browser Local Storage !')\n throw new Error('Your browser does not support HTML5 Browser Local Storage !')\n }\n return localStorage.getItem(key) ?? undefined\n }\n\n async removeItem(key: string): Promise<void> {\n if (typeof Storage === 'undefined') {\n console.error('Your browser does not support HTML5 Browser Local Storage !')\n throw new Error('Your browser does not support HTML5 Browser Local Storage !')\n }\n return localStorage.removeItem(key)\n }\n\n async setItem(key: string, valueToStore: string): Promise<void> {\n if (typeof Storage === 'undefined') {\n console.error('Your browser does not support HTML5 Browser Local Storage !')\n throw new Error('Your browser does not support HTML5 Browser Local Storage !')\n }\n return localStorage.setItem(key, valueToStore)\n }\n}\n"]}
@@ -15,5 +15,5 @@ export interface StorageFacade<T> {
15
15
  * Removes the item with the given key from the storage.
16
16
  * @param key The key of the item to remove.
17
17
  */
18
- deleteItem(key: string): Promise<void>;
18
+ removeItem(key: string): Promise<void>;
19
19
  }
@@ -1 +1 @@
1
- {"version":3,"file":"StorageFacade.js","sourceRoot":"","sources":["../../../icc-x-api/storage/StorageFacade.ts"],"names":[],"mappings":"","sourcesContent":["export interface StorageFacade<T> {\n /**\n * Returns the value of the provided key from the storage\n * @param key Key of the value to retrieve\n * @return The value associated to the provided key or null if not found.\n */\n getItem(key: string): Promise<T | undefined>\n\n /**\n * Set an item in the storage for the given key\n * @param key Key of the value to set\n * @param valueToStore\n */\n setItem(key: string, valueToStore: T): Promise<void>\n\n /**\n * Removes the item with the given key from the storage.\n * @param key The key of the item to remove.\n */\n deleteItem(key: string): Promise<void>\n}\n"]}
1
+ {"version":3,"file":"StorageFacade.js","sourceRoot":"","sources":["../../../icc-x-api/storage/StorageFacade.ts"],"names":[],"mappings":"","sourcesContent":["export interface StorageFacade<T> {\n /**\n * Returns the value of the provided key from the storage\n * @param key Key of the value to retrieve\n * @return The value associated to the provided key or null if not found.\n */\n getItem(key: string): Promise<T | undefined>\n\n /**\n * Set an item in the storage for the given key\n * @param key Key of the value to set\n * @param valueToStore\n */\n setItem(key: string, valueToStore: T): Promise<void>\n\n /**\n * Removes the item with the given key from the storage.\n * @param key The key of the item to remove.\n */\n removeItem(key: string): Promise<void>\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@icure/api",
3
- "version": "6.0.0",
3
+ "version": "6.0.2",
4
4
  "description": "Typescript version of iCure standalone API client",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",