@zio.dev/zio-blocks 0.0.29 → 0.0.31
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/guides/compile-time-resource-safety-with-scope.md +997 -0
- package/guides/query-dsl-extending.md +1 -1
- package/guides/query-dsl-fluent-builder.md +203 -203
- package/guides/query-dsl-reified-optics.md +1 -1
- package/guides/query-dsl-sql.md +1 -1
- package/guides/zio-schema-migration.md +8 -8
- package/index.md +20 -14
- package/package.json +1 -1
- package/reference/codec.md +17 -17
- package/reference/context.md +49 -1
- package/reference/docs.md +1 -1
- package/reference/dynamic-schema.md +39 -42
- package/reference/formats.md +5 -11
- package/reference/json-schema.md +2 -2
- package/reference/json.md +34 -43
- package/reference/media-type.md +2 -2
- package/reference/modifier.md +4 -4
- package/reference/resource-management/defer-handle.md +246 -0
- package/reference/resource-management/finalization.md +286 -0
- package/reference/resource-management/finalizer.md +167 -0
- package/reference/{resource-management-di → resource-management}/index.md +3 -8
- package/reference/{resource-management-di → resource-management}/resource.md +532 -50
- package/reference/resource-management/scope.md +3026 -0
- package/reference/resource-management/unscoped.md +125 -0
- package/reference/{resource-management-di → resource-management}/wire.md +122 -28
- package/reference/schema-error.md +0 -1
- package/reference/schema-evolution/as.md +4 -4
- package/reference/schema-evolution/into.md +2 -2
- package/reference/schema-expr.md +2 -2
- package/reference/schema.md +9 -4
- package/reference/streams.md +989 -0
- package/reference/type-class-derivation.md +14 -15
- package/ringbuffer.md +1 -1
- package/sidebars.js +9 -4
- package/undocumented-report.md +1 -1
- package/reference/resource-management-di/scope.md +0 -1423
|
@@ -7,20 +7,15 @@ title: "Resource Management & Dependency Injection"
|
|
|
7
7
|
|
|
8
8
|
Resource management and dependency injection are fundamental to building reliable, maintainable applications. ZIO Blocks provides three complementary types that work together to eliminate common lifetime bugs while enabling powerful composition patterns: **Scope** provides compile-time safe resource boundaries, **Resource** encapsulates acquisition and cleanup with automatic finalization, and **Wire** describes dependency graphs with type-safe construction recipes. Together, they form a cohesive system for managing object lifecycles, preventing resource leaks, and building dependency-injected architectures.
|
|
9
9
|
|
|
10
|
-
**Related Types:**
|
|
11
|
-
- [`Resource`](./resource.md) — Lazy recipe for managing resource lifecycles with automatic cleanup
|
|
12
|
-
- [`Scope`](./scope.md) — Compile-time safe resource management and scoped value access
|
|
13
|
-
- [`Wire`](./wire.md) — Type-safe recipes for constructing services and their dependencies
|
|
14
|
-
|
|
15
10
|
## Overview
|
|
16
11
|
|
|
17
12
|
These three types solve the fundamental problem of managing resources and dependencies in concurrent, long-lived applications:
|
|
18
13
|
|
|
19
|
-
**Scope** is the foundation — it provides a compile-time safe boundary that prevents resources from escaping their intended lifetime. Using path-dependent types, Scope ensures that values allocated in one scope cannot accidentally be used in another scope, catching lifetime violations at compile time rather than causing runtime bugs.
|
|
14
|
+
**[Scope](./scope.md)** is the foundation — it provides a compile-time safe boundary that prevents resources from escaping their intended lifetime. Using path-dependent types, Scope ensures that values allocated in one scope cannot accidentally be used in another scope, catching lifetime violations at compile time rather than causing runtime bugs.
|
|
20
15
|
|
|
21
|
-
**Resource** builds on Scope to describe how to acquire and finalize resources. Rather than executing immediately, a Resource is a lazy recipe that composes naturally with `map`, `flatMap`, and `zip`. When allocated within a scope, finalizers run automatically in LIFO order, ensuring cleanup happens even when errors occur.
|
|
16
|
+
**[Resource](./resource.md)** builds on Scope to describe how to acquire and finalize resources. Rather than executing immediately, a Resource is a lazy recipe that composes naturally with `map`, `flatMap`, and `zip`. When allocated within a scope, finalizers run automatically in LIFO order, ensuring cleanup happens even when errors occur.
|
|
22
17
|
|
|
23
|
-
**Wire** brings it all together by describing how to construct services and their dependencies. The Wire macro automatically handles dependency resolution, cycle detection, and AutoCloseable registration, letting you declaratively specify a dependency graph that the compiler validates.
|
|
18
|
+
**[Wire](./wire.md)** brings it all together by describing how to construct services and their dependencies. The Wire macro automatically handles dependency resolution, cycle detection, and AutoCloseable registration, letting you declaratively specify a dependency graph that the compiler validates.
|
|
24
19
|
|
|
25
20
|
### How They Work Together
|
|
26
21
|
|