chore: crush git history - reborn from consolidation on 2026-03-10
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
/**
|
||||
* APOSTL AST Types
|
||||
* Formula parsing and evaluation types for the APOSTL contract language.
|
||||
*/
|
||||
|
||||
export type FormulaNode =
|
||||
| { type: 'literal'; value: boolean | number | string | null }
|
||||
| { type: 'variable'; name: string; accessor?: string[] | undefined }
|
||||
| { type: 'comparison'; op: Comparator; left: FormulaNode; right: FormulaNode }
|
||||
| { type: 'boolean'; op: BooleanOperator; left: FormulaNode; right: FormulaNode }
|
||||
| { type: 'conditional'; condition: FormulaNode; then: FormulaNode; else: FormulaNode }
|
||||
| { type: 'quantified'; quantifier: 'for' | 'exists'; variable: string; collection: OperationCall; body: FormulaNode }
|
||||
| { type: 'operation'; header: OperationHeader; parameter: OperationParameter; accessor?: string[] | undefined }
|
||||
| { type: 'previous'; inner: FormulaNode }
|
||||
| { type: 'status'; code: number }
|
||||
|
||||
export type Comparator = '==' | '!=' | '<=' | '>=' | '<' | '>' | 'matches'
|
||||
export type BooleanOperator = '&&' | '||' | '=>'
|
||||
export type OperationPathSegment =
|
||||
| { type: 'text'; value: string }
|
||||
| { type: 'expression'; expression: FormulaNode }
|
||||
export type OperationHeader =
|
||||
| 'request_body'
|
||||
| 'response_body'
|
||||
| 'response_payload'
|
||||
| 'response_code'
|
||||
| 'request_headers'
|
||||
| 'response_headers'
|
||||
| 'query_params'
|
||||
| 'cookies'
|
||||
| 'response_time'
|
||||
| 'request_params'
|
||||
| 'redirect_count'
|
||||
| 'redirect_url'
|
||||
| 'redirect_status'
|
||||
| 'timeout_occurred'
|
||||
| 'timeout_value'
|
||||
| 'request_files'
|
||||
| 'request_fields'
|
||||
| 'stream_chunks'
|
||||
| 'stream_duration'
|
||||
| string
|
||||
export type OperationParameter =
|
||||
| { type: 'this' }
|
||||
| { type: 'call'; method: 'GET'; path: OperationPathSegment[] }
|
||||
export type OperationCall = { header: OperationHeader; parameter: OperationParameter; accessor?: string[] | undefined }
|
||||
|
||||
export interface ParseResult {
|
||||
readonly ast: FormulaNode
|
||||
readonly raw: string
|
||||
}
|
||||
Reference in New Issue
Block a user