-
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.
fully transitioned to detailed state data structure
- Loading branch information
Showing
3 changed files
with
98 additions
and
29 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,46 @@ | ||
/** | ||
* Representation of each spec being put to exectution, | ||
* become concrete and not only a spec. | ||
*/ | ||
export interface RuntimeState { | ||
/** | ||
* `"idle"` is waiting runtime didn't start yet. | ||
* `"running"` is request being performed right now. | ||
* `"success"` is request finished, responded with ok status. | ||
* `"unsuccess"` is request finished, responded with not ok status. | ||
* `"error"` for when the request didn't even reach the server. | ||
*/ | ||
readonly step: "idle" | "running" | "success" | "unsuccess" | "error"; | ||
readonly text: string; | ||
readonly status: number; | ||
/** Observability snapshot of the request. With blank values while `step="idle"`. */ | ||
readonly request: RequestInfo; | ||
/** Observability of the response. With blank values if there wasn't a server response yet. */ | ||
readonly response: ResponseInfo; | ||
/** Any exception unrelated to the direct 1:1 request-response relation (see `step="error"`). */ | ||
readonly errorMessage: string; | ||
/** Useful metadata for performance visibility. */ | ||
readonly startedAt: number; | ||
/** Useful metadata for performance visibility. */ | ||
readonly finishedAt: number; | ||
} | ||
|
||
/** | ||
* Applied final data used to make a real request run. | ||
* | ||
* However, due to browser policies, the actual request headers for example are not | ||
* fully acessible. There's no API available to preview what the browser itself intercepted. | ||
*/ | ||
export interface RequestInfo { | ||
readonly url: string; | ||
readonly method: string; | ||
readonly body: string; | ||
readonly headers: { [key: string]: string }; | ||
readonly headers: Array<{ key: string; value: string }>; | ||
} | ||
|
||
/** | ||
* Response received by the server after a request. | ||
*/ | ||
export interface ResponseInfo { | ||
readonly status: number; | ||
readonly body: string; | ||
readonly headers: { [key: string]: string }; | ||
readonly headers: Array<{ key: string; value: string }>; | ||
} |
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