feat: persist passive browser activity batches
This commit is contained in:
@@ -262,6 +262,26 @@ export function createPluginAPI(pluginId) {
|
||||
return data || {};
|
||||
});
|
||||
},
|
||||
readNDJSON: function(name) {
|
||||
assertActive('storage.data.readNDJSON(' + name + ')');
|
||||
if (!name) {
|
||||
throw new Error('storage.data.readNDJSON requires a name');
|
||||
}
|
||||
return callBackend(pluginId, 'storage.data.readNDJSON(' + name + ')', function() {
|
||||
return App.ReadPluginDataNDJSON(pluginId, name);
|
||||
}).then(function(records) {
|
||||
return Array.isArray(records) ? records : [];
|
||||
});
|
||||
},
|
||||
writeNDJSON: function(name, records) {
|
||||
assertActive('storage.data.writeNDJSON(' + name + ')');
|
||||
if (!name) {
|
||||
throw new Error('storage.data.writeNDJSON requires a name');
|
||||
}
|
||||
return callBackendErrorString(pluginId, 'storage.data.writeNDJSON(' + name + ')', function() {
|
||||
return App.WritePluginDataNDJSON(pluginId, name, Array.isArray(records) ? records : []);
|
||||
});
|
||||
},
|
||||
write: function(name, data) {
|
||||
assertActive('storage.data.write(' + name + ')');
|
||||
if (!name) {
|
||||
|
||||
@@ -3341,11 +3341,20 @@
|
||||
var data = (pluginData[pluginId] && pluginData[pluginId][name]) || {};
|
||||
return Promise.resolve([Object.assign({}, data), '']);
|
||||
},
|
||||
ReadPluginDataNDJSON: function (pluginId, name) {
|
||||
var data = (pluginData[pluginId] && pluginData[pluginId][name]) || [];
|
||||
return Promise.resolve([Array.isArray(data) ? data.slice() : [], '']);
|
||||
},
|
||||
WritePluginDataJSON: function (pluginId, name, data) {
|
||||
pluginData[pluginId] = pluginData[pluginId] || {};
|
||||
pluginData[pluginId][name] = Object.assign({}, data || {});
|
||||
return Promise.resolve('');
|
||||
},
|
||||
WritePluginDataNDJSON: function (pluginId, name, records) {
|
||||
pluginData[pluginId] = pluginData[pluginId] || {};
|
||||
pluginData[pluginId][name] = Array.isArray(records) ? records.slice() : [];
|
||||
return Promise.resolve('');
|
||||
},
|
||||
OpenWorkbenchResource: function (pluginId, request) {
|
||||
return openWorkbenchResource(pluginId, request || {}, '');
|
||||
},
|
||||
|
||||
Vendored
+4
@@ -124,6 +124,8 @@ export function PublishPluginEvent(arg1:string,arg2:string,arg3:Record<string, a
|
||||
|
||||
export function ReadPluginDataJSON(arg1:string,arg2:string):Promise<Record<string, any>>;
|
||||
|
||||
export function ReadPluginDataNDJSON(arg1:string,arg2:string):Promise<Array<Record<string, any>>>;
|
||||
|
||||
export function ReadPluginSetting(arg1:string,arg2:string):Promise<any>;
|
||||
|
||||
export function ReadPluginSettings(arg1:string):Promise<Record<string, any>|string>;
|
||||
@@ -176,6 +178,8 @@ export function WriteFrontendLog(arg1:string,arg2:string):Promise<void>;
|
||||
|
||||
export function WritePluginDataJSON(arg1:string,arg2:string,arg3:Record<string, any>):Promise<string>;
|
||||
|
||||
export function WritePluginDataNDJSON(arg1:string,arg2:string,arg3:Array<Record<string, any>>):Promise<string>;
|
||||
|
||||
export function WritePluginSetting(arg1:string,arg2:string,arg3:any):Promise<string>;
|
||||
|
||||
export function WritePluginSettings(arg1:string,arg2:Record<string, any>):Promise<string>;
|
||||
|
||||
@@ -234,6 +234,10 @@ export function ReadPluginDataJSON(arg1, arg2) {
|
||||
return window['go']['api']['App']['ReadPluginDataJSON'](arg1, arg2);
|
||||
}
|
||||
|
||||
export function ReadPluginDataNDJSON(arg1, arg2) {
|
||||
return window['go']['api']['App']['ReadPluginDataNDJSON'](arg1, arg2);
|
||||
}
|
||||
|
||||
export function ReadPluginSetting(arg1, arg2) {
|
||||
return window['go']['api']['App']['ReadPluginSetting'](arg1, arg2);
|
||||
}
|
||||
@@ -338,6 +342,10 @@ export function WritePluginDataJSON(arg1, arg2, arg3) {
|
||||
return window['go']['api']['App']['WritePluginDataJSON'](arg1, arg2, arg3);
|
||||
}
|
||||
|
||||
export function WritePluginDataNDJSON(arg1, arg2, arg3) {
|
||||
return window['go']['api']['App']['WritePluginDataNDJSON'](arg1, arg2, arg3);
|
||||
}
|
||||
|
||||
export function WritePluginSetting(arg1, arg2, arg3) {
|
||||
return window['go']['api']['App']['WritePluginSetting'](arg1, arg2, arg3);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user