@systemfsoftware/hex-schema 1.1.0 → 1.1.2

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.
@@ -0,0 +1,32 @@
1
+ import { Schema } from 'effect';
2
+
3
+ export declare const ColonHex: Schema.brand<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">>, "ColonHex">;
4
+
5
+ export declare type ColonHex = Schema.Schema.Type<typeof ColonHex>;
6
+
7
+ /**
8
+ * Composable hex-to-bytes schema. Compose any branded hex schema with
9
+ * this to produce a `Uint8Array` from that format:
10
+ *
11
+ * ```ts
12
+ * S.compose(PrefixedHex, HexBytes) // Schema<Uint8Array, string>
13
+ * S.compose(ColonHex, HexBytes) // Schema<Uint8Array, string>
14
+ * ```
15
+ */
16
+ export declare const HexBytes: Schema.Schema<Uint8Array<ArrayBufferLike>, string, never>;
17
+
18
+ export declare const HexString: Schema.brand<Schema.transform<Schema.refine<string, typeof Schema.String>, Schema.refine<string, typeof Schema.String>>, "HexString">;
19
+
20
+ export declare type HexString = Schema.Schema.Type<typeof HexString>;
21
+
22
+ export declare const PrefixedHex: Schema.brand<Schema.transform<Schema.refine<string, typeof Schema.String>, Schema.refine<string, typeof Schema.String>>, "PrefixedHex">;
23
+
24
+ export declare type PrefixedHex = Schema.Schema.Type<typeof PrefixedHex>;
25
+
26
+ export declare const StrictHex: Schema.refine<string, typeof Schema.String>;
27
+
28
+ export declare const Uint8ArrayFromPrefixedHex: Schema.transform<Schema.refine<string, typeof Schema.String>, Schema.Schema<Uint8Array<ArrayBufferLike>, string, never>>;
29
+
30
+ export declare type Uint8ArrayFromPrefixedHex = Schema.Schema.Type<typeof Uint8ArrayFromPrefixedHex>;
31
+
32
+ export { }
package/dist/index.mjs CHANGED
@@ -8,7 +8,11 @@ const StrictHex = Schema.String.pipe(Schema.pattern(/^[0-9a-f]*$/), Schema.annot
8
8
  }));
9
9
  //#endregion
10
10
  //#region src/hex-string.schema.ts
11
- 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, {
11
+ const HexString = pipe(Schema.transform(Schema.String.pipe(Schema.pattern(/^(0x)?[0-9a-fA-F]*$/), Schema.annotations({
12
+ arbitrary: () => (fc) => fc.stringMatching(/^(0x)?[0-9a-fA-F]*$/),
13
+ identifier: "HexStringInput",
14
+ description: "A hex string, optionally prefixed with 0x (empty string allowed)"
15
+ })), StrictHex, {
12
16
  decode: (hex) => (hex.startsWith("0x") ? hex.slice(2) : hex).toLowerCase(),
13
17
  encode: (s) => s
14
18
  }), Schema.annotations({
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@systemfsoftware/hex-schema",
3
3
  "license": "MIT",
4
- "version": "1.1.0",
4
+ "version": "1.1.2",
5
5
  "author": "Ryan Lee <drdgvhbh@gmail.com>",
6
6
  "repository": {
7
7
  "type": "git",
@@ -19,6 +19,7 @@
19
19
  "hex",
20
20
  "hexstring",
21
21
  "branded-types",
22
+ "validation",
22
23
  "typescript"
23
24
  ],
24
25
  "type": "module",
@@ -43,19 +44,19 @@
43
44
  "rimraf": "^6.1.3",
44
45
  "tsdown": "^0.22.9",
45
46
  "vitest": "^4",
46
- "@systemfsoftware/effect-schema-law": "^0.3.0",
47
- "@systemfsoftware/effect-schema-vite": "^1.1.0",
47
+ "@systemfsoftware/arethetypeswrong-cli": "^1.0.0",
48
+ "@systemfsoftware/effect-schema-law": "^0.3.2",
48
49
  "@systemfsoftware/oxlint-config": "^0.1.0",
50
+ "@systemfsoftware/vitest-config": "^0.1.0",
49
51
  "@systemfsoftware/tsconfig": "^1.1.0",
50
- "@systemfsoftware/arethetypeswrong-cli": "^1.0.0",
51
- "@systemfsoftware/vitest-config": "^0.1.0"
52
+ "@systemfsoftware/effect-schema-vite": "^1.1.0"
52
53
  },
53
54
  "peerDependencies": {
54
55
  "effect": "*"
55
56
  },
56
57
  "scripts": {
57
58
  "clean": "rimraf dist",
58
- "build": "tsdown",
59
+ "build": "tsdown && api-extractor run --local",
59
60
  "typecheck": "tsc --noEmit --incremental",
60
61
  "test": "vitest run",
61
62
  "api:check": "api-extractor run",