@gcoredev/fastedge-test 0.2.1 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/fastedge-cli/METADATA.json +1 -1
- package/dist/fastedge-cli/fastedge-run-darwin-arm64 +0 -0
- package/dist/fastedge-cli/fastedge-run-linux-x64 +0 -0
- package/dist/fastedge-cli/fastedge-run.exe +0 -0
- package/dist/lib/index.cjs +28 -15
- package/dist/lib/index.js +28 -15
- package/dist/lib/runner/HostFunctions.d.ts +1 -0
- package/dist/lib/test-framework/index.cjs +28 -15
- package/dist/lib/test-framework/index.js +28 -15
- package/dist/server.js +16 -16
- package/docs/API.md +56 -56
- package/docs/DEBUGGER.md +7 -7
- package/docs/TEST_CONFIG.md +19 -19
- package/package.json +2 -2
package/docs/API.md
CHANGED
|
@@ -18,12 +18,12 @@ The port can be overridden via the `PORT` environment variable. The active port
|
|
|
18
18
|
|
|
19
19
|
The `POST /api/execute`, `POST /api/send`, and `POST /api/config` endpoints accept an optional `X-Source` request header that tags the origin of the operation in WebSocket broadcast events.
|
|
20
20
|
|
|
21
|
-
| Value
|
|
22
|
-
|
|
|
23
|
-
| `ui`
|
|
24
|
-
| `ai_agent`
|
|
25
|
-
| `api`
|
|
26
|
-
| `system`
|
|
21
|
+
| Value | Description |
|
|
22
|
+
| ------------ | ------------------------------------------------------- |
|
|
23
|
+
| `ui` | Request originated from the web UI (default if omitted) |
|
|
24
|
+
| `ai_agent` | Request originated from an AI agent |
|
|
25
|
+
| `api` | Request originated from direct API usage |
|
|
26
|
+
| `system` | Request originated from an automated system |
|
|
27
27
|
|
|
28
28
|
```http
|
|
29
29
|
X-Source: ai_agent
|
|
@@ -179,11 +179,11 @@ curl -X POST http://localhost:5179/api/load \
|
|
|
179
179
|
|
|
180
180
|
**Error Responses**
|
|
181
181
|
|
|
182
|
-
| Status | Condition
|
|
183
|
-
| ------ |
|
|
184
|
-
| `400` | Validation failed, missing both `wasmPath` and `wasmBase64`, invalid path, or path does not end in `.wasm`
|
|
185
|
-
| `400` | `httpPort` is specified and already in use (HTTP-WASM only)
|
|
186
|
-
| `500` | WASM load failed or runner initialization error
|
|
182
|
+
| Status | Condition |
|
|
183
|
+
| ------ | ------------------------------------------------------------------------------------------------------------ |
|
|
184
|
+
| `400` | Validation failed, missing both `wasmPath` and `wasmBase64`, invalid path, or path does not end in `.wasm` |
|
|
185
|
+
| `400` | `httpPort` is specified and already in use (HTTP-WASM only) |
|
|
186
|
+
| `500` | WASM load failed or runner initialization error |
|
|
187
187
|
|
|
188
188
|
---
|
|
189
189
|
|
|
@@ -417,10 +417,10 @@ curl -X POST http://localhost:5179/api/execute \
|
|
|
417
417
|
|
|
418
418
|
**Error Responses**
|
|
419
419
|
|
|
420
|
-
| Status | Condition
|
|
421
|
-
| ------ |
|
|
422
|
-
| `400` | No WASM module loaded, or missing `path`/`url` for HTTP-WASM, or missing `url` for Proxy-WASM
|
|
423
|
-
| `500` | Execution failed
|
|
420
|
+
| Status | Condition |
|
|
421
|
+
| ------ | ----------------------------------------------------------------------------------------------- |
|
|
422
|
+
| `400` | No WASM module loaded, or missing `path`/`url` for HTTP-WASM, or missing `url` for Proxy-WASM |
|
|
423
|
+
| `500` | Execution failed |
|
|
424
424
|
|
|
425
425
|
---
|
|
426
426
|
|
|
@@ -529,10 +529,10 @@ curl -X POST http://localhost:5179/api/call \
|
|
|
529
529
|
|
|
530
530
|
**Error Responses**
|
|
531
531
|
|
|
532
|
-
| Status | Condition
|
|
533
|
-
| ------ |
|
|
534
|
-
| `400` | Validation failed (invalid hook name, missing `properties`), or no WASM module loaded
|
|
535
|
-
| `500` | Hook execution failed
|
|
532
|
+
| Status | Condition |
|
|
533
|
+
| ------ | --------------------------------------------------------------------------------------- |
|
|
534
|
+
| `400` | Validation failed (invalid hook name, missing `properties`), or no WASM module loaded |
|
|
535
|
+
| `500` | Hook execution failed |
|
|
536
536
|
|
|
537
537
|
---
|
|
538
538
|
|
|
@@ -652,10 +652,10 @@ curl -X POST http://localhost:5179/api/send \
|
|
|
652
652
|
|
|
653
653
|
**Error Responses**
|
|
654
654
|
|
|
655
|
-
| Status | Condition
|
|
656
|
-
| ------ |
|
|
657
|
-
| `400` | Validation failed (missing `url` or `properties`), or no WASM module loaded
|
|
658
|
-
| `500` | Execution failed
|
|
655
|
+
| Status | Condition |
|
|
656
|
+
| ------ | ----------------------------------------------------------------------------- |
|
|
657
|
+
| `400` | Validation failed (missing `url` or `properties`), or no WASM module loaded |
|
|
658
|
+
| `500` | Execution failed |
|
|
659
659
|
|
|
660
660
|
---
|
|
661
661
|
|
|
@@ -744,9 +744,9 @@ curl http://localhost:5179/api/config
|
|
|
744
744
|
|
|
745
745
|
**Error Responses**
|
|
746
746
|
|
|
747
|
-
| Status | Condition
|
|
748
|
-
| ------ |
|
|
749
|
-
| `404` | `fastedge-config.test.json` does not exist
|
|
747
|
+
| Status | Condition |
|
|
748
|
+
| ------ | ------------------------------------------- |
|
|
749
|
+
| `404` | `fastedge-config.test.json` does not exist |
|
|
750
750
|
|
|
751
751
|
---
|
|
752
752
|
|
|
@@ -805,10 +805,10 @@ curl -X POST http://localhost:5179/api/config \
|
|
|
805
805
|
|
|
806
806
|
**Error Responses**
|
|
807
807
|
|
|
808
|
-
| Status | Condition
|
|
809
|
-
| ------ |
|
|
810
|
-
| `400` | Validation failed (missing `config.appType`, `config.request`, or `config.properties`)
|
|
811
|
-
| `500` | File write failed
|
|
808
|
+
| Status | Condition |
|
|
809
|
+
| ------ | ---------------------------------------------------------------------------------------- |
|
|
810
|
+
| `400` | Validation failed (missing `config.appType`, `config.request`, or `config.properties`) |
|
|
811
|
+
| `500` | File write failed |
|
|
812
812
|
|
|
813
813
|
---
|
|
814
814
|
|
|
@@ -863,10 +863,10 @@ curl -X POST http://localhost:5179/api/config/save-as \
|
|
|
863
863
|
|
|
864
864
|
**Error Responses**
|
|
865
865
|
|
|
866
|
-
| Status | Condition
|
|
867
|
-
| ------ |
|
|
868
|
-
| `400` | Missing `config` or `filePath`
|
|
869
|
-
| `500` | File write or directory creation failed
|
|
866
|
+
| Status | Condition |
|
|
867
|
+
| ------ | ---------------------------------------- |
|
|
868
|
+
| `400` | Missing `config` or `filePath` |
|
|
869
|
+
| `500` | File write or directory creation failed |
|
|
870
870
|
|
|
871
871
|
---
|
|
872
872
|
|
|
@@ -886,23 +886,23 @@ Returns the JSON Schema document with `Content-Type: application/json`.
|
|
|
886
886
|
|
|
887
887
|
#### Request Schemas
|
|
888
888
|
|
|
889
|
-
| Name
|
|
890
|
-
|
|
|
891
|
-
| `api-load`
|
|
892
|
-
| `api-send`
|
|
893
|
-
| `api-call`
|
|
894
|
-
| `api-config`
|
|
889
|
+
| Name | Description |
|
|
890
|
+
| -------------- | ------------------------------------------- |
|
|
891
|
+
| `api-load` | Request body schema for `POST /api/load` |
|
|
892
|
+
| `api-send` | Request body schema for `POST /api/send` |
|
|
893
|
+
| `api-call` | Request body schema for `POST /api/call` |
|
|
894
|
+
| `api-config` | Request body schema for `POST /api/config` |
|
|
895
895
|
|
|
896
896
|
#### Response / Type Schemas
|
|
897
897
|
|
|
898
|
-
| Name
|
|
899
|
-
|
|
|
900
|
-
| `fastedge-config.test`
|
|
901
|
-
| `hook-result`
|
|
902
|
-
| `hook-call`
|
|
903
|
-
| `full-flow-result`
|
|
904
|
-
| `http-request`
|
|
905
|
-
| `http-response`
|
|
898
|
+
| Name | Description |
|
|
899
|
+
| ----------------------- | -------------------------------------------------------------- |
|
|
900
|
+
| `fastedge-config.test` | Schema for `fastedge-config.test.json` config files |
|
|
901
|
+
| `hook-result` | Shape of a single `HookResult` object |
|
|
902
|
+
| `hook-call` | Shape of a `HookCall` input object |
|
|
903
|
+
| `full-flow-result` | Shape of the `FullFlowResult` returned by full-flow endpoints |
|
|
904
|
+
| `http-request` | Shape of an `HttpRequest` for HTTP-WASM execution |
|
|
905
|
+
| `http-response` | Shape of an `HttpResponse` returned by HTTP-WASM execution |
|
|
906
906
|
|
|
907
907
|
**Example**
|
|
908
908
|
|
|
@@ -932,9 +932,9 @@ curl http://localhost:5179/api/schema/fastedge-config.test
|
|
|
932
932
|
|
|
933
933
|
**Error Responses**
|
|
934
934
|
|
|
935
|
-
| Status | Condition
|
|
936
|
-
| ------ |
|
|
937
|
-
| `404` | Schema name not found
|
|
935
|
+
| Status | Condition |
|
|
936
|
+
| ------ | ---------------------- |
|
|
937
|
+
| `404` | Schema name not found |
|
|
938
938
|
|
|
939
939
|
---
|
|
940
940
|
|
|
@@ -953,11 +953,11 @@ When a request body fails schema validation (Zod), `error` is the flattened Zod
|
|
|
953
953
|
|
|
954
954
|
**Common status codes**
|
|
955
955
|
|
|
956
|
-
| Status | Meaning
|
|
957
|
-
| ------ |
|
|
958
|
-
| `400` | Invalid request body, missing required fields, or precondition not met (e.g. no WASM loaded)
|
|
959
|
-
| `404` | Resource not found (config file, schema file)
|
|
960
|
-
| `500` | Internal server error during execution or I/O
|
|
956
|
+
| Status | Meaning |
|
|
957
|
+
| ------ | ---------------------------------------------------------------------------------------------- |
|
|
958
|
+
| `400` | Invalid request body, missing required fields, or precondition not met (e.g. no WASM loaded) |
|
|
959
|
+
| `404` | Resource not found (config file, schema file) |
|
|
960
|
+
| `500` | Internal server error during execution or I/O |
|
|
961
961
|
|
|
962
962
|
---
|
|
963
963
|
|
package/docs/DEBUGGER.md
CHANGED
|
@@ -98,13 +98,13 @@ curl http://localhost:5179/health
|
|
|
98
98
|
|
|
99
99
|
## Environment Variables
|
|
100
100
|
|
|
101
|
-
| Variable | Type | Default | Description
|
|
102
|
-
| -------------------- | -------- | ------- |
|
|
103
|
-
| `PORT` | `number` | unset | Port the HTTP server listens on. Defaults to `5179` when not set.
|
|
104
|
-
| `PROXY_RUNNER_DEBUG` | `"1"` | unset | Enable verbose debug logging for WebSocket and runner activity.
|
|
105
|
-
| `VSCODE_INTEGRATION` | `"true"` | unset | Set to `"true"` when running inside the VSCode extension; enables workspace WASM detection.
|
|
106
|
-
| `WORKSPACE_PATH` | `string` | unset | Absolute path to the workspace root; used as the `.env` file base and for port file placement.
|
|
107
|
-
| `FASTEDGE_RUN_PATH` | `string` | unset | Override the path to the `fastedge-run` CLI binary used to execute WASM modules.
|
|
101
|
+
| Variable | Type | Default | Description |
|
|
102
|
+
| -------------------- | -------- | ------- | ------------------------------------------------------------------------------------------------ |
|
|
103
|
+
| `PORT` | `number` | unset | Port the HTTP server listens on. Defaults to `5179` when not set. |
|
|
104
|
+
| `PROXY_RUNNER_DEBUG` | `"1"` | unset | Enable verbose debug logging for WebSocket and runner activity. |
|
|
105
|
+
| `VSCODE_INTEGRATION` | `"true"` | unset | Set to `"true"` when running inside the VSCode extension; enables workspace WASM detection. |
|
|
106
|
+
| `WORKSPACE_PATH` | `string` | unset | Absolute path to the workspace root; used as the `.env` file base and for port file placement. |
|
|
107
|
+
| `FASTEDGE_RUN_PATH` | `string` | unset | Override the path to the `fastedge-run` CLI binary used to execute WASM modules. |
|
|
108
108
|
|
|
109
109
|
### Usage examples
|
|
110
110
|
|
package/docs/TEST_CONFIG.md
CHANGED
|
@@ -22,25 +22,25 @@ The config schema is a union of two variants selected by `appType`:
|
|
|
22
22
|
|
|
23
23
|
### Top-Level Fields
|
|
24
24
|
|
|
25
|
-
| JSON Path | Type | Required (Schema)
|
|
26
|
-
| ------------------ | --------- |
|
|
27
|
-
| `$schema` | `string` | No
|
|
28
|
-
| `description` | `string` | No
|
|
29
|
-
| `wasm` | `object` | No
|
|
30
|
-
| `wasm.path` | `string` | Yes (if `wasm` present)
|
|
31
|
-
| `wasm.description` | `string` | No
|
|
32
|
-
| `appType` | `string` | Yes (schema) / CDN has runtime default
|
|
33
|
-
| `request` | `object` | **Yes**
|
|
34
|
-
| `request.method` | `string` | Yes (schema) / runtime default
|
|
35
|
-
| `request.url` | `string` | **Yes** (CDN only)
|
|
36
|
-
| `request.path` | `string` | **Yes** (HTTP-WASM only)
|
|
37
|
-
| `request.headers` | `object` | Yes (schema) / runtime default
|
|
38
|
-
| `request.body` | `string` | Yes (schema) / runtime default
|
|
39
|
-
| `properties` | `object` | **Yes** (schema) / runtime default
|
|
40
|
-
| `dotenv` | `object` | No
|
|
41
|
-
| `dotenv.enabled` | `boolean` | No
|
|
42
|
-
| `dotenv.path` | `string` | No
|
|
43
|
-
| `httpPort` | `integer` | No
|
|
25
|
+
| JSON Path | Type | Required (Schema) | Default | Description |
|
|
26
|
+
| ------------------ | --------- | -------------------------------------- | -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
27
|
+
| `$schema` | `string` | No | — | URI pointing to the JSON Schema file for IDE autocompletion and validation. |
|
|
28
|
+
| `description` | `string` | No | — | Human-readable label for this test scenario. |
|
|
29
|
+
| `wasm` | `object` | No | — | WASM binary configuration. Required when running without a programmatic `wasmBuffer`. |
|
|
30
|
+
| `wasm.path` | `string` | Yes (if `wasm` present) | — | Path to the compiled `.wasm` binary, relative to the config file or absolute. |
|
|
31
|
+
| `wasm.description` | `string` | No | — | Human-readable label for the WASM binary. |
|
|
32
|
+
| `appType` | `string` | Yes (schema) / CDN has runtime default | `"proxy-wasm"` | App variant. `"proxy-wasm"` for CDN mode; `"http-wasm"` for HTTP mode. HTTP-WASM has no default. |
|
|
33
|
+
| `request` | `object` | **Yes** | — | Incoming HTTP request to simulate. |
|
|
34
|
+
| `request.method` | `string` | Yes (schema) / runtime default | `"GET"` | HTTP method (e.g. `"GET"`, `"POST"`). |
|
|
35
|
+
| `request.url` | `string` | **Yes** (CDN only) | — | Full URL for the simulated upstream request (e.g. `"https://example.com/api"`). CDN mode only. |
|
|
36
|
+
| `request.path` | `string` | **Yes** (HTTP-WASM only) | — | Request path (e.g. `"/api/submit"`). HTTP-WASM mode only. The WASM module acts as the origin server and receives only the path portion of the request. |
|
|
37
|
+
| `request.headers` | `object` | Yes (schema) / runtime default | `{}` | Key/value map of request headers. All keys and values must be strings. |
|
|
38
|
+
| `request.body` | `string` | Yes (schema) / runtime default | `""` | Request body as a plain string. Use an empty string for requests with no body. |
|
|
39
|
+
| `properties` | `object` | **Yes** (schema) / runtime default | `{}` | CDN property key/value pairs passed to the WASM execution context. Values may be any JSON type. |
|
|
40
|
+
| `dotenv` | `object` | No | — | Dotenv file loading configuration. |
|
|
41
|
+
| `dotenv.enabled` | `boolean` | No | — | Whether to load a `.env` file before execution. |
|
|
42
|
+
| `dotenv.path` | `string` | No | — | Path to the `.env` file. If omitted, resolves `.env` relative to the config file directory. |
|
|
43
|
+
| `httpPort` | `integer` | No | — | HTTP-WASM only. Pin the subprocess to a specific port (1024–65535) instead of dynamic allocation from the 8100–8199 pool. Throws if the port is busy. |
|
|
44
44
|
|
|
45
45
|
### Required vs. Default Distinction
|
|
46
46
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gcoredev/fastedge-test",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2",
|
|
4
4
|
"private": false,
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -78,7 +78,7 @@
|
|
|
78
78
|
},
|
|
79
79
|
"dependencies": {
|
|
80
80
|
"@assemblyscript/wasi-shim": "^0.1.0",
|
|
81
|
-
"@gcoredev/fastedge-sdk-js": "^2.2.
|
|
81
|
+
"@gcoredev/fastedge-sdk-js": "^2.2.3",
|
|
82
82
|
"@gcoredev/proxy-wasm-sdk-as": "^1.2.3",
|
|
83
83
|
"@types/ws": "^8.18.1",
|
|
84
84
|
"express": "^4.19.2",
|