@digitaldefiance/node-express-suite 3.12.16 → 3.13.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 (77) hide show
  1. package/package.json +1 -1
  2. package/src/application-base.d.ts +50 -47
  3. package/src/application-base.d.ts.map +1 -1
  4. package/src/application-base.js +180 -229
  5. package/src/application-base.js.map +1 -1
  6. package/src/application.d.ts +2 -1
  7. package/src/application.d.ts.map +1 -1
  8. package/src/application.js +8 -4
  9. package/src/application.js.map +1 -1
  10. package/src/index.d.ts +1 -0
  11. package/src/index.d.ts.map +1 -1
  12. package/src/index.js +3 -1
  13. package/src/index.js.map +1 -1
  14. package/src/interfaces/document-store.d.ts +38 -0
  15. package/src/interfaces/document-store.d.ts.map +1 -0
  16. package/src/interfaces/document-store.js +8 -0
  17. package/src/interfaces/document-store.js.map +1 -0
  18. package/src/interfaces/failable-result.d.ts +1 -6
  19. package/src/interfaces/failable-result.d.ts.map +1 -1
  20. package/src/interfaces/failable-result.js +0 -5
  21. package/src/interfaces/failable-result.js.map +1 -1
  22. package/src/interfaces/index.d.ts +2 -0
  23. package/src/interfaces/index.d.ts.map +1 -1
  24. package/src/interfaces/index.js +2 -0
  25. package/src/interfaces/index.js.map +1 -1
  26. package/src/interfaces/storage/client-session.d.ts +22 -0
  27. package/src/interfaces/storage/client-session.d.ts.map +1 -0
  28. package/src/interfaces/storage/client-session.js +3 -0
  29. package/src/interfaces/storage/client-session.js.map +1 -0
  30. package/src/interfaces/storage/collection.d.ts +80 -0
  31. package/src/interfaces/storage/collection.d.ts.map +1 -0
  32. package/src/interfaces/storage/collection.js +3 -0
  33. package/src/interfaces/storage/collection.js.map +1 -0
  34. package/src/interfaces/storage/database-lifecycle-hooks.d.ts +43 -0
  35. package/src/interfaces/storage/database-lifecycle-hooks.d.ts.map +1 -0
  36. package/src/interfaces/storage/database-lifecycle-hooks.js +3 -0
  37. package/src/interfaces/storage/database-lifecycle-hooks.js.map +1 -0
  38. package/src/interfaces/storage/database.d.ts +30 -0
  39. package/src/interfaces/storage/database.d.ts.map +1 -0
  40. package/src/interfaces/storage/database.js +3 -0
  41. package/src/interfaces/storage/database.js.map +1 -0
  42. package/src/interfaces/storage/document-types.d.ts +413 -0
  43. package/src/interfaces/storage/document-types.d.ts.map +1 -0
  44. package/src/interfaces/storage/document-types.js +8 -0
  45. package/src/interfaces/storage/document-types.js.map +1 -0
  46. package/src/interfaces/storage/index.d.ts +6 -0
  47. package/src/interfaces/storage/index.d.ts.map +1 -0
  48. package/src/interfaces/storage/index.js +9 -0
  49. package/src/interfaces/storage/index.js.map +1 -0
  50. package/src/services/index.d.ts +4 -0
  51. package/src/services/index.d.ts.map +1 -1
  52. package/src/services/index.js +4 -0
  53. package/src/services/index.js.map +1 -1
  54. package/src/services/mongoose-collection.d.ts +52 -0
  55. package/src/services/mongoose-collection.d.ts.map +1 -0
  56. package/src/services/mongoose-collection.js +326 -0
  57. package/src/services/mongoose-collection.js.map +1 -0
  58. package/src/services/mongoose-database.d.ts +64 -0
  59. package/src/services/mongoose-database.d.ts.map +1 -0
  60. package/src/services/mongoose-database.js +121 -0
  61. package/src/services/mongoose-database.js.map +1 -0
  62. package/src/services/mongoose-document-store.d.ts +109 -0
  63. package/src/services/mongoose-document-store.d.ts.map +1 -0
  64. package/src/services/mongoose-document-store.js +264 -0
  65. package/src/services/mongoose-document-store.js.map +1 -0
  66. package/src/services/mongoose-session-adapter.d.ts +39 -0
  67. package/src/services/mongoose-session-adapter.d.ts.map +1 -0
  68. package/src/services/mongoose-session-adapter.js +63 -0
  69. package/src/services/mongoose-session-adapter.js.map +1 -0
  70. package/src/utils/default-mongo-uri-validator.d.ts +15 -0
  71. package/src/utils/default-mongo-uri-validator.d.ts.map +1 -0
  72. package/src/utils/default-mongo-uri-validator.js +46 -0
  73. package/src/utils/default-mongo-uri-validator.js.map +1 -0
  74. package/src/utils.d.ts +21 -2
  75. package/src/utils.d.ts.map +1 -1
  76. package/src/utils.js +124 -49
  77. package/src/utils.js.map +1 -1
package/src/index.d.ts CHANGED
@@ -37,4 +37,5 @@ export * from './openapi';
37
37
  export { type DEBUG_TYPE, debugLog, directLog, getValueAtPath, mapZodIssuesToValidationErrors, requireValidatedFieldsAsync, requireOneOfValidatedFieldsAsync, requireValidatedFieldsOrThrow, isValidStringObjectId as isValidStringId, DEFAULT_RETRY_ATTEMPTS, DEFAULT_TRANSACTION_TIMEOUT, DEFAULT_TRANSACTION_LOCK_REQUEST_TIMEOUT, type TransactionOptions, getDefaultBaseDelay, withTransaction, sendApiMessageResponse, sendApiErrorResponse, sendApiExpressValidationErrorResponse, sendApiMongoValidationErrorResponse, sendRawJsonResponse, handleError, locatePEMRoot, lengthEncodeData, decodeLengthEncodedData, isValidTimezone, omit, validateEnumCollection, uint8ArrayToBase64, base64ToUint8Array, uint8ArrayToHex, hexToUint8Array, crc16, stringToUint8Array, uint8ArrayToString, randomBytes, arraysEqual, concatUint8Arrays, getLengthEncodingTypeForLength, getLengthEncodingTypeFromValue, getLengthForLengthType, parseBackupCodes, isValidHostname, parseHostnames, } from './utils';
38
38
  export type { TransactionOptions as UtilsTransactionOptions } from './utils';
39
39
  export * from './validation';
40
+ export { defaultMongoUriValidator } from './utils/default-mongo-uri-validator';
40
41
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../packages/digitaldefiance-node-express-suite/src/index.ts"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,CAAC;AAE1B,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,wBAAwB,CAAC;AACvC,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,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AK,UAAU,EACf,QAAQ,EACR,SAAS,EACT,cAAc,EACd,8BAA8B,EAC9B,2BAA2B,EAC3B,gCAAgC,EAChC,6BAA6B,EAC7B,qBAAqB,IAAI,eAAe,EACxC,sBAAsB,EACtB,2BAA2B,EAC3B,wCAAwC,EACxC,KAAK,kBAAkB,EACvB,mBAAmB,EACnB,eAAe,EACf,sBAAsB,EACtB,oBAAoB,EACpB,qCAAqC,EACrC,mCAAmC,EACnC,mBAAmB,EACnB,WAAW,EACX,aAAa,EACb,gBAAgB,EAChB,uBAAuB,EACvB,eAAe,EACf,IAAI,EACJ,sBAAsB,EACtB,kBAAkB,EAClB,kBAAkB,EAClB,eAAe,EACf,eAAe,EACf,KAAK,EACL,kBAAkB,EAClB,kBAAkB,EAClB,WAAW,EACX,WAAW,EACX,iBAAiB,EACjB,8BAA8B,EAC9B,8BAA8B,EAC9B,sBAAsB,EACtB,gBAAgB,EAChB,eAAe,EACf,cAAc,GACf,MAAM,SAAS,CAAC;AACjB,YAAY,EAAE,kBAAkB,IAAI,uBAAuB,EAAE,MAAM,SAAS,CAAC;AAC7E,cAAc,cAAc,CAAC;AAC7B,OAAO,EAAE,wBAAwB,EAAE,MAAM,qCAAqC,CAAC"}
package/src/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.parseHostnames = exports.isValidHostname = exports.parseBackupCodes = exports.getLengthForLengthType = exports.getLengthEncodingTypeFromValue = exports.getLengthEncodingTypeForLength = exports.concatUint8Arrays = exports.arraysEqual = exports.randomBytes = exports.uint8ArrayToString = exports.stringToUint8Array = exports.crc16 = exports.hexToUint8Array = exports.uint8ArrayToHex = exports.base64ToUint8Array = exports.uint8ArrayToBase64 = exports.validateEnumCollection = exports.omit = exports.isValidTimezone = exports.decodeLengthEncodedData = exports.lengthEncodeData = exports.locatePEMRoot = exports.handleError = exports.sendRawJsonResponse = exports.sendApiMongoValidationErrorResponse = exports.sendApiExpressValidationErrorResponse = exports.sendApiErrorResponse = exports.sendApiMessageResponse = exports.withTransaction = exports.getDefaultBaseDelay = exports.DEFAULT_TRANSACTION_LOCK_REQUEST_TIMEOUT = exports.DEFAULT_TRANSACTION_TIMEOUT = exports.DEFAULT_RETRY_ATTEMPTS = exports.isValidStringId = exports.requireValidatedFieldsOrThrow = exports.requireOneOfValidatedFieldsAsync = exports.requireValidatedFieldsAsync = exports.mapZodIssuesToValidationErrors = exports.getValueAtPath = exports.directLog = exports.debugLog = exports.RouteBuilder = void 0;
3
+ exports.defaultMongoUriValidator = exports.parseHostnames = exports.isValidHostname = exports.parseBackupCodes = exports.getLengthForLengthType = exports.getLengthEncodingTypeFromValue = exports.getLengthEncodingTypeForLength = exports.concatUint8Arrays = exports.arraysEqual = exports.randomBytes = exports.uint8ArrayToString = exports.stringToUint8Array = exports.crc16 = exports.hexToUint8Array = exports.uint8ArrayToHex = exports.base64ToUint8Array = exports.uint8ArrayToBase64 = exports.validateEnumCollection = exports.omit = exports.isValidTimezone = exports.decodeLengthEncodedData = exports.lengthEncodeData = exports.locatePEMRoot = exports.handleError = exports.sendRawJsonResponse = exports.sendApiMongoValidationErrorResponse = exports.sendApiExpressValidationErrorResponse = exports.sendApiErrorResponse = exports.sendApiMessageResponse = exports.withTransaction = exports.getDefaultBaseDelay = exports.DEFAULT_TRANSACTION_LOCK_REQUEST_TIMEOUT = exports.DEFAULT_TRANSACTION_TIMEOUT = exports.DEFAULT_RETRY_ATTEMPTS = exports.isValidStringId = exports.requireValidatedFieldsOrThrow = exports.requireOneOfValidatedFieldsAsync = exports.requireValidatedFieldsAsync = exports.mapZodIssuesToValidationErrors = exports.getValueAtPath = exports.directLog = exports.debugLog = exports.RouteBuilder = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  require("reflect-metadata");
6
6
  tslib_1.__exportStar(require("./application"), exports);
@@ -81,4 +81,6 @@ Object.defineProperty(exports, "parseBackupCodes", { enumerable: true, get: func
81
81
  Object.defineProperty(exports, "isValidHostname", { enumerable: true, get: function () { return utils_1.isValidHostname; } });
82
82
  Object.defineProperty(exports, "parseHostnames", { enumerable: true, get: function () { return utils_1.parseHostnames; } });
83
83
  tslib_1.__exportStar(require("./validation"), exports);
84
+ var default_mongo_uri_validator_1 = require("./utils/default-mongo-uri-validator");
85
+ Object.defineProperty(exports, "defaultMongoUriValidator", { enumerable: true, get: function () { return default_mongo_uri_validator_1.defaultMongoUriValidator; } });
84
86
  //# sourceMappingURL=index.js.map
package/src/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../packages/digitaldefiance-node-express-suite/src/index.ts"],"names":[],"mappings":";;;;AAAA,4BAA0B;AAE1B,wDAA8B;AAC9B,6DAAmC;AACnC,iEAAuC;AACvC,wDAA8B;AAC9B,qDAA2B;AAC3B,sDAA4B;AAC5B,sDAA4B;AAC5B,wDAA8B;AAC9B,qDAA2B;AAC3B,uDAA6B;AAC7B,qDAA2B;AAC3B,sDAA4B;AAC5B,yDAA+B;AAC/B,wDAA8B;AAC9B,mDAAyB;AACzB,yDAA+B;AAC/B,8DAAoC;AACpC,yDAA+B;AAC/B,uDAA6B;AAC7B,wDAA8B;AAC9B,6DAAmC;AACnC,2DAAiC;AACjC,mDAAyB;AACzB,qDAA2B;AAC3B,oDAA0B;AAC1B,qDAA2B;AAC3B,sDAA4B;AAC5B,oDAA0B;AAC1B,qCAAyC;AAAhC,uGAAA,YAAY,OAAA;AAErB,oDAA0B;AAC1B,qDAA2B;AAC3B,yDAA+B;AAC/B,kDAAwB;AACxB,oDAA0B;AAC1B,iCA4CiB;AA1Cf,iGAAA,QAAQ,OAAA;AACR,kGAAA,SAAS,OAAA;AACT,uGAAA,cAAc,OAAA;AACd,uHAAA,8BAA8B,OAAA;AAC9B,oHAAA,2BAA2B,OAAA;AAC3B,yHAAA,gCAAgC,OAAA;AAChC,sHAAA,6BAA6B,OAAA;AAC7B,wGAAA,qBAAqB,OAAmB;AACxC,+GAAA,sBAAsB,OAAA;AACtB,oHAAA,2BAA2B,OAAA;AAC3B,iIAAA,wCAAwC,OAAA;AAExC,4GAAA,mBAAmB,OAAA;AACnB,wGAAA,eAAe,OAAA;AACf,+GAAA,sBAAsB,OAAA;AACtB,6GAAA,oBAAoB,OAAA;AACpB,8HAAA,qCAAqC,OAAA;AACrC,4HAAA,mCAAmC,OAAA;AACnC,4GAAA,mBAAmB,OAAA;AACnB,oGAAA,WAAW,OAAA;AACX,sGAAA,aAAa,OAAA;AACb,yGAAA,gBAAgB,OAAA;AAChB,gHAAA,uBAAuB,OAAA;AACvB,wGAAA,eAAe,OAAA;AACf,6FAAA,IAAI,OAAA;AACJ,+GAAA,sBAAsB,OAAA;AACtB,2GAAA,kBAAkB,OAAA;AAClB,2GAAA,kBAAkB,OAAA;AAClB,wGAAA,eAAe,OAAA;AACf,wGAAA,eAAe,OAAA;AACf,8FAAA,KAAK,OAAA;AACL,2GAAA,kBAAkB,OAAA;AAClB,2GAAA,kBAAkB,OAAA;AAClB,oGAAA,WAAW,OAAA;AACX,oGAAA,WAAW,OAAA;AACX,0GAAA,iBAAiB,OAAA;AACjB,uHAAA,8BAA8B,OAAA;AAC9B,uHAAA,8BAA8B,OAAA;AAC9B,+GAAA,sBAAsB,OAAA;AACtB,yGAAA,gBAAgB,OAAA;AAChB,wGAAA,eAAe,OAAA;AACf,uGAAA,cAAc,OAAA;AAGhB,uDAA6B"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../packages/digitaldefiance-node-express-suite/src/index.ts"],"names":[],"mappings":";;;;AAAA,4BAA0B;AAE1B,wDAA8B;AAC9B,6DAAmC;AACnC,iEAAuC;AACvC,wDAA8B;AAC9B,qDAA2B;AAC3B,sDAA4B;AAC5B,sDAA4B;AAC5B,wDAA8B;AAC9B,qDAA2B;AAC3B,uDAA6B;AAC7B,qDAA2B;AAC3B,sDAA4B;AAC5B,yDAA+B;AAC/B,wDAA8B;AAC9B,mDAAyB;AACzB,yDAA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0GAAA,iBAAiB,OAAA;AACjB,uHAAA,8BAA8B,OAAA;AAC9B,uHAAA,8BAA8B,OAAA;AAC9B,+GAAA,sBAAsB,OAAA;AACtB,yGAAA,gBAAgB,OAAA;AAChB,wGAAA,eAAe,OAAA;AACf,uGAAA,cAAc,OAAA;AAGhB,uDAA6B;AAC7B,mFAA+E;AAAtE,uIAAA,wBAAwB,OAAA"}
@@ -0,0 +1,38 @@
1
+ /**
2
+ * @fileoverview Storage-agnostic interface for database operations.
3
+ * Implementations wrap specific database technologies (mongoose, BrightChainDb, etc.).
4
+ * @module interfaces/document-store
5
+ */
6
+ import { Model } from '@digitaldefiance/mongoose-types';
7
+ import type { PlatformID } from '@digitaldefiance/node-ecies-lib';
8
+ import { MongoMemoryReplSet } from 'mongodb-memory-server';
9
+ import { IBaseDocument } from '../documents/base';
10
+ import { ISchema } from './schema';
11
+ import { IApplication } from './application';
12
+ /**
13
+ * Storage-agnostic interface for database operations.
14
+ * Implementations wrap specific database technologies (mongoose, BrightChainDb, etc.).
15
+ * @template TID - Platform-specific ID type extending PlatformID
16
+ * @template TModelDocs - Record mapping model names to their document types
17
+ */
18
+ export interface IDocumentStore<TID extends PlatformID = Buffer, TModelDocs extends Record<string, IBaseDocument<any, TID>> = Record<string, IBaseDocument<any, TID>>> {
19
+ /** Connect to the backing store. URI may be ignored by non-network stores. */
20
+ connect(uri?: string): Promise<void>;
21
+ /** Disconnect from the backing store. */
22
+ disconnect(): Promise<void>;
23
+ /** Whether the store is currently connected and ready for operations. */
24
+ isConnected(): boolean;
25
+ /** Retrieve a model/collection handle by name. */
26
+ getModel<T extends IBaseDocument<any, TID>>(modelName: string): Model<T>;
27
+ /** The schema map, if available (populated after connect). */
28
+ readonly schemaMap?: {
29
+ [K in keyof TModelDocs]: ISchema<TID, TModelDocs[K]>;
30
+ };
31
+ /** The dev database instance, if any (for cleanup on stop). */
32
+ readonly devDatabase?: MongoMemoryReplSet;
33
+ /** Optional: provision a dev/test database, returning its connection URI. */
34
+ setupDevStore?(): Promise<string | void>;
35
+ /** Optional: seed the dev database with initial data. */
36
+ initializeDevStore?<TInitResults>(app: IApplication<TID>): Promise<TInitResults>;
37
+ }
38
+ //# sourceMappingURL=document-store.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"document-store.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-node-express-suite/src/interfaces/document-store.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,iCAAiC,CAAC;AACxD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAClE,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AACnC,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAE7C;;;;;GAKG;AAEH,MAAM,WAAW,cAAc,CAC7B,GAAG,SAAS,UAAU,GAAG,MAAM,EAC/B,UAAU,SAAS,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,GAAG,MAAM,CACjE,MAAM,EACN,aAAa,CAAC,GAAG,EAAE,GAAG,CAAC,CACxB;IAED,8EAA8E;IAC9E,OAAO,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAErC,yCAAyC;IACzC,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAE5B,yEAAyE;IACzE,WAAW,IAAI,OAAO,CAAC;IAEvB,kDAAkD;IAClD,QAAQ,CAAC,CAAC,SAAS,aAAa,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,SAAS,EAAE,MAAM,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;IAEzE,8DAA8D;IAC9D,QAAQ,CAAC,SAAS,CAAC,EAAE;SAAG,CAAC,IAAI,MAAM,UAAU,GAAG,OAAO,CAAC,GAAG,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC;KAAE,CAAC;IAE9E,+DAA+D;IAC/D,QAAQ,CAAC,WAAW,CAAC,EAAE,kBAAkB,CAAC;IAE1C,6EAA6E;IAC7E,aAAa,CAAC,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IAEzC,yDAAyD;IACzD,kBAAkB,CAAC,CAAC,YAAY,EAC9B,GAAG,EAAE,YAAY,CAAC,GAAG,CAAC,GACrB,OAAO,CAAC,YAAY,CAAC,CAAC;CAC1B"}
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ /**
3
+ * @fileoverview Storage-agnostic interface for database operations.
4
+ * Implementations wrap specific database technologies (mongoose, BrightChainDb, etc.).
5
+ * @module interfaces/document-store
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ //# sourceMappingURL=document-store.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"document-store.js","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-node-express-suite/src/interfaces/document-store.ts"],"names":[],"mappings":";AAAA;;;;GAIG"}
@@ -1,10 +1,5 @@
1
1
  /**
2
- * @fileoverview Failable result interface for operation outcomes.
3
- * Generic interface for operations that can succeed or fail.
4
- * @module interfaces/failable-result
5
- */
6
- /**
7
- * Result of an operation that can succeed or fail.
2
+ * Result type for operations that can succeed or fail with optional data and error information.
8
3
  * @template T - Result data type
9
4
  * @property {boolean} success - True if operation succeeded
10
5
  * @property {T} [data] - Result data if successful
@@ -1 +1 @@
1
- {"version":3,"file":"failable-result.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-node-express-suite/src/interfaces/failable-result.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;;GAOG;AACH,MAAM,WAAW,eAAe,CAAC,CAAC;IAChC,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,CAAC,EAAE,CAAC,CAAC;IACT,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC;CACxB"}
1
+ {"version":3,"file":"failable-result.d.ts","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-node-express-suite/src/interfaces/failable-result.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,MAAM,WAAW,eAAe,CAAC,CAAC;IAChC,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,CAAC,EAAE,CAAC,CAAC;IACT,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC;CACxB"}
@@ -1,8 +1,3 @@
1
1
  "use strict";
2
- /**
3
- * @fileoverview Failable result interface for operation outcomes.
4
- * Generic interface for operations that can succeed or fail.
5
- * @module interfaces/failable-result
6
- */
7
2
  Object.defineProperty(exports, "__esModule", { value: true });
8
3
  //# sourceMappingURL=failable-result.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"failable-result.js","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-node-express-suite/src/interfaces/failable-result.ts"],"names":[],"mappings":";AAAA;;;;GAIG"}
1
+ {"version":3,"file":"failable-result.js","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-node-express-suite/src/interfaces/failable-result.ts"],"names":[],"mappings":""}
@@ -1,3 +1,5 @@
1
+ export * from './document-store';
2
+ export * from './storage';
1
3
  export * from './api-error-response';
2
4
  export * from './api-express-validation-error-response';
3
5
  export * from './api-message-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,sBAAsB,CAAC;AACrC,cAAc,yCAAyC,CAAC;AACxD,cAAc,wBAAwB,CAAC;AACvC,cAAc,uCAAuC,CAAC;AACtD,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,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,kBAAkB,CAAC;AACjC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,4BAA4B,CAAC;AAC3C,cAAc,cAAc,CAAC;AAC7B,cAAc,qBAAqB,CAAC;AACpC,cAAc,UAAU,CAAC;AACzB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,wBAAwB,CAAC;AACvC,cAAc,UAAU,CAAC;AACzB,cAAc,sBAAsB,CAAC;AACrC,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,WAAW,CAAC;AAE1B,cAAc,sBAAsB,CAAC;AACrC,cAAc,yCAAyC,CAAC;AACxD,cAAc,wBAAwB,CAAC;AACvC,cAAc,uCAAuC,CAAC;AACtD,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,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,kBAAkB,CAAC;AACjC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,4BAA4B,CAAC;AAC3C,cAAc,cAAc,CAAC;AAC7B,cAAc,qBAAqB,CAAC;AACpC,cAAc,UAAU,CAAC;AACzB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,wBAAwB,CAAC;AACvC,cAAc,UAAU,CAAC;AACzB,cAAc,sBAAsB,CAAC;AACrC,cAAc,wBAAwB,CAAC;AACvC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,kBAAkB,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("./document-store"), exports);
5
+ tslib_1.__exportStar(require("./storage"), exports);
4
6
  tslib_1.__exportStar(require("./api-error-response"), exports);
5
7
  tslib_1.__exportStar(require("./api-express-validation-error-response"), exports);
6
8
  tslib_1.__exportStar(require("./api-message-response"), exports);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/digitaldefiance-node-express-suite/src/interfaces/index.ts"],"names":[],"mappings":";;;AAAA,+DAAqC;AACrC,kFAAwD;AACxD,iEAAuC;AACvC,gFAAsD;AACtD,0DAAgC;AAChC,wDAA8B;AAC9B,4DAAkC;AAClC,4DAAkC;AAClC,4DAAkC;AAClC,sDAA4B;AAC5B,8DAAoC;AACpC,+DAAqC;AACrC,uDAA6B;AAC7B,2DAAiC;AACjC,2DAAiC;AACjC,sEAA4C;AAC5C,0DAAgC;AAChC,wDAA8B;AAC9B,8DAAoC;AACpC,4DAAkC;AAClC,uDAA6B;AAC7B,yDAA+B;AAC/B,qEAA2C;AAC3C,uDAA6B;AAC7B,8DAAoC;AACpC,mDAAyB;AACzB,yDAA+B;AAC/B,oDAA0B;AAC1B,oDAA0B;AAC1B,yDAA+B;AAC/B,iEAAuC;AACvC,mDAAyB;AACzB,+DAAqC;AACrC,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,oDAA0B;AAE1B,+DAAqC;AACrC,kFAAwD;AACxD,iEAAuC;AACvC,gFAAsD;AACtD,0DAAgC;AAChC,wDAA8B;AAC9B,4DAAkC;AAClC,4DAAkC;AAClC,4DAAkC;AAClC,sDAA4B;AAC5B,8DAAoC;AACpC,+DAAqC;AACrC,uDAA6B;AAC7B,2DAAiC;AACjC,2DAAiC;AACjC,sEAA4C;AAC5C,0DAAgC;AAChC,wDAA8B;AAC9B,8DAAoC;AACpC,4DAAkC;AAClC,uDAA6B;AAC7B,yDAA+B;AAC/B,qEAA2C;AAC3C,uDAA6B;AAC7B,8DAAoC;AACpC,mDAAyB;AACzB,yDAA+B;AAC/B,oDAA0B;AAC1B,oDAA0B;AAC1B,yDAA+B;AAC/B,iEAAuC;AACvC,mDAAyB;AACzB,+DAAqC;AACrC,iEAAuC;AACvC,yEAA+C;AAC/C,2DAAiC"}
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Storage-agnostic client session interface for transaction support.
3
+ *
4
+ * Both brightchain-db's DbSession and mongoose-based session adapters
5
+ * implement this interface, allowing transaction-aware code to work
6
+ * with any database backend.
7
+ */
8
+ export interface IClientSession {
9
+ /** Unique session ID */
10
+ readonly id: string;
11
+ /** Whether a transaction is currently active */
12
+ readonly inTransaction: boolean;
13
+ /** Start a new transaction */
14
+ startTransaction(): void;
15
+ /** Commit the current transaction */
16
+ commitTransaction(): Promise<void>;
17
+ /** Abort the current transaction */
18
+ abortTransaction(): Promise<void>;
19
+ /** End the session */
20
+ endSession(): void;
21
+ }
22
+ //# sourceMappingURL=client-session.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client-session.d.ts","sourceRoot":"","sources":["../../../../../../packages/digitaldefiance-node-express-suite/src/interfaces/storage/client-session.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,WAAW,cAAc;IAC7B,wBAAwB;IACxB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,gDAAgD;IAChD,QAAQ,CAAC,aAAa,EAAE,OAAO,CAAC;IAChC,8BAA8B;IAC9B,gBAAgB,IAAI,IAAI,CAAC;IACzB,qCAAqC;IACrC,iBAAiB,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACnC,oCAAoC;IACpC,gBAAgB,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAClC,sBAAsB;IACtB,UAAU,IAAI,IAAI,CAAC;CACpB"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=client-session.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client-session.js","sourceRoot":"","sources":["../../../../../../packages/digitaldefiance-node-express-suite/src/interfaces/storage/client-session.ts"],"names":[],"mappings":""}
@@ -0,0 +1,80 @@
1
+ /**
2
+ * Storage-agnostic collection interface for document CRUD, query, index,
3
+ * aggregation, schema validation, and lifecycle operations.
4
+ *
5
+ * Both brightchain-db's Collection and mongoose-based collection adapters
6
+ * implement this interface, allowing collection-level code to work with
7
+ * any database backend.
8
+ */
9
+ import { AggregationStage, BsonDocument, BulkWriteOperation, BulkWriteOptions, BulkWriteResult, ChangeListener, CollectionSchema, DeleteResult, DocumentId, FilterQuery, FindOptions, IndexOptions, IndexSpec, InsertManyResult, InsertOneResult, ReadPreference, ReplaceResult, TextIndexOptions, UpdateOptions, UpdateQuery, UpdateResult, ValidationFieldError, WriteConcern, WriteOptions } from './document-types';
10
+ export interface ICollection<T extends BsonDocument = BsonDocument> {
11
+ /** Insert a single document. */
12
+ insertOne(doc: T, options?: WriteOptions): Promise<InsertOneResult>;
13
+ /** Insert multiple documents. */
14
+ insertMany(docs: T[], options?: WriteOptions): Promise<InsertManyResult>;
15
+ /** Find the first document matching the filter. */
16
+ findOne(filter?: FilterQuery<T>, options?: FindOptions<T>): Promise<T | null>;
17
+ /**
18
+ * Find all documents matching the filter.
19
+ *
20
+ * Return type is `T[] | PromiseLike<T[]>` to accommodate both synchronous
21
+ * in-memory results (brightchain-db Cursor, which is thenable) and async
22
+ * mongoose queries.
23
+ */
24
+ find(filter?: FilterQuery<T>, options?: FindOptions<T>): T[] | PromiseLike<T[]>;
25
+ /** Find a document by its `_id`. */
26
+ findById(id: DocumentId): Promise<T | null>;
27
+ /** Update the first document matching the filter. */
28
+ updateOne(filter: FilterQuery<T>, update: UpdateQuery<T>, options?: UpdateOptions): Promise<UpdateResult>;
29
+ /** Update all documents matching the filter. */
30
+ updateMany(filter: FilterQuery<T>, update: UpdateQuery<T>, options?: UpdateOptions): Promise<UpdateResult>;
31
+ /** Delete the first document matching the filter. */
32
+ deleteOne(filter: FilterQuery<T>, options?: WriteOptions): Promise<DeleteResult>;
33
+ /** Delete all documents matching the filter. */
34
+ deleteMany(filter: FilterQuery<T>, options?: WriteOptions): Promise<DeleteResult>;
35
+ /** Replace the first document matching the filter. */
36
+ replaceOne(filter: FilterQuery<T>, doc: T, options?: UpdateOptions): Promise<ReplaceResult>;
37
+ /** Count documents matching the filter. */
38
+ countDocuments(filter?: FilterQuery<T>): Promise<number>;
39
+ /** Estimated total document count (may be faster than countDocuments). */
40
+ estimatedDocumentCount(): Promise<number>;
41
+ /** Return distinct values for a field, optionally filtered. */
42
+ distinct<K extends keyof T>(field: K, filter?: FilterQuery<T>): Promise<Array<T[K]>>;
43
+ /** Run an aggregation pipeline. */
44
+ aggregate(pipeline: AggregationStage[]): Promise<BsonDocument[]>;
45
+ /** Create an index on the collection. Returns the index name. */
46
+ createIndex(spec: IndexSpec, options?: IndexOptions): Promise<string>;
47
+ /** Drop an index by name. */
48
+ dropIndex(name: string): Promise<void>;
49
+ /** List all index names on this collection. */
50
+ listIndexes(): string[];
51
+ /** Execute multiple write operations in bulk. */
52
+ bulkWrite(operations: BulkWriteOperation<T>[], options?: BulkWriteOptions): Promise<BulkWriteResult>;
53
+ /** Watch for changes on this collection. Returns an unsubscribe function. */
54
+ watch(listener: ChangeListener<T>): () => void;
55
+ /** Set a validation schema for this collection. */
56
+ setSchema(schema: CollectionSchema): void;
57
+ /** Get the current validation schema (if any). */
58
+ getSchema(): CollectionSchema | undefined;
59
+ /** Remove the validation schema. */
60
+ removeSchema(): void;
61
+ /** Validate a document against the current schema. */
62
+ validateDoc(doc: T): ValidationFieldError[];
63
+ /** Get the current write concern. */
64
+ getWriteConcern(): WriteConcern;
65
+ /** Set the write concern for this collection. */
66
+ setWriteConcern(wc: WriteConcern): void;
67
+ /** Get the current read preference. */
68
+ getReadPreference(): ReadPreference;
69
+ /** Set the read preference for this collection. */
70
+ setReadPreference(rp: ReadPreference): void;
71
+ /** Create a text index. Returns the index name. */
72
+ createTextIndex(options: TextIndexOptions): string;
73
+ /** Drop the text index. */
74
+ dropTextIndex(): void;
75
+ /** Whether a text index exists on this collection. */
76
+ hasTextIndex(): boolean;
77
+ /** Drop this collection and all its data. */
78
+ drop(): Promise<void>;
79
+ }
80
+ //# sourceMappingURL=collection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"collection.d.ts","sourceRoot":"","sources":["../../../../../../packages/digitaldefiance-node-express-suite/src/interfaces/storage/collection.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EACL,gBAAgB,EAChB,YAAY,EACZ,kBAAkB,EAClB,gBAAgB,EAChB,eAAe,EACf,cAAc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I,CAAC,CAAC;IAEvC,+CAA+C;IAC/C,WAAW,IAAI,MAAM,EAAE,CAAC;IAIxB,iDAAiD;IACjD,SAAS,CACP,UAAU,EAAE,kBAAkB,CAAC,CAAC,CAAC,EAAE,EACnC,OAAO,CAAC,EAAE,gBAAgB,GACzB,OAAO,CAAC,eAAe,CAAC,CAAC;IAI5B,6EAA6E;IAC7E,KAAK,CAAC,QAAQ,EAAE,cAAc,CAAC,CAAC,CAAC,GAAG,MAAM,IAAI,CAAC;IAI/C,mDAAmD;IACnD,SAAS,CAAC,MAAM,EAAE,gBAAgB,GAAG,IAAI,CAAC;IAE1C,kDAAkD;IAClD,SAAS,IAAI,gBAAgB,GAAG,SAAS,CAAC;IAE1C,oCAAoC;IACpC,YAAY,IAAI,IAAI,CAAC;IAErB,sDAAsD;IACtD,WAAW,CAAC,GAAG,EAAE,CAAC,GAAG,oBAAoB,EAAE,CAAC;IAI5C,qCAAqC;IACrC,eAAe,IAAI,YAAY,CAAC;IAEhC,iDAAiD;IACjD,eAAe,CAAC,EAAE,EAAE,YAAY,GAAG,IAAI,CAAC;IAExC,uCAAuC;IACvC,iBAAiB,IAAI,cAAc,CAAC;IAEpC,mDAAmD;IACnD,iBAAiB,CAAC,EAAE,EAAE,cAAc,GAAG,IAAI,CAAC;IAI5C,mDAAmD;IACnD,eAAe,CAAC,OAAO,EAAE,gBAAgB,GAAG,MAAM,CAAC;IAEnD,2BAA2B;IAC3B,aAAa,IAAI,IAAI,CAAC;IAEtB,sDAAsD;IACtD,YAAY,IAAI,OAAO,CAAC;IAIxB,6CAA6C;IAC7C,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACvB"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=collection.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"collection.js","sourceRoot":"","sources":["../../../../../../packages/digitaldefiance-node-express-suite/src/interfaces/storage/collection.ts"],"names":[],"mappings":""}
@@ -0,0 +1,43 @@
1
+ import { IFailableResult } from '../failable-result';
2
+ /**
3
+ * Storage-agnostic lifecycle hooks for database initialization.
4
+ * Provided to BaseApplication to enable init, validation, and dev setup
5
+ * regardless of which database backend (IDatabase or IDocumentStore) is used.
6
+ *
7
+ * All hooks are optional, allowing partial configuration.
8
+ * Each hook is a stateless function (or closure) receiving all needed context
9
+ * as parameters, enabling independent unit testing.
10
+ *
11
+ * @template TInitResults - Application-specific initialization result type
12
+ */
13
+ export interface IDatabaseLifecycleHooks<TInitResults = unknown> {
14
+ /**
15
+ * Validate a database connection URI before connecting.
16
+ * Should throw on invalid or unsafe URIs.
17
+ * If not provided, BaseApplication uses a default validator.
18
+ */
19
+ validateUri?: (uri: string) => void;
20
+ /**
21
+ * Provision an ephemeral dev/test database.
22
+ * Returns the connection URI for the provisioned store.
23
+ * Called before connect() when environment.devDatabase is truthy.
24
+ */
25
+ setupDevStore?: () => Promise<string>;
26
+ /**
27
+ * Clean up the ephemeral dev/test database on shutdown.
28
+ * Called during stop() if setupDevStore was invoked.
29
+ */
30
+ teardownDevStore?: () => Promise<void>;
31
+ /**
32
+ * Initialize/seed the database after connection.
33
+ * Called after connect() when environment.devDatabase is truthy.
34
+ * Must return a failable result indicating success or failure.
35
+ */
36
+ initializeDatabase?: (application: unknown) => Promise<IFailableResult<TInitResults>>;
37
+ /**
38
+ * Hash the initialization results for logging purposes.
39
+ * Called after successful initializeDatabase when detailedDebug is enabled.
40
+ */
41
+ hashInitResults?: (initResults: TInitResults) => string;
42
+ }
43
+ //# sourceMappingURL=database-lifecycle-hooks.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"database-lifecycle-hooks.d.ts","sourceRoot":"","sources":["../../../../../../packages/digitaldefiance-node-express-suite/src/interfaces/storage/database-lifecycle-hooks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErD;;;;;;;;;;GAUG;AACH,MAAM,WAAW,uBAAuB,CAAC,YAAY,GAAG,OAAO;IAC7D;;;;OAIG;IACH,WAAW,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IAEpC;;;;OAIG;IACH,aAAa,CAAC,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,CAAC;IAEtC;;;OAGG;IACH,gBAAgB,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAEvC;;;;OAIG;IACH,kBAAkB,CAAC,EAAE,CACnB,WAAW,EAAE,OAAO,KACjB,OAAO,CAAC,eAAe,CAAC,YAAY,CAAC,CAAC,CAAC;IAE5C;;;OAGG;IACH,eAAe,CAAC,EAAE,CAAC,WAAW,EAAE,YAAY,KAAK,MAAM,CAAC;CACzD"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=database-lifecycle-hooks.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"database-lifecycle-hooks.js","sourceRoot":"","sources":["../../../../../../packages/digitaldefiance-node-express-suite/src/interfaces/storage/database-lifecycle-hooks.ts"],"names":[],"mappings":""}
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Storage-agnostic database interface for collection access, session/transaction
3
+ * management, and connection lifecycle.
4
+ *
5
+ * Both brightchain-db's BrightChainDb and mongoose-based database adapters
6
+ * implement this interface, allowing application code to work with any
7
+ * database backend through a single contract.
8
+ */
9
+ import { IClientSession } from './client-session';
10
+ import { ICollection } from './collection';
11
+ import { BsonDocument, CollectionOptions } from './document-types';
12
+ export interface IDatabase {
13
+ /** Get or create a collection by name. */
14
+ collection<T extends BsonDocument = BsonDocument>(name: string, options?: CollectionOptions): ICollection<T>;
15
+ /** Start a client session for transaction support. */
16
+ startSession(): IClientSession;
17
+ /** Run a callback within a transaction (auto-commit/abort). */
18
+ withTransaction<R>(fn: (session: IClientSession) => Promise<R>): Promise<R>;
19
+ /** List all known collection names. */
20
+ listCollections(): string[];
21
+ /** Drop a collection by name. */
22
+ dropCollection(name: string): Promise<boolean>;
23
+ /** Connect to the backing store. URI may be ignored by non-network stores. */
24
+ connect(uri?: string): Promise<void>;
25
+ /** Disconnect from the backing store. */
26
+ disconnect(): Promise<void>;
27
+ /** Whether the store is currently connected. */
28
+ isConnected(): boolean;
29
+ }
30
+ //# sourceMappingURL=database.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"database.d.ts","sourceRoot":"","sources":["../../../../../../packages/digitaldefiance-node-express-suite/src/interfaces/storage/database.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAEnE,MAAM,WAAW,SAAS;IACxB,0CAA0C;IAC1C,UAAU,CAAC,CAAC,SAAS,YAAY,GAAG,YAAY,EAC9C,IAAI,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE,iBAAiB,GAC1B,WAAW,CAAC,CAAC,CAAC,CAAC;IAElB,sDAAsD;IACtD,YAAY,IAAI,cAAc,CAAC;IAE/B,+DAA+D;IAC/D,eAAe,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,OAAO,EAAE,cAAc,KAAK,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;IAE5E,uCAAuC;IACvC,eAAe,IAAI,MAAM,EAAE,CAAC;IAE5B,iCAAiC;IACjC,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAE/C,8EAA8E;IAC9E,OAAO,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAErC,yCAAyC;IACzC,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAE5B,gDAAgD;IAChD,WAAW,IAAI,OAAO,CAAC;CACxB"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=database.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"database.js","sourceRoot":"","sources":["../../../../../../packages/digitaldefiance-node-express-suite/src/interfaces/storage/database.ts"],"names":[],"mappings":""}