@railway-ts/pipelines 0.1.10 → 0.1.12

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.
Files changed (2) hide show
  1. package/README.md +51 -43
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -6,6 +6,10 @@ Railway-oriented programming for TypeScript. Result and Option types that don't
6
6
 
7
7
  Small, focused API surface. Errors propagate automatically, you handle them once at the end.
8
8
 
9
+ Fully tree-shakable — import only what you need:
10
+
11
+ `option` 402 B · `result` 582 B · `composition` 233 B · `schema` ~3 kB — **~4.2 kB total** minified + brotli
12
+
9
13
  ## Install
10
14
 
11
15
  ```bash
@@ -73,6 +77,10 @@ For a complete real-world pipeline, see the [Launch Decision Pipeline](docs/RECI
73
77
  - **Async** -- sync-preserving overloads, parallel field validation, seamless sync/async mixing
74
78
  - **Standard Schema v1** -- `toStandardSchema()` for tRPC, TanStack Form, React Hook Form, and other consumers
75
79
 
80
+ ## Ecosystem
81
+
82
+ - **[@railway-ts/use-form](https://github.com/sakobu/railway-ts-use-form)** -- Type-safe React form hook. Define a schema here, get validated forms with autocomplete, error handling, and native HTML bindings.
83
+
76
84
  ## API Reference
77
85
 
78
86
  ### Option
@@ -95,15 +103,15 @@ match(name, {
95
103
  }); // Output: Alice
96
104
  ```
97
105
 
98
- | Category | Functions |
99
- |----------|-----------|
100
- | **Core** | `some`, `none`, `isSome`, `isNone` |
101
- | **Transform** | `map`, `flatMap`, `bimap`, `filter`, `tap` |
102
- | **Curried** | `mapWith`, `flatMapWith`, `filterWith`, `tapWith` |
103
- | **Unwrap** | `unwrap`, `unwrapOr`, `unwrapOrElse` |
104
- | **Combine** | `combine` |
105
- | **Convert** | `fromNullable`, `mapToResult` |
106
- | **Branch** | `match` |
106
+ | Category | Functions |
107
+ | ------------- | ------------------------------------------------- |
108
+ | **Core** | `some`, `none`, `isSome`, `isNone` |
109
+ | **Transform** | `map`, `flatMap`, `bimap`, `filter`, `tap` |
110
+ | **Curried** | `mapWith`, `flatMapWith`, `filterWith`, `tapWith` |
111
+ | **Unwrap** | `unwrap`, `unwrapOr`, `unwrapOrElse` |
112
+ | **Combine** | `combine` |
113
+ | **Convert** | `fromNullable`, `mapToResult` |
114
+ | **Branch** | `match` |
107
115
 
108
116
  ### Result
109
117
 
@@ -126,22 +134,22 @@ match(result, {
126
134
  }); // Output: 15
127
135
  ```
128
136
 
129
- | Category | Functions |
130
- |----------|-----------|
131
- | **Core** | `ok`, `err`, `isOk`, `isErr` |
132
- | **Transform** | `map`, `mapErr`, `flatMap`, `bimap`, `filter`, `tap`, `tapErr` |
133
- | **Curried** | `mapWith`, `flatMapWith`, `mapErrWith`, `filterWith`, `tapWith`, `tapErrWith` |
134
- | **Recovery** | `orElse`, `orElseWith` |
135
- | **Unwrap** | `unwrap`, `unwrapOr`, `unwrapOrElse` |
136
- | **Combine** | `combine`, `combineAll` |
137
- | **Convert** | `fromTry`, `fromTryWithError`, `fromPromise`, `fromPromiseWithError`, `toPromise`, `mapToOption` |
138
- | **Branch** | `match` |
137
+ | Category | Functions |
138
+ | ------------- | ------------------------------------------------------------------------------------------------ |
139
+ | **Core** | `ok`, `err`, `isOk`, `isErr` |
140
+ | **Transform** | `map`, `mapErr`, `flatMap`, `bimap`, `filter`, `tap`, `tapErr` |
141
+ | **Curried** | `mapWith`, `flatMapWith`, `mapErrWith`, `filterWith`, `tapWith`, `tapErrWith` |
142
+ | **Recovery** | `orElse`, `orElseWith` |
143
+ | **Unwrap** | `unwrap`, `unwrapOr`, `unwrapOrElse` |
144
+ | **Combine** | `combine`, `combineAll` |
145
+ | **Convert** | `fromTry`, `fromTryWithError`, `fromPromise`, `fromPromiseWithError`, `toPromise`, `mapToOption` |
146
+ | **Branch** | `match` |
139
147
 
140
148
  ### Schema
141
149
 
142
150
  Parse untrusted data into typed values. Accumulates all validation errors.
143
151
 
144
- > **Standard Schema v1 compliant** — use `toStandardSchema()` for interop with tRPC, TanStack Form, React Hook Form, and other Standard Schema consumers. See [Recipes → Standard Schema Interop](docs/RECIPES.md#standard-schema-interop).
152
+ > **Standard Schema v1 compliant** — use `toStandardSchema()` for interop with tRPC, TanStack Form, React Hook Form, and other Standard Schema consumers. See [Recipes -> Standard Schema Interop](docs/RECIPES.md#standard-schema-interop).
145
153
 
146
154
  ```typescript
147
155
  import {
@@ -170,24 +178,24 @@ const result = validate(input, userSchema);
170
178
  // Result<User, ValidationError[]>
171
179
  ```
172
180
 
173
- | Category | Functions |
174
- |----------|-----------|
175
- | **Primitives** | `string`, `number`, `boolean`, `date`, `bigint` |
176
- | **Parsers** | `parseNumber`, `parseString`, `parseBool`, `parseBigInt`, `parseDate`, `parseISODate`, `parseJSON`, `parseURL`, `parseEnum` |
177
- | **Structures** | `object`, `array`, `tuple`, `tupleOf` |
178
- | **Unions** | `union`, `discriminatedUnion`, `literal` |
179
- | **Modifiers** | `required`, `optional`, `nullable`, `emptyAsOptional` |
180
- | **String Constraints** | `minLength`, `maxLength`, `pattern`, `nonEmpty`, `email`, `phoneNumber` |
181
- | **Number Constraints** | `min`, `max`, `integer`, `finite`, `between`, `positive`, `negative`, `nonZero`, `divisibleBy`, `precision` |
182
- | **Date Constraints** | `dateRange`, `pastDate`, `futureDate`, `todayOrFuture` |
183
- | **Enums** | `stringEnum`, `enumValue`, `oneOf` |
184
- | **Boolean Constraints** | `matches` |
185
- | **Array Constraints** | `minItems`, `maxItems`, `notEmpty`, `unique` |
186
- | **Combinators** | `chain`, `transform`, `refine` |
187
- | **Cross-field** | `refineAt`, `refineAtAsync` |
188
- | **Async** | `chainAsync`, `refineAsync`, `refineAtAsync` |
189
- | **Utilities** | `validate`, `validateAndFormatResult`, `formatErrors`, `toStandardSchema`, `ROOT_ERROR_KEY` |
190
- | **Types** | `Validator`, `AsyncValidator`, `MaybeAsyncValidator`, `Schema`, `SyncSchema`, `InferSchemaType`, `ValidatorMapOutput`, `ValidationError`, `ValidationResult`, `StandardSchemaV1` |
181
+ | Category | Functions |
182
+ | ----------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
183
+ | **Primitives** | `string`, `number`, `boolean`, `date`, `bigint` |
184
+ | **Parsers** | `parseNumber`, `parseString`, `parseBool`, `parseBigInt`, `parseDate`, `parseISODate`, `parseJSON`, `parseURL`, `parseEnum` |
185
+ | **Structures** | `object`, `array`, `tuple`, `tupleOf` |
186
+ | **Unions** | `union`, `discriminatedUnion`, `literal` |
187
+ | **Modifiers** | `required`, `optional`, `nullable`, `emptyAsOptional` |
188
+ | **String Constraints** | `minLength`, `maxLength`, `pattern`, `nonEmpty`, `email`, `phoneNumber` |
189
+ | **Number Constraints** | `min`, `max`, `integer`, `finite`, `between`, `positive`, `negative`, `nonZero`, `divisibleBy`, `precision` |
190
+ | **Date Constraints** | `dateRange`, `pastDate`, `futureDate`, `todayOrFuture` |
191
+ | **Enums** | `stringEnum`, `enumValue`, `oneOf` |
192
+ | **Boolean Constraints** | `matches` |
193
+ | **Array Constraints** | `minItems`, `maxItems`, `notEmpty`, `unique` |
194
+ | **Combinators** | `chain`, `transform`, `refine` |
195
+ | **Cross-field** | `refineAt`, `refineAtAsync` |
196
+ | **Async** | `chainAsync`, `refineAsync`, `refineAtAsync` |
197
+ | **Utilities** | `validate`, `validateAndFormatResult`, `formatErrors`, `toStandardSchema`, `ROOT_ERROR_KEY` |
198
+ | **Types** | `Validator`, `AsyncValidator`, `MaybeAsyncValidator`, `Schema`, `SyncSchema`, `InferSchemaType`, `ValidatorMapOutput`, `ValidationError`, `ValidationResult`, `StandardSchemaV1` |
191
199
 
192
200
  ### Composition
193
201
 
@@ -218,11 +226,11 @@ const processOrder = flowAsync(validateOrder, chargePayment, createShipment);
218
226
  await processOrder(orderInput);
219
227
  ```
220
228
 
221
- | Category | Functions |
222
- |----------|-----------|
223
- | **Sync** | `pipe`, `flow`, `curry`, `uncurry`, `tupled`, `untupled` |
224
- | **Async** | `pipeAsync`, `flowAsync` |
225
- | **Types** | `MaybeAsync` |
229
+ | Category | Functions |
230
+ | --------- | -------------------------------------------------------- |
231
+ | **Sync** | `pipe`, `flow`, `curry`, `uncurry`, `tupled`, `untupled` |
232
+ | **Async** | `pipeAsync`, `flowAsync` |
233
+ | **Types** | `MaybeAsync` |
226
234
 
227
235
  ## Examples
228
236
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@railway-ts/pipelines",
3
- "version": "0.1.10",
3
+ "version": "0.1.12",
4
4
  "description": "Railway-oriented pipelines for TypeScript: a lightweight fp-style Result/Option and schema layer for handling errors and validating boundaries.",
5
5
  "type": "module",
6
6
  "exports": {