@med1802/repository-manager 3.0.1 → 3.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (111) hide show
  1. package/README.md +214 -255
  2. package/dist/core/index.d.ts +3 -0
  3. package/dist/core/index.d.ts.map +1 -0
  4. package/dist/{workspace/modules → core}/index.js +1 -0
  5. package/dist/core/middleware.d.ts.map +1 -0
  6. package/dist/core/repository.d.ts +10 -0
  7. package/dist/core/repository.d.ts.map +1 -0
  8. package/dist/core/repository.js +83 -0
  9. package/dist/{workspace/modules/repository → core}/types.d.ts +2 -2
  10. package/dist/core/types.d.ts.map +1 -0
  11. package/dist/{workspace/infrastructure → infrastructure}/index.d.ts +1 -0
  12. package/dist/infrastructure/index.d.ts.map +1 -0
  13. package/dist/{workspace/infrastructure → infrastructure}/index.js +1 -0
  14. package/dist/{workspace/infrastructure → infrastructure}/logger.d.ts +2 -2
  15. package/dist/infrastructure/logger.d.ts.map +1 -0
  16. package/dist/infrastructure/observer/EventScope.d.ts +14 -0
  17. package/dist/infrastructure/observer/EventScope.d.ts.map +1 -0
  18. package/dist/infrastructure/observer/EventScope.js +38 -0
  19. package/dist/infrastructure/observer/index.d.ts +16 -0
  20. package/dist/infrastructure/observer/index.d.ts.map +1 -0
  21. package/dist/infrastructure/observer/index.js +52 -0
  22. package/dist/infrastructure/observer/types.d.ts +18 -0
  23. package/dist/infrastructure/observer/types.d.ts.map +1 -0
  24. package/dist/infrastructure/observer/types.js +1 -0
  25. package/dist/infrastructure/scope/index.d.ts.map +1 -0
  26. package/dist/infrastructure/scope/scope.d.ts.map +1 -0
  27. package/dist/{workspace/infrastructure → infrastructure}/scope/scope.js +3 -8
  28. package/dist/infrastructure/scope/types.d.ts +4 -0
  29. package/dist/infrastructure/scope/types.d.ts.map +1 -0
  30. package/dist/infrastructure/store.d.ts.map +1 -0
  31. package/dist/manager.d.ts +3 -5
  32. package/dist/manager.d.ts.map +1 -1
  33. package/dist/manager.js +8 -11
  34. package/dist/workspace/{modules/repository/createRepositoryModule.d.ts → client.d.ts} +5 -5
  35. package/dist/workspace/client.d.ts.map +1 -0
  36. package/dist/workspace/{modules/repository/createRepositoryModule.js → client.js} +7 -8
  37. package/dist/workspace/context.d.ts +13 -0
  38. package/dist/workspace/context.d.ts.map +1 -0
  39. package/dist/workspace/context.js +32 -0
  40. package/dist/workspace/index.d.ts +2 -12
  41. package/dist/workspace/index.d.ts.map +1 -1
  42. package/dist/workspace/index.js +2 -30
  43. package/dist/workspace/types/configuration.types.d.ts +6 -0
  44. package/dist/workspace/types/configuration.types.d.ts.map +1 -0
  45. package/dist/workspace/types/index.d.ts +3 -0
  46. package/dist/workspace/types/index.d.ts.map +1 -0
  47. package/dist/workspace/types/index.js +2 -0
  48. package/dist/workspace/types/observer.types.d.ts +15 -0
  49. package/dist/workspace/types/observer.types.d.ts.map +1 -0
  50. package/dist/workspace/types/observer.types.js +1 -0
  51. package/package.json +1 -1
  52. package/src/{workspace/modules → core}/index.ts +1 -0
  53. package/src/core/repository.ts +90 -0
  54. package/src/{workspace/modules/repository → core}/types.ts +2 -2
  55. package/src/{workspace/infrastructure → infrastructure}/index.ts +1 -0
  56. package/src/{workspace/infrastructure → infrastructure}/logger.ts +2 -2
  57. package/src/infrastructure/observer/EventScope.ts +51 -0
  58. package/src/infrastructure/observer/index.ts +91 -0
  59. package/src/infrastructure/observer/types.ts +23 -0
  60. package/src/{workspace/infrastructure → infrastructure}/scope/scope.ts +4 -9
  61. package/src/infrastructure/scope/types.ts +3 -0
  62. package/src/manager.ts +8 -15
  63. package/src/workspace/{modules/repository/createRepositoryModule.ts → client.ts} +11 -9
  64. package/src/workspace/context.ts +58 -0
  65. package/src/workspace/index.ts +2 -38
  66. package/src/workspace/types/configuration.types.ts +5 -0
  67. package/src/workspace/types/index.ts +2 -0
  68. package/src/workspace/types/observer.types.ts +18 -0
  69. package/tsconfig.tsbuildinfo +1 -1
  70. package/dist/workspace/infrastructure/index.d.ts.map +0 -1
  71. package/dist/workspace/infrastructure/logger.d.ts.map +0 -1
  72. package/dist/workspace/infrastructure/scope/index.d.ts.map +0 -1
  73. package/dist/workspace/infrastructure/scope/scope.d.ts.map +0 -1
  74. package/dist/workspace/infrastructure/scope/types.d.ts +0 -8
  75. package/dist/workspace/infrastructure/scope/types.d.ts.map +0 -1
  76. package/dist/workspace/infrastructure/store.d.ts.map +0 -1
  77. package/dist/workspace/modules/index.d.ts +0 -2
  78. package/dist/workspace/modules/index.d.ts.map +0 -1
  79. package/dist/workspace/modules/repository/createRepositoryModule.d.ts.map +0 -1
  80. package/dist/workspace/modules/repository/index.d.ts +0 -3
  81. package/dist/workspace/modules/repository/index.d.ts.map +0 -1
  82. package/dist/workspace/modules/repository/index.js +0 -2
  83. package/dist/workspace/modules/repository/middleware.d.ts.map +0 -1
  84. package/dist/workspace/modules/repository/repositoryAccessor.d.ts +0 -9
  85. package/dist/workspace/modules/repository/repositoryAccessor.d.ts.map +0 -1
  86. package/dist/workspace/modules/repository/repositoryAccessor.js +0 -42
  87. package/dist/workspace/modules/repository/types.d.ts.map +0 -1
  88. package/dist/workspace/providers/index.d.ts +0 -5
  89. package/dist/workspace/providers/index.d.ts.map +0 -1
  90. package/dist/workspace/providers/index.js +0 -3
  91. package/dist/workspace/types.d.ts +0 -5
  92. package/dist/workspace/types.d.ts.map +0 -1
  93. package/src/workspace/infrastructure/scope/types.ts +0 -8
  94. package/src/workspace/modules/repository/index.ts +0 -2
  95. package/src/workspace/modules/repository/repositoryAccessor.ts +0 -48
  96. package/src/workspace/providers/index.ts +0 -5
  97. package/src/workspace/types.ts +0 -4
  98. /package/dist/{workspace/modules/repository → core}/middleware.d.ts +0 -0
  99. /package/dist/{workspace/modules/repository → core}/middleware.js +0 -0
  100. /package/dist/{workspace/infrastructure/scope → core}/types.js +0 -0
  101. /package/dist/{workspace/infrastructure → infrastructure}/logger.js +0 -0
  102. /package/dist/{workspace/infrastructure → infrastructure}/scope/index.d.ts +0 -0
  103. /package/dist/{workspace/infrastructure → infrastructure}/scope/index.js +0 -0
  104. /package/dist/{workspace/infrastructure → infrastructure}/scope/scope.d.ts +0 -0
  105. /package/dist/{workspace/modules/repository → infrastructure/scope}/types.js +0 -0
  106. /package/dist/{workspace/infrastructure → infrastructure}/store.d.ts +0 -0
  107. /package/dist/{workspace/infrastructure → infrastructure}/store.js +0 -0
  108. /package/dist/workspace/{types.js → types/configuration.types.js} +0 -0
  109. /package/src/{workspace/modules/repository → core}/middleware.ts +0 -0
  110. /package/src/{workspace/infrastructure → infrastructure}/scope/index.ts +0 -0
  111. /package/src/{workspace/infrastructure → infrastructure}/store.ts +0 -0
@@ -1,3 +0,0 @@
1
- export * from "./createRepositoryModule";
2
- export * from "./types";
3
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/workspace/modules/repository/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC;AACzC,cAAc,SAAS,CAAC"}
@@ -1,2 +0,0 @@
1
- export * from "./createRepositoryModule";
2
- export * from "./types";
@@ -1 +0,0 @@
1
- {"version":3,"file":"middleware.d.ts","sourceRoot":"","sources":["../../../../src/workspace/modules/repository/middleware.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAE1C,wBAAgB,eAAe,CAAC,UAAU,EAAE,GAAG,EAAE,WAAW,EAAE,UAAU,EAAE,OAkCzE"}
@@ -1,9 +0,0 @@
1
- import type { IRepositoryPlugin } from "./types";
2
- declare function createRepositoryAccessor<I>(infrastructure: I, repositoryPlugin: IRepositoryPlugin<I, any>): {
3
- readonly repository: unknown;
4
- readonly connections: number;
5
- connect(): void;
6
- disconnect(): void;
7
- };
8
- export { createRepositoryAccessor };
9
- //# sourceMappingURL=repositoryAccessor.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"repositoryAccessor.d.ts","sourceRoot":"","sources":["../../../../src/workspace/modules/repository/repositoryAccessor.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAEjD,iBAAS,wBAAwB,CAAC,CAAC,EACjC,cAAc,EAAE,CAAC,EACjB,gBAAgB,EAAE,iBAAiB,CAAC,CAAC,EAAE,GAAG,CAAC;;;;;EAuC5C;AAED,OAAO,EAAE,wBAAwB,EAAE,CAAC"}
@@ -1,42 +0,0 @@
1
- import { useScope } from "../../infrastructure";
2
- import { applyMiddleware } from "./middleware";
3
- function createRepositoryAccessor(infrastructure, repositoryPlugin) {
4
- const { install, middlewares, onConnect, onDisconnect } = repositoryPlugin;
5
- let repository = undefined;
6
- let connections = 0;
7
- const obj = {
8
- get repository() {
9
- return repository;
10
- },
11
- get connections() {
12
- return connections;
13
- },
14
- connect() {
15
- if (connections === 0) {
16
- const rawRepository = install({
17
- instance: { infrastructure, useScope },
18
- });
19
- repository = middlewares
20
- ? applyMiddleware(rawRepository, middlewares)
21
- : rawRepository;
22
- if (onConnect) {
23
- onConnect();
24
- }
25
- }
26
- connections += 1;
27
- },
28
- disconnect() {
29
- if (connections === 0)
30
- return;
31
- connections -= 1;
32
- if (connections === 0) {
33
- repository = undefined;
34
- if (onDisconnect) {
35
- onDisconnect();
36
- }
37
- }
38
- },
39
- };
40
- return obj;
41
- }
42
- export { createRepositoryAccessor };
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/workspace/modules/repository/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAE3D,MAAM,MAAM,cAAc,CAAC,CAAC,GAAG,GAAG,EAAE,CAAC,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE;IACnD,QAAQ,EAAE;QACR,cAAc,EAAE,CAAC,CAAC;QAClB,QAAQ,EAAE,OAAO,QAAQ,CAAC;KAC3B,CAAC;CACH,KAAK,CAAC,CAAC;AAER,MAAM,WAAW,iBAAiB,CAAC,CAAC,GAAG,GAAG,EAAE,CAAC,GAAG,GAAG;IACjD,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,cAAc,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAC9B,WAAW,CAAC,EAAE,UAAU,EAAE,CAAC;IAC3B,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IACvB,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;CAC3B;AAED,MAAM,WAAW,mBAAmB,CAAC,CAAC,GAAG,GAAG;IAC1C,OAAO,IAAI,IAAI,CAAC;IAChB,UAAU,IAAI,IAAI,CAAC;IACnB,UAAU,EAAE,UAAU,CAAC,cAAc,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC;IAC3D,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,MAAM,UAAU,GAAG,CACvB,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,GAAG,EAAE,EACX,IAAI,EAAE,CAAC,GAAG,QAAQ,EAAE,GAAG,EAAE,KAAK,GAAG,KAC9B,GAAG,CAAC"}
@@ -1,5 +0,0 @@
1
- declare const repositoryScope: import("../infrastructure/scope").IScope<any> & {
2
- currentValue: any;
3
- };
4
- export { repositoryScope };
5
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/workspace/providers/index.ts"],"names":[],"mappings":"AAEA,QAAA,MAAM,eAAe;;CAA8B,CAAC;AAEpD,OAAO,EAAE,eAAe,EAAE,CAAC"}
@@ -1,3 +0,0 @@
1
- import { createScope } from "../infrastructure";
2
- const repositoryScope = createScope(undefined);
3
- export { repositoryScope };
@@ -1,5 +0,0 @@
1
- export interface IConfiguration {
2
- id: string;
3
- logging?: boolean;
4
- }
5
- //# sourceMappingURL=types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/workspace/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB"}
@@ -1,8 +0,0 @@
1
- export interface IScope<V = any> {
2
- provider(options: IScopeProviderOptions<V>): void;
3
- }
4
-
5
- export interface IScopeProviderOptions<V = any> {
6
- value: V;
7
- children: () => void;
8
- }
@@ -1,2 +0,0 @@
1
- export * from "./createRepositoryModule";
2
- export * from "./types";
@@ -1,48 +0,0 @@
1
- import { useScope } from "../../infrastructure";
2
- import { applyMiddleware } from "./middleware";
3
- import type { IRepositoryPlugin } from "./types";
4
-
5
- function createRepositoryAccessor<I>(
6
- infrastructure: I,
7
- repositoryPlugin: IRepositoryPlugin<I, any>
8
- ) {
9
- const { install, middlewares, onConnect, onDisconnect } = repositoryPlugin;
10
- let repository = undefined as unknown;
11
- let connections = 0;
12
- const obj = {
13
- get repository() {
14
- return repository;
15
- },
16
- get connections() {
17
- return connections;
18
- },
19
- connect() {
20
- if (connections === 0) {
21
- const rawRepository = install({
22
- instance: { infrastructure, useScope },
23
- });
24
- repository = middlewares
25
- ? applyMiddleware(rawRepository, middlewares)
26
- : rawRepository;
27
- if (onConnect) {
28
- onConnect();
29
- }
30
- }
31
- connections += 1;
32
- },
33
- disconnect() {
34
- if (connections === 0) return;
35
- connections -= 1;
36
- if (connections === 0) {
37
- repository = undefined;
38
- if (onDisconnect) {
39
- onDisconnect();
40
- }
41
- }
42
- },
43
- };
44
-
45
- return obj;
46
- }
47
-
48
- export { createRepositoryAccessor };
@@ -1,5 +0,0 @@
1
- import { createScope } from "../infrastructure";
2
-
3
- const repositoryScope = createScope<any>(undefined);
4
-
5
- export { repositoryScope };
@@ -1,4 +0,0 @@
1
- export interface IConfiguration {
2
- id: string;
3
- logging?: boolean;
4
- }