wingbot-mongodb 4.2.8 → 4.2.10

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.
@@ -0,0 +1 @@
1
+ {"parent":null,"pid":2997333,"argv":["/nix/store/h4apbnz8p5fmjwcmzlaxcjm5vr70d97x-nodejs-slim-24.13.0/bin/node","/home/lika85456/workspace/wingbot/wingbot-mongodb/node_modules/.bin/mocha","./test"],"execArgv":[],"cwd":"/home/lika85456/workspace/wingbot/wingbot-mongodb","time":1772622254531,"ppid":2997322,"coverageFilename":"/home/lika85456/workspace/wingbot/wingbot-mongodb/.nyc_output/561e17b4-b0de-410b-ab5f-ce9b6ffe8232.json","externalId":"","uuid":"561e17b4-b0de-410b-ab5f-ce9b6ffe8232","files":["/home/lika85456/workspace/wingbot/wingbot-mongodb/src/BaseStorage.js","/home/lika85456/workspace/wingbot/wingbot-mongodb/src/defaultLogger.js","/home/lika85456/workspace/wingbot/wingbot-mongodb/src/getNestedObjects.js","/home/lika85456/workspace/wingbot/wingbot-mongodb/src/AttachmentCache.js","/home/lika85456/workspace/wingbot/wingbot-mongodb/src/AuditLogStorage.js","/home/lika85456/workspace/wingbot/wingbot-mongodb/src/BotConfigStorage.js","/home/lika85456/workspace/wingbot/wingbot-mongodb/src/BotTokenStorage.js","/home/lika85456/workspace/wingbot/wingbot-mongodb/src/tokenFactory.js","/home/lika85456/workspace/wingbot/wingbot-mongodb/src/ChatLogStorage.js","/home/lika85456/workspace/wingbot/wingbot-mongodb/src/NotificationsStorage.js","/home/lika85456/workspace/wingbot/wingbot-mongodb/src/StateStorage.js"]}
@@ -1 +1 @@
1
- {"processes":{"e6d9f3c1-d3d8-4e19-a2e5-18bcc8f35eb7":{"parent":null,"children":[]}},"files":{"/Users/david/Development/wingbot-mongodb/src/BaseStorage.js":["e6d9f3c1-d3d8-4e19-a2e5-18bcc8f35eb7"],"/Users/david/Development/wingbot-mongodb/src/defaultLogger.js":["e6d9f3c1-d3d8-4e19-a2e5-18bcc8f35eb7"],"/Users/david/Development/wingbot-mongodb/src/getNestedObjects.js":["e6d9f3c1-d3d8-4e19-a2e5-18bcc8f35eb7"],"/Users/david/Development/wingbot-mongodb/src/AttachmentCache.js":["e6d9f3c1-d3d8-4e19-a2e5-18bcc8f35eb7"],"/Users/david/Development/wingbot-mongodb/src/AuditLogStorage.js":["e6d9f3c1-d3d8-4e19-a2e5-18bcc8f35eb7"],"/Users/david/Development/wingbot-mongodb/src/BotConfigStorage.js":["e6d9f3c1-d3d8-4e19-a2e5-18bcc8f35eb7"],"/Users/david/Development/wingbot-mongodb/src/BotTokenStorage.js":["e6d9f3c1-d3d8-4e19-a2e5-18bcc8f35eb7"],"/Users/david/Development/wingbot-mongodb/src/tokenFactory.js":["e6d9f3c1-d3d8-4e19-a2e5-18bcc8f35eb7"],"/Users/david/Development/wingbot-mongodb/src/ChatLogStorage.js":["e6d9f3c1-d3d8-4e19-a2e5-18bcc8f35eb7"],"/Users/david/Development/wingbot-mongodb/src/NotificationsStorage.js":["e6d9f3c1-d3d8-4e19-a2e5-18bcc8f35eb7"],"/Users/david/Development/wingbot-mongodb/src/StateStorage.js":["e6d9f3c1-d3d8-4e19-a2e5-18bcc8f35eb7"]},"externalIds":{}}
1
+ {"processes":{"561e17b4-b0de-410b-ab5f-ce9b6ffe8232":{"parent":null,"children":[]}},"files":{"/home/lika85456/workspace/wingbot/wingbot-mongodb/src/BaseStorage.js":["561e17b4-b0de-410b-ab5f-ce9b6ffe8232"],"/home/lika85456/workspace/wingbot/wingbot-mongodb/src/defaultLogger.js":["561e17b4-b0de-410b-ab5f-ce9b6ffe8232"],"/home/lika85456/workspace/wingbot/wingbot-mongodb/src/getNestedObjects.js":["561e17b4-b0de-410b-ab5f-ce9b6ffe8232"],"/home/lika85456/workspace/wingbot/wingbot-mongodb/src/AttachmentCache.js":["561e17b4-b0de-410b-ab5f-ce9b6ffe8232"],"/home/lika85456/workspace/wingbot/wingbot-mongodb/src/AuditLogStorage.js":["561e17b4-b0de-410b-ab5f-ce9b6ffe8232"],"/home/lika85456/workspace/wingbot/wingbot-mongodb/src/BotConfigStorage.js":["561e17b4-b0de-410b-ab5f-ce9b6ffe8232"],"/home/lika85456/workspace/wingbot/wingbot-mongodb/src/BotTokenStorage.js":["561e17b4-b0de-410b-ab5f-ce9b6ffe8232"],"/home/lika85456/workspace/wingbot/wingbot-mongodb/src/tokenFactory.js":["561e17b4-b0de-410b-ab5f-ce9b6ffe8232"],"/home/lika85456/workspace/wingbot/wingbot-mongodb/src/ChatLogStorage.js":["561e17b4-b0de-410b-ab5f-ce9b6ffe8232"],"/home/lika85456/workspace/wingbot/wingbot-mongodb/src/NotificationsStorage.js":["561e17b4-b0de-410b-ab5f-ce9b6ffe8232"],"/home/lika85456/workspace/wingbot/wingbot-mongodb/src/StateStorage.js":["561e17b4-b0de-410b-ab5f-ce9b6ffe8232"]},"externalIds":{}}
package/LICENSE CHANGED
File without changes
package/README.md CHANGED
File without changes
package/jsconfig.json CHANGED
File without changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wingbot-mongodb",
3
- "version": "4.2.8",
3
+ "version": "4.2.10",
4
4
  "description": "MongoDB storage for wingbot.ai",
5
5
  "main": "src/main.js",
6
6
  "types": "types/main.d.ts",
@@ -49,7 +49,7 @@
49
49
  "jsdoc-to-markdown": "^7.1.1",
50
50
  "jsdoc-tsimport-plugin": "^1.0.5",
51
51
  "mocha": "^10.1.0",
52
- "mongodb": "^6.1.0",
52
+ "mongodb": "^6.21.0",
53
53
  "nyc": "^15.1.0",
54
54
  "typescript": "^5.9.3",
55
55
  "wingbot": "^3.46.3"
File without changes
@@ -13,15 +13,9 @@ const getNestedObjects = require('./getNestedObjects');
13
13
  /** @typedef {import('mongodb').Document} Document */
14
14
  /** @typedef {import('mongodb').CreateIndexesOptions} CreateIndexesOptions */
15
15
 
16
- /**
17
- * @template T=ObjectId
18
- * @typedef {object} CustomIdentifier
19
- * @prop {T} _id
20
- */
21
-
22
16
  /**
23
17
  * @template {object} T
24
- * @typedef {T & CustomIdentifier<ObjectId>} WithId
18
+ * @typedef {import('mongodb').WithId<T>} WithId
25
19
  */
26
20
 
27
21
  /**
@@ -42,7 +36,7 @@ function signReplacer (k, v) {
42
36
  }
43
37
 
44
38
  /**
45
- * @template T={} {Document}
39
+ * @template T={Document}
46
40
  */
47
41
  class BaseStorage {
48
42
 
@@ -181,7 +175,7 @@ class BaseStorage {
181
175
  * @returns {Promise<import('mongodb').Collection<WithId<T>>>}
182
176
  */
183
177
  preHeat () {
184
- return this._getCollection();
178
+ return this._getCollection(false, true);
185
179
  }
186
180
 
187
181
  /**
@@ -295,9 +289,10 @@ class BaseStorage {
295
289
  *
296
290
  * @protected
297
291
  * @param {boolean} [forRead]
292
+ * @param {boolean} [forceIndexAwait=false]
298
293
  * @returns {Promise<import('mongodb').Collection<WithId<T>>>}
299
294
  */
300
- async _getCollection (forRead = false) {
295
+ async _getCollection (forRead = false, forceIndexAwait = false) {
301
296
  if (this._collection === null) {
302
297
  let c;
303
298
  try {
@@ -311,9 +306,11 @@ class BaseStorage {
311
306
  }
312
307
  }
313
308
 
309
+ const requiresIndexAwait = this._shouldWaitForIndex
310
+ && (!forRead || this._shouldIndexBeforeRead);
311
+
314
312
  if (this._indexing
315
- && this._shouldWaitForIndex
316
- && (!forRead || this._shouldIndexBeforeRead)) {
313
+ && (requiresIndexAwait || forceIndexAwait)) {
317
314
 
318
315
  const err = await this._indexing;
319
316
  this._indexing = false;
File without changes
File without changes
File without changes
package/src/compact.js CHANGED
File without changes
File without changes
File without changes
package/src/main.js CHANGED
File without changes
File without changes
@@ -1,6 +1,6 @@
1
1
  export = BaseStorage;
2
2
  /**
3
- * @template T={} {Document}
3
+ * @template T={Document}
4
4
  */
5
5
  declare class BaseStorage<T> {
6
6
  static netFailuresIntervalMs: number;
@@ -131,9 +131,10 @@ declare class BaseStorage<T> {
131
131
  *
132
132
  * @protected
133
133
  * @param {boolean} [forRead]
134
+ * @param {boolean} [forceIndexAwait=false]
134
135
  * @returns {Promise<import('mongodb').Collection<WithId<T>>>}
135
136
  */
136
- protected _getCollection(forRead?: boolean): Promise<import("mongodb").Collection<WithId<T>>>;
137
+ protected _getCollection(forRead?: boolean, forceIndexAwait?: boolean): Promise<import("mongodb").Collection<WithId<T>>>;
137
138
  /**
138
139
  *
139
140
  * @param {object[]} indexes
@@ -176,13 +177,10 @@ declare class BaseStorage<T> {
176
177
  drop(): Promise<any>;
177
178
  }
178
179
  declare namespace BaseStorage {
179
- export { Db, Document, CreateIndexesOptions, CustomIdentifier, WithId };
180
+ export { Db, Document, CreateIndexesOptions, WithId };
180
181
  }
181
182
  import { ObjectId } from "mongodb";
182
183
  type Db = import("mongodb").Db;
183
184
  type Document = import("mongodb").Document;
184
185
  type CreateIndexesOptions = import("mongodb").CreateIndexesOptions;
185
- type CustomIdentifier<T> = {
186
- _id: T;
187
- };
188
- type WithId<T extends unknown> = T & CustomIdentifier<ObjectId>;
186
+ type WithId<T extends unknown> = import("mongodb").WithId<T>;