@resolveio/server-lib 22.3.200 → 22.3.202
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
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
|
}
|
|
@@ -6979,7 +6993,14 @@ function resolveAssistantDataIntentDateWindow(message) {
|
|
|
6979
6993
|
year: now.getUTCFullYear()
|
|
6980
6994
|
};
|
|
6981
6995
|
}
|
|
6982
|
-
if (/\
|
|
6996
|
+
if (/\b(?:this|current)\s+month\b/.test(text)) {
|
|
6997
|
+
return {
|
|
6998
|
+
start: new Date(Date.UTC(now.getUTCFullYear(), now.getUTCMonth(), 1, 0, 0, 0, 0)).toISOString(),
|
|
6999
|
+
end: new Date(Date.UTC(now.getUTCFullYear(), now.getUTCMonth(), now.getUTCDate(), 23, 59, 59, 999)).toISOString(),
|
|
7000
|
+
year: now.getUTCFullYear()
|
|
7001
|
+
};
|
|
7002
|
+
}
|
|
7003
|
+
if (/\b(?:this|current)\s+week\b/.test(text)) {
|
|
6983
7004
|
var start = new Date(Date.UTC(now.getUTCFullYear(), now.getUTCMonth(), now.getUTCDate(), 0, 0, 0, 0));
|
|
6984
7005
|
var day = start.getUTCDay();
|
|
6985
7006
|
var offset = day === 0 ? 6 : day - 1;
|
|
@@ -7032,13 +7053,15 @@ function buildAssistantDataIntentMatchStage(customerText, dateField, dateWindow,
|
|
|
7032
7053
|
})
|
|
7033
7054
|
});
|
|
7034
7055
|
}
|
|
7035
|
-
if (dateField && dateWindow.start
|
|
7036
|
-
|
|
7037
|
-
|
|
7038
|
-
|
|
7039
|
-
|
|
7040
|
-
|
|
7041
|
-
|
|
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));
|
|
7042
7065
|
}
|
|
7043
7066
|
return and.length ? { $match: { $and: and } } : { $match: {} };
|
|
7044
7067
|
}
|
|
@@ -7074,6 +7097,9 @@ function isAssistantEmptyPipelineObject(value) {
|
|
|
7074
7097
|
}
|
|
7075
7098
|
function removeUndefinedAssistantPipelineValues(value, parentKey) {
|
|
7076
7099
|
if (parentKey === void 0) { parentKey = ''; }
|
|
7100
|
+
if (value instanceof Date) {
|
|
7101
|
+
return value;
|
|
7102
|
+
}
|
|
7077
7103
|
if (Array.isArray(value)) {
|
|
7078
7104
|
return value
|
|
7079
7105
|
.map(function (entry) { return removeUndefinedAssistantPipelineValues(entry, parentKey); })
|
|
@@ -7134,6 +7160,143 @@ function buildAssistantGenericDataIntentPipeline(intent, customerText, dateWindo
|
|
|
7134
7160
|
});
|
|
7135
7161
|
return pipeline;
|
|
7136
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 extractAssistantRequestedBreakdownDimensionText(message) {
|
|
7171
|
+
var e_5, _a;
|
|
7172
|
+
var text = normalizeOptionalString(message).toLowerCase();
|
|
7173
|
+
if (!text) {
|
|
7174
|
+
return '';
|
|
7175
|
+
}
|
|
7176
|
+
var patterns = [
|
|
7177
|
+
/\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,
|
|
7178
|
+
/\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,
|
|
7179
|
+
/\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
|
|
7180
|
+
];
|
|
7181
|
+
try {
|
|
7182
|
+
for (var patterns_2 = __values(patterns), patterns_2_1 = patterns_2.next(); !patterns_2_1.done; patterns_2_1 = patterns_2.next()) {
|
|
7183
|
+
var pattern = patterns_2_1.value;
|
|
7184
|
+
var match = text.match(pattern);
|
|
7185
|
+
var dimensionText = cleanAssistantRequestedDimensionText((match === null || match === void 0 ? void 0 : match[1]) || '');
|
|
7186
|
+
if (dimensionText) {
|
|
7187
|
+
return dimensionText;
|
|
7188
|
+
}
|
|
7189
|
+
}
|
|
7190
|
+
}
|
|
7191
|
+
catch (e_5_1) { e_5 = { error: e_5_1 }; }
|
|
7192
|
+
finally {
|
|
7193
|
+
try {
|
|
7194
|
+
if (patterns_2_1 && !patterns_2_1.done && (_a = patterns_2.return)) _a.call(patterns_2);
|
|
7195
|
+
}
|
|
7196
|
+
finally { if (e_5) throw e_5.error; }
|
|
7197
|
+
}
|
|
7198
|
+
return '';
|
|
7199
|
+
}
|
|
7200
|
+
function scoreAssistantDataDimensionMatch(requestedDimensionText, dimension) {
|
|
7201
|
+
var requested = cleanAssistantRequestedDimensionText(requestedDimensionText);
|
|
7202
|
+
if (!requested) {
|
|
7203
|
+
return 0;
|
|
7204
|
+
}
|
|
7205
|
+
var score = 0;
|
|
7206
|
+
var id = cleanAssistantRequestedDimensionText(dimension.id);
|
|
7207
|
+
if (id && requested === id) {
|
|
7208
|
+
score += 10;
|
|
7209
|
+
}
|
|
7210
|
+
else if (id && containsAssistantHeuristicTerm(requested, id)) {
|
|
7211
|
+
score += 4;
|
|
7212
|
+
}
|
|
7213
|
+
(dimension.terms || []).forEach(function (term) {
|
|
7214
|
+
var normalizedTerm = cleanAssistantRequestedDimensionText(term);
|
|
7215
|
+
if (!normalizedTerm) {
|
|
7216
|
+
return;
|
|
7217
|
+
}
|
|
7218
|
+
if (requested === normalizedTerm) {
|
|
7219
|
+
score += normalizedTerm.includes(' ') ? 8 : 6;
|
|
7220
|
+
}
|
|
7221
|
+
else if (containsAssistantHeuristicTerm(requested, normalizedTerm)) {
|
|
7222
|
+
score += normalizedTerm.includes(' ') ? 4 : 2;
|
|
7223
|
+
}
|
|
7224
|
+
});
|
|
7225
|
+
return score;
|
|
7226
|
+
}
|
|
7227
|
+
function resolveAssistantRequestedDataDimension(message, intent) {
|
|
7228
|
+
var requestedDimensionText = extractAssistantRequestedBreakdownDimensionText(message);
|
|
7229
|
+
if (!requestedDimensionText || !Array.isArray(intent.dimensions) || !intent.dimensions.length) {
|
|
7230
|
+
return null;
|
|
7231
|
+
}
|
|
7232
|
+
var selected = null;
|
|
7233
|
+
intent.dimensions.forEach(function (dimension) {
|
|
7234
|
+
var score = scoreAssistantDataDimensionMatch(requestedDimensionText, dimension);
|
|
7235
|
+
if (score <= 0) {
|
|
7236
|
+
return;
|
|
7237
|
+
}
|
|
7238
|
+
if (!selected || score > selected.score) {
|
|
7239
|
+
selected = { dimension: dimension, score: score };
|
|
7240
|
+
}
|
|
7241
|
+
});
|
|
7242
|
+
return selected ? selected.dimension : null;
|
|
7243
|
+
}
|
|
7244
|
+
function extractAssistantDataIntentGroupKeys(groupId) {
|
|
7245
|
+
if (!groupId || typeof groupId !== 'object' || Array.isArray(groupId)) {
|
|
7246
|
+
return [];
|
|
7247
|
+
}
|
|
7248
|
+
return Object.keys(groupId).filter(Boolean);
|
|
7249
|
+
}
|
|
7250
|
+
function isAssistantProjectFieldFromGroupId(value) {
|
|
7251
|
+
return typeof value === 'string' && value.startsWith('$_id.');
|
|
7252
|
+
}
|
|
7253
|
+
function applyAssistantDataIntentDimensionTemplate(dimension, params) {
|
|
7254
|
+
return __assign(__assign({}, dimension), { groupId: removeUndefinedAssistantPipelineValues(applyAssistantDataIntentPipelineTemplate(dimension.groupId, params)), project: dimension.project
|
|
7255
|
+
? removeUndefinedAssistantPipelineValues(applyAssistantDataIntentPipelineTemplate(dimension.project, params))
|
|
7256
|
+
: undefined, sort: dimension.sort
|
|
7257
|
+
? removeUndefinedAssistantPipelineValues(applyAssistantDataIntentPipelineTemplate(dimension.sort, params))
|
|
7258
|
+
: undefined, preGroupStages: Array.isArray(dimension.preGroupStages)
|
|
7259
|
+
? removeUndefinedAssistantPipelineValues(applyAssistantDataIntentPipelineTemplate(dimension.preGroupStages, params))
|
|
7260
|
+
: undefined });
|
|
7261
|
+
}
|
|
7262
|
+
function applyAssistantDataIntentDimensionToPipeline(pipeline, dimension) {
|
|
7263
|
+
if (!dimension || !Array.isArray(pipeline) || !pipeline.length) {
|
|
7264
|
+
return pipeline;
|
|
7265
|
+
}
|
|
7266
|
+
var next = (0, common_1.deepCopy)(pipeline);
|
|
7267
|
+
var groupIndex = findAggregateGroupIndex(next);
|
|
7268
|
+
if (groupIndex === -1) {
|
|
7269
|
+
return next;
|
|
7270
|
+
}
|
|
7271
|
+
if (Array.isArray(dimension.preGroupStages) && dimension.preGroupStages.length) {
|
|
7272
|
+
next.splice.apply(next, __spreadArray([groupIndex, 0], __read((0, common_1.deepCopy)(dimension.preGroupStages)), false));
|
|
7273
|
+
groupIndex += dimension.preGroupStages.length;
|
|
7274
|
+
}
|
|
7275
|
+
var groupStage = next[groupIndex];
|
|
7276
|
+
if (!(groupStage === null || groupStage === void 0 ? void 0 : groupStage.$group) || typeof groupStage.$group !== 'object') {
|
|
7277
|
+
return next;
|
|
7278
|
+
}
|
|
7279
|
+
var oldGroupKeys = new Set(extractAssistantDataIntentGroupKeys(groupStage.$group._id));
|
|
7280
|
+
var newGroupKeys = new Set(extractAssistantDataIntentGroupKeys(dimension.groupId));
|
|
7281
|
+
groupStage.$group._id = (0, common_1.deepCopy)(dimension.groupId);
|
|
7282
|
+
var projectIndex = next.findIndex(function (stage, index) { return index > groupIndex && !!(stage === null || stage === void 0 ? void 0 : stage.$project); });
|
|
7283
|
+
if (projectIndex > -1 && next[projectIndex].$project && typeof next[projectIndex].$project === 'object') {
|
|
7284
|
+
var project_1 = next[projectIndex].$project;
|
|
7285
|
+
oldGroupKeys.forEach(function (key) {
|
|
7286
|
+
if (!newGroupKeys.has(key) && isAssistantProjectFieldFromGroupId(project_1[key])) {
|
|
7287
|
+
delete project_1[key];
|
|
7288
|
+
}
|
|
7289
|
+
});
|
|
7290
|
+
if (dimension.project) {
|
|
7291
|
+
Object.assign(project_1, (0, common_1.deepCopy)(dimension.project));
|
|
7292
|
+
}
|
|
7293
|
+
}
|
|
7294
|
+
var sortIndex = next.findIndex(function (stage, index) { return index > groupIndex && !!(stage === null || stage === void 0 ? void 0 : stage.$sort); });
|
|
7295
|
+
if (sortIndex > -1 && dimension.sort) {
|
|
7296
|
+
next[sortIndex].$sort = (0, common_1.deepCopy)(dimension.sort);
|
|
7297
|
+
}
|
|
7298
|
+
return next;
|
|
7299
|
+
}
|
|
7137
7300
|
function buildAssistantAppDataIntentDirective(message, collectionNames, appId) {
|
|
7138
7301
|
if (collectionNames === void 0) { collectionNames = []; }
|
|
7139
7302
|
var intent = selectAssistantAppDataIntent(message, collectionNames, appId);
|
|
@@ -7142,6 +7305,10 @@ function buildAssistantAppDataIntentDirective(message, collectionNames, appId) {
|
|
|
7142
7305
|
}
|
|
7143
7306
|
var customerText = extractAssistantDataIntentCustomerText(message);
|
|
7144
7307
|
var dateWindow = resolveAssistantDataIntentDateWindow(message);
|
|
7308
|
+
var requestedDimension = resolveAssistantRequestedDataDimension(message, intent);
|
|
7309
|
+
var templatedDimension = requestedDimension
|
|
7310
|
+
? applyAssistantDataIntentDimensionTemplate(requestedDimension, { customerText: customerText, dateWindow: dateWindow })
|
|
7311
|
+
: null;
|
|
7145
7312
|
var acknowledgementText = buildAssistantDataIntentAcknowledgement(intent, customerText, dateWindow);
|
|
7146
7313
|
var progress = intent.progress.map(function (entry) {
|
|
7147
7314
|
return entry
|
|
@@ -7156,7 +7323,11 @@ function buildAssistantAppDataIntentDirective(message, collectionNames, appId) {
|
|
|
7156
7323
|
assumptions: intent.assumptions,
|
|
7157
7324
|
fallbackCollections: intent.fallbackCollections,
|
|
7158
7325
|
customerText: customerText,
|
|
7159
|
-
dateWindow: dateWindow
|
|
7326
|
+
dateWindow: dateWindow,
|
|
7327
|
+
requestedDimension: templatedDimension ? {
|
|
7328
|
+
id: templatedDimension.id,
|
|
7329
|
+
terms: templatedDimension.terms
|
|
7330
|
+
} : null
|
|
7160
7331
|
};
|
|
7161
7332
|
var basePayload = function (pipeline) { return ({
|
|
7162
7333
|
collection: intent.collection,
|
|
@@ -7168,7 +7339,8 @@ function buildAssistantAppDataIntentDirective(message, collectionNames, appId) {
|
|
|
7168
7339
|
var pipeline = configuredPipeline.length
|
|
7169
7340
|
? configuredPipeline
|
|
7170
7341
|
: buildAssistantGenericDataIntentPipeline(intent, customerText, dateWindow);
|
|
7171
|
-
|
|
7342
|
+
var finalPipeline = applyAssistantDataIntentDimensionToPipeline(pipeline, templatedDimension);
|
|
7343
|
+
return { type: 'aggregate', payload: basePayload(finalPipeline), cleaned: '', rawLine: "HEURISTIC_AGG(app-data-intent:".concat(intent.id, ")"), metadata: metadata };
|
|
7172
7344
|
}
|
|
7173
7345
|
function isAssistantDeterministicHeuristicDirective(directive) {
|
|
7174
7346
|
return isAssistantSchemaHoursHeuristicDirective(directive)
|
|
@@ -7324,7 +7496,7 @@ function ensureAssistantDisplayColumns(display, requestedColumns) {
|
|
|
7324
7496
|
return __assign(__assign({}, display), { columns: columns, rows: rows });
|
|
7325
7497
|
}
|
|
7326
7498
|
function resolveAssistantPipelineTimeGrain(pipeline) {
|
|
7327
|
-
var
|
|
7499
|
+
var e_6, _a;
|
|
7328
7500
|
if (!Array.isArray(pipeline) || !pipeline.length) {
|
|
7329
7501
|
return null;
|
|
7330
7502
|
}
|
|
@@ -7386,12 +7558,12 @@ function resolveAssistantPipelineTimeGrain(pipeline) {
|
|
|
7386
7558
|
}
|
|
7387
7559
|
}
|
|
7388
7560
|
}
|
|
7389
|
-
catch (
|
|
7561
|
+
catch (e_6_1) { e_6 = { error: e_6_1 }; }
|
|
7390
7562
|
finally {
|
|
7391
7563
|
try {
|
|
7392
7564
|
if (priority_1_1 && !priority_1_1.done && (_a = priority_1.return)) _a.call(priority_1);
|
|
7393
7565
|
}
|
|
7394
|
-
finally { if (
|
|
7566
|
+
finally { if (e_6) throw e_6.error; }
|
|
7395
7567
|
}
|
|
7396
7568
|
return null;
|
|
7397
7569
|
}
|
|
@@ -8252,7 +8424,7 @@ function applyAssistantDatedReportWindow(value, toolResult) {
|
|
|
8252
8424
|
return "".concat(line, "\n\n").concat(content).trim();
|
|
8253
8425
|
}
|
|
8254
8426
|
function resolveAssistantDatedReportWindow(toolResult) {
|
|
8255
|
-
var
|
|
8427
|
+
var e_7, _a;
|
|
8256
8428
|
var _b, _c, _d, _e, _f, _g, _h, _j;
|
|
8257
8429
|
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;
|
|
8258
8430
|
var verificationStart = normalizeOptionalString(verificationWindow === null || verificationWindow === void 0 ? void 0 : verificationWindow.startDate);
|
|
@@ -8318,12 +8490,12 @@ function resolveAssistantDatedReportWindow(toolResult) {
|
|
|
8318
8490
|
};
|
|
8319
8491
|
}
|
|
8320
8492
|
}
|
|
8321
|
-
catch (
|
|
8493
|
+
catch (e_7_1) { e_7 = { error: e_7_1 }; }
|
|
8322
8494
|
finally {
|
|
8323
8495
|
try {
|
|
8324
8496
|
if (pipelineCandidates_1_1 && !pipelineCandidates_1_1.done && (_a = pipelineCandidates_1.return)) _a.call(pipelineCandidates_1);
|
|
8325
8497
|
}
|
|
8326
|
-
finally { if (
|
|
8498
|
+
finally { if (e_7) throw e_7.error; }
|
|
8327
8499
|
}
|
|
8328
8500
|
return null;
|
|
8329
8501
|
}
|
|
@@ -9002,7 +9174,7 @@ function getValueAtPath(obj, path) {
|
|
|
9002
9174
|
return walk(obj, 0);
|
|
9003
9175
|
}
|
|
9004
9176
|
function hasArrayValueAtPath(docs, path) {
|
|
9005
|
-
var
|
|
9177
|
+
var e_8, _a;
|
|
9006
9178
|
if (!Array.isArray(docs) || !docs.length || !path) {
|
|
9007
9179
|
return false;
|
|
9008
9180
|
}
|
|
@@ -9015,17 +9187,17 @@ function hasArrayValueAtPath(docs, path) {
|
|
|
9015
9187
|
}
|
|
9016
9188
|
}
|
|
9017
9189
|
}
|
|
9018
|
-
catch (
|
|
9190
|
+
catch (e_8_1) { e_8 = { error: e_8_1 }; }
|
|
9019
9191
|
finally {
|
|
9020
9192
|
try {
|
|
9021
9193
|
if (docs_1_1 && !docs_1_1.done && (_a = docs_1.return)) _a.call(docs_1);
|
|
9022
9194
|
}
|
|
9023
|
-
finally { if (
|
|
9195
|
+
finally { if (e_8) throw e_8.error; }
|
|
9024
9196
|
}
|
|
9025
9197
|
return false;
|
|
9026
9198
|
}
|
|
9027
9199
|
function inferIdFieldStorageTypeFromDocs(docs, fieldPath) {
|
|
9028
|
-
var
|
|
9200
|
+
var e_9, _a, e_10, _b;
|
|
9029
9201
|
if (!Array.isArray(docs) || !fieldPath) {
|
|
9030
9202
|
return 'unknown';
|
|
9031
9203
|
}
|
|
@@ -9038,7 +9210,7 @@ function inferIdFieldStorageTypeFromDocs(docs, fieldPath) {
|
|
|
9038
9210
|
: doc === null || doc === void 0 ? void 0 : doc[fieldPath];
|
|
9039
9211
|
var queue = Array.isArray(value) ? value : [value];
|
|
9040
9212
|
try {
|
|
9041
|
-
for (var queue_1 = (
|
|
9213
|
+
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()) {
|
|
9042
9214
|
var entry = queue_1_1.value;
|
|
9043
9215
|
if (entry === null || entry === undefined) {
|
|
9044
9216
|
continue;
|
|
@@ -9051,21 +9223,21 @@ function inferIdFieldStorageTypeFromDocs(docs, fieldPath) {
|
|
|
9051
9223
|
}
|
|
9052
9224
|
}
|
|
9053
9225
|
}
|
|
9054
|
-
catch (
|
|
9226
|
+
catch (e_10_1) { e_10 = { error: e_10_1 }; }
|
|
9055
9227
|
finally {
|
|
9056
9228
|
try {
|
|
9057
9229
|
if (queue_1_1 && !queue_1_1.done && (_b = queue_1.return)) _b.call(queue_1);
|
|
9058
9230
|
}
|
|
9059
|
-
finally { if (
|
|
9231
|
+
finally { if (e_10) throw e_10.error; }
|
|
9060
9232
|
}
|
|
9061
9233
|
}
|
|
9062
9234
|
}
|
|
9063
|
-
catch (
|
|
9235
|
+
catch (e_9_1) { e_9 = { error: e_9_1 }; }
|
|
9064
9236
|
finally {
|
|
9065
9237
|
try {
|
|
9066
9238
|
if (docs_2_1 && !docs_2_1.done && (_a = docs_2.return)) _a.call(docs_2);
|
|
9067
9239
|
}
|
|
9068
|
-
finally { if (
|
|
9240
|
+
finally { if (e_9) throw e_9.error; }
|
|
9069
9241
|
}
|
|
9070
9242
|
return sawString ? 'string' : 'unknown';
|
|
9071
9243
|
}
|
|
@@ -9160,7 +9332,7 @@ function normalizeLookupKeyValue(value) {
|
|
|
9160
9332
|
return '';
|
|
9161
9333
|
}
|
|
9162
9334
|
function collectTopLevelIdFieldValues(docs, options) {
|
|
9163
|
-
var
|
|
9335
|
+
var e_11, _a, e_12, _b;
|
|
9164
9336
|
if (!Array.isArray(docs) || !docs.length) {
|
|
9165
9337
|
return [];
|
|
9166
9338
|
}
|
|
@@ -9208,26 +9380,26 @@ function collectTopLevelIdFieldValues(docs, options) {
|
|
|
9208
9380
|
});
|
|
9209
9381
|
};
|
|
9210
9382
|
try {
|
|
9211
|
-
for (var keys_1 = (
|
|
9383
|
+
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()) {
|
|
9212
9384
|
var key = keys_1_1.value;
|
|
9213
9385
|
_loop_3(key);
|
|
9214
9386
|
}
|
|
9215
9387
|
}
|
|
9216
|
-
catch (
|
|
9388
|
+
catch (e_12_1) { e_12 = { error: e_12_1 }; }
|
|
9217
9389
|
finally {
|
|
9218
9390
|
try {
|
|
9219
9391
|
if (keys_1_1 && !keys_1_1.done && (_b = keys_1.return)) _b.call(keys_1);
|
|
9220
9392
|
}
|
|
9221
|
-
finally { if (
|
|
9393
|
+
finally { if (e_12) throw e_12.error; }
|
|
9222
9394
|
}
|
|
9223
9395
|
}
|
|
9224
9396
|
}
|
|
9225
|
-
catch (
|
|
9397
|
+
catch (e_11_1) { e_11 = { error: e_11_1 }; }
|
|
9226
9398
|
finally {
|
|
9227
9399
|
try {
|
|
9228
9400
|
if (docs_3_1 && !docs_3_1.done && (_a = docs_3.return)) _a.call(docs_3);
|
|
9229
9401
|
}
|
|
9230
|
-
finally { if (
|
|
9402
|
+
finally { if (e_11) throw e_11.error; }
|
|
9231
9403
|
}
|
|
9232
9404
|
return Array.from(fieldMap.entries()).map(function (_a) {
|
|
9233
9405
|
var _b = __read(_a, 2), field = _b[0], values = _b[1];
|
|
@@ -9348,8 +9520,8 @@ function resolveLookupMappingsForField(field, mappings) {
|
|
|
9348
9520
|
}
|
|
9349
9521
|
function applyIdLookupDisplayEnrichment(params) {
|
|
9350
9522
|
return __awaiter(this, void 0, void 0, function () {
|
|
9351
|
-
var docs, collection, db, dbName, idClient, idCustomer, isSuperAdmin, idFields, lookupMappings, allCollections, collectionProbeCache, collectionSchemaCache, lookupMeta, enrichedDocs, _loop_4, idFields_1, idFields_1_1, fieldEntry,
|
|
9352
|
-
var
|
|
9523
|
+
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;
|
|
9524
|
+
var e_13, _a;
|
|
9353
9525
|
return __generator(this, function (_b) {
|
|
9354
9526
|
switch (_b.label) {
|
|
9355
9527
|
case 0:
|
|
@@ -9373,8 +9545,8 @@ function applyIdLookupDisplayEnrichment(params) {
|
|
|
9373
9545
|
lookupMeta = [];
|
|
9374
9546
|
enrichedDocs = docs.map(function (doc) { return (__assign({}, doc)); });
|
|
9375
9547
|
_loop_4 = function (fieldEntry) {
|
|
9376
|
-
var values, baseToken, mappingMatches, candidateCollections, filteredCandidates, _loop_5, filteredCandidates_1, filteredCandidates_1_1, candidate, state_3,
|
|
9377
|
-
var
|
|
9548
|
+
var values, baseToken, mappingMatches, candidateCollections, filteredCandidates, _loop_5, filteredCandidates_1, filteredCandidates_1_1, candidate, state_3, e_14_1;
|
|
9549
|
+
var e_14, _c;
|
|
9378
9550
|
return __generator(this, function (_d) {
|
|
9379
9551
|
switch (_d.label) {
|
|
9380
9552
|
case 0:
|
|
@@ -9548,7 +9720,7 @@ function applyIdLookupDisplayEnrichment(params) {
|
|
|
9548
9720
|
_d.label = 1;
|
|
9549
9721
|
case 1:
|
|
9550
9722
|
_d.trys.push([1, 6, 7, 8]);
|
|
9551
|
-
filteredCandidates_1 = (
|
|
9723
|
+
filteredCandidates_1 = (e_14 = void 0, __values(filteredCandidates)), filteredCandidates_1_1 = filteredCandidates_1.next();
|
|
9552
9724
|
_d.label = 2;
|
|
9553
9725
|
case 2:
|
|
9554
9726
|
if (!!filteredCandidates_1_1.done) return [3 /*break*/, 5];
|
|
@@ -9564,14 +9736,14 @@ function applyIdLookupDisplayEnrichment(params) {
|
|
|
9564
9736
|
return [3 /*break*/, 2];
|
|
9565
9737
|
case 5: return [3 /*break*/, 8];
|
|
9566
9738
|
case 6:
|
|
9567
|
-
|
|
9568
|
-
|
|
9739
|
+
e_14_1 = _d.sent();
|
|
9740
|
+
e_14 = { error: e_14_1 };
|
|
9569
9741
|
return [3 /*break*/, 8];
|
|
9570
9742
|
case 7:
|
|
9571
9743
|
try {
|
|
9572
9744
|
if (filteredCandidates_1_1 && !filteredCandidates_1_1.done && (_c = filteredCandidates_1.return)) _c.call(filteredCandidates_1);
|
|
9573
9745
|
}
|
|
9574
|
-
finally { if (
|
|
9746
|
+
finally { if (e_14) throw e_14.error; }
|
|
9575
9747
|
return [7 /*endfinally*/];
|
|
9576
9748
|
case 8: return [2 /*return*/];
|
|
9577
9749
|
}
|
|
@@ -9594,14 +9766,14 @@ function applyIdLookupDisplayEnrichment(params) {
|
|
|
9594
9766
|
return [3 /*break*/, 3];
|
|
9595
9767
|
case 6: return [3 /*break*/, 9];
|
|
9596
9768
|
case 7:
|
|
9597
|
-
|
|
9598
|
-
|
|
9769
|
+
e_13_1 = _b.sent();
|
|
9770
|
+
e_13 = { error: e_13_1 };
|
|
9599
9771
|
return [3 /*break*/, 9];
|
|
9600
9772
|
case 8:
|
|
9601
9773
|
try {
|
|
9602
9774
|
if (idFields_1_1 && !idFields_1_1.done && (_a = idFields_1.return)) _a.call(idFields_1);
|
|
9603
9775
|
}
|
|
9604
|
-
finally { if (
|
|
9776
|
+
finally { if (e_13) throw e_13.error; }
|
|
9605
9777
|
return [7 /*endfinally*/];
|
|
9606
9778
|
case 9:
|
|
9607
9779
|
if (!lookupMeta.length) {
|
|
@@ -9620,7 +9792,7 @@ function applyIdLookupDisplayEnrichment(params) {
|
|
|
9620
9792
|
});
|
|
9621
9793
|
}
|
|
9622
9794
|
function hasNonEmptyValue(docs, fieldPath, options) {
|
|
9623
|
-
var
|
|
9795
|
+
var e_15, _a;
|
|
9624
9796
|
if (!Array.isArray(docs) || !fieldPath) {
|
|
9625
9797
|
return false;
|
|
9626
9798
|
}
|
|
@@ -9637,12 +9809,12 @@ function hasNonEmptyValue(docs, fieldPath, options) {
|
|
|
9637
9809
|
}
|
|
9638
9810
|
}
|
|
9639
9811
|
}
|
|
9640
|
-
catch (
|
|
9812
|
+
catch (e_15_1) { e_15 = { error: e_15_1 }; }
|
|
9641
9813
|
finally {
|
|
9642
9814
|
try {
|
|
9643
9815
|
if (docs_4_1 && !docs_4_1.done && (_a = docs_4.return)) _a.call(docs_4);
|
|
9644
9816
|
}
|
|
9645
|
-
finally { if (
|
|
9817
|
+
finally { if (e_15) throw e_15.error; }
|
|
9646
9818
|
}
|
|
9647
9819
|
return false;
|
|
9648
9820
|
}
|
|
@@ -12258,7 +12430,7 @@ function flattenAssistantExprClauses(expr) {
|
|
|
12258
12430
|
return [expr];
|
|
12259
12431
|
}
|
|
12260
12432
|
function detectAssistantMonthWindowInExpr(expr, allowedDateFields) {
|
|
12261
|
-
var
|
|
12433
|
+
var e_16, _a;
|
|
12262
12434
|
var clauses = flattenAssistantExprClauses(expr);
|
|
12263
12435
|
if (!clauses.length) {
|
|
12264
12436
|
return null;
|
|
@@ -12332,12 +12504,12 @@ function detectAssistantMonthWindowInExpr(expr, allowedDateFields) {
|
|
|
12332
12504
|
return state_4.value;
|
|
12333
12505
|
}
|
|
12334
12506
|
}
|
|
12335
|
-
catch (
|
|
12507
|
+
catch (e_16_1) { e_16 = { error: e_16_1 }; }
|
|
12336
12508
|
finally {
|
|
12337
12509
|
try {
|
|
12338
12510
|
if (lowerClauses_1_1 && !lowerClauses_1_1.done && (_a = lowerClauses_1.return)) _a.call(lowerClauses_1);
|
|
12339
12511
|
}
|
|
12340
|
-
finally { if (
|
|
12512
|
+
finally { if (e_16) throw e_16.error; }
|
|
12341
12513
|
}
|
|
12342
12514
|
return null;
|
|
12343
12515
|
}
|
|
@@ -12400,7 +12572,7 @@ function resolveAssistantMonthlyGroupDateFields(pipeline) {
|
|
|
12400
12572
|
return fields;
|
|
12401
12573
|
}
|
|
12402
12574
|
function detectAssistantMonthWindowFromPipeline(pipeline) {
|
|
12403
|
-
var
|
|
12575
|
+
var e_17, _a;
|
|
12404
12576
|
var _b;
|
|
12405
12577
|
var monthlyFields = resolveAssistantMonthlyGroupDateFields(pipeline);
|
|
12406
12578
|
var scanMatch = function (match) {
|
|
@@ -12428,12 +12600,12 @@ function detectAssistantMonthWindowFromPipeline(pipeline) {
|
|
|
12428
12600
|
}
|
|
12429
12601
|
}
|
|
12430
12602
|
}
|
|
12431
|
-
catch (
|
|
12603
|
+
catch (e_17_1) { e_17 = { error: e_17_1 }; }
|
|
12432
12604
|
finally {
|
|
12433
12605
|
try {
|
|
12434
12606
|
if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
|
|
12435
12607
|
}
|
|
12436
|
-
finally { if (
|
|
12608
|
+
finally { if (e_17) throw e_17.error; }
|
|
12437
12609
|
}
|
|
12438
12610
|
return null;
|
|
12439
12611
|
}
|
|
@@ -12713,7 +12885,7 @@ function normalizeAssistantCustomerLookupProjectionPipeline(pipeline) {
|
|
|
12713
12885
|
var nextProject = __assign({}, project);
|
|
12714
12886
|
var stageChanged = false;
|
|
12715
12887
|
Object.keys(nextProject).forEach(function (field) {
|
|
12716
|
-
var
|
|
12888
|
+
var e_18, _a;
|
|
12717
12889
|
var expression = nextProject[field];
|
|
12718
12890
|
if (typeof expression !== 'string') {
|
|
12719
12891
|
return;
|
|
@@ -12749,12 +12921,12 @@ function normalizeAssistantCustomerLookupProjectionPipeline(pipeline) {
|
|
|
12749
12921
|
break;
|
|
12750
12922
|
}
|
|
12751
12923
|
}
|
|
12752
|
-
catch (
|
|
12924
|
+
catch (e_18_1) { e_18 = { error: e_18_1 }; }
|
|
12753
12925
|
finally {
|
|
12754
12926
|
try {
|
|
12755
12927
|
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
12756
12928
|
}
|
|
12757
|
-
finally { if (
|
|
12929
|
+
finally { if (e_18) throw e_18.error; }
|
|
12758
12930
|
}
|
|
12759
12931
|
});
|
|
12760
12932
|
if (stageChanged) {
|
|
@@ -12927,7 +13099,7 @@ function matchContainsField(value, field) {
|
|
|
12927
13099
|
});
|
|
12928
13100
|
}
|
|
12929
13101
|
function resolveAggregateCompletionFallback(pipeline) {
|
|
12930
|
-
var
|
|
13102
|
+
var e_19, _a;
|
|
12931
13103
|
if (!Array.isArray(pipeline)) {
|
|
12932
13104
|
return null;
|
|
12933
13105
|
}
|
|
@@ -12940,7 +13112,7 @@ function resolveAggregateCompletionFallback(pipeline) {
|
|
|
12940
13112
|
}
|
|
12941
13113
|
var addFields = stage.$addFields;
|
|
12942
13114
|
try {
|
|
12943
|
-
for (var _b = (
|
|
13115
|
+
for (var _b = (e_19 = void 0, __values(Object.keys(addFields))), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
12944
13116
|
var key = _c.value;
|
|
12945
13117
|
if (!isCompletionFieldName(key)) {
|
|
12946
13118
|
continue;
|
|
@@ -12954,12 +13126,12 @@ function resolveAggregateCompletionFallback(pipeline) {
|
|
|
12954
13126
|
}
|
|
12955
13127
|
}
|
|
12956
13128
|
}
|
|
12957
|
-
catch (
|
|
13129
|
+
catch (e_19_1) { e_19 = { error: e_19_1 }; }
|
|
12958
13130
|
finally {
|
|
12959
13131
|
try {
|
|
12960
13132
|
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
12961
13133
|
}
|
|
12962
|
-
finally { if (
|
|
13134
|
+
finally { if (e_19) throw e_19.error; }
|
|
12963
13135
|
}
|
|
12964
13136
|
if (candidateField) {
|
|
12965
13137
|
break;
|
|
@@ -13115,7 +13287,7 @@ function buildCompletionFallbackSources(field) {
|
|
|
13115
13287
|
]);
|
|
13116
13288
|
}
|
|
13117
13289
|
function resolveAggregateCompletionExprFallback(pipeline) {
|
|
13118
|
-
var
|
|
13290
|
+
var e_20, _a;
|
|
13119
13291
|
if (!Array.isArray(pipeline)) {
|
|
13120
13292
|
return null;
|
|
13121
13293
|
}
|
|
@@ -13135,7 +13307,7 @@ function resolveAggregateCompletionExprFallback(pipeline) {
|
|
|
13135
13307
|
}
|
|
13136
13308
|
if (!candidateField) {
|
|
13137
13309
|
try {
|
|
13138
|
-
for (var _b = (
|
|
13310
|
+
for (var _b = (e_20 = void 0, __values(Object.keys(matchStage))), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
13139
13311
|
var key = _c.value;
|
|
13140
13312
|
if (key.startsWith('$')) {
|
|
13141
13313
|
continue;
|
|
@@ -13150,12 +13322,12 @@ function resolveAggregateCompletionExprFallback(pipeline) {
|
|
|
13150
13322
|
}
|
|
13151
13323
|
}
|
|
13152
13324
|
}
|
|
13153
|
-
catch (
|
|
13325
|
+
catch (e_20_1) { e_20 = { error: e_20_1 }; }
|
|
13154
13326
|
finally {
|
|
13155
13327
|
try {
|
|
13156
13328
|
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
13157
13329
|
}
|
|
13158
|
-
finally { if (
|
|
13330
|
+
finally { if (e_20) throw e_20.error; }
|
|
13159
13331
|
}
|
|
13160
13332
|
}
|
|
13161
13333
|
if (!candidateField) {
|
|
@@ -13357,7 +13529,7 @@ function hasAssistantDateGroupingOperator(value) {
|
|
|
13357
13529
|
return Object.keys(value).some(function (key) { return hasAssistantDateGroupingOperator(value[key]); });
|
|
13358
13530
|
}
|
|
13359
13531
|
function isGroupFieldDerivedFromDateExpression(pipeline, groupIndex, groupPaths) {
|
|
13360
|
-
var
|
|
13532
|
+
var e_21, _a, e_22, _b;
|
|
13361
13533
|
if (!Array.isArray(pipeline) || groupIndex <= 0 || !groupPaths.length) {
|
|
13362
13534
|
return false;
|
|
13363
13535
|
}
|
|
@@ -13383,14 +13555,14 @@ function isGroupFieldDerivedFromDateExpression(pipeline, groupIndex, groupPaths)
|
|
|
13383
13555
|
continue;
|
|
13384
13556
|
}
|
|
13385
13557
|
try {
|
|
13386
|
-
for (var stageKeys_1 = (
|
|
13558
|
+
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()) {
|
|
13387
13559
|
var stageKey = stageKeys_1_1.value;
|
|
13388
13560
|
var payload = stage[stageKey];
|
|
13389
13561
|
if (!payload || typeof payload !== 'object' || Array.isArray(payload)) {
|
|
13390
13562
|
continue;
|
|
13391
13563
|
}
|
|
13392
13564
|
try {
|
|
13393
|
-
for (var groupFields_1 = (
|
|
13565
|
+
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()) {
|
|
13394
13566
|
var groupField = groupFields_1_1.value;
|
|
13395
13567
|
if (!Object.prototype.hasOwnProperty.call(payload, groupField)) {
|
|
13396
13568
|
continue;
|
|
@@ -13400,21 +13572,21 @@ function isGroupFieldDerivedFromDateExpression(pipeline, groupIndex, groupPaths)
|
|
|
13400
13572
|
}
|
|
13401
13573
|
}
|
|
13402
13574
|
}
|
|
13403
|
-
catch (
|
|
13575
|
+
catch (e_22_1) { e_22 = { error: e_22_1 }; }
|
|
13404
13576
|
finally {
|
|
13405
13577
|
try {
|
|
13406
13578
|
if (groupFields_1_1 && !groupFields_1_1.done && (_b = groupFields_1.return)) _b.call(groupFields_1);
|
|
13407
13579
|
}
|
|
13408
|
-
finally { if (
|
|
13580
|
+
finally { if (e_22) throw e_22.error; }
|
|
13409
13581
|
}
|
|
13410
13582
|
}
|
|
13411
13583
|
}
|
|
13412
|
-
catch (
|
|
13584
|
+
catch (e_21_1) { e_21 = { error: e_21_1 }; }
|
|
13413
13585
|
finally {
|
|
13414
13586
|
try {
|
|
13415
13587
|
if (stageKeys_1_1 && !stageKeys_1_1.done && (_a = stageKeys_1.return)) _a.call(stageKeys_1);
|
|
13416
13588
|
}
|
|
13417
|
-
finally { if (
|
|
13589
|
+
finally { if (e_21) throw e_21.error; }
|
|
13418
13590
|
}
|
|
13419
13591
|
}
|
|
13420
13592
|
return false;
|
|
@@ -13521,7 +13693,7 @@ function isRegexMatchCondition(value) {
|
|
|
13521
13693
|
return false;
|
|
13522
13694
|
}
|
|
13523
13695
|
function findRegexMatchInMatchObject(match, prefix) {
|
|
13524
|
-
var
|
|
13696
|
+
var e_23, _a, e_24, _b;
|
|
13525
13697
|
if (prefix === void 0) { prefix = ''; }
|
|
13526
13698
|
if (Array.isArray(match)) {
|
|
13527
13699
|
try {
|
|
@@ -13533,12 +13705,12 @@ function findRegexMatchInMatchObject(match, prefix) {
|
|
|
13533
13705
|
}
|
|
13534
13706
|
}
|
|
13535
13707
|
}
|
|
13536
|
-
catch (
|
|
13708
|
+
catch (e_23_1) { e_23 = { error: e_23_1 }; }
|
|
13537
13709
|
finally {
|
|
13538
13710
|
try {
|
|
13539
13711
|
if (match_1_1 && !match_1_1.done && (_a = match_1.return)) _a.call(match_1);
|
|
13540
13712
|
}
|
|
13541
|
-
finally { if (
|
|
13713
|
+
finally { if (e_23) throw e_23.error; }
|
|
13542
13714
|
}
|
|
13543
13715
|
return null;
|
|
13544
13716
|
}
|
|
@@ -13569,12 +13741,12 @@ function findRegexMatchInMatchObject(match, prefix) {
|
|
|
13569
13741
|
}
|
|
13570
13742
|
}
|
|
13571
13743
|
}
|
|
13572
|
-
catch (
|
|
13744
|
+
catch (e_24_1) { e_24 = { error: e_24_1 }; }
|
|
13573
13745
|
finally {
|
|
13574
13746
|
try {
|
|
13575
13747
|
if (keys_2_1 && !keys_2_1.done && (_b = keys_2.return)) _b.call(keys_2);
|
|
13576
13748
|
}
|
|
13577
|
-
finally { if (
|
|
13749
|
+
finally { if (e_24) throw e_24.error; }
|
|
13578
13750
|
}
|
|
13579
13751
|
return null;
|
|
13580
13752
|
}
|
|
@@ -13963,7 +14135,7 @@ function collectMatchFieldsByCondition(match, predicate, prefix) {
|
|
|
13963
14135
|
return results;
|
|
13964
14136
|
}
|
|
13965
14137
|
function findMatchConditionForField(match, targetField, prefix) {
|
|
13966
|
-
var
|
|
14138
|
+
var e_25, _a, e_26, _b;
|
|
13967
14139
|
if (prefix === void 0) { prefix = ''; }
|
|
13968
14140
|
if (!match || typeof match !== 'object') {
|
|
13969
14141
|
return undefined;
|
|
@@ -13978,12 +14150,12 @@ function findMatchConditionForField(match, targetField, prefix) {
|
|
|
13978
14150
|
}
|
|
13979
14151
|
}
|
|
13980
14152
|
}
|
|
13981
|
-
catch (
|
|
14153
|
+
catch (e_25_1) { e_25 = { error: e_25_1 }; }
|
|
13982
14154
|
finally {
|
|
13983
14155
|
try {
|
|
13984
14156
|
if (match_2_1 && !match_2_1.done && (_a = match_2.return)) _a.call(match_2);
|
|
13985
14157
|
}
|
|
13986
|
-
finally { if (
|
|
14158
|
+
finally { if (e_25) throw e_25.error; }
|
|
13987
14159
|
}
|
|
13988
14160
|
return undefined;
|
|
13989
14161
|
}
|
|
@@ -14010,12 +14182,12 @@ function findMatchConditionForField(match, targetField, prefix) {
|
|
|
14010
14182
|
}
|
|
14011
14183
|
}
|
|
14012
14184
|
}
|
|
14013
|
-
catch (
|
|
14185
|
+
catch (e_26_1) { e_26 = { error: e_26_1 }; }
|
|
14014
14186
|
finally {
|
|
14015
14187
|
try {
|
|
14016
14188
|
if (_d && !_d.done && (_b = _c.return)) _b.call(_c);
|
|
14017
14189
|
}
|
|
14018
|
-
finally { if (
|
|
14190
|
+
finally { if (e_26) throw e_26.error; }
|
|
14019
14191
|
}
|
|
14020
14192
|
return undefined;
|
|
14021
14193
|
}
|
|
@@ -14248,7 +14420,7 @@ function detectIdLikeValue(value) {
|
|
|
14248
14420
|
return false;
|
|
14249
14421
|
}
|
|
14250
14422
|
function detectChemicalIdFromProbe(probeDocs, fields) {
|
|
14251
|
-
var
|
|
14423
|
+
var e_27, _a, e_28, _b;
|
|
14252
14424
|
if (!Array.isArray(probeDocs) || !probeDocs.length) {
|
|
14253
14425
|
return false;
|
|
14254
14426
|
}
|
|
@@ -14260,7 +14432,7 @@ function detectChemicalIdFromProbe(probeDocs, fields) {
|
|
|
14260
14432
|
for (var probeDocs_1 = __values(probeDocs), probeDocs_1_1 = probeDocs_1.next(); !probeDocs_1_1.done; probeDocs_1_1 = probeDocs_1.next()) {
|
|
14261
14433
|
var doc = probeDocs_1_1.value;
|
|
14262
14434
|
try {
|
|
14263
|
-
for (var targets_1 = (
|
|
14435
|
+
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()) {
|
|
14264
14436
|
var field = targets_1_1.value;
|
|
14265
14437
|
var value = getValueAtPath(doc, field);
|
|
14266
14438
|
if (Array.isArray(value)) {
|
|
@@ -14273,21 +14445,21 @@ function detectChemicalIdFromProbe(probeDocs, fields) {
|
|
|
14273
14445
|
}
|
|
14274
14446
|
}
|
|
14275
14447
|
}
|
|
14276
|
-
catch (
|
|
14448
|
+
catch (e_28_1) { e_28 = { error: e_28_1 }; }
|
|
14277
14449
|
finally {
|
|
14278
14450
|
try {
|
|
14279
14451
|
if (targets_1_1 && !targets_1_1.done && (_b = targets_1.return)) _b.call(targets_1);
|
|
14280
14452
|
}
|
|
14281
|
-
finally { if (
|
|
14453
|
+
finally { if (e_28) throw e_28.error; }
|
|
14282
14454
|
}
|
|
14283
14455
|
}
|
|
14284
14456
|
}
|
|
14285
|
-
catch (
|
|
14457
|
+
catch (e_27_1) { e_27 = { error: e_27_1 }; }
|
|
14286
14458
|
finally {
|
|
14287
14459
|
try {
|
|
14288
14460
|
if (probeDocs_1_1 && !probeDocs_1_1.done && (_a = probeDocs_1.return)) _a.call(probeDocs_1);
|
|
14289
14461
|
}
|
|
14290
|
-
finally { if (
|
|
14462
|
+
finally { if (e_27) throw e_27.error; }
|
|
14291
14463
|
}
|
|
14292
14464
|
return false;
|
|
14293
14465
|
}
|
|
@@ -14508,8 +14680,8 @@ function buildChemicalIdFieldCandidates(field) {
|
|
|
14508
14680
|
}
|
|
14509
14681
|
function applyChemicalNameLookupFallbackToQuery(params) {
|
|
14510
14682
|
return __awaiter(this, void 0, void 0, function () {
|
|
14511
|
-
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,
|
|
14512
|
-
var
|
|
14683
|
+
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;
|
|
14684
|
+
var e_29, _a;
|
|
14513
14685
|
var _b;
|
|
14514
14686
|
return __generator(this, function (_c) {
|
|
14515
14687
|
switch (_c.label) {
|
|
@@ -14622,14 +14794,14 @@ function applyChemicalNameLookupFallbackToQuery(params) {
|
|
|
14622
14794
|
return [3 /*break*/, 3];
|
|
14623
14795
|
case 6: return [3 /*break*/, 9];
|
|
14624
14796
|
case 7:
|
|
14625
|
-
|
|
14626
|
-
|
|
14797
|
+
e_29_1 = _c.sent();
|
|
14798
|
+
e_29 = { error: e_29_1 };
|
|
14627
14799
|
return [3 /*break*/, 9];
|
|
14628
14800
|
case 8:
|
|
14629
14801
|
try {
|
|
14630
14802
|
if (candidates_1_1 && !candidates_1_1.done && (_a = candidates_1.return)) _a.call(candidates_1);
|
|
14631
14803
|
}
|
|
14632
|
-
finally { if (
|
|
14804
|
+
finally { if (e_29) throw e_29.error; }
|
|
14633
14805
|
return [7 /*endfinally*/];
|
|
14634
14806
|
case 9: return [2 /*return*/, null];
|
|
14635
14807
|
}
|
|
@@ -14729,8 +14901,8 @@ function lookupIdsForNameMatch(params) {
|
|
|
14729
14901
|
}
|
|
14730
14902
|
function applyIdLookupFallbackToQuery(params) {
|
|
14731
14903
|
return __awaiter(this, void 0, void 0, function () {
|
|
14732
|
-
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,
|
|
14733
|
-
var
|
|
14904
|
+
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;
|
|
14905
|
+
var e_31, _c, e_30, _d;
|
|
14734
14906
|
var _e;
|
|
14735
14907
|
return __generator(this, function (_f) {
|
|
14736
14908
|
switch (_f.label) {
|
|
@@ -14800,7 +14972,7 @@ function applyIdLookupFallbackToQuery(params) {
|
|
|
14800
14972
|
_f.label = 5;
|
|
14801
14973
|
case 5:
|
|
14802
14974
|
_f.trys.push([5, 14, 15, 16]);
|
|
14803
|
-
candidates_2 = (
|
|
14975
|
+
candidates_2 = (e_30 = void 0, __values(candidates)), candidates_2_1 = candidates_2.next();
|
|
14804
14976
|
_f.label = 6;
|
|
14805
14977
|
case 6:
|
|
14806
14978
|
if (!!candidates_2_1.done) return [3 /*break*/, 13];
|
|
@@ -14867,28 +15039,28 @@ function applyIdLookupFallbackToQuery(params) {
|
|
|
14867
15039
|
return [3 /*break*/, 6];
|
|
14868
15040
|
case 13: return [3 /*break*/, 16];
|
|
14869
15041
|
case 14:
|
|
14870
|
-
|
|
14871
|
-
|
|
15042
|
+
e_30_1 = _f.sent();
|
|
15043
|
+
e_30 = { error: e_30_1 };
|
|
14872
15044
|
return [3 /*break*/, 16];
|
|
14873
15045
|
case 15:
|
|
14874
15046
|
try {
|
|
14875
15047
|
if (candidates_2_1 && !candidates_2_1.done && (_d = candidates_2.return)) _d.call(candidates_2);
|
|
14876
15048
|
}
|
|
14877
|
-
finally { if (
|
|
15049
|
+
finally { if (e_30) throw e_30.error; }
|
|
14878
15050
|
return [7 /*endfinally*/];
|
|
14879
15051
|
case 16:
|
|
14880
15052
|
conditions_1_1 = conditions_1.next();
|
|
14881
15053
|
return [3 /*break*/, 4];
|
|
14882
15054
|
case 17: return [3 /*break*/, 20];
|
|
14883
15055
|
case 18:
|
|
14884
|
-
|
|
14885
|
-
|
|
15056
|
+
e_31_1 = _f.sent();
|
|
15057
|
+
e_31 = { error: e_31_1 };
|
|
14886
15058
|
return [3 /*break*/, 20];
|
|
14887
15059
|
case 19:
|
|
14888
15060
|
try {
|
|
14889
15061
|
if (conditions_1_1 && !conditions_1_1.done && (_c = conditions_1.return)) _c.call(conditions_1);
|
|
14890
15062
|
}
|
|
14891
|
-
finally { if (
|
|
15063
|
+
finally { if (e_31) throw e_31.error; }
|
|
14892
15064
|
return [7 /*endfinally*/];
|
|
14893
15065
|
case 20: return [2 /*return*/, null];
|
|
14894
15066
|
}
|
|
@@ -15333,8 +15505,8 @@ function resolveAssistantSurfaceFileCandidates(baseName) {
|
|
|
15333
15505
|
}
|
|
15334
15506
|
function readFirstAssistantSurfaceFile(candidates) {
|
|
15335
15507
|
return __awaiter(this, void 0, void 0, function () {
|
|
15336
|
-
var candidates_3, candidates_3_1, candidate, normalized, _a,
|
|
15337
|
-
var
|
|
15508
|
+
var candidates_3, candidates_3_1, candidate, normalized, _a, e_32_1;
|
|
15509
|
+
var e_32, _b;
|
|
15338
15510
|
return __generator(this, function (_c) {
|
|
15339
15511
|
switch (_c.label) {
|
|
15340
15512
|
case 0:
|
|
@@ -15361,14 +15533,14 @@ function readFirstAssistantSurfaceFile(candidates) {
|
|
|
15361
15533
|
return [3 /*break*/, 1];
|
|
15362
15534
|
case 6: return [3 /*break*/, 9];
|
|
15363
15535
|
case 7:
|
|
15364
|
-
|
|
15365
|
-
|
|
15536
|
+
e_32_1 = _c.sent();
|
|
15537
|
+
e_32 = { error: e_32_1 };
|
|
15366
15538
|
return [3 /*break*/, 9];
|
|
15367
15539
|
case 8:
|
|
15368
15540
|
try {
|
|
15369
15541
|
if (candidates_3_1 && !candidates_3_1.done && (_b = candidates_3.return)) _b.call(candidates_3);
|
|
15370
15542
|
}
|
|
15371
|
-
finally { if (
|
|
15543
|
+
finally { if (e_32) throw e_32.error; }
|
|
15372
15544
|
return [7 /*endfinally*/];
|
|
15373
15545
|
case 9: return [2 /*return*/, ''];
|
|
15374
15546
|
}
|
|
@@ -15901,6 +16073,20 @@ function cloneAssistantHeuristicProfile(profile) {
|
|
|
15901
16073
|
progress: mergeAssistantHintValues((entry === null || entry === void 0 ? void 0 : entry.progress) || []),
|
|
15902
16074
|
acknowledgement: normalizeOptionalString(entry === null || entry === void 0 ? void 0 : entry.acknowledgement) || undefined,
|
|
15903
16075
|
assumptions: mergeAssistantHintValues((entry === null || entry === void 0 ? void 0 : entry.assumptions) || []),
|
|
16076
|
+
dimensions: Array.isArray(entry === null || entry === void 0 ? void 0 : entry.dimensions)
|
|
16077
|
+
? entry.dimensions.map(function (dimension) { return ({
|
|
16078
|
+
id: normalizeOptionalString(dimension === null || dimension === void 0 ? void 0 : dimension.id),
|
|
16079
|
+
terms: mergeAssistantHintValues((dimension === null || dimension === void 0 ? void 0 : dimension.terms) || []).map(function (term) { return term.toLowerCase(); }),
|
|
16080
|
+
groupId: (0, common_1.deepCopy)(dimension === null || dimension === void 0 ? void 0 : dimension.groupId),
|
|
16081
|
+
project: (dimension === null || dimension === void 0 ? void 0 : dimension.project) && typeof dimension.project === 'object' && !Array.isArray(dimension.project)
|
|
16082
|
+
? (0, common_1.deepCopy)(dimension.project)
|
|
16083
|
+
: undefined,
|
|
16084
|
+
sort: (dimension === null || dimension === void 0 ? void 0 : dimension.sort) && typeof dimension.sort === 'object' && !Array.isArray(dimension.sort)
|
|
16085
|
+
? (0, common_1.deepCopy)(dimension.sort)
|
|
16086
|
+
: undefined,
|
|
16087
|
+
preGroupStages: Array.isArray(dimension === null || dimension === void 0 ? void 0 : dimension.preGroupStages) ? (0, common_1.deepCopy)(dimension.preGroupStages) : undefined
|
|
16088
|
+
}); }).filter(function (dimension) { return !!dimension.id && dimension.groupId !== undefined; })
|
|
16089
|
+
: [],
|
|
15904
16090
|
pipeline: Array.isArray(entry === null || entry === void 0 ? void 0 : entry.pipeline) ? (0, common_1.deepCopy)(entry.pipeline) : undefined,
|
|
15905
16091
|
options: (entry === null || entry === void 0 ? void 0 : entry.options) && typeof entry.options === 'object' && !Array.isArray(entry.options)
|
|
15906
16092
|
? (0, common_1.deepCopy)(entry.options)
|
|
@@ -16052,6 +16238,53 @@ function normalizeAssistantCollectionTermHints(value) {
|
|
|
16052
16238
|
});
|
|
16053
16239
|
return hints;
|
|
16054
16240
|
}
|
|
16241
|
+
function normalizeAssistantAppDataDimensions(value) {
|
|
16242
|
+
var entries = Array.isArray(value)
|
|
16243
|
+
? value.map(function (entry) { return ({ key: '', entry: entry }); })
|
|
16244
|
+
: value && typeof value === 'object'
|
|
16245
|
+
? Object.keys(value).map(function (key) { return ({ key: key, entry: value[key] }); })
|
|
16246
|
+
: [];
|
|
16247
|
+
var dimensions = [];
|
|
16248
|
+
entries.forEach(function (_a) {
|
|
16249
|
+
var key = _a.key, entry = _a.entry;
|
|
16250
|
+
if (!entry || typeof entry !== 'object' || Array.isArray(entry)) {
|
|
16251
|
+
return;
|
|
16252
|
+
}
|
|
16253
|
+
var id = normalizeOptionalString(entry.id
|
|
16254
|
+
|| entry.dimension_id
|
|
16255
|
+
|| entry.dimensionId
|
|
16256
|
+
|| key);
|
|
16257
|
+
var groupId = entry.group_id !== undefined
|
|
16258
|
+
? entry.group_id
|
|
16259
|
+
: entry.groupId !== undefined
|
|
16260
|
+
? entry.groupId
|
|
16261
|
+
: entry.group;
|
|
16262
|
+
if (!id || groupId === undefined) {
|
|
16263
|
+
return;
|
|
16264
|
+
}
|
|
16265
|
+
var terms = normalizeAssistantHeuristicStringList(entry.terms
|
|
16266
|
+
|| entry.aliases
|
|
16267
|
+
|| entry.phrases
|
|
16268
|
+
|| [id]).map(function (term) { return term.toLowerCase(); });
|
|
16269
|
+
dimensions.push({
|
|
16270
|
+
id: id,
|
|
16271
|
+
terms: terms.length ? terms : [id.toLowerCase()],
|
|
16272
|
+
groupId: (0, common_1.deepCopy)(groupId),
|
|
16273
|
+
project: entry.project && typeof entry.project === 'object' && !Array.isArray(entry.project)
|
|
16274
|
+
? (0, common_1.deepCopy)(entry.project)
|
|
16275
|
+
: undefined,
|
|
16276
|
+
sort: entry.sort && typeof entry.sort === 'object' && !Array.isArray(entry.sort)
|
|
16277
|
+
? (0, common_1.deepCopy)(entry.sort)
|
|
16278
|
+
: undefined,
|
|
16279
|
+
preGroupStages: Array.isArray(entry.pre_group_stages)
|
|
16280
|
+
? (0, common_1.deepCopy)(entry.pre_group_stages)
|
|
16281
|
+
: Array.isArray(entry.preGroupStages)
|
|
16282
|
+
? (0, common_1.deepCopy)(entry.preGroupStages)
|
|
16283
|
+
: undefined
|
|
16284
|
+
});
|
|
16285
|
+
});
|
|
16286
|
+
return dimensions;
|
|
16287
|
+
}
|
|
16055
16288
|
function normalizeAssistantAppDataIntents(value) {
|
|
16056
16289
|
var entries = Array.isArray(value) ? value : [];
|
|
16057
16290
|
var intents = [];
|
|
@@ -16082,6 +16315,10 @@ function normalizeAssistantAppDataIntents(value) {
|
|
|
16082
16315
|
|| entry.acknowledgement_template
|
|
16083
16316
|
|| entry.acknowledgementTemplate) || undefined,
|
|
16084
16317
|
assumptions: mergeAssistantHintValues(Array.isArray(entry.assumptions) ? entry.assumptions : []),
|
|
16318
|
+
dimensions: normalizeAssistantAppDataDimensions(entry.dimensions
|
|
16319
|
+
|| entry.breakdown_dimensions
|
|
16320
|
+
|| entry.breakdownDimensions
|
|
16321
|
+
|| []),
|
|
16085
16322
|
pipeline: Array.isArray(entry.pipeline) ? (0, common_1.deepCopy)(entry.pipeline) : undefined,
|
|
16086
16323
|
options: entry.options && typeof entry.options === 'object' && !Array.isArray(entry.options)
|
|
16087
16324
|
? (0, common_1.deepCopy)(entry.options)
|
|
@@ -16812,7 +17049,7 @@ function doesAssistantPreserveAnyTermMatch(text, terms) {
|
|
|
16812
17049
|
return (Array.isArray(terms) ? terms : []).some(function (term) { return doesAssistantPreserveTermMatch(text, term); });
|
|
16813
17050
|
}
|
|
16814
17051
|
function shouldPreserveAssistantCollectionForRouteFromRules(params) {
|
|
16815
|
-
var
|
|
17052
|
+
var e_33, _a;
|
|
16816
17053
|
var _b, _c, _d, _e, _f, _g, _h;
|
|
16817
17054
|
var routePreferred = normalizeAssistantCollectionOverrideName(params.routePreferredName);
|
|
16818
17055
|
var requested = normalizeAssistantCollectionOverrideName(params.requestedCollection);
|
|
@@ -16844,12 +17081,12 @@ function shouldPreserveAssistantCollectionForRouteFromRules(params) {
|
|
|
16844
17081
|
return true;
|
|
16845
17082
|
}
|
|
16846
17083
|
}
|
|
16847
|
-
catch (
|
|
17084
|
+
catch (e_33_1) { e_33 = { error: e_33_1 }; }
|
|
16848
17085
|
finally {
|
|
16849
17086
|
try {
|
|
16850
17087
|
if (_k && !_k.done && (_a = _j.return)) _a.call(_j);
|
|
16851
17088
|
}
|
|
16852
|
-
finally { if (
|
|
17089
|
+
finally { if (e_33) throw e_33.error; }
|
|
16853
17090
|
}
|
|
16854
17091
|
return false;
|
|
16855
17092
|
}
|
|
@@ -17740,7 +17977,7 @@ function resolveAssistantNestedPrefixCollectionCandidates(params) {
|
|
|
17740
17977
|
function resolveAssistantNestedAggregateFallbacks(params) {
|
|
17741
17978
|
return __awaiter(this, void 0, void 0, function () {
|
|
17742
17979
|
var prefixes, collectionNames, fallbacks, seen, prefixes_1, prefixes_1_1, prefix, rewrite, candidates, candidates_4, candidates_4_1, candidate, normalizedPipeline, key;
|
|
17743
|
-
var
|
|
17980
|
+
var e_34, _a, e_35, _b;
|
|
17744
17981
|
return __generator(this, function (_c) {
|
|
17745
17982
|
switch (_c.label) {
|
|
17746
17983
|
case 0:
|
|
@@ -17770,7 +18007,7 @@ function resolveAssistantNestedAggregateFallbacks(params) {
|
|
|
17770
18007
|
triedCollections: params.triedCollections
|
|
17771
18008
|
});
|
|
17772
18009
|
try {
|
|
17773
|
-
for (candidates_4 = (
|
|
18010
|
+
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()) {
|
|
17774
18011
|
candidate = candidates_4_1.value;
|
|
17775
18012
|
normalizedPipeline = normalizeAssistantAggregatePipeline(rewrite.pipeline, candidate);
|
|
17776
18013
|
if (!normalizedPipeline.length || containsForbiddenMongoOperators(normalizedPipeline)) {
|
|
@@ -17792,21 +18029,21 @@ function resolveAssistantNestedAggregateFallbacks(params) {
|
|
|
17792
18029
|
}
|
|
17793
18030
|
}
|
|
17794
18031
|
}
|
|
17795
|
-
catch (
|
|
18032
|
+
catch (e_35_1) { e_35 = { error: e_35_1 }; }
|
|
17796
18033
|
finally {
|
|
17797
18034
|
try {
|
|
17798
18035
|
if (candidates_4_1 && !candidates_4_1.done && (_b = candidates_4.return)) _b.call(candidates_4);
|
|
17799
18036
|
}
|
|
17800
|
-
finally { if (
|
|
18037
|
+
finally { if (e_35) throw e_35.error; }
|
|
17801
18038
|
}
|
|
17802
18039
|
}
|
|
17803
18040
|
}
|
|
17804
|
-
catch (
|
|
18041
|
+
catch (e_34_1) { e_34 = { error: e_34_1 }; }
|
|
17805
18042
|
finally {
|
|
17806
18043
|
try {
|
|
17807
18044
|
if (prefixes_1_1 && !prefixes_1_1.done && (_a = prefixes_1.return)) _a.call(prefixes_1);
|
|
17808
18045
|
}
|
|
17809
|
-
finally { if (
|
|
18046
|
+
finally { if (e_34) throw e_34.error; }
|
|
17810
18047
|
}
|
|
17811
18048
|
return [2 /*return*/, fallbacks];
|
|
17812
18049
|
}
|
|
@@ -17938,8 +18175,8 @@ function resolveAssistantBridgeCollectionHintCandidates(requestedCollection, req
|
|
|
17938
18175
|
}
|
|
17939
18176
|
function resolveAssistantReportBuilderBridgeCollection(collection_1, db_1) {
|
|
17940
18177
|
return __awaiter(this, arguments, void 0, function (collection, db, dbName, options) {
|
|
17941
|
-
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,
|
|
17942
|
-
var
|
|
18178
|
+
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;
|
|
18179
|
+
var e_38, _b, e_39, _c, e_36, _d, e_37, _e, e_40, _f;
|
|
17943
18180
|
var _g, _h;
|
|
17944
18181
|
if (dbName === void 0) { dbName = ''; }
|
|
17945
18182
|
return __generator(this, function (_j) {
|
|
@@ -18013,12 +18250,12 @@ function resolveAssistantReportBuilderBridgeCollection(collection_1, db_1) {
|
|
|
18013
18250
|
}
|
|
18014
18251
|
}
|
|
18015
18252
|
}
|
|
18016
|
-
catch (
|
|
18253
|
+
catch (e_38_1) { e_38 = { error: e_38_1 }; }
|
|
18017
18254
|
finally {
|
|
18018
18255
|
try {
|
|
18019
18256
|
if (candidates_5_1 && !candidates_5_1.done && (_b = candidates_5.return)) _b.call(candidates_5);
|
|
18020
18257
|
}
|
|
18021
|
-
finally { if (
|
|
18258
|
+
finally { if (e_38) throw e_38.error; }
|
|
18022
18259
|
}
|
|
18023
18260
|
}
|
|
18024
18261
|
if (configuredCollectionNames.length) {
|
|
@@ -18033,12 +18270,12 @@ function resolveAssistantReportBuilderBridgeCollection(collection_1, db_1) {
|
|
|
18033
18270
|
}
|
|
18034
18271
|
}
|
|
18035
18272
|
}
|
|
18036
|
-
catch (
|
|
18273
|
+
catch (e_39_1) { e_39 = { error: e_39_1 }; }
|
|
18037
18274
|
finally {
|
|
18038
18275
|
try {
|
|
18039
18276
|
if (candidates_6_1 && !candidates_6_1.done && (_c = candidates_6.return)) _c.call(candidates_6);
|
|
18040
18277
|
}
|
|
18041
|
-
finally { if (
|
|
18278
|
+
finally { if (e_39) throw e_39.error; }
|
|
18042
18279
|
}
|
|
18043
18280
|
}
|
|
18044
18281
|
primaryCollectionHint = normalizeOptionalString((_h = requestHints === null || requestHints === void 0 ? void 0 : requestHints.collectionHints) === null || _h === void 0 ? void 0 : _h[0]);
|
|
@@ -18099,14 +18336,14 @@ function resolveAssistantReportBuilderBridgeCollection(collection_1, db_1) {
|
|
|
18099
18336
|
return [3 /*break*/, 2];
|
|
18100
18337
|
case 7: return [3 /*break*/, 10];
|
|
18101
18338
|
case 8:
|
|
18102
|
-
|
|
18103
|
-
|
|
18339
|
+
e_36_1 = _j.sent();
|
|
18340
|
+
e_36 = { error: e_36_1 };
|
|
18104
18341
|
return [3 /*break*/, 10];
|
|
18105
18342
|
case 9:
|
|
18106
18343
|
try {
|
|
18107
18344
|
if (resolverTargets_1_1 && !resolverTargets_1_1.done && (_d = resolverTargets_1.return)) _d.call(resolverTargets_1);
|
|
18108
18345
|
}
|
|
18109
|
-
finally { if (
|
|
18346
|
+
finally { if (e_36) throw e_36.error; }
|
|
18110
18347
|
return [7 /*endfinally*/];
|
|
18111
18348
|
case 10:
|
|
18112
18349
|
if (!db) return [3 /*break*/, 18];
|
|
@@ -18132,14 +18369,14 @@ function resolveAssistantReportBuilderBridgeCollection(collection_1, db_1) {
|
|
|
18132
18369
|
return [3 /*break*/, 12];
|
|
18133
18370
|
case 15: return [3 /*break*/, 18];
|
|
18134
18371
|
case 16:
|
|
18135
|
-
|
|
18136
|
-
|
|
18372
|
+
e_37_1 = _j.sent();
|
|
18373
|
+
e_37 = { error: e_37_1 };
|
|
18137
18374
|
return [3 /*break*/, 18];
|
|
18138
18375
|
case 17:
|
|
18139
18376
|
try {
|
|
18140
18377
|
if (candidates_7_1 && !candidates_7_1.done && (_e = candidates_7.return)) _e.call(candidates_7);
|
|
18141
18378
|
}
|
|
18142
|
-
finally { if (
|
|
18379
|
+
finally { if (e_37) throw e_37.error; }
|
|
18143
18380
|
return [7 /*endfinally*/];
|
|
18144
18381
|
case 18:
|
|
18145
18382
|
try {
|
|
@@ -18150,12 +18387,12 @@ function resolveAssistantReportBuilderBridgeCollection(collection_1, db_1) {
|
|
|
18150
18387
|
}
|
|
18151
18388
|
}
|
|
18152
18389
|
}
|
|
18153
|
-
catch (
|
|
18390
|
+
catch (e_40_1) { e_40 = { error: e_40_1 }; }
|
|
18154
18391
|
finally {
|
|
18155
18392
|
try {
|
|
18156
18393
|
if (candidates_8_1 && !candidates_8_1.done && (_f = candidates_8.return)) _f.call(candidates_8);
|
|
18157
18394
|
}
|
|
18158
|
-
finally { if (
|
|
18395
|
+
finally { if (e_40) throw e_40.error; }
|
|
18159
18396
|
}
|
|
18160
18397
|
throw new Error('AI assistant report builder bridge: No queryable collection could be resolved.');
|
|
18161
18398
|
}
|
|
@@ -18163,7 +18400,7 @@ function resolveAssistantReportBuilderBridgeCollection(collection_1, db_1) {
|
|
|
18163
18400
|
});
|
|
18164
18401
|
}
|
|
18165
18402
|
function findQueryDateField(query) {
|
|
18166
|
-
var
|
|
18403
|
+
var e_41, _a, e_42, _b;
|
|
18167
18404
|
if (!query || typeof query !== 'object') {
|
|
18168
18405
|
return null;
|
|
18169
18406
|
}
|
|
@@ -18177,12 +18414,12 @@ function findQueryDateField(query) {
|
|
|
18177
18414
|
}
|
|
18178
18415
|
}
|
|
18179
18416
|
}
|
|
18180
|
-
catch (
|
|
18417
|
+
catch (e_41_1) { e_41 = { error: e_41_1 }; }
|
|
18181
18418
|
finally {
|
|
18182
18419
|
try {
|
|
18183
18420
|
if (query_1_1 && !query_1_1.done && (_a = query_1.return)) _a.call(query_1);
|
|
18184
18421
|
}
|
|
18185
|
-
finally { if (
|
|
18422
|
+
finally { if (e_41) throw e_41.error; }
|
|
18186
18423
|
}
|
|
18187
18424
|
return null;
|
|
18188
18425
|
}
|
|
@@ -18201,12 +18438,12 @@ function findQueryDateField(query) {
|
|
|
18201
18438
|
}
|
|
18202
18439
|
}
|
|
18203
18440
|
}
|
|
18204
|
-
catch (
|
|
18441
|
+
catch (e_42_1) { e_42 = { error: e_42_1 }; }
|
|
18205
18442
|
finally {
|
|
18206
18443
|
try {
|
|
18207
18444
|
if (_d && !_d.done && (_b = _c.return)) _b.call(_c);
|
|
18208
18445
|
}
|
|
18209
|
-
finally { if (
|
|
18446
|
+
finally { if (e_42) throw e_42.error; }
|
|
18210
18447
|
}
|
|
18211
18448
|
return null;
|
|
18212
18449
|
}
|
|
@@ -18494,7 +18731,7 @@ function resolveQueryDateFieldFallback(query) {
|
|
|
18494
18731
|
return { from: dateField, to: fallback };
|
|
18495
18732
|
}
|
|
18496
18733
|
function containsForbiddenMongoOperators(value) {
|
|
18497
|
-
var
|
|
18734
|
+
var e_43, _a;
|
|
18498
18735
|
if (!value || typeof value !== 'object') {
|
|
18499
18736
|
return false;
|
|
18500
18737
|
}
|
|
@@ -18513,12 +18750,12 @@ function containsForbiddenMongoOperators(value) {
|
|
|
18513
18750
|
}
|
|
18514
18751
|
}
|
|
18515
18752
|
}
|
|
18516
|
-
catch (
|
|
18753
|
+
catch (e_43_1) { e_43 = { error: e_43_1 }; }
|
|
18517
18754
|
finally {
|
|
18518
18755
|
try {
|
|
18519
18756
|
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
18520
18757
|
}
|
|
18521
|
-
finally { if (
|
|
18758
|
+
finally { if (e_43) throw e_43.error; }
|
|
18522
18759
|
}
|
|
18523
18760
|
return false;
|
|
18524
18761
|
}
|
|
@@ -18703,7 +18940,7 @@ function splitAssistantPermissionTokenSets(value) {
|
|
|
18703
18940
|
};
|
|
18704
18941
|
}
|
|
18705
18942
|
function isAssistantTokenSetSubset(subset, superset) {
|
|
18706
|
-
var
|
|
18943
|
+
var e_44, _a;
|
|
18707
18944
|
if (!subset.size) {
|
|
18708
18945
|
return false;
|
|
18709
18946
|
}
|
|
@@ -18715,12 +18952,12 @@ function isAssistantTokenSetSubset(subset, superset) {
|
|
|
18715
18952
|
}
|
|
18716
18953
|
}
|
|
18717
18954
|
}
|
|
18718
|
-
catch (
|
|
18955
|
+
catch (e_44_1) { e_44 = { error: e_44_1 }; }
|
|
18719
18956
|
finally {
|
|
18720
18957
|
try {
|
|
18721
18958
|
if (subset_1_1 && !subset_1_1.done && (_a = subset_1.return)) _a.call(subset_1);
|
|
18722
18959
|
}
|
|
18723
|
-
finally { if (
|
|
18960
|
+
finally { if (e_44) throw e_44.error; }
|
|
18724
18961
|
}
|
|
18725
18962
|
return true;
|
|
18726
18963
|
}
|
|
@@ -19255,8 +19492,8 @@ function applyCodexStreamStatusHandler(runOptions, streamStatusHandler) {
|
|
|
19255
19492
|
}
|
|
19256
19493
|
function waitForCodexWorkerMessage(worker, streamStatusHandler) {
|
|
19257
19494
|
return __awaiter(this, void 0, void 0, function () {
|
|
19258
|
-
var _a, _b, _c, _d, message, payload, status_1,
|
|
19259
|
-
var _e,
|
|
19495
|
+
var _a, _b, _c, _d, message, payload, status_1, e_45_1;
|
|
19496
|
+
var _e, e_45, _f, _g;
|
|
19260
19497
|
return __generator(this, function (_h) {
|
|
19261
19498
|
switch (_h.label) {
|
|
19262
19499
|
case 0:
|
|
@@ -19283,8 +19520,8 @@ function waitForCodexWorkerMessage(worker, streamStatusHandler) {
|
|
|
19283
19520
|
return [3 /*break*/, 1];
|
|
19284
19521
|
case 4: return [3 /*break*/, 11];
|
|
19285
19522
|
case 5:
|
|
19286
|
-
|
|
19287
|
-
|
|
19523
|
+
e_45_1 = _h.sent();
|
|
19524
|
+
e_45 = { error: e_45_1 };
|
|
19288
19525
|
return [3 /*break*/, 11];
|
|
19289
19526
|
case 6:
|
|
19290
19527
|
_h.trys.push([6, , 9, 10]);
|
|
@@ -19295,7 +19532,7 @@ function waitForCodexWorkerMessage(worker, streamStatusHandler) {
|
|
|
19295
19532
|
_h.label = 8;
|
|
19296
19533
|
case 8: return [3 /*break*/, 10];
|
|
19297
19534
|
case 9:
|
|
19298
|
-
if (
|
|
19535
|
+
if (e_45) throw e_45.error;
|
|
19299
19536
|
return [7 /*endfinally*/];
|
|
19300
19537
|
case 10: return [7 /*endfinally*/];
|
|
19301
19538
|
case 11: throw new CodexWorkerBootstrapError('AI worker exited before completing.');
|
|
@@ -19639,8 +19876,8 @@ function buildAssistantWorkspaceRootCandidates(params) {
|
|
|
19639
19876
|
}
|
|
19640
19877
|
function resolveAssistantWorkspaceRoot() {
|
|
19641
19878
|
return __awaiter(this, void 0, void 0, function () {
|
|
19642
|
-
var candidates, firstExisting, firstNestedGitRoot, candidates_9, candidates_9_1, candidate, _a, gitRoot, nestedGitRoots,
|
|
19643
|
-
var
|
|
19879
|
+
var candidates, firstExisting, firstNestedGitRoot, candidates_9, candidates_9_1, candidate, _a, gitRoot, nestedGitRoots, e_46_1;
|
|
19880
|
+
var e_46, _b;
|
|
19644
19881
|
return __generator(this, function (_c) {
|
|
19645
19882
|
switch (_c.label) {
|
|
19646
19883
|
case 0:
|
|
@@ -19687,14 +19924,14 @@ function resolveAssistantWorkspaceRoot() {
|
|
|
19687
19924
|
return [3 /*break*/, 2];
|
|
19688
19925
|
case 8: return [3 /*break*/, 11];
|
|
19689
19926
|
case 9:
|
|
19690
|
-
|
|
19691
|
-
|
|
19927
|
+
e_46_1 = _c.sent();
|
|
19928
|
+
e_46 = { error: e_46_1 };
|
|
19692
19929
|
return [3 /*break*/, 11];
|
|
19693
19930
|
case 10:
|
|
19694
19931
|
try {
|
|
19695
19932
|
if (candidates_9_1 && !candidates_9_1.done && (_b = candidates_9.return)) _b.call(candidates_9);
|
|
19696
19933
|
}
|
|
19697
|
-
finally { if (
|
|
19934
|
+
finally { if (e_46) throw e_46.error; }
|
|
19698
19935
|
return [7 /*endfinally*/];
|
|
19699
19936
|
case 11:
|
|
19700
19937
|
if (firstNestedGitRoot) {
|
|
@@ -20102,7 +20339,7 @@ var AI_ASSISTANT_BREAKDOWN_DIMENSION_STOPWORDS = new Set([
|
|
|
20102
20339
|
'by'
|
|
20103
20340
|
]);
|
|
20104
20341
|
function normalizeAssistantBreakdownDimension(value) {
|
|
20105
|
-
var
|
|
20342
|
+
var e_47, _a;
|
|
20106
20343
|
var normalized = normalizeOptionalString(value)
|
|
20107
20344
|
.toLowerCase()
|
|
20108
20345
|
.replace(/[^a-z0-9_\s-]+/g, ' ')
|
|
@@ -20134,12 +20371,12 @@ function normalizeAssistantBreakdownDimension(value) {
|
|
|
20134
20371
|
}
|
|
20135
20372
|
}
|
|
20136
20373
|
}
|
|
20137
|
-
catch (
|
|
20374
|
+
catch (e_47_1) { e_47 = { error: e_47_1 }; }
|
|
20138
20375
|
finally {
|
|
20139
20376
|
try {
|
|
20140
20377
|
if (tokens_1_1 && !tokens_1_1.done && (_a = tokens_1.return)) _a.call(tokens_1);
|
|
20141
20378
|
}
|
|
20142
|
-
finally { if (
|
|
20379
|
+
finally { if (e_47) throw e_47.error; }
|
|
20143
20380
|
}
|
|
20144
20381
|
if (!kept.length) {
|
|
20145
20382
|
return '';
|
|
@@ -20344,7 +20581,7 @@ function resolveAssistantPlannerEnabled(config) {
|
|
|
20344
20581
|
return raw === undefined ? false : raw === true;
|
|
20345
20582
|
}
|
|
20346
20583
|
function resolveAssistantPlannerKnownRoutes(user, isSuperAdmin) {
|
|
20347
|
-
var
|
|
20584
|
+
var e_48, _a;
|
|
20348
20585
|
var _b;
|
|
20349
20586
|
if (isSuperAdmin === void 0) { isSuperAdmin = false; }
|
|
20350
20587
|
var routes = ((_b = resolveio_server_app_1.ResolveIOServer.getClientRoutes) === null || _b === void 0 ? void 0 : _b.call(resolveio_server_app_1.ResolveIOServer)) || [];
|
|
@@ -20358,12 +20595,12 @@ function resolveAssistantPlannerKnownRoutes(user, isSuperAdmin) {
|
|
|
20358
20595
|
}
|
|
20359
20596
|
}
|
|
20360
20597
|
}
|
|
20361
|
-
catch (
|
|
20598
|
+
catch (e_48_1) { e_48 = { error: e_48_1 }; }
|
|
20362
20599
|
finally {
|
|
20363
20600
|
try {
|
|
20364
20601
|
if (routes_1_1 && !routes_1_1.done && (_a = routes_1.return)) _a.call(routes_1);
|
|
20365
20602
|
}
|
|
20366
|
-
finally { if (
|
|
20603
|
+
finally { if (e_48) throw e_48.error; }
|
|
20367
20604
|
}
|
|
20368
20605
|
var normalizedRoutes = Array.from(unique);
|
|
20369
20606
|
var allowedRoutes = collectAssistantAllowedRoutesForUser(user, normalizedRoutes, isSuperAdmin);
|
|
@@ -20739,7 +20976,7 @@ function normalizeRouteMatchKey(value) {
|
|
|
20739
20976
|
return normalizeRouteKey(value).toLowerCase();
|
|
20740
20977
|
}
|
|
20741
20978
|
function buildClientRouteIndex() {
|
|
20742
|
-
var
|
|
20979
|
+
var e_49, _a;
|
|
20743
20980
|
var _b;
|
|
20744
20981
|
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);
|
|
20745
20982
|
var set = new Set();
|
|
@@ -20758,12 +20995,12 @@ function buildClientRouteIndex() {
|
|
|
20758
20995
|
}
|
|
20759
20996
|
}
|
|
20760
20997
|
}
|
|
20761
|
-
catch (
|
|
20998
|
+
catch (e_49_1) { e_49 = { error: e_49_1 }; }
|
|
20762
20999
|
finally {
|
|
20763
21000
|
try {
|
|
20764
21001
|
if (routes_2_1 && !routes_2_1.done && (_a = routes_2.return)) _a.call(routes_2);
|
|
20765
21002
|
}
|
|
20766
|
-
finally { if (
|
|
21003
|
+
finally { if (e_49) throw e_49.error; }
|
|
20767
21004
|
}
|
|
20768
21005
|
return { set: set, map: map, size: routes.length };
|
|
20769
21006
|
}
|
|
@@ -21654,8 +21891,8 @@ function shouldSkipAssistantGitDiscoveryDirectory(name) {
|
|
|
21654
21891
|
}
|
|
21655
21892
|
function resolveAssistantWorkspaceGitRoots(workspaceRoot) {
|
|
21656
21893
|
return __awaiter(this, void 0, void 0, function () {
|
|
21657
|
-
var roots, seen, push, _a, configuredRoots, configuredRoots_1, configuredRoots_1_1, configuredRoot, _b,
|
|
21658
|
-
var
|
|
21894
|
+
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;
|
|
21895
|
+
var e_50, _e, e_51, _f;
|
|
21659
21896
|
var _g;
|
|
21660
21897
|
return __generator(this, function (_h) {
|
|
21661
21898
|
switch (_h.label) {
|
|
@@ -21700,14 +21937,14 @@ function resolveAssistantWorkspaceGitRoots(workspaceRoot) {
|
|
|
21700
21937
|
return [3 /*break*/, 3];
|
|
21701
21938
|
case 6: return [3 /*break*/, 9];
|
|
21702
21939
|
case 7:
|
|
21703
|
-
|
|
21704
|
-
|
|
21940
|
+
e_50_1 = _h.sent();
|
|
21941
|
+
e_50 = { error: e_50_1 };
|
|
21705
21942
|
return [3 /*break*/, 9];
|
|
21706
21943
|
case 8:
|
|
21707
21944
|
try {
|
|
21708
21945
|
if (configuredRoots_1_1 && !configuredRoots_1_1.done && (_e = configuredRoots_1.return)) _e.call(configuredRoots_1);
|
|
21709
21946
|
}
|
|
21710
|
-
finally { if (
|
|
21947
|
+
finally { if (e_50) throw e_50.error; }
|
|
21711
21948
|
return [7 /*endfinally*/];
|
|
21712
21949
|
case 9:
|
|
21713
21950
|
queue = [];
|
|
@@ -21747,7 +21984,7 @@ function resolveAssistantWorkspaceGitRoots(workspaceRoot) {
|
|
|
21747
21984
|
return [3 /*break*/, 14];
|
|
21748
21985
|
case 14:
|
|
21749
21986
|
_h.trys.push([14, 21, 22, 23]);
|
|
21750
|
-
entries_1 = (
|
|
21987
|
+
entries_1 = (e_51 = void 0, __values(entries)), entries_1_1 = entries_1.next();
|
|
21751
21988
|
_h.label = 15;
|
|
21752
21989
|
case 15:
|
|
21753
21990
|
if (!!entries_1_1.done) return [3 /*break*/, 20];
|
|
@@ -21786,14 +22023,14 @@ function resolveAssistantWorkspaceGitRoots(workspaceRoot) {
|
|
|
21786
22023
|
return [3 /*break*/, 15];
|
|
21787
22024
|
case 20: return [3 /*break*/, 23];
|
|
21788
22025
|
case 21:
|
|
21789
|
-
|
|
21790
|
-
|
|
22026
|
+
e_51_1 = _h.sent();
|
|
22027
|
+
e_51 = { error: e_51_1 };
|
|
21791
22028
|
return [3 /*break*/, 23];
|
|
21792
22029
|
case 22:
|
|
21793
22030
|
try {
|
|
21794
22031
|
if (entries_1_1 && !entries_1_1.done && (_f = entries_1.return)) _f.call(entries_1);
|
|
21795
22032
|
}
|
|
21796
|
-
finally { if (
|
|
22033
|
+
finally { if (e_51) throw e_51.error; }
|
|
21797
22034
|
return [7 /*endfinally*/];
|
|
21798
22035
|
case 23: return [3 /*break*/, 10];
|
|
21799
22036
|
case 24: return [2 /*return*/, roots];
|
|
@@ -22133,8 +22370,8 @@ function syncAssistantGitMirror(repoUrl) {
|
|
|
22133
22370
|
}
|
|
22134
22371
|
function resolveAssistantChangeHistoryGitRoots(workspaceRoot) {
|
|
22135
22372
|
return __awaiter(this, void 0, void 0, function () {
|
|
22136
|
-
var roots, repoUrls, mirroredRoots, repoUrls_1, repoUrls_1_1, repoUrl, mirrorRoot,
|
|
22137
|
-
var
|
|
22373
|
+
var roots, repoUrls, mirroredRoots, repoUrls_1, repoUrls_1_1, repoUrl, mirrorRoot, e_52_1;
|
|
22374
|
+
var e_52, _a;
|
|
22138
22375
|
return __generator(this, function (_b) {
|
|
22139
22376
|
switch (_b.label) {
|
|
22140
22377
|
case 0: return [4 /*yield*/, resolveAssistantWorkspaceGitRoots(workspaceRoot)];
|
|
@@ -22168,14 +22405,14 @@ function resolveAssistantChangeHistoryGitRoots(workspaceRoot) {
|
|
|
22168
22405
|
return [3 /*break*/, 3];
|
|
22169
22406
|
case 6: return [3 /*break*/, 9];
|
|
22170
22407
|
case 7:
|
|
22171
|
-
|
|
22172
|
-
|
|
22408
|
+
e_52_1 = _b.sent();
|
|
22409
|
+
e_52 = { error: e_52_1 };
|
|
22173
22410
|
return [3 /*break*/, 9];
|
|
22174
22411
|
case 8:
|
|
22175
22412
|
try {
|
|
22176
22413
|
if (repoUrls_1_1 && !repoUrls_1_1.done && (_a = repoUrls_1.return)) _a.call(repoUrls_1);
|
|
22177
22414
|
}
|
|
22178
|
-
finally { if (
|
|
22415
|
+
finally { if (e_52) throw e_52.error; }
|
|
22179
22416
|
return [7 /*endfinally*/];
|
|
22180
22417
|
case 9: return [2 /*return*/, mirroredRoots];
|
|
22181
22418
|
}
|
|
@@ -22184,8 +22421,8 @@ function resolveAssistantChangeHistoryGitRoots(workspaceRoot) {
|
|
|
22184
22421
|
}
|
|
22185
22422
|
function resolveAssistantChangeHistoryFastPathResponse(params) {
|
|
22186
22423
|
return __awaiter(this, void 0, void 0, function () {
|
|
22187
|
-
var workspaceRoot, _a, gitRoots, featureKeywords, sawExecutionError, bestFallback, gitRoots_1, gitRoots_1_1, gitRoot, _b, branch, _c, _d, limit, historyDepth, rawHistory, commits, summary, hasKeywordMatches, _e,
|
|
22188
|
-
var
|
|
22424
|
+
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;
|
|
22425
|
+
var e_53, _f;
|
|
22189
22426
|
return __generator(this, function (_g) {
|
|
22190
22427
|
switch (_g.label) {
|
|
22191
22428
|
case 0:
|
|
@@ -22307,14 +22544,14 @@ function resolveAssistantChangeHistoryFastPathResponse(params) {
|
|
|
22307
22544
|
return [3 /*break*/, 7];
|
|
22308
22545
|
case 20: return [3 /*break*/, 23];
|
|
22309
22546
|
case 21:
|
|
22310
|
-
|
|
22311
|
-
|
|
22547
|
+
e_53_1 = _g.sent();
|
|
22548
|
+
e_53 = { error: e_53_1 };
|
|
22312
22549
|
return [3 /*break*/, 23];
|
|
22313
22550
|
case 22:
|
|
22314
22551
|
try {
|
|
22315
22552
|
if (gitRoots_1_1 && !gitRoots_1_1.done && (_f = gitRoots_1.return)) _f.call(gitRoots_1);
|
|
22316
22553
|
}
|
|
22317
|
-
finally { if (
|
|
22554
|
+
finally { if (e_53) throw e_53.error; }
|
|
22318
22555
|
return [7 /*endfinally*/];
|
|
22319
22556
|
case 23:
|
|
22320
22557
|
if (bestFallback) {
|
|
@@ -22495,7 +22732,7 @@ function sanitizeAssistantResponse(value) {
|
|
|
22495
22732
|
return normalizeAssistantRoutes(normalizedCurrency);
|
|
22496
22733
|
}
|
|
22497
22734
|
function evaluateAssistantGuardrails(message) {
|
|
22498
|
-
var
|
|
22735
|
+
var e_54, _a;
|
|
22499
22736
|
var normalized = String(message || '').toLowerCase();
|
|
22500
22737
|
var identityGuardrail = evaluateAssistantIdentityDisclosureGuardrail(normalized);
|
|
22501
22738
|
if (identityGuardrail === null || identityGuardrail === void 0 ? void 0 : identityGuardrail.blocked) {
|
|
@@ -22529,8 +22766,8 @@ function evaluateAssistantGuardrails(message) {
|
|
|
22529
22766
|
}
|
|
22530
22767
|
];
|
|
22531
22768
|
try {
|
|
22532
|
-
for (var
|
|
22533
|
-
var entry =
|
|
22769
|
+
for (var patterns_3 = __values(patterns), patterns_3_1 = patterns_3.next(); !patterns_3_1.done; patterns_3_1 = patterns_3.next()) {
|
|
22770
|
+
var entry = patterns_3_1.value;
|
|
22534
22771
|
if (entry.pattern.test(normalized)) {
|
|
22535
22772
|
return {
|
|
22536
22773
|
blocked: true,
|
|
@@ -22540,12 +22777,12 @@ function evaluateAssistantGuardrails(message) {
|
|
|
22540
22777
|
}
|
|
22541
22778
|
}
|
|
22542
22779
|
}
|
|
22543
|
-
catch (
|
|
22780
|
+
catch (e_54_1) { e_54 = { error: e_54_1 }; }
|
|
22544
22781
|
finally {
|
|
22545
22782
|
try {
|
|
22546
|
-
if (
|
|
22783
|
+
if (patterns_3_1 && !patterns_3_1.done && (_a = patterns_3.return)) _a.call(patterns_3);
|
|
22547
22784
|
}
|
|
22548
|
-
finally { if (
|
|
22785
|
+
finally { if (e_54) throw e_54.error; }
|
|
22549
22786
|
}
|
|
22550
22787
|
return null;
|
|
22551
22788
|
}
|
|
@@ -22650,7 +22887,7 @@ function tokenizeArithmeticExpression(expression) {
|
|
|
22650
22887
|
return tokens;
|
|
22651
22888
|
}
|
|
22652
22889
|
function evaluateArithmeticExpression(expression) {
|
|
22653
|
-
var
|
|
22890
|
+
var e_55, _a, e_56, _b;
|
|
22654
22891
|
var tokens = tokenizeArithmeticExpression(expression);
|
|
22655
22892
|
if (!tokens || !tokens.length) {
|
|
22656
22893
|
return null;
|
|
@@ -22707,12 +22944,12 @@ function evaluateArithmeticExpression(expression) {
|
|
|
22707
22944
|
prevToken = token;
|
|
22708
22945
|
}
|
|
22709
22946
|
}
|
|
22710
|
-
catch (
|
|
22947
|
+
catch (e_55_1) { e_55 = { error: e_55_1 }; }
|
|
22711
22948
|
finally {
|
|
22712
22949
|
try {
|
|
22713
22950
|
if (tokens_2_1 && !tokens_2_1.done && (_a = tokens_2.return)) _a.call(tokens_2);
|
|
22714
22951
|
}
|
|
22715
|
-
finally { if (
|
|
22952
|
+
finally { if (e_55) throw e_55.error; }
|
|
22716
22953
|
}
|
|
22717
22954
|
while (ops.length) {
|
|
22718
22955
|
var op = ops.pop();
|
|
@@ -22752,12 +22989,12 @@ function evaluateArithmeticExpression(expression) {
|
|
|
22752
22989
|
stack.push(Number(token));
|
|
22753
22990
|
}
|
|
22754
22991
|
}
|
|
22755
|
-
catch (
|
|
22992
|
+
catch (e_56_1) { e_56 = { error: e_56_1 }; }
|
|
22756
22993
|
finally {
|
|
22757
22994
|
try {
|
|
22758
22995
|
if (output_1_1 && !output_1_1.done && (_b = output_1.return)) _b.call(output_1);
|
|
22759
22996
|
}
|
|
22760
|
-
finally { if (
|
|
22997
|
+
finally { if (e_56) throw e_56.error; }
|
|
22761
22998
|
}
|
|
22762
22999
|
if (stack.length !== 1 || Number.isNaN(stack[0])) {
|
|
22763
23000
|
return null;
|
|
@@ -22941,8 +23178,8 @@ function handleCodexUpload(id_conversation, file_name, content_base64, size, con
|
|
|
22941
23178
|
}
|
|
22942
23179
|
function readAttachmentContents(attachments) {
|
|
22943
23180
|
return __awaiter(this, void 0, void 0, function () {
|
|
22944
|
-
var limits, totalBytes, totalChars, chunks, cleaned, attachments_1, attachments_1_1, attachment, localPath, safe, stat, ext, name_1, type, readable, content, _a,
|
|
22945
|
-
var
|
|
23181
|
+
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;
|
|
23182
|
+
var e_57, _b;
|
|
22946
23183
|
return __generator(this, function (_c) {
|
|
22947
23184
|
switch (_c.label) {
|
|
22948
23185
|
case 0:
|
|
@@ -23021,14 +23258,14 @@ function readAttachmentContents(attachments) {
|
|
|
23021
23258
|
return [3 /*break*/, 2];
|
|
23022
23259
|
case 10: return [3 /*break*/, 13];
|
|
23023
23260
|
case 11:
|
|
23024
|
-
|
|
23025
|
-
|
|
23261
|
+
e_57_1 = _c.sent();
|
|
23262
|
+
e_57 = { error: e_57_1 };
|
|
23026
23263
|
return [3 /*break*/, 13];
|
|
23027
23264
|
case 12:
|
|
23028
23265
|
try {
|
|
23029
23266
|
if (attachments_1_1 && !attachments_1_1.done && (_b = attachments_1.return)) _b.call(attachments_1);
|
|
23030
23267
|
}
|
|
23031
|
-
finally { if (
|
|
23268
|
+
finally { if (e_57) throw e_57.error; }
|
|
23032
23269
|
return [7 /*endfinally*/];
|
|
23033
23270
|
case 13: return [2 /*return*/, {
|
|
23034
23271
|
promptText: chunks.length ? "\n\nAttachments:\n".concat(chunks.join('\n\n')) : '',
|
|
@@ -23453,7 +23690,7 @@ function sanitizeAssistantMessageSetPayload(setPayload) {
|
|
|
23453
23690
|
return next;
|
|
23454
23691
|
}
|
|
23455
23692
|
function sanitizeMongoSafeObject(value) {
|
|
23456
|
-
var
|
|
23693
|
+
var e_58, _a;
|
|
23457
23694
|
if (value === null || value === undefined) {
|
|
23458
23695
|
return value;
|
|
23459
23696
|
}
|
|
@@ -23477,17 +23714,17 @@ function sanitizeMongoSafeObject(value) {
|
|
|
23477
23714
|
out[key] = sanitizeMongoSafeObject(rawValue);
|
|
23478
23715
|
}
|
|
23479
23716
|
}
|
|
23480
|
-
catch (
|
|
23717
|
+
catch (e_58_1) { e_58 = { error: e_58_1 }; }
|
|
23481
23718
|
finally {
|
|
23482
23719
|
try {
|
|
23483
23720
|
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
23484
23721
|
}
|
|
23485
|
-
finally { if (
|
|
23722
|
+
finally { if (e_58) throw e_58.error; }
|
|
23486
23723
|
}
|
|
23487
23724
|
return out;
|
|
23488
23725
|
}
|
|
23489
23726
|
function restoreMongoSafeObject(value) {
|
|
23490
|
-
var
|
|
23727
|
+
var e_59, _a;
|
|
23491
23728
|
if (value === null || value === undefined) {
|
|
23492
23729
|
return value;
|
|
23493
23730
|
}
|
|
@@ -23511,12 +23748,12 @@ function restoreMongoSafeObject(value) {
|
|
|
23511
23748
|
out[key] = restoreMongoSafeObject(rawValue);
|
|
23512
23749
|
}
|
|
23513
23750
|
}
|
|
23514
|
-
catch (
|
|
23751
|
+
catch (e_59_1) { e_59 = { error: e_59_1 }; }
|
|
23515
23752
|
finally {
|
|
23516
23753
|
try {
|
|
23517
23754
|
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
23518
23755
|
}
|
|
23519
|
-
finally { if (
|
|
23756
|
+
finally { if (e_59) throw e_59.error; }
|
|
23520
23757
|
}
|
|
23521
23758
|
return out;
|
|
23522
23759
|
}
|
|
@@ -23694,7 +23931,7 @@ function recordAssistantAnswerAIRun(input) {
|
|
|
23694
23931
|
});
|
|
23695
23932
|
}
|
|
23696
23933
|
function evaluateGuardrails(message) {
|
|
23697
|
-
var
|
|
23934
|
+
var e_60, _a;
|
|
23698
23935
|
var normalized = String(message || '').toLowerCase();
|
|
23699
23936
|
var identityGuardrail = evaluateAssistantIdentityDisclosureGuardrail(normalized);
|
|
23700
23937
|
if (identityGuardrail === null || identityGuardrail === void 0 ? void 0 : identityGuardrail.blocked) {
|
|
@@ -23709,8 +23946,8 @@ function evaluateGuardrails(message) {
|
|
|
23709
23946
|
{ pattern: /\b(exploit|bypass|malware|phishing|ransomware|ddos)\b/i, reason: 'Security abuse is restricted.' }
|
|
23710
23947
|
];
|
|
23711
23948
|
try {
|
|
23712
|
-
for (var
|
|
23713
|
-
var entry =
|
|
23949
|
+
for (var patterns_4 = __values(patterns), patterns_4_1 = patterns_4.next(); !patterns_4_1.done; patterns_4_1 = patterns_4.next()) {
|
|
23950
|
+
var entry = patterns_4_1.value;
|
|
23714
23951
|
if (entry.pattern.test(normalized)) {
|
|
23715
23952
|
return {
|
|
23716
23953
|
blocked: true,
|
|
@@ -23720,12 +23957,12 @@ function evaluateGuardrails(message) {
|
|
|
23720
23957
|
}
|
|
23721
23958
|
}
|
|
23722
23959
|
}
|
|
23723
|
-
catch (
|
|
23960
|
+
catch (e_60_1) { e_60 = { error: e_60_1 }; }
|
|
23724
23961
|
finally {
|
|
23725
23962
|
try {
|
|
23726
|
-
if (
|
|
23963
|
+
if (patterns_4_1 && !patterns_4_1.done && (_a = patterns_4.return)) _a.call(patterns_4);
|
|
23727
23964
|
}
|
|
23728
|
-
finally { if (
|
|
23965
|
+
finally { if (e_60) throw e_60.error; }
|
|
23729
23966
|
}
|
|
23730
23967
|
return null;
|
|
23731
23968
|
}
|