@med1802/repository-manager 3.0.2 → 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.
- package/README.md +214 -247
- package/dist/core/index.d.ts +3 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/{workspace/modules → core}/index.js +1 -0
- package/dist/core/middleware.d.ts.map +1 -0
- package/dist/core/repository.d.ts +10 -0
- package/dist/core/repository.d.ts.map +1 -0
- package/dist/core/repository.js +83 -0
- package/dist/{workspace/modules/repository → core}/types.d.ts +2 -2
- package/dist/core/types.d.ts.map +1 -0
- package/dist/{workspace/infrastructure → infrastructure}/index.d.ts +1 -0
- package/dist/infrastructure/index.d.ts.map +1 -0
- package/dist/{workspace/infrastructure → infrastructure}/index.js +1 -0
- package/dist/{workspace/infrastructure → infrastructure}/logger.d.ts +2 -2
- package/dist/infrastructure/logger.d.ts.map +1 -0
- package/dist/infrastructure/observer/EventScope.d.ts +14 -0
- package/dist/infrastructure/observer/EventScope.d.ts.map +1 -0
- package/dist/infrastructure/observer/EventScope.js +38 -0
- package/dist/infrastructure/observer/index.d.ts +16 -0
- package/dist/infrastructure/observer/index.d.ts.map +1 -0
- package/dist/infrastructure/observer/index.js +52 -0
- package/dist/infrastructure/observer/types.d.ts +18 -0
- package/dist/infrastructure/observer/types.d.ts.map +1 -0
- package/dist/infrastructure/observer/types.js +1 -0
- package/dist/infrastructure/scope/index.d.ts.map +1 -0
- package/dist/infrastructure/scope/scope.d.ts.map +1 -0
- package/dist/{workspace/infrastructure → infrastructure}/scope/scope.js +3 -8
- package/dist/infrastructure/scope/types.d.ts +4 -0
- package/dist/infrastructure/scope/types.d.ts.map +1 -0
- package/dist/infrastructure/store.d.ts.map +1 -0
- package/dist/manager.d.ts +3 -5
- package/dist/manager.d.ts.map +1 -1
- package/dist/manager.js +8 -11
- package/dist/workspace/{modules/repository/createRepositoryModule.d.ts → client.d.ts} +5 -5
- package/dist/workspace/client.d.ts.map +1 -0
- package/dist/workspace/{modules/repository/createRepositoryModule.js → client.js} +7 -8
- package/dist/workspace/context.d.ts +13 -0
- package/dist/workspace/context.d.ts.map +1 -0
- package/dist/workspace/context.js +32 -0
- package/dist/workspace/index.d.ts +2 -12
- package/dist/workspace/index.d.ts.map +1 -1
- package/dist/workspace/index.js +2 -30
- package/dist/workspace/types/configuration.types.d.ts +6 -0
- package/dist/workspace/types/configuration.types.d.ts.map +1 -0
- package/dist/workspace/types/index.d.ts +3 -0
- package/dist/workspace/types/index.d.ts.map +1 -0
- package/dist/workspace/types/index.js +2 -0
- package/dist/workspace/types/observer.types.d.ts +15 -0
- package/dist/workspace/types/observer.types.d.ts.map +1 -0
- package/dist/workspace/types/observer.types.js +1 -0
- package/package.json +1 -1
- package/src/{workspace/modules → core}/index.ts +1 -0
- package/src/core/repository.ts +90 -0
- package/src/{workspace/modules/repository → core}/types.ts +2 -2
- package/src/{workspace/infrastructure → infrastructure}/index.ts +1 -0
- package/src/{workspace/infrastructure → infrastructure}/logger.ts +2 -2
- package/src/infrastructure/observer/EventScope.ts +51 -0
- package/src/infrastructure/observer/index.ts +91 -0
- package/src/infrastructure/observer/types.ts +23 -0
- package/src/{workspace/infrastructure → infrastructure}/scope/scope.ts +4 -9
- package/src/infrastructure/scope/types.ts +3 -0
- package/src/manager.ts +8 -15
- package/src/workspace/{modules/repository/createRepositoryModule.ts → client.ts} +11 -9
- package/src/workspace/context.ts +58 -0
- package/src/workspace/index.ts +2 -38
- package/src/workspace/types/configuration.types.ts +5 -0
- package/src/workspace/types/index.ts +2 -0
- package/src/workspace/types/observer.types.ts +18 -0
- package/tsconfig.tsbuildinfo +1 -1
- package/dist/workspace/infrastructure/index.d.ts.map +0 -1
- package/dist/workspace/infrastructure/logger.d.ts.map +0 -1
- package/dist/workspace/infrastructure/scope/index.d.ts.map +0 -1
- package/dist/workspace/infrastructure/scope/scope.d.ts.map +0 -1
- package/dist/workspace/infrastructure/scope/types.d.ts +0 -8
- package/dist/workspace/infrastructure/scope/types.d.ts.map +0 -1
- package/dist/workspace/infrastructure/store.d.ts.map +0 -1
- package/dist/workspace/modules/index.d.ts +0 -2
- package/dist/workspace/modules/index.d.ts.map +0 -1
- package/dist/workspace/modules/repository/createRepositoryModule.d.ts.map +0 -1
- package/dist/workspace/modules/repository/index.d.ts +0 -3
- package/dist/workspace/modules/repository/index.d.ts.map +0 -1
- package/dist/workspace/modules/repository/index.js +0 -2
- package/dist/workspace/modules/repository/middleware.d.ts.map +0 -1
- package/dist/workspace/modules/repository/repositoryAccessor.d.ts +0 -9
- package/dist/workspace/modules/repository/repositoryAccessor.d.ts.map +0 -1
- package/dist/workspace/modules/repository/repositoryAccessor.js +0 -42
- package/dist/workspace/modules/repository/types.d.ts.map +0 -1
- package/dist/workspace/providers/index.d.ts +0 -5
- package/dist/workspace/providers/index.d.ts.map +0 -1
- package/dist/workspace/providers/index.js +0 -3
- package/dist/workspace/types.d.ts +0 -5
- package/dist/workspace/types.d.ts.map +0 -1
- package/src/workspace/infrastructure/scope/types.ts +0 -8
- package/src/workspace/modules/repository/index.ts +0 -2
- package/src/workspace/modules/repository/repositoryAccessor.ts +0 -48
- package/src/workspace/providers/index.ts +0 -5
- package/src/workspace/types.ts +0 -4
- /package/dist/{workspace/modules/repository → core}/middleware.d.ts +0 -0
- /package/dist/{workspace/modules/repository → core}/middleware.js +0 -0
- /package/dist/{workspace/infrastructure/scope → core}/types.js +0 -0
- /package/dist/{workspace/infrastructure → infrastructure}/logger.js +0 -0
- /package/dist/{workspace/infrastructure → infrastructure}/scope/index.d.ts +0 -0
- /package/dist/{workspace/infrastructure → infrastructure}/scope/index.js +0 -0
- /package/dist/{workspace/infrastructure → infrastructure}/scope/scope.d.ts +0 -0
- /package/dist/{workspace/modules/repository → infrastructure/scope}/types.js +0 -0
- /package/dist/{workspace/infrastructure → infrastructure}/store.d.ts +0 -0
- /package/dist/{workspace/infrastructure → infrastructure}/store.js +0 -0
- /package/dist/workspace/{types.js → types/configuration.types.js} +0 -0
- /package/src/{workspace/modules/repository → core}/middleware.ts +0 -0
- /package/src/{workspace/infrastructure → infrastructure}/scope/index.ts +0 -0
- /package/src/{workspace/infrastructure → infrastructure}/store.ts +0 -0
|
@@ -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 +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 +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 +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,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 };
|
package/src/workspace/types.ts
DELETED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|