@memberjunction/core-entities-server 6.2.0-edge.6 → 6.2.0-edge.8
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/README.md +155 -100
- package/dist/custom/AnchoredConversationReadSecurityHook.d.ts +22 -0
- package/dist/custom/AnchoredConversationReadSecurityHook.d.ts.map +1 -0
- package/dist/custom/AnchoredConversationReadSecurityHook.js +293 -0
- package/dist/custom/AnchoredConversationReadSecurityHook.js.map +1 -0
- package/dist/custom/MJAIAgentExampleEntityServer.server.d.ts +2 -0
- package/dist/custom/MJAIAgentExampleEntityServer.server.d.ts.map +1 -1
- package/dist/custom/MJAIAgentExampleEntityServer.server.js +8 -5
- package/dist/custom/MJAIAgentExampleEntityServer.server.js.map +1 -1
- package/dist/custom/MJAIAgentNoteEntityServer.server.d.ts +2 -0
- package/dist/custom/MJAIAgentNoteEntityServer.server.d.ts.map +1 -1
- package/dist/custom/MJAIAgentNoteEntityServer.server.js +8 -5
- package/dist/custom/MJAIAgentNoteEntityServer.server.js.map +1 -1
- package/dist/custom/MJAIAgentRelationshipEntityServer.server.d.ts +17 -0
- package/dist/custom/MJAIAgentRelationshipEntityServer.server.d.ts.map +1 -0
- package/dist/custom/MJAIAgentRelationshipEntityServer.server.js +71 -0
- package/dist/custom/MJAIAgentRelationshipEntityServer.server.js.map +1 -0
- package/dist/custom/MJAIAgentSessionEntityServer.server.d.ts +8 -22
- package/dist/custom/MJAIAgentSessionEntityServer.server.d.ts.map +1 -1
- package/dist/custom/MJAIAgentSessionEntityServer.server.js +24 -1
- package/dist/custom/MJAIAgentSessionEntityServer.server.js.map +1 -1
- package/dist/custom/MJAIAgentUserPolicyEntityServer.server.d.ts +23 -0
- package/dist/custom/MJAIAgentUserPolicyEntityServer.server.d.ts.map +1 -0
- package/dist/custom/MJAIAgentUserPolicyEntityServer.server.js +53 -0
- package/dist/custom/MJAIAgentUserPolicyEntityServer.server.js.map +1 -0
- package/dist/custom/MJAIPromptEntityServer.server.d.ts.map +1 -1
- package/dist/custom/MJAIPromptEntityServer.server.js +2 -1
- package/dist/custom/MJAIPromptEntityServer.server.js.map +1 -1
- package/dist/custom/MJBrandKitEntityServer.server.d.ts +14 -0
- package/dist/custom/MJBrandKitEntityServer.server.d.ts.map +1 -0
- package/dist/custom/MJBrandKitEntityServer.server.js +75 -0
- package/dist/custom/MJBrandKitEntityServer.server.js.map +1 -0
- package/dist/custom/MJCompanyIntegrationEntityServer.server.d.ts.map +1 -1
- package/dist/custom/MJCompanyIntegrationEntityServer.server.js +1 -0
- package/dist/custom/MJCompanyIntegrationEntityServer.server.js.map +1 -1
- package/dist/custom/MJComponentEntityServer.server.d.ts +2 -0
- package/dist/custom/MJComponentEntityServer.server.d.ts.map +1 -1
- package/dist/custom/MJComponentEntityServer.server.js +5 -1
- package/dist/custom/MJComponentEntityServer.server.js.map +1 -1
- package/dist/custom/MJConversationDetailEntityServer.server.d.ts +20 -30
- package/dist/custom/MJConversationDetailEntityServer.server.d.ts.map +1 -1
- package/dist/custom/MJConversationDetailEntityServer.server.js +89 -35
- package/dist/custom/MJConversationDetailEntityServer.server.js.map +1 -1
- package/dist/custom/MJConversationEntityServer.server.d.ts +19 -4
- package/dist/custom/MJConversationEntityServer.server.d.ts.map +1 -1
- package/dist/custom/MJConversationEntityServer.server.js +169 -11
- package/dist/custom/MJConversationEntityServer.server.js.map +1 -1
- package/dist/custom/MJEntityDocumentEntityServer.server.d.ts.map +1 -1
- package/dist/custom/MJEntityDocumentEntityServer.server.js +1 -0
- package/dist/custom/MJEntityDocumentEntityServer.server.js.map +1 -1
- package/dist/custom/MJListDetailEntityServer.server.d.ts.map +1 -1
- package/dist/custom/MJListDetailEntityServer.server.js +1 -0
- package/dist/custom/MJListDetailEntityServer.server.js.map +1 -1
- package/dist/custom/MJProjectEntityServer.server.d.ts +21 -0
- package/dist/custom/MJProjectEntityServer.server.d.ts.map +1 -0
- package/dist/custom/MJProjectEntityServer.server.js +106 -0
- package/dist/custom/MJProjectEntityServer.server.js.map +1 -0
- package/dist/custom/MJQueryEntityServer.server.d.ts +177 -47
- package/dist/custom/MJQueryEntityServer.server.d.ts.map +1 -1
- package/dist/custom/MJQueryEntityServer.server.js +479 -164
- package/dist/custom/MJQueryEntityServer.server.js.map +1 -1
- package/dist/custom/MJQuerySQLEntityServer.server.d.ts +15 -18
- package/dist/custom/MJQuerySQLEntityServer.server.d.ts.map +1 -1
- package/dist/custom/MJQuerySQLEntityServer.server.js +34 -42
- package/dist/custom/MJQuerySQLEntityServer.server.js.map +1 -1
- package/dist/custom/MJTagEntityServer.server.d.ts +2 -0
- package/dist/custom/MJTagEntityServer.server.d.ts.map +1 -1
- package/dist/custom/MJTagEntityServer.server.js +13 -7
- package/dist/custom/MJTagEntityServer.server.js.map +1 -1
- package/dist/custom/MJUserRoutineEntityServer.server.d.ts.map +1 -1
- package/dist/custom/MJUserRoutineEntityServer.server.js +8 -1
- package/dist/custom/MJUserRoutineEntityServer.server.js.map +1 -1
- package/dist/custom/RestrictedFieldCommentClassifier.d.ts +73 -0
- package/dist/custom/RestrictedFieldCommentClassifier.d.ts.map +1 -0
- package/dist/custom/RestrictedFieldCommentClassifier.js +240 -0
- package/dist/custom/RestrictedFieldCommentClassifier.js.map +1 -0
- package/dist/custom/query-extraction/childRowWriter.d.ts +77 -0
- package/dist/custom/query-extraction/childRowWriter.d.ts.map +1 -0
- package/dist/custom/query-extraction/childRowWriter.js +277 -0
- package/dist/custom/query-extraction/childRowWriter.js.map +1 -0
- package/dist/custom/query-extraction/compositionTargets.d.ts +40 -0
- package/dist/custom/query-extraction/compositionTargets.d.ts.map +1 -0
- package/dist/custom/query-extraction/compositionTargets.js +99 -0
- package/dist/custom/query-extraction/compositionTargets.js.map +1 -0
- package/dist/custom/query-extraction/declared.d.ts +79 -0
- package/dist/custom/query-extraction/declared.d.ts.map +1 -0
- package/dist/custom/query-extraction/declared.js +91 -0
- package/dist/custom/query-extraction/declared.js.map +1 -0
- package/dist/custom/query-extraction/describeFacts.d.ts +40 -0
- package/dist/custom/query-extraction/describeFacts.d.ts.map +1 -0
- package/dist/custom/query-extraction/describeFacts.js +225 -0
- package/dist/custom/query-extraction/describeFacts.js.map +1 -0
- package/dist/custom/query-extraction/descriptionPass.d.ts +23 -0
- package/dist/custom/query-extraction/descriptionPass.d.ts.map +1 -0
- package/dist/custom/query-extraction/descriptionPass.js +95 -0
- package/dist/custom/query-extraction/descriptionPass.js.map +1 -0
- package/dist/custom/query-extraction/extractQuery.d.ts +25 -0
- package/dist/custom/query-extraction/extractQuery.d.ts.map +1 -0
- package/dist/custom/query-extraction/extractQuery.js +146 -0
- package/dist/custom/query-extraction/extractQuery.js.map +1 -0
- package/dist/custom/query-extraction/extractionTypes.d.ts +133 -0
- package/dist/custom/query-extraction/extractionTypes.d.ts.map +1 -0
- package/dist/custom/query-extraction/extractionTypes.js +2 -0
- package/dist/custom/query-extraction/extractionTypes.js.map +1 -0
- package/dist/custom/query-extraction/index.d.ts +16 -0
- package/dist/custom/query-extraction/index.d.ts.map +1 -1
- package/dist/custom/query-extraction/index.js +11 -1
- package/dist/custom/query-extraction/index.js.map +1 -1
- package/dist/custom/query-extraction/pipeline.d.ts +6 -2
- package/dist/custom/query-extraction/pipeline.d.ts.map +1 -1
- package/dist/custom/query-extraction/pipeline.js +21 -14
- package/dist/custom/query-extraction/pipeline.js.map +1 -1
- package/dist/custom/query-extraction/resolve.d.ts +7 -2
- package/dist/custom/query-extraction/resolve.d.ts.map +1 -1
- package/dist/custom/query-extraction/resolve.js +17 -14
- package/dist/custom/query-extraction/resolve.js.map +1 -1
- package/dist/custom/query-extraction/sourceBinding.d.ts +57 -0
- package/dist/custom/query-extraction/sourceBinding.d.ts.map +1 -0
- package/dist/custom/query-extraction/sourceBinding.js +104 -0
- package/dist/custom/query-extraction/sourceBinding.js.map +1 -0
- package/dist/custom/query-extraction/sync.d.ts +27 -3
- package/dist/custom/query-extraction/sync.d.ts.map +1 -1
- package/dist/custom/query-extraction/sync.js +69 -44
- package/dist/custom/query-extraction/sync.js.map +1 -1
- package/dist/custom/query-extraction/templateFacts.d.ts +62 -0
- package/dist/custom/query-extraction/templateFacts.d.ts.map +1 -0
- package/dist/custom/query-extraction/templateFacts.js +229 -0
- package/dist/custom/query-extraction/templateFacts.js.map +1 -0
- package/dist/custom/query-extraction/types.d.ts +4 -0
- package/dist/custom/query-extraction/types.d.ts.map +1 -1
- package/dist/custom/query-refresh/QueryExtractionService.d.ts +54 -0
- package/dist/custom/query-refresh/QueryExtractionService.d.ts.map +1 -0
- package/dist/custom/query-refresh/QueryExtractionService.js +207 -0
- package/dist/custom/query-refresh/QueryExtractionService.js.map +1 -0
- package/dist/custom/query-refresh/QueryRefreshExtractionServerOperation.d.ts +28 -0
- package/dist/custom/query-refresh/QueryRefreshExtractionServerOperation.d.ts.map +1 -0
- package/dist/custom/query-refresh/QueryRefreshExtractionServerOperation.js +106 -0
- package/dist/custom/query-refresh/QueryRefreshExtractionServerOperation.js.map +1 -0
- package/dist/custom/query-refresh/index.d.ts +14 -0
- package/dist/custom/query-refresh/index.d.ts.map +1 -0
- package/dist/custom/query-refresh/index.js +10 -0
- package/dist/custom/query-refresh/index.js.map +1 -0
- package/dist/custom/query-refresh/queryRebind.d.ts +33 -0
- package/dist/custom/query-refresh/queryRebind.d.ts.map +1 -0
- package/dist/custom/query-refresh/queryRebind.js +85 -0
- package/dist/custom/query-refresh/queryRebind.js.map +1 -0
- package/dist/custom/query-refresh/refreshAuthorization.d.ts +29 -0
- package/dist/custom/query-refresh/refreshAuthorization.d.ts.map +1 -0
- package/dist/custom/query-refresh/refreshAuthorization.js +66 -0
- package/dist/custom/query-refresh/refreshAuthorization.js.map +1 -0
- package/dist/custom/query-refresh/refreshFormat.d.ts +16 -0
- package/dist/custom/query-refresh/refreshFormat.d.ts.map +1 -0
- package/dist/custom/query-refresh/refreshFormat.js +67 -0
- package/dist/custom/query-refresh/refreshFormat.js.map +1 -0
- package/dist/custom/query-refresh/refreshOrder.d.ts +25 -0
- package/dist/custom/query-refresh/refreshOrder.d.ts.map +1 -0
- package/dist/custom/query-refresh/refreshOrder.js +95 -0
- package/dist/custom/query-refresh/refreshOrder.js.map +1 -0
- package/dist/custom/query-refresh/refreshSelection.d.ts +15 -0
- package/dist/custom/query-refresh/refreshSelection.d.ts.map +1 -0
- package/dist/custom/query-refresh/refreshSelection.js +99 -0
- package/dist/custom/query-refresh/refreshSelection.js.map +1 -0
- package/dist/custom/query-refresh/refreshTypes.d.ts +81 -0
- package/dist/custom/query-refresh/refreshTypes.d.ts.map +1 -0
- package/dist/custom/query-refresh/refreshTypes.js +5 -0
- package/dist/custom/query-refresh/refreshTypes.js.map +1 -0
- package/dist/custom/util.d.ts +8 -0
- package/dist/custom/util.d.ts.map +1 -1
- package/dist/custom/util.js +18 -1
- package/dist/custom/util.js.map +1 -1
- package/dist/engines/QueryEngineServer.d.ts +8 -5
- package/dist/engines/QueryEngineServer.d.ts.map +1 -1
- package/dist/engines/QueryEngineServer.js +16 -23
- package/dist/engines/QueryEngineServer.js.map +1 -1
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -1
- package/package.json +30 -30
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { IMetadataProvider, IRunViewProvider, UserInfo } from "@memberjunction/core";
|
|
2
|
+
/** What the description pass works on. */
|
|
3
|
+
export interface DescriptionPassRequest {
|
|
4
|
+
readonly QueryID: string;
|
|
5
|
+
readonly QueryName: string;
|
|
6
|
+
/** The query's SQL, as the prompt reads it. */
|
|
7
|
+
readonly SQL: string;
|
|
8
|
+
readonly Provider: IMetadataProvider & IRunViewProvider;
|
|
9
|
+
/** The user the rows are written as. */
|
|
10
|
+
readonly User: UserInfo;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Asks the LLM for descriptions of the query's fields and parameters whose description is still
|
|
14
|
+
* empty, and writes only those descriptions. It never sets a name, type, source or any other fact,
|
|
15
|
+
* and never replaces a description that is already there (authored, from a doc comment, or
|
|
16
|
+
* written earlier).
|
|
17
|
+
*
|
|
18
|
+
* Meant to run after the save's transaction commits (`RunAfterCommit`), so no LLM call is made
|
|
19
|
+
* while a transaction is open. A failure is recorded on the query: `ExtractionMessage` gets the
|
|
20
|
+
* reason and an `OK` status becomes `Warning`. Never throws.
|
|
21
|
+
*/
|
|
22
|
+
export declare function RunDescriptionPass(request: DescriptionPassRequest): Promise<void>;
|
|
23
|
+
//# sourceMappingURL=descriptionPass.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"descriptionPass.d.ts","sourceRoot":"","sources":["../../../src/custom/query-extraction/descriptionPass.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAc,iBAAiB,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAmBtG,0CAA0C;AAC1C,MAAM,WAAW,sBAAsB;IACnC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,+CAA+C;IAC/C,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,QAAQ,EAAE,iBAAiB,GAAG,gBAAgB,CAAC;IACxD,wCAAwC;IACxC,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;CAC3B;AAED;;;;;;;;;GASG;AACH,wBAAsB,kBAAkB,CAAC,OAAO,EAAE,sBAAsB,GAAG,OAAO,CAAC,IAAI,CAAC,CAWvF"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { AIEngine } from "@memberjunction/aiengine";
|
|
2
|
+
import { AIPromptRunner } from "@memberjunction/ai-prompts";
|
|
3
|
+
import { AIPromptParams } from "@memberjunction/ai-core-plus";
|
|
4
|
+
import { LogError, RunMaybeSerial } from "@memberjunction/core";
|
|
5
|
+
import { EscapeSQLString } from "@memberjunction/global";
|
|
6
|
+
const PROMPT_NAME = 'SQL Query Parameter Extraction';
|
|
7
|
+
const PROMPT_CATEGORY = 'MJ: System';
|
|
8
|
+
/**
|
|
9
|
+
* Asks the LLM for descriptions of the query's fields and parameters whose description is still
|
|
10
|
+
* empty, and writes only those descriptions. It never sets a name, type, source or any other fact,
|
|
11
|
+
* and never replaces a description that is already there (authored, from a doc comment, or
|
|
12
|
+
* written earlier).
|
|
13
|
+
*
|
|
14
|
+
* Meant to run after the save's transaction commits (`RunAfterCommit`), so no LLM call is made
|
|
15
|
+
* while a transaction is open. A failure is recorded on the query: `ExtractionMessage` gets the
|
|
16
|
+
* reason and an `OK` status becomes `Warning`. Never throws.
|
|
17
|
+
*/
|
|
18
|
+
export async function RunDescriptionPass(request) {
|
|
19
|
+
try {
|
|
20
|
+
const [fields, parameters] = await loadUndescribedRows(request);
|
|
21
|
+
if (fields.length === 0 && parameters.length === 0)
|
|
22
|
+
return;
|
|
23
|
+
const described = await askForDescriptions(request, fields, parameters);
|
|
24
|
+
const writes = [...applyDescriptions(fields, described.fields), ...applyDescriptions(parameters, described.parameters)];
|
|
25
|
+
const outcomes = await RunMaybeSerial(request.Provider, writes);
|
|
26
|
+
if (outcomes.some(ok => !ok))
|
|
27
|
+
throw new Error('some descriptions could not be saved');
|
|
28
|
+
}
|
|
29
|
+
catch (e) {
|
|
30
|
+
await recordFailure(request, e instanceof Error ? e.message : String(e));
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
/** The field and parameter rows whose description is empty, read from the database. */
|
|
34
|
+
async function loadUndescribedRows(request) {
|
|
35
|
+
const filter = `QueryID='${EscapeSQLString(request.QueryID)}' AND (Description IS NULL OR Description = '')`;
|
|
36
|
+
const load = async (entityName) => {
|
|
37
|
+
const result = await request.Provider.RunView({ EntityName: entityName, ExtraFilter: filter, ResultType: 'entity_object', BypassCache: true, IgnoreMaxRows: true }, request.User);
|
|
38
|
+
if (!result.Success)
|
|
39
|
+
throw new Error(`could not read the ${entityName}: ${result.ErrorMessage}`);
|
|
40
|
+
return result.Results ?? [];
|
|
41
|
+
};
|
|
42
|
+
return Promise.all([load('MJ: Query Fields'), load('MJ: Query Parameters')]);
|
|
43
|
+
}
|
|
44
|
+
async function askForDescriptions(request, fields, parameters) {
|
|
45
|
+
await AIEngine.Instance.Config(false, request.User, request.Provider);
|
|
46
|
+
const prompt = AIEngine.Instance.Prompts.find(p => p.Name === PROMPT_NAME && p.Category === PROMPT_CATEGORY);
|
|
47
|
+
if (!prompt)
|
|
48
|
+
throw new Error(`the prompt "${PROMPT_NAME}" was not found`);
|
|
49
|
+
const params = new AIPromptParams();
|
|
50
|
+
params.prompt = prompt;
|
|
51
|
+
params.contextUser = request.User;
|
|
52
|
+
params.data = {
|
|
53
|
+
templateText: request.SQL,
|
|
54
|
+
fields: fields.map(f => ({ name: f.Name, type: f.SQLFullType, source: f.SourceEntityField ?? f.SourceObjectName ?? null, isComputed: f.IsComputed })),
|
|
55
|
+
parameters: parameters.map(p => ({ name: p.Name, type: p.Type, isRequired: p.IsRequired === true })),
|
|
56
|
+
};
|
|
57
|
+
const result = await new AIPromptRunner().ExecutePrompt(params);
|
|
58
|
+
if (!result.success || !result.result)
|
|
59
|
+
throw new Error(result.errorMessage || 'the prompt returned no result');
|
|
60
|
+
return result.result;
|
|
61
|
+
}
|
|
62
|
+
/** Writes for the rows the result describes; a row whose description was filled meanwhile is left alone. */
|
|
63
|
+
function applyDescriptions(rows, described) {
|
|
64
|
+
const byName = new Map((described ?? []).filter(d => typeof d?.description === 'string' && d.description.trim()).map(d => [String(d.name).toLowerCase(), d.description.trim()]));
|
|
65
|
+
const writes = [];
|
|
66
|
+
for (const row of rows) {
|
|
67
|
+
const description = byName.get(row.Name.toLowerCase());
|
|
68
|
+
if (!description)
|
|
69
|
+
continue;
|
|
70
|
+
row.Description = description;
|
|
71
|
+
if ('SQLFullType' in row && row.DetectionMethod === 'Database')
|
|
72
|
+
row.DetectionMethod = 'AI';
|
|
73
|
+
writes.push(() => row.Save());
|
|
74
|
+
}
|
|
75
|
+
return writes;
|
|
76
|
+
}
|
|
77
|
+
/** Records a failed pass on the query: the reason in `ExtractionMessage`, and `OK` raised to `Warning`. */
|
|
78
|
+
async function recordFailure(request, reason) {
|
|
79
|
+
try {
|
|
80
|
+
const query = await request.Provider.GetEntityObject('MJ: Queries', request.User);
|
|
81
|
+
if (!await query.Load(request.QueryID))
|
|
82
|
+
return;
|
|
83
|
+
const line = `The LLM description pass failed: ${reason.trim().replace(/\.+$/, '')}. Empty descriptions were left empty.`;
|
|
84
|
+
query.ExtractionMessage = query.ExtractionMessage ? `${query.ExtractionMessage}\n${line}` : line;
|
|
85
|
+
if (query.ExtractionStatus === 'OK' || query.ExtractionStatus === null)
|
|
86
|
+
query.ExtractionStatus = 'Warning';
|
|
87
|
+
if (!await query.Save({ SkipEntityAIActions: true })) {
|
|
88
|
+
LogError(`[QueryExtraction] Could not record the description-pass failure on query "${request.QueryName}": ${query.LatestResult?.CompleteMessage}`);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
catch (e) {
|
|
92
|
+
LogError(`[QueryExtraction] Could not record the description-pass failure on query "${request.QueryName}": ${e instanceof Error ? e.message : String(e)}`);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
//# sourceMappingURL=descriptionPass.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"descriptionPass.js","sourceRoot":"","sources":["../../../src/custom/query-extraction/descriptionPass.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAGhE,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEzD,MAAM,WAAW,GAAG,gCAAgC,CAAC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AAE,eAAe,EAAE,CAAC,CAAC;QACxJ,CAAC;IACL,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACT,QAAQ,CAAC,6EAA6E,OAAO,CAAC,SAAS,MAAM,CAAC,YAAY,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;IAC/J,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { DatabasePlatform } from "@memberjunction/core";
|
|
2
|
+
import type { QueryExtractionInput, QueryExtractionResult } from "./extractionTypes.js";
|
|
3
|
+
/**
|
|
4
|
+
* Establishes a query's facts from its SQL and the database server, without writing anything:
|
|
5
|
+
*
|
|
6
|
+
* - from MJ's parser: whether it is a template, its parameters (with composition pass-throughs),
|
|
7
|
+
* its compositions, the entities it reads, its doc comments and the save-time rules;
|
|
8
|
+
* - from the server: its output columns (name, order, exact type, nullability, source), for the
|
|
9
|
+
* base render and every branch render, mapped through MJ metadata.
|
|
10
|
+
*
|
|
11
|
+
* In `Save` mode a save-time rule error or a repeated output name refuses the save
|
|
12
|
+
* (`Refusal`); in `Refresh` mode they are recorded with status `Error`. An external-data-source
|
|
13
|
+
* query is not described (`Skipped`); a describe failure keeps the stored fields (`Error`). A
|
|
14
|
+
* query that reads a table named by a template parameter is not described either: its output
|
|
15
|
+
* depends on the arguments, so its stored (declared) fields are kept and a note says why.
|
|
16
|
+
*/
|
|
17
|
+
export declare function ComputeQueryExtraction(input: QueryExtractionInput): Promise<QueryExtractionResult>;
|
|
18
|
+
/** Why the fields of a query that reads a parameter-named table are not taken from a describe. */
|
|
19
|
+
export declare const PARAMETER_NAMED_SOURCE_NOTE: string;
|
|
20
|
+
/**
|
|
21
|
+
* The hash of the SQL the child rows are extracted from: SHA-256 (hex) of the dialect key and
|
|
22
|
+
* the platform SQL, so the same text on another platform hashes differently.
|
|
23
|
+
*/
|
|
24
|
+
export declare function ExtractionSQLHash(sql: string, platform: DatabasePlatform): string;
|
|
25
|
+
//# sourceMappingURL=extractQuery.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extractQuery.d.ts","sourceRoot":"","sources":["../../../src/custom/query-extraction/extractQuery.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAO7D,OAAO,KAAK,EACR,oBAAoB,EACpB,qBAAqB,EAGxB,MAAM,mBAAmB,CAAC;AAS3B;;;;;;;;;;;;;GAaG;AACH,wBAAsB,sBAAsB,CAAC,KAAK,EAAE,oBAAoB,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAsBxG;AAED,kGAAkG;AAClG,eAAO,MAAM,2BAA2B,QAC4E,CAAC;AAErH;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,gBAAgB,GAAG,MAAM,CAEjF"}
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
import { AnalyzeQueryTemplate, DescribeDiagnostic } from "./templateFacts.js";
|
|
3
|
+
import { DescribeQueryOutput, FindUnsafeRender } from "./describeFacts.js";
|
|
4
|
+
import { BindColumnSource, EntityObjectIndex } from "./sourceBinding.js";
|
|
5
|
+
/**
|
|
6
|
+
* Establishes a query's facts from its SQL and the database server, without writing anything:
|
|
7
|
+
*
|
|
8
|
+
* - from MJ's parser: whether it is a template, its parameters (with composition pass-throughs),
|
|
9
|
+
* its compositions, the entities it reads, its doc comments and the save-time rules;
|
|
10
|
+
* - from the server: its output columns (name, order, exact type, nullability, source), for the
|
|
11
|
+
* base render and every branch render, mapped through MJ metadata.
|
|
12
|
+
*
|
|
13
|
+
* In `Save` mode a save-time rule error or a repeated output name refuses the save
|
|
14
|
+
* (`Refusal`); in `Refresh` mode they are recorded with status `Error`. An external-data-source
|
|
15
|
+
* query is not described (`Skipped`); a describe failure keeps the stored fields (`Error`). A
|
|
16
|
+
* query that reads a table named by a template parameter is not described either: its output
|
|
17
|
+
* depends on the arguments, so its stored (declared) fields are kept and a note says why.
|
|
18
|
+
*/
|
|
19
|
+
export async function ComputeQueryExtraction(input) {
|
|
20
|
+
const analysis = AnalyzeQueryTemplate(input);
|
|
21
|
+
const findings = { Errors: [], Warnings: [], Notes: [] };
|
|
22
|
+
const refusal = saveRefusal(input, analysis.Errors.map(d => DescribeDiagnostic(d, input.SQL)), analysis.DuplicateOutputNames);
|
|
23
|
+
if (refusal)
|
|
24
|
+
return resultOf(input, analysis, null, findings, refusal);
|
|
25
|
+
recordAnalysis(input, analysis, findings);
|
|
26
|
+
const unsafe = input.IsExternal ? null : FindUnsafeRender(input, analysis.Template, analysis.Parameters);
|
|
27
|
+
if (unsafe !== null)
|
|
28
|
+
return unsafeResult(input, analysis, findings, unsafe);
|
|
29
|
+
if (input.IsExternal) {
|
|
30
|
+
return { ...resultOf(input, analysis, null, findings, null), Entities: null, Status: 'Skipped',
|
|
31
|
+
Messages: ['The query reads an external data source, which the database server cannot describe; its fields and entities were left as they are.', ...messagesOf(findings)] };
|
|
32
|
+
}
|
|
33
|
+
if (analysis.ReadsParameterNamedSource) {
|
|
34
|
+
findings.Notes.push(PARAMETER_NAMED_SOURCE_NOTE);
|
|
35
|
+
return resultOf(input, analysis, null, findings, null);
|
|
36
|
+
}
|
|
37
|
+
const output = await DescribeQueryOutput(input, analysis.Template, analysis.Parameters);
|
|
38
|
+
const outputRefusal = saveRefusal(input, [], output.DuplicateNames);
|
|
39
|
+
if (outputRefusal)
|
|
40
|
+
return resultOf(input, analysis, null, findings, outputRefusal);
|
|
41
|
+
recordOutput(output, analysis, findings);
|
|
42
|
+
const fields = output.Failure === null ? fieldFacts(output.Columns, analysis, input, findings) : null;
|
|
43
|
+
return resultOf(input, analysis, fields, findings, null);
|
|
44
|
+
}
|
|
45
|
+
/** Why the fields of a query that reads a parameter-named table are not taken from a describe. */
|
|
46
|
+
export const PARAMETER_NAMED_SOURCE_NOTE = 'The query reads a table or view named by a template parameter, so its output columns depend on the arguments ' +
|
|
47
|
+
'and no sample render describes them; its fields were left as they are (declare them in the query\'s metadata).';
|
|
48
|
+
/**
|
|
49
|
+
* The hash of the SQL the child rows are extracted from: SHA-256 (hex) of the dialect key and
|
|
50
|
+
* the platform SQL, so the same text on another platform hashes differently.
|
|
51
|
+
*/
|
|
52
|
+
export function ExtractionSQLHash(sql, platform) {
|
|
53
|
+
return createHash('sha256').update(`${platform}\n${sql}`).digest('hex');
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* A query a render of which may not run: a new or edited one is refused; a refresh records the
|
|
57
|
+
* reason as an error and keeps the stored fields. Nothing is described, so the database server is
|
|
58
|
+
* never handed the statement.
|
|
59
|
+
*/
|
|
60
|
+
function unsafeResult(input, analysis, findings, reason) {
|
|
61
|
+
const refusal = saveRefusal(input, [reason], []);
|
|
62
|
+
if (refusal)
|
|
63
|
+
return resultOf(input, analysis, null, findings, refusal);
|
|
64
|
+
findings.Errors.push(`${reason} The stored fields were left as they are.`);
|
|
65
|
+
return resultOf(input, analysis, null, findings, null);
|
|
66
|
+
}
|
|
67
|
+
/** Why a new or edited query must be refused; `null` when it may be saved or this is a refresh. */
|
|
68
|
+
function saveRefusal(input, errors, duplicates) {
|
|
69
|
+
const reasons = [...errors];
|
|
70
|
+
if (duplicates.length > 0)
|
|
71
|
+
reasons.push(duplicateMessage(duplicates));
|
|
72
|
+
if (input.Mode !== 'Save' || reasons.length === 0)
|
|
73
|
+
return null;
|
|
74
|
+
return `Query "${input.QueryName}" was not saved:\n${reasons.join('\n')}`;
|
|
75
|
+
}
|
|
76
|
+
function duplicateMessage(duplicates) {
|
|
77
|
+
return `The query returns more than one column named ${duplicates.map(d => `"${d}"`).join(', ')} (names compare without case). ` +
|
|
78
|
+
'Give each output column its own name, for example with an alias.';
|
|
79
|
+
}
|
|
80
|
+
/** Records what the template analysis found: refresh-mode rule errors, warnings, unread facts, orphaned authored parameters. */
|
|
81
|
+
function recordAnalysis(input, analysis, findings) {
|
|
82
|
+
findings.Errors.push(...analysis.Errors.map(d => DescribeDiagnostic(d, input.SQL)));
|
|
83
|
+
if (analysis.DuplicateOutputNames.length > 0)
|
|
84
|
+
findings.Errors.push(duplicateMessage(analysis.DuplicateOutputNames));
|
|
85
|
+
findings.Warnings.push(...analysis.Warnings.map(d => DescribeDiagnostic(d, input.SQL)), ...analysis.Notes);
|
|
86
|
+
const used = new Set(analysis.Parameters.map(p => p.Name.toLowerCase()));
|
|
87
|
+
for (const known of input.KnownParameters) {
|
|
88
|
+
if (known.IsAuthored && !used.has(known.Name.toLowerCase())) {
|
|
89
|
+
findings.Warnings.push(`The authored parameter "${known.Name}" is not used by the SQL. It is kept, and a value passed for it is accepted and ignored.`);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
/** Records the describe outcome: a failure, refresh-mode duplicates the parser did not already report, branch-only columns. */
|
|
94
|
+
function recordOutput(output, analysis, findings) {
|
|
95
|
+
if (output.Failure !== null)
|
|
96
|
+
findings.Errors.push(`${output.Failure.trim().replace(/[.;]?$/, '.')} The stored fields were left as they are.`);
|
|
97
|
+
const reported = new Set(analysis.DuplicateOutputNames.map(n => n.toLowerCase()));
|
|
98
|
+
const duplicates = output.DuplicateNames.filter(n => !reported.has(n.toLowerCase()));
|
|
99
|
+
if (duplicates.length > 0)
|
|
100
|
+
findings.Errors.push(duplicateMessage(duplicates));
|
|
101
|
+
if (output.BranchOnlyColumns.length > 0) {
|
|
102
|
+
findings.Notes.push(`Columns only some branches of the template return: ${output.BranchOnlyColumns.join(', ')}.`);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
/** The field facts of the described output, in order; unnamed columns are skipped and reported. */
|
|
106
|
+
function fieldFacts(columns, analysis, input, findings) {
|
|
107
|
+
const index = new EntityObjectIndex(input.Entities);
|
|
108
|
+
const facts = [];
|
|
109
|
+
for (const column of columns) {
|
|
110
|
+
if (column.Name.trim().length === 0) {
|
|
111
|
+
findings.Warnings.push(`Output column ${column.Ordinal} has no name, so it has no field row. Give it an alias.`);
|
|
112
|
+
continue;
|
|
113
|
+
}
|
|
114
|
+
const source = BindColumnSource(column.Source, index);
|
|
115
|
+
facts.push({
|
|
116
|
+
Name: column.Name, Sequence: facts.length + 1, SQLBaseType: column.SQLBaseType, SQLFullType: column.SQLFullType,
|
|
117
|
+
IsNullable: column.IsNullable, IsComputed: column.IsComputed,
|
|
118
|
+
SourceEntityID: source.SourceEntityID, SourceEntityFieldID: source.SourceEntityFieldID,
|
|
119
|
+
SourceFieldName: source.SourceFieldName, SourceObjectName: source.SourceObjectName,
|
|
120
|
+
DocDescription: analysis.FieldDocs.get(column.Name.toLowerCase()) ?? null, SourceDescription: source.SourceDescription,
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
return facts;
|
|
124
|
+
}
|
|
125
|
+
function resultOf(input, analysis, fields, findings, refusal) {
|
|
126
|
+
return {
|
|
127
|
+
UsesTemplate: analysis.UsesTemplate,
|
|
128
|
+
Refusal: refusal,
|
|
129
|
+
Status: statusOf(findings),
|
|
130
|
+
Messages: messagesOf(findings),
|
|
131
|
+
Hash: ExtractionSQLHash(input.SQL, input.Platform),
|
|
132
|
+
Fields: fields,
|
|
133
|
+
Parameters: analysis.Parameters,
|
|
134
|
+
Entities: analysis.Entities,
|
|
135
|
+
Dependencies: analysis.Dependencies,
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
function statusOf(findings) {
|
|
139
|
+
if (findings.Errors.length > 0)
|
|
140
|
+
return 'Error';
|
|
141
|
+
return findings.Warnings.length > 0 ? 'Warning' : 'OK';
|
|
142
|
+
}
|
|
143
|
+
function messagesOf(findings) {
|
|
144
|
+
return [...findings.Errors, ...findings.Warnings, ...findings.Notes];
|
|
145
|
+
}
|
|
146
|
+
//# sourceMappingURL=extractQuery.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,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C3B,YAAY,EAAE,QAAQ,CAAC,YAAY;KACtC,CAAC;AACN,CAAC;AAED,SAAS,QAAQ,CAAC,QAAkB;IAChC,IAAI,QAAQ,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC;QAAE,OAAO,OAAO,CAAC;IAC/C,OAAO,QAAQ,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC;AAC3D,CAAC;AAED,SAAS,UAAU,CAAC,QAAkB;IAClC,OAAO,CAAC,GAAG,QAAQ,CAAC,MAAM,EAAE,GAAG,QAAQ,CAAC,QAAQ,EAAE,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;AACzE,CAAC"}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import type { DatabasePlatform, EntityInfo, QueryDependencySpec, UserInfo } from "@memberjunction/core";
|
|
2
|
+
import type { CompositionCandidate } from "./compositionTargets.js";
|
|
3
|
+
import type { DescribeStatementResult } from "@memberjunction/generic-database-provider";
|
|
4
|
+
/**
|
|
5
|
+
* What a query save does about extraction, set per save on the query entity
|
|
6
|
+
* (`MJQueryEntityServer.ExtractionOverride`).
|
|
7
|
+
*
|
|
8
|
+
* - `Auto`: extract when the query is new or its SQL changed.
|
|
9
|
+
* - `Skip`: do not extract on this save, even when the SQL changed. The save-time rules are not
|
|
10
|
+
* applied; the stored child rows, the Extraction columns and `UsesTemplate` stay as they are.
|
|
11
|
+
* - `Force`: extract on this save even when the SQL did not change (a refresh).
|
|
12
|
+
*/
|
|
13
|
+
export type QueryExtractionOverride = 'Auto' | 'Skip' | 'Force';
|
|
14
|
+
/** The outcome of an extraction run, as stored in `MJ: Queries.ExtractionStatus`. */
|
|
15
|
+
export type QueryExtractionStatus = 'OK' | 'Warning' | 'Error' | 'Skipped';
|
|
16
|
+
/**
|
|
17
|
+
* Which save-time rules apply: `Save` for a new or edited query (errors refuse the save),
|
|
18
|
+
* `Refresh` for re-extracting a query whose SQL did not change (errors are recorded, never refused).
|
|
19
|
+
*/
|
|
20
|
+
export type QueryExtractionMode = 'Save' | 'Refresh';
|
|
21
|
+
/** A parameter type the `MJ: Query Parameters` table stores. */
|
|
22
|
+
export type QueryParameterType = 'string' | 'number' | 'date' | 'boolean' | 'array';
|
|
23
|
+
/**
|
|
24
|
+
* A parameter row extraction knows about before it runs: a row the save declares, or a row
|
|
25
|
+
* already stored. Its type, sample and server-set flag drive the renders that are described.
|
|
26
|
+
*/
|
|
27
|
+
export interface KnownQueryParameter {
|
|
28
|
+
readonly Name: string;
|
|
29
|
+
readonly Type: QueryParameterType;
|
|
30
|
+
readonly IsRequired: boolean;
|
|
31
|
+
readonly IsServerSet: boolean;
|
|
32
|
+
readonly SampleValue: string | null;
|
|
33
|
+
readonly DefaultValue: string | null;
|
|
34
|
+
readonly ValidationFilters: string | null;
|
|
35
|
+
/** Whether a person wrote the row (`DetectionMethod` `Manual`). */
|
|
36
|
+
readonly IsAuthored: boolean;
|
|
37
|
+
}
|
|
38
|
+
/** Everything one extraction run reads. Independent of the entity object, so it can be tested alone. */
|
|
39
|
+
export interface QueryExtractionInput {
|
|
40
|
+
/** The query's ID; `null` for a query not saved yet. */
|
|
41
|
+
readonly QueryID: string | null;
|
|
42
|
+
readonly QueryName: string;
|
|
43
|
+
/** The query's full path (category path and name), for composition cycle detection. */
|
|
44
|
+
readonly QueryPath: string;
|
|
45
|
+
/** The SQL to extract from: the query's SQL for the platform described on. */
|
|
46
|
+
readonly SQL: string;
|
|
47
|
+
/** The platform the SQL is rendered for and described on. */
|
|
48
|
+
readonly Platform: DatabasePlatform;
|
|
49
|
+
readonly Mode: QueryExtractionMode;
|
|
50
|
+
/** Whether the query reads an external data source, which the database server cannot describe. */
|
|
51
|
+
readonly IsExternal: boolean;
|
|
52
|
+
readonly KnownParameters: readonly KnownQueryParameter[];
|
|
53
|
+
/** Tested sample values a caller supplied (`ParameterHints`), by parameter name. */
|
|
54
|
+
readonly ParameterHints?: ReadonlyMap<string, string>;
|
|
55
|
+
/** The user the renders are made for (composed queries must be runnable by them). */
|
|
56
|
+
readonly ContextUser: UserInfo;
|
|
57
|
+
/** The entity catalog sources and table references are mapped through. */
|
|
58
|
+
readonly Entities: readonly EntityInfo[];
|
|
59
|
+
/** The saved queries compositions resolve against. */
|
|
60
|
+
readonly Queries: readonly CompositionCandidate[];
|
|
61
|
+
/**
|
|
62
|
+
* Render specs for composed queries the shared query cache does not hold yet (saved earlier in
|
|
63
|
+
* the same transaction), searched before the cache when the describe renders compose them.
|
|
64
|
+
*/
|
|
65
|
+
readonly CompositionDependencies?: readonly QueryDependencySpec[];
|
|
66
|
+
/** Describes a rendered statement on the database server; `null` when the provider cannot. */
|
|
67
|
+
readonly Describe: ((sql: string) => Promise<DescribeStatementResult>) | null;
|
|
68
|
+
}
|
|
69
|
+
/** The facts of one output column: what the server reports, mapped through MJ metadata. */
|
|
70
|
+
export interface QueryFieldFact {
|
|
71
|
+
readonly Name: string;
|
|
72
|
+
readonly Sequence: number;
|
|
73
|
+
readonly SQLBaseType: string;
|
|
74
|
+
readonly SQLFullType: string;
|
|
75
|
+
readonly IsNullable: boolean | null;
|
|
76
|
+
readonly IsComputed: boolean;
|
|
77
|
+
readonly SourceEntityID: string | null;
|
|
78
|
+
readonly SourceEntityFieldID: string | null;
|
|
79
|
+
readonly SourceFieldName: string | null;
|
|
80
|
+
readonly SourceObjectName: string | null;
|
|
81
|
+
/** A doc-comment description: an authored annotation. */
|
|
82
|
+
readonly DocDescription: string | null;
|
|
83
|
+
/** The source entity field's description, used for a new row with no other description. */
|
|
84
|
+
readonly SourceDescription: string | null;
|
|
85
|
+
}
|
|
86
|
+
/** The facts of one parameter the template reads. */
|
|
87
|
+
export interface QueryParameterFact {
|
|
88
|
+
readonly Name: string;
|
|
89
|
+
/** The type the template's filters imply; `null` when they imply none. */
|
|
90
|
+
readonly Type: QueryParameterType | null;
|
|
91
|
+
readonly IsRequired: boolean;
|
|
92
|
+
readonly DefaultValue: string | null;
|
|
93
|
+
/** A sample for a new row: the caller's hint, or the value a composed query's parameter has. */
|
|
94
|
+
readonly SampleValue: string | null;
|
|
95
|
+
/** A doc-comment description: an authored annotation. */
|
|
96
|
+
readonly DocDescription: string | null;
|
|
97
|
+
/** A description inherited from the composed query's parameter this one is passed to. */
|
|
98
|
+
readonly InheritedDescription: string | null;
|
|
99
|
+
}
|
|
100
|
+
/** An entity the query reads, through its base view, base table or an alternate base view. */
|
|
101
|
+
export interface QueryEntityFact {
|
|
102
|
+
readonly EntityID: string;
|
|
103
|
+
readonly AlternateBaseViewID: string | null;
|
|
104
|
+
}
|
|
105
|
+
/** A query this query composes. */
|
|
106
|
+
export interface QueryDependencyFact {
|
|
107
|
+
readonly DependsOnQueryID: string;
|
|
108
|
+
/** The full path as the composition writes it. */
|
|
109
|
+
readonly ReferencePath: string;
|
|
110
|
+
readonly Alias: string | null;
|
|
111
|
+
/** The arguments, as JSON (`{"Region":"@Region","Year":"2024"}`), or `null` when there are none. */
|
|
112
|
+
readonly ParameterMapping: string | null;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* The result of one extraction run. A `null` collection means its facts could not be established
|
|
116
|
+
* (a describe failure, an external source, SQL that could not be read): its stored rows are kept.
|
|
117
|
+
*/
|
|
118
|
+
export interface QueryExtractionResult {
|
|
119
|
+
/** Whether the SQL holds any template tag outside SQL comments: a lexer fact. */
|
|
120
|
+
readonly UsesTemplate: boolean;
|
|
121
|
+
/** Set when the save must be refused (save-time rule errors, duplicate output names); the reason. */
|
|
122
|
+
readonly Refusal: string | null;
|
|
123
|
+
readonly Status: QueryExtractionStatus;
|
|
124
|
+
/** Diagnostics for `ExtractionMessage`, one per line. */
|
|
125
|
+
readonly Messages: readonly string[];
|
|
126
|
+
/** SHA-256 of the platform SQL and the dialect key. */
|
|
127
|
+
readonly Hash: string;
|
|
128
|
+
readonly Fields: readonly QueryFieldFact[] | null;
|
|
129
|
+
readonly Parameters: readonly QueryParameterFact[];
|
|
130
|
+
readonly Entities: readonly QueryEntityFact[] | null;
|
|
131
|
+
readonly Dependencies: readonly QueryDependencyFact[] | null;
|
|
132
|
+
}
|
|
133
|
+
//# sourceMappingURL=extractionTypes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extractionTypes.d.ts","sourceRoot":"","sources":["../../../src/custom/query-extraction/extractionTypes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,UAAU,EAAE,mBAAmB,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AACxG,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AACjE,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,2CAA2C,CAAC;AAEzF;;;;;;;;GAQG;AACH,MAAM,MAAM,uBAAuB,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;AAEhE,qFAAqF;AACrF,MAAM,MAAM,qBAAqB,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,CAAC;AAE3E;;;GAGG;AACH,MAAM,MAAM,mBAAmB,GAAG,MAAM,GAAG,SAAS,CAAC;AAErD,gEAAgE;AAChE,MAAM,MAAM,kBAAkB,GAAG,QAAQ,GAAG,QAAQ,GAAG,MAAM,GAAG,SAAS,GAAG,OAAO,CAAC;AAEpF;;;GAGG;AACH,MAAM,WAAW,mBAAmB;IAChC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,kBAAkB,CAAC;IAClC,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC;IAC7B,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC;IAC9B,QAAQ,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IACpC,QAAQ,CAAC,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IACrC,QAAQ,CAAC,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1C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AAE,MAAM,CAAC;IAClC,kDAAkD;IAClD,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,oGAAoG;IACpG,QAAQ,CAAC,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5C;AAED;;;GAGG;AACH,MAAM,WAAW,qBAAqB;IAClC,iFAAiF;IACjF,QAAQ,CAAC,YAAY,EAAE,OAAO,CAAC;IAC/B,qGAAqG;IACrG,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,QAAQ,CAAC,MAAM,EAAE,qBAAqB,CAAC;IACvC,yDAAyD;IACzD,QAAQ,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC;IACrC,uDAAuD;IACvD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,SAAS,cAAc,EAAE,GAAG,IAAI,CAAC;IAClD,QAAQ,CAAC,UAAU,EAAE,SAAS,kBAAkB,EAAE,CAAC;IACnD,QAAQ,CAAC,QAAQ,EAAE,SAAS,eAAe,EAAE,GAAG,IAAI,CAAC;IACrD,QAAQ,CAAC,YAAY,EAAE,SAAS,mBAAmB,EAAE,GAAG,IAAI,CAAC;CAChE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extractionTypes.js","sourceRoot":"","sources":["../../../src/custom/query-extraction/extractionTypes.ts"],"names":[],"mappings":""}
|
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
export { ComputeQueryExtraction, ExtractionSQLHash } from "./extractQuery.js";
|
|
2
|
+
export { WriteExtractedChildRows, ApplyFieldFacts } from "./childRowWriter.js";
|
|
3
|
+
export type { ChildRowWriteContext, ChildRowWriteSummary, ChildRowChange, QueryChildCollection } from "./childRowWriter.js";
|
|
4
|
+
export { RunDescriptionPass } from "./descriptionPass.js";
|
|
5
|
+
export type { DescriptionPassRequest } from "./descriptionPass.js";
|
|
6
|
+
export { AnalyzeQueryTemplate, SQLUsesTemplate, DescribeDiagnostic } from "./templateFacts.js";
|
|
7
|
+
export { ReadCompositionTargetsAsync, MergeCompositionCandidates } from "./compositionTargets.js";
|
|
8
|
+
export type { CompositionCandidate, CompositionCandidateParameter, CompositionTargetRead } from "./compositionTargets.js";
|
|
9
|
+
export type { TemplateAnalysis } from "./templateFacts.js";
|
|
10
|
+
export { DescribeQueryOutput, SampleValueFor } from "./describeFacts.js";
|
|
11
|
+
export type { DescribedOutput } from "./describeFacts.js";
|
|
12
|
+
export { EntityObjectIndex, BindColumnSource, BindTableReferences } from "./sourceBinding.js";
|
|
13
|
+
export type { BoundColumnSource } from "./sourceBinding.js";
|
|
14
|
+
export type { QueryExtractionOverride, QueryExtractionStatus, QueryExtractionMode, QueryParameterType, KnownQueryParameter, QueryExtractionInput, QueryFieldFact, QueryParameterFact, QueryEntityFact, QueryDependencyFact, QueryExtractionResult, } from "./extractionTypes.js";
|
|
1
15
|
export { RunExtractionPipeline, CleanupQueryData } from "./pipeline.js";
|
|
2
16
|
export type { PipelineResult } from "./pipeline.js";
|
|
3
17
|
export type { ExtractedParameter, ExtractedField, ParameterExtractionResult, PassthroughParamContext, ResolvedCompositionReference, EntityMetadataEntry, ParseResult, ResolveResult, QuerySyncContext, } from "./types.js";
|
|
@@ -5,5 +19,7 @@ export { ParseQuerySQL, parseQuerySQL } from "./parse.js";
|
|
|
5
19
|
export { ResolveCompositionReferences, ResolveQueryByNameAndCategory, BuildParameterMappings, ExtractAliasFromSQL, BuildPassthroughParams, MergePassthroughParams, MapQueryParamTypeToParserType, BuildFieldsForSelectStar, EnrichFieldTypesFromCompositions, EnrichFieldTypesFromEntityMetadata, ExpandWildcardFields, ExtractEntityMetadataFromSQL, DetectDependencyCycles, FindEntityByName, } from "./resolve.js";
|
|
6
20
|
export { RunLLMEnrichment, MergeParametersWithLLM, GenerateParameterDescription, BuildPassthroughDescription, GenerateSampleValue, } from "./enrich.js";
|
|
7
21
|
export { SyncParameters, SyncFields, SyncEntities, SyncDependencies, RemoveAllRecords } from "./sync.js";
|
|
22
|
+
export { CollectDeclaredQueryChildren, HasDeclaredQueryChildren, FindReplacedRows, QueueReplacedRowDeletion, QueryChildNameKey, QueryEntityKey, NO_DECLARED_QUERY_CHILDREN, } from "./declared.js";
|
|
23
|
+
export type { DeclaredQueryChildren, DeclaredQueryCollections } from "./declared.js";
|
|
8
24
|
export { ConvertTSQLToPostgreSQL } from "./dialect.js";
|
|
9
25
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/custom/query-extraction/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AACrE,YAAY,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAGjD,YAAY,EACR,kBAAkB,EAClB,cAAc,EACd,yBAAyB,EACzB,uBAAuB,EACvB,4BAA4B,EAC5B,mBAAmB,EACnB,WAAW,EACX,aAAa,EACb,gBAAgB,GACnB,MAAM,SAAS,CAAC;AAGjB,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAGvD,OAAO,EACH,4BAA4B,EAC5B,6BAA6B,EAC7B,sBAAsB,EACtB,mBAAmB,EACnB,sBAAsB,EACtB,sBAAsB,EACtB,6BAA6B,EAC7B,wBAAwB,EACxB,gCAAgC,EAChC,kCAAkC,EAClC,oBAAoB,EACpB,4BAA4B,EAC5B,sBAAsB,EACtB,gBAAgB,GACnB,MAAM,WAAW,CAAC;AAGnB,OAAO,EACH,gBAAgB,EAChB,sBAAsB,EACtB,4BAA4B,EAC5B,2BAA2B,EAC3B,mBAAmB,GACtB,MAAM,UAAU,CAAC;AAGlB,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,YAAY,EAAE,gBAAgB,EAAE,gBAAgB,EAA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,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AACrE,YAAY,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAGjD,YAAY,EACR,kBAAkB,EAClB,cAAc,EACd,yBAAyB,EACzB,uBAAuB,EACvB,4BAA4B,EAC5B,mBAAmB,EACnB,WAAW,EACX,aAAa,EACb,gBAAgB,GACnB,MAAM,SAAS,CAAC;AAGjB,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAGvD,OAAO,EACH,4BAA4B,EAC5B,6BAA6B,EAC7B,sBAAsB,EACtB,mBAAmB,EACnB,sBAAsB,EACtB,sBAAsB,EACtB,6BAA6B,EAC7B,wBAAwB,EACxB,gCAAgC,EAChC,kCAAkC,EAClC,oBAAoB,EACpB,4BAA4B,EAC5B,sBAAsB,EACtB,gBAAgB,GACnB,MAAM,WAAW,CAAC;AAGnB,OAAO,EACH,gBAAgB,EAChB,sBAAsB,EACtB,4BAA4B,EAC5B,2BAA2B,EAC3B,mBAAmB,GACtB,MAAM,UAAU,CAAC;AAGlB,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,YAAY,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,QAAQ,CAAC;AAGtG,OAAO,EACH,4BAA4B,EAC5B,wBAAwB,EACxB,gBAAgB,EAChB,wBAAwB,EACxB,iBAAiB,EACjB,cAAc,EACd,0BAA0B,GAC7B,MAAM,YAAY,CAAC;AACpB,YAAY,EAAE,qBAAqB,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC;AAGlF,OAAO,EAAE,uBAAuB,EAAE,MAAM,WAAW,CAAC"}
|
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
// Query Extraction Pipeline — barrel exports
|
|
2
2
|
// Re-exports the public API for the query extraction subsystem.
|
|
3
|
-
//
|
|
3
|
+
// Extraction (describe-based): facts, child-row writes, the post-commit description pass
|
|
4
|
+
export { ComputeQueryExtraction, ExtractionSQLHash } from "./extractQuery.js";
|
|
5
|
+
export { WriteExtractedChildRows, ApplyFieldFacts } from "./childRowWriter.js";
|
|
6
|
+
export { RunDescriptionPass } from "./descriptionPass.js";
|
|
7
|
+
export { AnalyzeQueryTemplate, SQLUsesTemplate, DescribeDiagnostic } from "./templateFacts.js";
|
|
8
|
+
export { ReadCompositionTargetsAsync, MergeCompositionCandidates } from "./compositionTargets.js";
|
|
9
|
+
export { DescribeQueryOutput, SampleValueFor } from "./describeFacts.js";
|
|
10
|
+
export { EntityObjectIndex, BindColumnSource, BindTableReferences } from "./sourceBinding.js";
|
|
11
|
+
// Legacy pipeline orchestrator (kept as a façade; saves use ComputeQueryExtraction)
|
|
4
12
|
export { RunExtractionPipeline, CleanupQueryData } from "./pipeline.js";
|
|
5
13
|
// Parse stage
|
|
6
14
|
export { ParseQuerySQL, parseQuerySQL } from "./parse.js";
|
|
@@ -10,6 +18,8 @@ export { ResolveCompositionReferences, ResolveQueryByNameAndCategory, BuildParam
|
|
|
10
18
|
export { RunLLMEnrichment, MergeParametersWithLLM, GenerateParameterDescription, BuildPassthroughDescription, GenerateSampleValue, } from "./enrich.js";
|
|
11
19
|
// Sync engine
|
|
12
20
|
export { SyncParameters, SyncFields, SyncEntities, SyncDependencies, RemoveAllRecords } from "./sync.js";
|
|
21
|
+
// Declared child rows (graph saves)
|
|
22
|
+
export { CollectDeclaredQueryChildren, HasDeclaredQueryChildren, FindReplacedRows, QueueReplacedRowDeletion, QueryChildNameKey, QueryEntityKey, NO_DECLARED_QUERY_CHILDREN, } from "./declared.js";
|
|
13
23
|
// Dialect conversion
|
|
14
24
|
export { ConvertTSQLToPostgreSQL } from "./dialect.js";
|
|
15
25
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/custom/query-extraction/index.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,gEAAgE;AAEhE,
|
|
1
|
+
{"version":3,"file":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Q,CAAC;AAEtG,oCAAoC;AACpC,OAAO,EACH,4BAA4B,EAC5B,wBAAwB,EACxB,gBAAgB,EAChB,wBAAwB,EACxB,iBAAiB,EACjB,cAAc,EACd,0BAA0B,GAC7B,MAAM,YAAY,CAAC;AAGpB,qBAAqB;AACrB,OAAO,EAAE,uBAAuB,EAAE,MAAM,WAAW,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { QuerySyncContext } from "./types.js";
|
|
2
2
|
/**
|
|
3
|
-
* Result of running the full extraction pipeline.
|
|
4
|
-
*
|
|
3
|
+
* Result of running the full extraction pipeline. `UsesTemplate` is a lexical fact: whether the
|
|
4
|
+
* SQL holds any template tag outside SQL comments.
|
|
5
5
|
*/
|
|
6
6
|
export interface PipelineResult {
|
|
7
7
|
UsesTemplate: boolean;
|
|
@@ -15,6 +15,10 @@ export interface PipelineResult {
|
|
|
15
15
|
* 5. SYNC — parallel database writes
|
|
16
16
|
*
|
|
17
17
|
* Throws on invalid composition references (non-existent, non-Reusable, circular).
|
|
18
|
+
*
|
|
19
|
+
* @deprecated Saves extract with `ComputeQueryExtraction` (the database server describes the
|
|
20
|
+
* output) and `WriteExtractedChildRows` (facts corrected, authored annotations kept). This
|
|
21
|
+
* LLM-assisted pipeline is kept for callers of the package API.
|
|
18
22
|
*/
|
|
19
23
|
export declare function RunExtractionPipeline(ctx: QuerySyncContext): Promise<PipelineResult>;
|
|
20
24
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pipeline.d.ts","sourceRoot":"","sources":["../../../src/custom/query-extraction/pipeline.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAiC,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"pipeline.d.ts","sourceRoot":"","sources":["../../../src/custom/query-extraction/pipeline.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAiC,MAAM,SAAS,CAAC;AAoB/E;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC3B,YAAY,EAAE,OAAO,CAAC;CACzB;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAsB,qBAAqB,CAAC,GAAG,EAAE,gBAAgB,GAAG,OAAO,CAAC,cAAc,CAAC,CAqB1F;AAED;;GAEG;AACH,wBAAsB,gBAAgB,CAAC,GAAG,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CAQ3E"}
|