@resolveio/server-lib 22.3.211 → 22.3.213

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.
@@ -7411,7 +7411,7 @@ function extractAssistantDataIntentCustomerText(message) {
7411
7411
  value = value.replace(/\b(?:last|past|previous|over\s+the\s+last)\s+(?:few|couple|couple\s+of|several)\s+(?:days?|weeks?|months?|years?)\b/gi, ' ');
7412
7412
  value = value.replace(/\b(?:last|past)\s+[0-9]+\s+(?:days?|weeks?|months?)\b/gi, ' ');
7413
7413
  value = value.replace(/\b(?:this|current)\s+(?:week|month|quarter|year)\b/gi, ' ');
7414
- value = value.replace(/\b(?:last|past)\s+(?:week|month|quarter|year)\b/gi, ' ');
7414
+ value = value.replace(/\b(?:last|past|previous|over\s+the\s+last)\s+(?:week|month|quarter|year)\b/gi, ' ');
7415
7415
  value = value.replace(/\byear\s+to\s+date\b/gi, ' ');
7416
7416
  value = value.replace(/\b(how|many|much|number|numbers|count|counts|summarize|summary|show|list|give|pull|find|tell|me|about|of|the|a|an|and|or|with|without|amount|quantity|qty|total|totals|for|to|them|their|we|our|us|right|now|by|what|which|were|was|is|are|has|have|had|been|did|do|does|get|report|all)\b/gi, ' ');
7417
7417
  value = value.replace(/\b(work\s*orders?|wos?|jobs?|invoices?|invoice|invoiced|invoicing|billed|billing|revenue|charged|chemicals?|chemical|sent|shipped|shipment|shipments|delivered|planned|inventory|on\s+hand|stock|ytd|status|state|open|completed|reviewed|closed|monthly|month)\b/gi, ' ');
@@ -7448,11 +7448,11 @@ function extractAssistantDataIntentLikelyFilterText(message, intent) {
7448
7448
  value = value.replace(/\b(?:last|past|previous|over\s+the\s+last)\s+(?:few|couple|couple\s+of|several)\s+(?:days?|weeks?|months?|years?)\b/gi, ' ');
7449
7449
  value = value.replace(/\b(?:last|past)\s+[0-9]+\s+(?:days?|weeks?|months?)\b/gi, ' ');
7450
7450
  value = value.replace(/\b(?:this|current)\s+(?:week|month|quarter|year)\b/gi, ' ');
7451
- value = value.replace(/\b(?:last|past)\s+(?:week|month|quarter|year)\b/gi, ' ');
7451
+ value = value.replace(/\b(?:last|past|previous|over\s+the\s+last)\s+(?:week|month|quarter|year)\b/gi, ' ');
7452
7452
  value = value.replace(/\b(?:until|through|since)\s+[a-z]+\s+[0-9]{1,2}\b/gi, ' ');
7453
7453
  value = value.replace(/\byear\s+to\s+date\b/gi, ' ');
7454
7454
  value = value.replace(/\b(?:by|per|group(?:ed)?(?:\s+by)?|split(?:\s+by)?)\s+[a-z0-9 _/-]+\b/gi, ' ');
7455
- value = value.replace(/\b(how|many|much|number|numbers|count|counts|summarize|summary|show|list|give|pull|find|tell|me|about|of|the|a|an|and|or|with|without|in|from|amount|quantity|qty|volume|total|totals|for|to|them|their|we|our|us|right|now|by|what|which|were|was|is|are|has|have|had|been|did|do|does|get|report|reports|all|break\s+down|breakdown|activity|activities|transactions?|movement|movements?|chemicals?|chemical|products?|product|inventory|invoices?|invoice|invoiced|invoicing|billed|billing|revenue|charged|usage|monthly|month|current|jobs?|work\s+orders?|blends?|blended|blending|planned|sent|shipped|shipment|shipments|delivered|created|increased?|decreased?|positive|negative|open|closed|completed|reviewed|this)\b/gi, ' ');
7455
+ value = value.replace(/\b(how|many|much|number|numbers|count|counts|summarize|summary|show|list|give|pull|find|tell|me|about|of|the|a|an|and|or|with|without|in|from|over|amount|quantity|qty|volume|total|totals|for|to|them|their|we|our|us|right|now|by|what|which|were|was|is|are|has|have|had|been|did|do|does|get|report|reports|all|break\s+down|breakdown|activity|activities|transactions?|movement|movements?|chemicals?|chemical|products?|product|inventory|invoices?|invoice|invoiced|invoicing|billed|billing|revenue|charged|usage|monthly|month|current|jobs?|work\s+orders?|blends?|blended|blending|planned|sent|shipped|shipment|shipments|delivered|created|increased?|decreased?|positive|negative|open|closed|completed|reviewed|this)\b/gi, ' ');
7456
7456
  var filterTerms = new Set();
7457
7457
  buildAssistantAppDataFilterCandidates(intent).forEach(function (filterField) {
7458
7458
  (filterField.terms || []).forEach(function (term) { return filterTerms.add(normalizeOptionalString(term).toLowerCase()); });
@@ -10167,7 +10167,15 @@ function buildAssistantFieldFilterCondition(value, operator, type) {
10167
10167
  if (type === 'boolean') {
10168
10168
  return coerced;
10169
10169
  }
10170
- var escaped = escapeRegexValue(String(coerced));
10170
+ var rawString = String(coerced);
10171
+ var escaped = normalizedOperator === 'contains'
10172
+ ? rawString
10173
+ .split(/[^a-z0-9%&]+/i)
10174
+ .map(function (token) { return normalizeOptionalString(token); })
10175
+ .filter(function (token) { return token.length > 1 || /[0-9%&]/.test(token); })
10176
+ .map(function (token) { return escapeRegexValue(token); })
10177
+ .join('.*')
10178
+ : escapeRegexValue(rawString);
10171
10179
  if (!escaped) {
10172
10180
  return undefined;
10173
10181
  }
@@ -10182,15 +10190,36 @@ function normalizeAssistantFieldAwareFilterValue(value, candidate) {
10182
10190
  ], __read((candidate.terms || [])), false), __read((candidate.fields || [])), false).map(function (term) { return cleanAssistantRequestedDimensionText(term); })
10183
10191
  .filter(Boolean);
10184
10192
  var isDivisionCandidate = candidateTerms.some(function (term) { return term === 'division' || term === 'divisions' || term.endsWith(' division'); });
10185
- if (!isDivisionCandidate) {
10193
+ var isPersonCandidate = candidateTerms.some(function (term) { return [
10194
+ 'driver',
10195
+ 'drivers',
10196
+ 'user',
10197
+ 'users',
10198
+ 'employee',
10199
+ 'employees',
10200
+ 'person',
10201
+ 'people',
10202
+ 'name',
10203
+ 'id user',
10204
+ 'id_user'
10205
+ ].includes(term); });
10206
+ if (!isDivisionCandidate && !isPersonCandidate) {
10186
10207
  return value;
10187
10208
  }
10188
10209
  var text = normalizeOptionalString(value);
10189
10210
  if (!text) {
10190
10211
  return value;
10191
10212
  }
10192
- var normalized = normalizeOptionalString(text
10193
- .replace(/\bdivision(?:s)?\b/gi, ' ')
10213
+ var normalizedText = text;
10214
+ if (isDivisionCandidate) {
10215
+ normalizedText = normalizedText.replace(/\bdivision(?:s)?\b/gi, ' ');
10216
+ }
10217
+ if (isPersonCandidate) {
10218
+ normalizedText = normalizedText
10219
+ .replace(/\b([a-z][a-z0-9.'-]*)'s\b/gi, '$1')
10220
+ .replace(/\b(?:ats|pay|pays|settlement|settlements|driver|drivers|user|users|employee|employees|over)\b/gi, ' ');
10221
+ }
10222
+ var normalized = normalizeOptionalString(normalizedText
10194
10223
  .replace(/\s+/g, ' '));
10195
10224
  return normalized || value;
10196
10225
  }