@gcoredev/fastedge-test 0.1.6 → 0.2.0

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.
Files changed (43) hide show
  1. package/dist/frontend/assets/{index-BpdzhbRl.js → index-CiqeJ9rz.js} +24 -24
  2. package/dist/frontend/index.html +1 -1
  3. package/dist/lib/index.cjs +164 -66
  4. package/dist/lib/index.d.ts +1 -0
  5. package/dist/lib/index.js +164 -66
  6. package/dist/lib/runner/HeaderManager.d.ts +6 -4
  7. package/dist/lib/runner/HostFunctions.d.ts +5 -5
  8. package/dist/lib/runner/HttpWasmRunner.d.ts +22 -5
  9. package/dist/lib/runner/IStateManager.d.ts +7 -7
  10. package/dist/lib/runner/IWasmRunner.d.ts +42 -10
  11. package/dist/lib/runner/PortManager.d.ts +4 -1
  12. package/dist/lib/runner/PropertyResolver.d.ts +3 -3
  13. package/dist/lib/runner/ProxyWasmRunner.d.ts +5 -2
  14. package/dist/lib/runner/standalone.d.ts +1 -1
  15. package/dist/lib/runner/types.d.ts +17 -8
  16. package/dist/lib/schemas/api.d.ts +2 -8
  17. package/dist/lib/schemas/config.d.ts +2 -13
  18. package/dist/lib/schemas/index.d.ts +2 -2
  19. package/dist/lib/test-framework/assertions.d.ts +18 -4
  20. package/dist/lib/test-framework/index.cjs +18634 -115
  21. package/dist/lib/test-framework/index.d.ts +2 -0
  22. package/dist/lib/test-framework/index.js +18651 -104
  23. package/dist/lib/test-framework/mock-origins.d.ts +56 -0
  24. package/dist/lib/test-framework/suite-runner.d.ts +16 -0
  25. package/dist/lib/test-framework/types.d.ts +1 -5
  26. package/dist/server.js +33 -33
  27. package/docs/API.md +48 -54
  28. package/docs/DEBUGGER.md +7 -8
  29. package/docs/INDEX.md +4 -1
  30. package/docs/RUNNER.md +126 -74
  31. package/docs/TEST_CONFIG.md +79 -40
  32. package/docs/TEST_FRAMEWORK.md +235 -36
  33. package/docs/WEBSOCKET.md +25 -21
  34. package/docs/quickstart.md +1 -13
  35. package/package.json +4 -1
  36. package/schemas/api-config.schema.json +5 -24
  37. package/schemas/api-load.schema.json +5 -0
  38. package/schemas/api-send.schema.json +0 -20
  39. package/schemas/fastedge-config.test.schema.json +5 -24
  40. package/schemas/full-flow-result.schema.json +17 -7
  41. package/schemas/hook-call.schema.json +16 -6
  42. package/schemas/hook-result.schema.json +16 -6
  43. package/schemas/http-response.schema.json +227 -5
@@ -49,6 +49,11 @@
49
49
  "type": "string",
50
50
  "const": "http-wasm"
51
51
  },
52
+ "httpPort": {
53
+ "type": "integer",
54
+ "minimum": 1024,
55
+ "maximum": 65535
56
+ },
52
57
  "request": {
53
58
  "type": "object",
54
59
  "properties": {
@@ -171,30 +176,6 @@
171
176
  "body"
172
177
  ],
173
178
  "additionalProperties": false
174
- },
175
- "response": {
176
- "type": "object",
177
- "properties": {
178
- "headers": {
179
- "default": {},
180
- "type": "object",
181
- "propertyNames": {
182
- "type": "string"
183
- },
184
- "additionalProperties": {
185
- "type": "string"
186
- }
187
- },
188
- "body": {
189
- "default": "",
190
- "type": "string"
191
- }
192
- },
193
- "required": [
194
- "headers",
195
- "body"
196
- ],
197
- "additionalProperties": false
198
179
  }
199
180
  },
200
181
  "required": [
@@ -21,7 +21,7 @@
21
21
  "type": "string"
22
22
  },
23
23
  "headers": {
24
- "$ref": "#/definitions/HeaderMap"
24
+ "$ref": "#/definitions/HeaderRecord"
25
25
  },
26
26
  "body": {
27
27
  "type": "string"
@@ -85,7 +85,7 @@
85
85
  "type": "object",
86
86
  "properties": {
87
87
  "headers": {
88
- "$ref": "#/definitions/HeaderMap"
88
+ "$ref": "#/definitions/HeaderRecord"
89
89
  },
90
90
  "body": {
91
91
  "type": "string"
@@ -100,7 +100,7 @@
100
100
  "type": "object",
101
101
  "properties": {
102
102
  "headers": {
103
- "$ref": "#/definitions/HeaderMap"
103
+ "$ref": "#/definitions/HeaderRecord"
104
104
  },
105
105
  "body": {
106
106
  "type": "string"
@@ -128,7 +128,7 @@
128
128
  "type": "object",
129
129
  "properties": {
130
130
  "headers": {
131
- "$ref": "#/definitions/HeaderMap"
131
+ "$ref": "#/definitions/HeaderRecord"
132
132
  },
133
133
  "body": {
134
134
  "type": "string"
@@ -143,7 +143,7 @@
143
143
  "type": "object",
144
144
  "properties": {
145
145
  "headers": {
146
- "$ref": "#/definitions/HeaderMap"
146
+ "$ref": "#/definitions/HeaderRecord"
147
147
  },
148
148
  "body": {
149
149
  "type": "string"
@@ -177,10 +177,20 @@
177
177
  "properties"
178
178
  ]
179
179
  },
180
- "HeaderMap": {
180
+ "HeaderRecord": {
181
181
  "type": "object",
182
182
  "additionalProperties": {
183
- "type": "string"
183
+ "anyOf": [
184
+ {
185
+ "type": "string"
186
+ },
187
+ {
188
+ "type": "array",
189
+ "items": {
190
+ "type": "string"
191
+ }
192
+ }
193
+ ]
184
194
  }
185
195
  }
186
196
  }
@@ -12,7 +12,7 @@
12
12
  "type": "object",
13
13
  "properties": {
14
14
  "headers": {
15
- "$ref": "#/definitions/HeaderMap"
15
+ "$ref": "#/definitions/HeaderRecord"
16
16
  },
17
17
  "body": {
18
18
  "type": "string"
@@ -36,7 +36,7 @@
36
36
  "type": "object",
37
37
  "properties": {
38
38
  "headers": {
39
- "$ref": "#/definitions/HeaderMap"
39
+ "$ref": "#/definitions/HeaderRecord"
40
40
  },
41
41
  "body": {
42
42
  "type": "string"
@@ -51,7 +51,8 @@
51
51
  "required": [
52
52
  "headers",
53
53
  "body"
54
- ]
54
+ ],
55
+ "description": "Seed state for the response hooks (`onResponseHeaders` / `onResponseBody`) when calling them in isolation via `callHook()`. The full-flow path (`callFullFlow`) generates the upstream response at runtime and does not consume this field — request hooks ignore it, and response hooks are called with the response built from the live origin fetch or built-in responder output."
55
56
  },
56
57
  "properties": {
57
58
  "type": "object",
@@ -67,14 +68,23 @@
67
68
  "required": [
68
69
  "hook",
69
70
  "request",
70
- "response",
71
71
  "properties"
72
72
  ]
73
73
  },
74
- "HeaderMap": {
74
+ "HeaderRecord": {
75
75
  "type": "object",
76
76
  "additionalProperties": {
77
- "type": "string"
77
+ "anyOf": [
78
+ {
79
+ "type": "string"
80
+ },
81
+ {
82
+ "type": "array",
83
+ "items": {
84
+ "type": "string"
85
+ }
86
+ }
87
+ ]
78
88
  }
79
89
  }
80
90
  }
@@ -36,7 +36,7 @@
36
36
  "type": "object",
37
37
  "properties": {
38
38
  "headers": {
39
- "$ref": "#/definitions/HeaderMap"
39
+ "$ref": "#/definitions/HeaderRecord"
40
40
  },
41
41
  "body": {
42
42
  "type": "string"
@@ -51,7 +51,7 @@
51
51
  "type": "object",
52
52
  "properties": {
53
53
  "headers": {
54
- "$ref": "#/definitions/HeaderMap"
54
+ "$ref": "#/definitions/HeaderRecord"
55
55
  },
56
56
  "body": {
57
57
  "type": "string"
@@ -79,7 +79,7 @@
79
79
  "type": "object",
80
80
  "properties": {
81
81
  "headers": {
82
- "$ref": "#/definitions/HeaderMap"
82
+ "$ref": "#/definitions/HeaderRecord"
83
83
  },
84
84
  "body": {
85
85
  "type": "string"
@@ -94,7 +94,7 @@
94
94
  "type": "object",
95
95
  "properties": {
96
96
  "headers": {
97
- "$ref": "#/definitions/HeaderMap"
97
+ "$ref": "#/definitions/HeaderRecord"
98
98
  },
99
99
  "body": {
100
100
  "type": "string"
@@ -128,10 +128,20 @@
128
128
  "properties"
129
129
  ]
130
130
  },
131
- "HeaderMap": {
131
+ "HeaderRecord": {
132
132
  "type": "object",
133
133
  "additionalProperties": {
134
- "type": "string"
134
+ "anyOf": [
135
+ {
136
+ "type": "string"
137
+ },
138
+ {
139
+ "type": "array",
140
+ "items": {
141
+ "type": "string"
142
+ }
143
+ }
144
+ ]
135
145
  }
136
146
  }
137
147
  }
@@ -12,10 +12,7 @@
12
12
  "type": "string"
13
13
  },
14
14
  "headers": {
15
- "type": "object",
16
- "additionalProperties": {
17
- "type": "string"
18
- }
15
+ "$ref": "#/definitions/IncomingHttpHeaders"
19
16
  },
20
17
  "body": {
21
18
  "type": "string"
@@ -56,7 +53,232 @@
56
53
  "contentType",
57
54
  "logs"
58
55
  ],
59
- "description": "HTTP Response type for HTTP WASM runner"
56
+ "description": "HTTP Response type for HTTP WASM runner.\n\n`headers` uses Node's `IncomingHttpHeaders` shape — common single-valued headers (`content-type`, `location`, `etag`, …) are typed as `string`; `set-cookie` is `string[]`; unknown keys are `string | string[] | undefined`. This preserves RFC 6265 Set-Cookie semantics (each cookie kept separate) and matches consumer expectations for Node's fetch/http ecosystem."
57
+ },
58
+ "IncomingHttpHeaders": {
59
+ "type": "object",
60
+ "properties": {
61
+ "accept": {
62
+ "type": "string"
63
+ },
64
+ "accept-encoding": {
65
+ "type": "string"
66
+ },
67
+ "accept-language": {
68
+ "type": "string"
69
+ },
70
+ "accept-patch": {
71
+ "type": "string"
72
+ },
73
+ "accept-ranges": {
74
+ "type": "string"
75
+ },
76
+ "access-control-allow-credentials": {
77
+ "type": "string"
78
+ },
79
+ "access-control-allow-headers": {
80
+ "type": "string"
81
+ },
82
+ "access-control-allow-methods": {
83
+ "type": "string"
84
+ },
85
+ "access-control-allow-origin": {
86
+ "type": "string"
87
+ },
88
+ "access-control-expose-headers": {
89
+ "type": "string"
90
+ },
91
+ "access-control-max-age": {
92
+ "type": "string"
93
+ },
94
+ "access-control-request-headers": {
95
+ "type": "string"
96
+ },
97
+ "access-control-request-method": {
98
+ "type": "string"
99
+ },
100
+ "age": {
101
+ "type": "string"
102
+ },
103
+ "allow": {
104
+ "type": "string"
105
+ },
106
+ "alt-svc": {
107
+ "type": "string"
108
+ },
109
+ "authorization": {
110
+ "type": "string"
111
+ },
112
+ "cache-control": {
113
+ "type": "string"
114
+ },
115
+ "connection": {
116
+ "type": "string"
117
+ },
118
+ "content-disposition": {
119
+ "type": "string"
120
+ },
121
+ "content-encoding": {
122
+ "type": "string"
123
+ },
124
+ "content-language": {
125
+ "type": "string"
126
+ },
127
+ "content-length": {
128
+ "type": "string"
129
+ },
130
+ "content-location": {
131
+ "type": "string"
132
+ },
133
+ "content-range": {
134
+ "type": "string"
135
+ },
136
+ "content-type": {
137
+ "type": "string"
138
+ },
139
+ "cookie": {
140
+ "type": "string"
141
+ },
142
+ "date": {
143
+ "type": "string"
144
+ },
145
+ "etag": {
146
+ "type": "string"
147
+ },
148
+ "expect": {
149
+ "type": "string"
150
+ },
151
+ "expires": {
152
+ "type": "string"
153
+ },
154
+ "forwarded": {
155
+ "type": "string"
156
+ },
157
+ "from": {
158
+ "type": "string"
159
+ },
160
+ "host": {
161
+ "type": "string"
162
+ },
163
+ "if-match": {
164
+ "type": "string"
165
+ },
166
+ "if-modified-since": {
167
+ "type": "string"
168
+ },
169
+ "if-none-match": {
170
+ "type": "string"
171
+ },
172
+ "if-unmodified-since": {
173
+ "type": "string"
174
+ },
175
+ "last-modified": {
176
+ "type": "string"
177
+ },
178
+ "location": {
179
+ "type": "string"
180
+ },
181
+ "origin": {
182
+ "type": "string"
183
+ },
184
+ "pragma": {
185
+ "type": "string"
186
+ },
187
+ "proxy-authenticate": {
188
+ "type": "string"
189
+ },
190
+ "proxy-authorization": {
191
+ "type": "string"
192
+ },
193
+ "public-key-pins": {
194
+ "type": "string"
195
+ },
196
+ "range": {
197
+ "type": "string"
198
+ },
199
+ "referer": {
200
+ "type": "string"
201
+ },
202
+ "retry-after": {
203
+ "type": "string"
204
+ },
205
+ "sec-fetch-site": {
206
+ "type": "string"
207
+ },
208
+ "sec-fetch-mode": {
209
+ "type": "string"
210
+ },
211
+ "sec-fetch-user": {
212
+ "type": "string"
213
+ },
214
+ "sec-fetch-dest": {
215
+ "type": "string"
216
+ },
217
+ "sec-websocket-accept": {
218
+ "type": "string"
219
+ },
220
+ "sec-websocket-extensions": {
221
+ "type": "string"
222
+ },
223
+ "sec-websocket-key": {
224
+ "type": "string"
225
+ },
226
+ "sec-websocket-protocol": {
227
+ "type": "string"
228
+ },
229
+ "sec-websocket-version": {
230
+ "type": "string"
231
+ },
232
+ "set-cookie": {
233
+ "type": "array",
234
+ "items": {
235
+ "type": "string"
236
+ }
237
+ },
238
+ "strict-transport-security": {
239
+ "type": "string"
240
+ },
241
+ "tk": {
242
+ "type": "string"
243
+ },
244
+ "trailer": {
245
+ "type": "string"
246
+ },
247
+ "transfer-encoding": {
248
+ "type": "string"
249
+ },
250
+ "upgrade": {
251
+ "type": "string"
252
+ },
253
+ "user-agent": {
254
+ "type": "string"
255
+ },
256
+ "vary": {
257
+ "type": "string"
258
+ },
259
+ "via": {
260
+ "type": "string"
261
+ },
262
+ "warning": {
263
+ "type": "string"
264
+ },
265
+ "www-authenticate": {
266
+ "type": "string"
267
+ }
268
+ },
269
+ "additionalProperties": {
270
+ "anyOf": [
271
+ {
272
+ "type": "string"
273
+ },
274
+ {
275
+ "type": "array",
276
+ "items": {
277
+ "type": "string"
278
+ }
279
+ }
280
+ ]
281
+ }
60
282
  }
61
283
  }
62
284
  }