@resolveio/server-lib 22.3.201 → 22.3.203
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.
- package/methods/ai-terminal.js +685 -216
- package/methods/ai-terminal.js.map +1 -1
- package/package.json +1 -1
- package/util/ai-runner-manager-policy.js +14 -0
- package/util/ai-runner-manager-policy.js.map +1 -1
- package/util/ai-runner-qa-tools.js +39 -10
- package/util/ai-runner-qa-tools.js.map +1 -1
- package/util/support-runner-v5.js +28 -2
- package/util/support-runner-v5.js.map +1 -1
package/methods/ai-terminal.js
CHANGED
|
@@ -6937,15 +6937,29 @@ function resolveAssistantDataIntentDateWindow(message) {
|
|
|
6937
6937
|
december: 11,
|
|
6938
6938
|
dec: 11
|
|
6939
6939
|
};
|
|
6940
|
+
var boundedEndMatch = text.match(/\b(?:until|through|thru|to)\s+(january|jan|february|feb|march|mar|april|apr|may|june|jun|july|jul|august|aug|september|sep|october|oct|november|nov|december|dec)\s+([0-9]{1,2})(?:,?\s+([0-9]{4}))?\b/);
|
|
6941
|
+
if (boundedEndMatch) {
|
|
6942
|
+
var endMonth = monthNames[boundedEndMatch[1]];
|
|
6943
|
+
var endDay = Math.max(1, Math.min(31, Number(boundedEndMatch[2]) || 1));
|
|
6944
|
+
var year_1 = Number(boundedEndMatch[3]) || now.getUTCFullYear();
|
|
6945
|
+
var start = /\b(?:this|current)\s+month\b/.test(text)
|
|
6946
|
+
? new Date(Date.UTC(year_1, endMonth, 1, 0, 0, 0, 0)).toISOString()
|
|
6947
|
+
: undefined;
|
|
6948
|
+
return {
|
|
6949
|
+
start: start,
|
|
6950
|
+
end: new Date(Date.UTC(year_1, endMonth, endDay, 23, 59, 59, 999)).toISOString(),
|
|
6951
|
+
year: year_1
|
|
6952
|
+
};
|
|
6953
|
+
}
|
|
6940
6954
|
var monthMatch = text.match(/\b(january|jan|february|feb|march|mar|april|apr|may|june|jun|july|jul|august|aug|september|sep|october|oct|november|nov|december|dec)\s+([0-9]{4})\b/);
|
|
6941
6955
|
if (monthMatch) {
|
|
6942
6956
|
var month = monthNames[monthMatch[1]];
|
|
6943
|
-
var
|
|
6944
|
-
if (Number.isFinite(
|
|
6957
|
+
var year_2 = Number(monthMatch[2]);
|
|
6958
|
+
if (Number.isFinite(year_2) && month >= 0) {
|
|
6945
6959
|
return {
|
|
6946
|
-
start: new Date(Date.UTC(
|
|
6947
|
-
end: new Date(Date.UTC(
|
|
6948
|
-
year:
|
|
6960
|
+
start: new Date(Date.UTC(year_2, month, 1, 0, 0, 0, 0)).toISOString(),
|
|
6961
|
+
end: new Date(Date.UTC(year_2, month + 1, 0, 23, 59, 59, 999)).toISOString(),
|
|
6962
|
+
year: year_2
|
|
6949
6963
|
};
|
|
6950
6964
|
}
|
|
6951
6965
|
}
|
|
@@ -7039,13 +7053,15 @@ function buildAssistantDataIntentMatchStage(customerText, dateField, dateWindow,
|
|
|
7039
7053
|
})
|
|
7040
7054
|
});
|
|
7041
7055
|
}
|
|
7042
|
-
if (dateField && dateWindow.start
|
|
7043
|
-
|
|
7044
|
-
|
|
7045
|
-
|
|
7046
|
-
|
|
7047
|
-
|
|
7048
|
-
|
|
7056
|
+
if (dateField && (dateWindow.start || dateWindow.end)) {
|
|
7057
|
+
var dateQuery = {};
|
|
7058
|
+
if (dateWindow.start) {
|
|
7059
|
+
dateQuery.$gte = dateWindow.start;
|
|
7060
|
+
}
|
|
7061
|
+
if (dateWindow.end) {
|
|
7062
|
+
dateQuery.$lte = dateWindow.end;
|
|
7063
|
+
}
|
|
7064
|
+
and.push((_a = {}, _a[dateField] = dateQuery, _a));
|
|
7049
7065
|
}
|
|
7050
7066
|
return and.length ? { $match: { $and: and } } : { $match: {} };
|
|
7051
7067
|
}
|
|
@@ -7144,6 +7160,365 @@ function buildAssistantGenericDataIntentPipeline(intent, customerText, dateWindo
|
|
|
7144
7160
|
});
|
|
7145
7161
|
return pipeline;
|
|
7146
7162
|
}
|
|
7163
|
+
function cleanAssistantRequestedDimensionText(value) {
|
|
7164
|
+
var text = normalizeOptionalString(value).toLowerCase();
|
|
7165
|
+
text = text.replace(/^(?:the|a|an|each|every|all)\s+/i, '');
|
|
7166
|
+
text = text.replace(/\s+(?:for|from|to|until|through|during|where|with|and|or|this|last|past|current)\s+.*$/i, '');
|
|
7167
|
+
text = text.replace(/[^a-z0-9_ -]+/gi, ' ');
|
|
7168
|
+
return normalizeOptionalString(text.replace(/\s+/g, ' ')).toLowerCase();
|
|
7169
|
+
}
|
|
7170
|
+
function extractAssistantRequestedBreakdownDimensionTexts(message) {
|
|
7171
|
+
var e_5, _a;
|
|
7172
|
+
var text = normalizeOptionalString(message).toLowerCase();
|
|
7173
|
+
if (!text) {
|
|
7174
|
+
return [];
|
|
7175
|
+
}
|
|
7176
|
+
var extracted = extractAssistantRequestedBreakdownDimensions(text)
|
|
7177
|
+
.map(function (value) { return cleanAssistantRequestedDimensionText(value); })
|
|
7178
|
+
.filter(Boolean);
|
|
7179
|
+
if (extracted.length) {
|
|
7180
|
+
return mergeAssistantHintValues(extracted);
|
|
7181
|
+
}
|
|
7182
|
+
var patterns = [
|
|
7183
|
+
/\b(?:group(?:ed)?|break(?:\s*down)?|broken\s+down|split)\s+by\s+([a-z0-9][a-z0-9_ -]{0,50}?)(?=\s+(?:for|from|to|until|through|during|this|last|past|current|where|with|and|or)\b|[,.!?;]|$)/i,
|
|
7184
|
+
/\bby\s+([a-z0-9][a-z0-9_ -]{0,50}?)(?=\s+(?:for|from|to|until|through|during|this|last|past|current|where|with|and|or)\b|[,.!?;]|$)/i,
|
|
7185
|
+
/\bper\s+([a-z0-9][a-z0-9_ -]{0,50}?)(?=\s+(?:for|from|to|until|through|during|this|last|past|current|where|with|and|or)\b|[,.!?;]|$)/i
|
|
7186
|
+
];
|
|
7187
|
+
var results = [];
|
|
7188
|
+
try {
|
|
7189
|
+
for (var patterns_2 = __values(patterns), patterns_2_1 = patterns_2.next(); !patterns_2_1.done; patterns_2_1 = patterns_2.next()) {
|
|
7190
|
+
var pattern = patterns_2_1.value;
|
|
7191
|
+
var match = text.match(pattern);
|
|
7192
|
+
var dimensionText = cleanAssistantRequestedDimensionText((match === null || match === void 0 ? void 0 : match[1]) || '');
|
|
7193
|
+
if (dimensionText) {
|
|
7194
|
+
results.push(dimensionText);
|
|
7195
|
+
}
|
|
7196
|
+
}
|
|
7197
|
+
}
|
|
7198
|
+
catch (e_5_1) { e_5 = { error: e_5_1 }; }
|
|
7199
|
+
finally {
|
|
7200
|
+
try {
|
|
7201
|
+
if (patterns_2_1 && !patterns_2_1.done && (_a = patterns_2.return)) _a.call(patterns_2);
|
|
7202
|
+
}
|
|
7203
|
+
finally { if (e_5) throw e_5.error; }
|
|
7204
|
+
}
|
|
7205
|
+
return mergeAssistantHintValues(results);
|
|
7206
|
+
}
|
|
7207
|
+
function scoreAssistantDataDimensionMatch(requestedDimensionText, dimension) {
|
|
7208
|
+
var requested = cleanAssistantRequestedDimensionText(requestedDimensionText);
|
|
7209
|
+
if (!requested) {
|
|
7210
|
+
return 0;
|
|
7211
|
+
}
|
|
7212
|
+
var score = 0;
|
|
7213
|
+
var id = cleanAssistantRequestedDimensionText(dimension.id);
|
|
7214
|
+
if (id && requested === id) {
|
|
7215
|
+
score += 10;
|
|
7216
|
+
}
|
|
7217
|
+
else if (id && containsAssistantHeuristicTerm(requested, id)) {
|
|
7218
|
+
score += 4;
|
|
7219
|
+
}
|
|
7220
|
+
(dimension.terms || []).forEach(function (term) {
|
|
7221
|
+
var normalizedTerm = cleanAssistantRequestedDimensionText(term);
|
|
7222
|
+
if (!normalizedTerm) {
|
|
7223
|
+
return;
|
|
7224
|
+
}
|
|
7225
|
+
if (requested === normalizedTerm) {
|
|
7226
|
+
score += normalizedTerm.includes(' ') ? 8 : 6;
|
|
7227
|
+
}
|
|
7228
|
+
else if (containsAssistantHeuristicTerm(requested, normalizedTerm)) {
|
|
7229
|
+
score += normalizedTerm.includes(' ') ? 4 : 2;
|
|
7230
|
+
}
|
|
7231
|
+
});
|
|
7232
|
+
return score;
|
|
7233
|
+
}
|
|
7234
|
+
function resolveAssistantTimeBreakdownGranularity(requestedDimensionText) {
|
|
7235
|
+
var requested = cleanAssistantRequestedDimensionText(requestedDimensionText);
|
|
7236
|
+
if (!requested) {
|
|
7237
|
+
return '';
|
|
7238
|
+
}
|
|
7239
|
+
if (/\b(quarter|quarters|quarterly|qtr|qtrs)\b/i.test(requested)) {
|
|
7240
|
+
return 'quarter';
|
|
7241
|
+
}
|
|
7242
|
+
if (/\b(month|months|monthly)\b/i.test(requested)) {
|
|
7243
|
+
return 'month';
|
|
7244
|
+
}
|
|
7245
|
+
if (/\b(week|weeks|weekly)\b/i.test(requested)) {
|
|
7246
|
+
return 'week';
|
|
7247
|
+
}
|
|
7248
|
+
if (/\b(day|days|daily|date)\b/i.test(requested)) {
|
|
7249
|
+
return requested === 'date' ? 'date' : 'day';
|
|
7250
|
+
}
|
|
7251
|
+
if (/\b(year|years|yearly|annual|annually)\b/i.test(requested)) {
|
|
7252
|
+
return 'year';
|
|
7253
|
+
}
|
|
7254
|
+
return '';
|
|
7255
|
+
}
|
|
7256
|
+
function buildAssistantTimeBreakdownGroupExpression(granularity, dateField) {
|
|
7257
|
+
var dateOperand = "$".concat(dateField);
|
|
7258
|
+
if (granularity === 'quarter') {
|
|
7259
|
+
return {
|
|
7260
|
+
$concat: [
|
|
7261
|
+
{ $toString: { $year: dateOperand } },
|
|
7262
|
+
'-Q',
|
|
7263
|
+
{ $toString: { $ceil: { $divide: [{ $month: dateOperand }, 3] } } }
|
|
7264
|
+
]
|
|
7265
|
+
};
|
|
7266
|
+
}
|
|
7267
|
+
var format = granularity === 'year'
|
|
7268
|
+
? '%Y'
|
|
7269
|
+
: granularity === 'week'
|
|
7270
|
+
? '%Y-W%U'
|
|
7271
|
+
: granularity === 'day' || granularity === 'date'
|
|
7272
|
+
? '%Y-%m-%d'
|
|
7273
|
+
: '%Y-%m';
|
|
7274
|
+
return {
|
|
7275
|
+
$dateToString: {
|
|
7276
|
+
format: format,
|
|
7277
|
+
date: dateOperand
|
|
7278
|
+
}
|
|
7279
|
+
};
|
|
7280
|
+
}
|
|
7281
|
+
function buildAssistantDataIntentTimeDimension(requestedDimensionText, intent) {
|
|
7282
|
+
var _a, _b, _c;
|
|
7283
|
+
var granularity = resolveAssistantTimeBreakdownGranularity(requestedDimensionText);
|
|
7284
|
+
var dateField = normalizeOptionalString(intent.dateField);
|
|
7285
|
+
if (!granularity || !dateField) {
|
|
7286
|
+
return null;
|
|
7287
|
+
}
|
|
7288
|
+
var id = granularity === 'date' ? 'date' : granularity;
|
|
7289
|
+
return {
|
|
7290
|
+
id: id,
|
|
7291
|
+
type: 'time',
|
|
7292
|
+
granularity: granularity,
|
|
7293
|
+
requestedText: requestedDimensionText,
|
|
7294
|
+
terms: [id, requestedDimensionText].filter(Boolean),
|
|
7295
|
+
groupId: (_a = {},
|
|
7296
|
+
_a[id] = buildAssistantTimeBreakdownGroupExpression(granularity, dateField),
|
|
7297
|
+
_a),
|
|
7298
|
+
project: (_b = {},
|
|
7299
|
+
_b[id] = "$_id.".concat(id),
|
|
7300
|
+
_b),
|
|
7301
|
+
sort: (_c = {},
|
|
7302
|
+
_c[id] = 1,
|
|
7303
|
+
_c)
|
|
7304
|
+
};
|
|
7305
|
+
}
|
|
7306
|
+
function extractAssistantDataIntentExpressionFieldHints(value, hints) {
|
|
7307
|
+
if (hints === void 0) { hints = new Set(); }
|
|
7308
|
+
if (typeof value === 'string') {
|
|
7309
|
+
if (value.startsWith('$') && !value.startsWith('$$') && !value.startsWith('$_id.')) {
|
|
7310
|
+
var path_1 = normalizeOptionalString(value.slice(1));
|
|
7311
|
+
if (path_1) {
|
|
7312
|
+
hints.add(path_1);
|
|
7313
|
+
}
|
|
7314
|
+
}
|
|
7315
|
+
return Array.from(hints);
|
|
7316
|
+
}
|
|
7317
|
+
if (Array.isArray(value)) {
|
|
7318
|
+
value.forEach(function (entry) { return extractAssistantDataIntentExpressionFieldHints(entry, hints); });
|
|
7319
|
+
return Array.from(hints);
|
|
7320
|
+
}
|
|
7321
|
+
if (value && typeof value === 'object') {
|
|
7322
|
+
Object.keys(value).forEach(function (key) { return extractAssistantDataIntentExpressionFieldHints(value[key], hints); });
|
|
7323
|
+
}
|
|
7324
|
+
return Array.from(hints);
|
|
7325
|
+
}
|
|
7326
|
+
function buildAssistantDataRequestMeasures(intent, pipeline) {
|
|
7327
|
+
var _a;
|
|
7328
|
+
var measures = [];
|
|
7329
|
+
var add = function (value) {
|
|
7330
|
+
var normalized = normalizeOptionalString(value);
|
|
7331
|
+
if (normalized && !measures.includes(normalized)) {
|
|
7332
|
+
measures.push(normalized);
|
|
7333
|
+
}
|
|
7334
|
+
};
|
|
7335
|
+
var groupIndex = findAggregateGroupIndex(pipeline || []);
|
|
7336
|
+
if (groupIndex > -1) {
|
|
7337
|
+
var groupStage = (_a = pipeline[groupIndex]) === null || _a === void 0 ? void 0 : _a.$group;
|
|
7338
|
+
if (groupStage && typeof groupStage === 'object') {
|
|
7339
|
+
Object.keys(groupStage).forEach(function (key) {
|
|
7340
|
+
if (key === '_id') {
|
|
7341
|
+
return;
|
|
7342
|
+
}
|
|
7343
|
+
if (/^(first|last|min|max)_/i.test(key) || /_ids?$/i.test(key) || key === 'blend_ids') {
|
|
7344
|
+
return;
|
|
7345
|
+
}
|
|
7346
|
+
add(key);
|
|
7347
|
+
});
|
|
7348
|
+
}
|
|
7349
|
+
}
|
|
7350
|
+
add(intent.quantityField ? intent.quantityField.split('.').pop() || intent.quantityField : '');
|
|
7351
|
+
add(intent.metricField ? intent.metricField.split('.').pop() || intent.metricField : '');
|
|
7352
|
+
if (!measures.length) {
|
|
7353
|
+
add('row_count');
|
|
7354
|
+
}
|
|
7355
|
+
return measures;
|
|
7356
|
+
}
|
|
7357
|
+
function buildAssistantDataRequestUnderstanding(message, intent, dateWindow) {
|
|
7358
|
+
var requestedDimensionTexts = extractAssistantRequestedBreakdownDimensionTexts(message);
|
|
7359
|
+
var dimensions = [];
|
|
7360
|
+
var requestedBreakdowns = [];
|
|
7361
|
+
var ambiguities = [];
|
|
7362
|
+
var seenDimensionIds = new Set();
|
|
7363
|
+
var addDimension = function (dimension) {
|
|
7364
|
+
var id = normalizeOptionalString(dimension.id);
|
|
7365
|
+
if (!id || seenDimensionIds.has(id)) {
|
|
7366
|
+
return;
|
|
7367
|
+
}
|
|
7368
|
+
seenDimensionIds.add(id);
|
|
7369
|
+
dimensions.push(dimension);
|
|
7370
|
+
};
|
|
7371
|
+
requestedDimensionTexts.forEach(function (requestedDimensionText) {
|
|
7372
|
+
var timeDimension = buildAssistantDataIntentTimeDimension(requestedDimensionText, intent);
|
|
7373
|
+
if (timeDimension) {
|
|
7374
|
+
addDimension(timeDimension);
|
|
7375
|
+
requestedBreakdowns.push({
|
|
7376
|
+
type: 'time',
|
|
7377
|
+
requested_text: requestedDimensionText,
|
|
7378
|
+
dimension: timeDimension.id,
|
|
7379
|
+
granularity: timeDimension.granularity,
|
|
7380
|
+
field_hint: intent.dateField
|
|
7381
|
+
});
|
|
7382
|
+
return;
|
|
7383
|
+
}
|
|
7384
|
+
if (resolveAssistantTimeBreakdownGranularity(requestedDimensionText) && !intent.dateField) {
|
|
7385
|
+
ambiguities.push("Requested ".concat(requestedDimensionText, " breakdown, but this app data intent has no date field."));
|
|
7386
|
+
requestedBreakdowns.push({
|
|
7387
|
+
type: 'unknown',
|
|
7388
|
+
requested_text: requestedDimensionText,
|
|
7389
|
+
granularity: resolveAssistantTimeBreakdownGranularity(requestedDimensionText)
|
|
7390
|
+
});
|
|
7391
|
+
return;
|
|
7392
|
+
}
|
|
7393
|
+
var selected = null;
|
|
7394
|
+
(intent.dimensions || []).forEach(function (dimension) {
|
|
7395
|
+
var score = scoreAssistantDataDimensionMatch(requestedDimensionText, dimension);
|
|
7396
|
+
if (score <= 0) {
|
|
7397
|
+
return;
|
|
7398
|
+
}
|
|
7399
|
+
if (!selected || score > selected.score) {
|
|
7400
|
+
selected = { dimension: dimension, score: score };
|
|
7401
|
+
}
|
|
7402
|
+
});
|
|
7403
|
+
if (selected) {
|
|
7404
|
+
var dimension = __assign(__assign({}, selected.dimension), { type: selected.dimension.type || 'entity', requestedText: requestedDimensionText });
|
|
7405
|
+
addDimension(dimension);
|
|
7406
|
+
requestedBreakdowns.push({
|
|
7407
|
+
type: 'entity',
|
|
7408
|
+
requested_text: requestedDimensionText,
|
|
7409
|
+
dimension: dimension.id,
|
|
7410
|
+
field_hints: extractAssistantDataIntentExpressionFieldHints(dimension.groupId)
|
|
7411
|
+
});
|
|
7412
|
+
return;
|
|
7413
|
+
}
|
|
7414
|
+
ambiguities.push("Requested ".concat(requestedDimensionText, " breakdown did not match a configured app dimension."));
|
|
7415
|
+
requestedBreakdowns.push({
|
|
7416
|
+
type: 'unknown',
|
|
7417
|
+
requested_text: requestedDimensionText
|
|
7418
|
+
});
|
|
7419
|
+
});
|
|
7420
|
+
var confidence = requestedBreakdowns.length && !ambiguities.length
|
|
7421
|
+
? 0.9
|
|
7422
|
+
: requestedBreakdowns.length
|
|
7423
|
+
? 0.65
|
|
7424
|
+
: 0.75;
|
|
7425
|
+
return {
|
|
7426
|
+
dimensions: dimensions,
|
|
7427
|
+
contract: {
|
|
7428
|
+
intent_type: 'data_summary',
|
|
7429
|
+
domain: intent.id || intent.collection,
|
|
7430
|
+
operation: 'aggregate',
|
|
7431
|
+
requested_breakdowns: requestedBreakdowns,
|
|
7432
|
+
date_range: dateWindow.start || dateWindow.end ? __assign({}, dateWindow) : null,
|
|
7433
|
+
measures: [],
|
|
7434
|
+
filters: [],
|
|
7435
|
+
output_format: 'collapse_table',
|
|
7436
|
+
ambiguities: ambiguities,
|
|
7437
|
+
confidence: confidence,
|
|
7438
|
+
source: 'fast_app_data_request_contract'
|
|
7439
|
+
}
|
|
7440
|
+
};
|
|
7441
|
+
}
|
|
7442
|
+
function extractAssistantDataIntentGroupKeys(groupId) {
|
|
7443
|
+
if (!groupId || typeof groupId !== 'object' || Array.isArray(groupId)) {
|
|
7444
|
+
return [];
|
|
7445
|
+
}
|
|
7446
|
+
return Object.keys(groupId).filter(Boolean);
|
|
7447
|
+
}
|
|
7448
|
+
function isAssistantProjectFieldFromGroupId(value) {
|
|
7449
|
+
return typeof value === 'string' && value.startsWith('$_id.');
|
|
7450
|
+
}
|
|
7451
|
+
function applyAssistantDataIntentDimensionTemplate(dimension, params) {
|
|
7452
|
+
return __assign(__assign({}, dimension), { groupId: removeUndefinedAssistantPipelineValues(applyAssistantDataIntentPipelineTemplate(dimension.groupId, params)), project: dimension.project
|
|
7453
|
+
? removeUndefinedAssistantPipelineValues(applyAssistantDataIntentPipelineTemplate(dimension.project, params))
|
|
7454
|
+
: undefined, sort: dimension.sort
|
|
7455
|
+
? removeUndefinedAssistantPipelineValues(applyAssistantDataIntentPipelineTemplate(dimension.sort, params))
|
|
7456
|
+
: undefined, preGroupStages: Array.isArray(dimension.preGroupStages)
|
|
7457
|
+
? removeUndefinedAssistantPipelineValues(applyAssistantDataIntentPipelineTemplate(dimension.preGroupStages, params))
|
|
7458
|
+
: undefined });
|
|
7459
|
+
}
|
|
7460
|
+
function applyAssistantDataIntentDimensionsToPipeline(pipeline, dimensions) {
|
|
7461
|
+
var selectedDimensions = (Array.isArray(dimensions) ? dimensions : []).filter(function (dimension) { return !!(dimension === null || dimension === void 0 ? void 0 : dimension.groupId); });
|
|
7462
|
+
if (!selectedDimensions.length || !Array.isArray(pipeline) || !pipeline.length) {
|
|
7463
|
+
return pipeline;
|
|
7464
|
+
}
|
|
7465
|
+
var next = (0, common_1.deepCopy)(pipeline);
|
|
7466
|
+
var groupIndex = findAggregateGroupIndex(next);
|
|
7467
|
+
if (groupIndex === -1) {
|
|
7468
|
+
return next;
|
|
7469
|
+
}
|
|
7470
|
+
selectedDimensions.forEach(function (dimension) {
|
|
7471
|
+
if (Array.isArray(dimension.preGroupStages) && dimension.preGroupStages.length) {
|
|
7472
|
+
next.splice.apply(next, __spreadArray([groupIndex, 0], __read((0, common_1.deepCopy)(dimension.preGroupStages)), false));
|
|
7473
|
+
groupIndex += dimension.preGroupStages.length;
|
|
7474
|
+
}
|
|
7475
|
+
});
|
|
7476
|
+
var groupStage = next[groupIndex];
|
|
7477
|
+
if (!(groupStage === null || groupStage === void 0 ? void 0 : groupStage.$group) || typeof groupStage.$group !== 'object') {
|
|
7478
|
+
return next;
|
|
7479
|
+
}
|
|
7480
|
+
var oldGroupKeys = new Set(extractAssistantDataIntentGroupKeys(groupStage.$group._id));
|
|
7481
|
+
var combinedGroupId = {};
|
|
7482
|
+
selectedDimensions.forEach(function (dimension) {
|
|
7483
|
+
if (dimension.groupId && typeof dimension.groupId === 'object' && !Array.isArray(dimension.groupId)) {
|
|
7484
|
+
Object.assign(combinedGroupId, (0, common_1.deepCopy)(dimension.groupId));
|
|
7485
|
+
}
|
|
7486
|
+
});
|
|
7487
|
+
var newGroupKeys = new Set(extractAssistantDataIntentGroupKeys(combinedGroupId));
|
|
7488
|
+
groupStage.$group._id = combinedGroupId;
|
|
7489
|
+
var projectIndex = next.findIndex(function (stage, index) { return index > groupIndex && !!(stage === null || stage === void 0 ? void 0 : stage.$project); });
|
|
7490
|
+
if (projectIndex > -1 && next[projectIndex].$project && typeof next[projectIndex].$project === 'object') {
|
|
7491
|
+
var project_1 = next[projectIndex].$project;
|
|
7492
|
+
oldGroupKeys.forEach(function (key) {
|
|
7493
|
+
if (!newGroupKeys.has(key) && isAssistantProjectFieldFromGroupId(project_1[key])) {
|
|
7494
|
+
delete project_1[key];
|
|
7495
|
+
}
|
|
7496
|
+
});
|
|
7497
|
+
selectedDimensions.forEach(function (dimension) {
|
|
7498
|
+
if (dimension.project) {
|
|
7499
|
+
Object.assign(project_1, (0, common_1.deepCopy)(dimension.project));
|
|
7500
|
+
}
|
|
7501
|
+
});
|
|
7502
|
+
}
|
|
7503
|
+
var sortIndex = next.findIndex(function (stage, index) { return index > groupIndex && !!(stage === null || stage === void 0 ? void 0 : stage.$sort); });
|
|
7504
|
+
if (sortIndex > -1) {
|
|
7505
|
+
var combinedSort_1 = {};
|
|
7506
|
+
selectedDimensions.forEach(function (dimension) {
|
|
7507
|
+
if (dimension.sort && typeof dimension.sort === 'object' && !Array.isArray(dimension.sort)) {
|
|
7508
|
+
Object.keys(dimension.sort).forEach(function (key) {
|
|
7509
|
+
var _a;
|
|
7510
|
+
if (!Object.prototype.hasOwnProperty.call(combinedSort_1, key)) {
|
|
7511
|
+
combinedSort_1[key] = (0, common_1.deepCopy)((_a = dimension.sort) === null || _a === void 0 ? void 0 : _a[key]);
|
|
7512
|
+
}
|
|
7513
|
+
});
|
|
7514
|
+
}
|
|
7515
|
+
});
|
|
7516
|
+
if (Object.keys(combinedSort_1).length) {
|
|
7517
|
+
next[sortIndex].$sort = combinedSort_1;
|
|
7518
|
+
}
|
|
7519
|
+
}
|
|
7520
|
+
return next;
|
|
7521
|
+
}
|
|
7147
7522
|
function buildAssistantAppDataIntentDirective(message, collectionNames, appId) {
|
|
7148
7523
|
if (collectionNames === void 0) { collectionNames = []; }
|
|
7149
7524
|
var intent = selectAssistantAppDataIntent(message, collectionNames, appId);
|
|
@@ -7152,6 +7527,10 @@ function buildAssistantAppDataIntentDirective(message, collectionNames, appId) {
|
|
|
7152
7527
|
}
|
|
7153
7528
|
var customerText = extractAssistantDataIntentCustomerText(message);
|
|
7154
7529
|
var dateWindow = resolveAssistantDataIntentDateWindow(message);
|
|
7530
|
+
var requestUnderstanding = buildAssistantDataRequestUnderstanding(message, intent, dateWindow);
|
|
7531
|
+
var templatedDimensions = requestUnderstanding.dimensions
|
|
7532
|
+
.map(function (dimension) { return applyAssistantDataIntentDimensionTemplate(dimension, { customerText: customerText, dateWindow: dateWindow }); })
|
|
7533
|
+
.filter(function (dimension) { return !!(dimension === null || dimension === void 0 ? void 0 : dimension.groupId); });
|
|
7155
7534
|
var acknowledgementText = buildAssistantDataIntentAcknowledgement(intent, customerText, dateWindow);
|
|
7156
7535
|
var progress = intent.progress.map(function (entry) {
|
|
7157
7536
|
return entry
|
|
@@ -7166,7 +7545,18 @@ function buildAssistantAppDataIntentDirective(message, collectionNames, appId) {
|
|
|
7166
7545
|
assumptions: intent.assumptions,
|
|
7167
7546
|
fallbackCollections: intent.fallbackCollections,
|
|
7168
7547
|
customerText: customerText,
|
|
7169
|
-
dateWindow: dateWindow
|
|
7548
|
+
dateWindow: dateWindow,
|
|
7549
|
+
requestedDimension: templatedDimensions[0] ? {
|
|
7550
|
+
id: templatedDimensions[0].id,
|
|
7551
|
+
terms: templatedDimensions[0].terms
|
|
7552
|
+
} : null,
|
|
7553
|
+
requestedDimensions: templatedDimensions.map(function (dimension) { return ({
|
|
7554
|
+
id: dimension.id,
|
|
7555
|
+
type: dimension.type || 'entity',
|
|
7556
|
+
granularity: dimension.granularity || undefined,
|
|
7557
|
+
terms: dimension.terms
|
|
7558
|
+
}); }),
|
|
7559
|
+
requestContract: requestUnderstanding.contract
|
|
7170
7560
|
};
|
|
7171
7561
|
var basePayload = function (pipeline) { return ({
|
|
7172
7562
|
collection: intent.collection,
|
|
@@ -7178,7 +7568,9 @@ function buildAssistantAppDataIntentDirective(message, collectionNames, appId) {
|
|
|
7178
7568
|
var pipeline = configuredPipeline.length
|
|
7179
7569
|
? configuredPipeline
|
|
7180
7570
|
: buildAssistantGenericDataIntentPipeline(intent, customerText, dateWindow);
|
|
7181
|
-
|
|
7571
|
+
var finalPipeline = applyAssistantDataIntentDimensionsToPipeline(pipeline, templatedDimensions);
|
|
7572
|
+
metadata.requestContract = __assign(__assign({}, requestUnderstanding.contract), { measures: buildAssistantDataRequestMeasures(intent, finalPipeline) });
|
|
7573
|
+
return { type: 'aggregate', payload: basePayload(finalPipeline), cleaned: '', rawLine: "HEURISTIC_AGG(app-data-intent:".concat(intent.id, ")"), metadata: metadata };
|
|
7182
7574
|
}
|
|
7183
7575
|
function isAssistantDeterministicHeuristicDirective(directive) {
|
|
7184
7576
|
return isAssistantSchemaHoursHeuristicDirective(directive)
|
|
@@ -7334,7 +7726,7 @@ function ensureAssistantDisplayColumns(display, requestedColumns) {
|
|
|
7334
7726
|
return __assign(__assign({}, display), { columns: columns, rows: rows });
|
|
7335
7727
|
}
|
|
7336
7728
|
function resolveAssistantPipelineTimeGrain(pipeline) {
|
|
7337
|
-
var
|
|
7729
|
+
var e_6, _a;
|
|
7338
7730
|
if (!Array.isArray(pipeline) || !pipeline.length) {
|
|
7339
7731
|
return null;
|
|
7340
7732
|
}
|
|
@@ -7396,12 +7788,12 @@ function resolveAssistantPipelineTimeGrain(pipeline) {
|
|
|
7396
7788
|
}
|
|
7397
7789
|
}
|
|
7398
7790
|
}
|
|
7399
|
-
catch (
|
|
7791
|
+
catch (e_6_1) { e_6 = { error: e_6_1 }; }
|
|
7400
7792
|
finally {
|
|
7401
7793
|
try {
|
|
7402
7794
|
if (priority_1_1 && !priority_1_1.done && (_a = priority_1.return)) _a.call(priority_1);
|
|
7403
7795
|
}
|
|
7404
|
-
finally { if (
|
|
7796
|
+
finally { if (e_6) throw e_6.error; }
|
|
7405
7797
|
}
|
|
7406
7798
|
return null;
|
|
7407
7799
|
}
|
|
@@ -7883,7 +8275,7 @@ function buildAssistantToolResultPayload(directive, toolResponse, requestMessage
|
|
|
7883
8275
|
? toolResponse.verification
|
|
7884
8276
|
: undefined;
|
|
7885
8277
|
var directiveMetadata = directive.metadata && typeof directive.metadata === 'object' ? directive.metadata : {};
|
|
7886
|
-
var mergedDebug = __assign(__assign(__assign(__assign(__assign(__assign(__assign({}, ((toolResponse === null || toolResponse === void 0 ? void 0 : toolResponse.debug) && typeof toolResponse.debug === 'object' ? toolResponse.debug : {})), (normalizeOptionalString(directiveMetadata.intentId) ? { intentId: normalizeOptionalString(directiveMetadata.intentId) } : {})), (normalizeOptionalString(directiveMetadata.acknowledgementText) ? { acknowledgementText: normalizeOptionalString(directiveMetadata.acknowledgementText) } : {})), (normalizeOptionalString(directiveMetadata.recipeUsed) ? { recipeUsed: normalizeOptionalString(directiveMetadata.recipeUsed) } : {})), (normalizeOptionalString(directiveMetadata.customerText) ? { customerText: normalizeOptionalString(directiveMetadata.customerText) } : {})), (directiveMetadata.dateWindow && typeof directiveMetadata.dateWindow === 'object' ? { dateWindow: directiveMetadata.dateWindow } : {})), (Array.isArray(directiveMetadata.assumptions) && directiveMetadata.assumptions.length ? { assumptions: directiveMetadata.assumptions } : {}));
|
|
8278
|
+
var mergedDebug = __assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign({}, ((toolResponse === null || toolResponse === void 0 ? void 0 : toolResponse.debug) && typeof toolResponse.debug === 'object' ? toolResponse.debug : {})), (normalizeOptionalString(directiveMetadata.intentId) ? { intentId: normalizeOptionalString(directiveMetadata.intentId) } : {})), (normalizeOptionalString(directiveMetadata.acknowledgementText) ? { acknowledgementText: normalizeOptionalString(directiveMetadata.acknowledgementText) } : {})), (normalizeOptionalString(directiveMetadata.recipeUsed) ? { recipeUsed: normalizeOptionalString(directiveMetadata.recipeUsed) } : {})), (normalizeOptionalString(directiveMetadata.customerText) ? { customerText: normalizeOptionalString(directiveMetadata.customerText) } : {})), (directiveMetadata.dateWindow && typeof directiveMetadata.dateWindow === 'object' ? { dateWindow: directiveMetadata.dateWindow } : {})), (directiveMetadata.requestContract && typeof directiveMetadata.requestContract === 'object' ? { requestContract: directiveMetadata.requestContract } : {})), (Array.isArray(directiveMetadata.requestedDimensions) && directiveMetadata.requestedDimensions.length ? { requestedDimensions: directiveMetadata.requestedDimensions } : {})), (Array.isArray(directiveMetadata.assumptions) && directiveMetadata.assumptions.length ? { assumptions: directiveMetadata.assumptions } : {}));
|
|
7887
8279
|
var result = {
|
|
7888
8280
|
type: directive.type === 'aggregate' ? 'mongo_agg' : 'mongo_read',
|
|
7889
8281
|
input: directivePayload,
|
|
@@ -8262,7 +8654,7 @@ function applyAssistantDatedReportWindow(value, toolResult) {
|
|
|
8262
8654
|
return "".concat(line, "\n\n").concat(content).trim();
|
|
8263
8655
|
}
|
|
8264
8656
|
function resolveAssistantDatedReportWindow(toolResult) {
|
|
8265
|
-
var
|
|
8657
|
+
var e_7, _a;
|
|
8266
8658
|
var _b, _c, _d, _e, _f, _g, _h, _j;
|
|
8267
8659
|
var verificationWindow = (_d = (_c = (_b = toolResult === null || toolResult === void 0 ? void 0 : toolResult.output) === null || _b === void 0 ? void 0 : _b.verification) === null || _c === void 0 ? void 0 : _c.metrics) === null || _d === void 0 ? void 0 : _d.window;
|
|
8268
8660
|
var verificationStart = normalizeOptionalString(verificationWindow === null || verificationWindow === void 0 ? void 0 : verificationWindow.startDate);
|
|
@@ -8328,12 +8720,12 @@ function resolveAssistantDatedReportWindow(toolResult) {
|
|
|
8328
8720
|
};
|
|
8329
8721
|
}
|
|
8330
8722
|
}
|
|
8331
|
-
catch (
|
|
8723
|
+
catch (e_7_1) { e_7 = { error: e_7_1 }; }
|
|
8332
8724
|
finally {
|
|
8333
8725
|
try {
|
|
8334
8726
|
if (pipelineCandidates_1_1 && !pipelineCandidates_1_1.done && (_a = pipelineCandidates_1.return)) _a.call(pipelineCandidates_1);
|
|
8335
8727
|
}
|
|
8336
|
-
finally { if (
|
|
8728
|
+
finally { if (e_7) throw e_7.error; }
|
|
8337
8729
|
}
|
|
8338
8730
|
return null;
|
|
8339
8731
|
}
|
|
@@ -8471,14 +8863,14 @@ function buildAssistantDebugPayload(params) {
|
|
|
8471
8863
|
else {
|
|
8472
8864
|
notes.push("Report builder bridge collection: ".concat(from, " -> ").concat(to, "."));
|
|
8473
8865
|
}
|
|
8474
|
-
var
|
|
8866
|
+
var path_2 = Array.isArray(fallbackInfo.reportBuilderBridge.resolutionPath)
|
|
8475
8867
|
? fallbackInfo.reportBuilderBridge.resolutionPath
|
|
8476
8868
|
.map(function (entry) { return normalizeOptionalString(entry); })
|
|
8477
8869
|
.filter(Boolean)
|
|
8478
8870
|
.join(' -> ')
|
|
8479
8871
|
: '';
|
|
8480
|
-
if (
|
|
8481
|
-
notes.push("Bridge resolution path: ".concat(
|
|
8872
|
+
if (path_2) {
|
|
8873
|
+
notes.push("Bridge resolution path: ".concat(path_2, "."));
|
|
8482
8874
|
}
|
|
8483
8875
|
}
|
|
8484
8876
|
if ((_w = fallbackInfo === null || fallbackInfo === void 0 ? void 0 : fallbackInfo.reportFallback) === null || _w === void 0 ? void 0 : _w.used) {
|
|
@@ -9012,7 +9404,7 @@ function getValueAtPath(obj, path) {
|
|
|
9012
9404
|
return walk(obj, 0);
|
|
9013
9405
|
}
|
|
9014
9406
|
function hasArrayValueAtPath(docs, path) {
|
|
9015
|
-
var
|
|
9407
|
+
var e_8, _a;
|
|
9016
9408
|
if (!Array.isArray(docs) || !docs.length || !path) {
|
|
9017
9409
|
return false;
|
|
9018
9410
|
}
|
|
@@ -9025,17 +9417,17 @@ function hasArrayValueAtPath(docs, path) {
|
|
|
9025
9417
|
}
|
|
9026
9418
|
}
|
|
9027
9419
|
}
|
|
9028
|
-
catch (
|
|
9420
|
+
catch (e_8_1) { e_8 = { error: e_8_1 }; }
|
|
9029
9421
|
finally {
|
|
9030
9422
|
try {
|
|
9031
9423
|
if (docs_1_1 && !docs_1_1.done && (_a = docs_1.return)) _a.call(docs_1);
|
|
9032
9424
|
}
|
|
9033
|
-
finally { if (
|
|
9425
|
+
finally { if (e_8) throw e_8.error; }
|
|
9034
9426
|
}
|
|
9035
9427
|
return false;
|
|
9036
9428
|
}
|
|
9037
9429
|
function inferIdFieldStorageTypeFromDocs(docs, fieldPath) {
|
|
9038
|
-
var
|
|
9430
|
+
var e_9, _a, e_10, _b;
|
|
9039
9431
|
if (!Array.isArray(docs) || !fieldPath) {
|
|
9040
9432
|
return 'unknown';
|
|
9041
9433
|
}
|
|
@@ -9048,7 +9440,7 @@ function inferIdFieldStorageTypeFromDocs(docs, fieldPath) {
|
|
|
9048
9440
|
: doc === null || doc === void 0 ? void 0 : doc[fieldPath];
|
|
9049
9441
|
var queue = Array.isArray(value) ? value : [value];
|
|
9050
9442
|
try {
|
|
9051
|
-
for (var queue_1 = (
|
|
9443
|
+
for (var queue_1 = (e_10 = void 0, __values(queue)), queue_1_1 = queue_1.next(); !queue_1_1.done; queue_1_1 = queue_1.next()) {
|
|
9052
9444
|
var entry = queue_1_1.value;
|
|
9053
9445
|
if (entry === null || entry === undefined) {
|
|
9054
9446
|
continue;
|
|
@@ -9061,21 +9453,21 @@ function inferIdFieldStorageTypeFromDocs(docs, fieldPath) {
|
|
|
9061
9453
|
}
|
|
9062
9454
|
}
|
|
9063
9455
|
}
|
|
9064
|
-
catch (
|
|
9456
|
+
catch (e_10_1) { e_10 = { error: e_10_1 }; }
|
|
9065
9457
|
finally {
|
|
9066
9458
|
try {
|
|
9067
9459
|
if (queue_1_1 && !queue_1_1.done && (_b = queue_1.return)) _b.call(queue_1);
|
|
9068
9460
|
}
|
|
9069
|
-
finally { if (
|
|
9461
|
+
finally { if (e_10) throw e_10.error; }
|
|
9070
9462
|
}
|
|
9071
9463
|
}
|
|
9072
9464
|
}
|
|
9073
|
-
catch (
|
|
9465
|
+
catch (e_9_1) { e_9 = { error: e_9_1 }; }
|
|
9074
9466
|
finally {
|
|
9075
9467
|
try {
|
|
9076
9468
|
if (docs_2_1 && !docs_2_1.done && (_a = docs_2.return)) _a.call(docs_2);
|
|
9077
9469
|
}
|
|
9078
|
-
finally { if (
|
|
9470
|
+
finally { if (e_9) throw e_9.error; }
|
|
9079
9471
|
}
|
|
9080
9472
|
return sawString ? 'string' : 'unknown';
|
|
9081
9473
|
}
|
|
@@ -9170,7 +9562,7 @@ function normalizeLookupKeyValue(value) {
|
|
|
9170
9562
|
return '';
|
|
9171
9563
|
}
|
|
9172
9564
|
function collectTopLevelIdFieldValues(docs, options) {
|
|
9173
|
-
var
|
|
9565
|
+
var e_11, _a, e_12, _b;
|
|
9174
9566
|
if (!Array.isArray(docs) || !docs.length) {
|
|
9175
9567
|
return [];
|
|
9176
9568
|
}
|
|
@@ -9218,26 +9610,26 @@ function collectTopLevelIdFieldValues(docs, options) {
|
|
|
9218
9610
|
});
|
|
9219
9611
|
};
|
|
9220
9612
|
try {
|
|
9221
|
-
for (var keys_1 = (
|
|
9613
|
+
for (var keys_1 = (e_12 = void 0, __values(keys)), keys_1_1 = keys_1.next(); !keys_1_1.done; keys_1_1 = keys_1.next()) {
|
|
9222
9614
|
var key = keys_1_1.value;
|
|
9223
9615
|
_loop_3(key);
|
|
9224
9616
|
}
|
|
9225
9617
|
}
|
|
9226
|
-
catch (
|
|
9618
|
+
catch (e_12_1) { e_12 = { error: e_12_1 }; }
|
|
9227
9619
|
finally {
|
|
9228
9620
|
try {
|
|
9229
9621
|
if (keys_1_1 && !keys_1_1.done && (_b = keys_1.return)) _b.call(keys_1);
|
|
9230
9622
|
}
|
|
9231
|
-
finally { if (
|
|
9623
|
+
finally { if (e_12) throw e_12.error; }
|
|
9232
9624
|
}
|
|
9233
9625
|
}
|
|
9234
9626
|
}
|
|
9235
|
-
catch (
|
|
9627
|
+
catch (e_11_1) { e_11 = { error: e_11_1 }; }
|
|
9236
9628
|
finally {
|
|
9237
9629
|
try {
|
|
9238
9630
|
if (docs_3_1 && !docs_3_1.done && (_a = docs_3.return)) _a.call(docs_3);
|
|
9239
9631
|
}
|
|
9240
|
-
finally { if (
|
|
9632
|
+
finally { if (e_11) throw e_11.error; }
|
|
9241
9633
|
}
|
|
9242
9634
|
return Array.from(fieldMap.entries()).map(function (_a) {
|
|
9243
9635
|
var _b = __read(_a, 2), field = _b[0], values = _b[1];
|
|
@@ -9358,8 +9750,8 @@ function resolveLookupMappingsForField(field, mappings) {
|
|
|
9358
9750
|
}
|
|
9359
9751
|
function applyIdLookupDisplayEnrichment(params) {
|
|
9360
9752
|
return __awaiter(this, void 0, void 0, function () {
|
|
9361
|
-
var docs, collection, db, dbName, idClient, idCustomer, isSuperAdmin, idFields, lookupMappings, allCollections, collectionProbeCache, collectionSchemaCache, lookupMeta, enrichedDocs, _loop_4, idFields_1, idFields_1_1, fieldEntry,
|
|
9362
|
-
var
|
|
9753
|
+
var docs, collection, db, dbName, idClient, idCustomer, isSuperAdmin, idFields, lookupMappings, allCollections, collectionProbeCache, collectionSchemaCache, lookupMeta, enrichedDocs, _loop_4, idFields_1, idFields_1_1, fieldEntry, e_13_1;
|
|
9754
|
+
var e_13, _a;
|
|
9363
9755
|
return __generator(this, function (_b) {
|
|
9364
9756
|
switch (_b.label) {
|
|
9365
9757
|
case 0:
|
|
@@ -9383,8 +9775,8 @@ function applyIdLookupDisplayEnrichment(params) {
|
|
|
9383
9775
|
lookupMeta = [];
|
|
9384
9776
|
enrichedDocs = docs.map(function (doc) { return (__assign({}, doc)); });
|
|
9385
9777
|
_loop_4 = function (fieldEntry) {
|
|
9386
|
-
var values, baseToken, mappingMatches, candidateCollections, filteredCandidates, _loop_5, filteredCandidates_1, filteredCandidates_1_1, candidate, state_3,
|
|
9387
|
-
var
|
|
9778
|
+
var values, baseToken, mappingMatches, candidateCollections, filteredCandidates, _loop_5, filteredCandidates_1, filteredCandidates_1_1, candidate, state_3, e_14_1;
|
|
9779
|
+
var e_14, _c;
|
|
9388
9780
|
return __generator(this, function (_d) {
|
|
9389
9781
|
switch (_d.label) {
|
|
9390
9782
|
case 0:
|
|
@@ -9558,7 +9950,7 @@ function applyIdLookupDisplayEnrichment(params) {
|
|
|
9558
9950
|
_d.label = 1;
|
|
9559
9951
|
case 1:
|
|
9560
9952
|
_d.trys.push([1, 6, 7, 8]);
|
|
9561
|
-
filteredCandidates_1 = (
|
|
9953
|
+
filteredCandidates_1 = (e_14 = void 0, __values(filteredCandidates)), filteredCandidates_1_1 = filteredCandidates_1.next();
|
|
9562
9954
|
_d.label = 2;
|
|
9563
9955
|
case 2:
|
|
9564
9956
|
if (!!filteredCandidates_1_1.done) return [3 /*break*/, 5];
|
|
@@ -9574,14 +9966,14 @@ function applyIdLookupDisplayEnrichment(params) {
|
|
|
9574
9966
|
return [3 /*break*/, 2];
|
|
9575
9967
|
case 5: return [3 /*break*/, 8];
|
|
9576
9968
|
case 6:
|
|
9577
|
-
|
|
9578
|
-
|
|
9969
|
+
e_14_1 = _d.sent();
|
|
9970
|
+
e_14 = { error: e_14_1 };
|
|
9579
9971
|
return [3 /*break*/, 8];
|
|
9580
9972
|
case 7:
|
|
9581
9973
|
try {
|
|
9582
9974
|
if (filteredCandidates_1_1 && !filteredCandidates_1_1.done && (_c = filteredCandidates_1.return)) _c.call(filteredCandidates_1);
|
|
9583
9975
|
}
|
|
9584
|
-
finally { if (
|
|
9976
|
+
finally { if (e_14) throw e_14.error; }
|
|
9585
9977
|
return [7 /*endfinally*/];
|
|
9586
9978
|
case 8: return [2 /*return*/];
|
|
9587
9979
|
}
|
|
@@ -9604,14 +9996,14 @@ function applyIdLookupDisplayEnrichment(params) {
|
|
|
9604
9996
|
return [3 /*break*/, 3];
|
|
9605
9997
|
case 6: return [3 /*break*/, 9];
|
|
9606
9998
|
case 7:
|
|
9607
|
-
|
|
9608
|
-
|
|
9999
|
+
e_13_1 = _b.sent();
|
|
10000
|
+
e_13 = { error: e_13_1 };
|
|
9609
10001
|
return [3 /*break*/, 9];
|
|
9610
10002
|
case 8:
|
|
9611
10003
|
try {
|
|
9612
10004
|
if (idFields_1_1 && !idFields_1_1.done && (_a = idFields_1.return)) _a.call(idFields_1);
|
|
9613
10005
|
}
|
|
9614
|
-
finally { if (
|
|
10006
|
+
finally { if (e_13) throw e_13.error; }
|
|
9615
10007
|
return [7 /*endfinally*/];
|
|
9616
10008
|
case 9:
|
|
9617
10009
|
if (!lookupMeta.length) {
|
|
@@ -9630,7 +10022,7 @@ function applyIdLookupDisplayEnrichment(params) {
|
|
|
9630
10022
|
});
|
|
9631
10023
|
}
|
|
9632
10024
|
function hasNonEmptyValue(docs, fieldPath, options) {
|
|
9633
|
-
var
|
|
10025
|
+
var e_15, _a;
|
|
9634
10026
|
if (!Array.isArray(docs) || !fieldPath) {
|
|
9635
10027
|
return false;
|
|
9636
10028
|
}
|
|
@@ -9647,12 +10039,12 @@ function hasNonEmptyValue(docs, fieldPath, options) {
|
|
|
9647
10039
|
}
|
|
9648
10040
|
}
|
|
9649
10041
|
}
|
|
9650
|
-
catch (
|
|
10042
|
+
catch (e_15_1) { e_15 = { error: e_15_1 }; }
|
|
9651
10043
|
finally {
|
|
9652
10044
|
try {
|
|
9653
10045
|
if (docs_4_1 && !docs_4_1.done && (_a = docs_4.return)) _a.call(docs_4);
|
|
9654
10046
|
}
|
|
9655
|
-
finally { if (
|
|
10047
|
+
finally { if (e_15) throw e_15.error; }
|
|
9656
10048
|
}
|
|
9657
10049
|
return false;
|
|
9658
10050
|
}
|
|
@@ -12268,7 +12660,7 @@ function flattenAssistantExprClauses(expr) {
|
|
|
12268
12660
|
return [expr];
|
|
12269
12661
|
}
|
|
12270
12662
|
function detectAssistantMonthWindowInExpr(expr, allowedDateFields) {
|
|
12271
|
-
var
|
|
12663
|
+
var e_16, _a;
|
|
12272
12664
|
var clauses = flattenAssistantExprClauses(expr);
|
|
12273
12665
|
if (!clauses.length) {
|
|
12274
12666
|
return null;
|
|
@@ -12342,12 +12734,12 @@ function detectAssistantMonthWindowInExpr(expr, allowedDateFields) {
|
|
|
12342
12734
|
return state_4.value;
|
|
12343
12735
|
}
|
|
12344
12736
|
}
|
|
12345
|
-
catch (
|
|
12737
|
+
catch (e_16_1) { e_16 = { error: e_16_1 }; }
|
|
12346
12738
|
finally {
|
|
12347
12739
|
try {
|
|
12348
12740
|
if (lowerClauses_1_1 && !lowerClauses_1_1.done && (_a = lowerClauses_1.return)) _a.call(lowerClauses_1);
|
|
12349
12741
|
}
|
|
12350
|
-
finally { if (
|
|
12742
|
+
finally { if (e_16) throw e_16.error; }
|
|
12351
12743
|
}
|
|
12352
12744
|
return null;
|
|
12353
12745
|
}
|
|
@@ -12410,7 +12802,7 @@ function resolveAssistantMonthlyGroupDateFields(pipeline) {
|
|
|
12410
12802
|
return fields;
|
|
12411
12803
|
}
|
|
12412
12804
|
function detectAssistantMonthWindowFromPipeline(pipeline) {
|
|
12413
|
-
var
|
|
12805
|
+
var e_17, _a;
|
|
12414
12806
|
var _b;
|
|
12415
12807
|
var monthlyFields = resolveAssistantMonthlyGroupDateFields(pipeline);
|
|
12416
12808
|
var scanMatch = function (match) {
|
|
@@ -12438,12 +12830,12 @@ function detectAssistantMonthWindowFromPipeline(pipeline) {
|
|
|
12438
12830
|
}
|
|
12439
12831
|
}
|
|
12440
12832
|
}
|
|
12441
|
-
catch (
|
|
12833
|
+
catch (e_17_1) { e_17 = { error: e_17_1 }; }
|
|
12442
12834
|
finally {
|
|
12443
12835
|
try {
|
|
12444
12836
|
if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
|
|
12445
12837
|
}
|
|
12446
|
-
finally { if (
|
|
12838
|
+
finally { if (e_17) throw e_17.error; }
|
|
12447
12839
|
}
|
|
12448
12840
|
return null;
|
|
12449
12841
|
}
|
|
@@ -12723,7 +13115,7 @@ function normalizeAssistantCustomerLookupProjectionPipeline(pipeline) {
|
|
|
12723
13115
|
var nextProject = __assign({}, project);
|
|
12724
13116
|
var stageChanged = false;
|
|
12725
13117
|
Object.keys(nextProject).forEach(function (field) {
|
|
12726
|
-
var
|
|
13118
|
+
var e_18, _a;
|
|
12727
13119
|
var expression = nextProject[field];
|
|
12728
13120
|
if (typeof expression !== 'string') {
|
|
12729
13121
|
return;
|
|
@@ -12759,12 +13151,12 @@ function normalizeAssistantCustomerLookupProjectionPipeline(pipeline) {
|
|
|
12759
13151
|
break;
|
|
12760
13152
|
}
|
|
12761
13153
|
}
|
|
12762
|
-
catch (
|
|
13154
|
+
catch (e_18_1) { e_18 = { error: e_18_1 }; }
|
|
12763
13155
|
finally {
|
|
12764
13156
|
try {
|
|
12765
13157
|
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
12766
13158
|
}
|
|
12767
|
-
finally { if (
|
|
13159
|
+
finally { if (e_18) throw e_18.error; }
|
|
12768
13160
|
}
|
|
12769
13161
|
});
|
|
12770
13162
|
if (stageChanged) {
|
|
@@ -12937,7 +13329,7 @@ function matchContainsField(value, field) {
|
|
|
12937
13329
|
});
|
|
12938
13330
|
}
|
|
12939
13331
|
function resolveAggregateCompletionFallback(pipeline) {
|
|
12940
|
-
var
|
|
13332
|
+
var e_19, _a;
|
|
12941
13333
|
if (!Array.isArray(pipeline)) {
|
|
12942
13334
|
return null;
|
|
12943
13335
|
}
|
|
@@ -12950,7 +13342,7 @@ function resolveAggregateCompletionFallback(pipeline) {
|
|
|
12950
13342
|
}
|
|
12951
13343
|
var addFields = stage.$addFields;
|
|
12952
13344
|
try {
|
|
12953
|
-
for (var _b = (
|
|
13345
|
+
for (var _b = (e_19 = void 0, __values(Object.keys(addFields))), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
12954
13346
|
var key = _c.value;
|
|
12955
13347
|
if (!isCompletionFieldName(key)) {
|
|
12956
13348
|
continue;
|
|
@@ -12964,12 +13356,12 @@ function resolveAggregateCompletionFallback(pipeline) {
|
|
|
12964
13356
|
}
|
|
12965
13357
|
}
|
|
12966
13358
|
}
|
|
12967
|
-
catch (
|
|
13359
|
+
catch (e_19_1) { e_19 = { error: e_19_1 }; }
|
|
12968
13360
|
finally {
|
|
12969
13361
|
try {
|
|
12970
13362
|
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
12971
13363
|
}
|
|
12972
|
-
finally { if (
|
|
13364
|
+
finally { if (e_19) throw e_19.error; }
|
|
12973
13365
|
}
|
|
12974
13366
|
if (candidateField) {
|
|
12975
13367
|
break;
|
|
@@ -13125,7 +13517,7 @@ function buildCompletionFallbackSources(field) {
|
|
|
13125
13517
|
]);
|
|
13126
13518
|
}
|
|
13127
13519
|
function resolveAggregateCompletionExprFallback(pipeline) {
|
|
13128
|
-
var
|
|
13520
|
+
var e_20, _a;
|
|
13129
13521
|
if (!Array.isArray(pipeline)) {
|
|
13130
13522
|
return null;
|
|
13131
13523
|
}
|
|
@@ -13145,7 +13537,7 @@ function resolveAggregateCompletionExprFallback(pipeline) {
|
|
|
13145
13537
|
}
|
|
13146
13538
|
if (!candidateField) {
|
|
13147
13539
|
try {
|
|
13148
|
-
for (var _b = (
|
|
13540
|
+
for (var _b = (e_20 = void 0, __values(Object.keys(matchStage))), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
13149
13541
|
var key = _c.value;
|
|
13150
13542
|
if (key.startsWith('$')) {
|
|
13151
13543
|
continue;
|
|
@@ -13160,12 +13552,12 @@ function resolveAggregateCompletionExprFallback(pipeline) {
|
|
|
13160
13552
|
}
|
|
13161
13553
|
}
|
|
13162
13554
|
}
|
|
13163
|
-
catch (
|
|
13555
|
+
catch (e_20_1) { e_20 = { error: e_20_1 }; }
|
|
13164
13556
|
finally {
|
|
13165
13557
|
try {
|
|
13166
13558
|
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
13167
13559
|
}
|
|
13168
|
-
finally { if (
|
|
13560
|
+
finally { if (e_20) throw e_20.error; }
|
|
13169
13561
|
}
|
|
13170
13562
|
}
|
|
13171
13563
|
if (!candidateField) {
|
|
@@ -13367,7 +13759,7 @@ function hasAssistantDateGroupingOperator(value) {
|
|
|
13367
13759
|
return Object.keys(value).some(function (key) { return hasAssistantDateGroupingOperator(value[key]); });
|
|
13368
13760
|
}
|
|
13369
13761
|
function isGroupFieldDerivedFromDateExpression(pipeline, groupIndex, groupPaths) {
|
|
13370
|
-
var
|
|
13762
|
+
var e_21, _a, e_22, _b;
|
|
13371
13763
|
if (!Array.isArray(pipeline) || groupIndex <= 0 || !groupPaths.length) {
|
|
13372
13764
|
return false;
|
|
13373
13765
|
}
|
|
@@ -13393,14 +13785,14 @@ function isGroupFieldDerivedFromDateExpression(pipeline, groupIndex, groupPaths)
|
|
|
13393
13785
|
continue;
|
|
13394
13786
|
}
|
|
13395
13787
|
try {
|
|
13396
|
-
for (var stageKeys_1 = (
|
|
13788
|
+
for (var stageKeys_1 = (e_21 = void 0, __values(stageKeys)), stageKeys_1_1 = stageKeys_1.next(); !stageKeys_1_1.done; stageKeys_1_1 = stageKeys_1.next()) {
|
|
13397
13789
|
var stageKey = stageKeys_1_1.value;
|
|
13398
13790
|
var payload = stage[stageKey];
|
|
13399
13791
|
if (!payload || typeof payload !== 'object' || Array.isArray(payload)) {
|
|
13400
13792
|
continue;
|
|
13401
13793
|
}
|
|
13402
13794
|
try {
|
|
13403
|
-
for (var groupFields_1 = (
|
|
13795
|
+
for (var groupFields_1 = (e_22 = void 0, __values(groupFields)), groupFields_1_1 = groupFields_1.next(); !groupFields_1_1.done; groupFields_1_1 = groupFields_1.next()) {
|
|
13404
13796
|
var groupField = groupFields_1_1.value;
|
|
13405
13797
|
if (!Object.prototype.hasOwnProperty.call(payload, groupField)) {
|
|
13406
13798
|
continue;
|
|
@@ -13410,21 +13802,21 @@ function isGroupFieldDerivedFromDateExpression(pipeline, groupIndex, groupPaths)
|
|
|
13410
13802
|
}
|
|
13411
13803
|
}
|
|
13412
13804
|
}
|
|
13413
|
-
catch (
|
|
13805
|
+
catch (e_22_1) { e_22 = { error: e_22_1 }; }
|
|
13414
13806
|
finally {
|
|
13415
13807
|
try {
|
|
13416
13808
|
if (groupFields_1_1 && !groupFields_1_1.done && (_b = groupFields_1.return)) _b.call(groupFields_1);
|
|
13417
13809
|
}
|
|
13418
|
-
finally { if (
|
|
13810
|
+
finally { if (e_22) throw e_22.error; }
|
|
13419
13811
|
}
|
|
13420
13812
|
}
|
|
13421
13813
|
}
|
|
13422
|
-
catch (
|
|
13814
|
+
catch (e_21_1) { e_21 = { error: e_21_1 }; }
|
|
13423
13815
|
finally {
|
|
13424
13816
|
try {
|
|
13425
13817
|
if (stageKeys_1_1 && !stageKeys_1_1.done && (_a = stageKeys_1.return)) _a.call(stageKeys_1);
|
|
13426
13818
|
}
|
|
13427
|
-
finally { if (
|
|
13819
|
+
finally { if (e_21) throw e_21.error; }
|
|
13428
13820
|
}
|
|
13429
13821
|
}
|
|
13430
13822
|
return false;
|
|
@@ -13531,7 +13923,7 @@ function isRegexMatchCondition(value) {
|
|
|
13531
13923
|
return false;
|
|
13532
13924
|
}
|
|
13533
13925
|
function findRegexMatchInMatchObject(match, prefix) {
|
|
13534
|
-
var
|
|
13926
|
+
var e_23, _a, e_24, _b;
|
|
13535
13927
|
if (prefix === void 0) { prefix = ''; }
|
|
13536
13928
|
if (Array.isArray(match)) {
|
|
13537
13929
|
try {
|
|
@@ -13543,12 +13935,12 @@ function findRegexMatchInMatchObject(match, prefix) {
|
|
|
13543
13935
|
}
|
|
13544
13936
|
}
|
|
13545
13937
|
}
|
|
13546
|
-
catch (
|
|
13938
|
+
catch (e_23_1) { e_23 = { error: e_23_1 }; }
|
|
13547
13939
|
finally {
|
|
13548
13940
|
try {
|
|
13549
13941
|
if (match_1_1 && !match_1_1.done && (_a = match_1.return)) _a.call(match_1);
|
|
13550
13942
|
}
|
|
13551
|
-
finally { if (
|
|
13943
|
+
finally { if (e_23) throw e_23.error; }
|
|
13552
13944
|
}
|
|
13553
13945
|
return null;
|
|
13554
13946
|
}
|
|
@@ -13579,12 +13971,12 @@ function findRegexMatchInMatchObject(match, prefix) {
|
|
|
13579
13971
|
}
|
|
13580
13972
|
}
|
|
13581
13973
|
}
|
|
13582
|
-
catch (
|
|
13974
|
+
catch (e_24_1) { e_24 = { error: e_24_1 }; }
|
|
13583
13975
|
finally {
|
|
13584
13976
|
try {
|
|
13585
13977
|
if (keys_2_1 && !keys_2_1.done && (_b = keys_2.return)) _b.call(keys_2);
|
|
13586
13978
|
}
|
|
13587
|
-
finally { if (
|
|
13979
|
+
finally { if (e_24) throw e_24.error; }
|
|
13588
13980
|
}
|
|
13589
13981
|
return null;
|
|
13590
13982
|
}
|
|
@@ -13973,7 +14365,7 @@ function collectMatchFieldsByCondition(match, predicate, prefix) {
|
|
|
13973
14365
|
return results;
|
|
13974
14366
|
}
|
|
13975
14367
|
function findMatchConditionForField(match, targetField, prefix) {
|
|
13976
|
-
var
|
|
14368
|
+
var e_25, _a, e_26, _b;
|
|
13977
14369
|
if (prefix === void 0) { prefix = ''; }
|
|
13978
14370
|
if (!match || typeof match !== 'object') {
|
|
13979
14371
|
return undefined;
|
|
@@ -13988,12 +14380,12 @@ function findMatchConditionForField(match, targetField, prefix) {
|
|
|
13988
14380
|
}
|
|
13989
14381
|
}
|
|
13990
14382
|
}
|
|
13991
|
-
catch (
|
|
14383
|
+
catch (e_25_1) { e_25 = { error: e_25_1 }; }
|
|
13992
14384
|
finally {
|
|
13993
14385
|
try {
|
|
13994
14386
|
if (match_2_1 && !match_2_1.done && (_a = match_2.return)) _a.call(match_2);
|
|
13995
14387
|
}
|
|
13996
|
-
finally { if (
|
|
14388
|
+
finally { if (e_25) throw e_25.error; }
|
|
13997
14389
|
}
|
|
13998
14390
|
return undefined;
|
|
13999
14391
|
}
|
|
@@ -14020,12 +14412,12 @@ function findMatchConditionForField(match, targetField, prefix) {
|
|
|
14020
14412
|
}
|
|
14021
14413
|
}
|
|
14022
14414
|
}
|
|
14023
|
-
catch (
|
|
14415
|
+
catch (e_26_1) { e_26 = { error: e_26_1 }; }
|
|
14024
14416
|
finally {
|
|
14025
14417
|
try {
|
|
14026
14418
|
if (_d && !_d.done && (_b = _c.return)) _b.call(_c);
|
|
14027
14419
|
}
|
|
14028
|
-
finally { if (
|
|
14420
|
+
finally { if (e_26) throw e_26.error; }
|
|
14029
14421
|
}
|
|
14030
14422
|
return undefined;
|
|
14031
14423
|
}
|
|
@@ -14258,7 +14650,7 @@ function detectIdLikeValue(value) {
|
|
|
14258
14650
|
return false;
|
|
14259
14651
|
}
|
|
14260
14652
|
function detectChemicalIdFromProbe(probeDocs, fields) {
|
|
14261
|
-
var
|
|
14653
|
+
var e_27, _a, e_28, _b;
|
|
14262
14654
|
if (!Array.isArray(probeDocs) || !probeDocs.length) {
|
|
14263
14655
|
return false;
|
|
14264
14656
|
}
|
|
@@ -14270,7 +14662,7 @@ function detectChemicalIdFromProbe(probeDocs, fields) {
|
|
|
14270
14662
|
for (var probeDocs_1 = __values(probeDocs), probeDocs_1_1 = probeDocs_1.next(); !probeDocs_1_1.done; probeDocs_1_1 = probeDocs_1.next()) {
|
|
14271
14663
|
var doc = probeDocs_1_1.value;
|
|
14272
14664
|
try {
|
|
14273
|
-
for (var targets_1 = (
|
|
14665
|
+
for (var targets_1 = (e_28 = void 0, __values(targets)), targets_1_1 = targets_1.next(); !targets_1_1.done; targets_1_1 = targets_1.next()) {
|
|
14274
14666
|
var field = targets_1_1.value;
|
|
14275
14667
|
var value = getValueAtPath(doc, field);
|
|
14276
14668
|
if (Array.isArray(value)) {
|
|
@@ -14283,21 +14675,21 @@ function detectChemicalIdFromProbe(probeDocs, fields) {
|
|
|
14283
14675
|
}
|
|
14284
14676
|
}
|
|
14285
14677
|
}
|
|
14286
|
-
catch (
|
|
14678
|
+
catch (e_28_1) { e_28 = { error: e_28_1 }; }
|
|
14287
14679
|
finally {
|
|
14288
14680
|
try {
|
|
14289
14681
|
if (targets_1_1 && !targets_1_1.done && (_b = targets_1.return)) _b.call(targets_1);
|
|
14290
14682
|
}
|
|
14291
|
-
finally { if (
|
|
14683
|
+
finally { if (e_28) throw e_28.error; }
|
|
14292
14684
|
}
|
|
14293
14685
|
}
|
|
14294
14686
|
}
|
|
14295
|
-
catch (
|
|
14687
|
+
catch (e_27_1) { e_27 = { error: e_27_1 }; }
|
|
14296
14688
|
finally {
|
|
14297
14689
|
try {
|
|
14298
14690
|
if (probeDocs_1_1 && !probeDocs_1_1.done && (_a = probeDocs_1.return)) _a.call(probeDocs_1);
|
|
14299
14691
|
}
|
|
14300
|
-
finally { if (
|
|
14692
|
+
finally { if (e_27) throw e_27.error; }
|
|
14301
14693
|
}
|
|
14302
14694
|
return false;
|
|
14303
14695
|
}
|
|
@@ -14518,8 +14910,8 @@ function buildChemicalIdFieldCandidates(field) {
|
|
|
14518
14910
|
}
|
|
14519
14911
|
function applyChemicalNameLookupFallbackToQuery(params) {
|
|
14520
14912
|
return __awaiter(this, void 0, void 0, function () {
|
|
14521
|
-
var query, db, dbName, idClient, idCustomer, isSuperAdmin, probeDocs, chemicalFields, targetField, condition, regex, sampleDocs, collectionNames, candidates, _loop_8, candidates_1, candidates_1_1, candidate, state_5,
|
|
14522
|
-
var
|
|
14913
|
+
var query, db, dbName, idClient, idCustomer, isSuperAdmin, probeDocs, chemicalFields, targetField, condition, regex, sampleDocs, collectionNames, candidates, _loop_8, candidates_1, candidates_1_1, candidate, state_5, e_29_1;
|
|
14914
|
+
var e_29, _a;
|
|
14523
14915
|
var _b;
|
|
14524
14916
|
return __generator(this, function (_c) {
|
|
14525
14917
|
switch (_c.label) {
|
|
@@ -14632,14 +15024,14 @@ function applyChemicalNameLookupFallbackToQuery(params) {
|
|
|
14632
15024
|
return [3 /*break*/, 3];
|
|
14633
15025
|
case 6: return [3 /*break*/, 9];
|
|
14634
15026
|
case 7:
|
|
14635
|
-
|
|
14636
|
-
|
|
15027
|
+
e_29_1 = _c.sent();
|
|
15028
|
+
e_29 = { error: e_29_1 };
|
|
14637
15029
|
return [3 /*break*/, 9];
|
|
14638
15030
|
case 8:
|
|
14639
15031
|
try {
|
|
14640
15032
|
if (candidates_1_1 && !candidates_1_1.done && (_a = candidates_1.return)) _a.call(candidates_1);
|
|
14641
15033
|
}
|
|
14642
|
-
finally { if (
|
|
15034
|
+
finally { if (e_29) throw e_29.error; }
|
|
14643
15035
|
return [7 /*endfinally*/];
|
|
14644
15036
|
case 9: return [2 /*return*/, null];
|
|
14645
15037
|
}
|
|
@@ -14739,8 +15131,8 @@ function lookupIdsForNameMatch(params) {
|
|
|
14739
15131
|
}
|
|
14740
15132
|
function applyIdLookupFallbackToQuery(params) {
|
|
14741
15133
|
return __awaiter(this, void 0, void 0, function () {
|
|
14742
|
-
var query, db, dbName, idClient, idCustomer, isSuperAdmin, probeDocs, conditions, collectionNames, _a, conditions_1, conditions_1_1, condition, regex, baseToken, targetFieldType, nextValue, localNameField, candidates, candidates_2, candidates_2_1, candidate, candidateHasClientScope, _b, candidateProbe, lookup, targetFieldType, normalizedIds, idsForQuery,
|
|
14743
|
-
var
|
|
15134
|
+
var query, db, dbName, idClient, idCustomer, isSuperAdmin, probeDocs, conditions, collectionNames, _a, conditions_1, conditions_1_1, condition, regex, baseToken, targetFieldType, nextValue, localNameField, candidates, candidates_2, candidates_2_1, candidate, candidateHasClientScope, _b, candidateProbe, lookup, targetFieldType, normalizedIds, idsForQuery, e_30_1, e_31_1;
|
|
15135
|
+
var e_31, _c, e_30, _d;
|
|
14744
15136
|
var _e;
|
|
14745
15137
|
return __generator(this, function (_f) {
|
|
14746
15138
|
switch (_f.label) {
|
|
@@ -14810,7 +15202,7 @@ function applyIdLookupFallbackToQuery(params) {
|
|
|
14810
15202
|
_f.label = 5;
|
|
14811
15203
|
case 5:
|
|
14812
15204
|
_f.trys.push([5, 14, 15, 16]);
|
|
14813
|
-
candidates_2 = (
|
|
15205
|
+
candidates_2 = (e_30 = void 0, __values(candidates)), candidates_2_1 = candidates_2.next();
|
|
14814
15206
|
_f.label = 6;
|
|
14815
15207
|
case 6:
|
|
14816
15208
|
if (!!candidates_2_1.done) return [3 /*break*/, 13];
|
|
@@ -14877,28 +15269,28 @@ function applyIdLookupFallbackToQuery(params) {
|
|
|
14877
15269
|
return [3 /*break*/, 6];
|
|
14878
15270
|
case 13: return [3 /*break*/, 16];
|
|
14879
15271
|
case 14:
|
|
14880
|
-
|
|
14881
|
-
|
|
15272
|
+
e_30_1 = _f.sent();
|
|
15273
|
+
e_30 = { error: e_30_1 };
|
|
14882
15274
|
return [3 /*break*/, 16];
|
|
14883
15275
|
case 15:
|
|
14884
15276
|
try {
|
|
14885
15277
|
if (candidates_2_1 && !candidates_2_1.done && (_d = candidates_2.return)) _d.call(candidates_2);
|
|
14886
15278
|
}
|
|
14887
|
-
finally { if (
|
|
15279
|
+
finally { if (e_30) throw e_30.error; }
|
|
14888
15280
|
return [7 /*endfinally*/];
|
|
14889
15281
|
case 16:
|
|
14890
15282
|
conditions_1_1 = conditions_1.next();
|
|
14891
15283
|
return [3 /*break*/, 4];
|
|
14892
15284
|
case 17: return [3 /*break*/, 20];
|
|
14893
15285
|
case 18:
|
|
14894
|
-
|
|
14895
|
-
|
|
15286
|
+
e_31_1 = _f.sent();
|
|
15287
|
+
e_31 = { error: e_31_1 };
|
|
14896
15288
|
return [3 /*break*/, 20];
|
|
14897
15289
|
case 19:
|
|
14898
15290
|
try {
|
|
14899
15291
|
if (conditions_1_1 && !conditions_1_1.done && (_c = conditions_1.return)) _c.call(conditions_1);
|
|
14900
15292
|
}
|
|
14901
|
-
finally { if (
|
|
15293
|
+
finally { if (e_31) throw e_31.error; }
|
|
14902
15294
|
return [7 /*endfinally*/];
|
|
14903
15295
|
case 20: return [2 /*return*/, null];
|
|
14904
15296
|
}
|
|
@@ -15343,8 +15735,8 @@ function resolveAssistantSurfaceFileCandidates(baseName) {
|
|
|
15343
15735
|
}
|
|
15344
15736
|
function readFirstAssistantSurfaceFile(candidates) {
|
|
15345
15737
|
return __awaiter(this, void 0, void 0, function () {
|
|
15346
|
-
var candidates_3, candidates_3_1, candidate, normalized, _a,
|
|
15347
|
-
var
|
|
15738
|
+
var candidates_3, candidates_3_1, candidate, normalized, _a, e_32_1;
|
|
15739
|
+
var e_32, _b;
|
|
15348
15740
|
return __generator(this, function (_c) {
|
|
15349
15741
|
switch (_c.label) {
|
|
15350
15742
|
case 0:
|
|
@@ -15371,14 +15763,14 @@ function readFirstAssistantSurfaceFile(candidates) {
|
|
|
15371
15763
|
return [3 /*break*/, 1];
|
|
15372
15764
|
case 6: return [3 /*break*/, 9];
|
|
15373
15765
|
case 7:
|
|
15374
|
-
|
|
15375
|
-
|
|
15766
|
+
e_32_1 = _c.sent();
|
|
15767
|
+
e_32 = { error: e_32_1 };
|
|
15376
15768
|
return [3 /*break*/, 9];
|
|
15377
15769
|
case 8:
|
|
15378
15770
|
try {
|
|
15379
15771
|
if (candidates_3_1 && !candidates_3_1.done && (_b = candidates_3.return)) _b.call(candidates_3);
|
|
15380
15772
|
}
|
|
15381
|
-
finally { if (
|
|
15773
|
+
finally { if (e_32) throw e_32.error; }
|
|
15382
15774
|
return [7 /*endfinally*/];
|
|
15383
15775
|
case 9: return [2 /*return*/, ''];
|
|
15384
15776
|
}
|
|
@@ -15911,6 +16303,23 @@ function cloneAssistantHeuristicProfile(profile) {
|
|
|
15911
16303
|
progress: mergeAssistantHintValues((entry === null || entry === void 0 ? void 0 : entry.progress) || []),
|
|
15912
16304
|
acknowledgement: normalizeOptionalString(entry === null || entry === void 0 ? void 0 : entry.acknowledgement) || undefined,
|
|
15913
16305
|
assumptions: mergeAssistantHintValues((entry === null || entry === void 0 ? void 0 : entry.assumptions) || []),
|
|
16306
|
+
dimensions: Array.isArray(entry === null || entry === void 0 ? void 0 : entry.dimensions)
|
|
16307
|
+
? entry.dimensions.map(function (dimension) { return ({
|
|
16308
|
+
id: normalizeOptionalString(dimension === null || dimension === void 0 ? void 0 : dimension.id),
|
|
16309
|
+
type: normalizeAssistantAppDataDimensionType(dimension === null || dimension === void 0 ? void 0 : dimension.type),
|
|
16310
|
+
granularity: normalizeOptionalString(dimension === null || dimension === void 0 ? void 0 : dimension.granularity) || undefined,
|
|
16311
|
+
requestedText: normalizeOptionalString(dimension === null || dimension === void 0 ? void 0 : dimension.requestedText) || undefined,
|
|
16312
|
+
terms: mergeAssistantHintValues((dimension === null || dimension === void 0 ? void 0 : dimension.terms) || []).map(function (term) { return term.toLowerCase(); }),
|
|
16313
|
+
groupId: (0, common_1.deepCopy)(dimension === null || dimension === void 0 ? void 0 : dimension.groupId),
|
|
16314
|
+
project: (dimension === null || dimension === void 0 ? void 0 : dimension.project) && typeof dimension.project === 'object' && !Array.isArray(dimension.project)
|
|
16315
|
+
? (0, common_1.deepCopy)(dimension.project)
|
|
16316
|
+
: undefined,
|
|
16317
|
+
sort: (dimension === null || dimension === void 0 ? void 0 : dimension.sort) && typeof dimension.sort === 'object' && !Array.isArray(dimension.sort)
|
|
16318
|
+
? (0, common_1.deepCopy)(dimension.sort)
|
|
16319
|
+
: undefined,
|
|
16320
|
+
preGroupStages: Array.isArray(dimension === null || dimension === void 0 ? void 0 : dimension.preGroupStages) ? (0, common_1.deepCopy)(dimension.preGroupStages) : undefined
|
|
16321
|
+
}); }).filter(function (dimension) { return !!dimension.id && dimension.groupId !== undefined; })
|
|
16322
|
+
: [],
|
|
15914
16323
|
pipeline: Array.isArray(entry === null || entry === void 0 ? void 0 : entry.pipeline) ? (0, common_1.deepCopy)(entry.pipeline) : undefined,
|
|
15915
16324
|
options: (entry === null || entry === void 0 ? void 0 : entry.options) && typeof entry.options === 'object' && !Array.isArray(entry.options)
|
|
15916
16325
|
? (0, common_1.deepCopy)(entry.options)
|
|
@@ -16004,6 +16413,13 @@ function normalizeAssistantDisplayDateFormat(value) {
|
|
|
16004
16413
|
}
|
|
16005
16414
|
return undefined;
|
|
16006
16415
|
}
|
|
16416
|
+
function normalizeAssistantAppDataDimensionType(value) {
|
|
16417
|
+
var normalized = normalizeOptionalString(value).toLowerCase();
|
|
16418
|
+
if (normalized === 'time' || normalized === 'entity') {
|
|
16419
|
+
return normalized;
|
|
16420
|
+
}
|
|
16421
|
+
return undefined;
|
|
16422
|
+
}
|
|
16007
16423
|
function normalizeAssistantHeuristicStringList(value) {
|
|
16008
16424
|
if (Array.isArray(value)) {
|
|
16009
16425
|
return mergeAssistantHintValues(value.map(function (entry) { return normalizeOptionalString(entry).toLowerCase(); }));
|
|
@@ -16062,6 +16478,55 @@ function normalizeAssistantCollectionTermHints(value) {
|
|
|
16062
16478
|
});
|
|
16063
16479
|
return hints;
|
|
16064
16480
|
}
|
|
16481
|
+
function normalizeAssistantAppDataDimensions(value) {
|
|
16482
|
+
var entries = Array.isArray(value)
|
|
16483
|
+
? value.map(function (entry) { return ({ key: '', entry: entry }); })
|
|
16484
|
+
: value && typeof value === 'object'
|
|
16485
|
+
? Object.keys(value).map(function (key) { return ({ key: key, entry: value[key] }); })
|
|
16486
|
+
: [];
|
|
16487
|
+
var dimensions = [];
|
|
16488
|
+
entries.forEach(function (_a) {
|
|
16489
|
+
var key = _a.key, entry = _a.entry;
|
|
16490
|
+
if (!entry || typeof entry !== 'object' || Array.isArray(entry)) {
|
|
16491
|
+
return;
|
|
16492
|
+
}
|
|
16493
|
+
var id = normalizeOptionalString(entry.id
|
|
16494
|
+
|| entry.dimension_id
|
|
16495
|
+
|| entry.dimensionId
|
|
16496
|
+
|| key);
|
|
16497
|
+
var groupId = entry.group_id !== undefined
|
|
16498
|
+
? entry.group_id
|
|
16499
|
+
: entry.groupId !== undefined
|
|
16500
|
+
? entry.groupId
|
|
16501
|
+
: entry.group;
|
|
16502
|
+
if (!id || groupId === undefined) {
|
|
16503
|
+
return;
|
|
16504
|
+
}
|
|
16505
|
+
var terms = normalizeAssistantHeuristicStringList(entry.terms
|
|
16506
|
+
|| entry.aliases
|
|
16507
|
+
|| entry.phrases
|
|
16508
|
+
|| [id]).map(function (term) { return term.toLowerCase(); });
|
|
16509
|
+
dimensions.push({
|
|
16510
|
+
id: id,
|
|
16511
|
+
type: normalizeAssistantAppDataDimensionType(entry.type),
|
|
16512
|
+
granularity: normalizeOptionalString(entry.granularity) || undefined,
|
|
16513
|
+
terms: terms.length ? terms : [id.toLowerCase()],
|
|
16514
|
+
groupId: (0, common_1.deepCopy)(groupId),
|
|
16515
|
+
project: entry.project && typeof entry.project === 'object' && !Array.isArray(entry.project)
|
|
16516
|
+
? (0, common_1.deepCopy)(entry.project)
|
|
16517
|
+
: undefined,
|
|
16518
|
+
sort: entry.sort && typeof entry.sort === 'object' && !Array.isArray(entry.sort)
|
|
16519
|
+
? (0, common_1.deepCopy)(entry.sort)
|
|
16520
|
+
: undefined,
|
|
16521
|
+
preGroupStages: Array.isArray(entry.pre_group_stages)
|
|
16522
|
+
? (0, common_1.deepCopy)(entry.pre_group_stages)
|
|
16523
|
+
: Array.isArray(entry.preGroupStages)
|
|
16524
|
+
? (0, common_1.deepCopy)(entry.preGroupStages)
|
|
16525
|
+
: undefined
|
|
16526
|
+
});
|
|
16527
|
+
});
|
|
16528
|
+
return dimensions;
|
|
16529
|
+
}
|
|
16065
16530
|
function normalizeAssistantAppDataIntents(value) {
|
|
16066
16531
|
var entries = Array.isArray(value) ? value : [];
|
|
16067
16532
|
var intents = [];
|
|
@@ -16092,6 +16557,10 @@ function normalizeAssistantAppDataIntents(value) {
|
|
|
16092
16557
|
|| entry.acknowledgement_template
|
|
16093
16558
|
|| entry.acknowledgementTemplate) || undefined,
|
|
16094
16559
|
assumptions: mergeAssistantHintValues(Array.isArray(entry.assumptions) ? entry.assumptions : []),
|
|
16560
|
+
dimensions: normalizeAssistantAppDataDimensions(entry.dimensions
|
|
16561
|
+
|| entry.breakdown_dimensions
|
|
16562
|
+
|| entry.breakdownDimensions
|
|
16563
|
+
|| []),
|
|
16095
16564
|
pipeline: Array.isArray(entry.pipeline) ? (0, common_1.deepCopy)(entry.pipeline) : undefined,
|
|
16096
16565
|
options: entry.options && typeof entry.options === 'object' && !Array.isArray(entry.options)
|
|
16097
16566
|
? (0, common_1.deepCopy)(entry.options)
|
|
@@ -16822,7 +17291,7 @@ function doesAssistantPreserveAnyTermMatch(text, terms) {
|
|
|
16822
17291
|
return (Array.isArray(terms) ? terms : []).some(function (term) { return doesAssistantPreserveTermMatch(text, term); });
|
|
16823
17292
|
}
|
|
16824
17293
|
function shouldPreserveAssistantCollectionForRouteFromRules(params) {
|
|
16825
|
-
var
|
|
17294
|
+
var e_33, _a;
|
|
16826
17295
|
var _b, _c, _d, _e, _f, _g, _h;
|
|
16827
17296
|
var routePreferred = normalizeAssistantCollectionOverrideName(params.routePreferredName);
|
|
16828
17297
|
var requested = normalizeAssistantCollectionOverrideName(params.requestedCollection);
|
|
@@ -16854,12 +17323,12 @@ function shouldPreserveAssistantCollectionForRouteFromRules(params) {
|
|
|
16854
17323
|
return true;
|
|
16855
17324
|
}
|
|
16856
17325
|
}
|
|
16857
|
-
catch (
|
|
17326
|
+
catch (e_33_1) { e_33 = { error: e_33_1 }; }
|
|
16858
17327
|
finally {
|
|
16859
17328
|
try {
|
|
16860
17329
|
if (_k && !_k.done && (_a = _j.return)) _a.call(_j);
|
|
16861
17330
|
}
|
|
16862
|
-
finally { if (
|
|
17331
|
+
finally { if (e_33) throw e_33.error; }
|
|
16863
17332
|
}
|
|
16864
17333
|
return false;
|
|
16865
17334
|
}
|
|
@@ -17750,7 +18219,7 @@ function resolveAssistantNestedPrefixCollectionCandidates(params) {
|
|
|
17750
18219
|
function resolveAssistantNestedAggregateFallbacks(params) {
|
|
17751
18220
|
return __awaiter(this, void 0, void 0, function () {
|
|
17752
18221
|
var prefixes, collectionNames, fallbacks, seen, prefixes_1, prefixes_1_1, prefix, rewrite, candidates, candidates_4, candidates_4_1, candidate, normalizedPipeline, key;
|
|
17753
|
-
var
|
|
18222
|
+
var e_34, _a, e_35, _b;
|
|
17754
18223
|
return __generator(this, function (_c) {
|
|
17755
18224
|
switch (_c.label) {
|
|
17756
18225
|
case 0:
|
|
@@ -17780,7 +18249,7 @@ function resolveAssistantNestedAggregateFallbacks(params) {
|
|
|
17780
18249
|
triedCollections: params.triedCollections
|
|
17781
18250
|
});
|
|
17782
18251
|
try {
|
|
17783
|
-
for (candidates_4 = (
|
|
18252
|
+
for (candidates_4 = (e_35 = void 0, __values(candidates)), candidates_4_1 = candidates_4.next(); !candidates_4_1.done; candidates_4_1 = candidates_4.next()) {
|
|
17784
18253
|
candidate = candidates_4_1.value;
|
|
17785
18254
|
normalizedPipeline = normalizeAssistantAggregatePipeline(rewrite.pipeline, candidate);
|
|
17786
18255
|
if (!normalizedPipeline.length || containsForbiddenMongoOperators(normalizedPipeline)) {
|
|
@@ -17802,21 +18271,21 @@ function resolveAssistantNestedAggregateFallbacks(params) {
|
|
|
17802
18271
|
}
|
|
17803
18272
|
}
|
|
17804
18273
|
}
|
|
17805
|
-
catch (
|
|
18274
|
+
catch (e_35_1) { e_35 = { error: e_35_1 }; }
|
|
17806
18275
|
finally {
|
|
17807
18276
|
try {
|
|
17808
18277
|
if (candidates_4_1 && !candidates_4_1.done && (_b = candidates_4.return)) _b.call(candidates_4);
|
|
17809
18278
|
}
|
|
17810
|
-
finally { if (
|
|
18279
|
+
finally { if (e_35) throw e_35.error; }
|
|
17811
18280
|
}
|
|
17812
18281
|
}
|
|
17813
18282
|
}
|
|
17814
|
-
catch (
|
|
18283
|
+
catch (e_34_1) { e_34 = { error: e_34_1 }; }
|
|
17815
18284
|
finally {
|
|
17816
18285
|
try {
|
|
17817
18286
|
if (prefixes_1_1 && !prefixes_1_1.done && (_a = prefixes_1.return)) _a.call(prefixes_1);
|
|
17818
18287
|
}
|
|
17819
|
-
finally { if (
|
|
18288
|
+
finally { if (e_34) throw e_34.error; }
|
|
17820
18289
|
}
|
|
17821
18290
|
return [2 /*return*/, fallbacks];
|
|
17822
18291
|
}
|
|
@@ -17948,8 +18417,8 @@ function resolveAssistantBridgeCollectionHintCandidates(requestedCollection, req
|
|
|
17948
18417
|
}
|
|
17949
18418
|
function resolveAssistantReportBuilderBridgeCollection(collection_1, db_1) {
|
|
17950
18419
|
return __awaiter(this, arguments, void 0, function (collection, db, dbName, options) {
|
|
17951
|
-
var normalized, resolutionPath, pushResolutionStep, finalizeResolution, requestHints, appId, requestedTokens, requestedTokenWeights, aliasCandidates, hintCandidates, alias, manager, hasManager, configuredCollectionNames, isConfiguredCollection, candidates, pushCandidate, base, reportCandidate, candidates_5, candidates_5_1, candidate, model, candidates_6, candidates_6_1, candidate, primaryCollectionHint, resolverTargets, resolverErrorLogged, resolverTargets_1, resolverTargets_1_1, resolverTarget, resolved, resolvedName, resolvedScore, resolvedModel, _a,
|
|
17952
|
-
var
|
|
18420
|
+
var normalized, resolutionPath, pushResolutionStep, finalizeResolution, requestHints, appId, requestedTokens, requestedTokenWeights, aliasCandidates, hintCandidates, alias, manager, hasManager, configuredCollectionNames, isConfiguredCollection, candidates, pushCandidate, base, reportCandidate, candidates_5, candidates_5_1, candidate, model, candidates_6, candidates_6_1, candidate, primaryCollectionHint, resolverTargets, resolverErrorLogged, resolverTargets_1, resolverTargets_1_1, resolverTarget, resolved, resolvedName, resolvedScore, resolvedModel, _a, e_36_1, candidates_7, candidates_7_1, candidate, e_37_1, candidates_8, candidates_8_1, candidate;
|
|
18421
|
+
var e_38, _b, e_39, _c, e_36, _d, e_37, _e, e_40, _f;
|
|
17953
18422
|
var _g, _h;
|
|
17954
18423
|
if (dbName === void 0) { dbName = ''; }
|
|
17955
18424
|
return __generator(this, function (_j) {
|
|
@@ -18023,12 +18492,12 @@ function resolveAssistantReportBuilderBridgeCollection(collection_1, db_1) {
|
|
|
18023
18492
|
}
|
|
18024
18493
|
}
|
|
18025
18494
|
}
|
|
18026
|
-
catch (
|
|
18495
|
+
catch (e_38_1) { e_38 = { error: e_38_1 }; }
|
|
18027
18496
|
finally {
|
|
18028
18497
|
try {
|
|
18029
18498
|
if (candidates_5_1 && !candidates_5_1.done && (_b = candidates_5.return)) _b.call(candidates_5);
|
|
18030
18499
|
}
|
|
18031
|
-
finally { if (
|
|
18500
|
+
finally { if (e_38) throw e_38.error; }
|
|
18032
18501
|
}
|
|
18033
18502
|
}
|
|
18034
18503
|
if (configuredCollectionNames.length) {
|
|
@@ -18043,12 +18512,12 @@ function resolveAssistantReportBuilderBridgeCollection(collection_1, db_1) {
|
|
|
18043
18512
|
}
|
|
18044
18513
|
}
|
|
18045
18514
|
}
|
|
18046
|
-
catch (
|
|
18515
|
+
catch (e_39_1) { e_39 = { error: e_39_1 }; }
|
|
18047
18516
|
finally {
|
|
18048
18517
|
try {
|
|
18049
18518
|
if (candidates_6_1 && !candidates_6_1.done && (_c = candidates_6.return)) _c.call(candidates_6);
|
|
18050
18519
|
}
|
|
18051
|
-
finally { if (
|
|
18520
|
+
finally { if (e_39) throw e_39.error; }
|
|
18052
18521
|
}
|
|
18053
18522
|
}
|
|
18054
18523
|
primaryCollectionHint = normalizeOptionalString((_h = requestHints === null || requestHints === void 0 ? void 0 : requestHints.collectionHints) === null || _h === void 0 ? void 0 : _h[0]);
|
|
@@ -18109,14 +18578,14 @@ function resolveAssistantReportBuilderBridgeCollection(collection_1, db_1) {
|
|
|
18109
18578
|
return [3 /*break*/, 2];
|
|
18110
18579
|
case 7: return [3 /*break*/, 10];
|
|
18111
18580
|
case 8:
|
|
18112
|
-
|
|
18113
|
-
|
|
18581
|
+
e_36_1 = _j.sent();
|
|
18582
|
+
e_36 = { error: e_36_1 };
|
|
18114
18583
|
return [3 /*break*/, 10];
|
|
18115
18584
|
case 9:
|
|
18116
18585
|
try {
|
|
18117
18586
|
if (resolverTargets_1_1 && !resolverTargets_1_1.done && (_d = resolverTargets_1.return)) _d.call(resolverTargets_1);
|
|
18118
18587
|
}
|
|
18119
|
-
finally { if (
|
|
18588
|
+
finally { if (e_36) throw e_36.error; }
|
|
18120
18589
|
return [7 /*endfinally*/];
|
|
18121
18590
|
case 10:
|
|
18122
18591
|
if (!db) return [3 /*break*/, 18];
|
|
@@ -18142,14 +18611,14 @@ function resolveAssistantReportBuilderBridgeCollection(collection_1, db_1) {
|
|
|
18142
18611
|
return [3 /*break*/, 12];
|
|
18143
18612
|
case 15: return [3 /*break*/, 18];
|
|
18144
18613
|
case 16:
|
|
18145
|
-
|
|
18146
|
-
|
|
18614
|
+
e_37_1 = _j.sent();
|
|
18615
|
+
e_37 = { error: e_37_1 };
|
|
18147
18616
|
return [3 /*break*/, 18];
|
|
18148
18617
|
case 17:
|
|
18149
18618
|
try {
|
|
18150
18619
|
if (candidates_7_1 && !candidates_7_1.done && (_e = candidates_7.return)) _e.call(candidates_7);
|
|
18151
18620
|
}
|
|
18152
|
-
finally { if (
|
|
18621
|
+
finally { if (e_37) throw e_37.error; }
|
|
18153
18622
|
return [7 /*endfinally*/];
|
|
18154
18623
|
case 18:
|
|
18155
18624
|
try {
|
|
@@ -18160,12 +18629,12 @@ function resolveAssistantReportBuilderBridgeCollection(collection_1, db_1) {
|
|
|
18160
18629
|
}
|
|
18161
18630
|
}
|
|
18162
18631
|
}
|
|
18163
|
-
catch (
|
|
18632
|
+
catch (e_40_1) { e_40 = { error: e_40_1 }; }
|
|
18164
18633
|
finally {
|
|
18165
18634
|
try {
|
|
18166
18635
|
if (candidates_8_1 && !candidates_8_1.done && (_f = candidates_8.return)) _f.call(candidates_8);
|
|
18167
18636
|
}
|
|
18168
|
-
finally { if (
|
|
18637
|
+
finally { if (e_40) throw e_40.error; }
|
|
18169
18638
|
}
|
|
18170
18639
|
throw new Error('AI assistant report builder bridge: No queryable collection could be resolved.');
|
|
18171
18640
|
}
|
|
@@ -18173,7 +18642,7 @@ function resolveAssistantReportBuilderBridgeCollection(collection_1, db_1) {
|
|
|
18173
18642
|
});
|
|
18174
18643
|
}
|
|
18175
18644
|
function findQueryDateField(query) {
|
|
18176
|
-
var
|
|
18645
|
+
var e_41, _a, e_42, _b;
|
|
18177
18646
|
if (!query || typeof query !== 'object') {
|
|
18178
18647
|
return null;
|
|
18179
18648
|
}
|
|
@@ -18187,12 +18656,12 @@ function findQueryDateField(query) {
|
|
|
18187
18656
|
}
|
|
18188
18657
|
}
|
|
18189
18658
|
}
|
|
18190
|
-
catch (
|
|
18659
|
+
catch (e_41_1) { e_41 = { error: e_41_1 }; }
|
|
18191
18660
|
finally {
|
|
18192
18661
|
try {
|
|
18193
18662
|
if (query_1_1 && !query_1_1.done && (_a = query_1.return)) _a.call(query_1);
|
|
18194
18663
|
}
|
|
18195
|
-
finally { if (
|
|
18664
|
+
finally { if (e_41) throw e_41.error; }
|
|
18196
18665
|
}
|
|
18197
18666
|
return null;
|
|
18198
18667
|
}
|
|
@@ -18211,12 +18680,12 @@ function findQueryDateField(query) {
|
|
|
18211
18680
|
}
|
|
18212
18681
|
}
|
|
18213
18682
|
}
|
|
18214
|
-
catch (
|
|
18683
|
+
catch (e_42_1) { e_42 = { error: e_42_1 }; }
|
|
18215
18684
|
finally {
|
|
18216
18685
|
try {
|
|
18217
18686
|
if (_d && !_d.done && (_b = _c.return)) _b.call(_c);
|
|
18218
18687
|
}
|
|
18219
|
-
finally { if (
|
|
18688
|
+
finally { if (e_42) throw e_42.error; }
|
|
18220
18689
|
}
|
|
18221
18690
|
return null;
|
|
18222
18691
|
}
|
|
@@ -18504,7 +18973,7 @@ function resolveQueryDateFieldFallback(query) {
|
|
|
18504
18973
|
return { from: dateField, to: fallback };
|
|
18505
18974
|
}
|
|
18506
18975
|
function containsForbiddenMongoOperators(value) {
|
|
18507
|
-
var
|
|
18976
|
+
var e_43, _a;
|
|
18508
18977
|
if (!value || typeof value !== 'object') {
|
|
18509
18978
|
return false;
|
|
18510
18979
|
}
|
|
@@ -18523,12 +18992,12 @@ function containsForbiddenMongoOperators(value) {
|
|
|
18523
18992
|
}
|
|
18524
18993
|
}
|
|
18525
18994
|
}
|
|
18526
|
-
catch (
|
|
18995
|
+
catch (e_43_1) { e_43 = { error: e_43_1 }; }
|
|
18527
18996
|
finally {
|
|
18528
18997
|
try {
|
|
18529
18998
|
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
18530
18999
|
}
|
|
18531
|
-
finally { if (
|
|
19000
|
+
finally { if (e_43) throw e_43.error; }
|
|
18532
19001
|
}
|
|
18533
19002
|
return false;
|
|
18534
19003
|
}
|
|
@@ -18713,7 +19182,7 @@ function splitAssistantPermissionTokenSets(value) {
|
|
|
18713
19182
|
};
|
|
18714
19183
|
}
|
|
18715
19184
|
function isAssistantTokenSetSubset(subset, superset) {
|
|
18716
|
-
var
|
|
19185
|
+
var e_44, _a;
|
|
18717
19186
|
if (!subset.size) {
|
|
18718
19187
|
return false;
|
|
18719
19188
|
}
|
|
@@ -18725,12 +19194,12 @@ function isAssistantTokenSetSubset(subset, superset) {
|
|
|
18725
19194
|
}
|
|
18726
19195
|
}
|
|
18727
19196
|
}
|
|
18728
|
-
catch (
|
|
19197
|
+
catch (e_44_1) { e_44 = { error: e_44_1 }; }
|
|
18729
19198
|
finally {
|
|
18730
19199
|
try {
|
|
18731
19200
|
if (subset_1_1 && !subset_1_1.done && (_a = subset_1.return)) _a.call(subset_1);
|
|
18732
19201
|
}
|
|
18733
|
-
finally { if (
|
|
19202
|
+
finally { if (e_44) throw e_44.error; }
|
|
18734
19203
|
}
|
|
18735
19204
|
return true;
|
|
18736
19205
|
}
|
|
@@ -19265,8 +19734,8 @@ function applyCodexStreamStatusHandler(runOptions, streamStatusHandler) {
|
|
|
19265
19734
|
}
|
|
19266
19735
|
function waitForCodexWorkerMessage(worker, streamStatusHandler) {
|
|
19267
19736
|
return __awaiter(this, void 0, void 0, function () {
|
|
19268
|
-
var _a, _b, _c, _d, message, payload, status_1,
|
|
19269
|
-
var _e,
|
|
19737
|
+
var _a, _b, _c, _d, message, payload, status_1, e_45_1;
|
|
19738
|
+
var _e, e_45, _f, _g;
|
|
19270
19739
|
return __generator(this, function (_h) {
|
|
19271
19740
|
switch (_h.label) {
|
|
19272
19741
|
case 0:
|
|
@@ -19293,8 +19762,8 @@ function waitForCodexWorkerMessage(worker, streamStatusHandler) {
|
|
|
19293
19762
|
return [3 /*break*/, 1];
|
|
19294
19763
|
case 4: return [3 /*break*/, 11];
|
|
19295
19764
|
case 5:
|
|
19296
|
-
|
|
19297
|
-
|
|
19765
|
+
e_45_1 = _h.sent();
|
|
19766
|
+
e_45 = { error: e_45_1 };
|
|
19298
19767
|
return [3 /*break*/, 11];
|
|
19299
19768
|
case 6:
|
|
19300
19769
|
_h.trys.push([6, , 9, 10]);
|
|
@@ -19305,7 +19774,7 @@ function waitForCodexWorkerMessage(worker, streamStatusHandler) {
|
|
|
19305
19774
|
_h.label = 8;
|
|
19306
19775
|
case 8: return [3 /*break*/, 10];
|
|
19307
19776
|
case 9:
|
|
19308
|
-
if (
|
|
19777
|
+
if (e_45) throw e_45.error;
|
|
19309
19778
|
return [7 /*endfinally*/];
|
|
19310
19779
|
case 10: return [7 /*endfinally*/];
|
|
19311
19780
|
case 11: throw new CodexWorkerBootstrapError('AI worker exited before completing.');
|
|
@@ -19649,8 +20118,8 @@ function buildAssistantWorkspaceRootCandidates(params) {
|
|
|
19649
20118
|
}
|
|
19650
20119
|
function resolveAssistantWorkspaceRoot() {
|
|
19651
20120
|
return __awaiter(this, void 0, void 0, function () {
|
|
19652
|
-
var candidates, firstExisting, firstNestedGitRoot, candidates_9, candidates_9_1, candidate, _a, gitRoot, nestedGitRoots,
|
|
19653
|
-
var
|
|
20121
|
+
var candidates, firstExisting, firstNestedGitRoot, candidates_9, candidates_9_1, candidate, _a, gitRoot, nestedGitRoots, e_46_1;
|
|
20122
|
+
var e_46, _b;
|
|
19654
20123
|
return __generator(this, function (_c) {
|
|
19655
20124
|
switch (_c.label) {
|
|
19656
20125
|
case 0:
|
|
@@ -19697,14 +20166,14 @@ function resolveAssistantWorkspaceRoot() {
|
|
|
19697
20166
|
return [3 /*break*/, 2];
|
|
19698
20167
|
case 8: return [3 /*break*/, 11];
|
|
19699
20168
|
case 9:
|
|
19700
|
-
|
|
19701
|
-
|
|
20169
|
+
e_46_1 = _c.sent();
|
|
20170
|
+
e_46 = { error: e_46_1 };
|
|
19702
20171
|
return [3 /*break*/, 11];
|
|
19703
20172
|
case 10:
|
|
19704
20173
|
try {
|
|
19705
20174
|
if (candidates_9_1 && !candidates_9_1.done && (_b = candidates_9.return)) _b.call(candidates_9);
|
|
19706
20175
|
}
|
|
19707
|
-
finally { if (
|
|
20176
|
+
finally { if (e_46) throw e_46.error; }
|
|
19708
20177
|
return [7 /*endfinally*/];
|
|
19709
20178
|
case 11:
|
|
19710
20179
|
if (firstNestedGitRoot) {
|
|
@@ -20112,7 +20581,7 @@ var AI_ASSISTANT_BREAKDOWN_DIMENSION_STOPWORDS = new Set([
|
|
|
20112
20581
|
'by'
|
|
20113
20582
|
]);
|
|
20114
20583
|
function normalizeAssistantBreakdownDimension(value) {
|
|
20115
|
-
var
|
|
20584
|
+
var e_47, _a;
|
|
20116
20585
|
var normalized = normalizeOptionalString(value)
|
|
20117
20586
|
.toLowerCase()
|
|
20118
20587
|
.replace(/[^a-z0-9_\s-]+/g, ' ')
|
|
@@ -20144,12 +20613,12 @@ function normalizeAssistantBreakdownDimension(value) {
|
|
|
20144
20613
|
}
|
|
20145
20614
|
}
|
|
20146
20615
|
}
|
|
20147
|
-
catch (
|
|
20616
|
+
catch (e_47_1) { e_47 = { error: e_47_1 }; }
|
|
20148
20617
|
finally {
|
|
20149
20618
|
try {
|
|
20150
20619
|
if (tokens_1_1 && !tokens_1_1.done && (_a = tokens_1.return)) _a.call(tokens_1);
|
|
20151
20620
|
}
|
|
20152
|
-
finally { if (
|
|
20621
|
+
finally { if (e_47) throw e_47.error; }
|
|
20153
20622
|
}
|
|
20154
20623
|
if (!kept.length) {
|
|
20155
20624
|
return '';
|
|
@@ -20172,10 +20641,10 @@ function extractAssistantRequestedBreakdownDimensions(message) {
|
|
|
20172
20641
|
results.push(normalized);
|
|
20173
20642
|
};
|
|
20174
20643
|
var patterns = [
|
|
20175
|
-
/\bgroup(?:ed)?\s+by\s+([a-z0-9_-]+(?:\s+[a-z0-9_-]+){0,2})(?=\s+(?:by|per|for|of|in|with|and|or)\b|[,.!?;]|$)/gi,
|
|
20176
|
-
/\bbreak(?:\s+up|\s*down)?\b[\s\S]{0,80}?\bby\s+([a-z0-9_-]+(?:\s+[a-z0-9_-]+){0,2})(?=\s+(?:by|per|for|of|in|with|and|or)\b|[,.!?;]|$)/gi,
|
|
20177
|
-
/\b(?:by|per)\s+(?:each\s+)?([a-z0-9_-]+(?:\s+[a-z0-9_-]+){0,2})(?=\s+(?:by|per|for|of|in|with|and|or)\b|[,.!?;]|$)/gi,
|
|
20178
|
-
/\bfor\s+each\s+([a-z0-9_-]+(?:\s+[a-z0-9_-]+){0,2})(?=\s+(?:by|per|for|of|in|with|and|or)\b|[,.!?;]|$)/gi
|
|
20644
|
+
/\bgroup(?:ed)?\s+by\s+([a-z0-9_-]+(?:\s+(?!(?:by|per|for|of|in|with|and|or)\b)[a-z0-9_-]+){0,2})(?=\s+(?:by|per|for|of|in|with|and|or)\b|[,.!?;]|$)/gi,
|
|
20645
|
+
/\bbreak(?:\s+up|\s*down)?\b[\s\S]{0,80}?\bby\s+([a-z0-9_-]+(?:\s+(?!(?:by|per|for|of|in|with|and|or)\b)[a-z0-9_-]+){0,2})(?=\s+(?:by|per|for|of|in|with|and|or)\b|[,.!?;]|$)/gi,
|
|
20646
|
+
/\b(?:by|per)\s+(?:each\s+)?([a-z0-9_-]+(?:\s+(?!(?:by|per|for|of|in|with|and|or)\b)[a-z0-9_-]+){0,2})(?=\s+(?:by|per|for|of|in|with|and|or)\b|[,.!?;]|$)/gi,
|
|
20647
|
+
/\bfor\s+each\s+([a-z0-9_-]+(?:\s+(?!(?:by|per|for|of|in|with|and|or)\b)[a-z0-9_-]+){0,2})(?=\s+(?:by|per|for|of|in|with|and|or)\b|[,.!?;]|$)/gi
|
|
20179
20648
|
];
|
|
20180
20649
|
patterns.forEach(function (pattern) {
|
|
20181
20650
|
var match = pattern.exec(text);
|
|
@@ -20354,7 +20823,7 @@ function resolveAssistantPlannerEnabled(config) {
|
|
|
20354
20823
|
return raw === undefined ? false : raw === true;
|
|
20355
20824
|
}
|
|
20356
20825
|
function resolveAssistantPlannerKnownRoutes(user, isSuperAdmin) {
|
|
20357
|
-
var
|
|
20826
|
+
var e_48, _a;
|
|
20358
20827
|
var _b;
|
|
20359
20828
|
if (isSuperAdmin === void 0) { isSuperAdmin = false; }
|
|
20360
20829
|
var routes = ((_b = resolveio_server_app_1.ResolveIOServer.getClientRoutes) === null || _b === void 0 ? void 0 : _b.call(resolveio_server_app_1.ResolveIOServer)) || [];
|
|
@@ -20368,12 +20837,12 @@ function resolveAssistantPlannerKnownRoutes(user, isSuperAdmin) {
|
|
|
20368
20837
|
}
|
|
20369
20838
|
}
|
|
20370
20839
|
}
|
|
20371
|
-
catch (
|
|
20840
|
+
catch (e_48_1) { e_48 = { error: e_48_1 }; }
|
|
20372
20841
|
finally {
|
|
20373
20842
|
try {
|
|
20374
20843
|
if (routes_1_1 && !routes_1_1.done && (_a = routes_1.return)) _a.call(routes_1);
|
|
20375
20844
|
}
|
|
20376
|
-
finally { if (
|
|
20845
|
+
finally { if (e_48) throw e_48.error; }
|
|
20377
20846
|
}
|
|
20378
20847
|
var normalizedRoutes = Array.from(unique);
|
|
20379
20848
|
var allowedRoutes = collectAssistantAllowedRoutesForUser(user, normalizedRoutes, isSuperAdmin);
|
|
@@ -20749,7 +21218,7 @@ function normalizeRouteMatchKey(value) {
|
|
|
20749
21218
|
return normalizeRouteKey(value).toLowerCase();
|
|
20750
21219
|
}
|
|
20751
21220
|
function buildClientRouteIndex() {
|
|
20752
|
-
var
|
|
21221
|
+
var e_49, _a;
|
|
20753
21222
|
var _b;
|
|
20754
21223
|
var routes = mergeAssistantHintValues(((_b = resolveio_server_app_1.ResolveIOServer.getClientRoutes) === null || _b === void 0 ? void 0 : _b.call(resolveio_server_app_1.ResolveIOServer)) || [], AI_ASSISTANT_CORE_PUBLIC_ROUTES);
|
|
20755
21224
|
var set = new Set();
|
|
@@ -20768,12 +21237,12 @@ function buildClientRouteIndex() {
|
|
|
20768
21237
|
}
|
|
20769
21238
|
}
|
|
20770
21239
|
}
|
|
20771
|
-
catch (
|
|
21240
|
+
catch (e_49_1) { e_49 = { error: e_49_1 }; }
|
|
20772
21241
|
finally {
|
|
20773
21242
|
try {
|
|
20774
21243
|
if (routes_2_1 && !routes_2_1.done && (_a = routes_2.return)) _a.call(routes_2);
|
|
20775
21244
|
}
|
|
20776
|
-
finally { if (
|
|
21245
|
+
finally { if (e_49) throw e_49.error; }
|
|
20777
21246
|
}
|
|
20778
21247
|
return { set: set, map: map, size: routes.length };
|
|
20779
21248
|
}
|
|
@@ -21664,8 +22133,8 @@ function shouldSkipAssistantGitDiscoveryDirectory(name) {
|
|
|
21664
22133
|
}
|
|
21665
22134
|
function resolveAssistantWorkspaceGitRoots(workspaceRoot) {
|
|
21666
22135
|
return __awaiter(this, void 0, void 0, function () {
|
|
21667
|
-
var roots, seen, push, _a, configuredRoots, configuredRoots_1, configuredRoots_1_1, configuredRoot, _b,
|
|
21668
|
-
var
|
|
22136
|
+
var roots, seen, push, _a, configuredRoots, configuredRoots_1, configuredRoots_1_1, configuredRoot, _b, e_50_1, queue, queued, enqueue, next, entries, _c, entries_1, entries_1_1, entry, childName, candidate, gitPath, _d, e_51_1;
|
|
22137
|
+
var e_50, _e, e_51, _f;
|
|
21669
22138
|
var _g;
|
|
21670
22139
|
return __generator(this, function (_h) {
|
|
21671
22140
|
switch (_h.label) {
|
|
@@ -21710,14 +22179,14 @@ function resolveAssistantWorkspaceGitRoots(workspaceRoot) {
|
|
|
21710
22179
|
return [3 /*break*/, 3];
|
|
21711
22180
|
case 6: return [3 /*break*/, 9];
|
|
21712
22181
|
case 7:
|
|
21713
|
-
|
|
21714
|
-
|
|
22182
|
+
e_50_1 = _h.sent();
|
|
22183
|
+
e_50 = { error: e_50_1 };
|
|
21715
22184
|
return [3 /*break*/, 9];
|
|
21716
22185
|
case 8:
|
|
21717
22186
|
try {
|
|
21718
22187
|
if (configuredRoots_1_1 && !configuredRoots_1_1.done && (_e = configuredRoots_1.return)) _e.call(configuredRoots_1);
|
|
21719
22188
|
}
|
|
21720
|
-
finally { if (
|
|
22189
|
+
finally { if (e_50) throw e_50.error; }
|
|
21721
22190
|
return [7 /*endfinally*/];
|
|
21722
22191
|
case 9:
|
|
21723
22192
|
queue = [];
|
|
@@ -21757,7 +22226,7 @@ function resolveAssistantWorkspaceGitRoots(workspaceRoot) {
|
|
|
21757
22226
|
return [3 /*break*/, 14];
|
|
21758
22227
|
case 14:
|
|
21759
22228
|
_h.trys.push([14, 21, 22, 23]);
|
|
21760
|
-
entries_1 = (
|
|
22229
|
+
entries_1 = (e_51 = void 0, __values(entries)), entries_1_1 = entries_1.next();
|
|
21761
22230
|
_h.label = 15;
|
|
21762
22231
|
case 15:
|
|
21763
22232
|
if (!!entries_1_1.done) return [3 /*break*/, 20];
|
|
@@ -21796,14 +22265,14 @@ function resolveAssistantWorkspaceGitRoots(workspaceRoot) {
|
|
|
21796
22265
|
return [3 /*break*/, 15];
|
|
21797
22266
|
case 20: return [3 /*break*/, 23];
|
|
21798
22267
|
case 21:
|
|
21799
|
-
|
|
21800
|
-
|
|
22268
|
+
e_51_1 = _h.sent();
|
|
22269
|
+
e_51 = { error: e_51_1 };
|
|
21801
22270
|
return [3 /*break*/, 23];
|
|
21802
22271
|
case 22:
|
|
21803
22272
|
try {
|
|
21804
22273
|
if (entries_1_1 && !entries_1_1.done && (_f = entries_1.return)) _f.call(entries_1);
|
|
21805
22274
|
}
|
|
21806
|
-
finally { if (
|
|
22275
|
+
finally { if (e_51) throw e_51.error; }
|
|
21807
22276
|
return [7 /*endfinally*/];
|
|
21808
22277
|
case 23: return [3 /*break*/, 10];
|
|
21809
22278
|
case 24: return [2 /*return*/, roots];
|
|
@@ -22143,8 +22612,8 @@ function syncAssistantGitMirror(repoUrl) {
|
|
|
22143
22612
|
}
|
|
22144
22613
|
function resolveAssistantChangeHistoryGitRoots(workspaceRoot) {
|
|
22145
22614
|
return __awaiter(this, void 0, void 0, function () {
|
|
22146
|
-
var roots, repoUrls, mirroredRoots, repoUrls_1, repoUrls_1_1, repoUrl, mirrorRoot,
|
|
22147
|
-
var
|
|
22615
|
+
var roots, repoUrls, mirroredRoots, repoUrls_1, repoUrls_1_1, repoUrl, mirrorRoot, e_52_1;
|
|
22616
|
+
var e_52, _a;
|
|
22148
22617
|
return __generator(this, function (_b) {
|
|
22149
22618
|
switch (_b.label) {
|
|
22150
22619
|
case 0: return [4 /*yield*/, resolveAssistantWorkspaceGitRoots(workspaceRoot)];
|
|
@@ -22178,14 +22647,14 @@ function resolveAssistantChangeHistoryGitRoots(workspaceRoot) {
|
|
|
22178
22647
|
return [3 /*break*/, 3];
|
|
22179
22648
|
case 6: return [3 /*break*/, 9];
|
|
22180
22649
|
case 7:
|
|
22181
|
-
|
|
22182
|
-
|
|
22650
|
+
e_52_1 = _b.sent();
|
|
22651
|
+
e_52 = { error: e_52_1 };
|
|
22183
22652
|
return [3 /*break*/, 9];
|
|
22184
22653
|
case 8:
|
|
22185
22654
|
try {
|
|
22186
22655
|
if (repoUrls_1_1 && !repoUrls_1_1.done && (_a = repoUrls_1.return)) _a.call(repoUrls_1);
|
|
22187
22656
|
}
|
|
22188
|
-
finally { if (
|
|
22657
|
+
finally { if (e_52) throw e_52.error; }
|
|
22189
22658
|
return [7 /*endfinally*/];
|
|
22190
22659
|
case 9: return [2 /*return*/, mirroredRoots];
|
|
22191
22660
|
}
|
|
@@ -22194,8 +22663,8 @@ function resolveAssistantChangeHistoryGitRoots(workspaceRoot) {
|
|
|
22194
22663
|
}
|
|
22195
22664
|
function resolveAssistantChangeHistoryFastPathResponse(params) {
|
|
22196
22665
|
return __awaiter(this, void 0, void 0, function () {
|
|
22197
|
-
var workspaceRoot, _a, gitRoots, featureKeywords, sawExecutionError, bestFallback, gitRoots_1, gitRoots_1_1, gitRoot, _b, branch, _c, _d, limit, historyDepth, rawHistory, commits, summary, hasKeywordMatches, _e,
|
|
22198
|
-
var
|
|
22666
|
+
var workspaceRoot, _a, gitRoots, featureKeywords, sawExecutionError, bestFallback, gitRoots_1, gitRoots_1_1, gitRoot, _b, branch, _c, _d, limit, historyDepth, rawHistory, commits, summary, hasKeywordMatches, _e, e_53_1;
|
|
22667
|
+
var e_53, _f;
|
|
22199
22668
|
return __generator(this, function (_g) {
|
|
22200
22669
|
switch (_g.label) {
|
|
22201
22670
|
case 0:
|
|
@@ -22317,14 +22786,14 @@ function resolveAssistantChangeHistoryFastPathResponse(params) {
|
|
|
22317
22786
|
return [3 /*break*/, 7];
|
|
22318
22787
|
case 20: return [3 /*break*/, 23];
|
|
22319
22788
|
case 21:
|
|
22320
|
-
|
|
22321
|
-
|
|
22789
|
+
e_53_1 = _g.sent();
|
|
22790
|
+
e_53 = { error: e_53_1 };
|
|
22322
22791
|
return [3 /*break*/, 23];
|
|
22323
22792
|
case 22:
|
|
22324
22793
|
try {
|
|
22325
22794
|
if (gitRoots_1_1 && !gitRoots_1_1.done && (_f = gitRoots_1.return)) _f.call(gitRoots_1);
|
|
22326
22795
|
}
|
|
22327
|
-
finally { if (
|
|
22796
|
+
finally { if (e_53) throw e_53.error; }
|
|
22328
22797
|
return [7 /*endfinally*/];
|
|
22329
22798
|
case 23:
|
|
22330
22799
|
if (bestFallback) {
|
|
@@ -22505,7 +22974,7 @@ function sanitizeAssistantResponse(value) {
|
|
|
22505
22974
|
return normalizeAssistantRoutes(normalizedCurrency);
|
|
22506
22975
|
}
|
|
22507
22976
|
function evaluateAssistantGuardrails(message) {
|
|
22508
|
-
var
|
|
22977
|
+
var e_54, _a;
|
|
22509
22978
|
var normalized = String(message || '').toLowerCase();
|
|
22510
22979
|
var identityGuardrail = evaluateAssistantIdentityDisclosureGuardrail(normalized);
|
|
22511
22980
|
if (identityGuardrail === null || identityGuardrail === void 0 ? void 0 : identityGuardrail.blocked) {
|
|
@@ -22539,8 +23008,8 @@ function evaluateAssistantGuardrails(message) {
|
|
|
22539
23008
|
}
|
|
22540
23009
|
];
|
|
22541
23010
|
try {
|
|
22542
|
-
for (var
|
|
22543
|
-
var entry =
|
|
23011
|
+
for (var patterns_3 = __values(patterns), patterns_3_1 = patterns_3.next(); !patterns_3_1.done; patterns_3_1 = patterns_3.next()) {
|
|
23012
|
+
var entry = patterns_3_1.value;
|
|
22544
23013
|
if (entry.pattern.test(normalized)) {
|
|
22545
23014
|
return {
|
|
22546
23015
|
blocked: true,
|
|
@@ -22550,12 +23019,12 @@ function evaluateAssistantGuardrails(message) {
|
|
|
22550
23019
|
}
|
|
22551
23020
|
}
|
|
22552
23021
|
}
|
|
22553
|
-
catch (
|
|
23022
|
+
catch (e_54_1) { e_54 = { error: e_54_1 }; }
|
|
22554
23023
|
finally {
|
|
22555
23024
|
try {
|
|
22556
|
-
if (
|
|
23025
|
+
if (patterns_3_1 && !patterns_3_1.done && (_a = patterns_3.return)) _a.call(patterns_3);
|
|
22557
23026
|
}
|
|
22558
|
-
finally { if (
|
|
23027
|
+
finally { if (e_54) throw e_54.error; }
|
|
22559
23028
|
}
|
|
22560
23029
|
return null;
|
|
22561
23030
|
}
|
|
@@ -22660,7 +23129,7 @@ function tokenizeArithmeticExpression(expression) {
|
|
|
22660
23129
|
return tokens;
|
|
22661
23130
|
}
|
|
22662
23131
|
function evaluateArithmeticExpression(expression) {
|
|
22663
|
-
var
|
|
23132
|
+
var e_55, _a, e_56, _b;
|
|
22664
23133
|
var tokens = tokenizeArithmeticExpression(expression);
|
|
22665
23134
|
if (!tokens || !tokens.length) {
|
|
22666
23135
|
return null;
|
|
@@ -22717,12 +23186,12 @@ function evaluateArithmeticExpression(expression) {
|
|
|
22717
23186
|
prevToken = token;
|
|
22718
23187
|
}
|
|
22719
23188
|
}
|
|
22720
|
-
catch (
|
|
23189
|
+
catch (e_55_1) { e_55 = { error: e_55_1 }; }
|
|
22721
23190
|
finally {
|
|
22722
23191
|
try {
|
|
22723
23192
|
if (tokens_2_1 && !tokens_2_1.done && (_a = tokens_2.return)) _a.call(tokens_2);
|
|
22724
23193
|
}
|
|
22725
|
-
finally { if (
|
|
23194
|
+
finally { if (e_55) throw e_55.error; }
|
|
22726
23195
|
}
|
|
22727
23196
|
while (ops.length) {
|
|
22728
23197
|
var op = ops.pop();
|
|
@@ -22762,12 +23231,12 @@ function evaluateArithmeticExpression(expression) {
|
|
|
22762
23231
|
stack.push(Number(token));
|
|
22763
23232
|
}
|
|
22764
23233
|
}
|
|
22765
|
-
catch (
|
|
23234
|
+
catch (e_56_1) { e_56 = { error: e_56_1 }; }
|
|
22766
23235
|
finally {
|
|
22767
23236
|
try {
|
|
22768
23237
|
if (output_1_1 && !output_1_1.done && (_b = output_1.return)) _b.call(output_1);
|
|
22769
23238
|
}
|
|
22770
|
-
finally { if (
|
|
23239
|
+
finally { if (e_56) throw e_56.error; }
|
|
22771
23240
|
}
|
|
22772
23241
|
if (stack.length !== 1 || Number.isNaN(stack[0])) {
|
|
22773
23242
|
return null;
|
|
@@ -22951,8 +23420,8 @@ function handleCodexUpload(id_conversation, file_name, content_base64, size, con
|
|
|
22951
23420
|
}
|
|
22952
23421
|
function readAttachmentContents(attachments) {
|
|
22953
23422
|
return __awaiter(this, void 0, void 0, function () {
|
|
22954
|
-
var limits, totalBytes, totalChars, chunks, cleaned, attachments_1, attachments_1_1, attachment, localPath, safe, stat, ext, name_1, type, readable, content, _a,
|
|
22955
|
-
var
|
|
23423
|
+
var limits, totalBytes, totalChars, chunks, cleaned, attachments_1, attachments_1_1, attachment, localPath, safe, stat, ext, name_1, type, readable, content, _a, e_57_1;
|
|
23424
|
+
var e_57, _b;
|
|
22956
23425
|
return __generator(this, function (_c) {
|
|
22957
23426
|
switch (_c.label) {
|
|
22958
23427
|
case 0:
|
|
@@ -23031,14 +23500,14 @@ function readAttachmentContents(attachments) {
|
|
|
23031
23500
|
return [3 /*break*/, 2];
|
|
23032
23501
|
case 10: return [3 /*break*/, 13];
|
|
23033
23502
|
case 11:
|
|
23034
|
-
|
|
23035
|
-
|
|
23503
|
+
e_57_1 = _c.sent();
|
|
23504
|
+
e_57 = { error: e_57_1 };
|
|
23036
23505
|
return [3 /*break*/, 13];
|
|
23037
23506
|
case 12:
|
|
23038
23507
|
try {
|
|
23039
23508
|
if (attachments_1_1 && !attachments_1_1.done && (_b = attachments_1.return)) _b.call(attachments_1);
|
|
23040
23509
|
}
|
|
23041
|
-
finally { if (
|
|
23510
|
+
finally { if (e_57) throw e_57.error; }
|
|
23042
23511
|
return [7 /*endfinally*/];
|
|
23043
23512
|
case 13: return [2 /*return*/, {
|
|
23044
23513
|
promptText: chunks.length ? "\n\nAttachments:\n".concat(chunks.join('\n\n')) : '',
|
|
@@ -23463,7 +23932,7 @@ function sanitizeAssistantMessageSetPayload(setPayload) {
|
|
|
23463
23932
|
return next;
|
|
23464
23933
|
}
|
|
23465
23934
|
function sanitizeMongoSafeObject(value) {
|
|
23466
|
-
var
|
|
23935
|
+
var e_58, _a;
|
|
23467
23936
|
if (value === null || value === undefined) {
|
|
23468
23937
|
return value;
|
|
23469
23938
|
}
|
|
@@ -23487,17 +23956,17 @@ function sanitizeMongoSafeObject(value) {
|
|
|
23487
23956
|
out[key] = sanitizeMongoSafeObject(rawValue);
|
|
23488
23957
|
}
|
|
23489
23958
|
}
|
|
23490
|
-
catch (
|
|
23959
|
+
catch (e_58_1) { e_58 = { error: e_58_1 }; }
|
|
23491
23960
|
finally {
|
|
23492
23961
|
try {
|
|
23493
23962
|
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
23494
23963
|
}
|
|
23495
|
-
finally { if (
|
|
23964
|
+
finally { if (e_58) throw e_58.error; }
|
|
23496
23965
|
}
|
|
23497
23966
|
return out;
|
|
23498
23967
|
}
|
|
23499
23968
|
function restoreMongoSafeObject(value) {
|
|
23500
|
-
var
|
|
23969
|
+
var e_59, _a;
|
|
23501
23970
|
if (value === null || value === undefined) {
|
|
23502
23971
|
return value;
|
|
23503
23972
|
}
|
|
@@ -23521,12 +23990,12 @@ function restoreMongoSafeObject(value) {
|
|
|
23521
23990
|
out[key] = restoreMongoSafeObject(rawValue);
|
|
23522
23991
|
}
|
|
23523
23992
|
}
|
|
23524
|
-
catch (
|
|
23993
|
+
catch (e_59_1) { e_59 = { error: e_59_1 }; }
|
|
23525
23994
|
finally {
|
|
23526
23995
|
try {
|
|
23527
23996
|
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
23528
23997
|
}
|
|
23529
|
-
finally { if (
|
|
23998
|
+
finally { if (e_59) throw e_59.error; }
|
|
23530
23999
|
}
|
|
23531
24000
|
return out;
|
|
23532
24001
|
}
|
|
@@ -23704,7 +24173,7 @@ function recordAssistantAnswerAIRun(input) {
|
|
|
23704
24173
|
});
|
|
23705
24174
|
}
|
|
23706
24175
|
function evaluateGuardrails(message) {
|
|
23707
|
-
var
|
|
24176
|
+
var e_60, _a;
|
|
23708
24177
|
var normalized = String(message || '').toLowerCase();
|
|
23709
24178
|
var identityGuardrail = evaluateAssistantIdentityDisclosureGuardrail(normalized);
|
|
23710
24179
|
if (identityGuardrail === null || identityGuardrail === void 0 ? void 0 : identityGuardrail.blocked) {
|
|
@@ -23719,8 +24188,8 @@ function evaluateGuardrails(message) {
|
|
|
23719
24188
|
{ pattern: /\b(exploit|bypass|malware|phishing|ransomware|ddos)\b/i, reason: 'Security abuse is restricted.' }
|
|
23720
24189
|
];
|
|
23721
24190
|
try {
|
|
23722
|
-
for (var
|
|
23723
|
-
var entry =
|
|
24191
|
+
for (var patterns_4 = __values(patterns), patterns_4_1 = patterns_4.next(); !patterns_4_1.done; patterns_4_1 = patterns_4.next()) {
|
|
24192
|
+
var entry = patterns_4_1.value;
|
|
23724
24193
|
if (entry.pattern.test(normalized)) {
|
|
23725
24194
|
return {
|
|
23726
24195
|
blocked: true,
|
|
@@ -23730,12 +24199,12 @@ function evaluateGuardrails(message) {
|
|
|
23730
24199
|
}
|
|
23731
24200
|
}
|
|
23732
24201
|
}
|
|
23733
|
-
catch (
|
|
24202
|
+
catch (e_60_1) { e_60 = { error: e_60_1 }; }
|
|
23734
24203
|
finally {
|
|
23735
24204
|
try {
|
|
23736
|
-
if (
|
|
24205
|
+
if (patterns_4_1 && !patterns_4_1.done && (_a = patterns_4.return)) _a.call(patterns_4);
|
|
23737
24206
|
}
|
|
23738
|
-
finally { if (
|
|
24207
|
+
finally { if (e_60) throw e_60.error; }
|
|
23739
24208
|
}
|
|
23740
24209
|
return null;
|
|
23741
24210
|
}
|