@midscene/visualizer 0.30.10 → 0.30.11-beta-20251218071621.0
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/es/component/blackboard/index.css +8 -0
- package/dist/es/component/blackboard/index.mjs +137 -68
- package/dist/es/component/config-selector/index.mjs +102 -4
- package/dist/es/component/context-preview/index.mjs +1 -2
- package/dist/es/component/env-config/index.mjs +1 -2
- package/dist/es/component/env-config-reminder/index.css +8 -0
- package/dist/es/component/env-config-reminder/index.mjs +1 -2
- package/dist/es/component/form-field/index.mjs +5 -10
- package/dist/es/component/history-selector/index.css +38 -1
- package/dist/es/component/history-selector/index.mjs +1 -2
- package/dist/es/component/logo/index.mjs +7 -3
- package/dist/es/component/misc/index.mjs +1 -4
- package/dist/es/component/nav-actions/index.mjs +1 -2
- package/dist/es/component/nav-actions/style.css +1 -1
- package/dist/es/component/player/index.css +26 -0
- package/dist/es/component/player/index.mjs +376 -364
- package/dist/es/component/playground/index.css +291 -31
- package/dist/es/component/playground-result/index.css +10 -0
- package/dist/es/component/playground-result/index.mjs +129 -10
- package/dist/es/component/prompt-input/index.css +281 -31
- package/dist/es/component/prompt-input/index.mjs +83 -25
- package/dist/es/component/screenshot-viewer/index.css +214 -0
- package/dist/es/component/screenshot-viewer/index.mjs +282 -0
- package/dist/es/component/service-mode-control/index.mjs +1 -2
- package/dist/es/component/shiny-text/index.css +35 -3
- package/dist/es/component/shiny-text/index.mjs +3 -3
- package/dist/es/component/universal-playground/index.css +61 -1
- package/dist/es/component/universal-playground/index.mjs +106 -83
- package/dist/es/component/universal-playground/providers/context-provider.mjs +56 -18
- package/dist/es/component/universal-playground/providers/indexeddb-storage-provider.mjs +213 -139
- package/dist/es/component/universal-playground/providers/storage-provider.mjs +199 -121
- package/dist/es/hooks/usePlaygroundExecution.mjs +297 -146
- package/dist/es/hooks/usePlaygroundState.mjs +141 -75
- package/dist/es/hooks/useSafeOverrideAIConfig.mjs +2 -6
- package/dist/es/hooks/useServerValid.mjs +37 -12
- package/dist/es/hooks/useTheme.mjs +25 -0
- package/dist/es/icons/avatar.mjs +46 -4
- package/dist/es/icons/close.mjs +46 -4
- package/dist/es/icons/global-perspective.mjs +47 -5
- package/dist/es/icons/history.mjs +48 -6
- package/dist/es/icons/magnifying-glass.mjs +47 -5
- package/dist/es/icons/player-setting.mjs +48 -6
- package/dist/es/icons/setting.mjs +47 -5
- package/dist/es/icons/show-marker.mjs +47 -5
- package/dist/es/index.mjs +4 -4
- package/dist/es/store/history.mjs +46 -7
- package/dist/es/store/store.mjs +68 -2
- package/dist/es/types.mjs +1 -1
- package/dist/es/utils/constants.mjs +7 -3
- package/dist/es/utils/index.mjs +4 -1
- package/dist/es/utils/pixi-loader.mjs +37 -11
- package/dist/es/utils/replay-scripts.mjs +160 -111
- package/dist/lib/component/blackboard/index.css +8 -0
- package/dist/lib/component/blackboard/index.js +139 -70
- package/dist/lib/component/config-selector/index.js +103 -5
- package/dist/lib/component/context-preview/index.js +3 -4
- package/dist/lib/component/env-config/index.js +3 -4
- package/dist/lib/component/env-config-reminder/index.css +8 -0
- package/dist/lib/component/env-config-reminder/index.js +3 -4
- package/dist/lib/component/form-field/index.js +10 -15
- package/dist/lib/component/history-selector/index.css +38 -1
- package/dist/lib/component/history-selector/index.js +3 -4
- package/dist/lib/component/index.js +6 -8
- package/dist/lib/component/logo/index.js +9 -5
- package/dist/lib/component/misc/index.js +6 -9
- package/dist/lib/component/nav-actions/index.js +3 -4
- package/dist/lib/component/nav-actions/style.css +1 -1
- package/dist/lib/component/player/index.css +26 -0
- package/dist/lib/component/player/index.js +376 -365
- package/dist/lib/component/playground/index.css +291 -31
- package/dist/lib/component/playground/index.js +31 -33
- package/dist/lib/component/playground-result/index.css +10 -0
- package/dist/lib/component/playground-result/index.js +131 -12
- package/dist/lib/component/prompt-input/index.css +281 -31
- package/dist/lib/component/prompt-input/index.js +84 -26
- package/dist/lib/component/screenshot-viewer/index.css +214 -0
- package/dist/lib/component/screenshot-viewer/index.js +316 -0
- package/dist/lib/component/service-mode-control/index.js +3 -4
- package/dist/lib/component/shiny-text/index.css +35 -3
- package/dist/lib/component/shiny-text/index.js +5 -5
- package/dist/lib/component/universal-playground/index.css +61 -1
- package/dist/lib/component/universal-playground/index.js +108 -84
- package/dist/lib/component/universal-playground/providers/context-provider.js +58 -20
- package/dist/lib/component/universal-playground/providers/indexeddb-storage-provider.js +217 -143
- package/dist/lib/component/universal-playground/providers/storage-provider.js +207 -129
- package/dist/lib/hooks/usePlaygroundExecution.js +299 -148
- package/dist/lib/hooks/usePlaygroundState.js +143 -77
- package/dist/lib/hooks/useSafeOverrideAIConfig.js +4 -8
- package/dist/lib/hooks/useServerValid.js +39 -14
- package/dist/lib/hooks/useTheme.js +59 -0
- package/dist/lib/icons/avatar.js +48 -6
- package/dist/lib/icons/close.js +48 -6
- package/dist/lib/icons/global-perspective.js +49 -7
- package/dist/lib/icons/history.js +50 -8
- package/dist/lib/icons/magnifying-glass.js +49 -7
- package/dist/lib/icons/player-setting.js +50 -8
- package/dist/lib/icons/setting.js +49 -7
- package/dist/lib/icons/show-marker.js +49 -7
- package/dist/lib/index.js +44 -34
- package/dist/lib/store/history.js +48 -9
- package/dist/lib/store/store.js +74 -8
- package/dist/lib/types.js +3 -3
- package/dist/lib/utils/color.js +2 -2
- package/dist/lib/utils/constants.js +20 -4
- package/dist/lib/utils/index.js +10 -4
- package/dist/lib/utils/pixi-loader.js +41 -15
- package/dist/lib/utils/playground-utils.js +4 -4
- package/dist/lib/utils/replay-scripts.js +164 -115
- package/dist/types/component/config-selector/index.d.ts +2 -0
- package/dist/types/component/player/index.d.ts +0 -1
- package/dist/types/component/playground-result/index.d.ts +1 -0
- package/dist/types/component/prompt-input/index.d.ts +2 -1
- package/dist/types/component/screenshot-viewer/index.d.ts +15 -0
- package/dist/types/hooks/usePlaygroundExecution.d.ts +1 -1
- package/dist/types/hooks/usePlaygroundState.d.ts +3 -3
- package/dist/types/hooks/useTheme.d.ts +7 -0
- package/dist/types/index.d.ts +3 -3
- package/dist/types/store/store.d.ts +18 -1
- package/dist/types/types.d.ts +14 -4
- package/dist/types/utils/constants.d.ts +5 -1
- package/dist/types/utils/index.d.ts +1 -0
- package/dist/types/utils/replay-scripts.d.ts +1 -1
- package/package.json +12 -22
|
@@ -1,4 +1,30 @@
|
|
|
1
1
|
import { IndexedDBManager, createCleanupFunction, withErrorHandling } from "@midscene/shared/baseDB";
|
|
2
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
3
|
+
try {
|
|
4
|
+
var info = gen[key](arg);
|
|
5
|
+
var value = info.value;
|
|
6
|
+
} catch (error) {
|
|
7
|
+
reject(error);
|
|
8
|
+
return;
|
|
9
|
+
}
|
|
10
|
+
if (info.done) resolve(value);
|
|
11
|
+
else Promise.resolve(value).then(_next, _throw);
|
|
12
|
+
}
|
|
13
|
+
function _async_to_generator(fn) {
|
|
14
|
+
return function() {
|
|
15
|
+
var self = this, args = arguments;
|
|
16
|
+
return new Promise(function(resolve, reject) {
|
|
17
|
+
var gen = fn.apply(self, args);
|
|
18
|
+
function _next(value) {
|
|
19
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
20
|
+
}
|
|
21
|
+
function _throw(err) {
|
|
22
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
23
|
+
}
|
|
24
|
+
_next(void 0);
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
}
|
|
2
28
|
function _define_property(obj, key, value) {
|
|
3
29
|
if (key in obj) Object.defineProperty(obj, key, {
|
|
4
30
|
value: value,
|
|
@@ -9,6 +35,38 @@ function _define_property(obj, key, value) {
|
|
|
9
35
|
else obj[key] = value;
|
|
10
36
|
return obj;
|
|
11
37
|
}
|
|
38
|
+
function _object_spread(target) {
|
|
39
|
+
for(var i = 1; i < arguments.length; i++){
|
|
40
|
+
var source = null != arguments[i] ? arguments[i] : {};
|
|
41
|
+
var ownKeys = Object.keys(source);
|
|
42
|
+
if ("function" == typeof Object.getOwnPropertySymbols) ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
43
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
44
|
+
}));
|
|
45
|
+
ownKeys.forEach(function(key) {
|
|
46
|
+
_define_property(target, key, source[key]);
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
return target;
|
|
50
|
+
}
|
|
51
|
+
function indexeddb_storage_provider_ownKeys(object, enumerableOnly) {
|
|
52
|
+
var keys = Object.keys(object);
|
|
53
|
+
if (Object.getOwnPropertySymbols) {
|
|
54
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
55
|
+
if (enumerableOnly) symbols = symbols.filter(function(sym) {
|
|
56
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
57
|
+
});
|
|
58
|
+
keys.push.apply(keys, symbols);
|
|
59
|
+
}
|
|
60
|
+
return keys;
|
|
61
|
+
}
|
|
62
|
+
function _object_spread_props(target, source) {
|
|
63
|
+
source = null != source ? source : {};
|
|
64
|
+
if (Object.getOwnPropertyDescriptors) Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
65
|
+
else indexeddb_storage_provider_ownKeys(Object(source)).forEach(function(key) {
|
|
66
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
67
|
+
});
|
|
68
|
+
return target;
|
|
69
|
+
}
|
|
12
70
|
const DB_NAME = 'midscene_playground';
|
|
13
71
|
const DB_VERSION = 1;
|
|
14
72
|
const MESSAGES_STORE = 'playground_messages';
|
|
@@ -16,109 +74,105 @@ const RESULTS_STORE = 'playground_results';
|
|
|
16
74
|
const MAX_STORED_MESSAGES = 100;
|
|
17
75
|
const MAX_STORED_RESULTS = 50;
|
|
18
76
|
class IndexedDBStorageProvider {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
async loadMessages() {
|
|
38
|
-
const result = await withErrorHandling(async ()=>{
|
|
39
|
-
const messages = await this.dbManager.getAll(MESSAGES_STORE, true);
|
|
40
|
-
if (0 === messages.length) return [];
|
|
41
|
-
return Promise.all(messages.map(async (msg)=>{
|
|
42
|
-
const item = msg.data;
|
|
43
|
-
const restoredItem = {
|
|
44
|
-
...item,
|
|
45
|
-
timestamp: new Date(item.timestamp)
|
|
46
|
-
};
|
|
47
|
-
if ('result' === item.type && item.id) {
|
|
48
|
-
const fullResult = await this.loadResult(item.id);
|
|
49
|
-
if (fullResult) {
|
|
50
|
-
restoredItem.result = fullResult.result;
|
|
51
|
-
restoredItem.replayScriptsInfo = fullResult.replayScriptsInfo;
|
|
52
|
-
restoredItem.replayCounter = fullResult.replayCounter;
|
|
53
|
-
restoredItem.verticalMode = fullResult.verticalMode;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
return restoredItem;
|
|
57
|
-
}));
|
|
58
|
-
}, 'Failed to load messages from IndexedDB', [], this.messagesCleanup);
|
|
59
|
-
return result || [];
|
|
60
|
-
}
|
|
61
|
-
async clearMessages() {
|
|
62
|
-
await withErrorHandling(async ()=>{
|
|
63
|
-
await Promise.all([
|
|
64
|
-
this.dbManager.clear(MESSAGES_STORE),
|
|
65
|
-
this.dbManager.clear(RESULTS_STORE)
|
|
66
|
-
]);
|
|
67
|
-
}, 'Failed to clear messages from IndexedDB');
|
|
68
|
-
}
|
|
69
|
-
async saveResult(id, result) {
|
|
70
|
-
await withErrorHandling(async ()=>{
|
|
71
|
-
const compressedResult = this.compressResultForStorage(result);
|
|
72
|
-
const data = {
|
|
73
|
-
id,
|
|
74
|
-
data: compressedResult,
|
|
75
|
-
timestamp: Date.now(),
|
|
76
|
-
size: JSON.stringify(compressedResult).length
|
|
77
|
-
};
|
|
78
|
-
await this.dbManager.put(RESULTS_STORE, data);
|
|
79
|
-
}, 'Failed to save result to IndexedDB', void 0, this.resultsCleanup);
|
|
77
|
+
saveMessages(messages) {
|
|
78
|
+
return _async_to_generator(function*() {
|
|
79
|
+
yield withErrorHandling(()=>_async_to_generator(function*() {
|
|
80
|
+
yield this.dbManager.clear(MESSAGES_STORE);
|
|
81
|
+
const messagesToSave = messages.slice(-MAX_STORED_MESSAGES);
|
|
82
|
+
yield Promise.all(messagesToSave.map((msg, index)=>{
|
|
83
|
+
const lightMessage = _object_spread_props(_object_spread({}, msg), {
|
|
84
|
+
result: 'result' === msg.type ? void 0 : msg.result
|
|
85
|
+
});
|
|
86
|
+
const data = {
|
|
87
|
+
id: msg.id || `msg-${index}`,
|
|
88
|
+
data: lightMessage,
|
|
89
|
+
timestamp: msg.timestamp ? msg.timestamp.getTime() : Date.now() + index
|
|
90
|
+
};
|
|
91
|
+
return this.dbManager.put(MESSAGES_STORE, data);
|
|
92
|
+
}));
|
|
93
|
+
}).call(this), 'Failed to save messages to IndexedDB', void 0, this.messagesCleanup);
|
|
94
|
+
}).call(this);
|
|
80
95
|
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
const
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
96
|
+
loadMessages() {
|
|
97
|
+
return _async_to_generator(function*() {
|
|
98
|
+
const result = yield withErrorHandling(()=>_async_to_generator(function*() {
|
|
99
|
+
const messages = yield this.dbManager.getAll(MESSAGES_STORE, true);
|
|
100
|
+
if (0 === messages.length) return [];
|
|
101
|
+
return Promise.all(messages.map((msg)=>_async_to_generator(function*() {
|
|
102
|
+
const item = msg.data;
|
|
103
|
+
const restoredItem = _object_spread_props(_object_spread({}, item), {
|
|
104
|
+
timestamp: new Date(item.timestamp)
|
|
105
|
+
});
|
|
106
|
+
if ('result' === item.type && item.id) {
|
|
107
|
+
const fullResult = yield this.loadResult(item.id);
|
|
108
|
+
if (fullResult) {
|
|
109
|
+
restoredItem.result = fullResult.result;
|
|
110
|
+
restoredItem.replayScriptsInfo = fullResult.replayScriptsInfo;
|
|
111
|
+
restoredItem.replayCounter = fullResult.replayCounter;
|
|
112
|
+
restoredItem.verticalMode = fullResult.verticalMode;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
return restoredItem;
|
|
116
|
+
}).call(this)));
|
|
117
|
+
}).call(this), 'Failed to load messages from IndexedDB', [], this.messagesCleanup);
|
|
118
|
+
return result || [];
|
|
119
|
+
}).call(this);
|
|
120
|
+
}
|
|
121
|
+
clearMessages() {
|
|
122
|
+
return _async_to_generator(function*() {
|
|
123
|
+
yield withErrorHandling(()=>_async_to_generator(function*() {
|
|
124
|
+
yield Promise.all([
|
|
125
|
+
this.dbManager.clear(MESSAGES_STORE),
|
|
126
|
+
this.dbManager.clear(RESULTS_STORE)
|
|
127
|
+
]);
|
|
128
|
+
}).call(this), 'Failed to clear messages from IndexedDB');
|
|
129
|
+
}).call(this);
|
|
130
|
+
}
|
|
131
|
+
saveResult(id, result) {
|
|
132
|
+
return _async_to_generator(function*() {
|
|
133
|
+
yield withErrorHandling(()=>_async_to_generator(function*() {
|
|
134
|
+
const compressedResult = this.compressResultForStorage(result);
|
|
135
|
+
const data = {
|
|
136
|
+
id,
|
|
137
|
+
data: compressedResult,
|
|
138
|
+
timestamp: Date.now(),
|
|
139
|
+
size: JSON.stringify(compressedResult).length
|
|
140
|
+
};
|
|
141
|
+
yield this.dbManager.put(RESULTS_STORE, data);
|
|
142
|
+
}).call(this), 'Failed to save result to IndexedDB', void 0, this.resultsCleanup);
|
|
143
|
+
}).call(this);
|
|
144
|
+
}
|
|
145
|
+
loadResult(id) {
|
|
146
|
+
return _async_to_generator(function*() {
|
|
147
|
+
const result = yield withErrorHandling(()=>_async_to_generator(function*() {
|
|
148
|
+
const data = yield this.dbManager.get(RESULTS_STORE, id);
|
|
149
|
+
return (null == data ? void 0 : data.data) || null;
|
|
150
|
+
}).call(this), 'Failed to load result from IndexedDB', null);
|
|
151
|
+
return result || null;
|
|
152
|
+
}).call(this);
|
|
87
153
|
}
|
|
88
154
|
compressResultForStorage(result) {
|
|
89
155
|
var _result_result_dump, _result_result;
|
|
90
|
-
if (!(null == (_result_result = result.result) ? void 0 : null == (_result_result_dump = _result_result.dump) ? void 0 : _result_result_dump.
|
|
91
|
-
const
|
|
92
|
-
var
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
})) || []
|
|
110
|
-
};
|
|
156
|
+
if (!(null == (_result_result = result.result) ? void 0 : null == (_result_result_dump = _result_result.dump) ? void 0 : _result_result_dump.tasks)) return result;
|
|
157
|
+
const compressedTasks = result.result.dump.tasks.map((task)=>{
|
|
158
|
+
var _task_recorder;
|
|
159
|
+
var _this_compressScreenshotIfNeeded;
|
|
160
|
+
return _object_spread_props(_object_spread({}, task), {
|
|
161
|
+
uiContext: task.uiContext ? _object_spread_props(_object_spread({}, task.uiContext), {
|
|
162
|
+
screenshotBase64: null != (_this_compressScreenshotIfNeeded = this.compressScreenshotIfNeeded(task.uiContext.screenshotBase64)) ? _this_compressScreenshotIfNeeded : task.uiContext.screenshotBase64
|
|
163
|
+
}) : task.uiContext,
|
|
164
|
+
recorder: null == (_task_recorder = task.recorder) ? void 0 : _task_recorder.map((record)=>_object_spread_props(_object_spread({}, record), {
|
|
165
|
+
screenshot: this.compressScreenshotIfNeeded(record.screenshot)
|
|
166
|
+
}))
|
|
167
|
+
});
|
|
168
|
+
});
|
|
169
|
+
return _object_spread_props(_object_spread({}, result), {
|
|
170
|
+
result: _object_spread_props(_object_spread({}, result.result), {
|
|
171
|
+
dump: _object_spread_props(_object_spread({}, result.result.dump), {
|
|
172
|
+
tasks: compressedTasks
|
|
173
|
+
})
|
|
174
|
+
})
|
|
111
175
|
});
|
|
112
|
-
return {
|
|
113
|
-
...result,
|
|
114
|
-
result: {
|
|
115
|
-
...result.result,
|
|
116
|
-
dump: {
|
|
117
|
-
...result.result.dump,
|
|
118
|
-
executions: compressedExecutions
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
};
|
|
122
176
|
}
|
|
123
177
|
compressScreenshotIfNeeded(screenshot) {
|
|
124
178
|
if (!screenshot) return screenshot;
|
|
@@ -128,30 +182,34 @@ class IndexedDBStorageProvider {
|
|
|
128
182
|
}
|
|
129
183
|
return screenshot;
|
|
130
184
|
}
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
const
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
185
|
+
getStorageStats() {
|
|
186
|
+
return _async_to_generator(function*() {
|
|
187
|
+
const result = yield withErrorHandling(()=>_async_to_generator(function*() {
|
|
188
|
+
const [messageCount, resultCount] = yield Promise.all([
|
|
189
|
+
this.dbManager.count(MESSAGES_STORE),
|
|
190
|
+
this.dbManager.count(RESULTS_STORE)
|
|
191
|
+
]);
|
|
192
|
+
return {
|
|
193
|
+
messageCount,
|
|
194
|
+
resultCount
|
|
195
|
+
};
|
|
196
|
+
}).call(this), 'Failed to get storage statistics', {
|
|
197
|
+
messageCount: 0,
|
|
198
|
+
resultCount: 0
|
|
199
|
+
});
|
|
200
|
+
return result || {
|
|
201
|
+
messageCount: 0,
|
|
202
|
+
resultCount: 0
|
|
140
203
|
};
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
async cleanup() {
|
|
151
|
-
await Promise.all([
|
|
152
|
-
this.messagesCleanup(),
|
|
153
|
-
this.resultsCleanup()
|
|
154
|
-
]);
|
|
204
|
+
}).call(this);
|
|
205
|
+
}
|
|
206
|
+
cleanup() {
|
|
207
|
+
return _async_to_generator(function*() {
|
|
208
|
+
yield Promise.all([
|
|
209
|
+
this.messagesCleanup(),
|
|
210
|
+
this.resultsCleanup()
|
|
211
|
+
]);
|
|
212
|
+
}).call(this);
|
|
155
213
|
}
|
|
156
214
|
constructor(namespace = 'playground'){
|
|
157
215
|
_define_property(this, "dbManager", void 0);
|
|
@@ -174,22 +232,30 @@ class IndexedDBStorageProvider {
|
|
|
174
232
|
}
|
|
175
233
|
}
|
|
176
234
|
class MemoryStorageProvider {
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
235
|
+
saveMessages(messages) {
|
|
236
|
+
return _async_to_generator(function*() {
|
|
237
|
+
this.messages = [
|
|
238
|
+
...messages
|
|
239
|
+
];
|
|
240
|
+
}).call(this);
|
|
181
241
|
}
|
|
182
|
-
|
|
183
|
-
return
|
|
184
|
-
|
|
185
|
-
|
|
242
|
+
loadMessages() {
|
|
243
|
+
return _async_to_generator(function*() {
|
|
244
|
+
return [
|
|
245
|
+
...this.messages
|
|
246
|
+
];
|
|
247
|
+
}).call(this);
|
|
186
248
|
}
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
249
|
+
clearMessages() {
|
|
250
|
+
return _async_to_generator(function*() {
|
|
251
|
+
this.messages = [];
|
|
252
|
+
this.results.clear();
|
|
253
|
+
}).call(this);
|
|
190
254
|
}
|
|
191
|
-
|
|
192
|
-
|
|
255
|
+
saveResult(id, result) {
|
|
256
|
+
return _async_to_generator(function*() {
|
|
257
|
+
this.results.set(id, result);
|
|
258
|
+
}).call(this);
|
|
193
259
|
}
|
|
194
260
|
constructor(){
|
|
195
261
|
_define_property(this, "messages", []);
|
|
@@ -197,11 +263,19 @@ class MemoryStorageProvider {
|
|
|
197
263
|
}
|
|
198
264
|
}
|
|
199
265
|
class NoOpStorageProvider {
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
266
|
+
saveMessages(_messages) {
|
|
267
|
+
return _async_to_generator(function*() {})();
|
|
268
|
+
}
|
|
269
|
+
loadMessages() {
|
|
270
|
+
return _async_to_generator(function*() {
|
|
271
|
+
return [];
|
|
272
|
+
})();
|
|
273
|
+
}
|
|
274
|
+
clearMessages() {
|
|
275
|
+
return _async_to_generator(function*() {})();
|
|
276
|
+
}
|
|
277
|
+
saveResult(_id, _result) {
|
|
278
|
+
return _async_to_generator(function*() {})();
|
|
203
279
|
}
|
|
204
|
-
async clearMessages() {}
|
|
205
|
-
async saveResult(_id, _result) {}
|
|
206
280
|
}
|
|
207
281
|
export { IndexedDBStorageProvider, MemoryStorageProvider, NoOpStorageProvider };
|