about summary refs log tree commit diff stats
path: root/js/scripting-lang/repl/.repl_history
diff options
context:
space:
mode:
Diffstat (limited to 'js/scripting-lang/repl/.repl_history')
-rw-r--r--js/scripting-lang/repl/.repl_history216
1 files changed, 216 insertions, 0 deletions
diff --git a/js/scripting-lang/repl/.repl_history b/js/scripting-lang/repl/.repl_history
new file mode 100644
index 0000000..6f69f53
--- /dev/null
+++ b/js/scripting-lang/repl/.repl_history
@@ -0,0 +1,216 @@
+first_mixed : mixed[1];
+name_mixed : mixed.name;
+second_mixed : mixed[2];
+..assert first_mixed = 1;
+..assert name_mixed = "Bob";
+..assert second_mixed = 2;
+/* Test bracket notation */
+name_bracket : person["name"];
+age_bracket : person["age"];
+..assert name_bracket = "Alice";
+..assert age_bracket = 30;
+..out "Tables test completed"; 
+/* HTTP GET request example */
+/* Simple GET request to JSONPlaceholder API */
+/* Make a GET request to fetch a post */
+..emit {
+    action: "http_request",
+    method: "GET",
+    url: "https://jsonplaceholder.typicode.com/posts/1",
+    headers: {
+        "Accept": "application/json"
+    }
+};
+/* Return request info */
+{
+    request_type: "GET",
+    url: "https://jsonplaceholder.typicode.com/posts/1",
+    description: "Fetching a sample post from JSONPlaceholder"
+}
+/* HTTP GET request example */
+/* Simple GET request to JSONPlaceholder API */
+/* Make a GET request to fetch a post */
+..emit {
+    action: "http_request",
+    method: "GET",
+    url: "https://jsonplaceholder.typicode.com/posts/1",
+    headers: {
+        "Accept": "application/json"
+    }
+};
+/* Return request info */
+{
+    request_type: "GET",
+    url: "https://jsonplaceholder.typicode.com/posts/1",
+    description: "Fetching a sample post from JSONPlaceholder"
+}
+/* File operations example */
+/* Demonstrates file adapter integration */
+/* Get current state */
+state : ..listen;
+/* Read a file using file adapter */
+..emit {
+    action: "read_file",
+    filename: "tests/09_tables.txt"
+};
+/* Save current state to file */
+..emit {
+    action: "save_file",
+    filename: "current_state.json",
+    data: state
+};
+/* Return operation info */
+{
+    operations: [
+        { action: "read_file", filename: "tests/09_tables.txt" },
+        { action: "save_file", filename: "current_state.json", data: state }
+    ],
+    note: "File operations processed through file adapter"
+}
+/* File adapter demonstration */
+/* This script uses the file adapter to read and execute the target file */
+/* Emit command to read the file using file adapter */
+..emit {
+    action: "read_file",
+    filename: "/Users/eli/Code/tour/js/scripting-lang/tests/09_tables.txt"
+};
+/* Return info about the operation */
+{
+    operation: "read_file",
+    filename: "/Users/eli/Code/tour/js/scripting-lang/tests/09_tables.txt",
+    note: "File content will be available through file adapter"
+}
+state : ..listen; result : { message: 'Hello from harness', state: state };
+state : ..listen; result : { message: "Hello from harness", state: state };
+/* HTTP GET request example */
+/* Simple GET request to JSONPlaceholder API */
+/* Make a GET request to fetch a post */
+..emit {
+    action: "http_request",
+    method: "GET",
+    url: "https://jsonplaceholder.typicode.com/posts/1",
+    headers: {
+        "Accept": "application/json"
+    }
+};
+/* Return request info */
+{
+    request_type: "GET",
+    url: "https://jsonplaceholder.typicode.com/posts/1",
+    description: "Fetching a sample post from JSONPlaceholder"
+}
+..emit { action: "test" };
+..emit { action: "http_request", method: "GET", url: "https://jsonplaceholder.typicode.com/posts/1" };
+..emit { action: "http_request", method: "GET", url: "https://jsonplaceholder.typicode.com/posts/1" };
+state : ..listen; result : { message: "Test state", version: 1 };
+state : ..listen; result : { message: "Test state", version: 1 };
+state : ..listen; result : { message: "Test state", version: 1 };
+state : ..listen; result : { message: "Test state", version: 1 };
+state : ..listen; result : { message: "Test state", version: 1 };
+state : ..listen; result : { message: "Test state", version: 1 };
+state : ..listen; result : { message: "Test state", version: 1 };
+state : ..listen; result : { message: "Test state", version: 1 };
+/* Branching and state management demonstration */
+/* Shows advanced harness features */
+/* Get current state */
+state : ..listen;
+/* Create a branching scenario */
+branch_scenario : when state is
+    { action: "create_branch", name: branchName, fromVersion: version } then {
+        action: "branch_created",
+        branch_name: branchName,
+        base_version: version,
+        timestamp: Date.now(),
+        status: "ready"
+    }
+    { action: "merge_branch", source: sourceBranch, target: targetBranch } then {
+        action: "branch_merged",
+        source_branch: sourceBranch,
+        target_branch: targetBranch,
+        timestamp: Date.now(),
+        status: "merged"
+    }
+    { action: "compare_versions", from: fromVersion, to: toVersion } then {
+        action: "version_compared",
+        from_version: fromVersion,
+        to_version: toVersion,
+        timestamp: Date.now(),
+        status: "compared"
+    }
+    _ then {
+        action: "unknown",
+        timestamp: Date.now(),
+        status: "unknown"
+    };
+/* Log the branching operation */
+..emit {
+    action: "console_log",
+    message: "Branching operation: " + branch_scenario.action + " - " + branch_scenario.status
+};
+/* Save branch state */
+..emit {
+    action: "save_file",
+    filename: "branch_" + branch_scenario.action + "_" + Date.now() + ".json",
+    data: branch_scenario
+};
+/* Return branch scenario */
+branch_scenario
+state : ..listen; result : { message: "Initial state", version: 1 };
+state : ..listen; result : { message: "Updated state", version: 2, newField: "value" };
+state : ..listen; result : { message: "Test state", version: 1 };
+/* Error recovery and resilience demonstration */
+/* Shows how the harness handles errors gracefully */
+/* Get current state */
+state : ..listen;
+/* Simulate different error scenarios */
+error_scenario : when state is
+    { action: "simulate_timeout" } then {
+        action: "timeout_simulation",
+        retry_count: 0,
+        max_retries: 3,
+        status: "retrying"
+    }
+    { action: "simulate_network_error" } then {
+        action: "network_error_simulation",
+        retry_count: 0,
+        max_retries: 5,
+        backoff_delay: 2000,
+        status: "retrying"
+    }
+    { action: "simulate_script_error" } then {
+        action: "script_error_simulation",
+        recovery_action: "rollback",
+        rollback_version: state.version - 1,
+        status: "recovering"
+    }
+    { action: "test_resilience", data: testData } then {
+        action: "resilience_test",
+        test_data: testData,
+        attempts: 0,
+        max_attempts: 3,
+        status: "testing"
+    }
+    _ then {
+        action: "no_error",
+        status: "normal",
+        timestamp: Date.now()
+    };
+/* Log the error recovery operation */
+..emit {
+    action: "console_log",
+    message: "Error recovery: " + error_scenario.action + " - " + error_scenario.status
+};
+/* Save error recovery state */
+..emit {
+    action: "save_file",
+    filename: "error_recovery_" + error_scenario.action + ".json",
+    data: error_scenario
+};
+/* Return error scenario */
+error_scenario
+result : add 5 3;
+a : 1;
+b : 2;
+c : x y -> x + y;
+apply c a b;
+d : c a b;
\ No newline at end of file