@railway-ts/pipelines 0.1.14 → 0.1.15
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/README.md +19 -19
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.com/package/@railway-ts/pipelines) [](https://github.com/sakobu/railway-ts-pipelines/actions) [](https://opensource.org/licenses/MIT) [](https://www.typescriptlang.org/) [](https://codecov.io/gh/sakobu/railway-ts-pipelines)
|
|
4
4
|
|
|
5
|
-
Railway-oriented programming for TypeScript. Typed `Result<T, E>` pipelines with first-class validation and optional `Option<T>` support
|
|
5
|
+
Railway-oriented programming for TypeScript. Typed `Result<T, E>` pipelines with first-class validation and optional `Option<T>` support -- small, modular, and fully tree-shakable.
|
|
6
6
|
|
|
7
7
|
## Why?
|
|
8
8
|
|
|
@@ -20,19 +20,19 @@ No runtime. No global context. No required framework. Import only what you need.
|
|
|
20
20
|
|
|
21
21
|
The library is layered and modular:
|
|
22
22
|
|
|
23
|
-
- **Result**
|
|
24
|
-
- **Option**
|
|
25
|
-
- **Schema**
|
|
26
|
-
- **Composition**
|
|
23
|
+
- **Result** -- explicit success/failure, no exceptions
|
|
24
|
+
- **Option** -- nullable handling without null checks
|
|
25
|
+
- **Schema** -- parse unknown input into typed values
|
|
26
|
+
- **Composition** -- build sync and async pipelines
|
|
27
27
|
|
|
28
28
|
Each layer works independently. Combine them when it makes sense.
|
|
29
29
|
|
|
30
30
|
Fully tree-shakable:
|
|
31
31
|
|
|
32
|
-
- `result`
|
|
33
|
-
- `option`
|
|
34
|
-
- `composition`
|
|
35
|
-
- `schema`
|
|
32
|
+
- `result` -- 582 B
|
|
33
|
+
- `option` -- 402 B
|
|
34
|
+
- `composition` -- 233 B
|
|
35
|
+
- `schema` -- ~3 kB
|
|
36
36
|
|
|
37
37
|
**~4.2 kB total** (minified + brotli)
|
|
38
38
|
|
|
@@ -137,7 +137,7 @@ match(result, {
|
|
|
137
137
|
}); // Output: 15
|
|
138
138
|
```
|
|
139
139
|
|
|
140
|
-
`ok` · `err` · `isOk` · `isErr` · `map` · `flatMap` · `mapErr` · `bimap` · `filter` · `tap` · `tapErr` · `orElse` · `combine` · `combineAll` · `fromPromise` · `fromTry` · `match` · `unwrapOr`
|
|
140
|
+
`ok` · `err` · `isOk` · `isErr` · `map` · `flatMap` · `mapErr` · `bimap` · `filter` · `tap` · `tapErr` · `orElse` · `combine` · `combineAll` · `fromPromise` · `fromTry` · `match` · `unwrapOr` -- [full API](docs/API.md#result)
|
|
141
141
|
|
|
142
142
|
### Option
|
|
143
143
|
|
|
@@ -159,7 +159,7 @@ match(name, {
|
|
|
159
159
|
}); // Output: Alice
|
|
160
160
|
```
|
|
161
161
|
|
|
162
|
-
`some` · `none` · `isSome` · `isNone` · `map` · `flatMap` · `bimap` · `filter` · `tap` · `combine` · `fromNullable` · `mapToResult` · `match` · `unwrapOr`
|
|
162
|
+
`some` · `none` · `isSome` · `isNone` · `map` · `flatMap` · `bimap` · `filter` · `tap` · `combine` · `fromNullable` · `mapToResult` · `match` · `unwrapOr` -- [full API](docs/API.md#option)
|
|
163
163
|
|
|
164
164
|
Use independently, or convert to Result when needed.
|
|
165
165
|
|
|
@@ -167,7 +167,7 @@ Use independently, or convert to Result when needed.
|
|
|
167
167
|
|
|
168
168
|
Parse unknown data into typed values. Accumulates all validation errors.
|
|
169
169
|
|
|
170
|
-
> **Standard Schema v1 compliant**
|
|
170
|
+
> **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).
|
|
171
171
|
|
|
172
172
|
```typescript
|
|
173
173
|
import {
|
|
@@ -196,7 +196,7 @@ const result = validate(input, userSchema);
|
|
|
196
196
|
// Result<User, ValidationError[]>
|
|
197
197
|
```
|
|
198
198
|
|
|
199
|
-
`object` · `array` · `tuple` · `required` · `optional` · `chain` · `string` · `parseNumber` · `email` · `min` · `max` · `union` · `discriminatedUnion` · `refine` · `refineAt` · `transform` · `validate` · `toStandardSchema`
|
|
199
|
+
`object` · `array` · `tuple` · `required` · `optional` · `chain` · `string` · `parseNumber` · `email` · `min` · `max` · `union` · `discriminatedUnion` · `refine` · `refineAt` · `transform` · `validate` · `toStandardSchema` -- [full API](docs/API.md#schema)
|
|
200
200
|
|
|
201
201
|
### Composition
|
|
202
202
|
|
|
@@ -227,20 +227,20 @@ const processOrder = flowAsync(validateOrder, chargePayment, createShipment);
|
|
|
227
227
|
await processOrder(orderInput);
|
|
228
228
|
```
|
|
229
229
|
|
|
230
|
-
`pipe` · `flow` · `pipeAsync` · `flowAsync` · `curry` · `uncurry` · `tupled` · `untupled`
|
|
230
|
+
`pipe` · `flow` · `pipeAsync` · `flowAsync` · `curry` · `uncurry` · `tupled` · `untupled` -- [full API](docs/API.md#composition)
|
|
231
231
|
|
|
232
232
|
Sync and async composition share the same mental model.
|
|
233
233
|
|
|
234
234
|
## Ecosystem
|
|
235
235
|
|
|
236
|
-
- **[@railway-ts/use-form](https://github.com/sakobu/railway-ts-use-form)**
|
|
236
|
+
- **[@railway-ts/use-form](https://github.com/sakobu/railway-ts-use-form)** -- Type-safe React form hook built directly on the Schema layer. Define a schema once -- use it for validation, type inference, and form state.
|
|
237
237
|
|
|
238
238
|
## Documentation
|
|
239
239
|
|
|
240
|
-
- **[Getting Started](docs/GETTING_STARTED.md)**
|
|
241
|
-
- **[Recipes](docs/RECIPES.md)**
|
|
242
|
-
- **[API Reference](docs/API.md)**
|
|
243
|
-
- **[Examples](examples/)**
|
|
240
|
+
- **[Getting Started](docs/GETTING_STARTED.md)** -- Learn the concepts, one at a time
|
|
241
|
+
- **[Recipes](docs/RECIPES.md)** -- Patterns for real work: async pipelines, error recovery, validation, Standard Schema
|
|
242
|
+
- **[API Reference](docs/API.md)** -- Every function signature and description
|
|
243
|
+
- **[Examples](examples/)** -- Working code you can run
|
|
244
244
|
|
|
245
245
|
For a complete real-world pipeline, see the [Launch Decision Pipeline](docs/RECIPES.md#full-example-launch-decision-pipeline) -- validates input, fetches weather data, and makes a GO/NO-GO decision.
|
|
246
246
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@railway-ts/pipelines",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.15",
|
|
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": {
|