@qaecy/cue-sdk 0.0.40 → 0.0.44
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 +23 -0
- package/browser.js +7473 -6895
- package/{document-filter-Ccb84D3H.js → document-filter-Cj0Yql1C.js} +1422 -844
- package/index.d.ts +5 -1
- package/index.js +28 -26
- package/lib/api.d.ts +18 -3
- package/lib/cue.d.ts +2 -2
- package/lib/data-sources.d.ts +77 -11
- package/lib/document-filter.d.ts +1 -1
- package/lib/documents.d.ts +1 -1
- package/lib/entities.d.ts +1 -1
- package/lib/gis-sources.d.ts +57 -0
- package/lib/llm-tools.d.ts +83 -0
- package/lib/models.d.ts +34 -0
- package/lib/project-view.d.ts +10 -2
- package/lib/schema.d.ts +29 -1
- package/lib/semantic-template.d.ts +63 -0
- package/lib/sync.d.ts +7 -0
- package/node.js +26 -24
- package/package.json +1 -1
- package/variables.d.ts +5 -5
package/index.d.ts
CHANGED
|
@@ -41,9 +41,13 @@ export type { ProjectTable } from './lib/tables';
|
|
|
41
41
|
export { CueExtraction } from './lib/extraction';
|
|
42
42
|
export type { ExtractionRequest, ExtractionResponse } from './lib/extraction';
|
|
43
43
|
export { CueLlmTools } from './lib/llm-tools';
|
|
44
|
-
export type { GenerateWranglingSchemaRequest, GenerateWranglingSchemaResponse } from './lib/llm-tools';
|
|
44
|
+
export type { GenerateWranglingSchemaRequest, GenerateWranglingSchemaResponse, ExistingCategoryForSuggestion, SuggestEntityCategoryRequest, SuggestEntityCategoryResponse, SuggestEntityCategoryMatch, SuggestEntityCategorySuggestion, ColumnToSuggest, ColumnCategorySuggestionResult, SuggestEntityCategoryBatchRequest, SuggestEntityCategoryBatchResponse, } from './lib/llm-tools';
|
|
45
45
|
export { CueDataSources } from './lib/data-sources';
|
|
46
46
|
export type { DataSourceRecord, XToRdfConfig, RmlXToRdfConfig, GraphXToRdfConfig, TypeMappingConfiguration, UploadDataSourceMode, UploadDataSourceResult, } from './lib/data-sources';
|
|
47
|
+
export { CueGisSources } from './lib/gis-sources';
|
|
48
|
+
export type { GisSourceRecord, GisSourceUploadFormat, GisSourceCrs } from './lib/gis-sources';
|
|
49
|
+
export { CueSemanticTemplate } from './lib/semantic-template';
|
|
50
|
+
export type { MutationResult as SemanticTemplateMutationResult, BatchMutationResult as SemanticTemplateBatchMutationResult, ContentCategoryInput, EntityCategoryInput, EntityRelationshipInput, } from './lib/semantic-template';
|
|
47
51
|
export { CueContexts } from './lib/contexts';
|
|
48
52
|
export type { ContextDoc, ContextItem, McpContext } from './lib/models';
|
|
49
53
|
export { CueAppData } from './lib/app-data';
|
package/index.js
CHANGED
|
@@ -1,40 +1,42 @@
|
|
|
1
|
-
import { B as a, C as u, a as C, b as t, c as
|
|
1
|
+
import { B as a, C as u, a as C, b as t, c as i, d as r, e as o, f as c, g as n, h as p, i as S, j as m, k as E, l as A, m as P, n as R, o as l, p as g, q as D, r as j, s as U, t as x, u as d, v as f, w as h, x as I, y as T, z as y, A as G, D as _, E as b, F as q, G as v, H as w, I as B, R as F, S as L, J as N, K as O } from "./document-filter-Cj0Yql1C.js";
|
|
2
2
|
export {
|
|
3
3
|
a as BASE_CURRENCY,
|
|
4
4
|
u as Cue,
|
|
5
5
|
C as CueAdmin,
|
|
6
6
|
t as CueApi,
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
i as CueAppData,
|
|
8
|
+
r as CueApps,
|
|
9
9
|
o as CueAuth,
|
|
10
10
|
c as CueCache,
|
|
11
11
|
n as CueContexts,
|
|
12
12
|
p as CueCurrency,
|
|
13
13
|
S as CueDataSources,
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
m as CueDmsApi,
|
|
15
|
+
E as CueDocumentFilter,
|
|
16
|
+
A as CueExtraction,
|
|
17
17
|
P as CueGis,
|
|
18
|
-
R as
|
|
18
|
+
R as CueGisSources,
|
|
19
|
+
l as CueIndexApi,
|
|
19
20
|
g as CueLlmTools,
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
21
|
+
D as CueMcp,
|
|
22
|
+
j as CuePrivileges,
|
|
23
|
+
U as CueProcessingApi,
|
|
24
|
+
x as CueProfile,
|
|
25
|
+
d as CueProjectDocuments,
|
|
26
|
+
f as CueProjectEntities,
|
|
27
|
+
h as CueProjectSchema,
|
|
28
|
+
I as CueProjectView,
|
|
29
|
+
T as CueProjects,
|
|
29
30
|
y as CueRequestError,
|
|
30
|
-
|
|
31
|
-
_ as
|
|
32
|
-
b as
|
|
33
|
-
q as
|
|
34
|
-
v as
|
|
35
|
-
w as
|
|
36
|
-
B as
|
|
37
|
-
F as
|
|
38
|
-
|
|
39
|
-
|
|
31
|
+
G as CueSemanticTemplate,
|
|
32
|
+
_ as CueSignUp,
|
|
33
|
+
b as CueSignal,
|
|
34
|
+
q as CueStorage,
|
|
35
|
+
v as CueSyncApi,
|
|
36
|
+
w as CueTables,
|
|
37
|
+
B as CueUserSettings,
|
|
38
|
+
F as REQUIRED_ROLES,
|
|
39
|
+
L as SUPPORTED_CURRENCIES,
|
|
40
|
+
N as configureScanWasm,
|
|
41
|
+
O as cueComputed
|
|
40
42
|
};
|
package/lib/api.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { CueBlobStorage } from 'js-databases';
|
|
1
2
|
import { CueAuth } from './auth';
|
|
2
3
|
import { SearchRequest, SearchResponse, ShaclValidationReport, UnitsConsumedDto } from './models';
|
|
3
4
|
import { CueProjects } from './project';
|
|
@@ -14,6 +15,8 @@ import { CueProcessingApi } from './processing';
|
|
|
14
15
|
import { CueDmsApi } from './dms';
|
|
15
16
|
import { CueLlmTools } from './llm-tools';
|
|
16
17
|
import { CueDataSources } from './data-sources';
|
|
18
|
+
import { CueGisSources } from './gis-sources';
|
|
19
|
+
import { CueSemanticTemplate } from './semantic-template';
|
|
17
20
|
export declare class CueApi {
|
|
18
21
|
private readonly _auth;
|
|
19
22
|
private readonly _gatewayUrl;
|
|
@@ -42,11 +45,17 @@ export declare class CueApi {
|
|
|
42
45
|
readonly llmTools: CueLlmTools;
|
|
43
46
|
/** Project-scoped data sources — reusable raw-data-to-RDF pipelines writing into their own named graph. */
|
|
44
47
|
readonly dataSources: CueDataSources;
|
|
48
|
+
/** Project-scoped GIS sources — user-uploaded GeoJSON/KML/Shapefile feature sets, returned by
|
|
49
|
+
* `cue.gis` under the 'custom' category alongside every other GIS category. */
|
|
50
|
+
readonly gisSources: CueGisSources;
|
|
51
|
+
/** Mutates a project's custom extraction/classification schema (content categories, entity
|
|
52
|
+
* categories, entity relationships) and reloads its `databases-cue` schema graph. */
|
|
53
|
+
readonly semanticTemplate: CueSemanticTemplate;
|
|
45
54
|
/** Active language used for language-sensitive SPARQL queries across all project classes. */
|
|
46
55
|
language: string;
|
|
47
56
|
/** Updates the active language. All project classes (`CueProjectSchema`, `CueProjectDocuments`, `CueProjectEntities`) read this at query time. */
|
|
48
57
|
setLanguage(lang: string): void;
|
|
49
|
-
constructor(_auth: CueAuth, _gatewayUrl: string, projects: CueProjects, sync?: CueSyncApi | undefined);
|
|
58
|
+
constructor(_auth: CueAuth, _gatewayUrl: string, projects: CueProjects, sync?: CueSyncApi | undefined, blob?: CueBlobStorage);
|
|
50
59
|
/**
|
|
51
60
|
* Returns standard authentication headers for the current user.
|
|
52
61
|
* Useful when calling Cue-backed services directly (e.g. the GIS proxy).
|
|
@@ -60,8 +69,14 @@ export declare class CueApi {
|
|
|
60
69
|
/**
|
|
61
70
|
* Execute a SPARQL query against the project's triplestore.
|
|
62
71
|
* The user must be authenticated before calling this.
|
|
72
|
+
*
|
|
73
|
+
* The gateway resolves which graph backend (qlever, cue, …) actually serves
|
|
74
|
+
* the query per-project — `graphType` here only needs to distinguish legacy
|
|
75
|
+
* Fuseki, which lives on its own static Kong route rather than that
|
|
76
|
+
* per-project routing. Pass it explicitly if the caller already knows;
|
|
77
|
+
* otherwise it's looked up from the project's own settings.
|
|
63
78
|
*/
|
|
64
|
-
sparql(query: string, projectId: string, graphType?:
|
|
79
|
+
sparql(query: string, projectId: string, graphType?: 'fuseki' | 'qlever'): Promise<unknown>;
|
|
65
80
|
/**
|
|
66
81
|
* Validate a SHACL shape against the project's triplestore.
|
|
67
82
|
*
|
|
@@ -75,7 +90,7 @@ export declare class CueApi {
|
|
|
75
90
|
shacl(shape: string, projectId: string, options?: {
|
|
76
91
|
format?: 'json-ld' | 'turtle';
|
|
77
92
|
verbose?: boolean;
|
|
78
|
-
graphType?:
|
|
93
|
+
graphType?: 'fuseki' | 'qlever';
|
|
79
94
|
}): Promise<ShaclValidationReport | string>;
|
|
80
95
|
/**
|
|
81
96
|
* Per-extension credit rates for `tier` (e.g. `{ pdf: 4, ifc: 2, dwg: 2 }`),
|
package/lib/cue.d.ts
CHANGED
|
@@ -111,7 +111,7 @@ export declare class Cue {
|
|
|
111
111
|
*/
|
|
112
112
|
createProjectEntities(projectId: string, opts?: {
|
|
113
113
|
rdfBase?: string;
|
|
114
|
-
graphType?:
|
|
114
|
+
graphType?: 'fuseki' | 'qlever';
|
|
115
115
|
verbose?: boolean;
|
|
116
116
|
}): CueProjectEntities;
|
|
117
117
|
/**
|
|
@@ -128,7 +128,7 @@ export declare class Cue {
|
|
|
128
128
|
createProjectDocuments(projectId: string, opts?: {
|
|
129
129
|
language?: string;
|
|
130
130
|
rdfBase?: string;
|
|
131
|
-
graphType?:
|
|
131
|
+
graphType?: 'fuseki' | 'qlever';
|
|
132
132
|
verbose?: boolean;
|
|
133
133
|
}): CueProjectDocuments;
|
|
134
134
|
}
|
package/lib/data-sources.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { CueBlobStorage } from 'js-databases';
|
|
1
2
|
import { CueAuth } from './auth';
|
|
2
|
-
export type XToRdfConfig = RmlXToRdfConfig | GraphXToRdfConfig | DecompositionConfig;
|
|
3
|
+
export type XToRdfConfig = RmlXToRdfConfig | GraphXToRdfConfig | DecompositionConfig | SheetXToRdfConfig;
|
|
3
4
|
interface XToRdfConfigBase {
|
|
4
5
|
/** Steps run on the transform's output, in order — see `XToRdfPostProcessingStep`. */
|
|
5
6
|
postProcessing?: XToRdfPostProcessingStep[];
|
|
@@ -51,6 +52,47 @@ export interface DecompositionConfig extends XToRdfConfigBase {
|
|
|
51
52
|
*/
|
|
52
53
|
levels: Record<string, unknown>[];
|
|
53
54
|
}
|
|
55
|
+
export interface SheetXToRdfConfig extends XToRdfConfigBase {
|
|
56
|
+
type: 'sheet';
|
|
57
|
+
mapping: SheetMappingConfiguration;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* How a spreadsheet's columns become RDF: every column is either ignored, an entity — minted
|
|
61
|
+
* onto the same deterministic-IRI scheme `graph`/`decomposition` use
|
|
62
|
+
* (`<rdfBase><projectId>/<uuidv5(value+categoryIri)>`) — or an attribute of one entity column (a
|
|
63
|
+
* `qcy:Property` node linked via `qcy:hasProperty`). A relationship connects two entity columns
|
|
64
|
+
* via a chosen predicate, read off the same row. Unlike `wizardConfig`/`levels` above, this is
|
|
65
|
+
* NOT opaque to the backend — it's the actual input the sheet transform interprets row by row.
|
|
66
|
+
*/
|
|
67
|
+
export interface SheetMappingConfiguration {
|
|
68
|
+
id?: string;
|
|
69
|
+
name: string;
|
|
70
|
+
columnRoles: Record<string, SheetColumnRole>;
|
|
71
|
+
relationMappings: SheetRelationMapping[];
|
|
72
|
+
fileLinkage?: SheetFileLinkage | null;
|
|
73
|
+
}
|
|
74
|
+
export type SheetColumnRole = {
|
|
75
|
+
kind: 'unmapped';
|
|
76
|
+
} | {
|
|
77
|
+
kind: 'entity';
|
|
78
|
+
categoryIri: string;
|
|
79
|
+
} | {
|
|
80
|
+
kind: 'attribute';
|
|
81
|
+
entityColumn: string;
|
|
82
|
+
label: string;
|
|
83
|
+
};
|
|
84
|
+
export interface SheetRelationMapping {
|
|
85
|
+
sourceColumn: string;
|
|
86
|
+
targetColumn: string;
|
|
87
|
+
predicateIri: string;
|
|
88
|
+
/** True when the predicate points from target to source instead of source to target. */
|
|
89
|
+
reversed?: boolean;
|
|
90
|
+
}
|
|
91
|
+
/** "Rows represent files" — a sheet-wide special case, not a per-column role. */
|
|
92
|
+
export interface SheetFileLinkage {
|
|
93
|
+
filePathColumn: string;
|
|
94
|
+
md5Column?: string;
|
|
95
|
+
}
|
|
54
96
|
/**
|
|
55
97
|
* A step applied to a transform's *output*, after the CONSTRUCT query (or RML mapping) has run.
|
|
56
98
|
*
|
|
@@ -139,14 +181,25 @@ export interface DataSourceProgressEvent {
|
|
|
139
181
|
export declare class CueDataSources {
|
|
140
182
|
private readonly _auth;
|
|
141
183
|
private readonly _gatewayUrl;
|
|
142
|
-
|
|
184
|
+
private readonly _blob?;
|
|
185
|
+
constructor(_auth: CueAuth, _gatewayUrl: string, _blob?: CueBlobStorage | undefined);
|
|
143
186
|
createDataSource(projectId: string, name: string, config: XToRdfConfig): Promise<DataSourceRecord>;
|
|
144
187
|
updateDataSource(projectId: string, id: string, updates: {
|
|
145
188
|
name?: string;
|
|
146
189
|
config?: XToRdfConfig;
|
|
147
190
|
}): Promise<DataSourceRecord>;
|
|
148
|
-
/**
|
|
149
|
-
|
|
191
|
+
/**
|
|
192
|
+
* Hard delete — also removes the data source's triples from the graph/ledger. This fetches the
|
|
193
|
+
* whole named graph and round-trips to the ledger/graph store, which can take tens of seconds;
|
|
194
|
+
* the endpoint streams NDJSON progress while that's in flight — pass `onProgress` to receive it
|
|
195
|
+
* (see `uploadData`'s doc comment for the wire format). Still bounded by a client-side timeout
|
|
196
|
+
* covering the server's own bounded retries against the ledger/graph store (30s x up to 3
|
|
197
|
+
* retries each, for both) plus normal request/response overhead, in case the stream stalls
|
|
198
|
+
* with no further progress.
|
|
199
|
+
*/
|
|
200
|
+
deleteDataSource(projectId: string, id: string, onProgress?: (event: DataSourceProgressEvent) => void): Promise<{
|
|
201
|
+
removed: number;
|
|
202
|
+
}>;
|
|
150
203
|
/**
|
|
151
204
|
* Uploads new data to be transformed by the data source's stored config and
|
|
152
205
|
* committed into its named graph. `mode: 'replace'` swaps out everything
|
|
@@ -156,11 +209,13 @@ export declare class CueDataSources {
|
|
|
156
209
|
* they're all loaded into one shared graph server-side before the stored
|
|
157
210
|
* CONSTRUCT query runs against it. `type: 'rml'` configs expect exactly one.
|
|
158
211
|
*
|
|
159
|
-
*
|
|
160
|
-
*
|
|
161
|
-
*
|
|
162
|
-
*
|
|
163
|
-
*
|
|
212
|
+
* Each file is uploaded straight to storage first (see `_stageFiles`) — the request that
|
|
213
|
+
* follows carries only small file references, never the bytes, so file size never runs into
|
|
214
|
+
* Cloud Run's request-size limit. `onProgress` receives `phase: 'uploading'` events for that
|
|
215
|
+
* step, then the endpoint's usual NDJSON processing-progress events once the notify request is
|
|
216
|
+
* in flight. The call still resolves/rejects only once, with the final result or an `Error`
|
|
217
|
+
* built from the stream's `error` line (a non-2xx HTTP status, e.g. an auth/guard rejection
|
|
218
|
+
* before the handler even runs, is still thrown from `response.ok` as before).
|
|
164
219
|
*/
|
|
165
220
|
uploadData(projectId: string, id: string, files: Blob[], mode: UploadDataSourceMode, onProgress?: (event: DataSourceProgressEvent) => void): Promise<UploadDataSourceResult>;
|
|
166
221
|
/**
|
|
@@ -168,12 +223,23 @@ export declare class CueDataSources {
|
|
|
168
223
|
* without creating a data source or writing anything to the graph/ledger —
|
|
169
224
|
* for previewing a transform (e.g. while building a CONSTRUCT query or RML
|
|
170
225
|
* mapping) before saving it. Same transform code as `uploadData`, so a
|
|
171
|
-
* preview never drifts from what an actual upload would produce.
|
|
172
|
-
* progress the same way — see
|
|
226
|
+
* preview never drifts from what an actual upload would produce. Uploads
|
|
227
|
+
* `files` to storage first and streams progress the same way — see
|
|
228
|
+
* `uploadData`'s doc comment.
|
|
173
229
|
*/
|
|
174
230
|
previewTransform(projectId: string, config: XToRdfConfig, files: Blob[], onProgress?: (event: DataSourceProgressEvent) => void): Promise<{
|
|
175
231
|
turtle: string;
|
|
176
232
|
}>;
|
|
233
|
+
/**
|
|
234
|
+
* Uploads every file straight to the raw bucket's `${projectId}/_tmp-uploads/` prefix (server
|
|
235
|
+
* deletes each one right after processing it — see writers-commands' `_withTempFiles`), so
|
|
236
|
+
* `uploadData`/`previewTransform`'s own request only ever carries small JSON references —
|
|
237
|
+
* bytes never cross Cloud Run's request-size cap, no matter how large the file. Reports
|
|
238
|
+
* upload-byte progress through `onProgress` as `phase: 'uploading'`, aggregated across every
|
|
239
|
+
* file in the batch (not most-recent-file-wins) since callers pass everything to `uploadData`
|
|
240
|
+
* in one call.
|
|
241
|
+
*/
|
|
242
|
+
private _stageFiles;
|
|
177
243
|
/** Reads an NDJSON response (`{type:'progress',...}` lines, then one `{type:'result',...}`
|
|
178
244
|
* or `{type:'error',...}` line), forwarding progress events to `onProgress` and
|
|
179
245
|
* resolving/rejecting with the terminal event. The HTTP status alone can't signal
|
package/lib/document-filter.d.ts
CHANGED
|
@@ -27,7 +27,7 @@ export declare class CueDocumentFilter {
|
|
|
27
27
|
private readonly _api;
|
|
28
28
|
private readonly _projectId;
|
|
29
29
|
private readonly _graphType?;
|
|
30
|
-
constructor(_api: CueApi, _projectId: string, _graphType?:
|
|
30
|
+
constructor(_api: CueApi, _projectId: string, _graphType?: "fuseki" | "qlever" | undefined);
|
|
31
31
|
/**
|
|
32
32
|
* Returns which mime, content and entity-category options are available among
|
|
33
33
|
* documents that satisfy `applied`. Pass an empty object (or omit) to get
|
package/lib/documents.d.ts
CHANGED
|
@@ -52,7 +52,7 @@ export declare class CueProjectDocuments {
|
|
|
52
52
|
readonly projectDocumentsData: ReadonlySignal<ProjectDocumentsData>;
|
|
53
53
|
constructor(_api: CueApi, _projectId: string, language?: string,
|
|
54
54
|
/** Override the RDF resource base URL. Defaults to `https://cue.qaecy.com/r/`. */
|
|
55
|
-
rdfBase?: string, _graphType?:
|
|
55
|
+
rdfBase?: string, _graphType?: "fuseki" | "qlever" | undefined, _verbose?: boolean);
|
|
56
56
|
/**
|
|
57
57
|
* Resets all document state. Call when the active project changes.
|
|
58
58
|
* Follow with `fetchOverview()` once the triplestore is ready.
|
package/lib/entities.d.ts
CHANGED
|
@@ -70,7 +70,7 @@ export declare class CueProjectEntities {
|
|
|
70
70
|
readonly entityGraph: ReadonlySignal<ProjectEntitiesData | undefined>;
|
|
71
71
|
constructor(_api: CueApi, _projectId: string,
|
|
72
72
|
/** Override the RDF resource base URL. Defaults to `https://cue.qaecy.com/r/`. */
|
|
73
|
-
rdfBase?: string, _graphType?:
|
|
73
|
+
rdfBase?: string, _graphType?: "fuseki" | "qlever" | undefined, _verbose?: boolean);
|
|
74
74
|
/**
|
|
75
75
|
* Constructs the full RDF IRI for the given entity UUID.
|
|
76
76
|
* Use this to bridge the UUID-based batch APIs and the IRI-based per-entity APIs.
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { FeatureCollection } from 'geojson';
|
|
2
|
+
import { CueAuth } from './auth';
|
|
3
|
+
export type GisSourceUploadFormat = 'geojson' | 'kml' | 'shapefile-zip';
|
|
4
|
+
/** `'auto'` (the default) detects LV95/LV03 from a GeoJSON legacy `crs` member or a Shapefile's
|
|
5
|
+
* `.prj` sidecar — pass an explicit value when a file lacks that information altogether. KML is
|
|
6
|
+
* always WGS84 per spec and never reprojected either way. */
|
|
7
|
+
export type GisSourceCrs = 'auto' | 'WGS84' | 'LV95' | 'LV03';
|
|
8
|
+
export interface GisSourceRecord {
|
|
9
|
+
id: string;
|
|
10
|
+
projectId: string;
|
|
11
|
+
name: string;
|
|
12
|
+
createdAt: string;
|
|
13
|
+
createdBy: string;
|
|
14
|
+
updatedAt: string;
|
|
15
|
+
updatedBy: string;
|
|
16
|
+
/** `featureCollection.features.length`, cached at upload time. */
|
|
17
|
+
featureCount: number;
|
|
18
|
+
/** WGS84 [west, south, east, north], or null when the source has no features. */
|
|
19
|
+
bbox: [number, number, number, number] | null;
|
|
20
|
+
/** The format originally uploaded — display-only, `featureCollection` below is always WGS84. */
|
|
21
|
+
sourceFormat: GisSourceUploadFormat;
|
|
22
|
+
/** The CRS resolution that was actually applied — display-only, same reason as `sourceFormat`. */
|
|
23
|
+
sourceCrs: GisSourceCrs;
|
|
24
|
+
/** Canonical WGS84 GeoJSON — the actual feature data, same shape used everywhere else in the
|
|
25
|
+
* GIS pipeline (see `cue.gis`). */
|
|
26
|
+
featureCollection: FeatureCollection;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Client for project-scoped GIS sources — user-uploaded GeoJSON/KML/Shapefile feature sets that
|
|
30
|
+
* are stored on the project and returned by `cue.gis` under the `'custom'` category, alongside
|
|
31
|
+
* every other (WFS-backed) category. Reprojection to WGS84 (from LV95/LV03) happens server-side
|
|
32
|
+
* at upload time — `featureCollection` is always WGS84.
|
|
33
|
+
*
|
|
34
|
+
* Mutations (create/update/delete) go through writers-commands and require the syncer role;
|
|
35
|
+
* reads (list/get) go through data-views.
|
|
36
|
+
*
|
|
37
|
+
* Exposed as `cue.api.gisSources`.
|
|
38
|
+
*/
|
|
39
|
+
export declare class CueGisSources {
|
|
40
|
+
private readonly _auth;
|
|
41
|
+
private readonly _gatewayUrl;
|
|
42
|
+
constructor(_auth: CueAuth, _gatewayUrl: string);
|
|
43
|
+
listGisSources(projectId: string): Promise<GisSourceRecord[]>;
|
|
44
|
+
getGisSource(projectId: string, id: string): Promise<GisSourceRecord>;
|
|
45
|
+
/** `filename`'s extension (`.geojson`/`.json`/`.kml`/`.zip`) tells the server which parser to
|
|
46
|
+
* use — pass it explicitly since `file` may not carry a usable `name` (e.g. a `Blob`). */
|
|
47
|
+
createGisSource(projectId: string, name: string, file: Blob, filename: string, crs?: GisSourceCrs): Promise<GisSourceRecord>;
|
|
48
|
+
/** Omitting `file` renames the source without touching its stored features. */
|
|
49
|
+
updateGisSource(projectId: string, id: string, updates: {
|
|
50
|
+
name?: string;
|
|
51
|
+
file?: Blob;
|
|
52
|
+
filename?: string;
|
|
53
|
+
crs?: GisSourceCrs;
|
|
54
|
+
}): Promise<GisSourceRecord>;
|
|
55
|
+
deleteGisSource(projectId: string, id: string): Promise<void>;
|
|
56
|
+
private _errorMessage;
|
|
57
|
+
}
|
package/lib/llm-tools.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { CueAuth } from './auth';
|
|
2
2
|
export declare const ENDPOINT_WRANGLING_SCHEMA_GENERATE = "/llm-tools/wrangling-schema/generate";
|
|
3
3
|
export declare const ENDPOINT_WRANGLING_SCHEMA_REFINE = "/llm-tools/wrangling-schema/refine";
|
|
4
|
+
export declare const ENDPOINT_ENTITY_CATEGORY_SUGGEST = "/llm-tools/entity-category-suggestion/suggest";
|
|
5
|
+
export declare const ENDPOINT_ENTITY_CATEGORY_SUGGEST_BATCH = "/llm-tools/entity-category-suggestion/suggest-batch";
|
|
4
6
|
export interface GenerateWranglingSchemaRequest {
|
|
5
7
|
/** Plain-language instruction for how the sheet should be reshaped. */
|
|
6
8
|
prompt: string;
|
|
@@ -26,6 +28,11 @@ export interface RefineWranglingSchemaRequest {
|
|
|
26
28
|
currentRules: Record<string, unknown>[];
|
|
27
29
|
/** The new, follow-up instruction. */
|
|
28
30
|
prompt: string;
|
|
31
|
+
/**
|
|
32
|
+
* How the follow-up instruction should treat `currentRules`: "append" only adds
|
|
33
|
+
* rules for what it describes, "change" revises whichever current rules it concerns.
|
|
34
|
+
*/
|
|
35
|
+
mode: 'append' | 'change';
|
|
29
36
|
/** Column names available in the sheet. */
|
|
30
37
|
columns: string[];
|
|
31
38
|
/** A handful of real rows, given as worked examples for the model. */
|
|
@@ -37,6 +44,67 @@ export interface RefineWranglingSchemaResponse {
|
|
|
37
44
|
/** The complete, updated rule set — a replacement, not a diff. Same shape as `generate`'s. */
|
|
38
45
|
rules: Record<string, unknown>[];
|
|
39
46
|
}
|
|
47
|
+
/** An already-existing entity category/relationship the candidate can be matched against or nested under. */
|
|
48
|
+
export interface ExistingCategoryForSuggestion {
|
|
49
|
+
iri: string;
|
|
50
|
+
label: string;
|
|
51
|
+
definition?: string;
|
|
52
|
+
/** IRI of the parent category/relationship, if nested. */
|
|
53
|
+
parent?: string;
|
|
54
|
+
}
|
|
55
|
+
export interface SuggestEntityCategoryRequest {
|
|
56
|
+
/** The label the person typed for the new category/relationship they want to add. */
|
|
57
|
+
label: string;
|
|
58
|
+
/** Optional free-text description, if the person gave one. */
|
|
59
|
+
description?: string;
|
|
60
|
+
kind: 'category' | 'relationship';
|
|
61
|
+
/** Every already-existing entity category (or relationship, matching `kind`) in the project. */
|
|
62
|
+
existingCategories: ExistingCategoryForSuggestion[];
|
|
63
|
+
/** Project the request is scoped to. */
|
|
64
|
+
projectId: string;
|
|
65
|
+
}
|
|
66
|
+
export interface SuggestEntityCategoryMatch {
|
|
67
|
+
/** IRI of the existing category/relationship this candidate matches — one of the IRIs given in `existingCategories`. */
|
|
68
|
+
iri: string;
|
|
69
|
+
confidence: number;
|
|
70
|
+
reasoning: string;
|
|
71
|
+
}
|
|
72
|
+
export interface SuggestEntityCategorySuggestion {
|
|
73
|
+
label: string;
|
|
74
|
+
definition: string;
|
|
75
|
+
/** IRI of the existing category/relationship this new one should nest under, if any. */
|
|
76
|
+
parentIri?: string;
|
|
77
|
+
reasoning: string;
|
|
78
|
+
}
|
|
79
|
+
export interface SuggestEntityCategoryResponse {
|
|
80
|
+
decision: 'match' | 'new';
|
|
81
|
+
match?: SuggestEntityCategoryMatch;
|
|
82
|
+
suggestion?: SuggestEntityCategorySuggestion;
|
|
83
|
+
}
|
|
84
|
+
/** A sheet column not yet assigned a role, plus a few real values to seed the model. */
|
|
85
|
+
export interface ColumnToSuggest {
|
|
86
|
+
column: string;
|
|
87
|
+
sampleValues?: string[];
|
|
88
|
+
}
|
|
89
|
+
export interface ColumnCategorySuggestionResult {
|
|
90
|
+
column: string;
|
|
91
|
+
/** "skip" — this column doesn't look like a distinct entity and is left unmapped. */
|
|
92
|
+
decision: 'skip' | 'match' | 'new';
|
|
93
|
+
match?: SuggestEntityCategoryMatch;
|
|
94
|
+
suggestion?: SuggestEntityCategorySuggestion;
|
|
95
|
+
}
|
|
96
|
+
export interface SuggestEntityCategoryBatchRequest {
|
|
97
|
+
/** Every currently-unmapped column, each with a few real sample values. */
|
|
98
|
+
columns: ColumnToSuggest[];
|
|
99
|
+
/** Every already-existing entity category in the project. */
|
|
100
|
+
existingCategories: ExistingCategoryForSuggestion[];
|
|
101
|
+
/** Project the request is scoped to. */
|
|
102
|
+
projectId: string;
|
|
103
|
+
}
|
|
104
|
+
export interface SuggestEntityCategoryBatchResponse {
|
|
105
|
+
/** One result per given column, in the same order. */
|
|
106
|
+
results: ColumnCategorySuggestionResult[];
|
|
107
|
+
}
|
|
40
108
|
/**
|
|
41
109
|
* Client for the llm-tools guarded-LLM endpoints — small, single-purpose
|
|
42
110
|
* backend calls that turn a prompt plus example data into a structured JSON
|
|
@@ -61,4 +129,19 @@ export declare class CueLlmTools {
|
|
|
61
129
|
* than starts over.
|
|
62
130
|
*/
|
|
63
131
|
refineWranglingSchema(request: RefineWranglingSchemaRequest): Promise<RefineWranglingSchemaResponse>;
|
|
132
|
+
/**
|
|
133
|
+
* Given a label (and optional description) for a new entity category or relationship, decides
|
|
134
|
+
* whether it already exists in the project's ontology under a different name/wording — so a
|
|
135
|
+
* person doesn't have to eyeball a long list themselves — or suggests a well-formed new one,
|
|
136
|
+
* including a parent nested under an existing category/relationship when that fits.
|
|
137
|
+
*/
|
|
138
|
+
suggestEntityCategory(request: SuggestEntityCategoryRequest): Promise<SuggestEntityCategoryResponse>;
|
|
139
|
+
/**
|
|
140
|
+
* Given every currently-unmapped column in a sheet (name plus a few real values) and the
|
|
141
|
+
* project's existing entity categories, decides for each one whether it should stay unmapped,
|
|
142
|
+
* map to an existing category, or become a well-formed new one — one call covering every
|
|
143
|
+
* column at once, so the model can also stay consistent across them (e.g. not suggesting the
|
|
144
|
+
* same new category twice under different names).
|
|
145
|
+
*/
|
|
146
|
+
suggestEntityCategoryBatch(request: SuggestEntityCategoryBatchRequest): Promise<SuggestEntityCategoryBatchResponse>;
|
|
64
147
|
}
|
package/lib/models.d.ts
CHANGED
|
@@ -115,6 +115,26 @@ export interface McpContext {
|
|
|
115
115
|
id: string;
|
|
116
116
|
text: string;
|
|
117
117
|
}
|
|
118
|
+
/**
|
|
119
|
+
* Which service owns this project's INDEX — i.e. who applies writes to the
|
|
120
|
+
* graph/vector/FTS trio and owns the rebuild lifecycle for them.
|
|
121
|
+
*
|
|
122
|
+
* Deliberately a sibling of `graph`, not a new `graph.type` value: `cue` is not
|
|
123
|
+
* a graph backend. `databases-cue` owns all three engines, so `graph.type:
|
|
124
|
+
* 'cue'` would say "the graph lives at cue" while leaving vector and FTS
|
|
125
|
+
* pointed at `writers-index` — two owners for one project, which is the exact
|
|
126
|
+
* split this field exists to prevent. See the monorepo's
|
|
127
|
+
* `apps/databases/cue/PLAN.md` §9b.
|
|
128
|
+
*/
|
|
129
|
+
export type IndexService = 'writers-index' | 'cue';
|
|
130
|
+
export interface IndexSettings {
|
|
131
|
+
service: IndexService;
|
|
132
|
+
/**
|
|
133
|
+
* Optional address override. Omitted means "the deployment's configured
|
|
134
|
+
* endpoint for `service`" — mirrors how `graph.uri` relates to `graph.type`.
|
|
135
|
+
*/
|
|
136
|
+
uri?: string;
|
|
137
|
+
}
|
|
118
138
|
export interface ProjectSettings {
|
|
119
139
|
views?: Array<{
|
|
120
140
|
id: string;
|
|
@@ -125,8 +145,22 @@ export interface ProjectSettings {
|
|
|
125
145
|
type: 'qlever' | 'fuseki';
|
|
126
146
|
uri?: string;
|
|
127
147
|
};
|
|
148
|
+
/**
|
|
149
|
+
* Absent means `writers-index` — every project predating this field is on it,
|
|
150
|
+
* so the default has to be the status quo, not the new service.
|
|
151
|
+
*/
|
|
152
|
+
index?: IndexSettings;
|
|
128
153
|
/** Processing tier determining credit costs. Defaults to "l" if not set. */
|
|
129
154
|
tier?: 's' | 'm' | 'l';
|
|
155
|
+
/**
|
|
156
|
+
* Gzip-compress eligible raw uploads for this project (see `gzip-steps.md`
|
|
157
|
+
* Phase 3 — per-project rollout gate, not a global switch). Absent/false
|
|
158
|
+
* means uploads stay uncompressed, which must stay the default until a
|
|
159
|
+
* project has been verified end-to-end. No admin-panel UI toggles this
|
|
160
|
+
* today (same as `tier` on an existing project) — set it directly on the
|
|
161
|
+
* project's Firestore doc.
|
|
162
|
+
*/
|
|
163
|
+
gzipEnabled?: boolean;
|
|
130
164
|
}
|
|
131
165
|
/** One daily snapshot in `QleverStats.history` — a calendar day this index's stats were (re)computed. */
|
|
132
166
|
export interface QleverStatsHistoryEntry {
|
package/lib/project-view.d.ts
CHANGED
|
@@ -4,12 +4,14 @@ import { CueProjectEntities } from './entities';
|
|
|
4
4
|
import { CueProjectDocuments } from './documents';
|
|
5
5
|
import { ReadonlySignal } from './signal';
|
|
6
6
|
import { SearchOptions, SearchResponse, CategoryDef, RelationshipDef, EntityDetailedData, EntityRelationships, ProjectEntitiesData, DocumentInfo, ProjectDocumentsData } from './models';
|
|
7
|
+
import { ContentCategoryInput, EntityCategoryInput, EntityRelationshipInput } from './semantic-template';
|
|
7
8
|
export interface CueProjectViewOptions {
|
|
8
9
|
language: string;
|
|
9
10
|
/** Override the RDF resource base URL. Defaults to `https://cue.qaecy.com/r/`. */
|
|
10
11
|
rdfBase?: string;
|
|
11
|
-
/** Graph engine type
|
|
12
|
-
|
|
12
|
+
/** Graph engine type ('qlever' or legacy 'fuseki'). No longer read from the
|
|
13
|
+
* project document — see project-migration.md §4.3. */
|
|
14
|
+
graphType?: 'fuseki' | 'qlever';
|
|
13
15
|
/** Enable verbose debug logging for entity and document fetch stats. */
|
|
14
16
|
verbose?: boolean;
|
|
15
17
|
}
|
|
@@ -60,6 +62,12 @@ export declare class CueProjectView {
|
|
|
60
62
|
readonly searchResults: ReadonlySignal<SearchResponse | undefined>;
|
|
61
63
|
private _destroyed;
|
|
62
64
|
constructor(_api: CueApi, _projectId: string, { language, rdfBase, graphType, verbose }: CueProjectViewOptions);
|
|
65
|
+
/** Creates a new content category, appending it to `availableContentCategories` on success. */
|
|
66
|
+
createContentCategory(item: ContentCategoryInput): Promise<CategoryDef | null>;
|
|
67
|
+
/** Creates a new entity category, appending it to `availableEntityCategories` on success. */
|
|
68
|
+
createEntityCategory(item: EntityCategoryInput): Promise<CategoryDef | null>;
|
|
69
|
+
/** Creates a new entity relationship, appending it to `availableEntityRelationships` on success. */
|
|
70
|
+
createEntityRelationship(item: EntityRelationshipInput): Promise<RelationshipDef | null>;
|
|
63
71
|
/**
|
|
64
72
|
* Lazily batch-fetch core data (label + categories) for the given entity UUIDs.
|
|
65
73
|
* Already-fetched UUIDs are skipped. Populates `entityInfoMap`.
|
package/lib/schema.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { CueApi } from './api';
|
|
2
2
|
import { ReadonlySignal } from './signal';
|
|
3
3
|
import { CategoryDef, RelationshipDef } from './models';
|
|
4
|
+
import { ContentCategoryInput, EntityCategoryInput, EntityRelationshipInput } from './semantic-template';
|
|
4
5
|
/**
|
|
5
6
|
* Holds the schema for a single project: available content categories,
|
|
6
7
|
* entity categories, and entity relationship types.
|
|
@@ -49,7 +50,7 @@ export declare class CueProjectSchema {
|
|
|
49
50
|
* completed (or failed). Await this before reading signal values imperatively.
|
|
50
51
|
*/
|
|
51
52
|
readonly ready: Promise<void>;
|
|
52
|
-
constructor(_api: CueApi, _projectId: string, language: string, _graphType?:
|
|
53
|
+
constructor(_api: CueApi, _projectId: string, language: string, _graphType?: "fuseki" | "qlever" | undefined, verbose?: boolean);
|
|
53
54
|
/** Returns the currently active language. */
|
|
54
55
|
get language(): string;
|
|
55
56
|
/**
|
|
@@ -63,6 +64,33 @@ export declare class CueProjectSchema {
|
|
|
63
64
|
* Useful when the triplestore data has changed.
|
|
64
65
|
*/
|
|
65
66
|
refresh(): Promise<void>;
|
|
67
|
+
/**
|
|
68
|
+
* Creates a new content category via `cue.api.semanticTemplate` and, on success,
|
|
69
|
+
* appends it to {@link availableContentCategories} in place — no `refresh()`
|
|
70
|
+
* needed for it to show up in every subscriber.
|
|
71
|
+
*/
|
|
72
|
+
createContentCategory(item: ContentCategoryInput): Promise<CategoryDef | null>;
|
|
73
|
+
/**
|
|
74
|
+
* Creates a new entity category via `cue.api.semanticTemplate` and, on success,
|
|
75
|
+
* appends it to {@link availableEntityCategories} in place — no `refresh()`
|
|
76
|
+
* needed for it to show up in every subscriber.
|
|
77
|
+
*/
|
|
78
|
+
createEntityCategory(item: EntityCategoryInput): Promise<CategoryDef | null>;
|
|
79
|
+
/**
|
|
80
|
+
* Creates a new entity relationship via `cue.api.semanticTemplate` and, on
|
|
81
|
+
* success, appends it to {@link availableEntityRelationships} in place — no
|
|
82
|
+
* `refresh()` needed for it to show up in every subscriber.
|
|
83
|
+
*/
|
|
84
|
+
createEntityRelationship(item: EntityRelationshipInput): Promise<RelationshipDef | null>;
|
|
85
|
+
/**
|
|
86
|
+
* Turns a successful create-mutation result into a {@link CategoryDef} and
|
|
87
|
+
* appends it to both the cached language-independent snapshot and the live
|
|
88
|
+
* signal. Updating `_snapshot` too (not just the signal) matters: it's what
|
|
89
|
+
* `setLanguage()`/`_apply()` re-derive from, so skipping it would make the
|
|
90
|
+
* appended item vanish on the next language switch. Returns `null` when the
|
|
91
|
+
* mutation failed (no IRI was assigned).
|
|
92
|
+
*/
|
|
93
|
+
private _appendCreated;
|
|
66
94
|
private _load;
|
|
67
95
|
/**
|
|
68
96
|
* Fetches the schema once. On QLever the pre-computed `schemas` materialized
|