lambdaorm-client-node
Version:
Client form lambda ORM service
31 lines • 2.09 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.SentenceLibrary = void 0;
const CryptoJS = require('crypto-js');
class SentenceLibrary {
// eslint-disable-next-line no-useless-constructor
constructor(exp) {
this.exp = exp;
}
load() {
this.functions();
}
functions() {
this.exp.addFunction('toBase64(value:string):string', (value) => CryptoJS.enc.Base64.parse(value), { description: 'Convert to base 64' });
this.exp.addFunction('getBase64(value:string):string', (value) => CryptoJS.enc.Base64.stringify(value), { description: 'Get base 64' });
this.exp.addFunction('encrypt(value:string):string', (value, key) => CryptoJS.AES.encrypt(value, key).toString(), { description: 'Encrypt' });
this.exp.addFunction('decrypt(value:string):string', (value, key) => {
const bytes = CryptoJS.AES.decrypt(value, key);
return bytes.toString(CryptoJS.enc.Utf8);
}, { description: 'Decrypt' });
this.exp.addFunction('update(list: any[], predicate: any):any', () => { throw new Error('NotImplemented'); }, { description: 'Update' });
this.exp.addFunction('updateAll(list: any[], predicate: any):any', () => { throw new Error('NotImplemented'); }, { description: 'Update all' });
this.exp.addFunction('deleteAll(list: any[]):any', () => { throw new Error('NotImplemented'); }, { description: 'Delete all' });
this.exp.addFunction('having(list: T[], predicate: boolean):T[]', () => { throw new Error('NotImplemented'); }, { description: 'Having' });
this.exp.addFunction('include(list: any[], predicate: any):any', () => { throw new Error('NotImplemented'); }, { description: 'Include' });
this.exp.addFunction('desc(value:any):void', () => { throw new Error('NotImplemented'); }, { description: 'Desc' });
this.exp.addFunction('asc(value:any):void', () => { throw new Error('NotImplemented'); }, { description: 'Asc' });
}
}
exports.SentenceLibrary = SentenceLibrary;
//# sourceMappingURL=library.js.map