@featbit/js-client-sdk 3.0.0 → 3.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.
- package/dist/esm/Configuration.d.ts.map +1 -1
- package/dist/esm/Configuration.js +2 -2
- package/dist/esm/Configuration.js.map +1 -1
- package/dist/esm/FbClientBuilder.d.ts +3 -0
- package/dist/esm/FbClientBuilder.d.ts.map +1 -1
- package/dist/esm/FbClientBuilder.js +4 -0
- package/dist/esm/FbClientBuilder.js.map +1 -1
- package/dist/esm/FbClientCore.d.ts +2 -1
- package/dist/esm/FbClientCore.d.ts.map +1 -1
- package/dist/esm/FbClientCore.js +1 -1
- package/dist/esm/FbClientCore.js.map +1 -1
- package/dist/esm/data-sources/DataSourceUpdates.d.ts.map +1 -1
- package/dist/esm/data-sources/DataSourceUpdates.js +33 -28
- package/dist/esm/data-sources/DataSourceUpdates.js.map +1 -1
- package/dist/esm/index.d.ts +1 -0
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +1 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/logging/SafeLogger.d.ts +1 -1
- package/dist/esm/logging/SafeLogger.d.ts.map +1 -1
- package/dist/esm/logging/SafeLogger.js +2 -1
- package/dist/esm/logging/SafeLogger.js.map +1 -1
- package/dist/esm/platform/IInfo.d.ts +19 -0
- package/dist/esm/platform/IInfo.d.ts.map +1 -1
- package/dist/esm/platform/IStore.d.ts +3 -9
- package/dist/esm/platform/IStore.d.ts.map +1 -1
- package/dist/esm/platform/browser/BrowserPlatform.js +2 -2
- package/dist/esm/platform/browser/BrowserPlatform.js.map +1 -1
- package/dist/esm/platform/browser/BrowserRequests.d.ts +1 -1
- package/dist/esm/platform/browser/BrowserRequests.d.ts.map +1 -1
- package/dist/esm/platform/browser/BrowserRequests.js +2 -1
- package/dist/esm/platform/browser/BrowserRequests.js.map +1 -1
- package/dist/esm/platform/browser/FbClient.d.ts +2 -1
- package/dist/esm/platform/browser/FbClient.d.ts.map +1 -1
- package/dist/esm/platform/browser/FbClient.js +9 -4
- package/dist/esm/platform/browser/FbClient.js.map +1 -1
- package/dist/esm/platform/browser/LocalStorageStore.d.ts +6 -20
- package/dist/esm/platform/browser/LocalStorageStore.d.ts.map +1 -1
- package/dist/esm/platform/browser/LocalStorageStore.js +44 -101
- package/dist/esm/platform/browser/LocalStorageStore.js.map +1 -1
- package/dist/esm/platform/index.d.ts +4 -0
- package/dist/esm/platform/index.d.ts.map +1 -1
- package/dist/esm/platform/index.js +8 -0
- package/dist/esm/platform/index.js.map +1 -1
- package/dist/esm/store/BaseStore.d.ts +25 -0
- package/dist/esm/store/BaseStore.d.ts.map +1 -0
- package/dist/esm/store/BaseStore.js +125 -0
- package/dist/esm/store/BaseStore.js.map +1 -0
- package/dist/esm/store/InMemoryStore.d.ts +7 -20
- package/dist/esm/store/InMemoryStore.d.ts.map +1 -1
- package/dist/esm/store/InMemoryStore.js +31 -81
- package/dist/esm/store/InMemoryStore.js.map +1 -1
- package/dist/esm/store/index.d.ts +1 -0
- package/dist/esm/store/index.d.ts.map +1 -1
- package/dist/esm/store/index.js +1 -0
- package/dist/esm/store/index.js.map +1 -1
- package/dist/esm/utils/debounce.d.ts +22 -0
- package/dist/esm/utils/debounce.d.ts.map +1 -0
- package/dist/esm/utils/debounce.js +34 -0
- package/dist/esm/utils/debounce.js.map +1 -0
- package/dist/esm/utils/index.d.ts +2 -0
- package/dist/esm/utils/index.d.ts.map +1 -1
- package/dist/esm/utils/index.js +2 -0
- package/dist/esm/utils/index.js.map +1 -1
- package/dist/esm/version.d.ts +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/umd/featbit-js-client-sdk-3.0.2.js +2 -0
- package/dist/umd/featbit-js-client-sdk-3.0.2.js.map +1 -0
- package/dist/umd/featbit-js-client-sdk.js +1 -1
- package/dist/umd/featbit-js-client-sdk.js.map +1 -1
- package/package.json +1 -1
- package/src/Configuration.ts +1 -2
- package/src/FbClientBuilder.ts +7 -0
- package/src/FbClientCore.ts +3 -3
- package/src/data-sources/DataSourceUpdates.ts +23 -27
- package/src/index.ts +1 -0
- package/src/logging/SafeLogger.ts +1 -1
- package/src/platform/IInfo.ts +21 -0
- package/src/platform/IStore.ts +3 -9
- package/src/platform/browser/BrowserPlatform.ts +1 -1
- package/src/platform/browser/BrowserRequests.ts +1 -1
- package/src/platform/browser/FbClient.ts +11 -4
- package/src/platform/browser/LocalStorageStore.ts +13 -106
- package/src/platform/index.ts +9 -1
- package/src/store/BaseStore.ts +123 -0
- package/src/store/InMemoryStore.ts +21 -99
- package/src/store/index.ts +2 -1
- package/src/utils/debounce.ts +33 -0
- package/src/utils/index.ts +3 -1
- package/src/version.ts +1 -1
- package/dist/umd/featbit-js-client-sdk-3.0.0.js +0 -2
- package/dist/umd/featbit-js-client-sdk-3.0.0.js.map +0 -1
|
@@ -1,26 +1,12 @@
|
|
|
1
|
-
import { IDataKind } from "../../IDataKind";
|
|
2
|
-
import { IKeyedStoreItem, IStoreDataStorage, IStoreItem, IStoreKindData } from "../../store/store";
|
|
3
|
-
import { IStore } from "../../platform/IStore";
|
|
4
|
-
import { IUser } from "../../options/IUser";
|
|
5
1
|
import { IOptions } from "../../options/IOptions";
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
private initCalled;
|
|
9
|
-
private _user;
|
|
2
|
+
import { BaseStore } from "../../store/BaseStore";
|
|
3
|
+
export default class LocalStorageStore extends BaseStore {
|
|
10
4
|
private logger;
|
|
11
5
|
constructor(options: IOptions);
|
|
12
|
-
identify(user: IUser): void;
|
|
13
|
-
get user(): IUser;
|
|
14
|
-
private addItem;
|
|
15
|
-
get(kind: IDataKind, key: string): IStoreItem | null;
|
|
16
|
-
all(kind: IDataKind): [IStoreKindData, number];
|
|
17
|
-
init(allData: IStoreDataStorage, callback: () => void): void;
|
|
18
|
-
upsert(kind: IDataKind, data: IKeyedStoreItem, callback: () => void): void;
|
|
19
|
-
initialized(): boolean;
|
|
20
6
|
close(): void;
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
7
|
+
get description(): string;
|
|
8
|
+
protected saveUser(): Promise<void>;
|
|
9
|
+
protected dumpStoreToStorage(): Promise<void>;
|
|
10
|
+
protected loadStoreFromStorage(): Promise<void>;
|
|
25
11
|
}
|
|
26
12
|
//# sourceMappingURL=LocalStorageStore.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LocalStorageStore.d.ts","sourceRoot":"","sources":["../../../../src/platform/browser/LocalStorageStore.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"LocalStorageStore.d.ts","sourceRoot":"","sources":["../../../../src/platform/browser/LocalStorageStore.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAIlD,MAAM,CAAC,OAAO,OAAO,iBAAkB,SAAQ,SAAS;IACtD,OAAO,CAAC,MAAM,CAAU;gBAEZ,OAAO,EAAE,QAAQ;IAO7B,KAAK,IAAI,IAAI;IAIb,IAAI,WAAW,IAAI,MAAM,CAExB;cAGe,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;cAIhB,kBAAkB;cAKlB,oBAAoB;CAsB9C"}
|
|
@@ -1,121 +1,64 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
2
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
12
|
const store_1 = require("../../store/store");
|
|
13
|
+
const BaseStore_1 = require("../../store/BaseStore");
|
|
4
14
|
const serializeUser_1 = require("../../utils/serializeUser");
|
|
5
|
-
class LocalStorageStore {
|
|
15
|
+
class LocalStorageStore extends BaseStore_1.BaseStore {
|
|
6
16
|
constructor(options) {
|
|
7
|
-
|
|
8
|
-
this.initCalled = false;
|
|
9
|
-
this._user = {};
|
|
17
|
+
super();
|
|
10
18
|
this.logger = options.logger;
|
|
11
19
|
}
|
|
12
|
-
identify(user) {
|
|
13
|
-
this._user = Object.assign({}, user);
|
|
14
|
-
localStorage.setItem(store_1.CurrentUserStorageKey, (0, serializeUser_1.serializeUser)(this._user));
|
|
15
|
-
this.loadStoreFromStorage();
|
|
16
|
-
}
|
|
17
|
-
get user() {
|
|
18
|
-
return this._user;
|
|
19
|
-
}
|
|
20
|
-
addItem(kind, key, item) {
|
|
21
|
-
let items = this.store[kind.namespace];
|
|
22
|
-
if (!items) {
|
|
23
|
-
items = {};
|
|
24
|
-
this.store[kind.namespace] = items;
|
|
25
|
-
}
|
|
26
|
-
if (Object.hasOwnProperty.call(items, key)) {
|
|
27
|
-
const old = items[key];
|
|
28
|
-
if (!old || old.version < item.version) {
|
|
29
|
-
items[key] = item;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
else {
|
|
33
|
-
items[key] = item;
|
|
34
|
-
}
|
|
35
|
-
if (item.version > this.store.version) {
|
|
36
|
-
this.store.version = item.version;
|
|
37
|
-
}
|
|
38
|
-
this.dumpStoreToStorage();
|
|
39
|
-
}
|
|
40
|
-
get(kind, key) {
|
|
41
|
-
const items = this.store[kind.namespace];
|
|
42
|
-
if (items) {
|
|
43
|
-
if (Object.prototype.hasOwnProperty.call(items, key)) {
|
|
44
|
-
const item = items[key];
|
|
45
|
-
if (item) {
|
|
46
|
-
return item;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
return null;
|
|
51
|
-
}
|
|
52
|
-
all(kind) {
|
|
53
|
-
var _a;
|
|
54
|
-
const result = {};
|
|
55
|
-
const items = (_a = this.store[kind.namespace]) !== null && _a !== void 0 ? _a : {};
|
|
56
|
-
Object.entries(items).forEach(([key, item]) => {
|
|
57
|
-
if (item) {
|
|
58
|
-
result[key] = item;
|
|
59
|
-
}
|
|
60
|
-
});
|
|
61
|
-
return [result, this.store.version];
|
|
62
|
-
}
|
|
63
|
-
init(allData, callback) {
|
|
64
|
-
this.store = allData;
|
|
65
|
-
Object.keys(allData).map(namespace => {
|
|
66
|
-
Object.entries(allData[namespace]).forEach(([_, item]) => {
|
|
67
|
-
const ele = item;
|
|
68
|
-
if (ele.version > this.store.version) {
|
|
69
|
-
this.store.version = ele.version;
|
|
70
|
-
}
|
|
71
|
-
});
|
|
72
|
-
});
|
|
73
|
-
this.dumpStoreToStorage();
|
|
74
|
-
this.initCalled = true;
|
|
75
|
-
callback === null || callback === void 0 ? void 0 : callback();
|
|
76
|
-
}
|
|
77
|
-
upsert(kind, data, callback) {
|
|
78
|
-
this.addItem(kind, data.key, data);
|
|
79
|
-
callback === null || callback === void 0 ? void 0 : callback();
|
|
80
|
-
}
|
|
81
|
-
initialized() {
|
|
82
|
-
return this.initCalled;
|
|
83
|
-
}
|
|
84
20
|
/* eslint-disable class-methods-use-this */
|
|
85
21
|
close() {
|
|
86
|
-
// For the
|
|
22
|
+
// For the LocalStorage store this is a no-op.
|
|
87
23
|
}
|
|
88
|
-
|
|
24
|
+
get description() {
|
|
89
25
|
return 'local-storage-store';
|
|
90
26
|
}
|
|
91
|
-
|
|
92
|
-
|
|
27
|
+
// This method needs to be overridden in the child class
|
|
28
|
+
saveUser() {
|
|
29
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
30
|
+
localStorage.setItem(store_1.CurrentUserStorageKey, (0, serializeUser_1.serializeUser)(this._user));
|
|
31
|
+
});
|
|
93
32
|
}
|
|
94
33
|
dumpStoreToStorage() {
|
|
95
|
-
|
|
96
|
-
|
|
34
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
35
|
+
const storageKey = `${store_1.StoreStorageKey}-${this._user.keyId}`;
|
|
36
|
+
localStorage.setItem(storageKey, JSON.stringify(this.store));
|
|
37
|
+
});
|
|
97
38
|
}
|
|
98
39
|
loadStoreFromStorage() {
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
40
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
41
|
+
const storageKey = `${store_1.StoreStorageKey}-${this._user.keyId}`;
|
|
42
|
+
const dataStoreStr = localStorage.getItem(storageKey);
|
|
43
|
+
let store = null;
|
|
44
|
+
try {
|
|
45
|
+
if (dataStoreStr && dataStoreStr.trim().length > 0) {
|
|
46
|
+
store = JSON.parse(dataStoreStr);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
catch (err) {
|
|
50
|
+
this.logger.error(`error while loading local data store: ${storageKey}`, err);
|
|
51
|
+
}
|
|
52
|
+
if (!!store) {
|
|
53
|
+
this.store = store;
|
|
105
54
|
}
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
}
|
|
113
|
-
else {
|
|
114
|
-
this.store = {
|
|
115
|
-
flags: {},
|
|
116
|
-
version: 0
|
|
117
|
-
};
|
|
118
|
-
}
|
|
55
|
+
else {
|
|
56
|
+
this.store = {
|
|
57
|
+
flags: {},
|
|
58
|
+
version: 0
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
});
|
|
119
62
|
}
|
|
120
63
|
}
|
|
121
64
|
exports.default = LocalStorageStore;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LocalStorageStore.js","sourceRoot":"","sources":["../../../../src/platform/browser/LocalStorageStore.ts"],"names":[],"mappings":"
|
|
1
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EAAE,GAAG,CAAC,CAAC;aAC/E;YAED,IAAI,CAAC,CAAC,KAAK,EAAE;gBACX,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;aACpB;iBAAM;gBACL,IAAI,CAAC,KAAK,GAAG;oBACX,KAAK,EAAE,EAAE;oBACT,OAAO,EAAE,CAAC;iBACX,CAAC;aACH;QACH,CAAC;KAAA;CACF;AAlDD,oCAkDC"}
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
export * from './IInfo';
|
|
2
|
+
export * from './IStore';
|
|
2
3
|
export * from './IPlatform';
|
|
3
4
|
export * from './IWebSocket';
|
|
4
5
|
export * from './requests';
|
|
6
|
+
export * from './browser/BrowserRequests';
|
|
7
|
+
import BrowserWebSocket from './browser/BrowserWebSocket';
|
|
8
|
+
export { BrowserWebSocket };
|
|
5
9
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/platform/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/platform/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,2BAA2B,CAAC;AAE1C,OAAO,gBAAgB,MAAM,4BAA4B,CAAC;AAE1D,OAAO,EACL,gBAAgB,EACjB,CAAC"}
|
|
@@ -13,9 +13,17 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
|
|
|
13
13
|
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
17
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
18
|
+
};
|
|
16
19
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
+
exports.BrowserWebSocket = void 0;
|
|
17
21
|
__exportStar(require("./IInfo"), exports);
|
|
22
|
+
__exportStar(require("./IStore"), exports);
|
|
18
23
|
__exportStar(require("./IPlatform"), exports);
|
|
19
24
|
__exportStar(require("./IWebSocket"), exports);
|
|
20
25
|
__exportStar(require("./requests"), exports);
|
|
26
|
+
__exportStar(require("./browser/BrowserRequests"), exports);
|
|
27
|
+
const BrowserWebSocket_1 = __importDefault(require("./browser/BrowserWebSocket"));
|
|
28
|
+
exports.BrowserWebSocket = BrowserWebSocket_1.default;
|
|
21
29
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/platform/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/platform/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA,0CAAwB;AACxB,2CAAyB;AACzB,8CAA4B;AAC5B,+CAA6B;AAC7B,6CAA2B;AAC3B,4DAA0C;AAE1C,kFAA0D;AAGxD,2BAHK,0BAAgB,CAGL"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { IStore } from "../platform";
|
|
2
|
+
import { IKeyedStoreItem, IStoreDataStorage, IStoreItem, IStoreKindData } from "./store";
|
|
3
|
+
import { IUser } from "../options";
|
|
4
|
+
import { IDataKind } from "../IDataKind";
|
|
5
|
+
export declare class BaseStore implements IStore {
|
|
6
|
+
protected store: IStoreDataStorage;
|
|
7
|
+
protected initCalled: boolean;
|
|
8
|
+
protected _user: IUser;
|
|
9
|
+
constructor();
|
|
10
|
+
identify(user: IUser): Promise<void>;
|
|
11
|
+
get user(): IUser;
|
|
12
|
+
protected addItem(kind: IDataKind, key: string, item: IStoreItem): Promise<void>;
|
|
13
|
+
get(kind: IDataKind, key: string): IStoreItem | null;
|
|
14
|
+
all(kind: IDataKind): [IStoreKindData, number];
|
|
15
|
+
init(allData: IStoreDataStorage): Promise<void>;
|
|
16
|
+
upsert(kind: IDataKind, data: IKeyedStoreItem): Promise<void>;
|
|
17
|
+
initialized(): boolean;
|
|
18
|
+
close(): void;
|
|
19
|
+
get version(): number;
|
|
20
|
+
get description(): string;
|
|
21
|
+
protected saveUser(): Promise<void>;
|
|
22
|
+
protected loadStoreFromStorage(): Promise<void>;
|
|
23
|
+
protected dumpStoreToStorage(): Promise<void>;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=BaseStore.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BaseStore.d.ts","sourceRoot":"","sources":["../../../src/store/BaseStore.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AACzF,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,qBAAa,SAAU,YAAW,MAAM;IACtC,SAAS,CAAC,KAAK,EAAE,iBAAiB,CAA4B;IAE9D,SAAS,CAAC,UAAU,UAAS;IAE7B,SAAS,CAAC,KAAK,EAAE,KAAK,CAAe;;IAK/B,QAAQ,CAAC,IAAI,EAAE,KAAK;IAO1B,IAAI,IAAI,IAAI,KAAK,CAEhB;cAEe,OAAO,CAAC,IAAI,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU;IAsBtE,GAAG,CAAC,IAAI,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,GAAG,UAAU,GAAG,IAAI;IAapD,GAAG,CAAC,IAAI,EAAE,SAAS,GAAG,CAAC,cAAc,EAAE,MAAM,CAAC;IAYxC,IAAI,CAAC,OAAO,EAAE,iBAAiB;IAgB/B,MAAM,CAAC,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,eAAe;IAInD,WAAW,IAAI,OAAO;IAKtB,KAAK,IAAI,IAAI;IAIb,IAAI,OAAO,IAAI,MAAM,CAEpB;IAGD,IAAI,WAAW,IAAI,MAAM,CAExB;cAGe,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;cAIzB,oBAAoB,IAAI,OAAO,CAAC,IAAI,CAAC;cAIrC,kBAAkB,IAAI,OAAO,CAAC,IAAI,CAAC;CAEpD"}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.BaseStore = void 0;
|
|
13
|
+
class BaseStore {
|
|
14
|
+
constructor() {
|
|
15
|
+
this.store = {};
|
|
16
|
+
this.initCalled = false;
|
|
17
|
+
this._user = {};
|
|
18
|
+
}
|
|
19
|
+
identify(user) {
|
|
20
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
21
|
+
this._user = Object.assign({}, user);
|
|
22
|
+
yield this.saveUser();
|
|
23
|
+
yield this.loadStoreFromStorage();
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
get user() {
|
|
27
|
+
return this._user;
|
|
28
|
+
}
|
|
29
|
+
addItem(kind, key, item) {
|
|
30
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
31
|
+
let items = this.store[kind.namespace];
|
|
32
|
+
if (!items) {
|
|
33
|
+
items = {};
|
|
34
|
+
this.store[kind.namespace] = items;
|
|
35
|
+
}
|
|
36
|
+
if (Object.hasOwnProperty.call(items, key)) {
|
|
37
|
+
const old = items[key];
|
|
38
|
+
if (!old || old.version < item.version) {
|
|
39
|
+
items[key] = item;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
items[key] = item;
|
|
44
|
+
}
|
|
45
|
+
if (item.version > this.store.version) {
|
|
46
|
+
this.store.version = item.version;
|
|
47
|
+
}
|
|
48
|
+
yield this.dumpStoreToStorage();
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
get(kind, key) {
|
|
52
|
+
const items = this.store[kind.namespace];
|
|
53
|
+
if (items) {
|
|
54
|
+
if (Object.prototype.hasOwnProperty.call(items, key)) {
|
|
55
|
+
const item = items[key];
|
|
56
|
+
if (item) {
|
|
57
|
+
return item;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
return null;
|
|
62
|
+
}
|
|
63
|
+
all(kind) {
|
|
64
|
+
var _a;
|
|
65
|
+
const result = {};
|
|
66
|
+
const items = (_a = this.store[kind.namespace]) !== null && _a !== void 0 ? _a : {};
|
|
67
|
+
Object.entries(items).forEach(([key, item]) => {
|
|
68
|
+
if (item) {
|
|
69
|
+
result[key] = item;
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
return [result, this.store.version];
|
|
73
|
+
}
|
|
74
|
+
init(allData) {
|
|
75
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
76
|
+
this.store = allData;
|
|
77
|
+
Object.keys(allData).map(namespace => {
|
|
78
|
+
Object.entries(allData[namespace]).forEach(([_, item]) => {
|
|
79
|
+
const ele = item;
|
|
80
|
+
if (ele.version > this.store.version) {
|
|
81
|
+
this.store.version = ele.version;
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
});
|
|
85
|
+
yield this.dumpStoreToStorage();
|
|
86
|
+
this.initCalled = true;
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
upsert(kind, data) {
|
|
90
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
91
|
+
yield this.addItem(kind, data.key, data);
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
initialized() {
|
|
95
|
+
return this.initCalled;
|
|
96
|
+
}
|
|
97
|
+
/* eslint-disable class-methods-use-this */
|
|
98
|
+
close() {
|
|
99
|
+
// For the LocalStorage store this is a no-op.
|
|
100
|
+
}
|
|
101
|
+
get version() {
|
|
102
|
+
return this.store.version;
|
|
103
|
+
}
|
|
104
|
+
// This getter needs to be overridden in the child class
|
|
105
|
+
get description() {
|
|
106
|
+
return '';
|
|
107
|
+
}
|
|
108
|
+
// This method needs to be overridden in the child class
|
|
109
|
+
saveUser() {
|
|
110
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
// This method needs to be overridden in the child class
|
|
114
|
+
loadStoreFromStorage() {
|
|
115
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
// This method needs to be overridden in the child class
|
|
119
|
+
dumpStoreToStorage() {
|
|
120
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
exports.BaseStore = BaseStore;
|
|
125
|
+
//# sourceMappingURL=BaseStore.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BaseStore.js","sourceRoot":"","sources":["../../../src/store/BaseStore.ts"],"names":[],"mappings":";;;;;;;;;;;;AAKA,MAAa,SAAS;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BAClC;gBACH,CAAC,CAAC,CAAA;YACJ,CAAC,CAAC,CAAC;YAEH,MAAM,IAAI,CAAC,kBAAkB,EAAE,CAAC;YAChC,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;QACzB,CAAC;KAAA;IAEK,MAAM,CAAC,IAAe,EAAE,IAAqB;;YACjD,MAAM,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;QAC3C,CAAC;KAAA;IAED,WAAW;QACT,OAAO,IAAI,CAAC,UAAU,CAAC;IACzB,CAAC;IAED,2CAA2C;IAC3C,KAAK;QACH,8CAA8C;IAChD,CAAC;IAED,IAAI,OAAO;QACT,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC;IAC5B,CAAC;IAED,wDAAwD;IACxD,IAAI,WAAW;QACb,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,wDAAwD;IACxC,QAAQ;;QACxB,CAAC;KAAA;IAED,wDAAwD;IACxC,oBAAoB;;QACpC,CAAC;KAAA;IAED,wDAAwD;IACxC,kBAAkB;;QAClC,CAAC;KAAA;CACF;AArHD,8BAqHC"}
|
|
@@ -1,24 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import { IStore } from "../platform/IStore";
|
|
4
|
-
import { IUser } from "../options/IUser";
|
|
5
|
-
import { IOptions } from "../options/IOptions";
|
|
6
|
-
export default class InMemoryStore implements IStore {
|
|
1
|
+
import { BaseStore } from "./BaseStore";
|
|
2
|
+
export default class InMemoryStore extends BaseStore {
|
|
7
3
|
private allStores;
|
|
8
|
-
|
|
9
|
-
private initCalled;
|
|
10
|
-
private _user;
|
|
11
|
-
constructor(options: IOptions);
|
|
12
|
-
identify(user: IUser): void;
|
|
13
|
-
get user(): IUser;
|
|
14
|
-
private addItem;
|
|
15
|
-
get(kind: IDataKind, key: string): IStoreItem | null;
|
|
16
|
-
all(kind: IDataKind): [IStoreKindData, number];
|
|
17
|
-
init(allData: IStoreDataStorage, callback: () => void): void;
|
|
18
|
-
upsert(kind: IDataKind, data: IKeyedStoreItem, callback: () => void): void;
|
|
19
|
-
initialized(): boolean;
|
|
4
|
+
constructor();
|
|
20
5
|
close(): void;
|
|
21
|
-
|
|
22
|
-
|
|
6
|
+
get description(): string;
|
|
7
|
+
protected saveUser(): Promise<void>;
|
|
8
|
+
protected dumpStoreToStorage(): Promise<void>;
|
|
9
|
+
protected loadStoreFromStorage(): Promise<void>;
|
|
23
10
|
}
|
|
24
11
|
//# sourceMappingURL=InMemoryStore.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InMemoryStore.d.ts","sourceRoot":"","sources":["../../../src/store/InMemoryStore.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"InMemoryStore.d.ts","sourceRoot":"","sources":["../../../src/store/InMemoryStore.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,MAAM,CAAC,OAAO,OAAO,aAAc,SAAQ,SAAS;IAClD,OAAO,CAAC,SAAS,CAA4D;;IAO7E,KAAK,IAAI,IAAI;IAIb,IAAI,WAAW,IAAI,MAAM,CAExB;cAEe,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;cAIhB,kBAAkB;cAKlB,oBAAoB;CAK9C"}
|
|
@@ -1,95 +1,45 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
2
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
12
|
const store_1 = require("./store");
|
|
4
|
-
|
|
5
|
-
|
|
13
|
+
const BaseStore_1 = require("./BaseStore");
|
|
14
|
+
class InMemoryStore extends BaseStore_1.BaseStore {
|
|
15
|
+
constructor() {
|
|
16
|
+
super();
|
|
6
17
|
this.allStores = {};
|
|
7
|
-
this.store = {};
|
|
8
|
-
this.initCalled = false;
|
|
9
|
-
this._user = {};
|
|
10
18
|
}
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
this
|
|
14
|
-
this.store = (_a = this.allStores[`${store_1.StoreStorageKey}-${this._user.keyId}`]) !== null && _a !== void 0 ? _a : { flags: {}, version: 0 };
|
|
15
|
-
}
|
|
16
|
-
get user() {
|
|
17
|
-
return this._user;
|
|
18
|
-
}
|
|
19
|
-
addItem(kind, key, item) {
|
|
20
|
-
let items = this.store[kind.namespace];
|
|
21
|
-
if (!items) {
|
|
22
|
-
items = {};
|
|
23
|
-
this.store[kind.namespace] = items;
|
|
24
|
-
}
|
|
25
|
-
if (Object.hasOwnProperty.call(items, key)) {
|
|
26
|
-
const old = items[key];
|
|
27
|
-
if (!old || old.version < item.version) {
|
|
28
|
-
items[key] = item;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
else {
|
|
32
|
-
items[key] = item;
|
|
33
|
-
}
|
|
34
|
-
if (item.version > this.store.version) {
|
|
35
|
-
this.store.version = item.version;
|
|
36
|
-
}
|
|
37
|
-
this.allStores[`${store_1.StoreStorageKey}-${this._user.keyId}`] = Object.assign({}, this.store);
|
|
19
|
+
/* eslint-disable class-methods-use-this */
|
|
20
|
+
close() {
|
|
21
|
+
// For the LocalStorage store this is a no-op.
|
|
38
22
|
}
|
|
39
|
-
get(
|
|
40
|
-
|
|
41
|
-
if (items) {
|
|
42
|
-
if (Object.prototype.hasOwnProperty.call(items, key)) {
|
|
43
|
-
const item = items[key];
|
|
44
|
-
if (item) {
|
|
45
|
-
return item;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
return null;
|
|
23
|
+
get description() {
|
|
24
|
+
return 'in-memory-store';
|
|
50
25
|
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
const items = (_a = this.store[kind.namespace]) !== null && _a !== void 0 ? _a : {};
|
|
55
|
-
Object.entries(items).forEach(([key, item]) => {
|
|
56
|
-
if (item) {
|
|
57
|
-
result[key] = item;
|
|
58
|
-
}
|
|
26
|
+
saveUser() {
|
|
27
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
28
|
+
// For in-memory store, this is a no-op.
|
|
59
29
|
});
|
|
60
|
-
return [result, this.store.version];
|
|
61
30
|
}
|
|
62
|
-
|
|
63
|
-
this
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
Object.entries(allData[namespace]).forEach(([_, item]) => {
|
|
67
|
-
const ele = item;
|
|
68
|
-
if (ele.version > this.store.version) {
|
|
69
|
-
this.store.version = ele.version;
|
|
70
|
-
}
|
|
71
|
-
});
|
|
31
|
+
dumpStoreToStorage() {
|
|
32
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
33
|
+
const storageKey = `${store_1.StoreStorageKey}-${this._user.keyId}`;
|
|
34
|
+
this.allStores[storageKey] = Object.assign({}, this.store);
|
|
72
35
|
});
|
|
73
|
-
this.allStores[`${store_1.StoreStorageKey}-${this._user.keyId}`] = Object.assign({}, this.store);
|
|
74
|
-
this.initCalled = true;
|
|
75
|
-
callback === null || callback === void 0 ? void 0 : callback();
|
|
76
|
-
}
|
|
77
|
-
upsert(kind, data, callback) {
|
|
78
|
-
this.addItem(kind, data.key, data);
|
|
79
|
-
callback === null || callback === void 0 ? void 0 : callback();
|
|
80
36
|
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
}
|
|
88
|
-
getDescription() {
|
|
89
|
-
return 'in-memory-store';
|
|
90
|
-
}
|
|
91
|
-
get version() {
|
|
92
|
-
return this.store.version;
|
|
37
|
+
loadStoreFromStorage() {
|
|
38
|
+
var _a;
|
|
39
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
40
|
+
const storageKey = `${store_1.StoreStorageKey}-${this._user.keyId}`;
|
|
41
|
+
this.store = (_a = this.allStores[storageKey]) !== null && _a !== void 0 ? _a : { flags: {}, version: 0 };
|
|
42
|
+
});
|
|
93
43
|
}
|
|
94
44
|
}
|
|
95
45
|
exports.default = InMemoryStore;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InMemoryStore.js","sourceRoot":"","sources":["../../../src/store/InMemoryStore.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"InMemoryStore.js","sourceRoot":"","sources":["../../../src/store/InMemoryStore.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,mCAGiB;AACjB,2CAAwC;AAExC,MAAqB,aAAc,SAAQ,qBAAS;IAGlD;QACE,KAAK,EAAE,CAAC;QAHF,cAAS,GAAyD,EAAE,CAAC;IAI7E,CAAC;IAED,2CAA2C;IAC3C,KAAK;QACH,8CAA8C;IAChD,CAAC;IAED,IAAI,WAAW;QACb,OAAO,iBAAiB,CAAA;IAC1B,CAAC;IAEe,QAAQ;;YACtB,wCAAwC;QAC1C,CAAC;KAAA;IAEwB,kBAAkB;;YACzC,MAAM,UAAU,GAAG,GAAG,uBAAe,IAAI,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;YAC5D,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,qBAAO,IAAI,CAAC,KAAK,CAAC,CAAC;QAC/C,CAAC;KAAA;IAEwB,oBAAoB;;;YAC3C,MAAM,UAAU,GAAG,GAAG,uBAAe,IAAI,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;YAE5D,IAAI,CAAC,KAAK,GAAG,MAAA,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,mCAAI,EAAE,KAAK,EAAE,EAAE,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;KACtE;CACF;AA9BD,gCA8BC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/store/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,sBAAsB,CAAC;AACrC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,SAAS,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/store/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,sBAAsB,CAAC;AACrC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC"}
|
package/dist/esm/store/index.js
CHANGED
|
@@ -19,4 +19,5 @@ __exportStar(require("./IDataSourceUpdates"), exports);
|
|
|
19
19
|
__exportStar(require("./InMemoryStore"), exports);
|
|
20
20
|
__exportStar(require("./serialization"), exports);
|
|
21
21
|
__exportStar(require("./store"), exports);
|
|
22
|
+
__exportStar(require("./BaseStore"), exports);
|
|
22
23
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/store/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8CAA4B;AAC5B,uDAAqC;AACrC,kDAAgC;AAChC,kDAAgC;AAChC,0CAAwB"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/store/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8CAA4B;AAC5B,uDAAqC;AACrC,kDAAgC;AAChC,kDAAgC;AAChC,0CAAwB;AACxB,8CAA4B"}
|