@fuzdev/fuz_app 0.33.0 → 0.34.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/actions/action_rpc.d.ts.map +1 -1
- package/dist/actions/action_rpc.js +6 -1
- package/dist/testing/admin_integration.d.ts +7 -5
- package/dist/testing/admin_integration.d.ts.map +1 -1
- package/dist/testing/admin_integration.js +146 -145
- package/dist/testing/audit_completeness.d.ts.map +1 -1
- package/dist/testing/audit_completeness.js +34 -31
- package/dist/testing/integration.d.ts +2 -2
- package/dist/testing/integration.d.ts.map +1 -1
- package/dist/testing/integration.js +187 -124
- package/dist/testing/schema_generators.d.ts.map +1 -1
- package/dist/testing/schema_generators.js +25 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema_generators.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/testing/schema_generators.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AAE7B;;;;;;;;GAQG;AAEH,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AACtB,OAAO,EAKN,KAAK,YAAY,EACjB,MAAM,yBAAyB,CAAC;AAIjC;;;GAGG;AACH,eAAO,MAAM,aAAa,GAAI,cAAc,CAAC,CAAC,OAAO,KAAG,MAAM,GAAG,IAShE,CAAC;
|
|
1
|
+
{"version":3,"file":"schema_generators.d.ts","sourceRoot":"../src/lib/","sources":["../../src/lib/testing/schema_generators.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AAE7B;;;;;;;;GAQG;AAEH,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AACtB,OAAO,EAKN,KAAK,YAAY,EACjB,MAAM,yBAAyB,CAAC;AAIjC;;;GAGG;AACH,eAAO,MAAM,aAAa,GAAI,cAAc,CAAC,CAAC,OAAO,KAAG,MAAM,GAAG,IAShE,CAAC;AAqDF,qEAAqE;AACrE,eAAO,MAAM,oBAAoB,GAAI,OAAO,YAAY,EAAE,cAAc,CAAC,CAAC,OAAO,KAAG,OAkDnF,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,kBAAkB,GAAI,MAAM,MAAM,EAAE,gBAAgB,CAAC,CAAC,SAAS,KAAG,MAa9E,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,mBAAmB,GAC/B,cAAc,CAAC,CAAC,OAAO,KACrB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAkB5B,CAAC"}
|
|
@@ -28,16 +28,34 @@ export const detect_format = (field_schema) => {
|
|
|
28
28
|
}
|
|
29
29
|
return null;
|
|
30
30
|
};
|
|
31
|
-
/**
|
|
31
|
+
/**
|
|
32
|
+
* Extract a candidate value from a JSON Schema `pattern` when the shape is
|
|
33
|
+
* a fixed-length hex character class — covers blake3 (64-char lowercase hex),
|
|
34
|
+
* sha256, md5, and similar digest refinements. Returns `null` when the
|
|
35
|
+
* pattern doesn't match the expected shape.
|
|
36
|
+
*/
|
|
37
|
+
const generate_hex_pattern_value = (pattern) => {
|
|
38
|
+
const match = /^\^\[0-9a-f(?:A-F)?\]\{(\d+)\}\$$/.exec(pattern);
|
|
39
|
+
if (!match)
|
|
40
|
+
return null;
|
|
41
|
+
const n = Number(match[1]);
|
|
42
|
+
if (!Number.isInteger(n) || n <= 0)
|
|
43
|
+
return null;
|
|
44
|
+
return '0'.repeat(n);
|
|
45
|
+
};
|
|
46
|
+
/** Generate a string that satisfies minLength/maxLength/pattern constraints via JSON Schema. */
|
|
32
47
|
const generate_valid_string = (field_schema) => {
|
|
33
48
|
let min_length = 0;
|
|
34
49
|
let max_length = Infinity;
|
|
50
|
+
let pattern = null;
|
|
35
51
|
try {
|
|
36
52
|
const json = z.toJSONSchema(field_schema);
|
|
37
53
|
if (typeof json.minLength === 'number')
|
|
38
54
|
min_length = json.minLength;
|
|
39
55
|
if (typeof json.maxLength === 'number')
|
|
40
56
|
max_length = json.maxLength;
|
|
57
|
+
if (typeof json.pattern === 'string')
|
|
58
|
+
pattern = json.pattern;
|
|
41
59
|
}
|
|
42
60
|
catch {
|
|
43
61
|
// no constraints
|
|
@@ -48,6 +66,12 @@ const generate_valid_string = (field_schema) => {
|
|
|
48
66
|
// If the base string fails, try common patterns before giving up.
|
|
49
67
|
if (field_schema.safeParse(base).success)
|
|
50
68
|
return base;
|
|
69
|
+
// Fixed-length hex refinement (blake3, sha256, etc.)
|
|
70
|
+
if (pattern) {
|
|
71
|
+
const hex = generate_hex_pattern_value(pattern);
|
|
72
|
+
if (hex !== null && field_schema.safeParse(hex).success)
|
|
73
|
+
return hex;
|
|
74
|
+
}
|
|
51
75
|
// Absolute path refinement (e.g. DiskfilePath)
|
|
52
76
|
const with_slash = '/' + base;
|
|
53
77
|
if (field_schema.safeParse(with_slash).success)
|