-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6de8918
commit f12acea
Showing
12 changed files
with
3,100 additions
and
41 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
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
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
13 changes: 5 additions & 8 deletions
13
packages/jdm-editor/src/components/function/helpers/default-function.js
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,10 +1,7 @@ | ||
/** | ||
* @param input | ||
* @param {{ | ||
* dayjs: import('dayjs') | ||
* Big: import('big.js').BigConstructor | ||
* }} helpers | ||
*/ | ||
const handler = (input, { dayjs, Big }) => { | ||
import http from 'http'; | ||
import zen from 'zen'; | ||
|
||
export const handler = async (input) => { | ||
const a = zen.evaluate(); | ||
return input; | ||
}; |
11 changes: 11 additions & 0 deletions
11
packages/jdm-editor/src/components/function/helpers/global.d.ts
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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
declare namespace console { | ||
function log(...args: any[]): void; | ||
} | ||
|
||
interface Config { | ||
readonly maxDepth: number; | ||
readonly iteration: number; | ||
readonly trace: boolean; | ||
} | ||
|
||
declare const config: Config; |
28 changes: 28 additions & 0 deletions
28
packages/jdm-editor/src/components/function/helpers/http.d.ts
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 |
---|---|---|
@@ -0,0 +1,28 @@ | ||
declare class HttpResponse { | ||
readonly data: any; | ||
readonly headers: Record<string, string>; | ||
readonly status: number; | ||
} | ||
|
||
interface HttpConfig { | ||
headers: Record<string, string>; | ||
params: Record<string, string>; | ||
data: any; | ||
} | ||
|
||
export class Http { | ||
head(url: string, config?: HttpConfig): Promise<HttpResponse>; | ||
|
||
get(url: string, config?: HttpConfig): Promise<HttpResponse>; | ||
|
||
delete(url: string, config?: HttpConfig): Promise<HttpResponse>; | ||
|
||
post(url: string, data: any, config?: HttpConfig): Promise<HttpResponse>; | ||
|
||
patch(url: string, data: any, config?: HttpConfig): Promise<HttpResponse>; | ||
|
||
put(url: string, data: any, config?: HttpConfig): Promise<HttpResponse>; | ||
} | ||
|
||
declare const http: Http; | ||
export default http; |
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
48 changes: 48 additions & 0 deletions
48
packages/jdm-editor/src/components/function/helpers/zen.d.ts
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 |
---|---|---|
@@ -0,0 +1,48 @@ | ||
interface EvaluateOptions { | ||
trace?: boolean; | ||
} | ||
|
||
interface EvaluateResponse { | ||
performance: string; | ||
result: any; | ||
trace?: any; | ||
} | ||
|
||
interface ZenModule { | ||
/** | ||
* Evaluates ZEN expression | ||
* @param expression | ||
* @param context Must contain '$' key | ||
*/ | ||
evaluateExpression(expression: string, context: any): any; | ||
|
||
/** | ||
* Evaluates ZEN unary expression | ||
* @param expression | ||
* @param context Must contain '$' key | ||
*/ | ||
evaluateUnaryExpression(expression: string, context: any): boolean; | ||
|
||
/** | ||
* Evaluates ZEN unary expression | ||
* @param file File to be evaluated via DecisionLoader | ||
* @param context | ||
* @param opts | ||
*/ | ||
evaluate(file: string, context: any, opts?: EvaluateOptions): Promise<EvaluateResponse>; | ||
|
||
/** | ||
* Get Content from the DecisionLoader | ||
* @param file | ||
*/ | ||
get(file: string): Promise<any>; | ||
} | ||
|
||
export const evaluateExpression: ZenModule['evaluateExpression']; | ||
export const evaluateUnaryExpression: ZenModule['evaluateUnaryExpression']; | ||
export const evaluate: ZenModule['evaluate']; | ||
export const get: ZenModule['get']; | ||
|
||
declare const zenModule: ZenModule; | ||
|
||
export default zenModule; |
Oops, something went wrong.