@decaf-ts/core 0.7.2 → 0.7.3

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.
Files changed (214) hide show
  1. package/README.md +1 -1
  2. package/dist/core.cjs +1 -1
  3. package/dist/core.cjs.map +1 -1
  4. package/dist/core.js +1 -1
  5. package/dist/core.js.map +1 -1
  6. package/lib/esm/identity/decorators.d.ts +3 -4
  7. package/lib/esm/identity/decorators.js +4 -10
  8. package/lib/esm/identity/decorators.js.map +1 -1
  9. package/lib/esm/identity/index.d.ts +0 -1
  10. package/lib/esm/identity/index.js +0 -1
  11. package/lib/esm/identity/index.js.map +1 -1
  12. package/lib/esm/index.d.ts +1 -1
  13. package/lib/esm/index.js +1 -1
  14. package/lib/esm/interfaces/ContextuallyLogged.d.ts +8 -0
  15. package/lib/esm/interfaces/ContextuallyLogged.js +2 -0
  16. package/lib/esm/interfaces/ContextuallyLogged.js.map +1 -0
  17. package/lib/esm/interfaces/ErrorParser.d.ts +2 -2
  18. package/lib/esm/interfaces/Executor.d.ts +1 -1
  19. package/lib/esm/interfaces/Observable.d.ts +8 -8
  20. package/lib/esm/interfaces/Observer.d.ts +2 -2
  21. package/lib/esm/interfaces/RawExecutor.d.ts +1 -1
  22. package/lib/esm/model/BaseModel.d.ts +2 -2
  23. package/lib/esm/model/BaseModel.js +2 -2
  24. package/lib/esm/model/construction.d.ts +9 -8
  25. package/lib/esm/model/construction.js +2 -2
  26. package/lib/esm/model/construction.js.map +1 -1
  27. package/lib/esm/model/decorators.d.ts +4 -3
  28. package/lib/esm/model/decorators.js +2 -2
  29. package/lib/esm/model/decorators.js.map +1 -1
  30. package/lib/esm/overrides/Metadata.d.ts +1 -8
  31. package/lib/esm/overrides/Model.d.ts +75 -0
  32. package/lib/esm/overrides/Model.js +2 -0
  33. package/lib/esm/overrides/Model.js.map +1 -0
  34. package/lib/esm/overrides/index.d.ts +2 -0
  35. package/lib/esm/overrides/index.js +2 -0
  36. package/lib/esm/overrides/index.js.map +1 -1
  37. package/lib/esm/overrides/injectables.d.ts +10 -0
  38. package/lib/esm/overrides/injectables.js +2 -0
  39. package/lib/esm/overrides/injectables.js.map +1 -0
  40. package/lib/esm/overrides/overrides.js +45 -3
  41. package/lib/esm/overrides/overrides.js.map +1 -1
  42. package/lib/esm/persistence/Adapter.d.ts +52 -51
  43. package/lib/esm/persistence/Adapter.js +76 -61
  44. package/lib/esm/persistence/Adapter.js.map +1 -1
  45. package/lib/esm/persistence/Dispatch.d.ts +7 -6
  46. package/lib/esm/persistence/Dispatch.js +25 -18
  47. package/lib/esm/persistence/Dispatch.js.map +1 -1
  48. package/lib/esm/persistence/ObserverHandler.d.ts +7 -6
  49. package/lib/esm/persistence/ObserverHandler.js +5 -4
  50. package/lib/esm/persistence/ObserverHandler.js.map +1 -1
  51. package/lib/esm/persistence/Sequence.d.ts +10 -17
  52. package/lib/esm/persistence/Sequence.js +10 -15
  53. package/lib/esm/persistence/Sequence.js.map +1 -1
  54. package/lib/esm/persistence/constants.d.ts +1 -0
  55. package/lib/esm/persistence/constants.js +1 -0
  56. package/lib/esm/persistence/constants.js.map +1 -1
  57. package/lib/esm/persistence/migrations.d.ts +8 -8
  58. package/lib/esm/persistence/migrations.js +8 -9
  59. package/lib/esm/persistence/migrations.js.map +1 -1
  60. package/lib/esm/persistence/types.d.ts +38 -20
  61. package/lib/esm/query/Paginator.d.ts +6 -5
  62. package/lib/esm/query/Paginator.js +4 -4
  63. package/lib/esm/query/Paginator.js.map +1 -1
  64. package/lib/esm/query/Statement.d.ts +9 -8
  65. package/lib/esm/query/Statement.js +23 -10
  66. package/lib/esm/query/Statement.js.map +1 -1
  67. package/lib/esm/ram/RamAdapter.d.ts +21 -21
  68. package/lib/esm/ram/RamAdapter.js +36 -23
  69. package/lib/esm/ram/RamAdapter.js.map +1 -1
  70. package/lib/esm/ram/RamPaginator.d.ts +2 -1
  71. package/lib/esm/ram/RamPaginator.js +5 -3
  72. package/lib/esm/ram/RamPaginator.js.map +1 -1
  73. package/lib/esm/ram/RamSequence.d.ts +4 -11
  74. package/lib/esm/ram/RamSequence.js +20 -24
  75. package/lib/esm/ram/RamSequence.js.map +1 -1
  76. package/lib/esm/ram/RamStatement.d.ts +7 -7
  77. package/lib/esm/ram/RamStatement.js.map +1 -1
  78. package/lib/esm/ram/handlers.d.ts +3 -4
  79. package/lib/esm/ram/handlers.js.map +1 -1
  80. package/lib/esm/ram/index.d.ts +0 -1
  81. package/lib/esm/ram/index.js +0 -1
  82. package/lib/esm/ram/index.js.map +1 -1
  83. package/lib/esm/ram/types.d.ts +4 -12
  84. package/lib/esm/repository/Repository.d.ts +31 -95
  85. package/lib/esm/repository/Repository.js +106 -201
  86. package/lib/esm/repository/Repository.js.map +1 -1
  87. package/lib/esm/repository/decorators.js +3 -2
  88. package/lib/esm/repository/decorators.js.map +1 -1
  89. package/lib/esm/repository/utils.d.ts +1 -1
  90. package/lib/esm/repository/utils.js +2 -3
  91. package/lib/esm/repository/utils.js.map +1 -1
  92. package/lib/esm/utils/ContextualLoggedClass.d.ts +16 -0
  93. package/lib/esm/utils/ContextualLoggedClass.js +29 -0
  94. package/lib/esm/utils/ContextualLoggedClass.js.map +1 -0
  95. package/lib/esm/utils/Services.d.ts +28 -0
  96. package/lib/esm/utils/Services.js +88 -0
  97. package/lib/esm/utils/Services.js.map +1 -0
  98. package/lib/esm/utils/decorators.d.ts +1 -9
  99. package/lib/esm/utils/decorators.js +26 -15
  100. package/lib/esm/utils/decorators.js.map +1 -1
  101. package/lib/esm/utils/index.d.ts +2 -1
  102. package/lib/esm/utils/index.js +2 -1
  103. package/lib/esm/utils/index.js.map +1 -1
  104. package/lib/identity/decorators.cjs +3 -9
  105. package/lib/identity/decorators.d.ts +3 -4
  106. package/lib/identity/decorators.js.map +1 -1
  107. package/lib/identity/index.cjs +0 -1
  108. package/lib/identity/index.d.ts +0 -1
  109. package/lib/identity/index.js.map +1 -1
  110. package/lib/index.cjs +1 -1
  111. package/lib/index.d.ts +1 -1
  112. package/lib/interfaces/ContextuallyLogged.cjs +3 -0
  113. package/lib/interfaces/ContextuallyLogged.d.ts +8 -0
  114. package/lib/interfaces/ContextuallyLogged.js.map +1 -0
  115. package/lib/interfaces/ErrorParser.d.ts +2 -2
  116. package/lib/interfaces/Executor.d.ts +1 -1
  117. package/lib/interfaces/Observable.d.ts +8 -8
  118. package/lib/interfaces/Observer.d.ts +2 -2
  119. package/lib/interfaces/RawExecutor.d.ts +1 -1
  120. package/lib/model/BaseModel.cjs +2 -2
  121. package/lib/model/BaseModel.d.ts +2 -2
  122. package/lib/model/construction.cjs +2 -2
  123. package/lib/model/construction.d.ts +9 -8
  124. package/lib/model/construction.js.map +1 -1
  125. package/lib/model/decorators.cjs +1 -1
  126. package/lib/model/decorators.d.ts +4 -3
  127. package/lib/model/decorators.js.map +1 -1
  128. package/lib/overrides/Metadata.d.ts +1 -8
  129. package/lib/overrides/Model.cjs +4 -0
  130. package/lib/overrides/Model.d.ts +75 -0
  131. package/lib/overrides/Model.js.map +1 -0
  132. package/lib/overrides/index.cjs +2 -0
  133. package/lib/overrides/index.d.ts +2 -0
  134. package/lib/overrides/index.js.map +1 -1
  135. package/lib/overrides/injectables.cjs +4 -0
  136. package/lib/overrides/injectables.d.ts +10 -0
  137. package/lib/overrides/injectables.js.map +1 -0
  138. package/lib/overrides/overrides.cjs +43 -1
  139. package/lib/overrides/overrides.js.map +1 -1
  140. package/lib/persistence/Adapter.cjs +81 -66
  141. package/lib/persistence/Adapter.d.ts +52 -51
  142. package/lib/persistence/Adapter.js.map +1 -1
  143. package/lib/persistence/Dispatch.cjs +25 -18
  144. package/lib/persistence/Dispatch.d.ts +7 -6
  145. package/lib/persistence/Dispatch.js.map +1 -1
  146. package/lib/persistence/ObserverHandler.cjs +5 -4
  147. package/lib/persistence/ObserverHandler.d.ts +7 -6
  148. package/lib/persistence/ObserverHandler.js.map +1 -1
  149. package/lib/persistence/Sequence.cjs +10 -15
  150. package/lib/persistence/Sequence.d.ts +10 -17
  151. package/lib/persistence/Sequence.js.map +1 -1
  152. package/lib/persistence/constants.cjs +1 -0
  153. package/lib/persistence/constants.d.ts +1 -0
  154. package/lib/persistence/constants.js.map +1 -1
  155. package/lib/persistence/migrations.cjs +7 -8
  156. package/lib/persistence/migrations.d.ts +8 -8
  157. package/lib/persistence/migrations.js.map +1 -1
  158. package/lib/persistence/types.d.ts +38 -20
  159. package/lib/query/Paginator.cjs +4 -4
  160. package/lib/query/Paginator.d.ts +6 -5
  161. package/lib/query/Paginator.js.map +1 -1
  162. package/lib/query/Statement.cjs +34 -21
  163. package/lib/query/Statement.d.ts +9 -8
  164. package/lib/query/Statement.js.map +1 -1
  165. package/lib/ram/RamAdapter.cjs +35 -22
  166. package/lib/ram/RamAdapter.d.ts +21 -21
  167. package/lib/ram/RamAdapter.js.map +1 -1
  168. package/lib/ram/RamPaginator.cjs +5 -3
  169. package/lib/ram/RamPaginator.d.ts +2 -1
  170. package/lib/ram/RamPaginator.js.map +1 -1
  171. package/lib/ram/RamSequence.cjs +19 -23
  172. package/lib/ram/RamSequence.d.ts +4 -11
  173. package/lib/ram/RamSequence.js.map +1 -1
  174. package/lib/ram/RamStatement.d.ts +7 -7
  175. package/lib/ram/RamStatement.js.map +1 -1
  176. package/lib/ram/handlers.d.ts +3 -4
  177. package/lib/ram/handlers.js.map +1 -1
  178. package/lib/ram/index.cjs +0 -1
  179. package/lib/ram/index.d.ts +0 -1
  180. package/lib/ram/index.js.map +1 -1
  181. package/lib/ram/types.d.ts +4 -12
  182. package/lib/repository/Repository.cjs +107 -202
  183. package/lib/repository/Repository.d.ts +31 -95
  184. package/lib/repository/Repository.js.map +1 -1
  185. package/lib/repository/decorators.cjs +1 -0
  186. package/lib/repository/decorators.js.map +1 -1
  187. package/lib/repository/utils.cjs +2 -3
  188. package/lib/repository/utils.d.ts +1 -1
  189. package/lib/repository/utils.js.map +1 -1
  190. package/lib/utils/ContextualLoggedClass.cjs +33 -0
  191. package/lib/utils/ContextualLoggedClass.d.ts +16 -0
  192. package/lib/utils/ContextualLoggedClass.js.map +1 -0
  193. package/lib/utils/Services.cjs +93 -0
  194. package/lib/utils/Services.d.ts +28 -0
  195. package/lib/utils/Services.js.map +1 -0
  196. package/lib/utils/decorators.cjs +27 -16
  197. package/lib/utils/decorators.d.ts +1 -9
  198. package/lib/utils/decorators.js.map +1 -1
  199. package/lib/utils/index.cjs +2 -1
  200. package/lib/utils/index.d.ts +2 -1
  201. package/lib/utils/index.js.map +1 -1
  202. package/package.json +1 -1
  203. package/lib/esm/identity/utils.d.ts +0 -24
  204. package/lib/esm/identity/utils.js +0 -44
  205. package/lib/esm/identity/utils.js.map +0 -1
  206. package/lib/esm/ram/RamContext.d.ts +0 -28
  207. package/lib/esm/ram/RamContext.js +0 -30
  208. package/lib/esm/ram/RamContext.js.map +0 -1
  209. package/lib/identity/utils.cjs +0 -49
  210. package/lib/identity/utils.d.ts +0 -24
  211. package/lib/identity/utils.js.map +0 -1
  212. package/lib/ram/RamContext.cjs +0 -34
  213. package/lib/ram/RamContext.d.ts +0 -28
  214. package/lib/ram/RamContext.js.map +0 -1
@@ -1,7 +1,30 @@
1
- import { BulkCrudOperationKeys, Context, OperationKeys, RepositoryFlags } from "@decaf-ts/db-decorators";
1
+ import { BulkCrudOperationKeys, Context, ContextOfRepository, FlagsOfContext, FlagsOfRepository, IRepository, LoggerOfContext, LoggerOfFlags, LoggerOfRepository, OperationKeys, RepositoryFlags } from "@decaf-ts/db-decorators";
2
2
  import { Adapter } from "./Adapter";
3
- import { Observable } from "../interfaces/index";
3
+ import { Observable, type Observer } from "../interfaces/index";
4
4
  import { Logger } from "@decaf-ts/logging";
5
+ import { Constructor } from "@decaf-ts/decoration";
6
+ import { Model } from "@decaf-ts/decorator-validation";
7
+ import { ContextualArgs } from "../utils/index";
8
+ export type ContextOf<OBJ extends IRepository<any, any> | Adapter<any, any, any, any>> = OBJ extends Adapter<any, any, any, infer C> ? C : OBJ extends IRepository<any, any> ? ContextOfRepository<OBJ> : never;
9
+ export type LoggerOfAdapter<A extends Adapter<any, any, any, any>> = A extends Adapter<any, any, any, infer C> ? LoggerOfContext<C> : never;
10
+ export type FlagsOfAdapter<A extends Adapter<any, any, any, any>> = A extends Adapter<any, any, any, infer C> ? FlagsOfContext<C> : never;
11
+ export type LoggerOf<OBJ extends RepositoryFlags<any> | Context<any> | Adapter<any, any, any> | IRepository<any, any>> = OBJ extends RepositoryFlags<any> ? LoggerOfFlags<OBJ> : OBJ extends Context<any> ? LoggerOfContext<OBJ> : OBJ extends IRepository<any, any> ? LoggerOfRepository<OBJ> : OBJ extends Adapter<any, any, any> ? LoggerOfAdapter<OBJ> : Logger;
12
+ export type FlagsOf<OBJ extends IRepository<any, any> | Adapter<any, any, any, any> | Context<any>> = OBJ extends Context<any> ? FlagsOfContext<OBJ> : OBJ extends IRepository<any, any> ? FlagsOfRepository<OBJ> : OBJ extends Adapter<any, any, any, any> ? FlagsOfAdapter<OBJ> : never;
13
+ export type PersistenceObservable<CONTEXT extends Context<any>> = Observable<[
14
+ Observer,
15
+ ObserverFilter?
16
+ ], [
17
+ Constructor | string,
18
+ OperationKeys | BulkCrudOperationKeys | string,
19
+ EventIds,
20
+ ...ContextualArgs<CONTEXT>
21
+ ]>;
22
+ export type PersistenceObserver<CONTEXT extends Context<any>> = Observer<[
23
+ Constructor | string,
24
+ OperationKeys | BulkCrudOperationKeys | string,
25
+ EventIds,
26
+ ...ContextualArgs<CONTEXT>
27
+ ]>;
5
28
  /**
6
29
  * @description Type representing possible ID formats for database events
7
30
  * @summary A union type that defines the possible formats for event identifiers in the persistence layer.
@@ -10,25 +33,20 @@ import { Logger } from "@decaf-ts/logging";
10
33
  * @memberOf module:core
11
34
  */
12
35
  export type EventIds = string | number | bigint | string[] | number[] | bigint[];
13
- /**
14
- * @description Function type for filtering observer notifications
15
- * @summary A function type that defines a predicate used to determine whether an observer should be notified
16
- * about a specific database event. The filter examines the table name, event type, and affected IDs.
17
- * @param {string} table - The name of the database table where the event occurred
18
- * @param {(OperationKeys|BulkCrudOperationKeys|string)} event - The type of operation that triggered the event
19
- * @param {EventIds} id - The identifier(s) of the affected record(s)
20
- * @return {boolean} True if the observer should be notified, false otherwise
21
- * @typedef {Function} ObserverFilter
22
- * @memberOf module:core
23
- */
24
- export type ObserverFilter = (table: string, event: OperationKeys | BulkCrudOperationKeys | string, id: EventIds) => boolean;
25
- export type InferredAdapterConfig<A> = A extends Adapter<infer CONF, any, any, any> ? CONF : never;
26
- export interface AdapterDispatch extends Observable {
36
+ export type ObserverFilter = (table: string | Constructor, event: OperationKeys | BulkCrudOperationKeys | string, id: EventIds, ...args: [...any[], Context<any>]) => boolean;
37
+ export type InferredAdapterConfig<A> = A extends Adapter<infer CONF, any, any> ? CONF : never;
38
+ export interface AdapterDispatch<A extends Adapter<any, any, any, any>> extends PersistenceObservable<ContextOf<A>> {
27
39
  close(): Promise<void>;
28
- updateObservers(table: string, event: OperationKeys | BulkCrudOperationKeys | string, id: EventIds): Promise<void>;
40
+ updateObservers<M extends Model>(table: Constructor<M> | string, event: OperationKeys | BulkCrudOperationKeys | string, id: EventIds, ...args: ContextualArgs<ContextOf<A>>): Promise<void>;
29
41
  }
30
- export interface Migration<QUERYRUNNER, A extends Adapter<CONF, CONN, QUERY, FLAGS, CONTEXT>, CONF, CONN, QUERY, FLAGS extends RepositoryFlags = RepositoryFlags, CONTEXT extends Context<FLAGS> = Context<FLAGS>> {
42
+ export interface Migration<QUERYRUNNER, A extends Adapter<any, any, any, any>> {
31
43
  transaction: boolean;
32
- up(qr: QUERYRUNNER, adapter?: A, log?: Logger): Promise<void>;
33
- down(qr: QUERYRUNNER, adapter?: A, log?: Logger): Promise<void>;
44
+ up(qr: QUERYRUNNER, adapter?: A, ctx?: ContextOf<A>): Promise<void>;
45
+ down(qr: QUERYRUNNER, adapter?: A, ctx?: ContextOf<A>): Promise<void>;
34
46
  }
47
+ export type RepositoryFor<A extends Adapter<any, any, any, any>> = A extends Adapter<any, any, any, any> ? ReturnType<A["repository"]> : never;
48
+ export type PreparedModel = {
49
+ record: Record<string, any>;
50
+ id: string;
51
+ transient?: Record<string, any>;
52
+ };
@@ -2,6 +2,7 @@ import { Adapter } from "../persistence";
2
2
  import { Model } from "@decaf-ts/decorator-validation";
3
3
  import { Constructor } from "@decaf-ts/decoration";
4
4
  import { LoggedClass } from "@decaf-ts/logging";
5
+ import { MaybeContextualArg } from "../utils/index";
5
6
  /**
6
7
  * @description Handles pagination for database queries
7
8
  * @summary Provides functionality for navigating through paginated query results
@@ -59,7 +60,7 @@ import { LoggedClass } from "@decaf-ts/logging";
59
60
  * Paginator-->>Client: return page results
60
61
  */
61
62
  export declare abstract class Paginator<M extends Model, R = M[], Q = any> extends LoggedClass {
62
- protected readonly adapter: Adapter<any, any, Q, any, any>;
63
+ protected readonly adapter: Adapter<any, any, Q, any>;
63
64
  protected readonly query: Q;
64
65
  readonly size: number;
65
66
  protected readonly clazz: Constructor<M>;
@@ -72,10 +73,10 @@ export declare abstract class Paginator<M extends Model, R = M[], Q = any> exten
72
73
  get total(): number;
73
74
  get count(): number;
74
75
  protected get statement(): Q;
75
- protected constructor(adapter: Adapter<any, any, Q, any, any>, query: Q, size: number, clazz: Constructor<M>);
76
+ protected constructor(adapter: Adapter<any, any, Q, any>, query: Q, size: number, clazz: Constructor<M>);
76
77
  protected abstract prepare(rawStatement: Q): Q;
77
- next(): Promise<R[]>;
78
- previous(): Promise<R[]>;
78
+ next(...args: MaybeContextualArg<any>): Promise<R[]>;
79
+ previous(...args: MaybeContextualArg<any>): Promise<R[]>;
79
80
  protected validatePage(page: number): number;
80
- abstract page(page?: number): Promise<R[]>;
81
+ abstract page(page?: number, ...args: MaybeContextualArg<any>): Promise<R[]>;
81
82
  }
@@ -78,11 +78,11 @@ export class Paginator extends LoggedClass {
78
78
  this.size = size;
79
79
  this.clazz = clazz;
80
80
  }
81
- async next() {
82
- return this.page(this.current + 1);
81
+ async next(...args) {
82
+ return this.page(this.current + 1, ...args);
83
83
  }
84
- async previous() {
85
- return this.page(this.current - 1);
84
+ async previous(...args) {
85
+ return this.page(this.current - 1, ...args);
86
86
  }
87
87
  validatePage(page) {
88
88
  if (page < 1 || !Number.isInteger(page))
@@ -1 +1 @@
1
- {"version":3,"file":"Paginator.js","sourceRoot":"","sources":["../../../src/query/Paginator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,oBAAiB;AAIvC,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuDG;AACH,MAAM,OAAgB,SAIpB,SAAQ,WAAW;IAQnB,IAAI,OAAO;QACT,OAAO,IAAI,CAAC,YAAY,CAAC;IAC3B,CAAC;IAED,IAAI,KAAK;QACP,OAAO,IAAI,CAAC,WAAW,CAAC;IAC1B,CAAC;IAED,IAAI,KAAK;QACP,OAAO,IAAI,CAAC,YAAY,CAAC;IAC3B,CAAC;IAED,IAAc,SAAS;QACrB,IAAI,CAAC,IAAI,CAAC,UAAU;YAAE,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACjE,OAAO,IAAI,CAAC,UAAU,CAAC;IACzB,CAAC;IAED,YACqB,OAAuC,EACvC,KAAQ,EAClB,IAAY,EACF,KAAqB;QAExC,KAAK,EAAE,CAAC;QALW,YAAO,GAAP,OAAO,CAAgC;QACvC,UAAK,GAAL,KAAK,CAAG;QAClB,SAAI,GAAJ,IAAI,CAAQ;QACF,UAAK,GAAL,KAAK,CAAgB;IAG1C,CAAC;IAID,KAAK,CAAC,IAAI;QACR,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,GAAG,CAAC,CAAC,CAAC;IACrC,CAAC;IAED,KAAK,CAAC,QAAQ;QACZ,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,GAAG,CAAC,CAAC,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GAAL,KAAK,CAAgB;IAG1C,CAAC;IAID,KAAK,CAAC,IAAI,CAAC,GAAG,IAA6B;QACzC,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,GAAG,CAAC,EAAE,GAAG,IAAI,CAAC,CAAC;IAC9C,CAAC;IAED,KAAK,CAAC,QAAQ,CAAC,GAAG,IAA6B;QAC7C,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,GAAG,CAAC,EAAE,GAAG,IAAI,CAAC,CAAC;IAC9C,CAAC;IAES,YAAY,CAAC,IAAY;QACjC,IAAI,IAAI,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC;YACrC,MAAM,IAAI,WAAW,CACnB,sDAAsD,CACvD,CAAC;QACJ,IAAI,OAAO,IAAI,CAAC,WAAW,KAAK,WAAW,IAAI,IAAI,GAAG,IAAI,CAAC,WAAW;YACpE,MAAM,IAAI,WAAW,CACnB,QAAQ,IAAI,CAAC,WAAW,qCAAqC,IAAI,EAAE,CACpE,CAAC;QACJ,OAAO,IAAI,CAAC;IACd,CAAC;CAGF"}
@@ -5,10 +5,10 @@ import { Condition } from "./Condition";
5
5
  import type { CountOption, DistinctOption, LimitOption, MaxOption, MinOption, OffsetOption, OrderAndGroupOption, SelectOption, WhereOption } from "./options";
6
6
  import { Paginatable } from "../interfaces/Paginatable";
7
7
  import { Paginator } from "./Paginator";
8
- import { Adapter } from "../persistence";
8
+ import { Adapter, type ContextOf } from "../persistence";
9
9
  import { Logger } from "@decaf-ts/logging";
10
- import { LoggedClass } from "@decaf-ts/logging";
11
10
  import { Constructor } from "@decaf-ts/decoration";
11
+ import { type ContextualArgs, ContextualLoggedClass, type MaybeContextualArg } from "../utils/index";
12
12
  /**
13
13
  * @description Base class for database query statements
14
14
  * @summary Provides a foundation for building and executing database queries
@@ -60,8 +60,8 @@ import { Constructor } from "@decaf-ts/decoration";
60
60
  * Adapter-->>Statement: return processed results
61
61
  * Statement-->>Client: return final results
62
62
  */
63
- export declare abstract class Statement<Q, M extends Model, R> extends LoggedClass implements Executor<R>, RawExecutor<Q>, Paginatable<M, R, Q> {
64
- protected adapter: Adapter<any, any, Q, any, any>;
63
+ export declare abstract class Statement<M extends Model, A extends Adapter<any, any, any, any>, R, Q = A extends Adapter<any, any, infer Q, any> ? Q : never> extends ContextualLoggedClass<ContextOf<A>> implements Executor<R>, RawExecutor<Q>, Paginatable<M, R, Q> {
64
+ protected adapter: Adapter<any, any, Q, any>;
65
65
  protected readonly selectSelector?: SelectSelector<M>[];
66
66
  protected distinctSelector?: SelectSelector<M>;
67
67
  protected maxSelector?: SelectSelector<M>;
@@ -73,7 +73,7 @@ export declare abstract class Statement<Q, M extends Model, R> extends LoggedCla
73
73
  protected groupBySelector?: GroupBySelector<M>;
74
74
  protected limitSelector?: number;
75
75
  protected offsetSelector?: number;
76
- protected constructor(adapter: Adapter<any, any, Q, any, any>);
76
+ protected constructor(adapter: Adapter<any, any, Q, any>);
77
77
  protected get log(): Logger;
78
78
  select<S extends readonly SelectSelector<M>[]>(): SelectOption<M, M[]>;
79
79
  select<S extends readonly SelectSelector<M>[]>(selector: readonly [...S]): SelectOption<M, Pick<M, S[number]>[]>;
@@ -87,9 +87,10 @@ export declare abstract class Statement<Q, M extends Model, R> extends LoggedCla
87
87
  groupBy(selector: GroupBySelector<M>): LimitOption<M, R>;
88
88
  limit(value: number): OffsetOption<R>;
89
89
  offset(value: number): Executor<R>;
90
- execute(): Promise<R>;
91
- raw<R>(rawInput: Q): Promise<R>;
90
+ execute(...args: MaybeContextualArg<ContextOf<A>>): Promise<R>;
91
+ raw<R>(rawInput: Q, ...args: ContextualArgs<ContextOf<A>>): Promise<R>;
92
92
  protected abstract build(): Q;
93
93
  protected abstract parseCondition(condition: Condition<M>, ...args: any[]): Q;
94
- abstract paginate(size: number): Promise<Paginator<M, R, Q>>;
94
+ abstract paginate(size: number, ...args: MaybeContextualArg<ContextOf<A>>): Promise<Paginator<M, R, Q>>;
95
+ toString(): string;
95
96
  }
@@ -10,10 +10,11 @@ var __metadata = (this && this.__metadata) || function (k, v) {
10
10
  var _a, _b, _c, _d;
11
11
  import { Model } from "@decaf-ts/decorator-validation";
12
12
  import { Condition } from "./Condition.js";
13
- import { InternalError } from "@decaf-ts/db-decorators";
14
- import { final } from "./../utils/decorators.js";
13
+ import { Context, InternalError, OperationKeys } from "@decaf-ts/db-decorators";
14
+ import { final } from "@decaf-ts/logging";
15
+ import { Adapter } from "./../persistence/index.js";
15
16
  import { QueryError } from "./errors.js";
16
- import { LoggedClass } from "@decaf-ts/logging";
17
+ import { ContextualLoggedClass, } from "./../utils/index.js";
17
18
  /**
18
19
  * @description Base class for database query statements
19
20
  * @summary Provides a foundation for building and executing database queries
@@ -65,7 +66,7 @@ import { LoggedClass } from "@decaf-ts/logging";
65
66
  * Adapter-->>Statement: return processed results
66
67
  * Statement-->>Client: return final results
67
68
  */
68
- export class Statement extends LoggedClass {
69
+ export class Statement extends ContextualLoggedClass {
69
70
  constructor(adapter) {
70
71
  super();
71
72
  this.adapter = adapter;
@@ -122,28 +123,40 @@ export class Statement extends LoggedClass {
122
123
  this.offsetSelector = value;
123
124
  return this;
124
125
  }
125
- async execute() {
126
+ async execute(...args) {
127
+ let execArgs = args;
128
+ if ((!execArgs.length ||
129
+ !(execArgs[execArgs.length - 1] instanceof Context)) &&
130
+ this.fromSelector) {
131
+ const ctx = await this.adapter.context(OperationKeys.READ, {}, this.fromSelector);
132
+ execArgs = [...execArgs, ctx];
133
+ }
134
+ const { ctx } = Adapter.logCtx(execArgs, this.toString());
126
135
  try {
127
136
  const query = this.build();
128
- return (await this.raw(query));
137
+ return (await this.raw(query, ctx));
129
138
  }
130
139
  catch (e) {
131
140
  throw new InternalError(e);
132
141
  }
133
142
  }
134
- async raw(rawInput) {
135
- const results = await this.adapter.raw(rawInput);
143
+ async raw(rawInput, ...args) {
144
+ const { ctx, ctxArgs } = this.logCtx(args, this.raw);
145
+ const results = await this.adapter.raw(rawInput, ...ctxArgs);
136
146
  if (!this.selectSelector)
137
147
  return results;
138
148
  const pkAttr = Model.pk(this.fromSelector);
139
149
  const processor = function recordProcessor(r) {
140
150
  const id = r[pkAttr];
141
- return this.adapter.revert(r, this.fromSelector, pkAttr, id);
151
+ return this.adapter.revert(r, this.fromSelector, id, undefined, ctx);
142
152
  }.bind(this);
143
153
  if (Array.isArray(results))
144
154
  return results.map(processor);
145
155
  return processor(results);
146
156
  }
157
+ toString() {
158
+ return `${this.adapter.flavour} statement`;
159
+ }
147
160
  }
148
161
  __decorate([
149
162
  final(),
@@ -214,7 +227,7 @@ __decorate([
214
227
  __decorate([
215
228
  final(),
216
229
  __metadata("design:type", Function),
217
- __metadata("design:paramtypes", []),
230
+ __metadata("design:paramtypes", [void 0]),
218
231
  __metadata("design:returntype", Promise)
219
232
  ], Statement.prototype, "execute", null);
220
233
  //# sourceMappingURL=Statement.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Statement.js","sourceRoot":"","sources":["../../../src/query/Statement.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,gCAAgC,CAAC;AAQvD,OAAO,EAAE,SAAS,EAAE,uBAAoB;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,KAAK,EAAE,iCAA4B;AAe5C,OAAO,EAAE,UAAU,EAAE,oBAAiB;AAEtC,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGhD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkDG;AACH,MAAM,OAAgB,SACpB,SAAQ,WAAW;IAenB,YAAgC,OAAuC;QACrE,KAAK,EAAE,CAAC;QADsB,YAAO,GAAP,OAAO,CAAgC;IAEvE,CAAC;IAED,IAAuB,GAAG;QACxB,OAAQ,IAAI,CAAC,OAAe,CAAC,GAAG,CAAC,GAAG,CAAC,SAAS,CAAC,CAA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AAK,EAAE;;;;uCAIP;AAGK;IADL,KAAK,EAAE;;;;wCAsBP"}
@@ -1,11 +1,11 @@
1
- import { RamFlags, RawRamQuery, RamStorage, RamRepository, RamConfig } from "./types";
1
+ import { RamFlags, RawRamQuery, RamStorage, RamConfig, RamContext } from "./types";
2
2
  import { RamStatement } from "./RamStatement";
3
- import { RamContext } from "./RamContext";
3
+ import { Repository } from "../repository/Repository";
4
4
  import { Dispatch } from "../persistence/Dispatch";
5
5
  import { Adapter, Sequence } from "../persistence";
6
6
  import { SequenceOptions } from "../interfaces";
7
7
  import { Model } from "@decaf-ts/decorator-validation";
8
- import { BaseError, OperationKeys } from "@decaf-ts/db-decorators";
8
+ import { BaseError, OperationKeys, PrimaryKeyType } from "@decaf-ts/db-decorators";
9
9
  import { Constructor } from "@decaf-ts/decoration";
10
10
  /**
11
11
  * @description In-memory adapter for data persistence
@@ -50,7 +50,7 @@ import { Constructor } from "@decaf-ts/decoration";
50
50
  * RamAdapter-->>Repository: model
51
51
  * Repository-->>Client: model
52
52
  */
53
- export declare class RamAdapter extends Adapter<RamConfig, RamStorage, RawRamQuery<any>, RamFlags, RamContext> {
53
+ export declare class RamAdapter extends Adapter<RamConfig, RamStorage, RawRamQuery, RamContext> {
54
54
  constructor(conf?: RamConfig, alias?: string);
55
55
  /**
56
56
  * @description Gets the repository constructor for a model
@@ -59,7 +59,7 @@ export declare class RamAdapter extends Adapter<RamConfig, RamStorage, RawRamQue
59
59
  * @template M - The model type for the repository
60
60
  * @return {Constructor<RamRepository<M>>} A constructor for creating RAM repositories
61
61
  */
62
- repository<M extends Model<boolean>>(): Constructor<RamRepository<M>>;
62
+ repository<R extends Repository<any, Adapter<any, any, any, any>>>(): Constructor<R>;
63
63
  /**
64
64
  * @description Creates operation flags with UUID
65
65
  * @summary Extends the base flags with a UUID for user identification.
@@ -71,8 +71,8 @@ export declare class RamAdapter extends Adapter<RamConfig, RamStorage, RawRamQue
71
71
  * @return {Promise<RamFlags>} Complete flags with UUID
72
72
  */
73
73
  flags<M extends Model<boolean>>(operation: OperationKeys, model: Constructor<M>, flags: Partial<RamFlags>): Promise<RamFlags>;
74
- protected Dispatch(): Dispatch;
75
- Context: typeof RamContext;
74
+ protected Dispatch(): Dispatch<RamAdapter>;
75
+ Context: Constructor<RamContext>;
76
76
  private indexes;
77
77
  private lock;
78
78
  /**
@@ -92,9 +92,10 @@ export declare class RamAdapter extends Adapter<RamConfig, RamStorage, RawRamQue
92
92
  * @param pk - The primary key property name
93
93
  * @return Object containing the record and ID
94
94
  */
95
- prepare<M extends Model>(model: M, pk: keyof M): {
95
+ prepare<M extends Model>(model: M, ...args: [...any[], RamContext]): {
96
96
  record: Record<string, any>;
97
97
  id: string;
98
+ transient?: Record<string, any>;
98
99
  };
99
100
  /**
100
101
  * @description Converts a stored record back to a model instance
@@ -102,18 +103,17 @@ export declare class RamAdapter extends Adapter<RamConfig, RamStorage, RawRamQue
102
103
  * This method is the inverse of the prepare method.
103
104
  * @template M - The model type to revert to
104
105
  * @param {Record<string, any>} obj - The stored record
105
- * @param {string | Constructor<M>} clazz - The model class or name
106
- * @param pk - The primary key property name
107
- * @param {string | number} id - The primary key value
106
+ * @param {Constructor<M>} clazz - The model class or name
107
+ * @param {PrimaryKeyType} id - The primary key value
108
108
  * @return {M} The reconstructed model instance
109
109
  */
110
- revert<M extends Model>(obj: Record<string, any>, clazz: string | Constructor<M>, pk: keyof M, id: string | number): M;
110
+ revert<M extends Model>(obj: Record<string, any>, clazz: Constructor<M>, id: PrimaryKeyType, transient?: Record<string, any>, ...args: [...any[], RamContext]): M;
111
111
  /**
112
112
  * @description Creates a new record in the in-memory storage
113
113
  * @summary Stores a new record in the specified table with the given ID.
114
114
  * This method acquires a lock to ensure thread safety, creates the table if it doesn't exist,
115
115
  * checks for conflicts, and stores the model.
116
- * @param {string} tableName - The name of the table to store the record in
116
+ * @param {string} clazz - The name of the table to store the record in
117
117
  * @param {string | number} id - The unique identifier for the record
118
118
  * @param {Record<string, any>} model - The record data to store
119
119
  * @return {Promise<Record<string, any>>} A promise that resolves to the stored record
@@ -137,13 +137,13 @@ export declare class RamAdapter extends Adapter<RamConfig, RamStorage, RawRamQue
137
137
  * RamAdapter->>RamAdapter: lock.release()
138
138
  * RamAdapter-->>Caller: model
139
139
  */
140
- create(tableName: string, id: string | number, model: Record<string, any>): Promise<Record<string, any>>;
140
+ create<M extends Model>(clazz: Constructor<M>, id: PrimaryKeyType, model: Record<string, any>, ctx: RamContext): Promise<Record<string, any>>;
141
141
  /**
142
142
  * @description Retrieves a record from in-memory storage
143
143
  * @summary Fetches a record with the specified ID from the given table.
144
144
  * This method checks if the table and record exist and throws appropriate errors if not.
145
- * @param {string} tableName - The name of the table to retrieve from
146
- * @param {string | number} id - The unique identifier of the record to retrieve
145
+ * @param {Constructor} clazz - The name of the table to retrieve from
146
+ * @param {PrimaryKeyType} id - The unique identifier of the record to retrieve
147
147
  * @return {Promise<Record<string, any>>} A promise that resolves to the retrieved record
148
148
  * @mermaid
149
149
  * sequenceDiagram
@@ -164,7 +164,7 @@ export declare class RamAdapter extends Adapter<RamConfig, RamStorage, RawRamQue
164
164
  * Storage-->>RamAdapter: record
165
165
  * RamAdapter-->>Caller: record
166
166
  */
167
- read(tableName: string, id: string | number): Promise<Record<string, any>>;
167
+ read<M extends Model>(clazz: Constructor<M>, id: PrimaryKeyType, ctx: RamContext): Promise<Record<string, any>>;
168
168
  /**
169
169
  * @description Updates an existing record in the in-memory storage
170
170
  * @summary Updates a record with the specified ID in the given table.
@@ -194,7 +194,7 @@ export declare class RamAdapter extends Adapter<RamConfig, RamStorage, RawRamQue
194
194
  * RamAdapter->>RamAdapter: lock.release()
195
195
  * RamAdapter-->>Caller: model
196
196
  */
197
- update(tableName: string, id: string | number, model: Record<string, any>): Promise<Record<string, any>>;
197
+ update<M extends Model>(clazz: Constructor<M>, id: PrimaryKeyType, model: Record<string, any>, ctx: RamContext): Promise<Record<string, any>>;
198
198
  /**
199
199
  * @description Deletes a record from the in-memory storage
200
200
  * @summary Removes a record with the specified ID from the given table.
@@ -225,7 +225,7 @@ export declare class RamAdapter extends Adapter<RamConfig, RamStorage, RawRamQue
225
225
  * RamAdapter->>RamAdapter: lock.release()
226
226
  * RamAdapter-->>Caller: record
227
227
  */
228
- delete(tableName: string, id: string | number): Promise<Record<string, any>>;
228
+ delete<M extends Model>(clazz: Constructor<M>, id: PrimaryKeyType, ctx: RamContext): Promise<Record<string, any>>;
229
229
  /**
230
230
  * @description Gets or creates a table in the in-memory storage
231
231
  * @summary Retrieves the Map representing a table for a given model or table name.
@@ -279,7 +279,7 @@ export declare class RamAdapter extends Adapter<RamConfig, RamStorage, RawRamQue
279
279
  * end
280
280
  * RamAdapter-->>Caller: result
281
281
  */
282
- raw<R>(rawInput: RawRamQuery<any>): Promise<R>;
282
+ raw<R>(rawInput: RawRamQuery<any>, ctx: RamContext): Promise<R>;
283
283
  /**
284
284
  * @description Parses and converts errors to appropriate types
285
285
  * @summary Ensures that errors are of the correct type for consistent error handling.
@@ -296,7 +296,7 @@ export declare class RamAdapter extends Adapter<RamConfig, RamStorage, RawRamQue
296
296
  * @template M - The model type for the statement
297
297
  * @return {RamStatement<M, any>} A new statement builder instance
298
298
  */
299
- Statement<M extends Model<boolean>>(): RamStatement<M, any>;
299
+ Statement<M extends Model<boolean>>(): RamStatement<M, any, Adapter<any, any, RawRamQuery<M>, RamContext>>;
300
300
  /**
301
301
  * @description Creates a new sequence for generating sequential IDs
302
302
  * @summary Factory method that creates a new RamSequence instance for ID generation.
@@ -1,10 +1,8 @@
1
1
  import { RamStatement } from "./RamStatement.js";
2
- import { RamContext } from "./RamContext.js";
3
- import { Repository } from "./../repository/Repository.js";
4
2
  import { Adapter, PersistenceKeys, Sequence } from "./../persistence/index.js";
5
3
  import { Lock } from "@decaf-ts/transactional-decorators";
6
4
  import { hashObj, Model } from "@decaf-ts/decorator-validation";
7
- import { BaseError, ConflictError, InternalError, NotFoundError, onCreate, onCreateUpdate, DBKeys, } from "@decaf-ts/db-decorators";
5
+ import { BaseError, ConflictError, InternalError, NotFoundError, onCreate, onCreateUpdate, DBKeys, Context, } from "@decaf-ts/db-decorators";
8
6
  import { RamSequence } from "./RamSequence.js";
9
7
  import { createdByOnRamCreateUpdate } from "./handlers.js";
10
8
  import { RamFlavour } from "./constants.js";
@@ -55,7 +53,7 @@ import { Decoration, Metadata, propMetadata, } from "@decaf-ts/decoration";
55
53
  export class RamAdapter extends Adapter {
56
54
  constructor(conf = {}, alias) {
57
55
  super(conf, RamFlavour, alias);
58
- this.Context = RamContext;
56
+ this.Context = Context;
59
57
  this.indexes = {};
60
58
  this.lock = new Lock();
61
59
  }
@@ -107,9 +105,10 @@ export class RamAdapter extends Adapter {
107
105
  * @param pk - The primary key property name
108
106
  * @return Object containing the record and ID
109
107
  */
110
- prepare(model, pk) {
111
- const prepared = super.prepare(model, pk);
112
- delete prepared.record[pk];
108
+ prepare(model, ...args) {
109
+ const ctx = args.pop();
110
+ const prepared = super.prepare(model, ...args, ctx);
111
+ delete prepared.record[Model.pk(model.constructor)];
113
112
  return prepared;
114
113
  }
115
114
  /**
@@ -118,13 +117,12 @@ export class RamAdapter extends Adapter {
118
117
  * This method is the inverse of the prepare method.
119
118
  * @template M - The model type to revert to
120
119
  * @param {Record<string, any>} obj - The stored record
121
- * @param {string | Constructor<M>} clazz - The model class or name
122
- * @param pk - The primary key property name
123
- * @param {string | number} id - The primary key value
120
+ * @param {Constructor<M>} clazz - The model class or name
121
+ * @param {PrimaryKeyType} id - The primary key value
124
122
  * @return {M} The reconstructed model instance
125
123
  */
126
- revert(obj, clazz, pk, id) {
127
- const res = super.revert(obj, clazz, pk, id);
124
+ revert(obj, clazz, id, transient, ...args) {
125
+ const res = super.revert(obj, clazz, id, transient, ...args);
128
126
  return res;
129
127
  }
130
128
  /**
@@ -132,7 +130,7 @@ export class RamAdapter extends Adapter {
132
130
  * @summary Stores a new record in the specified table with the given ID.
133
131
  * This method acquires a lock to ensure thread safety, creates the table if it doesn't exist,
134
132
  * checks for conflicts, and stores the model.
135
- * @param {string} tableName - The name of the table to store the record in
133
+ * @param {string} clazz - The name of the table to store the record in
136
134
  * @param {string | number} id - The unique identifier for the record
137
135
  * @param {Record<string, any>} model - The record data to store
138
136
  * @return {Promise<Record<string, any>>} A promise that resolves to the stored record
@@ -156,11 +154,15 @@ export class RamAdapter extends Adapter {
156
154
  * RamAdapter->>RamAdapter: lock.release()
157
155
  * RamAdapter-->>Caller: model
158
156
  */
159
- async create(tableName, id, model) {
157
+ async create(clazz, id, model, ctx) {
158
+ const log = ctx.logger.for(this.create);
159
+ const tableName = Model.tableName(clazz);
160
+ log.debug(`creating record in table ${tableName} with id ${id}`);
160
161
  await this.lock.acquire();
161
162
  if (!this.client.has(tableName))
162
163
  this.client.set(tableName, new Map());
163
- if (this.client.get(tableName) && this.client.get(tableName)?.has(id))
164
+ if (this.client.get(tableName) &&
165
+ this.client.get(tableName)?.has(id))
164
166
  throw new ConflictError(`Record with id ${id} already exists in table ${tableName}`);
165
167
  this.client.get(tableName)?.set(id, model);
166
168
  this.lock.release();
@@ -170,8 +172,8 @@ export class RamAdapter extends Adapter {
170
172
  * @description Retrieves a record from in-memory storage
171
173
  * @summary Fetches a record with the specified ID from the given table.
172
174
  * This method checks if the table and record exist and throws appropriate errors if not.
173
- * @param {string} tableName - The name of the table to retrieve from
174
- * @param {string | number} id - The unique identifier of the record to retrieve
175
+ * @param {Constructor} clazz - The name of the table to retrieve from
176
+ * @param {PrimaryKeyType} id - The unique identifier of the record to retrieve
175
177
  * @return {Promise<Record<string, any>>} A promise that resolves to the retrieved record
176
178
  * @mermaid
177
179
  * sequenceDiagram
@@ -192,7 +194,10 @@ export class RamAdapter extends Adapter {
192
194
  * Storage-->>RamAdapter: record
193
195
  * RamAdapter-->>Caller: record
194
196
  */
195
- async read(tableName, id) {
197
+ async read(clazz, id,
198
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
199
+ ctx) {
200
+ const tableName = Model.tableName(clazz);
196
201
  if (!this.client.has(tableName))
197
202
  throw new NotFoundError(`Table ${tableName} not found`);
198
203
  if (!this.client.get(tableName)?.has(id))
@@ -228,7 +233,10 @@ export class RamAdapter extends Adapter {
228
233
  * RamAdapter->>RamAdapter: lock.release()
229
234
  * RamAdapter-->>Caller: model
230
235
  */
231
- async update(tableName, id, model) {
236
+ async update(clazz, id, model, ctx) {
237
+ const log = ctx.logger.for(this.update);
238
+ const tableName = Model.tableName(clazz);
239
+ log.debug(`updating record in table ${tableName} with id ${id}`);
232
240
  await this.lock.acquire();
233
241
  if (!this.client.has(tableName))
234
242
  throw new NotFoundError(`Table ${tableName} not found`);
@@ -268,7 +276,10 @@ export class RamAdapter extends Adapter {
268
276
  * RamAdapter->>RamAdapter: lock.release()
269
277
  * RamAdapter-->>Caller: record
270
278
  */
271
- async delete(tableName, id) {
279
+ async delete(clazz, id, ctx) {
280
+ const log = ctx.logger.for(this.delete);
281
+ const tableName = Model.tableName(clazz);
282
+ log.debug(`deleting record from table ${tableName} with pk ${id}`);
272
283
  await this.lock.acquire();
273
284
  if (!this.client.has(tableName))
274
285
  throw new NotFoundError(`Table ${tableName} not found`);
@@ -291,7 +302,7 @@ export class RamAdapter extends Adapter {
291
302
  tableFor(from) {
292
303
  if (typeof from === "string")
293
304
  from = Model.get(from);
294
- const table = Repository.table(from);
305
+ const table = Model.tableName(from);
295
306
  if (!this.client.has(table))
296
307
  this.client.set(table, new Map());
297
308
  return this.client.get(table);
@@ -339,7 +350,9 @@ export class RamAdapter extends Adapter {
339
350
  * end
340
351
  * RamAdapter-->>Caller: result
341
352
  */
342
- async raw(rawInput) {
353
+ async raw(rawInput, ctx) {
354
+ const log = ctx.logger.for(this.raw);
355
+ log.debug(`performing raw query: ${JSON.stringify(rawInput)}`);
343
356
  const { where, sort, limit, skip, from } = rawInput;
344
357
  let { select } = rawInput;
345
358
  const collection = this.tableFor(from);
@@ -347,7 +360,7 @@ export class RamAdapter extends Adapter {
347
360
  throw new InternalError(`Table ${from} not found in RamAdapter`);
348
361
  const id = Model.pk(from);
349
362
  const props = Metadata.get(from, Metadata.key(DBKeys.ID, id));
350
- let result = Array.from(collection.entries()).map(([pk, r]) => this.revert(r, from, id, Sequence.parseValue(props.type, pk)));
363
+ let result = Array.from(collection.entries()).map(([pk, r]) => this.revert(r, from, Sequence.parseValue(props.type, pk), undefined, ctx));
351
364
  result = where ? result.filter(where) : result;
352
365
  if (sort)
353
366
  result = result.sort(sort);
@@ -1 +1 @@
1
- {"version":3,"file":"RamAdapter.js","sourceRoot":"","sources":["../../../src/ram/RamAdapter.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,YAAY,EAAE,0BAAuB;AAC9C,OAAO,EAAE,UAAU,EAAE,wBAAqB;AAC1C,OAAO,EAAE,UAAU,EAAE,sCAAiC;AAEtD,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,kCAAuB;AAEpE,OAAO,EAAE,IAAI,EAAE,MAAM,oCAAoC,CAAC;AAC1D,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,gCAAgC,CAAC;AAChE,OAAO,EACL,SAAS,EACT,aAAa,EAEb,aAAa,EACb,aAAa,EACb,QAAQ,EACR,cAAc,EACd,MAAM,GACP,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,WAAW,EAAE,yBAAsB;AAC5C,OAAO,EAAE,0BAA0B,EAAE,sBAAmB;AACxD,OAAO,EAAE,UAAU,EAAE,uBAAoB;AACzC,OAAO,EAEL,UAAU,EACV,QAAQ,EACR,YAAY,GACb,MAAM,sBAAsB,CAAC;AAC9B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,MAAM,OAAO,UAAW,SAAQ,OAM/B;IACC,YAAY,OAAkB,EAAS,EAAE,KAAc;QACrD,KAAK,CAAC,IAAI,EAAE,UAAU,EAAE,KAAK,CAAC,CAAC;QAwCxB,YAAO,GAAG,UAAU,CAAC;QAEtB,YAAO,GAGX,EAAE,CA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AK,CAAC,UAAU,EAAE,CAAC;QACnB,MAAM,YAAY,GAAG,eAAe,CAAC,UAAU,CAAC;QAChD,MAAM,YAAY,GAAG,eAAe,CAAC,UAAU,CAAC;QAChD,UAAU,CAAC,WAAW,CAAC,UAAU,CAAC;aAC/B,GAAG,CAAC,YAAY,CAAC;aACjB,MAAM,CACL,QAAQ,CAAC,0BAA0B,CAAC,EACpC,YAAY,CAAC,YAAY,EAAE,EAAE,CAAC,CAC/B;aACA,KAAK,EAAE,CAAC;QACX,UAAU,CAAC,WAAW,CAAC,UAAU,CAAC;aAC/B,GAAG,CAAC,YAAY,CAAC;aACjB,MAAM,CACL,cAAc,CAAC,0BAA0B,CAAC,EAC1C,YAAY,CAAC,YAAY,EAAE,EAAE,CAAC,CAC/B;aACA,KAAK,EAAE,CAAC;IACb,CAAC;IAEkB,SAAS;QAC1B,OAAO,IAAI,GAAG,EAAE,CAAC;IACnB,CAAC;CACF"}
@@ -3,6 +3,7 @@ import { Paginator } from "../query";
3
3
  import { Model } from "@decaf-ts/decorator-validation";
4
4
  import { Adapter } from "../persistence";
5
5
  import { Constructor } from "@decaf-ts/decoration";
6
+ import { MaybeContextualArg } from "../utils/index";
6
7
  /**
7
8
  * @description RAM-specific paginator implementation
8
9
  * @summary Extends the base Paginator class to provide pagination functionality for RAM adapter queries.
@@ -49,5 +50,5 @@ export declare class RamPaginator<M extends Model, R> extends Paginator<M, R, Ra
49
50
  * @param {number} [page=1] - The page number to retrieve (1-based)
50
51
  * @return {Promise<R[]>} A promise that resolves to an array of results for the requested page
51
52
  */
52
- page(page?: number): Promise<R[]>;
53
+ page(page?: number, ...args: MaybeContextualArg<any>): Promise<R[]>;
53
54
  }