@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
|
@@ -1,20 +1,49 @@
|
|
|
1
1
|
import { EntitySaveOptions, SimpleEmbeddingResult } from "@memberjunction/core";
|
|
2
2
|
import { MJQueryEntityExtended } from "@memberjunction/core-entities";
|
|
3
|
+
import type { DeclaredQueryChildren, QueryExtractionOverride, QueryExtractionResult, ChildRowWriteSummary } from "./query-extraction/index.js";
|
|
3
4
|
/**
|
|
4
|
-
* Server-side query entity with embedding generation, SQL extraction
|
|
5
|
-
*
|
|
6
|
-
*
|
|
5
|
+
* Server-side query entity with embedding generation, SQL extraction, and dialect auto-conversion.
|
|
6
|
+
* Extends `MJQueryEntityExtended`, which provides the child-relationship getters and business
|
|
7
|
+
* logic available on both client and server.
|
|
8
|
+
*
|
|
9
|
+
* **Extraction.** A save of a new query, of a query whose SQL changed, or with
|
|
10
|
+
* {@link ExtractionOverride} `Force`, establishes the query's facts (`ComputeQueryExtraction`):
|
|
11
|
+
* its parameters, compositions and the entities it reads from MJ's parser, and its output fields
|
|
12
|
+
* from the database server's description of each render. Save-time rule errors and repeated
|
|
13
|
+
* output names refuse a new or edited query, with the reasons in the save's result. Once the save
|
|
14
|
+
* of the query row succeeds, the child rows are brought in line with the facts as the system user,
|
|
15
|
+
* keeping what people authored (`WriteExtractedChildRows`), and the query's `UsesTemplate`,
|
|
16
|
+
* `ExtractedSQLHash`, `ExtractionStatus` and `ExtractionMessage` record the run. Empty
|
|
17
|
+
* descriptions are then filled by an LLM after the save's transaction commits, unless the save
|
|
18
|
+
* skips AI actions.
|
|
7
19
|
*/
|
|
8
20
|
export declare class MJQueryEntityServer extends MJQueryEntityExtended {
|
|
9
|
-
/** Optional caller-provided parameter sample values. When set, these
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* Keys are parameter names, values are the tested sample values. */
|
|
21
|
+
/** Optional caller-provided parameter sample values. When set, these are used as the sample of a
|
|
22
|
+
* parameter extraction adds, and in the renders that are described. Use this to pass tested,
|
|
23
|
+
* validated values from the calling system. Keys are parameter names. */
|
|
13
24
|
ParameterHints?: Map<string, string>;
|
|
25
|
+
/**
|
|
26
|
+
* What the next save does about extraction: `Auto` (the default) extracts when the query is new
|
|
27
|
+
* or its SQL changed; `Skip` does not extract, so the save-time rules are not applied and the
|
|
28
|
+
* child rows, the Extraction columns and `UsesTemplate` stay as they are (for bulk loaders and
|
|
29
|
+
* fixtures that write those themselves); `Force` extracts even when the SQL did not change.
|
|
30
|
+
* Reset to `Auto` after each save.
|
|
31
|
+
*/
|
|
32
|
+
ExtractionOverride: QueryExtractionOverride;
|
|
33
|
+
/** The SQL a re-extraction reads instead of the cached platform variant (set by {@link RerunExtraction}). */
|
|
34
|
+
private platformSQLOverride;
|
|
35
|
+
/** The facts an explicit refresh already established, which its save writes instead of extracting again. */
|
|
36
|
+
private presetExtraction;
|
|
37
|
+
/** Whether the running save is an explicit refresh ({@link ApplyRefreshAsync}). */
|
|
38
|
+
private refreshing;
|
|
39
|
+
/** What the last save's child-row writes changed; `null` when it wrote none. */
|
|
40
|
+
private lastWriteSummary;
|
|
14
41
|
/**
|
|
15
42
|
* Simple proxy to local helper method for embeddings. Needed for BaseEntity sub-classes that want to use embeddings built into BaseEntity
|
|
16
43
|
*/
|
|
17
44
|
protected EmbedTextLocal(textToEmbed: string): Promise<SimpleEmbeddingResult>;
|
|
45
|
+
/** A stored vector from a model other than the default local one is re-embedded on save. */
|
|
46
|
+
protected IsEmbeddingStale(embeddingModelID: string | null): Promise<boolean>;
|
|
18
47
|
/**
|
|
19
48
|
* Generates an embedding from composite text (Name + UserQuestion + Description) for richer semantic search.
|
|
20
49
|
* Stores the vector in EmbeddingVector (JSON) and EmbeddingVectorBinary (float32 bytes, base64), and the
|
|
@@ -24,11 +53,79 @@ export declare class MJQueryEntityServer extends MJQueryEntityExtended {
|
|
|
24
53
|
* embedder error — all three columns are cleared, so a query whose text changed never keeps a vector
|
|
25
54
|
* computed from its old text. An embedder error is logged and does not fail the save; the query simply
|
|
26
55
|
* has no semantic match until its next successful embedding.
|
|
56
|
+
*
|
|
57
|
+
* Does nothing when {@link SkipEmbeddings} is set (a bulk load computes them later), so the stored
|
|
58
|
+
* vector is left as it is.
|
|
59
|
+
*
|
|
60
|
+
* @param textChanged - false when the text is unchanged and only the stored vector's model is stale:
|
|
61
|
+
* a failed embed then keeps the existing vector, which still matches the text.
|
|
27
62
|
*/
|
|
28
|
-
protected GenerateCompositeEmbedding(): Promise<void>;
|
|
63
|
+
protected GenerateCompositeEmbedding(textChanged?: boolean): Promise<void>;
|
|
29
64
|
/** Clears the stored vector (both forms) and the model it was computed with. */
|
|
30
65
|
private clearEmbedding;
|
|
66
|
+
/** Re-embeds when the embedded text changed, or when the stored vector came from a model other than the default local one. */
|
|
67
|
+
private refreshEmbeddingAsync;
|
|
31
68
|
Save(options?: EntitySaveOptions): Promise<boolean>;
|
|
69
|
+
/** Whether this object saves through a network (client) provider rather than to a database. */
|
|
70
|
+
private get savesOverNetwork();
|
|
71
|
+
/**
|
|
72
|
+
* The save: facts first (a refusal writes nothing), then the query row (a graph save with any
|
|
73
|
+
* declared children), then the child rows extraction derives, then the approval fingerprint.
|
|
74
|
+
*/
|
|
75
|
+
private saveWithExtractionAsync;
|
|
76
|
+
private get hasSQL();
|
|
77
|
+
/**
|
|
78
|
+
* Whether this save extracts, and under which rules: a new or edited query extracts under the
|
|
79
|
+
* save-time rules; a save that writes declared child rows, or a `Force` override, re-extracts an
|
|
80
|
+
* unchanged query under the refresh rules, so the facts of rows it writes are corrected again.
|
|
81
|
+
*/
|
|
82
|
+
private planExtraction;
|
|
83
|
+
/**
|
|
84
|
+
* Sets the columns a save records about the SQL before the row is written. `UsesTemplate` is a
|
|
85
|
+
* lexical fact and follows every SQL change; it is never changed by a failed extraction. A save
|
|
86
|
+
* with {@link ExtractionOverride} `Skip` leaves it as the caller set it, like the other
|
|
87
|
+
* extraction results.
|
|
88
|
+
*/
|
|
89
|
+
private applyRunColumns;
|
|
90
|
+
/**
|
|
91
|
+
* Gives each field row this save declares the facts extraction established for it, before the
|
|
92
|
+
* graph is written. Facts follow the SQL and the database server whatever a caller declares, so
|
|
93
|
+
* a declaration that carries facts (types, nullability, sequence, source) for another platform is
|
|
94
|
+
* corrected before it is written instead of being written and then corrected, and a new declared
|
|
95
|
+
* row, which may declare only its name and annotations, gets the facts its columns require.
|
|
96
|
+
*/
|
|
97
|
+
private applyFactsToDeclaredFields;
|
|
98
|
+
/** Whether the SQL holds a template tag outside comments, read by the lexer. */
|
|
99
|
+
private lexicalUsesTemplate;
|
|
100
|
+
/** The save's result entry for a refused save, carrying the reasons. */
|
|
101
|
+
private refusalResult;
|
|
102
|
+
/**
|
|
103
|
+
* The declared-rows-win hook, run before the save writes anything.
|
|
104
|
+
*
|
|
105
|
+
* A caller can save a query together with child rows it declares, through the `Parameters`,
|
|
106
|
+
* `Fields` and `Entities` collections. When a NEW declared row has the key of a stored row with a
|
|
107
|
+
* different ID whose `DetectionMethod` is not `Manual` (a row extraction created), the stored row
|
|
108
|
+
* is deleted inside the same graph save, before the declared row is inserted. The declared row
|
|
109
|
+
* keeps the ID the caller gave it, which is what makes a metadata file that names its child IDs
|
|
110
|
+
* converge instead of colliding with rows extraction wrote earlier. A stored `Manual` row is never
|
|
111
|
+
* deleted here; a declared row that collides with one fails the save on the database's own
|
|
112
|
+
* uniqueness rule where there is one.
|
|
113
|
+
*
|
|
114
|
+
* Extraction then runs after `super.Save()`, sees the declared rows already written, and treats
|
|
115
|
+
* them like any stored row: their facts are corrected from the SQL, their authored annotations
|
|
116
|
+
* kept.
|
|
117
|
+
*
|
|
118
|
+
* @param options - The save's options. A `ReplayOnly` save, or one that skips related
|
|
119
|
+
* collections, writes no declared rows, so nothing is declared.
|
|
120
|
+
* @returns The keys of the child rows this save declares.
|
|
121
|
+
*/
|
|
122
|
+
protected PrepareDeclaredChildrenAsync(options?: EntitySaveOptions): Promise<DeclaredQueryChildren>;
|
|
123
|
+
/**
|
|
124
|
+
* Reads the stored child rows from the database (never a cache, which inside a transaction can
|
|
125
|
+
* miss rows written earlier in it) and queues the extraction-created rows each new declared row
|
|
126
|
+
* replaces for deletion in the graph save.
|
|
127
|
+
*/
|
|
128
|
+
private queueReplacedRowDeletionsAsync;
|
|
32
129
|
/**
|
|
33
130
|
* Stores the fingerprint of the definition just approved: this row's SQL, template flag and
|
|
34
131
|
* external source, with its dialect and parameter rows read back from the database. Until this
|
|
@@ -39,55 +136,92 @@ export declare class MJQueryEntityServer extends MJQueryEntityExtended {
|
|
|
39
136
|
private loadDefinitionRowsAsync;
|
|
40
137
|
Delete(options?: EntitySaveOptions): Promise<boolean>;
|
|
41
138
|
/**
|
|
42
|
-
*
|
|
43
|
-
*
|
|
139
|
+
* The platform the query is extracted for: the platform of the provider this entity saves
|
|
140
|
+
* through, so two providers on different platforms in one process each extract for their own.
|
|
44
141
|
*/
|
|
45
|
-
private get
|
|
142
|
+
private get extractionPlatform();
|
|
143
|
+
/** The provider as extraction reads and writes through it; `null` when it cannot read views and create entity objects. */
|
|
144
|
+
private get extractionProvider();
|
|
46
145
|
/**
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
* 1. MJ: Query SQLs record matching the current platform's dialect → use that SQL
|
|
51
|
-
* 2. Base Query.SQL field → fall back if no dialect variant exists
|
|
52
|
-
*
|
|
53
|
-
* After resolution, validates the SQL is compatible with the current platform's
|
|
54
|
-
* dialect by attempting a parse. Logs a warning if the SQL appears to be for a
|
|
55
|
-
* different dialect (e.g., T-SQL bracket identifiers on a PostgreSQL database).
|
|
146
|
+
* The user derived child rows are read and written as: the system user, once the caller's save
|
|
147
|
+
* of the query is authorized (the rows mirror SQL the caller was allowed to change, like CodeGen
|
|
148
|
+
* output). The caller when no system user is loaded.
|
|
56
149
|
*/
|
|
57
|
-
private
|
|
150
|
+
private get extractionUser();
|
|
151
|
+
/** The SQL extraction reads: a re-extraction's override, else the query's SQL for the platform. */
|
|
152
|
+
private get extractionSQL();
|
|
153
|
+
/** Establishes the query's facts (nothing is written); an explicit refresh's facts when it already has them. */
|
|
154
|
+
private computeExtractionAsync;
|
|
58
155
|
/**
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
156
|
+
* The queries the SQL composes, read on this save's provider with every cache bypassed, so a
|
|
157
|
+
* target saved earlier in the same transaction (one metadata push creating both queries) is
|
|
158
|
+
* found before the shared query cache hears of it. Nothing is read for SQL that composes
|
|
159
|
+
* nothing, or on a provider that cannot run views.
|
|
160
|
+
*/
|
|
161
|
+
private readCompositionTargetsAsync;
|
|
162
|
+
/** Loads QueryEngine when this process has not yet (a CLI or sync context); compositions resolve against it. */
|
|
163
|
+
private ensureQueryEngineLoadedAsync;
|
|
164
|
+
/**
|
|
165
|
+
* The parameter rows extraction knows before it runs: the stored rows, read from the database
|
|
166
|
+
* (never the cache), overlaid by the rows this save declares.
|
|
66
167
|
*/
|
|
67
|
-
private
|
|
168
|
+
private knownParametersAsync;
|
|
169
|
+
private storedParametersAsync;
|
|
68
170
|
/**
|
|
69
|
-
*
|
|
70
|
-
*
|
|
171
|
+
* Writes the derived child rows as the system user, inside the caller's transaction when there
|
|
172
|
+
* is one, then queues the description pass. A failed write is recorded on the query
|
|
173
|
+
* (`ExtractionStatus` `Error`) rather than failing a save whose row is already written.
|
|
71
174
|
*/
|
|
72
|
-
private
|
|
175
|
+
private writeExtractionAsync;
|
|
176
|
+
/** An entity's name from the saving provider's catalog, for reporting; the ID when it is not there. */
|
|
177
|
+
private entityNameOf;
|
|
178
|
+
private recordWriteFailureAsync;
|
|
179
|
+
/** The post-commit token of the caller's transaction, captured before the save writes anything. */
|
|
180
|
+
private capturePostCommitToken;
|
|
73
181
|
/**
|
|
74
|
-
*
|
|
75
|
-
*
|
|
76
|
-
*
|
|
77
|
-
*
|
|
182
|
+
* Queues the LLM description pass to run after the caller's transaction commits, when some row
|
|
183
|
+
* has no description and the save does not skip AI actions. No LLM call is made inside the
|
|
184
|
+
* transaction. A save-triggered extraction that changed no child row does not queue it: the
|
|
185
|
+
* rows are as the last run left them, so a repeated save (a re-push of unchanged metadata) does
|
|
186
|
+
* not call the LLM again, and a pass that failed is not retried, and recorded, on every save.
|
|
187
|
+
* An explicit refresh that asks for the pass always queues it.
|
|
188
|
+
*/
|
|
189
|
+
private queueDescriptionPass;
|
|
190
|
+
/**
|
|
191
|
+
* Re-extracts this query: a save with {@link ExtractionOverride} `Force`. Called by
|
|
192
|
+
* `MJQuerySQLEntityServer` when a dialect variant for the current platform is saved.
|
|
78
193
|
*
|
|
79
|
-
* @param skipAIEnrichment Skip the
|
|
194
|
+
* @param skipAIEnrichment Skip the description pass, as `SkipEntityAIActions` does for a save.
|
|
195
|
+
* @param platformSQL The SQL to extract from (the variant just saved), instead of the cached
|
|
196
|
+
* platform variant, which inside a transaction may not hold it yet.
|
|
197
|
+
*/
|
|
198
|
+
RerunExtraction(skipAIEnrichment?: boolean, platformSQL?: string): Promise<void>;
|
|
199
|
+
/**
|
|
200
|
+
* Establishes this saved query's facts under the refresh rules (a save-time rule error is
|
|
201
|
+
* recorded, never a refusal), as the save would, and writes nothing. The facts are read on the
|
|
202
|
+
* provider this entity was loaded with, for its platform.
|
|
80
203
|
*/
|
|
81
|
-
|
|
204
|
+
ComputeRefreshExtractionAsync(): Promise<QueryExtractionResult>;
|
|
82
205
|
/**
|
|
83
|
-
*
|
|
84
|
-
*
|
|
206
|
+
* The child-row changes `extraction` would make, worked out against the rows stored now and
|
|
207
|
+
* read as this entity's context user. Nothing is written.
|
|
208
|
+
*/
|
|
209
|
+
PreviewRefreshAsync(extraction: QueryExtractionResult, entityName?: (entityID: string) => string): Promise<ChildRowWriteSummary>;
|
|
210
|
+
/**
|
|
211
|
+
* Writes `extraction` (from {@link ComputeRefreshExtractionAsync}): a save with
|
|
212
|
+
* {@link ExtractionOverride} `Force` that records the run on the query and brings the child
|
|
213
|
+
* rows in line with the facts. Unlike a save-triggered extraction, the child rows are written
|
|
214
|
+
* as this entity's context user, so each write is checked against that user's permissions, and
|
|
215
|
+
* a failed write fails the refresh instead of being recorded on the query. SQL, dialect
|
|
216
|
+
* variants and the embedding are never written.
|
|
85
217
|
*
|
|
86
|
-
* @param
|
|
218
|
+
* @param withAI Queue the LLM description pass for rows still without a description.
|
|
219
|
+
* @returns What the child-row writes changed.
|
|
220
|
+
* @throws Error when the save or a child-row write fails; the caller's transaction should be rolled back.
|
|
87
221
|
*/
|
|
88
|
-
|
|
222
|
+
ApplyRefreshAsync(extraction: QueryExtractionResult, withAI: boolean): Promise<ChildRowWriteSummary | null>;
|
|
89
223
|
/**
|
|
90
|
-
* Cleans up all extraction data when SQL is empty
|
|
224
|
+
* Cleans up all extraction data when SQL is empty.
|
|
91
225
|
*/
|
|
92
226
|
private cleanupEmptyQueryAsync;
|
|
93
227
|
/**
|
|
@@ -103,9 +237,5 @@ export declare class MJQueryEntityServer extends MJQueryEntityExtended {
|
|
|
103
237
|
* Creates or updates a QuerySQL record for the given dialect.
|
|
104
238
|
*/
|
|
105
239
|
private upsertQuerySQLRecord;
|
|
106
|
-
/**
|
|
107
|
-
* Removes all QuerySQL records for this query. Called during cleanup operations.
|
|
108
|
-
*/
|
|
109
|
-
private removeAllQuerySQLRecordsAsync;
|
|
110
240
|
}
|
|
111
241
|
//# sourceMappingURL=MJQueryEntityServer.server.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MJQueryEntityServer.server.d.ts","sourceRoot":"","sources":["../../src/custom/MJQueryEntityServer.server.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"MJQueryEntityServer.server.d.ts","sourceRoot":"","sources":["../../src/custom/MJQueryEntityServer.server.ts"],"names":[],"mappings":"AAAA,OAAO,EAKH,iBAAiB,EAOjB,qBAAqB,EAExB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAMH,qBAAqB,EAIxB,MAAM,+BAA+B,CAAC;AAuBvC,OAAO,KAAK,EAER,qBAAqB,EAGrB,uBAAuB,EACvB,qBAAqB,EACrB,oBAAoB,EAEvB,MAAM,oBAAoB,CAAC;AAkB5B;;;;;;;;;;;;;;;GAeG;AACH,qBACa,mBAAoB,SAAQ,qBAAqB;IAC1D;;8EAE0E;IACnE,cAAc,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAE5C;;;;;;OAMG;IACI,kBAAkB,EAAE,uBAAuB,CAAU;IAE5D,6GAA6G;IAC7G,OAAO,CAAC,mBAAmB,CAAuB;IAElD,4GAA4G;IAC5G,OAAO,CAAC,gBAAgB,CAAsC;IAE9D,mFAAmF;IACnF,OAAO,CAAC,UAAU,CAAS;IAE3B,gFAAgF;IAChF,OAAO,CAAC,gBAAgB,CAAqC;IAI7D;;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