@resolveio/server-lib 22.3.201 → 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
|
}
|
|
@@ -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,143 @@ 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 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
|
+
}
|
|
7147
7300
|
function buildAssistantAppDataIntentDirective(message, collectionNames, appId) {
|
|
7148
7301
|
if (collectionNames === void 0) { collectionNames = []; }
|
|
7149
7302
|
var intent = selectAssistantAppDataIntent(message, collectionNames, appId);
|
|
@@ -7152,6 +7305,10 @@ function buildAssistantAppDataIntentDirective(message, collectionNames, appId) {
|
|
|
7152
7305
|
}
|
|
7153
7306
|
var customerText = extractAssistantDataIntentCustomerText(message);
|
|
7154
7307
|
var dateWindow = resolveAssistantDataIntentDateWindow(message);
|
|
7308
|
+
var requestedDimension = resolveAssistantRequestedDataDimension(message, intent);
|
|
7309
|
+
var templatedDimension = requestedDimension
|
|
7310
|
+
? applyAssistantDataIntentDimensionTemplate(requestedDimension, { customerText: customerText, dateWindow: dateWindow })
|
|
7311
|
+
: null;
|
|
7155
7312
|
var acknowledgementText = buildAssistantDataIntentAcknowledgement(intent, customerText, dateWindow);
|
|
7156
7313
|
var progress = intent.progress.map(function (entry) {
|
|
7157
7314
|
return entry
|
|
@@ -7166,7 +7323,11 @@ function buildAssistantAppDataIntentDirective(message, collectionNames, appId) {
|
|
|
7166
7323
|
assumptions: intent.assumptions,
|
|
7167
7324
|
fallbackCollections: intent.fallbackCollections,
|
|
7168
7325
|
customerText: customerText,
|
|
7169
|
-
dateWindow: dateWindow
|
|
7326
|
+
dateWindow: dateWindow,
|
|
7327
|
+
requestedDimension: templatedDimension ? {
|
|
7328
|
+
id: templatedDimension.id,
|
|
7329
|
+
terms: templatedDimension.terms
|
|
7330
|
+
} : null
|
|
7170
7331
|
};
|
|
7171
7332
|
var basePayload = function (pipeline) { return ({
|
|
7172
7333
|
collection: intent.collection,
|
|
@@ -7178,7 +7339,8 @@ function buildAssistantAppDataIntentDirective(message, collectionNames, appId) {
|
|
|
7178
7339
|
var pipeline = configuredPipeline.length
|
|
7179
7340
|
? configuredPipeline
|
|
7180
7341
|
: buildAssistantGenericDataIntentPipeline(intent, customerText, dateWindow);
|
|
7181
|
-
|
|
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 };
|
|
7182
7344
|
}
|
|
7183
7345
|
function isAssistantDeterministicHeuristicDirective(directive) {
|
|
7184
7346
|
return isAssistantSchemaHoursHeuristicDirective(directive)
|
|
@@ -7334,7 +7496,7 @@ function ensureAssistantDisplayColumns(display, requestedColumns) {
|
|
|
7334
7496
|
return __assign(__assign({}, display), { columns: columns, rows: rows });
|
|
7335
7497
|
}
|
|
7336
7498
|
function resolveAssistantPipelineTimeGrain(pipeline) {
|
|
7337
|
-
var
|
|
7499
|
+
var e_6, _a;
|
|
7338
7500
|
if (!Array.isArray(pipeline) || !pipeline.length) {
|
|
7339
7501
|
return null;
|
|
7340
7502
|
}
|
|
@@ -7396,12 +7558,12 @@ function resolveAssistantPipelineTimeGrain(pipeline) {
|
|
|
7396
7558
|
}
|
|
7397
7559
|
}
|
|
7398
7560
|
}
|
|
7399
|
-
catch (
|
|
7561
|
+
catch (e_6_1) { e_6 = { error: e_6_1 }; }
|
|
7400
7562
|
finally {
|
|
7401
7563
|
try {
|
|
7402
7564
|
if (priority_1_1 && !priority_1_1.done && (_a = priority_1.return)) _a.call(priority_1);
|
|
7403
7565
|
}
|
|
7404
|
-
finally { if (
|
|
7566
|
+
finally { if (e_6) throw e_6.error; }
|
|
7405
7567
|
}
|
|
7406
7568
|
return null;
|
|
7407
7569
|
}
|
|
@@ -8262,7 +8424,7 @@ function applyAssistantDatedReportWindow(value, toolResult) {
|
|
|
8262
8424
|
return "".concat(line, "\n\n").concat(content).trim();
|
|
8263
8425
|
}
|
|
8264
8426
|
function resolveAssistantDatedReportWindow(toolResult) {
|
|
8265
|
-
var
|
|
8427
|
+
var e_7, _a;
|
|
8266
8428
|
var _b, _c, _d, _e, _f, _g, _h, _j;
|
|
8267
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;
|
|
8268
8430
|
var verificationStart = normalizeOptionalString(verificationWindow === null || verificationWindow === void 0 ? void 0 : verificationWindow.startDate);
|
|
@@ -8328,12 +8490,12 @@ function resolveAssistantDatedReportWindow(toolResult) {
|
|
|
8328
8490
|
};
|
|
8329
8491
|
}
|
|
8330
8492
|
}
|
|
8331
|
-
catch (
|
|
8493
|
+
catch (e_7_1) { e_7 = { error: e_7_1 }; }
|
|
8332
8494
|
finally {
|
|
8333
8495
|
try {
|
|
8334
8496
|
if (pipelineCandidates_1_1 && !pipelineCandidates_1_1.done && (_a = pipelineCandidates_1.return)) _a.call(pipelineCandidates_1);
|
|
8335
8497
|
}
|
|
8336
|
-
finally { if (
|
|
8498
|
+
finally { if (e_7) throw e_7.error; }
|
|
8337
8499
|
}
|
|
8338
8500
|
return null;
|
|
8339
8501
|
}
|
|
@@ -9012,7 +9174,7 @@ function getValueAtPath(obj, path) {
|
|
|
9012
9174
|
return walk(obj, 0);
|
|
9013
9175
|
}
|
|
9014
9176
|
function hasArrayValueAtPath(docs, path) {
|
|
9015
|
-
var
|
|
9177
|
+
var e_8, _a;
|
|
9016
9178
|
if (!Array.isArray(docs) || !docs.length || !path) {
|
|
9017
9179
|
return false;
|
|
9018
9180
|
}
|
|
@@ -9025,17 +9187,17 @@ function hasArrayValueAtPath(docs, path) {
|
|
|
9025
9187
|
}
|
|
9026
9188
|
}
|
|
9027
9189
|
}
|
|
9028
|
-
catch (
|
|
9190
|
+
catch (e_8_1) { e_8 = { error: e_8_1 }; }
|
|
9029
9191
|
finally {
|
|
9030
9192
|
try {
|
|
9031
9193
|
if (docs_1_1 && !docs_1_1.done && (_a = docs_1.return)) _a.call(docs_1);
|
|
9032
9194
|
}
|
|
9033
|
-
finally { if (
|
|
9195
|
+
finally { if (e_8) throw e_8.error; }
|
|
9034
9196
|
}
|
|
9035
9197
|
return false;
|
|
9036
9198
|
}
|
|
9037
9199
|
function inferIdFieldStorageTypeFromDocs(docs, fieldPath) {
|
|
9038
|
-
var
|
|
9200
|
+
var e_9, _a, e_10, _b;
|
|
9039
9201
|
if (!Array.isArray(docs) || !fieldPath) {
|
|
9040
9202
|
return 'unknown';
|
|
9041
9203
|
}
|
|
@@ -9048,7 +9210,7 @@ function inferIdFieldStorageTypeFromDocs(docs, fieldPath) {
|
|
|
9048
9210
|
: doc === null || doc === void 0 ? void 0 : doc[fieldPath];
|
|
9049
9211
|
var queue = Array.isArray(value) ? value : [value];
|
|
9050
9212
|
try {
|
|
9051
|
-
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()) {
|
|
9052
9214
|
var entry = queue_1_1.value;
|
|
9053
9215
|
if (entry === null || entry === undefined) {
|
|
9054
9216
|
continue;
|
|
@@ -9061,21 +9223,21 @@ function inferIdFieldStorageTypeFromDocs(docs, fieldPath) {
|
|
|
9061
9223
|
}
|
|
9062
9224
|
}
|
|
9063
9225
|
}
|
|
9064
|
-
catch (
|
|
9226
|
+
catch (e_10_1) { e_10 = { error: e_10_1 }; }
|
|
9065
9227
|
finally {
|
|
9066
9228
|
try {
|
|
9067
9229
|
if (queue_1_1 && !queue_1_1.done && (_b = queue_1.return)) _b.call(queue_1);
|
|
9068
9230
|
}
|
|
9069
|
-
finally { if (
|
|
9231
|
+
finally { if (e_10) throw e_10.error; }
|
|
9070
9232
|
}
|
|
9071
9233
|
}
|
|
9072
9234
|
}
|
|
9073
|
-
catch (
|
|
9235
|
+
catch (e_9_1) { e_9 = { error: e_9_1 }; }
|
|
9074
9236
|
finally {
|
|
9075
9237
|
try {
|
|
9076
9238
|
if (docs_2_1 && !docs_2_1.done && (_a = docs_2.return)) _a.call(docs_2);
|
|
9077
9239
|
}
|
|
9078
|
-
finally { if (
|
|
9240
|
+
finally { if (e_9) throw e_9.error; }
|
|
9079
9241
|
}
|
|
9080
9242
|
return sawString ? 'string' : 'unknown';
|
|
9081
9243
|
}
|
|
@@ -9170,7 +9332,7 @@ function normalizeLookupKeyValue(value) {
|
|
|
9170
9332
|
return '';
|
|
9171
9333
|
}
|
|
9172
9334
|
function collectTopLevelIdFieldValues(docs, options) {
|
|
9173
|
-
var
|
|
9335
|
+
var e_11, _a, e_12, _b;
|
|
9174
9336
|
if (!Array.isArray(docs) || !docs.length) {
|
|
9175
9337
|
return [];
|
|
9176
9338
|
}
|
|
@@ -9218,26 +9380,26 @@ function collectTopLevelIdFieldValues(docs, options) {
|
|
|
9218
9380
|
});
|
|
9219
9381
|
};
|
|
9220
9382
|
try {
|
|
9221
|
-
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()) {
|
|
9222
9384
|
var key = keys_1_1.value;
|
|
9223
9385
|
_loop_3(key);
|
|
9224
9386
|
}
|
|
9225
9387
|
}
|
|
9226
|
-
catch (
|
|
9388
|
+
catch (e_12_1) { e_12 = { error: e_12_1 }; }
|
|
9227
9389
|
finally {
|
|
9228
9390
|
try {
|
|
9229
9391
|
if (keys_1_1 && !keys_1_1.done && (_b = keys_1.return)) _b.call(keys_1);
|
|
9230
9392
|
}
|
|
9231
|
-
finally { if (
|
|
9393
|
+
finally { if (e_12) throw e_12.error; }
|
|
9232
9394
|
}
|
|
9233
9395
|
}
|
|
9234
9396
|
}
|
|
9235
|
-
catch (
|
|
9397
|
+
catch (e_11_1) { e_11 = { error: e_11_1 }; }
|
|
9236
9398
|
finally {
|
|
9237
9399
|
try {
|
|
9238
9400
|
if (docs_3_1 && !docs_3_1.done && (_a = docs_3.return)) _a.call(docs_3);
|
|
9239
9401
|
}
|
|
9240
|
-
finally { if (
|
|
9402
|
+
finally { if (e_11) throw e_11.error; }
|
|
9241
9403
|
}
|
|
9242
9404
|
return Array.from(fieldMap.entries()).map(function (_a) {
|
|
9243
9405
|
var _b = __read(_a, 2), field = _b[0], values = _b[1];
|
|
@@ -9358,8 +9520,8 @@ function resolveLookupMappingsForField(field, mappings) {
|
|
|
9358
9520
|
}
|
|
9359
9521
|
function applyIdLookupDisplayEnrichment(params) {
|
|
9360
9522
|
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
|
|
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;
|
|
9363
9525
|
return __generator(this, function (_b) {
|
|
9364
9526
|
switch (_b.label) {
|
|
9365
9527
|
case 0:
|
|
@@ -9383,8 +9545,8 @@ function applyIdLookupDisplayEnrichment(params) {
|
|
|
9383
9545
|
lookupMeta = [];
|
|
9384
9546
|
enrichedDocs = docs.map(function (doc) { return (__assign({}, doc)); });
|
|
9385
9547
|
_loop_4 = function (fieldEntry) {
|
|
9386
|
-
var values, baseToken, mappingMatches, candidateCollections, filteredCandidates, _loop_5, filteredCandidates_1, filteredCandidates_1_1, candidate, state_3,
|
|
9387
|
-
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;
|
|
9388
9550
|
return __generator(this, function (_d) {
|
|
9389
9551
|
switch (_d.label) {
|
|
9390
9552
|
case 0:
|
|
@@ -9558,7 +9720,7 @@ function applyIdLookupDisplayEnrichment(params) {
|
|
|
9558
9720
|
_d.label = 1;
|
|
9559
9721
|
case 1:
|
|
9560
9722
|
_d.trys.push([1, 6, 7, 8]);
|
|
9561
|
-
filteredCandidates_1 = (
|
|
9723
|
+
filteredCandidates_1 = (e_14 = void 0, __values(filteredCandidates)), filteredCandidates_1_1 = filteredCandidates_1.next();
|
|
9562
9724
|
_d.label = 2;
|
|
9563
9725
|
case 2:
|
|
9564
9726
|
if (!!filteredCandidates_1_1.done) return [3 /*break*/, 5];
|
|
@@ -9574,14 +9736,14 @@ function applyIdLookupDisplayEnrichment(params) {
|
|
|
9574
9736
|
return [3 /*break*/, 2];
|
|
9575
9737
|
case 5: return [3 /*break*/, 8];
|
|
9576
9738
|
case 6:
|
|
9577
|
-
|
|
9578
|
-
|
|
9739
|
+
e_14_1 = _d.sent();
|
|
9740
|
+
e_14 = { error: e_14_1 };
|
|
9579
9741
|
return [3 /*break*/, 8];
|
|
9580
9742
|
case 7:
|
|
9581
9743
|
try {
|
|
9582
9744
|
if (filteredCandidates_1_1 && !filteredCandidates_1_1.done && (_c = filteredCandidates_1.return)) _c.call(filteredCandidates_1);
|
|
9583
9745
|
}
|
|
9584
|
-
finally { if (
|
|
9746
|
+
finally { if (e_14) throw e_14.error; }
|
|
9585
9747
|
return [7 /*endfinally*/];
|
|
9586
9748
|
case 8: return [2 /*return*/];
|
|
9587
9749
|
}
|
|
@@ -9604,14 +9766,14 @@ function applyIdLookupDisplayEnrichment(params) {
|
|
|
9604
9766
|
return [3 /*break*/, 3];
|
|
9605
9767
|
case 6: return [3 /*break*/, 9];
|
|
9606
9768
|
case 7:
|
|
9607
|
-
|
|
9608
|
-
|
|
9769
|
+
e_13_1 = _b.sent();
|
|
9770
|
+
e_13 = { error: e_13_1 };
|
|
9609
9771
|
return [3 /*break*/, 9];
|
|
9610
9772
|
case 8:
|
|
9611
9773
|
try {
|
|
9612
9774
|
if (idFields_1_1 && !idFields_1_1.done && (_a = idFields_1.return)) _a.call(idFields_1);
|
|
9613
9775
|
}
|
|
9614
|
-
finally { if (
|
|
9776
|
+
finally { if (e_13) throw e_13.error; }
|
|
9615
9777
|
return [7 /*endfinally*/];
|
|
9616
9778
|
case 9:
|
|
9617
9779
|
if (!lookupMeta.length) {
|
|
@@ -9630,7 +9792,7 @@ function applyIdLookupDisplayEnrichment(params) {
|
|
|
9630
9792
|
});
|
|
9631
9793
|
}
|
|
9632
9794
|
function hasNonEmptyValue(docs, fieldPath, options) {
|
|
9633
|
-
var
|
|
9795
|
+
var e_15, _a;
|
|
9634
9796
|
if (!Array.isArray(docs) || !fieldPath) {
|
|
9635
9797
|
return false;
|
|
9636
9798
|
}
|
|
@@ -9647,12 +9809,12 @@ function hasNonEmptyValue(docs, fieldPath, options) {
|
|
|
9647
9809
|
}
|
|
9648
9810
|
}
|
|
9649
9811
|
}
|
|
9650
|
-
catch (
|
|
9812
|
+
catch (e_15_1) { e_15 = { error: e_15_1 }; }
|
|
9651
9813
|
finally {
|
|
9652
9814
|
try {
|
|
9653
9815
|
if (docs_4_1 && !docs_4_1.done && (_a = docs_4.return)) _a.call(docs_4);
|
|
9654
9816
|
}
|
|
9655
|
-
finally { if (
|
|
9817
|
+
finally { if (e_15) throw e_15.error; }
|
|
9656
9818
|
}
|
|
9657
9819
|
return false;
|
|
9658
9820
|
}
|
|
@@ -12268,7 +12430,7 @@ function flattenAssistantExprClauses(expr) {
|
|
|
12268
12430
|
return [expr];
|
|
12269
12431
|
}
|
|
12270
12432
|
function detectAssistantMonthWindowInExpr(expr, allowedDateFields) {
|
|
12271
|
-
var
|
|
12433
|
+
var e_16, _a;
|
|
12272
12434
|
var clauses = flattenAssistantExprClauses(expr);
|
|
12273
12435
|
if (!clauses.length) {
|
|
12274
12436
|
return null;
|
|
@@ -12342,12 +12504,12 @@ function detectAssistantMonthWindowInExpr(expr, allowedDateFields) {
|
|
|
12342
12504
|
return state_4.value;
|
|
12343
12505
|
}
|
|
12344
12506
|
}
|
|
12345
|
-
catch (
|
|
12507
|
+
catch (e_16_1) { e_16 = { error: e_16_1 }; }
|
|
12346
12508
|
finally {
|
|
12347
12509
|
try {
|
|
12348
12510
|
if (lowerClauses_1_1 && !lowerClauses_1_1.done && (_a = lowerClauses_1.return)) _a.call(lowerClauses_1);
|
|
12349
12511
|
}
|
|
12350
|
-
finally { if (
|
|
12512
|
+
finally { if (e_16) throw e_16.error; }
|
|
12351
12513
|
}
|
|
12352
12514
|
return null;
|
|
12353
12515
|
}
|
|
@@ -12410,7 +12572,7 @@ function resolveAssistantMonthlyGroupDateFields(pipeline) {
|
|
|
12410
12572
|
return fields;
|
|
12411
12573
|
}
|
|
12412
12574
|
function detectAssistantMonthWindowFromPipeline(pipeline) {
|
|
12413
|
-
var
|
|
12575
|
+
var e_17, _a;
|
|
12414
12576
|
var _b;
|
|
12415
12577
|
var monthlyFields = resolveAssistantMonthlyGroupDateFields(pipeline);
|
|
12416
12578
|
var scanMatch = function (match) {
|
|
@@ -12438,12 +12600,12 @@ function detectAssistantMonthWindowFromPipeline(pipeline) {
|
|
|
12438
12600
|
}
|
|
12439
12601
|
}
|
|
12440
12602
|
}
|
|
12441
|
-
catch (
|
|
12603
|
+
catch (e_17_1) { e_17 = { error: e_17_1 }; }
|
|
12442
12604
|
finally {
|
|
12443
12605
|
try {
|
|
12444
12606
|
if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
|
|
12445
12607
|
}
|
|
12446
|
-
finally { if (
|
|
12608
|
+
finally { if (e_17) throw e_17.error; }
|
|
12447
12609
|
}
|
|
12448
12610
|
return null;
|
|
12449
12611
|
}
|
|
@@ -12723,7 +12885,7 @@ function normalizeAssistantCustomerLookupProjectionPipeline(pipeline) {
|
|
|
12723
12885
|
var nextProject = __assign({}, project);
|
|
12724
12886
|
var stageChanged = false;
|
|
12725
12887
|
Object.keys(nextProject).forEach(function (field) {
|
|
12726
|
-
var
|
|
12888
|
+
var e_18, _a;
|
|
12727
12889
|
var expression = nextProject[field];
|
|
12728
12890
|
if (typeof expression !== 'string') {
|
|
12729
12891
|
return;
|
|
@@ -12759,12 +12921,12 @@ function normalizeAssistantCustomerLookupProjectionPipeline(pipeline) {
|
|
|
12759
12921
|
break;
|
|
12760
12922
|
}
|
|
12761
12923
|
}
|
|
12762
|
-
catch (
|
|
12924
|
+
catch (e_18_1) { e_18 = { error: e_18_1 }; }
|
|
12763
12925
|
finally {
|
|
12764
12926
|
try {
|
|
12765
12927
|
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
12766
12928
|
}
|
|
12767
|
-
finally { if (
|
|
12929
|
+
finally { if (e_18) throw e_18.error; }
|
|
12768
12930
|
}
|
|
12769
12931
|
});
|
|
12770
12932
|
if (stageChanged) {
|
|
@@ -12937,7 +13099,7 @@ function matchContainsField(value, field) {
|
|
|
12937
13099
|
});
|
|
12938
13100
|
}
|
|
12939
13101
|
function resolveAggregateCompletionFallback(pipeline) {
|
|
12940
|
-
var
|
|
13102
|
+
var e_19, _a;
|
|
12941
13103
|
if (!Array.isArray(pipeline)) {
|
|
12942
13104
|
return null;
|
|
12943
13105
|
}
|
|
@@ -12950,7 +13112,7 @@ function resolveAggregateCompletionFallback(pipeline) {
|
|
|
12950
13112
|
}
|
|
12951
13113
|
var addFields = stage.$addFields;
|
|
12952
13114
|
try {
|
|
12953
|
-
for (var _b = (
|
|
13115
|
+
for (var _b = (e_19 = void 0, __values(Object.keys(addFields))), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
12954
13116
|
var key = _c.value;
|
|
12955
13117
|
if (!isCompletionFieldName(key)) {
|
|
12956
13118
|
continue;
|
|
@@ -12964,12 +13126,12 @@ function resolveAggregateCompletionFallback(pipeline) {
|
|
|
12964
13126
|
}
|
|
12965
13127
|
}
|
|
12966
13128
|
}
|
|
12967
|
-
catch (
|
|
13129
|
+
catch (e_19_1) { e_19 = { error: e_19_1 }; }
|
|
12968
13130
|
finally {
|
|
12969
13131
|
try {
|
|
12970
13132
|
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
12971
13133
|
}
|
|
12972
|
-
finally { if (
|
|
13134
|
+
finally { if (e_19) throw e_19.error; }
|
|
12973
13135
|
}
|
|
12974
13136
|
if (candidateField) {
|
|
12975
13137
|
break;
|
|
@@ -13125,7 +13287,7 @@ function buildCompletionFallbackSources(field) {
|
|
|
13125
13287
|
]);
|
|
13126
13288
|
}
|
|
13127
13289
|
function resolveAggregateCompletionExprFallback(pipeline) {
|
|
13128
|
-
var
|
|
13290
|
+
var e_20, _a;
|
|
13129
13291
|
if (!Array.isArray(pipeline)) {
|
|
13130
13292
|
return null;
|
|
13131
13293
|
}
|
|
@@ -13145,7 +13307,7 @@ function resolveAggregateCompletionExprFallback(pipeline) {
|
|
|
13145
13307
|
}
|
|
13146
13308
|
if (!candidateField) {
|
|
13147
13309
|
try {
|
|
13148
|
-
for (var _b = (
|
|
13310
|
+
for (var _b = (e_20 = void 0, __values(Object.keys(matchStage))), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
13149
13311
|
var key = _c.value;
|
|
13150
13312
|
if (key.startsWith('$')) {
|
|
13151
13313
|
continue;
|
|
@@ -13160,12 +13322,12 @@ function resolveAggregateCompletionExprFallback(pipeline) {
|
|
|
13160
13322
|
}
|
|
13161
13323
|
}
|
|
13162
13324
|
}
|
|
13163
|
-
catch (
|
|
13325
|
+
catch (e_20_1) { e_20 = { error: e_20_1 }; }
|
|
13164
13326
|
finally {
|
|
13165
13327
|
try {
|
|
13166
13328
|
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
13167
13329
|
}
|
|
13168
|
-
finally { if (
|
|
13330
|
+
finally { if (e_20) throw e_20.error; }
|
|
13169
13331
|
}
|
|
13170
13332
|
}
|
|
13171
13333
|
if (!candidateField) {
|
|
@@ -13367,7 +13529,7 @@ function hasAssistantDateGroupingOperator(value) {
|
|
|
13367
13529
|
return Object.keys(value).some(function (key) { return hasAssistantDateGroupingOperator(value[key]); });
|
|
13368
13530
|
}
|
|
13369
13531
|
function isGroupFieldDerivedFromDateExpression(pipeline, groupIndex, groupPaths) {
|
|
13370
|
-
var
|
|
13532
|
+
var e_21, _a, e_22, _b;
|
|
13371
13533
|
if (!Array.isArray(pipeline) || groupIndex <= 0 || !groupPaths.length) {
|
|
13372
13534
|
return false;
|
|
13373
13535
|
}
|
|
@@ -13393,14 +13555,14 @@ function isGroupFieldDerivedFromDateExpression(pipeline, groupIndex, groupPaths)
|
|
|
13393
13555
|
continue;
|
|
13394
13556
|
}
|
|
13395
13557
|
try {
|
|
13396
|
-
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()) {
|
|
13397
13559
|
var stageKey = stageKeys_1_1.value;
|
|
13398
13560
|
var payload = stage[stageKey];
|
|
13399
13561
|
if (!payload || typeof payload !== 'object' || Array.isArray(payload)) {
|
|
13400
13562
|
continue;
|
|
13401
13563
|
}
|
|
13402
13564
|
try {
|
|
13403
|
-
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()) {
|
|
13404
13566
|
var groupField = groupFields_1_1.value;
|
|
13405
13567
|
if (!Object.prototype.hasOwnProperty.call(payload, groupField)) {
|
|
13406
13568
|
continue;
|
|
@@ -13410,21 +13572,21 @@ function isGroupFieldDerivedFromDateExpression(pipeline, groupIndex, groupPaths)
|
|
|
13410
13572
|
}
|
|
13411
13573
|
}
|
|
13412
13574
|
}
|
|
13413
|
-
catch (
|
|
13575
|
+
catch (e_22_1) { e_22 = { error: e_22_1 }; }
|
|
13414
13576
|
finally {
|
|
13415
13577
|
try {
|
|
13416
13578
|
if (groupFields_1_1 && !groupFields_1_1.done && (_b = groupFields_1.return)) _b.call(groupFields_1);
|
|
13417
13579
|
}
|
|
13418
|
-
finally { if (
|
|
13580
|
+
finally { if (e_22) throw e_22.error; }
|
|
13419
13581
|
}
|
|
13420
13582
|
}
|
|
13421
13583
|
}
|
|
13422
|
-
catch (
|
|
13584
|
+
catch (e_21_1) { e_21 = { error: e_21_1 }; }
|
|
13423
13585
|
finally {
|
|
13424
13586
|
try {
|
|
13425
13587
|
if (stageKeys_1_1 && !stageKeys_1_1.done && (_a = stageKeys_1.return)) _a.call(stageKeys_1);
|
|
13426
13588
|
}
|
|
13427
|
-
finally { if (
|
|
13589
|
+
finally { if (e_21) throw e_21.error; }
|
|
13428
13590
|
}
|
|
13429
13591
|
}
|
|
13430
13592
|
return false;
|
|
@@ -13531,7 +13693,7 @@ function isRegexMatchCondition(value) {
|
|
|
13531
13693
|
return false;
|
|
13532
13694
|
}
|
|
13533
13695
|
function findRegexMatchInMatchObject(match, prefix) {
|
|
13534
|
-
var
|
|
13696
|
+
var e_23, _a, e_24, _b;
|
|
13535
13697
|
if (prefix === void 0) { prefix = ''; }
|
|
13536
13698
|
if (Array.isArray(match)) {
|
|
13537
13699
|
try {
|
|
@@ -13543,12 +13705,12 @@ function findRegexMatchInMatchObject(match, prefix) {
|
|
|
13543
13705
|
}
|
|
13544
13706
|
}
|
|
13545
13707
|
}
|
|
13546
|
-
catch (
|
|
13708
|
+
catch (e_23_1) { e_23 = { error: e_23_1 }; }
|
|
13547
13709
|
finally {
|
|
13548
13710
|
try {
|
|
13549
13711
|
if (match_1_1 && !match_1_1.done && (_a = match_1.return)) _a.call(match_1);
|
|
13550
13712
|
}
|
|
13551
|
-
finally { if (
|
|
13713
|
+
finally { if (e_23) throw e_23.error; }
|
|
13552
13714
|
}
|
|
13553
13715
|
return null;
|
|
13554
13716
|
}
|
|
@@ -13579,12 +13741,12 @@ function findRegexMatchInMatchObject(match, prefix) {
|
|
|
13579
13741
|
}
|
|
13580
13742
|
}
|
|
13581
13743
|
}
|
|
13582
|
-
catch (
|
|
13744
|
+
catch (e_24_1) { e_24 = { error: e_24_1 }; }
|
|
13583
13745
|
finally {
|
|
13584
13746
|
try {
|
|
13585
13747
|
if (keys_2_1 && !keys_2_1.done && (_b = keys_2.return)) _b.call(keys_2);
|
|
13586
13748
|
}
|
|
13587
|
-
finally { if (
|
|
13749
|
+
finally { if (e_24) throw e_24.error; }
|
|
13588
13750
|
}
|
|
13589
13751
|
return null;
|
|
13590
13752
|
}
|
|
@@ -13973,7 +14135,7 @@ function collectMatchFieldsByCondition(match, predicate, prefix) {
|
|
|
13973
14135
|
return results;
|
|
13974
14136
|
}
|
|
13975
14137
|
function findMatchConditionForField(match, targetField, prefix) {
|
|
13976
|
-
var
|
|
14138
|
+
var e_25, _a, e_26, _b;
|
|
13977
14139
|
if (prefix === void 0) { prefix = ''; }
|
|
13978
14140
|
if (!match || typeof match !== 'object') {
|
|
13979
14141
|
return undefined;
|
|
@@ -13988,12 +14150,12 @@ function findMatchConditionForField(match, targetField, prefix) {
|
|
|
13988
14150
|
}
|
|
13989
14151
|
}
|
|
13990
14152
|
}
|
|
13991
|
-
catch (
|
|
14153
|
+
catch (e_25_1) { e_25 = { error: e_25_1 }; }
|
|
13992
14154
|
finally {
|
|
13993
14155
|
try {
|
|
13994
14156
|
if (match_2_1 && !match_2_1.done && (_a = match_2.return)) _a.call(match_2);
|
|
13995
14157
|
}
|
|
13996
|
-
finally { if (
|
|
14158
|
+
finally { if (e_25) throw e_25.error; }
|
|
13997
14159
|
}
|
|
13998
14160
|
return undefined;
|
|
13999
14161
|
}
|
|
@@ -14020,12 +14182,12 @@ function findMatchConditionForField(match, targetField, prefix) {
|
|
|
14020
14182
|
}
|
|
14021
14183
|
}
|
|
14022
14184
|
}
|
|
14023
|
-
catch (
|
|
14185
|
+
catch (e_26_1) { e_26 = { error: e_26_1 }; }
|
|
14024
14186
|
finally {
|
|
14025
14187
|
try {
|
|
14026
14188
|
if (_d && !_d.done && (_b = _c.return)) _b.call(_c);
|
|
14027
14189
|
}
|
|
14028
|
-
finally { if (
|
|
14190
|
+
finally { if (e_26) throw e_26.error; }
|
|
14029
14191
|
}
|
|
14030
14192
|
return undefined;
|
|
14031
14193
|
}
|
|
@@ -14258,7 +14420,7 @@ function detectIdLikeValue(value) {
|
|
|
14258
14420
|
return false;
|
|
14259
14421
|
}
|
|
14260
14422
|
function detectChemicalIdFromProbe(probeDocs, fields) {
|
|
14261
|
-
var
|
|
14423
|
+
var e_27, _a, e_28, _b;
|
|
14262
14424
|
if (!Array.isArray(probeDocs) || !probeDocs.length) {
|
|
14263
14425
|
return false;
|
|
14264
14426
|
}
|
|
@@ -14270,7 +14432,7 @@ function detectChemicalIdFromProbe(probeDocs, fields) {
|
|
|
14270
14432
|
for (var probeDocs_1 = __values(probeDocs), probeDocs_1_1 = probeDocs_1.next(); !probeDocs_1_1.done; probeDocs_1_1 = probeDocs_1.next()) {
|
|
14271
14433
|
var doc = probeDocs_1_1.value;
|
|
14272
14434
|
try {
|
|
14273
|
-
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()) {
|
|
14274
14436
|
var field = targets_1_1.value;
|
|
14275
14437
|
var value = getValueAtPath(doc, field);
|
|
14276
14438
|
if (Array.isArray(value)) {
|
|
@@ -14283,21 +14445,21 @@ function detectChemicalIdFromProbe(probeDocs, fields) {
|
|
|
14283
14445
|
}
|
|
14284
14446
|
}
|
|
14285
14447
|
}
|
|
14286
|
-
catch (
|
|
14448
|
+
catch (e_28_1) { e_28 = { error: e_28_1 }; }
|
|
14287
14449
|
finally {
|
|
14288
14450
|
try {
|
|
14289
14451
|
if (targets_1_1 && !targets_1_1.done && (_b = targets_1.return)) _b.call(targets_1);
|
|
14290
14452
|
}
|
|
14291
|
-
finally { if (
|
|
14453
|
+
finally { if (e_28) throw e_28.error; }
|
|
14292
14454
|
}
|
|
14293
14455
|
}
|
|
14294
14456
|
}
|
|
14295
|
-
catch (
|
|
14457
|
+
catch (e_27_1) { e_27 = { error: e_27_1 }; }
|
|
14296
14458
|
finally {
|
|
14297
14459
|
try {
|
|
14298
14460
|
if (probeDocs_1_1 && !probeDocs_1_1.done && (_a = probeDocs_1.return)) _a.call(probeDocs_1);
|
|
14299
14461
|
}
|
|
14300
|
-
finally { if (
|
|
14462
|
+
finally { if (e_27) throw e_27.error; }
|
|
14301
14463
|
}
|
|
14302
14464
|
return false;
|
|
14303
14465
|
}
|
|
@@ -14518,8 +14680,8 @@ function buildChemicalIdFieldCandidates(field) {
|
|
|
14518
14680
|
}
|
|
14519
14681
|
function applyChemicalNameLookupFallbackToQuery(params) {
|
|
14520
14682
|
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
|
|
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;
|
|
14523
14685
|
var _b;
|
|
14524
14686
|
return __generator(this, function (_c) {
|
|
14525
14687
|
switch (_c.label) {
|
|
@@ -14632,14 +14794,14 @@ function applyChemicalNameLookupFallbackToQuery(params) {
|
|
|
14632
14794
|
return [3 /*break*/, 3];
|
|
14633
14795
|
case 6: return [3 /*break*/, 9];
|
|
14634
14796
|
case 7:
|
|
14635
|
-
|
|
14636
|
-
|
|
14797
|
+
e_29_1 = _c.sent();
|
|
14798
|
+
e_29 = { error: e_29_1 };
|
|
14637
14799
|
return [3 /*break*/, 9];
|
|
14638
14800
|
case 8:
|
|
14639
14801
|
try {
|
|
14640
14802
|
if (candidates_1_1 && !candidates_1_1.done && (_a = candidates_1.return)) _a.call(candidates_1);
|
|
14641
14803
|
}
|
|
14642
|
-
finally { if (
|
|
14804
|
+
finally { if (e_29) throw e_29.error; }
|
|
14643
14805
|
return [7 /*endfinally*/];
|
|
14644
14806
|
case 9: return [2 /*return*/, null];
|
|
14645
14807
|
}
|
|
@@ -14739,8 +14901,8 @@ function lookupIdsForNameMatch(params) {
|
|
|
14739
14901
|
}
|
|
14740
14902
|
function applyIdLookupFallbackToQuery(params) {
|
|
14741
14903
|
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
|
|
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;
|
|
14744
14906
|
var _e;
|
|
14745
14907
|
return __generator(this, function (_f) {
|
|
14746
14908
|
switch (_f.label) {
|
|
@@ -14810,7 +14972,7 @@ function applyIdLookupFallbackToQuery(params) {
|
|
|
14810
14972
|
_f.label = 5;
|
|
14811
14973
|
case 5:
|
|
14812
14974
|
_f.trys.push([5, 14, 15, 16]);
|
|
14813
|
-
candidates_2 = (
|
|
14975
|
+
candidates_2 = (e_30 = void 0, __values(candidates)), candidates_2_1 = candidates_2.next();
|
|
14814
14976
|
_f.label = 6;
|
|
14815
14977
|
case 6:
|
|
14816
14978
|
if (!!candidates_2_1.done) return [3 /*break*/, 13];
|
|
@@ -14877,28 +15039,28 @@ function applyIdLookupFallbackToQuery(params) {
|
|
|
14877
15039
|
return [3 /*break*/, 6];
|
|
14878
15040
|
case 13: return [3 /*break*/, 16];
|
|
14879
15041
|
case 14:
|
|
14880
|
-
|
|
14881
|
-
|
|
15042
|
+
e_30_1 = _f.sent();
|
|
15043
|
+
e_30 = { error: e_30_1 };
|
|
14882
15044
|
return [3 /*break*/, 16];
|
|
14883
15045
|
case 15:
|
|
14884
15046
|
try {
|
|
14885
15047
|
if (candidates_2_1 && !candidates_2_1.done && (_d = candidates_2.return)) _d.call(candidates_2);
|
|
14886
15048
|
}
|
|
14887
|
-
finally { if (
|
|
15049
|
+
finally { if (e_30) throw e_30.error; }
|
|
14888
15050
|
return [7 /*endfinally*/];
|
|
14889
15051
|
case 16:
|
|
14890
15052
|
conditions_1_1 = conditions_1.next();
|
|
14891
15053
|
return [3 /*break*/, 4];
|
|
14892
15054
|
case 17: return [3 /*break*/, 20];
|
|
14893
15055
|
case 18:
|
|
14894
|
-
|
|
14895
|
-
|
|
15056
|
+
e_31_1 = _f.sent();
|
|
15057
|
+
e_31 = { error: e_31_1 };
|
|
14896
15058
|
return [3 /*break*/, 20];
|
|
14897
15059
|
case 19:
|
|
14898
15060
|
try {
|
|
14899
15061
|
if (conditions_1_1 && !conditions_1_1.done && (_c = conditions_1.return)) _c.call(conditions_1);
|
|
14900
15062
|
}
|
|
14901
|
-
finally { if (
|
|
15063
|
+
finally { if (e_31) throw e_31.error; }
|
|
14902
15064
|
return [7 /*endfinally*/];
|
|
14903
15065
|
case 20: return [2 /*return*/, null];
|
|
14904
15066
|
}
|
|
@@ -15343,8 +15505,8 @@ function resolveAssistantSurfaceFileCandidates(baseName) {
|
|
|
15343
15505
|
}
|
|
15344
15506
|
function readFirstAssistantSurfaceFile(candidates) {
|
|
15345
15507
|
return __awaiter(this, void 0, void 0, function () {
|
|
15346
|
-
var candidates_3, candidates_3_1, candidate, normalized, _a,
|
|
15347
|
-
var
|
|
15508
|
+
var candidates_3, candidates_3_1, candidate, normalized, _a, e_32_1;
|
|
15509
|
+
var e_32, _b;
|
|
15348
15510
|
return __generator(this, function (_c) {
|
|
15349
15511
|
switch (_c.label) {
|
|
15350
15512
|
case 0:
|
|
@@ -15371,14 +15533,14 @@ function readFirstAssistantSurfaceFile(candidates) {
|
|
|
15371
15533
|
return [3 /*break*/, 1];
|
|
15372
15534
|
case 6: return [3 /*break*/, 9];
|
|
15373
15535
|
case 7:
|
|
15374
|
-
|
|
15375
|
-
|
|
15536
|
+
e_32_1 = _c.sent();
|
|
15537
|
+
e_32 = { error: e_32_1 };
|
|
15376
15538
|
return [3 /*break*/, 9];
|
|
15377
15539
|
case 8:
|
|
15378
15540
|
try {
|
|
15379
15541
|
if (candidates_3_1 && !candidates_3_1.done && (_b = candidates_3.return)) _b.call(candidates_3);
|
|
15380
15542
|
}
|
|
15381
|
-
finally { if (
|
|
15543
|
+
finally { if (e_32) throw e_32.error; }
|
|
15382
15544
|
return [7 /*endfinally*/];
|
|
15383
15545
|
case 9: return [2 /*return*/, ''];
|
|
15384
15546
|
}
|
|
@@ -15911,6 +16073,20 @@ function cloneAssistantHeuristicProfile(profile) {
|
|
|
15911
16073
|
progress: mergeAssistantHintValues((entry === null || entry === void 0 ? void 0 : entry.progress) || []),
|
|
15912
16074
|
acknowledgement: normalizeOptionalString(entry === null || entry === void 0 ? void 0 : entry.acknowledgement) || undefined,
|
|
15913
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
|
+
: [],
|
|
15914
16090
|
pipeline: Array.isArray(entry === null || entry === void 0 ? void 0 : entry.pipeline) ? (0, common_1.deepCopy)(entry.pipeline) : undefined,
|
|
15915
16091
|
options: (entry === null || entry === void 0 ? void 0 : entry.options) && typeof entry.options === 'object' && !Array.isArray(entry.options)
|
|
15916
16092
|
? (0, common_1.deepCopy)(entry.options)
|
|
@@ -16062,6 +16238,53 @@ function normalizeAssistantCollectionTermHints(value) {
|
|
|
16062
16238
|
});
|
|
16063
16239
|
return hints;
|
|
16064
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
|
+
}
|
|
16065
16288
|
function normalizeAssistantAppDataIntents(value) {
|
|
16066
16289
|
var entries = Array.isArray(value) ? value : [];
|
|
16067
16290
|
var intents = [];
|
|
@@ -16092,6 +16315,10 @@ function normalizeAssistantAppDataIntents(value) {
|
|
|
16092
16315
|
|| entry.acknowledgement_template
|
|
16093
16316
|
|| entry.acknowledgementTemplate) || undefined,
|
|
16094
16317
|
assumptions: mergeAssistantHintValues(Array.isArray(entry.assumptions) ? entry.assumptions : []),
|
|
16318
|
+
dimensions: normalizeAssistantAppDataDimensions(entry.dimensions
|
|
16319
|
+
|| entry.breakdown_dimensions
|
|
16320
|
+
|| entry.breakdownDimensions
|
|
16321
|
+
|| []),
|
|
16095
16322
|
pipeline: Array.isArray(entry.pipeline) ? (0, common_1.deepCopy)(entry.pipeline) : undefined,
|
|
16096
16323
|
options: entry.options && typeof entry.options === 'object' && !Array.isArray(entry.options)
|
|
16097
16324
|
? (0, common_1.deepCopy)(entry.options)
|
|
@@ -16822,7 +17049,7 @@ function doesAssistantPreserveAnyTermMatch(text, terms) {
|
|
|
16822
17049
|
return (Array.isArray(terms) ? terms : []).some(function (term) { return doesAssistantPreserveTermMatch(text, term); });
|
|
16823
17050
|
}
|
|
16824
17051
|
function shouldPreserveAssistantCollectionForRouteFromRules(params) {
|
|
16825
|
-
var
|
|
17052
|
+
var e_33, _a;
|
|
16826
17053
|
var _b, _c, _d, _e, _f, _g, _h;
|
|
16827
17054
|
var routePreferred = normalizeAssistantCollectionOverrideName(params.routePreferredName);
|
|
16828
17055
|
var requested = normalizeAssistantCollectionOverrideName(params.requestedCollection);
|
|
@@ -16854,12 +17081,12 @@ function shouldPreserveAssistantCollectionForRouteFromRules(params) {
|
|
|
16854
17081
|
return true;
|
|
16855
17082
|
}
|
|
16856
17083
|
}
|
|
16857
|
-
catch (
|
|
17084
|
+
catch (e_33_1) { e_33 = { error: e_33_1 }; }
|
|
16858
17085
|
finally {
|
|
16859
17086
|
try {
|
|
16860
17087
|
if (_k && !_k.done && (_a = _j.return)) _a.call(_j);
|
|
16861
17088
|
}
|
|
16862
|
-
finally { if (
|
|
17089
|
+
finally { if (e_33) throw e_33.error; }
|
|
16863
17090
|
}
|
|
16864
17091
|
return false;
|
|
16865
17092
|
}
|
|
@@ -17750,7 +17977,7 @@ function resolveAssistantNestedPrefixCollectionCandidates(params) {
|
|
|
17750
17977
|
function resolveAssistantNestedAggregateFallbacks(params) {
|
|
17751
17978
|
return __awaiter(this, void 0, void 0, function () {
|
|
17752
17979
|
var prefixes, collectionNames, fallbacks, seen, prefixes_1, prefixes_1_1, prefix, rewrite, candidates, candidates_4, candidates_4_1, candidate, normalizedPipeline, key;
|
|
17753
|
-
var
|
|
17980
|
+
var e_34, _a, e_35, _b;
|
|
17754
17981
|
return __generator(this, function (_c) {
|
|
17755
17982
|
switch (_c.label) {
|
|
17756
17983
|
case 0:
|
|
@@ -17780,7 +18007,7 @@ function resolveAssistantNestedAggregateFallbacks(params) {
|
|
|
17780
18007
|
triedCollections: params.triedCollections
|
|
17781
18008
|
});
|
|
17782
18009
|
try {
|
|
17783
|
-
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()) {
|
|
17784
18011
|
candidate = candidates_4_1.value;
|
|
17785
18012
|
normalizedPipeline = normalizeAssistantAggregatePipeline(rewrite.pipeline, candidate);
|
|
17786
18013
|
if (!normalizedPipeline.length || containsForbiddenMongoOperators(normalizedPipeline)) {
|
|
@@ -17802,21 +18029,21 @@ function resolveAssistantNestedAggregateFallbacks(params) {
|
|
|
17802
18029
|
}
|
|
17803
18030
|
}
|
|
17804
18031
|
}
|
|
17805
|
-
catch (
|
|
18032
|
+
catch (e_35_1) { e_35 = { error: e_35_1 }; }
|
|
17806
18033
|
finally {
|
|
17807
18034
|
try {
|
|
17808
18035
|
if (candidates_4_1 && !candidates_4_1.done && (_b = candidates_4.return)) _b.call(candidates_4);
|
|
17809
18036
|
}
|
|
17810
|
-
finally { if (
|
|
18037
|
+
finally { if (e_35) throw e_35.error; }
|
|
17811
18038
|
}
|
|
17812
18039
|
}
|
|
17813
18040
|
}
|
|
17814
|
-
catch (
|
|
18041
|
+
catch (e_34_1) { e_34 = { error: e_34_1 }; }
|
|
17815
18042
|
finally {
|
|
17816
18043
|
try {
|
|
17817
18044
|
if (prefixes_1_1 && !prefixes_1_1.done && (_a = prefixes_1.return)) _a.call(prefixes_1);
|
|
17818
18045
|
}
|
|
17819
|
-
finally { if (
|
|
18046
|
+
finally { if (e_34) throw e_34.error; }
|
|
17820
18047
|
}
|
|
17821
18048
|
return [2 /*return*/, fallbacks];
|
|
17822
18049
|
}
|
|
@@ -17948,8 +18175,8 @@ function resolveAssistantBridgeCollectionHintCandidates(requestedCollection, req
|
|
|
17948
18175
|
}
|
|
17949
18176
|
function resolveAssistantReportBuilderBridgeCollection(collection_1, db_1) {
|
|
17950
18177
|
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
|
|
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;
|
|
17953
18180
|
var _g, _h;
|
|
17954
18181
|
if (dbName === void 0) { dbName = ''; }
|
|
17955
18182
|
return __generator(this, function (_j) {
|
|
@@ -18023,12 +18250,12 @@ function resolveAssistantReportBuilderBridgeCollection(collection_1, db_1) {
|
|
|
18023
18250
|
}
|
|
18024
18251
|
}
|
|
18025
18252
|
}
|
|
18026
|
-
catch (
|
|
18253
|
+
catch (e_38_1) { e_38 = { error: e_38_1 }; }
|
|
18027
18254
|
finally {
|
|
18028
18255
|
try {
|
|
18029
18256
|
if (candidates_5_1 && !candidates_5_1.done && (_b = candidates_5.return)) _b.call(candidates_5);
|
|
18030
18257
|
}
|
|
18031
|
-
finally { if (
|
|
18258
|
+
finally { if (e_38) throw e_38.error; }
|
|
18032
18259
|
}
|
|
18033
18260
|
}
|
|
18034
18261
|
if (configuredCollectionNames.length) {
|
|
@@ -18043,12 +18270,12 @@ function resolveAssistantReportBuilderBridgeCollection(collection_1, db_1) {
|
|
|
18043
18270
|
}
|
|
18044
18271
|
}
|
|
18045
18272
|
}
|
|
18046
|
-
catch (
|
|
18273
|
+
catch (e_39_1) { e_39 = { error: e_39_1 }; }
|
|
18047
18274
|
finally {
|
|
18048
18275
|
try {
|
|
18049
18276
|
if (candidates_6_1 && !candidates_6_1.done && (_c = candidates_6.return)) _c.call(candidates_6);
|
|
18050
18277
|
}
|
|
18051
|
-
finally { if (
|
|
18278
|
+
finally { if (e_39) throw e_39.error; }
|
|
18052
18279
|
}
|
|
18053
18280
|
}
|
|
18054
18281
|
primaryCollectionHint = normalizeOptionalString((_h = requestHints === null || requestHints === void 0 ? void 0 : requestHints.collectionHints) === null || _h === void 0 ? void 0 : _h[0]);
|
|
@@ -18109,14 +18336,14 @@ function resolveAssistantReportBuilderBridgeCollection(collection_1, db_1) {
|
|
|
18109
18336
|
return [3 /*break*/, 2];
|
|
18110
18337
|
case 7: return [3 /*break*/, 10];
|
|
18111
18338
|
case 8:
|
|
18112
|
-
|
|
18113
|
-
|
|
18339
|
+
e_36_1 = _j.sent();
|
|
18340
|
+
e_36 = { error: e_36_1 };
|
|
18114
18341
|
return [3 /*break*/, 10];
|
|
18115
18342
|
case 9:
|
|
18116
18343
|
try {
|
|
18117
18344
|
if (resolverTargets_1_1 && !resolverTargets_1_1.done && (_d = resolverTargets_1.return)) _d.call(resolverTargets_1);
|
|
18118
18345
|
}
|
|
18119
|
-
finally { if (
|
|
18346
|
+
finally { if (e_36) throw e_36.error; }
|
|
18120
18347
|
return [7 /*endfinally*/];
|
|
18121
18348
|
case 10:
|
|
18122
18349
|
if (!db) return [3 /*break*/, 18];
|
|
@@ -18142,14 +18369,14 @@ function resolveAssistantReportBuilderBridgeCollection(collection_1, db_1) {
|
|
|
18142
18369
|
return [3 /*break*/, 12];
|
|
18143
18370
|
case 15: return [3 /*break*/, 18];
|
|
18144
18371
|
case 16:
|
|
18145
|
-
|
|
18146
|
-
|
|
18372
|
+
e_37_1 = _j.sent();
|
|
18373
|
+
e_37 = { error: e_37_1 };
|
|
18147
18374
|
return [3 /*break*/, 18];
|
|
18148
18375
|
case 17:
|
|
18149
18376
|
try {
|
|
18150
18377
|
if (candidates_7_1 && !candidates_7_1.done && (_e = candidates_7.return)) _e.call(candidates_7);
|
|
18151
18378
|
}
|
|
18152
|
-
finally { if (
|
|
18379
|
+
finally { if (e_37) throw e_37.error; }
|
|
18153
18380
|
return [7 /*endfinally*/];
|
|
18154
18381
|
case 18:
|
|
18155
18382
|
try {
|
|
@@ -18160,12 +18387,12 @@ function resolveAssistantReportBuilderBridgeCollection(collection_1, db_1) {
|
|
|
18160
18387
|
}
|
|
18161
18388
|
}
|
|
18162
18389
|
}
|
|
18163
|
-
catch (
|
|
18390
|
+
catch (e_40_1) { e_40 = { error: e_40_1 }; }
|
|
18164
18391
|
finally {
|
|
18165
18392
|
try {
|
|
18166
18393
|
if (candidates_8_1 && !candidates_8_1.done && (_f = candidates_8.return)) _f.call(candidates_8);
|
|
18167
18394
|
}
|
|
18168
|
-
finally { if (
|
|
18395
|
+
finally { if (e_40) throw e_40.error; }
|
|
18169
18396
|
}
|
|
18170
18397
|
throw new Error('AI assistant report builder bridge: No queryable collection could be resolved.');
|
|
18171
18398
|
}
|
|
@@ -18173,7 +18400,7 @@ function resolveAssistantReportBuilderBridgeCollection(collection_1, db_1) {
|
|
|
18173
18400
|
});
|
|
18174
18401
|
}
|
|
18175
18402
|
function findQueryDateField(query) {
|
|
18176
|
-
var
|
|
18403
|
+
var e_41, _a, e_42, _b;
|
|
18177
18404
|
if (!query || typeof query !== 'object') {
|
|
18178
18405
|
return null;
|
|
18179
18406
|
}
|
|
@@ -18187,12 +18414,12 @@ function findQueryDateField(query) {
|
|
|
18187
18414
|
}
|
|
18188
18415
|
}
|
|
18189
18416
|
}
|
|
18190
|
-
catch (
|
|
18417
|
+
catch (e_41_1) { e_41 = { error: e_41_1 }; }
|
|
18191
18418
|
finally {
|
|
18192
18419
|
try {
|
|
18193
18420
|
if (query_1_1 && !query_1_1.done && (_a = query_1.return)) _a.call(query_1);
|
|
18194
18421
|
}
|
|
18195
|
-
finally { if (
|
|
18422
|
+
finally { if (e_41) throw e_41.error; }
|
|
18196
18423
|
}
|
|
18197
18424
|
return null;
|
|
18198
18425
|
}
|
|
@@ -18211,12 +18438,12 @@ function findQueryDateField(query) {
|
|
|
18211
18438
|
}
|
|
18212
18439
|
}
|
|
18213
18440
|
}
|
|
18214
|
-
catch (
|
|
18441
|
+
catch (e_42_1) { e_42 = { error: e_42_1 }; }
|
|
18215
18442
|
finally {
|
|
18216
18443
|
try {
|
|
18217
18444
|
if (_d && !_d.done && (_b = _c.return)) _b.call(_c);
|
|
18218
18445
|
}
|
|
18219
|
-
finally { if (
|
|
18446
|
+
finally { if (e_42) throw e_42.error; }
|
|
18220
18447
|
}
|
|
18221
18448
|
return null;
|
|
18222
18449
|
}
|
|
@@ -18504,7 +18731,7 @@ function resolveQueryDateFieldFallback(query) {
|
|
|
18504
18731
|
return { from: dateField, to: fallback };
|
|
18505
18732
|
}
|
|
18506
18733
|
function containsForbiddenMongoOperators(value) {
|
|
18507
|
-
var
|
|
18734
|
+
var e_43, _a;
|
|
18508
18735
|
if (!value || typeof value !== 'object') {
|
|
18509
18736
|
return false;
|
|
18510
18737
|
}
|
|
@@ -18523,12 +18750,12 @@ function containsForbiddenMongoOperators(value) {
|
|
|
18523
18750
|
}
|
|
18524
18751
|
}
|
|
18525
18752
|
}
|
|
18526
|
-
catch (
|
|
18753
|
+
catch (e_43_1) { e_43 = { error: e_43_1 }; }
|
|
18527
18754
|
finally {
|
|
18528
18755
|
try {
|
|
18529
18756
|
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
18530
18757
|
}
|
|
18531
|
-
finally { if (
|
|
18758
|
+
finally { if (e_43) throw e_43.error; }
|
|
18532
18759
|
}
|
|
18533
18760
|
return false;
|
|
18534
18761
|
}
|
|
@@ -18713,7 +18940,7 @@ function splitAssistantPermissionTokenSets(value) {
|
|
|
18713
18940
|
};
|
|
18714
18941
|
}
|
|
18715
18942
|
function isAssistantTokenSetSubset(subset, superset) {
|
|
18716
|
-
var
|
|
18943
|
+
var e_44, _a;
|
|
18717
18944
|
if (!subset.size) {
|
|
18718
18945
|
return false;
|
|
18719
18946
|
}
|
|
@@ -18725,12 +18952,12 @@ function isAssistantTokenSetSubset(subset, superset) {
|
|
|
18725
18952
|
}
|
|
18726
18953
|
}
|
|
18727
18954
|
}
|
|
18728
|
-
catch (
|
|
18955
|
+
catch (e_44_1) { e_44 = { error: e_44_1 }; }
|
|
18729
18956
|
finally {
|
|
18730
18957
|
try {
|
|
18731
18958
|
if (subset_1_1 && !subset_1_1.done && (_a = subset_1.return)) _a.call(subset_1);
|
|
18732
18959
|
}
|
|
18733
|
-
finally { if (
|
|
18960
|
+
finally { if (e_44) throw e_44.error; }
|
|
18734
18961
|
}
|
|
18735
18962
|
return true;
|
|
18736
18963
|
}
|
|
@@ -19265,8 +19492,8 @@ function applyCodexStreamStatusHandler(runOptions, streamStatusHandler) {
|
|
|
19265
19492
|
}
|
|
19266
19493
|
function waitForCodexWorkerMessage(worker, streamStatusHandler) {
|
|
19267
19494
|
return __awaiter(this, void 0, void 0, function () {
|
|
19268
|
-
var _a, _b, _c, _d, message, payload, status_1,
|
|
19269
|
-
var _e,
|
|
19495
|
+
var _a, _b, _c, _d, message, payload, status_1, e_45_1;
|
|
19496
|
+
var _e, e_45, _f, _g;
|
|
19270
19497
|
return __generator(this, function (_h) {
|
|
19271
19498
|
switch (_h.label) {
|
|
19272
19499
|
case 0:
|
|
@@ -19293,8 +19520,8 @@ function waitForCodexWorkerMessage(worker, streamStatusHandler) {
|
|
|
19293
19520
|
return [3 /*break*/, 1];
|
|
19294
19521
|
case 4: return [3 /*break*/, 11];
|
|
19295
19522
|
case 5:
|
|
19296
|
-
|
|
19297
|
-
|
|
19523
|
+
e_45_1 = _h.sent();
|
|
19524
|
+
e_45 = { error: e_45_1 };
|
|
19298
19525
|
return [3 /*break*/, 11];
|
|
19299
19526
|
case 6:
|
|
19300
19527
|
_h.trys.push([6, , 9, 10]);
|
|
@@ -19305,7 +19532,7 @@ function waitForCodexWorkerMessage(worker, streamStatusHandler) {
|
|
|
19305
19532
|
_h.label = 8;
|
|
19306
19533
|
case 8: return [3 /*break*/, 10];
|
|
19307
19534
|
case 9:
|
|
19308
|
-
if (
|
|
19535
|
+
if (e_45) throw e_45.error;
|
|
19309
19536
|
return [7 /*endfinally*/];
|
|
19310
19537
|
case 10: return [7 /*endfinally*/];
|
|
19311
19538
|
case 11: throw new CodexWorkerBootstrapError('AI worker exited before completing.');
|
|
@@ -19649,8 +19876,8 @@ function buildAssistantWorkspaceRootCandidates(params) {
|
|
|
19649
19876
|
}
|
|
19650
19877
|
function resolveAssistantWorkspaceRoot() {
|
|
19651
19878
|
return __awaiter(this, void 0, void 0, function () {
|
|
19652
|
-
var candidates, firstExisting, firstNestedGitRoot, candidates_9, candidates_9_1, candidate, _a, gitRoot, nestedGitRoots,
|
|
19653
|
-
var
|
|
19879
|
+
var candidates, firstExisting, firstNestedGitRoot, candidates_9, candidates_9_1, candidate, _a, gitRoot, nestedGitRoots, e_46_1;
|
|
19880
|
+
var e_46, _b;
|
|
19654
19881
|
return __generator(this, function (_c) {
|
|
19655
19882
|
switch (_c.label) {
|
|
19656
19883
|
case 0:
|
|
@@ -19697,14 +19924,14 @@ function resolveAssistantWorkspaceRoot() {
|
|
|
19697
19924
|
return [3 /*break*/, 2];
|
|
19698
19925
|
case 8: return [3 /*break*/, 11];
|
|
19699
19926
|
case 9:
|
|
19700
|
-
|
|
19701
|
-
|
|
19927
|
+
e_46_1 = _c.sent();
|
|
19928
|
+
e_46 = { error: e_46_1 };
|
|
19702
19929
|
return [3 /*break*/, 11];
|
|
19703
19930
|
case 10:
|
|
19704
19931
|
try {
|
|
19705
19932
|
if (candidates_9_1 && !candidates_9_1.done && (_b = candidates_9.return)) _b.call(candidates_9);
|
|
19706
19933
|
}
|
|
19707
|
-
finally { if (
|
|
19934
|
+
finally { if (e_46) throw e_46.error; }
|
|
19708
19935
|
return [7 /*endfinally*/];
|
|
19709
19936
|
case 11:
|
|
19710
19937
|
if (firstNestedGitRoot) {
|
|
@@ -20112,7 +20339,7 @@ var AI_ASSISTANT_BREAKDOWN_DIMENSION_STOPWORDS = new Set([
|
|
|
20112
20339
|
'by'
|
|
20113
20340
|
]);
|
|
20114
20341
|
function normalizeAssistantBreakdownDimension(value) {
|
|
20115
|
-
var
|
|
20342
|
+
var e_47, _a;
|
|
20116
20343
|
var normalized = normalizeOptionalString(value)
|
|
20117
20344
|
.toLowerCase()
|
|
20118
20345
|
.replace(/[^a-z0-9_\s-]+/g, ' ')
|
|
@@ -20144,12 +20371,12 @@ function normalizeAssistantBreakdownDimension(value) {
|
|
|
20144
20371
|
}
|
|
20145
20372
|
}
|
|
20146
20373
|
}
|
|
20147
|
-
catch (
|
|
20374
|
+
catch (e_47_1) { e_47 = { error: e_47_1 }; }
|
|
20148
20375
|
finally {
|
|
20149
20376
|
try {
|
|
20150
20377
|
if (tokens_1_1 && !tokens_1_1.done && (_a = tokens_1.return)) _a.call(tokens_1);
|
|
20151
20378
|
}
|
|
20152
|
-
finally { if (
|
|
20379
|
+
finally { if (e_47) throw e_47.error; }
|
|
20153
20380
|
}
|
|
20154
20381
|
if (!kept.length) {
|
|
20155
20382
|
return '';
|
|
@@ -20354,7 +20581,7 @@ function resolveAssistantPlannerEnabled(config) {
|
|
|
20354
20581
|
return raw === undefined ? false : raw === true;
|
|
20355
20582
|
}
|
|
20356
20583
|
function resolveAssistantPlannerKnownRoutes(user, isSuperAdmin) {
|
|
20357
|
-
var
|
|
20584
|
+
var e_48, _a;
|
|
20358
20585
|
var _b;
|
|
20359
20586
|
if (isSuperAdmin === void 0) { isSuperAdmin = false; }
|
|
20360
20587
|
var routes = ((_b = resolveio_server_app_1.ResolveIOServer.getClientRoutes) === null || _b === void 0 ? void 0 : _b.call(resolveio_server_app_1.ResolveIOServer)) || [];
|
|
@@ -20368,12 +20595,12 @@ function resolveAssistantPlannerKnownRoutes(user, isSuperAdmin) {
|
|
|
20368
20595
|
}
|
|
20369
20596
|
}
|
|
20370
20597
|
}
|
|
20371
|
-
catch (
|
|
20598
|
+
catch (e_48_1) { e_48 = { error: e_48_1 }; }
|
|
20372
20599
|
finally {
|
|
20373
20600
|
try {
|
|
20374
20601
|
if (routes_1_1 && !routes_1_1.done && (_a = routes_1.return)) _a.call(routes_1);
|
|
20375
20602
|
}
|
|
20376
|
-
finally { if (
|
|
20603
|
+
finally { if (e_48) throw e_48.error; }
|
|
20377
20604
|
}
|
|
20378
20605
|
var normalizedRoutes = Array.from(unique);
|
|
20379
20606
|
var allowedRoutes = collectAssistantAllowedRoutesForUser(user, normalizedRoutes, isSuperAdmin);
|
|
@@ -20749,7 +20976,7 @@ function normalizeRouteMatchKey(value) {
|
|
|
20749
20976
|
return normalizeRouteKey(value).toLowerCase();
|
|
20750
20977
|
}
|
|
20751
20978
|
function buildClientRouteIndex() {
|
|
20752
|
-
var
|
|
20979
|
+
var e_49, _a;
|
|
20753
20980
|
var _b;
|
|
20754
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);
|
|
20755
20982
|
var set = new Set();
|
|
@@ -20768,12 +20995,12 @@ function buildClientRouteIndex() {
|
|
|
20768
20995
|
}
|
|
20769
20996
|
}
|
|
20770
20997
|
}
|
|
20771
|
-
catch (
|
|
20998
|
+
catch (e_49_1) { e_49 = { error: e_49_1 }; }
|
|
20772
20999
|
finally {
|
|
20773
21000
|
try {
|
|
20774
21001
|
if (routes_2_1 && !routes_2_1.done && (_a = routes_2.return)) _a.call(routes_2);
|
|
20775
21002
|
}
|
|
20776
|
-
finally { if (
|
|
21003
|
+
finally { if (e_49) throw e_49.error; }
|
|
20777
21004
|
}
|
|
20778
21005
|
return { set: set, map: map, size: routes.length };
|
|
20779
21006
|
}
|
|
@@ -21664,8 +21891,8 @@ function shouldSkipAssistantGitDiscoveryDirectory(name) {
|
|
|
21664
21891
|
}
|
|
21665
21892
|
function resolveAssistantWorkspaceGitRoots(workspaceRoot) {
|
|
21666
21893
|
return __awaiter(this, void 0, void 0, function () {
|
|
21667
|
-
var roots, seen, push, _a, configuredRoots, configuredRoots_1, configuredRoots_1_1, configuredRoot, _b,
|
|
21668
|
-
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;
|
|
21669
21896
|
var _g;
|
|
21670
21897
|
return __generator(this, function (_h) {
|
|
21671
21898
|
switch (_h.label) {
|
|
@@ -21710,14 +21937,14 @@ function resolveAssistantWorkspaceGitRoots(workspaceRoot) {
|
|
|
21710
21937
|
return [3 /*break*/, 3];
|
|
21711
21938
|
case 6: return [3 /*break*/, 9];
|
|
21712
21939
|
case 7:
|
|
21713
|
-
|
|
21714
|
-
|
|
21940
|
+
e_50_1 = _h.sent();
|
|
21941
|
+
e_50 = { error: e_50_1 };
|
|
21715
21942
|
return [3 /*break*/, 9];
|
|
21716
21943
|
case 8:
|
|
21717
21944
|
try {
|
|
21718
21945
|
if (configuredRoots_1_1 && !configuredRoots_1_1.done && (_e = configuredRoots_1.return)) _e.call(configuredRoots_1);
|
|
21719
21946
|
}
|
|
21720
|
-
finally { if (
|
|
21947
|
+
finally { if (e_50) throw e_50.error; }
|
|
21721
21948
|
return [7 /*endfinally*/];
|
|
21722
21949
|
case 9:
|
|
21723
21950
|
queue = [];
|
|
@@ -21757,7 +21984,7 @@ function resolveAssistantWorkspaceGitRoots(workspaceRoot) {
|
|
|
21757
21984
|
return [3 /*break*/, 14];
|
|
21758
21985
|
case 14:
|
|
21759
21986
|
_h.trys.push([14, 21, 22, 23]);
|
|
21760
|
-
entries_1 = (
|
|
21987
|
+
entries_1 = (e_51 = void 0, __values(entries)), entries_1_1 = entries_1.next();
|
|
21761
21988
|
_h.label = 15;
|
|
21762
21989
|
case 15:
|
|
21763
21990
|
if (!!entries_1_1.done) return [3 /*break*/, 20];
|
|
@@ -21796,14 +22023,14 @@ function resolveAssistantWorkspaceGitRoots(workspaceRoot) {
|
|
|
21796
22023
|
return [3 /*break*/, 15];
|
|
21797
22024
|
case 20: return [3 /*break*/, 23];
|
|
21798
22025
|
case 21:
|
|
21799
|
-
|
|
21800
|
-
|
|
22026
|
+
e_51_1 = _h.sent();
|
|
22027
|
+
e_51 = { error: e_51_1 };
|
|
21801
22028
|
return [3 /*break*/, 23];
|
|
21802
22029
|
case 22:
|
|
21803
22030
|
try {
|
|
21804
22031
|
if (entries_1_1 && !entries_1_1.done && (_f = entries_1.return)) _f.call(entries_1);
|
|
21805
22032
|
}
|
|
21806
|
-
finally { if (
|
|
22033
|
+
finally { if (e_51) throw e_51.error; }
|
|
21807
22034
|
return [7 /*endfinally*/];
|
|
21808
22035
|
case 23: return [3 /*break*/, 10];
|
|
21809
22036
|
case 24: return [2 /*return*/, roots];
|
|
@@ -22143,8 +22370,8 @@ function syncAssistantGitMirror(repoUrl) {
|
|
|
22143
22370
|
}
|
|
22144
22371
|
function resolveAssistantChangeHistoryGitRoots(workspaceRoot) {
|
|
22145
22372
|
return __awaiter(this, void 0, void 0, function () {
|
|
22146
|
-
var roots, repoUrls, mirroredRoots, repoUrls_1, repoUrls_1_1, repoUrl, mirrorRoot,
|
|
22147
|
-
var
|
|
22373
|
+
var roots, repoUrls, mirroredRoots, repoUrls_1, repoUrls_1_1, repoUrl, mirrorRoot, e_52_1;
|
|
22374
|
+
var e_52, _a;
|
|
22148
22375
|
return __generator(this, function (_b) {
|
|
22149
22376
|
switch (_b.label) {
|
|
22150
22377
|
case 0: return [4 /*yield*/, resolveAssistantWorkspaceGitRoots(workspaceRoot)];
|
|
@@ -22178,14 +22405,14 @@ function resolveAssistantChangeHistoryGitRoots(workspaceRoot) {
|
|
|
22178
22405
|
return [3 /*break*/, 3];
|
|
22179
22406
|
case 6: return [3 /*break*/, 9];
|
|
22180
22407
|
case 7:
|
|
22181
|
-
|
|
22182
|
-
|
|
22408
|
+
e_52_1 = _b.sent();
|
|
22409
|
+
e_52 = { error: e_52_1 };
|
|
22183
22410
|
return [3 /*break*/, 9];
|
|
22184
22411
|
case 8:
|
|
22185
22412
|
try {
|
|
22186
22413
|
if (repoUrls_1_1 && !repoUrls_1_1.done && (_a = repoUrls_1.return)) _a.call(repoUrls_1);
|
|
22187
22414
|
}
|
|
22188
|
-
finally { if (
|
|
22415
|
+
finally { if (e_52) throw e_52.error; }
|
|
22189
22416
|
return [7 /*endfinally*/];
|
|
22190
22417
|
case 9: return [2 /*return*/, mirroredRoots];
|
|
22191
22418
|
}
|
|
@@ -22194,8 +22421,8 @@ function resolveAssistantChangeHistoryGitRoots(workspaceRoot) {
|
|
|
22194
22421
|
}
|
|
22195
22422
|
function resolveAssistantChangeHistoryFastPathResponse(params) {
|
|
22196
22423
|
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
|
|
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;
|
|
22199
22426
|
return __generator(this, function (_g) {
|
|
22200
22427
|
switch (_g.label) {
|
|
22201
22428
|
case 0:
|
|
@@ -22317,14 +22544,14 @@ function resolveAssistantChangeHistoryFastPathResponse(params) {
|
|
|
22317
22544
|
return [3 /*break*/, 7];
|
|
22318
22545
|
case 20: return [3 /*break*/, 23];
|
|
22319
22546
|
case 21:
|
|
22320
|
-
|
|
22321
|
-
|
|
22547
|
+
e_53_1 = _g.sent();
|
|
22548
|
+
e_53 = { error: e_53_1 };
|
|
22322
22549
|
return [3 /*break*/, 23];
|
|
22323
22550
|
case 22:
|
|
22324
22551
|
try {
|
|
22325
22552
|
if (gitRoots_1_1 && !gitRoots_1_1.done && (_f = gitRoots_1.return)) _f.call(gitRoots_1);
|
|
22326
22553
|
}
|
|
22327
|
-
finally { if (
|
|
22554
|
+
finally { if (e_53) throw e_53.error; }
|
|
22328
22555
|
return [7 /*endfinally*/];
|
|
22329
22556
|
case 23:
|
|
22330
22557
|
if (bestFallback) {
|
|
@@ -22505,7 +22732,7 @@ function sanitizeAssistantResponse(value) {
|
|
|
22505
22732
|
return normalizeAssistantRoutes(normalizedCurrency);
|
|
22506
22733
|
}
|
|
22507
22734
|
function evaluateAssistantGuardrails(message) {
|
|
22508
|
-
var
|
|
22735
|
+
var e_54, _a;
|
|
22509
22736
|
var normalized = String(message || '').toLowerCase();
|
|
22510
22737
|
var identityGuardrail = evaluateAssistantIdentityDisclosureGuardrail(normalized);
|
|
22511
22738
|
if (identityGuardrail === null || identityGuardrail === void 0 ? void 0 : identityGuardrail.blocked) {
|
|
@@ -22539,8 +22766,8 @@ function evaluateAssistantGuardrails(message) {
|
|
|
22539
22766
|
}
|
|
22540
22767
|
];
|
|
22541
22768
|
try {
|
|
22542
|
-
for (var
|
|
22543
|
-
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;
|
|
22544
22771
|
if (entry.pattern.test(normalized)) {
|
|
22545
22772
|
return {
|
|
22546
22773
|
blocked: true,
|
|
@@ -22550,12 +22777,12 @@ function evaluateAssistantGuardrails(message) {
|
|
|
22550
22777
|
}
|
|
22551
22778
|
}
|
|
22552
22779
|
}
|
|
22553
|
-
catch (
|
|
22780
|
+
catch (e_54_1) { e_54 = { error: e_54_1 }; }
|
|
22554
22781
|
finally {
|
|
22555
22782
|
try {
|
|
22556
|
-
if (
|
|
22783
|
+
if (patterns_3_1 && !patterns_3_1.done && (_a = patterns_3.return)) _a.call(patterns_3);
|
|
22557
22784
|
}
|
|
22558
|
-
finally { if (
|
|
22785
|
+
finally { if (e_54) throw e_54.error; }
|
|
22559
22786
|
}
|
|
22560
22787
|
return null;
|
|
22561
22788
|
}
|
|
@@ -22660,7 +22887,7 @@ function tokenizeArithmeticExpression(expression) {
|
|
|
22660
22887
|
return tokens;
|
|
22661
22888
|
}
|
|
22662
22889
|
function evaluateArithmeticExpression(expression) {
|
|
22663
|
-
var
|
|
22890
|
+
var e_55, _a, e_56, _b;
|
|
22664
22891
|
var tokens = tokenizeArithmeticExpression(expression);
|
|
22665
22892
|
if (!tokens || !tokens.length) {
|
|
22666
22893
|
return null;
|
|
@@ -22717,12 +22944,12 @@ function evaluateArithmeticExpression(expression) {
|
|
|
22717
22944
|
prevToken = token;
|
|
22718
22945
|
}
|
|
22719
22946
|
}
|
|
22720
|
-
catch (
|
|
22947
|
+
catch (e_55_1) { e_55 = { error: e_55_1 }; }
|
|
22721
22948
|
finally {
|
|
22722
22949
|
try {
|
|
22723
22950
|
if (tokens_2_1 && !tokens_2_1.done && (_a = tokens_2.return)) _a.call(tokens_2);
|
|
22724
22951
|
}
|
|
22725
|
-
finally { if (
|
|
22952
|
+
finally { if (e_55) throw e_55.error; }
|
|
22726
22953
|
}
|
|
22727
22954
|
while (ops.length) {
|
|
22728
22955
|
var op = ops.pop();
|
|
@@ -22762,12 +22989,12 @@ function evaluateArithmeticExpression(expression) {
|
|
|
22762
22989
|
stack.push(Number(token));
|
|
22763
22990
|
}
|
|
22764
22991
|
}
|
|
22765
|
-
catch (
|
|
22992
|
+
catch (e_56_1) { e_56 = { error: e_56_1 }; }
|
|
22766
22993
|
finally {
|
|
22767
22994
|
try {
|
|
22768
22995
|
if (output_1_1 && !output_1_1.done && (_b = output_1.return)) _b.call(output_1);
|
|
22769
22996
|
}
|
|
22770
|
-
finally { if (
|
|
22997
|
+
finally { if (e_56) throw e_56.error; }
|
|
22771
22998
|
}
|
|
22772
22999
|
if (stack.length !== 1 || Number.isNaN(stack[0])) {
|
|
22773
23000
|
return null;
|
|
@@ -22951,8 +23178,8 @@ function handleCodexUpload(id_conversation, file_name, content_base64, size, con
|
|
|
22951
23178
|
}
|
|
22952
23179
|
function readAttachmentContents(attachments) {
|
|
22953
23180
|
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
|
|
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;
|
|
22956
23183
|
return __generator(this, function (_c) {
|
|
22957
23184
|
switch (_c.label) {
|
|
22958
23185
|
case 0:
|
|
@@ -23031,14 +23258,14 @@ function readAttachmentContents(attachments) {
|
|
|
23031
23258
|
return [3 /*break*/, 2];
|
|
23032
23259
|
case 10: return [3 /*break*/, 13];
|
|
23033
23260
|
case 11:
|
|
23034
|
-
|
|
23035
|
-
|
|
23261
|
+
e_57_1 = _c.sent();
|
|
23262
|
+
e_57 = { error: e_57_1 };
|
|
23036
23263
|
return [3 /*break*/, 13];
|
|
23037
23264
|
case 12:
|
|
23038
23265
|
try {
|
|
23039
23266
|
if (attachments_1_1 && !attachments_1_1.done && (_b = attachments_1.return)) _b.call(attachments_1);
|
|
23040
23267
|
}
|
|
23041
|
-
finally { if (
|
|
23268
|
+
finally { if (e_57) throw e_57.error; }
|
|
23042
23269
|
return [7 /*endfinally*/];
|
|
23043
23270
|
case 13: return [2 /*return*/, {
|
|
23044
23271
|
promptText: chunks.length ? "\n\nAttachments:\n".concat(chunks.join('\n\n')) : '',
|
|
@@ -23463,7 +23690,7 @@ function sanitizeAssistantMessageSetPayload(setPayload) {
|
|
|
23463
23690
|
return next;
|
|
23464
23691
|
}
|
|
23465
23692
|
function sanitizeMongoSafeObject(value) {
|
|
23466
|
-
var
|
|
23693
|
+
var e_58, _a;
|
|
23467
23694
|
if (value === null || value === undefined) {
|
|
23468
23695
|
return value;
|
|
23469
23696
|
}
|
|
@@ -23487,17 +23714,17 @@ function sanitizeMongoSafeObject(value) {
|
|
|
23487
23714
|
out[key] = sanitizeMongoSafeObject(rawValue);
|
|
23488
23715
|
}
|
|
23489
23716
|
}
|
|
23490
|
-
catch (
|
|
23717
|
+
catch (e_58_1) { e_58 = { error: e_58_1 }; }
|
|
23491
23718
|
finally {
|
|
23492
23719
|
try {
|
|
23493
23720
|
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
23494
23721
|
}
|
|
23495
|
-
finally { if (
|
|
23722
|
+
finally { if (e_58) throw e_58.error; }
|
|
23496
23723
|
}
|
|
23497
23724
|
return out;
|
|
23498
23725
|
}
|
|
23499
23726
|
function restoreMongoSafeObject(value) {
|
|
23500
|
-
var
|
|
23727
|
+
var e_59, _a;
|
|
23501
23728
|
if (value === null || value === undefined) {
|
|
23502
23729
|
return value;
|
|
23503
23730
|
}
|
|
@@ -23521,12 +23748,12 @@ function restoreMongoSafeObject(value) {
|
|
|
23521
23748
|
out[key] = restoreMongoSafeObject(rawValue);
|
|
23522
23749
|
}
|
|
23523
23750
|
}
|
|
23524
|
-
catch (
|
|
23751
|
+
catch (e_59_1) { e_59 = { error: e_59_1 }; }
|
|
23525
23752
|
finally {
|
|
23526
23753
|
try {
|
|
23527
23754
|
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
23528
23755
|
}
|
|
23529
|
-
finally { if (
|
|
23756
|
+
finally { if (e_59) throw e_59.error; }
|
|
23530
23757
|
}
|
|
23531
23758
|
return out;
|
|
23532
23759
|
}
|
|
@@ -23704,7 +23931,7 @@ function recordAssistantAnswerAIRun(input) {
|
|
|
23704
23931
|
});
|
|
23705
23932
|
}
|
|
23706
23933
|
function evaluateGuardrails(message) {
|
|
23707
|
-
var
|
|
23934
|
+
var e_60, _a;
|
|
23708
23935
|
var normalized = String(message || '').toLowerCase();
|
|
23709
23936
|
var identityGuardrail = evaluateAssistantIdentityDisclosureGuardrail(normalized);
|
|
23710
23937
|
if (identityGuardrail === null || identityGuardrail === void 0 ? void 0 : identityGuardrail.blocked) {
|
|
@@ -23719,8 +23946,8 @@ function evaluateGuardrails(message) {
|
|
|
23719
23946
|
{ pattern: /\b(exploit|bypass|malware|phishing|ransomware|ddos)\b/i, reason: 'Security abuse is restricted.' }
|
|
23720
23947
|
];
|
|
23721
23948
|
try {
|
|
23722
|
-
for (var
|
|
23723
|
-
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;
|
|
23724
23951
|
if (entry.pattern.test(normalized)) {
|
|
23725
23952
|
return {
|
|
23726
23953
|
blocked: true,
|
|
@@ -23730,12 +23957,12 @@ function evaluateGuardrails(message) {
|
|
|
23730
23957
|
}
|
|
23731
23958
|
}
|
|
23732
23959
|
}
|
|
23733
|
-
catch (
|
|
23960
|
+
catch (e_60_1) { e_60 = { error: e_60_1 }; }
|
|
23734
23961
|
finally {
|
|
23735
23962
|
try {
|
|
23736
|
-
if (
|
|
23963
|
+
if (patterns_4_1 && !patterns_4_1.done && (_a = patterns_4.return)) _a.call(patterns_4);
|
|
23737
23964
|
}
|
|
23738
|
-
finally { if (
|
|
23965
|
+
finally { if (e_60) throw e_60.error; }
|
|
23739
23966
|
}
|
|
23740
23967
|
return null;
|
|
23741
23968
|
}
|