@decaf-ts/core 0.7.1 → 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 +54 -51
  43. package/lib/esm/persistence/Adapter.js +78 -57
  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 +83 -62
  141. package/lib/persistence/Adapter.d.ts +54 -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
@@ -0,0 +1,28 @@
1
+ import { Constructor } from "@decaf-ts/decoration";
2
+ import { ContextualLoggedClass } from "./ContextualLoggedClass";
3
+ export declare abstract class Service extends ContextualLoggedClass<any> {
4
+ readonly name?: string | undefined;
5
+ protected constructor(name?: string | undefined);
6
+ /**
7
+ * @description Retrieves a Service instance by name/class
8
+ * @summary Looks up and returns a cached API instance by its name or constructor
9
+ * @template A Type extending Api
10
+ * @param {string | Constructor<A>} name - Name of the API or its constructor
11
+ * @return {A} The requested API instance
12
+ */
13
+ static get<A extends Service>(name: string | symbol | Constructor<A>): A;
14
+ static boot(): Promise<void>;
15
+ }
16
+ export declare abstract class ClientBasedService<CLIENT, CONF> extends Service {
17
+ protected _client?: CLIENT;
18
+ protected _config?: CONF;
19
+ protected constructor();
20
+ boot(): Promise<void>;
21
+ abstract initialize(): Promise<{
22
+ config: CONF;
23
+ client: CLIENT;
24
+ }>;
25
+ protected get config(): CONF;
26
+ get client(): CLIENT;
27
+ shutdown(): Promise<void>;
28
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Services.js","sourceRoot":"","sources":["../../src/utils/Services.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2DAAwD;AACxD,+CAAmD;AAEnD,2EAA8D;AAC9D,uEAAgE;AAEhE,MAAsB,OAAQ,SAAQ,6CAA0B;IAC9D,YAA+B,IAAa;QAC1C,KAAK,EAAE,CAAC;QADqB,SAAI,GAAJ,IAAI,CAAS;IAE5C,CAAC;IAED;;;;;;OAMG;IACH,MAAM,CAAC,GAAG,CAAoB,IAAsC;QAClE,IAAI,CAAC,IAAI;YAAE,MAAM,IAAI,6BAAa,CAAC,kBAAkB,CAAC,CAAC;QAEvD,MAAM,UAAU,GAAG,mCAAW,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QACzC,IAAI,UAAU;YAAE,OAAO,UAAe,CAAC;QAEvC,MAAM,IAAI,6BAAa,CACrB,wBAAwB,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,CACnH,CAAC;IACJ,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,IAAI;QACf,MAAM,GAAG,GAAG,iBAAO,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACnC,MAAM,QAAQ,GAAG,mCAAW,CAAC,QAAQ,EAAE,CAAC;QACxC,KAAK,MAAM,CAAC,GAAG,EAAE,OAAO,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC;YACtD,IAAI,CAAC;gBACH,MAAM,CAAC,GAAG,IACR,OACD,CAAC,IAAI,EAAE,CAAC;gBACT,IAAI,CAAC,YAAY,kBAAkB;oBAAE,MAAM,CAAC,CAAC,IAAI,EAAE,CAAC;YACtD,CAAC;YAAC,OAAO,CAAU,EAAE,CAAC;gBACpB,GAAG,CAAC,KAAK,CAAC,kBAAkB,GAAG,UAAU,EAAE,CAAU,CAAC,CAAC;YACzD,CAAC;QACH,CAAC;IACH,CAAC;CACF;AArCD,0BAqCC;AAED,MAAsB,kBAAiC,SAAQ,OAAO;IAKpE;QACE,KAAK,EAAE,CAAC;IACV,CAAC;IAGK,AAAN,KAAK,CAAC,IAAI;QACR,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,IAAI,CAAC,UAAU,EAAE,CAAC;QACnD,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;IACxB,CAAC;IAOD,IACc,MAAM;QAClB,IAAI,CAAC,IAAI,CAAC,OAAO;YAAE,MAAM,IAAI,6BAAa,CAAC,wBAAwB,CAAC,CAAC;QACrE,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;IAED,IACI,MAAM;QACR,IAAI,CAAC,IAAI,CAAC,OAAO;YAAE,MAAM,IAAI,6BAAa,CAAC,wBAAwB,CAAC,CAAC;QACrE,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;IAED,KAAK,CAAC,QAAQ;QACZ,kFAAkF;IACpF,CAAC;CACF;AApCD,gDAoCC;AA1BO;IADL,IAAA,eAAK,GAAE;;;;8CAKP;AAOD;IAAC,IAAA,eAAK,GAAE;;;gDAIP;AAED;IAAC,IAAA,eAAK,GAAE;;;gDAIP"}
@@ -1,22 +1,33 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.final = final;
4
- /**
5
- * @description Creates a decorator that makes a method non-configurable
6
- * @summary This decorator prevents a method from being overridden by making it non-configurable.
7
- * It throws an error if used on anything other than a method.
8
- * @return {Function} A decorator function that can be applied to methods
9
- * @function final
10
- * @category Method Decorators
11
- */
12
- function final() {
13
- return (target, propertyKey, descriptor) => {
14
- if (!descriptor)
15
- throw new Error("final decorator can only be used on methods");
16
- if (descriptor?.configurable) {
17
- descriptor.configurable = false;
3
+ exports.service = service;
4
+ const decoration_1 = require("@decaf-ts/decoration");
5
+ const injectable_decorators_1 = require("@decaf-ts/injectable-decorators");
6
+ const index_1 = require("./../persistence/index.cjs");
7
+ function service(key) {
8
+ return function service(target, prop, descriptor) {
9
+ decoration_1.Metadata.set(index_1.PersistenceKeys.SERVICE, key, target);
10
+ const decs = [];
11
+ if (descriptor && typeof descriptor.value === "number") {
12
+ decs.push((0, injectable_decorators_1.inject)());
18
13
  }
19
- return descriptor;
14
+ else if (!descriptor && !prop) {
15
+ decs.push((0, injectable_decorators_1.injectable)({
16
+ callback: (inst) => Object.defineProperty(inst, "name", {
17
+ enumerable: true,
18
+ configurable: false,
19
+ writable: false,
20
+ value: key,
21
+ }),
22
+ }));
23
+ }
24
+ else if (!descriptor) {
25
+ decs.push((0, injectable_decorators_1.inject)());
26
+ }
27
+ else
28
+ throw new Error("Invalid decorator usage. Should be impossible");
29
+ decs.push((0, decoration_1.metadata)(index_1.PersistenceKeys.SERVICE, key));
30
+ return (0, decoration_1.apply)(...decs)(target, prop, descriptor);
20
31
  };
21
32
  }
22
33
  //# sourceMappingURL=decorators.js.map
@@ -1,9 +1 @@
1
- /**
2
- * @description Creates a decorator that makes a method non-configurable
3
- * @summary This decorator prevents a method from being overridden by making it non-configurable.
4
- * It throws an error if used on anything other than a method.
5
- * @return {Function} A decorator function that can be applied to methods
6
- * @function final
7
- * @category Method Decorators
8
- */
9
- export declare function final(): (target: object, propertyKey?: any, descriptor?: PropertyDescriptor) => PropertyDescriptor;
1
+ export declare function service(key: string): (target: any, prop?: any, descriptor?: any) => void;
@@ -1 +1 @@
1
- {"version":3,"file":"decorators.js","sourceRoot":"","sources":["../../src/utils/decorators.ts"],"names":[],"mappings":";;AAQA,sBAaC;AArBD;;;;;;;GAOG;AACH,SAAgB,KAAK;IACnB,OAAO,CACL,MAAc,EACd,WAAiB,EACjB,UAA+B,EAC/B,EAAE;QACF,IAAI,CAAC,UAAU;YACb,MAAM,IAAI,KAAK,CAAC,6CAA6C,CAAC,CAAC;QACjE,IAAI,UAAU,EAAE,YAAY,EAAE,CAAC;YAC7B,UAAU,CAAC,YAAY,GAAG,KAAK,CAAC;QAClC,CAAC;QACD,OAAO,UAAU,CAAC;IACpB,CAAC,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"decorators.js","sourceRoot":"","sources":["../../src/utils/decorators.ts"],"names":[],"mappings":";;AAIA,0BAyBC;AA7BD,qDAAiE;AACjE,2EAAqE;AACrE,sDAAuD;AAEvD,SAAgB,OAAO,CAAC,GAAW;IACjC,OAAO,SAAS,OAAO,CAAC,MAAW,EAAE,IAAU,EAAE,UAAgB;QAC/D,qBAAQ,CAAC,GAAG,CAAC,uBAAe,CAAC,OAAO,EAAE,GAAG,EAAE,MAAM,CAAC,CAAC;QACnD,MAAM,IAAI,GAAG,EAAE,CAAC;QAChB,IAAI,UAAU,IAAI,OAAO,UAAU,CAAC,KAAK,KAAK,QAAQ,EAAE,CAAC;YACvD,IAAI,CAAC,IAAI,CAAC,IAAA,8BAAM,GAAE,CAAC,CAAC;QACtB,CAAC;aAAM,IAAI,CAAC,UAAU,IAAI,CAAC,IAAI,EAAE,CAAC;YAChC,IAAI,CAAC,IAAI,CACP,IAAA,kCAAU,EAAC;gBACT,QAAQ,EAAE,CAAC,IAAS,EAAE,EAAE,CACtB,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE;oBAClC,UAAU,EAAE,IAAI;oBAChB,YAAY,EAAE,KAAK;oBACnB,QAAQ,EAAE,KAAK;oBACf,KAAK,EAAE,GAAG;iBACX,CAAC;aACL,CAAC,CACH,CAAC;QACJ,CAAC;aAAM,IAAI,CAAC,UAAU,EAAE,CAAC;YACvB,IAAI,CAAC,IAAI,CAAC,IAAA,8BAAM,GAAE,CAAC,CAAC;QACtB,CAAC;;YAAM,MAAM,IAAI,KAAK,CAAC,+CAA+C,CAAC,CAAC;QAExE,IAAI,CAAC,IAAI,CAAC,IAAA,qBAAQ,EAAC,uBAAe,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC,CAAC;QAClD,OAAO,IAAA,kBAAK,EAAC,GAAG,IAAI,CAAC,CAAC,MAAM,EAAE,IAAI,EAAE,UAAU,CAAC,CAAC;IAClD,CAAC,CAAC;AACJ,CAAC"}
@@ -14,6 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./decorators.cjs"), exports);
17
+ __exportStar(require("./ContextualLoggedClass.cjs"), exports);
18
18
  __exportStar(require("./errors.cjs"), exports);
19
+ __exportStar(require("./Services.cjs"), exports);
19
20
  //# sourceMappingURL=index.js.map
@@ -1,2 +1,3 @@
1
- export * from "./decorators";
1
+ export * from "./ContextualLoggedClass";
2
2
  export * from "./errors";
3
+ export * from "./Services";
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,mDAA6B;AAC7B,+CAAyB"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8DAAwC;AACxC,+CAAyB;AACzB,iDAA2B"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@decaf-ts/core",
3
- "version": "0.7.1",
3
+ "version": "0.7.3",
4
4
  "description": "Core persistence module for the decaf framework",
5
5
  "type": "module",
6
6
  "exports": {
@@ -1,24 +0,0 @@
1
- import { Model } from "@decaf-ts/decorator-validation";
2
- import { Constructor } from "@decaf-ts/decoration";
3
- /**
4
- * @description Gets the table name for a model
5
- * @summary Retrieves the table name associated with a model by checking metadata or falling back to the constructor name
6
- * @template M - Type that extends Model
7
- * @param {M | Constructor<M>} model - The model instance or constructor to get the table name for
8
- * @return {string} The table name for the model
9
- * @function getTableName
10
- * @memberOf module:core
11
- */
12
- export declare function getTableName<M extends Model>(model: M | Constructor<M>): string;
13
- export declare function getColumnName<M extends Model>(model: M | Constructor<M>, attribute: string): string;
14
- /**
15
- * @description Generates a sequence name for a model
16
- * @summary Creates a standardized sequence name by combining the table name with additional arguments
17
- * @template M - Type that extends Model
18
- * @param {M | Constructor<M>} model - The model instance or constructor to generate the sequence name for
19
- * @param {...string} args - Additional string arguments to append to the sequence name
20
- * @return {string} The generated sequence name
21
- * @function sequenceNameForModel
22
- * @memberOf module:core
23
- */
24
- export declare function sequenceNameForModel<M extends Model>(model: M | Constructor<M>, ...args: string[]): string;
@@ -1,44 +0,0 @@
1
- import { Model } from "@decaf-ts/decorator-validation";
2
- import { InternalError } from "@decaf-ts/db-decorators";
3
- import { PersistenceKeys } from "./../persistence/constants.js";
4
- import { Metadata } from "@decaf-ts/decoration";
5
- /**
6
- * @description Gets the table name for a model
7
- * @summary Retrieves the table name associated with a model by checking metadata or falling back to the constructor name
8
- * @template M - Type that extends Model
9
- * @param {M | Constructor<M>} model - The model instance or constructor to get the table name for
10
- * @return {string} The table name for the model
11
- * @function getTableName
12
- * @memberOf module:core
13
- */
14
- export function getTableName(model) {
15
- const obj = model instanceof Model ? Model.get(model.constructor.name) : model;
16
- if (!obj)
17
- throw new InternalError(`Unable to find model ${model}`);
18
- const meta = Metadata.get(model instanceof Model ? model.constructor : model, PersistenceKeys.TABLE);
19
- if (meta) {
20
- return meta;
21
- }
22
- if (model instanceof Model) {
23
- return model.constructor.name;
24
- }
25
- return model.name;
26
- }
27
- export function getColumnName(model, attribute) {
28
- const metadata = Metadata.get(model instanceof Model ? model.constructor : model, Metadata.key(PersistenceKeys.COLUMN, attribute));
29
- return metadata ? metadata : attribute;
30
- }
31
- /**
32
- * @description Generates a sequence name for a model
33
- * @summary Creates a standardized sequence name by combining the table name with additional arguments
34
- * @template M - Type that extends Model
35
- * @param {M | Constructor<M>} model - The model instance or constructor to generate the sequence name for
36
- * @param {...string} args - Additional string arguments to append to the sequence name
37
- * @return {string} The generated sequence name
38
- * @function sequenceNameForModel
39
- * @memberOf module:core
40
- */
41
- export function sequenceNameForModel(model, ...args) {
42
- return [getTableName(model), ...args].join("_");
43
- }
44
- //# sourceMappingURL=utils.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/identity/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,gCAAgC,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,sCAAiC;AAC3D,OAAO,EAAe,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAE7D;;;;;;;;GAQG;AACH,MAAM,UAAU,YAAY,CAC1B,KAAyB;IAEzB,MAAM,GAAG,GACP,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;IAErE,IAAI,CAAC,GAAG;QAAE,MAAM,IAAI,aAAa,CAAC,wBAAwB,KAAK,EAAE,CAAC,CAAC;IAEnE,MAAM,IAAI,GAAG,QAAQ,CAAC,GAAG,CACvB,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CAAE,KAAa,EAC3D,eAAe,CAAC,KAAK,CACtB,CAAC;IAEF,IAAI,IAAI,EAAE,CAAC;QACT,OAAO,IAAI,CAAC;IACd,CAAC;IACD,IAAI,KAAK,YAAY,KAAK,EAAE,CAAC;QAC3B,OAAO,KAAK,CAAC,WAAW,CAAC,IAAI,CAAC;IAChC,CAAC;IACD,OAAO,KAAK,CAAC,IAAI,CAAC;AACpB,CAAC;AAED,MAAM,UAAU,aAAa,CAC3B,KAAyB,EACzB,SAAiB;IAEjB,MAAM,QAAQ,GAAG,QAAQ,CAAC,GAAG,CAC3B,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CAAE,KAAa,EAC3D,QAAQ,CAAC,GAAG,CAAC,eAAe,CAAC,MAAM,EAAE,SAAS,CAAC,CAChD,CAAC;IACF,OAAO,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC;AACzC,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,oBAAoB,CAClC,KAAyB,EACzB,GAAG,IAAc;IAEjB,OAAO,CAAC,YAAY,CAAC,KAAK,CAAC,EAAE,GAAG,IAAI,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAClD,CAAC"}
@@ -1,28 +0,0 @@
1
- import { Context } from "@decaf-ts/db-decorators";
2
- import { RamFlags } from "./types";
3
- /**
4
- * @description Context class for RAM adapter operations
5
- * @summary Provides a specialized context for RAM adapter operations, extending the base Context with RAM-specific flags. This context is used to pass operation parameters and user information.
6
- * @class RamContext
7
- * @category Ram
8
- * @example
9
- * ```typescript
10
- * // Create a new RAM context
11
- * const context = new RamContext();
12
- * // Optionally set a flag
13
- * context.set('UUID', '123e4567-e89b-12d3-a456-426614174000');
14
- * // Access a flag from the context
15
- * const uuid = context.get('UUID');
16
- * ```
17
- * @mermaid
18
- * sequenceDiagram
19
- * participant Caller
20
- * participant RamContext
21
- * participant BaseContext as Context
22
- * Caller->>RamContext: new RamContext()
23
- * RamContext->>BaseContext: super()
24
- * RamContext-->>Caller: instance
25
- */
26
- export declare class RamContext extends Context<RamFlags> {
27
- constructor();
28
- }
@@ -1,30 +0,0 @@
1
- import { Context } from "@decaf-ts/db-decorators";
2
- /**
3
- * @description Context class for RAM adapter operations
4
- * @summary Provides a specialized context for RAM adapter operations, extending the base Context with RAM-specific flags. This context is used to pass operation parameters and user information.
5
- * @class RamContext
6
- * @category Ram
7
- * @example
8
- * ```typescript
9
- * // Create a new RAM context
10
- * const context = new RamContext();
11
- * // Optionally set a flag
12
- * context.set('UUID', '123e4567-e89b-12d3-a456-426614174000');
13
- * // Access a flag from the context
14
- * const uuid = context.get('UUID');
15
- * ```
16
- * @mermaid
17
- * sequenceDiagram
18
- * participant Caller
19
- * participant RamContext
20
- * participant BaseContext as Context
21
- * Caller->>RamContext: new RamContext()
22
- * RamContext->>BaseContext: super()
23
- * RamContext-->>Caller: instance
24
- */
25
- export class RamContext extends Context {
26
- constructor() {
27
- super();
28
- }
29
- }
30
- //# sourceMappingURL=RamContext.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"RamContext.js","sourceRoot":"","sources":["../../../src/ram/RamContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAGlD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,OAAO,UAAW,SAAQ,OAAiB;IAC/C;QACE,KAAK,EAAE,CAAC;IACV,CAAC;CACF"}
@@ -1,49 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getTableName = getTableName;
4
- exports.getColumnName = getColumnName;
5
- exports.sequenceNameForModel = sequenceNameForModel;
6
- const decorator_validation_1 = require("@decaf-ts/decorator-validation");
7
- const db_decorators_1 = require("@decaf-ts/db-decorators");
8
- const constants_1 = require("./../persistence/constants.cjs");
9
- const decoration_1 = require("@decaf-ts/decoration");
10
- /**
11
- * @description Gets the table name for a model
12
- * @summary Retrieves the table name associated with a model by checking metadata or falling back to the constructor name
13
- * @template M - Type that extends Model
14
- * @param {M | Constructor<M>} model - The model instance or constructor to get the table name for
15
- * @return {string} The table name for the model
16
- * @function getTableName
17
- * @memberOf module:core
18
- */
19
- function getTableName(model) {
20
- const obj = model instanceof decorator_validation_1.Model ? decorator_validation_1.Model.get(model.constructor.name) : model;
21
- if (!obj)
22
- throw new db_decorators_1.InternalError(`Unable to find model ${model}`);
23
- const meta = decoration_1.Metadata.get(model instanceof decorator_validation_1.Model ? model.constructor : model, constants_1.PersistenceKeys.TABLE);
24
- if (meta) {
25
- return meta;
26
- }
27
- if (model instanceof decorator_validation_1.Model) {
28
- return model.constructor.name;
29
- }
30
- return model.name;
31
- }
32
- function getColumnName(model, attribute) {
33
- const metadata = decoration_1.Metadata.get(model instanceof decorator_validation_1.Model ? model.constructor : model, decoration_1.Metadata.key(constants_1.PersistenceKeys.COLUMN, attribute));
34
- return metadata ? metadata : attribute;
35
- }
36
- /**
37
- * @description Generates a sequence name for a model
38
- * @summary Creates a standardized sequence name by combining the table name with additional arguments
39
- * @template M - Type that extends Model
40
- * @param {M | Constructor<M>} model - The model instance or constructor to generate the sequence name for
41
- * @param {...string} args - Additional string arguments to append to the sequence name
42
- * @return {string} The generated sequence name
43
- * @function sequenceNameForModel
44
- * @memberOf module:core
45
- */
46
- function sequenceNameForModel(model, ...args) {
47
- return [getTableName(model), ...args].join("_");
48
- }
49
- //# sourceMappingURL=utils.js.map
@@ -1,24 +0,0 @@
1
- import { Model } from "@decaf-ts/decorator-validation";
2
- import { Constructor } from "@decaf-ts/decoration";
3
- /**
4
- * @description Gets the table name for a model
5
- * @summary Retrieves the table name associated with a model by checking metadata or falling back to the constructor name
6
- * @template M - Type that extends Model
7
- * @param {M | Constructor<M>} model - The model instance or constructor to get the table name for
8
- * @return {string} The table name for the model
9
- * @function getTableName
10
- * @memberOf module:core
11
- */
12
- export declare function getTableName<M extends Model>(model: M | Constructor<M>): string;
13
- export declare function getColumnName<M extends Model>(model: M | Constructor<M>, attribute: string): string;
14
- /**
15
- * @description Generates a sequence name for a model
16
- * @summary Creates a standardized sequence name by combining the table name with additional arguments
17
- * @template M - Type that extends Model
18
- * @param {M | Constructor<M>} model - The model instance or constructor to generate the sequence name for
19
- * @param {...string} args - Additional string arguments to append to the sequence name
20
- * @return {string} The generated sequence name
21
- * @function sequenceNameForModel
22
- * @memberOf module:core
23
- */
24
- export declare function sequenceNameForModel<M extends Model>(model: M | Constructor<M>, ...args: string[]): string;
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/identity/utils.ts"],"names":[],"mappings":";;AAcA,oCAoBC;AAED,sCASC;AAYD,oDAKC;AA9DD,yEAAuD;AACvD,2DAAwD;AACxD,8DAA2D;AAC3D,qDAA6D;AAE7D;;;;;;;;GAQG;AACH,SAAgB,YAAY,CAC1B,KAAyB;IAEzB,MAAM,GAAG,GACP,KAAK,YAAY,4BAAK,CAAC,CAAC,CAAC,4BAAK,CAAC,GAAG,CAAC,KAAK,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;IAErE,IAAI,CAAC,GAAG;QAAE,MAAM,IAAI,6BAAa,CAAC,wBAAwB,KAAK,EAAE,CAAC,CAAC;IAEnE,MAAM,IAAI,GAAG,qBAAQ,CAAC,GAAG,CACvB,KAAK,YAAY,4BAAK,CAAC,CAAC,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CAAE,KAAa,EAC3D,2BAAe,CAAC,KAAK,CACtB,CAAC;IAEF,IAAI,IAAI,EAAE,CAAC;QACT,OAAO,IAAI,CAAC;IACd,CAAC;IACD,IAAI,KAAK,YAAY,4BAAK,EAAE,CAAC;QAC3B,OAAO,KAAK,CAAC,WAAW,CAAC,IAAI,CAAC;IAChC,CAAC;IACD,OAAO,KAAK,CAAC,IAAI,CAAC;AACpB,CAAC;AAED,SAAgB,aAAa,CAC3B,KAAyB,EACzB,SAAiB;IAEjB,MAAM,QAAQ,GAAG,qBAAQ,CAAC,GAAG,CAC3B,KAAK,YAAY,4BAAK,CAAC,CAAC,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CAAE,KAAa,EAC3D,qBAAQ,CAAC,GAAG,CAAC,2BAAe,CAAC,MAAM,EAAE,SAAS,CAAC,CAChD,CAAC;IACF,OAAO,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC;AACzC,CAAC;AAED;;;;;;;;;GASG;AACH,SAAgB,oBAAoB,CAClC,KAAyB,EACzB,GAAG,IAAc;IAEjB,OAAO,CAAC,YAAY,CAAC,KAAK,CAAC,EAAE,GAAG,IAAI,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAClD,CAAC"}
@@ -1,34 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.RamContext = void 0;
4
- const db_decorators_1 = require("@decaf-ts/db-decorators");
5
- /**
6
- * @description Context class for RAM adapter operations
7
- * @summary Provides a specialized context for RAM adapter operations, extending the base Context with RAM-specific flags. This context is used to pass operation parameters and user information.
8
- * @class RamContext
9
- * @category Ram
10
- * @example
11
- * ```typescript
12
- * // Create a new RAM context
13
- * const context = new RamContext();
14
- * // Optionally set a flag
15
- * context.set('UUID', '123e4567-e89b-12d3-a456-426614174000');
16
- * // Access a flag from the context
17
- * const uuid = context.get('UUID');
18
- * ```
19
- * @mermaid
20
- * sequenceDiagram
21
- * participant Caller
22
- * participant RamContext
23
- * participant BaseContext as Context
24
- * Caller->>RamContext: new RamContext()
25
- * RamContext->>BaseContext: super()
26
- * RamContext-->>Caller: instance
27
- */
28
- class RamContext extends db_decorators_1.Context {
29
- constructor() {
30
- super();
31
- }
32
- }
33
- exports.RamContext = RamContext;
34
- //# sourceMappingURL=RamContext.js.map
@@ -1,28 +0,0 @@
1
- import { Context } from "@decaf-ts/db-decorators";
2
- import { RamFlags } from "./types";
3
- /**
4
- * @description Context class for RAM adapter operations
5
- * @summary Provides a specialized context for RAM adapter operations, extending the base Context with RAM-specific flags. This context is used to pass operation parameters and user information.
6
- * @class RamContext
7
- * @category Ram
8
- * @example
9
- * ```typescript
10
- * // Create a new RAM context
11
- * const context = new RamContext();
12
- * // Optionally set a flag
13
- * context.set('UUID', '123e4567-e89b-12d3-a456-426614174000');
14
- * // Access a flag from the context
15
- * const uuid = context.get('UUID');
16
- * ```
17
- * @mermaid
18
- * sequenceDiagram
19
- * participant Caller
20
- * participant RamContext
21
- * participant BaseContext as Context
22
- * Caller->>RamContext: new RamContext()
23
- * RamContext->>BaseContext: super()
24
- * RamContext-->>Caller: instance
25
- */
26
- export declare class RamContext extends Context<RamFlags> {
27
- constructor();
28
- }
@@ -1 +0,0 @@
1
- {"version":3,"file":"RamContext.js","sourceRoot":"","sources":["../../src/ram/RamContext.ts"],"names":[],"mappings":";;;AAAA,2DAAkD;AAGlD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAa,UAAW,SAAQ,uBAAiB;IAC/C;QACE,KAAK,EAAE,CAAC;IACV,CAAC;CACF;AAJD,gCAIC"}