@digitaldefiance/node-express-suite 4.23.4 → 4.23.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -6
- package/package.json +4 -4
- package/src/container/service-container.d.ts +39 -13
- package/src/container/service-container.d.ts.map +1 -1
- package/src/container/service-container.js +16 -17
- package/src/container/service-container.js.map +1 -1
- package/src/container/service-definitions.d.ts +24 -2
- package/src/container/service-definitions.d.ts.map +1 -1
- package/src/container/service-definitions.js +2 -2
- package/src/container/service-definitions.js.map +1 -1
- package/src/registry/index.d.ts +0 -1
- package/src/registry/index.d.ts.map +1 -1
- package/src/registry/index.js +1 -3
- package/src/registry/index.js.map +1 -1
- package/src/registry/email-service-registry.d.ts +0 -49
- package/src/registry/email-service-registry.d.ts.map +0 -1
- package/src/registry/email-service-registry.js +0 -64
- package/src/registry/email-service-registry.js.map +0 -1
package/README.md
CHANGED
|
@@ -118,15 +118,15 @@ yarn add @digitaldefiance/node-express-suite
|
|
|
118
118
|
### Basic Server Setup (Database-Agnostic)
|
|
119
119
|
|
|
120
120
|
```typescript
|
|
121
|
-
import { Application,
|
|
121
|
+
import { Application, ServiceKeys } from '@digitaldefiance/node-express-suite';
|
|
122
122
|
import { LanguageCodes } from '@digitaldefiance/i18n-lib';
|
|
123
123
|
import { EmailService } from './services/email'; // Your concrete implementation
|
|
124
124
|
|
|
125
125
|
// Create application instance
|
|
126
126
|
const app = new Application(environment, apiRouterFactory);
|
|
127
127
|
|
|
128
|
-
//
|
|
129
|
-
|
|
128
|
+
// Register email service (required before using middleware)
|
|
129
|
+
app.services.register(ServiceKeys.EMAIL, () => new EmailService(app));
|
|
130
130
|
|
|
131
131
|
// Start server
|
|
132
132
|
await app.start();
|
|
@@ -312,7 +312,7 @@ if (result.success) {
|
|
|
312
312
|
Before using middleware that requires email functionality, configure the email service:
|
|
313
313
|
|
|
314
314
|
```typescript
|
|
315
|
-
import {
|
|
315
|
+
import { ServiceKeys, IEmailService } from '@digitaldefiance/node-express-suite';
|
|
316
316
|
|
|
317
317
|
// Implement the IEmailService interface
|
|
318
318
|
class MyEmailService implements IEmailService {
|
|
@@ -321,8 +321,8 @@ class MyEmailService implements IEmailService {
|
|
|
321
321
|
}
|
|
322
322
|
}
|
|
323
323
|
|
|
324
|
-
// Register at application startup
|
|
325
|
-
|
|
324
|
+
// Register at application startup via the ServiceContainer
|
|
325
|
+
app.services.register(ServiceKeys.EMAIL, () => new MyEmailService());
|
|
326
326
|
```
|
|
327
327
|
|
|
328
328
|
#### Authentication Middleware
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@digitaldefiance/node-express-suite",
|
|
3
|
-
"version": "4.23.
|
|
3
|
+
"version": "4.23.6",
|
|
4
4
|
"homepage": "https://github.com/Digital-Defiance/node-express-suite",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -39,11 +39,11 @@
|
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
41
|
"@digitaldefiance/branded-interface": "^0.0.5",
|
|
42
|
-
"@digitaldefiance/ecies-lib": "4.
|
|
42
|
+
"@digitaldefiance/ecies-lib": "4.23.1",
|
|
43
43
|
"@digitaldefiance/i18n-lib": "4.6.4",
|
|
44
|
-
"@digitaldefiance/node-ecies-lib": "4.23.
|
|
44
|
+
"@digitaldefiance/node-ecies-lib": "4.23.2",
|
|
45
45
|
"@digitaldefiance/reed-solomon-erasure.wasm": "^1.0.2",
|
|
46
|
-
"@digitaldefiance/suite-core-lib": "4.
|
|
46
|
+
"@digitaldefiance/suite-core-lib": "4.23.1",
|
|
47
47
|
"@noble/curves": "^1.9.0",
|
|
48
48
|
"@noble/hashes": "^1.8.0",
|
|
49
49
|
"argon2": "^0.40.1",
|
|
@@ -1,40 +1,66 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @fileoverview Service container for dependency injection.
|
|
3
3
|
* Manages service registration and lifecycle with singleton support.
|
|
4
|
+
* Type-safe for well-known service keys defined in ServiceMap.
|
|
4
5
|
* @module container/service-container
|
|
5
6
|
*/
|
|
7
|
+
import type { ServiceMap } from './service-definitions';
|
|
6
8
|
/**
|
|
7
9
|
* Factory function for creating service instances.
|
|
8
10
|
* @template T - Service type
|
|
9
11
|
*/
|
|
10
|
-
export type ServiceFactory<T
|
|
12
|
+
export type ServiceFactory<T> = () => T;
|
|
11
13
|
/**
|
|
12
|
-
*
|
|
14
|
+
* Type-safe service container for dependency injection.
|
|
15
|
+
*
|
|
16
|
+
* Well-known keys from {@link ServiceMap} are type-checked at compile time.
|
|
17
|
+
* Ad-hoc string keys still work via explicit generic parameters.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```typescript
|
|
21
|
+
* // Type-safe: returns IEmailService automatically
|
|
22
|
+
* container.get(ServiceKeys.EMAIL);
|
|
23
|
+
*
|
|
24
|
+
* // Ad-hoc: explicit generic needed
|
|
25
|
+
* container.get<MyService>('myCustomService');
|
|
26
|
+
* ```
|
|
13
27
|
*/
|
|
14
28
|
export declare class ServiceContainer {
|
|
15
29
|
private services;
|
|
16
30
|
private instances;
|
|
17
31
|
private singletons;
|
|
18
32
|
/**
|
|
19
|
-
* Registers a service with the container.
|
|
20
|
-
* @
|
|
21
|
-
* @param
|
|
22
|
-
* @param
|
|
23
|
-
|
|
33
|
+
* Registers a service with the container using a well-known key.
|
|
34
|
+
* @param key - A key from ServiceMap
|
|
35
|
+
* @param factory - Factory function to create service
|
|
36
|
+
* @param singleton - Whether to cache as singleton (default: true)
|
|
37
|
+
*/
|
|
38
|
+
register<K extends keyof ServiceMap>(key: K, factory: ServiceFactory<ServiceMap[K]>, singleton?: boolean): void;
|
|
39
|
+
/**
|
|
40
|
+
* Registers a service with the container using an ad-hoc string key.
|
|
41
|
+
* @param key - Service identifier
|
|
42
|
+
* @param factory - Factory function to create service
|
|
43
|
+
* @param singleton - Whether to cache as singleton (default: true)
|
|
24
44
|
*/
|
|
25
45
|
register<T>(key: string, factory: ServiceFactory<T>, singleton?: boolean): void;
|
|
26
46
|
/**
|
|
27
|
-
* Retrieves a service from the container.
|
|
28
|
-
* @
|
|
29
|
-
* @
|
|
30
|
-
* @
|
|
47
|
+
* Retrieves a service from the container using a well-known key.
|
|
48
|
+
* @param key - A key from ServiceMap
|
|
49
|
+
* @returns Service instance with the correct type
|
|
50
|
+
* @throws {TranslatableSuiteError} If service is not registered
|
|
51
|
+
*/
|
|
52
|
+
get<K extends keyof ServiceMap>(key: K): ServiceMap[K];
|
|
53
|
+
/**
|
|
54
|
+
* Retrieves a service from the container using an ad-hoc string key.
|
|
55
|
+
* @param key - Service identifier
|
|
56
|
+
* @returns Service instance
|
|
31
57
|
* @throws {TranslatableSuiteError} If service is not registered
|
|
32
58
|
*/
|
|
33
59
|
get<T>(key: string): T;
|
|
34
60
|
/**
|
|
35
61
|
* Checks if a service is registered.
|
|
36
|
-
* @param
|
|
37
|
-
* @returns
|
|
62
|
+
* @param key - Service identifier
|
|
63
|
+
* @returns True if service exists
|
|
38
64
|
*/
|
|
39
65
|
has(key: string): boolean;
|
|
40
66
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service-container.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-node-express-suite/src/container/service-container.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"service-container.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-node-express-suite/src/container/service-container.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAExD;;;GAGG;AACH,MAAM,MAAM,cAAc,CAAC,CAAC,IAAI,MAAM,CAAC,CAAC;AAExC;;;;;;;;;;;;;;GAcG;AACH,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,QAAQ,CAA8C;IAC9D,OAAO,CAAC,SAAS,CAA8B;IAC/C,OAAO,CAAC,UAAU,CAAqB;IAEvC;;;;;OAKG;IACH,QAAQ,CAAC,CAAC,SAAS,MAAM,UAAU,EACjC,GAAG,EAAE,CAAC,EACN,OAAO,EAAE,cAAc,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,EACtC,SAAS,CAAC,EAAE,OAAO,GAClB,IAAI;IACP;;;;;OAKG;IACH,QAAQ,CAAC,CAAC,EACR,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,cAAc,CAAC,CAAC,CAAC,EAC1B,SAAS,CAAC,EAAE,OAAO,GAClB,IAAI;IAYP;;;;;OAKG;IACH,GAAG,CAAC,CAAC,SAAS,MAAM,UAAU,EAAE,GAAG,EAAE,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC;IACtD;;;;;OAKG;IACH,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,GAAG,CAAC;IAwBtB;;;;OAIG;IACH,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO;IAIzB;;OAEG;IACH,KAAK,IAAI,IAAI;CAGd"}
|
|
@@ -2,38 +2,37 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* @fileoverview Service container for dependency injection.
|
|
4
4
|
* Manages service registration and lifecycle with singleton support.
|
|
5
|
+
* Type-safe for well-known service keys defined in ServiceMap.
|
|
5
6
|
* @module container/service-container
|
|
6
7
|
*/
|
|
7
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
9
|
exports.ServiceContainer = void 0;
|
|
9
10
|
const suite_core_lib_1 = require("@digitaldefiance/suite-core-lib");
|
|
10
11
|
/**
|
|
11
|
-
*
|
|
12
|
+
* Type-safe service container for dependency injection.
|
|
13
|
+
*
|
|
14
|
+
* Well-known keys from {@link ServiceMap} are type-checked at compile time.
|
|
15
|
+
* Ad-hoc string keys still work via explicit generic parameters.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```typescript
|
|
19
|
+
* // Type-safe: returns IEmailService automatically
|
|
20
|
+
* container.get(ServiceKeys.EMAIL);
|
|
21
|
+
*
|
|
22
|
+
* // Ad-hoc: explicit generic needed
|
|
23
|
+
* container.get<MyService>('myCustomService');
|
|
24
|
+
* ```
|
|
12
25
|
*/
|
|
13
26
|
class ServiceContainer {
|
|
14
27
|
services = new Map();
|
|
15
28
|
instances = new Map();
|
|
16
29
|
singletons = new Set();
|
|
17
|
-
/**
|
|
18
|
-
* Registers a service with the container.
|
|
19
|
-
* @template T - Service type
|
|
20
|
-
* @param {string} key - Service identifier
|
|
21
|
-
* @param {ServiceFactory<T>} factory - Factory function to create service
|
|
22
|
-
* @param {boolean} [singleton=true] - Whether to cache as singleton
|
|
23
|
-
*/
|
|
24
30
|
register(key, factory, singleton = true) {
|
|
25
31
|
this.services.set(key, factory);
|
|
26
32
|
if (singleton) {
|
|
27
33
|
this.singletons.add(key);
|
|
28
34
|
}
|
|
29
35
|
}
|
|
30
|
-
/**
|
|
31
|
-
* Retrieves a service from the container.
|
|
32
|
-
* @template T - Service type
|
|
33
|
-
* @param {string} key - Service identifier
|
|
34
|
-
* @returns {T} Service instance
|
|
35
|
-
* @throws {TranslatableSuiteError} If service is not registered
|
|
36
|
-
*/
|
|
37
36
|
get(key) {
|
|
38
37
|
if (this.singletons.has(key)) {
|
|
39
38
|
if (!this.instances.has(key)) {
|
|
@@ -51,8 +50,8 @@ class ServiceContainer {
|
|
|
51
50
|
}
|
|
52
51
|
/**
|
|
53
52
|
* Checks if a service is registered.
|
|
54
|
-
* @param
|
|
55
|
-
* @returns
|
|
53
|
+
* @param key - Service identifier
|
|
54
|
+
* @returns True if service exists
|
|
56
55
|
*/
|
|
57
56
|
has(key) {
|
|
58
57
|
return this.services.has(key);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service-container.js","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-node-express-suite/src/container/service-container.ts"],"names":[],"mappings":";AAAA
|
|
1
|
+
{"version":3,"file":"service-container.js","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-node-express-suite/src/container/service-container.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEH,oEAGyC;AASzC;;;;;;;;;;;;;;GAcG;AACH,MAAa,gBAAgB;IACnB,QAAQ,GAAG,IAAI,GAAG,EAAmC,CAAC;IACtD,SAAS,GAAG,IAAI,GAAG,EAAmB,CAAC;IACvC,UAAU,GAAG,IAAI,GAAG,EAAU,CAAC;IAwBvC,QAAQ,CACN,GAAW,EACX,OAAgC,EAChC,SAAS,GAAG,IAAI;QAEhB,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;QAChC,IAAI,SAAS,EAAE,CAAC;YACd,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAC3B,CAAC;IACH,CAAC;IAgBD,GAAG,CAAC,GAAW;QACb,IAAI,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;YAC7B,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;gBAC7B,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;gBACvC,IAAI,CAAC,OAAO;oBACV,MAAM,IAAI,uCAAsB,CAC9B,mCAAkB,CAAC,oCAAoC,EACvD,EAAE,GAAG,EAAE,CACR,CAAC;gBACJ,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,EAAE,OAAO,EAAE,CAAC,CAAC;YACrC,CAAC;YACD,OAAO,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QACjC,CAAC;QAED,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QACvC,IAAI,CAAC,OAAO;YACV,MAAM,IAAI,uCAAsB,CAC9B,mCAAkB,CAAC,oCAAoC,EACvD,EAAE,GAAG,EAAE,CACR,CAAC;QACJ,OAAO,OAAO,EAAE,CAAC;IACnB,CAAC;IAED;;;;OAIG;IACH,GAAG,CAAC,GAAW;QACb,OAAO,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAChC,CAAC;IAED;;OAEG;IACH,KAAK;QACH,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,CAAC;IACzB,CAAC;CACF;AA1FD,4CA0FC"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @fileoverview Service key definitions for dependency injection.
|
|
3
|
-
* Defines constants for service registration keys.
|
|
2
|
+
* @fileoverview Service key definitions and type map for dependency injection.
|
|
3
|
+
* Defines constants for service registration keys and maps them to their types.
|
|
4
4
|
* @module container/service-definitions
|
|
5
5
|
*/
|
|
6
|
+
import type { IEmailService } from '../interfaces/email-service';
|
|
6
7
|
/**
|
|
7
8
|
* Service registration keys.
|
|
8
9
|
*/
|
|
@@ -19,4 +20,25 @@ export declare const ServiceKeys: {
|
|
|
19
20
|
* Union type of all service keys.
|
|
20
21
|
*/
|
|
21
22
|
export type ServiceKey = (typeof ServiceKeys)[keyof typeof ServiceKeys];
|
|
23
|
+
/**
|
|
24
|
+
* Maps well-known service keys to their expected types.
|
|
25
|
+
* Extend this interface to add type-safe service registrations.
|
|
26
|
+
*
|
|
27
|
+
* Services not listed here can still be registered using string keys
|
|
28
|
+
* with explicit type parameters.
|
|
29
|
+
*
|
|
30
|
+
* Note: JWT, ROLE, USER, BACKUP_CODE, and ECIES are typed loosely here
|
|
31
|
+
* because their concrete types are generic and defined in downstream packages
|
|
32
|
+
* (e.g. node-express-suite-mongo). Downstream consumers get the correct types
|
|
33
|
+
* via the generic parameter on `get<T>()`.
|
|
34
|
+
*/
|
|
35
|
+
export interface ServiceMap {
|
|
36
|
+
[ServiceKeys.EMAIL]: IEmailService;
|
|
37
|
+
[ServiceKeys.JWT]: unknown;
|
|
38
|
+
[ServiceKeys.ECIES]: unknown;
|
|
39
|
+
[ServiceKeys.KEY_WRAPPING]: unknown;
|
|
40
|
+
[ServiceKeys.ROLE]: unknown;
|
|
41
|
+
[ServiceKeys.USER]: unknown;
|
|
42
|
+
[ServiceKeys.BACKUP_CODE]: unknown;
|
|
43
|
+
}
|
|
22
44
|
//# sourceMappingURL=service-definitions.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service-definitions.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-node-express-suite/src/container/service-definitions.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;GAEG;AACH,eAAO,MAAM,WAAW;;;;;;;;CAQd,CAAC;AAEX;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,CAAC,OAAO,WAAW,CAAC,CAAC,MAAM,OAAO,WAAW,CAAC,CAAC"}
|
|
1
|
+
{"version":3,"file":"service-definitions.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-node-express-suite/src/container/service-definitions.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAEjE;;GAEG;AACH,eAAO,MAAM,WAAW;;;;;;;;CAQd,CAAC;AAEX;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,CAAC,OAAO,WAAW,CAAC,CAAC,MAAM,OAAO,WAAW,CAAC,CAAC;AAExE;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,UAAU;IACzB,CAAC,WAAW,CAAC,KAAK,CAAC,EAAE,aAAa,CAAC;IACnC,CAAC,WAAW,CAAC,GAAG,CAAC,EAAE,OAAO,CAAC;IAC3B,CAAC,WAAW,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC;IAC7B,CAAC,WAAW,CAAC,YAAY,CAAC,EAAE,OAAO,CAAC;IACpC,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC;IAC5B,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC;IAC5B,CAAC,WAAW,CAAC,WAAW,CAAC,EAAE,OAAO,CAAC;CACpC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/**
|
|
3
|
-
* @fileoverview Service key definitions for dependency injection.
|
|
4
|
-
* Defines constants for service registration keys.
|
|
3
|
+
* @fileoverview Service key definitions and type map for dependency injection.
|
|
4
|
+
* Defines constants for service registration keys and maps them to their types.
|
|
5
5
|
* @module container/service-definitions
|
|
6
6
|
*/
|
|
7
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service-definitions.js","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-node-express-suite/src/container/service-definitions.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;
|
|
1
|
+
{"version":3,"file":"service-definitions.js","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-node-express-suite/src/container/service-definitions.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAIH;;GAEG;AACU,QAAA,WAAW,GAAG;IACzB,GAAG,EAAE,KAAK;IACV,KAAK,EAAE,OAAO;IACd,KAAK,EAAE,OAAO;IACd,YAAY,EAAE,aAAa;IAC3B,IAAI,EAAE,MAAM;IACZ,IAAI,EAAE,MAAM;IACZ,WAAW,EAAE,YAAY;CACjB,CAAC"}
|
package/src/registry/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-node-express-suite/src/registry/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-node-express-suite/src/registry/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,YAAY,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC"}
|
package/src/registry/index.js
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ControllerRegistry =
|
|
4
|
-
var email_service_registry_1 = require("./email-service-registry");
|
|
5
|
-
Object.defineProperty(exports, "emailServiceRegistry", { enumerable: true, get: function () { return email_service_registry_1.emailServiceRegistry; } });
|
|
3
|
+
exports.ControllerRegistry = void 0;
|
|
6
4
|
var controller_registry_1 = require("./controller-registry");
|
|
7
5
|
Object.defineProperty(exports, "ControllerRegistry", { enumerable: true, get: function () { return controller_registry_1.ControllerRegistry; } });
|
|
8
6
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-node-express-suite/src/registry/index.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-node-express-suite/src/registry/index.ts"],"names":[],"mappings":";;;AAAA,6DAA2D;AAAlD,yHAAA,kBAAkB,OAAA"}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @fileoverview Email service registry singleton.
|
|
3
|
-
* Manages email service registration and retrieval.
|
|
4
|
-
* @module registry/email-service-registry
|
|
5
|
-
*/
|
|
6
|
-
import { IEmailService } from '../interfaces/email-service';
|
|
7
|
-
/**
|
|
8
|
-
* Singleton registry for email service.
|
|
9
|
-
*/
|
|
10
|
-
declare class EmailServiceRegistry {
|
|
11
|
-
private service?;
|
|
12
|
-
/**
|
|
13
|
-
* Registers an email service.
|
|
14
|
-
* @param {IEmailService} service - Email service implementation
|
|
15
|
-
*/
|
|
16
|
-
setService(service: IEmailService): void;
|
|
17
|
-
/**
|
|
18
|
-
* Retrieves the registered email service.
|
|
19
|
-
* @returns {IEmailService} Email service instance
|
|
20
|
-
* @throws {TranslatableSuiteError} If no service is registered
|
|
21
|
-
*/
|
|
22
|
-
getService(): IEmailService;
|
|
23
|
-
/**
|
|
24
|
-
* Check if any email service is registered.
|
|
25
|
-
* @returns {boolean} True if service is registered
|
|
26
|
-
*/
|
|
27
|
-
hasService(): boolean;
|
|
28
|
-
/**
|
|
29
|
-
* Check if the registered service is an instance of a specific class.
|
|
30
|
-
* @template T - Email service type
|
|
31
|
-
* @param {Function} serviceClass - The class/constructor to check against
|
|
32
|
-
* @returns {boolean} True if the registered service is an instance of the given class
|
|
33
|
-
* @example
|
|
34
|
-
* emailServiceRegistry.isServiceType(EmailService) // true if EmailService is registered
|
|
35
|
-
* emailServiceRegistry.isServiceType(DummyEmailService) // true if DummyEmailService is registered
|
|
36
|
-
*/
|
|
37
|
-
isServiceType<T extends IEmailService>(serviceClass: new (...args: any[]) => T): boolean;
|
|
38
|
-
/**
|
|
39
|
-
* Get the constructor name of the registered service.
|
|
40
|
-
* @returns {string | undefined} The name of the service class, or undefined if no service is registered
|
|
41
|
-
*/
|
|
42
|
-
getServiceTypeName(): string | undefined;
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Singleton instance of EmailServiceRegistry.
|
|
46
|
-
*/
|
|
47
|
-
export declare const emailServiceRegistry: EmailServiceRegistry;
|
|
48
|
-
export {};
|
|
49
|
-
//# sourceMappingURL=email-service-registry.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"email-service-registry.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-node-express-suite/src/registry/email-service-registry.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAE5D;;GAEG;AACH,cAAM,oBAAoB;IACxB,OAAO,CAAC,OAAO,CAAC,CAAgB;IAEhC;;;OAGG;IACH,UAAU,CAAC,OAAO,EAAE,aAAa,GAAG,IAAI;IAIxC;;;;OAIG;IACH,UAAU,IAAI,aAAa;IAS3B;;;OAGG;IACH,UAAU,IAAI,OAAO;IAIrB;;;;;;;;OAQG;IACH,aAAa,CAAC,CAAC,SAAS,aAAa,EACnC,YAAY,EAAE,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,CAAC,GACtC,OAAO;IAIV;;;OAGG;IACH,kBAAkB,IAAI,MAAM,GAAG,SAAS;CAGzC;AAED;;GAEG;AACH,eAAO,MAAM,oBAAoB,sBAA6B,CAAC"}
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* @fileoverview Email service registry singleton.
|
|
4
|
-
* Manages email service registration and retrieval.
|
|
5
|
-
* @module registry/email-service-registry
|
|
6
|
-
*/
|
|
7
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
-
exports.emailServiceRegistry = void 0;
|
|
9
|
-
const suite_core_lib_1 = require("@digitaldefiance/suite-core-lib");
|
|
10
|
-
/**
|
|
11
|
-
* Singleton registry for email service.
|
|
12
|
-
*/
|
|
13
|
-
class EmailServiceRegistry {
|
|
14
|
-
service;
|
|
15
|
-
/**
|
|
16
|
-
* Registers an email service.
|
|
17
|
-
* @param {IEmailService} service - Email service implementation
|
|
18
|
-
*/
|
|
19
|
-
setService(service) {
|
|
20
|
-
this.service = service;
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* Retrieves the registered email service.
|
|
24
|
-
* @returns {IEmailService} Email service instance
|
|
25
|
-
* @throws {TranslatableSuiteError} If no service is registered
|
|
26
|
-
*/
|
|
27
|
-
getService() {
|
|
28
|
-
if (!this.service) {
|
|
29
|
-
throw new suite_core_lib_1.TranslatableSuiteError(suite_core_lib_1.SuiteCoreStringKey.Error_EmailService_NotConfigured);
|
|
30
|
-
}
|
|
31
|
-
return this.service;
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Check if any email service is registered.
|
|
35
|
-
* @returns {boolean} True if service is registered
|
|
36
|
-
*/
|
|
37
|
-
hasService() {
|
|
38
|
-
return this.service !== undefined;
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* Check if the registered service is an instance of a specific class.
|
|
42
|
-
* @template T - Email service type
|
|
43
|
-
* @param {Function} serviceClass - The class/constructor to check against
|
|
44
|
-
* @returns {boolean} True if the registered service is an instance of the given class
|
|
45
|
-
* @example
|
|
46
|
-
* emailServiceRegistry.isServiceType(EmailService) // true if EmailService is registered
|
|
47
|
-
* emailServiceRegistry.isServiceType(DummyEmailService) // true if DummyEmailService is registered
|
|
48
|
-
*/
|
|
49
|
-
isServiceType(serviceClass) {
|
|
50
|
-
return this.service !== undefined && this.service instanceof serviceClass;
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* Get the constructor name of the registered service.
|
|
54
|
-
* @returns {string | undefined} The name of the service class, or undefined if no service is registered
|
|
55
|
-
*/
|
|
56
|
-
getServiceTypeName() {
|
|
57
|
-
return this.service?.constructor.name;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
/**
|
|
61
|
-
* Singleton instance of EmailServiceRegistry.
|
|
62
|
-
*/
|
|
63
|
-
exports.emailServiceRegistry = new EmailServiceRegistry();
|
|
64
|
-
//# sourceMappingURL=email-service-registry.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"email-service-registry.js","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-node-express-suite/src/registry/email-service-registry.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEH,oEAGyC;AAGzC;;GAEG;AACH,MAAM,oBAAoB;IAChB,OAAO,CAAiB;IAEhC;;;OAGG;IACH,UAAU,CAAC,OAAsB;QAC/B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;IAED;;;;OAIG;IACH,UAAU;QACR,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;YAClB,MAAM,IAAI,uCAAsB,CAC9B,mCAAkB,CAAC,gCAAgC,CACpD,CAAC;QACJ,CAAC;QACD,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;IAED;;;OAGG;IACH,UAAU;QACR,OAAO,IAAI,CAAC,OAAO,KAAK,SAAS,CAAC;IACpC,CAAC;IAED;;;;;;;;OAQG;IACH,aAAa,CACX,YAAuC;QAEvC,OAAO,IAAI,CAAC,OAAO,KAAK,SAAS,IAAI,IAAI,CAAC,OAAO,YAAY,YAAY,CAAC;IAC5E,CAAC;IAED;;;OAGG;IACH,kBAAkB;QAChB,OAAO,IAAI,CAAC,OAAO,EAAE,WAAW,CAAC,IAAI,CAAC;IACxC,CAAC;CACF;AAED;;GAEG;AACU,QAAA,oBAAoB,GAAG,IAAI,oBAAoB,EAAE,CAAC"}
|