@tapni/auth 0.0.118 → 0.0.119

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tapni/auth",
3
- "version": "0.0.118",
3
+ "version": "0.0.119",
4
4
  "type": "module",
5
5
  "main": "./dist/TapniAuth.umd.js",
6
6
  "module": "./dist/TapniAuth.es.js",
@@ -1,54 +0,0 @@
1
- import { WebPlugin as p } from "@capacitor/core";
2
- class f extends p {
3
- constructor() {
4
- super(...arguments), this.group = "CapacitorStorage";
5
- }
6
- async configure({ group: e }) {
7
- typeof e == "string" && (this.group = e);
8
- }
9
- async get(e) {
10
- return { value: this.impl.getItem(this.applyPrefix(e.key)) };
11
- }
12
- async set(e) {
13
- this.impl.setItem(this.applyPrefix(e.key), e.value);
14
- }
15
- async remove(e) {
16
- this.impl.removeItem(this.applyPrefix(e.key));
17
- }
18
- async keys() {
19
- return { keys: this.rawKeys().map((t) => t.substring(this.prefix.length)) };
20
- }
21
- async clear() {
22
- for (const e of this.rawKeys())
23
- this.impl.removeItem(e);
24
- }
25
- async migrate() {
26
- var e;
27
- const t = [], s = [], n = "_cap_", o = Object.keys(this.impl).filter((i) => i.indexOf(n) === 0);
28
- for (const i of o) {
29
- const r = i.substring(n.length), a = (e = this.impl.getItem(i)) !== null && e !== void 0 ? e : "", { value: l } = await this.get({ key: r });
30
- typeof l == "string" ? s.push(r) : (await this.set({ key: r, value: a }), t.push(r));
31
- }
32
- return { migrated: t, existing: s };
33
- }
34
- async removeOld() {
35
- const e = "_cap_", t = Object.keys(this.impl).filter((s) => s.indexOf(e) === 0);
36
- for (const s of t)
37
- this.impl.removeItem(s);
38
- }
39
- get impl() {
40
- return window.localStorage;
41
- }
42
- get prefix() {
43
- return this.group === "NativeStorage" ? "" : `${this.group}.`;
44
- }
45
- rawKeys() {
46
- return Object.keys(this.impl).filter((e) => e.indexOf(this.prefix) === 0);
47
- }
48
- applyPrefix(e) {
49
- return this.prefix + e;
50
- }
51
- }
52
- export {
53
- f as PreferencesWeb
54
- };