@digitaldefiance/node-express-suite 4.23.0 → 4.23.1

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 (61) hide show
  1. package/package.json +1 -1
  2. package/src/interfaces/documents/base.d.ts +24 -0
  3. package/src/interfaces/documents/base.d.ts.map +1 -0
  4. package/src/interfaces/documents/base.js +13 -0
  5. package/src/interfaces/documents/base.js.map +1 -0
  6. package/src/interfaces/documents/email-token.d.ts +15 -0
  7. package/src/interfaces/documents/email-token.d.ts.map +1 -0
  8. package/src/interfaces/documents/email-token.js +7 -0
  9. package/src/interfaces/documents/email-token.js.map +1 -0
  10. package/src/interfaces/documents/index.d.ts +25 -0
  11. package/src/interfaces/documents/index.d.ts.map +1 -0
  12. package/src/interfaces/documents/index.js +20 -0
  13. package/src/interfaces/documents/index.js.map +1 -0
  14. package/src/interfaces/documents/mnemonic.d.ts +15 -0
  15. package/src/interfaces/documents/mnemonic.d.ts.map +1 -0
  16. package/src/interfaces/documents/mnemonic.js +7 -0
  17. package/src/interfaces/documents/mnemonic.js.map +1 -0
  18. package/src/interfaces/documents/role.d.ts +15 -0
  19. package/src/interfaces/documents/role.d.ts.map +1 -0
  20. package/src/interfaces/documents/role.js +7 -0
  21. package/src/interfaces/documents/role.js.map +1 -0
  22. package/src/interfaces/documents/used-direct-login-token.d.ts +15 -0
  23. package/src/interfaces/documents/used-direct-login-token.d.ts.map +1 -0
  24. package/src/interfaces/documents/used-direct-login-token.js +7 -0
  25. package/src/interfaces/documents/used-direct-login-token.js.map +1 -0
  26. package/src/interfaces/documents/user-role.d.ts +15 -0
  27. package/src/interfaces/documents/user-role.d.ts.map +1 -0
  28. package/src/interfaces/documents/user-role.js +7 -0
  29. package/src/interfaces/documents/user-role.js.map +1 -0
  30. package/src/interfaces/documents/user.d.ts +16 -0
  31. package/src/interfaces/documents/user.d.ts.map +1 -0
  32. package/src/interfaces/documents/user.js +7 -0
  33. package/src/interfaces/documents/user.js.map +1 -0
  34. package/src/interfaces/index.d.ts +4 -0
  35. package/src/interfaces/index.d.ts.map +1 -1
  36. package/src/interfaces/index.js +4 -0
  37. package/src/interfaces/index.js.map +1 -1
  38. package/src/interfaces/jwt-service.d.ts +27 -0
  39. package/src/interfaces/jwt-service.d.ts.map +1 -0
  40. package/src/interfaces/jwt-service.js +10 -0
  41. package/src/interfaces/jwt-service.js.map +1 -0
  42. package/src/interfaces/role-service.d.ts +55 -0
  43. package/src/interfaces/role-service.d.ts.map +1 -0
  44. package/src/interfaces/role-service.js +10 -0
  45. package/src/interfaces/role-service.js.map +1 -0
  46. package/src/interfaces/server-init-result.d.ts +37 -0
  47. package/src/interfaces/server-init-result.d.ts.map +1 -0
  48. package/src/interfaces/server-init-result.js +10 -0
  49. package/src/interfaces/server-init-result.js.map +1 -0
  50. package/src/services/abstract-jwt-service.d.ts +34 -0
  51. package/src/services/abstract-jwt-service.d.ts.map +1 -0
  52. package/src/services/abstract-jwt-service.js +68 -0
  53. package/src/services/abstract-jwt-service.js.map +1 -0
  54. package/src/services/abstract-role-service.d.ts +61 -0
  55. package/src/services/abstract-role-service.d.ts.map +1 -0
  56. package/src/services/abstract-role-service.js +69 -0
  57. package/src/services/abstract-role-service.js.map +1 -0
  58. package/src/services/index.d.ts +2 -0
  59. package/src/services/index.d.ts.map +1 -1
  60. package/src/services/index.js +2 -0
  61. package/src/services/index.js.map +1 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@digitaldefiance/node-express-suite",
3
- "version": "4.23.0",
3
+ "version": "4.23.1",
4
4
  "homepage": "https://github.com/Digital-Defiance/node-express-suite",
5
5
  "repository": {
6
6
  "type": "git",
@@ -0,0 +1,24 @@
1
+ /**
2
+ * @fileoverview Storage-agnostic base document type.
3
+ *
4
+ * Unlike the Mongo variant (which intersects with Mongoose's Document class),
5
+ * this type is a plain data intersection: the domain data shape `T` combined
6
+ * with `IHasId<TID>`. Any storage engine whose records carry `_id` plus the
7
+ * domain fields satisfies this contract.
8
+ *
9
+ * @module interfaces/documents/base
10
+ */
11
+ import type { PlatformID } from '@digitaldefiance/node-ecies-lib';
12
+ import type { IHasId } from '@digitaldefiance/suite-core-lib';
13
+ /**
14
+ * Storage-agnostic base document type.
15
+ *
16
+ * For Mongoose backends, the concrete document type is a superset
17
+ * (MongooseDocument & T) and is assignable to this type.
18
+ * For BrightDb or other backends, plain objects with `_id` + T fields work.
19
+ *
20
+ * @template T - Domain data interface (e.g. IUserBase, IRoleBase)
21
+ * @template TID - Platform ID type (defaults to Buffer)
22
+ */
23
+ export type BaseDocument<T, TID extends PlatformID = Buffer> = IHasId<TID> & T;
24
+ //# sourceMappingURL=base.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../../../../../packages/digitaldefiance-node-express-suite/src/interfaces/documents/base.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAClE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iCAAiC,CAAC;AAE9D;;;;;;;;;GASG;AACH,MAAM,MAAM,YAAY,CAAC,CAAC,EAAE,GAAG,SAAS,UAAU,GAAG,MAAM,IAAI,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC"}
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ /**
3
+ * @fileoverview Storage-agnostic base document type.
4
+ *
5
+ * Unlike the Mongo variant (which intersects with Mongoose's Document class),
6
+ * this type is a plain data intersection: the domain data shape `T` combined
7
+ * with `IHasId<TID>`. Any storage engine whose records carry `_id` plus the
8
+ * domain fields satisfies this contract.
9
+ *
10
+ * @module interfaces/documents/base
11
+ */
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ //# sourceMappingURL=base.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base.js","sourceRoot":"","sources":["../../../../../../packages/digitaldefiance-node-express-suite/src/interfaces/documents/base.ts"],"names":[],"mappings":";AAAA;;;;;;;;;GASG"}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * @fileoverview Storage-agnostic email token document type.
3
+ * @module interfaces/documents/email-token
4
+ */
5
+ import type { PlatformID } from '@digitaldefiance/node-ecies-lib';
6
+ import type { EmailTokenType, IEmailTokenBase } from '@digitaldefiance/suite-core-lib';
7
+ import type { BaseDocument } from './base';
8
+ /**
9
+ * Storage-agnostic email token document type.
10
+ * Satisfied by both Mongoose documents and BrightDb plain records.
11
+ *
12
+ * @template TID - Platform ID type (defaults to Buffer)
13
+ */
14
+ export type EmailTokenDocument<TID extends PlatformID = Buffer> = BaseDocument<IEmailTokenBase<TID, Date, EmailTokenType>, TID>;
15
+ //# sourceMappingURL=email-token.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"email-token.d.ts","sourceRoot":"","sources":["../../../../../../packages/digitaldefiance-node-express-suite/src/interfaces/documents/email-token.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAClE,OAAO,KAAK,EACV,cAAc,EACd,eAAe,EAChB,MAAM,iCAAiC,CAAC;AACzC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAE3C;;;;;GAKG;AACH,MAAM,MAAM,kBAAkB,CAAC,GAAG,SAAS,UAAU,GAAG,MAAM,IAAI,YAAY,CAC5E,eAAe,CAAC,GAAG,EAAE,IAAI,EAAE,cAAc,CAAC,EAC1C,GAAG,CACJ,CAAC"}
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ /**
3
+ * @fileoverview Storage-agnostic email token document type.
4
+ * @module interfaces/documents/email-token
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ //# sourceMappingURL=email-token.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"email-token.js","sourceRoot":"","sources":["../../../../../../packages/digitaldefiance-node-express-suite/src/interfaces/documents/email-token.ts"],"names":[],"mappings":";AAAA;;;GAGG"}
@@ -0,0 +1,25 @@
1
+ /**
2
+ * @fileoverview Storage-agnostic document type aliases.
3
+ *
4
+ * These types represent the shape of documents as stored in any backend
5
+ * (Mongoose/MongoDB, BrightDb, etc.). They are simply the suite-core-lib
6
+ * base interfaces with backend-appropriate type parameters (TDate = Date,
7
+ * enums pinned to concrete types).
8
+ *
9
+ * Mongo documents (MongooseDocument & IFooBase) are a superset of these
10
+ * types, so they satisfy the contract. BrightDb plain-object records also
11
+ * satisfy the contract since they carry the same fields.
12
+ *
13
+ * Downstream packages should use these types when they need to reference
14
+ * "a user record" or "a role record" without caring about the storage engine.
15
+ *
16
+ * @module interfaces/documents
17
+ */
18
+ export type { UserDocument } from './user';
19
+ export type { RoleDocument } from './role';
20
+ export type { EmailTokenDocument } from './email-token';
21
+ export type { UserRoleDocument } from './user-role';
22
+ export type { MnemonicDocument } from './mnemonic';
23
+ export type { UsedDirectLoginTokenDocument } from './used-direct-login-token';
24
+ export type { BaseDocument } from './base';
25
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../packages/digitaldefiance-node-express-suite/src/interfaces/documents/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,YAAY,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAC3C,YAAY,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAC3C,YAAY,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACxD,YAAY,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AACpD,YAAY,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AACnD,YAAY,EAAE,4BAA4B,EAAE,MAAM,2BAA2B,CAAC;AAC9E,YAAY,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC"}
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ /**
3
+ * @fileoverview Storage-agnostic document type aliases.
4
+ *
5
+ * These types represent the shape of documents as stored in any backend
6
+ * (Mongoose/MongoDB, BrightDb, etc.). They are simply the suite-core-lib
7
+ * base interfaces with backend-appropriate type parameters (TDate = Date,
8
+ * enums pinned to concrete types).
9
+ *
10
+ * Mongo documents (MongooseDocument & IFooBase) are a superset of these
11
+ * types, so they satisfy the contract. BrightDb plain-object records also
12
+ * satisfy the contract since they carry the same fields.
13
+ *
14
+ * Downstream packages should use these types when they need to reference
15
+ * "a user record" or "a role record" without caring about the storage engine.
16
+ *
17
+ * @module interfaces/documents
18
+ */
19
+ Object.defineProperty(exports, "__esModule", { value: true });
20
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/digitaldefiance-node-express-suite/src/interfaces/documents/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;GAgBG"}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * @fileoverview Storage-agnostic mnemonic document type.
3
+ * @module interfaces/documents/mnemonic
4
+ */
5
+ import type { PlatformID } from '@digitaldefiance/node-ecies-lib';
6
+ import type { IMnemonicBase } from '@digitaldefiance/suite-core-lib';
7
+ import type { BaseDocument } from './base';
8
+ /**
9
+ * Storage-agnostic mnemonic document type.
10
+ * Satisfied by both Mongoose documents and BrightDb plain records.
11
+ *
12
+ * @template TID - Platform ID type (defaults to Buffer)
13
+ */
14
+ export type MnemonicDocument<TID extends PlatformID = Buffer> = BaseDocument<IMnemonicBase<TID>, TID>;
15
+ //# sourceMappingURL=mnemonic.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mnemonic.d.ts","sourceRoot":"","sources":["../../../../../../packages/digitaldefiance-node-express-suite/src/interfaces/documents/mnemonic.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAClE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AACrE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAE3C;;;;;GAKG;AACH,MAAM,MAAM,gBAAgB,CAAC,GAAG,SAAS,UAAU,GAAG,MAAM,IAAI,YAAY,CAC1E,aAAa,CAAC,GAAG,CAAC,EAClB,GAAG,CACJ,CAAC"}
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ /**
3
+ * @fileoverview Storage-agnostic mnemonic document type.
4
+ * @module interfaces/documents/mnemonic
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ //# sourceMappingURL=mnemonic.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mnemonic.js","sourceRoot":"","sources":["../../../../../../packages/digitaldefiance-node-express-suite/src/interfaces/documents/mnemonic.ts"],"names":[],"mappings":";AAAA;;;GAGG"}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * @fileoverview Storage-agnostic role document type.
3
+ * @module interfaces/documents/role
4
+ */
5
+ import type { PlatformID } from '@digitaldefiance/node-ecies-lib';
6
+ import type { IRoleBase } from '@digitaldefiance/suite-core-lib';
7
+ import type { BaseDocument } from './base';
8
+ /**
9
+ * Storage-agnostic role document type.
10
+ * Satisfied by both Mongoose documents and BrightDb plain records.
11
+ *
12
+ * @template TID - Platform ID type (defaults to Buffer)
13
+ */
14
+ export type RoleDocument<TID extends PlatformID = Buffer> = BaseDocument<IRoleBase<TID, Date>, TID>;
15
+ //# sourceMappingURL=role.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"role.d.ts","sourceRoot":"","sources":["../../../../../../packages/digitaldefiance-node-express-suite/src/interfaces/documents/role.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAClE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAE3C;;;;;GAKG;AACH,MAAM,MAAM,YAAY,CAAC,GAAG,SAAS,UAAU,GAAG,MAAM,IAAI,YAAY,CACtE,SAAS,CAAC,GAAG,EAAE,IAAI,CAAC,EACpB,GAAG,CACJ,CAAC"}
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ /**
3
+ * @fileoverview Storage-agnostic role document type.
4
+ * @module interfaces/documents/role
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ //# sourceMappingURL=role.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"role.js","sourceRoot":"","sources":["../../../../../../packages/digitaldefiance-node-express-suite/src/interfaces/documents/role.ts"],"names":[],"mappings":";AAAA;;;GAGG"}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * @fileoverview Storage-agnostic used direct login token document type.
3
+ * @module interfaces/documents/used-direct-login-token
4
+ */
5
+ import type { PlatformID } from '@digitaldefiance/node-ecies-lib';
6
+ import type { IUsedDirectLoginTokenBase } from '@digitaldefiance/suite-core-lib';
7
+ import type { BaseDocument } from './base';
8
+ /**
9
+ * Storage-agnostic used direct login token document type.
10
+ * Satisfied by both Mongoose documents and BrightDb plain records.
11
+ *
12
+ * @template TID - Platform ID type (defaults to Buffer)
13
+ */
14
+ export type UsedDirectLoginTokenDocument<TID extends PlatformID = Buffer> = BaseDocument<IUsedDirectLoginTokenBase<TID>, TID>;
15
+ //# sourceMappingURL=used-direct-login-token.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"used-direct-login-token.d.ts","sourceRoot":"","sources":["../../../../../../packages/digitaldefiance-node-express-suite/src/interfaces/documents/used-direct-login-token.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAClE,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,iCAAiC,CAAC;AACjF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAE3C;;;;;GAKG;AACH,MAAM,MAAM,4BAA4B,CAAC,GAAG,SAAS,UAAU,GAAG,MAAM,IACtE,YAAY,CAAC,yBAAyB,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC,CAAC"}
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ /**
3
+ * @fileoverview Storage-agnostic used direct login token document type.
4
+ * @module interfaces/documents/used-direct-login-token
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ //# sourceMappingURL=used-direct-login-token.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"used-direct-login-token.js","sourceRoot":"","sources":["../../../../../../packages/digitaldefiance-node-express-suite/src/interfaces/documents/used-direct-login-token.ts"],"names":[],"mappings":";AAAA;;;GAGG"}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * @fileoverview Storage-agnostic user-role document type.
3
+ * @module interfaces/documents/user-role
4
+ */
5
+ import type { PlatformID } from '@digitaldefiance/node-ecies-lib';
6
+ import type { IUserRoleBase } from '@digitaldefiance/suite-core-lib';
7
+ import type { BaseDocument } from './base';
8
+ /**
9
+ * Storage-agnostic user-role document type.
10
+ * Satisfied by both Mongoose documents and BrightDb plain records.
11
+ *
12
+ * @template TID - Platform ID type (defaults to Buffer)
13
+ */
14
+ export type UserRoleDocument<TID extends PlatformID = Buffer> = BaseDocument<IUserRoleBase<TID, Date>, TID>;
15
+ //# sourceMappingURL=user-role.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"user-role.d.ts","sourceRoot":"","sources":["../../../../../../packages/digitaldefiance-node-express-suite/src/interfaces/documents/user-role.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAClE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AACrE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAE3C;;;;;GAKG;AACH,MAAM,MAAM,gBAAgB,CAAC,GAAG,SAAS,UAAU,GAAG,MAAM,IAAI,YAAY,CAC1E,aAAa,CAAC,GAAG,EAAE,IAAI,CAAC,EACxB,GAAG,CACJ,CAAC"}
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ /**
3
+ * @fileoverview Storage-agnostic user-role document type.
4
+ * @module interfaces/documents/user-role
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ //# sourceMappingURL=user-role.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"user-role.js","sourceRoot":"","sources":["../../../../../../packages/digitaldefiance-node-express-suite/src/interfaces/documents/user-role.ts"],"names":[],"mappings":";AAAA;;;GAGG"}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * @fileoverview Storage-agnostic user document type.
3
+ * @module interfaces/documents/user
4
+ */
5
+ import type { PlatformID } from '@digitaldefiance/node-ecies-lib';
6
+ import type { AccountStatus, IUserBase } from '@digitaldefiance/suite-core-lib';
7
+ import type { BaseDocument } from './base';
8
+ /**
9
+ * Storage-agnostic user document type.
10
+ * Satisfied by both Mongoose documents and BrightDb plain records.
11
+ *
12
+ * @template TLanguage - String type for site language (defaults to string)
13
+ * @template TID - Platform ID type (defaults to Buffer)
14
+ */
15
+ export type UserDocument<TLanguage extends string = string, TID extends PlatformID = Buffer> = BaseDocument<IUserBase<TID, Date, TLanguage, AccountStatus>, TID>;
16
+ //# sourceMappingURL=user.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"user.d.ts","sourceRoot":"","sources":["../../../../../../packages/digitaldefiance-node-express-suite/src/interfaces/documents/user.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAClE,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AAChF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAE3C;;;;;;GAMG;AACH,MAAM,MAAM,YAAY,CACtB,SAAS,SAAS,MAAM,GAAG,MAAM,EACjC,GAAG,SAAS,UAAU,GAAG,MAAM,IAC7B,YAAY,CAAC,SAAS,CAAC,GAAG,EAAE,IAAI,EAAE,SAAS,EAAE,aAAa,CAAC,EAAE,GAAG,CAAC,CAAC"}
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ /**
3
+ * @fileoverview Storage-agnostic user document type.
4
+ * @module interfaces/documents/user
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ //# sourceMappingURL=user.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"user.js","sourceRoot":"","sources":["../../../../../../packages/digitaldefiance-node-express-suite/src/interfaces/documents/user.ts"],"names":[],"mappings":";AAAA;;;GAGG"}
@@ -1,4 +1,5 @@
1
1
  export * from './document-store';
2
+ export * from './documents';
2
3
  export * from './api-error-response';
3
4
  export * from './api-express-validation-error-response';
4
5
  export * from './api-message-response';
@@ -21,11 +22,14 @@ export * from './flexible-csp';
21
22
  export * from './handleable-error-options';
22
23
  export * from './jwt-consts';
23
24
  export * from './jwt-sign-response';
25
+ export * from './jwt-service';
24
26
  export * from './lets-encrypt-config';
25
27
  export * from './network';
26
28
  export * from './openApi';
27
29
  export * from './request-user';
28
30
  export * from './required-string-keys';
31
+ export * from './role-service';
32
+ export * from './server-init-result';
29
33
  export * from './status-code-response';
30
34
  export * from './symmetric-encryption-results';
31
35
  export * from './token-response';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-node-express-suite/src/interfaces/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AAEjC,cAAc,sBAAsB,CAAC;AACrC,cAAc,yCAAyC,CAAC;AACxD,cAAc,wBAAwB,CAAC;AACvC,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,cAAc,CAAC;AAC7B,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,4BAA4B,CAAC;AAC3C,cAAc,cAAc,CAAC;AAC7B,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,wBAAwB,CAAC;AACvC,cAAc,wBAAwB,CAAC;AACvC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,kBAAkB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-node-express-suite/src/interfaces/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC;AAE5B,cAAc,sBAAsB,CAAC;AACrC,cAAc,yCAAyC,CAAC;AACxD,cAAc,wBAAwB,CAAC;AACvC,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,cAAc,CAAC;AAC7B,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,4BAA4B,CAAC;AAC3C,cAAc,cAAc,CAAC;AAC7B,cAAc,qBAAqB,CAAC;AACpC,cAAc,eAAe,CAAC;AAC9B,cAAc,uBAAuB,CAAC;AACtC,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,wBAAwB,CAAC;AACvC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,sBAAsB,CAAC;AACrC,cAAc,wBAAwB,CAAC;AACvC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,kBAAkB,CAAC"}
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
4
  tslib_1.__exportStar(require("./document-store"), exports);
5
+ tslib_1.__exportStar(require("./documents"), exports);
5
6
  tslib_1.__exportStar(require("./api-error-response"), exports);
6
7
  tslib_1.__exportStar(require("./api-express-validation-error-response"), exports);
7
8
  tslib_1.__exportStar(require("./api-message-response"), exports);
@@ -24,11 +25,14 @@ tslib_1.__exportStar(require("./flexible-csp"), exports);
24
25
  tslib_1.__exportStar(require("./handleable-error-options"), exports);
25
26
  tslib_1.__exportStar(require("./jwt-consts"), exports);
26
27
  tslib_1.__exportStar(require("./jwt-sign-response"), exports);
28
+ tslib_1.__exportStar(require("./jwt-service"), exports);
27
29
  tslib_1.__exportStar(require("./lets-encrypt-config"), exports);
28
30
  tslib_1.__exportStar(require("./network"), exports);
29
31
  tslib_1.__exportStar(require("./openApi"), exports);
30
32
  tslib_1.__exportStar(require("./request-user"), exports);
31
33
  tslib_1.__exportStar(require("./required-string-keys"), exports);
34
+ tslib_1.__exportStar(require("./role-service"), exports);
35
+ tslib_1.__exportStar(require("./server-init-result"), exports);
32
36
  tslib_1.__exportStar(require("./status-code-response"), exports);
33
37
  tslib_1.__exportStar(require("./symmetric-encryption-results"), exports);
34
38
  tslib_1.__exportStar(require("./token-response"), exports);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-node-express-suite/src/interfaces/index.ts"],"names":[],"mappings":";;;AAAA,2DAAiC;AAEjC,+DAAqC;AACrC,kFAAwD;AACxD,iEAAuC;AACvC,0DAAgC;AAChC,wDAA8B;AAC9B,oEAA0C;AAC1C,8DAAoC;AACpC,4DAAkC;AAClC,4DAAkC;AAClC,4DAAkC;AAClC,sDAA4B;AAC5B,8DAAoC;AACpC,+DAAqC;AACrC,uDAA6B;AAC7B,2DAAiC;AACjC,0DAAgC;AAChC,wDAA8B;AAC9B,uDAA6B;AAC7B,yDAA+B;AAC/B,qEAA2C;AAC3C,uDAA6B;AAC7B,8DAAoC;AACpC,gEAAsC;AACtC,oDAA0B;AAC1B,oDAA0B;AAC1B,yDAA+B;AAC/B,iEAAuC;AACvC,iEAAuC;AACvC,yEAA+C;AAC/C,2DAAiC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-node-express-suite/src/interfaces/index.ts"],"names":[],"mappings":";;;AAAA,2DAAiC;AACjC,sDAA4B;AAE5B,+DAAqC;AACrC,kFAAwD;AACxD,iEAAuC;AACvC,0DAAgC;AAChC,wDAA8B;AAC9B,oEAA0C;AAC1C,8DAAoC;AACpC,4DAAkC;AAClC,4DAAkC;AAClC,4DAAkC;AAClC,sDAA4B;AAC5B,8DAAoC;AACpC,+DAAqC;AACrC,uDAA6B;AAC7B,2DAAiC;AACjC,0DAAgC;AAChC,wDAA8B;AAC9B,uDAA6B;AAC7B,yDAA+B;AAC/B,qEAA2C;AAC3C,uDAA6B;AAC7B,8DAAoC;AACpC,wDAA8B;AAC9B,gEAAsC;AACtC,oDAA0B;AAC1B,oDAA0B;AAC1B,yDAA+B;AAC/B,iEAAuC;AACvC,yDAA+B;AAC/B,+DAAqC;AACrC,iEAAuC;AACvC,yEAA+C;AAC/C,2DAAiC"}
@@ -0,0 +1,27 @@
1
+ /**
2
+ * @fileoverview Abstract JWT service interface.
3
+ * Database-agnostic contract for JWT token operations.
4
+ * Concrete implementations live in backend-specific packages
5
+ * (e.g. node-express-suite-mongo, @brightchain/node-express-suite).
6
+ * @module interfaces/jwt-service
7
+ */
8
+ import type { ITokenUser } from '@digitaldefiance/suite-core-lib';
9
+ /**
10
+ * Abstract interface for JWT token operations.
11
+ * Implementations handle token signing and verification
12
+ * using their backend-specific user/role storage.
13
+ *
14
+ * @template TID - Platform ID type (defaults to Buffer)
15
+ * @template TTokenUser - Token user type (defaults to ITokenUser)
16
+ */
17
+ export interface IJwtService<TTokenUser extends ITokenUser = ITokenUser> {
18
+ /**
19
+ * Verify a JWT token and return the decoded user payload.
20
+ * @param token - The JWT token string to verify
21
+ * @returns The decoded token user, or null if invalid
22
+ * @throws {TokenExpiredError} If the token has expired
23
+ * @throws {InvalidJwtTokenError} If the token is malformed
24
+ */
25
+ verifyToken(token: string): Promise<TTokenUser | null>;
26
+ }
27
+ //# sourceMappingURL=jwt-service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"jwt-service.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-node-express-suite/src/interfaces/jwt-service.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAElE;;;;;;;GAOG;AACH,MAAM,WAAW,WAAW,CAAC,UAAU,SAAS,UAAU,GAAG,UAAU;IACrE;;;;;;OAMG;IACH,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC,CAAC;CACxD"}
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ /**
3
+ * @fileoverview Abstract JWT service interface.
4
+ * Database-agnostic contract for JWT token operations.
5
+ * Concrete implementations live in backend-specific packages
6
+ * (e.g. node-express-suite-mongo, @brightchain/node-express-suite).
7
+ * @module interfaces/jwt-service
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ //# sourceMappingURL=jwt-service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"jwt-service.js","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-node-express-suite/src/interfaces/jwt-service.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG"}
@@ -0,0 +1,55 @@
1
+ /**
2
+ * @fileoverview Abstract role service interface.
3
+ * Database-agnostic contract for role-based access control operations.
4
+ * Concrete implementations live in backend-specific packages
5
+ * (e.g. node-express-suite-mongo, @brightchain/node-express-suite).
6
+ * @module interfaces/role-service
7
+ */
8
+ import type { PlatformID } from '@digitaldefiance/node-ecies-lib';
9
+ import type { IRoleBase, ITokenRole } from '@digitaldefiance/suite-core-lib';
10
+ import type { MemberType } from '@digitaldefiance/ecies-lib';
11
+ /**
12
+ * Abstract interface for role service operations.
13
+ * Implementations handle role CRUD and user-role associations
14
+ * using their backend-specific storage.
15
+ *
16
+ * @template TID - Platform ID type (defaults to Buffer)
17
+ * @template TDate - Date type (defaults to Date)
18
+ * @template TTokenRole - Token role type (defaults to ITokenRole<TID, TDate>)
19
+ */
20
+ export interface IRoleService<TID extends PlatformID = Buffer, TDate extends Date = Date, TTokenRole extends ITokenRole<TID, TDate> = ITokenRole<TID, TDate>, TRole extends IRoleBase<TID> = IRoleBase<TID>> {
21
+ /**
22
+ * Get the role ID for a given role name.
23
+ * @param roleName - The name of the role to look up
24
+ * @returns The role ID, or null/undefined if not found
25
+ */
26
+ getRoleIdByName(roleName: string): Promise<TID | null | undefined>;
27
+ /**
28
+ * Get all roles assigned to a user.
29
+ * @param userId - The user's ID
30
+ * @returns Array of role objects (storage-specific, e.g. RoleDocument)
31
+ */
32
+ getUserRoles(userId: TID): Promise<TRole[]>;
33
+ /**
34
+ * Check if a user has the admin role.
35
+ * @param userId - The user's ID
36
+ */
37
+ isUserAdmin(userId: TID): Promise<boolean>;
38
+ /**
39
+ * Check if a user has the member role.
40
+ * @param userId - The user's ID
41
+ */
42
+ isUserMember(userId: TID): Promise<boolean>;
43
+ /**
44
+ * Get the MemberType for a user based on their roles.
45
+ * @param userId - The user's ID
46
+ */
47
+ getMemberType(userId: TID): Promise<MemberType>;
48
+ /**
49
+ * Convert role objects to token role representations.
50
+ * @param roles - Array of role objects
51
+ * @param overrideLanguage - Optional language override for role name translation
52
+ */
53
+ rolesToTokenRoles(roles: TRole[], overrideLanguage?: string): TTokenRole[];
54
+ }
55
+ //# sourceMappingURL=role-service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"role-service.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-node-express-suite/src/interfaces/role-service.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAClE,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAC7E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAE7D;;;;;;;;GAQG;AACH,MAAM,WAAW,YAAY,CAC3B,GAAG,SAAS,UAAU,GAAG,MAAM,EAC/B,KAAK,SAAS,IAAI,GAAG,IAAI,EACzB,UAAU,SAAS,UAAU,CAAC,GAAG,EAAE,KAAK,CAAC,GAAG,UAAU,CAAC,GAAG,EAAE,KAAK,CAAC,EAClE,KAAK,SAAS,SAAS,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC,GAAG,CAAC;IAE7C;;;;OAIG;IACH,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,GAAG,IAAI,GAAG,SAAS,CAAC,CAAC;IAEnE;;;;OAIG;IACH,YAAY,CAAC,MAAM,EAAE,GAAG,GAAG,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC;IAE5C;;;OAGG;IACH,WAAW,CAAC,MAAM,EAAE,GAAG,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAE3C;;;OAGG;IACH,YAAY,CAAC,MAAM,EAAE,GAAG,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAE5C;;;OAGG;IACH,aAAa,CAAC,MAAM,EAAE,GAAG,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;IAEhD;;;;OAIG;IACH,iBAAiB,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE,gBAAgB,CAAC,EAAE,MAAM,GAAG,UAAU,EAAE,CAAC;CAC5E"}
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ /**
3
+ * @fileoverview Abstract role service interface.
4
+ * Database-agnostic contract for role-based access control operations.
5
+ * Concrete implementations live in backend-specific packages
6
+ * (e.g. node-express-suite-mongo, @brightchain/node-express-suite).
7
+ * @module interfaces/role-service
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ //# sourceMappingURL=role-service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"role-service.js","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-node-express-suite/src/interfaces/role-service.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG"}
@@ -0,0 +1,37 @@
1
+ /**
2
+ * @fileoverview Base server initialization result interface.
3
+ * Database-agnostic contract for the result of initializing a server
4
+ * with admin, member, and system user accounts.
5
+ * Backend-specific packages extend this with their document types.
6
+ * @module interfaces/server-init-result
7
+ */
8
+ import type { Member, PlatformID } from '@digitaldefiance/node-ecies-lib';
9
+ /**
10
+ * Base result of server initialization.
11
+ * Contains credentials and member objects for admin, member, and system accounts.
12
+ * Backend-specific packages (mongo, brightdb) extend this with their
13
+ * own document/record types for roles, users, and user-roles.
14
+ *
15
+ * @template TID - Platform ID type (defaults to Buffer)
16
+ */
17
+ export interface IServerInitResult<TID extends PlatformID = Buffer> {
18
+ adminUsername: string;
19
+ adminEmail: string;
20
+ adminMnemonic: string;
21
+ adminPassword: string;
22
+ adminBackupCodes: Array<string>;
23
+ adminMember: Member<TID>;
24
+ memberUsername: string;
25
+ memberEmail: string;
26
+ memberMnemonic: string;
27
+ memberPassword: string;
28
+ memberBackupCodes: Array<string>;
29
+ memberMember: Member<TID>;
30
+ systemUsername: string;
31
+ systemEmail: string;
32
+ systemMnemonic: string;
33
+ systemPassword: string;
34
+ systemBackupCodes: Array<string>;
35
+ systemMember: Member<TID>;
36
+ }
37
+ //# sourceMappingURL=server-init-result.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server-init-result.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-node-express-suite/src/interfaces/server-init-result.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAE1E;;;;;;;GAOG;AACH,MAAM,WAAW,iBAAiB,CAAC,GAAG,SAAS,UAAU,GAAG,MAAM;IAChE,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,MAAM,CAAC;IACtB,gBAAgB,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAChC,WAAW,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC;IAEzB,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,MAAM,CAAC;IACvB,cAAc,EAAE,MAAM,CAAC;IACvB,iBAAiB,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACjC,YAAY,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC;IAE1B,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,MAAM,CAAC;IACvB,cAAc,EAAE,MAAM,CAAC;IACvB,iBAAiB,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACjC,YAAY,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC;CAC3B"}
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ /**
3
+ * @fileoverview Base server initialization result interface.
4
+ * Database-agnostic contract for the result of initializing a server
5
+ * with admin, member, and system user accounts.
6
+ * Backend-specific packages extend this with their document types.
7
+ * @module interfaces/server-init-result
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ //# sourceMappingURL=server-init-result.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server-init-result.js","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-node-express-suite/src/interfaces/server-init-result.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG"}
@@ -0,0 +1,34 @@
1
+ /**
2
+ * @fileoverview Abstract JWT service base class.
3
+ * Provides storage-agnostic token verification logic.
4
+ * Concrete implementations (Mongo, BrightDb, etc.) extend this
5
+ * and provide signToken with their storage-specific role lookup.
6
+ * @module services/abstract-jwt-service
7
+ */
8
+ import type { PlatformID } from '@digitaldefiance/node-ecies-lib';
9
+ import type { ITokenUser } from '@digitaldefiance/suite-core-lib';
10
+ import type { IApplication } from '../interfaces/application';
11
+ import type { IJwtService } from '../interfaces/jwt-service';
12
+ import { BaseService } from './base';
13
+ /**
14
+ * Abstract base class for JWT token operations.
15
+ *
16
+ * Provides a complete, storage-agnostic `verifyToken` implementation.
17
+ * Subclasses must implement `signToken` using their backend-specific
18
+ * role service to look up user roles and produce signed tokens.
19
+ *
20
+ * @template TID - Platform ID type (defaults to Buffer)
21
+ * @template TTokenUser - Token user type (defaults to ITokenUser)
22
+ * @template TApplication - Application interface type
23
+ */
24
+ export declare abstract class AbstractJwtService<TID extends PlatformID = Buffer, TTokenUser extends ITokenUser = ITokenUser, TApplication extends IApplication<TID> = IApplication<TID>> extends BaseService<TID, TApplication> implements IJwtService<TTokenUser> {
25
+ constructor(application: TApplication);
26
+ /**
27
+ * Verify a JWT token and return the decoded user payload.
28
+ *
29
+ * This implementation is storage-agnostic — it only depends on
30
+ * `application.environment.jwtSecret` and `application.constants.JWT`.
31
+ */
32
+ verifyToken(token: string): Promise<TTokenUser | null>;
33
+ }
34
+ //# sourceMappingURL=abstract-jwt-service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"abstract-jwt-service.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-node-express-suite/src/services/abstract-jwt-service.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAClE,OAAO,KAAK,EAEV,UAAU,EACX,MAAM,iCAAiC,CAAC;AAWzC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AASrC;;;;;;;;;;GAUG;AACH,8BAAsB,kBAAkB,CACtC,GAAG,SAAS,UAAU,GAAG,MAAM,EAC/B,UAAU,SAAS,UAAU,GAAG,UAAU,EAC1C,YAAY,SAAS,YAAY,CAAC,GAAG,CAAC,GAAG,YAAY,CAAC,GAAG,CAAC,CAE1D,SAAQ,WAAW,CAAC,GAAG,EAAE,YAAY,CACrC,YAAW,WAAW,CAAC,UAAU,CAAC;gBAEtB,WAAW,EAAE,YAAY;IAIrC;;;;;OAKG;IACU,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC;CAgCpE"}
@@ -0,0 +1,68 @@
1
+ "use strict";
2
+ /**
3
+ * @fileoverview Abstract JWT service base class.
4
+ * Provides storage-agnostic token verification logic.
5
+ * Concrete implementations (Mongo, BrightDb, etc.) extend this
6
+ * and provide signToken with their storage-specific role lookup.
7
+ * @module services/abstract-jwt-service
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.AbstractJwtService = void 0;
11
+ const jsonwebtoken_1 = require("jsonwebtoken");
12
+ const util_1 = require("util");
13
+ const invalid_jwt_token_1 = require("../errors/invalid-jwt-token");
14
+ const token_expired_1 = require("../errors/token-expired");
15
+ const base_1 = require("./base");
16
+ const verifyAsync = (0, util_1.promisify)(jsonwebtoken_1.verify);
17
+ /**
18
+ * Abstract base class for JWT token operations.
19
+ *
20
+ * Provides a complete, storage-agnostic `verifyToken` implementation.
21
+ * Subclasses must implement `signToken` using their backend-specific
22
+ * role service to look up user roles and produce signed tokens.
23
+ *
24
+ * @template TID - Platform ID type (defaults to Buffer)
25
+ * @template TTokenUser - Token user type (defaults to ITokenUser)
26
+ * @template TApplication - Application interface type
27
+ */
28
+ class AbstractJwtService extends base_1.BaseService {
29
+ constructor(application) {
30
+ super(application);
31
+ }
32
+ /**
33
+ * Verify a JWT token and return the decoded user payload.
34
+ *
35
+ * This implementation is storage-agnostic — it only depends on
36
+ * `application.environment.jwtSecret` and `application.constants.JWT`.
37
+ */
38
+ async verifyToken(token) {
39
+ try {
40
+ const decoded = (await verifyAsync(token, this.application.environment.jwtSecret, {
41
+ algorithms: [this.application.constants.JWT.ALGORITHM],
42
+ }));
43
+ if (typeof decoded === 'object' &&
44
+ decoded !== null &&
45
+ 'userId' in decoded &&
46
+ 'roles' in decoded) {
47
+ return {
48
+ userId: decoded['userId'],
49
+ roles: decoded['roles'],
50
+ };
51
+ }
52
+ else {
53
+ return null;
54
+ }
55
+ }
56
+ catch (err) {
57
+ if (err instanceof jsonwebtoken_1.TokenExpiredError) {
58
+ throw new token_expired_1.TokenExpiredError();
59
+ }
60
+ else if (err instanceof jsonwebtoken_1.JsonWebTokenError) {
61
+ throw err;
62
+ }
63
+ throw new invalid_jwt_token_1.InvalidJwtTokenError();
64
+ }
65
+ }
66
+ }
67
+ exports.AbstractJwtService = AbstractJwtService;
68
+ //# sourceMappingURL=abstract-jwt-service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"abstract-jwt-service.js","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-node-express-suite/src/services/abstract-jwt-service.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAOH,+CAMsB;AACtB,+BAAiC;AACjC,mEAAmE;AACnE,2DAA4D;AAG5D,iCAAqC;AAErC,MAAM,WAAW,GAAG,IAAA,gBAAS,EAK3B,qBAAM,CAAC,CAAC;AAEV;;;;;;;;;;GAUG;AACH,MAAsB,kBAKpB,SAAQ,kBAA8B;IAGtC,YAAY,WAAyB;QACnC,KAAK,CAAC,WAAW,CAAC,CAAC;IACrB,CAAC;IAED;;;;;OAKG;IACI,KAAK,CAAC,WAAW,CAAC,KAAa;QACpC,IAAI,CAAC;YACH,MAAM,OAAO,GAAG,CAAC,MAAM,WAAW,CAChC,KAAK,EACL,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC,SAAS,EACtC;gBACE,UAAU,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,SAAS,CAAC,GAAG,CAAC,SAAS,CAAC;aACvD,CACF,CAAe,CAAC;YAEjB,IACE,OAAO,OAAO,KAAK,QAAQ;gBAC3B,OAAO,KAAK,IAAI;gBAChB,QAAQ,IAAI,OAAO;gBACnB,OAAO,IAAI,OAAO,EAClB,CAAC;gBACD,OAAO;oBACL,MAAM,EAAE,OAAO,CAAC,QAAQ,CAAW;oBACnC,KAAK,EAAE,OAAO,CAAC,OAAO,CAAoB;iBAC7B,CAAC;YAClB,CAAC;iBAAM,CAAC;gBACN,OAAO,IAAI,CAAC;YACd,CAAC;QACH,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,IAAI,GAAG,YAAY,gCAAoB,EAAE,CAAC;gBACxC,MAAM,IAAI,iCAAiB,EAAE,CAAC;YAChC,CAAC;iBAAM,IAAI,GAAG,YAAY,gCAAiB,EAAE,CAAC;gBAC5C,MAAM,GAAG,CAAC;YACZ,CAAC;YACD,MAAM,IAAI,wCAAoB,EAAE,CAAC;QACnC,CAAC;IACH,CAAC;CACF;AAlDD,gDAkDC"}
@@ -0,0 +1,61 @@
1
+ /**
2
+ * @fileoverview Abstract role service base class.
3
+ * Provides storage-agnostic role-checking logic (getMemberType, isUserAdmin, etc.).
4
+ * Concrete implementations (Mongo, BrightDb, etc.) extend this and provide
5
+ * the storage-specific methods: getUserRoles, getRoleIdByName, rolesToTokenRoles.
6
+ * @module services/abstract-role-service
7
+ */
8
+ import { MemberType } from '@digitaldefiance/ecies-lib';
9
+ import type { PlatformID } from '@digitaldefiance/node-ecies-lib';
10
+ import type { IRoleBase, ITokenRole } from '@digitaldefiance/suite-core-lib';
11
+ import type { IApplication } from '../interfaces/application';
12
+ import type { IRoleService } from '../interfaces/role-service';
13
+ import { BaseService } from './base';
14
+ /**
15
+ * Abstract base class for role service operations.
16
+ *
17
+ * Provides default implementations for role-checking methods
18
+ * (`isUserAdmin`, `isUserMember`, `getMemberType`) that delegate
19
+ * to `getUserRoles`. Subclasses must implement the storage-specific
20
+ * methods: `getUserRoles`, `getRoleIdByName`, `rolesToTokenRoles`.
21
+ *
22
+ * @template TID - Platform ID type (defaults to Buffer)
23
+ * @template TDate - Date type (defaults to Date)
24
+ * @template TTokenRole - Token role type (defaults to ITokenRole<TID, TDate>)
25
+ * @template TRole - Raw role type returned by getUserRoles (defaults to IRoleBase<TID>)
26
+ * @template TApplication - Application interface type
27
+ */
28
+ export declare abstract class AbstractRoleService<TID extends PlatformID = Buffer, TDate extends Date = Date, TTokenRole extends ITokenRole<TID, TDate> = ITokenRole<TID, TDate>, TRole extends IRoleBase<TID> = IRoleBase<TID>, TApplication extends IApplication<TID> = IApplication<TID>> extends BaseService<TID, TApplication> implements IRoleService<TID, TDate, TTokenRole, TRole> {
29
+ constructor(application: TApplication);
30
+ /**
31
+ * Get the role ID for a given role name.
32
+ * Must be implemented by storage-specific subclasses.
33
+ */
34
+ abstract getRoleIdByName(roleName: string): Promise<TID | null | undefined>;
35
+ /**
36
+ * Get all roles assigned to a user.
37
+ * Must be implemented by storage-specific subclasses.
38
+ */
39
+ abstract getUserRoles(userId: TID): Promise<TRole[]>;
40
+ /**
41
+ * Convert role objects to token role representations.
42
+ * Must be implemented by storage-specific subclasses.
43
+ */
44
+ abstract rolesToTokenRoles(roles: TRole[], overrideLanguage?: string): TTokenRole[];
45
+ /**
46
+ * Check if a user has the admin role.
47
+ * Default implementation delegates to getUserRoles.
48
+ */
49
+ isUserAdmin(userId: TID): Promise<boolean>;
50
+ /**
51
+ * Check if a user has the member role.
52
+ * Default implementation delegates to getUserRoles.
53
+ */
54
+ isUserMember(userId: TID): Promise<boolean>;
55
+ /**
56
+ * Get the MemberType for a user based on their roles.
57
+ * Default implementation: system > admin > member > anonymous.
58
+ */
59
+ getMemberType(userId: TID): Promise<MemberType>;
60
+ }
61
+ //# sourceMappingURL=abstract-role-service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"abstract-role-service.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-node-express-suite/src/services/abstract-role-service.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AACxD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAClE,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAC7E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AAErC;;;;;;;;;;;;;GAaG;AACH,8BAAsB,mBAAmB,CACvC,GAAG,SAAS,UAAU,GAAG,MAAM,EAC/B,KAAK,SAAS,IAAI,GAAG,IAAI,EACzB,UAAU,SAAS,UAAU,CAAC,GAAG,EAAE,KAAK,CAAC,GAAG,UAAU,CAAC,GAAG,EAAE,KAAK,CAAC,EAClE,KAAK,SAAS,SAAS,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC,GAAG,CAAC,EAC7C,YAAY,SAAS,YAAY,CAAC,GAAG,CAAC,GAAG,YAAY,CAAC,GAAG,CAAC,CAE1D,SAAQ,WAAW,CAAC,GAAG,EAAE,YAAY,CACrC,YAAW,YAAY,CAAC,GAAG,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,CAAC;gBAE1C,WAAW,EAAE,YAAY;IAMrC;;;OAGG;IACH,QAAQ,CAAC,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,GAAG,IAAI,GAAG,SAAS,CAAC;IAE3E;;;OAGG;IACH,QAAQ,CAAC,YAAY,CAAC,MAAM,EAAE,GAAG,GAAG,OAAO,CAAC,KAAK,EAAE,CAAC;IAEpD;;;OAGG;IACH,QAAQ,CAAC,iBAAiB,CACxB,KAAK,EAAE,KAAK,EAAE,EACd,gBAAgB,CAAC,EAAE,MAAM,GACxB,UAAU,EAAE;IAIf;;;OAGG;IACU,WAAW,CAAC,MAAM,EAAE,GAAG,GAAG,OAAO,CAAC,OAAO,CAAC;IAKvD;;;OAGG;IACU,YAAY,CAAC,MAAM,EAAE,GAAG,GAAG,OAAO,CAAC,OAAO,CAAC;IAKxD;;;OAGG;IACU,aAAa,CAAC,MAAM,EAAE,GAAG,GAAG,OAAO,CAAC,UAAU,CAAC;CAY7D"}
@@ -0,0 +1,69 @@
1
+ "use strict";
2
+ /**
3
+ * @fileoverview Abstract role service base class.
4
+ * Provides storage-agnostic role-checking logic (getMemberType, isUserAdmin, etc.).
5
+ * Concrete implementations (Mongo, BrightDb, etc.) extend this and provide
6
+ * the storage-specific methods: getUserRoles, getRoleIdByName, rolesToTokenRoles.
7
+ * @module services/abstract-role-service
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.AbstractRoleService = void 0;
11
+ const ecies_lib_1 = require("@digitaldefiance/ecies-lib");
12
+ const base_1 = require("./base");
13
+ /**
14
+ * Abstract base class for role service operations.
15
+ *
16
+ * Provides default implementations for role-checking methods
17
+ * (`isUserAdmin`, `isUserMember`, `getMemberType`) that delegate
18
+ * to `getUserRoles`. Subclasses must implement the storage-specific
19
+ * methods: `getUserRoles`, `getRoleIdByName`, `rolesToTokenRoles`.
20
+ *
21
+ * @template TID - Platform ID type (defaults to Buffer)
22
+ * @template TDate - Date type (defaults to Date)
23
+ * @template TTokenRole - Token role type (defaults to ITokenRole<TID, TDate>)
24
+ * @template TRole - Raw role type returned by getUserRoles (defaults to IRoleBase<TID>)
25
+ * @template TApplication - Application interface type
26
+ */
27
+ class AbstractRoleService extends base_1.BaseService {
28
+ constructor(application) {
29
+ super(application);
30
+ }
31
+ // ── Default implementations (storage-agnostic) ────────────────────
32
+ /**
33
+ * Check if a user has the admin role.
34
+ * Default implementation delegates to getUserRoles.
35
+ */
36
+ async isUserAdmin(userId) {
37
+ const roles = await this.getUserRoles(userId);
38
+ return roles.some((r) => r.admin);
39
+ }
40
+ /**
41
+ * Check if a user has the member role.
42
+ * Default implementation delegates to getUserRoles.
43
+ */
44
+ async isUserMember(userId) {
45
+ const roles = await this.getUserRoles(userId);
46
+ return roles.some((r) => r.member);
47
+ }
48
+ /**
49
+ * Get the MemberType for a user based on their roles.
50
+ * Default implementation: system > admin > member > anonymous.
51
+ */
52
+ async getMemberType(userId) {
53
+ const roles = await this.getUserRoles(userId);
54
+ if (roles.some((r) => r.system)) {
55
+ return ecies_lib_1.MemberType.System;
56
+ }
57
+ else if (roles.some((r) => r.admin)) {
58
+ return ecies_lib_1.MemberType.Admin;
59
+ }
60
+ else if (roles.some((r) => r.member)) {
61
+ return ecies_lib_1.MemberType.User;
62
+ }
63
+ else {
64
+ return ecies_lib_1.MemberType.Anonymous;
65
+ }
66
+ }
67
+ }
68
+ exports.AbstractRoleService = AbstractRoleService;
69
+ //# sourceMappingURL=abstract-role-service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"abstract-role-service.js","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-node-express-suite/src/services/abstract-role-service.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAEH,0DAAwD;AAKxD,iCAAqC;AAErC;;;;;;;;;;;;;GAaG;AACH,MAAsB,mBAOpB,SAAQ,kBAA8B;IAGtC,YAAY,WAAyB;QACnC,KAAK,CAAC,WAAW,CAAC,CAAC;IACrB,CAAC;IAyBD,qEAAqE;IAErE;;;OAGG;IACI,KAAK,CAAC,WAAW,CAAC,MAAW;QAClC,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;QAC9C,OAAO,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;IACpC,CAAC;IAED;;;OAGG;IACI,KAAK,CAAC,YAAY,CAAC,MAAW;QACnC,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;QAC9C,OAAO,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;IACrC,CAAC;IAED;;;OAGG;IACI,KAAK,CAAC,aAAa,CAAC,MAAW;QACpC,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;QAC9C,IAAI,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC;YAChC,OAAO,sBAAU,CAAC,MAAM,CAAC;QAC3B,CAAC;aAAM,IAAI,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC;YACtC,OAAO,sBAAU,CAAC,KAAK,CAAC;QAC1B,CAAC;aAAM,IAAI,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC;YACvC,OAAO,sBAAU,CAAC,IAAI,CAAC;QACzB,CAAC;aAAM,CAAC;YACN,OAAO,sBAAU,CAAC,SAAS,CAAC;QAC9B,CAAC;IACH,CAAC;CACF;AAzED,kDAyEC"}
@@ -1,3 +1,5 @@
1
+ export * from './abstract-jwt-service';
2
+ export * from './abstract-role-service';
1
3
  export * from './base';
2
4
  export * from './checksum';
3
5
  export * from './dummy-email-service';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-node-express-suite/src/services/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,uBAAuB,CAAC;AACtC,cAAc,OAAO,CAAC;AACtB,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,OAAO,CAAC;AACtB,cAAc,QAAQ,CAAC;AACvB,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-node-express-suite/src/services/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC;AACxC,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,uBAAuB,CAAC;AACtC,cAAc,OAAO,CAAC;AACtB,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,OAAO,CAAC;AACtB,cAAc,QAAQ,CAAC;AACvB,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC"}
@@ -1,6 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./abstract-jwt-service"), exports);
5
+ tslib_1.__exportStar(require("./abstract-role-service"), exports);
4
6
  tslib_1.__exportStar(require("./base"), exports);
5
7
  tslib_1.__exportStar(require("./checksum"), exports);
6
8
  tslib_1.__exportStar(require("./dummy-email-service"), exports);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-node-express-suite/src/services/index.ts"],"names":[],"mappings":";;;AAAA,iDAAuB;AACvB,qDAA2B;AAC3B,gEAAsC;AACtC,gDAAsB;AACtB,8DAAoC;AACpC,yDAA+B;AAC/B,sDAA4B;AAC5B,wDAA8B;AAC9B,gDAAsB;AACtB,iDAAuB;AACvB,wDAA8B;AAC9B,yDAA+B"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-node-express-suite/src/services/index.ts"],"names":[],"mappings":";;;AAAA,iEAAuC;AACvC,kEAAwC;AACxC,iDAAuB;AACvB,qDAA2B;AAC3B,gEAAsC;AACtC,gDAAsB;AACtB,8DAAoC;AACpC,yDAA+B;AAC/B,sDAA4B;AAC5B,wDAA8B;AAC9B,gDAAsB;AACtB,iDAAuB;AACvB,wDAA8B;AAC9B,yDAA+B"}