@memberjunction/core-entities-server 5.16.0 → 5.18.0
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/dist/custom/MJQueryEntityServer.server.d.ts +12 -91
- package/dist/custom/MJQueryEntityServer.server.d.ts.map +1 -1
- package/dist/custom/MJQueryEntityServer.server.js +69 -1097
- package/dist/custom/MJQueryEntityServer.server.js.map +1 -1
- package/dist/custom/query-extraction/dialect.d.ts +23 -0
- package/dist/custom/query-extraction/dialect.d.ts.map +1 -0
- package/dist/custom/query-extraction/dialect.js +45 -0
- package/dist/custom/query-extraction/dialect.js.map +1 -0
- package/dist/custom/query-extraction/enrich.d.ts +51 -0
- package/dist/custom/query-extraction/enrich.d.ts.map +1 -0
- package/dist/custom/query-extraction/enrich.js +180 -0
- package/dist/custom/query-extraction/enrich.js.map +1 -0
- package/dist/custom/query-extraction/index.d.ts +9 -0
- package/dist/custom/query-extraction/index.d.ts.map +1 -0
- package/dist/custom/query-extraction/index.js +15 -0
- package/dist/custom/query-extraction/index.js.map +1 -0
- package/dist/custom/query-extraction/parse.d.ts +7 -0
- package/dist/custom/query-extraction/parse.d.ts.map +1 -0
- package/dist/custom/query-extraction/parse.js +13 -0
- package/dist/custom/query-extraction/parse.js.map +1 -0
- package/dist/custom/query-extraction/pipeline.d.ts +24 -0
- package/dist/custom/query-extraction/pipeline.d.ts.map +1 -0
- package/dist/custom/query-extraction/pipeline.js +101 -0
- package/dist/custom/query-extraction/pipeline.js.map +1 -0
- package/dist/custom/query-extraction/resolve.d.ts +110 -0
- package/dist/custom/query-extraction/resolve.d.ts.map +1 -0
- package/dist/custom/query-extraction/resolve.js +677 -0
- package/dist/custom/query-extraction/resolve.js.map +1 -0
- package/dist/custom/query-extraction/sync.d.ts +30 -0
- package/dist/custom/query-extraction/sync.d.ts.map +1 -0
- package/dist/custom/query-extraction/sync.js +456 -0
- package/dist/custom/query-extraction/sync.js.map +1 -0
- package/dist/custom/query-extraction/types.d.ts +114 -0
- package/dist/custom/query-extraction/types.d.ts.map +1 -0
- package/dist/custom/query-extraction/types.js +2 -0
- package/dist/custom/query-extraction/types.js.map +1 -0
- package/package.json +19 -19
|
@@ -11,8 +11,6 @@ export declare class MJQueryEntityServer extends MJQueryEntity {
|
|
|
11
11
|
get QueryPermissions(): QueryPermissionInfo[];
|
|
12
12
|
/**
|
|
13
13
|
* Simple proxy to local helper method for embeddings. Needed for BaseEntity sub-classes that want to use embeddings built into BaseEntity
|
|
14
|
-
* @param textToEmbed
|
|
15
|
-
* @returns
|
|
16
14
|
*/
|
|
17
15
|
protected EmbedTextLocal(textToEmbed: string): Promise<SimpleEmbeddingResult>;
|
|
18
16
|
/**
|
|
@@ -24,106 +22,31 @@ export declare class MJQueryEntityServer extends MJQueryEntity {
|
|
|
24
22
|
Delete(options?: EntitySaveOptions): Promise<boolean>;
|
|
25
23
|
/**
|
|
26
24
|
* Builds a category path string from a CategoryID by walking up the category hierarchy.
|
|
27
|
-
* Returns a path like "
|
|
25
|
+
* Returns a slash-delimited path like "Ground-Truth-Queries/Sales" or "Ground-Truth-Queries".
|
|
28
26
|
*/
|
|
29
|
-
|
|
27
|
+
BuildCategoryPathFromID(categoryID: string): string;
|
|
30
28
|
/**
|
|
31
|
-
*
|
|
32
|
-
* to prevent connection pool exhaustion
|
|
29
|
+
* Builds the QuerySyncContext from this entity instance for use by the extraction pipeline.
|
|
33
30
|
*/
|
|
34
|
-
private
|
|
35
|
-
/**
|
|
36
|
-
* Asynchronous cleanup for empty queries
|
|
37
|
-
*/
|
|
38
|
-
private cleanupEmptyQueryAsync;
|
|
39
|
-
private extractAndSyncData;
|
|
40
|
-
/**
|
|
41
|
-
* Runs the LLM enrichment prompt to get descriptions and sample values.
|
|
42
|
-
* Returns null if the LLM is unavailable or fails (non-fatal).
|
|
43
|
-
*/
|
|
44
|
-
private runLLMEnrichment;
|
|
45
|
-
/**
|
|
46
|
-
* Merges deterministic parameter extraction (SQLParser) with LLM enrichment.
|
|
47
|
-
*
|
|
48
|
-
* SQLParser is the authority for: name, type, isRequired, defaultValue
|
|
49
|
-
* LLM provides: description, sampleValue (with heuristic fallbacks if LLM unavailable)
|
|
50
|
-
*/
|
|
51
|
-
private mergeParametersWithLLM;
|
|
52
|
-
/**
|
|
53
|
-
* Generates a deterministic description for a parameter when LLM is unavailable.
|
|
54
|
-
* Uses the parameter name, type, and filter information to create a meaningful description.
|
|
55
|
-
*/
|
|
56
|
-
private generateParameterDescription;
|
|
57
|
-
/**
|
|
58
|
-
* Generates a deterministic sample value based on the parameter type.
|
|
59
|
-
*/
|
|
60
|
-
private generateSampleValue;
|
|
61
|
-
/**
|
|
62
|
-
* Extracts entity metadata from the SQL to provide context to the LLM for parameter type inference.
|
|
63
|
-
* Uses SQLParser for robust SQL parsing with MJ template support.
|
|
64
|
-
*/
|
|
65
|
-
private extractEntityMetadataFromSQL;
|
|
66
|
-
private syncQueryParameters;
|
|
67
|
-
private removeAllQueryParameters;
|
|
68
|
-
/**
|
|
69
|
-
* Detects if the SQL uses SELECT * and if so, builds the complete field list deterministically
|
|
70
|
-
* from entity metadata without relying on the AI (which can't enumerate * columns).
|
|
71
|
-
* Returns null if the SQL doesn't use SELECT * or if entities can't be resolved.
|
|
72
|
-
*/
|
|
73
|
-
private buildFieldsForSelectStar;
|
|
74
|
-
/**
|
|
75
|
-
* Finds an entity by name, checking both Name (which may have "MJ: " prefix) and DisplayName.
|
|
76
|
-
* The AI often returns entity names without the "MJ: " prefix, so we need to match both.
|
|
77
|
-
*/
|
|
78
|
-
private findEntityByName;
|
|
79
|
-
/**
|
|
80
|
-
* Expands wildcard (*) entries in the extracted fields list.
|
|
81
|
-
* When AI returns a field with name="*" or sourceFieldName="*", we expand it into
|
|
82
|
-
* individual field entries by looking up the source from metadata.
|
|
83
|
-
* If the AI didn't provide a sourceEntity, we parse the SQL's FROM clause to find it.
|
|
84
|
-
*/
|
|
85
|
-
private expandWildcardFields;
|
|
86
|
-
private syncQueryFields;
|
|
87
|
-
private syncQueryEntities;
|
|
88
|
-
private removeAllQueryFields;
|
|
89
|
-
private removeAllQueryEntities;
|
|
90
|
-
/**
|
|
91
|
-
* Deterministically extracts {{query:"..."}} composition references from this query's SQL
|
|
92
|
-
* and syncs the QueryDependency records accordingly. No LLM needed — uses regex parsing.
|
|
93
|
-
*/
|
|
94
|
-
private extractAndSyncQueryDependencies;
|
|
31
|
+
private buildSyncContext;
|
|
95
32
|
/**
|
|
96
|
-
*
|
|
33
|
+
* Runs the extraction pipeline and saves the UsesTemplate flag.
|
|
34
|
+
* On error, sets UsesTemplate=false and attempts to save so the query remains usable.
|
|
97
35
|
*/
|
|
98
|
-
private
|
|
99
|
-
/**
|
|
100
|
-
* Extracts the SQL alias following a {{query:"..."}} token from this query's SQL.
|
|
101
|
-
*/
|
|
102
|
-
private extractAliasFromSQL;
|
|
103
|
-
/**
|
|
104
|
-
* Detects circular dependencies by walking the dependency graph.
|
|
105
|
-
* Returns a descriptive error string if a cycle is found, or null if clean.
|
|
106
|
-
*/
|
|
107
|
-
private detectDependencyCycles;
|
|
108
|
-
/**
|
|
109
|
-
* Syncs extracted query dependencies against existing QueryDependency records.
|
|
110
|
-
* Follows the same add/update/delete pattern as syncQueryParameters/Fields/Entities.
|
|
111
|
-
*/
|
|
112
|
-
private syncQueryDependencies;
|
|
36
|
+
private extractAndSyncDataAsync;
|
|
113
37
|
/**
|
|
114
|
-
*
|
|
38
|
+
* Cleans up all extraction data when SQL is empty, then saves the updated UsesTemplate flag.
|
|
115
39
|
*/
|
|
116
|
-
private
|
|
40
|
+
private cleanupEmptyQueryAsync;
|
|
117
41
|
/**
|
|
118
42
|
* Auto-converts the query's SQL to other dialects based on the queryDialects
|
|
119
43
|
* configuration stored in GlobalObjectStore. Best-effort: failures never block the save.
|
|
120
44
|
*/
|
|
121
45
|
private autoConvertDialectsAsync;
|
|
122
46
|
/**
|
|
123
|
-
* Converts
|
|
124
|
-
* Applies the standard transform pipeline for statement-level conversions.
|
|
47
|
+
* Converts and persists SQL for a single target dialect. Logs warnings on skip/failure.
|
|
125
48
|
*/
|
|
126
|
-
private
|
|
49
|
+
private convertToTargetDialect;
|
|
127
50
|
/**
|
|
128
51
|
* Creates or updates a QuerySQL record for the given dialect.
|
|
129
52
|
*/
|
|
@@ -137,9 +60,7 @@ export declare class MJQueryEntityServer extends MJQueryEntity {
|
|
|
137
60
|
LoadFromData(data: any, _replaceOldValues?: boolean): Promise<boolean>;
|
|
138
61
|
/**
|
|
139
62
|
* Refreshes this record's related metadata from the provider, refreshing
|
|
140
|
-
* all the way up from the database if refreshFromDB is true, otherwise from
|
|
141
|
-
* cache.
|
|
142
|
-
* @param refreshFromDB
|
|
63
|
+
* all the way up from the database if refreshFromDB is true, otherwise from cache.
|
|
143
64
|
*/
|
|
144
65
|
RefreshRelatedMetadata(refreshFromDB: boolean): Promise<void>;
|
|
145
66
|
}
|
|
@@ -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,EAEH,YAAY,EACZ,iBAAiB,EAIjB,eAAe,EACf,cAAc,EACd,kBAAkB,EAClB,mBAAmB,EACnB,qBAAqB,EAExB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,aAAa,EAAoB,MAAM,+BAA+B,CAAC;AAUhF,qBACa,mBAAoB,SAAQ,aAAa;IAClD,OAAO,CAAC,cAAc,CAAyB;IAC/C,OAAO,CAAC,YAAY,CAAwB;IAC5C,OAAO,CAAC,gBAAgB,CAA4B;IACpD,OAAO,CAAC,iBAAiB,CAA6B;IAEtD,IAAW,aAAa,IAAI,eAAe,EAAE,CAE5C;IAED,IAAW,WAAW,IAAI,cAAc,EAAE,CAEzC;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