@decaf-ts/core 0.25.4 → 0.25.6

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.
@@ -15,6 +15,7 @@ import type { Observer } from "../interfaces/Observer.d.cts";
15
15
  import { Constructor } from "@decaf-ts/decoration";
16
16
  import { Model } from "@decaf-ts/decorator-validation";
17
17
  import { SerializedPage } from "../query/Paginator.d.cts";
18
+ import { Context } from "../persistence/index.d.cts";
18
19
  /**
19
20
  * @description Type alias for Repository class with simplified generic parameters.
20
21
  * @summary Provides a more concise way to reference the Repository class with its generic parameters.
@@ -117,11 +118,11 @@ export declare class Repository<M extends Model<boolean>, A extends Adapter<any,
117
118
  protected get pkProps(): SequenceOptions;
118
119
  get filters(): Record<"onlyOnCreate" | "onlyOnUpdate" | "onlyOnDelete" | "onlyOnTransactional" | "onlyOnSingle" | "onlyOnBulk", ObserverFilter>;
119
120
  constructor(adapter?: A, clazz?: Constructor<M>, force?: boolean, ...args: any[]);
120
- protected logCtx<ARGS extends any[] = any[], METHOD extends MethodOrOperation = MethodOrOperation>(args: MaybeContextualArg<ContextOf<A>, ARGS>, operation: METHOD): ContextualizedArgs<ContextOf<A>, ARGS, METHOD extends string ? true : false>;
121
- protected logCtx<ARGS extends any[] = any[], METHOD extends MethodOrOperation = MethodOrOperation>(args: MaybeContextualArg<ContextOf<A>, ARGS>, operation: METHOD, allowCreate: false): ContextualizedArgs<ContextOf<A>, ARGS, METHOD extends string ? true : false>;
122
- protected logCtx<ARGS extends any[] = any[], METHOD extends MethodOrOperation = MethodOrOperation>(args: MaybeContextualArg<ContextOf<A>, ARGS>, operation: METHOD, allowCreate: true): Promise<ContextualizedArgs<ContextOf<A>, ARGS, METHOD extends string ? true : false>>;
123
- protected logCtx<ARGS extends any[] = any[], METHOD extends MethodOrOperation = MethodOrOperation>(args: MaybeContextualArg<ContextOf<A>, ARGS>, operation: METHOD, allowCreate: true, overrides?: Partial<FlagsOf<ContextOf<A>>>): Promise<ContextualizedArgs<ContextOf<A>, ARGS, METHOD extends string ? true : false>>;
124
- protected logCtx<ARGS extends any[] = any[], METHOD extends MethodOrOperation = MethodOrOperation>(args: MaybeContextualArg<ContextOf<A>, ARGS>, operation: METHOD, allowCreate: false, overrides?: Partial<FlagsOf<ContextOf<A>>>): ContextualizedArgs<ContextOf<A>, ARGS, METHOD extends string ? true : false>;
121
+ protected logCtx<CONTEXT extends Context<any> = ContextOf<A>, ARGS extends any[] = any[], METHOD extends MethodOrOperation = MethodOrOperation>(args: MaybeContextualArg<CONTEXT, ARGS>, operation: METHOD): ContextualizedArgs<ContextOf<A>, ARGS, METHOD extends string ? true : false>;
122
+ protected logCtx<CONTEXT extends Context<any> = ContextOf<A>, ARGS extends any[] = any[], METHOD extends MethodOrOperation = MethodOrOperation>(args: MaybeContextualArg<CONTEXT, ARGS>, operation: METHOD, allowCreate: false): ContextualizedArgs<ContextOf<A>, ARGS, METHOD extends string ? true : false>;
123
+ protected logCtx<CONTEXT extends Context<any> = ContextOf<A>, ARGS extends any[] = any[], METHOD extends MethodOrOperation = MethodOrOperation>(args: MaybeContextualArg<CONTEXT, ARGS>, operation: METHOD, allowCreate: true): Promise<ContextualizedArgs<ContextOf<A>, ARGS, METHOD extends string ? true : false>>;
124
+ protected logCtx<CONTEXT extends Context<any> = ContextOf<A>, ARGS extends any[] = any[], METHOD extends MethodOrOperation = MethodOrOperation>(args: MaybeContextualArg<CONTEXT, ARGS>, operation: METHOD, allowCreate: true, overrides?: Partial<FlagsOf<ContextOf<A>>>): Promise<ContextualizedArgs<ContextOf<A>, ARGS, METHOD extends string ? true : false>>;
125
+ protected logCtx<CONTEXT extends Context<any> = ContextOf<A>, ARGS extends any[] = any[], METHOD extends MethodOrOperation = MethodOrOperation>(args: MaybeContextualArg<CONTEXT, ARGS>, operation: METHOD, allowCreate: false, overrides?: Partial<FlagsOf<ContextOf<A>>>): ContextualizedArgs<ContextOf<A>, ARGS, METHOD extends string ? true : false>;
125
126
  /**
126
127
  * @description Creates a proxy with overridden repository flags.
127
128
  * @summary Returns a proxy of this repository with the specified flags overridden.
@@ -15,6 +15,7 @@ import type { Observer } from "../interfaces/Observer.d.mts";
15
15
  import { Constructor } from "@decaf-ts/decoration";
16
16
  import { Model } from "@decaf-ts/decorator-validation";
17
17
  import { SerializedPage } from "../query/Paginator.d.mts";
18
+ import { Context } from "../persistence/index.d.mts";
18
19
  /**
19
20
  * @description Type alias for Repository class with simplified generic parameters.
20
21
  * @summary Provides a more concise way to reference the Repository class with its generic parameters.
@@ -117,11 +118,11 @@ export declare class Repository<M extends Model<boolean>, A extends Adapter<any,
117
118
  protected get pkProps(): SequenceOptions;
118
119
  get filters(): Record<"onlyOnCreate" | "onlyOnUpdate" | "onlyOnDelete" | "onlyOnTransactional" | "onlyOnSingle" | "onlyOnBulk", ObserverFilter>;
119
120
  constructor(adapter?: A, clazz?: Constructor<M>, force?: boolean, ...args: any[]);
120
- protected logCtx<ARGS extends any[] = any[], METHOD extends MethodOrOperation = MethodOrOperation>(args: MaybeContextualArg<ContextOf<A>, ARGS>, operation: METHOD): ContextualizedArgs<ContextOf<A>, ARGS, METHOD extends string ? true : false>;
121
- protected logCtx<ARGS extends any[] = any[], METHOD extends MethodOrOperation = MethodOrOperation>(args: MaybeContextualArg<ContextOf<A>, ARGS>, operation: METHOD, allowCreate: false): ContextualizedArgs<ContextOf<A>, ARGS, METHOD extends string ? true : false>;
122
- protected logCtx<ARGS extends any[] = any[], METHOD extends MethodOrOperation = MethodOrOperation>(args: MaybeContextualArg<ContextOf<A>, ARGS>, operation: METHOD, allowCreate: true): Promise<ContextualizedArgs<ContextOf<A>, ARGS, METHOD extends string ? true : false>>;
123
- protected logCtx<ARGS extends any[] = any[], METHOD extends MethodOrOperation = MethodOrOperation>(args: MaybeContextualArg<ContextOf<A>, ARGS>, operation: METHOD, allowCreate: true, overrides?: Partial<FlagsOf<ContextOf<A>>>): Promise<ContextualizedArgs<ContextOf<A>, ARGS, METHOD extends string ? true : false>>;
124
- protected logCtx<ARGS extends any[] = any[], METHOD extends MethodOrOperation = MethodOrOperation>(args: MaybeContextualArg<ContextOf<A>, ARGS>, operation: METHOD, allowCreate: false, overrides?: Partial<FlagsOf<ContextOf<A>>>): ContextualizedArgs<ContextOf<A>, ARGS, METHOD extends string ? true : false>;
121
+ protected logCtx<CONTEXT extends Context<any> = ContextOf<A>, ARGS extends any[] = any[], METHOD extends MethodOrOperation = MethodOrOperation>(args: MaybeContextualArg<CONTEXT, ARGS>, operation: METHOD): ContextualizedArgs<ContextOf<A>, ARGS, METHOD extends string ? true : false>;
122
+ protected logCtx<CONTEXT extends Context<any> = ContextOf<A>, ARGS extends any[] = any[], METHOD extends MethodOrOperation = MethodOrOperation>(args: MaybeContextualArg<CONTEXT, ARGS>, operation: METHOD, allowCreate: false): ContextualizedArgs<ContextOf<A>, ARGS, METHOD extends string ? true : false>;
123
+ protected logCtx<CONTEXT extends Context<any> = ContextOf<A>, ARGS extends any[] = any[], METHOD extends MethodOrOperation = MethodOrOperation>(args: MaybeContextualArg<CONTEXT, ARGS>, operation: METHOD, allowCreate: true): Promise<ContextualizedArgs<ContextOf<A>, ARGS, METHOD extends string ? true : false>>;
124
+ protected logCtx<CONTEXT extends Context<any> = ContextOf<A>, ARGS extends any[] = any[], METHOD extends MethodOrOperation = MethodOrOperation>(args: MaybeContextualArg<CONTEXT, ARGS>, operation: METHOD, allowCreate: true, overrides?: Partial<FlagsOf<ContextOf<A>>>): Promise<ContextualizedArgs<ContextOf<A>, ARGS, METHOD extends string ? true : false>>;
125
+ protected logCtx<CONTEXT extends Context<any> = ContextOf<A>, ARGS extends any[] = any[], METHOD extends MethodOrOperation = MethodOrOperation>(args: MaybeContextualArg<CONTEXT, ARGS>, operation: METHOD, allowCreate: false, overrides?: Partial<FlagsOf<ContextOf<A>>>): ContextualizedArgs<ContextOf<A>, ARGS, METHOD extends string ? true : false>;
125
126
  /**
126
127
  * @description Creates a proxy with overridden repository flags.
127
128
  * @summary Returns a proxy of this repository with the specified flags overridden.
@@ -9,8 +9,9 @@ import { OrderDirection } from "../repository/constants.d.cts";
9
9
  import { type DirectionLimitOffset } from "../query/types.d.cts";
10
10
  import { type Observer } from "../interfaces/index.d.cts";
11
11
  import { SelectSelector, WhereOption } from "../query/index.d.cts";
12
+ import { Context } from "../persistence/index.d.cts";
12
13
  export type ArrayMode = "one" | "many";
13
- export declare class ModelService<M extends Model<boolean>, R extends Repo<M> = Repo<M>> extends Service implements IRepository<M, ContextOf<R>>, PersistenceObservable<ContextOf<R>>, PersistenceObserver<ContextOf<R>> {
14
+ export declare class ModelService<M extends Model<boolean>, R extends Repo<M> = Repo<M>> extends Service<ContextOf<R>> implements IRepository<M, ContextOf<R>>, PersistenceObservable<ContextOf<R>>, PersistenceObserver<ContextOf<R>> {
14
15
  private readonly clazz;
15
16
  protected _repository: R;
16
17
  get class(): Constructor<M>;
@@ -39,7 +40,7 @@ export declare class ModelService<M extends Model<boolean>, R extends Repo<M> =
39
40
  observe(observer: Observer, filter?: ObserverFilter): () => void;
40
41
  unObserve(observer: Observer): void;
41
42
  updateObservers(model: Constructor, operation: AllOperationKeys, ids: EventIds, ...args: ContextualArgs<ContextOf<R>>): Promise<void>;
42
- protected logCtx<ARGS extends any[] = any[], METHOD extends MethodOrOperation = MethodOrOperation>(args: MaybeContextualArg<ContextOf<this["repo"]>, ARGS>, operation: METHOD): ContextualizedArgs<ContextOf<this["repo"]>, ARGS, METHOD extends string ? true : false>;
43
- protected logCtx<ARGS extends any[] = any[], METHOD extends MethodOrOperation = MethodOrOperation>(args: MaybeContextualArg<ContextOf<this["repo"]>, ARGS>, operation: METHOD, allowCreate: false): ContextualizedArgs<ContextOf<this["repo"]>, ARGS, METHOD extends string ? true : false>;
44
- protected logCtx<ARGS extends any[] = any[], METHOD extends MethodOrOperation = MethodOrOperation>(args: MaybeContextualArg<ContextOf<this["repo"]>, ARGS>, operation: METHOD, allowCreate: true): Promise<ContextualizedArgs<ContextOf<this["repo"]>, ARGS, METHOD extends string ? true : false>>;
43
+ protected logCtx<CONTEXT extends Context<any> = Context<any>, ARGS extends any[] = any[], METHOD extends MethodOrOperation = MethodOrOperation>(args: MaybeContextualArg<CONTEXT, ARGS>, operation: METHOD): ContextualizedArgs<ContextOf<this["repo"]>, ARGS, METHOD extends string ? true : false>;
44
+ protected logCtx<CONTEXT extends Context<any> = Context<any>, ARGS extends any[] = any[], METHOD extends MethodOrOperation = MethodOrOperation>(args: MaybeContextualArg<CONTEXT, ARGS>, operation: METHOD, allowCreate: false): ContextualizedArgs<ContextOf<this["repo"]>, ARGS, METHOD extends string ? true : false>;
45
+ protected logCtx<CONTEXT extends Context<any> = Context<any>, ARGS extends any[] = any[], METHOD extends MethodOrOperation = MethodOrOperation>(args: MaybeContextualArg<CONTEXT, ARGS>, operation: METHOD, allowCreate: true): Promise<ContextualizedArgs<ContextOf<this["repo"]>, ARGS, METHOD extends string ? true : false>>;
45
46
  }
@@ -9,8 +9,9 @@ import { OrderDirection } from "../repository/constants.d.mts";
9
9
  import { type DirectionLimitOffset } from "../query/types.d.mts";
10
10
  import { type Observer } from "../interfaces/index.d.mts";
11
11
  import { SelectSelector, WhereOption } from "../query/index.d.mts";
12
+ import { Context } from "../persistence/index.d.mts";
12
13
  export type ArrayMode = "one" | "many";
13
- export declare class ModelService<M extends Model<boolean>, R extends Repo<M> = Repo<M>> extends Service implements IRepository<M, ContextOf<R>>, PersistenceObservable<ContextOf<R>>, PersistenceObserver<ContextOf<R>> {
14
+ export declare class ModelService<M extends Model<boolean>, R extends Repo<M> = Repo<M>> extends Service<ContextOf<R>> implements IRepository<M, ContextOf<R>>, PersistenceObservable<ContextOf<R>>, PersistenceObserver<ContextOf<R>> {
14
15
  private readonly clazz;
15
16
  protected _repository: R;
16
17
  get class(): Constructor<M>;
@@ -39,7 +40,7 @@ export declare class ModelService<M extends Model<boolean>, R extends Repo<M> =
39
40
  observe(observer: Observer, filter?: ObserverFilter): () => void;
40
41
  unObserve(observer: Observer): void;
41
42
  updateObservers(model: Constructor, operation: AllOperationKeys, ids: EventIds, ...args: ContextualArgs<ContextOf<R>>): Promise<void>;
42
- protected logCtx<ARGS extends any[] = any[], METHOD extends MethodOrOperation = MethodOrOperation>(args: MaybeContextualArg<ContextOf<this["repo"]>, ARGS>, operation: METHOD): ContextualizedArgs<ContextOf<this["repo"]>, ARGS, METHOD extends string ? true : false>;
43
- protected logCtx<ARGS extends any[] = any[], METHOD extends MethodOrOperation = MethodOrOperation>(args: MaybeContextualArg<ContextOf<this["repo"]>, ARGS>, operation: METHOD, allowCreate: false): ContextualizedArgs<ContextOf<this["repo"]>, ARGS, METHOD extends string ? true : false>;
44
- protected logCtx<ARGS extends any[] = any[], METHOD extends MethodOrOperation = MethodOrOperation>(args: MaybeContextualArg<ContextOf<this["repo"]>, ARGS>, operation: METHOD, allowCreate: true): Promise<ContextualizedArgs<ContextOf<this["repo"]>, ARGS, METHOD extends string ? true : false>>;
43
+ protected logCtx<CONTEXT extends Context<any> = Context<any>, ARGS extends any[] = any[], METHOD extends MethodOrOperation = MethodOrOperation>(args: MaybeContextualArg<CONTEXT, ARGS>, operation: METHOD): ContextualizedArgs<ContextOf<this["repo"]>, ARGS, METHOD extends string ? true : false>;
44
+ protected logCtx<CONTEXT extends Context<any> = Context<any>, ARGS extends any[] = any[], METHOD extends MethodOrOperation = MethodOrOperation>(args: MaybeContextualArg<CONTEXT, ARGS>, operation: METHOD, allowCreate: false): ContextualizedArgs<ContextOf<this["repo"]>, ARGS, METHOD extends string ? true : false>;
45
+ protected logCtx<CONTEXT extends Context<any> = Context<any>, ARGS extends any[] = any[], METHOD extends MethodOrOperation = MethodOrOperation>(args: MaybeContextualArg<CONTEXT, ARGS>, operation: METHOD, allowCreate: true): Promise<ContextualizedArgs<ContextOf<this["repo"]>, ARGS, METHOD extends string ? true : false>>;
45
46
  }
@@ -2,8 +2,10 @@ import type { AllOperationKeys, ContextFlags, EventIds, FlagsOf, ObserverFilter,
2
2
  import { Context } from "../persistence/Context.d.cts";
3
3
  import { ContextualArgs, ContextualizedArgs, ContextualLoggedClass, MaybeContextualArg, MethodOrOperation } from "../utils/ContextualLoggedClass.d.cts";
4
4
  import { Constructor } from "@decaf-ts/decoration";
5
+ import type { Model } from "@decaf-ts/decorator-validation";
5
6
  import type { Observer } from "../interfaces/Observer.d.cts";
6
7
  import { ObserverHandler } from "../persistence/ObserverHandler.d.cts";
8
+ import type { ModelService } from "./ModelService.d.cts";
7
9
  export declare abstract class Service<C extends Context<ContextFlags<any>> = Context<ContextFlags<any>>> extends ContextualLoggedClass<C> implements PersistenceObservable<C>, PersistenceObserver<C> {
8
10
  protected observers: Observer[];
9
11
  protected observerHandler?: ObserverHandler;
@@ -66,9 +68,9 @@ export declare abstract class Service<C extends Context<ContextFlags<any>> = Con
66
68
  */
67
69
  protected readonly Context: Constructor<C>;
68
70
  context(operation: ((...args: any[]) => any) | string, overrides: Partial<FlagsOf<C>>, ...args: MaybeContextualArg<Context<any>>): Promise<C>;
69
- protected logCtx<CONTEXT extends Context<any> = C, ARGS extends any[] = any[], METHOD extends MethodOrOperation = MethodOrOperation>(args: MaybeContextualArg<CONTEXT, ARGS>, operation: METHOD): ContextualizedArgs<CONTEXT, ARGS, METHOD extends string ? true : false>;
70
- protected logCtx<CONTEXT extends Context<any> = C, ARGS extends any[] = any[], METHOD extends MethodOrOperation = MethodOrOperation>(args: MaybeContextualArg<CONTEXT, ARGS>, operation: METHOD, allowCreate: false, overrides?: Partial<FlagsOf<CONTEXT>>): ContextualizedArgs<CONTEXT, ARGS, METHOD extends string ? true : false>;
71
- protected logCtx<CONTEXT extends Context<any> = C, ARGS extends any[] = any[], METHOD extends MethodOrOperation = MethodOrOperation>(args: MaybeContextualArg<CONTEXT, ARGS>, operation: METHOD, allowCreate: true, overrides?: Partial<FlagsOf<CONTEXT>>): Promise<ContextualizedArgs<CONTEXT, ARGS, METHOD extends string ? true : false>>;
71
+ protected logCtx<ARGS extends any[] = any[], METHOD extends MethodOrOperation = MethodOrOperation>(args: MaybeContextualArg<C, ARGS>, operation: METHOD): ContextualizedArgs<C, ARGS, METHOD extends string ? true : false>;
72
+ protected logCtx<CONTEXT extends Context<any> = C, ARGS extends any[] = any[], METHOD extends MethodOrOperation = MethodOrOperation>(args: MaybeContextualArg<CONTEXT, ARGS>, operation: METHOD, allowCreate: false, overrides?: Partial<FlagsOf<CONTEXT>>): ContextualizedArgs<C, ARGS, METHOD extends string ? true : false>;
73
+ protected logCtx<CONTEXT extends Context<any> = C, ARGS extends any[] = any[], METHOD extends MethodOrOperation = MethodOrOperation>(args: MaybeContextualArg<CONTEXT, ARGS>, operation: METHOD, allowCreate: true, overrides?: Partial<FlagsOf<CONTEXT>>): Promise<ContextualizedArgs<C, ARGS, METHOD extends string ? true : false>>;
72
74
  /**
73
75
  * @description Retrieves a Service instance by name/class
74
76
  * @summary Looks up and returns a cached API instance by its name or constructor
@@ -76,11 +78,13 @@ export declare abstract class Service<C extends Context<ContextFlags<any>> = Con
76
78
  * @param {string | Constructor<A>} name - Name of the API or its constructor
77
79
  * @return {A} The requested API instance
78
80
  */
79
- static get<A extends Service>(name: string | symbol | Constructor<A>): A;
81
+ static get<A extends Service>(name: string | symbol): A;
82
+ static get<A extends Service>(name: Constructor<A>): A;
83
+ static get<M extends Model<boolean>>(name: Constructor<M>): ModelService<M>;
80
84
  static boot<C extends Context<any> = any>(...args: MaybeContextualArg<C>): Promise<void>;
81
85
  static shutdown<C extends Context<any> = any>(...args: MaybeContextualArg<C>): Promise<void>;
82
86
  }
83
- export declare abstract class ClientBasedService<CLIENT, CONF, C extends Context<any> = any> extends Service {
87
+ export declare abstract class ClientBasedService<CLIENT, CONF, C extends Context<any> = any> extends Service<C> {
84
88
  protected _client?: CLIENT;
85
89
  protected _config?: CONF;
86
90
  protected constructor();
@@ -2,8 +2,10 @@ import type { AllOperationKeys, ContextFlags, EventIds, FlagsOf, ObserverFilter,
2
2
  import { Context } from "../persistence/Context.d.mts";
3
3
  import { ContextualArgs, ContextualizedArgs, ContextualLoggedClass, MaybeContextualArg, MethodOrOperation } from "../utils/ContextualLoggedClass.d.mts";
4
4
  import { Constructor } from "@decaf-ts/decoration";
5
+ import type { Model } from "@decaf-ts/decorator-validation";
5
6
  import type { Observer } from "../interfaces/Observer.d.mts";
6
7
  import { ObserverHandler } from "../persistence/ObserverHandler.d.mts";
8
+ import type { ModelService } from "./ModelService.d.mts";
7
9
  export declare abstract class Service<C extends Context<ContextFlags<any>> = Context<ContextFlags<any>>> extends ContextualLoggedClass<C> implements PersistenceObservable<C>, PersistenceObserver<C> {
8
10
  protected observers: Observer[];
9
11
  protected observerHandler?: ObserverHandler;
@@ -66,9 +68,9 @@ export declare abstract class Service<C extends Context<ContextFlags<any>> = Con
66
68
  */
67
69
  protected readonly Context: Constructor<C>;
68
70
  context(operation: ((...args: any[]) => any) | string, overrides: Partial<FlagsOf<C>>, ...args: MaybeContextualArg<Context<any>>): Promise<C>;
69
- protected logCtx<CONTEXT extends Context<any> = C, ARGS extends any[] = any[], METHOD extends MethodOrOperation = MethodOrOperation>(args: MaybeContextualArg<CONTEXT, ARGS>, operation: METHOD): ContextualizedArgs<CONTEXT, ARGS, METHOD extends string ? true : false>;
70
- protected logCtx<CONTEXT extends Context<any> = C, ARGS extends any[] = any[], METHOD extends MethodOrOperation = MethodOrOperation>(args: MaybeContextualArg<CONTEXT, ARGS>, operation: METHOD, allowCreate: false, overrides?: Partial<FlagsOf<CONTEXT>>): ContextualizedArgs<CONTEXT, ARGS, METHOD extends string ? true : false>;
71
- protected logCtx<CONTEXT extends Context<any> = C, ARGS extends any[] = any[], METHOD extends MethodOrOperation = MethodOrOperation>(args: MaybeContextualArg<CONTEXT, ARGS>, operation: METHOD, allowCreate: true, overrides?: Partial<FlagsOf<CONTEXT>>): Promise<ContextualizedArgs<CONTEXT, ARGS, METHOD extends string ? true : false>>;
71
+ protected logCtx<ARGS extends any[] = any[], METHOD extends MethodOrOperation = MethodOrOperation>(args: MaybeContextualArg<C, ARGS>, operation: METHOD): ContextualizedArgs<C, ARGS, METHOD extends string ? true : false>;
72
+ protected logCtx<CONTEXT extends Context<any> = C, ARGS extends any[] = any[], METHOD extends MethodOrOperation = MethodOrOperation>(args: MaybeContextualArg<CONTEXT, ARGS>, operation: METHOD, allowCreate: false, overrides?: Partial<FlagsOf<CONTEXT>>): ContextualizedArgs<C, ARGS, METHOD extends string ? true : false>;
73
+ protected logCtx<CONTEXT extends Context<any> = C, ARGS extends any[] = any[], METHOD extends MethodOrOperation = MethodOrOperation>(args: MaybeContextualArg<CONTEXT, ARGS>, operation: METHOD, allowCreate: true, overrides?: Partial<FlagsOf<CONTEXT>>): Promise<ContextualizedArgs<C, ARGS, METHOD extends string ? true : false>>;
72
74
  /**
73
75
  * @description Retrieves a Service instance by name/class
74
76
  * @summary Looks up and returns a cached API instance by its name or constructor
@@ -76,11 +78,13 @@ export declare abstract class Service<C extends Context<ContextFlags<any>> = Con
76
78
  * @param {string | Constructor<A>} name - Name of the API or its constructor
77
79
  * @return {A} The requested API instance
78
80
  */
79
- static get<A extends Service>(name: string | symbol | Constructor<A>): A;
81
+ static get<A extends Service>(name: string | symbol): A;
82
+ static get<A extends Service>(name: Constructor<A>): A;
83
+ static get<M extends Model<boolean>>(name: Constructor<M>): ModelService<M>;
80
84
  static boot<C extends Context<any> = any>(...args: MaybeContextualArg<C>): Promise<void>;
81
85
  static shutdown<C extends Context<any> = any>(...args: MaybeContextualArg<C>): Promise<void>;
82
86
  }
83
- export declare abstract class ClientBasedService<CLIENT, CONF, C extends Context<any> = any> extends Service {
87
+ export declare abstract class ClientBasedService<CLIENT, CONF, C extends Context<any> = any> extends Service<C> {
84
88
  protected _client?: CLIENT;
85
89
  protected _config?: CONF;
86
90
  protected constructor();
@@ -1,12 +1,12 @@
1
1
  import { AnyFunction, Logger, LoggingConfig, LogLevel, LogMeta, StringLike } from "@decaf-ts/logging";
2
2
  import { EventPipe, LogPipe, LogPipeOptions } from "./types.d.cts";
3
3
  export declare class TaskLogger<LOG extends Logger> implements Logger {
4
- protected logger: Logger;
4
+ protected logger: LOG;
5
5
  protected bufferSize: number;
6
6
  protected maxBufferSize: number;
7
7
  protected pipe?: LogPipe | undefined;
8
8
  protected history: [LogLevel, string, any][];
9
- constructor(logger: Logger, bufferSize?: number, maxBufferSize?: number, pipe?: LogPipe | undefined);
9
+ constructor(logger: LOG, bufferSize?: number, maxBufferSize?: number, pipe?: LogPipe | undefined);
10
10
  push(level: LogLevel, string: string, meta?: any): void;
11
11
  flush<PIPE extends LogPipe>(pipe?: PIPE): PIPE extends LogPipe ? Promise<[LogLevel, string, any][]> : [LogLevel, string, any][];
12
12
  readonly root: string[];
@@ -14,6 +14,8 @@ export declare class TaskLogger<LOG extends Logger> implements Logger {
14
14
  clear(): this;
15
15
  debug(msg: StringLike, meta?: LogMeta): void;
16
16
  error(msg: StringLike | Error, e?: Error | LogMeta, meta?: LogMeta): void;
17
+ fatal(msg: StringLike | Error, error?: Error | LogMeta, meta?: LogMeta): void;
18
+ critical(msg: StringLike | Error, error?: Error | LogMeta, meta?: LogMeta): void;
17
19
  for(config: Partial<LoggingConfig>): this;
18
20
  for(context: string | {
19
21
  new (...args: any[]): any;
@@ -1,12 +1,12 @@
1
1
  import { AnyFunction, Logger, LoggingConfig, LogLevel, LogMeta, StringLike } from "@decaf-ts/logging";
2
2
  import { EventPipe, LogPipe, LogPipeOptions } from "./types.d.mts";
3
3
  export declare class TaskLogger<LOG extends Logger> implements Logger {
4
- protected logger: Logger;
4
+ protected logger: LOG;
5
5
  protected bufferSize: number;
6
6
  protected maxBufferSize: number;
7
7
  protected pipe?: LogPipe | undefined;
8
8
  protected history: [LogLevel, string, any][];
9
- constructor(logger: Logger, bufferSize?: number, maxBufferSize?: number, pipe?: LogPipe | undefined);
9
+ constructor(logger: LOG, bufferSize?: number, maxBufferSize?: number, pipe?: LogPipe | undefined);
10
10
  push(level: LogLevel, string: string, meta?: any): void;
11
11
  flush<PIPE extends LogPipe>(pipe?: PIPE): PIPE extends LogPipe ? Promise<[LogLevel, string, any][]> : [LogLevel, string, any][];
12
12
  readonly root: string[];
@@ -14,6 +14,8 @@ export declare class TaskLogger<LOG extends Logger> implements Logger {
14
14
  clear(): this;
15
15
  debug(msg: StringLike, meta?: LogMeta): void;
16
16
  error(msg: StringLike | Error, e?: Error | LogMeta, meta?: LogMeta): void;
17
+ fatal(msg: StringLike | Error, error?: Error | LogMeta, meta?: LogMeta): void;
18
+ critical(msg: StringLike | Error, error?: Error | LogMeta, meta?: LogMeta): void;
17
19
  for(config: Partial<LoggingConfig>): this;
18
20
  for(context: string | {
19
21
  new (...args: any[]): any;
@@ -19,7 +19,7 @@ export type ContextualizedArgs<C extends Context<any> = any, ARGS extends any[]
19
19
  ctxArgs: ContextualArgs<C, ARGS>;
20
20
  };
21
21
  export declare abstract class ContextualLoggedClass<C extends Context<any>> extends LoggedClass {
22
- protected logCtx<ARGS extends any[] = any[], METHOD extends MethodOrOperation = MethodOrOperation>(args: MaybeContextualArg<C, ARGS>, operation: METHOD): ContextualizedArgs<C, ARGS, METHOD extends string ? true : false>;
22
+ protected logCtx<CONTEXT extends Context<any> = C, ARGS extends any[] = any[], METHOD extends MethodOrOperation = MethodOrOperation>(args: MaybeContextualArg<CONTEXT, ARGS>, operation: METHOD): ContextualizedArgs<C, ARGS, METHOD extends string ? true : false>;
23
23
  protected logCtx<CONTEXT extends Context<any> = C, ARGS extends any[] = any[], METHOD extends MethodOrOperation = MethodOrOperation>(args: MaybeContextualArg<CONTEXT, ARGS>, operation: METHOD, allowCreate: false, overrides?: Partial<FlagsOf<C>>): ContextualizedArgs<C, ARGS, METHOD extends string ? true : false>;
24
24
  protected logCtx<CONTEXT extends Context<any> = C, ARGS extends any[] = any[], METHOD extends MethodOrOperation = MethodOrOperation>(args: MaybeContextualArg<CONTEXT, ARGS>, operation: METHOD, allowCreate: true, overrides?: Partial<FlagsOf<C>>): Promise<ContextualizedArgs<C, ARGS, METHOD extends string ? true : false>>;
25
25
  static logFrom<CONTEXT extends Context<any>, A = any | Contextual<CONTEXT>, METHOD extends MethodOrOperation = MethodOrOperation>(obj: A, logger: LoggerOf<any>, ctx: CONTEXT, method?: METHOD | keyof A): Logger;
@@ -19,7 +19,7 @@ export type ContextualizedArgs<C extends Context<any> = any, ARGS extends any[]
19
19
  ctxArgs: ContextualArgs<C, ARGS>;
20
20
  };
21
21
  export declare abstract class ContextualLoggedClass<C extends Context<any>> extends LoggedClass {
22
- protected logCtx<ARGS extends any[] = any[], METHOD extends MethodOrOperation = MethodOrOperation>(args: MaybeContextualArg<C, ARGS>, operation: METHOD): ContextualizedArgs<C, ARGS, METHOD extends string ? true : false>;
22
+ protected logCtx<CONTEXT extends Context<any> = C, ARGS extends any[] = any[], METHOD extends MethodOrOperation = MethodOrOperation>(args: MaybeContextualArg<CONTEXT, ARGS>, operation: METHOD): ContextualizedArgs<C, ARGS, METHOD extends string ? true : false>;
23
23
  protected logCtx<CONTEXT extends Context<any> = C, ARGS extends any[] = any[], METHOD extends MethodOrOperation = MethodOrOperation>(args: MaybeContextualArg<CONTEXT, ARGS>, operation: METHOD, allowCreate: false, overrides?: Partial<FlagsOf<C>>): ContextualizedArgs<C, ARGS, METHOD extends string ? true : false>;
24
24
  protected logCtx<CONTEXT extends Context<any> = C, ARGS extends any[] = any[], METHOD extends MethodOrOperation = MethodOrOperation>(args: MaybeContextualArg<CONTEXT, ARGS>, operation: METHOD, allowCreate: true, overrides?: Partial<FlagsOf<C>>): Promise<ContextualizedArgs<C, ARGS, METHOD extends string ? true : false>>;
25
25
  static logFrom<CONTEXT extends Context<any>, A = any | Contextual<CONTEXT>, METHOD extends MethodOrOperation = MethodOrOperation>(obj: A, logger: LoggerOf<any>, ctx: CONTEXT, method?: METHOD | keyof A): Logger;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@decaf-ts/core",
3
- "version": "0.25.4",
3
+ "version": "0.25.6",
4
4
  "description": "Core persistence module for the decaf framework",
5
5
  "type": "module",
6
6
  "exports": {