@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/entities.d.ts
DELETED
|
@@ -1,187 +0,0 @@
|
|
|
1
|
-
import { CueApi } from './api';
|
|
2
|
-
import { ReadonlySignal } from './signal';
|
|
3
|
-
import { EntityDetailedData, EntityRelationships, ProjectEntitiesData, SummaryGraphData, QueryCache } from './models';
|
|
4
|
-
/**
|
|
5
|
-
* Manages entity data for a single project.
|
|
6
|
-
*
|
|
7
|
-
* ### Data model
|
|
8
|
-
* - **`entityInfoMap`** — merged per-entity signal. Recomputes reactively as
|
|
9
|
-
* any of the five underlying slices (core data, documents, relationships,
|
|
10
|
-
* OSM map, OSM WKT) change.
|
|
11
|
-
* - **`entityGraph`** — project-level category-to-category relationship graph,
|
|
12
|
-
* fetched once on construction.
|
|
13
|
-
*
|
|
14
|
-
* ### Lazy loading
|
|
15
|
-
* All public `request*` / `fetch*` methods are no-ops for UUIDs / IRIs already
|
|
16
|
-
* in the cache. Only the delta is fetched. Data is merged into the
|
|
17
|
-
* `entityInfoMap` signal incrementally — callers just react to the signal.
|
|
18
|
-
*
|
|
19
|
-
* ### Language
|
|
20
|
-
* Entity labels (`qcy:value`) are not language-tagged in the triplestore, so
|
|
21
|
-
* entity data itself is language-independent. The `language` parameter is
|
|
22
|
-
* carried here for future-proofing and forwards to the schema-level queries
|
|
23
|
-
* where language filtering does apply.
|
|
24
|
-
*
|
|
25
|
-
* ### Lifecycle
|
|
26
|
-
* Call `reset()` when the project changes. The Angular adapter calls this from
|
|
27
|
-
* the effect that watches `projectId`.
|
|
28
|
-
*
|
|
29
|
-
* @example
|
|
30
|
-
* ```ts
|
|
31
|
-
* const entities = new CueProjectEntities(cue.api, projectId);
|
|
32
|
-
* entities.requestEntityData(['uuid1', 'uuid2']);
|
|
33
|
-
* const info = entities.entityInfoMap.get()['uuid1'];
|
|
34
|
-
* ```
|
|
35
|
-
*/
|
|
36
|
-
export declare class CueProjectEntities {
|
|
37
|
-
private readonly _api;
|
|
38
|
-
private readonly _projectId;
|
|
39
|
-
private readonly _queryCache?;
|
|
40
|
-
private readonly _graphType?;
|
|
41
|
-
private readonly _verbose;
|
|
42
|
-
/** Full RDF base URL for this project, e.g. `https://cue.qaecy.com/r/{pid}/` */
|
|
43
|
-
readonly baseURL: string;
|
|
44
|
-
private readonly _entityDetails;
|
|
45
|
-
private readonly _entityDocuments;
|
|
46
|
-
private readonly _entityRelationships;
|
|
47
|
-
private readonly _entityOSMMap;
|
|
48
|
-
private readonly _osmWKTMap;
|
|
49
|
-
private readonly _fetchingOSMIds;
|
|
50
|
-
/** Cumulative unique entity UUIDs ever passed to request methods (survives cache hits). */
|
|
51
|
-
private readonly _seenIds;
|
|
52
|
-
private readonly _entityGraph;
|
|
53
|
-
private readonly _entityInfoMapComputed;
|
|
54
|
-
/** Merged per-entity detail map. Updated reactively as data arrives. */
|
|
55
|
-
readonly entityInfoMap: ReadonlySignal<Record<string, EntityDetailedData>>;
|
|
56
|
-
/** Project-level category graph (fetched once per project). */
|
|
57
|
-
readonly entityGraph: ReadonlySignal<ProjectEntitiesData | undefined>;
|
|
58
|
-
constructor(_api: CueApi, _projectId: string,
|
|
59
|
-
/** Override the RDF resource base URL. Defaults to `https://cue.qaecy.com/r/`. */
|
|
60
|
-
rdfBase?: string, _queryCache?: QueryCache | undefined, _graphType?: string | undefined, _verbose?: boolean);
|
|
61
|
-
/**
|
|
62
|
-
* Constructs the full RDF IRI for the given entity UUID.
|
|
63
|
-
* Use this to bridge the UUID-based batch APIs and the IRI-based per-entity APIs.
|
|
64
|
-
*/
|
|
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;
|
|
69
|
-
/**
|
|
70
|
-
* Resets all entity state and re-fetches the entity graph.
|
|
71
|
-
* Call when the active project changes.
|
|
72
|
-
*/
|
|
73
|
-
reset(): void;
|
|
74
|
-
/**
|
|
75
|
-
* Lazily batch-fetches core data (label + categories) for the given entity
|
|
76
|
-
* UUIDs. Already-fetched UUIDs are skipped.
|
|
77
|
-
*
|
|
78
|
-
* Data is merged into `entityInfoMap` once the SPARQL response arrives.
|
|
79
|
-
*/
|
|
80
|
-
requestEntityData(uuids: string[], includeMentionCount?: boolean): void;
|
|
81
|
-
/**
|
|
82
|
-
* Lazily fetches OSM location data for the given entity UUIDs.
|
|
83
|
-
* Already-fetched UUIDs are skipped.
|
|
84
|
-
*
|
|
85
|
-
* OSM WKT geometry is fetched in a second pass via a federated SPARQL SERVICE
|
|
86
|
-
* query and merged into `entityInfoMap` reactively once it arrives.
|
|
87
|
-
*/
|
|
88
|
-
requestEntityLocations(uuids: string[]): Promise<void>;
|
|
89
|
-
/**
|
|
90
|
-
* Fetches incoming and outgoing relationships for a single entity IRI.
|
|
91
|
-
* Neighbouring entity core data is opportunistically populated into
|
|
92
|
-
* `entityInfoMap` as a side-effect.
|
|
93
|
-
*
|
|
94
|
-
* The result is stored in `entityInfoMap[uuid].relationshipData` and also
|
|
95
|
-
* returned directly for callers that need an immediate value.
|
|
96
|
-
*/
|
|
97
|
-
fetchEntityRelationships(iri: string): Promise<EntityRelationships>;
|
|
98
|
-
/**
|
|
99
|
-
* Fetches UUIDs of documents that reference the given entity IRI.
|
|
100
|
-
* Also triggers a core-data fetch for the entity itself if not yet loaded.
|
|
101
|
-
*
|
|
102
|
-
* Returns document UUIDs. Full document data will be populated by the
|
|
103
|
-
* document service (future `CueProjectDocuments`).
|
|
104
|
-
*/
|
|
105
|
-
fetchEntityDocuments(iri: string): Promise<string[]>;
|
|
106
|
-
/**
|
|
107
|
-
* Fetches all `qcy:EntityCategory` IRIs and their preferred labels for this
|
|
108
|
-
* project. Uses `api.language` (default `'en'`);
|
|
109
|
-
* falls back to an untagged label when no match is found.
|
|
110
|
-
*/
|
|
111
|
-
contentCategoriesInProject(orderByOccurences?: boolean): Promise<{
|
|
112
|
-
iri: string;
|
|
113
|
-
label: string;
|
|
114
|
-
}[]>;
|
|
115
|
-
/**
|
|
116
|
-
* Fetches all `qcy:CanonicalEntity` instances that belong to at least one of
|
|
117
|
-
* the given category IRIs.
|
|
118
|
-
*
|
|
119
|
-
* Accepts both full HTTP IRIs and prefixed forms, e.g.:
|
|
120
|
-
* - `"qcy:Building"`
|
|
121
|
-
* - `"https://cue.qaecy.com/ontology#Building"`
|
|
122
|
-
*
|
|
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`.
|
|
126
|
-
* Use the default form when you intend to lazy-load details via `requestEntityData`.
|
|
127
|
-
*/
|
|
128
|
-
entitiesByCategory(categoryIris: string[], includeMetadata?: false): Promise<Array<{
|
|
129
|
-
iri: string;
|
|
130
|
-
uuid: string;
|
|
131
|
-
}>>;
|
|
132
|
-
entitiesByCategory(categoryIris: string[], includeMetadata: true): Promise<Array<{
|
|
133
|
-
iri: string;
|
|
134
|
-
uuid: string;
|
|
135
|
-
value: string;
|
|
136
|
-
categories: string[];
|
|
137
|
-
}>>;
|
|
138
|
-
/**
|
|
139
|
-
* Fetches a summary graph of entity category relationships for the project.
|
|
140
|
-
*
|
|
141
|
-
* Each row describes how many times entities of `sourceCat` point to
|
|
142
|
-
* entities of `targetCat` via a given `predicate`, ordered by descending
|
|
143
|
-
* occurrence count.
|
|
144
|
-
*
|
|
145
|
-
* @param format
|
|
146
|
-
* - `undefined` — raw SPARQL JSON result
|
|
147
|
-
* - `'graph'` — structured `{ entities, relations }` with predicates and weights
|
|
148
|
-
* - `'md'` — compact aligned text table
|
|
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
|
-
*
|
|
155
|
-
* @example
|
|
156
|
-
* ```ts
|
|
157
|
-
* // Structured graph (nodes + edges)
|
|
158
|
-
* const g = await entities.buildSummaryGraph('graph');
|
|
159
|
-
* // g.entities → [{ iri: 'https://…FloorPlanDrawing' }, …]
|
|
160
|
-
* // g.relations → [{ sourceID, predicate, targetID, weight }, …]
|
|
161
|
-
*
|
|
162
|
-
* // Neighbourhood of a single category (prefixed IRI)
|
|
163
|
-
* const g2 = await entities.buildSummaryGraph('graph', 'qcy:Building');
|
|
164
|
-
*
|
|
165
|
-
* // Markdown table
|
|
166
|
-
* const md = await entities.buildSummaryGraph('md');
|
|
167
|
-
* // qcy:FloorPlanDrawing -> qcy:includesBuildingEntity -> qcy:BuildingZone (5652)
|
|
168
|
-
* ```
|
|
169
|
-
*/
|
|
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;
|
|
180
|
-
private _computeEntityInfoMap;
|
|
181
|
-
private _fetchOutgoingRelationships;
|
|
182
|
-
private _fetchIncomingRelationships;
|
|
183
|
-
private _fetchEntityGraph;
|
|
184
|
-
/** Detects new OSM IRIs in the OSM map that don't yet have WKT and fetches them. */
|
|
185
|
-
private _checkPendingOSMFetches;
|
|
186
|
-
private _fetchOSMLocations;
|
|
187
|
-
}
|
package/lib/extraction.d.ts
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { CueAuth } from './auth';
|
|
2
|
-
export declare const ENDPOINT_EXTRACTION = "/semantic-extraction/extract";
|
|
3
|
-
export interface ExtractionRequest {
|
|
4
|
-
/** PNG (or other image) blob of the document page to extract from. */
|
|
5
|
-
image: Blob;
|
|
6
|
-
/** SemanticTemplate JSON object. */
|
|
7
|
-
template: object;
|
|
8
|
-
/** Project / space ID used by the extraction service. */
|
|
9
|
-
projectId: string;
|
|
10
|
-
/** IRI of the pre-selected content category; omit to let the model classify. */
|
|
11
|
-
category?: string | null;
|
|
12
|
-
/** Plain text of the page, used as additional context. */
|
|
13
|
-
text?: string | null;
|
|
14
|
-
/** Desired RDF serialisation — defaults to `'json-ld'`. */
|
|
15
|
-
rdfFormat?: 'json-ld' | 'turtle' | 'ntriples' | 'xml';
|
|
16
|
-
}
|
|
17
|
-
export interface ExtractionResponse {
|
|
18
|
-
/** Parsed JSON-LD document ready for `cue-rdf-graph`. */
|
|
19
|
-
jsonld: object;
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Client for the Cue semantic-extraction endpoint.
|
|
23
|
-
*
|
|
24
|
-
* Exposed as `cue.api.extraction`.
|
|
25
|
-
*
|
|
26
|
-
* @example
|
|
27
|
-
* ```ts
|
|
28
|
-
* const result = await cue.api.extraction.extract({
|
|
29
|
-
* image: pngBlob,
|
|
30
|
-
* template: myTemplate,
|
|
31
|
-
* projectId: 'my-project',
|
|
32
|
-
* });
|
|
33
|
-
* // result.jsonld is a JSON-LD document for cue-rdf-graph
|
|
34
|
-
* ```
|
|
35
|
-
*/
|
|
36
|
-
export declare class CueExtraction {
|
|
37
|
-
private readonly _auth;
|
|
38
|
-
private readonly _gatewayUrl;
|
|
39
|
-
constructor(_auth: CueAuth, _gatewayUrl: string);
|
|
40
|
-
/**
|
|
41
|
-
* Run semantic extraction on a document page image.
|
|
42
|
-
*
|
|
43
|
-
* Sends a multipart/form-data POST to `/semantic-extraction/extract`.
|
|
44
|
-
* Always requests JSON-LD so the result can be displayed directly in
|
|
45
|
-
* `cue-rdf-graph` without any further parsing.
|
|
46
|
-
*/
|
|
47
|
-
extract(request: ExtractionRequest): Promise<ExtractionResponse>;
|
|
48
|
-
}
|
package/lib/gis.d.ts
DELETED
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
import { BBox, FeatureCategory, FeatureCategoryDescriptor, GisFeature } from 'js/cue-gis';
|
|
2
|
-
export type GisBBox = BBox;
|
|
3
|
-
export type { FeatureCategory };
|
|
4
|
-
export type GisCategoryDescriptor = FeatureCategoryDescriptor;
|
|
5
|
-
export type { GisFeature };
|
|
6
|
-
export type GisFeaturesMap = Map<FeatureCategory, GisFeature[]>;
|
|
7
|
-
type Listener<T> = (value: T) => void;
|
|
8
|
-
/**
|
|
9
|
-
* Reactive GIS service, exposed lazily as `cue.gis`.
|
|
10
|
-
*
|
|
11
|
-
* Push-based: consumers set the active bbox and selected categories; results are
|
|
12
|
-
* delivered via subscription callbacks. All debouncing and request cancellation
|
|
13
|
-
* are handled internally.
|
|
14
|
-
*
|
|
15
|
-
* @example
|
|
16
|
-
* ```ts
|
|
17
|
-
* cue.gis.setProjectId('my-project-id');
|
|
18
|
-
* cue.gis.onAvailableCategories(cats => console.log(cats));
|
|
19
|
-
*
|
|
20
|
-
* // On every map pan/zoom:
|
|
21
|
-
* cue.gis.setBbox([west, south, east, north]);
|
|
22
|
-
*
|
|
23
|
-
* // When the user toggles a category:
|
|
24
|
-
* cue.gis.setSelectedCategories(new Set(['cadastre', 'building']));
|
|
25
|
-
*
|
|
26
|
-
* // Cleanup:
|
|
27
|
-
* cue.gis.destroy();
|
|
28
|
-
* ```
|
|
29
|
-
*/
|
|
30
|
-
export declare class CueGis {
|
|
31
|
-
private readonly _getAuthHeaders;
|
|
32
|
-
private readonly _gatewayUrl;
|
|
33
|
-
private _bbox;
|
|
34
|
-
private _projectId;
|
|
35
|
-
private _selectedCategories;
|
|
36
|
-
private _queryToken;
|
|
37
|
-
private _categoryTokens;
|
|
38
|
-
private _debounceTimer;
|
|
39
|
-
private _availableCategories;
|
|
40
|
-
private _features;
|
|
41
|
-
private readonly _catListeners;
|
|
42
|
-
private readonly _featListeners;
|
|
43
|
-
private readonly _loadListeners;
|
|
44
|
-
private _gatewayCache;
|
|
45
|
-
private _gatewayProjectId;
|
|
46
|
-
/** @internal — construct via `cue.gis`, not directly. */
|
|
47
|
-
constructor(_getAuthHeaders: () => Promise<Record<string, string>>, _gatewayUrl: string);
|
|
48
|
-
/**
|
|
49
|
-
* Update the current map viewport.
|
|
50
|
-
* Triggers a debounced query for available categories and reloads selected ones.
|
|
51
|
-
*/
|
|
52
|
-
setBbox(bbox: BBox): void;
|
|
53
|
-
/**
|
|
54
|
-
* Set or clear the active project.
|
|
55
|
-
* Rebuilds the authenticated adapter so subsequent requests carry the new project header.
|
|
56
|
-
*/
|
|
57
|
-
setProjectId(projectId: string | null): void;
|
|
58
|
-
/**
|
|
59
|
-
* Replace the full set of selected categories.
|
|
60
|
-
* Newly added categories begin loading immediately; removed categories are cleared.
|
|
61
|
-
*/
|
|
62
|
-
setSelectedCategories(categories: Set<FeatureCategory>): void;
|
|
63
|
-
/**
|
|
64
|
-
* Subscribe to available-category updates.
|
|
65
|
-
* Replays the current value immediately, then fires on every bbox change.
|
|
66
|
-
* @returns An unsubscribe function.
|
|
67
|
-
*/
|
|
68
|
-
onAvailableCategories(cb: Listener<GisCategoryDescriptor[]>): () => void;
|
|
69
|
-
/**
|
|
70
|
-
* Subscribe to the feature map (category → GisFeature[]).
|
|
71
|
-
* Replays the current value immediately, then fires whenever features change.
|
|
72
|
-
* @returns An unsubscribe function.
|
|
73
|
-
*/
|
|
74
|
-
onFeaturesChange(cb: Listener<GisFeaturesMap>): () => void;
|
|
75
|
-
/**
|
|
76
|
-
* Subscribe to the global loading state.
|
|
77
|
-
* Fires `true` while the category list is being queried, `false` when done.
|
|
78
|
-
* @returns An unsubscribe function.
|
|
79
|
-
*/
|
|
80
|
-
onLoadingChange(cb: Listener<boolean>): () => void;
|
|
81
|
-
/** Cancel all pending requests and clear all listeners. */
|
|
82
|
-
destroy(): void;
|
|
83
|
-
private _scheduleDebouncedQuery;
|
|
84
|
-
private _getGateway;
|
|
85
|
-
private _queryLayers;
|
|
86
|
-
private _loadCategory;
|
|
87
|
-
private _emitFeatures;
|
|
88
|
-
private _emitLoading;
|
|
89
|
-
}
|
package/lib/index-api.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { CueAuth } from './auth';
|
|
2
|
-
import { IndexSearchRequest, IndexSearchResponse } from './models';
|
|
3
|
-
export declare class CueIndexApi {
|
|
4
|
-
private readonly _auth;
|
|
5
|
-
private readonly _gatewayUrl;
|
|
6
|
-
constructor(_auth: CueAuth, _gatewayUrl: string);
|
|
7
|
-
search(input: string, projectId: string, opts?: Omit<IndexSearchRequest, 'input'>): Promise<IndexSearchResponse>;
|
|
8
|
-
lookup(input: string, projectId: string, opts?: {
|
|
9
|
-
aggregate?: boolean;
|
|
10
|
-
}): Promise<IndexSearchResponse>;
|
|
11
|
-
}
|