@systemfsoftware/effect-schema-law 0.2.0 → 0.3.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 +9 -0
- package/dist/index.mjs +9 -0
- package/package.json +5 -3
package/dist/index.d.ts
CHANGED
|
@@ -7,6 +7,15 @@ declare const boundedUnion: <Base extends readonly [Schema.Schema.Any, ...Readon
|
|
|
7
7
|
}) => Schema.Schema<Schema.Schema.Type<Base[number] | Recur[number]>, Schema.Schema.Encoded<Base[number] | Recur[number]>, Schema.Schema.Context<Base[number] | Recur[number]>>;
|
|
8
8
|
//#endregion
|
|
9
9
|
//#region src/schema.d.ts
|
|
10
|
+
/**
|
|
11
|
+
* Property-test the round-trip and encode-stability laws of any Effect Schema.
|
|
12
|
+
*
|
|
13
|
+
* Registers two fast-check properties with `@effect/vitest`:
|
|
14
|
+
* 1. `∀x. enc(dec(enc(x))) === enc(x)` — encode stability across decode.
|
|
15
|
+
* 2. `∀x. dec(enc(x)) === x` — round-trip identity.
|
|
16
|
+
*
|
|
17
|
+
* Use inside a `describe` block to scope the generated tests.
|
|
18
|
+
*/
|
|
10
19
|
declare const ruleOfSchemas: <A, I>(name: string, schema: Schema.Schema<A, I, never>) => void;
|
|
11
20
|
//#endregion
|
|
12
21
|
export { boundedUnion, ruleOfSchemas };
|
package/dist/index.mjs
CHANGED
|
@@ -15,6 +15,15 @@ const boundedUnion = (identifier, options) => {
|
|
|
15
15
|
};
|
|
16
16
|
//#endregion
|
|
17
17
|
//#region src/schema.ts
|
|
18
|
+
/**
|
|
19
|
+
* Property-test the round-trip and encode-stability laws of any Effect Schema.
|
|
20
|
+
*
|
|
21
|
+
* Registers two fast-check properties with `@effect/vitest`:
|
|
22
|
+
* 1. `∀x. enc(dec(enc(x))) === enc(x)` — encode stability across decode.
|
|
23
|
+
* 2. `∀x. dec(enc(x)) === x` — round-trip identity.
|
|
24
|
+
*
|
|
25
|
+
* Use inside a `describe` block to scope the generated tests.
|
|
26
|
+
*/
|
|
18
27
|
const ruleOfSchemas = (name, schema) => {
|
|
19
28
|
const decodeEither = Schema.decodeEither(schema);
|
|
20
29
|
const encodeSync = Schema.encodeSync(schema);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@systemfsoftware/effect-schema-law",
|
|
3
3
|
"license": "MIT",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.3.1",
|
|
5
5
|
"author": "Ryan Lee <drdgvhbh@gmail.com>",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -45,8 +45,9 @@
|
|
|
45
45
|
"tsdown": "^0.22.9",
|
|
46
46
|
"vite-tsconfig-paths": "^6.1.1",
|
|
47
47
|
"vitest": "^4",
|
|
48
|
+
"@systemfsoftware/tsconfig": "^1.1.0",
|
|
48
49
|
"@systemfsoftware/oxlint-config": "^0.1.0",
|
|
49
|
-
"@systemfsoftware/
|
|
50
|
+
"@systemfsoftware/arethetypeswrong-cli": "^1.0.0",
|
|
50
51
|
"@systemfsoftware/vitest-config": "^0.1.0"
|
|
51
52
|
},
|
|
52
53
|
"peerDependencies": {
|
|
@@ -62,6 +63,7 @@
|
|
|
62
63
|
"test:run": "vitest run",
|
|
63
64
|
"api:check": "api-extractor run",
|
|
64
65
|
"api:update": "api-extractor run --local",
|
|
65
|
-
"lint": "oxlint . ${AGENT:+--format=unix --quiet}"
|
|
66
|
+
"lint": "oxlint . ${AGENT:+--format=unix --quiet}",
|
|
67
|
+
"attw": "attw --pack ."
|
|
66
68
|
}
|
|
67
69
|
}
|