@yuno-payments/sdk-event-log 0.3.0-beta.11 → 0.3.0-beta.12
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.
|
@@ -19,10 +19,11 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
19
19
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
20
20
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
21
21
|
};
|
|
22
|
-
var _LocalStorage_instances, _LocalStorage_localStorage, _LocalStorage_databaseName, _LocalStorage_getDatabase;
|
|
22
|
+
var _LocalStorage_instances, _LocalStorage_localStorage, _LocalStorage_databaseName, _LocalStorage_getDatabase, _LocalStorage_stringify;
|
|
23
23
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
24
|
exports.LocalStorage = void 0;
|
|
25
25
|
const DATABASE_NAME_SPACE = 'YUNO_EVENT_LOGS';
|
|
26
|
+
const DO_NOT_EXIST = -1;
|
|
26
27
|
class LocalStorage {
|
|
27
28
|
constructor(organizationName) {
|
|
28
29
|
_LocalStorage_instances.add(this);
|
|
@@ -47,7 +48,7 @@ class LocalStorage {
|
|
|
47
48
|
database[publicApiKey] = [];
|
|
48
49
|
}
|
|
49
50
|
database[publicApiKey].push(item);
|
|
50
|
-
__classPrivateFieldGet(this, _LocalStorage_localStorage, "f").setItem(__classPrivateFieldGet(this, _LocalStorage_databaseName, "f"),
|
|
51
|
+
__classPrivateFieldGet(this, _LocalStorage_localStorage, "f").setItem(__classPrivateFieldGet(this, _LocalStorage_databaseName, "f"), __classPrivateFieldGet(this, _LocalStorage_instances, "m", _LocalStorage_stringify).call(this, database));
|
|
51
52
|
});
|
|
52
53
|
}
|
|
53
54
|
getItem(id) {
|
|
@@ -70,4 +71,18 @@ _LocalStorage_localStorage = new WeakMap(), _LocalStorage_databaseName = new Wea
|
|
|
70
71
|
__classPrivateFieldGet(this, _LocalStorage_localStorage, "f").setItem(__classPrivateFieldGet(this, _LocalStorage_databaseName, "f"), database);
|
|
71
72
|
}
|
|
72
73
|
return JSON.parse(database);
|
|
74
|
+
}, _LocalStorage_stringify = function _LocalStorage_stringify(obj) {
|
|
75
|
+
const cache = [];
|
|
76
|
+
const str = JSON.stringify(obj, function (key, value) {
|
|
77
|
+
if (typeof value === 'object' && value !== null) {
|
|
78
|
+
if (cache.indexOf(value) !== DO_NOT_EXIST) {
|
|
79
|
+
// Circular reference found, discard key
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
// Store value in our collection
|
|
83
|
+
cache.push(value);
|
|
84
|
+
}
|
|
85
|
+
return value;
|
|
86
|
+
});
|
|
87
|
+
return str;
|
|
73
88
|
};
|
|
@@ -10,10 +10,11 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
10
10
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
11
11
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
12
12
|
};
|
|
13
|
-
var _LocalStorage_instances, _LocalStorage_localStorage, _LocalStorage_databaseName, _LocalStorage_getDatabase;
|
|
13
|
+
var _LocalStorage_instances, _LocalStorage_localStorage, _LocalStorage_databaseName, _LocalStorage_getDatabase, _LocalStorage_stringify;
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
exports.LocalStorage = void 0;
|
|
16
16
|
const DATABASE_NAME_SPACE = 'YUNO_EVENT_LOGS';
|
|
17
|
+
const DO_NOT_EXIST = -1;
|
|
17
18
|
class LocalStorage {
|
|
18
19
|
constructor(organizationName) {
|
|
19
20
|
_LocalStorage_instances.add(this);
|
|
@@ -35,7 +36,7 @@ class LocalStorage {
|
|
|
35
36
|
database[publicApiKey] = [];
|
|
36
37
|
}
|
|
37
38
|
database[publicApiKey].push(item);
|
|
38
|
-
__classPrivateFieldGet(this, _LocalStorage_localStorage, "f").setItem(__classPrivateFieldGet(this, _LocalStorage_databaseName, "f"),
|
|
39
|
+
__classPrivateFieldGet(this, _LocalStorage_localStorage, "f").setItem(__classPrivateFieldGet(this, _LocalStorage_databaseName, "f"), __classPrivateFieldGet(this, _LocalStorage_instances, "m", _LocalStorage_stringify).call(this, database));
|
|
39
40
|
}
|
|
40
41
|
getItem(id) {
|
|
41
42
|
throw new Error('Method not implemented.' + id);
|
|
@@ -57,4 +58,18 @@ _LocalStorage_localStorage = new WeakMap(), _LocalStorage_databaseName = new Wea
|
|
|
57
58
|
__classPrivateFieldGet(this, _LocalStorage_localStorage, "f").setItem(__classPrivateFieldGet(this, _LocalStorage_databaseName, "f"), database);
|
|
58
59
|
}
|
|
59
60
|
return JSON.parse(database);
|
|
61
|
+
}, _LocalStorage_stringify = function _LocalStorage_stringify(obj) {
|
|
62
|
+
const cache = [];
|
|
63
|
+
const str = JSON.stringify(obj, function (key, value) {
|
|
64
|
+
if (typeof value === 'object' && value !== null) {
|
|
65
|
+
if (cache.indexOf(value) !== DO_NOT_EXIST) {
|
|
66
|
+
// Circular reference found, discard key
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
// Store value in our collection
|
|
70
|
+
cache.push(value);
|
|
71
|
+
}
|
|
72
|
+
return value;
|
|
73
|
+
});
|
|
74
|
+
return str;
|
|
60
75
|
};
|