@navios/di 0.1.3 → 0.1.4

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.
@@ -1,9 +1,4 @@
1
- import { AnyZodObject } from 'zod';
2
- import { BoundInjectionToken as BoundInjectionToken_2 } from './injection-token.mjs';
3
- import { ClassType as ClassType_2 } from './injection-token.mjs';
4
- import { FactoryInjectionToken as FactoryInjectionToken_2 } from './injection-token.mjs';
5
- import { InjectionToken as InjectionToken_2 } from './injection-token.mjs';
6
- import { input } from 'zod';
1
+ import type { AnyZodObject } from 'zod';
7
2
  import { z } from 'zod';
8
3
  import { ZodOptional } from 'zod';
9
4
 
@@ -173,14 +168,7 @@ declare const globalRegistry: Registry;
173
168
  export { globalRegistry }
174
169
  export { globalRegistry as globalRegistry_alias_1 }
175
170
 
176
- declare const inject: {
177
- <T extends ClassType_2>(token: T): Promise<InstanceType<T>>;
178
- <T, S extends AnyZodObject>(token: InjectionToken_2<T, S>, args: input<S>): Promise<T>;
179
- <T, S extends ZodOptional<AnyZodObject>>(token: InjectionToken_2<T, S>, args?: input<S>): Promise<T>;
180
- <T>(token: InjectionToken_2<T, undefined>): Promise<T>;
181
- <T>(token: BoundInjectionToken_2<T, any>): Promise<T>;
182
- <T>(token: FactoryInjectionToken_2<T, any>): Promise<T>;
183
- };
171
+ declare const inject: Injectors['inject'];
184
172
  export { inject }
185
173
  export { inject as inject_alias_1 }
186
174
 
@@ -336,7 +324,7 @@ declare function makeProxyServiceLocator(serviceLocator: ServiceLocator, ctx: Fa
336
324
  export { makeProxyServiceLocator }
337
325
  export { makeProxyServiceLocator as makeProxyServiceLocator_alias_1 }
338
326
 
339
- declare const provideServiceLocator: (locator: ServiceLocator) => ServiceLocator;
327
+ declare const provideServiceLocator: Injectors['provideServiceLocator'];
340
328
  export { provideServiceLocator }
341
329
  export { provideServiceLocator as provideServiceLocator_alias_1 }
342
330
 
@@ -509,14 +497,7 @@ declare class ServiceLocatorManager {
509
497
  export { ServiceLocatorManager }
510
498
  export { ServiceLocatorManager as ServiceLocatorManager_alias_1 }
511
499
 
512
- declare const syncInject: {
513
- <T extends ClassType_2>(token: T): InstanceType<T>;
514
- <T, S extends AnyZodObject>(token: InjectionToken_2<T, S>, args: input<S>): T;
515
- <T, S extends ZodOptional<AnyZodObject>>(token: InjectionToken_2<T, S>, args?: input<S>): T;
516
- <T>(token: InjectionToken_2<T, undefined>): T;
517
- <T>(token: BoundInjectionToken_2<T, any>): T;
518
- <T>(token: FactoryInjectionToken_2<T, any>): T;
519
- };
500
+ declare const syncInject: Injectors['syncInject'];
520
501
  export { syncInject }
521
502
  export { syncInject as syncInject_alias_1 }
522
503
 
@@ -529,7 +510,7 @@ export { UnknownError }
529
510
  export { UnknownError as UnknownError_alias_1 }
530
511
  export { UnknownError as UnknownError_alias_2 }
531
512
 
532
- declare const wrapSyncInit: (cb: () => any) => () => [any, Promise<any>[]];
513
+ declare const wrapSyncInit: Injectors['wrapSyncInit'];
533
514
  export { wrapSyncInit }
534
515
  export { wrapSyncInit as wrapSyncInit_alias_1 }
535
516
 
@@ -1,9 +1,4 @@
1
- import { AnyZodObject } from 'zod';
2
- import { BoundInjectionToken as BoundInjectionToken_2 } from './injection-token.mjs';
3
- import { ClassType as ClassType_2 } from './injection-token.mjs';
4
- import { FactoryInjectionToken as FactoryInjectionToken_2 } from './injection-token.mjs';
5
- import { InjectionToken as InjectionToken_2 } from './injection-token.mjs';
6
- import { input } from 'zod';
1
+ import type { AnyZodObject } from 'zod';
7
2
  import { z } from 'zod';
8
3
  import { ZodOptional } from 'zod';
9
4
 
@@ -173,14 +168,7 @@ declare const globalRegistry: Registry;
173
168
  export { globalRegistry }
174
169
  export { globalRegistry as globalRegistry_alias_1 }
175
170
 
176
- declare const inject: {
177
- <T extends ClassType_2>(token: T): Promise<InstanceType<T>>;
178
- <T, S extends AnyZodObject>(token: InjectionToken_2<T, S>, args: input<S>): Promise<T>;
179
- <T, S extends ZodOptional<AnyZodObject>>(token: InjectionToken_2<T, S>, args?: input<S>): Promise<T>;
180
- <T>(token: InjectionToken_2<T, undefined>): Promise<T>;
181
- <T>(token: BoundInjectionToken_2<T, any>): Promise<T>;
182
- <T>(token: FactoryInjectionToken_2<T, any>): Promise<T>;
183
- };
171
+ declare const inject: Injectors['inject'];
184
172
  export { inject }
185
173
  export { inject as inject_alias_1 }
186
174
 
@@ -336,7 +324,7 @@ declare function makeProxyServiceLocator(serviceLocator: ServiceLocator, ctx: Fa
336
324
  export { makeProxyServiceLocator }
337
325
  export { makeProxyServiceLocator as makeProxyServiceLocator_alias_1 }
338
326
 
339
- declare const provideServiceLocator: (locator: ServiceLocator) => ServiceLocator;
327
+ declare const provideServiceLocator: Injectors['provideServiceLocator'];
340
328
  export { provideServiceLocator }
341
329
  export { provideServiceLocator as provideServiceLocator_alias_1 }
342
330
 
@@ -509,14 +497,7 @@ declare class ServiceLocatorManager {
509
497
  export { ServiceLocatorManager }
510
498
  export { ServiceLocatorManager as ServiceLocatorManager_alias_1 }
511
499
 
512
- declare const syncInject: {
513
- <T extends ClassType_2>(token: T): InstanceType<T>;
514
- <T, S extends AnyZodObject>(token: InjectionToken_2<T, S>, args: input<S>): T;
515
- <T, S extends ZodOptional<AnyZodObject>>(token: InjectionToken_2<T, S>, args?: input<S>): T;
516
- <T>(token: InjectionToken_2<T, undefined>): T;
517
- <T>(token: BoundInjectionToken_2<T, any>): T;
518
- <T>(token: FactoryInjectionToken_2<T, any>): T;
519
- };
500
+ declare const syncInject: Injectors['syncInject'];
520
501
  export { syncInject }
521
502
  export { syncInject as syncInject_alias_1 }
522
503
 
@@ -529,7 +510,7 @@ export { UnknownError }
529
510
  export { UnknownError as UnknownError_alias_1 }
530
511
  export { UnknownError as UnknownError_alias_2 }
531
512
 
532
- declare const wrapSyncInit: (cb: () => any) => () => [any, Promise<any>[]];
513
+ declare const wrapSyncInit: Injectors['wrapSyncInit'];
533
514
  export { wrapSyncInit }
534
515
  export { wrapSyncInit as wrapSyncInit_alias_1 }
535
516
 
package/dist/index.d.mts CHANGED
@@ -1,6 +1,5 @@
1
1
  export { Injectable } from './_tsup-dts-rollup.mjs';
2
2
  export { InjectableOptions } from './_tsup-dts-rollup.mjs';
3
- export { InjectableTokenMeta } from './_tsup-dts-rollup.mjs';
4
3
  export { InjectableScope } from './_tsup-dts-rollup.mjs';
5
4
  export { InjectableType } from './_tsup-dts-rollup.mjs';
6
5
  export { ErrorsEnum } from './_tsup-dts-rollup.mjs';
@@ -52,3 +51,4 @@ export { ServiceLocatorInstanceHolderCreated } from './_tsup-dts-rollup.mjs';
52
51
  export { ServiceLocatorInstanceHolderDestroying } from './_tsup-dts-rollup.mjs';
53
52
  export { ServiceLocatorInstanceHolder } from './_tsup-dts-rollup.mjs';
54
53
  export { ServiceLocatorManager } from './_tsup-dts-rollup.mjs';
54
+ export { InjectableTokenMeta } from './_tsup-dts-rollup.mjs';
package/dist/index.d.ts CHANGED
@@ -1,6 +1,5 @@
1
1
  export { Injectable } from './_tsup-dts-rollup.js';
2
2
  export { InjectableOptions } from './_tsup-dts-rollup.js';
3
- export { InjectableTokenMeta } from './_tsup-dts-rollup.js';
4
3
  export { InjectableScope } from './_tsup-dts-rollup.js';
5
4
  export { InjectableType } from './_tsup-dts-rollup.js';
6
5
  export { ErrorsEnum } from './_tsup-dts-rollup.js';
@@ -52,3 +51,4 @@ export { ServiceLocatorInstanceHolderCreated } from './_tsup-dts-rollup.js';
52
51
  export { ServiceLocatorInstanceHolderDestroying } from './_tsup-dts-rollup.js';
53
52
  export { ServiceLocatorInstanceHolder } from './_tsup-dts-rollup.js';
54
53
  export { ServiceLocatorManager } from './_tsup-dts-rollup.js';
54
+ export { InjectableTokenMeta } from './_tsup-dts-rollup.js';
package/dist/index.js CHANGED
@@ -229,6 +229,9 @@ function makeProxyServiceLocator(serviceLocator, ctx) {
229
229
  return new ProxyServiceLocator(serviceLocator, ctx);
230
230
  }
231
231
 
232
+ // packages/di/src/symbols/injectable-token.mts
233
+ var InjectableTokenMeta = Symbol.for("InjectableTokenMeta");
234
+
232
235
  // packages/di/src/utils/get-injectors.mts
233
236
  var InjectorsBase = /* @__PURE__ */ new Map();
234
237
  function getInjectors({ baseLocator }) {
@@ -333,7 +336,6 @@ async function resolveService(ctx, target, args = []) {
333
336
  }
334
337
 
335
338
  // packages/di/src/decorators/injectable.decorator.mts
336
- var InjectableTokenMeta = Symbol.for("InjectableTokenMeta");
337
339
  function Injectable({
338
340
  scope = "Singleton" /* Singleton */,
339
341
  type = "Class" /* Class */,
@@ -978,9 +980,13 @@ function getGlobalServiceLocator() {
978
980
  }
979
981
  return globalServiceLocator;
980
982
  }
981
- var { inject, syncInject, wrapSyncInit, provideServiceLocator } = getInjectors({
983
+ var values = getInjectors({
982
984
  baseLocator: globalServiceLocator
983
985
  });
986
+ var inject = values.inject;
987
+ var syncInject = values.syncInject;
988
+ var wrapSyncInit = values.wrapSyncInit;
989
+ var provideServiceLocator = values.provideServiceLocator;
984
990
  // Annotate the CommonJS export names for ESM import in node:
985
991
  0 && (module.exports = {
986
992
  BoundInjectionToken,
package/dist/index.mjs CHANGED
@@ -171,6 +171,9 @@ function makeProxyServiceLocator(serviceLocator, ctx) {
171
171
  return new ProxyServiceLocator(serviceLocator, ctx);
172
172
  }
173
173
 
174
+ // packages/di/src/symbols/injectable-token.mts
175
+ var InjectableTokenMeta = Symbol.for("InjectableTokenMeta");
176
+
174
177
  // packages/di/src/utils/get-injectors.mts
175
178
  var InjectorsBase = /* @__PURE__ */ new Map();
176
179
  function getInjectors({ baseLocator }) {
@@ -275,7 +278,6 @@ async function resolveService(ctx, target, args = []) {
275
278
  }
276
279
 
277
280
  // packages/di/src/decorators/injectable.decorator.mts
278
- var InjectableTokenMeta = Symbol.for("InjectableTokenMeta");
279
281
  function Injectable({
280
282
  scope = "Singleton" /* Singleton */,
281
283
  type = "Class" /* Class */,
@@ -920,9 +922,13 @@ function getGlobalServiceLocator() {
920
922
  }
921
923
  return globalServiceLocator;
922
924
  }
923
- var { inject, syncInject, wrapSyncInit, provideServiceLocator } = getInjectors({
925
+ var values = getInjectors({
924
926
  baseLocator: globalServiceLocator
925
927
  });
928
+ var inject = values.inject;
929
+ var syncInject = values.syncInject;
930
+ var wrapSyncInit = values.wrapSyncInit;
931
+ var provideServiceLocator = values.provideServiceLocator;
926
932
  export {
927
933
  BoundInjectionToken,
928
934
  ErrorsEnum,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@navios/di",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "author": {
5
5
  "name": "Oleksandr Hanzha",
6
6
  "email": "alex@granted.name"
@@ -10,6 +10,7 @@ import { InjectableScope, InjectableType } from '../enums/index.mjs'
10
10
  import { InjectionToken } from '../injection-token.mjs'
11
11
  import { globalRegistry } from '../registry.mjs'
12
12
  import { resolveService } from '../resolve-service.mjs'
13
+ import { InjectableTokenMeta } from '../symbols/index.mjs'
13
14
 
14
15
  export interface InjectableOptions {
15
16
  scope?: InjectableScope
@@ -18,8 +19,6 @@ export interface InjectableOptions {
18
19
  registry?: Registry
19
20
  }
20
21
 
21
- export const InjectableTokenMeta = Symbol.for('InjectableTokenMeta')
22
-
23
22
  export function Injectable(): <T extends ClassType>(
24
23
  target: T,
25
24
  context: ClassDecoratorContext,
package/src/index.mts CHANGED
@@ -14,3 +14,4 @@ export * from './service-locator.mjs'
14
14
  export * from './service-locator-event-bus.mjs'
15
15
  export * from './service-locator-instance-holder.mjs'
16
16
  export * from './service-locator-manager.mjs'
17
+ export * from './symbols/injectable-token.mjs'
package/src/injector.mts CHANGED
@@ -1,3 +1,5 @@
1
+ import type { Injectors } from './utils/index.mjs'
2
+
1
3
  import { ServiceLocator } from './service-locator.mjs'
2
4
  import { getInjectors } from './utils/index.mjs'
3
5
 
@@ -11,9 +13,15 @@ export function getGlobalServiceLocator(): ServiceLocator {
11
13
  }
12
14
  return globalServiceLocator
13
15
  }
14
- const { inject, syncInject, wrapSyncInit, provideServiceLocator } =
15
- getInjectors({
16
- baseLocator: globalServiceLocator,
17
- })
16
+ const values = getInjectors({
17
+ baseLocator: globalServiceLocator,
18
+ })
19
+
20
+ export const inject: Injectors['inject'] = values.inject
21
+
22
+ export const syncInject: Injectors['syncInject'] = values.syncInject
23
+
24
+ export const wrapSyncInit: Injectors['wrapSyncInit'] = values.wrapSyncInit
18
25
 
19
- export { inject, syncInject, wrapSyncInit, provideServiceLocator }
26
+ export const provideServiceLocator: Injectors['provideServiceLocator'] =
27
+ values.provideServiceLocator
@@ -0,0 +1 @@
1
+ export * from './injectable-token.mjs'
@@ -0,0 +1 @@
1
+ export const InjectableTokenMeta = Symbol.for('InjectableTokenMeta')
@@ -1,6 +1,6 @@
1
1
  import type { ClassType, InjectionToken } from '../injection-token.mjs'
2
2
 
3
- import { InjectableTokenMeta } from '../decorators/index.mjs'
3
+ import { InjectableTokenMeta } from '../symbols/injectable-token.mjs'
4
4
 
5
5
  export function getInjectableToken<R>(
6
6
  target: ClassType,
@@ -1,14 +1,14 @@
1
1
  import type { AnyZodObject, z, ZodOptional } from 'zod'
2
2
 
3
- import type { ClassType } from '../injection-token.mjs'
4
- import type { ServiceLocator } from '../service-locator.mjs'
5
-
6
- import { InjectableTokenMeta } from '../decorators/index.mjs'
7
- import {
3
+ import type {
8
4
  BoundInjectionToken,
5
+ ClassType,
9
6
  FactoryInjectionToken,
10
7
  InjectionToken,
11
8
  } from '../injection-token.mjs'
9
+ import type { ServiceLocator } from '../service-locator.mjs'
10
+
11
+ import { InjectableTokenMeta } from '../symbols/index.mjs'
12
12
 
13
13
  export interface CreateInjectorsOptions {
14
14
  baseLocator: ServiceLocator