@systemfsoftware/effect-schema-extensions 0.2.0 → 0.4.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 CHANGED
@@ -1,14 +1 @@
1
- import { Schema } from "effect";
2
- //#region src/hexstring.schema.d.ts
3
- declare const StrictHex: Schema.refine<string, typeof Schema.String>;
4
- type StrictHex = typeof StrictHex.Type;
5
- declare const HexString: Schema.brand<Schema.transform<Schema.refine<string, typeof Schema.String>, Schema.refine<string, typeof Schema.String>>, "HexString">;
6
- type HexString = Schema.Schema.Type<typeof HexString>;
7
- declare const ColonHex: Schema.transform<Schema.transform<Schema.refine<string, typeof Schema.String>, Schema.SchemaClass<string, string, never>>, Schema.brand<Schema.transform<Schema.refine<string, typeof Schema.String>, Schema.refine<string, typeof Schema.String>>, "HexString">>;
8
- type ColonHex = typeof ColonHex.Type;
9
- //#endregion
10
- //#region src/prefixed-hex.schema.d.ts
11
- declare const PrefixedHex: Schema.brand<Schema.transform<Schema.brand<Schema.transform<Schema.refine<string, typeof Schema.String>, Schema.refine<string, typeof Schema.String>>, "HexString">, Schema.refine<string, typeof Schema.String>>, "PrefixedHex">;
12
- type PrefixedHex = Schema.Schema.Type<typeof PrefixedHex>;
13
- //#endregion
14
- export { ColonHex, HexString, PrefixedHex, StrictHex };
1
+ export * from "@systemfsoftware/hex-schema";
package/dist/index.mjs CHANGED
@@ -1,44 +1,2 @@
1
- import { Schema, pipe } from "effect";
2
- //#region src/hexstring.schema.ts
3
- const StrictHex = Schema.String.pipe(Schema.pattern(/^[0-9a-f]+$/), Schema.annotations({
4
- arbitrary: () => (fc) => fc.hexaString({ minLength: 1 }),
5
- identifier: "StrictHex",
6
- description: "A lowercase hexadecimal string with no prefix",
7
- title: "Strict Hex String"
8
- }));
9
- const HexString = pipe(Schema.transform(Schema.String.pipe(Schema.pattern(/^(0x)?[0-9a-fA-F]+$/), Schema.annotations({ arbitrary: () => (fc) => fc.stringMatching(/^(0x)?[0-9a-fA-F]+$/) })), StrictHex, {
10
- decode: (hex) => (hex.startsWith("0x") ? hex.slice(2) : hex).toLowerCase(),
11
- encode: (s) => s
12
- }), Schema.annotations({
13
- identifier: "HexString",
14
- description: "A string representing hexadecimal data, with or without the 0x prefix",
15
- examples: ["add119540287cfb4c427fe4a6efd6cc4473221f389249c3b5f36aec92009fc67", "27f7a181fd4996d061bbdc97be024bb8b764525e56748d1d7fdcb3e93f57b4a1"],
16
- title: "Hex String"
17
- }), Schema.brand("HexString"));
18
- const hexToColon = (hex) => (hex.match(/.{1,2}/g) ?? []).map((byte) => byte.toUpperCase()).join(":");
19
- const ColonHex = pipe(Schema.compose(Schema.transform(Schema.String.pipe(Schema.pattern(/^[0-9A-Fa-f]{1,2}(:[0-9A-Fa-f]{1,2})*$/), Schema.annotations({
20
- arbitrary: () => (fc) => fc.hexaString({ minLength: 1 }).map(hexToColon),
21
- examples: ["5A:A3:A6:D7", "7B:47:1D:1B"]
22
- })), Schema.encodedSchema(HexString), {
23
- strict: true,
24
- decode: (colon) => colon.replaceAll(":", ""),
25
- encode: hexToColon
26
- }), HexString), Schema.annotations({
27
- identifier: "ColonHex",
28
- description: "Colon-separated uppercase hex bytes — the fingerprint format developers expect",
29
- title: "Colon-Separated Hex String"
30
- }));
31
- //#endregion
32
- //#region src/prefixed-hex.schema.ts
33
- const PrefixedHex = pipe(Schema.transform(HexString, Schema.String.pipe(Schema.pattern(/^0x[0-9a-f]+$/), Schema.annotations({ arbitrary: () => (fc) => fc.hexaString({ minLength: 1 }).map((hex) => `0x${hex}`) })), {
34
- strict: true,
35
- decode: (fromA, _fromI) => `0x${fromA}`,
36
- encode: (toI) => HexString.make(toI.slice(2))
37
- }), Schema.annotations({
38
- identifier: "PrefixedHex",
39
- description: "A hex string that preserves the 0x prefix",
40
- examples: ["0x1768aaf901cd18feac56426b8139c623b6e202cfb2710179c201b61b895190b0", "0xf678e79eb2c70a1201325fbd980a4d1157810519ce86cb49b1b5c868e89fba41"],
41
- title: "Prefixed Hex String"
42
- }), Schema.brand("PrefixedHex"));
43
- //#endregion
44
- export { ColonHex, HexString, PrefixedHex, StrictHex };
1
+ export * from "@systemfsoftware/hex-schema";
2
+ export {};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@systemfsoftware/effect-schema-extensions",
3
3
  "license": "MIT",
4
- "version": "0.2.0",
4
+ "version": "0.4.0",
5
5
  "author": "Ryan Lee <drdgvhbh@gmail.com>",
6
6
  "repository": {
7
7
  "type": "git",
@@ -39,7 +39,7 @@
39
39
  ],
40
40
  "dependencies": {
41
41
  "effect": "^3.22.0",
42
- "@systemfsoftware/hex-schema": "^0.1.0"
42
+ "@systemfsoftware/hex-schema": "^1.1.0"
43
43
  },
44
44
  "devDependencies": {
45
45
  "@effect/vitest": "0.30.0",
@@ -50,10 +50,11 @@
50
50
  "rimraf": "^6.1.3",
51
51
  "tsdown": "^0.22.9",
52
52
  "vitest": "^4",
53
- "@systemfsoftware/effect-schema-law": "^0.1.0",
53
+ "@systemfsoftware/effect-schema-law": "^0.3.0",
54
+ "@systemfsoftware/effect-schema-vite": "^1.1.0",
55
+ "@systemfsoftware/arethetypeswrong-cli": "^1.0.0",
54
56
  "@systemfsoftware/oxlint-config": "^0.1.0",
55
- "@systemfsoftware/effect-schema-vite": "^0.1.0",
56
- "@systemfsoftware/tsconfig": "^1.0.0",
57
+ "@systemfsoftware/tsconfig": "^1.1.0",
57
58
  "@systemfsoftware/vitest-config": "^0.1.0"
58
59
  },
59
60
  "peerDependencies": {
@@ -65,8 +66,9 @@
65
66
  "typecheck": "tsc --noEmit --incremental",
66
67
  "test": "vitest run",
67
68
  "test:run": "vitest run",
68
- "api:check": "api-extractor run",
69
- "api:update": "api-extractor run --local",
70
- "lint": "oxlint . ${AGENT:+--format=unix --quiet}"
69
+ "api:check": "api-extractor run && api-extractor run --config api-extractor.hex-schema.json",
70
+ "api:update": "api-extractor run --local && api-extractor run --local --config api-extractor.hex-schema.json",
71
+ "lint": "oxlint . ${AGENT:+--format=unix --quiet}",
72
+ "attw": "attw --pack ."
71
73
  }
72
74
  }