@oval-vote/oval 0.1.0 → 0.1.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/README.md +12 -2
- package/package.json +1 -1
- package/pkg/oval_wasm.d.ts +94 -2
- package/pkg/oval_wasm.js +44 -2
- package/pkg/oval_wasm_bg.wasm +0 -0
- package/pkg/oval_wasm_bg.wasm.d.ts +4 -1
package/README.md
CHANGED
|
@@ -9,7 +9,7 @@ const oval = require("@oval-vote/oval");
|
|
|
9
9
|
const source = fs.readFileSync("guide.oval", "utf8");
|
|
10
10
|
|
|
11
11
|
oval.check(source);
|
|
12
|
-
// [{ code: "
|
|
12
|
+
// [{ code: "unused-declaration", severity: "warning", range: { start: 120, end: 124 }, message: "..." }]
|
|
13
13
|
|
|
14
14
|
oval.compile(source);
|
|
15
15
|
// The canonical JSON model described by the specification's guide.schema.json.
|
|
@@ -17,9 +17,19 @@ oval.compile(source);
|
|
|
17
17
|
|
|
18
18
|
oval.format(source);
|
|
19
19
|
// The formatted source. Throws the diagnostics when the document has syntax errors.
|
|
20
|
+
|
|
21
|
+
oval.catalog();
|
|
22
|
+
// Every diagnostic the package can report, in the specification's order:
|
|
23
|
+
// [{ identifier: "illegal-tab", severity: "error", title: "Illegal Tab",
|
|
24
|
+
// url: "https://spec.oval.vote/draft/#sec-Illegal-Tab" }, ...]
|
|
25
|
+
|
|
26
|
+
oval.languageMajor(); // 1, the major version of the language this package reads
|
|
27
|
+
oval.version(); // the package's own version
|
|
20
28
|
```
|
|
21
29
|
|
|
22
|
-
Ranges are byte offsets into the UTF-8 source.
|
|
30
|
+
Ranges are byte offsets into the UTF-8 source. Diagnostic codes are the identifiers of the
|
|
31
|
+
specification's entries, and the typings declare them as a string union, so a `switch` over a
|
|
32
|
+
code is checked by TypeScript.
|
|
23
33
|
|
|
24
34
|
The language is specified in [oval-vote/oval-spec](https://github.com/oval-vote/oval-spec) and
|
|
25
35
|
implemented in [oval-vote/oval](https://github.com/oval-vote/oval), which also provides the `oval`
|
package/package.json
CHANGED
package/pkg/oval_wasm.d.ts
CHANGED
|
@@ -1,17 +1,109 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
|
|
4
|
+
export type DiagnosticIdentifier =
|
|
5
|
+
| "illegal-tab"
|
|
6
|
+
| "unexpected-character"
|
|
7
|
+
| "unterminated-string"
|
|
8
|
+
| "invalid-escape"
|
|
9
|
+
| "malformed-number"
|
|
10
|
+
| "malformed-url"
|
|
11
|
+
| "inconsistent-dedent"
|
|
12
|
+
| "unexpected-token"
|
|
13
|
+
| "missing-identifier"
|
|
14
|
+
| "missing-name"
|
|
15
|
+
| "missing-contest-kind"
|
|
16
|
+
| "missing-value"
|
|
17
|
+
| "missing-body"
|
|
18
|
+
| "missing-block"
|
|
19
|
+
| "unexpected-block"
|
|
20
|
+
| "unexpected-entry"
|
|
21
|
+
| "repeated-field"
|
|
22
|
+
| "repeated-flag"
|
|
23
|
+
| "misplaced-entry"
|
|
24
|
+
| "empty-recommendation"
|
|
25
|
+
| "unsupported-version"
|
|
26
|
+
| "missing-guide-field"
|
|
27
|
+
| "empty-document"
|
|
28
|
+
| "invalid-date"
|
|
29
|
+
| "undeclared-reference"
|
|
30
|
+
| "duplicate-declaration"
|
|
31
|
+
| "mismatched-reference"
|
|
32
|
+
| "block-on-reference"
|
|
33
|
+
| "misplaced-candidate-field"
|
|
34
|
+
| "empty-ballot"
|
|
35
|
+
| "empty-section"
|
|
36
|
+
| "contest-without-campaigns"
|
|
37
|
+
| "campaign-without-members"
|
|
38
|
+
| "duplicate-member"
|
|
39
|
+
| "candidate-in-two-campaigns"
|
|
40
|
+
| "invalid-multiple-count"
|
|
41
|
+
| "invalid-ranked-max"
|
|
42
|
+
| "retention-campaign-count"
|
|
43
|
+
| "missing-recommendation"
|
|
44
|
+
| "repeated-recommendation"
|
|
45
|
+
| "campaign-not-in-contest"
|
|
46
|
+
| "repeated-oppose"
|
|
47
|
+
| "repeated-stance"
|
|
48
|
+
| "tiers-in-single"
|
|
49
|
+
| "support-over-max"
|
|
50
|
+
| "retention-stance"
|
|
51
|
+
| "markdown-profile"
|
|
52
|
+
| "unused-declaration"
|
|
53
|
+
| "duplicate-party-name"
|
|
54
|
+
| "duplicate-ballot-title"
|
|
55
|
+
| "support-over-count"
|
|
56
|
+
| "non-head-reference"
|
|
57
|
+
| "unpaired-outcome"
|
|
58
|
+
| "insecure-url";
|
|
59
|
+
|
|
60
|
+
export type Severity = "error" | "warning";
|
|
61
|
+
|
|
62
|
+
export interface Diagnostic {
|
|
63
|
+
code: DiagnosticIdentifier;
|
|
64
|
+
severity: Severity;
|
|
65
|
+
range: { start: number; end: number };
|
|
66
|
+
message: string;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export interface CatalogEntry {
|
|
70
|
+
identifier: DiagnosticIdentifier;
|
|
71
|
+
severity: Severity;
|
|
72
|
+
title: string;
|
|
73
|
+
url: string;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export type Compiled = Record<string, unknown>;
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Every diagnostic the implementation can report, in the specification's order, with the
|
|
82
|
+
* address of its entry on the specification's site.
|
|
83
|
+
*/
|
|
84
|
+
export function catalog(): CatalogEntry[];
|
|
85
|
+
|
|
4
86
|
/**
|
|
5
87
|
* Parses and validates `source`, returning every diagnostic in source order.
|
|
6
88
|
*/
|
|
7
|
-
export function check(source: string):
|
|
89
|
+
export function check(source: string): Diagnostic[];
|
|
8
90
|
|
|
9
91
|
/**
|
|
10
92
|
* Compiles `source` to its canonical form, or fails with the diagnostics.
|
|
11
93
|
*/
|
|
12
|
-
export function compile(source: string):
|
|
94
|
+
export function compile(source: string): Compiled;
|
|
13
95
|
|
|
14
96
|
/**
|
|
15
97
|
* Formats `source`, or fails with the diagnostics.
|
|
16
98
|
*/
|
|
17
99
|
export function format(source: string): string;
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* The major version of the Oval language this package reads.
|
|
103
|
+
*/
|
|
104
|
+
export function languageMajor(): number;
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* The version of this package.
|
|
108
|
+
*/
|
|
109
|
+
export function version(): string;
|
package/pkg/oval_wasm.js
CHANGED
|
@@ -1,9 +1,23 @@
|
|
|
1
1
|
/* @ts-self-types="./oval_wasm.d.ts" */
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* Every diagnostic the implementation can report, in the specification's order, with the
|
|
5
|
+
* address of its entry on the specification's site.
|
|
6
|
+
* @returns {CatalogEntry[]}
|
|
7
|
+
*/
|
|
8
|
+
function catalog() {
|
|
9
|
+
const ret = wasm.catalog();
|
|
10
|
+
if (ret[2]) {
|
|
11
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
12
|
+
}
|
|
13
|
+
return takeFromExternrefTable0(ret[0]);
|
|
14
|
+
}
|
|
15
|
+
exports.catalog = catalog;
|
|
16
|
+
|
|
3
17
|
/**
|
|
4
18
|
* Parses and validates `source`, returning every diagnostic in source order.
|
|
5
19
|
* @param {string} source
|
|
6
|
-
* @returns {
|
|
20
|
+
* @returns {Diagnostic[]}
|
|
7
21
|
*/
|
|
8
22
|
function check(source) {
|
|
9
23
|
const ptr0 = passStringToWasm0(source, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
@@ -19,7 +33,7 @@ exports.check = check;
|
|
|
19
33
|
/**
|
|
20
34
|
* Compiles `source` to its canonical form, or fails with the diagnostics.
|
|
21
35
|
* @param {string} source
|
|
22
|
-
* @returns {
|
|
36
|
+
* @returns {Compiled}
|
|
23
37
|
*/
|
|
24
38
|
function compile(source) {
|
|
25
39
|
const ptr0 = passStringToWasm0(source, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
@@ -58,6 +72,34 @@ function format(source) {
|
|
|
58
72
|
}
|
|
59
73
|
}
|
|
60
74
|
exports.format = format;
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* The major version of the Oval language this package reads.
|
|
78
|
+
* @returns {number}
|
|
79
|
+
*/
|
|
80
|
+
function languageMajor() {
|
|
81
|
+
const ret = wasm.languageMajor();
|
|
82
|
+
return ret >>> 0;
|
|
83
|
+
}
|
|
84
|
+
exports.languageMajor = languageMajor;
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* The version of this package.
|
|
88
|
+
* @returns {string}
|
|
89
|
+
*/
|
|
90
|
+
function version() {
|
|
91
|
+
let deferred1_0;
|
|
92
|
+
let deferred1_1;
|
|
93
|
+
try {
|
|
94
|
+
const ret = wasm.version();
|
|
95
|
+
deferred1_0 = ret[0];
|
|
96
|
+
deferred1_1 = ret[1];
|
|
97
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
98
|
+
} finally {
|
|
99
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
exports.version = version;
|
|
61
103
|
function __wbg_get_imports() {
|
|
62
104
|
const import0 = {
|
|
63
105
|
__proto__: null,
|
package/pkg/oval_wasm_bg.wasm
CHANGED
|
Binary file
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
export const memory: WebAssembly.Memory;
|
|
4
|
+
export const catalog: () => [number, number, number];
|
|
4
5
|
export const check: (a: number, b: number) => [number, number, number];
|
|
5
6
|
export const compile: (a: number, b: number) => [number, number, number];
|
|
6
7
|
export const format: (a: number, b: number) => [number, number, number, number];
|
|
8
|
+
export const languageMajor: () => number;
|
|
9
|
+
export const version: () => [number, number];
|
|
7
10
|
export const __wbindgen_externrefs: WebAssembly.Table;
|
|
11
|
+
export const __externref_table_dealloc: (a: number) => void;
|
|
8
12
|
export const __wbindgen_malloc: (a: number, b: number) => number;
|
|
9
13
|
export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
10
14
|
export const __wbindgen_free: (a: number, b: number, c: number) => void;
|
|
11
|
-
export const __externref_table_dealloc: (a: number) => void;
|
|
12
15
|
export const __wbindgen_start: () => void;
|