@navios/di 0.1.13 → 0.2.0

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/src/registry.mts CHANGED
@@ -1,6 +1,4 @@
1
- import type { AnyZodObject } from 'zod'
2
-
3
- import { z } from 'zod'
1
+ import type { z, ZodObject } from 'zod/v4'
4
2
 
5
3
  import type { FactoryContext } from './factory-context.mjs'
6
4
  import type { InjectionToken } from './injection-token.mjs'
@@ -17,7 +15,7 @@ export type FactoryRecord<Instance = any, Schema = any> = {
17
15
  originalToken: InjectionToken<Instance, Schema>
18
16
  factory: InjectionFactory<
19
17
  Instance,
20
- Schema extends AnyZodObject ? z.input<Schema> : unknown
18
+ Schema extends ZodObject<any> ? z.input<Schema> : unknown
21
19
  >
22
20
  }
23
21
 
@@ -1,6 +1,6 @@
1
1
  /* eslint-disable @typescript-eslint/no-explicit-any */
2
2
  /* eslint-disable @typescript-eslint/no-empty-object-type */
3
- import type { AnyZodObject, z, ZodOptional } from 'zod'
3
+ import type { z, ZodObject, ZodOptional } from 'zod/v4'
4
4
 
5
5
  import type { FactoryContext } from './factory-context.mjs'
6
6
  import type {
@@ -62,7 +62,7 @@ export class ServiceLocator {
62
62
  ): void
63
63
  public storeInstance<
64
64
  Instance,
65
- Schema extends AnyZodObject | ZodOptional<AnyZodObject>,
65
+ Schema extends ZodObject<any> | ZodOptional<ZodObject<any>>,
66
66
  >(
67
67
  instance: Instance,
68
68
  token: InjectionToken<Instance, Schema>,
@@ -292,9 +292,9 @@ export class ServiceLocator {
292
292
  Schema extends InjectionTokenSchemaType | undefined,
293
293
  >(
294
294
  token: InjectionToken<Instance, Schema>,
295
- args: Schema extends AnyZodObject
295
+ args: Schema extends ZodObject<any>
296
296
  ? z.input<Schema>
297
- : Schema extends ZodOptional<AnyZodObject>
297
+ : Schema extends ZodOptional<ZodObject<any>>
298
298
  ? z.input<Schema> | undefined
299
299
  : undefined,
300
300
  ): Promise<Instance> {
@@ -321,9 +321,9 @@ export class ServiceLocator {
321
321
  >(
322
322
  instanceName: string,
323
323
  token: InjectionToken<Instance, Schema>,
324
- args: Schema extends AnyZodObject
324
+ args: Schema extends ZodObject<any>
325
325
  ? z.input<Schema>
326
- : Schema extends ZodOptional<AnyZodObject>
326
+ : Schema extends ZodOptional<ZodObject<any>>
327
327
  ? z.input<Schema> | undefined
328
328
  : undefined,
329
329
  ): Promise<[undefined, Instance] | [FactoryNotFound | UnknownError]> {
@@ -481,9 +481,9 @@ export class ServiceLocator {
481
481
  Schema extends InjectionTokenSchemaType | undefined,
482
482
  >(
483
483
  token: InjectionToken<Instance, Schema>,
484
- args: Schema extends AnyZodObject
484
+ args: Schema extends ZodObject<any>
485
485
  ? z.input<Schema>
486
- : Schema extends ZodOptional<AnyZodObject>
486
+ : Schema extends ZodOptional<ZodObject<any>>
487
487
  ? z.input<Schema> | undefined
488
488
  : undefined,
489
489
  ): Instance | null {
@@ -1,4 +1,4 @@
1
- import type { AnyZodObject, z, ZodType } from 'zod'
1
+ import type { z, ZodObject, ZodType } from 'zod/v4'
2
2
 
3
3
  import type {
4
4
  BoundInjectionToken,
@@ -150,8 +150,8 @@ export function getInjectors({ baseLocator }: CreateInjectorsOptions) {
150
150
  | InjectionToken<T>
151
151
  | BoundInjectionToken<T, any>
152
152
  | FactoryInjectionToken<T, any>,
153
- S extends AnyZodObject | unknown = Token['schema'],
154
- >(token: Token, args?: S extends AnyZodObject ? z.input<S> : never): T {
153
+ S extends ZodObject<any> | unknown = Token['schema'],
154
+ >(token: Token, args?: S extends ZodObject<any> ? z.input<S> : never): T {
155
155
  // @ts-expect-error In case we have a class
156
156
  const realToken = token[InjectableTokenMeta] ?? token
157
157