-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#201
- Loading branch information
FlavioLionelRita
committed
Nov 28, 2023
1 parent
8de6548
commit 70ce19d
Showing
5 changed files
with
94 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,28 @@ | ||
import { IModelManager } from '3xpr' | ||
import { Expressions } from '3xpr' | ||
const CryptoJS = require('crypto-js') | ||
|
||
export class SentenceLibrary { | ||
// eslint-disable-next-line no-useless-constructor | ||
public constructor (private readonly model:IModelManager) {} | ||
public constructor (private readonly expressions:Expressions) {} | ||
|
||
public load ():void { | ||
this.functions() | ||
} | ||
|
||
private functions (): void { | ||
this.model.addFunction('toBase64(value:string):string', (value: string):string => CryptoJS.enc.Base64.parse(value)) | ||
this.model.addFunction('getBase64(value:string):string', (value: string): string => CryptoJS.enc.Base64.stringify(value)) | ||
this.model.addFunction('encrypt(value:string):string', (value: string, key:string):string => CryptoJS.AES.encrypt(value, key).toString()) | ||
this.model.addFunction('decrypt(value:string):string', (value: string, key:string):string => { | ||
this.expressions.addFunction('toBase64(value:string):string', (value: string):string => CryptoJS.enc.Base64.parse(value)) | ||
this.expressions.addFunction('getBase64(value:string):string', (value: string): string => CryptoJS.enc.Base64.stringify(value)) | ||
this.expressions.addFunction('encrypt(value:string):string', (value: string, key:string):string => CryptoJS.AES.encrypt(value, key).toString()) | ||
this.expressions.addFunction('decrypt(value:string):string', (value: string, key:string):string => { | ||
const bytes = CryptoJS.AES.decrypt(value, key) | ||
return bytes.toString(CryptoJS.enc.Utf8) | ||
}) | ||
this.model.addFunction('update(list: any[], predicate: any):any', ():void => { throw new Error('NotImplemented') }) | ||
this.model.addFunction('updateAll(list: any[], predicate: any):any', ():void => { throw new Error('NotImplemented') }) | ||
this.model.addFunction('deleteAll(list: any[]):any', ():void => { throw new Error('NotImplemented') }) | ||
this.model.addFunction('having(list: T[], predicate: boolean):T[]', ():void => { throw new Error('NotImplemented') }) | ||
this.model.addFunction('include(list: any[], predicate: any):any', ():void => { throw new Error('NotImplemented') }) | ||
this.model.addFunction('desc(value:any):void', ():void => { throw new Error('NotImplemented') }) | ||
this.model.addFunction('asc(value:any):void', ():void => { throw new Error('NotImplemented') }) | ||
this.expressions.addFunction('update(list: any[], predicate: any):any', ():void => { throw new Error('NotImplemented') }) | ||
this.expressions.addFunction('updateAll(list: any[], predicate: any):any', ():void => { throw new Error('NotImplemented') }) | ||
this.expressions.addFunction('deleteAll(list: any[]):any', ():void => { throw new Error('NotImplemented') }) | ||
this.expressions.addFunction('having(list: T[], predicate: boolean):T[]', ():void => { throw new Error('NotImplemented') }) | ||
this.expressions.addFunction('include(list: any[], predicate: any):any', ():void => { throw new Error('NotImplemented') }) | ||
this.expressions.addFunction('desc(value:any):void', ():void => { throw new Error('NotImplemented') }) | ||
this.expressions.addFunction('asc(value:any):void', ():void => { throw new Error('NotImplemented') }) | ||
} | ||
} |