@qaecy/cue-sdk 0.0.29 → 0.0.31
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 +16 -16
- package/{cue-CnZyGMRG.js → cue-VOCN5IEZ.js} +865 -600
- package/index.d.ts +3 -1
- package/index.js +17 -16
- package/lib/api.d.ts +3 -0
- package/lib/contexts.d.ts +17 -0
- package/lib/cue.d.ts +3 -0
- package/lib/documents.d.ts +38 -4
- package/lib/entities.d.ts +32 -7
- package/lib/models.d.ts +45 -0
- package/lib/project-view.d.ts +3 -1
- package/lib/schema.d.ts +30 -16
- package/lib/storage.d.ts +26 -10
- package/node.js +40 -38
- package/package.json +1 -1
- package/variables.d.ts +4 -0
package/index.d.ts
CHANGED
|
@@ -19,9 +19,11 @@ export { CueSignal, cueComputed, staleWhileRevalidate } from './lib/signal';
|
|
|
19
19
|
export type { ReadonlySignal } from './lib/signal';
|
|
20
20
|
export { CueCache } from './lib/cache';
|
|
21
21
|
export type { QueryCacheEntry } from './lib/cache';
|
|
22
|
-
export type { CueSdkConfig, SsoProvider, PasswordCredentials, SearchRequest, SearchResponse, SearchSource, SearchOptions, ProjectData, ProjectSettings, CreateProjectOptions, SyncOptions, SyncResult, SyncPreview, ScanOutputRecord, UnitsConsumedDto, OrganizationData, OrgMember, ProfileSSOAccount, APIKeyInfo, APIKeyDoc, ProjectDoc, OrganizationDoc, UserDoc, RDFWritingDoc, ViewDefinition, QueryCache, CategoryDef, RelationshipDef, EntityCoreData, EntityRelationship, EntityRelationships, MapGeometry, EntityDetailedData, ProjectEntitiesData, DocumentInfo, DocumentSummary, ProjectDocumentsData, } from './lib/models';
|
|
22
|
+
export type { CueSdkConfig, SsoProvider, PasswordCredentials, SearchRequest, SearchResponse, SearchSource, SearchOptions, ProjectData, ProjectSettings, CreateProjectOptions, SyncOptions, SyncResult, SyncPreview, ScanOutputRecord, UnitsConsumedDto, OrganizationData, OrgMember, ProfileSSOAccount, APIKeyInfo, APIKeyDoc, ProjectDoc, OrganizationDoc, UserDoc, RDFWritingDoc, ViewDefinition, QueryCache, LangMap, CategoryDef, RelationshipDef, EntityCoreData, EntityRelationship, EntityRelationships, MapGeometry, EntityDetailedData, ProjectEntitiesData, DocumentInfo, DocumentSummary, ProjectDocumentsData, } from './lib/models';
|
|
23
23
|
export type { AuthStateListener, Unsubscribe } from './lib/auth';
|
|
24
24
|
export { CueTables } from './lib/tables';
|
|
25
25
|
export type { ProjectTable } from './lib/tables';
|
|
26
26
|
export { CueExtraction } from './lib/extraction';
|
|
27
27
|
export type { ExtractionRequest, ExtractionResponse } from './lib/extraction';
|
|
28
|
+
export { CueContexts } from './lib/contexts';
|
|
29
|
+
export type { ContextDoc, ContextItem } from './lib/models';
|
package/index.js
CHANGED
|
@@ -1,24 +1,25 @@
|
|
|
1
|
-
import { C as s, a as u, b as C, c as t, d as i, e as
|
|
1
|
+
import { C as s, a as u, b as C, c as t, d as i, e as o, f as c, g as r, h as n, i as l, j as P, k as j, l as m, m as S, n as g, o as h, p, q as E, R, r as f, s as d, t as x } from "./cue-VOCN5IEZ.js";
|
|
2
2
|
export {
|
|
3
3
|
s as Cue,
|
|
4
4
|
u as CueApi,
|
|
5
5
|
C as CueAuth,
|
|
6
6
|
t as CueCache,
|
|
7
|
-
i as
|
|
7
|
+
i as CueContexts,
|
|
8
|
+
o as CueExtraction,
|
|
8
9
|
c as CueGis,
|
|
9
|
-
|
|
10
|
-
|
|
10
|
+
r as CuePrivileges,
|
|
11
|
+
n as CueProfile,
|
|
11
12
|
l as CueProjectDocuments,
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
13
|
+
P as CueProjectEntities,
|
|
14
|
+
j as CueProjectSchema,
|
|
15
|
+
m as CueProjectView,
|
|
16
|
+
S as CueProjects,
|
|
17
|
+
g as CueSignal,
|
|
18
|
+
h as CueStorage,
|
|
19
|
+
p as CueSyncApi,
|
|
20
|
+
E as CueTables,
|
|
21
|
+
R as REQUIRED_ROLES,
|
|
22
|
+
f as configureScanWasm,
|
|
23
|
+
d as cueComputed,
|
|
24
|
+
x as staleWhileRevalidate
|
|
24
25
|
};
|
package/lib/api.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ import { CueProjects } from './project';
|
|
|
4
4
|
import { CueSyncApi } from './sync';
|
|
5
5
|
import { CueTables } from './tables';
|
|
6
6
|
import { CueExtraction } from './extraction';
|
|
7
|
+
import { CueContexts } from './contexts';
|
|
7
8
|
export declare class CueApi {
|
|
8
9
|
private readonly _auth;
|
|
9
10
|
private readonly _gatewayUrl;
|
|
@@ -12,6 +13,8 @@ export declare class CueApi {
|
|
|
12
13
|
readonly tables: CueTables;
|
|
13
14
|
/** Semantic extraction client — call document pages against a SemanticTemplate. */
|
|
14
15
|
readonly extraction: CueExtraction;
|
|
16
|
+
/** Session context file client — fetch and decompress context documents. */
|
|
17
|
+
readonly contexts: CueContexts;
|
|
15
18
|
/** Active language used for language-sensitive SPARQL queries across all project classes. */
|
|
16
19
|
language: string;
|
|
17
20
|
/** Updates the active language. All project classes (`CueProjectSchema`, `CueProjectDocuments`, `CueProjectEntities`) read this at query time. */
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { CueAuth } from './auth';
|
|
2
|
+
import { ContextDoc } from './models';
|
|
3
|
+
export declare class CueContexts {
|
|
4
|
+
private readonly _auth;
|
|
5
|
+
private readonly _gatewayUrl;
|
|
6
|
+
constructor(_auth: CueAuth, _gatewayUrl: string);
|
|
7
|
+
/**
|
|
8
|
+
* Fetch and decompress a session context document.
|
|
9
|
+
*
|
|
10
|
+
* Context files are stored as `sessions_eu_west6/{projectId}/contexts/{contextId}.json.gz`
|
|
11
|
+
* and served via the gateway at `GET /storage/sessions/{projectId}/contexts/{contextId}.json.gz`.
|
|
12
|
+
*
|
|
13
|
+
* @param projectId - The project the context belongs to.
|
|
14
|
+
* @param contextId - The context document ID (without the `.json.gz` suffix).
|
|
15
|
+
*/
|
|
16
|
+
getContext(projectId: string, contextId: string): Promise<ContextDoc>;
|
|
17
|
+
}
|
package/lib/cue.d.ts
CHANGED
|
@@ -36,6 +36,7 @@ export declare class Cue {
|
|
|
36
36
|
protected _storageProcessed: FirebaseStorage;
|
|
37
37
|
private _gis;
|
|
38
38
|
private readonly _projectDocuments;
|
|
39
|
+
private readonly _verbose;
|
|
39
40
|
/**
|
|
40
41
|
* Reactive GIS service. Lazily constructed on first access.
|
|
41
42
|
*
|
|
@@ -108,6 +109,7 @@ export declare class Cue {
|
|
|
108
109
|
rdfBase?: string;
|
|
109
110
|
graphType?: string;
|
|
110
111
|
queryCache?: QueryCache;
|
|
112
|
+
verbose?: boolean;
|
|
111
113
|
}): CueProjectEntities;
|
|
112
114
|
/**
|
|
113
115
|
* Creates a `CueProjectDocuments` instance for the given project, with the
|
|
@@ -128,5 +130,6 @@ export declare class Cue {
|
|
|
128
130
|
rdfBase?: string;
|
|
129
131
|
graphType?: string;
|
|
130
132
|
queryCache?: QueryCache;
|
|
133
|
+
verbose?: boolean;
|
|
131
134
|
}): CueProjectDocuments;
|
|
132
135
|
}
|
package/lib/documents.d.ts
CHANGED
|
@@ -38,11 +38,14 @@ export declare class CueProjectDocuments {
|
|
|
38
38
|
private readonly _projectId;
|
|
39
39
|
private readonly _queryCache?;
|
|
40
40
|
private readonly _graphType?;
|
|
41
|
+
private readonly _verbose;
|
|
41
42
|
/** Full RDF base URL for this project, e.g. `https://cue.qaecy.com/r/{pid}/` */
|
|
42
43
|
readonly baseURL: string;
|
|
43
44
|
/** Tracks the language for which `_documentInfoMap` is currently populated. */
|
|
44
45
|
private _currentLang;
|
|
45
46
|
private readonly _documentInfoMap;
|
|
47
|
+
/** Cumulative unique document UUIDs ever passed to request methods (survives cache hits). */
|
|
48
|
+
private readonly _seenIds;
|
|
46
49
|
private readonly _projectDocumentsData;
|
|
47
50
|
/** Lazily populated per-document detail map. */
|
|
48
51
|
readonly documentInfoMap: ReadonlySignal<Record<string, DocumentInfo>>;
|
|
@@ -50,7 +53,7 @@ export declare class CueProjectDocuments {
|
|
|
50
53
|
readonly projectDocumentsData: ReadonlySignal<ProjectDocumentsData>;
|
|
51
54
|
constructor(_api: CueApi, _projectId: string, language?: string,
|
|
52
55
|
/** Override the RDF resource base URL. Defaults to `https://cue.qaecy.com/r/`. */
|
|
53
|
-
rdfBase?: string, _queryCache?: QueryCache | undefined, _graphType?: string | undefined);
|
|
56
|
+
rdfBase?: string, _queryCache?: QueryCache | undefined, _graphType?: string | undefined, _verbose?: boolean);
|
|
54
57
|
/**
|
|
55
58
|
* Resets all document state. Call when the active project changes.
|
|
56
59
|
* Follow with `fetchOverview()` once the triplestore is ready.
|
|
@@ -134,7 +137,10 @@ export declare class CueProjectDocuments {
|
|
|
134
137
|
* Suffixes are matched case-insensitively and the leading dot is optional
|
|
135
138
|
* (both `'ifc'` and `'.ifc'` are accepted).
|
|
136
139
|
*/
|
|
137
|
-
documentsBySuffix(suffixes: string[], includeMetadata?: false): Promise<
|
|
140
|
+
documentsBySuffix(suffixes: string[], includeMetadata?: false): Promise<Array<{
|
|
141
|
+
iri: string;
|
|
142
|
+
uuid: string;
|
|
143
|
+
}>>;
|
|
138
144
|
documentsBySuffix(suffixes: string[], includeMetadata: true): Promise<Array<{
|
|
139
145
|
iri: string;
|
|
140
146
|
uuid: string;
|
|
@@ -149,7 +155,10 @@ export declare class CueProjectDocuments {
|
|
|
149
155
|
* Resolves matching suffixes from `fileExtensionsInfo` and delegates to
|
|
150
156
|
* `documentsBySuffix`. Accepts the same `includeMetadata` flag.
|
|
151
157
|
*/
|
|
152
|
-
documentsByFileType(fileTypes: FileType[], includeMetadata?: false): Promise<
|
|
158
|
+
documentsByFileType(fileTypes: FileType[], includeMetadata?: false): Promise<Array<{
|
|
159
|
+
iri: string;
|
|
160
|
+
uuid: string;
|
|
161
|
+
}>>;
|
|
153
162
|
documentsByFileType(fileTypes: FileType[], includeMetadata: true): Promise<Array<{
|
|
154
163
|
iri: string;
|
|
155
164
|
uuid: string;
|
|
@@ -157,6 +166,25 @@ export declare class CueProjectDocuments {
|
|
|
157
166
|
suffix: string;
|
|
158
167
|
size: number;
|
|
159
168
|
}>>;
|
|
169
|
+
/**
|
|
170
|
+
* Fetches all `qcy:FileContent` documents that carry one of the given
|
|
171
|
+
* content-category IRIs (e.g. as returned by `projectDocumentsData.documentsByContentCategory`).
|
|
172
|
+
*
|
|
173
|
+
* By default returns only `{ iri, uuid }` — pass `includeMetadata: true` to
|
|
174
|
+
* also get `path`, `suffix`, and `size`. Use the default form when you intend
|
|
175
|
+
* to lazy-load full details via `requestDocumentData`.
|
|
176
|
+
*/
|
|
177
|
+
documentsByContentCategory(categoryIRIs: string[], includeMetadata?: false): Promise<Array<{
|
|
178
|
+
iri: string;
|
|
179
|
+
uuid: string;
|
|
180
|
+
}>>;
|
|
181
|
+
documentsByContentCategory(categoryIRIs: string[], includeMetadata: true): Promise<Array<{
|
|
182
|
+
iri: string;
|
|
183
|
+
uuid: string;
|
|
184
|
+
path: string;
|
|
185
|
+
suffix: string;
|
|
186
|
+
size: number;
|
|
187
|
+
}>>;
|
|
160
188
|
/**
|
|
161
189
|
* Fetches documents whose MIME type matches one of the given strings
|
|
162
190
|
* (e.g. `'application/x-step'`, `'application/pdf'`).
|
|
@@ -164,7 +192,10 @@ export declare class CueProjectDocuments {
|
|
|
164
192
|
* Resolves matching suffixes from `fileExtensionsInfo` and delegates to
|
|
165
193
|
* `documentsBySuffix`. Accepts the same `includeMetadata` flag.
|
|
166
194
|
*/
|
|
167
|
-
documentsByMime(mimeTypes: string[], includeMetadata?: false): Promise<
|
|
195
|
+
documentsByMime(mimeTypes: string[], includeMetadata?: false): Promise<Array<{
|
|
196
|
+
iri: string;
|
|
197
|
+
uuid: string;
|
|
198
|
+
}>>;
|
|
168
199
|
documentsByMime(mimeTypes: string[], includeMetadata: true): Promise<Array<{
|
|
169
200
|
iri: string;
|
|
170
201
|
uuid: string;
|
|
@@ -172,6 +203,9 @@ export declare class CueProjectDocuments {
|
|
|
172
203
|
suffix: string;
|
|
173
204
|
size: number;
|
|
174
205
|
}>>;
|
|
206
|
+
/** Builds a full resource IRI from a UUID without a SPARQL round-trip. */
|
|
207
|
+
private _resourceIri;
|
|
208
|
+
private _log;
|
|
175
209
|
/** Executes the document-info SPARQL query for the given UUIDs, merges results
|
|
176
210
|
* into `documentInfoMap`, and returns the newly fetched entries. */
|
|
177
211
|
private _fetchDocumentInfoBatch;
|
package/lib/entities.d.ts
CHANGED
|
@@ -38,6 +38,7 @@ export declare class CueProjectEntities {
|
|
|
38
38
|
private readonly _projectId;
|
|
39
39
|
private readonly _queryCache?;
|
|
40
40
|
private readonly _graphType?;
|
|
41
|
+
private readonly _verbose;
|
|
41
42
|
/** Full RDF base URL for this project, e.g. `https://cue.qaecy.com/r/{pid}/` */
|
|
42
43
|
readonly baseURL: string;
|
|
43
44
|
private readonly _entityDetails;
|
|
@@ -46,6 +47,8 @@ export declare class CueProjectEntities {
|
|
|
46
47
|
private readonly _entityOSMMap;
|
|
47
48
|
private readonly _osmWKTMap;
|
|
48
49
|
private readonly _fetchingOSMIds;
|
|
50
|
+
/** Cumulative unique entity UUIDs ever passed to request methods (survives cache hits). */
|
|
51
|
+
private readonly _seenIds;
|
|
49
52
|
private readonly _entityGraph;
|
|
50
53
|
private readonly _entityInfoMapComputed;
|
|
51
54
|
/** Merged per-entity detail map. Updated reactively as data arrives. */
|
|
@@ -54,12 +57,15 @@ export declare class CueProjectEntities {
|
|
|
54
57
|
readonly entityGraph: ReadonlySignal<ProjectEntitiesData | undefined>;
|
|
55
58
|
constructor(_api: CueApi, _projectId: string,
|
|
56
59
|
/** Override the RDF resource base URL. Defaults to `https://cue.qaecy.com/r/`. */
|
|
57
|
-
rdfBase?: string, _queryCache?: QueryCache | undefined, _graphType?: string | undefined);
|
|
60
|
+
rdfBase?: string, _queryCache?: QueryCache | undefined, _graphType?: string | undefined, _verbose?: boolean);
|
|
58
61
|
/**
|
|
59
62
|
* Constructs the full RDF IRI for the given entity UUID.
|
|
60
63
|
* Use this to bridge the UUID-based batch APIs and the IRI-based per-entity APIs.
|
|
61
64
|
*/
|
|
62
65
|
entityIri(uuid: string): string;
|
|
66
|
+
/** @internal Builds a full resource IRI from a UUID without a SPARQL round-trip. */
|
|
67
|
+
private _resourceIri;
|
|
68
|
+
private _log;
|
|
63
69
|
/**
|
|
64
70
|
* Resets all entity state and re-fetches the entity graph.
|
|
65
71
|
* Call when the active project changes.
|
|
@@ -114,11 +120,15 @@ export declare class CueProjectEntities {
|
|
|
114
120
|
* - `"qcy:Building"`
|
|
115
121
|
* - `"https://cue.qaecy.com/ontology#Building"`
|
|
116
122
|
*
|
|
117
|
-
* By default returns
|
|
118
|
-
*
|
|
123
|
+
* By default returns `{ iri, uuid }[]` — the IRI is built locally from the
|
|
124
|
+
* project base URL so no extra data is fetched from the endpoint.
|
|
125
|
+
* Pass `includeMetadata: true` to also get `value` and `categories`.
|
|
119
126
|
* Use the default form when you intend to lazy-load details via `requestEntityData`.
|
|
120
127
|
*/
|
|
121
|
-
entitiesByCategory(categoryIris: string[], includeMetadata?: false): Promise<
|
|
128
|
+
entitiesByCategory(categoryIris: string[], includeMetadata?: false): Promise<Array<{
|
|
129
|
+
iri: string;
|
|
130
|
+
uuid: string;
|
|
131
|
+
}>>;
|
|
122
132
|
entitiesByCategory(categoryIris: string[], includeMetadata: true): Promise<Array<{
|
|
123
133
|
iri: string;
|
|
124
134
|
uuid: string;
|
|
@@ -137,6 +147,11 @@ export declare class CueProjectEntities {
|
|
|
137
147
|
* - `'graph'` — structured `{ entities, relations }` with predicates and weights
|
|
138
148
|
* - `'md'` — compact aligned text table
|
|
139
149
|
*
|
|
150
|
+
* @param entityIRI Optional category IRI (prefixed, e.g. `qcy:Building`, or
|
|
151
|
+
* full, e.g. `https://…Building`). When supplied, only edges where either
|
|
152
|
+
* the source or target category equals this IRI are returned — i.e. the
|
|
153
|
+
* one-hop neighbourhood of that category.
|
|
154
|
+
*
|
|
140
155
|
* @example
|
|
141
156
|
* ```ts
|
|
142
157
|
* // Structured graph (nodes + edges)
|
|
@@ -144,14 +159,24 @@ export declare class CueProjectEntities {
|
|
|
144
159
|
* // g.entities → [{ iri: 'https://…FloorPlanDrawing' }, …]
|
|
145
160
|
* // g.relations → [{ sourceID, predicate, targetID, weight }, …]
|
|
146
161
|
*
|
|
162
|
+
* // Neighbourhood of a single category (prefixed IRI)
|
|
163
|
+
* const g2 = await entities.buildSummaryGraph('graph', 'qcy:Building');
|
|
164
|
+
*
|
|
147
165
|
* // Markdown table
|
|
148
166
|
* const md = await entities.buildSummaryGraph('md');
|
|
149
167
|
* // qcy:FloorPlanDrawing -> qcy:includesBuildingEntity -> qcy:BuildingZone (5652)
|
|
150
168
|
* ```
|
|
151
169
|
*/
|
|
152
|
-
buildSummaryGraph(format: 'graph'): Promise<SummaryGraphData>;
|
|
153
|
-
buildSummaryGraph(format: 'md'): Promise<string>;
|
|
154
|
-
buildSummaryGraph(format?: undefined): Promise<unknown>;
|
|
170
|
+
buildSummaryGraph(format: 'graph', entityIRI?: string): Promise<SummaryGraphData>;
|
|
171
|
+
buildSummaryGraph(format: 'md', entityIRI?: string): Promise<string>;
|
|
172
|
+
buildSummaryGraph(format?: undefined, entityIRI?: string): Promise<unknown>;
|
|
173
|
+
/**
|
|
174
|
+
* Fetches the category-summary rows. On QLever the pre-computed
|
|
175
|
+
* `entity-summary` materialized view is tried first; if it yields no rows we
|
|
176
|
+
* warn and fall back to the live aggregation query. Fuseki always uses the
|
|
177
|
+
* live query.
|
|
178
|
+
*/
|
|
179
|
+
private _fetchSummaryData;
|
|
155
180
|
private _computeEntityInfoMap;
|
|
156
181
|
private _fetchOutgoingRelationships;
|
|
157
182
|
private _fetchIncomingRelationships;
|
package/lib/models.d.ts
CHANGED
|
@@ -26,6 +26,8 @@ export interface CueSdkConfig {
|
|
|
26
26
|
environment?: CueEnvironment;
|
|
27
27
|
/** Override individual endpoint URLs. Takes precedence over environment. */
|
|
28
28
|
endpoints?: Partial<CueEndpoints>;
|
|
29
|
+
/** Enable verbose debug logging for all entity/document store operations. */
|
|
30
|
+
verbose?: boolean;
|
|
29
31
|
}
|
|
30
32
|
export type SsoProvider = 'google' | 'microsoft';
|
|
31
33
|
export interface PasswordCredentials {
|
|
@@ -58,6 +60,26 @@ export interface SearchResponse {
|
|
|
58
60
|
sources: SearchSource[];
|
|
59
61
|
rankedSources: SearchSource[];
|
|
60
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
|
+
}
|
|
61
83
|
export interface ProjectSettings {
|
|
62
84
|
views?: Array<{
|
|
63
85
|
id: string;
|
|
@@ -283,12 +305,35 @@ export interface QueryCache {
|
|
|
283
305
|
get(key: string): Promise<unknown | undefined>;
|
|
284
306
|
set(key: string, data: unknown): Promise<void>;
|
|
285
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
|
+
};
|
|
286
316
|
/** A taxonomy node (content category or entity category) from the triplestore. */
|
|
287
317
|
export interface CategoryDef {
|
|
288
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
|
+
*/
|
|
289
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;
|
|
290
333
|
/** IRI of the parent category (skos:broader), if any. */
|
|
291
334
|
parent?: string;
|
|
335
|
+
/** Whether this category is marked as deprecated in the triplestore. */
|
|
336
|
+
deprecated?: boolean;
|
|
292
337
|
}
|
|
293
338
|
/**
|
|
294
339
|
* A relationship type discovered in the triplestore via `qcy:relatedEntity` property scan.
|
package/lib/project-view.d.ts
CHANGED
|
@@ -11,6 +11,8 @@ export interface CueProjectViewOptions {
|
|
|
11
11
|
rdfBase?: string;
|
|
12
12
|
/** Graph engine type from projectSettings.graph.type (e.g. 'qlever' or 'fuseki'). */
|
|
13
13
|
graphType?: string;
|
|
14
|
+
/** Enable verbose debug logging for entity and document fetch stats. */
|
|
15
|
+
verbose?: boolean;
|
|
14
16
|
}
|
|
15
17
|
/**
|
|
16
18
|
* Framework-agnostic facade over `CueProjectSchema`, `CueProjectEntities`, and
|
|
@@ -59,7 +61,7 @@ export declare class CueProjectView {
|
|
|
59
61
|
/** The result of the most recent `search()` call. `undefined` before first search. */
|
|
60
62
|
readonly searchResults: ReadonlySignal<SearchResponse | undefined>;
|
|
61
63
|
private _destroyed;
|
|
62
|
-
constructor(_api: CueApi, _projectId: string, { language, queryCache, rdfBase, graphType }: CueProjectViewOptions);
|
|
64
|
+
constructor(_api: CueApi, _projectId: string, { language, queryCache, rdfBase, graphType, verbose }: CueProjectViewOptions);
|
|
63
65
|
/**
|
|
64
66
|
* Lazily batch-fetch core data (label + categories) for the given entity UUIDs.
|
|
65
67
|
* Already-fetched UUIDs are skipped. Populates `entityInfoMap`.
|
package/lib/schema.d.ts
CHANGED
|
@@ -5,8 +5,10 @@ import { CategoryDef, QueryCache, RelationshipDef } from './models';
|
|
|
5
5
|
* Holds the schema for a single project: available content categories,
|
|
6
6
|
* entity categories, and entity relationship types.
|
|
7
7
|
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
8
|
+
* The full schema is fetched **once** (a single SPARQL query covering all three
|
|
9
|
+
* collections) and cached. Labels and definitions are retained for every
|
|
10
|
+
* available language as {@link LangMap}s; switching language is therefore a
|
|
11
|
+
* cheap, client-side re-projection with no extra network round-trip.
|
|
10
12
|
*
|
|
11
13
|
* ### Reactive paradigm
|
|
12
14
|
* All three collections are exposed as `ReadonlySignal<T>`. Framework adapters
|
|
@@ -21,8 +23,8 @@ import { CategoryDef, QueryCache, RelationshipDef } from './models';
|
|
|
21
23
|
* ```ts
|
|
22
24
|
* const schema = new CueProjectSchema(cue.api, projectId, 'en');
|
|
23
25
|
* schema.availableContentCategories.get(); // CategoryDef[]
|
|
24
|
-
* schema.setLanguage('da'); //
|
|
25
|
-
* await schema.refresh(); // force re-fetch
|
|
26
|
+
* schema.setLanguage('da'); // re-projects cached data instantly
|
|
27
|
+
* await schema.refresh(); // force re-fetch
|
|
26
28
|
* ```
|
|
27
29
|
*/
|
|
28
30
|
export declare class CueProjectSchema {
|
|
@@ -30,8 +32,10 @@ export declare class CueProjectSchema {
|
|
|
30
32
|
private readonly _projectId;
|
|
31
33
|
private readonly _queryCache?;
|
|
32
34
|
private readonly _graphType?;
|
|
33
|
-
private
|
|
35
|
+
private _snapshot?;
|
|
36
|
+
private _inflight?;
|
|
34
37
|
private _currentLang;
|
|
38
|
+
private readonly _verbose;
|
|
35
39
|
private readonly _contentCategories;
|
|
36
40
|
private readonly _entityCategories;
|
|
37
41
|
private readonly _relationships;
|
|
@@ -46,26 +50,36 @@ export declare class CueProjectSchema {
|
|
|
46
50
|
* completed (or failed). Await this before reading signal values imperatively.
|
|
47
51
|
*/
|
|
48
52
|
readonly ready: Promise<void>;
|
|
49
|
-
constructor(_api: CueApi, _projectId: string, language: string, _queryCache?: QueryCache | undefined, _graphType?: string | undefined);
|
|
53
|
+
constructor(_api: CueApi, _projectId: string, language: string, _queryCache?: QueryCache | undefined, _graphType?: string | undefined, verbose?: boolean);
|
|
50
54
|
/** Returns the currently active language. */
|
|
51
55
|
get language(): string;
|
|
52
56
|
/**
|
|
53
|
-
* Switch the active language.
|
|
54
|
-
*
|
|
55
|
-
*
|
|
57
|
+
* Switch the active language. Re-projects the already-fetched schema for the
|
|
58
|
+
* new language without re-querying; only triggers a fetch if nothing has been
|
|
59
|
+
* loaded yet.
|
|
56
60
|
*/
|
|
57
61
|
setLanguage(lang: string): void;
|
|
58
62
|
/**
|
|
59
|
-
* Force a re-fetch
|
|
63
|
+
* Force a re-fetch of the schema, bypassing the cache.
|
|
60
64
|
* Useful when the triplestore data has changed.
|
|
61
65
|
*/
|
|
62
66
|
refresh(): Promise<void>;
|
|
63
67
|
private _load;
|
|
68
|
+
/**
|
|
69
|
+
* Fetches the schema once. On QLever the pre-computed `schemas` materialized
|
|
70
|
+
* view is tried first; if it yields no rows we warn and fall back to the live
|
|
71
|
+
* schema query.
|
|
72
|
+
*/
|
|
73
|
+
private _fetchSnapshot;
|
|
64
74
|
private _apply;
|
|
65
|
-
|
|
66
|
-
private
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
75
|
+
/** Projects a language-independent {@link SchemaNode} into a {@link CategoryDef}. */
|
|
76
|
+
private _toDef;
|
|
77
|
+
/**
|
|
78
|
+
* Single query covering content categories, entity categories and entity
|
|
79
|
+
* relationship types. Labels/definitions are returned untouched (with their
|
|
80
|
+
* language tags) so they can be grouped into {@link LangMap}s client-side.
|
|
81
|
+
*/
|
|
82
|
+
private _buildSchemaQuery;
|
|
83
|
+
/** Runs a schema query and groups the flat rows into a {@link SchemaSnapshot}. */
|
|
84
|
+
private _runSchemaQuery;
|
|
71
85
|
}
|
package/lib/storage.d.ts
CHANGED
|
@@ -1,30 +1,41 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CueAuth } from './auth';
|
|
2
2
|
export type StorageBucket = 'raw' | 'processed';
|
|
3
3
|
/**
|
|
4
|
-
* Provides document download URL resolution
|
|
4
|
+
* Provides document download URL resolution proxied through the Cue gateway.
|
|
5
|
+
*
|
|
6
|
+
* The returned URLs require an `Authorization: Bearer {token}` header — use
|
|
7
|
+
* `cue.api.getAuthHeaders()` or `cue.auth.authenticatedFetch()` to fetch them.
|
|
8
|
+
* For use in `<img src>` / `<video src>`, convert to a blob URL first:
|
|
9
|
+
* ```ts
|
|
10
|
+
* const response = await cue.auth.authenticatedFetch(url);
|
|
11
|
+
* const objectUrl = URL.createObjectURL(await response.blob());
|
|
12
|
+
* ```
|
|
5
13
|
*
|
|
6
14
|
* @example
|
|
7
15
|
* ```ts
|
|
8
|
-
* const url =
|
|
16
|
+
* const url = cue.storage.getDownloadUrl('my-project', 'abc123', '.pdf');
|
|
17
|
+
* const res = await cue.auth.authenticatedFetch(url);
|
|
9
18
|
* ```
|
|
10
19
|
*/
|
|
11
20
|
export declare class CueStorage {
|
|
12
|
-
private readonly
|
|
13
|
-
|
|
21
|
+
private readonly _auth;
|
|
22
|
+
private readonly _gatewayUrl;
|
|
23
|
+
constructor(_auth: CueAuth, _gatewayUrl: string);
|
|
14
24
|
/**
|
|
15
|
-
* Returns a
|
|
25
|
+
* Returns a gateway download URL for a document stored in Cue.
|
|
16
26
|
*
|
|
17
27
|
* The storage path is `{projectId}/{uuid}{suffix}`, e.g. `my-project/abc-123.pdf`.
|
|
28
|
+
* The returned URL must be fetched with an Authorization header.
|
|
18
29
|
*
|
|
19
30
|
* @param projectId - The Cue project (space) ID.
|
|
20
31
|
* @param uuid - The document UUID.
|
|
21
32
|
* @param suffix - File suffix including the leading dot, e.g. `'.pdf'`, `'.ifc'`.
|
|
22
33
|
* @param bucket - `'raw'` (default, original uploads) or `'processed'` (derived artefacts).
|
|
23
34
|
*/
|
|
24
|
-
getDownloadUrl(projectId: string, uuid: string, suffix: string, bucket?: StorageBucket):
|
|
35
|
+
getDownloadUrl(projectId: string, uuid: string, suffix: string, bucket?: StorageBucket): string;
|
|
25
36
|
/**
|
|
26
|
-
* Returns a
|
|
27
|
-
*
|
|
37
|
+
* Returns a gateway download URL for an alternative representation using its
|
|
38
|
+
* full `qcy:remoteRelativePath` stored in the processed bucket.
|
|
28
39
|
*
|
|
29
40
|
* Use this instead of `getDownloadUrl` when the document info was obtained via
|
|
30
41
|
* `fetchAlternativeRepresentations` and carries a `remoteRelativePath`.
|
|
@@ -32,5 +43,10 @@ export declare class CueStorage {
|
|
|
32
43
|
* @param remoteRelativePath - The full path in the processed bucket,
|
|
33
44
|
* e.g. `{projectId}/fragments/{uuid}.fragments`.
|
|
34
45
|
*/
|
|
35
|
-
getAltRepDownloadUrl(remoteRelativePath: string):
|
|
46
|
+
getAltRepDownloadUrl(remoteRelativePath: string): string;
|
|
47
|
+
/**
|
|
48
|
+
* Fetch a file through the gateway and return it as a Blob.
|
|
49
|
+
* Convenience wrapper around `getDownloadUrl` + `authenticatedFetch`.
|
|
50
|
+
*/
|
|
51
|
+
downloadBlob(projectId: string, uuid: string, suffix: string, bucket?: StorageBucket): Promise<Blob>;
|
|
36
52
|
}
|
package/node.js
CHANGED
|
@@ -1,59 +1,61 @@
|
|
|
1
|
-
import { C as
|
|
2
|
-
import { b as
|
|
3
|
-
import { getStorage as
|
|
1
|
+
import { C as S, B as _, u as l, v as E, w as m, x as P, p as d, y as w, a as U } from "./cue-VOCN5IEZ.js";
|
|
2
|
+
import { b as y, c as I, d as K, e as L, f as N, g as O, h as v, i as H, j as D, k as G, l as W, m as k, n as q, o as Q, q as V, R as z, r as F, s as J, t as M } from "./cue-VOCN5IEZ.js";
|
|
3
|
+
import { getStorage as s, connectStorageEmulator as b } from "firebase/storage";
|
|
4
4
|
import "firebase/firestore";
|
|
5
|
-
class A extends
|
|
6
|
-
constructor(
|
|
7
|
-
super(
|
|
5
|
+
class A extends S {
|
|
6
|
+
constructor(t) {
|
|
7
|
+
super(t);
|
|
8
8
|
}
|
|
9
|
-
_buildApi(
|
|
10
|
-
const r =
|
|
9
|
+
_buildApi(t) {
|
|
10
|
+
const r = s(this._app, _), i = s(this._app, l), n = this._storageRaw, u = s(this._app, E), c = this._storageProcessed, e = s(this._app, m);
|
|
11
11
|
if (this._isEmulator) {
|
|
12
|
-
const
|
|
13
|
-
|
|
12
|
+
const g = this._endpoints.storageEmulatorHost, h = this._endpoints.storageEmulatorPort;
|
|
13
|
+
b(e, g, h);
|
|
14
14
|
}
|
|
15
|
-
const C = new
|
|
15
|
+
const C = s(this._app, P), p = new w({
|
|
16
16
|
storageChatSessions: r,
|
|
17
17
|
storageLogs: i,
|
|
18
18
|
storageRaw: n,
|
|
19
19
|
storagePersistence: u,
|
|
20
20
|
storageProcessed: c,
|
|
21
|
-
storagePublic: e
|
|
22
|
-
|
|
21
|
+
storagePublic: e,
|
|
22
|
+
storageSessions: C
|
|
23
|
+
}), a = new d(
|
|
23
24
|
this.auth,
|
|
24
|
-
|
|
25
|
-
|
|
25
|
+
t,
|
|
26
|
+
p,
|
|
26
27
|
this._endpoints.gatewayUrl
|
|
27
|
-
), o = new
|
|
28
|
+
), o = new U(
|
|
28
29
|
this.auth,
|
|
29
30
|
this._endpoints.gatewayUrl,
|
|
30
|
-
|
|
31
|
+
t,
|
|
31
32
|
a
|
|
32
33
|
);
|
|
33
34
|
return a._bindApi(o), o;
|
|
34
35
|
}
|
|
35
36
|
}
|
|
36
37
|
export {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
38
|
+
S as Cue,
|
|
39
|
+
U as CueApi,
|
|
40
|
+
y as CueAuth,
|
|
41
|
+
I as CueCache,
|
|
42
|
+
K as CueContexts,
|
|
43
|
+
L as CueExtraction,
|
|
44
|
+
N as CueGis,
|
|
43
45
|
A as CueNode,
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
46
|
+
O as CuePrivileges,
|
|
47
|
+
v as CueProfile,
|
|
48
|
+
H as CueProjectDocuments,
|
|
49
|
+
D as CueProjectEntities,
|
|
50
|
+
G as CueProjectSchema,
|
|
51
|
+
W as CueProjectView,
|
|
52
|
+
k as CueProjects,
|
|
53
|
+
q as CueSignal,
|
|
54
|
+
Q as CueStorage,
|
|
55
|
+
d as CueSyncApi,
|
|
56
|
+
V as CueTables,
|
|
57
|
+
z as REQUIRED_ROLES,
|
|
58
|
+
F as configureScanWasm,
|
|
59
|
+
J as cueComputed,
|
|
60
|
+
M as staleWhileRevalidate
|
|
59
61
|
};
|