@getbourdon/conformance 0.1.0 → 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.
- package/dist/index.d.ts +9 -11
- package/dist/index.js +25 -28
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,36 +1,34 @@
|
|
|
1
|
-
interface RedactionSecretCase {
|
|
1
|
+
export 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
|
-
interface RedactionBenignCase {
|
|
7
|
+
export interface RedactionBenignCase {
|
|
8
8
|
text: string;
|
|
9
9
|
expect_redacted: string;
|
|
10
10
|
expect_contains_secret: boolean;
|
|
11
11
|
}
|
|
12
|
-
interface RedactionBattery {
|
|
12
|
+
export interface RedactionBattery {
|
|
13
13
|
redacted_sentinel: string;
|
|
14
14
|
benign_limit: number;
|
|
15
15
|
secrets: RedactionSecretCase[];
|
|
16
16
|
benign: RedactionBenignCase[];
|
|
17
17
|
}
|
|
18
|
-
interface ConformanceFixtureMeta {
|
|
18
|
+
export interface ConformanceFixtureMeta {
|
|
19
19
|
path: string;
|
|
20
20
|
sha256: string;
|
|
21
21
|
producer: string;
|
|
22
22
|
}
|
|
23
|
-
interface ConformanceManifest {
|
|
23
|
+
export 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
|
-
declare function conformanceDir(): string;
|
|
31
|
-
declare function loadManifest(): ConformanceManifest;
|
|
32
|
-
declare function loadRedactionBattery(): RedactionBattery;
|
|
30
|
+
export declare function conformanceDir(): string;
|
|
31
|
+
export declare function loadManifest(): ConformanceManifest;
|
|
32
|
+
export declare function loadRedactionBattery(): RedactionBattery;
|
|
33
33
|
/** Reconstruct a secret case's runtime string from its fragments. */
|
|
34
|
-
declare function assembleSecret(secret: RedactionSecretCase): string;
|
|
35
|
-
|
|
36
|
-
export { type ConformanceFixtureMeta, type ConformanceManifest, type RedactionBattery, type RedactionBenignCase, type RedactionSecretCase, assembleSecret, conformanceDir, loadManifest, loadRedactionBattery };
|
|
34
|
+
export declare function assembleSecret(secret: RedactionSecretCase): string;
|
package/dist/index.js
CHANGED
|
@@ -1,36 +1,33 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { fileURLToPath } from "url";
|
|
1
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
2
|
+
import { dirname, resolve } from "node:path";
|
|
3
|
+
import { fileURLToPath } from "node:url";
|
|
5
4
|
function moduleDir() {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
if (typeof import.meta !== "undefined" && import.meta.url) {
|
|
6
|
+
return dirname(fileURLToPath(import.meta.url));
|
|
7
|
+
}
|
|
8
|
+
return typeof __dirname !== "undefined" ? __dirname : process.cwd();
|
|
10
9
|
}
|
|
11
|
-
function conformanceDir() {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
10
|
+
export function conformanceDir() {
|
|
11
|
+
const override = process.env.BOURDON_CONFORMANCE_DIR;
|
|
12
|
+
if (override)
|
|
13
|
+
return override;
|
|
14
|
+
// Bundled snapshot: <pkg>/fixtures, one level up from src/ or dist/.
|
|
15
|
+
const bundled = resolve(moduleDir(), "..", "fixtures");
|
|
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");
|
|
17
20
|
}
|
|
18
21
|
function loadJson(name) {
|
|
19
|
-
|
|
22
|
+
return JSON.parse(readFileSync(resolve(conformanceDir(), name), "utf8"));
|
|
20
23
|
}
|
|
21
|
-
function loadManifest() {
|
|
22
|
-
|
|
24
|
+
export function loadManifest() {
|
|
25
|
+
return loadJson("manifest.json");
|
|
23
26
|
}
|
|
24
|
-
function loadRedactionBattery() {
|
|
25
|
-
|
|
27
|
+
export function loadRedactionBattery() {
|
|
28
|
+
return loadJson("redaction_battery.json");
|
|
26
29
|
}
|
|
27
|
-
|
|
28
|
-
|
|
30
|
+
/** Reconstruct a secret case's runtime string from its fragments. */
|
|
31
|
+
export function assembleSecret(secret) {
|
|
32
|
+
return secret.fragments.join("");
|
|
29
33
|
}
|
|
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.
|
|
3
|
+
"version": "0.2.0",
|
|
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",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
},
|
|
24
24
|
"publishConfig": {
|
|
25
25
|
"access": "public",
|
|
26
|
-
"provenance":
|
|
26
|
+
"provenance": true
|
|
27
27
|
},
|
|
28
28
|
"homepage": "https://bourdon.ai",
|
|
29
29
|
"repository": {
|