@qaecy/cue-sdk 0.0.28 → 0.0.29
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 +17 -19
- package/{cue-BR7V1Nem.js → cue-CnZyGMRG.js} +21 -31
- package/index.js +1 -1
- package/lib/documents.d.ts +3 -12
- package/lib/entities.d.ts +3 -6
- package/node.js +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -238,15 +238,14 @@ Entity data for a project is accessed via a `CueProjectView`. Create a view with
|
|
|
238
238
|
|
|
239
239
|
Fetch all canonical entities that belong to at least one of the given category IRIs. Accepts both full HTTP IRIs and prefixed forms.
|
|
240
240
|
|
|
241
|
-
By default returns
|
|
241
|
+
By default returns a `string[]` of UUIDs — suitable for feeding directly into `requestEntityData()` for lazy detail loading. Pass `true` to also receive `iri`, `value`, and `categories`.
|
|
242
242
|
|
|
243
243
|
```typescript
|
|
244
|
-
// Lean — just
|
|
245
|
-
const
|
|
244
|
+
// Lean — just UUIDs (default)
|
|
245
|
+
const uuids = await view.entities.entitiesByCategory([
|
|
246
246
|
'qcy:Building',
|
|
247
247
|
'qcy:BuildingStorey',
|
|
248
248
|
]);
|
|
249
|
-
const uuids = entities.map((e) => e.uuid);
|
|
250
249
|
view.entities.requestEntityData(uuids); // lazy-loads labels + categories
|
|
251
250
|
|
|
252
251
|
// With metadata
|
|
@@ -260,7 +259,7 @@ entities.forEach((e) => console.log(e.uuid, e.value, e.categories));
|
|
|
260
259
|
| Parameter | Type | Description |
|
|
261
260
|
|---|---|---|
|
|
262
261
|
| `categoryIris` | `string[]` | Full IRIs (`https://…`) or prefixed forms (`qcy:…`) |
|
|
263
|
-
| `includeMetadata` | `boolean` | `false` (default) → `
|
|
262
|
+
| `includeMetadata` | `boolean` | `false` (default) → `string[]` UUIDs; `true` → adds `iri`, `value`, and `categories` |
|
|
264
263
|
|
|
265
264
|
### `view.entities.contentCategoriesInProject(orderByOccurrences?)`
|
|
266
265
|
|
|
@@ -303,12 +302,12 @@ Document data for a project is accessed via `view.documents` (`CueProjectDocumen
|
|
|
303
302
|
|
|
304
303
|
Fetch all documents whose file extension matches one of the given suffixes. The leading dot is optional — both `'ifc'` and `'.ifc'` are accepted.
|
|
305
304
|
|
|
306
|
-
By default returns
|
|
305
|
+
By default returns a `string[]` of UUIDs — suitable for feeding directly into `requestDocumentData()`. Pass `true` to also receive `path`, `suffix`, and `size`.
|
|
307
306
|
|
|
308
307
|
```typescript
|
|
309
|
-
// Lean — just
|
|
310
|
-
const
|
|
311
|
-
view.documents.requestDocumentData(
|
|
308
|
+
// Lean — just UUIDs (default)
|
|
309
|
+
const uuids = await view.documents.documentsBySuffix(['.ifc', '.rvt']);
|
|
310
|
+
view.documents.requestDocumentData(uuids);
|
|
312
311
|
|
|
313
312
|
// With file metadata
|
|
314
313
|
const docs = await view.documents.documentsBySuffix(['pdf', 'docx'], true);
|
|
@@ -322,8 +321,8 @@ Fetch documents by semantic `FileType` category. Resolves all matching suffixes
|
|
|
322
321
|
```typescript
|
|
323
322
|
import { FileType } from 'js/models';
|
|
324
323
|
|
|
325
|
-
// All BIM and CAD files
|
|
326
|
-
const
|
|
324
|
+
// All BIM and CAD files — just UUIDs
|
|
325
|
+
const uuids = await view.documents.documentsByFileType([
|
|
327
326
|
FileType.BIM,
|
|
328
327
|
FileType.CAD,
|
|
329
328
|
]);
|
|
@@ -337,7 +336,8 @@ const docs = await view.documents.documentsByFileType([FileType.IMAGE], true);
|
|
|
337
336
|
Fetch documents whose MIME type matches one of the given strings:
|
|
338
337
|
|
|
339
338
|
```typescript
|
|
340
|
-
|
|
339
|
+
// Just UUIDs
|
|
340
|
+
const uuids = await view.documents.documentsByMime([
|
|
341
341
|
'application/x-step', // .ifc
|
|
342
342
|
'application/pdf',
|
|
343
343
|
]);
|
|
@@ -349,13 +349,11 @@ const docs = await view.documents.documentsByMime(
|
|
|
349
349
|
);
|
|
350
350
|
```
|
|
351
351
|
|
|
352
|
-
| Method | Filters by |
|
|
353
|
-
|
|
354
|
-
| `documentsBySuffix` | File extension string(s) | `path`, `suffix`, `size` |
|
|
355
|
-
| `documentsByFileType` | `FileType` enum value(s) | `path`, `suffix`, `size` |
|
|
356
|
-
| `documentsByMime` | MIME type string(s) | `path`, `suffix`, `size` |
|
|
357
|
-
|
|
358
|
-
All three exclude alternative representations (e.g. derived `.fragments` tiles) from results.
|
|
352
|
+
| Method | Filters by | Default return | With `true` |
|
|
353
|
+
|---|---|---|---|
|
|
354
|
+
| `documentsBySuffix` | File extension string(s) | `string[]` UUIDs | adds `iri`, `path`, `suffix`, `size` |
|
|
355
|
+
| `documentsByFileType` | `FileType` enum value(s) | `string[]` UUIDs | adds `iri`, `path`, `suffix`, `size` |
|
|
356
|
+
| `documentsByMime` | MIME type string(s) | `string[]` UUIDs | adds `iri`, `path`, `suffix`, `size` |
|
|
359
357
|
|
|
360
358
|
## Node.js — file sync
|
|
361
359
|
|
|
@@ -6507,31 +6507,26 @@ WHERE {
|
|
|
6507
6507
|
qcy:hasEntityCategory ?filterCat ;
|
|
6508
6508
|
qcy:value ?val ;
|
|
6509
6509
|
qcy:hasEntityCategory ?allCat .
|
|
6510
|
-
BIND(REPLACE(STR(?iri), "^.*/
|
|
6510
|
+
BIND(REPLACE(STR(?iri), "^.*/", "") AS ?id)
|
|
6511
6511
|
}
|
|
6512
6512
|
GROUP BY ?iri ?id` : `PREFIX qcy: <${y.qcy}>
|
|
6513
|
-
SELECT DISTINCT ?
|
|
6513
|
+
SELECT DISTINCT ?id
|
|
6514
6514
|
WHERE {
|
|
6515
6515
|
VALUES ?filterCat { ${s} }
|
|
6516
6516
|
?iri a qcy:CanonicalEntity ;
|
|
6517
6517
|
qcy:hasEntityCategory ?filterCat .
|
|
6518
|
-
BIND(REPLACE(STR(?iri), "^.*/
|
|
6519
|
-
}
|
|
6520
|
-
return (await this._api.sparql(
|
|
6518
|
+
BIND(REPLACE(STR(?iri), "^.*/", "") AS ?id)
|
|
6519
|
+
}`, n = await this._api.sparql(
|
|
6521
6520
|
a,
|
|
6522
6521
|
this._projectId,
|
|
6523
6522
|
this._graphType
|
|
6524
|
-
)).results.bindings.filter((p) => p.iri && p.id).map(
|
|
6525
|
-
(p) => e ? {
|
|
6526
|
-
iri: p.iri.value,
|
|
6527
|
-
uuid: p.id.value,
|
|
6528
|
-
value: p.value?.value ?? "",
|
|
6529
|
-
categories: p.categories?.value?.split(";").filter(Boolean) ?? []
|
|
6530
|
-
} : {
|
|
6531
|
-
iri: p.iri.value,
|
|
6532
|
-
uuid: p.id.value
|
|
6533
|
-
}
|
|
6534
6523
|
);
|
|
6524
|
+
return e ? n.results.bindings.filter((p) => p.iri && p.id).map((p) => ({
|
|
6525
|
+
iri: p.iri.value,
|
|
6526
|
+
uuid: p.id.value,
|
|
6527
|
+
value: p.value?.value ?? "",
|
|
6528
|
+
categories: p.categories?.value?.split(";").filter(Boolean) ?? []
|
|
6529
|
+
})) : n.results.bindings.filter((p) => p.id).map((p) => p.id.value);
|
|
6535
6530
|
}
|
|
6536
6531
|
async buildSummaryGraph(t) {
|
|
6537
6532
|
const e = `PREFIX qcy: <${y.qcy}>
|
|
@@ -7810,29 +7805,24 @@ WHERE {
|
|
|
7810
7805
|
?loc qcy:suffix ?suffix ;
|
|
7811
7806
|
qcy:filePath ?fp .
|
|
7812
7807
|
FILTER NOT EXISTS { ?x qcy:alternativeRepresentation ?iri }
|
|
7813
|
-
BIND(REPLACE(STR(?iri), "^.*/
|
|
7808
|
+
BIND(REPLACE(STR(?iri), "^.*/", "") AS ?id)
|
|
7814
7809
|
}
|
|
7815
7810
|
GROUP BY ?iri ?id ?suffix` : `PREFIX qcy: <${y.qcy}>
|
|
7816
|
-
SELECT DISTINCT ?
|
|
7811
|
+
SELECT DISTINCT ?id
|
|
7817
7812
|
WHERE {
|
|
7818
7813
|
VALUES ?suffix { ${r} }
|
|
7819
7814
|
?iri a qcy:FileContent ;
|
|
7820
7815
|
qcy:hasFileLocation/qcy:suffix ?suffix .
|
|
7821
7816
|
FILTER NOT EXISTS { ?x qcy:alternativeRepresentation ?iri }
|
|
7822
|
-
BIND(REPLACE(STR(?iri), "^.*/
|
|
7823
|
-
}
|
|
7824
|
-
return
|
|
7825
|
-
|
|
7826
|
-
|
|
7827
|
-
|
|
7828
|
-
|
|
7829
|
-
|
|
7830
|
-
|
|
7831
|
-
} : {
|
|
7832
|
-
iri: n.iri.value,
|
|
7833
|
-
uuid: n.id.value
|
|
7834
|
-
}
|
|
7835
|
-
);
|
|
7817
|
+
BIND(REPLACE(STR(?iri), "^.*/", "") AS ?id)
|
|
7818
|
+
}`, a = await this._api.sparql(s, this._projectId, this._graphType);
|
|
7819
|
+
return e ? a.results.bindings.filter((n) => n.iri && n.id).map((n) => ({
|
|
7820
|
+
iri: n.iri.value,
|
|
7821
|
+
uuid: n.id.value,
|
|
7822
|
+
path: n.path?.value ?? "",
|
|
7823
|
+
suffix: n.suffix?.value ?? "",
|
|
7824
|
+
size: n.size ? parseInt(n.size.value, 10) : 0
|
|
7825
|
+
})) : a.results.bindings.filter((n) => n.id).map((n) => n.id.value);
|
|
7836
7826
|
}
|
|
7837
7827
|
documentsByFileType(t, e = !1) {
|
|
7838
7828
|
const o = new Set(t), r = Object.values(lt).filter((s) => o.has(s.type)).map((s) => s.suffix);
|
package/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as s, a as u, b as C, c as t, d as i, e as c, f as o, g as r, h as l, i as n, j as P, k as j, l as m, m as S, n as g, o as h, p, R as E, q as R, r as f, s as d } from "./cue-
|
|
1
|
+
import { C as s, a as u, b as C, c as t, d as i, e as c, f as o, g as r, h as l, i as n, j as P, k as j, l as m, m as S, n as g, o as h, p, R as E, q as R, r as f, s as d } from "./cue-CnZyGMRG.js";
|
|
2
2
|
export {
|
|
3
3
|
s as Cue,
|
|
4
4
|
u as CueApi,
|
package/lib/documents.d.ts
CHANGED
|
@@ -134,10 +134,7 @@ export declare class CueProjectDocuments {
|
|
|
134
134
|
* Suffixes are matched case-insensitively and the leading dot is optional
|
|
135
135
|
* (both `'ifc'` and `'.ifc'` are accepted).
|
|
136
136
|
*/
|
|
137
|
-
documentsBySuffix(suffixes: string[], includeMetadata?: false): Promise<
|
|
138
|
-
iri: string;
|
|
139
|
-
uuid: string;
|
|
140
|
-
}>>;
|
|
137
|
+
documentsBySuffix(suffixes: string[], includeMetadata?: false): Promise<string[]>;
|
|
141
138
|
documentsBySuffix(suffixes: string[], includeMetadata: true): Promise<Array<{
|
|
142
139
|
iri: string;
|
|
143
140
|
uuid: string;
|
|
@@ -152,10 +149,7 @@ export declare class CueProjectDocuments {
|
|
|
152
149
|
* Resolves matching suffixes from `fileExtensionsInfo` and delegates to
|
|
153
150
|
* `documentsBySuffix`. Accepts the same `includeMetadata` flag.
|
|
154
151
|
*/
|
|
155
|
-
documentsByFileType(fileTypes: FileType[], includeMetadata?: false): Promise<
|
|
156
|
-
iri: string;
|
|
157
|
-
uuid: string;
|
|
158
|
-
}>>;
|
|
152
|
+
documentsByFileType(fileTypes: FileType[], includeMetadata?: false): Promise<string[]>;
|
|
159
153
|
documentsByFileType(fileTypes: FileType[], includeMetadata: true): Promise<Array<{
|
|
160
154
|
iri: string;
|
|
161
155
|
uuid: string;
|
|
@@ -170,10 +164,7 @@ export declare class CueProjectDocuments {
|
|
|
170
164
|
* Resolves matching suffixes from `fileExtensionsInfo` and delegates to
|
|
171
165
|
* `documentsBySuffix`. Accepts the same `includeMetadata` flag.
|
|
172
166
|
*/
|
|
173
|
-
documentsByMime(mimeTypes: string[], includeMetadata?: false): Promise<
|
|
174
|
-
iri: string;
|
|
175
|
-
uuid: string;
|
|
176
|
-
}>>;
|
|
167
|
+
documentsByMime(mimeTypes: string[], includeMetadata?: false): Promise<string[]>;
|
|
177
168
|
documentsByMime(mimeTypes: string[], includeMetadata: true): Promise<Array<{
|
|
178
169
|
iri: string;
|
|
179
170
|
uuid: string;
|
package/lib/entities.d.ts
CHANGED
|
@@ -114,14 +114,11 @@ export declare class CueProjectEntities {
|
|
|
114
114
|
* - `"qcy:Building"`
|
|
115
115
|
* - `"https://cue.qaecy.com/ontology#Building"`
|
|
116
116
|
*
|
|
117
|
-
* By default returns only
|
|
118
|
-
* also get `value
|
|
117
|
+
* By default returns only UUIDs (`string[]`) — pass `includeMetadata: true` to
|
|
118
|
+
* also get `iri`, `value`, and `categories` (all categories, not just the filtered ones).
|
|
119
119
|
* Use the default form when you intend to lazy-load details via `requestEntityData`.
|
|
120
120
|
*/
|
|
121
|
-
entitiesByCategory(categoryIris: string[], includeMetadata?: false): Promise<
|
|
122
|
-
iri: string;
|
|
123
|
-
uuid: string;
|
|
124
|
-
}>>;
|
|
121
|
+
entitiesByCategory(categoryIris: string[], includeMetadata?: false): Promise<string[]>;
|
|
125
122
|
entitiesByCategory(categoryIris: string[], includeMetadata: true): Promise<Array<{
|
|
126
123
|
iri: string;
|
|
127
124
|
uuid: string;
|
package/node.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { C as h, B as l, t as _, u as E, v as S, o as m, w as P, a as d } from "./cue-
|
|
2
|
-
import { b as j, c as x, d as y, e as I, f as K, g as L, h as v, i as H, j as N, k as O, l as D, m as G, n as W, p as k, R as q, q as Q, r as V, s as z } from "./cue-
|
|
1
|
+
import { C as h, B as l, t as _, u as E, v as S, o as m, w as P, a as d } from "./cue-CnZyGMRG.js";
|
|
2
|
+
import { b as j, c as x, d as y, e as I, f as K, g as L, h as v, i as H, j as N, k as O, l as D, m as G, n as W, p as k, R as q, q as Q, r as V, s as z } from "./cue-CnZyGMRG.js";
|
|
3
3
|
import { getStorage as t, connectStorageEmulator as w } from "firebase/storage";
|
|
4
4
|
import "firebase/firestore";
|
|
5
5
|
class A extends h {
|