-
Notifications
You must be signed in to change notification settings - Fork 1
/
manifest.zig
39 lines (34 loc) · 1.05 KB
/
manifest.zig
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
const std = @import("std");
pub const WasmData = struct {
data: []const u8,
hash: ?[]const u8 = null,
name: ?[]const u8 = null,
};
pub const WasmFile = struct { path: []const u8, hash: ?[]const u8 = null, name: ?[]const u8 = null };
pub const WasmUrl = struct {
url: []const u8,
hash: ?[]const u8 = null,
name: ?[]const u8 = null,
method: ?[]const u8 = null,
headers: ?std.json.ArrayHashMap([]const u8) = null,
};
pub const Wasm = union(enum) {
wasm_data: WasmData,
wasm_file: WasmFile,
wasm_url: WasmUrl,
pub fn jsonStringify(self: @This(), jws: anytype) !void {
switch (self) {
inline else => |value| {
try jws.write(value);
},
}
}
};
pub const Manifest = struct {
wasm: []const Wasm,
memory: ?struct { max_pages: ?u32, max_http_response_bytes: ?u64 } = null,
config: ?std.json.ArrayHashMap([]const u8) = null,
allowed_hosts: ?[]const []const u8 = null,
allowed_paths: ?std.json.ArrayHashMap([]const u8) = null,
timeout: ?usize = null,
};