@qaecy/cue-sdk 0.0.32 → 0.0.33
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/browser.js +7509 -7182
- package/index.d.ts +2 -1
- package/index.js +18 -17
- package/node.js +28 -56
- package/package.json +11 -1
- package/PORTAL_MIGRATION.md +0 -346
- package/assets/wasm/dir_scanner_wasm.js +0 -461
- package/assets/wasm/dir_scanner_wasm_bg.wasm +0 -0
- package/cue-C7sbHLj4.js +0 -9249
- package/lib/api.d.ts +0 -57
- package/lib/auth.d.ts +0 -78
- package/lib/cache.d.ts +0 -26
- package/lib/contexts.d.ts +0 -17
- package/lib/cue-node.d.ts +0 -21
- package/lib/cue.d.ts +0 -135
- package/lib/documents.d.ts +0 -224
- package/lib/entities.d.ts +0 -187
- package/lib/extraction.d.ts +0 -48
- package/lib/gis.d.ts +0 -89
- package/lib/index-api.d.ts +0 -11
- package/lib/models.d.ts +0 -460
- package/lib/privileges.d.ts +0 -72
- package/lib/profile.d.ts +0 -60
- package/lib/project-view.d.ts +0 -114
- package/lib/project.d.ts +0 -45
- package/lib/schema.d.ts +0 -85
- package/lib/signal.d.ts +0 -54
- package/lib/storage.d.ts +0 -52
- package/lib/sync.d.ts +0 -125
- package/lib/tables.d.ts +0 -14
- package/variables.d.ts +0 -51
package/lib/models.d.ts
DELETED
|
@@ -1,460 +0,0 @@
|
|
|
1
|
-
export type CueEnvironment = 'production' | 'emulator';
|
|
2
|
-
export interface CueEndpoints {
|
|
3
|
-
/** API gateway base URL */
|
|
4
|
-
gatewayUrl: string;
|
|
5
|
-
/** Token exchange endpoint for API key sign-in */
|
|
6
|
-
tokenUrl: string;
|
|
7
|
-
/** Firebase Auth emulator URL */
|
|
8
|
-
authEmulatorUrl: string;
|
|
9
|
-
/** Firebase Storage emulator hostname, no protocol (emulator mode only, default: 'localhost') */
|
|
10
|
-
storageEmulatorHost: string;
|
|
11
|
-
/** Firebase Storage emulator port (emulator mode only, default: 9199) */
|
|
12
|
-
storageEmulatorPort: number;
|
|
13
|
-
/** Firebase Firestore emulator hostname, no protocol (emulator mode only, default: 'localhost') */
|
|
14
|
-
firestoreEmulatorHost: string;
|
|
15
|
-
/** Firebase Firestore emulator port (emulator mode only, default: 8080) */
|
|
16
|
-
firestoreEmulatorPort: number;
|
|
17
|
-
}
|
|
18
|
-
export interface CueSdkConfig {
|
|
19
|
-
/** Firebase API key for this project. Defaults to the QAECY demo app if omitted. */
|
|
20
|
-
apiKey?: string;
|
|
21
|
-
/** Firebase App ID. Defaults to the QAECY demo app if omitted. */
|
|
22
|
-
appId?: string;
|
|
23
|
-
/** Firebase Measurement ID. Defaults to the QAECY demo app if omitted. */
|
|
24
|
-
measurementId?: string;
|
|
25
|
-
/** Target environment. Defaults to 'production'. */
|
|
26
|
-
environment?: CueEnvironment;
|
|
27
|
-
/** Override individual endpoint URLs. Takes precedence over environment. */
|
|
28
|
-
endpoints?: Partial<CueEndpoints>;
|
|
29
|
-
/** Enable verbose debug logging for all entity/document store operations. */
|
|
30
|
-
verbose?: boolean;
|
|
31
|
-
}
|
|
32
|
-
export type SsoProvider = 'google' | 'microsoft';
|
|
33
|
-
export interface PasswordCredentials {
|
|
34
|
-
email: string;
|
|
35
|
-
password: string;
|
|
36
|
-
}
|
|
37
|
-
export interface SearchRequest {
|
|
38
|
-
/** Natural language query or search term */
|
|
39
|
-
term: string;
|
|
40
|
-
/** Project ID to search within */
|
|
41
|
-
projectId: string;
|
|
42
|
-
/** Optional category filters */
|
|
43
|
-
categories?: string[];
|
|
44
|
-
}
|
|
45
|
-
/** Options for `CueProjectView.search()`. */
|
|
46
|
-
export interface SearchOptions {
|
|
47
|
-
/** Optional content category IRI filters. */
|
|
48
|
-
categories?: string[];
|
|
49
|
-
}
|
|
50
|
-
export interface SearchSource {
|
|
51
|
-
item: string;
|
|
52
|
-
parent: string;
|
|
53
|
-
content: string;
|
|
54
|
-
}
|
|
55
|
-
export interface SearchResponse {
|
|
56
|
-
id: string;
|
|
57
|
-
question: string;
|
|
58
|
-
questionHTML: string;
|
|
59
|
-
response: string;
|
|
60
|
-
sources: SearchSource[];
|
|
61
|
-
rankedSources: SearchSource[];
|
|
62
|
-
}
|
|
63
|
-
export interface ContextItem {
|
|
64
|
-
id: string;
|
|
65
|
-
type: string;
|
|
66
|
-
relevance: number;
|
|
67
|
-
info: Record<string, unknown>;
|
|
68
|
-
sub_items: ContextItem[];
|
|
69
|
-
}
|
|
70
|
-
export interface ContextDoc {
|
|
71
|
-
id: string;
|
|
72
|
-
total: number;
|
|
73
|
-
operation: {
|
|
74
|
-
type: string;
|
|
75
|
-
};
|
|
76
|
-
input: string;
|
|
77
|
-
items: ContextItem[];
|
|
78
|
-
within: string[];
|
|
79
|
-
meta: {
|
|
80
|
-
time_created: string;
|
|
81
|
-
};
|
|
82
|
-
}
|
|
83
|
-
export interface ProjectSettings {
|
|
84
|
-
views?: Array<{
|
|
85
|
-
id: string;
|
|
86
|
-
pinned?: boolean;
|
|
87
|
-
}>;
|
|
88
|
-
chatDisabled: boolean;
|
|
89
|
-
graph?: {
|
|
90
|
-
type: 'qlever' | 'fuseki';
|
|
91
|
-
uri?: string;
|
|
92
|
-
};
|
|
93
|
-
/** Processing tier determining credit costs. Defaults to "l" if not set. */
|
|
94
|
-
tier?: 's' | 'm' | 'l';
|
|
95
|
-
}
|
|
96
|
-
export interface ProjectData {
|
|
97
|
-
id: string;
|
|
98
|
-
name: string;
|
|
99
|
-
organizationID: string;
|
|
100
|
-
created: string;
|
|
101
|
-
lastSync: string | null;
|
|
102
|
-
isPublic: boolean;
|
|
103
|
-
members: string[];
|
|
104
|
-
syncers: string[];
|
|
105
|
-
admins: string[];
|
|
106
|
-
alternativeIDs: string[];
|
|
107
|
-
projectSettings: ProjectSettings;
|
|
108
|
-
}
|
|
109
|
-
export interface CreateProjectOptions {
|
|
110
|
-
/** The organization this project belongs to */
|
|
111
|
-
organizationID: string;
|
|
112
|
-
/** Human-readable project name */
|
|
113
|
-
name: string;
|
|
114
|
-
/** Explicit project ID. Defaults to a new UUID. */
|
|
115
|
-
id?: string;
|
|
116
|
-
/** UIDs to set as project admins. Non-superadmin callers are always included automatically. */
|
|
117
|
-
admins?: string[];
|
|
118
|
-
/** UIDs to set as project syncers. Non-superadmin callers are always included automatically. */
|
|
119
|
-
syncers?: string[];
|
|
120
|
-
/** UIDs to set as project members. Non-superadmin callers are always included automatically. */
|
|
121
|
-
members?: string[];
|
|
122
|
-
/** Graph backend type. The service maps this to the configured URI. */
|
|
123
|
-
graphType?: 'fuseki' | 'qlever';
|
|
124
|
-
/** Processing tier determining credit costs. */
|
|
125
|
-
tier?: 's' | 'm' | 'l';
|
|
126
|
-
}
|
|
127
|
-
export interface SyncProgress {
|
|
128
|
-
percent: number;
|
|
129
|
-
syncCount: number;
|
|
130
|
-
totalCount: number;
|
|
131
|
-
syncSize: number;
|
|
132
|
-
totalSize: number;
|
|
133
|
-
}
|
|
134
|
-
export interface SyncOptions {
|
|
135
|
-
/** The project/space ID to sync into */
|
|
136
|
-
spaceId: string;
|
|
137
|
-
/** Provider ID identifying the file source (e.g. 'local', 's3') */
|
|
138
|
-
providerId: string;
|
|
139
|
-
/** Authenticated user ID */
|
|
140
|
-
userId: string;
|
|
141
|
-
/** Enable verbose logging */
|
|
142
|
-
verbose?: boolean;
|
|
143
|
-
/** Called whenever upload progress changes */
|
|
144
|
-
onProgress?: (progress: SyncProgress) => void;
|
|
145
|
-
/** Write RDF as BLOBs to the processed bucket instead of patching the graph directly */
|
|
146
|
-
legacy?: boolean;
|
|
147
|
-
}
|
|
148
|
-
/**
|
|
149
|
-
* Credit cost table fetched from the public bucket (`unit-credit.json`).
|
|
150
|
-
* Maps file extension → tier → credits per unit.
|
|
151
|
-
*/
|
|
152
|
-
export type UnitCreditMap = Partial<Record<'s' | 'm' | 'l', Record<string, number>>>;
|
|
153
|
-
/** Per-extension cost breakdown returned by {@link CueSyncApi.scanCost}. */
|
|
154
|
-
export interface ScanOutputRecord {
|
|
155
|
-
/** File extension (without leading dot), e.g. `"pdf"`, `"ifc"`. */
|
|
156
|
-
ext: string;
|
|
157
|
-
/** Number of files with this extension. */
|
|
158
|
-
count: number;
|
|
159
|
-
/** Share of this extension among supported files (0–100). */
|
|
160
|
-
percentOfFiltered: number;
|
|
161
|
-
/** Share of this extension among all files (0–100). */
|
|
162
|
-
percentOfAll: number;
|
|
163
|
-
/** Billable units for this extension (e.g. pages for PDFs, rows for spreadsheets). */
|
|
164
|
-
units: number;
|
|
165
|
-
/** Total size of files with this extension in megabytes. */
|
|
166
|
-
sizeMb: number;
|
|
167
|
-
/** Credits to consume for this extension (units × credit-per-unit for the project tier). */
|
|
168
|
-
credits?: number;
|
|
169
|
-
}
|
|
170
|
-
export interface UnitsConsumedDto {
|
|
171
|
-
creditsAvailable: number;
|
|
172
|
-
creditsConsumed: number;
|
|
173
|
-
filesProcessed: number;
|
|
174
|
-
unitsAvailable: number;
|
|
175
|
-
unitsConsumed: number;
|
|
176
|
-
}
|
|
177
|
-
export interface ShaclViolation {
|
|
178
|
-
'@type': string;
|
|
179
|
-
'sh:focusNode': {
|
|
180
|
-
'@id': string;
|
|
181
|
-
} | {
|
|
182
|
-
'@value': string;
|
|
183
|
-
};
|
|
184
|
-
'sh:resultPath'?: {
|
|
185
|
-
'@id': string;
|
|
186
|
-
};
|
|
187
|
-
'sh:resultSeverity': {
|
|
188
|
-
'@id': string;
|
|
189
|
-
};
|
|
190
|
-
'sh:sourceConstraintComponent': {
|
|
191
|
-
'@id': string;
|
|
192
|
-
};
|
|
193
|
-
'sh:sourceShape'?: {
|
|
194
|
-
'@id': string;
|
|
195
|
-
};
|
|
196
|
-
'sh:resultMessage': string;
|
|
197
|
-
'sh:value'?: string;
|
|
198
|
-
}
|
|
199
|
-
export interface ShaclValidationReport {
|
|
200
|
-
'@context': Record<string, string>;
|
|
201
|
-
'@type': string;
|
|
202
|
-
'sh:conforms': boolean;
|
|
203
|
-
'sh:result'?: ShaclViolation[];
|
|
204
|
-
}
|
|
205
|
-
export interface SyncPreview {
|
|
206
|
-
/** Per-extension cost breakdown for files not yet synced */
|
|
207
|
-
costRecords: ScanOutputRecord[];
|
|
208
|
-
/** Project tier used for cost calculation */
|
|
209
|
-
tier: 's' | 'm' | 'l';
|
|
210
|
-
/** Human-readable tier name from tier-names.json */
|
|
211
|
-
tierName: string;
|
|
212
|
-
/** Total units required for the new files */
|
|
213
|
-
unitsToConsume: number;
|
|
214
|
-
/** Total credits to consume (derived from unit-credit.json + project tier) */
|
|
215
|
-
creditsToConsume: number;
|
|
216
|
-
/** Credits currently available for this project */
|
|
217
|
-
creditsAvailable: number;
|
|
218
|
-
/** Units still available for this project */
|
|
219
|
-
unitsAvailable: number;
|
|
220
|
-
/** Number of new files that would be uploaded */
|
|
221
|
-
filesToUpload: number;
|
|
222
|
-
/** Total local files scanned */
|
|
223
|
-
totalLocalFiles: number;
|
|
224
|
-
}
|
|
225
|
-
export interface SyncResult {
|
|
226
|
-
/** Number of files successfully synced in this run */
|
|
227
|
-
syncCount: number;
|
|
228
|
-
/** Total bytes synced in this run */
|
|
229
|
-
syncSize: number;
|
|
230
|
-
/** Number of files that failed to upload */
|
|
231
|
-
failedUploads: number;
|
|
232
|
-
/** Total file count (local + remote combined) */
|
|
233
|
-
totalCount: number;
|
|
234
|
-
/** Total size across all files */
|
|
235
|
-
totalSize: number;
|
|
236
|
-
/** Whether any RDF metadata was written */
|
|
237
|
-
rdfWritten: boolean;
|
|
238
|
-
/** Updated credit balance after sync, fetched from the consumption endpoint */
|
|
239
|
-
creditsAvailable: number;
|
|
240
|
-
}
|
|
241
|
-
export interface OrgMember {
|
|
242
|
-
uid: string;
|
|
243
|
-
name: string;
|
|
244
|
-
email: string;
|
|
245
|
-
isAdmin: boolean;
|
|
246
|
-
}
|
|
247
|
-
export interface OrganizationData {
|
|
248
|
-
id: string;
|
|
249
|
-
name: string;
|
|
250
|
-
created: string;
|
|
251
|
-
admins: string[];
|
|
252
|
-
members: string[];
|
|
253
|
-
alternativeIDs: string[];
|
|
254
|
-
domain: string;
|
|
255
|
-
}
|
|
256
|
-
export interface ProfileSSOAccount {
|
|
257
|
-
id: string;
|
|
258
|
-
label: string;
|
|
259
|
-
}
|
|
260
|
-
export interface APIKeyInfo {
|
|
261
|
-
key: string;
|
|
262
|
-
expiration: string;
|
|
263
|
-
}
|
|
264
|
-
export interface APIKeyDoc {
|
|
265
|
-
key: string;
|
|
266
|
-
uid: string;
|
|
267
|
-
expiration: string;
|
|
268
|
-
}
|
|
269
|
-
/** Alias for {@link ProjectData} — the Firestore document shape for a project. */
|
|
270
|
-
export type ProjectDoc = ProjectData;
|
|
271
|
-
/** Alias for {@link OrganizationData} — the Firestore document shape for an org. */
|
|
272
|
-
export type OrganizationDoc = OrganizationData;
|
|
273
|
-
export interface UserDoc {
|
|
274
|
-
id: string;
|
|
275
|
-
name: string;
|
|
276
|
-
email: string;
|
|
277
|
-
created: string;
|
|
278
|
-
lastVisit: string;
|
|
279
|
-
lastVisitProjects?: Record<string, string>;
|
|
280
|
-
organizations: string[];
|
|
281
|
-
locale?: string;
|
|
282
|
-
hasAcceptedTermsAndConditions: boolean;
|
|
283
|
-
}
|
|
284
|
-
export interface RDFWritingDoc {
|
|
285
|
-
id: string;
|
|
286
|
-
accumulatedSizeSinceLastIdleEvent: number;
|
|
287
|
-
accumulatedFilesSinceLastIdleEvent: number;
|
|
288
|
-
firstRDFWrite: string;
|
|
289
|
-
lastRDFWrite: string;
|
|
290
|
-
}
|
|
291
|
-
export interface ViewDefinition {
|
|
292
|
-
id: string;
|
|
293
|
-
pinned?: boolean;
|
|
294
|
-
}
|
|
295
|
-
/**
|
|
296
|
-
* Minimal cache interface for SPARQL query results.
|
|
297
|
-
*
|
|
298
|
-
* Implement this against any storage backend (Cloud Storage, localStorage,
|
|
299
|
-
* IndexedDB, in-memory Map) and pass it to the project-view classes to enable
|
|
300
|
-
* stale-while-revalidate query caching.
|
|
301
|
-
*
|
|
302
|
-
* The Angular adapter wires this to `CueCache` from `cue-repos`.
|
|
303
|
-
*/
|
|
304
|
-
export interface QueryCache {
|
|
305
|
-
get(key: string): Promise<unknown | undefined>;
|
|
306
|
-
set(key: string, data: unknown): Promise<void>;
|
|
307
|
-
}
|
|
308
|
-
/**
|
|
309
|
-
* A multilingual string keyed by BCP-47 language tag. The special `default`
|
|
310
|
-
* key always resolves to the English value (or, when no English value exists,
|
|
311
|
-
* to the untagged/first available value).
|
|
312
|
-
*/
|
|
313
|
-
export type LangMap = {
|
|
314
|
-
[lang: string]: string;
|
|
315
|
-
};
|
|
316
|
-
/** A taxonomy node (content category or entity category) from the triplestore. */
|
|
317
|
-
export interface CategoryDef {
|
|
318
|
-
iri: string;
|
|
319
|
-
/**
|
|
320
|
-
* Label resolved for the currently active language (falls back to `default`
|
|
321
|
-
* / English). This is a computed convenience view of {@link CategoryDef.labels}.
|
|
322
|
-
*/
|
|
323
|
-
label: string;
|
|
324
|
-
/**
|
|
325
|
-
* Definition resolved for the currently active language (falls back to
|
|
326
|
-
* `default` / English). Computed view of {@link CategoryDef.definitions}.
|
|
327
|
-
*/
|
|
328
|
-
definition?: string;
|
|
329
|
-
/** Full set of labels keyed by language tag (plus a `default` key). */
|
|
330
|
-
labels: LangMap;
|
|
331
|
-
/** Full set of definitions keyed by language tag (plus a `default` key). */
|
|
332
|
-
definitions?: LangMap;
|
|
333
|
-
/** IRI of the parent category (skos:broader), if any. */
|
|
334
|
-
parent?: string;
|
|
335
|
-
/** Whether this category is marked as deprecated in the triplestore. */
|
|
336
|
-
deprecated?: boolean;
|
|
337
|
-
}
|
|
338
|
-
/**
|
|
339
|
-
* A relationship type discovered in the triplestore via `qcy:relatedEntity` property scan.
|
|
340
|
-
* The IRI is the property IRI, label is its rdfs:label.
|
|
341
|
-
*/
|
|
342
|
-
export type RelationshipDef = CategoryDef;
|
|
343
|
-
/** Core label + classification data for a single entity. */
|
|
344
|
-
export interface EntityCoreData {
|
|
345
|
-
value: string;
|
|
346
|
-
categories: string[];
|
|
347
|
-
mentionCount?: number;
|
|
348
|
-
}
|
|
349
|
-
/** A single directed relationship edge between two entities. */
|
|
350
|
-
export interface EntityRelationship {
|
|
351
|
-
/** IRI of the property used (e.g. `qcy:hasContractor`). */
|
|
352
|
-
relIRI: string;
|
|
353
|
-
/** Full IRI of the related entity. */
|
|
354
|
-
nodeIRI: string;
|
|
355
|
-
/** Label of the related entity. */
|
|
356
|
-
nodeValue: string;
|
|
357
|
-
/** Category IRIs of the related entity. */
|
|
358
|
-
nodeCategories: string[];
|
|
359
|
-
}
|
|
360
|
-
/** Incoming and outgoing relationship edges for one entity. */
|
|
361
|
-
export interface EntityRelationships {
|
|
362
|
-
incoming: EntityRelationship[];
|
|
363
|
-
outgoing: EntityRelationship[];
|
|
364
|
-
}
|
|
365
|
-
/** An OSM geometry associated with an entity or related entity. */
|
|
366
|
-
export interface MapGeometry {
|
|
367
|
-
osmIRI: string;
|
|
368
|
-
wkt: string;
|
|
369
|
-
}
|
|
370
|
-
/** Fully resolved data for a single entity, merging all lazy-loaded slices. */
|
|
371
|
-
export interface EntityDetailedData extends EntityCoreData {
|
|
372
|
-
relationshipData?: EntityRelationships;
|
|
373
|
-
/** UUIDs of documents that reference this entity. */
|
|
374
|
-
documentRefs?: string[];
|
|
375
|
-
directMapGeometries?: MapGeometry[];
|
|
376
|
-
indirectMapGeometries?: Array<{
|
|
377
|
-
rel: string;
|
|
378
|
-
entityUUID: string;
|
|
379
|
-
geometries: MapGeometry[];
|
|
380
|
-
}>;
|
|
381
|
-
}
|
|
382
|
-
/**
|
|
383
|
-
* Project-level entity category graph — nodes are category IRIs, edges
|
|
384
|
-
* represent the `qcy:relatedEntity` connection at the category level.
|
|
385
|
-
*/
|
|
386
|
-
export interface ProjectEntitiesData {
|
|
387
|
-
entities: Array<{
|
|
388
|
-
iri: string;
|
|
389
|
-
size?: number;
|
|
390
|
-
}>;
|
|
391
|
-
relations: Array<{
|
|
392
|
-
sourceID: string;
|
|
393
|
-
targetID: string;
|
|
394
|
-
}>;
|
|
395
|
-
}
|
|
396
|
-
/**
|
|
397
|
-
* Structured summary graph returned by `buildSummaryGraph('graph')`.
|
|
398
|
-
* Nodes are deduplicated category IRIs; edges carry the predicate and
|
|
399
|
-
* occurrence count from the summary query.
|
|
400
|
-
*/
|
|
401
|
-
export interface SummaryGraphData {
|
|
402
|
-
entities: Array<{
|
|
403
|
-
iri: string;
|
|
404
|
-
}>;
|
|
405
|
-
relations: Array<{
|
|
406
|
-
sourceID: string;
|
|
407
|
-
predicate: string;
|
|
408
|
-
targetID: string;
|
|
409
|
-
weight: number;
|
|
410
|
-
}>;
|
|
411
|
-
}
|
|
412
|
-
/** Core metadata for a single document (FileContent node). */
|
|
413
|
-
export interface DocumentInfo {
|
|
414
|
-
id: string;
|
|
415
|
-
contentIRI: string;
|
|
416
|
-
path: string;
|
|
417
|
-
suffix: string;
|
|
418
|
-
size: number;
|
|
419
|
-
tags: string[];
|
|
420
|
-
categories: string[];
|
|
421
|
-
subject?: string;
|
|
422
|
-
summary?: string;
|
|
423
|
-
providerId?: string;
|
|
424
|
-
/** Full storage path in the processed bucket (e.g. `{projectId}/fragments/{uuid}.fragments`).
|
|
425
|
-
* Only present on alternative representations that carry a `qcy:remoteRelativePath`. */
|
|
426
|
-
remoteRelativePath?: string;
|
|
427
|
-
}
|
|
428
|
-
/** Count + total size for a group of documents (e.g. grouped by suffix or category). */
|
|
429
|
-
export interface DocumentSummary {
|
|
430
|
-
size: number;
|
|
431
|
-
count: number;
|
|
432
|
-
}
|
|
433
|
-
/** Project-level document overview — fetched once on project init. */
|
|
434
|
-
export interface ProjectDocumentsData {
|
|
435
|
-
duplicateCount: number;
|
|
436
|
-
/** File extension → `{ size, count }` */
|
|
437
|
-
documentsBySuffix: Record<string, DocumentSummary>;
|
|
438
|
-
/** Content-category IRI → `{ size, count }` */
|
|
439
|
-
documentsByContentCategory: Record<string, DocumentSummary>;
|
|
440
|
-
}
|
|
441
|
-
export interface IndexSearchRequest {
|
|
442
|
-
input: string;
|
|
443
|
-
limit?: number;
|
|
444
|
-
aggregate?: boolean;
|
|
445
|
-
/** `'loose'` (default) allows partial matches; `'strict'` requires exact term presence. */
|
|
446
|
-
mode?: 'loose' | 'strict';
|
|
447
|
-
/** Pre-seed the context with these document UUIDs before running the search. */
|
|
448
|
-
identifiers?: string[];
|
|
449
|
-
}
|
|
450
|
-
export interface IndexItem {
|
|
451
|
-
id: string;
|
|
452
|
-
type: string;
|
|
453
|
-
relevance: number;
|
|
454
|
-
sub_items?: IndexItem[];
|
|
455
|
-
}
|
|
456
|
-
export interface IndexSearchResponse {
|
|
457
|
-
id?: string;
|
|
458
|
-
total?: number;
|
|
459
|
-
items: IndexItem[];
|
|
460
|
-
}
|
package/lib/privileges.d.ts
DELETED
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import { ReadonlySignal } from './signal';
|
|
2
|
-
/** Roles ordered from highest to lowest privilege. */
|
|
3
|
-
declare const ROLE_HIERARCHY: readonly ["superadmin", "admin", "syncer", "member"];
|
|
4
|
-
export type UserProjectRole = (typeof ROLE_HIERARCHY)[number];
|
|
5
|
-
/** Role a user can have within an organization. */
|
|
6
|
-
export type UserOrgRole = 'admin' | 'member';
|
|
7
|
-
export interface Privileges {
|
|
8
|
-
changeContentCategories: boolean;
|
|
9
|
-
createEntities: boolean;
|
|
10
|
-
createProject: boolean;
|
|
11
|
-
createProvider: boolean;
|
|
12
|
-
deleteDocuments: boolean;
|
|
13
|
-
deleteProject: boolean;
|
|
14
|
-
deleteUserFromProject: boolean;
|
|
15
|
-
downloadDocuments: boolean;
|
|
16
|
-
editContentCategories: boolean;
|
|
17
|
-
editPublicReposAvailableToAgent: boolean;
|
|
18
|
-
editTier: boolean;
|
|
19
|
-
inviteUserToProject: boolean;
|
|
20
|
-
renameDocuments: boolean;
|
|
21
|
-
uploadDocuments: boolean;
|
|
22
|
-
viewEntities: boolean;
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Minimum project role required for each privilege.
|
|
26
|
-
* Note: `createProject` is intentionally absent — it is gated by the
|
|
27
|
-
* user's organisation role, not their project role.
|
|
28
|
-
*/
|
|
29
|
-
export declare const REQUIRED_ROLES: Record<Exclude<keyof Privileges, 'createProject'>, UserProjectRole>;
|
|
30
|
-
/**
|
|
31
|
-
* Manages role-based access control for the current user + selected project.
|
|
32
|
-
*
|
|
33
|
-
* - Call `setProjectRoles()` whenever the selected project changes.
|
|
34
|
-
* - Call `setOrgRole()` whenever the selected project's organisation changes.
|
|
35
|
-
* - Read `privileges` (a `ReadonlySignal<Privileges>`) for reactive access.
|
|
36
|
-
*
|
|
37
|
-
* @example
|
|
38
|
-
* cue.privileges.setProjectRoles(['admin']);
|
|
39
|
-
* cue.privileges.setOrgRole('admin');
|
|
40
|
-
* const canUpload = cue.privileges.privileges.get().uploadDocuments; // true
|
|
41
|
-
* const canCreate = cue.privileges.privileges.get().createProject; // true
|
|
42
|
-
*/
|
|
43
|
-
export declare class CuePrivileges {
|
|
44
|
-
private readonly _isSuperAdmin;
|
|
45
|
-
private readonly _projectRoles;
|
|
46
|
-
private readonly _orgRole;
|
|
47
|
-
/**
|
|
48
|
-
* Reactive signal — current user's privileges for the selected project.
|
|
49
|
-
* Recomputes automatically when `setProjectRoles()` is called or when
|
|
50
|
-
* the `isSuperAdmin` signal changes.
|
|
51
|
-
*/
|
|
52
|
-
readonly privileges: ReadonlySignal<Privileges>;
|
|
53
|
-
constructor(_isSuperAdmin: ReadonlySignal<boolean>);
|
|
54
|
-
/**
|
|
55
|
-
* Set the user's role within the organisation that owns the selected project.
|
|
56
|
-
* Pass `null` to clear the organisation role (e.g. when deselecting a project).
|
|
57
|
-
*
|
|
58
|
-
* Only organisation admins (and superadmins) may create projects.
|
|
59
|
-
*/
|
|
60
|
-
setOrgRole(role: UserOrgRole | null): void;
|
|
61
|
-
/**
|
|
62
|
-
* Set the user's roles for the currently selected project.
|
|
63
|
-
*
|
|
64
|
-
* Roles are expanded along the hierarchy: `admin` automatically includes
|
|
65
|
-
* `syncer` and `member`; `syncer` includes `member`. Pass an empty array
|
|
66
|
-
* to reset to the lowest privilege level.
|
|
67
|
-
*/
|
|
68
|
-
setProjectRoles(roles: UserProjectRole[]): void;
|
|
69
|
-
private _expand;
|
|
70
|
-
private _compute;
|
|
71
|
-
}
|
|
72
|
-
export {};
|
package/lib/profile.d.ts
DELETED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import { UserInfo } from 'firebase/auth';
|
|
2
|
-
import { FirebaseApp } from 'firebase/app';
|
|
3
|
-
import { APIKeyDoc, APIKeyInfo, OrgMember, OrganizationData, ProfileSSOAccount } from './models';
|
|
4
|
-
import { CueAuth } from './auth';
|
|
5
|
-
export declare class CueProfile {
|
|
6
|
-
private readonly _auth;
|
|
7
|
-
private readonly _gatewayUrl;
|
|
8
|
-
private readonly _functions;
|
|
9
|
-
constructor(_auth: CueAuth, app: FirebaseApp, useEmulator: boolean, _gatewayUrl: string);
|
|
10
|
-
private _url;
|
|
11
|
-
private _fetch;
|
|
12
|
-
/** Whether the current user has an active API key. */
|
|
13
|
-
hasAPIKey(): Promise<boolean>;
|
|
14
|
-
/** Returns the sign-in methods registered for the current user's email. */
|
|
15
|
-
getSignInMethods(): Promise<string[]>;
|
|
16
|
-
/** Builds a human-readable label from a Firebase UserInfo provider entry. */
|
|
17
|
-
buildProviderLabel(userInfo: UserInfo): string;
|
|
18
|
-
/** Returns SSO accounts linked to the current user (excludes password). */
|
|
19
|
-
getSSOAccounts(): ProfileSSOAccount[];
|
|
20
|
-
/** Links a Google or Microsoft provider to the current account via popup. Returns the new provider label. */
|
|
21
|
-
linkProvider(ssoProvider: string): Promise<string>;
|
|
22
|
-
/** Unlinks a provider from the current account. */
|
|
23
|
-
unlinkProvider(providerId: string): Promise<void>;
|
|
24
|
-
/** Changes the password. Reauthenticates first. */
|
|
25
|
-
updatePassword(currentPassword: string, newPassword: string): Promise<void>;
|
|
26
|
-
/** Adds (sets) a password for an account that currently only uses SSO. */
|
|
27
|
-
addPassword(password: string): Promise<void>;
|
|
28
|
-
/** Requests an e-mail change. Sends a verification e-mail to the new address. */
|
|
29
|
-
updateEmail(newEmail: string, password: string): Promise<void>;
|
|
30
|
-
/** Creates a new API key for the current user. */
|
|
31
|
-
createAPIKey(expiration: string): Promise<APIKeyDoc>;
|
|
32
|
-
/** Revokes the current user's API key. */
|
|
33
|
-
revokeAPIKey(): Promise<void>;
|
|
34
|
-
/** Fetches the current user's existing API key. */
|
|
35
|
-
requestAPIKey(): Promise<APIKeyInfo>;
|
|
36
|
-
/** Returns organizations the current user is a member of. */
|
|
37
|
-
listOrganizations(): Promise<(Pick<OrganizationData, 'id' | 'name'> & {
|
|
38
|
-
isAdmin: boolean;
|
|
39
|
-
})[]>;
|
|
40
|
-
/** Returns all members of the given organisation. Caller must be an org admin or superadmin. */
|
|
41
|
-
getOrgMembers(orgId: string): Promise<OrgMember[]>;
|
|
42
|
-
private _requireUser;
|
|
43
|
-
/**
|
|
44
|
-
* Fetch display name and email for a list of user UIDs.
|
|
45
|
-
* Uses the `getUserInfo` Firebase callable function.
|
|
46
|
-
*/
|
|
47
|
-
getUserInfo(uids: string[]): Promise<Record<string, {
|
|
48
|
-
name: string;
|
|
49
|
-
email: string;
|
|
50
|
-
}>>;
|
|
51
|
-
/** Record that the current user has accepted the terms of service. Sets a `terms` custom claim on the token. */
|
|
52
|
-
acceptTerms(version: string): Promise<void>;
|
|
53
|
-
/**
|
|
54
|
-
* Returns the terms version the current user has accepted (e.g. `"v1"`),
|
|
55
|
-
* or `null` if they have not accepted any version yet.
|
|
56
|
-
* Reads from the cached ID token — call after `acceptTerms()` with a
|
|
57
|
-
* force-refreshed token to see the updated value.
|
|
58
|
-
*/
|
|
59
|
-
latestTermsAccepted(): Promise<string | null>;
|
|
60
|
-
}
|