@qaecy/cue-sdk 0.0.33 → 0.0.35
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/assets/wasm/dir_scanner_wasm.mjs +461 -0
- package/assets/wasm/dir_scanner_wasm_bg.wasm +0 -0
- package/document-filter-Dr_-QbaZ.js +10187 -0
- package/index.d.ts +14 -3
- package/index.js +33 -24
- package/lib/api.d.ts +79 -0
- package/lib/app-data.d.ts +21 -0
- package/lib/apps.d.ts +24 -0
- package/lib/auth.d.ts +77 -0
- package/lib/cache.d.ts +26 -0
- package/lib/contexts.d.ts +17 -0
- package/lib/cue-node.d.ts +19 -0
- package/lib/cue.d.ts +129 -0
- package/lib/currency.d.ts +34 -0
- package/lib/document-filter.d.ts +76 -0
- package/lib/documents.d.ts +223 -0
- package/lib/entities.d.ts +211 -0
- package/lib/extraction.d.ts +48 -0
- package/lib/gis.d.ts +89 -0
- package/lib/index-api.d.ts +39 -0
- package/lib/mcp.d.ts +61 -0
- package/lib/models.d.ts +662 -0
- package/lib/privileges.d.ts +76 -0
- package/lib/processing.d.ts +25 -0
- package/lib/profile.d.ts +128 -0
- package/lib/project-view.d.ts +112 -0
- package/lib/project.d.ts +56 -0
- package/lib/schema.d.ts +84 -0
- package/lib/signal.d.ts +38 -0
- package/lib/signup.d.ts +73 -0
- package/lib/storage.d.ts +52 -0
- package/lib/sync.d.ts +153 -0
- package/lib/tables.d.ts +14 -0
- package/lib/user-settings.d.ts +22 -0
- package/node.js +33 -24
- package/package.json +5 -6
- package/variables.d.ts +71 -0
- package/browser.js +0 -37970
package/lib/models.d.ts
ADDED
|
@@ -0,0 +1,662 @@
|
|
|
1
|
+
import { SupportedCurrency } from './currency';
|
|
2
|
+
export type CueEnvironment = 'production' | 'emulator';
|
|
3
|
+
export interface CueEndpoints {
|
|
4
|
+
/** API gateway base URL */
|
|
5
|
+
gatewayUrl: string;
|
|
6
|
+
/** Token exchange endpoint for API key sign-in */
|
|
7
|
+
tokenUrl: string;
|
|
8
|
+
/** Firebase Auth emulator URL */
|
|
9
|
+
authEmulatorUrl: string;
|
|
10
|
+
/** Firebase Storage emulator hostname, no protocol (emulator mode only, default: 'localhost') */
|
|
11
|
+
storageEmulatorHost: string;
|
|
12
|
+
/** Firebase Storage emulator port (emulator mode only, default: 9199) */
|
|
13
|
+
storageEmulatorPort: number;
|
|
14
|
+
/** Firebase Firestore emulator hostname, no protocol (emulator mode only, default: 'localhost') */
|
|
15
|
+
firestoreEmulatorHost: string;
|
|
16
|
+
/** Firebase Firestore emulator port (emulator mode only, default: 8080) */
|
|
17
|
+
firestoreEmulatorPort: number;
|
|
18
|
+
}
|
|
19
|
+
export interface CueSdkConfig {
|
|
20
|
+
/** Firebase API key for this project. Defaults to the QAECY demo app if omitted. */
|
|
21
|
+
apiKey?: string;
|
|
22
|
+
/** Firebase App ID. Defaults to the QAECY demo app if omitted. */
|
|
23
|
+
appId?: string;
|
|
24
|
+
/** Firebase Measurement ID. Defaults to the QAECY demo app if omitted. */
|
|
25
|
+
measurementId?: string;
|
|
26
|
+
/** Target environment. Defaults to 'production'. */
|
|
27
|
+
environment?: CueEnvironment;
|
|
28
|
+
/** Override individual endpoint URLs. Takes precedence over environment. */
|
|
29
|
+
endpoints?: Partial<CueEndpoints>;
|
|
30
|
+
/** Enable verbose debug logging for all entity/document store operations. */
|
|
31
|
+
verbose?: boolean;
|
|
32
|
+
}
|
|
33
|
+
export type SsoProvider = 'google' | 'microsoft';
|
|
34
|
+
export interface PasswordCredentials {
|
|
35
|
+
email: string;
|
|
36
|
+
password: string;
|
|
37
|
+
}
|
|
38
|
+
export interface SearchRequest {
|
|
39
|
+
/** Natural language query or search term */
|
|
40
|
+
term: string;
|
|
41
|
+
/** Project ID to search within */
|
|
42
|
+
projectId: string;
|
|
43
|
+
/** Optional category filters */
|
|
44
|
+
categories?: string[];
|
|
45
|
+
}
|
|
46
|
+
/** Options for `CueProjectView.search()`. */
|
|
47
|
+
export interface SearchOptions {
|
|
48
|
+
/** Optional content category IRI filters. */
|
|
49
|
+
categories?: string[];
|
|
50
|
+
}
|
|
51
|
+
export interface SearchSource {
|
|
52
|
+
item: string;
|
|
53
|
+
parent: string;
|
|
54
|
+
content: string;
|
|
55
|
+
}
|
|
56
|
+
export interface SearchResponse {
|
|
57
|
+
id: string;
|
|
58
|
+
question: string;
|
|
59
|
+
questionHTML: string;
|
|
60
|
+
response: string;
|
|
61
|
+
sources: SearchSource[];
|
|
62
|
+
rankedSources: SearchSource[];
|
|
63
|
+
}
|
|
64
|
+
export interface ContextItem {
|
|
65
|
+
id: string;
|
|
66
|
+
type: string;
|
|
67
|
+
relevance: number;
|
|
68
|
+
info: Record<string, unknown>;
|
|
69
|
+
sub_items: ContextItem[];
|
|
70
|
+
}
|
|
71
|
+
export interface ContextDoc {
|
|
72
|
+
id: string;
|
|
73
|
+
total: number;
|
|
74
|
+
operation: {
|
|
75
|
+
type: string;
|
|
76
|
+
};
|
|
77
|
+
input: string;
|
|
78
|
+
items: ContextItem[];
|
|
79
|
+
within: string[];
|
|
80
|
+
meta: {
|
|
81
|
+
time_created: string;
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* The standard result every Cue Index MCP *data tool* returns
|
|
86
|
+
* (`search`, `lookup`, `traverse`, `combine`, `select`, `schema`, `inspect`):
|
|
87
|
+
* `id` is the persistent context the call produced, `text` is the stringified
|
|
88
|
+
* snippet the tool renders for the calling agent. {@link CueMcp.callTool}
|
|
89
|
+
* proxies this object through exactly as the endpoint returns it.
|
|
90
|
+
*/
|
|
91
|
+
export interface McpContext {
|
|
92
|
+
id: string;
|
|
93
|
+
text: string;
|
|
94
|
+
}
|
|
95
|
+
export interface ProjectSettings {
|
|
96
|
+
views?: Array<{
|
|
97
|
+
id: string;
|
|
98
|
+
pinned?: boolean;
|
|
99
|
+
}>;
|
|
100
|
+
chatDisabled: boolean;
|
|
101
|
+
graph?: {
|
|
102
|
+
type: 'qlever' | 'fuseki';
|
|
103
|
+
uri?: string;
|
|
104
|
+
};
|
|
105
|
+
/** Processing tier determining credit costs. Defaults to "l" if not set. */
|
|
106
|
+
tier?: 's' | 'm' | 'l';
|
|
107
|
+
}
|
|
108
|
+
export interface QleverStats {
|
|
109
|
+
/** ISO timestamp of when this index was first created (init or clone) — null for indexes built before this field existed. */
|
|
110
|
+
created: string | null;
|
|
111
|
+
builtAt: string | null;
|
|
112
|
+
qleverVersion: string | null;
|
|
113
|
+
numTriples: number | null;
|
|
114
|
+
numSubjects: number | null;
|
|
115
|
+
numPredicates: number | null;
|
|
116
|
+
numObjects: number | null;
|
|
117
|
+
numDocuments: number | null;
|
|
118
|
+
/** ISO timestamp of the last build whose triple/subject/predicate counts actually differed from the build before it. */
|
|
119
|
+
lastChanged: string | null;
|
|
120
|
+
indexSizeBytes: number | null;
|
|
121
|
+
updateFractionPct: number | null;
|
|
122
|
+
lastQueriedAt: string | null;
|
|
123
|
+
resolvedMentions: number | null;
|
|
124
|
+
unresolvedMentions: number | null;
|
|
125
|
+
/** Percentage of entity mentions that are resolved: (resolved / total) * 100 */
|
|
126
|
+
resolutionPct: number | null;
|
|
127
|
+
avgEntitiesPerDoc: number | null;
|
|
128
|
+
}
|
|
129
|
+
export interface ProjectData {
|
|
130
|
+
id: string;
|
|
131
|
+
name: string;
|
|
132
|
+
organizationID: string;
|
|
133
|
+
created: string;
|
|
134
|
+
isPublic: boolean;
|
|
135
|
+
members: string[];
|
|
136
|
+
syncers: string[];
|
|
137
|
+
admins: string[];
|
|
138
|
+
alternativeIDs: string[];
|
|
139
|
+
projectSettings: ProjectSettings;
|
|
140
|
+
qleverStats?: QleverStats | null;
|
|
141
|
+
}
|
|
142
|
+
export interface CreateProjectOptions {
|
|
143
|
+
/** The organization this project belongs to */
|
|
144
|
+
organizationID: string;
|
|
145
|
+
/** Human-readable project name */
|
|
146
|
+
name: string;
|
|
147
|
+
/** Explicit project ID. Defaults to a new UUID. */
|
|
148
|
+
id?: string;
|
|
149
|
+
/** UIDs to set as project admins. Non-superadmin callers are always included automatically. */
|
|
150
|
+
admins?: string[];
|
|
151
|
+
/** UIDs to set as project syncers. Non-superadmin callers are always included automatically. */
|
|
152
|
+
syncers?: string[];
|
|
153
|
+
/** UIDs to set as project members. Non-superadmin callers are always included automatically. */
|
|
154
|
+
members?: string[];
|
|
155
|
+
/** Graph backend type. The service maps this to the configured URI. */
|
|
156
|
+
graphType?: 'fuseki' | 'qlever';
|
|
157
|
+
/** Processing tier determining credit costs. */
|
|
158
|
+
tier?: 's' | 'm' | 'l';
|
|
159
|
+
}
|
|
160
|
+
export interface SyncProgress {
|
|
161
|
+
percent: number;
|
|
162
|
+
syncCount: number;
|
|
163
|
+
totalCount: number;
|
|
164
|
+
syncSize: number;
|
|
165
|
+
totalSize: number;
|
|
166
|
+
}
|
|
167
|
+
export interface SyncOptions {
|
|
168
|
+
/** The project/space ID to sync into */
|
|
169
|
+
spaceId: string;
|
|
170
|
+
/** Provider ID identifying the file source (e.g. 'local', 's3') */
|
|
171
|
+
providerId: string;
|
|
172
|
+
/** Authenticated user ID */
|
|
173
|
+
userId: string;
|
|
174
|
+
/** Enable verbose logging */
|
|
175
|
+
verbose?: boolean;
|
|
176
|
+
/** Called whenever upload progress changes */
|
|
177
|
+
onProgress?: (progress: SyncProgress) => void;
|
|
178
|
+
/** Write RDF as BLOBs to the processed bucket instead of patching the graph directly */
|
|
179
|
+
legacy?: boolean;
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Credit cost table fetched from the public bucket (`unit-credit.json`).
|
|
183
|
+
* Maps size tier → file extension → credits per unit.
|
|
184
|
+
*/
|
|
185
|
+
export type UnitCreditMap = Partial<Record<'s' | 'm' | 'l', Record<string, number>>>;
|
|
186
|
+
/** Per-extension cost breakdown returned by {@link CueSyncApi.scanCost}. */
|
|
187
|
+
export interface ScanOutputRecord {
|
|
188
|
+
/** File extension (without leading dot), e.g. `"pdf"`, `"ifc"`. */
|
|
189
|
+
ext: string;
|
|
190
|
+
/** Number of files with this extension. */
|
|
191
|
+
count: number;
|
|
192
|
+
/** Share of this extension among supported files (0–100). */
|
|
193
|
+
percentOfFiltered: number;
|
|
194
|
+
/** Share of this extension among all files (0–100). */
|
|
195
|
+
percentOfAll: number;
|
|
196
|
+
/** Billable units for this extension (e.g. pages for PDFs, rows for spreadsheets). */
|
|
197
|
+
units: number;
|
|
198
|
+
/** Total size of files with this extension in megabytes. */
|
|
199
|
+
sizeMb: number;
|
|
200
|
+
/** Credits to consume for this extension (units × credit-per-unit for the project tier). */
|
|
201
|
+
credits?: number;
|
|
202
|
+
}
|
|
203
|
+
export interface UnitsConsumedDto {
|
|
204
|
+
creditsAvailable: number;
|
|
205
|
+
creditsConsumed: number;
|
|
206
|
+
filesProcessed: number;
|
|
207
|
+
unitsAvailable: number;
|
|
208
|
+
unitsConsumed: number;
|
|
209
|
+
}
|
|
210
|
+
export interface ShaclViolation {
|
|
211
|
+
'@type': string;
|
|
212
|
+
'sh:focusNode': {
|
|
213
|
+
'@id': string;
|
|
214
|
+
} | {
|
|
215
|
+
'@value': string;
|
|
216
|
+
};
|
|
217
|
+
'sh:resultPath'?: {
|
|
218
|
+
'@id': string;
|
|
219
|
+
};
|
|
220
|
+
'sh:resultSeverity': {
|
|
221
|
+
'@id': string;
|
|
222
|
+
};
|
|
223
|
+
'sh:sourceConstraintComponent': {
|
|
224
|
+
'@id': string;
|
|
225
|
+
};
|
|
226
|
+
'sh:sourceShape'?: {
|
|
227
|
+
'@id': string;
|
|
228
|
+
};
|
|
229
|
+
'sh:resultMessage': string;
|
|
230
|
+
'sh:value'?: string;
|
|
231
|
+
}
|
|
232
|
+
export interface ShaclValidationReport {
|
|
233
|
+
'@context': Record<string, string>;
|
|
234
|
+
'@type': string;
|
|
235
|
+
'sh:conforms': boolean;
|
|
236
|
+
'sh:result'?: ShaclViolation[];
|
|
237
|
+
}
|
|
238
|
+
export interface SyncPreview {
|
|
239
|
+
/** Per-extension cost breakdown for files not yet synced */
|
|
240
|
+
costRecords: ScanOutputRecord[];
|
|
241
|
+
/** Project tier used for cost calculation */
|
|
242
|
+
tier: 's' | 'm' | 'l';
|
|
243
|
+
/** Human-readable tier name from tier-names.json */
|
|
244
|
+
tierName: string;
|
|
245
|
+
/** Total units required for the new files */
|
|
246
|
+
unitsToConsume: number;
|
|
247
|
+
/** Total credits to consume (derived from unit-credit.json + project tier) */
|
|
248
|
+
creditsToConsume: number;
|
|
249
|
+
/** Credits currently available for this project */
|
|
250
|
+
creditsAvailable: number;
|
|
251
|
+
/** Units still available for this project */
|
|
252
|
+
unitsAvailable: number;
|
|
253
|
+
/** Number of new files that would be uploaded */
|
|
254
|
+
filesToUpload: number;
|
|
255
|
+
/** Total local files scanned */
|
|
256
|
+
totalLocalFiles: number;
|
|
257
|
+
}
|
|
258
|
+
export interface SyncResult {
|
|
259
|
+
/** Number of files successfully synced in this run */
|
|
260
|
+
syncCount: number;
|
|
261
|
+
/** Total bytes synced in this run */
|
|
262
|
+
syncSize: number;
|
|
263
|
+
/** Number of files that failed to upload */
|
|
264
|
+
failedUploads: number;
|
|
265
|
+
/** Total file count (local + remote combined) */
|
|
266
|
+
totalCount: number;
|
|
267
|
+
/** Total size across all files */
|
|
268
|
+
totalSize: number;
|
|
269
|
+
/** Whether any RDF metadata was written */
|
|
270
|
+
rdfWritten: boolean;
|
|
271
|
+
/** Updated credit balance after sync, fetched from the consumption endpoint */
|
|
272
|
+
creditsAvailable: number;
|
|
273
|
+
}
|
|
274
|
+
export interface OrgMember {
|
|
275
|
+
uid: string;
|
|
276
|
+
name: string;
|
|
277
|
+
email: string;
|
|
278
|
+
isAdmin: boolean;
|
|
279
|
+
}
|
|
280
|
+
export interface OrganizationData {
|
|
281
|
+
id: string;
|
|
282
|
+
name: string;
|
|
283
|
+
created: string;
|
|
284
|
+
admins: string[];
|
|
285
|
+
members: string[];
|
|
286
|
+
alternativeIDs: string[];
|
|
287
|
+
domain: string;
|
|
288
|
+
}
|
|
289
|
+
/** Org's current plan — no Stripe ids exposed to the frontend. */
|
|
290
|
+
export interface OrgPlanSummary {
|
|
291
|
+
type: 'freemium' | 'custom';
|
|
292
|
+
status: 'active' | 'pendingPayment' | 'cancelled';
|
|
293
|
+
monthlySpendChf?: number;
|
|
294
|
+
pricePerCredit?: number;
|
|
295
|
+
creditsPerMonth?: number;
|
|
296
|
+
discountPct?: number;
|
|
297
|
+
}
|
|
298
|
+
/**
|
|
299
|
+
* Org-level credit pool. Purchased credits are shared across every project
|
|
300
|
+
* the org owns — there is no per-project allocation. `available` is
|
|
301
|
+
* `purchased` minus the sum of every owned project's consumption.
|
|
302
|
+
*/
|
|
303
|
+
export interface OrgCreditsDto {
|
|
304
|
+
purchased: number;
|
|
305
|
+
consumed: number;
|
|
306
|
+
available: number;
|
|
307
|
+
plan: OrgPlanSummary;
|
|
308
|
+
}
|
|
309
|
+
/** Consumption for a single calendar month (`YYYY-MM`, UTC), keyed by the file's own upload time. */
|
|
310
|
+
export interface MonthlyConsumptionDto {
|
|
311
|
+
unitsConsumed: number;
|
|
312
|
+
creditsConsumed: number;
|
|
313
|
+
filesProcessed: number;
|
|
314
|
+
}
|
|
315
|
+
export interface ProjectConsumptionReportDto {
|
|
316
|
+
projectId: string;
|
|
317
|
+
name?: string;
|
|
318
|
+
/** Keyed by `YYYY-MM` (UTC). */
|
|
319
|
+
monthly: Record<string, MonthlyConsumptionDto>;
|
|
320
|
+
}
|
|
321
|
+
/** Per-project, per-month consumption breakdown for an org — see {@link OrgCreditsDto} for the org-level totals. */
|
|
322
|
+
export interface OrgConsumptionReportDto {
|
|
323
|
+
projects: ProjectConsumptionReportDto[];
|
|
324
|
+
}
|
|
325
|
+
export interface ProfileSSOAccount {
|
|
326
|
+
id: string;
|
|
327
|
+
label: string;
|
|
328
|
+
}
|
|
329
|
+
export interface APIKeyInfo {
|
|
330
|
+
key: string;
|
|
331
|
+
expiration: string;
|
|
332
|
+
}
|
|
333
|
+
export interface APIKeyDoc {
|
|
334
|
+
key: string;
|
|
335
|
+
uid: string;
|
|
336
|
+
expiration: string;
|
|
337
|
+
}
|
|
338
|
+
/** Alias for {@link ProjectData} — the Firestore document shape for a project. */
|
|
339
|
+
export type ProjectDoc = ProjectData;
|
|
340
|
+
/** Alias for {@link OrganizationData} — the Firestore document shape for an org. */
|
|
341
|
+
export type OrganizationDoc = OrganizationData;
|
|
342
|
+
export interface UserDoc {
|
|
343
|
+
id: string;
|
|
344
|
+
name: string;
|
|
345
|
+
email: string;
|
|
346
|
+
created: string;
|
|
347
|
+
lastVisit: string;
|
|
348
|
+
lastVisitProjects?: Record<string, string>;
|
|
349
|
+
organizations: string[];
|
|
350
|
+
/** @deprecated Use {@link UserSettings.language} via `cue.api.userSettings` instead. */
|
|
351
|
+
locale?: string;
|
|
352
|
+
hasAcceptedTermsAndConditions: boolean;
|
|
353
|
+
}
|
|
354
|
+
/**
|
|
355
|
+
* Global, per-user app preferences — a small JSON blob stored via
|
|
356
|
+
* `cue.api.userSettings`. Replaces the old Firestore `UserDoc.locale` field.
|
|
357
|
+
* Extend with more optional fields as new preferences are added; the backend
|
|
358
|
+
* stores this as an opaque blob, so no schema migration is needed.
|
|
359
|
+
*/
|
|
360
|
+
export interface UserSettings {
|
|
361
|
+
language?: string;
|
|
362
|
+
/** Grants access to the beta-features toggle. Not self-service — set by an admin/operator. */
|
|
363
|
+
betaTester?: boolean;
|
|
364
|
+
/** User-controlled visibility of beta features, only meaningful when `betaTester` is true. */
|
|
365
|
+
showBetaFeatures?: boolean;
|
|
366
|
+
/** Preferred display currency for pricing UIs (credits page, sign-up). Billing itself stays CHF. */
|
|
367
|
+
currency?: SupportedCurrency;
|
|
368
|
+
/** User-controlled visibility of super-admin-only views (e.g. project workspace advanced stats). Only meaningful for users with the `superadmin` claim. */
|
|
369
|
+
showSuperAdminFeatures?: boolean;
|
|
370
|
+
}
|
|
371
|
+
/** Metadata for a Studio app saved and shared within an organization via `cue.api.apps`. */
|
|
372
|
+
export interface CustomAppRecord {
|
|
373
|
+
id: string;
|
|
374
|
+
organizationID: string;
|
|
375
|
+
name: string;
|
|
376
|
+
description: string;
|
|
377
|
+
icon: string;
|
|
378
|
+
tone: string;
|
|
379
|
+
authorId: string;
|
|
380
|
+
authorName: string;
|
|
381
|
+
createdAt: string;
|
|
382
|
+
updatedAt: string;
|
|
383
|
+
}
|
|
384
|
+
/** Full custom app record including its HTML body, as returned by `cue.api.apps.get`. */
|
|
385
|
+
export interface CustomAppWithHtml extends CustomAppRecord {
|
|
386
|
+
html: string;
|
|
387
|
+
}
|
|
388
|
+
export interface CreateCustomAppOptions {
|
|
389
|
+
organizationID: string;
|
|
390
|
+
name: string;
|
|
391
|
+
description?: string;
|
|
392
|
+
icon?: string;
|
|
393
|
+
tone?: string;
|
|
394
|
+
/** Denormalized display name for the "author" badge — typically `cue.auth.user()?.displayName`. */
|
|
395
|
+
authorName?: string;
|
|
396
|
+
html: string;
|
|
397
|
+
}
|
|
398
|
+
export interface UpdateCustomAppOptions {
|
|
399
|
+
name?: string;
|
|
400
|
+
description?: string;
|
|
401
|
+
icon?: string;
|
|
402
|
+
tone?: string;
|
|
403
|
+
html?: string;
|
|
404
|
+
}
|
|
405
|
+
export interface RDFWritingDoc {
|
|
406
|
+
id: string;
|
|
407
|
+
accumulatedSizeSinceLastIdleEvent: number;
|
|
408
|
+
accumulatedFilesSinceLastIdleEvent: number;
|
|
409
|
+
firstRDFWrite: string;
|
|
410
|
+
lastRDFWrite: string;
|
|
411
|
+
}
|
|
412
|
+
export type ProcessingStage = 'idle' | 'writing' | 'loading' | 'enriching';
|
|
413
|
+
/**
|
|
414
|
+
* Aggregated, per-project pipeline status pushed live by the `accessors-data-views`
|
|
415
|
+
* processing-status WebSocket (see `CueProcessingApi.watchStatus`). Shape mirrors
|
|
416
|
+
* `cue-ui`'s `ProcessingStatus` (views/project-settings/models.ts) so it can be
|
|
417
|
+
* passed straight through to `<cue-project-settings>` / `<cue-portal-upload>`.
|
|
418
|
+
*/
|
|
419
|
+
export interface ProcessingStatus {
|
|
420
|
+
stage: ProcessingStage;
|
|
421
|
+
accumulatedSizeSinceLastIdleEvent: number;
|
|
422
|
+
accumulatedFilesSinceLastIdleEvent: number;
|
|
423
|
+
firstRDFWrite: string;
|
|
424
|
+
lastRDFWrite: string;
|
|
425
|
+
loadingTriggeredAt?: string;
|
|
426
|
+
resolutionTriggeredAt?: string;
|
|
427
|
+
lastResolutionActivityAt?: string;
|
|
428
|
+
enrichmentTotalBatches?: number;
|
|
429
|
+
enrichmentCompletedBatches?: number;
|
|
430
|
+
}
|
|
431
|
+
export interface ViewDefinition {
|
|
432
|
+
id: string;
|
|
433
|
+
pinned?: boolean;
|
|
434
|
+
}
|
|
435
|
+
/**
|
|
436
|
+
* Minimal cache interface for SPARQL query results.
|
|
437
|
+
*
|
|
438
|
+
* Implement this against any storage backend (Cloud Storage, localStorage,
|
|
439
|
+
* IndexedDB, in-memory Map) and pass it to the project-view classes to enable
|
|
440
|
+
* stale-while-revalidate query caching.
|
|
441
|
+
*
|
|
442
|
+
* The Angular adapter wires this to `CueCache` from `cue-repos`.
|
|
443
|
+
*/
|
|
444
|
+
export interface QueryCache {
|
|
445
|
+
get(key: string): Promise<unknown | undefined>;
|
|
446
|
+
set(key: string, data: unknown): Promise<void>;
|
|
447
|
+
}
|
|
448
|
+
/**
|
|
449
|
+
* A multilingual string keyed by BCP-47 language tag. The special `default`
|
|
450
|
+
* key always resolves to the English value (or, when no English value exists,
|
|
451
|
+
* to the untagged/first available value).
|
|
452
|
+
*/
|
|
453
|
+
export type LangMap = {
|
|
454
|
+
[lang: string]: string;
|
|
455
|
+
};
|
|
456
|
+
/** A taxonomy node (content category or entity category) from the triplestore. */
|
|
457
|
+
export interface CategoryDef {
|
|
458
|
+
iri: string;
|
|
459
|
+
/**
|
|
460
|
+
* Label resolved for the currently active language (falls back to `default`
|
|
461
|
+
* / English). This is a computed convenience view of {@link CategoryDef.labels}.
|
|
462
|
+
*/
|
|
463
|
+
label: string;
|
|
464
|
+
/**
|
|
465
|
+
* Definition resolved for the currently active language (falls back to
|
|
466
|
+
* `default` / English). Computed view of {@link CategoryDef.definitions}.
|
|
467
|
+
*/
|
|
468
|
+
definition?: string;
|
|
469
|
+
/** Full set of labels keyed by language tag (plus a `default` key). */
|
|
470
|
+
labels: LangMap;
|
|
471
|
+
/** Full set of definitions keyed by language tag (plus a `default` key). */
|
|
472
|
+
definitions?: LangMap;
|
|
473
|
+
/** IRI of the parent category (skos:broader), if any. */
|
|
474
|
+
parent?: string;
|
|
475
|
+
/** Whether this category is marked as deprecated in the triplestore. */
|
|
476
|
+
deprecated?: boolean;
|
|
477
|
+
}
|
|
478
|
+
/**
|
|
479
|
+
* A relationship type discovered in the triplestore via `qcy:relatedEntity` property scan.
|
|
480
|
+
* The IRI is the property IRI, label is its rdfs:label.
|
|
481
|
+
*/
|
|
482
|
+
export type RelationshipDef = CategoryDef;
|
|
483
|
+
/** Core label + classification data for a single entity. */
|
|
484
|
+
export interface EntityCoreData {
|
|
485
|
+
value: string;
|
|
486
|
+
categories: string[];
|
|
487
|
+
mentionCount?: number;
|
|
488
|
+
}
|
|
489
|
+
/** A single directed relationship edge between two entities. */
|
|
490
|
+
export interface EntityRelationship {
|
|
491
|
+
/** IRI of the property used (e.g. `qcy:hasContractor`). */
|
|
492
|
+
relIRI: string;
|
|
493
|
+
/** Full IRI of the related entity. */
|
|
494
|
+
nodeIRI: string;
|
|
495
|
+
/** Label of the related entity. */
|
|
496
|
+
nodeValue: string;
|
|
497
|
+
/** Category IRIs of the related entity. */
|
|
498
|
+
nodeCategories: string[];
|
|
499
|
+
}
|
|
500
|
+
/** Incoming and outgoing relationship edges for one entity. */
|
|
501
|
+
export interface EntityRelationships {
|
|
502
|
+
incoming: EntityRelationship[];
|
|
503
|
+
outgoing: EntityRelationship[];
|
|
504
|
+
}
|
|
505
|
+
/** An OSM geometry associated with an entity or related entity. */
|
|
506
|
+
export interface MapGeometry {
|
|
507
|
+
osmIRI: string;
|
|
508
|
+
wkt: string;
|
|
509
|
+
}
|
|
510
|
+
/** Fully resolved data for a single entity, merging all lazy-loaded slices. */
|
|
511
|
+
export interface EntityDetailedData extends EntityCoreData {
|
|
512
|
+
relationshipData?: EntityRelationships;
|
|
513
|
+
/** UUIDs of documents that reference this entity. */
|
|
514
|
+
documentRefs?: string[];
|
|
515
|
+
directMapGeometries?: MapGeometry[];
|
|
516
|
+
indirectMapGeometries?: Array<{
|
|
517
|
+
rel: string;
|
|
518
|
+
entityUUID: string;
|
|
519
|
+
geometries: MapGeometry[];
|
|
520
|
+
}>;
|
|
521
|
+
}
|
|
522
|
+
/**
|
|
523
|
+
* Project-level entity category graph — nodes are category IRIs, edges
|
|
524
|
+
* represent the `qcy:relatedEntity` connection at the category level.
|
|
525
|
+
*/
|
|
526
|
+
export interface ProjectEntitiesData {
|
|
527
|
+
entities: Array<{
|
|
528
|
+
iri: string;
|
|
529
|
+
size?: number;
|
|
530
|
+
}>;
|
|
531
|
+
relations: Array<{
|
|
532
|
+
sourceID: string;
|
|
533
|
+
targetID: string;
|
|
534
|
+
}>;
|
|
535
|
+
}
|
|
536
|
+
/**
|
|
537
|
+
* Structured summary graph returned by `buildSummaryGraph('graph')`.
|
|
538
|
+
* Nodes are deduplicated category IRIs; edges carry the predicate and
|
|
539
|
+
* occurrence count from the summary query.
|
|
540
|
+
*/
|
|
541
|
+
export interface SummaryGraphData {
|
|
542
|
+
/** `weight` is the number of entity instances in that category — undefined if the count query failed. */
|
|
543
|
+
entities: Array<{
|
|
544
|
+
iri: string;
|
|
545
|
+
weight?: number;
|
|
546
|
+
}>;
|
|
547
|
+
relations: Array<{
|
|
548
|
+
sourceID: string;
|
|
549
|
+
predicate: string;
|
|
550
|
+
targetID: string;
|
|
551
|
+
weight: number;
|
|
552
|
+
}>;
|
|
553
|
+
}
|
|
554
|
+
/** Core metadata for a single document (FileContent node). */
|
|
555
|
+
export interface DocumentInfo {
|
|
556
|
+
id: string;
|
|
557
|
+
contentIRI: string;
|
|
558
|
+
path: string;
|
|
559
|
+
suffix: string;
|
|
560
|
+
size: number;
|
|
561
|
+
tags: string[];
|
|
562
|
+
categories: string[];
|
|
563
|
+
subject?: string;
|
|
564
|
+
summary?: string;
|
|
565
|
+
providerId?: string;
|
|
566
|
+
/** Full storage path in the processed bucket (e.g. `{projectId}/fragments/{uuid}.fragments`).
|
|
567
|
+
* Only present on alternative representations that carry a `qcy:remoteRelativePath`. */
|
|
568
|
+
remoteRelativePath?: string;
|
|
569
|
+
}
|
|
570
|
+
/** Count + total size for a group of documents (e.g. grouped by suffix or category). */
|
|
571
|
+
export interface DocumentSummary {
|
|
572
|
+
size: number;
|
|
573
|
+
count: number;
|
|
574
|
+
}
|
|
575
|
+
/** Project-level document overview — fetched once on project init. */
|
|
576
|
+
export interface ProjectDocumentsData {
|
|
577
|
+
duplicateCount: number;
|
|
578
|
+
/** File extension → `{ size, count }` */
|
|
579
|
+
documentsBySuffix: Record<string, DocumentSummary>;
|
|
580
|
+
/** Content-category IRI → `{ size, count }` */
|
|
581
|
+
documentsByContentCategory: Record<string, DocumentSummary>;
|
|
582
|
+
}
|
|
583
|
+
/**
|
|
584
|
+
* A single dimension of a document filter expression.
|
|
585
|
+
*
|
|
586
|
+
* `included` IRIs are OR-ed together (document must have at least one).
|
|
587
|
+
* `excluded` IRIs are AND-NOT-ed (document must not have any).
|
|
588
|
+
* Multiple `SearchFilter` objects are AND-ed across dimensions.
|
|
589
|
+
*
|
|
590
|
+
* Type semantics:
|
|
591
|
+
* - `entity` — document is *about* an entity of the given category IRI(s).
|
|
592
|
+
* - `entityInstance` — document is *about* the given specific entity IRI(s)
|
|
593
|
+
* (e.g. the canonical entity "John Doe", not the category "Person").
|
|
594
|
+
*/
|
|
595
|
+
export interface SearchFilter {
|
|
596
|
+
type: 'content' | 'mime' | 'entity' | 'entityInstance' | 'suffix';
|
|
597
|
+
included: string[];
|
|
598
|
+
excluded: string[];
|
|
599
|
+
}
|
|
600
|
+
/** A single filter option (IRI + human-readable label) returned by the document filter. */
|
|
601
|
+
export interface DocumentFilterOption {
|
|
602
|
+
iri: string;
|
|
603
|
+
label: string;
|
|
604
|
+
}
|
|
605
|
+
/** Available filter options grouped by dimension, returned by {@link CueDocumentFilter.availableFilters}. */
|
|
606
|
+
export interface AvailableDocumentFilters {
|
|
607
|
+
mimes: DocumentFilterOption[];
|
|
608
|
+
contents: DocumentFilterOption[];
|
|
609
|
+
entityCategories: DocumentFilterOption[];
|
|
610
|
+
}
|
|
611
|
+
export interface IndexSearchRequest {
|
|
612
|
+
input: string;
|
|
613
|
+
limit?: number;
|
|
614
|
+
aggregate?: boolean;
|
|
615
|
+
/** `'loose'` (default) allows partial matches; `'strict'` requires exact term presence. */
|
|
616
|
+
mode?: 'loose' | 'strict';
|
|
617
|
+
/** Pre-seed the context with these document UUIDs before running the search. */
|
|
618
|
+
identifiers?: string[];
|
|
619
|
+
}
|
|
620
|
+
export interface IndexItem {
|
|
621
|
+
id: string;
|
|
622
|
+
type: string;
|
|
623
|
+
relevance: number;
|
|
624
|
+
sub_items?: IndexItem[];
|
|
625
|
+
}
|
|
626
|
+
export interface IndexSearchResponse {
|
|
627
|
+
id?: string;
|
|
628
|
+
total?: number;
|
|
629
|
+
items: IndexItem[];
|
|
630
|
+
}
|
|
631
|
+
/**
|
|
632
|
+
* A single filter option returned by {@link CueIndexApi.availableFilters}.
|
|
633
|
+
* Contains both the IRI (for use as a filter value) and a human-readable label.
|
|
634
|
+
*/
|
|
635
|
+
export interface IndexFilterOption {
|
|
636
|
+
iri: string;
|
|
637
|
+
label: string;
|
|
638
|
+
}
|
|
639
|
+
/**
|
|
640
|
+
* Applied filters passed to {@link CueIndexApi.availableFilters} to constrain
|
|
641
|
+
* which options are returned. Each array contains IRIs of the currently active
|
|
642
|
+
* filter values for that dimension.
|
|
643
|
+
*/
|
|
644
|
+
export interface IndexAppliedFilters {
|
|
645
|
+
/** MIME category IRIs currently included (e.g. `'application/pdf'`). */
|
|
646
|
+
mimes?: string[];
|
|
647
|
+
/** Content category IRIs currently included. */
|
|
648
|
+
contents?: string[];
|
|
649
|
+
/** Entity category IRIs currently included — documents must mention at least one entity of each. */
|
|
650
|
+
entityCategories?: string[];
|
|
651
|
+
}
|
|
652
|
+
/**
|
|
653
|
+
* Response from {@link CueIndexApi.availableFilters}. Each array lists the
|
|
654
|
+
* filter options that exist in the document set surviving the applied filters.
|
|
655
|
+
* Used to drive adaptive filter UIs where subsequent dropdowns narrow to only
|
|
656
|
+
* what is actually present after earlier selections.
|
|
657
|
+
*/
|
|
658
|
+
export interface AvailableFiltersResponse {
|
|
659
|
+
mimes: IndexFilterOption[];
|
|
660
|
+
contents: IndexFilterOption[];
|
|
661
|
+
entityCategories: IndexFilterOption[];
|
|
662
|
+
}
|