wingbot-mongodb 2.21.2 → 2.21.3-beta.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.
@@ -1 +1 @@
1
- {"processes":{"32821199-22af-42bd-8e0d-c255510f3efa":{"parent":null,"children":[]}},"files":{"/Users/david/Downloads/wingbot-mongodb/src/AttachmentCache.js":["32821199-22af-42bd-8e0d-c255510f3efa"],"/Users/david/Downloads/wingbot-mongodb/src/AuditLogStorage.js":["32821199-22af-42bd-8e0d-c255510f3efa"],"/Users/david/Downloads/wingbot-mongodb/src/BaseStorage.js":["32821199-22af-42bd-8e0d-c255510f3efa"],"/Users/david/Downloads/wingbot-mongodb/src/BotConfigStorage.js":["32821199-22af-42bd-8e0d-c255510f3efa"],"/Users/david/Downloads/wingbot-mongodb/src/BotTokenStorage.js":["32821199-22af-42bd-8e0d-c255510f3efa"],"/Users/david/Downloads/wingbot-mongodb/src/tokenFactory.js":["32821199-22af-42bd-8e0d-c255510f3efa"],"/Users/david/Downloads/wingbot-mongodb/src/ChatLogStorage.js":["32821199-22af-42bd-8e0d-c255510f3efa"],"/Users/david/Downloads/wingbot-mongodb/src/NotificationsStorage.js":["32821199-22af-42bd-8e0d-c255510f3efa"],"/Users/david/Downloads/wingbot-mongodb/src/StateStorage.js":["32821199-22af-42bd-8e0d-c255510f3efa"]},"externalIds":{}}
1
+ {"processes":{"8cd701fd-7d02-4d21-90bc-0f9eafe331ec":{"parent":null,"children":[]}},"files":{"/Users/david/Development/wingbot-mongodb/src/AttachmentCache.js":["8cd701fd-7d02-4d21-90bc-0f9eafe331ec"],"/Users/david/Development/wingbot-mongodb/src/AuditLogStorage.js":["8cd701fd-7d02-4d21-90bc-0f9eafe331ec"],"/Users/david/Development/wingbot-mongodb/src/BaseStorage.js":["8cd701fd-7d02-4d21-90bc-0f9eafe331ec"],"/Users/david/Development/wingbot-mongodb/src/BotConfigStorage.js":["8cd701fd-7d02-4d21-90bc-0f9eafe331ec"],"/Users/david/Development/wingbot-mongodb/src/BotTokenStorage.js":["8cd701fd-7d02-4d21-90bc-0f9eafe331ec"],"/Users/david/Development/wingbot-mongodb/src/tokenFactory.js":["8cd701fd-7d02-4d21-90bc-0f9eafe331ec"],"/Users/david/Development/wingbot-mongodb/src/ChatLogStorage.js":["8cd701fd-7d02-4d21-90bc-0f9eafe331ec"],"/Users/david/Development/wingbot-mongodb/src/NotificationsStorage.js":["8cd701fd-7d02-4d21-90bc-0f9eafe331ec"],"/Users/david/Development/wingbot-mongodb/src/StateStorage.js":["8cd701fd-7d02-4d21-90bc-0f9eafe331ec"]},"externalIds":{}}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wingbot-mongodb",
3
- "version": "2.21.2",
3
+ "version": "2.21.3-beta.1",
4
4
  "description": "MongoDB storage for wingbot.ai",
5
5
  "main": "src/main.js",
6
6
  "scripts": {
@@ -9,6 +9,7 @@ const BaseStorage = require('./BaseStorage');
9
9
  const USER_INDEX = 'senderId_1_pageId_1';
10
10
  const LAST_INTERACTION_INDEX = 'lastInteraction_1';
11
11
  const SEARCH = 'search-text';
12
+ const NAME = 'name_1';
12
13
 
13
14
  /**
14
15
  * @typedef {object} State
@@ -48,7 +49,12 @@ class StateStorage extends BaseStorage {
48
49
  { name: LAST_INTERACTION_INDEX }
49
50
  );
50
51
 
51
- if (!isCosmo) {
52
+ if (isCosmo) {
53
+ this.addIndex(
54
+ { name: 1 },
55
+ { name: NAME }
56
+ );
57
+ } else {
52
58
  this.addIndex(
53
59
  { '$**': 'text' },
54
60
  { name: SEARCH }
@@ -156,8 +162,12 @@ class StateStorage extends BaseStorage {
156
162
 
157
163
  if (searchStates) {
158
164
  if (this._isCosmo) {
165
+ const $regex = `^${condition.search}`.replace(/[-/\\^$*+?.()|[\]{}]/g, '\\$&');
159
166
  Object.assign(useCondition, {
160
- name: { $regex: condition.search, $options: 'i' }
167
+ $or: [
168
+ { senderId: { $regex } },
169
+ { name: { $regex } }
170
+ ]
161
171
  });
162
172
  } else {
163
173
  Object.assign(useCondition, {