@getbourdon/conformance 0.2.0 → 0.2.1
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/index.d.ts +11 -9
- package/dist/index.js +28 -25
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -1,34 +1,36 @@
|
|
|
1
|
-
|
|
1
|
+
interface RedactionSecretCase {
|
|
2
2
|
/** Joined at load (`assembleSecret`) so no contiguous secret literal lands in git. */
|
|
3
3
|
fragments: string[];
|
|
4
4
|
expect_redacted: string;
|
|
5
5
|
expect_contains_secret: boolean;
|
|
6
6
|
}
|
|
7
|
-
|
|
7
|
+
interface RedactionBenignCase {
|
|
8
8
|
text: string;
|
|
9
9
|
expect_redacted: string;
|
|
10
10
|
expect_contains_secret: boolean;
|
|
11
11
|
}
|
|
12
|
-
|
|
12
|
+
interface RedactionBattery {
|
|
13
13
|
redacted_sentinel: string;
|
|
14
14
|
benign_limit: number;
|
|
15
15
|
secrets: RedactionSecretCase[];
|
|
16
16
|
benign: RedactionBenignCase[];
|
|
17
17
|
}
|
|
18
|
-
|
|
18
|
+
interface ConformanceFixtureMeta {
|
|
19
19
|
path: string;
|
|
20
20
|
sha256: string;
|
|
21
21
|
producer: string;
|
|
22
22
|
}
|
|
23
|
-
|
|
23
|
+
interface ConformanceManifest {
|
|
24
24
|
conformance_version: string;
|
|
25
25
|
produced_against: {
|
|
26
26
|
bourdon_version: string;
|
|
27
27
|
};
|
|
28
28
|
fixtures: ConformanceFixtureMeta[];
|
|
29
29
|
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
30
|
+
declare function conformanceDir(): string;
|
|
31
|
+
declare function loadManifest(): ConformanceManifest;
|
|
32
|
+
declare function loadRedactionBattery(): RedactionBattery;
|
|
33
33
|
/** Reconstruct a secret case's runtime string from its fragments. */
|
|
34
|
-
|
|
34
|
+
declare function assembleSecret(secret: RedactionSecretCase): string;
|
|
35
|
+
|
|
36
|
+
export { type ConformanceFixtureMeta, type ConformanceManifest, type RedactionBattery, type RedactionBenignCase, type RedactionSecretCase, assembleSecret, conformanceDir, loadManifest, loadRedactionBattery };
|
package/dist/index.js
CHANGED
|
@@ -1,33 +1,36 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
// src/index.ts
|
|
2
|
+
import { existsSync, readFileSync } from "fs";
|
|
3
|
+
import { dirname, resolve } from "path";
|
|
4
|
+
import { fileURLToPath } from "url";
|
|
4
5
|
function moduleDir() {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
if (typeof import.meta !== "undefined" && import.meta.url) {
|
|
7
|
+
return dirname(fileURLToPath(import.meta.url));
|
|
8
|
+
}
|
|
9
|
+
return typeof __dirname !== "undefined" ? __dirname : process.cwd();
|
|
9
10
|
}
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
if (existsSync(resolve(bundled, "manifest.json")))
|
|
17
|
-
return bundled;
|
|
18
|
-
// Dev fallback: the sibling Python oracle checkout.
|
|
19
|
-
return resolve(process.cwd(), "..", "..", "bourdon", "conformance");
|
|
11
|
+
function conformanceDir() {
|
|
12
|
+
const override = process.env.BOURDON_CONFORMANCE_DIR;
|
|
13
|
+
if (override) return override;
|
|
14
|
+
const bundled = resolve(moduleDir(), "..", "fixtures");
|
|
15
|
+
if (existsSync(resolve(bundled, "manifest.json"))) return bundled;
|
|
16
|
+
return resolve(process.cwd(), "..", "..", "bourdon", "conformance");
|
|
20
17
|
}
|
|
21
18
|
function loadJson(name) {
|
|
22
|
-
|
|
19
|
+
return JSON.parse(readFileSync(resolve(conformanceDir(), name), "utf8"));
|
|
23
20
|
}
|
|
24
|
-
|
|
25
|
-
|
|
21
|
+
function loadManifest() {
|
|
22
|
+
return loadJson("manifest.json");
|
|
26
23
|
}
|
|
27
|
-
|
|
28
|
-
|
|
24
|
+
function loadRedactionBattery() {
|
|
25
|
+
return loadJson("redaction_battery.json");
|
|
29
26
|
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
return secret.fragments.join("");
|
|
27
|
+
function assembleSecret(secret) {
|
|
28
|
+
return secret.fragments.join("");
|
|
33
29
|
}
|
|
30
|
+
export {
|
|
31
|
+
assembleSecret,
|
|
32
|
+
conformanceDir,
|
|
33
|
+
loadManifest,
|
|
34
|
+
loadRedactionBattery
|
|
35
|
+
};
|
|
36
|
+
//# sourceMappingURL=index.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@getbourdon/conformance",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "Language-neutral cross-implementation parity fixtures for Bourdon. Python (pip install bourdon) is the oracle; the @getbourdon/* TypeScript mirror asserts against these exact bytes.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"homepage": "https://bourdon.ai",
|
|
29
29
|
"repository": {
|
|
30
30
|
"type": "git",
|
|
31
|
-
"url": "git+https://
|
|
31
|
+
"url": "git+https://gitlab.com/getbourdon/bourdon-js.git",
|
|
32
32
|
"directory": "packages/conformance"
|
|
33
33
|
},
|
|
34
34
|
"scripts": {
|
|
@@ -36,4 +36,4 @@
|
|
|
36
36
|
"test": "vitest run",
|
|
37
37
|
"sync-fixtures": "node scripts/sync-fixtures.mjs"
|
|
38
38
|
}
|
|
39
|
-
}
|
|
39
|
+
}
|