resultar 3.9.0 → 3.9.1

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.
@@ -44,7 +44,8 @@ contracts; converting an already-started Promise or ResultAsync cannot undo its
44
44
  when the boundary must inspect every exit without rejection. See [API details](references/api.md).
45
45
  For DI, Hono and Fastify, read [services and HTTP scopes](references/services.md). Use
46
46
  `ResultTask.service<T>()(name)` or DI `Service.require<T>()(name)` for inferred identifiers. Class
47
- services support optional `requires` with a factory returning ResultTask; generator-only `make`
47
+ services support optional `requires` with a factory returning a synchronous value or ResultTask
48
+ (Promises and thenables are rejected); generator-only `make`
48
49
  remains available. Check installed versions before using these overloads.
49
50
 
50
51
  ## Apply Opinionated Defaults
@@ -9,9 +9,10 @@ The former `/advanced` subpath has been removed; migrate existing imports to `re
9
9
  in DI to infer the literal identifier. The direct core overload remains supported; do not invent
10
10
  `Result.service`. Service requirements are represented by `R` in `ResultTask<T, E, R>`.
11
11
  - Declare class services with `Service('name', { requires: { alias: Token }, make: ({ alias }) =>
12
- ResultTask.sync(...) })`. The readonly dependency object is inferred; `make` must return a
13
- ResultTask, never a plain object or Promise. Use `ResultTask.gen` for initialization with more
14
- steps. Without `requires`, pass a task directly as `make` and yield requirements inline or by token.
12
+ ({ ... }) })`. The readonly dependency object is inferred; `make` can return the service
13
+ object directly or a ResultTask. Factories remain lazy and synchronous values add no typed
14
+ initialization errors. Promises and thenables are rejected. Use `ResultTask.gen` for
15
+ initialization with typed failures, additional requirements or owned resources. Without `requires`, pass a task directly as `make` and yield requirements inline or by token.
15
16
  Both forms support `Service<Contract>()('name', definition)`.
16
17
  - Keep provider registration explicit. `requires` does not acquire or register dependencies.
17
18
  Inline tokens resolve by name in DI or `provideServices`; core `provideService` supplies an exact
@@ -34,6 +35,12 @@ The former `/advanced` subpath has been removed; migrate existing imports to `re
34
35
  Unused default-selected services can still fail acquisition and prevent the handler.
35
36
  Fastify `appBindings` continues to default to `[]`; locals satisfy requirements without being
36
37
  automatically exposed as registrations. The Hono middleware API still takes explicit keys.
38
+ - `startup` is optional in the native application adapters and accepts a `ResultTask<void, E, R>`
39
+ whose requirements are checked against the module. Fastify runs it in `onReady` after plugin
40
+ loading and also accepts `(app: FastifyInstance) => ResultTask<void, E, R>`. Hono runs it on
41
+ `ready()` or before the first request. Direct resources live until close and release before
42
+ singleton dependencies; scoped/transient dependencies are rejected. A failure rolls back the
43
+ application root, preserving cleanup causes. Hono close cancels pending startup cooperatively.
37
44
  - Use `createHonoServices(module).middleware(keys, { locals })` to add services to an existing Hono
38
45
  router. Inline route middleware infers `c.var.services` while preserving `c.env` and native RPC
39
46
  responses. Install one services middleware per request; consume/cancel responses before `close()`.
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "resultar-check": "3.2.0",
3
- "resultar-di": "0.3.0",
4
- "resultar-fastify": "0.3.0",
5
- "resultar-hono": "0.3.0",
3
+ "resultar-di": "0.4.0",
4
+ "resultar-fastify": "0.4.0",
5
+ "resultar-hono": "0.4.0",
6
6
  "resultar-request": "0.1.2",
7
7
  "resultar-request-typebox": "0.1.2",
8
8
  "resultar-request-zod": "0.1.2",
9
- "resultar": "3.9.0"
9
+ "resultar": "3.9.1"
10
10
  }
package/dist/llms.txt CHANGED
@@ -1,4 +1,4 @@
1
- # Resultar 3.9.0
1
+ # Resultar 3.9.1
2
2
 
3
3
  Documentation bundled with this package version. Installed declarations remain authoritative.
4
4
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "resultar",
3
- "version": "3.9.0",
3
+ "version": "3.9.1",
4
4
  "description": "Result pattern for TypeScript",
5
5
  "keywords": [
6
6
  "error-handling",