@qaecy/cue-sdk 0.0.27 → 0.0.28
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 +99 -0
- package/{cue-CzxsQ6aP.js → cue-BR7V1Nem.js} +923 -841
- package/index.js +1 -1
- package/lib/documents.d.ts +59 -0
- package/lib/entities.d.ts +22 -0
- package/node.js +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -234,6 +234,43 @@ const project = await cue.api.projects.createProject({
|
|
|
234
234
|
|
|
235
235
|
Entity data for a project is accessed via a `CueProjectView`. Create a view with `cue.createProjectView(projectId)` and use `view.entities` (`CueProjectEntities`) for all entity-level operations.
|
|
236
236
|
|
|
237
|
+
### `view.entities.entitiesByCategory(categoryIris, includeMetadata?)`
|
|
238
|
+
|
|
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
|
+
|
|
241
|
+
By default returns only `{ iri, uuid }` — suitable for feeding directly into `requestEntityData()` for lazy detail loading. Pass `true` to also receive `value` and `categories`.
|
|
242
|
+
|
|
243
|
+
```typescript
|
|
244
|
+
// Lean — just IRIs + UUIDs (default)
|
|
245
|
+
const entities = await view.entities.entitiesByCategory([
|
|
246
|
+
'qcy:Building',
|
|
247
|
+
'qcy:BuildingStorey',
|
|
248
|
+
]);
|
|
249
|
+
const uuids = entities.map((e) => e.uuid);
|
|
250
|
+
view.entities.requestEntityData(uuids); // lazy-loads labels + categories
|
|
251
|
+
|
|
252
|
+
// With metadata
|
|
253
|
+
const entities = await view.entities.entitiesByCategory(
|
|
254
|
+
['https://cue.qaecy.com/ontology#Building'],
|
|
255
|
+
true,
|
|
256
|
+
);
|
|
257
|
+
entities.forEach((e) => console.log(e.uuid, e.value, e.categories));
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
| Parameter | Type | Description |
|
|
261
|
+
|---|---|---|
|
|
262
|
+
| `categoryIris` | `string[]` | Full IRIs (`https://…`) or prefixed forms (`qcy:…`) |
|
|
263
|
+
| `includeMetadata` | `boolean` | `false` (default) → `{ iri, uuid }[]`; `true` → adds `value` and `categories` |
|
|
264
|
+
|
|
265
|
+
### `view.entities.contentCategoriesInProject(orderByOccurrences?)`
|
|
266
|
+
|
|
267
|
+
Fetch all `qcy:EntityCategory` IRIs present in this project with their preferred labels:
|
|
268
|
+
|
|
269
|
+
```typescript
|
|
270
|
+
const cats = await view.entities.contentCategoriesInProject();
|
|
271
|
+
cats.forEach((c) => console.log(c.iri, c.label));
|
|
272
|
+
```
|
|
273
|
+
|
|
237
274
|
### `view.entities.buildSummaryGraph(format?)`
|
|
238
275
|
|
|
239
276
|
Fetches a project-level summary of entity category relationships: how many times entities of one category point to entities of another via each predicate, ordered by descending occurrence count.
|
|
@@ -258,6 +295,68 @@ const md = await view.entities.buildSummaryGraph('md');
|
|
|
258
295
|
const raw = await view.entities.buildSummaryGraph();
|
|
259
296
|
```
|
|
260
297
|
|
|
298
|
+
## Documents
|
|
299
|
+
|
|
300
|
+
Document data for a project is accessed via `view.documents` (`CueProjectDocuments`). Use `fetchOverview()` to get aggregate counts and the methods below to retrieve document lists.
|
|
301
|
+
|
|
302
|
+
### `view.documents.documentsBySuffix(suffixes, includeMetadata?)`
|
|
303
|
+
|
|
304
|
+
Fetch all documents whose file extension matches one of the given suffixes. The leading dot is optional — both `'ifc'` and `'.ifc'` are accepted.
|
|
305
|
+
|
|
306
|
+
By default returns only `{ iri, uuid }` for pairing with `requestDocumentData()`. Pass `true` to also receive `path`, `suffix`, and `size`.
|
|
307
|
+
|
|
308
|
+
```typescript
|
|
309
|
+
// Lean — just IRIs + UUIDs (default)
|
|
310
|
+
const docs = await view.documents.documentsBySuffix(['.ifc', '.rvt']);
|
|
311
|
+
view.documents.requestDocumentData(docs.map((d) => d.uuid));
|
|
312
|
+
|
|
313
|
+
// With file metadata
|
|
314
|
+
const docs = await view.documents.documentsBySuffix(['pdf', 'docx'], true);
|
|
315
|
+
docs.forEach((d) => console.log(d.path, d.suffix, d.size));
|
|
316
|
+
```
|
|
317
|
+
|
|
318
|
+
### `view.documents.documentsByFileType(fileTypes, includeMetadata?)`
|
|
319
|
+
|
|
320
|
+
Fetch documents by semantic `FileType` category. Resolves all matching suffixes automatically from the built-in `fileExtensionsInfo` map.
|
|
321
|
+
|
|
322
|
+
```typescript
|
|
323
|
+
import { FileType } from 'js/models';
|
|
324
|
+
|
|
325
|
+
// All BIM and CAD files
|
|
326
|
+
const docs = await view.documents.documentsByFileType([
|
|
327
|
+
FileType.BIM,
|
|
328
|
+
FileType.CAD,
|
|
329
|
+
]);
|
|
330
|
+
|
|
331
|
+
// With metadata
|
|
332
|
+
const docs = await view.documents.documentsByFileType([FileType.IMAGE], true);
|
|
333
|
+
```
|
|
334
|
+
|
|
335
|
+
### `view.documents.documentsByMime(mimeTypes, includeMetadata?)`
|
|
336
|
+
|
|
337
|
+
Fetch documents whose MIME type matches one of the given strings:
|
|
338
|
+
|
|
339
|
+
```typescript
|
|
340
|
+
const docs = await view.documents.documentsByMime([
|
|
341
|
+
'application/x-step', // .ifc
|
|
342
|
+
'application/pdf',
|
|
343
|
+
]);
|
|
344
|
+
|
|
345
|
+
// With metadata
|
|
346
|
+
const docs = await view.documents.documentsByMime(
|
|
347
|
+
['image/png', 'image/jpeg'],
|
|
348
|
+
true,
|
|
349
|
+
);
|
|
350
|
+
```
|
|
351
|
+
|
|
352
|
+
| Method | Filters by | Extra metadata (`true`) |
|
|
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.
|
|
359
|
+
|
|
261
360
|
## Node.js — file sync
|
|
262
361
|
|
|
263
362
|
For server-side or CLI use with file-sync capabilities, import from `@qaecy/cue-sdk/node`:
|