0.0.36 • Published 2 years ago
cipher-solomon v0.0.36
Module
import
import { cipher, decipher, random, createDate, calculateAge, hash, hostname, calculateAge, Client, Storage, Database, Backend, restoration, tableControls, SuggestionInput } from 'cipher-solomon';
Keychain
encrypt
cipher(...)
decrypt
decipher(...)
random
random()
createDate
createDate(0, 0, 0)
calculateAge
calculateAge(dateString)
hash
hash(...)
hostname
hostname()
S3 Adapter
init
const options = {
region: process.env.VUE_APP_DEFAULT_S3_REGION,
bucket: process.env.VUE_APP_DEFAULT_S3_BUCKET,
accessKeyId: process.env.VUE_APP_DEFAULT_S3_ACCESSKEYID,
secretAccessKey: process.env.VUE_APP_DEFAULT_S3_SECRETACCESSKEY
};
const client = new Client(options);
Vue.prototype.$client = client;
list
this.$client.listObjects(Prefix)
.then((data) => {
...
})
.catch((error) => {
...
});
put
this.$client.putObject(object, Key)
.then((data) => {
...
})
.catch((error) => {
...
});
delete
this.$client.deleteObject(Key)
.then((data) => {
...
})
.catch((error) => {
...
});
Storage
init
const storage = new Storage({
APP_BASE_URL: process.env.VUE_APP_DEFAULT_LEAN_BASEURL,
APP_LEAN_APPID: process.env.VUE_APP_DEFAULT_LEAN_APPID,
APP_LEAN_APPKEY: process.env.VUE_APP_DEFAULT_LEAN_APPKEY
});
Vue.prototype.$database = storage;
Database (Backend)
init (Database)
const database = new Database({
APP_BASE_URL: process.env.VUE_APP_DEFAULT_PARSE_BASEURL,
APP_PARSE_APPID: process.env.VUE_APP_DEFAULT_PARSE_APPID
});
Vue.prototype.$database = database;
init (Backend)
const backend = new Backend({
APP_BASE_URL: process.env.VUE_APP_DEFAULT_PARSE_BASEURL,
APP_PARSE_APPID: process.env.VUE_APP_DEFAULT_PARSE_APPID,
APP_PARSE_JAVASCRIPTKEY: process.env.VUE_APP_DEFAULT_PARSE_JAVASCRIPTKEY,
APP_PARSE_APIKEY: process.env.VUE_APP_DEFAULT_PARSE_APIKEY
});
Vue.prototype.$database = backend;
create
this.$database
.create(resource, body)
.then(response => {
})
.catch(error => {
})
retrieve
this.$database
.retrieve(resource, params)
.then(response => {
})
.catch(error => {
})
retrieveById
this.$database
.retrieveById(resource, objectId, params)
.then(response => {
})
.catch(error => {
})
updateById
this.$database
.updateById(resource, objectId, body)
.then(response => {
})
.catch(error => {
})
deleteById
this.$database
.deleteById(resource, objectId, body)
.then(response => {
})
.catch(error => {
})
aggregate
this.$database
.aggregate(resource, params)
.then(response => {
})
.catch(error => {
})
batch
this.$database
.batch(body)
.then(response => {
})
.catch(error => {
})
user
this.$database.user()
new user
this.$database.newUser(...)
session
this.$database.session()
role
this.$database.role()
query
this.$databse.query()
Restoration
apply
export default {
...
mixins: [restoration],
...
}
save
this.saveRestorationState(data);
load
const data = this.loadRestorationState();
example
export default {
...
watch: {
data: {
handler: function (newValue, oldValue) {
this.saveRestorationState(newValue);
const object = this.transformation(newValue);
this.$emit("update", object);
},
deep: true,
immediate: true,
},
},
methods: {
transformation(data) {
return ...
},
reset() {
const data = this.loadRestorationState();
const _data = this.transformation(data);
this.$emit("update", _data);
this.data = data;
},
},
...
}
Table Controls
data
data() {
return {
...
tableConfig: tableConfig,
...
};
},
mixins
mixins: [..., tableControls, ...],
computed
computed: {
include() {
return "...,...";
},
exclude() {
return [...];
},
resource() {
return ...;
},
where() {
return ...;
},
formName() {
return ...;
},
sessionToken() {
return ...;
},
masterKey() {
return ...;
}
},
example
import tableConfig from "./tableConfig";
import { _invoiceWhere } from "@/utils/defaultWheres";
import { tableControls } from 'cipher-table-controls-mixins';
const _resource = process.env.VUE_APP_DEFAULT_INVOICE;
export default {
name: "InvoiceTable",
components: {},
data() {
return {
tableConfig: tableConfig,
};
},
mixins: [tableControls],
computed: {
include() {
return "from,to";
},
exclude() {
return ["items"];
},
resource() {
return _resource;
},
where() {
if (this.keywords.length === 0) {
return undefined;
}
return _invoiceWhere(this.keywords);
},
formName() {
return "Invoice Form";
},
},
mounted() {},
created() {},
destroyed() {},
methods: {},
};
SuggestionInput
components
components: {
SuggestionInput,
},
data
data() {
return {
...
suggestions: [],
...
};
},
template
<suggestion-input
:suggestions="suggestions"
:value="item.description"
placeholder="Enter description"
@update="updateSelected"
/>
0.0.35
2 years ago
0.0.36
2 years ago
0.0.34
2 years ago
0.0.33
2 years ago
0.0.32
3 years ago
0.0.31
3 years ago
0.0.23
3 years ago
0.0.25
3 years ago
0.0.30
3 years ago
0.0.26
3 years ago
0.0.27
3 years ago
0.0.28
3 years ago
0.0.29
3 years ago
0.0.22
3 years ago
0.0.21
3 years ago
0.0.20
3 years ago
0.0.19
3 years ago
0.0.18
3 years ago
0.0.16
3 years ago
0.0.15
3 years ago
0.0.13
3 years ago
0.0.14
3 years ago
0.0.11
3 years ago
0.0.8
4 years ago
0.0.7
4 years ago
0.0.6
4 years ago
0.0.5
4 years ago
0.0.4
4 years ago
0.0.3
4 years ago
0.0.2
4 years ago
0.0.1
4 years ago