TimeChain/src/data/sqlite-client.js
Jason Tudisco c617c63510 Change page security.
Added special script to handle parcel and node require.
Added new tagging control.
Adding new HTML Sanitizer.
Packages so I could be sqlite with the right electron version.
Some style changes.
Interface changes.
Changes to the sqlite/client. Interfaces cuased errors.
Fixed bugs in electron ipc handling.
Fixes to the sqlite libs.
Create a new input control that can handle pasting.
pasting HTML works with cycle through HTML,Text, Sanatized HTML.
New UI controls.
Time stamp control has more functionality.
2022-02-03 03:27:51 -06:00

158 lines
3.3 KiB
JavaScript

/*const Interface = window.require("es6-interface");
const {InterfaceRecord,InterfaceFile,InterfaceTag,InterfaceTagLink} = require("./interfaces");*/
const { ipcRenderer } = window.require('electron')
///const { ipcRenderer } = window.require('electron')
class TimeChainDataSqliteTag //extends Interface(InterfaceTag)
{
constructor(){
this.cmd = "timechain-tag";
}
send(func, data){
data.func = func;
return ipcRenderer.invoke(this.cmd,data);
}
add(tag){
return this.send('add',{tag:tag})
}
delete(tag){
return this.send('delete',{tag:tag})
}
get(tag){
return this.send('get',{tag:tag})
}
has(tag){
return this.send('has',{tag:tag})
}
}
class TimeChainDataSqliteTagLink //extends Interface(InterfaceTagLink)
{
constructor(){
this.cmd = 'timechain-taglink';
}
send(func, data){
data.func = func;
return ipcRenderer.invoke(this.cmd,data);
}
add(uuid,tag){
return this.send('add',{uuid:uuid,tag:tag});
}
delete(uuid,tag){
return this.send('delete',{uuid:uuid,tag:tag});
}
deleteTag(tag){
return this.send('delete-tag',{tag:tag});
}
deleteRecord(uuid){
return this.send('delete-record',{uuid:uuid});
}
getRecords(tag){
return this.send('get-records',{tag:tag});
}
getTags(uuid){
return this.send('get-tags',{uuid:uuid});
}
}
class TimeChainDataSqliteFile //extends Interface(InterfaceFile)
{
constructor(){
this.cmd = 'timechain-file';
}
send(func, data){
data.func = func;
return ipcRenderer.invoke(this.cmd,data);
}
add(uuid_record,uuid,timestamp,content,mime,hash){
return this.send('add',{uuid_record:uuid_record,uuid:uuid,timestamp:timestamp,content:content,mime:mime,hash:hash});
}
getByRecord(uuid_record){
return this.send('get-record',{uuid_record:uuid_record});
}
get(uuid){
return this.send('get',{uuid:uuid});
}
delete(uuid){
return this.send('delete',{uuid:uuid});
}
deleteRecord(uuid_record){
return this.send('delete-record',{uuid_record:uuid_record});
}
update(uuid,timestamp,content,mime,hash){
return this.send('update',{uuid:uuid,timestamp:timestamp,content:content,mime:mime,hash:hash});
}
}
class TimeChainDataSqliteRecord //extends Interface(InterfaceRecord)
{
cmd = 'timechain-record'
send(func, data){
data.func = func;
return ipcRenderer.invoke(this.cmd,data);
}
add(uuid,timestamp,content,mime,hash){
return this.send('add',{uuid:uuid,timestamp:timestamp,content:content,mime:mime,hash:hash});
}
get(uuid){
return this.send('get',{uuid:uuid});
}
find(search,sort=null,limit=undefined,offset=0){
return this.send('find',{search:search,sort:sort,limit:limit,offset:offset});
}
delete(uuid){
return this.sedn('delete',{uuid:uuid});
}
update(uuid,content,mime,hash){
return this.send('update',{uuid:uuid,content:content,mime:mime,hash:hash});
}
}
class TimeChainDataSqlite {
}
module.exports = {
TimeChainDataSqlite,
TimeChainDataSqliteRecord,
TimeChainDataSqliteFile,
TimeChainDataSqliteTagLink,
TimeChainDataSqliteTag
}